diff --git a/.dockerignore b/.dockerignore index e0cc9dc3..7eb3a0b5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,4 @@ .github .editorconfig -**/node_modules \ No newline at end of file +.turbo +**/node_modules diff --git a/.eslintignore b/.eslintignore index 65347b11..6ce2af6e 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,14 +4,14 @@ noble-ed25519.js hpke-core.js # Built -dist/ +**/dist/ build/ out/ *.min.js *.min.css *.bundle.js +bundle.*.js coverage/ -.next/ .cache/ -node_modules/ +**/node_modules/ diff --git a/.github/actions/build-check/action.yml b/.github/actions/build-check/action.yml deleted file mode 100644 index 5be7d7ea..00000000 --- a/.github/actions/build-check/action.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: "Git check" -description: "Git sanity checks" - -runs: - using: "composite" - - steps: - - name: Is Git clean? - run: | - if [ -z "$( git status --porcelain )" ]; then - echo "Git is clean!" - exit 0 - else - echo "Git is dirty!" - git add -A - git --no-pager diff HEAD - exit 1 - fi - shell: bash \ No newline at end of file diff --git a/.github/scripts/get-turbo-affected.sh b/.github/scripts/get-turbo-affected.sh new file mode 100755 index 00000000..e48deef5 --- /dev/null +++ b/.github/scripts/get-turbo-affected.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +BASE=$1 +COMPARE=$2 + +# If there is no base to compare against, we return an everything filter +# +# This is a scenario for on: push workflow triggers where github.base_ref is empty +if [[ -z "$BASE" ]]; then + echo "*" + exit 0 +fi + +# Empty compare means the tip of the current branch +if [[ -z "$COMPARE" ]]; then + COMPARE="HEAD" +fi + +# We return a turbo filter for affected packages between the two branches +# +# See https://turborepo.dev/docs/reference/run#--filter-string for more info +echo "...[$BASE...$COMPARE]" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1398ad31..75b9711d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,154 +8,11 @@ on: workflow_dispatch: # Allows manual invocation jobs: - tests: - runs-on: ubuntu-latest - strategy: - matrix: - directory: - [ - 'auth', - 'export', - 'import', - 'export-and-sign', - 'oauth-origin', - 'oauth-redirect', - 'shared', - ] - - steps: - - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - # https://github.com/actions/setup-node - - name: Install Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version-file: ".nvmrc" - package-manager-cache: false - - # Some frames (like import/export-and-sign) depend on code in ./shared. - # Ensure shared's dependencies (including bech32) are installed before running their tests. - - name: Install Dependencies for shared (for dependent frames) - if: ${{ matrix.directory == 'import' || matrix.directory == 'export-and-sign' }} - working-directory: ./shared - run: npm install - - - name: Install Dependencies for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm install - - - name: Check Provenance Attestations for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm audit signatures - - - name: Run Tests for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm test - - format: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - directory: - [ - 'auth', - 'export', - 'import', - 'export-and-sign', - 'oauth-origin', - 'oauth-redirect', - 'shared', - ] - - steps: - - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - # https://github.com/actions/setup-node - - name: Install Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version-file: ".nvmrc" - package-manager-cache: false - - - name: Install Dependencies for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm install - - - name: Run Prettier Check for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm run prettier:check + build: + name: Build + uses: ./.github/workflows/reusable-build.yml - lint: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - directory: - [ - 'auth', - 'export', - 'import', - 'export-and-sign', - 'oauth-origin', - 'oauth-redirect', - 'shared', - ] - - steps: - - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - # https://github.com/actions/setup-node - - name: Install Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version-file: ".nvmrc" - package-manager-cache: false - - - name: Install Dependencies for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm install - - - name: Run ESLint for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm run lint - - build-check: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - directory: - [ - 'import', - 'export-and-sign', - ] - - steps: - - name: Checkout - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 - - # https://github.com/actions/setup-node - - name: Install Node.js - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version-file: ".nvmrc" - package-manager-cache: false - - - name: Install Dependencies for shared - working-directory: ./shared - run: npm install - - - name: Install Dependencies for ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm install - - - name: Build ${{ matrix.directory }} - working-directory: ./${{ matrix.directory }} - run: npm run build - - - name: Check dist folder matches committed version - uses: ./.github/actions/build-check + tests: + name: Test + needs: build + uses: ./.github/workflows/reusable-test.yml diff --git a/.github/workflows/reusable-build.yml b/.github/workflows/reusable-build.yml new file mode 100644 index 00000000..4be57a77 --- /dev/null +++ b/.github/workflows/reusable-build.yml @@ -0,0 +1,43 @@ +name: Build + +on: + workflow_call: + +env: + NODE_ENV: production + +jobs: + build: + runs-on: 16-core-runner-fren-1 + + steps: + # https://github.com/actions/checkout + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + + # Install and cache JS toolchain and dependencies (node_modules) + - name: Setup JS + uses: ./.github/actions/js-setup + + # Just to stay on the safe side + - name: Clean + run: pnpm clean + + # Build task depends on lint & prettier:write + - name: Build + run: pnpm build + + - name: Check formatting + run: pnpm prettier:check + + - name: Ensure git is clean + run: | + if [ -z "$( git status --porcelain )" ]; then + echo "Git is clean!" + exit 0 + else + echo "Git is dirty!" + git add -A + git --no-pager diff HEAD + exit 1 + fi diff --git a/.github/workflows/reusable-test.yml b/.github/workflows/reusable-test.yml new file mode 100644 index 00000000..0a6c3779 --- /dev/null +++ b/.github/workflows/reusable-test.yml @@ -0,0 +1,37 @@ +name: Test + +on: + workflow_call: + +env: + NODE_ENV: production + +jobs: + test: + runs-on: ubuntu-latest + steps: + # https://github.com/actions/checkout + - name: Checkout + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + fetch-depth: 0 # We need the full history to be able to calculate the affected packages with turbo + + # Install and cache JS toolchain and dependencies (node_modules) + - name: Setup JS + uses: ./.github/actions/js-setup + + - name: Build + run: pnpm build + + - name: Fetch base branch + if: ${{ github.base_ref }} + run: git fetch origin ${{ github.base_ref }} + + - name: Test + run: | + BASE_REF=${{ github.base_ref && format('origin/{0}', github.base_ref) }} + FILTER=$(./.github/scripts/get-turbo-affected.sh "$BASE_REF" HEAD) + + pnpm test --concurrency=1 --filter="$FILTER" + env: + NODE_ENV: development diff --git a/.gitignore b/.gitignore index 3c3629e6..2a65ac8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,6 @@ node_modules +.rollup.cache +.turbo +.DS_Store + +.env.* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 5f3016d2..641de02f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,43 +1,158 @@ ARG NODE_VERSION=24.11.0 -# Multi-stage build: first stage for building webpack bundles -FROM node:${NODE_VERSION}-bullseye-slim AS builder +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Base image that comes with node, rust & foundry +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +FROM node:$NODE_VERSION-alpine AS base + +# Environment setup +ENV PNPM_HOME="/pnpm" + +# We need to set the CI flag so that pnpm does not ask whether it should +# reinstall the modules +# +# See https://github.com/pnpm/pnpm/issues/6615 +ENV CI=1 + +# Paths +ENV PATH="${PNPM_HOME}:${PATH}" + +# Update system packages +RUN apk update --no-cache +RUN apk upgrade --no-cache + +# Required system packages +RUN apk add --no-cache curl + +# Enable corepack so that we have access to pnpm +RUN corepack enable + +# Output versions +RUN node --version +RUN npm --version +RUN pnpm --version + +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Image that prepares the workspace +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +FROM base AS workspace WORKDIR /app -# Copy shared directory first (needed by export-and-sign and import) -COPY shared ./shared/ -RUN cd shared && npm ci +# Get the pnpm files so that we can install all dependencies +COPY pnpm-*.yaml ./ + +# Fetch all the dependencies +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store\ + pnpm fetch --frozen-lockfile + +# Get the source code +COPY . . + +# Install the dependencies +RUN --mount=type=cache,id=pnpm-store,target=/pnpm/store\ + pnpm install --frozen-lockfile + +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Image for development +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +FROM workspace AS development + +# Since this dockerfile is used for all services, +# we'll use a build argument to pass the target service in +# and copy it to the environment so that it can be used in ENTRYPOINT +ARG TARGET_SERVICE +ENV TARGET_SERVICE=$TARGET_SERVICE +# We also need to define the signer environment so that it can be used in webpack.config.js +ARG TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE +ENV TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE=$TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE +ENV NODE_ENV=development +ENV TURBO_TELEMETRY_DISABLED=1 + +ENTRYPOINT pnpm dev --filter $TARGET_SERVICE + +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Image that builds the project +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +FROM workspace AS build -# Copy export-and-sign module and build -COPY export-and-sign ./export-and-sign/ -RUN cd export-and-sign && npm ci && npm run build - -# Copy import module and build -COPY import ./import/ -RUN cd import && npm ci && npm run build +WORKDIR /app -# Second stage: nginx runtime -# This is nginx 1.24.0 on bullseye. +ARG TURNKEY_SIGNER_ENVIRONMENT +ENV TURNKEY_SIGNER_ENVIRONMENT=$TURNKEY_SIGNER_ENVIRONMENT +ENV NODE_ENV=production + +# Build the project +RUN pnpm build + +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Server image (nginx 1.24.0 on bullseye) +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# # https://hub.docker.com/layers/nginxinc/nginx-unprivileged/1.24.0-bullseye/images/sha256-a8ec652916ce1e7ab2ab624fe59bb8dfc16a018fd489c6fb979fe35c5dd3ec50 -FROM docker.io/nginxinc/nginx-unprivileged:1.24.0-bullseye@sha256:ac0654a834233f7cc95b3a61550a07636299ce9020b5a11a04890b77b6917dc4 +FROM docker.io/nginxinc/nginx-unprivileged:1.24.0-bullseye@sha256:ac0654a834233f7cc95b3a61550a07636299ce9020b5a11a04890b77b6917dc4 AS server + +ENV NGINX_ENVSUBST_OUTPUT_DIR=/etc/nginx LABEL org.opencontainers.image.title frames LABEL org.opencontainers.image.source https://github.com/tkhq/frames -COPY nginx.conf /etc/nginx/nginx.conf +# COPY nginx.conf /etc/nginx/templates/nginx.conf.template -# iframe +CMD ["nginx"] + +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +# +# Production image (server + static files) +# +# .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.-. .-.- +# / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ \ / / \ +# `-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' `-`-' +FROM server AS production + +WORKDIR /usr/share/nginx + +COPY nginx.conf /etc/nginx/templates/nginx.conf.template # maintain recovery for backwards-compatibility COPY auth /usr/share/nginx/auth COPY auth /usr/share/nginx/recovery -COPY export /usr/share/nginx/export - -# Copy built export-and-sign and import files from builder stage -COPY --from=builder /app/export-and-sign/dist /usr/share/nginx/export-and-sign -COPY --from=builder /app/import/dist /usr/share/nginx/import +COPY --from=build /app/export/dist /usr/share/nginx/export +COPY --from=build /app/export-and-sign/dist /usr/share/nginx/export-and-sign +COPY --from=build /app/import/dist /usr/share/nginx/import # oauth COPY oauth-origin /usr/share/nginx/oauth-origin @@ -52,8 +167,4 @@ EXPOSE 8086/tcp # oauth EXPOSE 8084/tcp -EXPOSE 8085/tcp - -WORKDIR /usr/share/nginx - -CMD ["nginx"] +EXPOSE 8085/tcp \ No newline at end of file diff --git a/auth/.eslintignore b/auth/.eslintignore index 1ed167d5..b0f271c0 100644 --- a/auth/.eslintignore +++ b/auth/.eslintignore @@ -1,4 +1,5 @@ dist node_modules +.turbo hpke-core.js \ No newline at end of file diff --git a/auth/package.json b/auth/package.json index f500c2f4..31845f35 100644 --- a/auth/package.json +++ b/auth/package.json @@ -18,7 +18,7 @@ "@babel/core": "^7.23.0", "@babel/preset-env": "^7.22.20", "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", + "@testing-library/jest-dom": "^6.9.1", "babel-jest": "^29.7.0", "eslint": "^8.57.0", "jest": "^29.7.0", diff --git a/docker-compose.prod.yaml b/docker-compose.prod.yaml new file mode 100644 index 00000000..8c29735a --- /dev/null +++ b/docker-compose.prod.yaml @@ -0,0 +1,6 @@ +services: + server: + build: + target: production + depends_on: [] + volumes: [] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 00000000..f7113a02 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,101 @@ +services: + export: + build: + dockerfile: Dockerfile + target: development + args: + TARGET_SERVICE: "@turnkey/frames-export" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8081"] + interval: 3s + timeout: 5s + retries: 5 + start_period: 5s + volumes: + - ./export:/app/export + - ./shared:/app/shared + - export:/app/export/dist + + export-and-sign: + build: + dockerfile: Dockerfile + target: development + args: + TARGET_SERVICE: "@turnkey/frames-export-and-sign" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8086"] + interval: 3s + timeout: 5s + retries: 5 + start_period: 5s + volumes: + - ./export-and-sign:/app/export-and-sign + - ./shared:/app/shared + - export-and-sign:/app/export-and-sign/dist + + import: + build: + dockerfile: Dockerfile + target: development + args: + TARGET_SERVICE: "@turnkey/frames-import" + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8083"] + interval: 3s + timeout: 5s + retries: 5 + start_period: 5s + volumes: + - ./import:/app/import + - ./shared:/app/shared + - import:/app/import/dist + + server: + build: + dockerfile: Dockerfile + target: server + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:8080/health"] + interval: 3s + timeout: 5s + retries: 5 + start_period: 5s + depends_on: + export: + condition: service_healthy + export-and-sign: + condition: service_healthy + import: + condition: service_healthy + environment: + TURNKEY_SIGNER_ENVIRONMENT: ${TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE:-prod} + NGINX_ENVSUBST_FILTER: TURNKEY_ + ports: + - "8080-8086:8080-8086" + volumes: + - export:/usr/share/nginx/export:ro + - export-and-sign:/usr/share/nginx/export-and-sign:ro + - import:/usr/share/nginx/import:ro + - ./nginx.conf:/etc/nginx/templates/nginx.conf.template:ro + - ./nginx.upstreams.local.conf:/etc/nginx/templates/nginx.upstreams.local.conf.template:ro + - ./nginx.devserver.local.conf:/etc/nginx/templates/nginx.devserver.local.conf.template:ro + + e2e: + build: + dockerfile: Dockerfile + target: development + args: + TARGET_SERVICE: "@turnkey/frames-e2e" + depends_on: + server: + condition: service_healthy + entrypoint: pnpm test --filter=@turnkey/frames-e2e + environment: + EXPORT_AND_SIGN_IFRAME_URL: http://server:8086 + volumes: + - ./e2e:/app/e2e + +volumes: + export: + export-and-sign: + import: \ No newline at end of file diff --git a/e2e/.gitignore b/e2e/.gitignore new file mode 100644 index 00000000..12d294e9 --- /dev/null +++ b/e2e/.gitignore @@ -0,0 +1,2 @@ +__screenshots__ +.vitest-attachments \ No newline at end of file diff --git a/e2e/index.test.ts b/e2e/index.test.ts new file mode 100644 index 00000000..59a681b8 --- /dev/null +++ b/e2e/index.test.ts @@ -0,0 +1,68 @@ +import { expect, it, describe, inject, vi } from 'vitest' +import { getByText } from '@testing-library/dom' +import { TurnkeyApi, init } from "@turnkey/http" + +import { + IframeStamper, + TransactionType, + MessageType, +} from "@turnkey/iframe-stamper"; + +const EXPORT_AND_SIGN_IFRAME_URL = inject("EXPORT_AND_SIGN_IFRAME_URL"); + +describe("e2e", () => { + it("should load iframe", async () => { + const container = document.createElement("div") + window.document.body.appendChild(container) + + init({ + apiPublicKey: inject("API_PUBLIC_KEY")!, + apiPrivateKey: inject("API_PRIVATE_KEY")!, + baseUrl: inject("BASE_URL")!, + }) + + const result = await TurnkeyApi.createWallet({ + body: { + type: "ACTIVITY_TYPE_CREATE_WALLET", + organizationId: inject("ORGANIZATION_ID")!, + timestampMs: String(Date.now()), + parameters: { + walletName: "e2e-test-wallet", + accounts: [{ + curve: "CURVE_SECP256K1", + addressFormat: "ADDRESS_FORMAT_ETHEREUM", + pathFormat: "PATH_FORMAT_BIP32", + path: "m/44'/60'/0'/0/0", + name: "e2e-test-account", + }] + } + } + }) + + const stamper = new IframeStamper({ + iframeUrl: EXPORT_AND_SIGN_IFRAME_URL, + iframeContainer: container, + iframeElementId: "export-and-sign-iframe", + }); + + await stamper.init() + + // const turnkey = new TurnkeyApi({ + // defaultOrganizationId: inject("ORGANIZATION_ID")!, + // apiPublicKey: inject("API_PUBLIC_KEY")!, + // apiPrivateKey: inject("API_PRIVATE_KEY")!, + // apiBaseUrl: inject("BASE_URL")!, + // }) + + const message = "0x11" + const signedMessage = await stamper.signMessage( + { + message, + type: MessageType.Ethereum, + }, + "0x0", + ) + + stamper.clear(); + }, 30000) +}) \ No newline at end of file diff --git a/e2e/jest.config.ts b/e2e/jest.config.ts new file mode 100644 index 00000000..8a5adc1e --- /dev/null +++ b/e2e/jest.config.ts @@ -0,0 +1,16 @@ +import type { Config } from "jest"; + +export default { + clearMocks: true, + setupFiles: ["/jest.setup.ts"], + testEnvironment: "jsdom", + testEnvironmentOptions: { + url: "http://localhost", + resources: 'usable' + }, + transform: { + "^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }], + }, + testPathIgnorePatterns: ["/node_modules/"], + transformIgnorePatterns: ["/node_modules/.pnpm/(?!(@noble|@hpke)/)"], +} satisfies Config; diff --git a/e2e/jest.setup.ts b/e2e/jest.setup.ts new file mode 100644 index 00000000..a75d2bc8 --- /dev/null +++ b/e2e/jest.setup.ts @@ -0,0 +1,27 @@ +import "regenerator-runtime/runtime"; +import { TextEncoder, TextDecoder } from "util"; +import { ReadableStream } from "node:stream/web"; +import { MessagePort, MessageChannel } from "node:worker_threads"; + +if (typeof global.MessageChannel === "undefined") { + global.MessageChannel = MessageChannel as unknown as typeof global.MessageChannel; +} + +if (typeof global.MessagePort === "undefined") { + global.MessagePort = MessagePort as unknown as typeof global.MessagePort; +} + +if (typeof global.ReadableStream === "undefined") { + global.ReadableStream = + ReadableStream as unknown as typeof global.ReadableStream; +} + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} + +console.warn("updated global") diff --git a/e2e/package.json b/e2e/package.json new file mode 100644 index 00000000..970cc119 --- /dev/null +++ b/e2e/package.json @@ -0,0 +1,47 @@ +{ + "name": "@turnkey/frames-e2e", + "version": "0.1.0", + "private": true, + "scripts": { + "test": "vitest", + "lint": "eslint '**/*.js'", + "prettier:check": "prettier --check \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ../.prettierignore", + "prettier:write": "prettier --write \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ../.prettierignore" + }, + "repository": "git@github.com:tkhq/frames.git", + "author": "Turnkey ", + "description": "export-and-sign iframe with webpack-managed dependencies", + "license": "MIT", + "devDependencies": { + "@babel/core": "7.23.0", + "@babel/preset-env": "7.22.20", + "@testing-library/dom": "9.3.3", + "@testing-library/jest-dom": "^6.9.1", + "@turnkey/iframe-stamper": "^2.11.1", + "@turnkey/http": "5.0.0", + "@types/jest": "30.0.0", + "@types/jsdom": "28.0.3", + "@vitest/browser-playwright": "^4.1.10", + "babel-jest": "29.7.0", + "babel-loader": "9.1.3", + "css-loader": "6.8.1", + "eslint": "8.57.0", + "html-webpack-plugin": "5.5.3", + "jest": "30.4.2", + "jest-environment-jsdom": "30.4.1", + "jsdom": "^22.1.0", + "mini-css-extract-plugin": "2.9.4", + "prettier": "2.8.4", + "regenerator-runtime": "0.14.1", + "serve": "14.2.5", + "style-loader": "3.3.3", + "ts-jest": "29.4.11", + "typescript": "5.4.3", + "util": "0.12.5", + "vitest": "^4.1.10", + "webpack": "5.102.1", + "webpack-cli": "5.1.4", + "webpack-dev-server": "5.2.2", + "webpack-subresource-integrity": "5.2.0-rc.1" + } +} diff --git a/e2e/tsconfig.json b/e2e/tsconfig.json new file mode 100644 index 00000000..670e0b70 --- /dev/null +++ b/e2e/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": ".", + "tsBuildInfoFile": "./.cache/.tsbuildinfo", + "types": ["jest"] + }, + "include": ["src/**/*.ts", "src/**/*.js", "*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/e2e/vitest.config.ts b/e2e/vitest.config.ts new file mode 100644 index 00000000..91f129e7 --- /dev/null +++ b/e2e/vitest.config.ts @@ -0,0 +1,32 @@ +import { defineConfig } from 'vitest/config' +import { playwright } from '@vitest/browser-playwright' + +declare module 'vitest' { + export interface ProvidedContext { + EXPORT_AND_SIGN_IFRAME_URL: string + ORGANIZATION_ID: string | undefined, + API_PUBLIC_KEY: string | undefined, + API_PRIVATE_KEY: string | undefined, + BASE_URL: string | undefined, + } +} + +export default defineConfig({ + test: { + browser: { + enabled: true, + provider: playwright(), + // https://vitest.dev/config/browser/playwright + instances: [ + { browser: 'chromium' }, + ], + }, + provide: { + EXPORT_AND_SIGN_IFRAME_URL: process.env.EXPORT_AND_SIGN_IFRAME_URL || "http://localhost:8086", + ORGANIZATION_ID: process.env.ORGANIZATION_ID, + API_PUBLIC_KEY: process.env.API_PUBLIC_KEY, + API_PRIVATE_KEY: process.env.API_PRIVATE_KEY, + BASE_URL: process.env.BASE_URL, + }, + } +}) diff --git a/export-and-sign/.eslintignore b/export-and-sign/.eslintignore index 1ed167d5..50760c29 100644 --- a/export-and-sign/.eslintignore +++ b/export-and-sign/.eslintignore @@ -1,4 +1,3 @@ dist node_modules - -hpke-core.js \ No newline at end of file +.turbo diff --git a/export-and-sign/.npmrc b/export-and-sign/.npmrc deleted file mode 100644 index 7c6e3384..00000000 --- a/export-and-sign/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -ignore-scripts=true -save-exact=true diff --git a/export-and-sign/babel.config.js b/export-and-sign/babel.config.js deleted file mode 100644 index 6d9ca2ec..00000000 --- a/export-and-sign/babel.config.js +++ /dev/null @@ -1,10 +0,0 @@ -module.exports = { - presets: [ - [ - "@babel/preset-env", - { - exclude: ["transform-exponentiation-operator"], - }, - ], - ], -}; diff --git a/export-and-sign/dist/bundle.29203a225e88524b9cba.js b/export-and-sign/dist/bundle.29203a225e88524b9cba.js deleted file mode 100644 index 744b43a7..00000000 --- a/export-and-sign/dist/bundle.29203a225e88524b9cba.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkexport_and_sign=self.webpackChunkexport_and_sign||[]).push([[825],{4825:()=>{}}]); \ No newline at end of file diff --git a/export-and-sign/dist/bundle.52d2885ae469455328a8.js b/export-and-sign/dist/bundle.52d2885ae469455328a8.js deleted file mode 100644 index 5a8dffe1..00000000 --- a/export-and-sign/dist/bundle.52d2885ae469455328a8.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see bundle.52d2885ae469455328a8.js.LICENSE.txt */ -(self.webpackChunkexport_and_sign=self.webpackChunkexport_and_sign||[]).push([[96],{22:(e,t,r)=>{"use strict";const n=r(2107).v4,i=r(3289),s=function(e,t){if(!(this instanceof s))return new s(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return n()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=s,s.prototype.request=function(e,t,r,n){const s=this;let o=null;const a=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&a)throw new TypeError("JSON-RPC 1.0 does not support batching");if(a||!a&&e&&"object"==typeof e&&"function"==typeof t)n=t,o=e;else{"function"==typeof r&&(n=r,r=void 0);const s="function"==typeof n;try{o=i(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s)return void n(e);throw e}if(!s)return o}let c;try{c=JSON.stringify(o,this.options.replacer)}catch(e){return void n(e)}return this.callServer(c,function(e,t){s._parseResponse(e,t,n)}),o},s.prototype._parseResponse=function(e,t,r){if(e)return void r(e);if(!t)return void r();let n;try{n=JSON.parse(t,this.options.reviver)}catch(e){return void r(e)}if(3!==r.length)r(null,n);else{if(Array.isArray(n)){const e=function(e){return void 0!==e.error},t=function(t){return!e(t)};return void r(null,n.filter(e),n.filter(t))}r(null,n.error,n.result)}}},51:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(129))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}},129:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(996))&&n.__esModule?n:{default:n};t.default=function(e){return"string"==typeof e&&i.default.test(e)}},152:(e,t)=>{"use strict";class r{static isArrayBuffer(e){return"[object ArrayBuffer]"===Object.prototype.toString.call(e)}static toArrayBuffer(e){return this.isArrayBuffer(e)?e:e.byteLength===e.buffer.byteLength||0===e.byteOffset&&e.byteLength===e.buffer.byteLength?e.buffer:this.toUint8Array(e.buffer).slice(e.byteOffset,e.byteOffset+e.byteLength).buffer}static toUint8Array(e){return this.toView(e,Uint8Array)}static toView(e,t){if(e.constructor===t)return e;if(this.isArrayBuffer(e))return new t(e);if(this.isArrayBufferView(e))return new t(e.buffer,e.byteOffset,e.byteLength);throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'")}static isBufferSource(e){return this.isArrayBufferView(e)||this.isArrayBuffer(e)}static isArrayBufferView(e){return ArrayBuffer.isView(e)||e&&this.isArrayBuffer(e.buffer)}static isEqual(e,t){const n=r.toUint8Array(e),i=r.toUint8Array(t);if(n.length!==i.byteLength)return!1;for(let e=0;ee.byteLength).reduce((e,t)=>e+t),r=new Uint8Array(t);let n=0;return e.map(e=>new Uint8Array(e)).forEach(e=>{for(const t of e)r[n++]=t}),r.buffer},t.n4=function(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let t=0;t{"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var a=new i(n,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0===--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=new Array(s);i{t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,c=(1<>1,l=-7,h=r?i-1:0,f=r?-1:1,d=e[t+h];for(h+=f,s=d&(1<<-l)-1,d>>=-l,l+=a;l>0;s=256*s+e[t+h],h+=f,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=256*o+e[t+h],h+=f,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=u}return(d?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,c,u=8*s-i-1,l=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:s-1,p=n?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?f/c:f*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<0;e[r+d]=255&o,d+=p,o/=256,u-=8);e[r+d-p]|=128*y}},469:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var i=r(8226),s=n(r(2996));t.default=(0,s.default)(function(e){return(0,i.sha256)((0,i.sha256)(e))})},566:(e,t,r)=>{"use strict";r.d(t,{g8:()=>a});var n={};r.r(n),r.d(n,{Any:()=>_t,BaseBlock:()=>D,BaseStringBlock:()=>F,BitString:()=>De,BmpString:()=>lt,Boolean:()=>ze,CharacterString:()=>xt,Choice:()=>Pt,Constructed:()=>Ue,DATE:()=>kt,DateTime:()=>Et,Duration:()=>It,EndOfContent:()=>je,Enumerated:()=>Ze,GeneralString:()=>bt,GeneralizedTime:()=>St,GraphicString:()=>vt,HexBlock:()=>R,IA5String:()=>mt,Integer:()=>Ge,Null:()=>Re,NumericString:()=>dt,ObjectIdentifier:()=>Xe,OctetString:()=>$e,Primitive:()=>_e,PrintableString:()=>pt,RawData:()=>Ct,RelativeObjectIdentifier:()=>tt,Repeated:()=>Mt,Sequence:()=>rt,Set:()=>nt,TIME:()=>Ot,TeletexString:()=>yt,TimeOfDay:()=>Bt,UTCTime:()=>At,UniversalString:()=>ft,Utf8String:()=>ct,ValueBlock:()=>z,VideotexString:()=>gt,ViewWriter:()=>v,VisibleString:()=>wt,compareSchema:()=>Tt,fromBER:()=>Me,verifySchema:()=>Ut}),r(2755);const i=(e,t)=>{const r=t-e.length;if(r>0){const t=new Uint8Array(r).fill(0);return new Uint8Array([...t,...e])}if(r<0){const n=-1*r;let i=0;for(let t=0;t{const t=(e=>{if(!e||e.length%2!=0||!/^[0-9A-Fa-f]+$/.test(e))throw new Error(`cannot create uint8array from invalid hex string: "${e}"`);const t=new Uint8Array(e.match(/../g).map(e=>parseInt(e,16)));return t})(e);if(t.length<2)throw new Error("failed to convert DER-encoded signature: insufficient length");if(48!==t[0])throw new Error("failed to convert DER-encoded signature: invalid format (missing SEQUENCE tag)");let r=1;const n=t[r];if(!(n<=127))throw new Error("failed to convert DER-encoded signature: unexpectedly large or invalid signature length");if(t.length<2+n)throw new Error("failed to convert DER-encoded signature: inconsistent message length header");if(r+=1,2!==t[r])throw new Error("failed to convert DER-encoded signature: invalid tag for r");r++;const s=t[r];if(s>33)throw new Error("failed to convert DER-encoded signature: unexpected length for r");r++;const o=t.slice(r,r+s);if(r+=s,2!==t[r])throw new Error("failed to convert DER-encoded signature: invalid tag for s");r++;const a=t[r];if(a>33)throw new Error("failed to convert DER-encoded signature: unexpected length for s");r++;const c=t.slice(r,r+a),u=i(o,32),l=i(c,32);return new Uint8Array([...u,...l])};var c;!function(e){e.NOTARIZER="notarizer",e.SIGNER="signer",e.EVM_PARSER="evm-parser",e.TLS_FETCHER="tls-fetcher",e.UMP="ump"}(c||(c={})),r(2455),r(8630);var u=r(152);function l(e,t){let r=0;if(1===e.length)return e[0];for(let n=e.length-1;n>=0;n--)r+=e[e.length-1-n]*Math.pow(2,t*n);return r}function h(e,t,r=-1){const n=r;let i=e,s=0,o=Math.pow(2,t);for(let r=1;r<8;r++){if(e=0;e--){const r=Math.pow(2,e*t);o[s-e-1]=Math.floor(i/r),i-=o[s-e-1]*r}return e}o*=Math.pow(2,t)}return new ArrayBuffer(0)}function f(...e){let t=0,r=0;for(const r of e)t+=r.length;const n=new ArrayBuffer(t),i=new Uint8Array(n);for(const t of e)i.set(t,r),r+=t.length;return i}function d(){const e=new Uint8Array(this.valueHex);if(this.valueHex.byteLength>=2){const t=255===e[0]&&128&e[1],r=0===e[0]&&!(128&e[1]);(t||r)&&this.warnings.push("Needlessly long format")}const t=new ArrayBuffer(this.valueHex.byteLength),r=new Uint8Array(t);for(let e=0;e=i.length)return this.error="End of input reached before message was fully decoded",-1;if(e===r){r+=255;const e=new Uint8Array(r);for(let r=0;r8)return this.error="Too big integer",-1;if(s+1>i.length)return this.error="End of input reached before message was fully decoded",-1;const o=t+1,a=n.subarray(o,o+s);return 0===a[s-1]&&this.warnings.push("Needlessly long encoded length"),this.length=l(a,8),this.longFormUsed&&this.length<=127&&this.warnings.push("Unnecessary usage of long length form"),this.blockLength=s+1,t+this.blockLength}toBER(e=!1){let t,r;if(this.length>127&&(this.longFormUsed=!0),this.isIndefiniteForm)return t=new ArrayBuffer(1),!1===e&&(r=new Uint8Array(t),r[0]=128),t;if(this.longFormUsed){const n=h(this.length,8);if(n.byteLength>127)return this.error="Too big length",C;if(t=new ArrayBuffer(n.byteLength+1),e)return t;const i=new Uint8Array(n);r=new Uint8Array(t),r[0]=128|n.byteLength;for(let e=0;e=37&&!1===i.idBlock.isHexOnly)return i.error="UNIVERSAL 37 and upper tags are reserved by ASN.1 standard",{offset:-1,result:i};switch(i.idBlock.tagNumber){case 0:if(i.idBlock.isConstructed&&i.lenBlock.length>0)return i.error="Type [UNIVERSAL 0] is reserved",{offset:-1,result:i};a=K.EndOfContent;break;case 1:a=K.Boolean;break;case 2:a=K.Integer;break;case 3:a=K.BitString;break;case 4:a=K.OctetString;break;case 5:a=K.Null;break;case 6:a=K.ObjectIdentifier;break;case 10:a=K.Enumerated;break;case 12:a=K.Utf8String;break;case 13:a=K.RelativeObjectIdentifier;break;case 14:a=K.TIME;break;case 15:return i.error="[UNIVERSAL 15] is reserved by ASN.1 standard",{offset:-1,result:i};case 16:a=K.Sequence;break;case 17:a=K.Set;break;case 18:a=K.NumericString;break;case 19:a=K.PrintableString;break;case 20:a=K.TeletexString;break;case 21:a=K.VideotexString;break;case 22:a=K.IA5String;break;case 23:a=K.UTCTime;break;case 24:a=K.GeneralizedTime;break;case 25:a=K.GraphicString;break;case 26:a=K.VisibleString;break;case 27:a=K.GeneralString;break;case 28:a=K.UniversalString;break;case 29:a=K.CharacterString;break;case 30:a=K.BmpString;break;case 31:a=K.DATE;break;case 32:a=K.TimeOfDay;break;case 33:a=K.DateTime;break;case 34:a=K.Duration;break;default:{const e=i.idBlock.isConstructed?new K.Constructed:new K.Primitive;e.idBlock=i.idBlock,e.lenBlock=i.lenBlock,e.warnings=i.warnings,i=e}}}else a=i.idBlock.isConstructed?K.Constructed:K.Primitive;return i=function(e,t){if(e instanceof t)return e;const r=new t;return r.idBlock=e.idBlock,r.lenBlock=e.lenBlock,r.warnings=e.warnings,r.valueBeforeDecodeView=e.valueBeforeDecodeView,r}(i,a),o=i.fromBER(e,t,i.lenBlock.isIndefiniteForm?r:i.lenBlock.length),i.valueBeforeDecodeView=e.subarray(n,n+i.blockLength),{offset:o,result:i}}function Me(e){if(!e.byteLength){const e=new D({},z);return e.error="Input buffer has zero length",{offset:-1,result:e}}return Pe(u._H.toUint8Array(e).slice(),0,e.byteLength)}function Ce(e,t){return e?1:t}W=_e,K.Primitive=W,_e.NAME="PRIMITIVE";class Te extends z{constructor({value:e=[],isIndefiniteForm:t=!1,...r}={}){super(r),this.value=e,this.isIndefiniteForm=t}fromBER(e,t,r){const n=u._H.toUint8Array(e);if(!m(this,n,t,r))return-1;if(this.valueBeforeDecodeView=n.subarray(t,t+r),0===this.valueBeforeDecodeView.length)return this.warnings.push("Zero buffer length"),t;let i=t;for(;Ce(this.isIndefiniteForm,r)>0;){const e=Pe(n,i,r);if(-1===e.offset)return this.error=e.result.error,this.warnings.concat(e.result.warnings),-1;if(i=e.offset,this.blockLength+=e.result.blockLength,r-=e.result.blockLength,this.value.push(e.result),this.isIndefiniteForm&&e.result.constructor.NAME===U)break}return this.isIndefiniteForm&&(this.value[this.value.length-1].constructor.NAME===U?this.value.pop():this.warnings.push("No EndOfContent block encoded")),i}toBER(e,t){const r=t||new v;for(let t=0;t` ${e}`).join("\n"));const t=3===this.idBlock.tagClass?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return e.length?`${t} :\n${e.join("\n")}`:`${t} :`}}G=Ue,K.Constructed=G,Ue.NAME="CONSTRUCTED";class Ne extends z{fromBER(e,t,r){return t}toBER(e){return C}}Ne.override="EndOfContentValueBlock";class je extends D{constructor(e={}){super(e,Ne),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}Z=je,K.EndOfContent=Z,je.NAME=U;class Re extends D{constructor(e={}){super(e,z),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(e,t,r){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=r,t+r>e.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):t+r}toBER(e,t){const r=new ArrayBuffer(2);if(!e){const e=new Uint8Array(r);e[0]=5,e[1]=0}return t&&t.write(r),r}onAsciiEncoding(){return`${this.constructor.NAME}`}}J=Re,K.Null=J,Re.NAME="NULL";class Le extends(R(z)){get value(){for(const e of this.valueHexView)if(e>0)return!0;return!1}set value(e){this.valueHexView[0]=e?255:0}constructor({value:e,...t}={}){super(t),t.valueHex?this.valueHexView=u._H.toUint8Array(t.valueHex):this.valueHexView=new Uint8Array(1),e&&(this.value=e)}fromBER(e,t,r){const n=u._H.toUint8Array(e);return m(this,n,t,r)?(this.valueHexView=n.subarray(t,t+r),r>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,d.call(this),this.blockLength=r,t+r):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}Le.NAME="BooleanValueBlock";class ze extends D{getValue(){return this.valueBlock.value}setValue(e){this.valueBlock.value=e}constructor(e={}){super(e,Le),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}}Y=ze,K.Boolean=Y,ze.NAME="BOOLEAN";class He extends(R(Te)){constructor({isConstructed:e=!1,...t}={}){super(t),this.isConstructed=e}fromBER(e,t,r){let n=0;if(this.isConstructed){if(this.isHexOnly=!1,n=Te.prototype.fromBER.call(this,e,t,r),-1===n)return n;for(let e=0;e0&&r.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=r.unusedBits}return n}const i=u._H.toUint8Array(e);if(!m(this,i,t,r))return-1;const s=i.subarray(t,t+r);if(this.unusedBits=s[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const e=s.subarray(1);try{if(e.byteLength){const t=Pe(e,0,e.byteLength);-1!==t.offset&&t.offset===r-1&&(this.value=[t.result])}}catch{}}return this.valueHexView=s.subarray(1),this.blockLength=s.length,t+r}toBER(e,t){if(this.isConstructed)return Te.prototype.toBER.call(this,e,t);if(e)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength){const e=new Uint8Array(1);return e[0]=0,e.buffer}const r=new Uint8Array(this.valueHexView.length+1);return r[0]=this.unusedBits,r.set(this.valueHexView,1),r.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}Ke.NAME="BitStringValueBlock";class De extends D{constructor({idBlock:e={},lenBlock:t={},...r}={}){var n,i;null!==(n=r.isConstructed)&&void 0!==n||(r.isConstructed=!!(null===(i=r.value)||void 0===i?void 0:i.length)),super({idBlock:{isConstructed:r.isConstructed,...e},lenBlock:{...t,isIndefiniteForm:!!r.isIndefiniteForm},...r},Ke),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(e,t,r){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(e,t,r)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Ue.prototype.onAsciiEncoding.call(this);{const e=[],t=this.valueBlock.valueHexView;for(const r of t)e.push(r.toString(2).padStart(8,"0"));const r=e.join("");return`${this.constructor.NAME} : ${r.substring(0,r.length-this.valueBlock.unusedBits)}`}}}function Ve(e,t){const r=new Uint8Array([0]),n=new Uint8Array(e),i=new Uint8Array(t);let s=n.slice(0);const o=s.length-1,a=i.slice(0),c=a.length-1;let u=0,l=0;for(let e=c=0;e--,l++)u=1==l=s.length?s=f(new Uint8Array([u%10]),s):s[o-l]=u%10;return r[0]>0&&(s=f(r,s)),s}function Fe(e){if(e>=w.length)for(let t=w.length;t<=e;t++){const e=new Uint8Array([0]);let r=w[t-1].slice(0);for(let t=r.length-1;t>=0;t--){const n=new Uint8Array([(r[t]<<1)+e[0]]);e[0]=n[0]/10,r[t]=n[0]%10}e[0]>0&&(r=f(e,r)),w.push(r)}return w[e]}function qe(e,t){let r=0;const n=new Uint8Array(e),i=new Uint8Array(t),s=n.slice(0),o=s.length-1,a=i.slice(0),c=a.length-1;let u,l=0;for(let e=c;e>=0;e--,l++)u=s[o-l]-a[c-l]-r,1==u<0?(r=1,s[o-l]=u+10):(r=0,s[o-l]=u);if(r>0)for(let e=o-c+1;e>=0;e--,l++){if(u=s[o-l]-r,!(u<0)){r=0,s[o-l]=u;break}r=1,s[o-l]=u+10}return s.slice()}Q=De,K.BitString=Q,De.NAME=j;class We extends(R(z)){setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=d.call(this)))}constructor({value:e,...t}={}){super(t),this._valueDec=0,t.valueHex&&this.setValueHex(),void 0!==e&&(this.valueDec=e)}set valueDec(e){this._valueDec=e,this.isHexOnly=!1,this.valueHexView=new Uint8Array(function(e){const t=e<0?-1*e:e;let r=128;for(let n=1;n<8;n++){if(t<=r){if(e<0){const e=h(r-t,8,n);return new Uint8Array(e)[0]|=128,e}let i=h(t,8,n),s=new Uint8Array(i);if(128&s[0]){const e=i.slice(0),t=new Uint8Array(e);i=new ArrayBuffer(i.byteLength+1),s=new Uint8Array(i);for(let r=0;r1&&(n=s.length+1),this.valueHexView=s.subarray(n-s.length)),i}toDER(e=!1){const t=this.valueHexView;switch(!0){case!!(128&t[0]):{const e=new Uint8Array(this.valueHexView.length+1);e[0]=0,e.set(t,1),this.valueHexView=e}break;case 0===t[0]&&!(128&t[1]):this.valueHexView=this.valueHexView.subarray(1)}return this.toBER(e)}fromBER(e,t,r){const n=super.fromBER(e,t,r);return-1===n||this.setValueHex(),n}toBER(e){return e?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const e=8*this.valueHexView.length-1;let t,r=new Uint8Array(8*this.valueHexView.length/3),n=0;const i=this.valueHexView;let s="",o=!1;for(let o=i.byteLength-1;o>=0;o--){t=i[o];for(let i=0;i<8;i++)1&~t||(n===e?(r=qe(Fe(n),r),s="-"):r=Ve(r,Fe(n))),n++,t>>=1}for(let e=0;e0;){const t=new Je;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;0===this.value.length&&(t.isFirstSid=!0),this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e){const t=[];for(let r=0;rNumber.MAX_SAFE_INTEGER){y();const t=BigInt(n);e.valueBigInt=t}else if(e.valueDec=parseInt(n,10),isNaN(e.valueDec))return;this.value.length||(e.isFirstSid=!0,i=!0),this.value.push(e)}}while(-1!==r)}toString(){let e="",t=!1;for(let r=0;r0;){const t=new Qe;if(n=t.fromBER(e,n,r),-1===n)return this.blockLength=0,this.error=t.error,n;this.blockLength+=t.blockLength,r-=t.blockLength,this.value.push(t)}return n}toBER(e,t){const r=[];for(let t=0;t4)continue;const s=4-i.length;for(let e=i.length-1;e>=0;e--)r[4*n+e+s]=i[e]}this.valueBlock.value=e}}ht.NAME="UniversalStringValueBlock";class ft extends ht{constructor({...e}={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}ue=ft,K.UniversalString=ue,ft.NAME="UniversalString";class dt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}le=dt,K.NumericString=le,dt.NAME="NumericString";class pt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}he=pt,K.PrintableString=he,pt.NAME="PrintableString";class yt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}fe=yt,K.TeletexString=fe,yt.NAME="TeletexString";class gt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}de=gt,K.VideotexString=de,gt.NAME="VideotexString";class mt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}pe=mt,K.IA5String=pe,mt.NAME="IA5String";class vt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}ye=vt,K.GraphicString=ye,vt.NAME="GraphicString";class wt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}ge=wt,K.VisibleString=ge,wt.NAME="VisibleString";class bt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}me=bt,K.GeneralString=me,bt.NAME="GeneralString";class xt extends ot{constructor(e={}){super(e),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}ve=xt,K.CharacterString=ve,xt.NAME="CharacterString";class At extends wt{constructor({value:e,valueDate:t,...r}={}){if(super(r),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,e){this.fromString(e),this.valueBlock.valueHexView=new Uint8Array(e.length);for(let t=0;t=50?1900+r:2e3+r,this.month=parseInt(t[2],10),this.day=parseInt(t[3],10),this.hour=parseInt(t[4],10),this.minute=parseInt(t[5],10),this.second=parseInt(t[6],10)}toString(e="iso"){if("iso"===e){const e=new Array(7);return e[0]=p(this.year<2e3?this.year-1900:this.year-2e3,2),e[1]=p(this.month,2),e[2]=p(this.day,2),e[3]=p(this.hour,2),e[4]=p(this.minute,2),e[5]=p(this.second,2),e[6]="Z",e.join("")}return super.toString(e)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}we=At,K.UTCTime=we,At.NAME="UTCTime";class St extends At{constructor(e={}){var t;super(e),null!==(t=this.millisecond)&&void 0!==t||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(e){super.fromDate(e),this.millisecond=e.getUTCMilliseconds()}toDate(){const e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond);return new Date(e)}fromString(e){let t,r=!1,n="",i="",s=0,o=0,a=0;if("Z"===e[e.length-1])n=e.substring(0,e.length-1),r=!0;else{const t=new Number(e[e.length-1]);if(isNaN(t.valueOf()))throw new Error("Wrong input string for conversion");n=e}if(r){if(-1!==n.indexOf("+"))throw new Error("Wrong input string for conversion");if(-1!==n.indexOf("-"))throw new Error("Wrong input string for conversion")}else{let e=1,t=n.indexOf("+"),r="";if(-1===t&&(t=n.indexOf("-"),e=-1),-1!==t){if(r=n.substring(t+1),n=n.substring(0,t),2!==r.length&&4!==r.length)throw new Error("Wrong input string for conversion");let i=parseInt(r.substring(0,2),10);if(isNaN(i.valueOf()))throw new Error("Wrong input string for conversion");if(o=e*i,4===r.length){if(i=parseInt(r.substring(2,4),10),isNaN(i.valueOf()))throw new Error("Wrong input string for conversion");a=e*i}}}let c=n.indexOf(".");if(-1===c&&(c=n.indexOf(",")),-1!==c){const e=new Number(`0${n.substring(c)}`);if(isNaN(e.valueOf()))throw new Error("Wrong input string for conversion");s=e.valueOf(),i=n.substring(0,c)}else i=n;switch(!0){case 8===i.length:if(t=/(\d{4})(\d{2})(\d{2})/gi,-1!==c)throw new Error("Wrong input string for conversion");break;case 10===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*s;this.minute=Math.floor(e),e=60*(e-this.minute),this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 12===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){let e=60*s;this.second=Math.floor(e),e=1e3*(e-this.second),this.millisecond=Math.floor(e)}break;case 14===i.length:if(t=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/gi,-1!==c){const e=1e3*s;this.millisecond=Math.floor(e)}break;default:throw new Error("Wrong input string for conversion")}const u=t.exec(i);if(null===u)throw new Error("Wrong input string for conversion");for(let e=1;e0&&r.valueBlock.value[0]instanceof Mt&&(s=t.valueBlock.value.length),0===s)return{verified:!0,result:e};if(0===t.valueBlock.value.length&&0!==r.valueBlock.value.length){let t=!0;for(let e=0;e=t.valueBlock.value.length){if(!1===r.valueBlock.value[o].optional){const t={verified:!1,result:e};return e.error="Inconsistent length between ASN.1 data and schema",r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,M),r.name&&(delete e[r.name],t.name=r.name)),t}}else if(r.valueBlock.value[0]instanceof Mt){if(i=Tt(e,t.valueBlock.value[o],r.valueBlock.value[0].value),!1===i.verified){if(!r.valueBlock.value[0].optional)return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,M),r.name&&delete e[r.name]),i;n++}if(x in r.valueBlock.value[0]&&r.valueBlock.value[0].name.length>0){let n={};n=P in r.valueBlock.value[0]&&r.valueBlock.value[0].local?t:e,void 0===n[r.valueBlock.value[0].name]&&(n[r.valueBlock.value[0].name]=[]),n[r.valueBlock.value[0].name].push(t.valueBlock.value[o])}}else if(i=Tt(e,t.valueBlock.value[o-n],r.valueBlock.value[o]),!1===i.verified){if(!r.valueBlock.value[o].optional)return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,M),r.name&&delete e[r.name]),i;n++}if(!1===i.verified){const t={verified:!1,result:e};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,M),r.name&&(delete e[r.name],t.name=r.name)),t}return{verified:!0,result:e}}if(r.primitiveSchema&&A in t.valueBlock){const n=Pe(t.valueBlock.valueHexView);if(-1===n.offset){const t={verified:!1,result:n.result};return r.name&&(r.name=r.name.replace(/^\s+|\s+$/g,M),r.name&&(delete e[r.name],t.name=r.name)),t}return Tt(e,n.result,r.primitiveSchema)}return{verified:!0,result:e}}function Ut(e,t){if(t instanceof Object==0)return{verified:!1,result:{error:"Wrong ASN.1 schema type"}};const r=Pe(u._H.toUint8Array(e));return-1===r.offset?{verified:!1,result:r.result}:Tt(r.result,r.result,t)}(Oe=Ee||(Ee={}))[Oe.Sequence=0]="Sequence",Oe[Oe.Set=1]="Set",Oe[Oe.Choice=2]="Choice",function(e){e[e.Any=1]="Any",e[e.Boolean=2]="Boolean",e[e.OctetString=3]="OctetString",e[e.BitString=4]="BitString",e[e.Integer=5]="Integer",e[e.Enumerated=6]="Enumerated",e[e.ObjectIdentifier=7]="ObjectIdentifier",e[e.Utf8String=8]="Utf8String",e[e.BmpString=9]="BmpString",e[e.UniversalString=10]="UniversalString",e[e.NumericString=11]="NumericString",e[e.PrintableString=12]="PrintableString",e[e.TeletexString=13]="TeletexString",e[e.VideotexString=14]="VideotexString",e[e.IA5String=15]="IA5String",e[e.GraphicString=16]="GraphicString",e[e.VisibleString=17]="VisibleString",e[e.GeneralString=18]="GeneralString",e[e.CharacterString=19]="CharacterString",e[e.UTCTime=20]="UTCTime",e[e.GeneralizedTime=21]="GeneralizedTime",e[e.DATE=22]="DATE",e[e.TimeOfDay=23]="TimeOfDay",e[e.DateTime=24]="DateTime",e[e.Duration=25]="Duration",e[e.TIME=26]="TIME",e[e.Null=27]="Null"}(Ie||(Ie={}));class Nt{constructor(e,t=0){if(this.unusedBits=0,this.value=new ArrayBuffer(0),e)if("number"==typeof e)this.fromNumber(e);else{if(!u._H.isBufferSource(e))throw TypeError("Unsupported type of 'params' argument for BitString");this.unusedBits=t,this.value=u._H.toArrayBuffer(e)}}fromASN(e){if(!(e instanceof De))throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString");return this.unusedBits=e.valueBlock.unusedBits,this.value=e.valueBlock.valueHex,this}toASN(){return new De({unusedBits:this.unusedBits,valueHex:this.value})}toSchema(e){return new De({name:e})}toNumber(){let e="";const t=new Uint8Array(this.value);for(const r of t)e+=r.toString(2).padStart(8,"0");return e=e.split("").reverse().join(""),this.unusedBits&&(e=e.slice(this.unusedBits).padStart(this.unusedBits,"0")),parseInt(e,2)}fromNumber(e){let t=e.toString(2);const r=t.length+7>>3;this.unusedBits=(r<<3)-t.length;const n=new Uint8Array(r);t=t.padStart(r<<3,"0").split("").reverse().join("");let i=0;for(;ie instanceof Re?null:e.valueBeforeDecodeView,toASN:e=>{if(null===e)return new Re;const t=Me(e);if(t.result.error)throw new Error(t.result.error);return t.result}},Lt={fromASN:e=>e.valueBlock.valueHexView.byteLength>=4?e.valueBlock.toString():e.valueBlock.valueDec,toASN:e=>new Ge({value:+e})},zt={fromASN:e=>e.valueBlock.valueDec,toASN:e=>new Ze({value:e})},Ht={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new Ge({valueHex:e})},$t={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new De({valueHex:e})},Kt={fromASN:e=>e.valueBlock.toString(),toASN:e=>new Xe({value:e})},Dt={fromASN:e=>e.valueBlock.value,toASN:e=>new ze({value:e})},Vt={fromASN:e=>e.valueBlock.valueHexView,toASN:e=>new $e({valueHex:e})},Ft={fromASN:e=>new jt(e.getValue()),toASN:e=>e.toASN()};function qt(e){return{fromASN:e=>e.valueBlock.value,toASN:t=>new e({value:t})}}const Wt=qt(ct),Gt=qt(lt),Zt=qt(ft),Jt=qt(dt),Yt=qt(pt),Xt=qt(yt),Qt=qt(gt),er=qt(mt),tr=qt(vt),rr=qt(wt),nr=qt(bt),ir=qt(xt),sr={fromASN:e=>e.toDate(),toASN:e=>new At({valueDate:e})},or={fromASN:e=>e.toDate(),toASN:e=>new St({valueDate:e})},ar={fromASN:()=>null,toASN:()=>new Re};function cr(e){switch(e){case Ie.Any:return Rt;case Ie.BitString:return $t;case Ie.BmpString:return Gt;case Ie.Boolean:return Dt;case Ie.CharacterString:return ir;case Ie.Enumerated:return zt;case Ie.GeneralString:return nr;case Ie.GeneralizedTime:return or;case Ie.GraphicString:return tr;case Ie.IA5String:return er;case Ie.Integer:return Lt;case Ie.Null:return ar;case Ie.NumericString:return Jt;case Ie.ObjectIdentifier:return Kt;case Ie.OctetString:return Vt;case Ie.PrintableString:return Yt;case Ie.TeletexString:return Xt;case Ie.UTCTime:return sr;case Ie.UniversalString:return Zt;case Ie.Utf8String:return Wt;case Ie.VideotexString:return Qt;case Ie.VisibleString:return rr;default:return null}}function ur(e){return"function"==typeof e&&e.prototype?!(!e.prototype.toASN||!e.prototype.fromASN)||ur(e.prototype):!!(e&&"object"==typeof e&&"toASN"in e&&"fromASN"in e)}function lr(e){var t;if(e){const r=Object.getPrototypeOf(e);return(null===(t=null==r?void 0:r.prototype)||void 0===t?void 0:t.constructor)===Array||lr(r)}return!1}function hr(e,t){if(!e||!t)return!1;if(e.byteLength!==t.byteLength)return!1;const r=new Uint8Array(e),n=new Uint8Array(t);for(let t=0;tt=>{let r;fr.has(t)?r=fr.get(t):(r=fr.createDefault(t),fr.set(t,r)),Object.assign(r,e)},pr=e=>(t,r)=>{let n;fr.has(t.constructor)?n=fr.get(t.constructor):(n=fr.createDefault(t.constructor),fr.set(t.constructor,n));const i=Object.assign({},e);if("number"==typeof i.type&&!i.converter){const n=cr(e.type);if(!n)throw new Error(`Cannot get default converter for property '${r}' of ${t.constructor.name}`);i.converter=n}i.raw=e.raw,n.items[r]=i};class yr extends Error{constructor(){super(...arguments),this.schemas=[]}}class gr{static parse(e,t){const r=Me(e);if(r.result.error)throw new Error(r.result.error);return this.fromASN(r.result,t)}static fromASN(e,t){try{if(ur(t))return(new t).fromASN(e);const r=fr.get(t);fr.cache(t);let n=r.schema;const i=this.handleChoiceTypes(e,r,t,n);if(null==i?void 0:i.result)return i.result;(null==i?void 0:i.targetSchema)&&(n=i.targetSchema);const s=this.handleSequenceTypes(e,r,t,n),o=new t;return lr(t)?this.handleArrayTypes(e,r,t):(this.processSchemaItems(r,s,o),o)}catch(e){throw e instanceof yr&&e.schemas.push(t.name),e}}static handleChoiceTypes(e,t,r,n){if(e.constructor===Ue&&t.type===Ee.Choice&&3===e.idBlock.tagClass)for(const n in t.items){const i=t.items[n];if(i.context===e.idBlock.tagNumber&&i.implicit&&"function"==typeof i.type&&fr.has(i.type)){const t=fr.get(i.type);if(t&&t.type===Ee.Sequence){const t=new rt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock){t.valueBlock.value=e.valueBlock.value;const s=this.fromASN(t,i.type),o=new r;return o[n]=s,{result:o}}}}}else if(e.constructor===Ue&&t.type!==Ee.Choice){const r=new Ue({idBlock:{tagClass:3,tagNumber:e.idBlock.tagNumber},value:t.schema.valueBlock.value});for(const r in t.items)delete e[r];return{targetSchema:r}}return null}static handleSequenceTypes(e,t,r,n){if(t.type===Ee.Sequence){const t=Tt({},e,n);if(!t.verified)throw new yr(`Data does not match to ${r.name} ASN1 schema.${t.result.error?` ${t.result.error}`:""}`);return t}{const t=Tt({},e,n);if(!t.verified)throw new yr(`Data does not match to ${r.name} ASN1 schema.${t.result.error?` ${t.result.error}`:""}`);return t}}static processRepeatedField(e,t,r){let n=e.slice(t);if(1===n.length&&"Sequence"===n[0].constructor.name){const e=n[0];e.valueBlock&&e.valueBlock.value&&Array.isArray(e.valueBlock.value)&&(n=e.valueBlock.value)}if("number"==typeof r.type){const e=cr(r.type);if(!e)throw new Error(`No converter for ASN.1 type ${r.type}`);return n.filter(e=>e&&e.valueBlock).map(t=>{try{return e.fromASN(t)}catch{return}}).filter(e=>void 0!==e)}return n.filter(e=>e&&e.valueBlock).map(e=>{try{return this.fromASN(e,r.type)}catch{return}}).filter(e=>void 0!==e)}static processPrimitiveField(e,t){const r=cr(t.type);if(!r)throw new Error(`No converter for ASN.1 type ${t.type}`);return r.fromASN(e)}static isOptionalChoiceField(e){return e.optional&&"function"==typeof e.type&&fr.has(e.type)&&fr.get(e.type).type===Ee.Choice}static processOptionalChoiceField(e,t){try{return{processed:!0,value:this.fromASN(e,t.type)}}catch(e){if(e instanceof yr&&/Wrong values for Choice type/.test(e.message))return{processed:!1};throw e}}static handleArrayTypes(e,t,r){if(!("value"in e.valueBlock)||!Array.isArray(e.valueBlock.value))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const n=t.itemType;if("number"==typeof n){const t=cr(n);if(!t)throw new Error(`Cannot get default converter for array item of ${r.name} ASN1 schema`);return r.from(e.valueBlock.value,e=>t.fromASN(e))}return r.from(e.valueBlock.value,e=>this.fromASN(e,n))}static processSchemaItems(e,t,r){for(const n in e.items){const i=t.result[n];if(!i)continue;const s=e.items[n],o=s.type;let a;a="number"==typeof o||ur(o)?this.processPrimitiveSchemaItem(i,s,o):this.processComplexSchemaItem(i,s,o),a&&"object"==typeof a&&"value"in a&&"raw"in a?(r[n]=a.value,r[`${n}Raw`]=a.raw):r[n]=a}}static processPrimitiveSchemaItem(e,t,r){var n;const i=null!==(n=t.converter)&&void 0!==n?n:ur(r)?new r:null;if(!i)throw new Error("Converter is empty");return t.repeated?this.processRepeatedPrimitiveItem(e,t,i):this.processSinglePrimitiveItem(e,t,r,i)}static processRepeatedPrimitiveItem(e,t,r){if(t.implicit){const n=new("sequence"===t.repeated?rt:nt);n.valueBlock=e.valueBlock;const i=Me(n.toBER(!1));if(-1===i.offset)throw new Error(`Cannot parse the child item. ${i.result.error}`);if(!("value"in i.result.valueBlock)||!Array.isArray(i.result.valueBlock.value))throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.");const s=i.result.valueBlock.value;return Array.from(s,e=>r.fromASN(e))}return Array.from(e,e=>r.fromASN(e))}static processSinglePrimitiveItem(e,t,r,i){let s=e;if(t.implicit){let e;if(ur(r))e=(new r).toSchema("");else{const t=Ie[r],i=n[t];if(!i)throw new Error(`Cannot get '${t}' class from asn1js module`);e=new i}e.valueBlock=s.valueBlock,s=Me(e.toBER(!1)).result}return i.fromASN(s)}static processComplexSchemaItem(e,t,r){if(t.repeated){if(!Array.isArray(e))throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.");return Array.from(e,e=>this.fromASN(e,r))}{const n=this.handleImplicitTagging(e,t,r);if(!this.isOptionalChoiceField(t)){const i=this.fromASN(n,r);return t.raw?{value:i,raw:e.valueBeforeDecodeView}:i}try{return this.fromASN(n,r)}catch(e){if(e instanceof yr&&/Wrong values for Choice type/.test(e.message))return;throw e}}}static handleImplicitTagging(e,t,r){if(t.implicit&&"number"==typeof t.context){const t=fr.get(r);if(t.type===Ee.Sequence){const t=new rt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock)return t.valueBlock.value=e.valueBlock.value,t}else if(t.type===Ee.Set){const t=new nt;if("value"in e.valueBlock&&Array.isArray(e.valueBlock.value)&&"value"in t.valueBlock)return t.valueBlock.value=e.valueBlock.value,t}}return e}}class mr{static serialize(e){return e instanceof D?e.toBER(!1):this.toASN(e).toBER(!1)}static toASN(e){if(e&&"object"==typeof e&&ur(e))return e.toASN();if(!e||"object"!=typeof e)throw new TypeError("Parameter 1 should be type of Object.");const t=e.constructor,r=fr.get(t);fr.cache(t);let n,i=[];if(r.itemType){if(!Array.isArray(e))throw new TypeError("Parameter 1 should be type of Array.");if("number"==typeof r.itemType){const n=cr(r.itemType);if(!n)throw new Error(`Cannot get default converter for array item of ${t.name} ASN1 schema`);i=e.map(e=>n.toASN(e))}else i=e.map(e=>this.toAsnItem({type:r.itemType},"[]",t,e))}else for(const n in r.items){const s=r.items[n],o=e[n];if(void 0===o||s.defaultValue===o||"object"==typeof s.defaultValue&&"object"==typeof o&&hr(this.serialize(s.defaultValue),this.serialize(o)))continue;const a=mr.toAsnItem(s,n,t,o);if("number"==typeof s.context)if(s.implicit)if(s.repeated||"number"!=typeof s.type&&!ur(s.type))i.push(new Ue({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},value:a.valueBlock.value}));else{const e={};e.valueHex=a instanceof Re?a.valueBeforeDecodeView:a.valueBlock.toBER(),i.push(new _e({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},...e}))}else i.push(new Ue({optional:s.optional,idBlock:{tagClass:3,tagNumber:s.context},value:[a]}));else s.repeated?i=i.concat(a):i.push(a)}switch(r.type){case Ee.Sequence:n=new rt({value:i});break;case Ee.Set:n=new nt({value:i});break;case Ee.Choice:if(!i[0])throw new Error(`Schema '${t.name}' has wrong data. Choice cannot be empty.`);n=i[0]}return n}static toAsnItem(e,t,r,n){let i;if("number"==typeof e.type){const s=e.converter;if(!s)throw new Error(`Property '${t}' doesn't have converter for type ${Ie[e.type]} in schema '${r.name}'`);if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const t=Array.from(n,e=>s.toASN(e));i=new("sequence"===e.repeated?rt:nt)({value:t})}else i=s.toASN(n)}else if(e.repeated){if(!Array.isArray(n))throw new TypeError("Parameter 'objProp' should be type of Array.");const t=Array.from(n,e=>this.toASN(e));i=new("sequence"===e.repeated?rt:nt)({value:t})}else i=this.toASN(n);return i}}class vr extends Array{constructor(e=[]){if("number"==typeof e)super(e);else{super();for(const t of e)this.push(t)}}}class wr{static serialize(e){return mr.serialize(e)}static parse(e,t){return gr.parse(e,t)}static toString(e){const t=Me(u._H.isBufferSource(e)?u._H.toArrayBuffer(e):wr.serialize(e));if(-1===t.offset)throw new Error(`Cannot decode ASN.1 data. ${t.result.error}`);return t.result.toString()}}var br=r(2723);const{__extends:xr,__assign:Ar,__rest:Sr,__decorate:kr,__param:Br,__esDecorate:Er,__runInitializers:Ir,__propKey:Or,__setFunctionName:_r,__metadata:Pr,__awaiter:Mr,__generator:Cr,__exportStar:Tr,__createBinding:Ur,__values:Nr,__read:jr,__spread:Rr,__spreadArrays:Lr,__spreadArray:zr,__await:Hr,__asyncGenerator:$r,__asyncDelegator:Kr,__asyncValues:Dr,__makeTemplateObject:Vr,__importStar:Fr,__importDefault:qr,__classPrivateFieldGet:Wr,__classPrivateFieldSet:Gr,__classPrivateFieldIn:Zr,__addDisposableResource:Jr,__disposeResources:Yr,__rewriteRelativeImportExtension:Xr}=br;class Qr{static isIPv4(e){return/^(\d{1,3}\.){3}\d{1,3}$/.test(e)}static parseIPv4(e){const t=e.split(".");if(4!==t.length)throw new Error("Invalid IPv4 address");return t.map(e=>{const t=parseInt(e,10);if(isNaN(t)||t<0||t>255)throw new Error("Invalid IPv4 address part");return t})}static parseIPv6(e){const t=this.expandIPv6(e).split(":");if(8!==t.length)throw new Error("Invalid IPv6 address");return t.reduce((e,t)=>{const r=parseInt(t,16);if(isNaN(r)||r<0||r>65535)throw new Error("Invalid IPv6 address part");return e.push(r>>8&255),e.push(255&r),e},[])}static expandIPv6(e){if(!e.includes("::"))return e;const t=e.split("::");if(t.length>2)throw new Error("Invalid IPv6 address");const r=t[0]?t[0].split(":"):[],n=t[1]?t[1].split(":"):[],i=8-(r.length+n.length);if(i<0)throw new Error("Invalid IPv6 address");return[...r,...Array(i).fill("0"),...n].join(":")}static formatIPv6(e){const t=[];for(let r=0;r<16;r+=2)t.push((e[r]<<8|e[r+1]).toString(16));return this.compressIPv6(t.join(":"))}static compressIPv6(e){const t=e.split(":");let r=-1,n=0,i=-1,s=0;for(let e=0;en&&(r=i,n=s),i=-1,s=0);return s>n&&(r=i,n=s),n>1?`${t.slice(0,r).join(":")}::${t.slice(r+n).join(":")}`:e}static parseCIDR(e){const[t,r]=e.split("/"),n=parseInt(r,10);if(this.isIPv4(t)){if(n<0||n>32)throw new Error("Invalid IPv4 prefix length");return[this.parseIPv4(t),n]}if(n<0||n>128)throw new Error("Invalid IPv6 prefix length");return[this.parseIPv6(t),n]}static decodeIP(e){if(64===e.length&&0===parseInt(e,16))return"::/0";if(16!==e.length)return e;const t=parseInt(e.slice(8),16).toString(2).split("").reduce((e,t)=>e+ +t,0);let r=e.slice(0,8).replace(/(.{2})/g,e=>`${parseInt(e,16)}.`);return r=r.slice(0,-1),`${r}/${t}`}static toString(e){const t=new Uint8Array(e);if(4===t.length)return Array.from(t).join(".");if(16===t.length)return this.formatIPv6(t);if(8===t.length||32===t.length){const e=t.length/2,r=t.slice(0,e),n=t.slice(e);if(t.every(e=>0===e))return 8===t.length?"0.0.0.0/0":"::/0";const i=n.reduce((e,t)=>e+(t.toString(2).match(/1/g)||[]).length,0);return 8===t.length?`${Array.from(r).join(".")}/${i}`:`${this.formatIPv6(r)}/${i}`}return this.decodeIP(u.U$.ToHex(e))}static fromString(e){if(e.includes("/")){const[t,r]=this.parseCIDR(e),n=new Uint8Array(t.length);let i=r;for(let e=0;e=8?(n[e]=255,i-=8):i>0&&(n[e]=255<<8-i,i=0);const s=new Uint8Array(2*t.length);return s.set(t,0),s.set(n,t.length),s.buffer}const t=this.isIPv4(e)?this.parseIPv4(e):this.parseIPv6(e);return new Uint8Array(t).buffer}}var en,tn,rn;let nn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.bmpString||this.printableString||this.teletexString||this.universalString||this.utf8String||""}};kr([pr({type:Ie.TeletexString})],nn.prototype,"teletexString",void 0),kr([pr({type:Ie.PrintableString})],nn.prototype,"printableString",void 0),kr([pr({type:Ie.UniversalString})],nn.prototype,"universalString",void 0),kr([pr({type:Ie.Utf8String})],nn.prototype,"utf8String",void 0),kr([pr({type:Ie.BmpString})],nn.prototype,"bmpString",void 0),nn=kr([dr({type:Ee.Choice})],nn);let sn=class extends nn{constructor(e={}){super(e),Object.assign(this,e)}toString(){return this.ia5String||(this.anyValue?u.U$.ToHex(this.anyValue):super.toString())}};kr([pr({type:Ie.IA5String})],sn.prototype,"ia5String",void 0),kr([pr({type:Ie.Any})],sn.prototype,"anyValue",void 0),sn=kr([dr({type:Ee.Choice})],sn);class on{constructor(e={}){this.type="",this.value=new sn,Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],on.prototype,"type",void 0),kr([pr({type:sn})],on.prototype,"value",void 0);let an=en=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,en.prototype)}};an=en=kr([dr({type:Ee.Set,itemType:on})],an);let cn=tn=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,tn.prototype)}};cn=tn=kr([dr({type:Ee.Sequence,itemType:an})],cn);let un=rn=class extends cn{constructor(e){super(e),Object.setPrototypeOf(this,rn.prototype)}};un=rn=kr([dr({type:Ee.Sequence})],un);const ln={fromASN:e=>Qr.toString(Vt.fromASN(e)),toASN:e=>Vt.toASN(Qr.fromString(e))};class hn{constructor(e={}){this.typeId="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],hn.prototype,"typeId",void 0),kr([pr({type:Ie.Any,context:0})],hn.prototype,"value",void 0);class fn{constructor(e={}){this.partyName=new nn,Object.assign(this,e)}}kr([pr({type:nn,optional:!0,context:0,implicit:!0})],fn.prototype,"nameAssigner",void 0),kr([pr({type:nn,context:1,implicit:!0})],fn.prototype,"partyName",void 0);let dn=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:hn,context:0,implicit:!0})],dn.prototype,"otherName",void 0),kr([pr({type:Ie.IA5String,context:1,implicit:!0})],dn.prototype,"rfc822Name",void 0),kr([pr({type:Ie.IA5String,context:2,implicit:!0})],dn.prototype,"dNSName",void 0),kr([pr({type:Ie.Any,context:3,implicit:!0})],dn.prototype,"x400Address",void 0),kr([pr({type:un,context:4,implicit:!1})],dn.prototype,"directoryName",void 0),kr([pr({type:fn,context:5})],dn.prototype,"ediPartyName",void 0),kr([pr({type:Ie.IA5String,context:6,implicit:!0})],dn.prototype,"uniformResourceIdentifier",void 0),kr([pr({type:Ie.OctetString,context:7,implicit:!0,converter:ln})],dn.prototype,"iPAddress",void 0),kr([pr({type:Ie.ObjectIdentifier,context:8,implicit:!0})],dn.prototype,"registeredID",void 0),dn=kr([dr({type:Ee.Choice})],dn);const pn="1.3.6.1.5.5.7",yn=`${pn}.3`,gn=`${pn}.48`,mn=`${gn}.1`,vn=`${gn}.2`,wn=`${gn}.3`,bn=`${gn}.5`,xn="2.5.29";var An;const Sn=`${pn}.1.1`;class kn{constructor(e={}){this.accessMethod="",this.accessLocation=new dn,Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],kn.prototype,"accessMethod",void 0),kr([pr({type:dn})],kn.prototype,"accessLocation",void 0);let Bn=An=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,An.prototype)}};Bn=An=kr([dr({type:Ee.Sequence,itemType:kn})],Bn);const En=`${xn}.35`;class In extends jt{}class On{constructor(e={}){e&&Object.assign(this,e)}}kr([pr({type:In,context:0,optional:!0,implicit:!0})],On.prototype,"keyIdentifier",void 0),kr([pr({type:dn,context:1,optional:!0,implicit:!0,repeated:"sequence"})],On.prototype,"authorityCertIssuer",void 0),kr([pr({type:Ie.Integer,context:2,optional:!0,implicit:!0,converter:Ht})],On.prototype,"authorityCertSerialNumber",void 0);const _n=`${xn}.19`;class Pn{constructor(e={}){this.cA=!1,Object.assign(this,e)}}var Mn;kr([pr({type:Ie.Boolean,defaultValue:!1})],Pn.prototype,"cA",void 0),kr([pr({type:Ie.Integer,optional:!0})],Pn.prototype,"pathLenConstraint",void 0);let Cn=Mn=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Mn.prototype)}};var Tn;Cn=Mn=kr([dr({type:Ee.Sequence,itemType:dn})],Cn);let Un=Tn=class extends Cn{constructor(e){super(e),Object.setPrototypeOf(this,Tn.prototype)}};var Nn;Un=Tn=kr([dr({type:Ee.Sequence})],Un);const jn=`${xn}.32`;let Rn=class{constructor(e={}){Object.assign(this,e)}toString(){return this.ia5String||this.visibleString||this.bmpString||this.utf8String||""}};kr([pr({type:Ie.IA5String})],Rn.prototype,"ia5String",void 0),kr([pr({type:Ie.VisibleString})],Rn.prototype,"visibleString",void 0),kr([pr({type:Ie.BmpString})],Rn.prototype,"bmpString",void 0),kr([pr({type:Ie.Utf8String})],Rn.prototype,"utf8String",void 0),Rn=kr([dr({type:Ee.Choice})],Rn);class Ln{constructor(e={}){this.organization=new Rn,this.noticeNumbers=[],Object.assign(this,e)}}kr([pr({type:Rn})],Ln.prototype,"organization",void 0),kr([pr({type:Ie.Integer,repeated:"sequence"})],Ln.prototype,"noticeNumbers",void 0);class zn{constructor(e={}){Object.assign(this,e)}}kr([pr({type:Ln,optional:!0})],zn.prototype,"noticeRef",void 0),kr([pr({type:Rn,optional:!0})],zn.prototype,"explicitText",void 0);let Hn=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Ie.IA5String})],Hn.prototype,"cPSuri",void 0),kr([pr({type:zn})],Hn.prototype,"userNotice",void 0),Hn=kr([dr({type:Ee.Choice})],Hn);class $n{constructor(e={}){this.policyQualifierId="",this.qualifier=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],$n.prototype,"policyQualifierId",void 0),kr([pr({type:Ie.Any})],$n.prototype,"qualifier",void 0);class Kn{constructor(e={}){this.policyIdentifier="",Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Kn.prototype,"policyIdentifier",void 0),kr([pr({type:$n,repeated:"sequence",optional:!0})],Kn.prototype,"policyQualifiers",void 0);let Dn=Nn=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Nn.prototype)}};Dn=Nn=kr([dr({type:Ee.Sequence,itemType:Kn})],Dn);let Vn=class{constructor(e=0){this.value=e}};kr([pr({type:Ie.Integer})],Vn.prototype,"value",void 0),Vn=kr([dr({type:Ee.Choice})],Vn);let Fn=class extends Vn{};var qn;Fn=kr([dr({type:Ee.Choice})],Fn);const Wn=`${xn}.31`;var Gn;!function(e){e[e.unused=1]="unused",e[e.keyCompromise=2]="keyCompromise",e[e.cACompromise=4]="cACompromise",e[e.affiliationChanged=8]="affiliationChanged",e[e.superseded=16]="superseded",e[e.cessationOfOperation=32]="cessationOfOperation",e[e.certificateHold=64]="certificateHold",e[e.privilegeWithdrawn=128]="privilegeWithdrawn",e[e.aACompromise=256]="aACompromise"}(Gn||(Gn={}));class Zn extends Nt{toJSON(){const e=[],t=this.toNumber();return t&Gn.aACompromise&&e.push("aACompromise"),t&Gn.affiliationChanged&&e.push("affiliationChanged"),t&Gn.cACompromise&&e.push("cACompromise"),t&Gn.certificateHold&&e.push("certificateHold"),t&Gn.cessationOfOperation&&e.push("cessationOfOperation"),t&Gn.keyCompromise&&e.push("keyCompromise"),t&Gn.privilegeWithdrawn&&e.push("privilegeWithdrawn"),t&Gn.superseded&&e.push("superseded"),t&Gn.unused&&e.push("unused"),e}toString(){return`[${this.toJSON().join(", ")}]`}}let Jn=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:dn,context:0,repeated:"sequence",implicit:!0})],Jn.prototype,"fullName",void 0),kr([pr({type:an,context:1,implicit:!0})],Jn.prototype,"nameRelativeToCRLIssuer",void 0),Jn=kr([dr({type:Ee.Choice})],Jn);class Yn{constructor(e={}){Object.assign(this,e)}}kr([pr({type:Jn,context:0,optional:!0})],Yn.prototype,"distributionPoint",void 0),kr([pr({type:Zn,context:1,optional:!0,implicit:!0})],Yn.prototype,"reasons",void 0),kr([pr({type:dn,context:2,optional:!0,repeated:"sequence",implicit:!0})],Yn.prototype,"cRLIssuer",void 0);let Xn=qn=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,qn.prototype)}};var Qn;Xn=qn=kr([dr({type:Ee.Sequence,itemType:Yn})],Xn);let ei=Qn=class extends Xn{constructor(e){super(e),Object.setPrototypeOf(this,Qn.prototype)}};ei=Qn=kr([dr({type:Ee.Sequence,itemType:Yn})],ei);class ti{constructor(e={}){this.onlyContainsUserCerts=ti.ONLY,this.onlyContainsCACerts=ti.ONLY,this.indirectCRL=ti.ONLY,this.onlyContainsAttributeCerts=ti.ONLY,Object.assign(this,e)}}var ri;ti.ONLY=!1,kr([pr({type:Jn,context:0,optional:!0})],ti.prototype,"distributionPoint",void 0),kr([pr({type:Ie.Boolean,context:1,defaultValue:ti.ONLY,implicit:!0})],ti.prototype,"onlyContainsUserCerts",void 0),kr([pr({type:Ie.Boolean,context:2,defaultValue:ti.ONLY,implicit:!0})],ti.prototype,"onlyContainsCACerts",void 0),kr([pr({type:Zn,context:3,optional:!0,implicit:!0})],ti.prototype,"onlySomeReasons",void 0),kr([pr({type:Ie.Boolean,context:4,defaultValue:ti.ONLY,implicit:!0})],ti.prototype,"indirectCRL",void 0),kr([pr({type:Ie.Boolean,context:5,defaultValue:ti.ONLY,implicit:!0})],ti.prototype,"onlyContainsAttributeCerts",void 0),function(e){e[e.unspecified=0]="unspecified",e[e.keyCompromise=1]="keyCompromise",e[e.cACompromise=2]="cACompromise",e[e.affiliationChanged=3]="affiliationChanged",e[e.superseded=4]="superseded",e[e.cessationOfOperation=5]="cessationOfOperation",e[e.certificateHold=6]="certificateHold",e[e.removeFromCRL=8]="removeFromCRL",e[e.privilegeWithdrawn=9]="privilegeWithdrawn",e[e.aACompromise=10]="aACompromise"}(ri||(ri={}));let ni=class{constructor(e=ri.unspecified){this.reason=ri.unspecified,this.reason=e}toJSON(){return ri[this.reason]}toString(){return this.toJSON()}};var ii;kr([pr({type:Ie.Enumerated})],ni.prototype,"reason",void 0),ni=kr([dr({type:Ee.Choice})],ni);const si=`${xn}.37`;let oi=ii=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,ii.prototype)}};oi=ii=kr([dr({type:Ee.Sequence,itemType:Ie.ObjectIdentifier})],oi);const ai=`${yn}.1`,ci=`${yn}.2`,ui=`${yn}.3`,li=`${yn}.4`,hi=`${yn}.8`,fi=`${yn}.9`;let di=class{constructor(e=new ArrayBuffer(0)){this.value=e}};kr([pr({type:Ie.Integer,converter:Ht})],di.prototype,"value",void 0),di=kr([dr({type:Ee.Choice})],di);let pi=class{constructor(e){this.value=new Date,e&&(this.value=e)}};var yi;kr([pr({type:Ie.GeneralizedTime})],pi.prototype,"value",void 0),pi=kr([dr({type:Ee.Choice})],pi);let gi=yi=class extends Cn{constructor(e){super(e),Object.setPrototypeOf(this,yi.prototype)}};gi=yi=kr([dr({type:Ee.Sequence})],gi);const mi=`${xn}.15`;var vi,wi;!function(e){e[e.digitalSignature=1]="digitalSignature",e[e.nonRepudiation=2]="nonRepudiation",e[e.keyEncipherment=4]="keyEncipherment",e[e.dataEncipherment=8]="dataEncipherment",e[e.keyAgreement=16]="keyAgreement",e[e.keyCertSign=32]="keyCertSign",e[e.cRLSign=64]="cRLSign",e[e.encipherOnly=128]="encipherOnly",e[e.decipherOnly=256]="decipherOnly"}(vi||(vi={}));class bi extends Nt{toJSON(){const e=this.toNumber(),t=[];return e&vi.cRLSign&&t.push("crlSign"),e&vi.dataEncipherment&&t.push("dataEncipherment"),e&vi.decipherOnly&&t.push("decipherOnly"),e&vi.digitalSignature&&t.push("digitalSignature"),e&vi.encipherOnly&&t.push("encipherOnly"),e&vi.keyAgreement&&t.push("keyAgreement"),e&vi.keyCertSign&&t.push("keyCertSign"),e&vi.keyEncipherment&&t.push("keyEncipherment"),e&vi.nonRepudiation&&t.push("nonRepudiation"),t}toString(){return`[${this.toJSON().join(", ")}]`}}class xi{constructor(e={}){this.base=new dn,this.minimum=0,Object.assign(this,e)}}kr([pr({type:dn})],xi.prototype,"base",void 0),kr([pr({type:Ie.Integer,context:0,defaultValue:0,implicit:!0})],xi.prototype,"minimum",void 0),kr([pr({type:Ie.Integer,context:1,optional:!0,implicit:!0})],xi.prototype,"maximum",void 0);let Ai=wi=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,wi.prototype)}};Ai=wi=kr([dr({type:Ee.Sequence,itemType:xi})],Ai);class Si{constructor(e={}){Object.assign(this,e)}}kr([pr({type:Ai,context:0,optional:!0,implicit:!0})],Si.prototype,"permittedSubtrees",void 0),kr([pr({type:Ai,context:1,optional:!0,implicit:!0})],Si.prototype,"excludedSubtrees",void 0);class ki{constructor(e={}){Object.assign(this,e)}}var Bi;kr([pr({type:Ie.Integer,context:0,implicit:!0,optional:!0,converter:Ht})],ki.prototype,"requireExplicitPolicy",void 0),kr([pr({type:Ie.Integer,context:1,implicit:!0,optional:!0,converter:Ht})],ki.prototype,"inhibitPolicyMapping",void 0);class Ei{constructor(e={}){this.issuerDomainPolicy="",this.subjectDomainPolicy="",Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Ei.prototype,"issuerDomainPolicy",void 0),kr([pr({type:Ie.ObjectIdentifier})],Ei.prototype,"subjectDomainPolicy",void 0);let Ii=Bi=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Bi.prototype)}};var Oi;Ii=Bi=kr([dr({type:Ee.Sequence,itemType:Ei})],Ii);const _i=`${xn}.17`;let Pi=Oi=class extends Cn{constructor(e){super(e),Object.setPrototypeOf(this,Oi.prototype)}};Pi=Oi=kr([dr({type:Ee.Sequence})],Pi);class Mi{constructor(e={}){this.type="",this.values=[],Object.assign(this,e)}}var Ci;kr([pr({type:Ie.ObjectIdentifier})],Mi.prototype,"type",void 0),kr([pr({type:Ie.Any,repeated:"set"})],Mi.prototype,"values",void 0);let Ti=Ci=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Ci.prototype)}};Ti=Ci=kr([dr({type:Ee.Sequence,itemType:Mi})],Ti);const Ui=`${xn}.14`;class Ni extends In{}class ji{constructor(e={}){Object.assign(this,e)}}var Ri,Li;kr([pr({type:Ie.GeneralizedTime,context:0,implicit:!0,optional:!0})],ji.prototype,"notBefore",void 0),kr([pr({type:Ie.GeneralizedTime,context:1,implicit:!0,optional:!0})],ji.prototype,"notAfter",void 0),function(e){e[e.keyUpdateAllowed=1]="keyUpdateAllowed",e[e.newExtensions=2]="newExtensions",e[e.pKIXCertificate=4]="pKIXCertificate"}(Ri||(Ri={}));class zi extends Nt{toJSON(){const e=[],t=this.toNumber();return t&Ri.pKIXCertificate&&e.push("pKIXCertificate"),t&Ri.newExtensions&&e.push("newExtensions"),t&Ri.keyUpdateAllowed&&e.push("keyUpdateAllowed"),e}toString(){return`[${this.toJSON().join(", ")}]`}}class Hi{constructor(e={}){this.entrustVers="",this.entrustInfoFlags=new zi,Object.assign(this,e)}}kr([pr({type:Ie.GeneralString})],Hi.prototype,"entrustVers",void 0),kr([pr({type:zi})],Hi.prototype,"entrustInfoFlags",void 0);let $i=Li=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Li.prototype)}};$i=Li=kr([dr({type:Ee.Sequence,itemType:kn})],$i);class Ki{constructor(e={}){this.algorithm="",Object.assign(this,e)}isEqual(e){return e instanceof Ki&&e.algorithm==this.algorithm&&(e.parameters&&this.parameters&&u.n4(e.parameters,this.parameters)||e.parameters===this.parameters)}}kr([pr({type:Ie.ObjectIdentifier})],Ki.prototype,"algorithm",void 0),kr([pr({type:Ie.Any,optional:!0})],Ki.prototype,"parameters",void 0);class Di{constructor(e={}){this.algorithm=new Ki,this.subjectPublicKey=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ki})],Di.prototype,"algorithm",void 0),kr([pr({type:Ie.BitString})],Di.prototype,"subjectPublicKey",void 0);let Vi=class{constructor(e){if(e)if("string"==typeof e||"number"==typeof e||e instanceof Date){const t=new Date(e);t.getUTCFullYear()>2049?this.generalTime=t:this.utcTime=t}else Object.assign(this,e)}getTime(){const e=this.utcTime||this.generalTime;if(!e)throw new Error("Cannot get time from CHOICE object");return e}};kr([pr({type:Ie.UTCTime})],Vi.prototype,"utcTime",void 0),kr([pr({type:Ie.GeneralizedTime})],Vi.prototype,"generalTime",void 0),Vi=kr([dr({type:Ee.Choice})],Vi);class Fi{constructor(e){this.notBefore=new Vi(new Date),this.notAfter=new Vi(new Date),e&&(this.notBefore=new Vi(e.notBefore),this.notAfter=new Vi(e.notAfter))}}var qi;kr([pr({type:Vi})],Fi.prototype,"notBefore",void 0),kr([pr({type:Vi})],Fi.prototype,"notAfter",void 0);class Wi{constructor(e={}){this.extnID="",this.critical=Wi.CRITICAL,this.extnValue=new jt,Object.assign(this,e)}}Wi.CRITICAL=!1,kr([pr({type:Ie.ObjectIdentifier})],Wi.prototype,"extnID",void 0),kr([pr({type:Ie.Boolean,defaultValue:Wi.CRITICAL})],Wi.prototype,"critical",void 0),kr([pr({type:jt})],Wi.prototype,"extnValue",void 0);let Gi=qi=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,qi.prototype)}};var Zi;Gi=qi=kr([dr({type:Ee.Sequence,itemType:Wi})],Gi),function(e){e[e.v1=0]="v1",e[e.v2=1]="v2",e[e.v3=2]="v3"}(Zi||(Zi={}));class Ji{constructor(e={}){this.version=Zi.v1,this.serialNumber=new ArrayBuffer(0),this.signature=new Ki,this.issuer=new un,this.validity=new Fi,this.subject=new un,this.subjectPublicKeyInfo=new Di,Object.assign(this,e)}}kr([pr({type:Ie.Integer,context:0,defaultValue:Zi.v1})],Ji.prototype,"version",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ji.prototype,"serialNumber",void 0),kr([pr({type:Ki})],Ji.prototype,"signature",void 0),kr([pr({type:un})],Ji.prototype,"issuer",void 0),kr([pr({type:Fi})],Ji.prototype,"validity",void 0),kr([pr({type:un})],Ji.prototype,"subject",void 0),kr([pr({type:Di})],Ji.prototype,"subjectPublicKeyInfo",void 0),kr([pr({type:Ie.BitString,context:1,implicit:!0,optional:!0})],Ji.prototype,"issuerUniqueID",void 0),kr([pr({type:Ie.BitString,context:2,implicit:!0,optional:!0})],Ji.prototype,"subjectUniqueID",void 0),kr([pr({type:Gi,context:3,optional:!0})],Ji.prototype,"extensions",void 0);class Yi{constructor(e={}){this.tbsCertificate=new Ji,this.signatureAlgorithm=new Ki,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ji,raw:!0})],Yi.prototype,"tbsCertificate",void 0),kr([pr({type:Ki})],Yi.prototype,"signatureAlgorithm",void 0),kr([pr({type:Ie.BitString})],Yi.prototype,"signatureValue",void 0);class Xi{constructor(e={}){this.userCertificate=new ArrayBuffer(0),this.revocationDate=new Vi,Object.assign(this,e)}}kr([pr({type:Ie.Integer,converter:Ht})],Xi.prototype,"userCertificate",void 0),kr([pr({type:Vi})],Xi.prototype,"revocationDate",void 0),kr([pr({type:Wi,optional:!0,repeated:"sequence"})],Xi.prototype,"crlEntryExtensions",void 0);class Qi{constructor(e={}){this.signature=new Ki,this.issuer=new un,this.thisUpdate=new Vi,Object.assign(this,e)}}kr([pr({type:Ie.Integer,optional:!0})],Qi.prototype,"version",void 0),kr([pr({type:Ki})],Qi.prototype,"signature",void 0),kr([pr({type:un})],Qi.prototype,"issuer",void 0),kr([pr({type:Vi})],Qi.prototype,"thisUpdate",void 0),kr([pr({type:Vi,optional:!0})],Qi.prototype,"nextUpdate",void 0),kr([pr({type:Xi,repeated:"sequence",optional:!0})],Qi.prototype,"revokedCertificates",void 0),kr([pr({type:Wi,optional:!0,context:0,repeated:"sequence"})],Qi.prototype,"crlExtensions",void 0);class es{constructor(e={}){this.tbsCertList=new Qi,this.signatureAlgorithm=new Ki,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Qi,raw:!0})],es.prototype,"tbsCertList",void 0),kr([pr({type:Ki})],es.prototype,"signatureAlgorithm",void 0),kr([pr({type:Ie.BitString})],es.prototype,"signature",void 0);class ts{constructor(e={}){this.issuer=new un,this.serialNumber=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:un})],ts.prototype,"issuer",void 0),kr([pr({type:Ie.Integer,converter:Ht})],ts.prototype,"serialNumber",void 0);let rs=class{constructor(e={}){Object.assign(this,e)}};var ns;kr([pr({type:Ni,context:0,implicit:!0})],rs.prototype,"subjectKeyIdentifier",void 0),kr([pr({type:ts})],rs.prototype,"issuerAndSerialNumber",void 0),rs=kr([dr({type:Ee.Choice})],rs),function(e){e[e.v0=0]="v0",e[e.v1=1]="v1",e[e.v2=2]="v2",e[e.v3=3]="v3",e[e.v4=4]="v4",e[e.v5=5]="v5"}(ns||(ns={}));let is=class extends Ki{};is=kr([dr({type:Ee.Sequence})],is);let ss=class extends Ki{};ss=kr([dr({type:Ee.Sequence})],ss);let os=class extends Ki{};os=kr([dr({type:Ee.Sequence})],os);let as=class extends Ki{};as=kr([dr({type:Ee.Sequence})],as);let cs=class extends Ki{};cs=kr([dr({type:Ee.Sequence})],cs);let us=class extends Ki{};us=kr([dr({type:Ee.Sequence})],us);class ls{constructor(e={}){this.attrType="",this.attrValues=[],Object.assign(this,e)}}var hs;kr([pr({type:Ie.ObjectIdentifier})],ls.prototype,"attrType",void 0),kr([pr({type:Ie.Any,repeated:"set"})],ls.prototype,"attrValues",void 0);class fs{constructor(e={}){this.version=ns.v0,this.sid=new rs,this.digestAlgorithm=new is,this.signatureAlgorithm=new ss,this.signature=new jt,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],fs.prototype,"version",void 0),kr([pr({type:rs})],fs.prototype,"sid",void 0),kr([pr({type:is})],fs.prototype,"digestAlgorithm",void 0),kr([pr({type:ls,repeated:"set",context:0,implicit:!0,optional:!0,raw:!0})],fs.prototype,"signedAttrs",void 0),kr([pr({type:ss})],fs.prototype,"signatureAlgorithm",void 0),kr([pr({type:jt})],fs.prototype,"signature",void 0),kr([pr({type:ls,repeated:"set",context:1,implicit:!0,optional:!0})],fs.prototype,"unsignedAttrs",void 0);let ds=hs=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,hs.prototype)}};ds=hs=kr([dr({type:Ee.Set,itemType:fs})],ds);let ps=class extends fs{};ps=kr([dr({type:Ee.Sequence})],ps);let ys=class extends Vi{};ys=kr([dr({type:Ee.Choice})],ys);class gs{constructor(e={}){this.acIssuer=new dn,this.acSerial=0,this.attrs=[],Object.assign(this,e)}}var ms;kr([pr({type:dn})],gs.prototype,"acIssuer",void 0),kr([pr({type:Ie.Integer})],gs.prototype,"acSerial",void 0),kr([pr({type:Mi,repeated:"sequence"})],gs.prototype,"attrs",void 0);let vs=ms=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,ms.prototype)}};vs=ms=kr([dr({type:Ee.Sequence,itemType:Ie.ObjectIdentifier})],vs);class ws{constructor(e={}){this.permitUnSpecified=!0,Object.assign(this,e)}}kr([pr({type:Ie.Integer,optional:!0})],ws.prototype,"pathLenConstraint",void 0),kr([pr({type:vs,implicit:!0,context:0,optional:!0})],ws.prototype,"permittedAttrs",void 0),kr([pr({type:vs,implicit:!0,context:1,optional:!0})],ws.prototype,"excludedAttrs",void 0),kr([pr({type:Ie.Boolean,defaultValue:!0})],ws.prototype,"permitUnSpecified",void 0);class bs{constructor(e={}){this.issuer=new Cn,this.serial=new ArrayBuffer(0),this.issuerUID=new ArrayBuffer(0),Object.assign(this,e)}}var xs;kr([pr({type:Cn})],bs.prototype,"issuer",void 0),kr([pr({type:Ie.Integer,converter:Ht})],bs.prototype,"serial",void 0),kr([pr({type:Ie.BitString,optional:!0})],bs.prototype,"issuerUID",void 0),function(e){e[e.publicKey=0]="publicKey",e[e.publicKeyCert=1]="publicKeyCert",e[e.otherObjectTypes=2]="otherObjectTypes"}(xs||(xs={}));class As{constructor(e={}){this.digestedObjectType=xs.publicKey,this.digestAlgorithm=new Ki,this.objectDigest=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.Enumerated})],As.prototype,"digestedObjectType",void 0),kr([pr({type:Ie.ObjectIdentifier,optional:!0})],As.prototype,"otherObjectTypeID",void 0),kr([pr({type:Ki})],As.prototype,"digestAlgorithm",void 0),kr([pr({type:Ie.BitString})],As.prototype,"objectDigest",void 0);class Ss{constructor(e={}){Object.assign(this,e)}}kr([pr({type:Cn,optional:!0})],Ss.prototype,"issuerName",void 0),kr([pr({type:bs,context:0,implicit:!0,optional:!0})],Ss.prototype,"baseCertificateID",void 0),kr([pr({type:As,context:1,implicit:!0,optional:!0})],Ss.prototype,"objectDigestInfo",void 0);let ks=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:dn,repeated:"sequence"})],ks.prototype,"v1Form",void 0),kr([pr({type:Ss,context:0,implicit:!0})],ks.prototype,"v2Form",void 0),ks=kr([dr({type:Ee.Choice})],ks);class Bs{constructor(e={}){this.notBeforeTime=new Date,this.notAfterTime=new Date,Object.assign(this,e)}}kr([pr({type:Ie.GeneralizedTime})],Bs.prototype,"notBeforeTime",void 0),kr([pr({type:Ie.GeneralizedTime})],Bs.prototype,"notAfterTime",void 0);class Es{constructor(e={}){Object.assign(this,e)}}var Is,Os,_s;kr([pr({type:bs,implicit:!0,context:0,optional:!0})],Es.prototype,"baseCertificateID",void 0),kr([pr({type:Cn,implicit:!0,context:1,optional:!0})],Es.prototype,"entityName",void 0),kr([pr({type:As,implicit:!0,context:2,optional:!0})],Es.prototype,"objectDigestInfo",void 0),function(e){e[e.v2=1]="v2"}(Is||(Is={}));class Ps{constructor(e={}){this.version=Is.v2,this.holder=new Es,this.issuer=new ks,this.signature=new Ki,this.serialNumber=new ArrayBuffer(0),this.attrCertValidityPeriod=new Bs,this.attributes=[],Object.assign(this,e)}}kr([pr({type:Ie.Integer})],Ps.prototype,"version",void 0),kr([pr({type:Es})],Ps.prototype,"holder",void 0),kr([pr({type:ks})],Ps.prototype,"issuer",void 0),kr([pr({type:Ki})],Ps.prototype,"signature",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ps.prototype,"serialNumber",void 0),kr([pr({type:Bs})],Ps.prototype,"attrCertValidityPeriod",void 0),kr([pr({type:Mi,repeated:"sequence"})],Ps.prototype,"attributes",void 0),kr([pr({type:Ie.BitString,optional:!0})],Ps.prototype,"issuerUniqueID",void 0),kr([pr({type:Gi,optional:!0})],Ps.prototype,"extensions",void 0);class Ms{constructor(e={}){this.acinfo=new Ps,this.signatureAlgorithm=new Ki,this.signatureValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ps})],Ms.prototype,"acinfo",void 0),kr([pr({type:Ki})],Ms.prototype,"signatureAlgorithm",void 0),kr([pr({type:Ie.BitString})],Ms.prototype,"signatureValue",void 0),function(e){e[e.unmarked=1]="unmarked",e[e.unclassified=2]="unclassified",e[e.restricted=4]="restricted",e[e.confidential=8]="confidential",e[e.secret=16]="secret",e[e.topSecret=32]="topSecret"}(Os||(Os={}));class Cs extends Nt{}class Ts{constructor(e={}){this.type="",this.value=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier,implicit:!0,context:0})],Ts.prototype,"type",void 0),kr([pr({type:Ie.Any,implicit:!0,context:1})],Ts.prototype,"value",void 0);class Us{constructor(e={}){this.policyId="",this.classList=new Cs(Os.unclassified),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Us.prototype,"policyId",void 0),kr([pr({type:Cs,defaultValue:new Cs(Os.unclassified)})],Us.prototype,"classList",void 0),kr([pr({type:Ts,repeated:"set"})],Us.prototype,"securityCategories",void 0);class Ns{constructor(e={}){Object.assign(this,e)}}kr([pr({type:jt})],Ns.prototype,"cotets",void 0),kr([pr({type:Ie.ObjectIdentifier})],Ns.prototype,"oid",void 0),kr([pr({type:Ie.Utf8String})],Ns.prototype,"string",void 0);class js{constructor(e={}){this.values=[],Object.assign(this,e)}}kr([pr({type:Cn,implicit:!0,context:0,optional:!0})],js.prototype,"policyAuthority",void 0),kr([pr({type:Ns,repeated:"sequence"})],js.prototype,"values",void 0);class Rs{constructor(e={}){this.targetCertificate=new bs,Object.assign(this,e)}}kr([pr({type:bs})],Rs.prototype,"targetCertificate",void 0),kr([pr({type:dn,optional:!0})],Rs.prototype,"targetName",void 0),kr([pr({type:As,optional:!0})],Rs.prototype,"certDigestInfo",void 0);let Ls=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:dn,context:0,implicit:!0})],Ls.prototype,"targetName",void 0),kr([pr({type:dn,context:1,implicit:!0})],Ls.prototype,"targetGroup",void 0),kr([pr({type:Rs,context:2,implicit:!0})],Ls.prototype,"targetCert",void 0),Ls=kr([dr({type:Ee.Choice})],Ls);let zs=_s=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,_s.prototype)}};var Hs;zs=_s=kr([dr({type:Ee.Sequence,itemType:Ls})],zs);let $s=Hs=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Hs.prototype)}};$s=Hs=kr([dr({type:Ee.Sequence,itemType:zs})],$s);class Ks{constructor(e={}){Object.assign(this,e)}}kr([pr({type:Cn,implicit:!0,context:0,optional:!0})],Ks.prototype,"roleAuthority",void 0),kr([pr({type:dn,implicit:!0,context:1})],Ks.prototype,"roleName",void 0);class Ds{constructor(e={}){this.service=new dn,this.ident=new dn,Object.assign(this,e)}}var Vs;kr([pr({type:dn})],Ds.prototype,"service",void 0),kr([pr({type:dn})],Ds.prototype,"ident",void 0),kr([pr({type:jt,optional:!0})],Ds.prototype,"authInfo",void 0);class Fs{constructor(e={}){this.otherCertFormat="",this.otherCert=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Fs.prototype,"otherCertFormat",void 0),kr([pr({type:Ie.Any})],Fs.prototype,"otherCert",void 0);let qs=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Yi})],qs.prototype,"certificate",void 0),kr([pr({type:Ms,context:2,implicit:!0})],qs.prototype,"v2AttrCert",void 0),kr([pr({type:Fs,context:3,implicit:!0})],qs.prototype,"other",void 0),qs=kr([dr({type:Ee.Choice})],qs);let Ws=Vs=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Vs.prototype)}};Ws=Vs=kr([dr({type:Ee.Set,itemType:qs})],Ws);class Gs{constructor(e={}){this.contentType="",this.content=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Gs.prototype,"contentType",void 0),kr([pr({type:Ie.Any,context:0})],Gs.prototype,"content",void 0);let Zs=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:jt})],Zs.prototype,"single",void 0),kr([pr({type:Ie.Any})],Zs.prototype,"any",void 0),Zs=kr([dr({type:Ee.Choice})],Zs);class Js{constructor(e={}){this.eContentType="",Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Js.prototype,"eContentType",void 0),kr([pr({type:Zs,context:0,optional:!0})],Js.prototype,"eContent",void 0);let Ys=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:jt,context:0,implicit:!0,optional:!0})],Ys.prototype,"value",void 0),kr([pr({type:jt,converter:Ft,context:0,implicit:!0,optional:!0,repeated:"sequence"})],Ys.prototype,"constructedValue",void 0),Ys=kr([dr({type:Ee.Choice})],Ys);class Xs{constructor(e={}){this.contentType="",this.contentEncryptionAlgorithm=new as,Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Xs.prototype,"contentType",void 0),kr([pr({type:as})],Xs.prototype,"contentEncryptionAlgorithm",void 0),kr([pr({type:Ys,optional:!0})],Xs.prototype,"encryptedContent",void 0);class Qs{constructor(e={}){this.keyAttrId="",Object.assign(this,e)}}var eo;kr([pr({type:Ie.ObjectIdentifier})],Qs.prototype,"keyAttrId",void 0),kr([pr({type:Ie.Any,optional:!0})],Qs.prototype,"keyAttr",void 0);class to{constructor(e={}){this.subjectKeyIdentifier=new Ni,Object.assign(this,e)}}kr([pr({type:Ni})],to.prototype,"subjectKeyIdentifier",void 0),kr([pr({type:Ie.GeneralizedTime,optional:!0})],to.prototype,"date",void 0),kr([pr({type:Qs,optional:!0})],to.prototype,"other",void 0);let ro=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:to,context:0,implicit:!0,optional:!0})],ro.prototype,"rKeyId",void 0),kr([pr({type:ts,optional:!0})],ro.prototype,"issuerAndSerialNumber",void 0),ro=kr([dr({type:Ee.Choice})],ro);class no{constructor(e={}){this.rid=new ro,this.encryptedKey=new jt,Object.assign(this,e)}}kr([pr({type:ro})],no.prototype,"rid",void 0),kr([pr({type:jt})],no.prototype,"encryptedKey",void 0);let io=eo=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,eo.prototype)}};io=eo=kr([dr({type:Ee.Sequence,itemType:no})],io);class so{constructor(e={}){this.algorithm=new Ki,this.publicKey=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ki})],so.prototype,"algorithm",void 0),kr([pr({type:Ie.BitString})],so.prototype,"publicKey",void 0);let oo=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Ni,context:0,implicit:!0,optional:!0})],oo.prototype,"subjectKeyIdentifier",void 0),kr([pr({type:so,context:1,implicit:!0,optional:!0})],oo.prototype,"originatorKey",void 0),kr([pr({type:ts,optional:!0})],oo.prototype,"issuerAndSerialNumber",void 0),oo=kr([dr({type:Ee.Choice})],oo);class ao{constructor(e={}){this.version=ns.v3,this.originator=new oo,this.keyEncryptionAlgorithm=new os,this.recipientEncryptedKeys=new io,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],ao.prototype,"version",void 0),kr([pr({type:oo,context:0})],ao.prototype,"originator",void 0),kr([pr({type:jt,context:1,optional:!0})],ao.prototype,"ukm",void 0),kr([pr({type:os})],ao.prototype,"keyEncryptionAlgorithm",void 0),kr([pr({type:io})],ao.prototype,"recipientEncryptedKeys",void 0);let co=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Ni,context:0,implicit:!0})],co.prototype,"subjectKeyIdentifier",void 0),kr([pr({type:ts})],co.prototype,"issuerAndSerialNumber",void 0),co=kr([dr({type:Ee.Choice})],co);class uo{constructor(e={}){this.version=ns.v0,this.rid=new co,this.keyEncryptionAlgorithm=new os,this.encryptedKey=new jt,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],uo.prototype,"version",void 0),kr([pr({type:co})],uo.prototype,"rid",void 0),kr([pr({type:os})],uo.prototype,"keyEncryptionAlgorithm",void 0),kr([pr({type:jt})],uo.prototype,"encryptedKey",void 0);class lo{constructor(e={}){this.keyIdentifier=new jt,Object.assign(this,e)}}kr([pr({type:jt})],lo.prototype,"keyIdentifier",void 0),kr([pr({type:Ie.GeneralizedTime,optional:!0})],lo.prototype,"date",void 0),kr([pr({type:Qs,optional:!0})],lo.prototype,"other",void 0);class ho{constructor(e={}){this.version=ns.v4,this.kekid=new lo,this.keyEncryptionAlgorithm=new os,this.encryptedKey=new jt,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],ho.prototype,"version",void 0),kr([pr({type:lo})],ho.prototype,"kekid",void 0),kr([pr({type:os})],ho.prototype,"keyEncryptionAlgorithm",void 0),kr([pr({type:jt})],ho.prototype,"encryptedKey",void 0);class fo{constructor(e={}){this.version=ns.v0,this.keyEncryptionAlgorithm=new os,this.encryptedKey=new jt,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],fo.prototype,"version",void 0),kr([pr({type:us,context:0,optional:!0})],fo.prototype,"keyDerivationAlgorithm",void 0),kr([pr({type:os})],fo.prototype,"keyEncryptionAlgorithm",void 0),kr([pr({type:jt})],fo.prototype,"encryptedKey",void 0);class po{constructor(e={}){this.oriType="",this.oriValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],po.prototype,"oriType",void 0),kr([pr({type:Ie.Any})],po.prototype,"oriValue",void 0);let yo=class{constructor(e={}){Object.assign(this,e)}};var go;kr([pr({type:uo,optional:!0})],yo.prototype,"ktri",void 0),kr([pr({type:ao,context:1,implicit:!0,optional:!0})],yo.prototype,"kari",void 0),kr([pr({type:ho,context:2,implicit:!0,optional:!0})],yo.prototype,"kekri",void 0),kr([pr({type:fo,context:3,implicit:!0,optional:!0})],yo.prototype,"pwri",void 0),kr([pr({type:po,context:4,implicit:!0,optional:!0})],yo.prototype,"ori",void 0),yo=kr([dr({type:Ee.Choice})],yo);let mo=go=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,go.prototype)}};var vo;mo=go=kr([dr({type:Ee.Set,itemType:yo})],mo);class wo{constructor(e={}){this.otherRevInfoFormat="",this.otherRevInfo=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],wo.prototype,"otherRevInfoFormat",void 0),kr([pr({type:Ie.Any})],wo.prototype,"otherRevInfo",void 0);let bo=class{constructor(e={}){this.other=new wo,Object.assign(this,e)}};kr([pr({type:wo,context:1,implicit:!0})],bo.prototype,"other",void 0),bo=kr([dr({type:Ee.Choice})],bo);let xo=vo=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,vo.prototype)}};xo=vo=kr([dr({type:Ee.Set,itemType:bo})],xo);class Ao{constructor(e={}){Object.assign(this,e)}}var So;kr([pr({type:Ws,context:0,implicit:!0,optional:!0})],Ao.prototype,"certs",void 0),kr([pr({type:xo,context:1,implicit:!0,optional:!0})],Ao.prototype,"crls",void 0);let ko=So=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,So.prototype)}};ko=So=kr([dr({type:Ee.Set,itemType:ls})],ko);class Bo{constructor(e={}){this.version=ns.v0,this.recipientInfos=new mo,this.encryptedContentInfo=new Xs,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],Bo.prototype,"version",void 0),kr([pr({type:Ao,context:0,implicit:!0,optional:!0})],Bo.prototype,"originatorInfo",void 0),kr([pr({type:mo})],Bo.prototype,"recipientInfos",void 0),kr([pr({type:Xs})],Bo.prototype,"encryptedContentInfo",void 0),kr([pr({type:ko,context:1,implicit:!0,optional:!0})],Bo.prototype,"unprotectedAttrs",void 0);const Eo="1.2.840.113549.1.7.2";var Io;let Oo=Io=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Io.prototype)}};Oo=Io=kr([dr({type:Ee.Set,itemType:is})],Oo);class _o{constructor(e={}){this.version=ns.v0,this.digestAlgorithms=new Oo,this.encapContentInfo=new Js,this.signerInfos=new ds,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],_o.prototype,"version",void 0),kr([pr({type:Oo})],_o.prototype,"digestAlgorithms",void 0),kr([pr({type:Js})],_o.prototype,"encapContentInfo",void 0),kr([pr({type:Ws,context:0,implicit:!0,optional:!0})],_o.prototype,"certificates",void 0),kr([pr({type:xo,context:1,implicit:!0,optional:!0})],_o.prototype,"crls",void 0),kr([pr({type:ds})],_o.prototype,"signerInfos",void 0);const Po="1.2.840.10045.2.1",Mo="1.2.840.10045.4.1",Co="1.2.840.10045.4.3.1",To="1.2.840.10045.4.3.2",Uo="1.2.840.10045.4.3.3",No="1.2.840.10045.4.3.4",jo="1.2.840.10045.3.1.7",Ro="1.3.132.0.34",Lo="1.3.132.0.35";function zo(e){return new Ki({algorithm:e})}const Ho=zo(Mo),$o=(zo(Co),zo(To)),Ko=zo(Uo),Do=zo(No);let Vo=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Ie.ObjectIdentifier})],Vo.prototype,"fieldType",void 0),kr([pr({type:Ie.Any})],Vo.prototype,"parameters",void 0),Vo=kr([dr({type:Ee.Sequence})],Vo);let Fo=class{constructor(e={}){Object.assign(this,e)}};var qo;kr([pr({type:Ie.OctetString})],Fo.prototype,"a",void 0),kr([pr({type:Ie.OctetString})],Fo.prototype,"b",void 0),kr([pr({type:Ie.BitString,optional:!0})],Fo.prototype,"seed",void 0),Fo=kr([dr({type:Ee.Sequence})],Fo),function(e){e[e.ecpVer1=1]="ecpVer1"}(qo||(qo={}));let Wo=class{constructor(e={}){this.version=qo.ecpVer1,Object.assign(this,e)}};kr([pr({type:Ie.Integer})],Wo.prototype,"version",void 0),kr([pr({type:Vo})],Wo.prototype,"fieldID",void 0),kr([pr({type:Fo})],Wo.prototype,"curve",void 0),kr([pr({type:class extends jt{}})],Wo.prototype,"base",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Wo.prototype,"order",void 0),kr([pr({type:Ie.Integer,optional:!0})],Wo.prototype,"cofactor",void 0),Wo=kr([dr({type:Ee.Sequence})],Wo);let Go=class{constructor(e={}){Object.assign(this,e)}};kr([pr({type:Ie.ObjectIdentifier})],Go.prototype,"namedCurve",void 0),kr([pr({type:Ie.Null})],Go.prototype,"implicitCurve",void 0),kr([pr({type:Wo})],Go.prototype,"specifiedCurve",void 0),Go=kr([dr({type:Ee.Choice})],Go);class Zo{constructor(e={}){this.version=1,this.privateKey=new jt,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],Zo.prototype,"version",void 0),kr([pr({type:jt})],Zo.prototype,"privateKey",void 0),kr([pr({type:Go,context:0,optional:!0})],Zo.prototype,"parameters",void 0),kr([pr({type:Ie.BitString,context:1,optional:!0})],Zo.prototype,"publicKey",void 0);class Jo{constructor(e={}){this.r=new ArrayBuffer(0),this.s=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.Integer,converter:Ht})],Jo.prototype,"r",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Jo.prototype,"s",void 0);const Yo="1.2.840.113549.1.1",Xo=`${Yo}.1`,Qo=`${Yo}.7`,ea=`${Yo}.9`,ta=`${Yo}.10`,ra=`${Yo}.2`,na=`${Yo}.4`,ia=`${Yo}.5`,sa=`${Yo}.14`,oa=`${Yo}.11`,aa=`${Yo}.12`,ca=`${Yo}.13`,ua=`${Yo}.15`,la=`${Yo}.16`,ha="1.3.14.3.2.26",fa="2.16.840.1.101.3.4.2.4",da="2.16.840.1.101.3.4.2.1",pa="2.16.840.1.101.3.4.2.2",ya="2.16.840.1.101.3.4.2.3",ga=`${Yo}.8`;function ma(e){return new Ki({algorithm:e,parameters:null})}ma("1.2.840.113549.2.2"),ma("1.2.840.113549.2.5");const va=ma(ha),wa=(ma(fa),ma(da),ma(pa),ma(ya),ma("2.16.840.1.101.3.4.2.5"),ma("2.16.840.1.101.3.4.2.6"),new Ki({algorithm:ga,parameters:wr.serialize(va)})),ba=new Ki({algorithm:ea,parameters:wr.serialize(Vt.toASN(new Uint8Array([218,57,163,238,94,107,75,13,50,85,191,239,149,96,24,144,175,216,7,9]).buffer))});ma(Xo),ma(ra),ma(na),ma(ia),ma(ua),ma(la),ma(aa),ma(ca),ma(ua),ma(la);class xa{constructor(e={}){this.hashAlgorithm=new Ki(va),this.maskGenAlgorithm=new Ki({algorithm:ga,parameters:wr.serialize(va)}),this.pSourceAlgorithm=new Ki(ba),Object.assign(this,e)}}kr([pr({type:Ki,context:0,defaultValue:va})],xa.prototype,"hashAlgorithm",void 0),kr([pr({type:Ki,context:1,defaultValue:wa})],xa.prototype,"maskGenAlgorithm",void 0),kr([pr({type:Ki,context:2,defaultValue:ba})],xa.prototype,"pSourceAlgorithm",void 0),new Ki({algorithm:Qo,parameters:wr.serialize(new xa)});class Aa{constructor(e={}){this.hashAlgorithm=new Ki(va),this.maskGenAlgorithm=new Ki({algorithm:ga,parameters:wr.serialize(va)}),this.saltLength=20,this.trailerField=1,Object.assign(this,e)}}kr([pr({type:Ki,context:0,defaultValue:va})],Aa.prototype,"hashAlgorithm",void 0),kr([pr({type:Ki,context:1,defaultValue:wa})],Aa.prototype,"maskGenAlgorithm",void 0),kr([pr({type:Ie.Integer,context:2,defaultValue:20})],Aa.prototype,"saltLength",void 0),kr([pr({type:Ie.Integer,context:3,defaultValue:1})],Aa.prototype,"trailerField",void 0),new Ki({algorithm:ta,parameters:wr.serialize(new Aa)});class Sa{constructor(e={}){this.digestAlgorithm=new Ki,this.digest=new jt,Object.assign(this,e)}}var ka;kr([pr({type:Ki})],Sa.prototype,"digestAlgorithm",void 0),kr([pr({type:jt})],Sa.prototype,"digest",void 0);class Ba{constructor(e={}){this.prime=new ArrayBuffer(0),this.exponent=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.Integer,converter:Ht})],Ba.prototype,"prime",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ba.prototype,"exponent",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ba.prototype,"coefficient",void 0);let Ea=ka=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,ka.prototype)}};Ea=ka=kr([dr({type:Ee.Sequence,itemType:Ba})],Ea);class Ia{constructor(e={}){this.version=0,this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),this.privateExponent=new ArrayBuffer(0),this.prime1=new ArrayBuffer(0),this.prime2=new ArrayBuffer(0),this.exponent1=new ArrayBuffer(0),this.exponent2=new ArrayBuffer(0),this.coefficient=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.Integer})],Ia.prototype,"version",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"modulus",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"publicExponent",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"privateExponent",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"prime1",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"prime2",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"exponent1",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"exponent2",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Ia.prototype,"coefficient",void 0),kr([pr({type:Ea,optional:!0})],Ia.prototype,"otherPrimeInfos",void 0);class Oa{constructor(e={}){this.modulus=new ArrayBuffer(0),this.publicExponent=new ArrayBuffer(0),Object.assign(this,e)}}var _a;kr([pr({type:Ie.Integer,converter:Ht})],Oa.prototype,"modulus",void 0),kr([pr({type:Ie.Integer,converter:Ht})],Oa.prototype,"publicExponent",void 0),function(e){e[e.Transient=0]="Transient",e[e.Singleton=1]="Singleton",e[e.ResolutionScoped=2]="ResolutionScoped",e[e.ContainerScoped=3]="ContainerScoped"}(_a||(_a={}));const Pa=_a;function Ma(e){return!!e.useClass}function Ca(e){return!!e.useFactory}var Ta=function(){function e(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return e.prototype.createProxy=function(e){var t,r=this,n=!1;return new Proxy({},this.createHandler(function(){return n||(t=e(r.wrap()),n=!0),t}))},e.prototype.createHandler=function(e){var t={};return this.reflectMethods.forEach(function(r){t[r]=function(){for(var t=[],n=0;n0},e.prototype.clear=function(){this._registryMap.clear()},e.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},e}(),za=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xr(t,e),t}(La),Ha=function(){this.scopedResolutions=new Map};var $a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xr(t,e),t}(La),Ka=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return xr(t,e),t}(La);const Da=function(){this.preResolution=new $a,this.postResolution=new Ka};var Va=new Map,Fa=function(){function e(e){this.parent=e,this._registry=new za,this.interceptors=new Da,this.disposed=!1,this.disposables=new Set}return e.prototype.register=function(e,t,r){var n;if(void 0===r&&(r={lifecycle:Pa.Transient}),this.ensureNotDisposed(),n=function(e){return Ma(e)||Ra(e)||ja(e)||Ca(e)}(t)?t:{useClass:t},ja(n))for(var i=[e],s=n;null!=s;){var o=s.useToken;if(i.includes(o))throw new Error("Token registration cycle detected! "+Rr(i,[o]).join(" -> "));i.push(o);var a=this._registry.get(o);s=a&&ja(a.provider)?a.provider:null}if((r.lifecycle===Pa.Singleton||r.lifecycle==Pa.ContainerScoped||r.lifecycle==Pa.ResolutionScoped)&&(Ra(n)||Ca(n)))throw new Error('Cannot use lifecycle "'+Pa[r.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:r}),this},e.prototype.registerType=function(e,t){return this.ensureNotDisposed(),Ua(t)?this.register(e,{useToken:t}):this.register(e,{useClass:t})},e.prototype.registerInstance=function(e,t){return this.ensureNotDisposed(),this.register(e,{useValue:t})},e.prototype.registerSingleton=function(e,t){if(this.ensureNotDisposed(),Ua(e)){if(Ua(t))return this.register(e,{useToken:t},{lifecycle:Pa.Singleton});if(t)return this.register(e,{useClass:t},{lifecycle:Pa.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var r=e;return t&&!Ua(t)&&(r=t),this.register(e,{useClass:r},{lifecycle:Pa.Singleton})},e.prototype.resolve=function(e,t,r){void 0===t&&(t=new Ha),void 0===r&&(r=!1),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&Ua(e)){if(r)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,t);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(function(e){return"function"==typeof e||e instanceof Ta}(e))return i=this.construct(e,t),this.executePostResolutionInterceptor(e,i,"Single"),i;throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},e.prototype.executePreResolutionInterceptor=function(e,t){var r,n;if(this.interceptors.preResolution.has(e)){var i=[];try{for(var s=Nr(this.interceptors.preResolution.getAll(e)),o=s.next();!o.done;o=s.next()){var a=o.value;"Once"!=a.options.frequency&&i.push(a),a.callback(e,t)}}catch(e){r={error:e}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}this.interceptors.preResolution.setAll(e,i)}},e.prototype.executePostResolutionInterceptor=function(e,t,r){var n,i;if(this.interceptors.postResolution.has(e)){var s=[];try{for(var o=Nr(this.interceptors.postResolution.getAll(e)),a=o.next();!a.done;a=o.next()){var c=a.value;"Once"!=c.options.frequency&&s.push(c),c.callback(e,t,r)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,s)}},e.prototype.resolveRegistration=function(e,t){if(this.ensureNotDisposed(),e.options.lifecycle===Pa.ResolutionScoped&&t.scopedResolutions.has(e))return t.scopedResolutions.get(e);var r,n=e.options.lifecycle===Pa.Singleton,i=e.options.lifecycle===Pa.ContainerScoped,s=n||i;return r=Ra(e.provider)?e.provider.useValue:ja(e.provider)?s?e.instance||(e.instance=this.resolve(e.provider.useToken,t)):this.resolve(e.provider.useToken,t):Ma(e.provider)?s?e.instance||(e.instance=this.construct(e.provider.useClass,t)):this.construct(e.provider.useClass,t):Ca(e.provider)?e.provider.useFactory(this):this.construct(e.provider,t),e.options.lifecycle===Pa.ResolutionScoped&&t.scopedResolutions.set(e,r),r},e.prototype.resolveAll=function(e,t,r){var n=this;void 0===t&&(t=new Ha),void 0===r&&(r=!1),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&Ua(e)){if(r)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),i){var s=i.map(function(e){return n.resolveRegistration(e,t)});return this.executePostResolutionInterceptor(e,s,"All"),s}var o=[this.construct(e,t)];return this.executePostResolutionInterceptor(e,o,"All"),o},e.prototype.isRegistered=function(e,t){return void 0===t&&(t=!1),this.ensureNotDisposed(),this._registry.has(e)||t&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},e.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},e.prototype.clearInstances=function(){var e,t;this.ensureNotDisposed();try{for(var r=Nr(this._registry.entries()),n=r.next();!n.done;n=r.next()){var i=jr(n.value,2),s=i[0],o=i[1];this._registry.setAll(s,o.filter(function(e){return!Ra(e.provider)}).map(function(e){return e.instance=void 0,e}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},e.prototype.createChildContainer=function(){var t,r;this.ensureNotDisposed();var n=new e(this);try{for(var i=Nr(this._registry.entries()),s=i.next();!s.done;s=i.next()){var o=jr(s.value,2),a=o[0],c=o[1];c.some(function(e){return e.options.lifecycle===Pa.ContainerScoped})&&n._registry.setAll(a,c.map(function(e){return e.options.lifecycle===Pa.ContainerScoped?{provider:e.provider,options:e.options}:e}))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n},e.prototype.beforeResolution=function(e,t,r){void 0===r&&(r={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:t,options:r})},e.prototype.afterResolution=function(e,t,r){void 0===r&&(r={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:t,options:r})},e.prototype.dispose=function(){return Mr(this,void 0,void 0,function(){var e;return Cr(this,function(t){switch(t.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(t){var r=t.dispose();r&&e.push(r)}),[4,Promise.all(e)];case 1:return t.sent(),[2]}})})},e.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},e.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},e.prototype.construct=function(e,t){var r=this;if(e instanceof Ta)return e.createProxy(function(e){return r.resolve(e,t)});var n,i=function(){var n=Va.get(e);if(!n||0===n.length){if(0===e.length)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var i=n.map(r.resolveParams(t,e));return new(e.bind.apply(e,Rr([void 0],i)))}();return"function"!=typeof(n=i).dispose||n.dispose.length>0||this.disposables.add(i),i},e.prototype.resolveParams=function(e,t){var r=this;return function(n,i){var s,o,a,c;try{return"object"==typeof(c=n)&&"token"in c&&"multiple"in c?Na(n)?n.multiple?(s=r.resolve(n.transform)).transform.apply(s,Rr([r.resolveAll(n.token,new Ha,n.isOptional)],n.transformArgs)):(o=r.resolve(n.transform)).transform.apply(o,Rr([r.resolve(n.token,e,n.isOptional)],n.transformArgs)):n.multiple?r.resolveAll(n.token,new Ha,n.isOptional):r.resolve(n.token,e,n.isOptional):Na(n)?(a=r.resolve(n.transform,e)).transform.apply(a,Rr([r.resolve(n.token,e)],n.transformArgs)):r.resolve(n,e)}catch(e){throw new Error(function(e,t,r){var n,i,s,o,a=jr(e.toString().match(/constructor\(([\w, ]+)\)/)||[],2)[1];return n="Cannot inject the dependency "+(o=t,(null===(s=void 0===a?null:a)?"at position #"+o:'"'+s.split(",")[o].trim()+'" at position #'+o)+' of "')+e.name+'" constructor. Reason:',void 0===i&&(i=" "),Rr([n],r.message.split("\n").map(function(e){return i+e})).join("\n")}(t,i,e))}}},e.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},e}(),qa=new Fa;const Wa=function(e){return function(t){Va.set(t,function(e){var t=Reflect.getMetadata("design:paramtypes",e)||[],r=Reflect.getOwnMetadata("injectionTokens",e)||{};return Object.keys(r).forEach(function(e){t[+e]=r[e]}),t}(t)),e&&e.token&&(Array.isArray(e.token)?e.token.forEach(function(e){qa.register(e,t)}):qa.register(e.token,t))}};if("undefined"==typeof Reflect||!Reflect.getMetadata)throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point.");var Ga;class Za{constructor(e={}){this.attrId="",this.attrValues=[],Object.assign(e)}}kr([pr({type:Ie.ObjectIdentifier})],Za.prototype,"attrId",void 0),kr([pr({type:Ie.Any,repeated:"set"})],Za.prototype,"attrValues",void 0);let Ja=Ga=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Ga.prototype)}};var Ya;Ja=Ga=kr([dr({type:Ee.Sequence,itemType:Za})],Ja);let Xa=Ya=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Ya.prototype)}};Xa=Ya=kr([dr({type:Ee.Sequence,itemType:Gs})],Xa);class Qa{constructor(e={}){this.certId="",this.certValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],Qa.prototype,"certId",void 0),kr([pr({type:Ie.Any,context:0})],Qa.prototype,"certValue",void 0);class ec{constructor(e={}){this.crlId="",this.crltValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],ec.prototype,"crlId",void 0),kr([pr({type:Ie.Any,context:0})],ec.prototype,"crltValue",void 0);class tc extends jt{}class rc{constructor(e={}){this.encryptionAlgorithm=new Ki,this.encryptedData=new tc,Object.assign(this,e)}}var nc,ic;kr([pr({type:Ki})],rc.prototype,"encryptionAlgorithm",void 0),kr([pr({type:tc})],rc.prototype,"encryptedData",void 0),function(e){e[e.v1=0]="v1"}(ic||(ic={}));class sc extends jt{}let oc=nc=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,nc.prototype)}};oc=nc=kr([dr({type:Ee.Sequence,itemType:Mi})],oc);class ac{constructor(e={}){this.version=ic.v1,this.privateKeyAlgorithm=new Ki,this.privateKey=new sc,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],ac.prototype,"version",void 0),kr([pr({type:Ki})],ac.prototype,"privateKeyAlgorithm",void 0),kr([pr({type:sc})],ac.prototype,"privateKey",void 0),kr([pr({type:oc,implicit:!0,context:0,optional:!0})],ac.prototype,"attributes",void 0);let cc=class extends ac{};cc=kr([dr({type:Ee.Sequence})],cc);let uc=class extends rc{};uc=kr([dr({type:Ee.Sequence})],uc);class lc{constructor(e={}){this.secretTypeId="",this.secretValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],lc.prototype,"secretTypeId",void 0),kr([pr({type:Ie.Any,context:0})],lc.prototype,"secretValue",void 0);class hc{constructor(e={}){this.mac=new Sa,this.macSalt=new jt,this.iterations=1,Object.assign(this,e)}}kr([pr({type:Sa})],hc.prototype,"mac",void 0),kr([pr({type:jt})],hc.prototype,"macSalt",void 0),kr([pr({type:Ie.Integer,defaultValue:1})],hc.prototype,"iterations",void 0);class fc{constructor(e={}){this.version=3,this.authSafe=new Gs,this.macData=new hc,Object.assign(this,e)}}var dc;kr([pr({type:Ie.Integer})],fc.prototype,"version",void 0),kr([pr({type:Gs})],fc.prototype,"authSafe",void 0),kr([pr({type:hc,optional:!0})],fc.prototype,"macData",void 0);class pc{constructor(e={}){this.bagId="",this.bagValue=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Ie.ObjectIdentifier})],pc.prototype,"bagId",void 0),kr([pr({type:Ie.Any,context:0})],pc.prototype,"bagValue",void 0),kr([pr({type:Za,repeated:"set",optional:!0})],pc.prototype,"bagAttributes",void 0);let yc=dc=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,dc.prototype)}};var gc,mc,vc;yc=dc=kr([dr({type:Ee.Sequence,itemType:pc})],yc);const wc="1.2.840.113549.1.9",bc=`${wc}.7`,xc=`${wc}.14`;let Ac=class extends nn{constructor(e={}){super(e)}toString(){return{}.toString(),this.ia5String||super.toString()}};kr([pr({type:Ie.IA5String})],Ac.prototype,"ia5String",void 0),Ac=kr([dr({type:Ee.Choice})],Ac);let Sc=class extends Gs{};Sc=kr([dr({type:Ee.Sequence})],Sc);let kc=class extends fc{};kc=kr([dr({type:Ee.Sequence})],kc);let Bc=class extends rc{};Bc=kr([dr({type:Ee.Sequence})],Bc);let Ec=class{constructor(e=""){this.value=e}toString(){return this.value}};kr([pr({type:Ie.IA5String})],Ec.prototype,"value",void 0),Ec=kr([dr({type:Ee.Choice})],Ec);let Ic=class extends Ac{};Ic=kr([dr({type:Ee.Choice})],Ic);let Oc=class extends nn{};Oc=kr([dr({type:Ee.Choice})],Oc);let _c=class{constructor(e=new Date){this.value=e}};kr([pr({type:Ie.GeneralizedTime})],_c.prototype,"value",void 0),_c=kr([dr({type:Ee.Choice})],_c);let Pc=class extends nn{};Pc=kr([dr({type:Ee.Choice})],Pc);let Mc=class{constructor(e="M"){this.value=e}toString(){return this.value}};kr([pr({type:Ie.PrintableString})],Mc.prototype,"value",void 0),Mc=kr([dr({type:Ee.Choice})],Mc);let Cc=class{constructor(e=""){this.value=e}toString(){return this.value}};kr([pr({type:Ie.PrintableString})],Cc.prototype,"value",void 0),Cc=kr([dr({type:Ee.Choice})],Cc);let Tc=class extends Cc{};Tc=kr([dr({type:Ee.Choice})],Tc);let Uc=class extends nn{};Uc=kr([dr({type:Ee.Choice})],Uc);let Nc=class{constructor(e=""){this.value=e}toString(){return this.value}};kr([pr({type:Ie.ObjectIdentifier})],Nc.prototype,"value",void 0),Nc=kr([dr({type:Ee.Choice})],Nc);let jc=class extends Vi{};jc=kr([dr({type:Ee.Choice})],jc);let Rc=class{constructor(e=0){this.value=e}toString(){return this.value.toString()}};kr([pr({type:Ie.Integer})],Rc.prototype,"value",void 0),Rc=kr([dr({type:Ee.Choice})],Rc);let Lc=class extends fs{};Lc=kr([dr({type:Ee.Sequence})],Lc);let zc=class extends nn{};zc=kr([dr({type:Ee.Choice})],zc);let Hc=gc=class extends Gi{constructor(e){super(e),Object.setPrototypeOf(this,gc.prototype)}};Hc=gc=kr([dr({type:Ee.Sequence})],Hc);let $c=mc=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,mc.prototype)}};$c=mc=kr([dr({type:Ee.Set,itemType:ls})],$c);let Kc=class{constructor(e=""){this.value=e}toString(){return this.value}};kr([pr({type:Ie.BmpString})],Kc.prototype,"value",void 0),Kc=kr([dr({type:Ee.Choice})],Kc);let Dc=class extends Ki{};Dc=kr([dr({type:Ee.Sequence})],Dc);let Vc=vc=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,vc.prototype)}};var Fc;Vc=vc=kr([dr({type:Ee.Sequence,itemType:Dc})],Vc);let qc=Fc=class extends vr{constructor(e){super(e),Object.setPrototypeOf(this,Fc.prototype)}};qc=Fc=kr([dr({type:Ee.Sequence,itemType:Mi})],qc);class Wc{constructor(e={}){this.version=0,this.subject=new un,this.subjectPKInfo=new Di,this.attributes=new qc,Object.assign(this,e)}}kr([pr({type:Ie.Integer})],Wc.prototype,"version",void 0),kr([pr({type:un})],Wc.prototype,"subject",void 0),kr([pr({type:Di})],Wc.prototype,"subjectPKInfo",void 0),kr([pr({type:qc,implicit:!0,context:0,optional:!0})],Wc.prototype,"attributes",void 0);class Gc{constructor(e={}){this.certificationRequestInfo=new Wc,this.signatureAlgorithm=new Ki,this.signature=new ArrayBuffer(0),Object.assign(this,e)}}kr([pr({type:Wc,raw:!0})],Gc.prototype,"certificationRequestInfo",void 0),kr([pr({type:Ki})],Gc.prototype,"signatureAlgorithm",void 0),kr([pr({type:Ie.BitString})],Gc.prototype,"signature",void 0);const Zc="crypto.algorithm",Jc="crypto.algorithmProvider";var Yc;qa.registerSingleton(Jc,class{getAlgorithms(){return qa.resolveAll(Zc)}toAsnAlgorithm(e){for(const t of this.getAlgorithms()){const r=t.toAsnAlgorithm(e);if(r)return r}if(/^[0-9.]+$/.test(e.name)){const t=new Ki({algorithm:e.name});if("parameters"in e){const r=e;t.parameters=r.parameters}return t}throw new Error("Cannot convert WebCrypto algorithm to ASN.1 algorithm")}toWebAlgorithm(e){for(const t of this.getAlgorithms()){const r=t.toWebAlgorithm(e);if(r)return r}return{name:e.algorithm,parameters:e.parameters}}});const Xc="1.3.36.3.3.2.8.1.1",Qc=`${Xc}.1`,eu=`${Xc}.2`,tu=`${Xc}.3`,ru=`${Xc}.4`,nu=`${Xc}.5`,iu=`${Xc}.6`,su=`${Xc}.7`,ou=`${Xc}.8`,au=`${Xc}.9`,cu=`${Xc}.10`,uu=`${Xc}.11`,lu=`${Xc}.12`,hu=`${Xc}.13`,fu=`${Xc}.14`,du="brainpoolP160r1",pu="brainpoolP160t1",yu="brainpoolP192r1",gu="brainpoolP192t1",mu="brainpoolP224r1",vu="brainpoolP224t1",wu="brainpoolP256r1",bu="brainpoolP256t1",xu="brainpoolP320r1",Au="brainpoolP320t1",Su="brainpoolP384r1",ku="brainpoolP384t1",Bu="brainpoolP512r1",Eu="brainpoolP512t1",Iu="ECDSA";let Ou=Yc=class{toAsnAlgorithm(e){if(e.name.toLowerCase()===Iu.toLowerCase())if("hash"in e)switch(("string"==typeof e.hash?e.hash:e.hash.name).toLowerCase()){case"sha-1":return Ho;case"sha-256":return $o;case"sha-384":return Ko;case"sha-512":return Do}else if("namedCurve"in e){let t="";switch(e.namedCurve){case"P-256":t=jo;break;case"K-256":t=Yc.SECP256K1;break;case"P-384":t=Ro;break;case"P-521":t=Lo;break;case du:t=Qc;break;case pu:t=eu;break;case yu:t=tu;break;case gu:t=ru;break;case mu:t=nu;break;case vu:t=iu;break;case wu:t=su;break;case bu:t=ou;break;case xu:t=au;break;case Au:t=cu;break;case Su:t=uu;break;case ku:t=lu;break;case Bu:t=hu;break;case Eu:t=fu}if(t)return new Ki({algorithm:Po,parameters:wr.serialize(new Go({namedCurve:t}))})}return null}toWebAlgorithm(e){switch(e.algorithm){case Mo:return{name:Iu,hash:{name:"SHA-1"}};case To:return{name:Iu,hash:{name:"SHA-256"}};case Uo:return{name:Iu,hash:{name:"SHA-384"}};case No:return{name:Iu,hash:{name:"SHA-512"}};case Po:if(!e.parameters)throw new TypeError("Cannot get required parameters from EC algorithm");switch(wr.parse(e.parameters,Go).namedCurve){case jo:return{name:Iu,namedCurve:"P-256"};case Yc.SECP256K1:return{name:Iu,namedCurve:"K-256"};case Ro:return{name:Iu,namedCurve:"P-384"};case Lo:return{name:Iu,namedCurve:"P-521"};case Qc:return{name:Iu,namedCurve:du};case eu:return{name:Iu,namedCurve:pu};case tu:return{name:Iu,namedCurve:yu};case ru:return{name:Iu,namedCurve:gu};case nu:return{name:Iu,namedCurve:mu};case iu:return{name:Iu,namedCurve:vu};case su:return{name:Iu,namedCurve:wu};case ou:return{name:Iu,namedCurve:bu};case au:return{name:Iu,namedCurve:xu};case cu:return{name:Iu,namedCurve:Au};case uu:return{name:Iu,namedCurve:Su};case lu:return{name:Iu,namedCurve:ku};case hu:return{name:Iu,namedCurve:Bu};case fu:return{name:Iu,namedCurve:Eu}}}return null}};Ou.SECP256K1="1.3.132.0.10",Ou=Yc=kr([Wa()],Ou),qa.registerSingleton(Zc,Ou);const _u=Symbol("name"),Pu=Symbol("value");class Mu{constructor(e,t={},r=""){this[_u]=e,this[Pu]=r;for(const e in t)this[e]=t[e]}}Mu.NAME=_u,Mu.VALUE=Pu;class Cu{static toString(e){return this.items[e]||e}}Cu.items={[ha]:"sha1",[fa]:"sha224",[da]:"sha256",[pa]:"sha384",[ya]:"sha512",[Xo]:"rsaEncryption",[ia]:"sha1WithRSAEncryption",[sa]:"sha224WithRSAEncryption",[oa]:"sha256WithRSAEncryption",[aa]:"sha384WithRSAEncryption",[ca]:"sha512WithRSAEncryption",[Po]:"ecPublicKey",[Mo]:"ecdsaWithSHA1",[Co]:"ecdsaWithSHA224",[To]:"ecdsaWithSHA256",[Uo]:"ecdsaWithSHA384",[No]:"ecdsaWithSHA512",[ai]:"TLS WWW server authentication",[ci]:"TLS WWW client authentication",[ui]:"Code Signing",[li]:"E-mail Protection",[hi]:"Time Stamping",[fi]:"OCSP Signing",[Eo]:"Signed Data"};class Tu{static serialize(e){return this.serializeObj(e).join("\n")}static pad(e=0){return"".padStart(2*e," ")}static serializeObj(e,t=0){const r=[];let n=this.pad(t++),i="";const s=e[Mu.VALUE];s&&(i=` ${s}`),r.push(`${n}${e[Mu.NAME]}:${i}`),n=this.pad(t);for(const i in e){if("symbol"==typeof i)continue;const s=e[i],o=i?`${i}: `:"";if("string"==typeof s||"number"==typeof s||"boolean"==typeof s)r.push(`${n}${o}${s}`);else if(s instanceof Date)r.push(`${n}${o}${s.toUTCString()}`);else if(Array.isArray(s))for(const e of s)e[Mu.NAME]=i,r.push(...this.serializeObj(e,t));else if(s instanceof Mu)s[Mu.NAME]=i,r.push(...this.serializeObj(s,t));else if(u._H.isBufferSource(s))i?(r.push(`${n}${o}`),r.push(...this.serializeBufferSource(s,t+1))):r.push(...this.serializeBufferSource(s,t));else{if(!("toTextObject"in s))throw new TypeError("Cannot serialize data in text format. Unsupported type.");{const e=s.toTextObject();e[Mu.NAME]=i,r.push(...this.serializeObj(e,t))}}}return r}static serializeBufferSource(e,t=0){const r=this.pad(t),n=u._H.toUint8Array(e),i=[];for(let e=0;e255)return!1;return!0}static isPrintableString(e){return/^[A-Za-z0-9 '()+,-./:=?]*$/g.test(e)}constructor(e,t={}){this.extraNames=new Hu,this.asn=new un;for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const r=t[e];this.extraNames.register(e,r)}"string"==typeof e?this.asn=this.fromString(e):e instanceof un?this.asn=e:u._H.isBufferSource(e)?this.asn=wr.parse(e,un):this.asn=this.fromJSON(e)}getField(e){const t=this.extraNames.findId(e)||$u.findId(e),r=[];for(const e of this.asn)for(const n of e)n.type===t&&r.push(n.value.toString());return r}getName(e){return this.extraNames.get(e)||$u.get(e)}toString(){return this.asn.map(e=>e.map(e=>`${this.getName(e.type)||e.type}=${e.value.anyValue?`#${u.U$.ToHex(e.value.anyValue)}`:e.value.toString().replace(/([,+"\\<>;])/g,"\\$1").replace(/^([ #])/,"\\$1").replace(/([ ]$)/,"\\$1").replace(/([\r\n\t])/,Ku)}`).join("+")).join(", ")}toJSON(){var e;const t=[];for(const r of this.asn){const n={};for(const t of r){const r=this.getName(t.type)||t.type;null!==(e=n[r])&&void 0!==e||(n[r]=[]),n[r].push(t.value.anyValue?`#${u.U$.ToHex(t.value.anyValue)}`:t.value.toString())}t.push(n)}return t}fromString(e){const t=new un,r=/(\d\.[\d.]*\d|[A-Za-z]+)=((?:"")|(?:".*?[^\\]")|(?:[^,+].*?(?:[^\\][,+]))|(?:))([,+])?/g;let n=null,i=",";for(;n=r.exec(`${e},`);){let[,e,r]=n;const s=r[r.length-1];","!==s&&"+"!==s||(r=r.slice(0,r.length-1),n[3]=s);const o=n[3];e=this.getTypeOid(e);const a=this.createAttribute(e,r);"+"===i?t[t.length-1].push(a):t.push(new an([a])),i=o}return t}fromJSON(e){const t=new un;for(const r of e){const e=new an;for(const t in r){const n=this.getTypeOid(t),i=r[t];for(const t of i){const r=this.createAttribute(n,t);e.push(r)}}t.push(e)}return t}getTypeOid(e){if(/[\d.]+/.test(e)||(e=this.getName(e)||""),!e)throw new Error(`Cannot get OID for name type '${e}'`);return e}createAttribute(e,t){const r=new on({type:e});if("object"==typeof t)for(const e in t)switch(e){case"ia5String":r.value.ia5String=t[e];break;case"utf8String":r.value.utf8String=t[e];break;case"universalString":r.value.universalString=t[e];break;case"bmpString":r.value.bmpString=t[e];break;case"printableString":r.value.printableString=t[e]}else if("#"===t[0])r.value.anyValue=u.U$.FromHex(t.slice(1));else{const n=this.processStringValue(t);e===this.getName("E")||e===this.getName("DC")?r.value.ia5String=n:Du.isPrintableString(n)?r.value.printableString=n:r.value.utf8String=n}return r}processStringValue(e){const t=/"(.*?[^\\])?"/.exec(e);return t&&(e=t[1]),e.replace(/\\0a/gi,"\n").replace(/\\0d/gi,"\r").replace(/\\0g/gi,"\t").replace(/\\(.)/g,"$1")}toArrayBuffer(){return wr.serialize(this.asn)}async getThumbprint(...e){var t;let r,n="SHA-1";return e.length>=1&&!(null===(t=e[0])||void 0===t?void 0:t.subtle)?(n=e[0]||n,r=e[1]||Lu.get()):r=e[0]||Lu.get(),await r.subtle.digest(n,this.toArrayBuffer())}}const Vu="Cannot initialize GeneralName from ASN.1 data.",Fu=`${Vu} Unsupported string format in use.`,qu=`${Vu} Value doesn't match to GUID regular expression.`,Wu=/^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i,Gu="1.3.6.1.4.1.311.25.1",Zu="1.3.6.1.4.1.311.20.2.3",Ju="dns",Yu="dn",Xu="email",Qu="ip",el="url",tl="guid",rl="upn",nl="id";class il extends Uu{constructor(...e){let t;if(2===e.length)switch(e[0]){case Yu:{const r=new Du(e[1]).toArrayBuffer(),n=wr.parse(r,un);t=new dn({directoryName:n});break}case Ju:t=new dn({dNSName:e[1]});break;case Xu:t=new dn({rfc822Name:e[1]});break;case tl:{const r=new RegExp(Wu,"i").exec(e[1]);if(!r)throw new Error("Cannot parse GUID value. Value doesn't match to regular expression");const n=r.slice(1).map((e,t)=>t<3?u.U$.ToHex(new Uint8Array(u.U$.FromHex(e)).reverse()):e).join("");t=new dn({otherName:new hn({typeId:Gu,value:wr.serialize(new jt(u.U$.FromHex(n)))})});break}case Qu:t=new dn({iPAddress:e[1]});break;case nl:t=new dn({registeredID:e[1]});break;case rl:t=new dn({otherName:new hn({typeId:Zu,value:wr.serialize(Wt.toASN(e[1]))})});break;case el:t=new dn({uniformResourceIdentifier:e[1]});break;default:throw new Error("Cannot create GeneralName. Unsupported type of the name")}else t=u._H.isBufferSource(e[0])?wr.parse(e[0],dn):e[0];super(t)}onInit(e){if(null!=e.dNSName)this.type=Ju,this.value=e.dNSName;else if(null!=e.rfc822Name)this.type=Xu,this.value=e.rfc822Name;else if(null!=e.iPAddress)this.type=Qu,this.value=e.iPAddress;else if(null!=e.uniformResourceIdentifier)this.type=el,this.value=e.uniformResourceIdentifier;else if(null!=e.registeredID)this.type=nl,this.value=e.registeredID;else if(null!=e.directoryName)this.type=Yu,this.value=new Du(e.directoryName).toString();else{if(null==e.otherName)throw new Error(Fu);if(e.otherName.typeId===Gu){this.type=tl;const t=wr.parse(e.otherName.value,jt),r=new RegExp(Wu,"i").exec(u.U$.ToHex(t));if(!r)throw new Error(qu);this.value=r.slice(1).map((e,t)=>t<3?u.U$.ToHex(new Uint8Array(u.U$.FromHex(e)).reverse()):e).join("-")}else{if(e.otherName.typeId!==Zu)throw new Error(Fu);this.type=rl,this.value=wr.parse(e.otherName.value,nn).toString()}}}toJSON(){return{type:this.type,value:this.value}}toTextObject(){let e;switch(this.type){case Yu:case Ju:case tl:case Qu:case nl:case rl:case el:e=this.type.toUpperCase();break;case Xu:e="Email";break;default:throw new Error("Unsupported GeneralName type")}let t=this.value;return this.type===nl&&(t=Cu.toString(t)),new Mu(e,void 0,t)}}class sl extends Uu{constructor(e){let t;if(e instanceof Cn)t=e;else if(Array.isArray(e)){const r=[];for(const t of e)if(t instanceof dn)r.push(t);else{const e=wr.parse(new il(t.type,t.value).rawData,dn);r.push(e)}t=new Cn(r)}else{if(!u._H.isBufferSource(e))throw new Error("Cannot initialize GeneralNames. Incorrect incoming arguments");t=wr.parse(e,Cn)}super(t)}onInit(e){const t=[];for(const r of e){let e=null;try{e=new il(r)}catch{continue}t.push(e)}this.items=t}toJSON(){return this.items.map(e=>e.toJSON())}toTextObject(){const e=super.toTextObjectEmpty();for(const t of this.items){const r=t.toTextObject();let n=e[r[Mu.NAME]];Array.isArray(n)||(n=[],e[r[Mu.NAME]]=n),n.push(r)}return e}}sl.NAME="GeneralNames";const ol="-{5}",al="\\n",cl="\\n",ul=`${ol}BEGIN ([^${al}]+(?=${ol}))${ol}${cl}(?:((?:[^:${al}]+: (?:[^${al}]+${cl}(?: +[^${al}]+${cl})*))+))?${cl}?((?:[a-zA-Z0-9=+/]+${cl})+)${ol}END \\1${ol}`;class ll{static isPem(e){return"string"==typeof e&&new RegExp(ul,"g").test(e)}static decodeWithHeaders(e){e=e.replace(/\r/g,"");const t=new RegExp(ul,"g"),r=[];let n=null;for(;n=t.exec(e);){const e=n[3].replace(new RegExp(`[${al}]+`,"g"),""),t={type:n[1],headers:[],rawData:u.U$.FromBase64(e)},i=n[2];if(i){const e=i.split(new RegExp(cl,"g"));let r=null;for(const n of e){const[e,i]=n.split(/:(.*)/);if(void 0===i){if(!r)throw new Error("Cannot parse PEM string. Incorrect header value");r.value+=e.trim()}else r&&t.headers.push(r),r={key:e,value:i.trim()}}r&&t.headers.push(r)}r.push(t)}return r}static decode(e){return this.decodeWithHeaders(e).map(e=>e.rawData)}static decodeFirst(e){const t=this.decode(e);if(!t.length)throw new RangeError("PEM string doesn't contain any objects");return t[0]}static encode(e,t){if(Array.isArray(e)){const r=new Array;return t?e.forEach(e=>{if(!u._H.isBufferSource(e))throw new TypeError("Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource");r.push(this.encodeStruct({type:t,rawData:u._H.toArrayBuffer(e)}))}):e.forEach(e=>{if(!("type"in e))throw new TypeError("Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut");r.push(this.encodeStruct(e))}),r.join("\n")}if(!t)throw new Error("Required argument 'tag' is missed");return this.encodeStruct({type:t,rawData:u._H.toArrayBuffer(e)})}static encodeStruct(e){var t;const r=e.type.toLocaleUpperCase(),n=[];if(n.push(`-----BEGIN ${r}-----`),null===(t=e.headers)||void 0===t?void 0:t.length){for(const t of e.headers)n.push(`${t.key}: ${t.value}`);n.push("")}const i=u.U$.ToBase64(e.rawData);let s,o=0;const a=Array();for(;o1?(n=e[0]||n,r=e[1]||r,t=e[2]||Lu.get()):t=e[0]||Lu.get();let i=this.rawData;const s=wr.parse(this.rawData,Di);return s.algorithm.algorithm===ta&&(i=function(e){return e.algorithm=new Ki({algorithm:Xo,parameters:null}),wr.serialize(e)}(s)),t.subtle.importKey("spki",i,n,!0,r)}onInit(e){const t=qa.resolve(Jc),r=this.algorithm=t.toWebAlgorithm(e.algorithm);switch(e.algorithm.algorithm){case Xo:{const t=wr.parse(e.subjectPublicKey,Oa),n=u._H.toUint8Array(t.modulus);r.publicExponent=u._H.toUint8Array(t.publicExponent),r.modulusLength=(n[0]?n:n.slice(1)).byteLength<<3;break}}}async getThumbprint(...e){var t;let r,n="SHA-1";return e.length>=1&&!(null===(t=e[0])||void 0===t?void 0:t.subtle)?(n=e[0]||n,r=e[1]||Lu.get()):r=e[0]||Lu.get(),await r.subtle.digest(n,this.rawData)}async getKeyIdentifier(...e){let t,r="SHA-1";1===e.length?"string"==typeof e[0]?(r=e[0],t=Lu.get()):t=e[0]:2===e.length?(r=e[0],t=e[1]):t=Lu.get();const n=wr.parse(this.rawData,Di);return await t.subtle.digest(r,n.subjectPublicKey)}toTextObject(){const e=this.toTextObjectEmpty(),t=wr.parse(this.rawData,Di);return e.Algorithm=Tu.serializeAlgorithm(t.algorithm),t.algorithm.algorithm===Po?e["EC Point"]=t.subjectPublicKey:e["Raw Data"]=t.subjectPublicKey,e}}class dl extends Nu{static async create(e,t=!1,r=Lu.get()){if("name"in e&&"serialNumber"in e)return new dl(e,t);const n=await fl.create(e,r),i=await n.getKeyIdentifier(r);return new dl(u.U$.ToHex(i),t)}constructor(...e){if(u._H.isBufferSource(e[0]))super(e[0]);else if("string"==typeof e[0]){const t=new On({keyIdentifier:new In(u.U$.FromHex(e[0]))});super(En,e[1],wr.serialize(t))}else{const t=e[0],r=t.name instanceof sl?wr.parse(t.name.rawData,Cn):t.name,n=new On({authorityCertIssuer:r,authorityCertSerialNumber:u.U$.FromHex(t.serialNumber)});super(En,e[1],wr.serialize(n))}}onInit(e){super.onInit(e);const t=wr.parse(e.extnValue,On);t.keyIdentifier&&(this.keyId=u.U$.ToHex(t.keyIdentifier)),(t.authorityCertIssuer||t.authorityCertSerialNumber)&&(this.certId={name:t.authorityCertIssuer||[],serialNumber:t.authorityCertSerialNumber?u.U$.ToHex(t.authorityCertSerialNumber):""})}toTextObject(){const e=this.toTextObjectWithoutValue(),t=wr.parse(this.value,On);return t.authorityCertIssuer&&(e["Authority Issuer"]=new sl(t.authorityCertIssuer).toTextObject()),t.authorityCertSerialNumber&&(e["Authority Serial Number"]=t.authorityCertSerialNumber),t.keyIdentifier&&(e[""]=t.keyIdentifier),e}}dl.NAME="Authority Key Identifier";class pl extends Nu{constructor(...e){if(u._H.isBufferSource(e[0])){super(e[0]);const t=wr.parse(this.value,Pn);this.ca=t.cA,this.pathLength=t.pathLenConstraint}else{const t=new Pn({cA:e[0],pathLenConstraint:e[1]});super(_n,e[2],wr.serialize(t)),this.ca=e[0],this.pathLength=e[1]}}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ca&&(e.CA=this.ca),void 0!==this.pathLength&&(e["Path Length"]=this.pathLength),e}}var yl,gl;pl.NAME="Basic Constraints",function(e){e.serverAuth="1.3.6.1.5.5.7.3.1",e.clientAuth="1.3.6.1.5.5.7.3.2",e.codeSigning="1.3.6.1.5.5.7.3.3",e.emailProtection="1.3.6.1.5.5.7.3.4",e.timeStamping="1.3.6.1.5.5.7.3.8",e.ocspSigning="1.3.6.1.5.5.7.3.9"}(yl||(yl={}));class ml extends Nu{constructor(...e){if(u._H.isBufferSource(e[0])){super(e[0]);const t=wr.parse(this.value,oi);this.usages=t.map(e=>e)}else{const t=new oi(e[0]);super(si,e[1],wr.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[""]=this.usages.map(e=>Cu.toString(e)).join(", "),e}}ml.NAME="Extended Key Usages",function(e){e[e.digitalSignature=1]="digitalSignature",e[e.nonRepudiation=2]="nonRepudiation",e[e.keyEncipherment=4]="keyEncipherment",e[e.dataEncipherment=8]="dataEncipherment",e[e.keyAgreement=16]="keyAgreement",e[e.keyCertSign=32]="keyCertSign",e[e.cRLSign=64]="cRLSign",e[e.encipherOnly=128]="encipherOnly",e[e.decipherOnly=256]="decipherOnly"}(gl||(gl={}));class vl extends Nu{constructor(...e){if(u._H.isBufferSource(e[0])){super(e[0]);const t=wr.parse(this.value,bi);this.usages=t.toNumber()}else{const t=new bi(e[0]);super(mi,e[1],wr.serialize(t)),this.usages=e[0]}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=wr.parse(this.value,bi);return e[""]=t.toJSON().join(", "),e}}vl.NAME="Key Usages";class wl extends Nu{static async create(e,t=!1,r=Lu.get()){const n=await fl.create(e,r),i=await n.getKeyIdentifier(r);return new wl(u.U$.ToHex(i),t)}constructor(...e){if(u._H.isBufferSource(e[0])){super(e[0]);const t=wr.parse(this.value,Ni);this.keyId=u.U$.ToHex(t)}else{const t="string"==typeof e[0]?u.U$.FromHex(e[0]):e[0],r=new Ni(t);super(Ui,e[1],wr.serialize(r)),this.keyId=u.U$.ToHex(t)}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=wr.parse(this.value,Ni);return e[""]=t,e}}wl.NAME="Subject Key Identifier";class bl extends Nu{constructor(...e){u._H.isBufferSource(e[0])?super(e[0]):super(_i,e[1],new sl(e[0]||[]).rawData)}onInit(e){super.onInit(e);const t=wr.parse(e.extnValue,Pi);this.names=new sl(t)}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.names.toTextObject();for(const r in t)e[r]=t[r];return e}}bl.NAME="Subject Alternative Name";class xl{static register(e,t){this.items.set(e,t)}static create(e){const t=new Nu(e),r=this.items.get(t.type);return r?new r(e):t}}xl.items=new Map;class Al extends Nu{constructor(...e){var t;if(u._H.isBufferSource(e[0])){super(e[0]);const t=wr.parse(this.value,Dn);this.policies=t.map(e=>e.policyIdentifier)}else{const r=e[0],n=null!==(t=e[1])&&void 0!==t&&t,i=new Dn(r.map(e=>new Kn({policyIdentifier:e})));super(jn,n,wr.serialize(i)),this.policies=r}}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Policy=this.policies.map(e=>new Mu("",{},Cu.toString(e))),e}}Al.NAME="Certificate Policies",xl.register(jn,Al);class Sl extends Nu{constructor(...e){var t;if(u._H.isBufferSource(e[0]))super(e[0]);else if(Array.isArray(e[0])&&"string"==typeof e[0][0]){const t=e[0].map(e=>new Yn({distributionPoint:new Jn({fullName:[new dn({uniformResourceIdentifier:e})]})})),r=new Xn(t);super(Wn,e[1],wr.serialize(r))}else{const t=new Xn(e[0]);super(Wn,e[1],wr.serialize(t))}null!==(t=this.distributionPoints)&&void 0!==t||(this.distributionPoints=[])}onInit(e){super.onInit(e);const t=wr.parse(e.extnValue,Xn);this.distributionPoints=t}toTextObject(){const e=this.toTextObjectWithoutValue();return e["Distribution Point"]=this.distributionPoints.map(e=>{var t;const r={};return e.distributionPoint&&(r[""]=null===(t=e.distributionPoint.fullName)||void 0===t?void 0:t.map(e=>new il(e).toString()).join(", ")),e.reasons&&(r.Reasons=e.reasons.toString()),e.cRLIssuer&&(r["CRL Issuer"]=e.cRLIssuer.map(e=>e.toString()).join(", ")),r}),e}}Sl.NAME="CRL Distribution Points";class kl extends Nu{constructor(...e){var t,r,n,i;if(u._H.isBufferSource(e[0]))super(e[0]);else if(e[0]instanceof Bn){const t=new Bn(e[0]);super(Sn,e[1],wr.serialize(t))}else{const t=e[0],r=new Bn;El(r,t,mn,"ocsp"),El(r,t,vn,"caIssuers"),El(r,t,wn,"timeStamping"),El(r,t,bn,"caRepository"),super(Sn,e[1],wr.serialize(r))}null!==(t=this.ocsp)&&void 0!==t||(this.ocsp=[]),null!==(r=this.caIssuers)&&void 0!==r||(this.caIssuers=[]),null!==(n=this.timeStamping)&&void 0!==n||(this.timeStamping=[]),null!==(i=this.caRepository)&&void 0!==i||(this.caRepository=[])}onInit(e){super.onInit(e),this.ocsp=[],this.caIssuers=[],this.timeStamping=[],this.caRepository=[],wr.parse(e.extnValue,Bn).forEach(e=>{switch(e.accessMethod){case mn:this.ocsp.push(new il(e.accessLocation));break;case vn:this.caIssuers.push(new il(e.accessLocation));break;case wn:this.timeStamping.push(new il(e.accessLocation));break;case bn:this.caRepository.push(new il(e.accessLocation))}})}toTextObject(){const e=this.toTextObjectWithoutValue();return this.ocsp.length&&Bl(e,"OCSP",this.ocsp),this.caIssuers.length&&Bl(e,"CA Issuers",this.caIssuers),this.timeStamping.length&&Bl(e,"Time Stamping",this.timeStamping),this.caRepository.length&&Bl(e,"CA Repository",this.caRepository),e}}function Bl(e,t,r){if(1===r.length)e[t]=r[0].toTextObject();else{const n=new Mu("");r.forEach((e,t)=>{const r=e.toTextObject(),i=`${r[Mu.NAME]} ${t+1}`;let s=n[i];Array.isArray(s)||(s=[],n[i]=s),s.push(r)}),e[t]=n}}function El(e,t,r,n){const i=t[n];i&&(Array.isArray(i)?i:[i]).forEach(t=>{"string"==typeof t&&(t=new il("url",t)),e.push(new kn({accessMethod:r,accessLocation:wr.parse(t.rawData,dn)}))})}kl.NAME="Authority Info Access";class Il extends Uu{constructor(...e){let t;if(u._H.isBufferSource(e[0]))t=u._H.toArrayBuffer(e[0]);else{const r=e[0],n=Array.isArray(e[1])?e[1].map(e=>u._H.toArrayBuffer(e)):[];t=wr.serialize(new Mi({type:r,values:n}))}super(t,Mi)}onInit(e){this.type=e.type,this.values=e.values}toTextObject(){const e=this.toTextObjectWithoutValue();return e.Value=this.values.map(e=>new Mu("",{"":e})),e}toTextObjectWithoutValue(){const e=this.toTextObjectEmpty();return e[Mu.NAME]===Il.NAME&&(e[Mu.NAME]=Cu.toString(this.type)),e}}Il.NAME="Attribute";class Ol extends Il{constructor(...e){var t;if(u._H.isBufferSource(e[0]))super(e[0]);else{const t=new zc({printableString:e[0]});super(bc,[wr.serialize(t)])}null!==(t=this.password)&&void 0!==t||(this.password="")}onInit(e){if(super.onInit(e),this.values[0]){const e=wr.parse(this.values[0],zc);this.password=e.toString()}}toTextObject(){const e=this.toTextObjectWithoutValue();return e[Mu.VALUE]=this.password,e}}Ol.NAME="Challenge Password";class _l extends Il{constructor(...e){var t;if(u._H.isBufferSource(e[0]))super(e[0]);else{const t=e[0],r=new Gi;for(const e of t)r.push(wr.parse(e.rawData,Wi));super(xc,[wr.serialize(r)])}null!==(t=this.items)&&void 0!==t||(this.items=[])}onInit(e){if(super.onInit(e),this.values[0]){const e=wr.parse(this.values[0],Gi);this.items=e.map(e=>xl.create(wr.serialize(e)))}}toTextObject(){const e=this.toTextObjectWithoutValue(),t=this.items.map(e=>e.toTextObject());for(const r of t)e[r[Mu.NAME]]=r;return e}}_l.NAME="Extensions";class Pl{static register(e,t){this.items.set(e,t)}static create(e){const t=new Il(e),r=this.items.get(t.type);return r?new r(e):t}}Pl.items=new Map;const Ml="crypto.signatureFormatter";var Cl;let Tl=Cl=class{static createPssParams(e,t){const r=Cl.getHashAlgorithm(e);return r?new Aa({hashAlgorithm:r,maskGenAlgorithm:new Ki({algorithm:ga,parameters:wr.serialize(r)}),saltLength:t}):null}static getHashAlgorithm(e){const t=qa.resolve(Jc);return"string"==typeof e?t.toAsnAlgorithm({name:e}):"object"==typeof e&&e&&"name"in e?t.toAsnAlgorithm(e):null}toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"rsassa-pkcs1-v1_5":if(!("hash"in e))return new Ki({algorithm:Xo,parameters:null});{let t;if("string"==typeof e.hash)t=e.hash;else{if(!e.hash||"object"!=typeof e.hash||!("name"in e.hash)||"string"!=typeof e.hash.name)throw new Error("Cannot get hash algorithm name");t=e.hash.name.toUpperCase()}switch(t.toLowerCase()){case"sha-1":return new Ki({algorithm:ia,parameters:null});case"sha-256":return new Ki({algorithm:oa,parameters:null});case"sha-384":return new Ki({algorithm:aa,parameters:null});case"sha-512":return new Ki({algorithm:ca,parameters:null})}}break;case"rsa-pss":if("hash"in e){if(!("saltLength"in e)||"number"!=typeof e.saltLength)throw new Error("Cannot get 'saltLength' from 'alg' argument");const t=Cl.createPssParams(e.hash,e.saltLength);if(!t)throw new Error("Cannot create PSS parameters");return new Ki({algorithm:ta,parameters:wr.serialize(t)})}return new Ki({algorithm:ta,parameters:null})}return null}toWebAlgorithm(e){switch(e.algorithm){case Xo:return{name:"RSASSA-PKCS1-v1_5"};case ia:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-1"}};case oa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case aa:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-384"}};case ca:return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-512"}};case ta:if(e.parameters){const t=wr.parse(e.parameters,Aa);return{name:"RSA-PSS",hash:qa.resolve(Jc).toWebAlgorithm(t.hashAlgorithm),saltLength:t.saltLength}}return{name:"RSA-PSS"}}return null}};Tl=Cl=kr([Wa()],Tl),qa.registerSingleton(Zc,Tl);let Ul=class{toAsnAlgorithm(e){switch(e.name.toLowerCase()){case"sha-1":return new Ki({algorithm:ha});case"sha-256":return new Ki({algorithm:da});case"sha-384":return new Ki({algorithm:pa});case"sha-512":return new Ki({algorithm:ya})}return null}toWebAlgorithm(e){switch(e.algorithm){case ha:return{name:"SHA-1"};case da:return{name:"SHA-256"};case pa:return{name:"SHA-384"};case ya:return{name:"SHA-512"}}return null}};Ul=kr([Wa()],Ul),qa.registerSingleton(Zc,Ul);class Nl{addPadding(e,t){const r=u._H.toUint8Array(t),n=new Uint8Array(e);return n.set(r,e-r.length),n}removePadding(e,t=!1){let r=u._H.toUint8Array(e);for(let e=0;e127){const e=new Uint8Array(r.length+1);return e.set(r,1),e.buffer}return r.buffer}toAsnSignature(e,t){if("ECDSA"===e.name){const r=e.namedCurve,n=Nl.namedCurveSize.get(r)||Nl.defaultNamedCurveSize,i=new Jo,s=u._H.toUint8Array(t);return i.r=this.removePadding(s.slice(0,n),!0),i.s=this.removePadding(s.slice(n,n+n),!0),wr.serialize(i)}return null}toWebSignature(e,t){if("ECDSA"===e.name){const r=wr.parse(t,Jo),n=e.namedCurve,i=Nl.namedCurveSize.get(n)||Nl.defaultNamedCurveSize,s=this.addPadding(i,this.removePadding(r.r)),o=this.addPadding(i,this.removePadding(r.s));return(0,u.kg)(s,o)}return null}}Nl.namedCurveSize=new Map,Nl.defaultNamedCurveSize=32;const jl="1.3.101.110",Rl="1.3.101.111",Ll="1.3.101.112",zl="1.3.101.113";let Hl=class{toAsnAlgorithm(e){let t=null;switch(e.name.toLowerCase()){case"ed25519":t=Ll;break;case"x25519":t=jl;break;case"eddsa":switch(e.namedCurve.toLowerCase()){case"ed25519":t=Ll;break;case"ed448":t=zl}break;case"ecdh-es":switch(e.namedCurve.toLowerCase()){case"x25519":t=jl;break;case"x448":t=Rl}}return t?new Ki({algorithm:t}):null}toWebAlgorithm(e){switch(e.algorithm){case Ll:return{name:"Ed25519"};case zl:return{name:"EdDSA",namedCurve:"Ed448"};case jl:return{name:"X25519"};case Rl:return{name:"ECDH-ES",namedCurve:"X448"}}return null}};Hl=kr([Wa()],Hl),qa.registerSingleton(Zc,Hl);(class extends hl{constructor(e){hl.isAsnEncoded(e)?super(e,Gc):super(e),this.tag=ll.CertificateRequestTag}onInit(e){this.tbs=wr.serialize(e.certificationRequestInfo),this.publicKey=new fl(e.certificationRequestInfo.subjectPKInfo);const t=qa.resolve(Jc);this.signatureAlgorithm=t.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signature,this.attributes=e.certificationRequestInfo.attributes.map(e=>Pl.create(wr.serialize(e)));const r=this.getAttribute(xc);this.extensions=[],r instanceof _l&&(this.extensions=r.items),this.subjectName=new Du(e.certificationRequestInfo.subject),this.subject=this.subjectName.toString()}getAttribute(e){for(const t of this.attributes)if(t.type===e)return t;return null}getAttributes(e){return this.attributes.filter(t=>t.type===e)}getExtension(e){for(const t of this.extensions)if(t.type===e)return t;return null}getExtensions(e){return this.extensions.filter(t=>t.type===e)}async verify(e=Lu.get()){const t={...this.publicKey.algorithm,...this.signatureAlgorithm},r=await this.publicKey.export(t,["verify"],e),n=qa.resolveAll(Ml).reverse();let i=null;for(const e of n)if(i=e.toWebSignature(t,this.signature),i)break;if(!i)throw Error("Cannot convert WebCrypto signature value to ASN.1 format");return await e.subtle.verify(this.signatureAlgorithm,r,i,this.tbs)}toTextObject(){const e=this.toTextObjectEmpty(),t=wr.parse(this.rawData,Gc),r=t.certificationRequestInfo,n=new Mu("",{Version:`${Zi[r.version]} (${r.version})`,Subject:this.subject,"Subject Public Key Info":this.publicKey});if(this.attributes.length){const e=new Mu("");for(const t of this.attributes){const r=t.toTextObject();e[r[Mu.NAME]]=r}n.Attributes=e}return e.Data=n,e.Signature=new Mu("",{Algorithm:Tu.serializeAlgorithm(t.signatureAlgorithm),"":t.signature}),e}}).NAME="PKCS#10 Certificate Request";var $l;(class extends hl{constructor(e){hl.isAsnEncoded(e)?super(e,Yi):super(e),this.tag=ll.CertificateTag}onInit(e){const t=e.tbsCertificate;this.tbs=wr.serialize(t),this.serialNumber=u.U$.ToHex(t.serialNumber),this.subjectName=new Du(t.subject),this.subject=new Du(t.subject).toString(),this.issuerName=new Du(t.issuer),this.issuer=this.issuerName.toString();const r=qa.resolve(Jc);this.signatureAlgorithm=r.toWebAlgorithm(e.signatureAlgorithm),this.signature=e.signatureValue;const n=t.validity.notBefore.utcTime||t.validity.notBefore.generalTime;if(!n)throw new Error("Cannot get 'notBefore' value");this.notBefore=n;const i=t.validity.notAfter.utcTime||t.validity.notAfter.generalTime;if(!i)throw new Error("Cannot get 'notAfter' value");this.notAfter=i,this.extensions=[],t.extensions&&(this.extensions=t.extensions.map(e=>xl.create(wr.serialize(e)))),this.publicKey=new fl(t.subjectPublicKeyInfo)}getExtension(e){for(const t of this.extensions)if("string"==typeof e){if(t.type===e)return t}else if(t instanceof e)return t;return null}getExtensions(e){return this.extensions.filter(t=>"string"==typeof e?t.type===e:t instanceof e)}async verify(e={},t=Lu.get()){let r,n;const i=e.publicKey;try{if(i)if("publicKey"in i)r={...i.publicKey.algorithm,...this.signatureAlgorithm},n=await i.publicKey.export(r,["verify"],t);else if(i instanceof fl)r={...i.algorithm,...this.signatureAlgorithm},n=await i.export(r,["verify"],t);else if(u._H.isBufferSource(i)){const e=new fl(i);r={...e.algorithm,...this.signatureAlgorithm},n=await e.export(r,["verify"],t)}else r={...i.algorithm,...this.signatureAlgorithm},n=i;else r={...this.publicKey.algorithm,...this.signatureAlgorithm},n=await this.publicKey.export(r,["verify"],t)}catch(e){return!1}const s=qa.resolveAll(Ml).reverse();let o=null;for(const e of s)if(o=e.toWebSignature(r,this.signature),o)break;if(!o)throw Error("Cannot convert ASN.1 signature value to WebCrypto format");const a=await t.subtle.verify(this.signatureAlgorithm,n,o,this.tbs);if(e.signatureOnly)return a;{const t=(e.date||new Date).getTime();return a&&this.notBefore.getTime(){"use strict";r.d(t,{db:()=>s,eV:()=>i});var n=r(6440);function i(e,{dir:t,size:r=32}={}){return"string"==typeof e?s(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new n.Fl({size:e.length,targetSize:r,type:"bytes"});const i=new Uint8Array(r);for(let n=0;n2*r)throw new n.Fl({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}},601:(e,t,r)=>{"use strict";t.I0=t.DH=t.NX=t.u8=t.cY=void 0,t.av=t.O6=t.w3=t.Wg=void 0;const n=r(8287);function i(e){if(!(e instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}function s(e){return i(e),n.Buffer.from(e.buffer,e.byteOffset,e.length)}class o{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}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 a(e,t){return t.property?e+"["+t.property+"]":e}class c extends o{isCount(){throw new Error("ExternalLayout is abstract")}}class u extends c{constructor(e,t=0,r){if(!(e instanceof o))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof l||this.layout instanceof h}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}class l extends o{constructor(e,t){if(super(e,t),6e+n.encode(i,t,r+e),0);return this.count instanceof c&&this.count.encode(e.length,t,r),i}}class v extends o{constructor(e,t,r){if(!Array.isArray(e)||!e.reduce((e,t)=>e&&t instanceof o,!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof t&&void 0===r&&(r=t,t=void 0);for(const t of e)if(0>t.span&&void 0===t.property)throw new Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{const i=n.getSpan(e,t);return t+=i,r+i},0)}catch(e){throw new RangeError("indeterminate span")}return r}decode(e,t=0){i(e);const r=this.makeDestinationObject();for(const n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){const n=r;let i=0,s=0;for(const n of this.fields){let o=n.span;if(s=0o&&(o=n.getSpan(t,r)))}i=r,r+=o}return i+s-n}fromArray(e){const t=this.makeDestinationObject();for(const r of this.fields)void 0!==r.property&&0r.span?t=-1:0<=t&&(t+=r.span)}}}class w extends o{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof c||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),s(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof c&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw new TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw new RangeError("encoding overruns Uint8Array");const i=s(e);return s(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof c&&this.length.encode(n,t,r),n}}t.cY=(e,t,r)=>new u(e,t,r),t.u8=e=>new l(1,e),t.NX=e=>new l(2,e),t.DH=e=>new l(4,e),t.I0=e=>new y(e),t.Wg=e=>new g(e),t.w3=(e,t,r)=>new v(e,t,r),t.O6=(e,t,r)=>new m(e,t,r),t.av=(e,t)=>new w(e,t)},615:(e,t,r)=>{"use strict";r.d(t,{Ak:()=>c,UT:()=>b,Xf:()=>v,fH:()=>m,hT:()=>g,u0:()=>a});var n=r(1848),i=r(8030);const s=BigInt(0),o=BigInt(1);function a(e,t){const r=t.negate();return e?r:t}function c(e,t){const r=(0,i.pS)(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function u(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function l(e,t){u(e,t);const r=2**e;return{windows:Math.ceil(t/e)+1,windowSize:2**(e-1),mask:(0,n.OG)(e),maxNumber:r,shiftBy:BigInt(e)}}function h(e,t,r){const{windowSize:n,mask:i,maxNumber:s,shiftBy:a}=r;let c=Number(e&i),u=e>>a;c>n&&(c-=s,u+=o);const l=t*n;return{nextN:u,offset:l+Math.abs(c)-1,isZero:0===c,isNeg:c<0,isNegF:t%2!=0,offsetF:l}}const f=new WeakMap,d=new WeakMap;function p(e){return d.get(e)||1}function y(e){if(e!==s)throw new Error("invalid wNAF")}class g{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>s;)t&o&&(r=r.add(n)),n=n.double(),t>>=o;return r}precomputeWindow(e,t){const{windows:r,windowSize:n}=l(t,this.bits),i=[];let s=e,o=s;for(let e=0;es||n>s;)r&o&&(a=a.add(i)),n&o&&(c=c.add(i)),i=i.double(),r>>=o,n>>=o;return{p1:a,p2:c}}function v(e,t,r,i){(function(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})})(r,e),function(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}(i,t);const s=r.length,o=i.length;if(s!==o)throw new Error("arrays of points and scalars must have equal length");const a=e.ZERO,c=(0,n.dJ)(BigInt(s));let u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);const l=(0,n.OG)(u),h=new Array(Number(l)+1).fill(a);let f=a;for(let e=Math.floor((t.BITS-1)/u)*u;e>=0;e-=u){h.fill(a);for(let t=0;t>BigInt(e)&l);h[s]=h[s].add(r[t])}let t=a;for(let e=h.length-1,r=a;e>0;e--)r=r.add(h[e]),t=t.add(r);if(f=f.add(t),0!==e)for(let e=0;es))throw new Error(`CURVE.${e} must be positive bigint`)}const i=w(t.p,r.Fp,n),o=w(t.n,r.Fn,n),a=["Gx","Gy","a","weierstrass"===e?"b":"d"];for(const e of a)if(!i.isValid(t[e]))throw new Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}},638:(e,t,r)=>{"use strict";r.d(t,{eL:()=>n,sz:()=>i});const n={gwei:9,wei:18},i={ether:-9,wei:9}},882:(e,t)=>{"use strict";function r(e){return 14+(e+64>>>9<<4)+1}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,s,o){return n((a=n(n(t,e),n(i,o)))<<(c=s)|a>>>32-c,r);var a,c}function s(e,t,r,n,s,o,a){return i(t&r|~t&n,e,t,s,o,a)}function o(e,t,r,n,s,o,a){return i(t&n|r&~n,e,t,s,o,a)}function a(e,t,r,n,s,o,a){return i(t^r^n,e,t,s,o,a)}function c(e,t,r,n,s,o,a){return i(r^(t|~n),e,t,s,o,a)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(let r=0;r>5]>>>i%32&255,s=parseInt(n.charAt(r>>>4&15)+n.charAt(15&r),16);t.push(s)}return t}(function(e,t){e[t>>5]|=128<>5]|=(255&e[r/8])<{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default=/^(?:[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},1255:(e,t,r)=>{"use strict";r.d(t,{ws:()=>F,GR:()=>ye,RG:()=>ge,v7:()=>me});class n extends Error{constructor(e){let t;t=e instanceof Error?e.message:"string"==typeof e?e:"",super(t),this.name=this.constructor.name}}class i extends n{}class s extends n{}class o extends n{}class a extends n{}class c extends n{}class u extends n{}class l extends n{}class h extends n{}class f extends n{}class d extends n{}class p extends n{}const y=(g=globalThis,m={},new Proxy(g,{get:(e,t,r)=>t in m?m[t]:g[t],set:(e,t,r)=>(t in m&&delete m[t],g[t]=r,!0),deleteProperty(e,t){let r=!1;return t in m&&(delete m[t],r=!0),t in g&&(delete g[t],r=!0),r},ownKeys(e){const t=Reflect.ownKeys(g),r=Reflect.ownKeys(m),n=new Set(r);return[...t.filter(e=>!n.has(e)),...r]},defineProperty:(e,t,r)=>(t in m&&delete m[t],Reflect.defineProperty(g,t,r),!0),getOwnPropertyDescriptor:(e,t)=>t in m?Reflect.getOwnPropertyDescriptor(m,t):Reflect.getOwnPropertyDescriptor(g,t),has:(e,t)=>t in m||t in g}));var g,m;class v{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){void 0===this._api&&(this._api=await async function(){if(void 0!==y&&void 0!==globalThis.crypto)return globalThis.crypto.subtle;try{const{webcrypto:e}=await r.e(825).then(r.t.bind(r,4825,19));return e.subtle}catch(e){throw new p(e)}}())}}const w=8192,b=new Uint8Array(0),x=new Uint8Array([75,69,77,0,0]),A=e=>"object"==typeof e&&null!==e&&"object"==typeof e.privateKey&&"object"==typeof e.publicKey;function S(e,t){if(t<=0)throw new Error("i2Osp: too small size");if(e>=256**t)throw new Error("i2Osp: too large integer");const r=new Uint8Array(t);for(let n=0;n>=8;return r}function k(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}const B=new Uint8Array([101,97,101,95,112,114,107]),E=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);class I{constructor(e,t,r){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=r;const n=new Uint8Array(x);n.set(S(this.id,2),3),this._kdf.init(n)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(e)}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(e)}async importKey(e,t,r=!0){return await this._prim.importKey(e,t,r)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){if(e.byteLength>w)throw new i("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;t=void 0===e.ekm?await this.generateKeyPair():A(e.ekm)?e.ekm:await this.deriveKeyPair(e.ekm);const r=await this._prim.serializePublicKey(t.publicKey),n=await this._prim.serializePublicKey(e.recipientPublicKey);try{let i,s;if(void 0===e.senderKey)i=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{const r=A(e.senderKey)?e.senderKey.privateKey:e.senderKey;i=k(new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),new Uint8Array(await this._prim.dh(r,e.recipientPublicKey)))}if(void 0===e.senderKey)s=k(new Uint8Array(r),new Uint8Array(n));else{const t=A(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),i=await this._prim.serializePublicKey(t);s=function(e,t,r){const n=new Uint8Array(e.length+t.length+r.length);return n.set(e,0),n.set(t,e.length),n.set(r,e.length+t.length),n}(new Uint8Array(r),new Uint8Array(n),new Uint8Array(i))}return{enc:r,sharedSecret:await this._generateSharedSecret(i,s)}}catch(e){throw new a(e)}}async decap(e){const t=await this._prim.deserializePublicKey(e.enc),r=A(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,n=A(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),i=await this._prim.serializePublicKey(n);try{let n,s;if(void 0===e.senderPublicKey)n=new Uint8Array(await this._prim.dh(r,t));else{n=k(new Uint8Array(await this._prim.dh(r,t)),new Uint8Array(await this._prim.dh(r,e.senderPublicKey)))}if(void 0===e.senderPublicKey)s=k(new Uint8Array(e.enc),new Uint8Array(i));else{const t=await this._prim.serializePublicKey(e.senderPublicKey);s=new Uint8Array(e.enc.byteLength+i.byteLength+t.byteLength),s.set(new Uint8Array(e.enc),0),s.set(new Uint8Array(i),e.enc.byteLength),s.set(new Uint8Array(t),e.enc.byteLength+i.byteLength)}return await this._generateSharedSecret(n,s)}catch(e){throw new c(e)}}async _generateSharedSecret(e,t){const r=this._kdf.buildLabeledIkm(B,e),n=this._kdf.buildLabeledInfo(E,t,this.secretSize);return await this._kdf.extractAndExpand(b.buffer,r.buffer,n.buffer,this.secretSize)}}const O=["deriveBits"],_=new Uint8Array([100,107,112,95,112,114,107]);new Uint8Array([115,107]);class P{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}}const M=new Uint8Array([99,97,110,100,105,100,97,116,101]),C=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),T=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),U=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),N=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),j=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),R=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]);class L extends v{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case 16:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=C,this._bitmask=255,this._pkcs8AlgId=N;break;case 17:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=T,this._bitmask=255,this._pkcs8AlgId=j;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=U,this._bitmask=1,this._pkcs8AlgId=R}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(e){throw new s(e)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(e){throw new o(e)}}async serializePrivateKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),n=new Uint8Array(r.length);for(let e=0;e255)throw new Error("Faild to derive a key pair");const n=new Uint8Array(await this._hkdf.labeledExpand(t,M,S(e,1),this._nSk));n[0]=n[0]&this._bitmask,r.set(n)}const n=await this._deserializePkcs8Key(r.val());return r.reset(),{privateKey:n,publicKey:await this.derivePublicKey(n)}}catch(e){throw new d(e)}}async derivePublicKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(e){throw new o(e)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,8*this._nDh)}catch(e){throw new s(e)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(void 0===e.crv||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(void 0!==e.d)throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(void 0===e.d)throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,O)}async _deserializePkcs8Key(e){const t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,O)}}const z=new Uint8Array([72,80,75,69,45,118,49]);class H extends v{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:b}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();const r=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(z,0),r.set(this._suiteId,7),r.set(e,7+this._suiteId.byteLength),r.set(t,7+this._suiteId.byteLength+e.byteLength),r}buildLabeledInfo(e,t,r){this._checkInit();const n=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(new Uint8Array([0,r]),0),n.set(z,2),n.set(this._suiteId,9),n.set(e,9+this._suiteId.byteLength),n.set(t,9+this._suiteId.byteLength+e.byteLength),n}async extract(e,t){if(await this._setup(),0===e.byteLength&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new i("The salt length must be the same as the hashSize");const r=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",r,t)}async expand(e,t,r){await this._setup();const n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),i=new ArrayBuffer(r),s=new Uint8Array(i);let o=b;const a=new Uint8Array(t),c=new Uint8Array(1);if(r>255*this.hashSize)throw new Error("Entropy limit reached");const u=new Uint8Array(this.hashSize+a.length+1);for(let e=1,t=0;t=o.length?(s.set(o,t),t+=o.length):(s.set(o.slice(0,s.length-t),t),t+=s.length-t);return i}async extractAndExpand(e,t,r,n){await this._setup();const i=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:r},i,8*n)}async labeledExtract(e,t,r){return await this.extract(e,this.buildLabeledIkm(t,r).buffer)}async labeledExpand(e,t,r,n){return await this.expand(e,this.buildLabeledInfo(t,r,n).buffer,n)}_checkInit(){if(this._suiteId===b)throw new Error("Not initialized. Call init()")}}class $ extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}}const K=["encrypt","decrypt"];BigInt(0),BigInt(1),BigInt(2);class D extends v{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,r){await this._setupKey();const n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.encrypt(n,this._key,t)}async open(e,t,r){await this._setupKey();const n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.decrypt(n,this._key,t)}async _setupKey(){if(void 0!==this._key)return;await this._setup();const e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,K)}}class V{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new D(e)}}class F extends V{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:2}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}}function q(){return new Promise((e,t)=>{t(new p("Not supported"))})}const W=new Uint8Array([115,101,99]);class G{constructor(e,t,r){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=r}async seal(e,t){return await q()}async open(e,t){return await q()}async export(e,t){if(e.byteLength>w)throw new i("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,W,new Uint8Array(e),t)}catch(e){throw new u(e)}}}class Z extends G{}class J extends G{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=n}}class Y extends G{constructor(e,t,r){if(super(e,t,r.exporterSecret),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nT",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),void 0===r.key||void 0===r.baseNonce||void 0===r.seq)throw new Error("Required parameters are missing");this._aead=r.aead,this._nK=this._aead.keySize,this._nN=this._aead.nonceSize,this._nT=this._aead.tagSize;const n=this._aead.createEncryptionContext(r.key);this._ctx={key:n,baseNonce:r.baseNonce,seq:r.seq}}computeNonce(e){const t=S(e.seq,e.baseNonce.byteLength);return function(e,t){if(e.byteLength!==t.byteLength)throw new Error("xor: different length inputs");const r=new Uint8Array(e.byteLength);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new f("Message limit reached");e.seq+=1}}var X;class Q{constructor(){X.set(this,Promise.resolve())}async lock(){let e;const t=new Promise(t=>{e=t}),r=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)}(this,X,"f");return function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,X,t,"f"),await r,e}}X=new WeakMap;var ee,te=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class re extends Y{constructor(){super(...arguments),ee.set(this,void 0)}async open(e,t=b.buffer){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,ee,te(this,ee,"f")??new Q,"f");const r=await te(this,ee,"f").lock();let n;try{n=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(e){throw new h(e)}finally{r()}return this.incrementSeq(this._ctx),n}}ee=new WeakMap;var ne,ie=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class se extends Y{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ne.set(this,void 0),this.enc=n}async seal(e,t=b.buffer){!function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?i.call(e,r):i?i.value=r:t.set(e,r)}(this,ne,ie(this,ne,"f")??new Q,"f");const r=await ie(this,ne,"f").lock();let n;try{n=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(e){throw new l(e)}finally{r()}return this.incrementSeq(this._ctx),n}}ne=new WeakMap;const oe=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),ae=new Uint8Array([101,120,112]),ce=new Uint8Array([105,110,102,111,95,104,97,115,104]),ue=new Uint8Array([107,101,121]),le=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),he=new Uint8Array([115,101,99,114,101,116]),fe=new Uint8Array([72,80,75,69,0,0,0,0,0,0]);class de extends v{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),"number"==typeof e.kem)throw new i("KemId cannot be used");if(this._kem=e.kem,"number"==typeof e.kdf)throw new i("KdfId cannot be used");if(this._kdf=e.kdf,"number"==typeof e.aead)throw new i("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(fe),this._suiteId.set(S(this._kem.id,2),4),this._suiteId.set(S(this._kdf.id,2),6),this._suiteId.set(S(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.encap(e);let r;return r=void 0!==e.psk?void 0!==e.senderKey?3:1:void 0!==e.senderKey?2:0,await this._keyScheduleS(r,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.decap(e);let r;return r=void 0!==e.psk?void 0!==e.senderPublicKey?3:1:void 0!==e.senderPublicKey?2:0,await this._keyScheduleR(r,t,e)}async seal(e,t,r=b.buffer){const n=await this.createSenderContext(e);return{ct:await n.seal(t,r),enc:n.enc}}async open(e,t,r=b.buffer){const n=await this.createRecipientContext(e);return await n.open(t,r)}async _keySchedule(e,t,r){const n=void 0===r.psk?b:new Uint8Array(r.psk.id),i=await this._kdf.labeledExtract(b.buffer,le,n),s=void 0===r.info?b:new Uint8Array(r.info),o=await this._kdf.labeledExtract(b.buffer,ce,s),a=new Uint8Array(1+i.byteLength+o.byteLength);a.set(new Uint8Array([e]),0),a.set(new Uint8Array(i),1),a.set(new Uint8Array(o),1+i.byteLength);const c=void 0===r.psk?b:new Uint8Array(r.psk.key),u=this._kdf.buildLabeledIkm(he,c).buffer,l=this._kdf.buildLabeledInfo(ae,a,this._kdf.hashSize).buffer,h=await this._kdf.extractAndExpand(t,u,l,this._kdf.hashSize);if(65535===this._aead.id)return{aead:this._aead,exporterSecret:h};const f=this._kdf.buildLabeledInfo(ue,a,this._aead.keySize).buffer,d=await this._kdf.extractAndExpand(t,u,f,this._aead.keySize),p=this._kdf.buildLabeledInfo(oe,a,this._aead.nonceSize).buffer,y=await this._kdf.extractAndExpand(t,u,p,this._aead.nonceSize);return{aead:this._aead,exporterSecret:h,key:d,baseNonce:new Uint8Array(y),seq:0}}async _keyScheduleS(e,t,r,n){const i=await this._keySchedule(e,t,n);return void 0===i.key?new J(this._api,this._kdf,i.exporterSecret,r):new se(this._api,this._kdf,i,r)}async _keyScheduleR(e,t,r){const n=await this._keySchedule(e,t,r);return void 0===n.key?new Z(this._api,this._kdf,n.exporterSecret):new re(this._api,this._kdf,n)}_validateInputLength(e){if(void 0!==e.info&&e.info.byteLength>65536)throw new i("Too long info");if(void 0!==e.psk){if(e.psk.key.byteLength<32)throw new i("PSK must have at least 32 bytes");if(e.psk.key.byteLength>w)throw new i("Too long psk.key");if(e.psk.id.byteLength>w)throw new i("Too long psk.id")}}}class pe extends I{constructor(){const e=new $;super(16,new L(16,e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}}class ye extends de{}class ge extends pe{}class me extends ${}new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),new Uint8Array([48,70,2,1,0,48,5,6,3,43,101,111,4,58,4,56])},1344:(e,t,r)=>{"use strict";r.d(t,{C:()=>o});const n="2.45.0";let i=({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,s=`viem@${n}`;class o extends Error{constructor(e,t={}){const r=t.cause instanceof o?t.cause.details:t.cause?.message?t.cause.message:t.details,a=t.cause instanceof o&&t.cause.docsPath||t.docsPath,c=i?.({...t,docsPath:a});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...c?[`Docs: ${c}`]:[],...r?[`Details: ${r}`]:[],...s?[`Version: ${s}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=a,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=n}walk(e){return a(this,e)}}function a(e,t){return t?.(e)?e:e&&"object"==typeof e&&"cause"in e&&void 0!==e.cause?a(e.cause,t):t?null:e}},1525:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t,r){function s(e,s,o,a){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));const t=[];for(let r=0;r{"use strict";r.d(t,{DS:()=>A,OG:()=>b,Ph:()=>l,SJ:()=>S,aK:()=>v,d6:()=>o,dJ:()=>w,eV:()=>a,ex:()=>y,fg:()=>x,lX:()=>h,lq:()=>f,nC:()=>g,qj:()=>p,x:()=>k,z:()=>d,zW:()=>c});var n=r(9441);const i=BigInt(0),s=BigInt(1);function o(e,t=""){if("boolean"!=typeof e)throw new Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function a(e,t,r=""){const i=(0,n.aY)(e),s=e?.length,o=void 0!==t;if(!i||o&&s!==t)throw new Error((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(i?`length=${s}`:"type="+typeof e));return e}function c(e){const t=e.toString(16);return 1&t.length?"0"+t:t}function u(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return""===e?i:BigInt("0x"+e)}function l(e){return u((0,n.My)(e))}function h(e){return(0,n.DO)(e),u((0,n.My)(Uint8Array.from(e).reverse()))}function f(e,t){return(0,n.aT)(e.toString(16).padStart(2*t,"0"))}function d(e,t){return f(e,t).reverse()}function p(e,t,r){let i;if("string"==typeof t)try{i=(0,n.aT)(t)}catch(t){throw new Error(e+" must be hex string or Uint8Array, cause: "+t)}else{if(!(0,n.aY)(t))throw new Error(e+" must be hex string or Uint8Array");i=Uint8Array.from(t)}const s=i.length;if("number"==typeof r&&s!==r)throw new Error(e+" of length "+r+" expected, got "+s);return i}function y(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n"bigint"==typeof e&&i<=e;function v(e,t,r,n){if(!function(e,t,r){return m(e)&&m(t)&&m(r)&&t<=e&&ei;e>>=s,t+=1);return t}const b=e=>(s<new Uint8Array(e),s=e=>Uint8Array.of(e);let o=i(e),a=i(e),c=0;const u=()=>{o.fill(1),a.fill(0),c=0},l=(...e)=>r(a,o,...e),h=(e=i(0))=>{a=l(s(0),e),o=l(),0!==e.length&&(a=l(s(1),e),o=l())},f=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e{let r;for(u(),h(e);!(r=t(f()));)h();return u(),r}}function A(e,t,r={}){if(!e||"object"!=typeof e)throw new Error("expected valid options object");function n(t,r,n){const i=e[t];if(n&&void 0===i)return;const s=typeof i;if(s!==r||null===i)throw new Error(`param "${t}" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}const S=()=>{throw new Error("not implemented")};function k(e){const t=new WeakMap;return(r,...n)=>{const i=t.get(r);if(void 0!==i)return i;const s=e(r,...n);return t.set(r,s),s}}},2040:(e,t,r)=>{"use strict";r.d(t,{S:()=>a});var n=r(7238),i=r(6394),s=r(4706),o=r(4192);function a(e,t){const r=t||"hex",a=(0,n.lY)((0,i.q)(e,{strict:!1})?(0,s.ZJ)(e):e);return"bytes"===r?a:(0,o.nj)(a)}},2107:(e,t,r)=>{"use strict";Object.defineProperty(t,"v4",{enumerable:!0,get:function(){return n.default}});i(r(8610)),i(r(3208));var n=i(r(4061));i(r(3358)),i(r(6348)),i(r(51)),i(r(129)),i(r(2298)),i(r(2356));function i(e){return e&&e.__esModule?e:{default:e}}},2298:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(129))&&n.__esModule?n:{default:n};const s=[];for(let e=0;e<256;++e)s.push((e+256).toString(16).substr(1));t.default=function(e,t=0){const r=(s[e[t+0]]+s[e[t+1]]+s[e[t+2]]+s[e[t+3]]+"-"+s[e[t+4]]+s[e[t+5]]+"-"+s[e[t+6]]+s[e[t+7]]+"-"+s[e[t+8]]+s[e[t+9]]+"-"+s[e[t+10]]+s[e[t+11]]+s[e[t+12]]+s[e[t+13]]+s[e[t+14]]+s[e[t+15]]).toLowerCase();if(!(0,i.default)(r))throw TypeError("Stringified UUID is invalid");return r}},2343:(e,t)=>{"use strict";const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",n={};for(let e=0;e<32;e++){const t=r.charAt(e);n[t]=e}function i(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function s(e){let t=1;for(let r=0;r126)return"Invalid prefix ("+e+")";t=i(t)^n>>5}t=i(t);for(let r=0;r=r;)s-=r,a.push(i>>s&o);if(n)s>0&&a.push(i<=t)return"Excess padding";if(i<r)return"Exceeds length limit";const o=e.toLowerCase(),a=e.toUpperCase();if(e!==o&&e!==a)return"Mixed-case string "+e;const c=(e=o).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const u=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let h=s(u);if("string"==typeof h)return h;const f=[];for(let e=0;e=l.length||f.push(r)}return h!==t?"Invalid checksum for "+e:{prefix:u,words:f}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=o(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=o(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,n,o){if(o=o||90,e.length+7+n.length>o)throw new TypeError("Exceeds length limit");let a=s(e=e.toLowerCase());if("string"==typeof a)throw new Error(a);let c=e+"1";for(let e=0;e>5)throw new Error("Non 5-bit word");a=i(a)^t,c+=r.charAt(t)}for(let e=0;e<6;++e)a=i(a);a^=t;for(let e=0;e<6;++e)c+=r.charAt(a>>5*(5-e)&31);return c},toWords:a,fromWordsUnsafe:c,fromWords:u}}l("bech32"),l("bech32m")},2356:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n,i=(n=r(129))&&n.__esModule?n:{default:n};t.default=function(e){if(!(0,i.default)(e))throw TypeError("Invalid UUID");let t;const r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=255&t,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=255&t,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=255&t,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=255&t,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=255&t,r}},2455:function(e,t,r){var n,i;!function(s,o){"use strict";var a=Math.pow(2,-24),c=Math.pow(2,32),u=Math.pow(2,53);(i="function"==typeof(n={encode:function(e){var t,r=new ArrayBuffer(256),n=new DataView(r),i=0;function s(e){for(var s=r.byteLength,o=i+e;s>2,u=0;u>6),n.push(128|63&c)):c<55296?(n.push(224|c>>12),n.push(128|c>>6&63),n.push(128|63&c)):(c=(1023&c)<<10,c|=1023&t.charCodeAt(++r),c+=65536,n.push(240|c>>18),n.push(128|c>>12&63),n.push(128|c>>6&63),n.push(128|63&c))}return f(3,n.length),h(n);default:var d;if(Array.isArray(t))for(f(4,d=t.length),r=0;r>5!==e)throw"Invalid indefinite length element";return r}function g(e,t){for(var r=0;r>10),e.push(56320|1023&n))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof r&&(r=function(){return o});var m=function e(){var c,f,m=l(),v=m>>5,w=31&m;if(7===v)switch(w){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),r=h(),n=32768&r,i=31744&r,s=1023&r;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==s)return s*a;return t.setUint32(0,n<<16|i<<13|s<<13),t.getFloat32(0)}();case 26:return s(n.getFloat32(i),4);case 27:return s(n.getFloat64(i),8)}if((f=p(w))<0&&(v<2||6=0;)x+=f,b.push(u(f));var A=new Uint8Array(x),S=0;for(c=0;c=0;)g(k,f);else g(k,f);return String.fromCharCode.apply(null,k);case 4:var B;if(f<0)for(B=[];!d();)B.push(e());else for(B=new Array(f),c=0;c{"use strict";r.d(t,{AX:()=>yr,Kt:()=>ut});var n=r(8287),i=r(8442),s=r(9441),o=r(615),a=r(1848),c=r(8030);const u=BigInt(0),l=BigInt(1),h=BigInt(2),f=BigInt(8);class d{constructor(e){this.ep=e}static fromBytes(e){(0,a.SJ)()}static fromHex(e){(0,a.SJ)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,s.My)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}function p(e){const{CURVE:t,curveOpts:r,hash:n,eddsaOpts:i}=function(e){const t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:(0,c.D0)(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},n={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:n}}(e),d=function(e,t={}){const r=(0,o.UT)("edwards",e,t,t.FpFnLE),{Fp:n,Fn:i}=r;let c=r.CURVE;const{h:d}=c;(0,a.DS)(t,{},{uvRatio:"function"});const p=h<n.create(e),g=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(n.div(e,t))}}catch(e){return{isValid:!1,value:u}}});if(!function(e,t,r,n){const i=e.sqr(r),s=e.sqr(n),o=e.add(e.mul(t.a,i),s),a=e.add(e.ONE,e.mul(t.d,e.mul(i,s)));return e.eql(o,a)}(n,c,c.Gx,c.Gy))throw new Error("bad curve params: generator point");function m(e,t,r=!1){const n=r?l:u;return(0,a.aK)("coordinate "+e,t,n,p),t}function v(e){if(!(e instanceof x))throw new Error("ExtendedPoint expected")}const w=(0,a.x)((e,t)=>{const{X:r,Y:i,Z:s}=e,o=e.is0();null==t&&(t=o?f:n.inv(s));const a=y(r*t),c=y(i*t),h=n.mul(s,t);if(o)return{x:u,y:l};if(h!==l)throw new Error("invZ was invalid");return{x:a,y:c}}),b=(0,a.x)(e=>{const{a:t,d:r}=c;if(e.is0())throw new Error("bad point: ZERO");const{X:n,Y:i,Z:s,T:o}=e,a=y(n*n),u=y(i*i),l=y(s*s),h=y(l*l),f=y(a*t);if(y(l*y(f+u))!==y(h+y(r*y(a*u))))throw new Error("bad point: equation left != right (1)");if(y(n*i)!==y(s*o))throw new Error("bad point: equation left != right (2)");return!0});class x{constructor(e,t,r,n){this.X=m("x",e),this.Y=m("y",t),this.Z=m("z",r,!0),this.T=m("t",n),Object.freeze(this)}static CURVE(){return c}static fromAffine(e){if(e instanceof x)throw new Error("extended point not allowed");const{x:t,y:r}=e||{};return m("x",t),m("y",r),new x(t,r,l,y(t*r))}static fromBytes(e,t=!1){const r=n.BYTES,{a:i,d:s}=c;e=(0,a.nC)((0,a.eV)(e,r,"point")),(0,a.d6)(t,"zip215");const o=(0,a.nC)(e),h=e[r-1];o[r-1]=-129&h;const f=(0,a.lX)(o),d=t?p:n.ORDER;(0,a.aK)("point.y",f,u,d);const m=y(f*f),v=y(m-l),w=y(s*m-i);let{isValid:b,value:A}=g(v,w);if(!b)throw new Error("bad point: invalid y coordinate");const S=(A&l)===l,k=!!(128&h);if(!t&&A===u&&k)throw new Error("bad point: x=0 and x_0=1");return k!==S&&(A=y(-A)),x.fromAffine({x:A,y:f})}static fromHex(e,t=!1){return x.fromBytes((0,a.qj)("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return A.createCache(this,e),t||this.multiply(h),this}assertValidity(){b(this)}equals(e){v(e);const{X:t,Y:r,Z:n}=this,{X:i,Y:s,Z:o}=e,a=y(t*o),c=y(i*n),u=y(r*o),l=y(s*n);return a===c&&u===l}is0(){return this.equals(x.ZERO)}negate(){return new x(y(-this.X),this.Y,this.Z,y(-this.T))}double(){const{a:e}=c,{X:t,Y:r,Z:n}=this,i=y(t*t),s=y(r*r),o=y(h*y(n*n)),a=y(e*i),u=t+r,l=y(y(u*u)-i-s),f=a+s,d=f-o,p=a-s,g=y(l*d),m=y(f*p),v=y(l*p),w=y(d*f);return new x(g,m,w,v)}add(e){v(e);const{a:t,d:r}=c,{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:u,Z:l,T:h}=e,f=y(n*a),d=y(i*u),p=y(o*r*h),g=y(s*l),m=y((n+i)*(a+u)-f-d),w=g-p,b=g+p,A=y(d-t*f),S=y(m*w),k=y(b*A),B=y(m*A),E=y(w*b);return new x(S,k,E,B)}subtract(e){return this.add(e.negate())}multiply(e){if(!i.isValidNot0(e))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:t,f:r}=A.cached(this,e,e=>(0,o.Ak)(x,e));return(0,o.Ak)(x,[t,r])[0]}multiplyUnsafe(e,t=x.ZERO){if(!i.isValid(e))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return e===u?x.ZERO:this.is0()||e===l?this:A.unsafe(this,e,e=>(0,o.Ak)(x,e),t)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return A.unsafe(this,c.n).is0()}toAffine(e){return w(this,e)}clearCofactor(){return d===l?this:this.multiplyUnsafe(d)}toBytes(){const{x:e,y:t}=this.toAffine(),r=n.toBytes(t);return r[r.length-1]|=e&l?128:0,r}toHex(){return(0,s.My)(this.toBytes())}toString(){return``}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return(0,o.Ak)(x,e)}static msm(e,t){return(0,o.Xf)(x,i,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}x.BASE=new x(c.Gx,c.Gy,l,y(c.Gx*c.Gy)),x.ZERO=new x(u,l,l,u),x.Fp=n,x.Fn=i;const A=new o.hT(x,i.BITS);return x.BASE.precompute(8),x}(t,r);return function(e,t){const r=t.Point;return Object.assign({},t,{ExtendedPoint:r,CURVE:e,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}(e,function(e,t,r={}){if("function"!=typeof t)throw new Error('"hash" function param is required');(0,a.DS)(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:n}=r,{BASE:i,Fp:o,Fn:c}=e,u=r.randomBytes||s.po,h=r.adjustScalarBytes||(e=>e),f=r.domain||((e,t,r)=>{if((0,a.d6)(r,"phflag"),t.length||r)throw new Error("Contexts/pre-hash are not supported");return e});function d(e){return c.create((0,a.lX)(e))}function p(e){const{head:r,prefix:n,scalar:s}=function(e){const r=w.secretKey;e=(0,a.qj)("private key",e,r);const n=(0,a.qj)("hashed private key",t(e),2*r),i=h(n.slice(0,r));return{head:i,prefix:n.slice(r,2*r),scalar:d(i)}}(e),o=i.multiply(s),c=o.toBytes();return{head:r,prefix:n,scalar:s,point:o,pointBytes:c}}function y(e){return p(e).pointBytes}function g(e=Uint8Array.of(),...r){const i=(0,s.Id)(...r);return d(t(f(i,(0,a.qj)("context",e),!!n)))}const m={zip215:!0},v=o.BYTES,w={secretKey:v,publicKey:v,signature:2*v,seed:v};function b(e=u(w.seed)){return(0,a.eV)(e,w.seed,"seed")}const x={getExtendedPublicKey:p,randomSecretKey:b,isValidSecretKey:function(e){return(0,s.aY)(e)&&e.length===c.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(e){return!1}},toMontgomery(t){const{y:r}=e.fromBytes(t),n=w.publicKey,i=32===n;if(!i&&57!==n)throw new Error("only defined for 25519 and 448");const s=i?o.div(l+r,l-r):o.div(r-l,r+l);return o.toBytes(s)},toMontgomerySecret(e){const r=w.secretKey;(0,a.eV)(e,r);const n=t(e.subarray(0,r));return h(n).subarray(0,r)},randomPrivateKey:b,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){const t=x.randomSecretKey(e);return{secretKey:t,publicKey:y(t)}},getPublicKey:y,sign:function(e,t,r={}){e=(0,a.qj)("message",e),n&&(e=n(e));const{prefix:o,scalar:u,pointBytes:l}=p(t),h=g(r.context,o,e),f=i.multiply(h).toBytes(),d=g(r.context,f,l,e),y=c.create(h+d*u);if(!c.isValid(y))throw new Error("sign failed: invalid s");const m=(0,s.Id)(f,c.toBytes(y));return(0,a.eV)(m,w.signature,"result")},verify:function(t,r,s,o=m){const{context:c,zip215:u}=o,l=w.signature;t=(0,a.qj)("signature",t,l),r=(0,a.qj)("message",r),s=(0,a.qj)("publicKey",s,w.publicKey),void 0!==u&&(0,a.d6)(u,"zip215"),n&&(r=n(r));const h=l/2,f=t.subarray(0,h),d=(0,a.lX)(t.subarray(h,l));let p,y,v;try{p=e.fromBytes(s,u),y=e.fromBytes(f,u),v=i.multiplyUnsafe(d)}catch(e){return!1}if(!u&&p.isSmallOrder())return!1;const b=g(c,y.toBytes(),p.toBytes(),r);return y.add(p.multiplyUnsafe(b)).subtract(v).clearCofactor().is0()},utils:x,Point:e,lengths:w})}(d,n,i))}(0,s.AI)("HashToScalar-");const y=BigInt(0),g=BigInt(1),m=BigInt(2),v=(BigInt(3),BigInt(5)),w=BigInt(8),b=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),x=(()=>({p:b,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:w,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}))();function A(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}const S=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function k(e,t){const r=b,n=(0,c.zi)(t*t*t,r),i=function(e){const t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=b,o=e*e%s*e%s,a=(0,c.zH)(o,m,s)*o%s,u=(0,c.zH)(a,g,s)*e%s,l=(0,c.zH)(u,v,s)*u%s,h=(0,c.zH)(l,t,s)*l%s,f=(0,c.zH)(h,r,s)*h%s,d=(0,c.zH)(f,n,s)*f%s,p=(0,c.zH)(d,i,s)*d%s,y=(0,c.zH)(p,i,s)*d%s,w=(0,c.zH)(y,t,s)*l%s;return{pow_p_5_8:(0,c.zH)(w,m,s)*e%s,b2:o}}(e*(0,c.zi)(n*n*t,r)).pow_p_5_8;let s=(0,c.zi)(e*n*i,r);const o=(0,c.zi)(t*s*s,r),a=s,u=(0,c.zi)(s*S,r),l=o===e,h=o===(0,c.zi)(-e,r),f=o===(0,c.zi)(-e*S,r);return l&&(s=a),(h||f)&&(s=u),(0,c.dQ)(s,r)&&(s=(0,c.zi)(-s,r)),{isValid:l||h,value:s}}const B=(()=>(0,c.D0)(x.p,{isLE:!0}))(),E=(()=>(0,c.D0)(x.n,{isLE:!0}))(),I=(()=>({...x,Fp:B,hash:i.Zf,adjustScalarBytes:A,uvRatio:k}))(),O=(()=>p(I))(),_=S,P=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),M=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),C=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),T=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),U=e=>k(g,e),N=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),j=e=>O.Point.Fp.create((0,a.lX)(e)&N);function R(e){const{d:t}=x,r=b,n=e=>B.create(e),i=n(_*e*e),s=n((i+g)*C);let o=BigInt(-1);const a=n((o-t*i)*n(i+t));let{isValid:u,value:l}=k(s,a),h=n(l*e);(0,c.dQ)(h,r)||(h=n(-h)),u||(l=h),u||(o=i);const f=n(o*(i-g)*T-a),d=l*l,p=n((l+l)*a),y=n(f*P),m=n(g-d),v=n(g+d);return new O.Point(n(p*v),n(m*y),n(y*v),n(p*m))}class L extends d{constructor(e){super(e)}static fromAffine(e){return new L(O.Point.fromAffine(e))}assertSame(e){if(!(e instanceof L))throw new Error("RistrettoPoint expected")}init(e){return new L(e)}static hashToCurve(e){return function(e){(0,s.DO)(e,64);const t=R(j(e.subarray(0,32))),r=R(j(e.subarray(32,64)));return new L(t.add(r))}((0,a.qj)("ristrettoHash",e,64))}static fromBytes(e){(0,s.DO)(e,32);const{a:t,d:r}=x,n=b,i=e=>B.create(e),o=j(e);if(!(0,a.ex)(B.toBytes(o),e)||(0,c.dQ)(o,n))throw new Error("invalid ristretto255 encoding 1");const u=i(o*o),l=i(g+t*u),h=i(g-t*u),f=i(l*l),d=i(h*h),p=i(t*r*f-d),{isValid:m,value:v}=U(i(p*d)),w=i(v*h),A=i(v*w*p);let S=i((o+o)*w);(0,c.dQ)(S,n)&&(S=i(-S));const k=i(l*A),E=i(S*k);if(!m||(0,c.dQ)(E,n)||k===y)throw new Error("invalid ristretto255 encoding 2");return new L(new O.Point(S,k,g,E))}static fromHex(e){return L.fromBytes((0,a.qj)("ristrettoHex",e,32))}static msm(e,t){return(0,o.Xf)(L,O.Point.Fn,e,t)}toBytes(){let{X:e,Y:t,Z:r,T:n}=this.ep;const i=b,s=e=>B.create(e),o=s(s(r+t)*s(r-t)),a=s(e*t),u=s(a*a),{value:l}=U(s(o*u)),h=s(l*o),f=s(l*a),d=s(h*f*n);let p;if((0,c.dQ)(n*d,i)){let r=s(t*_),n=s(e*_);e=r,t=n,p=s(h*M)}else p=f;(0,c.dQ)(e*d,i)&&(t=s(-t));let y=s((r-t)*p);return(0,c.dQ)(y,i)&&(y=s(-y)),B.toBytes(y)}equals(e){this.assertSame(e);const{X:t,Y:r}=this.ep,{X:n,Y:i}=e.ep,s=e=>B.create(e),o=s(t*i)===s(r*n),a=s(r*i)===s(t*n);return o||a}is0(){return this.equals(L.ZERO)}}L.BASE=(()=>new L(O.Point.BASE))(),L.ZERO=(()=>new L(O.Point.ZERO))(),L.Fp=(()=>B)(),L.Fn=(()=>E)();var z=r(9404),H=r.n(z),$=r(6763),K=r.n($),D=r(8226),V=r(2755),F=r(601);function q(e){return Array.isArray(e)?"%5B"+e.map(q).join("%2C%20")+"%5D":"bigint"==typeof e?`${e}n`:encodeURIComponent(String(null!=e&&null===Object.getPrototypeOf(e)?{...e}:e))}function W([e,t]){return`${e}=${q(t)}`}var G=class extends Error{cause=this.cause;context;constructor(...[e,t]){let r,n;if(t){const{cause:e,...i}=t;e&&(n={cause:e}),Object.keys(i).length>0&&(r=i)}super(function(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${function(e){const t=Object.entries(e).map(W).join("&");return btoa(t)}(t)}'`),`${r}\``}}(e,r),n),this.context={__code:e,...r},this.name="SolanaError"}};function Z(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function J(e){return 1!==e?.endian}function Y(e){return t={fixedSize:e.size,write(t,r,n){e.range&&function(e,t,r,n){if(nr)throw new G(8078011,{codecDescription:e,max:r,min:t,value:n})}(e.name,e.range[0],e.range[1],t);const i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,J(e.config)),r.set(new Uint8Array(i),n),n+e.size}},Object.freeze({...t,encode:e=>{const r=new Uint8Array(function(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}(e,t));return t.write(e,r,0),r}});var t}function X(e){return t={fixedSize:e.size,read(t,r=0){!function(e,t,r=0){if(t.length-r<=0)throw new G(8078e3,{codecDescription:e})}(e.name,t,r),function(e,t,r,n=0){const i=r.length-n;if(it.read(e,r)[0]});var t}var Q=(e={})=>Y({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}),ee=(e={})=>function(e,t){if(Z(e)!==Z(t))throw new G(8078004);if(Z(e)&&Z(t)&&e.fixedSize!==t.fixedSize)throw new G(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!Z(e)&&!Z(t)&&e.maxSize!==t.maxSize)throw new G(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}(Q(e),((e={})=>X({config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}))(e));class te extends TypeError{constructor(e,t){let r;const{message:n,explanation:i,...s}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function re(e){return"object"==typeof e&&null!=e}function ne(e){return re(e)&&!Array.isArray(e)}function ie(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function se(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${ie(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*oe(e,t,r,n){var i;re(i=e)&&"function"==typeof i[Symbol.iterator]||(e=[e]);for(const i of e){const e=se(i,t,r,n);e&&(yield e)}}function*ae(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i,mask:o};s&&(e=t.coercer(e,a));let c="valid";for(const n of t.validator(e,a))n.explanation=r.message,c="not_valid",yield[n,void 0];for(let[u,l,h]of t.entries(e,a)){const t=ae(l,h,{path:void 0===u?n:[...n,u],branch:void 0===u?i:[...i,l],coerce:s,mask:o,message:r.message});for(const r of t)r[0]?(c=null!=r[0].refinement?"not_refined":"not_valid",yield[r[0],void 0]):s&&(l=r[1],void 0===u?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):re(e)&&(void 0!==l||u in e)&&(e[u]=l))}if("not_valid"!==c)for(const n of t.refiner(e,a))n.explanation=r.message,c="not_refined",yield[n,void 0];"valid"===c&&(yield[void 0,e])}class ce{constructor(e){const{type:t,schema:r,validator:n,refiner:i,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,this.validator=n?(e,t)=>oe(n(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>oe(i(e,t),t,this,e):()=>[]}assert(e,t){return function(e,t,r){const n=he(e,t,{message:r});if(n[0])throw n[0]}(e,this,t)}create(e,t){return ue(e,this,t)}is(e){return le(e,this)}mask(e,t){return function(e,t,r){const n=he(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}(e,this,t)}validate(e,t={}){return he(e,this,t)}}function ue(e,t,r){const n=he(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function le(e,t){return!he(e,t)[0]}function he(e,t,r={}){const n=ae(e,t,r),i=function(e){const{done:t,value:r}=e.next();return t?void 0:r}(n);return i[0]?[new te(i[0],function*(){for(const e of n)e[0]&&(yield e[0])}),void 0]:[void 0,i[1]]}function fe(e,t){return new ce({type:e,schema:null,validator:t})}function de(e){return new ce({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${ie(e)}`})}function pe(){return fe("boolean",e=>"boolean"==typeof e)}function ye(e){return fe("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ie(t)}`)}function ge(e){const t=ie(e),r=typeof e;return new ce({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${ie(r)}`})}function me(e){return new ce({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function ve(){return fe("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${ie(e)}`)}function we(e){return new ce({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function be(e,t){return new ce({type:"record",schema:null,*entries(r){if(re(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>ne(e)||`Expected an object, but received: ${ie(e)}`,coercer:e=>ne(e)?{...e}:e})}function xe(){return fe("string",e=>"string"==typeof e||`Expected a string, but received: ${ie(e)}`)}function Ae(e){const t=fe("never",()=>!1);return new ce({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${ie(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function Se(e){const t=Object.keys(e);return new ce({type:"type",schema:e,*entries(r){if(re(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>ne(e)||`Expected an object, but received: ${ie(e)}`,coercer:e=>ne(e)?{...e}:e})}function ke(e){const t=e.map(e=>e.type).join(" | ");return new ce({type:"union",schema:null,coercer(t,r){for(const n of e){const[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){const i=[];for(const t of e){const[...e]=ae(r,t,n),[s]=e;if(!s[0])return[];for(const[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ie(r)}`,...i]}})}function Be(){return fe("unknown",()=>!0)}function Ee(e,t,r){return new ce({...e,coercer:(n,i)=>le(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}r(22),r(228);var Ie=r(7238),Oe=r(2959);O.utils.randomPrivateKey;const _e=()=>{const e=O.utils.randomPrivateKey(),t=Pe(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),{publicKey:t,secretKey:r}},Pe=O.getPublicKey;function Me(e){try{return O.ExtendedPoint.fromHex(e),!0}catch{return!1}}const Ce=(e,t)=>O.sign(e,t.slice(0,32)),Te=O.verify,Ue=e=>n.Buffer.isBuffer(e)?e:e instanceof Uint8Array?n.Buffer.from(e.buffer,e.byteOffset,e.byteLength):n.Buffer.from(e);class Ne{constructor(e){Object.assign(this,e)}encode(){return n.Buffer.from((0,V.serialize)(je,this))}static decode(e){return(0,V.deserialize)(je,this,e)}static decodeUnchecked(e){return(0,V.deserializeUnchecked)(je,this,e)}}const je=new Map;var Re;const Le=32;let ze=1;class He extends Ne{constructor(e){if(super({}),this._bn=void 0,function(e){return void 0!==e._bn}(e))this._bn=e._bn;else{if("string"==typeof e){const t=K().decode(e);if(t.length!=Le)throw new Error("Invalid public key input");this._bn=new(H())(t)}else this._bn=new(H())(e);if(this._bn.byteLength()>Le)throw new Error("Invalid public key input")}}static unique(){const e=new He(ze);return ze+=1,new He(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return K().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(n.Buffer);if(e.length===Le)return e;const t=n.Buffer.alloc(32);return e.copy(t,32-e.length),t}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,t,r){const i=n.Buffer.concat([e.toBuffer(),n.Buffer.from(t),r.toBuffer()]),s=(0,D.sha256)(i);return new He(s)}static createProgramAddressSync(e,t){let r=n.Buffer.alloc(0);e.forEach(function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");r=n.Buffer.concat([r,Ue(e)])}),r=n.Buffer.concat([r,t.toBuffer(),n.Buffer.from("ProgramDerivedAddress")]);const i=(0,D.sha256)(r);if(Me(i))throw new Error("Invalid seeds, address must fall off the curve");return new He(i)}static async createProgramAddress(e,t){return this.createProgramAddressSync(e,t)}static findProgramAddressSync(e,t){let r,i=255;for(;0!=i;){try{const s=e.concat(n.Buffer.from([i]));r=this.createProgramAddressSync(s,t)}catch(e){if(e instanceof TypeError)throw e;i--;continue}return[r,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 Me(new He(e).toBytes())}}Re=He,He.default=new Re("11111111111111111111111111111111"),je.set(He,{kind:"struct",fields:[["_bn","u256"]]}),new He("BPFLoader1111111111111111111111111111111111");const $e=1232;class Ke extends Error{constructor(e){super(`Signature ${e} has expired: block height exceeded.`),this.signature=void 0,this.signature=e}}Object.defineProperty(Ke.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class De 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(De.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Ve extends Error{constructor(e){super(`Signature ${e} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=e}}Object.defineProperty(Ve.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Fe{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((e,r)=>{t.set(e.toBase58(),r)});const r=e=>{const r=t.get(e.toBase58());if(void 0===r)throw new Error("Encountered an unknown instruction account key during compilation");return r};return e.map(e=>({programIdIndex:r(e.programId),accountKeyIndexes:e.keys.map(e=>r(e.pubkey)),data:e.data}))}}const qe=(e="publicKey")=>F.av(32,e),We=(e="signature")=>F.av(64,e),Ge=(e="string")=>{const t=F.w3([F.DH("length"),F.DH("lengthPadding"),F.av(F.cY(F.DH(),-8),"chars")],e),r=t.decode.bind(t),i=t.encode.bind(t),s=t;return s.decode=(e,t)=>r(e,t).chars.toString(),s.encode=(e,t,r)=>{const s={chars:n.Buffer.from(e,"utf8")};return i(s,t,r)},s.alloc=e=>F.DH().span+F.DH().span+n.Buffer.from(e,"utf8").length,s};function Ze(e,t){const r=e=>{if(e.span>=0)return e.span;if("function"==typeof e.alloc)return e.alloc(t[e.property]);if("count"in e&&"elementLayout"in e){const n=t[e.property];if(Array.isArray(n))return n.length*r(e.elementLayout)}else if("fields"in e)return Ze({layout:e},t[e.property]);return 0};let n=0;return e.layout.fields.forEach(e=>{n+=r(e)}),n}function Je(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(127&n)<<7*r,r+=1,!(128&n))break}return t}function Ye(e,t){let r=t;for(;;){let t=127&r;if(r>>=7,0==r){e.push(t);break}t|=128,e.push(t)}}function Xe(e,t){if(!e)throw new Error(t||"Assertion failed")}class Qe{constructor(e,t){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=t}static compile(e,t){const r=new Map,n=e=>{const t=e.toBase58();let n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},i=n(t);i.isSigner=!0,i.isWritable=!0;for(const t of e){n(t.programId).isInvoked=!0;for(const e of t.keys){const t=n(e.pubkey);t.isSigner||=e.isSigner,t.isWritable||=e.isWritable}}return new Qe(t,r)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];Xe(e.length<=256,"Max static account keys length exceeded");const t=e.filter(([,e])=>e.isSigner&&e.isWritable),r=e.filter(([,e])=>e.isSigner&&!e.isWritable),n=e.filter(([,e])=>!e.isSigner&&e.isWritable),i=e.filter(([,e])=>!e.isSigner&&!e.isWritable),s={numRequiredSignatures:t.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{Xe(t.length>0,"Expected at least one writable signer key");const[e]=t[0];Xe(e===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[s,[...t.map(([e])=>new He(e)),...r.map(([e])=>new He(e)),...n.map(([e])=>new He(e)),...i.map(([e])=>new He(e))]]}extractTableLookup(e){const[t,r]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&e.isWritable),[n,i]=this.drainKeysFoundInLookupTable(e.state.addresses,e=>!e.isSigner&&!e.isInvoked&&!e.isWritable);if(0!==t.length||0!==n.length)return[{accountKey:e.key,writableIndexes:t,readonlyIndexes:n},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(e,t){const r=new Array,n=new Array;for(const[i,s]of this.keyMetaMap.entries())if(t(s)){const t=new He(i),s=e.findIndex(e=>e.equals(t));s>=0&&(Xe(s<256,"Max lookup table index exceeded"),r.push(s),n.push(t),this.keyMetaMap.delete(i))}return[r,n]}}const et="Reached end of buffer unexpectedly";function tt(e){if(0===e.length)throw new Error(et);return e.shift()}function rt(e,...t){const[r]=t;if(2===t.length?r+(t[1]??0)>e.length:r>=e.length)throw new Error(et);return e.splice(...t)}class nt{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(e=>new He(e)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.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(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:K().decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Fe(this.staticAccountKeys)}static compile(e){const t=Qe.compile(e.instructions,e.payerKey),[r,n]=t.getMessageComponents(),i=new Fe(n).compileInstructions(e.instructions).map(e=>({programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:K().encode(e.data)}));return new nt({header:r,accountKeys:n,recentBlockhash:e.recentBlockhash,instructions:i})}isAccountSigner(e){return e=this.header.numRequiredSignatures?e-t!this.isProgramId(t))}serialize(){const e=this.accountKeys.length;let t=[];Ye(t,e);const r=this.instructions.map(e=>{const{accounts:t,programIdIndex:r}=e,i=Array.from(K().decode(e.data));let s=[];Ye(s,t.length);let o=[];return Ye(o,i.length),{programIdIndex:r,keyIndicesCount:n.Buffer.from(s),keyIndices:t,dataLength:n.Buffer.from(o),data:i}});let i=[];Ye(i,r.length);let s=n.Buffer.alloc($e);n.Buffer.from(i).copy(s);let o=i.length;r.forEach(e=>{const t=F.w3([F.u8("programIdIndex"),F.av(e.keyIndicesCount.length,"keyIndicesCount"),F.O6(F.u8("keyIndex"),e.keyIndices.length,"keyIndices"),F.av(e.dataLength.length,"dataLength"),F.O6(F.u8("userdatum"),e.data.length,"data")]).encode(e,s,o);o+=t}),s=s.slice(0,o);const a=F.w3([F.av(1,"numRequiredSignatures"),F.av(1,"numReadonlySignedAccounts"),F.av(1,"numReadonlyUnsignedAccounts"),F.av(t.length,"keyCount"),F.O6(qe("key"),e,"keys"),qe("recentBlockhash")]),c={numRequiredSignatures:n.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:n.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:n.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:n.Buffer.from(t),keys:this.accountKeys.map(e=>Ue(e.toBytes())),recentBlockhash:K().decode(this.recentBlockhash)};let u=n.Buffer.alloc(2048);const l=a.encode(c,u);return s.copy(u,l),u.slice(0,l+s.length)}static from(e){let t=[...e];const r=tt(t);if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=tt(t),s=tt(t),o=Je(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 Fe(this.staticAccountKeys,t)}isAccountSigner(e){return e=r?e-re+t.writableIndexes.length,0):e>=this.header.numRequiredSignatures?e-te.key.equals(r.accountKey));if(!n)throw new Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(const e of r.writableIndexes){if(!(ee.toBytes()),recentBlockhash:K().decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:n},o);return o.slice(0,a)}serializeInstructions(){let e=0;const t=new Uint8Array($e);for(const r of this.compiledInstructions){const n=Array();Ye(n,r.accountKeyIndexes.length);const i=Array();Ye(i,r.data.length),e+=F.w3([F.u8("programIdIndex"),F.av(n.length,"encodedAccountKeyIndexesLength"),F.O6(F.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),F.av(i.length,"encodedDataLength"),F.av(r.data.length,"data")]).encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(n),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},t,e)}return t.slice(0,e)}serializeAddressTableLookups(){let e=0;const t=new Uint8Array($e);for(const r of this.addressTableLookups){const n=Array();Ye(n,r.writableIndexes.length);const i=Array();Ye(i,r.readonlyIndexes.length),e+=F.w3([qe("accountKey"),F.av(n.length,"encodedWritableIndexesLength"),F.O6(F.u8(),r.writableIndexes.length,"writableIndexes"),F.av(i.length,"encodedReadonlyIndexesLength"),F.O6(F.u8(),r.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(n),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},t,e)}return t.slice(0,e)}static deserialize(e){let t=[...e];const r=tt(t),n=127&r;Xe(r!==n,"Expected versioned message but received legacy message"),Xe(0===n,`Expected versioned message with version 0 but found version ${n}`);const i={numRequiredSignatures:tt(t),numReadonlySignedAccounts:tt(t),numReadonlyUnsignedAccounts:tt(t)},s=[],o=Je(t);for(let e=0;e{const t=st.deserializeMessageVersion(e);if("legacy"===t)return nt.from(e);if(0===t)return it.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}},ot=n.Buffer.alloc(64).fill(0);class at{constructor(e){this.keys=void 0,this.programId=void 0,this.data=n.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:r})=>({pubkey:e.toJSON(),isSigner:t,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class ct{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:r}=e;this.minNonceContextSlot=t,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:t,lastValidBlockHeight:r}=e;this.recentBlockhash=t,this.lastValidBlockHeight=r}else{const{recentBlockhash:t,nonceInfo:r}=e;r&&(this.nonceInfo=r),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(0===e.length)throw new Error("No instructions");return e.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 at(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,t,r;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)r=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");r=this.signatures[0].publicKey}for(let e=0;e{e.keys.forEach(e=>{i.push({...e})});const t=e.programId.toString();n.includes(t)||n.push(t)}),n.forEach(e=>{i.push({pubkey:new He(e),isSigner:!1,isWritable:!1})});const s=[];i.forEach(e=>{const t=e.pubkey.toString(),r=s.findIndex(e=>e.pubkey.toString()===t);r>-1?(s[r].isWritable=s[r].isWritable||e.isWritable,s[r].isSigner=s[r].isSigner||e.isSigner):s.push(e)}),s.sort(function(e,t){return e.isSigner!==t.isSigner?e.isSigner?-1:1:e.isWritable!==t.isWritable?e.isWritable?-1:1:e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const o=s.findIndex(e=>e.pubkey.equals(r));if(o>-1){const[e]=s.splice(o,1);e.isSigner=!0,e.isWritable=!0,s.unshift(e)}else s.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const e of this.signatures){const t=s.findIndex(t=>t.pubkey.equals(e.publicKey));if(!(t>-1))throw new Error(`unknown signer: ${e.publicKey.toString()}`);s[t].isSigner||(s[t].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 a=0,c=0,u=0;const l=[],h=[];s.forEach(({pubkey:e,isSigner:t,isWritable:r})=>{t?(l.push(e.toString()),a+=1,r||(c+=1)):(h.push(e.toString()),r||(u+=1))});const f=l.concat(h),d=t.map(e=>{const{data:t,programId:r}=e;return{programIdIndex:f.indexOf(r.toString()),accounts:e.keys.map(e=>f.indexOf(e.pubkey.toString())),data:K().encode(t)}});return d.forEach(e=>{Xe(e.programIdIndex>=0),e.accounts.forEach(e=>Xe(e>=0))}),new nt({header:{numRequiredSignatures:a,numReadonlySignedAccounts:c,numReadonlyUnsignedAccounts:u},accountKeys:f,recentBlockhash:e,instructions:d})}_compile(){const e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===t.length&&this.signatures.every((e,r)=>t[r].equals(e.publicKey))||(this.signatures=t.map(e=>({signature:null,publicKey:e}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(0===e.length)throw new Error("No signers");const t=new Set;this.signatures=e.filter(e=>{const r=e.toString();return!t.has(r)&&(t.add(r),!0)}).map(e=>({signature:null,publicKey:e}))}sign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,r=[];for(const n of e){const e=n.publicKey.toString();t.has(e)||(t.add(e),r.push(n))}this.signatures=r.map(e=>({signature:null,publicKey:e.publicKey}));const n=this._compile();this._partialSign(n,...r)}partialSign(...e){if(0===e.length)throw new Error("No signers");const t=new Set,r=[];for(const n of e){const e=n.publicKey.toString();t.has(e)||(t.add(e),r.push(n))}const n=this._compile();this._partialSign(n,...r)}_partialSign(e,...t){const r=e.serialize();t.forEach(e=>{const t=Ce(r,e.secretKey);this._addSignature(e.publicKey,Ue(t))})}addSignature(e,t){this._compile(),this._addSignature(e,t)}_addSignature(e,t){Xe(64===t.length);const r=this.signatures.findIndex(t=>e.equals(t.publicKey));if(r<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[r].signature=n.Buffer.from(t)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,t){const r={};for(const{signature:n,publicKey:i}of this.signatures)null===n?t&&(r.missing||=[]).push(i):Te(n,e,i.toBytes())||(r.invalid||=[]).push(i);return r.invalid||r.missing?r:void 0}serialize(e){const{requireAllSignatures:t,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=this.serializeMessage();if(r){const e=this._getMessageSignednessErrors(n,t);if(e){let t="Signature verification failed.";throw e.invalid&&(t+=`\nInvalid signature for public key${1===e.invalid.length?"":"(s)"} [\`${e.invalid.map(e=>e.toBase58()).join("`, `")}\`].`),e.missing&&(t+=`\nMissing signature for public key${1===e.missing.length?"":"(s)"} [\`${e.missing.map(e=>e.toBase58()).join("`, `")}\`].`),new Error(t)}}return this._serialize(n)}_serialize(e){const{signatures:t}=this,r=[];Ye(r,t.length);const i=r.length+64*t.length+e.length,s=n.Buffer.alloc(i);return Xe(t.length<256),n.Buffer.from(r).copy(s,0),t.forEach(({signature:e},t)=>{null!==e&&(Xe(64===e.length,"signature has invalid length"),n.Buffer.from(e).copy(s,r.length+64*t))}),e.copy(s,r.length+64*t.length),Xe(s.length<=$e,`Transaction too large: ${s.length} > 1232`),s}get keys(){return Xe(1===this.instructions.length),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return Xe(1===this.instructions.length),this.instructions[0].programId}get data(){return Xe(1===this.instructions.length),this.instructions[0].data}static from(e){let t=[...e];const r=Je(t);let i=[];for(let e=0;e0&&(r.feePayer=e.accountKeys[0]),t.forEach((t,n)=>{const i={signature:t==K().encode(ot)?null:K().decode(t),publicKey:e.accountKeys[n]};r.signatures.push(i)}),e.instructions.forEach(t=>{const n=t.accounts.map(t=>{const n=e.accountKeys[t];return{pubkey:n,isSigner:r.signatures.some(e=>e.publicKey.toString()===n.toString())||e.isAccountSigner(t),isWritable:e.isAccountWritable(t)}});r.instructions.push(new at({keys:n,programId:e.accountKeys[t.programIdIndex],data:K().decode(t.data)}))}),r._message=e,r._json=r.toJSON(),r}}class ut{get version(){return this.message.version}constructor(e,t){if(this.signatures=void 0,this.message=void 0,void 0!==t)Xe(t.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=t;else{const t=[];for(let r=0;re.equals(n.publicKey));Xe(e>=0,`Cannot sign with non signer key ${n.publicKey.toBase58()}`),this.signatures[e]=Ce(t,n.secretKey)}}addSignature(e,t){Xe(64===t.byteLength,"Signature must be 64 bytes long");const r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(t=>t.equals(e));Xe(r>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[r]=t}}const lt=new He("SysvarC1ock11111111111111111111111111111111"),ht=(new He("SysvarEpochSchedu1e111111111111111111111111"),new He("Sysvar1nstructions1111111111111111111111111"),new He("SysvarRecentB1ockHashes11111111111111111111")),ft=new He("SysvarRent111111111111111111111111111111111"),dt=(new He("SysvarRewards111111111111111111111111111111"),new He("SysvarS1otHashes111111111111111111111111111"),new He("SysvarS1otHistory11111111111111111111111111"),new He("SysvarStakeHistory1111111111111111111111111"));class pt extends Error{constructor({action:e,signature:t,transactionMessage:r,logs:n}){const i=n?`Logs: \n${JSON.stringify(n.slice(-10),null,2)}. `:"",s="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let o;switch(e){case"send":o=`Transaction ${t} resulted in an error. \n${r}. `+i+s;break;case"simulate":o=`Simulation failed. \nMessage: ${r}. \n`+i+s;break;default:o=`Unknown action '${e}'`}super(o),this.signature=void 0,this.transactionMessage=void 0,this.transactionLogs=void 0,this.signature=t,this.transactionMessage=r,this.transactionLogs=n||void 0}get transactionError(){return{message:this.transactionMessage,logs:Array.isArray(this.transactionLogs)?this.transactionLogs:void 0}}get logs(){const e=this.transactionLogs;if(null==e||"object"!=typeof e||!("then"in e))return e}async getLogs(e){return Array.isArray(this.transactionLogs)||(this.transactionLogs=new Promise((t,r)=>{e.getTransaction(this.signature).then(e=>{if(e&&e.meta&&e.meta.logMessages){const r=e.meta.logMessages;this.transactionLogs=r,t(r)}else r(new Error("Log messages not found"))}).catch(r)})),await this.transactionLogs}}async function yt(e,t,r,n){const i=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},s=await e.sendTransaction(t,r,i);let o;if(null!=t.recentBlockhash&&null!=t.lastValidBlockHeight)o=(await e.confirmTransaction({abortSignal:n?.abortSignal,signature:s,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(null!=t.minNonceContextSlot&&null!=t.nonceInfo){const{nonceInstruction:r}=t.nonceInfo,i=r.keys[0].pubkey;o=(await e.confirmTransaction({abortSignal:n?.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:i,nonceValue:t.nonceInfo.nonce,signature:s},n&&n.commitment)).value}else null!=n?.abortSignal&&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."),o=(await e.confirmTransaction(s,n&&n.commitment)).value;if(o.err){if(null!=s)throw new pt({action:"send",signature:s,transactionMessage:`Status: (${JSON.stringify(o)})`});throw new Error(`Transaction ${s} failed (${JSON.stringify(o)})`)}return s}function gt(e){return new Promise(t=>setTimeout(t,e))}function mt(e,t){const r=e.layout.span>=0?e.layout.span:Ze(e,t),i=n.Buffer.alloc(r),s=Object.assign({instruction:e.index},t);return e.layout.encode(s,i),i}Error;const vt=F.I0("lamportsPerSignature"),wt=F.w3([F.DH("version"),F.DH("state"),qe("authorizedPubkey"),qe("nonce"),F.w3([vt],"feeCalculator")]).span;function bt(e){const t=(0,F.av)(8,e),r=t.decode.bind(t),n=t.encode.bind(t),i=t,s=ee();return i.decode=(e,t)=>{const n=r(e,t);return s.decode(n)},i.encode=(e,t,r)=>{const i=s.encode(e);return n(i,t,r)},i}const xt=Object.freeze({Create:{index:0,layout:F.w3([F.DH("instruction"),F.Wg("lamports"),F.Wg("space"),qe("programId")])},Assign:{index:1,layout:F.w3([F.DH("instruction"),qe("programId")])},Transfer:{index:2,layout:F.w3([F.DH("instruction"),bt("lamports")])},CreateWithSeed:{index:3,layout:F.w3([F.DH("instruction"),qe("base"),Ge("seed"),F.Wg("lamports"),F.Wg("space"),qe("programId")])},AdvanceNonceAccount:{index:4,layout:F.w3([F.DH("instruction")])},WithdrawNonceAccount:{index:5,layout:F.w3([F.DH("instruction"),F.Wg("lamports")])},InitializeNonceAccount:{index:6,layout:F.w3([F.DH("instruction"),qe("authorized")])},AuthorizeNonceAccount:{index:7,layout:F.w3([F.DH("instruction"),qe("authorized")])},Allocate:{index:8,layout:F.w3([F.DH("instruction"),F.Wg("space")])},AllocateWithSeed:{index:9,layout:F.w3([F.DH("instruction"),qe("base"),Ge("seed"),F.Wg("space"),qe("programId")])},AssignWithSeed:{index:10,layout:F.w3([F.DH("instruction"),qe("base"),Ge("seed"),qe("programId")])},TransferWithSeed:{index:11,layout:F.w3([F.DH("instruction"),bt("lamports"),Ge("seed"),qe("programId")])},UpgradeNonceAccount:{index:12,layout:F.w3([F.DH("instruction")])}});class At{constructor(){}static createAccount(e){const t=mt(xt.Create,{lamports:e.lamports,space:e.space,programId:Ue(e.programId.toBuffer())});return new at({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,r;return"basePubkey"in e?(t=mt(xt.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:Ue(e.programId.toBuffer())}),r=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=mt(xt.Transfer,{lamports:BigInt(e.lamports)}),r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]),new at({keys:r,programId:this.programId,data:t})}static assign(e){let t,r;return"basePubkey"in e?(t=mt(xt.AssignWithSeed,{base:Ue(e.basePubkey.toBuffer()),seed:e.seed,programId:Ue(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=mt(xt.Assign,{programId:Ue(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new at({keys:r,programId:this.programId,data:t})}static createAccountWithSeed(e){const t=mt(xt.CreateWithSeed,{base:Ue(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:Ue(e.programId.toBuffer())});let r=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey.equals(e.fromPubkey)||r.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new at({keys:r,programId:this.programId,data:t})}static createNonceAccount(e){const t=new ct;"basePubkey"in e&&"seed"in e?t.add(At.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:wt,programId:this.programId})):t.add(At.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.noncePubkey,lamports:e.lamports,space:wt,programId:this.programId}));const r={noncePubkey:e.noncePubkey,authorizedPubkey:e.authorizedPubkey};return t.add(this.nonceInitialize(r)),t}static nonceInitialize(e){const t=mt(xt.InitializeNonceAccount,{authorized:Ue(e.authorizedPubkey.toBuffer())}),r={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ht,isSigner:!1,isWritable:!1},{pubkey:ft,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new at(r)}static nonceAdvance(e){const t=mt(xt.AdvanceNonceAccount),r={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:ht,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new at(r)}static nonceWithdraw(e){const t=mt(xt.WithdrawNonceAccount,{lamports:e.lamports});return new at({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:ht,isSigner:!1,isWritable:!1},{pubkey:ft,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}static nonceAuthorize(e){const t=mt(xt.AuthorizeNonceAccount,{authorized:Ue(e.newAuthorizedPubkey.toBuffer())});return new at({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,r;return"basePubkey"in e?(t=mt(xt.AllocateWithSeed,{base:Ue(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:Ue(e.programId.toBuffer())}),r=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=mt(xt.Allocate,{space:e.space}),r=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]),new at({keys:r,programId:this.programId,data:t})}}At.programId=new He("11111111111111111111111111111111");class St{constructor(){}static getMinNumSignatures(e){return 2*(Math.ceil(e/St.chunkSize)+1+1)}static async load(e,t,r,i,s){{const n=await e.getMinimumBalanceForRentExemption(s.length),o=await e.getAccountInfo(r.publicKey,"confirmed");let a=null;if(null!==o){if(o.executable)return console.error("Program load failed, account is already executable"),!1;o.data.length!==s.length&&(a=a||new ct,a.add(At.allocate({accountPubkey:r.publicKey,space:s.length}))),o.owner.equals(i)||(a=a||new ct,a.add(At.assign({accountPubkey:r.publicKey,programId:i}))),o.lamports0?n:1,space:s.length,programId:i}));null!==a&&await yt(e,a,[t,r],{commitment:"confirmed"})}const o=F.w3([F.DH("instruction"),F.DH("offset"),F.DH("bytesLength"),F.DH("bytesLengthPadding"),F.O6(F.u8("byte"),F.cY(F.DH(),-8),"bytes")]),a=St.chunkSize;let c=0,u=s,l=[];for(;u.length>0;){const s=u.slice(0,a),h=n.Buffer.alloc(a+16);o.encode({instruction:0,offset:c,bytes:s,bytesLength:0,bytesLengthPadding:0},h);const f=(new ct).add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0}],programId:i,data:h});if(l.push(yt(e,f,[t,r],{commitment:"confirmed"})),e._rpcEndpoint.includes("solana.com")){const e=4;await gt(1e3/e)}c+=a,u=u.slice(a)}await Promise.all(l);{const s=F.w3([F.DH("instruction")]),o=n.Buffer.alloc(s.span);s.encode({instruction:1},o);const a=(new ct).add({keys:[{pubkey:r.publicKey,isSigner:!0,isWritable:!0},{pubkey:ft,isSigner:!1,isWritable:!1}],programId:i,data:o}),c="processed",u=await e.sendTransaction(a,[t,r],{preflightCommitment:c}),{context:l,value:h}=await e.confirmTransaction({signature:u,lastValidBlockHeight:a.lastValidBlockHeight,blockhash:a.recentBlockhash},c);if(h.err)throw new Error(`Transaction ${u} failed (${JSON.stringify(h)})`);for(;;){try{if(await e.getSlot({commitment:c})>l.slot)break}catch{}await new Promise(e=>setTimeout(e,Math.round(200)))}}return!0}}St.chunkSize=932,new He("BPFLoader2111111111111111111111111111111111"),globalThis.fetch,F.w3([F.DH("typeIndex"),bt("deactivationSlot"),F.I0("lastExtendedSlot"),F.u8("lastExtendedStartIndex"),F.u8(),F.O6(qe(),F.cY(F.u8(),-1),"authority")]);const kt=Ee(ye(He),xe(),e=>new He(e)),Bt=Ae([xe(),ge("base64")]),Et=Ee(ye(n.Buffer),Bt,e=>n.Buffer.from(e[0],"base64"));function It(e){return ke([Se({jsonrpc:ge("2.0"),id:xe(),result:e}),Se({jsonrpc:ge("2.0"),id:xe(),error:Se({code:Be(),message:xe(),data:we(fe("any",()=>!0))})})])}const Ot=It(Be());function _t(e){return Ee(It(e),Ot,t=>"error"in t?t:{...t,result:ue(t.result,e)})}function Pt(e){return _t(Se({context:Se({slot:ve()}),value:e}))}function Mt(e){return Se({context:Se({slot:ve()}),value:e})}const Ct=Se({foundation:ve(),foundationTerm:ve(),initial:ve(),taper:ve(),terminal:ve()}),Tt=(_t(de(me(Se({epoch:ve(),effectiveSlot:ve(),amount:ve(),postBalance:ve(),commission:we(me(ve()))})))),de(Se({slot:ve(),prioritizationFee:ve()}))),Ut=Se({total:ve(),validator:ve(),foundation:ve(),epoch:ve()}),Nt=Se({epoch:ve(),slotIndex:ve(),slotsInEpoch:ve(),absoluteSlot:ve(),blockHeight:we(ve()),transactionCount:we(ve())}),jt=Se({slotsPerEpoch:ve(),leaderScheduleSlotOffset:ve(),warmup:pe(),firstNormalEpoch:ve(),firstNormalSlot:ve()}),Rt=be(xe(),de(ve())),Lt=me(ke([Se({}),xe()])),zt=Se({err:Lt}),Ht=ge("receivedSignature"),$t=(Se({"solana-core":xe(),"feature-set":we(ve())}),Se({program:xe(),programId:kt,parsed:Be()})),Kt=Se({programId:kt,accounts:de(kt),data:xe()});Pt(Se({err:me(ke([Se({}),xe()])),logs:me(de(xe())),accounts:we(me(de(me(Se({executable:pe(),owner:xe(),lamports:ve(),data:de(xe()),rentEpoch:we(ve())}))))),unitsConsumed:we(ve()),returnData:we(me(Se({programId:xe(),data:Ae([xe(),ge("base64")])}))),innerInstructions:we(me(de(Se({index:ve(),instructions:de(ke([$t,Kt]))}))))})),Pt(Se({byIdentity:be(xe(),de(ve())),range:Se({firstSlot:ve(),lastSlot:ve()})})),_t(Ct),_t(Ut),_t(Tt),_t(Nt),_t(jt),_t(Rt),_t(ve()),Pt(Se({total:ve(),circulating:ve(),nonCirculating:ve(),nonCirculatingAccounts:de(kt)}));const Dt=Se({amount:xe(),uiAmount:me(ve()),decimals:ve(),uiAmountString:we(xe())}),Vt=(Pt(de(Se({address:kt,amount:xe(),uiAmount:me(ve()),decimals:ve(),uiAmountString:we(xe())}))),Pt(de(Se({pubkey:kt,account:Se({executable:pe(),owner:kt,lamports:ve(),data:Et,rentEpoch:ve()})}))),Se({program:xe(),parsed:Be(),space:ve()})),Ft=(Pt(de(Se({pubkey:kt,account:Se({executable:pe(),owner:kt,lamports:ve(),data:Vt,rentEpoch:ve()})}))),Pt(de(Se({lamports:ve(),address:kt}))),Se({executable:pe(),owner:kt,lamports:ve(),data:Et,rentEpoch:ve()})),qt=(Se({pubkey:kt,account:Ft}),Ee(ke([ye(n.Buffer),Vt]),ke([Bt,Vt]),e=>Array.isArray(e)?ue(e,Et):e)),Wt=Se({executable:pe(),owner:kt,lamports:ve(),data:qt,rentEpoch:ve()}),Gt=(Se({pubkey:kt,account:Wt}),Se({state:ke([ge("active"),ge("inactive"),ge("activating"),ge("deactivating")]),active:ve(),inactive:ve()}),_t(de(Se({signature:xe(),slot:ve(),err:Lt,memo:me(xe()),blockTime:we(me(ve()))}))),_t(de(Se({signature:xe(),slot:ve(),err:Lt,memo:me(xe()),blockTime:we(me(ve()))}))),Se({subscription:ve(),result:Mt(Ft)}),Se({pubkey:kt,account:Ft})),Zt=(Se({subscription:ve(),result:Mt(Gt)}),Se({parent:ve(),slot:ve(),root:ve()})),Jt=(Se({subscription:ve(),result:Zt}),ke([Se({type:ke([ge("firstShredReceived"),ge("completed"),ge("optimisticConfirmation"),ge("root")]),slot:ve(),timestamp:ve()}),Se({type:ge("createdBank"),parent:ve(),slot:ve(),timestamp:ve()}),Se({type:ge("frozen"),slot:ve(),timestamp:ve(),stats:Se({numTransactionEntries:ve(),numSuccessfulTransactions:ve(),numFailedTransactions:ve(),maxTransactionsPerEntry:ve()})}),Se({type:ge("dead"),slot:ve(),timestamp:ve(),err:xe()})])),Yt=(Se({subscription:ve(),result:Jt}),Se({subscription:ve(),result:Mt(ke([zt,Ht]))}),Se({subscription:ve(),result:ve()}),Se({pubkey:xe(),gossip:me(xe()),tpu:me(xe()),rpc:me(xe()),version:me(xe())}),Se({votePubkey:xe(),nodePubkey:xe(),activatedStake:ve(),epochVoteAccount:pe(),epochCredits:de(Ae([ve(),ve(),ve()])),commission:ve(),lastVote:ve(),rootSlot:me(ve())})),Xt=(_t(Se({current:de(Yt),delinquent:de(Yt)})),ke([ge("processed"),ge("confirmed"),ge("finalized")])),Qt=Se({slot:ve(),confirmations:me(ve()),err:Lt,confirmationStatus:we(Xt)}),er=(Pt(de(me(Qt))),_t(ve()),Se({accountKey:kt,writableIndexes:de(ve()),readonlyIndexes:de(ve())})),tr=Se({signatures:de(xe()),message:Se({accountKeys:de(xe()),header:Se({numRequiredSignatures:ve(),numReadonlySignedAccounts:ve(),numReadonlyUnsignedAccounts:ve()}),instructions:de(Se({accounts:de(ve()),data:xe(),programIdIndex:ve()})),recentBlockhash:xe(),addressTableLookups:we(de(er))})}),rr=Se({pubkey:kt,signer:pe(),writable:pe(),source:we(ke([ge("transaction"),ge("lookupTable")]))}),nr=Se({accountKeys:de(rr),signatures:de(xe())}),ir=Se({parsed:Be(),program:xe(),programId:kt}),sr=Se({accounts:de(kt),data:xe(),programId:kt}),or=Ee(ke([sr,ir]),ke([Se({parsed:Be(),program:xe(),programId:xe()}),Se({accounts:de(xe()),data:xe(),programId:xe()})]),e=>ue(e,"accounts"in e?sr:ir)),ar=Se({signatures:de(xe()),message:Se({accountKeys:de(rr),instructions:de(or),recentBlockhash:xe(),addressTableLookups:we(me(de(er)))})}),cr=Se({accountIndex:ve(),mint:xe(),owner:we(xe()),programId:we(xe()),uiTokenAmount:Dt}),ur=Se({writable:de(kt),readonly:de(kt)}),lr=Se({err:Lt,fee:ve(),innerInstructions:we(me(de(Se({index:ve(),instructions:de(Se({accounts:de(ve()),data:xe(),programIdIndex:ve()}))})))),preBalances:de(ve()),postBalances:de(ve()),logMessages:we(me(de(xe()))),preTokenBalances:we(me(de(cr))),postTokenBalances:we(me(de(cr))),loadedAddresses:we(ur),computeUnitsConsumed:we(ve()),costUnits:we(ve())}),hr=Se({err:Lt,fee:ve(),innerInstructions:we(me(de(Se({index:ve(),instructions:de(or)})))),preBalances:de(ve()),postBalances:de(ve()),logMessages:we(me(de(xe()))),preTokenBalances:we(me(de(cr))),postTokenBalances:we(me(de(cr))),loadedAddresses:we(ur),computeUnitsConsumed:we(ve()),costUnits:we(ve())}),fr=ke([ge(0),ge("legacy")]),dr=Se({pubkey:xe(),lamports:ve(),postBalance:me(ve()),rewardType:me(xe()),commission:we(me(ve()))}),pr=(_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),transactions:de(Se({transaction:tr,meta:me(lr),version:we(fr)})),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),transactions:de(Se({transaction:nr,meta:me(lr),version:we(fr)})),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),transactions:de(Se({transaction:ar,meta:me(hr),version:we(fr)})),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),transactions:de(Se({transaction:nr,meta:me(hr),version:we(fr)})),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),rewards:we(de(dr)),blockTime:me(ve()),blockHeight:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),transactions:de(Se({transaction:tr,meta:me(lr)})),rewards:we(de(dr)),blockTime:me(ve())}))),_t(me(Se({blockhash:xe(),previousBlockhash:xe(),parentSlot:ve(),signatures:de(xe()),blockTime:me(ve())}))),_t(me(Se({slot:ve(),meta:me(lr),blockTime:we(me(ve())),transaction:tr,version:we(fr)}))),_t(me(Se({slot:ve(),transaction:ar,meta:me(hr),blockTime:we(me(ve())),version:we(fr)}))),Pt(Se({blockhash:xe(),lastValidBlockHeight:ve()})),Pt(pe()),_t(de(Se({slot:ve(),numTransactions:ve(),numSlots:ve(),samplePeriodSecs:ve()}))),Pt(me(Se({feeCalculator:Se({lamportsPerSignature:ve()})}))),_t(xe()),_t(xe()),Se({err:Lt,logs:de(xe()),signature:xe()}));Se({result:Mt(pr),subscription:ve()});class yr{constructor(e){this._keypair=void 0,this._keypair=e??_e()}static generate(){return new yr(_e())}static fromSecretKey(e,t){if(64!==e.byteLength)throw new Error("bad secret key size");const r=e.slice(32,64);if(!t||!t.skipValidation){const t=e.slice(0,32),n=Pe(t);for(let e=0;e<32;e++)if(r[e]!==n[e])throw new Error("provided secretKey is invalid")}return new yr({publicKey:r,secretKey:e})}static fromSeed(e){const t=Pe(e),r=new Uint8Array(64);return r.set(e),r.set(t,32),new yr({publicKey:t,secretKey:r})}get publicKey(){return new He(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}Object.freeze({CreateLookupTable:{index:0,layout:F.w3([F.DH("instruction"),bt("recentSlot"),F.u8("bumpSeed")])},FreezeLookupTable:{index:1,layout:F.w3([F.DH("instruction")])},ExtendLookupTable:{index:2,layout:F.w3([F.DH("instruction"),bt(),F.O6(qe(),F.cY(F.DH(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:F.w3([F.DH("instruction")])},CloseLookupTable:{index:4,layout:F.w3([F.DH("instruction")])}});new He("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:F.w3([F.u8("instruction"),F.DH("units"),F.DH("additionalFee")])},RequestHeapFrame:{index:1,layout:F.w3([F.u8("instruction"),F.DH("bytes")])},SetComputeUnitLimit:{index:2,layout:F.w3([F.u8("instruction"),F.DH("units")])},SetComputeUnitPrice:{index:3,layout:F.w3([F.u8("instruction"),bt("microLamports")])}});new He("ComputeBudget111111111111111111111111111111");const gr=F.w3([F.u8("numSignatures"),F.u8("padding"),F.NX("signatureOffset"),F.NX("signatureInstructionIndex"),F.NX("publicKeyOffset"),F.NX("publicKeyInstructionIndex"),F.NX("messageDataOffset"),F.NX("messageDataSize"),F.NX("messageInstructionIndex")]);class mr{constructor(){}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:i,instructionIndex:s}=e;Xe(32===t.length,`Public Key must be 32 bytes but received ${t.length} bytes`),Xe(64===i.length,`Signature must be 64 bytes but received ${i.length} bytes`);const o=gr.span,a=o+t.length,c=a+i.length,u=n.Buffer.alloc(c+r.length),l=null==s?65535:s;return gr.encode({numSignatures:1,padding:0,signatureOffset:a,signatureInstructionIndex:l,publicKeyOffset:o,publicKeyInstructionIndex:l,messageDataOffset:c,messageDataSize:r.length,messageInstructionIndex:l},u),u.fill(t,o),u.fill(i,a),u.fill(r,c),new at({keys:[],programId:mr.programId,data:u})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:n}=e;Xe(64===t.length,`Private key must be 64 bytes but received ${t.length} bytes`);try{const e=yr.fromSecretKey(t),i=e.publicKey.toBytes(),s=Ce(r,e.secretKey);return this.createInstructionWithPublicKey({publicKey:i,message:r,signature:s,instructionIndex:n})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}mr.programId=new He("Ed25519SigVerify111111111111111111111111111"),Oe.bI.utils.isValidPrivateKey;const vr=Oe.bI.getPublicKey,wr=F.w3([F.u8("numSignatures"),F.NX("signatureOffset"),F.u8("signatureInstructionIndex"),F.NX("ethAddressOffset"),F.u8("ethAddressInstructionIndex"),F.NX("messageDataOffset"),F.NX("messageDataSize"),F.u8("messageInstructionIndex"),F.av(20,"ethAddress"),F.av(64,"signature"),F.u8("recoveryId")]);class br{constructor(){}static publicKeyToEthAddress(e){Xe(64===e.length,`Public key must be 64 bytes but received ${e.length} bytes`);try{return n.Buffer.from((0,Ie.lY)(Ue(e))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(e){const{publicKey:t,message:r,signature:n,recoveryId:i,instructionIndex:s}=e;return br.createInstructionWithEthAddress({ethAddress:br.publicKeyToEthAddress(t),message:r,signature:n,recoveryId:i,instructionIndex:s})}static createInstructionWithEthAddress(e){const{ethAddress:t,message:r,signature:i,recoveryId:s,instructionIndex:o=0}=e;let a;a="string"==typeof t?t.startsWith("0x")?n.Buffer.from(t.substr(2),"hex"):n.Buffer.from(t,"hex"):t,Xe(20===a.length,`Address must be 20 bytes but received ${a.length} bytes`);const c=12+a.length,u=c+i.length+1,l=n.Buffer.alloc(wr.span+r.length);return wr.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:o,ethAddressOffset:12,ethAddressInstructionIndex:o,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:o,signature:Ue(i),ethAddress:Ue(a),recoveryId:s},l),l.fill(Ue(r),wr.span),new at({keys:[],programId:br.programId,data:l})}static createInstructionWithPrivateKey(e){const{privateKey:t,message:r,instructionIndex:i}=e;Xe(32===t.length,`Private key must be 32 bytes but received ${t.length} bytes`);try{const e=Ue(t),s=vr(e,!1).slice(1),o=n.Buffer.from((0,Ie.lY)(Ue(r))),[a,c]=((e,t)=>{const r=Oe.bI.sign(e,t);return[r.toCompactRawBytes(),r.recovery]})(o,e);return this.createInstructionWithPublicKey({publicKey:s,message:r,signature:a,recoveryId:c,instructionIndex:i})}catch(e){throw new Error(`Error creating instruction; ${e}`)}}}var xr;br.programId=new He("KeccakSecp256k11111111111111111111111111111");const Ar=new He("StakeConfig11111111111111111111111111111111");class Sr{constructor(e,t,r){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=t,this.custodian=r}}xr=Sr,Sr.default=new xr(0,0,He.default);const kr=Object.freeze({Initialize:{index:0,layout:F.w3([F.DH("instruction"),((e="authorized")=>F.w3([qe("staker"),qe("withdrawer")],e))(),((e="lockup")=>F.w3([F.Wg("unixTimestamp"),F.Wg("epoch"),qe("custodian")],e))()])},Authorize:{index:1,layout:F.w3([F.DH("instruction"),qe("newAuthorized"),F.DH("stakeAuthorizationType")])},Delegate:{index:2,layout:F.w3([F.DH("instruction")])},Split:{index:3,layout:F.w3([F.DH("instruction"),F.Wg("lamports")])},Withdraw:{index:4,layout:F.w3([F.DH("instruction"),F.Wg("lamports")])},Deactivate:{index:5,layout:F.w3([F.DH("instruction")])},Merge:{index:7,layout:F.w3([F.DH("instruction")])},AuthorizeWithSeed:{index:8,layout:F.w3([F.DH("instruction"),qe("newAuthorized"),F.DH("stakeAuthorizationType"),Ge("authoritySeed"),qe("authorityOwner")])}});Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Br{constructor(){}static initialize(e){const{stakePubkey:t,authorized:r,lockup:n}=e,i=n||Sr.default,s=mt(kr.Initialize,{authorized:{staker:Ue(r.staker.toBuffer()),withdrawer:Ue(r.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:Ue(i.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:ft,isSigner:!1,isWritable:!1}],programId:this.programId,data:s};return new at(o)}static createAccountWithSeed(e){const t=new ct;t.add(At.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static createAccount(e){const t=new ct;t.add(At.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));const{stakePubkey:r,authorized:n,lockup:i}=e;return t.add(this.initialize({stakePubkey:r,authorized:n,lockup:i}))}static delegate(e){const{stakePubkey:t,authorizedPubkey:r,votePubkey:n}=e,i=mt(kr.Delegate);return(new ct).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:dt,isSigner:!1,isWritable:!1},{pubkey:Ar,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(e){const{stakePubkey:t,authorizedPubkey:r,newAuthorizedPubkey:n,stakeAuthorizationType:i,custodianPubkey:s}=e,o=mt(kr.Authorize,{newAuthorized:Ue(n.toBuffer()),stakeAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),(new ct).add({keys:a,programId:this.programId,data:o})}static authorizeWithSeed(e){const{stakePubkey:t,authorityBase:r,authoritySeed:n,authorityOwner:i,newAuthorizedPubkey:s,stakeAuthorizationType:o,custodianPubkey:a}=e,c=mt(kr.AuthorizeWithSeed,{newAuthorized:Ue(s.toBuffer()),stakeAuthorizationType:o.index,authoritySeed:n,authorityOwner:Ue(i.toBuffer())}),u=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1},{pubkey:lt,isSigner:!1,isWritable:!1}];return a&&u.push({pubkey:a,isSigner:!0,isWritable:!1}),(new ct).add({keys:u,programId:this.programId,data:c})}static splitInstruction(e){const{stakePubkey:t,authorizedPubkey:r,splitStakePubkey:n,lamports:i}=e,s=mt(kr.Split,{lamports:i});return new at({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}static split(e,t){const r=new ct;return r.add(At.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:t,space:this.space,programId:this.programId})),r.add(this.splitInstruction(e))}static splitWithSeed(e,t){const{stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,basePubkey:s,seed:o,lamports:a}=e,c=new ct;return c.add(At.allocate({accountPubkey:i,basePubkey:s,seed:o,space:this.space,programId:this.programId})),t&&t>0&&c.add(At.transfer({fromPubkey:e.authorizedPubkey,toPubkey:i,lamports:t})),c.add(this.splitInstruction({stakePubkey:r,authorizedPubkey:n,splitStakePubkey:i,lamports:a}))}static merge(e){const{stakePubkey:t,sourceStakePubKey:r,authorizedPubkey:n}=e,i=mt(kr.Merge);return(new ct).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:dt,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(e){const{stakePubkey:t,authorizedPubkey:r,toPubkey:n,lamports:i,custodianPubkey:s}=e,o=mt(kr.Withdraw,{lamports:i}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:dt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return s&&a.push({pubkey:s,isSigner:!0,isWritable:!1}),(new ct).add({keys:a,programId:this.programId,data:o})}static deactivate(e){const{stakePubkey:t,authorizedPubkey:r}=e,n=mt(kr.Deactivate);return(new ct).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:n})}}Br.programId=new He("Stake11111111111111111111111111111111111111"),Br.space=200;const Er=Object.freeze({InitializeAccount:{index:0,layout:F.w3([F.DH("instruction"),((e="voteInit")=>F.w3([qe("nodePubkey"),qe("authorizedVoter"),qe("authorizedWithdrawer"),F.u8("commission")],e))()])},Authorize:{index:1,layout:F.w3([F.DH("instruction"),qe("newAuthorized"),F.DH("voteAuthorizationType")])},Withdraw:{index:3,layout:F.w3([F.DH("instruction"),F.Wg("lamports")])},UpdateValidatorIdentity:{index:4,layout:F.w3([F.DH("instruction")])},AuthorizeWithSeed:{index:10,layout:F.w3([F.DH("instruction"),((e="voteAuthorizeWithSeedArgs")=>F.w3([F.DH("voteAuthorizationType"),qe("currentAuthorityDerivedKeyOwnerPubkey"),Ge("currentAuthorityDerivedKeySeed"),qe("newAuthorized")],e))()])}});Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class Ir{constructor(){}static initializeAccount(e){const{votePubkey:t,nodePubkey:r,voteInit:n}=e,i=mt(Er.InitializeAccount,{voteInit:{nodePubkey:Ue(n.nodePubkey.toBuffer()),authorizedVoter:Ue(n.authorizedVoter.toBuffer()),authorizedWithdrawer:Ue(n.authorizedWithdrawer.toBuffer()),commission:n.commission}}),s={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:ft,isSigner:!1,isWritable:!1},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new at(s)}static createAccount(e){const t=new ct;return t.add(At.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:r,newAuthorizedPubkey:n,voteAuthorizationType:i}=e,s=mt(Er.Authorize,{newAuthorized:Ue(n.toBuffer()),voteAuthorizationType:i.index}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return(new ct).add({keys:o,programId:this.programId,data:s})}static authorizeWithSeed(e){const{currentAuthorityDerivedKeyBasePubkey:t,currentAuthorityDerivedKeyOwnerPubkey:r,currentAuthorityDerivedKeySeed:n,newAuthorizedPubkey:i,voteAuthorizationType:s,votePubkey:o}=e,a=mt(Er.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ue(r.toBuffer()),currentAuthorityDerivedKeySeed:n,newAuthorized:Ue(i.toBuffer()),voteAuthorizationType:s.index}}),c=[{pubkey:o,isSigner:!1,isWritable:!0},{pubkey:lt,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new ct).add({keys:c,programId:this.programId,data:a})}static withdraw(e){const{votePubkey:t,authorizedWithdrawerPubkey:r,lamports:n,toPubkey:i}=e,s=mt(Er.Withdraw,{lamports:n}),o=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!0,isWritable:!1}];return(new ct).add({keys:o,programId:this.programId,data:s})}static safeWithdraw(e,t,r){if(e.lamports>t-r)throw new Error("Withdraw will leave vote account with insufficient funds.");return Ir.withdraw(e)}static updateValidatorIdentity(e){const{votePubkey:t,authorizedWithdrawerPubkey:r,nodePubkey:n}=e,i=mt(Er.UpdateValidatorIdentity),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}];return(new ct).add({keys:s,programId:this.programId,data:i})}}Ir.programId=new He("Vote111111111111111111111111111111111111111"),Ir.space=3762,new He("Va1idator1nfo111111111111111111111111111111"),Se({name:xe(),website:we(xe()),details:we(xe()),iconUrl:we(xe()),keybaseUsername:we(xe())}),new He("Vote111111111111111111111111111111111111111"),F.w3([qe("nodePubkey"),qe("authorizedWithdrawer"),F.u8("commission"),F.I0(),F.O6(F.w3([F.I0("slot"),F.DH("confirmationCount")]),F.cY(F.DH(),-8),"votes"),F.u8("rootSlotValid"),F.I0("rootSlot"),F.I0(),F.O6(F.w3([F.I0("epoch"),qe("authorizedVoter")]),F.cY(F.DH(),-8),"authorizedVoters"),F.w3([F.O6(F.w3([qe("authorizedPubkey"),F.I0("epochOfLastAuthorizedSwitch"),F.I0("targetEpoch")]),32,"buf"),F.I0("idx"),F.u8("isEmpty")],"priorVoters"),F.I0(),F.O6(F.w3([F.I0("epoch"),F.I0("credits"),F.I0("prevCredits")]),F.cY(F.DH(),-8),"epochCredits"),F.w3([F.I0("slot"),F.I0("timestamp")],"lastTimestamp")])},2723:(e,t,r)=>{var n,i,s,o,a,c,u,l,h,f,d,p,y,g,m,v,w,b,x,A,S,k,B,E,I,O,_,P,M,C,T,U,N;!function(){var j="object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:{};function R(e,t){return e!==j&&("function"==typeof Object.create?Object.defineProperty(e,"__esModule",{value:!0}):e.__esModule=!0),function(r,n){return e[r]=t?t(r,n):n}}n=function(e){!function(e){var t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])};i=function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)},s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},c=function(e,t){return function(r,n){t(r,n,e)}},u=function(e,t,r,n,i,s){function o(e){if(void 0!==e&&"function"!=typeof e)throw new TypeError("Function expected");return e}for(var a,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",l=!t&&e?n.static?e:e.prototype:null,h=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),f=!1,d=r.length-1;d>=0;d--){var p={};for(var y in n)p[y]="access"===y?{}:n[y];for(var y in n.access)p.access[y]=n.access[y];p.addInitializer=function(e){if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(o(e||null))};var g=(0,r[d])("accessor"===c?{get:h.get,set:h.set}:h[u],p);if("accessor"===c){if(void 0===g)continue;if(null===g||"object"!=typeof g)throw new TypeError("Object expected");(a=o(g.get))&&(h.get=a),(a=o(g.set))&&(h.set=a),(a=o(g.init))&&i.unshift(a)}else(a=o(g))&&("field"===c?i.unshift(a):h[u]=a)}l&&Object.defineProperty(l,n.name,h),f=!0},l=function(e,t,r){for(var n=arguments.length>2,i=0;i0&&i[i.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},v=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o},w=function(){for(var e=[],t=0;t1||a(e,t)})},t&&(n[e]=t(n[e])))}function a(e,t){try{(r=i[e](t)).value instanceof A?Promise.resolve(r.value.v).then(c,u):l(s[0][2],r)}catch(e){l(s[0][3],e)}var r}function c(e){a("next",e)}function u(e){a("throw",e)}function l(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}},k=function(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:A(e[n](t)),done:!1}:i?i(t):t}:i}},B=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=m(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}},E=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e};var r=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},n=function(e){return n=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},n(e)};I=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i=n(e),s=0;s=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&n(t,e,r);return i(t,e),t},a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeUnchecked=t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;const c=a(r(9404)),u=a(r(6763)),l=o(r(4281)),h=new("function"!=typeof TextDecoder?l.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=Buffer.from(e,"utf8")),u.default.encode(Buffer.from(e))},t.baseDecode=function(e){return Buffer.from(u.default.decode(e))};const f=1024;class d 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(".")}}t.BorshError=d;class p{constructor(){this.buf=Buffer.alloc(f),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(f)]))}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(Buffer.from(new c.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new c.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new c.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new c.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(f)]),this.length+=e.length}writeString(e){this.maybeResize();const t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(const r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function y(e,t,r){const n=r.value;r.value=function(...e){try{return n.apply(this,e)}catch(e){if(e instanceof RangeError){const t=e.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(t)>=0)throw new d("Reached the end of buffer when deserializing")}throw e}}}t.BinaryWriter=p;class g{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 c.default(e,"le")}readU128(){const e=this.readBuffer(16);return new c.default(e,"le")}readU256(){const e=this.readBuffer(32);return new c.default(e,"le")}readU512(){const e=this.readBuffer(64);return new c.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new d(`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 h.decode(t)}catch(e){throw new d(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const t=this.readU32(),r=Array();for(let n=0;n{v(e,t,r,n[0],i)});else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),v(e,t,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,s)=>{v(e,t,s,n.key,i),v(e,t,r,n.value,i)});break;default:throw new d(`FieldType ${n} unrecognized`)}else w(e,r,i)}catch(e){throw e instanceof d&&e.addToFieldPath(t),e}}function w(e,t,r){if("function"==typeof t.borshSerialize)return void t.borshSerialize(r);const n=e.get(t.constructor);if(!n)throw new d(`Class ${t.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map(([n,i])=>{v(e,n,t[n],i,r)});else{if("enum"!==n.kind)throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const i=t[n.field];for(let s=0;sb(e,t,r[0],n))}if("option"===r.kind)return n.readU8()?b(e,t,r.type,n):void 0;if("map"===r.kind){let i=new Map;const s=n.readU32();for(let o=0;o=n.values.length)throw new d(`Enum index: ${i} is out of range`);const[s,o]=n.values[i],a=b(e,s,o,r);return new t({[s]:a})}throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}s([y],g.prototype,"readU8",null),s([y],g.prototype,"readU16",null),s([y],g.prototype,"readU32",null),s([y],g.prototype,"readU64",null),s([y],g.prototype,"readU128",null),s([y],g.prototype,"readU256",null),s([y],g.prototype,"readU512",null),s([y],g.prototype,"readString",null),s([y],g.prototype,"readFixedArray",null),s([y],g.prototype,"readArray",null),t.BinaryReader=g,t.serialize=function(e,t,r=p){const n=new r;return w(e,t,n),n.toArray()},t.deserialize=function(e,t,r,n=g){const i=new n(r),s=x(e,t,i);if(i.offset{var n=r(8287),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,r){if("number"==typeof e)throw new TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw new TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw new TypeError("Argument must be a number");return n.SlowBuffer(e)}},2959:(e,t,r)=>{"use strict";r.d(t,{bI:()=>O});var n=r(8442),i=r(9441);class s extends i.Vw{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,i.sd)(e);const r=(0,i.ZJ)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?e.create().update(r).digest():r);for(let e=0;enew s(e,t).update(r).digest();o.create=(e,t)=>new s(e,t);var a=r(1848),c=r(615),u=r(8030);const l=(e,t)=>(e+(e>=0?t:-t)/m)/t;function h(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function f(e,t){const r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return(0,a.d6)(r.lowS,"lowS"),(0,a.d6)(r.prehash,"prehash"),void 0!==r.format&&h(r.format),r}class d extends Error{constructor(e=""){super(e)}}const p={Err:d,_tlv:{encode:(e,t)=>{const{Err:r}=p;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");const n=t.length/2,i=(0,a.zW)(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");const s=n>127?(0,a.zW)(i.length/2|128):"";return(0,a.zW)(e)+s+i+t},decode(e,t){const{Err:r}=p;let n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");const i=t[n++];let s=0;if(128&i){const e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");const o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(const e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;const o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){const{Err:t}=p;if(eMath.ceil(e/2)))):void 0;return{CURVE:t,curveOpts:{Fp:r,Fn:(0,u.D0)(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes}}}(e),n={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:r,hash:e.hash,ecdsaOpts:n}}(e);return function(e,t){const r=t.Point;return Object.assign({},t,{ProjectivePoint:r,CURVE:Object.assign({},e,(0,u.LH)(r.Fn.ORDER,r.Fn.BITS))})}(e,function(e,t,r={}){(0,i.sd)(t),(0,a.DS)(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=r.randomBytes||i.po,s=r.hmac||((e,...r)=>o(t,e,(0,i.Id)(...r))),{Fp:c,Fn:l}=e,{ORDER:d,BITS:v}=l,{keygen:w,getPublicKey:S,getSharedSecret:k,utils:B,lengths:E}=function(e,t={}){const{Fn:r}=e,n=t.randomBytes||i.po,s=Object.assign(A(e.Fp,r),{seed:(0,u.Tp)(r.ORDER)});function o(e){try{return!!b(r,e)}catch(e){return!1}}function c(e=n(s.seed)){return(0,u.qy)((0,a.eV)(e,s.seed,"seed"),r.ORDER)}function l(t,n=!0){return e.BASE.multiply(b(r,t)).toBytes(n)}function h(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;const{secretKey:n,publicKey:i,publicKeyUncompressed:o}=s;if(r.allowedLengths||n===i)return;const c=(0,a.qj)("key",t).length;return c===i||c===o}const f={isValidSecretKey:o,isValidPublicKey:function(t,r){const{publicKey:n,publicKeyUncompressed:i}=s;try{const s=t.length;return!(!0===r&&s!==n||!1===r&&s!==i||!e.fromBytes(t))}catch(e){return!1}},randomSecretKey:c,isValidPrivateKey:o,randomPrivateKey:c,normPrivateKeyToScalar:e=>b(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({getPublicKey:l,getSharedSecret:function(t,n,i=!0){if(!0===h(t))throw new Error("first arg must be private key");if(!1===h(n))throw new Error("second arg must be public key");const s=b(r,t);return e.fromHex(n).multiply(s).toBytes(i)},keygen:function(e){const t=c(e);return{secretKey:t,publicKey:l(t)}},Point:e,utils:f,lengths:s})}(e,r),I={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},O="compact";function _(e){return e>d>>g}function P(e,t){if(!l.isValidNot0(t))throw new Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class M{constructor(e,t,r){this.r=P("r",e),this.s=P("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=O){let r;if(function(e,t){h(t);const r=E.signature,n="compact"===t?r:"recovered"===t?r+1:void 0;(0,a.eV)(e,n,`${t} signature`)}(e,t),"der"===t){const{r:t,s:r}=p.toSig((0,a.eV)(e));return new M(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));const n=l.BYTES,i=e.subarray(0,n),s=e.subarray(n,2*n);return new M(l.fromBytes(i),l.fromBytes(s),r)}static fromHex(e,t){return this.fromBytes((0,i.aT)(e),t)}addRecoveryBit(e){return new M(this.r,this.s,e)}recoverPublicKey(t){const r=c.ORDER,{r:n,s,recovery:o}=this;if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");if(d*m1)throw new Error("recovery id is ambiguous for h>1 curve");const u=2===o||3===o?n+d:n;if(!c.isValid(u))throw new Error("recovery id 2 or 3 invalid");const h=c.toBytes(u),f=e.fromBytes((0,i.Id)(x(!(1&o)),h)),p=l.inv(u),y=T((0,a.qj)("msgHash",t)),g=l.create(-y*p),v=l.create(s*p),w=e.BASE.multiplyUnsafe(g).add(f.multiplyUnsafe(v));if(w.is0())throw new Error("point at infinify");return w.assertValidity(),w}hasHighS(){return _(this.s)}toBytes(e=O){if(h(e),"der"===e)return(0,i.aT)(p.hexFromSig(this));const t=l.toBytes(this.r),r=l.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw new Error("recovery bit must be present");return(0,i.Id)(Uint8Array.of(this.recovery),t,r)}return(0,i.Id)(t,r)}toHex(e){return(0,i.My)(this.toBytes(e))}assertValidity(){}static fromCompact(e){return M.fromBytes((0,a.qj)("sig",e),"compact")}static fromDER(e){return M.fromBytes((0,a.qj)("sig",e),"der")}normalizeS(){return this.hasHighS()?new M(this.r,l.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,i.My)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,i.My)(this.toBytes("compact"))}}const C=r.bits2int||function(e){if(e.length>8192)throw new Error("input is too large");const t=(0,a.Ph)(e),r=8*e.length-v;return r>0?t>>BigInt(r):t},T=r.bits2int_modN||function(e){return l.create(C(e))},U=(0,a.OG)(v);function N(e){return(0,a.aK)("num < 2^"+v,e,y,U),l.toBytes(e)}function j(e,r){return(0,a.eV)(e,void 0,"message"),r?(0,a.eV)(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:w,getPublicKey:S,getSharedSecret:k,utils:B,lengths:E,Point:e,sign:function(r,o,c={}){r=(0,a.qj)("message",r);const{seed:u,k2sig:h}=function(t,r,s){if(["recovered","canonical"].some(e=>e in s))throw new Error("sign() legacy options not supported");const{lowS:o,prehash:c,extraEntropy:u}=f(s,I);t=j(t,c);const h=T(t),d=b(l,r),p=[N(d),N(h)];if(null!=u&&!1!==u){const e=!0===u?n(E.secretKey):u;p.push((0,a.qj)("extraEntropy",e))}const m=(0,i.Id)(...p),v=h;return{seed:m,k2sig:function(t){const r=C(t);if(!l.isValidNot0(r))return;const n=l.inv(r),i=e.BASE.multiply(r).toAffine(),s=l.create(i.x);if(s===y)return;const a=l.create(n*l.create(v+s*d));if(a===y)return;let c=(i.x===s?0:2)|Number(i.y&g),u=a;return o&&_(a)&&(u=l.neg(a),c^=1),new M(s,u,c)}}}(r,o,c);return(0,a.fg)(t.outputLen,l.BYTES,s)(u,h)},verify:function(t,r,n,s={}){const{lowS:o,prehash:c,format:u}=f(s,I);if(n=(0,a.qj)("publicKey",n),r=j((0,a.qj)("message",r),c),"strict"in s)throw new Error("options.strict was renamed to lowS");const h=void 0===u?function(e){let t;const r="string"==typeof e||(0,i.aY)(e),n=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!n)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(n)t=new M(e.r,e.s);else if(r){try{t=M.fromBytes((0,a.qj)("sig",e),"der")}catch(e){if(!(e instanceof p.Err))throw e}if(!t)try{t=M.fromBytes((0,a.qj)("sig",e),"compact")}catch(e){return!1}}return t||!1}(t):M.fromBytes((0,a.qj)("sig",t),u);if(!1===h)return!1;try{const t=e.fromBytes(n);if(o&&h.hasHighS())return!1;const{r:i,s}=h,a=T(r),c=l.inv(s),u=l.create(a*c),f=l.create(i*c),d=e.BASE.multiplyUnsafe(u).add(t.multiplyUnsafe(f));return!d.is0()&&l.create(d.x)===i}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){const{prehash:n}=f(r,I);return t=j(t,n),M.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:M,hash:t})}(function(e,t={}){const r=(0,c.UT)("weierstrass",e,t),{Fp:n,Fn:s}=r;let o=r.CURVE;const{h:u,n:h}=o;(0,a.DS)(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:f}=t;if(f&&(!n.is0(o.a)||"bigint"!=typeof f.beta||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=A(n,s);function p(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const m=t.toBytes||function(e,t,r){const{x:s,y:o}=t.toAffine(),c=n.toBytes(s);if((0,a.d6)(r,"isCompressed"),r){p();const e=!n.isOdd(o);return(0,i.Id)(x(e),c)}return(0,i.Id)(Uint8Array.of(4),c,n.toBytes(o))},S=t.fromBytes||function(e){(0,a.eV)(e,void 0,"Point");const{publicKey:t,publicKeyUncompressed:r}=d,i=e.length,s=e[0],o=e.subarray(1);if(i!==t||2!==s&&3!==s){if(i===r&&4===s){const e=n.BYTES,t=n.fromBytes(o.subarray(0,e)),r=n.fromBytes(o.subarray(e,2*e));if(!B(t,r))throw new Error("bad point: is not on curve");return{x:t,y:r}}throw new Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)}{const e=n.fromBytes(o);if(!n.isValid(e))throw new Error("bad point: is not on curve, wrong x");const t=k(e);let r;try{r=n.sqrt(t)}catch(e){const t=e instanceof Error?": "+e.message:"";throw new Error("bad point: is not on curve, sqrt error"+t)}return p(),!(1&~s)!==n.isOdd(r)&&(r=n.neg(r)),{x:e,y:r}}};function k(e){const t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,o.a)),o.b)}function B(e,t){const r=n.sqr(t),i=k(e);return n.eql(r,i)}if(!B(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const E=n.mul(n.pow(o.a,v),w),I=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(E,I)))throw new Error("bad curve params: a or b");function O(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw new Error(`bad point coordinate ${e}`);return t}function _(e){if(!(e instanceof U))throw new Error("ProjectivePoint expected")}function P(e){if(!f||!f.basises)throw new Error("no endo");return function(e,t,r){const[[n,i],[s,o]]=t,c=l(o*e,r),u=l(-i*e,r);let h=e-c*n-u*s,f=-c*i-u*o;const d=h=m||f=m)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:h,k2neg:p,k2:f}}(e,f.basises,s.ORDER)}const M=(0,a.x)((e,t)=>{const{X:r,Y:i,Z:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};const o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));const a=n.mul(r,t),c=n.mul(i,t),u=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:a,y:c}}),C=(0,a.x)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw new Error("bad point: ZERO")}const{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not field elements");if(!B(r,i))throw new Error("bad point: equation left != right");if(!e.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function T(e,t,r,i,s){return r=new U(n.mul(r.X,e),r.Y,r.Z),t=(0,c.u0)(i,t),r=(0,c.u0)(s,r),t.add(r)}class U{constructor(e,t,r){this.X=O("x",e),this.Y=O("y",t,!0),this.Z=O("z",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){const{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw new Error("invalid affine point");if(e instanceof U)throw new Error("projective point not allowed");return n.is0(t)&&n.is0(r)?U.ZERO:new U(t,r,n.ONE)}static fromBytes(e){const t=U.fromAffine(S((0,a.eV)(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return U.fromBytes((0,a.qj)("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return j.createCache(this,e),t||this.multiply(v),this}assertValidity(){C(this)}hasEvenY(){const{y:e}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){_(e);const{X:t,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=e,c=n.eql(n.mul(t,a),n.mul(s,i)),u=n.eql(n.mul(r,a),n.mul(o,i));return c&&u}negate(){return new U(this.X,n.neg(this.Y),this.Z)}double(){const{a:e,b:t}=o,r=n.mul(t,v),{X:i,Y:s,Z:a}=this;let c=n.ZERO,u=n.ZERO,l=n.ZERO,h=n.mul(i,i),f=n.mul(s,s),d=n.mul(a,a),p=n.mul(i,s);return p=n.add(p,p),l=n.mul(i,a),l=n.add(l,l),c=n.mul(e,l),u=n.mul(r,d),u=n.add(c,u),c=n.sub(f,u),u=n.add(f,u),u=n.mul(c,u),c=n.mul(p,c),l=n.mul(r,l),d=n.mul(e,d),p=n.sub(h,d),p=n.mul(e,p),p=n.add(p,l),l=n.add(h,h),h=n.add(l,h),h=n.add(h,d),h=n.mul(h,p),u=n.add(u,h),d=n.mul(s,a),d=n.add(d,d),h=n.mul(d,p),c=n.sub(c,h),l=n.mul(d,f),l=n.add(l,l),l=n.add(l,l),new U(c,u,l)}add(e){_(e);const{X:t,Y:r,Z:i}=this,{X:s,Y:a,Z:c}=e;let u=n.ZERO,l=n.ZERO,h=n.ZERO;const f=o.a,d=n.mul(o.b,v);let p=n.mul(t,s),y=n.mul(r,a),g=n.mul(i,c),m=n.add(t,r),w=n.add(s,a);m=n.mul(m,w),w=n.add(p,y),m=n.sub(m,w),w=n.add(t,i);let b=n.add(s,c);return w=n.mul(w,b),b=n.add(p,g),w=n.sub(w,b),b=n.add(r,i),u=n.add(a,c),b=n.mul(b,u),u=n.add(y,g),b=n.sub(b,u),h=n.mul(f,w),u=n.mul(d,g),h=n.add(u,h),u=n.sub(y,h),h=n.add(y,h),l=n.mul(u,h),y=n.add(p,p),y=n.add(y,p),g=n.mul(f,g),w=n.mul(d,w),y=n.add(y,g),g=n.sub(p,g),g=n.mul(f,g),w=n.add(w,g),p=n.mul(y,w),l=n.add(l,p),p=n.mul(b,w),u=n.mul(m,u),u=n.sub(u,p),p=n.mul(m,y),h=n.mul(b,h),h=n.add(h,p),new U(u,l,h)}subtract(e){return this.add(e.negate())}is0(){return this.equals(U.ZERO)}multiply(e){const{endo:r}=t;if(!s.isValidNot0(e))throw new Error("invalid scalar: out of range");let n,i;const o=e=>j.cached(this,e,e=>(0,c.Ak)(U,e));if(r){const{k1neg:t,k1:s,k2neg:a,k2:c}=P(e),{p:u,f:l}=o(s),{p:h,f}=o(c);i=l.add(f),n=T(r.beta,u,h,t,a)}else{const{p:t,f:r}=o(e);n=t,i=r}return(0,c.Ak)(U,[n,i])[0]}multiplyUnsafe(e){const{endo:r}=t,n=this;if(!s.isValid(e))throw new Error("invalid scalar: out of range");if(e===y||n.is0())return U.ZERO;if(e===g)return n;if(j.hasCache(this))return this.multiply(e);if(r){const{k1neg:t,k1:i,k2neg:s,k2:o}=P(e),{p1:a,p2:u}=(0,c.fH)(U,n,i,o);return T(r.beta,a,u,t,s)}return j.unsafe(n,e)}multiplyAndAddUnsafe(e,t,r){const n=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return n.is0()?void 0:n}toAffine(e){return M(this,e)}isTorsionFree(){const{isTorsionFree:e}=t;return u===g||(e?e(U,this):j.unsafe(this,h).is0())}clearCofactor(){const{clearCofactor:e}=t;return u===g?this:e?e(U,this):this.multiplyUnsafe(u)}isSmallOrder(){return this.multiplyUnsafe(u).is0()}toBytes(e=!0){return(0,a.d6)(e,"isCompressed"),this.assertValidity(),m(U,this,e)}toHex(e=!0){return(0,i.My)(this.toBytes(e))}toString(){return``}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return(0,c.Ak)(U,e)}static msm(e,t){return(0,c.Xf)(U,s,e,t)}static fromPrivateKey(e){return U.BASE.multiply(b(s,e))}}U.BASE=new U(o.Gx,o.Gy,n.ONE),U.ZERO=new U(n.ZERO,n.ONE,n.ZERO),U.Fp=n,U.Fn=s;const N=s.BITS,j=new c.hT(U,t.endo?Math.ceil(N/2):N);return U.BASE.precompute(8),U}(t,r),n,s))}const k={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},B={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},E=BigInt(2),I=(0,u.D0)(k.p,{sqrt:function(e){const t=k.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),l=e*e*e%t,h=l*l*e%t,f=(0,u.zH)(h,r,t)*h%t,d=(0,u.zH)(f,r,t)*h%t,p=(0,u.zH)(d,E,t)*l%t,y=(0,u.zH)(p,i,t)*p%t,g=(0,u.zH)(y,s,t)*y%t,m=(0,u.zH)(g,a,t)*g%t,v=(0,u.zH)(m,c,t)*m%t,w=(0,u.zH)(v,a,t)*g%t,b=(0,u.zH)(w,r,t)*h%t,x=(0,u.zH)(b,o,t)*y%t,A=(0,u.zH)(x,n,t)*l%t,S=(0,u.zH)(A,E,t);if(!I.eql(I.sqr(S),e))throw new Error("Cannot find square root");return S}}),O=function(e,t){const r=t=>S({...e,hash:t});return{...r(t),create:r}}({...k,Fp:I,lowS:!0,endo:B},n.sc)},2996:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){function t(t){var r=t.slice(0,-4),n=t.slice(-4),i=e(r);if(!(n[0]^i[0]|n[1]^i[1]|n[2]^i[2]|n[3]^i[3]))return r}return{encode:function(t){var r=Uint8Array.from(t),n=e(r),s=r.length+4,o=new Uint8Array(s);return o.set(r,0),o.set(n.subarray(0,4),r.length),i.default.encode(o)},decode:function(e){var r=t(i.default.decode(e));if(null==r)throw new Error("Invalid checksum");return r},decodeUnsafe:function(e){var r=i.default.decodeUnsafe(e);if(null!=r)return t(r)}}};var i=n(r(6763))},3208:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(1525)),i=s(r(882));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v3",48,i.default);t.default=o},3289:(e,t,r)=>{"use strict";const n=r(2107).v4;e.exports=function(e,t,r,i){if("string"!=typeof e)throw new TypeError(e+" must be a string");const s="number"==typeof(i=i||{}).version?i.version:2;if(1!==s&&2!==s)throw new TypeError(s+" must be 1 or 2");const o={method:e};if(2===s&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");o.params=t}if(void 0===r){const e="function"==typeof i.generator?i.generator:function(){return n()};o.id=e(o,i)}else 2===s&&null===r?i.notificationIdNull&&(o.id=null):o.id=r;return o}},3358:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(1525)),i=s(r(8135));function s(e){return e&&e.__esModule?e:{default:e}}var o=(0,n.default)("v5",80,i.default);t.default=o},3577:(e,t,r)=>{"use strict";r.d(t,{di:()=>o,iN:()=>u});var n=r(6440),i=r(6394),s=r(5182);function o(e,t,r,{strict:n}={}){return(0,i.q)(e,{strict:!1})?u(e,t,r,{strict:n}):function(e,t,r,{strict:n}={}){a(e,t);const i=e.slice(t,r);return n&&c(i,t,r),i}(e,t,r,{strict:n})}function a(e,t){if("number"==typeof t&&t>0&&t>(0,s.E)(e)-1)throw new n.ii({offset:t,position:"start",size:(0,s.E)(e)})}function c(e,t,r){if("number"==typeof t&&"number"==typeof r&&(0,s.E)(e)!==r-t)throw new n.ii({offset:r,position:"end",size:(0,s.E)(e)})}function u(e,t,r,{strict:n}={}){a(e,t);const i=`0x${e.replace("0x","").slice(2*(t??0),2*(r??e.length))}`;return n&&c(i,t,r),i}},3691:(e,t,r)=>{"use strict";r.d(t,{PK:()=>c,iq:()=>s,uP:()=>a,zF:()=>o});var n=r(6244),i=r(1344);class s extends i.C{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class o extends i.C{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class a extends i.C{constructor({hash:e,size:t}){super(`Versioned hash "${e}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${t}`],name:"InvalidVersionedHashSizeError"})}}class c extends i.C{constructor({hash:e,version:t}){super(`Versioned hash "${e}" version is invalid.`,{metaMessages:[`Expected: ${n.E}`,`Received: ${t}`],name:"InvalidVersionedHashVersionError"})}}},4061:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(5975)),i=s(r(2298));function s(e){return e&&e.__esModule?e:{default:e}}t.default=function(e,t,r){const s=(e=e||{}).random||(e.rng||n.default)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){r=r||0;for(let e=0;e<16;++e)t[r+e]=s[e];return t}return(0,i.default)(s)}},4192:(e,t,r)=>{"use strict";r.d(t,{$P:()=>c,My:()=>u,cK:()=>l,i3:()=>f,nj:()=>a});var n=r(4317),i=r(586),s=r(6675);const o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function a(e,t={}){return"number"==typeof e||"bigint"==typeof e?l(e,t):"string"==typeof e?f(e,t):"boolean"==typeof e?c(e,t):u(e,t)}function c(e,t={}){const r=`0x${Number(e)}`;return"number"==typeof t.size?((0,s.Sl)(r,{size:t.size}),(0,i.eV)(r,{size:t.size})):r}function u(e,t={}){let r="";for(let t=0;ta||o{"use strict";function r(e,t,r){return t<=e&&e<=r}function n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function i(e){this.tokens=[].slice.call(e)}i.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var s=-1;function o(e,t){if(e)throw TypeError("Decoder error");return t||65533}var a="utf-8";function c(e,t){if(!(this instanceof c))return new c(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw new Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=Boolean(t.fatal),this._ignoreBOM=Boolean(t.ignoreBOM),Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function u(e,t){if(!(this instanceof u))return new u(e,t);if((e=void 0!==e?String(e).toLowerCase():a)!==a)throw new Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._encoder=null,this._options={fatal:Boolean(t.fatal)},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,n=0,i=0,a=0,c=128,u=191;this.handler=function(e,l){if(-1===l&&0!==a)return a=0,o(t);if(-1===l)return s;if(0===a){if(r(l,0,127))return l;if(r(l,194,223))a=1,n=l-192;else if(r(l,224,239))224===l&&(c=160),237===l&&(u=159),a=2,n=l-224;else{if(!r(l,240,244))return o(t);240===l&&(c=144),244===l&&(u=143),a=3,n=l-240}return n<<=6*a,null}if(!r(l,c,u))return n=a=i=0,c=128,u=191,e.prepend(l),o(t);if(c=128,u=191,n+=l-128<<6*(a-(i+=1)),i!==a)return null;var h=n;return n=a=i=0,h}}function h(e){e.fatal,this.handler=function(e,t){if(-1===t)return s;if(r(t,0,127))return t;var n,i;r(t,128,2047)?(n=1,i=192):r(t,2048,65535)?(n=2,i=224):r(t,65536,1114111)&&(n=3,i=240);for(var o=[(t>>6*n)+i];n>0;){var a=t>>6*(n-1);o.push(128|63&a),n-=1}return o}}c.prototype={decode:function(e,t){var r;r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=n(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=Boolean(t.stream);for(var o,a=new i(r),c=[];!a.endOfStream()&&(o=this._decoder.handler(a,a.read()))!==s;)null!==o&&(Array.isArray(o)?c.push.apply(c,o):c.push(o));if(!this._streaming){do{if((o=this._decoder.handler(a,a.read()))===s)break;null!==o&&(Array.isArray(o)?c.push.apply(c,o):c.push(o))}while(!a.endOfStream());this._decoder=null}return c.length&&(-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===c[0]?(this._BOMseen=!0,c.shift()):this._BOMseen=!0)),function(e){for(var t="",r=0;r>10),56320+(1023&n)))}return t}(c)}},u.prototype={encode:function(e,t){e=e?String(e):"",t=n(t),this._streaming||(this._encoder=new h(this._options)),this._streaming=Boolean(t.stream);for(var r,o=[],a=new i(function(e){for(var t=String(e),r=t.length,n=0,i=[];n57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=1023&s,c=1023&o;i.push(65536+(a<<10)+c),n+=1}else i.push(65533)}n+=1}return i}(e));!a.endOfStream()&&(r=this._encoder.handler(a,a.read()))!==s;)Array.isArray(r)?o.push.apply(o,r):o.push(r);if(!this._streaming){for(;(r=this._encoder.handler(a,a.read()))!==s;)Array.isArray(r)?o.push.apply(o,r):o.push(r);this._encoder=null}return new Uint8Array(o)}},t.TextEncoder=u,t.TextDecoder=c},4306:(e,t,r)=>{"use strict";r.d(t,{M:()=>i});var n=r(1344);class i extends n.C{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}},4317:(e,t,r)=>{"use strict";r.d(t,{G6:()=>s,Ty:()=>i,u:()=>o});var n=r(1344);class i extends n.C{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}n.C,n.C;class s extends n.C{constructor(e){super(`Hex value "${e}" is an odd length (${e.length}). It must be an even length.`,{name:"InvalidHexValueError"})}}class o extends n.C{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}},4443:(e,t,r)=>{"use strict";r.d(t,{Zf:()=>n});const n=r(8442).Zf},4558:(e,t,r)=>{"use strict";r.d(t,{l:()=>c});var n=r(1344);class i extends n.C{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class s extends n.C{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class o extends n.C{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}const a={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new o({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new s({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new i({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new i({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function c(e,{recursiveReadLimit:t=8192}={}){const r=Object.create(a);return r.bytes=e,r.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}},4569:(e,t,r)=>{"use strict";r.d(t,{o:()=>o});var n=r(4706),i=r(2040);const s=new(r(6447).A)(8192);function o(e,t){if(s.has(`${e}.${t}`))return s.get(`${e}.${t}`);const r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),o=(0,i.S)((0,n.Af)(r),"bytes"),a=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)o[e>>1]>>4>=8&&a[e]&&(a[e]=a[e].toUpperCase()),(15&o[e>>1])>=8&&a[e+1]&&(a[e+1]=a[e+1].toUpperCase());const c=`0x${a.join("")}`;return s.set(`${e}.${t}`,c),c}},4706:(e,t,r)=>{"use strict";r.d(t,{Af:()=>d,ZJ:()=>u,aT:()=>f});var n=r(1344),i=r(6394),s=r(586),o=r(6675),a=r(4192);const c=new TextEncoder;function u(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t){return f((0,a.cK)(e,t))}(e,t):"boolean"==typeof e?function(e,t={}){const r=new Uint8Array(1);return r[0]=Number(e),"number"==typeof t.size?((0,o.Sl)(r,{size:t.size}),(0,s.eV)(r,{size:t.size})):r}(e,t):(0,i.q)(e)?f(e,t):d(e,t)}const l={zero:48,nine:57,A:65,F:70,a:97,f:102};function h(e){return e>=l.zero&&e<=l.nine?e-l.zero:e>=l.A&&e<=l.F?e-(l.A-10):e>=l.a&&e<=l.f?e-(l.a-10):void 0}function f(e,t={}){let r=e;t.size&&((0,o.Sl)(r,{size:t.size}),r=(0,s.eV)(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);const a=i.length/2,c=new Uint8Array(a);for(let e=0,t=0;e{"use strict";r.d(t,{E:()=>i});var n=r(6394);function i(e){return(0,n.q)(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}},5364:(e,t,r)=>{"use strict";var n=r(2861).Buffer;e.exports=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,l=new Uint8Array(o);r255)return;var f=t[h];if(255===f)return;for(var d=0,p=o-1;(0!==f||d>>0,l[p]=f%256>>>0,f=f/256>>>0;if(0!==f)throw new Error("Non-zero carry");s=d,r++}for(var y=o-s;y!==o&&0===l[y];)y++;var g=n.allocUnsafe(i+(o-y));g.fill(0,0,i);for(var m=i;y!==o;)g[m++]=l[y++];return g}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw new TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var u=(o-s)*l+1>>>0,h=new Uint8Array(u);s!==o;){for(var f=t[s],d=0,p=u-1;(0!==f||d>>0,h[p]=f%a>>>0,f=f/a>>>0;if(0!==f)throw new Error("Non-zero carry");i=d,s++}for(var y=u-i;y!==u&&0===h[y];)y++;for(var g=c.repeat(r);y{"use strict";r.d(t,{zW:()=>s,Vg:()=>o,UD:()=>c,gr:()=>a,fZ:()=>u}),r(638),r(7135),r(9670);var n=r(1344);function i(e){const t=Object.entries(e).map(([e,t])=>void 0===t||!1===t?null:[e,t]).filter(Boolean),r=t.reduce((e,[t])=>Math.max(e,t.length),0);return t.map(([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`).join("\n")}n.C;class s extends n.C{constructor({v:e}){super(`Invalid \`v\` value "${e}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class o extends n.C{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",i(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class a extends n.C{constructor({serializedType:e}){super(`Serialized transaction type "${e}" is invalid.`,{name:"InvalidSerializedTransactionType"}),Object.defineProperty(this,"serializedType",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedType=e}}class c extends n.C{constructor({attributes:e,serializedTransaction:t,type:r}){const n=Object.entries(e).map(([e,t])=>void 0===t?e:void 0).filter(Boolean);super(`Invalid serialized transaction of type "${r}" was provided.`,{metaMessages:[`Serialized Transaction: "${t}"`,n.length>0?`Missing Attributes: ${n.join(", ")}`:""].filter(Boolean),name:"InvalidSerializedTransactionError"}),Object.defineProperty(this,"serializedTransaction",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.serializedTransaction=t,this.type=r}}class u extends n.C{constructor({storageKey:e}){super(`Size for storage key "${e}" is invalid. Expected 32 bytes. Got ${Math.floor((e.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}n.C,n.C,n.C,n.C,n.C},5975:(e,t)=>{"use strict";let r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){if(!r&&(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),!r))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(n)};const n=new Uint8Array(16)},6092:(e,t,r)=>{"use strict";r.d(t,{MH:()=>A});var n=r(4306),i=r(5461),s=r(9873),o=r(6637),a=r(6394),c=r(586),u=r(8583),l=r(6675),h=r(1344),f=r(4317),d=r(4558),p=r(4706),y=r(4192);function g(e,t="hex"){const r=(()=>{if("string"==typeof e){if(e.length>3&&e.length%2!=0)throw new f.G6(e);return(0,p.aT)(e)}return e})();return m((0,d.l)(r,{recursiveReadLimit:Number.POSITIVE_INFINITY}),t)}function m(e,t="hex"){if(0===e.bytes.length)return"hex"===t?(0,y.My)(e.bytes):e.bytes;const r=e.readByte();if(r<128&&e.decrementPosition(1),r<192){const n=v(e,r,128),i=e.readBytes(n);return"hex"===t?(0,y.My)(i):i}return function(e,t,r){const n=e.position,i=[];for(;e.position-n=192)return"legacy";throw new i.gr({serializedType:t})}(e);return"eip1559"===t?function(e){const t=S(e),[r,n,s,o,c,u,h,f,d,p,y,g]=t;if(9!==t.length&&12!==t.length)throw new i.UD({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:s,maxFeePerGas:o,gas:c,to:u,value:h,data:f,accessList:d,...t.length>9?{v:p,r:y,s:g}:{}},serializedTransaction:e,type:"eip1559"});const m={chainId:(0,l.ME)(r),type:"eip1559"};return(0,a.q)(u)&&"0x"!==u&&(m.to=u),(0,a.q)(c)&&"0x"!==c&&(m.gas=(0,l.uU)(c)),(0,a.q)(f)&&"0x"!==f&&(m.data=f),(0,a.q)(n)&&(m.nonce="0x"===n?0:(0,l.ME)(n)),(0,a.q)(h)&&"0x"!==h&&(m.value=(0,l.uU)(h)),(0,a.q)(o)&&"0x"!==o&&(m.maxFeePerGas=(0,l.uU)(o)),(0,a.q)(s)&&"0x"!==s&&(m.maxPriorityFeePerGas=(0,l.uU)(s)),0!==d.length&&"0x"!==d&&(m.accessList=k(d)),(0,b.xO)(m),{...12===t.length?B(t):void 0,...m}}(e):"eip2930"===t?function(e){const t=S(e),[r,n,s,o,c,u,h,f,d,p,y]=t;if(8!==t.length&&11!==t.length)throw new i.UD({attributes:{chainId:r,nonce:n,gasPrice:s,gas:o,to:c,value:u,data:h,accessList:f,...t.length>8?{v:d,r:p,s:y}:{}},serializedTransaction:e,type:"eip2930"});const g={chainId:(0,l.ME)(r),type:"eip2930"};return(0,a.q)(c)&&"0x"!==c&&(g.to=c),(0,a.q)(o)&&"0x"!==o&&(g.gas=(0,l.uU)(o)),(0,a.q)(h)&&"0x"!==h&&(g.data=h),(0,a.q)(n)&&(g.nonce="0x"===n?0:(0,l.ME)(n)),(0,a.q)(u)&&"0x"!==u&&(g.value=(0,l.uU)(u)),(0,a.q)(s)&&"0x"!==s&&(g.gasPrice=(0,l.uU)(s)),0!==f.length&&"0x"!==f&&(g.accessList=k(f)),(0,b.p$)(g),{...11===t.length?B(t):void 0,...g}}(e):"eip4844"===t?function(e){const t=S(e),r=4===t.length,n=r?t[0]:t,s=r?t.slice(1):[],[c,u,h,f,d,p,y,g,m,v,w,x,A,E]=n,[I,O,_]=s;if(11!==n.length&&14!==n.length)throw new i.UD({attributes:{chainId:c,nonce:u,maxPriorityFeePerGas:h,maxFeePerGas:f,gas:d,to:p,value:y,data:g,accessList:m,...n.length>9?{v:x,r:A,s:E}:{}},serializedTransaction:e,type:"eip4844"});const P={blobVersionedHashes:w,chainId:(0,l.ME)(c),to:p,type:"eip4844"};return(0,a.q)(d)&&"0x"!==d&&(P.gas=(0,l.uU)(d)),(0,a.q)(g)&&"0x"!==g&&(P.data=g),(0,a.q)(u)&&(P.nonce="0x"===u?0:(0,l.ME)(u)),(0,a.q)(y)&&"0x"!==y&&(P.value=(0,l.uU)(y)),(0,a.q)(v)&&"0x"!==v&&(P.maxFeePerBlobGas=(0,l.uU)(v)),(0,a.q)(f)&&"0x"!==f&&(P.maxFeePerGas=(0,l.uU)(f)),(0,a.q)(h)&&"0x"!==h&&(P.maxPriorityFeePerGas=(0,l.uU)(h)),0!==m.length&&"0x"!==m&&(P.accessList=k(m)),I&&O&&_&&(P.sidecars=(0,o.T)({blobs:I,commitments:O,proofs:_})),(0,b.zv)(P),{...14===n.length?B(n):void 0,...P}}(e):"eip7702"===t?function(e){const t=S(e),[r,n,s,o,c,u,h,f,d,p,y,g,m]=t;if(10!==t.length&&13!==t.length)throw new i.UD({attributes:{chainId:r,nonce:n,maxPriorityFeePerGas:s,maxFeePerGas:o,gas:c,to:u,value:h,data:f,accessList:d,authorizationList:p,...t.length>9?{v:y,r:g,s:m}:{}},serializedTransaction:e,type:"eip7702"});const v={chainId:(0,l.ME)(r),type:"eip7702"};return(0,a.q)(u)&&"0x"!==u&&(v.to=u),(0,a.q)(c)&&"0x"!==c&&(v.gas=(0,l.uU)(c)),(0,a.q)(f)&&"0x"!==f&&(v.data=f),(0,a.q)(n)&&(v.nonce="0x"===n?0:(0,l.ME)(n)),(0,a.q)(h)&&"0x"!==h&&(v.value=(0,l.uU)(h)),(0,a.q)(o)&&"0x"!==o&&(v.maxFeePerGas=(0,l.uU)(o)),(0,a.q)(s)&&"0x"!==s&&(v.maxPriorityFeePerGas=(0,l.uU)(s)),0!==d.length&&"0x"!==d&&(v.accessList=k(d)),0!==p.length&&"0x"!==p&&(v.authorizationList=function(e){const t=[];for(let r=0;r6?{v:h,r:f,s:d}:{}},serializedTransaction:e,type:"legacy"});const p={type:"legacy"};if((0,a.q)(o)&&"0x"!==o&&(p.to=o),(0,a.q)(s)&&"0x"!==s&&(p.gas=(0,l.uU)(s)),(0,a.q)(u)&&"0x"!==u&&(p.data=u),(0,a.q)(r)&&(p.nonce="0x"===r?0:(0,l.ME)(r)),(0,a.q)(c)&&"0x"!==c&&(p.value=(0,l.uU)(c)),(0,a.q)(n)&&"0x"!==n&&(p.gasPrice=(0,l.uU)(n)),(0,b.og)(p),6===t.length)return p;const y=(0,a.q)(h)&&"0x"!==h?(0,l.uU)(h):0n;if("0x"===d&&"0x"===f)return y>0&&(p.chainId=Number(y)),p;const m=y,v=Number((m-35n)/2n);if(v>0)p.chainId=v;else if(27n!==m&&28n!==m)throw new i.zW({v:m});return p.v=m,p.s=d,p.r=f,p.yParity=m%2n==0n?1:0,p}(e)}function S(e){return g(`0x${e.slice(4)}`,"hex")}function k(e){const t=[];for(let r=0;r{return t=e,(0,a.q)(t)&&32===(0,w.E)(t)?e:(0,u.B)(e);var t})})}return t}function B(e){const t=e.slice(-3),r="0x"===t[0]||0n===(0,l.uU)(t[0])?27n:28n;return{r:(0,c.db)(t[1],{size:32}),s:(0,c.db)(t[2],{size:32}),v:r,yParity:27n===r?0:1}}},6244:(e,t,r)=>{"use strict";r.d(t,{E:()=>n});const n=1},6348:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0,t.default="00000000-0000-0000-0000-000000000000"},6394:(e,t,r)=>{"use strict";function n(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}r.d(t,{q:()=>n})},6440:(e,t,r)=>{"use strict";r.d(t,{Fl:()=>s,ii:()=>i});var n=r(1344);class i extends n.C{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class s extends n.C{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}n.C},6447:(e,t,r)=>{"use strict";r.d(t,{A:()=>n});class n extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const e=this.keys().next().value;e&&this.delete(e)}return this}}},6623:(e,t,r)=>{"use strict";r.d(t,{S:()=>s});var n=r(4706),i=r(4192);function s(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),s="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,n.aT)(e)):e.blobs,o=[];for(const e of s)o.push(Uint8Array.from(t.blobToKzgCommitment(e)));return"bytes"===r?o:o.map(e=>(0,i.My)(e))}},6637:(e,t,r)=>{"use strict";r.d(t,{T:()=>p});var n=r(6623),i=r(9998);const s=32,o=4096,a=s*o,c=6*a-1-1*o*6;var u=r(3691),l=r(4558),h=r(5182),f=r(4706),d=r(4192);function p(e){const{data:t,kzg:r,to:p}=e,y=e.blobs??function(e){const t=e.to??("string"==typeof e.data?"hex":"bytes"),r="string"==typeof e.data?(0,f.aT)(e.data):e.data,n=(0,h.E)(r);if(!n)throw new u.zF;if(n>c)throw new u.iq({maxSize:c,size:n});const i=[];let p=!0,y=0;for(;p;){const e=(0,l.l)(new Uint8Array(a));let t=0;for(;te.bytes):i.map(e=>(0,d.My)(e.bytes))}({data:t,to:p}),g=e.commitments??(0,n.S)({blobs:y,kzg:r,to:p}),m=e.proofs??(0,i.t)({blobs:y,commitments:g,kzg:r,to:p}),v=[];for(let e=0;e{"use strict";r.d(t,{ME:()=>a,Sl:()=>s,uU:()=>o});var n=r(4317),i=r(5182);function s(e,{size:t}){if((0,i.E)(e)>t)throw new n.u({givenSize:(0,i.E)(e),maxSize:t})}function o(e,t={}){const{signed:r}=t;t.size&&s(e,{size:t.size});const n=BigInt(e);if(!r)return n;const i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function a(e,t={}){const r=o(e,t),i=Number(r);if(!Number.isSafeInteger(i))throw new n.Ty({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${r}n`});return i}},6763:(e,t,r)=>{var n=r(5364);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},7135:(e,t,r)=>{"use strict";function n(e,t){let r=e.toString();const n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[i,s]=[r.slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}r.d(t,{J:()=>n})},7238:(e,t,r)=>{"use strict";r.d(t,{lY:()=>b});var n=r(9271),i=r(9441);const s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(7),u=BigInt(256),l=BigInt(113),h=[],f=[],d=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],h.push(2*(5*n+r)),f.push((e+1)*(e+2)/2%64);let i=s;for(let e=0;e<7;e++)t=(t<>c)*l)%u,t&a&&(i^=o<<(o<r>32?(0,n.WM)(e,t,r):(0,n.P5)(e,t,r),v=(e,t,r)=>r>32?(0,n.im)(e,t,r):(0,n.B4)(e,t,r);class w extends i.Vw{constructor(e,t,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,(0,i.Fe)(r),!(0=r&&this.keccak();const s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=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(0,i.Fe)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.Ht)(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,(0,i.uH)(this.state)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new w(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}const b=(()=>{return e=1,t=136,r=32,(0,i.qj)(()=>new w(t,e,r));var e,t,r})()},7270:(e,t,r)=>{"use strict";r.d(t,{R:()=>ae});var n=r(2959),i=r(4192),s=r(4306),o=r(9873),a=r(4569),c=r(2040),u=r(6394),l=r(4706),h=r(6675);let f=!1;async function d({hash:e,privateKey:t,to:r="object"}){const{r:s,s:o,recovery:a}=n.bI.sign(e.slice(2),t.slice(2),{lowS:!0,extraEntropy:(0,u.q)(f,{strict:!1})?(0,l.aT)(f):f}),c={r:(0,i.cK)(s,{size:32}),s:(0,i.cK)(o,{size:32}),v:a?28n:27n,yParity:a};return"bytes"===r||"hex"===r?function({r:e,s:t,to:r="hex",v:i,yParity:s}){const o=(()=>{if(0===s||1===s)return s;if(i&&(27n===i||28n===i||i>=35n))return i%2n==0n?1:0;throw new Error("Invalid `v` or `yParity` value")})(),a=`0x${new n.bI.Signature((0,h.uU)(e),(0,h.uU)(t)).toCompactHex()}${0===o?"1b":"1c"}`;return"hex"===r?a:(0,l.aT)(a)}({...c,to:r}):c}function p(e){return"string"==typeof e[0]?y(e):function(e){let t=0;for(const r of e)t+=r.length;const r=new Uint8Array(t);let n=0;for(const t of e)r.set(t,n),n+=t.length;return r}(e)}function y(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}var g=r(1344),m=r(4558);function v(e,t="hex"){const r=w(e),n=(0,m.l)(new Uint8Array(r.length));return r.encode(n),"hex"===t?(0,i.My)(n.bytes):n.bytes}function w(e){return Array.isArray(e)?function(e){const t=e.reduce((e,t)=>e+t.length,0),r=b(t);return{length:t<=55?1+t:1+r+t,encode(n){t<=55?n.pushByte(192+t):(n.pushByte(247+r),1===r?n.pushUint8(t):2===r?n.pushUint16(t):3===r?n.pushUint24(t):n.pushUint32(t));for(const{encode:t}of e)t(n)}}}(e.map(e=>w(e))):function(e){const t="string"==typeof e?(0,l.aT)(e):e,r=b(t.length);return{length:1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(e){1===t.length&&t[0]<128?e.pushBytes(t):t.length<=55?(e.pushByte(128+t.length),e.pushBytes(t)):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length),e.pushBytes(t))}}}(e)}function b(e){if(e<256)return 1;if(e<65536)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new g.C("Length is too large.")}function x(e){const{chainId:t,nonce:r,to:n}=e,s=e.contractAddress??e.address,o=(0,c.S)(y(["0x05",v([t?(0,i.cK)(t):"0x",s,r?(0,i.cK)(r):"0x"])]));return"bytes"===n?(0,l.aT)(o):o}const A="Ethereum Signed Message:\n";var S=r(5182);function k(e,t){return(0,c.S)(function(e){const t="string"==typeof e?(0,i.i3)(e):"string"==typeof e.raw?e.raw:(0,i.My)(e.raw);return p([(0,i.i3)(`${A}${(0,S.E)(t)}`),t])}(e),t)}var B=r(5461),E=r(6623),I=r(9998),O=r(8226);function _(e){const{commitment:t,version:r=1}=e,n=e.to??("string"==typeof t?"hex":"bytes"),s=function(e){const t=(0,O.sha256)((0,u.q)(e,{strict:!1})?(0,l.ZJ)(e):e);return t}(t);return s.set([r],0),"bytes"===n?s:(0,i.My)(s)}var P=r(6637),M=r(8583),C=r(9032);function T(e){if(!e||0===e.length)return[];const t=[];for(let r=0;r(0,i.My)(e)),r=e.kzg,n=(0,E.S)({blobs:t,kzg:r});if(void 0===d&&(d=function(e){const{commitments:t,version:r}=e,n=e.to??("string"==typeof t[0]?"hex":"bytes"),i=[];for(const e of t)i.push(_({commitment:e,to:n,version:r}));return i}({commitments:n})),void 0===p){const e=(0,I.t)({blobs:t,commitments:n,kzg:r});p=(0,P.T)({blobs:t,commitments:n,proofs:e})}}const g=T(h),m=[(0,i.cK)(r),s?(0,i.cK)(s):"0x",l?(0,i.cK)(l):"0x",u?(0,i.cK)(u):"0x",n?(0,i.cK)(n):"0x",o??"0x",a?(0,i.cK)(a):"0x",f??"0x",g,c?(0,i.cK)(c):"0x",d??[],...N(e,t)],w=[],b=[],x=[];if(p)for(let e=0;e{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n);if(r>0)return BigInt(2*r)+BigInt(35n+t.v-27n);const e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new B.zW({v:t.v});return e})(),n=(0,M.B)(t.r),s=(0,M.B)(t.s);l=[...l,(0,i.cK)(e),"0x00"===n?"0x":n,"0x00"===s?"0x":s]}else r>0&&(l=[...l,(0,i.cK)(r),"0x","0x"]);return v(l)}(e,t)}function N(e,t){const r=t??e,{v:n,yParity:s}=r;if(void 0===r.r)return[];if(void 0===r.s)return[];if(void 0===n&&void 0===s)return[];const o=(0,M.B)(r.r),a=(0,M.B)(r.s);return["number"==typeof s?s?(0,i.cK)(1):"0x":0n===n?"0x":1n===n?(0,i.cK)(1):27n===n?"0x":(0,i.cK)(1),"0x00"===o?"0x":o,"0x00"===a?"0x":a]}g.C,g.C,g.C,g.C,g.C;class j extends g.C{constructor({expectedLength:e,givenLength:t,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${e}`,`Given length: ${t}`].join("\n"),{name:"AbiEncodingArrayLengthMismatchError"})}}class R extends g.C{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${(0,S.E)(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class L extends g.C{constructor({expectedLength:e,givenLength:t}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${e}`,`Given length (values): ${t}`].join("\n"),{name:"AbiEncodingLengthMismatchError"})}}g.C,g.C,g.C,g.C,g.C,g.C,g.C,g.C,g.C,g.C;class z extends g.C{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}}g.C,g.C;class H extends g.C{constructor(e,{docsPath:t}){super([`Type "${e}" is not a valid encoding type.`,"Please provide a valid ABI type."].join("\n"),{docsPath:t,name:"InvalidAbiEncodingType"})}}g.C;class $ extends g.C{constructor(e){super([`Value "${e}" is not a valid array.`].join("\n"),{name:"InvalidArrayError"})}}g.C,g.C;var K=r(4317),D=r(586),V=r(3577);const F=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,q=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function W(e,t){if(e.length!==t.length)throw new L({expectedLength:e.length,givenLength:t.length});const r=function({params:e,values:t}){const r=[];for(let n=0;n0?p([t,e]):t}}if(s)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:p(o.map(({encoded:e})=>e))}}(t,{length:n,param:{...e,type:s}})}if("tuple"===e.type)return function(e,{param:t}){let r=!1;const n=[];for(let i=0;ie))}}(t,{param:e});if("address"===e.type)return function(e){if(!(0,o.P)(e))throw new s.M({address:e});return{dynamic:!1,encoded:(0,D.db)(e.toLowerCase())}}(t);if("bool"===e.type)return function(e){if("boolean"!=typeof e)throw new g.C(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,D.db)((0,i.$P)(e))}}(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,n="256"]=q.exec(e.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){const n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e{const r="bigint"==typeof t?t.toString():t;return r},undefined)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class Y extends g.C{constructor({primaryType:e,types:t}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class X extends g.C{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function Q({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},("number"==typeof e?.chainId||"bigint"==typeof e?.chainId)&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function ee(e){if("address"===e||"bool"===e||"string"===e||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new X({type:e})}function te(e){const{domain:t={},message:r,primaryType:n}=e,a={EIP712Domain:Q({domain:t}),...e.types};!function(e){const{domain:t,message:r,primaryType:n,types:a}=e,c=(e,t)=>{for(const r of e){const{name:e,type:n}=r,u=t[e],l=n.match(q);if(l&&("number"==typeof u||"bigint"==typeof u)){const[e,t,r]=l;(0,i.cK)(u,{signed:"int"===t,size:Number.parseInt(r,10)/8})}if("address"===n&&"string"==typeof u&&!(0,o.P)(u))throw new s.M({address:u});const h=n.match(F);if(h){const[e,t]=h;if(t&&(0,S.E)(u)!==Number.parseInt(t,10))throw new z({expectedSize:Number.parseInt(t,10),givenSize:(0,S.E)(u)})}const f=a[n];f&&(ee(n),c(f,u))}};if(a.EIP712Domain&&t){if("object"!=typeof t)throw new J({domain:t});c(a.EIP712Domain,t)}if("EIP712Domain"!==n){if(!a[n])throw new Y({primaryType:n,types:a});c(a[n],r)}}({domain:t,message:r,primaryType:n,types:a});const u=["0x1901"];return t&&u.push(function({domain:e,types:t}){return re({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:a})),"EIP712Domain"!==n&&u.push(re({data:r,primaryType:n,types:a})),(0,c.S)(p(u))}function re({data:e,primaryType:t,types:r}){const n=ne({data:e,primaryType:t,types:r});return(0,c.S)(n)}function ne({data:e,primaryType:t,types:r}){const n=[{type:"bytes32"}],i=[ie({primaryType:t,types:r})];for(const s of r[t]){const[t,o]=oe({types:r,name:s.name,type:s.type,value:e[s.name]});n.push(t),i.push(o)}return W(n,i)}function ie({primaryType:e,types:t}){const r=(0,i.nj)(function({primaryType:e,types:t}){let r="";const n=se({primaryType:e,types:t});n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i)r+=`${e}(${t[e].map(({name:e,type:t})=>`${t} ${e}`).join(",")})`;return r}({primaryType:e,types:t}));return(0,c.S)(r)}function se({primaryType:e,types:t},r=new Set){const n=e.match(/^\w*/u),i=n?.[0];if(r.has(i)||void 0===t[i])return r;r.add(i);for(const e of t[i])se({primaryType:e.type,types:t},r);return r}function oe({types:e,name:t,type:r,value:n}){if(void 0!==e[r])return[{type:"bytes32"},(0,c.S)(ne({data:n,primaryType:r,types:e}))];if("bytes"===r)return[{type:"bytes32"},(0,c.S)(n)];if("string"===r)return[{type:"bytes32"},(0,c.S)((0,i.nj)(n))];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),s=n.map(r=>oe({name:t,type:i,types:e,value:r}));return[{type:"bytes32"},(0,c.S)(W(s.map(([e])=>e),s.map(([,e])=>e)))]}return[{type:r},n]}function ae(e,t={}){const{nonceManager:r}=t,u=(0,i.nj)(n.bI.getPublicKey(e.slice(2),!1)),l=function(e){const t=(0,c.S)(`0x${e.substring(4)}`).substring(26);return(0,a.o)(`0x${t}`)}(u),h=function(e){if(!(0,o.P)(e.address,{strict:!1}))throw new s.M({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,signAuthorization:e.signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:"custom",type:"local"}}({address:l,nonceManager:r,sign:async({hash:t})=>d({hash:t,privateKey:e,to:"hex"}),signAuthorization:async t=>async function(e){const{chainId:t,nonce:r,privateKey:n,to:i="object"}=e,s=e.contractAddress??e.address,o=await d({hash:x({address:s,chainId:t,nonce:r}),privateKey:n,to:i});return"object"===i?{address:s,chainId:t,nonce:r,...o}:o}({...t,privateKey:e}),signMessage:async({message:t})=>async function({message:e,privateKey:t}){return await d({hash:k(e),privateKey:t,to:"hex"})}({message:t,privateKey:e}),signTransaction:async(t,{serializer:r}={})=>async function(e){const{privateKey:t,transaction:r,serializer:n=U}=e,i="eip4844"===r.type?{...r,sidecars:!1}:r,s=await d({hash:(0,c.S)(await n(i)),privateKey:t});return await n(r,s)}({privateKey:e,transaction:t,serializer:r}),signTypedData:async t=>async function(e){const{privateKey:t,...r}=e;return await d({hash:te(r),privateKey:t,to:"hex"})}({...t,privateKey:e})});return{...h,publicKey:u,source:"privateKey"}}},7526:(e,t)=>{"use strict";t.byteLength=function(e){var t=a(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,s=a(e),o=s[0],c=s[1],u=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,c)),l=0,h=c>0?o-4:o;for(r=0;r>16&255,u[l++]=t>>8&255,u[l++]=255&t;return 2===c&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[l++]=255&t),1===c&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=16383,a=0,c=n-i;ac?c:a+o));return 1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function a(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e){return r[e>>18&63]+r[e>>12&63]+r[e>>6&63]+r[63&e]}function u(e,t,r){for(var n,i=[],s=t;s{"use strict";r.d(t,{_S:()=>N,jn:()=>R,lG:()=>T});const n=2n**255n-19n,i=2n**252n+27742317777372353535851937790883648493n,s=0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,o=0x6666666666666666666666666666666666666666666666666666666666666658n,a={a:-1n,d:37095705934669439343138083508754565189542113879843219016388785533085940283555n,p:n,n:i,h:8,Gx:s,Gy:o},c=(e="")=>{throw new Error(e)},u=e=>"string"==typeof e,l=(e,t)=>!(e instanceof Uint8Array)||"number"==typeof t&&t>0&&e.length!==t?c("Uint8Array expected"):e,h=e=>new Uint8Array(e),f=(e,t)=>l(u(e)?x(e):h(e),t),d=(e,t=n)=>{let r=e%t;return r>=0n?r:t+r},p=e=>e instanceof g?e:c("Point expected");let y;class g{constructor(e,t,r,n){this.ex=e,this.ey=t,this.ez=r,this.et=n}static fromAffine(e){return new g(e.x,e.y,1n,d(e.x*e.y))}static fromHex(e,t=!0){const{d:r}=a,i=(e=f(e,32)).slice();i[31]=-129&e[31];const s=S(i);0n===s||(!t||0n0n;i=i.double(),e>>=1n)1n&e?r=r.add(i):t&&(n=n.add(i));return r}multiply(e){return this.mul(e)}clearCofactor(){return this.mul(BigInt(a.h),!1)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){let e=this.mul(i/2n,!1).double();return e=e.add(this),e.is0()}toAffine(){const{ex:e,ey:t,ez:r}=this;if(this.is0())return{x:0n,y:0n};const n=B(r);return 1n!==d(r*n)&&c("invalid inverse"),{x:d(e*n),y:d(t*n)}}toRawBytes(){const{x:e,y:t}=this.toAffine(),r=A(t);return r[31]|=1n&e?128:0,r}toHex(){return b(this.toRawBytes())}}g.BASE=new g(s,o,1n,d(s*o)),g.ZERO=new g(0n,1n,1n,0n);const{BASE:m,ZERO:v}=g,w=(e,t)=>e.toString(16).padStart(t,"0"),b=e=>Array.from(e).map(e=>w(e,2)).join(""),x=e=>{const t=e.length;(!u(e)||t%2)&&c("hex invalid 1");const r=h(t/2);for(let t=0;tx(w(e,64)).reverse(),S=e=>BigInt("0x"+b(h(l(e)).reverse())),k=(...e)=>{const t=h(e.reduce((e,t)=>e+l(t).length,0));let r=0;return e.forEach(e=>{t.set(e,r),r+=e.length}),t},B=(e,t=n)=>{(0n===e||t<=0n)&&c("no inverse n="+e+" mod="+t);let r=d(e,t),i=t,s=0n,o=1n,a=1n,u=0n;for(;0n!==r;){const e=i/r,t=i%r,n=s-a*e,c=o-u*e;i=r,r=t,s=a,o=u,a=n,u=c}return 1n===i?d(s,t):c("no inverse")},E=(e,t)=>{let r=e;for(;t-- >0n;)r*=r,r%=n;return r},I=19681161376707505956807079304988542015446066515923890162744021073123829784752n,O=(e,t)=>{const r=d(t*t*t),i=(e=>{const t=e*e%n*e%n,r=E(t,2n)*t%n,i=E(r,1n)*e%n,s=E(i,5n)*i%n,o=E(s,10n)*s%n,a=E(o,20n)*o%n,c=E(a,40n)*a%n,u=E(c,80n)*c%n,l=E(u,80n)*c%n,h=E(l,10n)*s%n;return{pow_p_5_8:E(h,2n)*e%n,b2:t}})(e*d(r*r*t)).pow_p_5_8;let s=d(e*r*i);const o=d(t*s*s),a=s,c=d(s*I),u=o===e,l=o===d(-e),h=o===d(-e*I);return u&&(s=a),(l||h)&&(s=c),1n==(1n&d(s))&&(s=d(-s)),{isValid:u||l,value:s}},_=e=>d(S(e),i);let P;const M=(...e)=>"function"==typeof P?P(...e):c("etc.sha512Sync not set"),C=e=>(e=>{const t=e.slice(0,32);t[0]&=248,t[31]&=127,t[31]|=64;const r=e.slice(32,64),n=_(t),i=m.mul(n),s=i.toRawBytes();return{head:t,prefix:r,scalar:n,point:i,pointBytes:s}})(M(f(e,32))),T=e=>C(e).pointBytes;function U(e,t){return e?((...e)=>R.sha512Async(...e))(t.hashable).then(t.finish):t.finish(M(t.hashable))}const N=(e,t)=>{const r=f(e),n=C(t);return U(!1,((e,t,r)=>{const{pointBytes:n,scalar:s}=e,o=_(t),a=m.mul(o).toRawBytes();return{hashable:k(a,n,r),finish:e=>{const t=d(o+_(e)*s,i);return l(k(a,A(t)),64)}}})(n,M(n.prefix,r),r))},j=()=>"object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,R={bytesToHex:b,hexToBytes:x,concatBytes:k,mod:d,invert:B,randomBytes:e=>{const t=j();return t||c("crypto.getRandomValues must be defined"),t.getRandomValues(h(e))},sha512Async:async(...e)=>{const t=j();t||c("crypto.subtle or etc.sha512Async must be defined");const r=k(...e);return h(await t.subtle.digest("SHA-512",r.buffer))},sha512Sync:void 0};Object.defineProperties(R,{sha512Sync:{configurable:!1,get:()=>P,set(e){P||(P=e)}}});const L=e=>{const t=y||(y=(()=>{const e=[];let t=m,r=t;for(let n=0;n<33;n++){r=t,e.push(r);for(let n=1;n<128;n++)r=r.add(t),e.push(r);t=r.double()}return e})()),r=(e,t)=>{let r=t.negate();return e?r:t};let n=v,i=m;const s=BigInt(255),o=BigInt(8);for(let a=0;a<33;a++){const c=128*a;let u=Number(e&s);e>>=o,u>128&&(u-=256,e+=1n);const l=c,h=c+Math.abs(u)-1,f=a%2!=0,d=u<0;0===u?i=i.add(r(f,t[l])):n=n.add(r(d,t[h]))}return{p:n,f:i}}},8030:(e,t,r)=>{"use strict";r.d(t,{D0:()=>O,LH:()=>I,Tp:()=>P,dQ:()=>A,jr:()=>k,pS:()=>B,qy:()=>M,zH:()=>g,zi:()=>y});var n=r(1848),i=r(9441);const s=BigInt(0),o=BigInt(1),a=BigInt(2),c=BigInt(3),u=BigInt(4),l=BigInt(5),h=BigInt(7),f=BigInt(8),d=BigInt(9),p=BigInt(16);function y(e,t){const r=e%t;return r>=s?r:t+r}function g(e,t,r){let n=e;for(;t-- >s;)n*=n,n%=r;return n}function m(e,t){if(e===s)throw new Error("invert: expected non-zero number");if(t<=s)throw new Error("invert: expected positive modulus, got "+t);let r=y(e,t),n=t,i=s,a=o,c=o,u=s;for(;r!==s;){const e=n/r,t=n%r,s=i-c*e,o=a-u*e;n=r,r=t,i=c,a=u,c=s,u=o}if(n!==o)throw new Error("invert: does not exist");return y(i,t)}function v(e,t,r){if(!e.eql(e.sqr(t),r))throw new Error("Cannot find square root")}function w(e,t){const r=(e.ORDER+o)/u,n=e.pow(t,r);return v(e,n,t),n}function b(e,t){const r=(e.ORDER-l)/f,n=e.mul(t,a),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,a),i),c=e.mul(s,e.sub(o,e.ONE));return v(e,c,t),c}function x(e){if(e1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===r)return w;let u=i.pow(n,t);const l=(t+o)/a;return function(e,n){if(e.is0(n))return n;if(1!==E(e,n))throw new Error("Cannot find square root");let i=r,s=e.mul(e.ONE,u),a=e.pow(n,t),c=e.pow(n,l);for(;!e.eql(a,e.ONE);){if(e.is0(a))return e.ZERO;let t=1,r=e.sqr(a);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw new Error("Cannot find square root");const n=o<(y(e,t)&o)===o,S=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function k(e){const t=S.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});return(0,n.DS)(e,t),e}function B(e,t,r=!1){const n=new Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function E(e,t){const r=(e.ORDER-o)/a,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),c=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!c)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function I(e,t){void 0!==t&&(0,i.Fe)(t);const r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function O(e,t,r=!1,i={}){if(e<=s)throw new Error("invalid field: expected ORDER > 0, got "+e);let a,g,A,S=!1;if("object"==typeof t&&null!=t){if(i.sqrt||r)throw new Error("cannot specify opts in two arguments");const e=t;e.BITS&&(a=e.BITS),e.sqrt&&(g=e.sqrt),"boolean"==typeof e.isLE&&(r=e.isLE),"boolean"==typeof e.modFromBytes&&(S=e.modFromBytes),A=e.allowedLengths}else"number"==typeof t&&(a=t),i.sqrt&&(g=i.sqrt);const{nBitLength:k,nByteLength:E}=I(e,a);if(E>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let _;const P=Object.freeze({ORDER:e,isLE:r,BITS:k,BYTES:E,MASK:(0,n.OG)(k),ZERO:s,ONE:o,allowedLengths:A,create:t=>y(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("invalid field element: expected bigint, got "+typeof t);return s<=t&&te===s,isValidNot0:e=>!P.is0(e)&&P.isValid(e),isOdd:e=>(e&o)===o,neg:t=>y(-t,e),eql:(e,t)=>e===t,sqr:t=>y(t*t,e),add:(t,r)=>y(t+r,e),sub:(t,r)=>y(t-r,e),mul:(t,r)=>y(t*r,e),pow:(e,t)=>function(e,t,r){if(rs;)r&o&&(n=e.mul(n,i)),i=e.sqr(i),r>>=o;return n}(P,e,t),div:(t,r)=>y(t*m(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>m(t,e),sqrt:g||(t=>{return _||(_=(r=e)%u===c?w:r%f===l?b:r%p===d?function(e){const t=O(e),r=x(e),n=r(t,t.neg(t.ONE)),i=r(t,n),s=r(t,t.neg(n)),o=(e+h)/p;return(e,t)=>{let r=e.pow(t,o),a=e.mul(r,n);const c=e.mul(r,i),u=e.mul(r,s),l=e.eql(e.sqr(a),t),h=e.eql(e.sqr(c),t);r=e.cmov(r,a,l),a=e.cmov(u,c,h);const f=e.eql(e.sqr(a),t),d=e.cmov(r,a,f);return v(e,d,t),d}}(r):x(r)),_(P,t);var r}),toBytes:e=>r?(0,n.z)(e,E):(0,n.lq)(e,E),fromBytes:(t,i=!0)=>{if(A){if(!A.includes(t.length)||t.length>E)throw new Error("Field.fromBytes: expected "+A+" bytes, got "+t.length);const e=new Uint8Array(E);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==E)throw new Error("Field.fromBytes: expected "+E+" bytes, got "+t.length);let s=r?(0,n.lX)(t):(0,n.Ph)(t);if(S&&(s=y(s,e)),!i&&!P.isValid(s))throw new Error("invalid field element: outside of range 0..ORDER");return s},invertBatch:e=>B(P,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(P)}function _(e){if("bigint"!=typeof e)throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function P(e){const t=_(e);return t+Math.ceil(t/2)}function M(e,t,r=!1){const i=e.length,s=_(t),a=P(t);if(i<16||i1024)throw new Error("expected "+a+"-1024 bytes of input, got "+i);const c=y(r?(0,n.lX)(e):(0,n.Ph)(e),t-o)+o;return r?(0,n.z)(c,s):(0,n.lq)(c,s)}},8135:(e,t)=>{"use strict";function r(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:case 3:return t^r^n;case 2:return t&r^t&n^r&n}}function n(e,t){return e<>>32-t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default=function(e){const t=[1518500249,1859775393,2400959708,3395469782],i=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){const t=unescape(encodeURIComponent(e));e=[];for(let r=0;r>>0;h=l,l=u,u=n(c,30)>>>0,c=o,o=a}i[0]=i[0]+o>>>0,i[1]=i[1]+c>>>0,i[2]=i[2]+u>>>0,i[3]=i[3]+l>>>0,i[4]=i[4]+h>>>0}return[i[0]>>24&255,i[0]>>16&255,i[0]>>8&255,255&i[0],i[1]>>24&255,i[1]>>16&255,i[1]>>8&255,255&i[1],i[2]>>24&255,i[2]>>16&255,i[2]>>8&255,255&i[2],i[3]>>24&255,i[3]>>16&255,i[3]>>8&255,255&i[3],i[4]>>24&255,i[4]>>16&255,i[4]>>8&255,255&i[4]]}},8226:(e,t,r)=>{"use strict";r.r(t),r.d(t,{SHA224:()=>o,SHA256:()=>i,sha224:()=>a,sha256:()=>s});var n=r(8442);const i=n.aD,s=n.sc,o=n.tn,a=n.ZT},8287:(e,t,r)=>{"use strict";const n=r(7526),i=r(251),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,c.prototype),t}function c(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return h(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!c.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let n=a(r);const i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Z(e,Uint8Array)){const t=new Uint8Array(e);return d(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Z(e,ArrayBuffer)||e&&Z(e.buffer,ArrayBuffer))return d(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Z(e,SharedArrayBuffer)||e&&Z(e.buffer,SharedArrayBuffer)))return d(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return c.from(n,t,r);const i=function(e){if(c.isBuffer(e)){const t=0|p(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||J(e.length)?a(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return c.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return l(e),a(e<0?0:0|p(e))}function f(e){const t=e.length<0?0:0|p(e.length),r=a(t);for(let n=0;n=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(c.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Z(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(e).length;default:if(i)return n?-1:q(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return E(this,t,r);case"ascii":return O(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return B(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function m(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function v(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),J(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=c.from(t,n)),c.isBuffer(t))return 0===t.length?-1:w(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function w(e,t,r,n,i){let s,o=1,a=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;sa&&(r=a-c),s=r;s>=0;s--){let r=!0;for(let n=0;ni&&(n=i):n=i;const s=t.length;let o;for(n>s/2&&(n=s/2),o=0;o>8,i=r%256,s.push(i),s.push(n);return s}(t,e.length-r),e,r,n)}function B(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function E(e,t,r){r=Math.min(e.length,r);const n=[];let i=t;for(;i239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,c;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(s=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&a)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let r="",n=0;for(;nn.length?(c.isBuffer(t)||(t=c.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!c.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},c.byteLength=y,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;tr&&(e+=" ... "),""},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(e,t,r,n,i){if(Z(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(n,i),l=e.slice(t,r);for(let e=0;e>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":case"latin1":case"binary":return A(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function O(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;in)&&(r=n);let i="";for(let n=t;nr)throw new RangeError("Trying to access beyond buffer length")}function T(e,t,r,n,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function U(e,t,r,n,i){K(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function N(e,t,r,n,i){K(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function j(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(e,t,r,n,s){return t=+t,r>>>=0,s||j(e,0,r,4),i.write(e,t,r,n,23,4),r+4}function L(e,t,r,n,s){return t=+t,r>>>=0,s||j(e,0,r,8),i.write(e,t,r,n,52,8),r+8}c.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],i=1,s=0;for(;++s>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},c.prototype.readUint8=c.prototype.readUInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),this[e]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(e,t){return e>>>=0,t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readBigUInt64LE=X(function(e){D(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<>>=0,t>>>=0,r||C(e,t,this.length);let n=this[e],i=1,s=0;for(;++s=i&&(n-=Math.pow(2,8*t)),n},c.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||C(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return e>>>=0,t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt16BE=function(e,t){e>>>=0,t||C(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},c.prototype.readInt32LE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return e>>>=0,t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readBigInt64LE=X(function(e){D(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||V(e,this.length-8);const n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<>>=0,t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return e>>>=0,t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return e>>>=0,t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(e,t,r,n){e=+e,t>>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=1,s=0;for(this[t]=255&e;++s>>=0,r>>>=0,n||T(this,e,t,r,Math.pow(2,8*r)-1,0);let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},c.prototype.writeUint8=c.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,255,0),this[t]=255&e,t+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigUInt64LE=X(function(e,t=0){return U(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=X(function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i>>=0,!n){const n=Math.pow(2,8*r-1);T(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+r},c.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},c.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},c.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},c.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||T(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},c.prototype.writeBigInt64LE=X(function(e,t=0){return U(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=X(function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(e,t,r){return R(this,e,t,!0,r)},c.prototype.writeFloatBE=function(e,t,r){return R(this,e,t,!1,r)},c.prototype.writeDoubleLE=function(e,t,r){return L(this,e,t,!0,r)},c.prototype.writeDoubleBE=function(e,t,r){return L(this,e,t,!1,r)},c.prototype.copy=function(e,t,r,n){if(!c.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function K(e,t,r,n,i,s){if(e>r||e3?0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${t}${n} and <= ${r}${n}`,new z.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,r){D(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||V(t,e.length-(r+1))}(n,i,s)}function D(e,t){if("number"!=typeof e)throw new z.ERR_INVALID_ARG_TYPE(t,"number",e)}function V(e,t,r){if(Math.floor(e)!==e)throw D(e,r),new z.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new z.ERR_BUFFER_OUT_OF_BOUNDS;throw new z.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}H("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),H("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),H("ERR_OUT_OF_RANGE",function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=$(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=$(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n},RangeError);const F=/[^+/0-9A-Za-z-_]/g;function q(e,t){let r;t=t||1/0;const n=e.length;let i=null;const s=[];for(let o=0;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function W(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,r,n){let i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function Z(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function J(e){return e!=e}const Y=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function X(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},8442:(e,t,r)=>{"use strict";r.d(t,{tn:()=>p,aD:()=>d,ZT:()=>A,sc:()=>x,Zf:()=>S});var n=r(9441);function i(e,t,r){return e&t^~e&r}function s(e,t,r){return e&t^e&r^t&r}class o extends n.Vw{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.O8)(this.buffer)}update(e){(0,n.CC)(this),e=(0,n.ZJ)(e),(0,n.DO)(e);const{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;oi-o&&(this.process(r,0),o=0);for(let e=o;e>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);const a=(0,n.O8)(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,l=this.get();if(u>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e>>3,s=(0,n.Ow)(r,17)^(0,n.Ow)(r,19)^r>>>10;f[e]=s+f[e-7]+i+f[e-16]|0}let{A:r,B:o,C:a,D:c,E:u,F:l,G:d,H:p}=this;for(let e=0;e<64;e++){const t=p+((0,n.Ow)(u,6)^(0,n.Ow)(u,11)^(0,n.Ow)(u,25))+i(u,l,d)+h[e]+f[e]|0,y=((0,n.Ow)(r,2)^(0,n.Ow)(r,13)^(0,n.Ow)(r,22))+s(r,o,a)|0;p=d,d=l,l=u,u=c+t|0,c=a,a=o,o=r,r=t+y|0}r=r+this.A|0,o=o+this.B|0,a=a+this.C|0,c=c+this.D|0,u=u+this.E|0,l=l+this.F|0,d=d+this.G|0,p=p+this.H|0,this.set(r,o,a,c,u,l,d,p)}roundClean(){(0,n.uH)(f)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.uH)(this.buffer)}}class p extends d{constructor(){super(28),this.A=0|c[0],this.B=0|c[1],this.C=0|c[2],this.D=0|c[3],this.E=0|c[4],this.F=0|c[5],this.G=0|c[6],this.H=0|c[7]}}const y=(()=>l.lD(["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(e=>BigInt(e))))(),g=(()=>y[0])(),m=(()=>y[1])(),v=new Uint32Array(80),w=new Uint32Array(80);class b extends o{constructor(e=64){super(128,e,16,!1),this.Ah=0|u[0],this.Al=0|u[1],this.Bh=0|u[2],this.Bl=0|u[3],this.Ch=0|u[4],this.Cl=0|u[5],this.Dh=0|u[6],this.Dl=0|u[7],this.Eh=0|u[8],this.El=0|u[9],this.Fh=0|u[10],this.Fl=0|u[11],this.Gh=0|u[12],this.Gl=0|u[13],this.Hh=0|u[14],this.Hl=0|u[15]}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:c,El:u,Fh:l,Fl:h,Gh:f,Gl:d,Hh:p,Hl:y}=this;return[e,t,r,n,i,s,o,a,c,u,l,h,f,d,p,y]}set(e,t,r,n,i,s,o,a,c,u,l,h,f,d,p,y){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|h,this.Gh=0|f,this.Gl=0|d,this.Hh=0|p,this.Hl=0|y}process(e,t){for(let r=0;r<16;r++,t+=4)v[r]=e.getUint32(t),w[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|v[e-15],r=0|w[e-15],n=l.rE(t,r,1)^l.rE(t,r,8)^l.xn(t,r,7),i=l.ry(t,r,1)^l.ry(t,r,8)^l.jm(t,r,7),s=0|v[e-2],o=0|w[e-2],a=l.rE(s,o,19)^l.qh(s,o,61)^l.xn(s,o,6),c=l.ry(s,o,19)^l.Ei(s,o,61)^l.jm(s,o,6),u=l.CW(i,c,w[e-7],w[e-16]),h=l.CQ(u,n,a,v[e-7],v[e-16]);v[e]=0|h,w[e]=0|u}let{Ah:r,Al:n,Bh:i,Bl:s,Ch:o,Cl:a,Dh:c,Dl:u,Eh:h,El:f,Fh:d,Fl:p,Gh:y,Gl:b,Hh:x,Hl:A}=this;for(let e=0;e<80;e++){const t=l.rE(h,f,14)^l.rE(h,f,18)^l.qh(h,f,41),S=l.ry(h,f,14)^l.ry(h,f,18)^l.Ei(h,f,41),k=h&d^~h&y,B=f&p^~f&b,E=l.F8(A,S,B,m[e],w[e]),I=l.TH(E,x,t,k,g[e],v[e]),O=0|E,_=l.rE(r,n,28)^l.qh(r,n,34)^l.qh(r,n,39),P=l.ry(r,n,28)^l.Ei(r,n,34)^l.Ei(r,n,39),M=r&i^r&o^i&o,C=n&s^n&a^s&a;x=0|y,A=0|b,y=0|d,b=0|p,d=0|h,p=0|f,({h,l:f}=l.WQ(0|c,0|u,0|I,0|O)),c=0|o,u=0|a,o=0|i,a=0|s,i=0|r,s=0|n;const T=l.Vl(O,P,C);r=l.Vr(T,I,_,M),n=0|T}({h:r,l:n}=l.WQ(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:s}=l.WQ(0|this.Bh,0|this.Bl,0|i,0|s)),({h:o,l:a}=l.WQ(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l:u}=l.WQ(0|this.Dh,0|this.Dl,0|c,0|u)),({h,l:f}=l.WQ(0|this.Eh,0|this.El,0|h,0|f)),({h:d,l:p}=l.WQ(0|this.Fh,0|this.Fl,0|d,0|p)),({h:y,l:b}=l.WQ(0|this.Gh,0|this.Gl,0|y,0|b)),({h:x,l:A}=l.WQ(0|this.Hh,0|this.Hl,0|x,0|A)),this.set(r,n,i,s,o,a,c,u,h,f,d,p,y,b,x,A)}roundClean(){(0,n.uH)(v,w)}destroy(){(0,n.uH)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const x=(0,n.qj)(()=>new d),A=(0,n.qj)(()=>new p),S=(0,n.qj)(()=>new b)},8583:(e,t,r)=>{"use strict";function n(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;en})},8610:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var n=s(r(5975)),i=s(r(2298));function s(e){return e&&e.__esModule?e:{default:e}}let o,a,c=0,u=0;t.default=function(e,t,r){let s=t&&r||0;const l=t||new Array(16);let h=(e=e||{}).node||o,f=void 0!==e.clockseq?e.clockseq:a;if(null==h||null==f){const t=e.random||(e.rng||n.default)();null==h&&(h=o=[1|t[0],t[1],t[2],t[3],t[4],t[5]]),null==f&&(f=a=16383&(t[6]<<8|t[7]))}let d=void 0!==e.msecs?e.msecs:Date.now(),p=void 0!==e.nsecs?e.nsecs:u+1;const y=d-c+(p-u)/1e4;if(y<0&&void 0===e.clockseq&&(f=f+1&16383),(y<0||d>c)&&void 0===e.nsecs&&(p=0),p>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");c=d,u=p,a=f,d+=122192928e5;const g=(1e4*(268435455&d)+p)%4294967296;l[s++]=g>>>24&255,l[s++]=g>>>16&255,l[s++]=g>>>8&255,l[s++]=255&g;const m=d/4294967296*1e4&268435455;l[s++]=m>>>8&255,l[s++]=255&m,l[s++]=m>>>24&15|16,l[s++]=m>>>16&255,l[s++]=f>>>8|128,l[s++]=255&f;for(let e=0;e<6;++e)l[s+e]=h[e];return t||(0,i.default)(l)}},8630:(e,t,r)=>{var n;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof r.g?r.g:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),n=i(e);function i(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(n=i(t.Reflect,n)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,i=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",s=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",o="function"==typeof Object.create,a={__proto__:[]}instanceof Array,c=!o&&!a,u={create:o?function(){return K(Object.create(null))}:a?function(){return K({__proto__:null})}:function(){return K({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),h="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[s]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,i=r+1;i=0;--r){var n=(0,e[r])(t);if(!B(n)&&!E(n)){if(!T(n))throw new TypeError;t=n}}return t}(e,t)}if(!M(e))throw new TypeError;if(!I(t))throw new TypeError;if(!I(n)&&!B(n)&&!E(n))throw new TypeError;return E(n)&&(n=void 0),function(e,t,r,n){for(var i=e.length-1;i>=0;--i){var s=(0,e[i])(t,r,n);if(!B(s)&&!E(s)){if(!I(s))throw new TypeError;n=s}}return n}(e,t,r=P(r),n)}),e("metadata",function(e,t){return function(r,n){if(!I(r))throw new TypeError;if(!B(n)&&!function(e){switch(k(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;x(e,t,r,n)}}),e("defineMetadata",function(e,t,r,n){if(!I(r))throw new TypeError;return B(n)||(n=P(n)),x(e,t,r,n)}),e("hasMetadata",function(e,t,r){if(!I(t))throw new TypeError;return B(r)||(r=P(r)),m(e,t,r)}),e("hasOwnMetadata",function(e,t,r){if(!I(t))throw new TypeError;return B(r)||(r=P(r)),v(e,t,r)}),e("getMetadata",function(e,t,r){if(!I(t))throw new TypeError;return B(r)||(r=P(r)),w(e,t,r)}),e("getOwnMetadata",function(e,t,r){if(!I(t))throw new TypeError;return B(r)||(r=P(r)),b(e,t,r)}),e("getMetadataKeys",function(e,t){if(!I(e))throw new TypeError;return B(t)||(t=P(t)),A(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!I(e))throw new TypeError;return B(t)||(t=P(t)),S(e,t)}),e("deleteMetadata",function(e,t,r){if(!I(t))throw new TypeError;if(B(r)||(r=P(r)),!I(t))throw new TypeError;B(r)||(r=P(r));var n=$(t,r,!1);return!B(n)&&n.OrdinaryDeleteMetadata(e,t,r)})}(n,t),void 0===t.Reflect&&(t.Reflect=e)}()}(n||(n={}))},9032:(e,t,r)=>{"use strict";r.d(t,{xO:()=>I,p$:()=>O,zv:()=>E,dc:()=>B,og:()=>_});var n=r(6244);const i=2n**256n-1n;var s=r(4306),o=r(1344),a=r(3691);o.C,o.C,o.C,o.C;class c extends o.C{constructor({chainId:e}){super("number"==typeof e?`Chain ID "${e}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}}var u=r(9670);class l extends o.C{constructor({cause:e,message:t}={}){const r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class h extends o.C{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,u.Q)(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(h,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class f extends o.C{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,u.Q)(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(f,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class d extends o.C{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class p extends o.C{constructor({cause:e,nonce:t}={}){super([`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join("\n"),{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(p,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class y extends o.C{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(y,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class g extends o.C{constructor({cause:e}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join("\n"),{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}Object.defineProperty(g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class m extends o.C{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(m,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class v extends o.C{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(v,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class w extends o.C{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(w,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class b extends o.C{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${(0,u.Q)(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${(0,u.Q)(r)} gwei`:""}).`].join("\n"),{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(b,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/}),o.C;var x=r(9873),A=r(5182),S=r(3577),k=r(6675);function B(e){const{authorizationList:t}=e;if(t)for(const e of t){const{chainId:t}=e,r=e.address;if(!(0,x.P)(r))throw new s.M({address:r});if(t<0)throw new c({chainId:t})}I(e)}function E(e){const{blobVersionedHashes:t}=e;if(t){if(0===t.length)throw new a.zF;for(const e of t){const t=(0,A.E)(e),r=(0,k.ME)((0,S.di)(e,0,1));if(32!==t)throw new a.uP({hash:e,size:t});if(r!==n.E)throw new a.PK({hash:e,version:r})}}I(e)}function I(e){const{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:n,to:o}=e;if(t<=0)throw new c({chainId:t});if(o&&!(0,x.P)(o))throw new s.M({address:o});if(n&&n>i)throw new h({maxFeePerGas:n});if(r&&n&&r>n)throw new b({maxFeePerGas:n,maxPriorityFeePerGas:r})}function O(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:a,to:u}=e;if(t<=0)throw new c({chainId:t});if(u&&!(0,x.P)(u))throw new s.M({address:u});if(r||a)throw new o.C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(n&&n>i)throw new h({maxFeePerGas:n})}function _(e){const{chainId:t,maxPriorityFeePerGas:r,gasPrice:n,maxFeePerGas:a,to:u}=e;if(u&&!(0,x.P)(u))throw new s.M({address:u});if(void 0!==t&&t<=0)throw new c({chainId:t});if(r||a)throw new o.C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(n&&n>i)throw new h({maxFeePerGas:n})}},9271:(e,t,r)=>{"use strict";r.d(t,{B4:()=>p,CQ:()=>x,CW:()=>b,Ei:()=>f,F8:()=>A,P5:()=>d,TH:()=>S,Vl:()=>v,Vr:()=>w,WM:()=>y,WQ:()=>m,im:()=>g,jm:()=>c,lD:()=>o,qh:()=>h,rE:()=>u,ry:()=>l,xn:()=>a});const n=BigInt(2**32-1),i=BigInt(32);function s(e,t=!1){return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}function o(e,t=!1){const r=e.length;let n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;oe>>>r,c=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e>>>r|t<<32-r,l=(e,t,r)=>e<<32-r|t>>>r,h=(e,t,r)=>e<<64-r|t>>>r-32,f=(e,t,r)=>e>>>r-32|t<<64-r,d=(e,t,r)=>e<>>32-r,p=(e,t,r)=>t<>>32-r,y=(e,t,r)=>t<>>64-r,g=(e,t,r)=>e<>>64-r;function m(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}const v=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),w=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,b=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),x=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,A=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),S=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0},9404:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(7790).Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function c(e,t,r){var n=a(e,r);return r-1>=t&&(n|=a(e,r-1)<<4),n}function u(e,t,r,i){for(var s=0,o=0,a=Math.min(e.length,r),c=t;c=49?u-49+10:u>=17?u-17+10:u,n(u>=0&&o0?e:t},s.min=function(e,t){return e.cmp(t)<0?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[s]|=o<>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);else if("le"===r)for(i=0,s=0;i>>26-a&67108863,(a+=24)>=26&&(a-=26,s++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=c(e,t,n)<=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,c=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=h}catch(e){s.prototype.inspect=h}else s.prototype.inspect=h;function h(){return(this.red?""}var f=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,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 y(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var u=1;u>>26,h=67108863&c,f=Math.min(u,t.length-1),d=Math.max(0,u-e.length+1);d<=f;d++){var p=u-d|0;l+=(o=(i=0|e.words[p])*(s=0|t.words[d])+h)/67108864|0,h=67108863&o}r.words[u]=0|h,c=0|l}return 0!==c?r.words[u]=0|c:r.length--,r._strip()}s.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,s=0,o=0;o>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==s||o!==this.length-1?f[6-c.length]+c+r:c+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var u=d[e],l=p[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var y=h.modrn(l).toString(e);r=(h=h.idivn(l)).isZero()?y+r:f[u-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i>8&255),r>16&255),6===s?(r>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 8191&t||(r+=13,t>>>=13),127&t||(r+=7,t>>>=7),15&t||(r+=4,t>>>=4),3&t||(r+=2,t>>>=2),1&t||r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,s=0;s>>26;for(;0!==i&&s>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;se.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var s=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==s&&o>26,this.words[o]=67108863&t;if(0===s&&o>>13,d=0|o[1],p=8191&d,y=d>>>13,g=0|o[2],m=8191&g,v=g>>>13,w=0|o[3],b=8191&w,x=w>>>13,A=0|o[4],S=8191&A,k=A>>>13,B=0|o[5],E=8191&B,I=B>>>13,O=0|o[6],_=8191&O,P=O>>>13,M=0|o[7],C=8191&M,T=M>>>13,U=0|o[8],N=8191&U,j=U>>>13,R=0|o[9],L=8191&R,z=R>>>13,H=0|a[0],$=8191&H,K=H>>>13,D=0|a[1],V=8191&D,F=D>>>13,q=0|a[2],W=8191&q,G=q>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,te=0|a[5],re=8191&te,ne=te>>>13,ie=0|a[6],se=8191&ie,oe=ie>>>13,ae=0|a[7],ce=8191&ae,ue=ae>>>13,le=0|a[8],he=8191&le,fe=le>>>13,de=0|a[9],pe=8191&de,ye=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ge=(u+(n=Math.imul(h,$))|0)+((8191&(i=(i=Math.imul(h,K))+Math.imul(f,$)|0))<<13)|0;u=((s=Math.imul(f,K))+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(p,$),i=(i=Math.imul(p,K))+Math.imul(y,$)|0,s=Math.imul(y,K);var me=(u+(n=n+Math.imul(h,V)|0)|0)+((8191&(i=(i=i+Math.imul(h,F)|0)+Math.imul(f,V)|0))<<13)|0;u=((s=s+Math.imul(f,F)|0)+(i>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,$),i=(i=Math.imul(m,K))+Math.imul(v,$)|0,s=Math.imul(v,K),n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,F)|0)+Math.imul(y,V)|0,s=s+Math.imul(y,F)|0;var ve=(u+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(f,W)|0))<<13)|0;u=((s=s+Math.imul(f,G)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(b,$),i=(i=Math.imul(b,K))+Math.imul(x,$)|0,s=Math.imul(x,K),n=n+Math.imul(m,V)|0,i=(i=i+Math.imul(m,F)|0)+Math.imul(v,V)|0,s=s+Math.imul(v,F)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(y,W)|0,s=s+Math.imul(y,G)|0;var we=(u+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,Y)|0)+Math.imul(f,J)|0))<<13)|0;u=((s=s+Math.imul(f,Y)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(S,$),i=(i=Math.imul(S,K))+Math.imul(k,$)|0,s=Math.imul(k,K),n=n+Math.imul(b,V)|0,i=(i=i+Math.imul(b,F)|0)+Math.imul(x,V)|0,s=s+Math.imul(x,F)|0,n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(v,W)|0,s=s+Math.imul(v,G)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(y,J)|0,s=s+Math.imul(y,Y)|0;var be=(u+(n=n+Math.imul(h,Q)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(f,Q)|0))<<13)|0;u=((s=s+Math.imul(f,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(E,$),i=(i=Math.imul(E,K))+Math.imul(I,$)|0,s=Math.imul(I,K),n=n+Math.imul(S,V)|0,i=(i=i+Math.imul(S,F)|0)+Math.imul(k,V)|0,s=s+Math.imul(k,F)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(x,W)|0,s=s+Math.imul(x,G)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(v,J)|0,s=s+Math.imul(v,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,Q)|0,s=s+Math.imul(y,ee)|0;var xe=(u+(n=n+Math.imul(h,re)|0)|0)+((8191&(i=(i=i+Math.imul(h,ne)|0)+Math.imul(f,re)|0))<<13)|0;u=((s=s+Math.imul(f,ne)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(_,$),i=(i=Math.imul(_,K))+Math.imul(P,$)|0,s=Math.imul(P,K),n=n+Math.imul(E,V)|0,i=(i=i+Math.imul(E,F)|0)+Math.imul(I,V)|0,s=s+Math.imul(I,F)|0,n=n+Math.imul(S,W)|0,i=(i=i+Math.imul(S,G)|0)+Math.imul(k,W)|0,s=s+Math.imul(k,G)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,Y)|0)+Math.imul(x,J)|0,s=s+Math.imul(x,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(v,Q)|0,s=s+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(y,re)|0,s=s+Math.imul(y,ne)|0;var Ae=(u+(n=n+Math.imul(h,se)|0)|0)+((8191&(i=(i=i+Math.imul(h,oe)|0)+Math.imul(f,se)|0))<<13)|0;u=((s=s+Math.imul(f,oe)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(C,$),i=(i=Math.imul(C,K))+Math.imul(T,$)|0,s=Math.imul(T,K),n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,F)|0)+Math.imul(P,V)|0,s=s+Math.imul(P,F)|0,n=n+Math.imul(E,W)|0,i=(i=i+Math.imul(E,G)|0)+Math.imul(I,W)|0,s=s+Math.imul(I,G)|0,n=n+Math.imul(S,J)|0,i=(i=i+Math.imul(S,Y)|0)+Math.imul(k,J)|0,s=s+Math.imul(k,Y)|0,n=n+Math.imul(b,Q)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(x,Q)|0,s=s+Math.imul(x,ee)|0,n=n+Math.imul(m,re)|0,i=(i=i+Math.imul(m,ne)|0)+Math.imul(v,re)|0,s=s+Math.imul(v,ne)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(y,se)|0,s=s+Math.imul(y,oe)|0;var Se=(u+(n=n+Math.imul(h,ce)|0)|0)+((8191&(i=(i=i+Math.imul(h,ue)|0)+Math.imul(f,ce)|0))<<13)|0;u=((s=s+Math.imul(f,ue)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(N,$),i=(i=Math.imul(N,K))+Math.imul(j,$)|0,s=Math.imul(j,K),n=n+Math.imul(C,V)|0,i=(i=i+Math.imul(C,F)|0)+Math.imul(T,V)|0,s=s+Math.imul(T,F)|0,n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(P,W)|0,s=s+Math.imul(P,G)|0,n=n+Math.imul(E,J)|0,i=(i=i+Math.imul(E,Y)|0)+Math.imul(I,J)|0,s=s+Math.imul(I,Y)|0,n=n+Math.imul(S,Q)|0,i=(i=i+Math.imul(S,ee)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,ee)|0,n=n+Math.imul(b,re)|0,i=(i=i+Math.imul(b,ne)|0)+Math.imul(x,re)|0,s=s+Math.imul(x,ne)|0,n=n+Math.imul(m,se)|0,i=(i=i+Math.imul(m,oe)|0)+Math.imul(v,se)|0,s=s+Math.imul(v,oe)|0,n=n+Math.imul(p,ce)|0,i=(i=i+Math.imul(p,ue)|0)+Math.imul(y,ce)|0,s=s+Math.imul(y,ue)|0;var ke=(u+(n=n+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,fe)|0)+Math.imul(f,he)|0))<<13)|0;u=((s=s+Math.imul(f,fe)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(L,$),i=(i=Math.imul(L,K))+Math.imul(z,$)|0,s=Math.imul(z,K),n=n+Math.imul(N,V)|0,i=(i=i+Math.imul(N,F)|0)+Math.imul(j,V)|0,s=s+Math.imul(j,F)|0,n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(T,W)|0,s=s+Math.imul(T,G)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(P,J)|0,s=s+Math.imul(P,Y)|0,n=n+Math.imul(E,Q)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(I,Q)|0,s=s+Math.imul(I,ee)|0,n=n+Math.imul(S,re)|0,i=(i=i+Math.imul(S,ne)|0)+Math.imul(k,re)|0,s=s+Math.imul(k,ne)|0,n=n+Math.imul(b,se)|0,i=(i=i+Math.imul(b,oe)|0)+Math.imul(x,se)|0,s=s+Math.imul(x,oe)|0,n=n+Math.imul(m,ce)|0,i=(i=i+Math.imul(m,ue)|0)+Math.imul(v,ce)|0,s=s+Math.imul(v,ue)|0,n=n+Math.imul(p,he)|0,i=(i=i+Math.imul(p,fe)|0)+Math.imul(y,he)|0,s=s+Math.imul(y,fe)|0;var Be=(u+(n=n+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(f,pe)|0))<<13)|0;u=((s=s+Math.imul(f,ye)|0)+(i>>>13)|0)+(Be>>>26)|0,Be&=67108863,n=Math.imul(L,V),i=(i=Math.imul(L,F))+Math.imul(z,V)|0,s=Math.imul(z,F),n=n+Math.imul(N,W)|0,i=(i=i+Math.imul(N,G)|0)+Math.imul(j,W)|0,s=s+Math.imul(j,G)|0,n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(T,J)|0,s=s+Math.imul(T,Y)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(P,Q)|0,s=s+Math.imul(P,ee)|0,n=n+Math.imul(E,re)|0,i=(i=i+Math.imul(E,ne)|0)+Math.imul(I,re)|0,s=s+Math.imul(I,ne)|0,n=n+Math.imul(S,se)|0,i=(i=i+Math.imul(S,oe)|0)+Math.imul(k,se)|0,s=s+Math.imul(k,oe)|0,n=n+Math.imul(b,ce)|0,i=(i=i+Math.imul(b,ue)|0)+Math.imul(x,ce)|0,s=s+Math.imul(x,ue)|0,n=n+Math.imul(m,he)|0,i=(i=i+Math.imul(m,fe)|0)+Math.imul(v,he)|0,s=s+Math.imul(v,fe)|0;var Ee=(u+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;u=((s=s+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(L,W),i=(i=Math.imul(L,G))+Math.imul(z,W)|0,s=Math.imul(z,G),n=n+Math.imul(N,J)|0,i=(i=i+Math.imul(N,Y)|0)+Math.imul(j,J)|0,s=s+Math.imul(j,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(P,re)|0,s=s+Math.imul(P,ne)|0,n=n+Math.imul(E,se)|0,i=(i=i+Math.imul(E,oe)|0)+Math.imul(I,se)|0,s=s+Math.imul(I,oe)|0,n=n+Math.imul(S,ce)|0,i=(i=i+Math.imul(S,ue)|0)+Math.imul(k,ce)|0,s=s+Math.imul(k,ue)|0,n=n+Math.imul(b,he)|0,i=(i=i+Math.imul(b,fe)|0)+Math.imul(x,he)|0,s=s+Math.imul(x,fe)|0;var Ie=(u+(n=n+Math.imul(m,pe)|0)|0)+((8191&(i=(i=i+Math.imul(m,ye)|0)+Math.imul(v,pe)|0))<<13)|0;u=((s=s+Math.imul(v,ye)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,n=Math.imul(L,J),i=(i=Math.imul(L,Y))+Math.imul(z,J)|0,s=Math.imul(z,Y),n=n+Math.imul(N,Q)|0,i=(i=i+Math.imul(N,ee)|0)+Math.imul(j,Q)|0,s=s+Math.imul(j,ee)|0,n=n+Math.imul(C,re)|0,i=(i=i+Math.imul(C,ne)|0)+Math.imul(T,re)|0,s=s+Math.imul(T,ne)|0,n=n+Math.imul(_,se)|0,i=(i=i+Math.imul(_,oe)|0)+Math.imul(P,se)|0,s=s+Math.imul(P,oe)|0,n=n+Math.imul(E,ce)|0,i=(i=i+Math.imul(E,ue)|0)+Math.imul(I,ce)|0,s=s+Math.imul(I,ue)|0,n=n+Math.imul(S,he)|0,i=(i=i+Math.imul(S,fe)|0)+Math.imul(k,he)|0,s=s+Math.imul(k,fe)|0;var Oe=(u+(n=n+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(x,pe)|0))<<13)|0;u=((s=s+Math.imul(x,ye)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(L,Q),i=(i=Math.imul(L,ee))+Math.imul(z,Q)|0,s=Math.imul(z,ee),n=n+Math.imul(N,re)|0,i=(i=i+Math.imul(N,ne)|0)+Math.imul(j,re)|0,s=s+Math.imul(j,ne)|0,n=n+Math.imul(C,se)|0,i=(i=i+Math.imul(C,oe)|0)+Math.imul(T,se)|0,s=s+Math.imul(T,oe)|0,n=n+Math.imul(_,ce)|0,i=(i=i+Math.imul(_,ue)|0)+Math.imul(P,ce)|0,s=s+Math.imul(P,ue)|0,n=n+Math.imul(E,he)|0,i=(i=i+Math.imul(E,fe)|0)+Math.imul(I,he)|0,s=s+Math.imul(I,fe)|0;var _e=(u+(n=n+Math.imul(S,pe)|0)|0)+((8191&(i=(i=i+Math.imul(S,ye)|0)+Math.imul(k,pe)|0))<<13)|0;u=((s=s+Math.imul(k,ye)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(L,re),i=(i=Math.imul(L,ne))+Math.imul(z,re)|0,s=Math.imul(z,ne),n=n+Math.imul(N,se)|0,i=(i=i+Math.imul(N,oe)|0)+Math.imul(j,se)|0,s=s+Math.imul(j,oe)|0,n=n+Math.imul(C,ce)|0,i=(i=i+Math.imul(C,ue)|0)+Math.imul(T,ce)|0,s=s+Math.imul(T,ue)|0,n=n+Math.imul(_,he)|0,i=(i=i+Math.imul(_,fe)|0)+Math.imul(P,he)|0,s=s+Math.imul(P,fe)|0;var Pe=(u+(n=n+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(I,pe)|0))<<13)|0;u=((s=s+Math.imul(I,ye)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(L,se),i=(i=Math.imul(L,oe))+Math.imul(z,se)|0,s=Math.imul(z,oe),n=n+Math.imul(N,ce)|0,i=(i=i+Math.imul(N,ue)|0)+Math.imul(j,ce)|0,s=s+Math.imul(j,ue)|0,n=n+Math.imul(C,he)|0,i=(i=i+Math.imul(C,fe)|0)+Math.imul(T,he)|0,s=s+Math.imul(T,fe)|0;var Me=(u+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,ye)|0)+Math.imul(P,pe)|0))<<13)|0;u=((s=s+Math.imul(P,ye)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(L,ce),i=(i=Math.imul(L,ue))+Math.imul(z,ce)|0,s=Math.imul(z,ue),n=n+Math.imul(N,he)|0,i=(i=i+Math.imul(N,fe)|0)+Math.imul(j,he)|0,s=s+Math.imul(j,fe)|0;var Ce=(u+(n=n+Math.imul(C,pe)|0)|0)+((8191&(i=(i=i+Math.imul(C,ye)|0)+Math.imul(T,pe)|0))<<13)|0;u=((s=s+Math.imul(T,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(L,he),i=(i=Math.imul(L,fe))+Math.imul(z,he)|0,s=Math.imul(z,fe);var Te=(u+(n=n+Math.imul(N,pe)|0)|0)+((8191&(i=(i=i+Math.imul(N,ye)|0)+Math.imul(j,pe)|0))<<13)|0;u=((s=s+Math.imul(j,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863;var Ue=(u+(n=Math.imul(L,pe))|0)+((8191&(i=(i=Math.imul(L,ye))+Math.imul(z,pe)|0))<<13)|0;return u=((s=Math.imul(z,ye))+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,c[0]=ge,c[1]=me,c[2]=ve,c[3]=we,c[4]=be,c[5]=xe,c[6]=Ae,c[7]=Se,c[8]=ke,c[9]=Be,c[10]=Ee,c[11]=Ie,c[12]=Oe,c[13]=_e,c[14]=Pe,c[15]=Me,c[16]=Ce,c[17]=Te,c[18]=Ue,0!==u&&(c[19]=u,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function v(e,t,r){return m(e,t,r)}function w(e,t){this.x=e,this.y=t}Math.imul||(g=y),s.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?g(this,e,t):r<63?y(this,e,t):r<1024?m(this,e,t):v(this,e,t)},w.prototype.makeRBT=function(e){for(var t=new Array(e),r=s.prototype._countBits(e)-1,n=0;n>=1;return n},w.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o>=26,r+=s/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<o)for(this.length-=o,u=0;u=0&&(0!==l||u>=i);u--){var h=0|this.words[u];this.words[u]=l<<26-s|h>>>s,l=h&a}return c&&0!==l&&(c.words[c.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(c/67108864|0),this.words[i+r]=67108863&s}for(;i>26,this.words[i+r]=67108863&s;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!=(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var a,c=n.length-i.length;if("mod"!==t){(a=new s(null)).length=c+1,a.words=new Array(a.length);for(var u=0;u=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,1,h),n.isZero()||(n.negative^=1);a&&(a.words[h]=f)}return a&&a._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:a||null,mod:n}},s.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):0!==(this.negative&e.negative)?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,o,a},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(r*i+(0|this.words[s]))%e;return t?-i:i},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*r;this.words[i]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new s(1),o=new s(0),a=new s(0),c=new s(1),u=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++u;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var f=0,d=1;0===(t.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,y=1;0===(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(l),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),o.isub(c)):(r.isub(t),a.isub(i),c.isub(o))}return{a,b:c,gcd:r.iushln(u)}},s.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new s(1),a=new s(0),c=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var u=0,l=1;0===(t.words[0]&l)&&u<26;++u,l<<=1);if(u>0)for(t.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,f=1;0===(r.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(r.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(a)):(r.isub(t),a.isub(o))}return(i=0===t.cmpn(1)?o:a).cmpn(0)<0&&i.iadd(e),i},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return!(1&this.words[0])},s.prototype.isOdd=function(){return!(1&~this.words[0])},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return-1===this.cmpn(e)},s.prototype.lt=function(e){return-1===this.cmp(e)},s.prototype.lten=function(e){return this.cmpn(e)<=0},s.prototype.lte=function(e){return this.cmp(e)<=0},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new E(e)},s.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={k256:null,p224:null,p192:null,p25519:null};function x(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function A(){x.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function S(){x.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function k(){x.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function B(){x.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function E(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){E.call(this,e),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)}x.prototype._tmp=function(){var e=new s(null);return e.words=new Array(Math.ceil(this.n/13)),e},x.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},x.prototype.split=function(e,t){e.iushrn(this.n,0,t)},x.prototype.imulK=function(e){return e.imul(this.k)},i(A,x),A.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,s=o}s>>>=22,e.words[i-10]=s,0===s&&e.length>10?e.length-=10:e.length-=9},A.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){if(b[e])return b[e];var t;if("k256"===e)t=new A;else if("p224"===e)t=new S;else if("p192"===e)t=new k;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new B}return b[e]=t,t},E.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},E.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},E.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},E.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},E.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},E.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},E.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},E.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},E.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},E.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},E.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},E.prototype.isqr=function(e){return this.imul(e,e.clone())},E.prototype.sqr=function(e){return this.mul(e,e)},E.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),c=a.redNeg(),u=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new s(2*l*l).toRed(this);0!==this.pow(l,u).cmp(c);)l.redIAdd(c);for(var h=this.pow(l,i),f=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=o;0!==d.cmp(a);){for(var y=d,g=0;0!==y.cmp(a);g++)y=y.redSqr();n(g=0;n--){for(var u=t.words[n],l=c-1;l>=0;l--){var h=u>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++a||0===n&&0===l)&&(i=this.mul(i,r[o]),a=0,o=0)):a=0}c=26}return i},E.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},E.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new I(e)},i(I,E),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):i.cmpn(0)<0&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},9441:(e,t,r)=>{"use strict";r.d(t,{Vw:()=>I,DO:()=>c,CC:()=>l,sd:()=>u,Fe:()=>a,Ht:()=>h,My:()=>b,uH:()=>d,Id:()=>E,qj:()=>O,O8:()=>p,aT:()=>S,aY:()=>o,po:()=>_,Ow:()=>y,fd:()=>m,ZJ:()=>B,DH:()=>f,AI:()=>k});var n=r(3846),i=r.t(n,2);const s=i&&"object"==typeof i&&"webcrypto"in i?n.webcrypto:i&&"object"==typeof i&&"randomBytes"in i?i:void 0;function o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function c(e,...t){if(!o(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function u(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.createHasher");a(e.outputLen),a(e.blockLen)}function l(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")}function h(e,t){c(e);const r=t.outputLen;if(e.length>>t}function g(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const m=(()=>68===new Uint8Array(new Uint32Array([287454020]).buffer)[0])()?e=>e:function(e){for(let t=0;t"function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex)(),w=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function b(e){if(c(e),v)return e.toHex();let t="";for(let r=0;r=x._0&&e<=x._9?e-x._0:e>=x.A&&e<=x.F?e-(x.A-10):e>=x.a&&e<=x.f?e-(x.a-10):void 0}function S(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);if(v)return Uint8Array.fromHex(e);const t=e.length,r=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let t=0,i=0;te().update(B(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function _(e=32){if(s&&"function"==typeof s.getRandomValues)return s.getRandomValues(new Uint8Array(e));if(s&&"function"==typeof s.randomBytes)return Uint8Array.from(s.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}},9670:(e,t,r)=>{"use strict";r.d(t,{Q:()=>s});var n=r(638),i=r(7135);function s(e,t="wei"){return(0,i.J)(e,n.sz[t])}},9873:(e,t,r)=>{"use strict";r.d(t,{P:()=>a});var n=r(6447),i=r(4569);const s=/^0x[a-fA-F0-9]{40}$/,o=new n.A(8192);function a(e,t){const{strict:r=!0}=t??{},n=`${e}.${r}`;if(o.has(n))return o.get(n);const a=!(!s.test(e)||e.toLowerCase()!==e&&r&&(0,i.o)(e)!==e);return o.set(n,a),a}},9998:(e,t,r)=>{"use strict";r.d(t,{t:()=>s});var n=r(4706),i=r(4192);function s(e){const{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),s="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,n.aT)(e)):e.blobs,o="string"==typeof e.commitments[0]?e.commitments.map(e=>(0,n.aT)(e)):e.commitments,a=[];for(let e=0;e(0,i.My)(e))}}}]); -//# sourceMappingURL=bundle.52d2885ae469455328a8.js.map \ No newline at end of file diff --git a/export-and-sign/dist/bundle.52d2885ae469455328a8.js.map b/export-and-sign/dist/bundle.52d2885ae469455328a8.js.map deleted file mode 100644 index 67d98d9e..00000000 --- a/export-and-sign/dist/bundle.52d2885ae469455328a8.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"bundle.52d2885ae469455328a8.js","mappings":";8GAEA,MAAMA,EAAO,WACPC,EAAkB,EAAQ,MAc1BC,EAAgB,SAASC,EAAYC,GACzC,KAAKC,gBAAgBH,GACnB,OAAO,IAAIA,EAAcC,EAAYC,GAGlCA,IACHA,EAAU,CAAC,GAGbC,KAAKD,QAAU,CACbE,aAAoC,IAApBF,EAAQE,QAA0BF,EAAQE,QAAU,KACpEC,cAAsC,IAArBH,EAAQG,SAA2BH,EAAQG,SAAW,KACvEC,eAAwC,IAAtBJ,EAAQI,UAA4BJ,EAAQI,UAAY,WAAa,OAAOR,GAAQ,EACtGS,aAAoC,IAApBL,EAAQK,QAA0BL,EAAQK,QAAU,EACpEC,mBAA0D,kBAA/BN,EAAQM,oBAAmCN,EAAQM,oBAGhFL,KAAKF,WAAaA,CACpB,EAEAQ,EAAOC,QAAUV,EAWjBA,EAAcW,UAAUC,QAAU,SAASC,EAAQC,EAAQC,EAAIC,GAC7D,MAAMC,EAAOd,KACb,IAAIS,EAAU,KAGd,MAAMM,EAAUC,MAAMC,QAAQP,IAA6B,mBAAXC,EAEhD,GAA6B,IAAzBX,KAAKD,QAAQK,SAAiBW,EAChC,MAAM,IAAIG,UAAU,0CAMtB,GAAGH,IAFYA,GAAWL,GAA4B,iBAAXA,GAAyC,mBA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CACX,C,uECHO,SAAS4+G,EAAc/pG,GAC1B,MAAM,IAAEspG,GAAQtpG,EACVk3B,EAAKl3B,EAAWk3B,KAAsC,iBAAxBl3B,EAAW+nG,MAAM,GAAkB,MAAQ,SACzEA,EAAwC,iBAAxB/nG,EAAW+nG,MAAM,GACjC/nG,EAAW+nG,MAAM11G,IAAK6oD,IAAM,QAAWA,IACvCl7C,EAAW+nG,MACXC,EAAoD,iBAA9BhoG,EAAWgoG,YAAY,GAC7ChoG,EAAWgoG,YAAY31G,IAAK6oD,IAAM,QAAWA,IAC7Cl7C,EAAWgoG,YACXC,EAAS,GACf,IAAK,IAAI16G,EAAI,EAAGA,EAAIw6G,EAAMl9G,OAAQ0C,IAAK,CACnC,MAAMg8G,EAAOxB,EAAMx6G,GACbipF,EAAawxB,EAAYz6G,GAC/B06G,EAAOj0G,KAAKrH,WAAWsE,KAAKq4G,EAAI6+B,oBAAoB5+B,EAAM/yB,IAC9D,CACA,MAAe,UAAPt/C,EACF+wE,EACAA,EAAO51G,IAAK6oD,IAAM,QAAWA,GACvC,C","sources":["webpack://export-and-sign/./node_modules/jayson/lib/client/browser/index.js","webpack://export-and-sign/./node_modules/uuid/dist/version.js","webpack://export-and-sign/./node_modules/uuid/dist/validate.js","webpack://export-and-sign/./node_modules/pvtsutils/build/index.js","webpack://export-and-sign/./node_modules/eventemitter3/index.js","webpack://export-and-sign/./node_modules/ieee754/index.js","webpack://export-and-sign/./node_modules/bs58check/src/cjs/index.cjs","webpack://export-and-sign/./node_modules/@turnkey/encoding/dist/hex.mjs","webpack://export-and-sign/./node_modules/@turnkey/encoding/dist/bs58.mjs","webpack://export-and-sign/./node_modules/@turnkey/encoding/dist/bs58check.mjs","webpack://export-and-sign/./node_modules/@turnkey/crypto/dist/constants.mjs","webpack://export-and-sign/./node_modules/@turnkey/crypto/dist/crypto.mjs","webpack://export-and-sign/./node_modules/@turnkey/crypto/dist/turnkey.mjs","webpack://export-and-sign/./node_modules/pvutils/build/utils.es.js","webpack://export-and-sign/./node_modules/asn1js/build/index.es.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/enums.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/types/bit_string.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/types/octet_string.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/converters.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/helper.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/storage.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/schema.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/decorators.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/errors/schema_validation.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/parser.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/serializer.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/objects.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-schema/build/es2015/convert.js","webpack://export-and-sign/./node_modules/tslib/modules/index.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/ip_converter.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/name.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/general_name.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/object_identifiers.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_information_access.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_key_identifier.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/basic_constraints.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/general_names.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_issuer.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_policies.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_number.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_delta_indicator.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_distribution_points.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_freshest.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_issuing_distribution_point.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_reason.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/extended_key_usage.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/inhibit_any_policy.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/invalidity_date.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/issuer_alternative_name.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/key_usage.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/name_constraints.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/policy_constraints.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/policy_mappings.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_alternative_name.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/attribute.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_directory_attributes.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_key_identifier.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/private_key_usage_period.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/entrust_version_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_info_access.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/algorithm_identifier.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/subject_public_key_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/time.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/validity.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/extension.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/types.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/tbs_certificate.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/certificate.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/tbs_cert_list.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509/build/es2015/certificate_list.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/issuer_and_serial_number.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/signer_identifier.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/types.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/attribute.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/signer_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/attributes/counter_signature.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/attributes/signing_time.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/aa_clear_attrs.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/attr_spec.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/aa_controls.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/issuer_serial.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/object_digest_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/v2_form.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/attr_cert_issuer.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/attr_cert_validity_period.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/holder.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/attribute_certificate_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/class_list.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/target.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/attribute_certificate.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/security_category.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/clearance.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/ietf_attr_syntax.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/proxy_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/role_syntax.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-x509-attr/build/es2015/svce_auth_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/certificate_choices.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/content_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/encapsulated_content_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/encrypted_content_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/other_key_attribute.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/key_agree_recipient_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/key_trans_recipient_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/kek_recipient_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/password_recipient_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/recipient_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/recipient_infos.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/revocation_info_choice.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/originator_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/enveloped_data.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/object_identifiers.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-cms/build/es2015/signed_data.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/object_identifiers.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/algorithms.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/rfc3279.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/ec_parameters.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/ec_private_key.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-ecc/build/es2015/ec_signature_value.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/object_identifiers.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/algorithms.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsaes_oaep.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsassa_pss.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsassa_pkcs1_v1_5.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/other_prime_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/rsa_private_key.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-rsa/build/es2015/rsa_public_key.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/types/lifecycle.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/class-provider.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/factory-provider.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/lazy-helpers.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/injection-token.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/token-provider.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/value-provider.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/registry-base.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/registry.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/resolution-context.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/interceptors.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/dependency-container.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/providers/provider.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/types/disposable.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/error-helpers.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/decorators/injectable.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/reflection-helpers.js","webpack://export-and-sign/./node_modules/tsyringe/dist/esm5/index.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/attribute.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/authenticated_safe.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/bags/cert_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/bags/crl_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pkcs8/build/es2015/encrypted_private_key_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pkcs8/build/es2015/private_key_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/bags/key_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/bags/pkcs8_shrouded_key_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/bags/secret_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/mac_data.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/pfx.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pfx/build/es2015/safe_bag.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-pkcs9/build/es2015/index.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-csr/build/es2015/attributes.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-csr/build/es2015/certification_request_info.js","webpack://export-and-sign/./node_modules/@peculiar/asn1-csr/build/es2015/certification_request.js","webpack://export-and-sign/./node_modules/@peculiar/x509/build/x509.es.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/pad.js","webpack://export-and-sign/./node_modules/@solana/buffer-layout/lib/Layout.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/abstract/curve.js","webpack://export-and-sign/./node_modules/viem/_esm/constants/unit.js","webpack://export-and-sign/./node_modules/uuid/dist/md5-browser.js","webpack://export-and-sign/./node_modules/uuid/dist/regex.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/errors.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/_dnt.shims.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/algorithm.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/identifiers.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/consts.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/interfaces/kemInterface.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/utils/misc.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/kems/dhkem.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/utils/bignum.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/ec.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/kdfs/hkdf.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js","webpack://export-and-sign/./node_modules/@hpke/common/esm/src/curve/montgomery.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/aeads/aesGcm.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/utils/emitNotSupported.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/exporterContext.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/encryptionContext.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/mutex.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/recipientContext.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/senderContext.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/cipherSuiteNative.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/kems/dhkemNative.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/native.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js","webpack://export-and-sign/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/version.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/base.js","webpack://export-and-sign/./node_modules/uuid/dist/v35.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/utils.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/hash/keccak256.js","webpack://export-and-sign/./node_modules/uuid/dist/index.js","webpack://export-and-sign/./node_modules/uuid/dist/stringify.js","webpack://export-and-sign/./node_modules/bech32/dist/index.js","webpack://export-and-sign/./node_modules/uuid/dist/parse.js","webpack://export-and-sign/./node_modules/cbor-js/cbor.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/abstract/edwards.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/abstract/hash-to-curve.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/ed25519.js","webpack://export-and-sign/./node_modules/@solana/errors/dist/index.browser.mjs","webpack://export-and-sign/./node_modules/@solana/codecs-core/dist/index.browser.mjs","webpack://export-and-sign/./node_modules/@solana/codecs-numbers/dist/index.browser.mjs","webpack://export-and-sign/./node_modules/superstruct/dist/index.mjs","webpack://export-and-sign/./node_modules/rpc-websockets/dist/index.browser.mjs","webpack://export-and-sign/./node_modules/@solana/web3.js/lib/index.browser.esm.js","webpack://export-and-sign/./node_modules/tslib/tslib.js","webpack://export-and-sign/./node_modules/borsh/lib/index.js","webpack://export-and-sign/./node_modules/safe-buffer/index.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/hmac.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/abstract/weierstrass.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/secp256k1.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/_shortw_utils.js","webpack://export-and-sign/./node_modules/bs58check/src/cjs/base.cjs","webpack://export-and-sign/./node_modules/uuid/dist/v3.js","webpack://export-and-sign/./node_modules/jayson/lib/generateRequest.js","webpack://export-and-sign/./node_modules/uuid/dist/v5.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/slice.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/blob.js","webpack://export-and-sign/./node_modules/uuid/dist/v4.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/encoding/toHex.js","webpack://export-and-sign/./node_modules/text-encoding-utf-8/lib/encoding.lib.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/address.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/encoding.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/sha512.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/cursor.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/cursor.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/address/getAddress.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/encoding/toBytes.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/size.js","webpack://export-and-sign/./node_modules/base-x/src/index.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/transaction.js","webpack://export-and-sign/./node_modules/uuid/dist/rng-browser.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/encoding/fromRlp.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/parseTransaction.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/getSerializedTransactionType.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/hash/isHash.js","webpack://export-and-sign/./node_modules/viem/_esm/constants/kzg.js","webpack://export-and-sign/./node_modules/uuid/dist/nil.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/isHex.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/data.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/lru.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/blobsToCommitments.js","webpack://export-and-sign/./node_modules/viem/_esm/constants/blob.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/toBlobSidecars.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/toBlobs.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/encoding/fromHex.js","webpack://export-and-sign/./node_modules/bs58/index.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/unit/formatUnits.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/sha3.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/sign.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/signature/serializeSignature.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/concat.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/encoding/toRlp.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/authorization/hashAuthorization.js","webpack://export-and-sign/./node_modules/viem/_esm/constants/strings.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/signature/hashMessage.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/signature/toPrefixedMessage.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/hash/sha256.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/serializeAccessList.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/serializeTransaction.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/getTransactionType.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/abi.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/regex.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/abi/encodeAbiParameters.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/typedData.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/stringify.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/typedData.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/signature/hashTypedData.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/privateKeyToAccount.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/toAccount.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/signAuthorization.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/signMessage.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/signTransaction.js","webpack://export-and-sign/./node_modules/viem/_esm/accounts/utils/signTypedData.js","webpack://export-and-sign/./node_modules/base64-js/index.js","webpack://export-and-sign/./node_modules/@noble/ed25519/index.js","webpack://export-and-sign/./node_modules/@noble/curves/esm/abstract/modular.js","webpack://export-and-sign/./node_modules/uuid/dist/sha1-browser.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/sha256.js","webpack://export-and-sign/./node_modules/buffer/index.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/_md.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/sha2.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/data/trim.js","webpack://export-and-sign/./node_modules/uuid/dist/v1.js","webpack://export-and-sign/./node_modules/reflect-metadata/Reflect.js","webpack://export-and-sign/./node_modules/viem/_esm/constants/number.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/chain.js","webpack://export-and-sign/./node_modules/viem/_esm/errors/node.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/transaction/assertTransaction.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/_u64.js","webpack://export-and-sign/./node_modules/bn.js/lib/bn.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/cryptoNode.js","webpack://export-and-sign/./node_modules/@noble/hashes/esm/utils.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/unit/formatGwei.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/address/isAddress.js","webpack://export-and-sign/./node_modules/viem/_esm/utils/blob/blobsToProofs.js"],"sourcesContent":["'use strict';\n\nconst uuid = require('uuid').v4;\nconst generateRequest = require('../../generateRequest');\n\n/**\n * Constructor for a Jayson Browser Client that does not depend any node.js core libraries\n * @class ClientBrowser\n * @param {Function} callServer Method that calls the server, receives the stringified request and a regular node-style callback\n * @param {Object} [options]\n * @param {Function} [options.reviver] Reviver function for JSON\n * @param {Function} [options.replacer] Replacer function for JSON\n * @param {Number} [options.version=2] JSON-RPC version to use (1|2)\n * @param {Function} [options.generator] Function to use for generating request IDs\n * @param {Boolean} [options.notificationIdNull=false] When true, version 2 requests will set id to null instead of omitting it\n * @return {ClientBrowser}\n */\nconst ClientBrowser = function(callServer, options) {\n if(!(this instanceof ClientBrowser)) {\n return new ClientBrowser(callServer, options);\n }\n\n if (!options) {\n options = {};\n }\n\n this.options = {\n reviver: typeof options.reviver !== 'undefined' ? options.reviver : null,\n replacer: typeof options.replacer !== 'undefined' ? options.replacer : null,\n generator: typeof options.generator !== 'undefined' ? options.generator : function() { return uuid(); },\n version: typeof options.version !== 'undefined' ? options.version : 2,\n notificationIdNull: typeof options.notificationIdNull === 'boolean' ? options.notificationIdNull : false,\n };\n\n this.callServer = callServer;\n};\n\nmodule.exports = ClientBrowser;\n\n/**\n * Creates a request and dispatches it if given a callback.\n * @param {String|Array} method A batch request if passed an Array, or a method name if passed a String\n * @param {Array|Object} [params] Parameters for the method\n * @param {String|Number} [id] Optional id. If undefined an id will be generated. If null it creates a notification request\n * @param {Function} [callback] Request callback. If specified, executes the request rather than only returning it.\n * @throws {TypeError} Invalid parameters\n * @return {Object} JSON-RPC 1.0 or 2.0 compatible request\n */\nClientBrowser.prototype.request = function(method, params, id, callback) {\n const self = this;\n let request = null;\n\n // is this a batch request?\n const isBatch = Array.isArray(method) && typeof params === 'function';\n\n if (this.options.version === 1 && isBatch) {\n throw new TypeError('JSON-RPC 1.0 does not support batching');\n }\n\n // is this a raw request?\n const isRaw = !isBatch && method && typeof method === 'object' && typeof params === 'function';\n\n if(isBatch || isRaw) {\n callback = params;\n request = method;\n } else {\n if(typeof id === 'function') {\n callback = id;\n // specifically undefined because \"null\" is a notification request\n id = undefined;\n }\n\n const hasCallback = typeof callback === 'function';\n\n try {\n request = generateRequest(method, params, id, {\n generator: this.options.generator,\n version: this.options.version,\n notificationIdNull: this.options.notificationIdNull,\n });\n } catch(err) {\n if(hasCallback) {\n callback(err);\n return;\n }\n throw err;\n }\n\n // no callback means we should just return a raw request\n if(!hasCallback) {\n return request;\n }\n\n }\n\n let message;\n try {\n message = JSON.stringify(request, this.options.replacer);\n } catch(err) {\n callback(err);\n return;\n }\n\n this.callServer(message, function(err, response) {\n self._parseResponse(err, response, callback);\n });\n\n // always return the raw request\n return request;\n};\n\n/**\n * Parses a response from a server\n * @param {Object} err Error to pass on that is unrelated to the actual response\n * @param {String} responseText JSON-RPC 1.0 or 2.0 response\n * @param {Function} callback Callback that will receive different arguments depending on the amount of parameters\n * @private\n */\nClientBrowser.prototype._parseResponse = function(err, responseText, callback) {\n if(err) {\n callback(err);\n return;\n }\n\n if(!responseText) {\n // empty response text, assume that is correct because it could be a\n // notification which jayson does not give any body for\n callback();\n return;\n }\n\n let response;\n try {\n response = JSON.parse(responseText, this.options.reviver);\n } catch(err) {\n callback(err);\n return;\n }\n\n if(callback.length === 3) {\n // if callback length is 3, we split callback arguments on error and response\n\n // is batch response?\n if(Array.isArray(response)) {\n\n // necessary to split strictly on validity according to spec here\n const isError = function(res) {\n return typeof res.error !== 'undefined';\n };\n\n const isNotError = function (res) {\n return !isError(res);\n };\n\n callback(null, response.filter(isError), response.filter(isNotError));\n return;\n } else {\n\n // split regardless of validity\n callback(null, response.error, response.result);\n return;\n }\n \n }\n\n callback(null, response);\n};\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction version(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n return parseInt(uuid.substr(14, 1), 16);\n}\n\nvar _default = version;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _regex = _interopRequireDefault(require(\"./regex.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction validate(uuid) {\n return typeof uuid === 'string' && _regex.default.test(uuid);\n}\n\nvar _default = validate;\nexports.default = _default;","/*!\n * MIT License\n * \n * Copyright (c) 2017-2024 Peculiar Ventures, LLC\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n * \n */\n\n'use strict';\n\nconst ARRAY_BUFFER_NAME = \"[object ArrayBuffer]\";\nclass BufferSourceConverter {\n static isArrayBuffer(data) {\n return Object.prototype.toString.call(data) === ARRAY_BUFFER_NAME;\n }\n static toArrayBuffer(data) {\n if (this.isArrayBuffer(data)) {\n return data;\n }\n if (data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {\n return data.buffer;\n }\n return this.toUint8Array(data.buffer)\n .slice(data.byteOffset, data.byteOffset + data.byteLength)\n .buffer;\n }\n static toUint8Array(data) {\n return this.toView(data, Uint8Array);\n }\n static toView(data, type) {\n if (data.constructor === type) {\n return data;\n }\n if (this.isArrayBuffer(data)) {\n return new type(data);\n }\n if (this.isArrayBufferView(data)) {\n return new type(data.buffer, data.byteOffset, data.byteLength);\n }\n throw new TypeError(\"The provided value is not of type '(ArrayBuffer or ArrayBufferView)'\");\n }\n static isBufferSource(data) {\n return this.isArrayBufferView(data)\n || this.isArrayBuffer(data);\n }\n static isArrayBufferView(data) {\n return ArrayBuffer.isView(data)\n || (data && this.isArrayBuffer(data.buffer));\n }\n static isEqual(a, b) {\n const aView = BufferSourceConverter.toUint8Array(a);\n const bView = BufferSourceConverter.toUint8Array(b);\n if (aView.length !== bView.byteLength) {\n return false;\n }\n for (let i = 0; i < aView.length; i++) {\n if (aView[i] !== bView[i]) {\n return false;\n }\n }\n return true;\n }\n static concat(...args) {\n let buffers;\n if (Array.isArray(args[0]) && !(args[1] instanceof Function)) {\n buffers = args[0];\n }\n else if (Array.isArray(args[0]) && args[1] instanceof Function) {\n buffers = args[0];\n }\n else {\n if (args[args.length - 1] instanceof Function) {\n buffers = args.slice(0, args.length - 1);\n }\n else {\n buffers = args;\n }\n }\n let size = 0;\n for (const buffer of buffers) {\n size += buffer.byteLength;\n }\n const res = new Uint8Array(size);\n let offset = 0;\n for (const buffer of buffers) {\n const view = this.toUint8Array(buffer);\n res.set(view, offset);\n offset += view.length;\n }\n if (args[args.length - 1] instanceof Function) {\n return this.toView(res, args[args.length - 1]);\n }\n return res.buffer;\n }\n}\n\nconst STRING_TYPE = \"string\";\nconst HEX_REGEX = /^[0-9a-f\\s]+$/i;\nconst BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;\nconst BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/;\nclass Utf8Converter {\n static fromString(text) {\n const s = unescape(encodeURIComponent(text));\n const uintArray = new Uint8Array(s.length);\n for (let i = 0; i < s.length; i++) {\n uintArray[i] = s.charCodeAt(i);\n }\n return uintArray.buffer;\n }\n static toString(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let encodedString = \"\";\n for (let i = 0; i < buf.length; i++) {\n encodedString += String.fromCharCode(buf[i]);\n }\n const decodedString = decodeURIComponent(escape(encodedString));\n return decodedString;\n }\n}\nclass Utf16Converter {\n static toString(buffer, littleEndian = false) {\n const arrayBuffer = BufferSourceConverter.toArrayBuffer(buffer);\n const dataView = new DataView(arrayBuffer);\n let res = \"\";\n for (let i = 0; i < arrayBuffer.byteLength; i += 2) {\n const code = dataView.getUint16(i, littleEndian);\n res += String.fromCharCode(code);\n }\n return res;\n }\n static fromString(text, littleEndian = false) {\n const res = new ArrayBuffer(text.length * 2);\n const dataView = new DataView(res);\n for (let i = 0; i < text.length; i++) {\n dataView.setUint16(i * 2, text.charCodeAt(i), littleEndian);\n }\n return res;\n }\n}\nclass Convert {\n static isHex(data) {\n return typeof data === STRING_TYPE\n && HEX_REGEX.test(data);\n }\n static isBase64(data) {\n return typeof data === STRING_TYPE\n && BASE64_REGEX.test(data);\n }\n static isBase64Url(data) {\n return typeof data === STRING_TYPE\n && BASE64URL_REGEX.test(data);\n }\n static ToString(buffer, enc = \"utf8\") {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.ToUtf8String(buf);\n case \"binary\":\n return this.ToBinary(buf);\n case \"hex\":\n return this.ToHex(buf);\n case \"base64\":\n return this.ToBase64(buf);\n case \"base64url\":\n return this.ToBase64Url(buf);\n case \"utf16le\":\n return Utf16Converter.toString(buf, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buf);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static FromString(str, enc = \"utf8\") {\n if (!str) {\n return new ArrayBuffer(0);\n }\n switch (enc.toLowerCase()) {\n case \"utf8\":\n return this.FromUtf8String(str);\n case \"binary\":\n return this.FromBinary(str);\n case \"hex\":\n return this.FromHex(str);\n case \"base64\":\n return this.FromBase64(str);\n case \"base64url\":\n return this.FromBase64Url(str);\n case \"utf16le\":\n return Utf16Converter.fromString(str, true);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(str);\n default:\n throw new Error(`Unknown type of encoding '${enc}'`);\n }\n }\n static ToBase64(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n if (typeof btoa !== \"undefined\") {\n const binary = this.ToString(buf, \"binary\");\n return btoa(binary);\n }\n else {\n return Buffer.from(buf).toString(\"base64\");\n }\n }\n static FromBase64(base64) {\n const formatted = this.formatString(base64);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64(formatted)) {\n throw new TypeError(\"Argument 'base64Text' is not Base64 encoded\");\n }\n if (typeof atob !== \"undefined\") {\n return this.FromBinary(atob(formatted));\n }\n else {\n return new Uint8Array(Buffer.from(formatted, \"base64\")).buffer;\n }\n }\n static FromBase64Url(base64url) {\n const formatted = this.formatString(base64url);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isBase64Url(formatted)) {\n throw new TypeError(\"Argument 'base64url' is not Base64Url encoded\");\n }\n return this.FromBase64(this.Base64Padding(formatted.replace(/\\-/g, \"+\").replace(/\\_/g, \"/\")));\n }\n static ToBase64Url(data) {\n return this.ToBase64(data).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/\\=/g, \"\");\n }\n static FromUtf8String(text, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.FromBinary(text);\n case \"utf8\":\n return Utf8Converter.fromString(text);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.fromString(text);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.fromString(text, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static ToUtf8String(buffer, encoding = Convert.DEFAULT_UTF8_ENCODING) {\n switch (encoding) {\n case \"ascii\":\n return this.ToBinary(buffer);\n case \"utf8\":\n return Utf8Converter.toString(buffer);\n case \"utf16\":\n case \"utf16be\":\n return Utf16Converter.toString(buffer);\n case \"utf16le\":\n case \"usc2\":\n return Utf16Converter.toString(buffer, true);\n default:\n throw new Error(`Unknown type of encoding '${encoding}'`);\n }\n }\n static FromBinary(text) {\n const stringLength = text.length;\n const resultView = new Uint8Array(stringLength);\n for (let i = 0; i < stringLength; i++) {\n resultView[i] = text.charCodeAt(i);\n }\n return resultView.buffer;\n }\n static ToBinary(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let res = \"\";\n for (let i = 0; i < buf.length; i++) {\n res += String.fromCharCode(buf[i]);\n }\n return res;\n }\n static ToHex(buffer) {\n const buf = BufferSourceConverter.toUint8Array(buffer);\n let result = \"\";\n const len = buf.length;\n for (let i = 0; i < len; i++) {\n const byte = buf[i];\n if (byte < 16) {\n result += \"0\";\n }\n result += byte.toString(16);\n }\n return result;\n }\n static FromHex(hexString) {\n let formatted = this.formatString(hexString);\n if (!formatted) {\n return new ArrayBuffer(0);\n }\n if (!Convert.isHex(formatted)) {\n throw new TypeError(\"Argument 'hexString' is not HEX encoded\");\n }\n if (formatted.length % 2) {\n formatted = `0${formatted}`;\n }\n const res = new Uint8Array(formatted.length / 2);\n for (let i = 0; i < formatted.length; i = i + 2) {\n const c = formatted.slice(i, i + 2);\n res[i / 2] = parseInt(c, 16);\n }\n return res.buffer;\n }\n static ToUtf16String(buffer, littleEndian = false) {\n return Utf16Converter.toString(buffer, littleEndian);\n }\n static FromUtf16String(text, littleEndian = false) {\n return Utf16Converter.fromString(text, littleEndian);\n }\n static Base64Padding(base64) {\n const padCount = 4 - (base64.length % 4);\n if (padCount < 4) {\n for (let i = 0; i < padCount; i++) {\n base64 += \"=\";\n }\n }\n return base64;\n }\n static formatString(data) {\n return (data === null || data === void 0 ? void 0 : data.replace(/[\\n\\r\\t ]/g, \"\")) || \"\";\n }\n}\nConvert.DEFAULT_UTF8_ENCODING = \"utf8\";\n\nfunction assign(target, ...sources) {\n const res = arguments[0];\n for (let i = 1; i < arguments.length; i++) {\n const obj = arguments[i];\n for (const prop in obj) {\n res[prop] = obj[prop];\n }\n }\n return res;\n}\nfunction combine(...buf) {\n const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur);\n const res = new Uint8Array(totalByteLength);\n let currentPos = 0;\n buf.map((item) => new Uint8Array(item)).forEach((arr) => {\n for (const item2 of arr) {\n res[currentPos++] = item2;\n }\n });\n return res.buffer;\n}\nfunction isEqual(bytes1, bytes2) {\n if (!(bytes1 && bytes2)) {\n return false;\n }\n if (bytes1.byteLength !== bytes2.byteLength) {\n return false;\n }\n const b1 = new Uint8Array(bytes1);\n const b2 = new Uint8Array(bytes2);\n for (let i = 0; i < bytes1.byteLength; i++) {\n if (b1[i] !== b2[i]) {\n return false;\n }\n }\n return true;\n}\n\nexports.BufferSourceConverter = BufferSourceConverter;\nexports.Convert = Convert;\nexports.assign = assign;\nexports.combine = combine;\nexports.isEqual = isEqual;\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty\n , prefix = '~';\n\n/**\n * Constructor to create a storage for our `EE` objects.\n * An `Events` instance is a plain object whose properties are event names.\n *\n * @constructor\n * @private\n */\nfunction Events() {}\n\n//\n// We try to not inherit from `Object.prototype`. In some engines creating an\n// instance in this way is faster than calling `Object.create(null)` directly.\n// If `Object.create(null)` is not supported we prefix the event names with a\n// character to make sure that the built-in object properties are not\n// overridden or used as an attack vector.\n//\nif (Object.create) {\n Events.prototype = Object.create(null);\n\n //\n // This hack is needed because the `__proto__` property is still inherited in\n // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.\n //\n if (!new Events().__proto__) prefix = false;\n}\n\n/**\n * Representation of a single event listener.\n *\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} [once=false] Specify if the listener is a one-time listener.\n * @constructor\n * @private\n */\nfunction EE(fn, context, once) {\n this.fn = fn;\n this.context = context;\n this.once = once || false;\n}\n\n/**\n * Add a listener for a given event.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} context The context to invoke the listener with.\n * @param {Boolean} once Specify if the listener is a one-time listener.\n * @returns {EventEmitter}\n * @private\n */\nfunction addListener(emitter, event, fn, context, once) {\n if (typeof fn !== 'function') {\n throw new TypeError('The listener must be a function');\n }\n\n var listener = new EE(fn, context || emitter, once)\n , evt = prefix ? prefix + event : event;\n\n if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;\n else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);\n else emitter._events[evt] = [emitter._events[evt], listener];\n\n return emitter;\n}\n\n/**\n * Clear event by name.\n *\n * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.\n * @param {(String|Symbol)} evt The Event name.\n * @private\n */\nfunction clearEvent(emitter, evt) {\n if (--emitter._eventsCount === 0) emitter._events = new Events();\n else delete emitter._events[evt];\n}\n\n/**\n * Minimal `EventEmitter` interface that is molded against the Node.js\n * `EventEmitter` interface.\n *\n * @constructor\n * @public\n */\nfunction EventEmitter() {\n this._events = new Events();\n this._eventsCount = 0;\n}\n\n/**\n * Return an array listing the events for which the emitter has registered\n * listeners.\n *\n * @returns {Array}\n * @public\n */\nEventEmitter.prototype.eventNames = function eventNames() {\n var names = []\n , events\n , name;\n\n if (this._eventsCount === 0) return names;\n\n for (name in (events = this._events)) {\n if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);\n }\n\n if (Object.getOwnPropertySymbols) {\n return names.concat(Object.getOwnPropertySymbols(events));\n }\n\n return names;\n};\n\n/**\n * Return the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Array} The registered listeners.\n * @public\n */\nEventEmitter.prototype.listeners = function listeners(event) {\n var evt = prefix ? prefix + event : event\n , handlers = this._events[evt];\n\n if (!handlers) return [];\n if (handlers.fn) return [handlers.fn];\n\n for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {\n ee[i] = handlers[i].fn;\n }\n\n return ee;\n};\n\n/**\n * Return the number of listeners listening to a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Number} The number of listeners.\n * @public\n */\nEventEmitter.prototype.listenerCount = function listenerCount(event) {\n var evt = prefix ? prefix + event : event\n , listeners = this._events[evt];\n\n if (!listeners) return 0;\n if (listeners.fn) return 1;\n return listeners.length;\n};\n\n/**\n * Calls each of the listeners registered for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @returns {Boolean} `true` if the event had listeners, else `false`.\n * @public\n */\nEventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return false;\n\n var listeners = this._events[evt]\n , len = arguments.length\n , args\n , i;\n\n if (listeners.fn) {\n if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);\n\n switch (len) {\n case 1: return listeners.fn.call(listeners.context), true;\n case 2: return listeners.fn.call(listeners.context, a1), true;\n case 3: return listeners.fn.call(listeners.context, a1, a2), true;\n case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;\n case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;\n case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;\n }\n\n for (i = 1, args = new Array(len -1); i < len; i++) {\n args[i - 1] = arguments[i];\n }\n\n listeners.fn.apply(listeners.context, args);\n } else {\n var length = listeners.length\n , j;\n\n for (i = 0; i < length; i++) {\n if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);\n\n switch (len) {\n case 1: listeners[i].fn.call(listeners[i].context); break;\n case 2: listeners[i].fn.call(listeners[i].context, a1); break;\n case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;\n case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;\n default:\n if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {\n args[j - 1] = arguments[j];\n }\n\n listeners[i].fn.apply(listeners[i].context, args);\n }\n }\n }\n\n return true;\n};\n\n/**\n * Add a listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.on = function on(event, fn, context) {\n return addListener(this, event, fn, context, false);\n};\n\n/**\n * Add a one-time listener for a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn The listener function.\n * @param {*} [context=this] The context to invoke the listener with.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.once = function once(event, fn, context) {\n return addListener(this, event, fn, context, true);\n};\n\n/**\n * Remove the listeners of a given event.\n *\n * @param {(String|Symbol)} event The event name.\n * @param {Function} fn Only remove the listeners that match this function.\n * @param {*} context Only remove the listeners that have this context.\n * @param {Boolean} once Only remove one-time listeners.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {\n var evt = prefix ? prefix + event : event;\n\n if (!this._events[evt]) return this;\n if (!fn) {\n clearEvent(this, evt);\n return this;\n }\n\n var listeners = this._events[evt];\n\n if (listeners.fn) {\n if (\n listeners.fn === fn &&\n (!once || listeners.once) &&\n (!context || listeners.context === context)\n ) {\n clearEvent(this, evt);\n }\n } else {\n for (var i = 0, events = [], length = listeners.length; i < length; i++) {\n if (\n listeners[i].fn !== fn ||\n (once && !listeners[i].once) ||\n (context && listeners[i].context !== context)\n ) {\n events.push(listeners[i]);\n }\n }\n\n //\n // Reset the array, or remove it completely if we have no more listeners.\n //\n if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;\n else clearEvent(this, evt);\n }\n\n return this;\n};\n\n/**\n * Remove all listeners, or those of the specified event.\n *\n * @param {(String|Symbol)} [event] The event name.\n * @returns {EventEmitter} `this`.\n * @public\n */\nEventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {\n var evt;\n\n if (event) {\n evt = prefix ? prefix + event : event;\n if (this._events[evt]) clearEvent(this, evt);\n } else {\n this._events = new Events();\n this._eventsCount = 0;\n }\n\n return this;\n};\n\n//\n// Alias methods names because people roll like that.\n//\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\nEventEmitter.prototype.addListener = EventEmitter.prototype.on;\n\n//\n// Expose the prefix.\n//\nEventEmitter.prefixed = prefix;\n\n//\n// Allow `EventEmitter` to be imported as module namespace.\n//\nEventEmitter.EventEmitter = EventEmitter;\n\n//\n// Expose the module.\n//\nif ('undefined' !== typeof module) {\n module.exports = EventEmitter;\n}\n","/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */\nexports.read = function (buffer, offset, isLE, mLen, nBytes) {\n var e, m\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var nBits = -7\n var i = isLE ? (nBytes - 1) : 0\n var d = isLE ? -1 : 1\n var s = buffer[offset + i]\n\n i += d\n\n e = s & ((1 << (-nBits)) - 1)\n s >>= (-nBits)\n nBits += eLen\n for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n m = e & ((1 << (-nBits)) - 1)\n e >>= (-nBits)\n nBits += mLen\n for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}\n\n if (e === 0) {\n e = 1 - eBias\n } else if (e === eMax) {\n return m ? NaN : ((s ? -1 : 1) * Infinity)\n } else {\n m = m + Math.pow(2, mLen)\n e = e - eBias\n }\n return (s ? -1 : 1) * m * Math.pow(2, e - mLen)\n}\n\nexports.write = function (buffer, value, offset, isLE, mLen, nBytes) {\n var e, m, c\n var eLen = (nBytes * 8) - mLen - 1\n var eMax = (1 << eLen) - 1\n var eBias = eMax >> 1\n var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)\n var i = isLE ? 0 : (nBytes - 1)\n var d = isLE ? 1 : -1\n var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0\n\n value = Math.abs(value)\n\n if (isNaN(value) || value === Infinity) {\n m = isNaN(value) ? 1 : 0\n e = eMax\n } else {\n e = Math.floor(Math.log(value) / Math.LN2)\n if (value * (c = Math.pow(2, -e)) < 1) {\n e--\n c *= 2\n }\n if (e + eBias >= 1) {\n value += rt / c\n } else {\n value += rt * Math.pow(2, 1 - eBias)\n }\n if (value * c >= 2) {\n e++\n c /= 2\n }\n\n if (e + eBias >= eMax) {\n m = 0\n e = eMax\n } else if (e + eBias >= 1) {\n m = ((value * c) - 1) * Math.pow(2, mLen)\n e = e + eBias\n } else {\n m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)\n e = 0\n }\n }\n\n for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}\n\n e = (e << mLen) | m\n eLen += mLen\n for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}\n\n buffer[offset + i - d] |= s * 128\n}\n","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar sha256_1 = require(\"@noble/hashes/sha256\");\nvar base_js_1 = __importDefault(require(\"./base.cjs\"));\n// SHA256(SHA256(buffer))\nfunction sha256x2(buffer) {\n return (0, sha256_1.sha256)((0, sha256_1.sha256)(buffer));\n}\nexports.default = (0, base_js_1.default)(sha256x2);\n","/**\n * Converts a Uint8Array into a lowercase hex string.\n *\n * @param {Uint8Array} input - The input byte array.\n * @returns {string} - The resulting hex string.\n */\nfunction uint8ArrayToHexString(input) {\n return input.reduce((result, x) => result + x.toString(16).padStart(2, \"0\"), \"\");\n}\n/**\n * Creates a Uint8Array from a hex string.\n *\n * @param {string} hexString - The input hex string.\n * @param {number} [length] - Optional target length for the output. If specified,\n * the result will be padded with leading 0s or throw if it overflows.\n * @returns {Uint8Array} - The resulting byte array.\n * @throws {Error} - If the hex string is invalid or too long for the specified length.\n */\nconst uint8ArrayFromHexString = (hexString, length) => {\n const hexRegex = /^[0-9A-Fa-f]+$/;\n if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) {\n throw new Error(`cannot create uint8array from invalid hex string: \"${hexString}\"`);\n }\n const buffer = new Uint8Array(hexString.match(/../g).map((h) => parseInt(h, 16)));\n if (!length) {\n return buffer;\n }\n if (hexString.length / 2 > length) {\n throw new Error(\"hex value cannot fit in a buffer of \" + length + \" byte(s)\");\n }\n // If a length is specified, ensure we sufficiently pad\n let paddedBuffer = new Uint8Array(length);\n paddedBuffer.set(buffer, length - buffer.length);\n return paddedBuffer;\n};\n/**\n * Converts a hex string to an ASCII string.\n * @param {string} hexString - The input hex string to convert.\n * @returns {string} - The converted ASCII string.\n */\nfunction hexToAscii(hexString) {\n let asciiStr = \"\";\n for (let i = 0; i < hexString.length; i += 2) {\n asciiStr += String.fromCharCode(parseInt(hexString.substr(i, 2), 16));\n }\n return asciiStr;\n}\n/**\n * Function to normalize padding of byte array with 0's to a target length.\n *\n * @param {Uint8Array} byteArray - The byte array to pad or trim.\n * @param {number} targetLength - The target length after padding or trimming.\n * @returns {Uint8Array} - The normalized byte array.\n */\nconst normalizePadding = (byteArray, targetLength) => {\n const paddingLength = targetLength - byteArray.length;\n // Add leading 0's to array\n if (paddingLength > 0) {\n const padding = new Uint8Array(paddingLength).fill(0);\n return new Uint8Array([...padding, ...byteArray]);\n }\n // Remove leading 0's from array\n if (paddingLength < 0) {\n const expectedZeroCount = paddingLength * -1;\n let zeroCount = 0;\n for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) {\n if (byteArray[i] === 0) {\n zeroCount++;\n }\n }\n // Check if the number of zeros found equals the number of zeroes expected\n if (zeroCount !== expectedZeroCount) {\n throw new Error(`invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`);\n }\n return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength);\n }\n return byteArray;\n};\n\nexport { hexToAscii, normalizePadding, uint8ArrayFromHexString, uint8ArrayToHexString };\n//# sourceMappingURL=hex.mjs.map\n","import * as raw from 'bs58';\n\n// This is a temporary shim for bs58@6.0.0\n//\n// This issue is similar to the one described here: https://github.com/bitcoinjs/bs58check/issues/47\n//\n// bs58 v6.0.0 uses ESM with only a default export, which causes compatibility\n// issues with Metro (React Native). When importing the package using\n// `import bs58 from 'bs58'`, Metro applies multiple levels of wrapping,\n// resulting in a structure like `{ default: { default: { encode, decode, ... } } }`.\n//\n// This shim unwraps the exports until it reaches the object that contains `.decode`,\n// `.encode`, and `.decodeUnsafe`, allowing consistent usage across platforms.\n//\n// We can remove this shim once bs58 publishes a version that properly re-exports\n// named methods from its ESM build.\nfunction unwrap(obj) {\n let cur = obj;\n while (cur &&\n !(cur.encode && cur.decode && cur.decodeUnsafe) &&\n cur.default) {\n cur = cur.default;\n }\n return cur;\n}\nconst bs58 = unwrap(raw);\n\nexport { bs58 };\n//# sourceMappingURL=bs58.mjs.map\n","import * as raw from 'bs58check';\n\n// This is a temporary shim for bs58check@4.0.0\n//\n// See: https://github.com/bitcoinjs/bs58check/issues/47\n//\n// bs58check v4.0.0 uses ESM with only a default export, which causes compatibility\n// issues with Metro (React Native). When importing the package using\n// `import bs58check from 'bs58check'`, Metro applies multiple levels of wrapping,\n// resulting in a structure like `{ default: { default: { encode, decode, ... } } }`.\n//\n// This shim unwraps the exports until it reaches the object that contains `.decode`,\n// `.encode`, and `.decodeUnsafe`, allowing consistent usage across platforms.\n//\n// We can remove this shim once bs58check publishes a version that properly re-exports\n// named methods from its ESM build\nfunction unwrap(obj) {\n let cur = obj;\n while (cur &&\n !(cur.encode && cur.decode && cur.decodeUnsafe) &&\n cur.default) {\n cur = cur.default;\n }\n return cur;\n}\nconst bs58check = unwrap(raw);\n\nexport { bs58check };\n//# sourceMappingURL=bs58check.mjs.map\n","const SUITE_ID_1 = new Uint8Array([75, 69, 77, 0, 16]); //KEM suite ID\nconst SUITE_ID_2 = new Uint8Array([72, 80, 75, 69, 0, 16, 0, 1, 0, 2]); //HPKE suite ID\nconst HPKE_VERSION = new Uint8Array([72, 80, 75, 69, 45, 118, 49]); //HPKE-v1\nconst LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]); //secret\nconst LABEL_EAE_PRK = new Uint8Array([101, 97, 101, 95, 112, 114, 107]); //eae_prk\nconst LABEL_SHARED_SECRET = new Uint8Array([\n 115, 104, 97, 114, 101, 100, 95, 115, 101, 99, 114, 101, 116,\n]); //shared_secret\nconst AES_KEY_INFO = new Uint8Array([\n 0, 32, 72, 80, 75, 69, 45, 118, 49, 72, 80, 75, 69, 0, 16, 0, 1, 0, 2, 107,\n 101, 121, 0, 143, 195, 174, 184, 50, 73, 10, 75, 90, 179, 228, 32, 35, 40,\n 125, 178, 154, 31, 75, 199, 194, 34, 192, 223, 34, 135, 39, 183, 10, 64, 33,\n 18, 47, 63, 4, 233, 32, 108, 209, 36, 19, 80, 53, 41, 180, 122, 198, 166, 48,\n 185, 46, 196, 207, 125, 35, 69, 8, 208, 175, 151, 113, 201, 158, 80,\n]); //key\nconst IV_INFO = new Uint8Array([\n 0, 12, 72, 80, 75, 69, 45, 118, 49, 72, 80, 75, 69, 0, 16, 0, 1, 0, 2, 98, 97,\n 115, 101, 95, 110, 111, 110, 99, 101, 0, 143, 195, 174, 184, 50, 73, 10, 75,\n 90, 179, 228, 32, 35, 40, 125, 178, 154, 31, 75, 199, 194, 34, 192, 223, 34,\n 135, 39, 183, 10, 64, 33, 18, 47, 63, 4, 233, 32, 108, 209, 36, 19, 80, 53,\n 41, 180, 122, 198, 166, 48, 185, 46, 196, 207, 125, 35, 69, 8, 208, 175, 151,\n 113, 201, 158, 80,\n]); //base_nonce\nconst QUORUM_ENCRYPT_NONCE_LENGTH_BYTES = 12;\nconst UNCOMPRESSED_PUB_KEY_LENGTH_BYTES = 65;\nconst QOS_ENCRYPTION_HMAC_MESSAGE = new TextEncoder().encode(\"qos_encryption_hmac_message\"); // used for encrypting messages to quorum keys matched whats found here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L22\nconst PRODUCTION_SIGNER_SIGN_PUBLIC_KEY = \"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\";\nconst PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY = \"04d498aa87ac3bf982ac2b5dd9604d0074905cfbda5d62727c5a237b895e6749205e9f7cd566909c4387f6ca25c308445c60884b788560b785f4a96ac33702a469\";\nconst PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY = \"045e899f1fcf7d12b3c8fd997a7a43bb853dd4e8d63419a8f867c70aacc1c4cf9d04848baca41f0c85ffbbd23cbf78967501cd8eca9e4a6369370a9a38f70d13c0\";\nconst PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY = \"02336ebd7e929ef64b87c776b72540255b4c7b41579a24b1e68fb060daa873f9f6\";\n// Pinned AWS Nitro Enclaves Root\nconst AWS_ROOT_CERT_PEM = `-----BEGIN CERTIFICATE-----\nMIICETCCAZagAwIBAgIRAPkxdWgbkK/hHUbMtOTn+FYwCgYIKoZIzj0EAwMwSTEL\nMAkGA1UEBhMCVVMxDzANBgNVBAoMBkFtYXpvbjEMMAoGA1UECwwDQVdTMRswGQYD\nVQQDDBJhd3Mubml0cm8tZW5jbGF2ZXMwHhcNMTkxMDI4MTMyODA1WhcNNDkxMDI4\nMTQyODA1WjBJMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGQW1hem9uMQwwCgYDVQQL\nDANBV1MxGzAZBgNVBAMMEmF3cy5uaXRyby1lbmNsYXZlczB2MBAGByqGSM49AgEG\nBSuBBAAiA2IABPwCVOumCMHzaHDimtqQvkY4MpJzbolL//Zy2YlES1BR5TSksfbb\n48C8WBoyt7F2Bw7eEtaaP+ohG2bnUs990d0JX28TcPQXCEPZ3BABIeTPYwEoCWZE\nh8l5YoQwTcU/9KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkCW1DdkF\nR+eWw5b6cp3PmanfS5YwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYC\nMQCjfy+Rocm9Xue4YnwWmNJVA44fA0P5W2OpYow9OYCVRaEevL8uO1XYru5xtMPW\nrfMCMQCi85sWBbJwKKXdS6BptQFuZbT73o/gBh1qUxl/nNr12UO8Yfwr6wPLb+6N\nIwLz3/Y=\n-----END CERTIFICATE-----`;\n// Official SHA-256 fingerprint\nconst AWS_ROOT_CERT_SHA256 = \"641A0321A3E244EFE456463195D606317ED7CDCC3C1756E09893F3C68F79BB5B\";\n\nexport { AES_KEY_INFO, AWS_ROOT_CERT_PEM, AWS_ROOT_CERT_SHA256, HPKE_VERSION, IV_INFO, LABEL_EAE_PRK, LABEL_SECRET, LABEL_SHARED_SECRET, PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY, PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY, PRODUCTION_SIGNER_SIGN_PUBLIC_KEY, PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY, QOS_ENCRYPTION_HMAC_MESSAGE, QUORUM_ENCRYPT_NONCE_LENGTH_BYTES, SUITE_ID_1, SUITE_ID_2, UNCOMPRESSED_PUB_KEY_LENGTH_BYTES };\n//# sourceMappingURL=constants.mjs.map\n","import { p256 } from '@noble/curves/p256';\nimport * as hkdf from '@noble/hashes/hkdf';\nimport { sha256 } from '@noble/hashes/sha256';\nimport { gcm } from '@noble/ciphers/aes';\nimport { randomBytes } from '@noble/hashes/utils';\nimport * as borsh from 'borsh';\nimport { uint8ArrayFromHexString, uint8ArrayToHexString, normalizePadding } from '@turnkey/encoding';\nimport { modSqrt, testBit } from './math.mjs';\nimport { LABEL_EAE_PRK, SUITE_ID_1, LABEL_SHARED_SECRET, LABEL_SECRET, SUITE_ID_2, AES_KEY_INFO, IV_INFO, UNCOMPRESSED_PUB_KEY_LENGTH_BYTES, QUORUM_ENCRYPT_NONCE_LENGTH_BYTES, HPKE_VERSION, QOS_ENCRYPTION_HMAC_MESSAGE } from './constants.mjs';\n\n/// \n// schema for borsh serialization\nconst EnvelopeSchema = {\n struct: {\n nonce: { array: { type: \"u8\", len: QUORUM_ENCRYPT_NONCE_LENGTH_BYTES } },\n ephemeralSenderPublic: {\n array: { type: \"u8\", len: UNCOMPRESSED_PUB_KEY_LENGTH_BYTES },\n },\n encryptedMessage: { array: { type: \"u8\" } },\n },\n};\n/**\n * Get PublicKey function\n * Derives public key from Uint8Array or hexstring private key\n *\n * @param {Uint8Array | string} privateKey - The Uint8Array or hexstring representation of a compressed private key.\n * @param {boolean} isCompressed - Specifies whether to return a compressed or uncompressed public key. Defaults to true.\n * @returns {Uint8Array} - The public key in Uin8Array representation.\n */\nconst getPublicKey = (privateKey, isCompressed = true) => {\n return p256.getPublicKey(privateKey, isCompressed);\n};\n/**\n * HPKE Encrypt Function\n * Encrypts data using Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/.\n *\n * @param {HpkeEncryptParams} params - The encryption parameters including plain text, encapsulated key, and sender private key.\n * @returns {Uint8Array} - The encrypted data.\n */\nconst hpkeEncrypt = ({ plainTextBuf, targetKeyBuf, }) => {\n try {\n // Standard HPKE Mode (Ephemeral Key Pair)\n const ephemeralKeyPair = generateP256KeyPair();\n const senderPrivBuf = uint8ArrayFromHexString(ephemeralKeyPair.privateKey);\n const senderPubBuf = uint8ArrayFromHexString(ephemeralKeyPair.publicKeyUncompressed);\n const aad = buildAdditionalAssociatedData(senderPubBuf, targetKeyBuf);\n // Step 1: Generate Shared Secret\n const ss = deriveSS(targetKeyBuf, uint8ArrayToHexString(senderPrivBuf));\n // Step 2: Generate the KEM context\n const kemContext = getKemContext(senderPubBuf, uint8ArrayToHexString(targetKeyBuf));\n // Step 3: Build the HKDF inputs for key derivation\n let ikm = buildLabeledIkm(LABEL_EAE_PRK, ss, SUITE_ID_1);\n let info = buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, SUITE_ID_1, 32);\n const sharedSecret = extractAndExpand(new Uint8Array([]), ikm, info, 32);\n // Step 4: Derive the AES key\n ikm = buildLabeledIkm(LABEL_SECRET, new Uint8Array([]), SUITE_ID_2);\n info = AES_KEY_INFO;\n const key = extractAndExpand(sharedSecret, ikm, info, 32);\n // Step 5: Derive the initialization vector\n info = IV_INFO;\n const iv = extractAndExpand(sharedSecret, ikm, info, 12);\n // Step 6: Encrypt the data using AES-GCM\n const encryptedData = aesGcmEncrypt(plainTextBuf, key, iv, aad);\n // Step 7: Concatenate the encapsulated key and the encrypted data for output\n const compressedSenderBuf = compressRawPublicKey(senderPubBuf);\n const result = new Uint8Array(compressedSenderBuf.length + encryptedData.length);\n result.set(compressedSenderBuf, 0);\n result.set(encryptedData, compressedSenderBuf.length);\n return result;\n }\n catch (error) {\n throw new Error(`Unable to perform hpkeEncrypt: ${error}`);\n }\n};\n/**\n * HPKE Encrypt Function\n * Encrypts data using Authenticated ,Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/.\n *\n * @param {HpkeAuthEncryptParams} params - The encryption parameters including plain text, encapsulated key, and sender private key.\n * @returns {Uint8Array} - The encrypted data.\n */\nconst hpkeAuthEncrypt = ({ plainTextBuf, targetKeyBuf, senderPriv, }) => {\n try {\n // Authenticated HPKE Mode\n const senderPrivBuf = uint8ArrayFromHexString(senderPriv);\n const senderPubBuf = getPublicKey(senderPriv, false);\n const aad = buildAdditionalAssociatedData(senderPubBuf, targetKeyBuf);\n // Step 1: Generate Shared Secret\n const ss = deriveSS(targetKeyBuf, uint8ArrayToHexString(senderPrivBuf));\n // Step 2: Generate the KEM context\n const kemContext = getKemContext(senderPubBuf, uint8ArrayToHexString(targetKeyBuf));\n // Step 3: Build the HKDF inputs for key derivation\n let ikm = buildLabeledIkm(LABEL_EAE_PRK, ss, SUITE_ID_1);\n let info = buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, SUITE_ID_1, 32);\n const sharedSecret = extractAndExpand(new Uint8Array([]), ikm, info, 32);\n // Step 4: Derive the AES key\n ikm = buildLabeledIkm(LABEL_SECRET, new Uint8Array([]), SUITE_ID_2);\n info = AES_KEY_INFO;\n const key = extractAndExpand(sharedSecret, ikm, info, 32);\n // Step 5: Derive the initialization vector\n info = IV_INFO;\n const iv = extractAndExpand(sharedSecret, ikm, info, 12);\n // Step 6: Encrypt the data using AES-GCM\n const encryptedData = aesGcmEncrypt(plainTextBuf, key, iv, aad);\n // Step 7: Concatenate the encapsulated key and the encrypted data for output\n const compressedSenderBuf = compressRawPublicKey(senderPubBuf);\n const result = new Uint8Array(compressedSenderBuf.length + encryptedData.length);\n result.set(compressedSenderBuf, 0);\n result.set(encryptedData, compressedSenderBuf.length);\n return result;\n }\n catch (error) {\n throw new Error(`Unable to perform hpkeEncrypt: ${error}`);\n }\n};\n/**\n * Encrypt a message to a quorum key. Algorithm originally implemented in qos here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L123\n * Returns a borsh serialized encrypted Envelope which is the nonce + ephemeralSenderPublicKey + encryptedMessage\n * This function creates an ephemeral key, creates a shared secret with the recipient targetPublicKeyUncompressed\n * creates additional associated data which follows the form: sender_public||sender_public_len||receiver_public||receiver_public_len\n * encrypts using aes-gcm-256 with a SHA-512 HMAC over the QOS_ENCRYPTION_HMAC_MESSAGE literally: \"qos_encryption_hmac_message\"\n * inserts and returns the necessary information in a borsh serialized envelope as described above\n * This encryption function is meant to be used with this decryption function in QOS: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L52\n *\n * @param {Uint8Array} targetPublicKeyUncompressed - The P256 uncompressed public key to encrypt the message to\n * @param {Uint8Array} message - The message to encrypt to targetPublicKeyUncompressed\n * @returns {Uint8Array} - A borsh serialized envelope containing the nonce + ephemeralSenderPublicKey + encrypted message\n */\nconst quorumKeyEncrypt = async (targetPublicKeyUncompressed, message) => {\n // generate an ephemeral keypair for this encryption operation\n const ephemeralKeyPair = generateP256KeyPair();\n const ephemeralSenderPublic = ephemeralKeyPair.publicKeyUncompressed;\n // create a shared secret AES-GCM key with the SHA-512 HMAC\n let cipher = await createQuorumKeyEncryptCipher(uint8ArrayFromHexString(ephemeralSenderPublic), uint8ArrayFromHexString(ephemeralKeyPair.privateKey), targetPublicKeyUncompressed);\n // generate a nonce\n const nonce = new Uint8Array(QUORUM_ENCRYPT_NONCE_LENGTH_BYTES);\n crypto.getRandomValues(nonce);\n // create the additional data in the form of sender_public||sender_public_len||receiver_public||receiver_public_len taken from QOS here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L298\n const aad = createAdditionalAssociatedData(uint8ArrayFromHexString(ephemeralSenderPublic), targetPublicKeyUncompressed);\n // algorithm specifications for AES-GCM\n const alg = {\n name: \"AES-GCM\",\n iv: nonce,\n tagLength: 128,\n additionalData: aad,\n };\n // encrypt the message with the shared secret\n const encryptedMessageBuf = await crypto.subtle.encrypt(alg, cipher, message);\n // create the envelope\n let envelope = {\n nonce: nonce,\n ephemeralSenderPublic: uint8ArrayFromHexString(ephemeralSenderPublic),\n encryptedMessage: new Uint8Array(encryptedMessageBuf),\n };\n // borsh serialize the envelope\n return borsh.serialize(EnvelopeSchema, envelope);\n};\n/**\n * Format HPKE Buffer Function\n * Returns a JSON string of an encrypted bundle, separating out the cipher text and the sender public key\n *\n * @param {Uint8Array} encryptedBuf - The result of hpkeAuthEncrypt or hpkeEncrypt\n * @returns {string} - A JSON string with \"encappedPublic\" and \"ciphertext\"\n */\nconst formatHpkeBuf = (encryptedBuf) => {\n const compressedSenderBuf = encryptedBuf.slice(0, 33);\n const encryptedData = encryptedBuf.slice(33);\n const encappedKeyBufHex = uint8ArrayToHexString(uncompressRawPublicKey(compressedSenderBuf));\n const ciphertextHex = uint8ArrayToHexString(encryptedData);\n return JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n};\n/**\n * HPKE Decrypt Function\n * Decrypts data using Hybrid Public Key Encryption (HPKE) standard https://datatracker.ietf.org/doc/rfc9180/.\n *\n * @param {HpkeDecryptParams} params - The decryption parameters including ciphertext, encapsulated key, and receiver private key.\n * @returns {Uint8Array} - The decrypted data.\n */\nconst hpkeDecrypt = ({ ciphertextBuf, encappedKeyBuf, receiverPriv, }) => {\n try {\n let ikm;\n let info;\n const receiverPubBuf = getPublicKey(uint8ArrayFromHexString(receiverPriv), false);\n const aad = buildAdditionalAssociatedData(encappedKeyBuf, receiverPubBuf); // Eventually we want users to be able to pass in aad as optional\n // Step 1: Generate Shared Secret\n const ss = deriveSS(encappedKeyBuf, receiverPriv);\n // Step 2: Generate the KEM context\n const kemContext = getKemContext(encappedKeyBuf, uint8ArrayToHexString(receiverPubBuf));\n // Step 3: Build the HKDF inputs for key derivation\n ikm = buildLabeledIkm(LABEL_EAE_PRK, ss, SUITE_ID_1);\n info = buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, SUITE_ID_1, 32);\n const sharedSecret = extractAndExpand(new Uint8Array([]), ikm, info, 32);\n // Step 4: Derive the AES key\n ikm = buildLabeledIkm(LABEL_SECRET, new Uint8Array([]), SUITE_ID_2);\n info = AES_KEY_INFO;\n const key = extractAndExpand(sharedSecret, ikm, info, 32);\n // Step 5: Derive the initialization vector\n info = IV_INFO;\n const iv = extractAndExpand(sharedSecret, ikm, info, 12);\n // Step 6: Decrypt the data using AES-GCM\n const decryptedData = aesGcmDecrypt(ciphertextBuf, key, iv, aad);\n return decryptedData;\n }\n catch (error) {\n throw new Error(`Unable to perform hpkeDecrypt: ${error} `);\n }\n};\n/**\n * Generate a P-256 key pair. Contains the hexed privateKey, publicKey, and Uncompressed publicKey\n *\n * @returns {KeyPair} - The generated key pair.\n */\nconst generateP256KeyPair = () => {\n const privateKey = randomBytes(32);\n const publicKey = getPublicKey(privateKey, true);\n const publicKeyUncompressed = uint8ArrayToHexString(uncompressRawPublicKey(publicKey));\n return {\n privateKey: uint8ArrayToHexString(privateKey),\n publicKey: uint8ArrayToHexString(publicKey),\n publicKeyUncompressed,\n };\n};\n/**\n * Create additional associated data (AAD) for AES-GCM decryption.\n *\n * @param {Uint8Array} senderPubBuf\n * @param {Uint8Array} receiverPubBuf\n * @return {Uint8Array} - The resulting concatenation of sender and receiver pubkeys.\n */\nconst buildAdditionalAssociatedData = (senderPubBuf, receiverPubBuf) => {\n return new Uint8Array([\n ...Array.from(senderPubBuf),\n ...Array.from(receiverPubBuf),\n ]);\n};\n/**\n * Accepts a private key Uint8Array in the PKCS8 format, and returns the encapsulated private key.\n *\n * @param {Uint8Array} privateKey - A PKCS#8 private key structured with the key data at a specific position. The actual key starts at byte 36 and is 32 bytes long.\n * @return {Uint8Array} - The private key.\n */\nconst extractPrivateKeyFromPKCS8Bytes = (privateKey) => {\n return privateKey.slice(36, 36 + 32);\n};\n/**\n * Accepts a public key Uint8Array, and returns a Uint8Array with the compressed version of the public key.\n *\n * @param {Uint8Array} rawPublicKey - The raw public key.\n * @return {Uint8Array} – The compressed public key.\n */\nconst compressRawPublicKey = (rawPublicKey) => {\n const len = rawPublicKey.byteLength;\n // Drop the y coordinate\n // Uncompressed key is in the form 0x04||x||y\n // `len >>> 1` is a more concise way to write `floor(len/2)`\n var compressedBytes = rawPublicKey.slice(0, (1 + len) >>> 1);\n // Encode the parity of `y` in first bit\n // `BYTE & 0x01` tests for parity and returns 0x00 when even, or 0x01 when odd\n // Then `0x02 | ` yields either 0x02 (even case) or 0x03 (odd).\n compressedBytes[0] = 0x02 | (rawPublicKey[len - 1] & 0x01);\n return compressedBytes;\n};\n/**\n * Accepts a public key array buffer, and returns a buffer with the uncompressed version of the public key\n * @param {Uint8Array} rawPublicKey - The public key.\n * @return {Uint8Array} - The uncompressed public key.\n */\nconst uncompressRawPublicKey = (rawPublicKey, curve = \"CURVE_P256\") => {\n if (rawPublicKey.length !== 33) {\n throw new Error(\"failed to uncompress raw public key: invalid length\");\n }\n if (!(rawPublicKey[0] === 2 || rawPublicKey[0] === 3)) {\n throw new Error(\"failed to uncompress raw public key: invalid prefix\");\n }\n // point[0] must be 2 (false) or 3 (true).\n // this maps to the initial \"02\" or \"03\" prefix\n const lsb = rawPublicKey[0] === 3;\n const x = BigInt(\"0x\" + uint8ArrayToHexString(rawPublicKey.subarray(1)));\n let p, a, b;\n if (curve === \"CURVE_P256\") {\n // p-256 domain parameters\n // https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.186-4.pdf (Appendix D).\n p = BigInt(\"115792089210356248762697446949407573530086143415290314195533631308867097853951\");\n b = BigInt(\"0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b\");\n a = p - BigInt(3);\n }\n else {\n // secp256k1 domain parameters\n // https://www.secg.org/sec2-v2.pdf (Section 2.4.1).\n p = BigInt(\"0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f\");\n a = BigInt(0);\n b = BigInt(7);\n }\n // Now compute y based on x\n const rhs = ((x * x + a) * x + b) % p;\n let y = modSqrt(rhs, p);\n if (lsb !== testBit(y, 0)) {\n y = (p - y) % p;\n }\n if (x < BigInt(0) || x >= p) {\n throw new Error(\"x is out of range\");\n }\n if (y < BigInt(0) || y >= p) {\n throw new Error(\"y is out of range\");\n }\n var uncompressedHexString = \"04\" + bigIntToHex(x, 64) + bigIntToHex(y, 64);\n return uint8ArrayFromHexString(uncompressedHexString);\n};\n/**\n * Build labeled Initial Key Material (IKM).\n *\n * @param {Uint8Array} label - The label to use.\n * @param {Uint8Array} ikm - The input key material.\n * @param {Uint8Array} suiteId - The suite identifier.\n * @returns {Uint8Array} - The labeled IKM.\n */\nconst buildLabeledIkm = (label, ikm, suiteId) => {\n const combinedLength = HPKE_VERSION.length + suiteId.length + label.length + ikm.length;\n const ret = new Uint8Array(combinedLength);\n let offset = 0;\n ret.set(HPKE_VERSION, offset);\n offset += HPKE_VERSION.length;\n ret.set(suiteId, offset);\n offset += suiteId.length;\n ret.set(label, offset);\n offset += label.length;\n ret.set(ikm, offset);\n return ret;\n};\n/**\n * Build labeled info for HKDF operations.\n *\n * @param {Uint8Array} label - The label to use.\n * @param {Uint8Array} info - Additional information.\n * @param {Uint8Array} suiteId - The suite identifier.\n * @param {number} len - The output length.\n * @returns {Uint8Array} - The labeled info.\n */\nconst buildLabeledInfo = (label, info, suiteId, len) => {\n const suiteIdStartIndex = 9; // first two are reserved for length bytes (unused in this case), the next 7 are for the HPKE_VERSION, then the suiteId starts at 9\n const ret = new Uint8Array(suiteIdStartIndex + suiteId.byteLength + label.byteLength + info.byteLength);\n ret.set(new Uint8Array([0, len]), 0); // this isn’t an error, we’re starting at index 2 because the first two bytes should be 0. See for reference.\n ret.set(HPKE_VERSION, 2);\n ret.set(suiteId, suiteIdStartIndex);\n ret.set(label, suiteIdStartIndex + suiteId.byteLength);\n ret.set(info, suiteIdStartIndex + suiteId.byteLength + label.byteLength);\n return ret;\n};\n/**\n * Perform HKDF extract and expand operations.\n */\nconst extractAndExpand = (sharedSecret, ikm, info, len) => {\n const prk = hkdf.extract(sha256, ikm, sharedSecret);\n const resp = hkdf.expand(sha256, prk, info, len);\n return new Uint8Array(resp);\n};\n/**\n * Derive the Diffie-Hellman shared secret using ECDH.\n */\nconst deriveSS = (encappedKeyBuf, priv) => {\n const ss = p256.getSharedSecret(uint8ArrayFromHexString(priv), encappedKeyBuf);\n return ss.slice(1);\n};\n/**\n * Encrypt data using AES-GCM.\n */\nconst aesGcmEncrypt = (plainTextData, key, iv, aad) => {\n const aes = gcm(key, iv, aad);\n const data = aes.encrypt(plainTextData);\n return data;\n};\n/**\n * Decrypt data using AES-GCM.\n */\nconst aesGcmDecrypt = (encryptedData, key, iv, aad) => {\n const aes = gcm(key, iv, aad);\n const data = aes.decrypt(encryptedData);\n return data;\n};\n/**\n * Generate a Key Encapsulation Mechanism (KEM) context.\n */\nconst getKemContext = (encappedKeyBuf, publicKey) => {\n const encappedKeyArray = new Uint8Array(encappedKeyBuf);\n const publicKeyArray = uint8ArrayFromHexString(publicKey);\n const kemContext = new Uint8Array(encappedKeyArray.length + publicKeyArray.length);\n kemContext.set(encappedKeyArray);\n kemContext.set(publicKeyArray, encappedKeyArray.length);\n return kemContext;\n};\n/**\n * Convert a BigInt to a hexadecimal string of a specific length.\n */\nconst bigIntToHex = (num, length) => {\n const hexString = num.toString(16);\n if (hexString.length > length) {\n throw new Error(`number cannot fit in a hex string of ${length} characters`);\n }\n return hexString.padStart(length, \"0\");\n};\n/**\n * Converts an ASN.1 DER-encoded ECDSA signature to the raw format used for verification.\n *\n * @param {string} derSignature - The DER-encoded signature.\n * @returns {Uint8Array} - The raw signature.\n */\nconst fromDerSignature = (derSignature) => {\n const derSignatureBuf = uint8ArrayFromHexString(derSignature);\n // Check minimum length\n if (derSignatureBuf.length < 2) {\n throw new Error(\"failed to convert DER-encoded signature: insufficient length\");\n }\n // Check SEQUENCE tag (0x30 at first byte)\n if (derSignatureBuf[0] !== 0x30) {\n throw new Error(\"failed to convert DER-encoded signature: invalid format (missing SEQUENCE tag)\");\n }\n // Check second byte, start of length field\n let index = 1;\n const lengthByte = derSignatureBuf[index];\n if (lengthByte <= 0x7f) {\n // Short form: single byte length\n // directly take the consumed value as length and check against buffer\n // buffer length: initial header bytes + claimed remaining length\n if (derSignatureBuf.length < 1 + 1 + lengthByte) {\n throw new Error(\"failed to convert DER-encoded signature: inconsistent message length header\");\n }\n // continue parsing\n index += 1;\n }\n else {\n // Multi-byte DER length header\n // Invalid DER values: lengthByte 0x80 and 0xff\n // Valid DER values: lengthByte > 0x80, < 0xff\n //\n // We do not expect signature data in the Long form notation\n // -> reject all such inputs\n //\n // More complex parsing for longer signature sequences can be implemented once needed\n throw new Error(\"failed to convert DER-encoded signature: unexpectedly large or invalid signature length\");\n }\n // Parse 'r' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\"failed to convert DER-encoded signature: invalid tag for r\");\n }\n index++; // Move past the INTEGER tag\n const rLength = derSignatureBuf[index];\n // Allow up to 32 data bytes + 1 byte 0-padding prefix\n if (rLength > 33) {\n throw new Error(\"failed to convert DER-encoded signature: unexpected length for r\");\n }\n index++; // Move past the length byte\n const r = derSignatureBuf.slice(index, index + rLength);\n index += rLength; // Move to the start of s\n // Parse 's' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\"failed to convert DER-encoded signature: invalid tag for s\");\n }\n index++; // Move past the INTEGER tag\n const sLength = derSignatureBuf[index];\n // Allow up to 32 data bytes + 1 byte 0-padding prefix\n if (sLength > 33) {\n throw new Error(\"failed to convert DER-encoded signature: unexpected length for s\");\n }\n index++; // Move past the length byte\n const s = derSignatureBuf.slice(index, index + sLength);\n // Normalize 'r' and 's' to 32 bytes each\n const rPadded = normalizePadding(r, 32);\n const sPadded = normalizePadding(s, 32);\n // Concatenate and return the raw signature\n return new Uint8Array([...rPadded, ...sPadded]);\n};\n/**\n * Converts a raw ECDSA signature to DER-encoded format.\n *\n * This function takes a raw ECDSA signature, which is a concatenation of two 32-byte integers (r and s),\n * and converts it into the DER-encoded format. DER (Distinguished Encoding Rules) is a binary encoding\n * for data structures described by ASN.1.\n *\n * @param {string} rawSignature - The raw signature in hexadecimal string format.\n * @returns {string} - The DER-encoded signature in hexadecimal string format.\n *\n * @throws {Error} - Throws an error if the input signature is invalid or if the encoding process fails.\n *\n * @example\n * // Example usage:\n * const rawSignature = \"0x487cdb8a88f2f4044b701cbb116075c4cabe5fe4657a6358b395c0aab70694db3453a8057e442bd1aff0ecabe8a82c831f0edd7f2158b7c1feb3de9b1f20309b1c\";\n * const derSignature = toDerSignature(rawSignature);\n * console.log(derSignature); // Outputs the DER-encoded signature as a hex string\n * // \"30440220487cdb8a88f2f4044b701cbb116075c4cabe5fe4657a6358b395c0aab70694db02203453a8057e442bd1aff0ecabe8a82c831f0edd7f2158b7c1feb3de9b1f20309b\"\n */\nconst toDerSignature = (rawSignature) => {\n const rawSignatureBuf = uint8ArrayFromHexString(rawSignature);\n // Split raw signature into r and s, each 32 bytes\n const r = rawSignatureBuf.slice(0, 32);\n const s = rawSignatureBuf.slice(32, 64);\n // Helper function to encode an integer with DER structure\n const encodeDerInteger = (integer) => {\n // Check if integer is defined and has at least one byte\n if (integer === undefined ||\n integer.length === 0 ||\n integer[0] === undefined) {\n throw new Error(\"Invalid integer: input is undefined or empty.\");\n }\n // Add a leading zero if the integer's most significant byte is >= 0x80\n const needsPadding = integer[0] & 0x80;\n const paddedInteger = needsPadding\n ? new Uint8Array([0x00, ...integer])\n : integer;\n // Prepend the integer tag (0x02) and length\n return new Uint8Array([0x02, paddedInteger.length, ...paddedInteger]);\n };\n // DER encode r and s\n const rEncoded = encodeDerInteger(r);\n const sEncoded = encodeDerInteger(s);\n // Combine as a DER sequence: 0x30, total length, rEncoded, sEncoded\n const derSignature = new Uint8Array([\n 0x30,\n rEncoded.length + sEncoded.length,\n ...rEncoded,\n ...sEncoded,\n ]);\n return uint8ArrayToHexString(derSignature);\n};\n/**\n * Create a shared AES-GCM secret with the quorum key encryption SHA-512 HMAC\n *\n * This function takes an ephemeral Sender public key generated for each encryption operation\n * the corresponding ephemeral private key, and the target public key uncompressed\n * for data structures described by ASN.1.\n *\n * @param {Uint8Array} ephemeralSenderPublic - The ephemeral public key used to create the preImage\n * @param {Uint8Array} ephemeralSenderPrivate - The ephemeral private key to create the shared secret with\n * @param {Uint8Array} targetPublicKeyUncompressed - The public key to create the shared secret with and encrypt the message to\n * @returns {Promise} - A shared secret AES-GCM key between ephemeralSenderPrivate and the targetPublicKeyUncompressed\n */\nasync function createQuorumKeyEncryptCipher(ephemeralSenderPublic, ephemeralSenderPrivate, targetPublicKeyUncompressed) {\n // create the shared secret between ephemeralSenderPrivate and targetPublicKeyUncompressed\n const sharedSecretUncompressed = p256.getSharedSecret(ephemeralSenderPrivate, targetPublicKeyUncompressed, false);\n const sharedSecret = sharedSecretUncompressed.slice(1, 33);\n // create the preImage as defined in qos here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L273-L282\n let preImage = new Uint8Array(ephemeralSenderPublic.length +\n targetPublicKeyUncompressed.length +\n sharedSecret.length);\n preImage.set(ephemeralSenderPublic, 0);\n preImage.set(targetPublicKeyUncompressed, ephemeralSenderPublic.length);\n preImage.set(sharedSecret, ephemeralSenderPublic.length + targetPublicKeyUncompressed.length);\n // create the HMAC key and create an HMAC using QOS_ENCRYPTION_HMAC_MESSAGE\n const hmacKey = await crypto.subtle.importKey(\"raw\", preImage, {\n name: \"HMAC\",\n hash: \"SHA-512\",\n }, false, [\"sign\"]);\n const mac = new Uint8Array(await crypto.subtle.sign(\"HMAC\", hmacKey, QOS_ENCRYPTION_HMAC_MESSAGE));\n // Use the first 32 bytes as the AES-GCM key\n const aesKeyRaw = mac.slice(0, 32);\n return crypto.subtle.importKey(\"raw\", aesKeyRaw, {\n name: \"AES-GCM\",\n }, false, [\"encrypt\"]);\n}\n/// Helper function to create the additional associated data (AAD). The data is\n/// of the form `sender_public||sender_public_len||receiver_public||receiver_public_len`.\n/// This is taken from QOS here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L298\n///\n/// Note that we append the length to each field as per NIST specs here: . See section 5.8.2.\nfunction createAdditionalAssociatedData(ephemeralSenderPublic, receiverPublic) {\n // get the length of the sending and receiver public keys\n const ephemeralSenderLength = ephemeralSenderPublic.length;\n const receiverPublicLength = receiverPublic.length;\n // ensure the lengths are under 1 byte\n if (ephemeralSenderLength > 255 || receiverPublicLength > 255)\n throw new Error(\"AAD len fields are 1 byte\");\n // allocate an array the size of both keys + 1 byte for their length\n const aad = new Uint8Array(ephemeralSenderLength + 1 + receiverPublicLength + 1);\n // keep track of the offset within the array\n let offset = 0;\n // set the bytes that represent the sender public key + its length\n aad.set(ephemeralSenderPublic, offset);\n offset += ephemeralSenderLength;\n aad[offset++] = ephemeralSenderLength;\n // set the bytes that represent the receiver public key + its length\n aad.set(receiverPublic, offset);\n offset += receiverPublicLength;\n aad[offset++] = receiverPublicLength;\n return aad;\n}\n\nexport { buildAdditionalAssociatedData, compressRawPublicKey, extractPrivateKeyFromPKCS8Bytes, formatHpkeBuf, fromDerSignature, generateP256KeyPair, getPublicKey, hpkeAuthEncrypt, hpkeDecrypt, hpkeEncrypt, quorumKeyEncrypt, toDerSignature, uncompressRawPublicKey };\n//# sourceMappingURL=crypto.mjs.map\n","import { bs58check, uint8ArrayToHexString, uint8ArrayFromHexString, bs58, hexToAscii } from '@turnkey/encoding';\nimport { PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY, PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY, PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY, PRODUCTION_SIGNER_SIGN_PUBLIC_KEY } from './constants.mjs';\nimport { uncompressRawPublicKey, hpkeDecrypt, fromDerSignature, hpkeEncrypt, formatHpkeBuf, quorumKeyEncrypt } from './crypto.mjs';\nimport { p256 } from '@noble/curves/p256';\nimport { ed25519 } from '@noble/curves/ed25519';\nimport { sha256 } from '@noble/hashes/sha256';\n\n/// \n// Turnkey-specific cryptographic utilities\nvar Enclave;\n(function (Enclave) {\n Enclave[\"NOTARIZER\"] = \"notarizer\";\n Enclave[\"SIGNER\"] = \"signer\";\n Enclave[\"EVM_PARSER\"] = \"evm-parser\";\n Enclave[\"TLS_FETCHER\"] = \"tls-fetcher\";\n Enclave[\"UMP\"] = \"ump\";\n})(Enclave || (Enclave = {}));\n/**\n * Decrypt an encrypted email auth/recovery or oauth credential bundle.\n *\n * @param {string} credentialBundle - The encrypted credential bundle.\n * @param {string} embeddedKey - The private key for decryption.\n * @returns {string} - The decrypted data or null if decryption fails.\n * @throws {Error} - If unable to decrypt the credential bundle\n */\nconst decryptCredentialBundle = (credentialBundle, embeddedKey) => {\n try {\n const bundleBytes = bs58check.decode(credentialBundle);\n if (bundleBytes.byteLength <= 33) {\n throw new Error(`Bundle size ${bundleBytes.byteLength} is too low. Expecting a compressed public key (33 bytes) and an encrypted credential.`);\n }\n const compressedEncappedKeyBuf = bundleBytes.slice(0, 33);\n const ciphertextBuf = bundleBytes.slice(33);\n const encappedKeyBuf = uncompressRawPublicKey(compressedEncappedKeyBuf);\n const decryptedData = hpkeDecrypt({\n ciphertextBuf,\n encappedKeyBuf,\n receiverPriv: embeddedKey,\n });\n return uint8ArrayToHexString(decryptedData);\n }\n catch (error) {\n throw new Error(`\"Error decrypting bundle:\", ${error}`);\n }\n};\n/**\n * Decrypt an encrypted export bundle (such as a private key or wallet account bundle).\n *\n * This function verifies the enclave signature to ensure the authenticity of the encrypted data.\n * It uses HPKE (Hybrid Public Key Encryption) to decrypt the contents of the bundle and returns\n * either the decrypted mnemonic or the decrypted data in hexadecimal format, based on the\n * `returnMnemonic` flag.\n *\n * @param {DecryptExportBundleParams} params - An object containing the following properties:\n * - exportBundle {string}: The encrypted export bundle in JSON format.\n * - organizationId {string}: The expected organization ID to verify against the signed data.\n * - embeddedKey {string}: The private key used for decrypting the data.\n * - dangerouslyOverrideSignerPublicKey {string} [Optional]: Optionally override the default signer public key used for verifying the signature. This should only be done for testing\n * - returnMnemonic {boolean}: If true, returns the decrypted data as a mnemonic string; otherwise, returns it in hexadecimal format.\n * @returns {Promise} - A promise that resolves to the decrypted mnemonic or decrypted hexadecimal data.\n * @throws {Error} - If decryption or signature verification fails, throws an error with details.\n */\nconst decryptExportBundle = async ({ exportBundle, embeddedKey, organizationId, dangerouslyOverrideSignerPublicKey, keyFormat, returnMnemonic, }) => {\n try {\n const parsedExportBundle = JSON.parse(exportBundle);\n const verified = await verifyEnclaveSignature(parsedExportBundle.enclaveQuorumPublic, parsedExportBundle.dataSignature, parsedExportBundle.data, dangerouslyOverrideSignerPublicKey);\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${parsedExportBundle}`);\n }\n const signedData = JSON.parse(new TextDecoder().decode(uint8ArrayFromHexString(parsedExportBundle.data)));\n if (!signedData.organizationId ||\n signedData.organizationId !== organizationId) {\n throw new Error(`organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`);\n }\n if (!signedData.encappedPublic) {\n throw new Error('missing \"encappedPublic\" in bundle signed data');\n }\n const encappedKeyBuf = uint8ArrayFromHexString(signedData.encappedPublic);\n const ciphertextBuf = uint8ArrayFromHexString(signedData.ciphertext);\n const decryptedData = hpkeDecrypt({\n ciphertextBuf,\n encappedKeyBuf,\n receiverPriv: embeddedKey,\n });\n if (keyFormat === \"SOLANA\" && !returnMnemonic) {\n if (decryptedData.length !== 32) {\n throw new Error(`invalid private key length. Expected 32 bytes. Got ${decryptedData.length}.`);\n }\n const publicKeyBytes = ed25519.getPublicKey(decryptedData);\n if (publicKeyBytes.length !== 32) {\n throw new Error(`invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.`);\n }\n const concatenatedBytes = new Uint8Array(64);\n concatenatedBytes.set(decryptedData, 0);\n concatenatedBytes.set(publicKeyBytes, 32);\n return bs58.encode(concatenatedBytes);\n }\n const decryptedDataHex = uint8ArrayToHexString(decryptedData);\n return returnMnemonic ? hexToAscii(decryptedDataHex) : decryptedDataHex;\n }\n catch (error) {\n throw new Error(`Error decrypting bundle: ${error}`);\n }\n};\n/**\n * Verifies a signature from a Turnkey stamp using ECDSA and SHA-256.\n *\n * @param {string} publicKey - The public key of the authenticator (e.g. WebAuthn or P256 API key).\n * @param {string} signature - The ECDSA signature in DER format.\n * @param {string} signedData - The data that was signed (e.g. JSON-stringified Turnkey request body).\n * @returns {Promise} - Returns true if the signature is valid, otherwise throws an error.\n *\n * @example\n *\n * const stampedRequest = await turnkeyClient.stampGetWhoami(...);\n * const decodedStampContents = atob(stampedRequest.stamp.stampHeaderValue);\n * const parsedStampContents = JSON.parse(decodedStampContents);\n * const signature = parsedStampContents.signature;\n *\n * await verifyStampSignature(publicKey, signature, stampedRequest.body)\n */\nconst verifyStampSignature = async (publicKey, signature, signedData) => {\n const publicKeyBuffer = uint8ArrayFromHexString(publicKey);\n const loadedPublicKey = loadPublicKey(publicKeyBuffer);\n if (!loadedPublicKey) {\n throw new Error(\"failed to load public key\");\n }\n // Convert the ASN.1 DER-encoded signature for verification\n const publicSignatureBuf = fromDerSignature(signature);\n const signedDataBuf = new TextEncoder().encode(signedData);\n const hashedData = sha256(signedDataBuf);\n return p256.verify(publicSignatureBuf, hashedData, loadedPublicKey.toHex());\n};\n/**\n * Verifies a signature from a Turnkey enclave using ECDSA and SHA-256.\n *\n * @param {string} enclaveQuorumPublic - The public key of the enclave signer.\n * @param {string} publicSignature - The ECDSA signature in DER format.\n * @param {string} signedData - The data that was signed.\n * @param {Environment} dangerouslyOverrideSignerPublicKey - (optional) an enum (PROD or PREPROD) to verify against the correct signer enclave key.\n * @returns {Promise} - Returns true if the signature is valid, otherwise throws an error.\n */\nconst verifyEnclaveSignature = async (enclaveQuorumPublic, publicSignature, signedData, dangerouslyOverrideSignerPublicKey) => {\n const expectedSignerPublicKey = dangerouslyOverrideSignerPublicKey || PRODUCTION_SIGNER_SIGN_PUBLIC_KEY;\n if (enclaveQuorumPublic != expectedSignerPublicKey) {\n throw new Error(`expected signer key ${dangerouslyOverrideSignerPublicKey ?? PRODUCTION_SIGNER_SIGN_PUBLIC_KEY} does not match signer key from bundle: ${enclaveQuorumPublic}`);\n }\n const encryptionQuorumPublicBuf = new Uint8Array(uint8ArrayFromHexString(enclaveQuorumPublic));\n const quorumKey = loadPublicKey(encryptionQuorumPublicBuf);\n if (!quorumKey) {\n throw new Error(\"failed to load quorum key\");\n }\n // Convert the ASN.1 DER-encoded signature for verification\n const publicSignatureBuf = fromDerSignature(publicSignature);\n const signedDataBuf = uint8ArrayFromHexString(signedData);\n const hashedData = sha256(signedDataBuf);\n return p256.verify(publicSignatureBuf, hashedData, quorumKey.toHex());\n};\n/**\n * Loads an ECDSA public key from a raw format for signature verification.\n *\n * @param {Uint8Array} publicKey - The raw P-256 public key bytes.\n * @returns {ProjPointType} - The parsed ECDSA public key.\n * @throws {Error} - If the public key is invalid.\n */\nconst loadPublicKey = (publicKey) => {\n return p256.ProjectivePoint.fromHex(uint8ArrayToHexString(publicKey));\n};\n/**\n * Decodes a private key based on the specified format.\n *\n * @param {string} privateKey - The private key to decode.\n * @param {string} keyFormat - The format of the private key (e.g., \"SOLANA\", \"HEXADECIMAL\").\n * @returns {Uint8Array} - The decoded private key.\n */\nconst decodeKey = (privateKey, keyFormat) => {\n switch (keyFormat) {\n case \"SOLANA\":\n const decodedKeyBytes = bs58.decode(privateKey);\n if (decodedKeyBytes.length !== 64) {\n throw new Error(`invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.`);\n }\n return decodedKeyBytes.subarray(0, 32);\n case \"HEXADECIMAL\":\n if (privateKey.startsWith(\"0x\")) {\n return uint8ArrayFromHexString(privateKey.slice(2));\n }\n return uint8ArrayFromHexString(privateKey);\n default:\n console.warn(`invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`);\n if (privateKey.startsWith(\"0x\")) {\n return uint8ArrayFromHexString(privateKey.slice(2));\n }\n return uint8ArrayFromHexString(privateKey);\n }\n};\n/**\n * Encrypts a private key bundle using HPKE and verifies the enclave signature.\n *\n * @param {EncryptPrivateKeyToBundleParams} params - An object containing the private key, key format, bundle, user, and organization details. Optionally, you can override the default signer key (for testing purposes)\n * @returns {Promise} - A promise that resolves to a JSON string representing the encrypted bundle.\n * @throws {Error} - If enclave signature verification or any other validation fails.\n */\nconst encryptPrivateKeyToBundle = async ({ privateKey, keyFormat, importBundle, userId, organizationId, dangerouslyOverrideSignerPublicKey, }) => {\n const parsedImportBundle = JSON.parse(importBundle);\n const plainTextBuf = decodeKey(privateKey, keyFormat);\n const verified = await verifyEnclaveSignature(parsedImportBundle.enclaveQuorumPublic, parsedImportBundle.dataSignature, parsedImportBundle.data, dangerouslyOverrideSignerPublicKey);\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${importBundle}`);\n }\n const signedData = JSON.parse(new TextDecoder().decode(uint8ArrayFromHexString(parsedImportBundle.data)));\n if (!signedData.organizationId ||\n signedData.organizationId !== organizationId) {\n throw new Error(`organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`);\n }\n if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(`user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`);\n }\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n // Load target public key generated from enclave\n const targetKeyBuf = uint8ArrayFromHexString(signedData.targetPublic);\n const privateKeyBundle = hpkeEncrypt({ plainTextBuf, targetKeyBuf });\n return formatHpkeBuf(privateKeyBundle);\n};\n/**\n /**\n * Encrypts a mnemonic wallet bundle using HPKE and verifies the enclave signature.\n *\n * @param {EncryptWalletToBundleParams} params - An object containing the mnemonic, bundle, user, and organization details. Optionally, you can override the default signer key (for testing purposes).\n * @returns {Promise} - A promise that resolves to a JSON string representing the encrypted wallet bundle.\n * @throws {Error} - If enclave signature verification or any other validation fails.\n */\nconst encryptWalletToBundle = async ({ mnemonic, importBundle, userId, organizationId, dangerouslyOverrideSignerPublicKey, }) => {\n const parsedImportBundle = JSON.parse(importBundle);\n const plainTextBuf = new TextEncoder().encode(mnemonic);\n const verified = await verifyEnclaveSignature(parsedImportBundle.enclaveQuorumPublic, parsedImportBundle.dataSignature, parsedImportBundle.data, dangerouslyOverrideSignerPublicKey);\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${importBundle}`);\n }\n const signedData = JSON.parse(new TextDecoder().decode(uint8ArrayFromHexString(parsedImportBundle.data)));\n if (!signedData.organizationId ||\n signedData.organizationId !== organizationId) {\n throw new Error(`organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`);\n }\n if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(`user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`);\n }\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n // Load target public key generated from enclave\n const targetKeyBuf = uint8ArrayFromHexString(signedData.targetPublic);\n const privateKeyBundle = hpkeEncrypt({ plainTextBuf, targetKeyBuf });\n return formatHpkeBuf(privateKeyBundle);\n};\n/**\n * Verifies that a **session JWT** was signed by Turnkey’s\n * notarizer key (P-256 / ES256, compact 64-byte r‖s signature).\n *\n * How it works\n * ------------\n * 1. Split the JWT into `header.payload.signature`.\n * 2. **Double-hash** the string `\"header.payload\"`:\n * `h1 = sha256(header.payload)`\n * `msg = sha256(h1)`\n * (The Rust signer feeds `h1` into `SigningKey::sign`, which hashes once\n * more internally, yielding `msg`.)\n * 3. Base64-URL-decode the signature (`r||s`, 64 bytes).\n * 4. Import the notarizer public key (hex `04‖X‖Y` → `Uint8Array`).\n * 5. Call `p256.verify(signature, msg, publicKey)`; noble treats the 32-byte\n * `msg` as a pre-hashed digest and performs ECDSA verification.\n *\n * @param jwt The session JWT to validate.\n * @param dangerouslyOverrideNotarizerPublicKey *(optional)* Hex-encoded\n * uncompressed P-256 public key to verify against (use only in\n * tests). Defaults to the production notarizer key.\n * @returns `true` if the signature is valid for the given key, else `false`.\n * @throws If the JWT is malformed.\n */\nconst verifySessionJwtSignature = async (jwt, dangerouslyOverrideNotarizerPublicKey) => {\n const notarizerKeyHex = dangerouslyOverrideNotarizerPublicKey ??\n PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY;\n /* 1. split JWT -------------------------------------------------------- */\n const [headerB64, payloadB64, signatureB64] = jwt.split(\".\");\n if (!signatureB64)\n throw new Error(\"invalid JWT: need 3 parts\");\n const signingInput = `${headerB64}.${payloadB64}`;\n /* 2. sha256(sha256(header.payload)) ----------------------------------- */\n const h1 = sha256(new TextEncoder().encode(signingInput));\n const msgDigest = sha256(h1); // 32-byte Uint8Array\n /* 3. base64-url decode signature -------------------------------------- */\n const toB64 = (u) => (u = u.replace(/-/g, \"+\").replace(/_/g, \"/\")).padEnd(u.length + ((4 - (u.length % 4)) % 4), \"=\");\n const signature = Uint8Array.from(atob(toB64(signatureB64))\n .split(\"\")\n .map((c) => c.charCodeAt(0))); // 64 bytes\n /* 4. load public key -------------------------------------------------- */\n const publicKey = uint8ArrayFromHexString(notarizerKeyHex);\n /* 5. verify ----------------------------------------------------------- */\n return p256.verify(signature, msgDigest, publicKey);\n};\n/**\n * Encrypts a message to an uncompressed P256 public key\n * The function takes in standard strings and converts them\n * to Uint8Arrays to be used by the lower level quorumKeyEncrypt\n * function. More details about how the encryption works is described\n * in that function's documentation.\n *\n * @param targetPublicKeyUncompressed A hex string uncompressed public key to encrypt a message to\n * @param message A standard string message to encrypt, does not have to be hex encoded\n * @returns {Promise} A borsh serialized envelope with the encrypted message (more details found in quorumKeyEncrypt)\n */\nconst encryptToEnclave = async (targetPublicKeyUncompressed, message) => {\n return await quorumKeyEncrypt(uint8ArrayFromHexString(targetPublicKeyUncompressed), new TextEncoder().encode(message));\n};\n/**\n * Helper function used specifically to encrypt a client secret to\n * TLS Fetchers quorum key. This is used for client_secret upload\n * when enabling authentication with an OAuth 2.0 provider\n *\n * @param client_secret The client secret issued by the OAuth 2.0 provider\n * @param dangerouslyOverrideTlsFetcherPublicKey *(optional)* Hex-encoded\n * uncompressed P-256 public key to encrypt to (use only in\n * tests/dev environment). Defaults to the production TLS Fetcher key.\n * @returns {Promise} A hex encoded borsh serialized envelope with the encrypted client\n * secret meant to be passed to the CreateOauth2Credential Activity\n */\nconst encryptOauth2ClientSecret = async (client_secret, dangerouslyOverrideTlsFetcherPublicKey) => {\n return uint8ArrayToHexString(await encryptToEnclave(dangerouslyOverrideTlsFetcherPublicKey ??\n PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY, client_secret));\n};\n/**\n * Helper function used specifically to encrypt your on ramp private/secret api keys\n * to the on ramp encryption public key. This is used before uploading your on ramp\n * credentials to Turnkey via the CreateFiatOnRampCredential activity\n *\n * @param secret The private/secret api key issued by the on ramp provider\n * @param dangerouslyOverrideOnRampEncryptionPublicKey *(optional)* Hex-encoded\n * uncompressed P-256 public key to encrypt to (use only in\n * tests/dev environment). Defaults to the production on ramp encryption public key.\n * @returns {Promise} A base58check encoded borsh serialized envelope with the encrypted secret\n * meant to be passed to the CreateFiatOnRampCredential activity\n */\nconst encryptOnRampSecret = (secret, dangerouslyOverrideOnRampEncryptionPublicKey) => {\n return bs58check.encode(hpkeEncrypt({\n plainTextBuf: new TextEncoder().encode(secret),\n targetKeyBuf: uncompressRawPublicKey(uint8ArrayFromHexString(dangerouslyOverrideOnRampEncryptionPublicKey ??\n PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY)),\n }));\n};\n\nexport { Enclave, decryptCredentialBundle, decryptExportBundle, encryptOauth2ClientSecret, encryptOnRampSecret, encryptPrivateKeyToBundle, encryptToEnclave, encryptWalletToBundle, verifySessionJwtSignature, verifyStampSignature };\n//# sourceMappingURL=turnkey.mjs.map\n","/*!\n Copyright (c) Peculiar Ventures, LLC\n*/\n\nfunction getUTCDate(date) {\r\n return new Date(date.getTime() + (date.getTimezoneOffset() * 60000));\r\n}\r\nfunction getParametersValue(parameters, name, defaultValue) {\r\n var _a;\r\n if ((parameters instanceof Object) === false) {\r\n return defaultValue;\r\n }\r\n return (_a = parameters[name]) !== null && _a !== void 0 ? _a : defaultValue;\r\n}\r\nfunction bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = (inputBuffer.byteLength - inputOffset), insertSpace = false) {\r\n let result = \"\";\r\n for (const item of (new Uint8Array(inputBuffer, inputOffset, inputLength))) {\r\n const str = item.toString(16).toUpperCase();\r\n if (str.length === 1) {\r\n result += \"0\";\r\n }\r\n result += str;\r\n if (insertSpace) {\r\n result += \" \";\r\n }\r\n }\r\n return result.trim();\r\n}\r\nfunction checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) {\r\n if (!(inputBuffer instanceof ArrayBuffer)) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer must be \\\"ArrayBuffer\\\"\";\r\n return false;\r\n }\r\n if (!inputBuffer.byteLength) {\r\n baseBlock.error = \"Wrong parameter: inputBuffer has zero length\";\r\n return false;\r\n }\r\n if (inputOffset < 0) {\r\n baseBlock.error = \"Wrong parameter: inputOffset less than zero\";\r\n return false;\r\n }\r\n if (inputLength < 0) {\r\n baseBlock.error = \"Wrong parameter: inputLength less than zero\";\r\n return false;\r\n }\r\n if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) {\r\n baseBlock.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\r\n return false;\r\n }\r\n return true;\r\n}\r\nfunction utilFromBase(inputBuffer, inputBase) {\r\n let result = 0;\r\n if (inputBuffer.length === 1) {\r\n return inputBuffer[0];\r\n }\r\n for (let i = (inputBuffer.length - 1); i >= 0; i--) {\r\n result += inputBuffer[(inputBuffer.length - 1) - i] * Math.pow(2, inputBase * i);\r\n }\r\n return result;\r\n}\r\nfunction utilToBase(value, base, reserved = (-1)) {\r\n const internalReserved = reserved;\r\n let internalValue = value;\r\n let result = 0;\r\n let biggest = Math.pow(2, base);\r\n for (let i = 1; i < 8; i++) {\r\n if (value < biggest) {\r\n let retBuf;\r\n if (internalReserved < 0) {\r\n retBuf = new ArrayBuffer(i);\r\n result = i;\r\n }\r\n else {\r\n if (internalReserved < i) {\r\n return (new ArrayBuffer(0));\r\n }\r\n retBuf = new ArrayBuffer(internalReserved);\r\n result = internalReserved;\r\n }\r\n const retView = new Uint8Array(retBuf);\r\n for (let j = (i - 1); j >= 0; j--) {\r\n const basis = Math.pow(2, j * base);\r\n retView[result - j - 1] = Math.floor(internalValue / basis);\r\n internalValue -= (retView[result - j - 1]) * basis;\r\n }\r\n return retBuf;\r\n }\r\n biggest *= Math.pow(2, base);\r\n }\r\n return new ArrayBuffer(0);\r\n}\r\nfunction utilConcatBuf(...buffers) {\r\n let outputLength = 0;\r\n let prevLength = 0;\r\n for (const buffer of buffers) {\r\n outputLength += buffer.byteLength;\r\n }\r\n const retBuf = new ArrayBuffer(outputLength);\r\n const retView = new Uint8Array(retBuf);\r\n for (const buffer of buffers) {\r\n retView.set(new Uint8Array(buffer), prevLength);\r\n prevLength += buffer.byteLength;\r\n }\r\n return retBuf;\r\n}\r\nfunction utilConcatView(...views) {\r\n let outputLength = 0;\r\n let prevLength = 0;\r\n for (const view of views) {\r\n outputLength += view.length;\r\n }\r\n const retBuf = new ArrayBuffer(outputLength);\r\n const retView = new Uint8Array(retBuf);\r\n for (const view of views) {\r\n retView.set(view, prevLength);\r\n prevLength += view.length;\r\n }\r\n return retView;\r\n}\r\nfunction utilDecodeTC() {\r\n const buf = new Uint8Array(this.valueHex);\r\n if (this.valueHex.byteLength >= 2) {\r\n const condition1 = (buf[0] === 0xFF) && (buf[1] & 0x80);\r\n const condition2 = (buf[0] === 0x00) && ((buf[1] & 0x80) === 0x00);\r\n if (condition1 || condition2) {\r\n this.warnings.push(\"Needlessly long format\");\r\n }\r\n }\r\n const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\r\n const bigIntView = new Uint8Array(bigIntBuffer);\r\n for (let i = 0; i < this.valueHex.byteLength; i++) {\r\n bigIntView[i] = 0;\r\n }\r\n bigIntView[0] = (buf[0] & 0x80);\r\n const bigInt = utilFromBase(bigIntView, 8);\r\n const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength);\r\n const smallIntView = new Uint8Array(smallIntBuffer);\r\n for (let j = 0; j < this.valueHex.byteLength; j++) {\r\n smallIntView[j] = buf[j];\r\n }\r\n smallIntView[0] &= 0x7F;\r\n const smallInt = utilFromBase(smallIntView, 8);\r\n return (smallInt - bigInt);\r\n}\r\nfunction utilEncodeTC(value) {\r\n const modValue = (value < 0) ? (value * (-1)) : value;\r\n let bigInt = 128;\r\n for (let i = 1; i < 8; i++) {\r\n if (modValue <= bigInt) {\r\n if (value < 0) {\r\n const smallInt = bigInt - modValue;\r\n const retBuf = utilToBase(smallInt, 8, i);\r\n const retView = new Uint8Array(retBuf);\r\n retView[0] |= 0x80;\r\n return retBuf;\r\n }\r\n let retBuf = utilToBase(modValue, 8, i);\r\n let retView = new Uint8Array(retBuf);\r\n if (retView[0] & 0x80) {\r\n const tempBuf = retBuf.slice(0);\r\n const tempView = new Uint8Array(tempBuf);\r\n retBuf = new ArrayBuffer(retBuf.byteLength + 1);\r\n retView = new Uint8Array(retBuf);\r\n for (let k = 0; k < tempBuf.byteLength; k++) {\r\n retView[k + 1] = tempView[k];\r\n }\r\n retView[0] = 0x00;\r\n }\r\n return retBuf;\r\n }\r\n bigInt *= Math.pow(2, 8);\r\n }\r\n return (new ArrayBuffer(0));\r\n}\r\nfunction isEqualBuffer(inputBuffer1, inputBuffer2) {\r\n if (inputBuffer1.byteLength !== inputBuffer2.byteLength) {\r\n return false;\r\n }\r\n const view1 = new Uint8Array(inputBuffer1);\r\n const view2 = new Uint8Array(inputBuffer2);\r\n for (let i = 0; i < view1.length; i++) {\r\n if (view1[i] !== view2[i]) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n}\r\nfunction padNumber(inputNumber, fullLength) {\r\n const str = inputNumber.toString(10);\r\n if (fullLength < str.length) {\r\n return \"\";\r\n }\r\n const dif = fullLength - str.length;\r\n const padding = new Array(dif);\r\n for (let i = 0; i < dif; i++) {\r\n padding[i] = \"0\";\r\n }\r\n const paddingString = padding.join(\"\");\r\n return paddingString.concat(str);\r\n}\r\nconst base64Template = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\r\nconst base64UrlTemplate = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=\";\r\nfunction toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) {\r\n let i = 0;\r\n let flag1 = 0;\r\n let flag2 = 0;\r\n let output = \"\";\r\n const template = (useUrlTemplate) ? base64UrlTemplate : base64Template;\r\n if (skipLeadingZeros) {\r\n let nonZeroPosition = 0;\r\n for (let i = 0; i < input.length; i++) {\r\n if (input.charCodeAt(i) !== 0) {\r\n nonZeroPosition = i;\r\n break;\r\n }\r\n }\r\n input = input.slice(nonZeroPosition);\r\n }\r\n while (i < input.length) {\r\n const chr1 = input.charCodeAt(i++);\r\n if (i >= input.length) {\r\n flag1 = 1;\r\n }\r\n const chr2 = input.charCodeAt(i++);\r\n if (i >= input.length) {\r\n flag2 = 1;\r\n }\r\n const chr3 = input.charCodeAt(i++);\r\n const enc1 = chr1 >> 2;\r\n const enc2 = ((chr1 & 0x03) << 4) | (chr2 >> 4);\r\n let enc3 = ((chr2 & 0x0F) << 2) | (chr3 >> 6);\r\n let enc4 = chr3 & 0x3F;\r\n if (flag1 === 1) {\r\n enc3 = enc4 = 64;\r\n }\r\n else {\r\n if (flag2 === 1) {\r\n enc4 = 64;\r\n }\r\n }\r\n if (skipPadding) {\r\n if (enc3 === 64) {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}`;\r\n }\r\n else {\r\n if (enc4 === 64) {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`;\r\n }\r\n else {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`;\r\n }\r\n }\r\n }\r\n else {\r\n output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`;\r\n }\r\n }\r\n return output;\r\n}\r\nfunction fromBase64(input, useUrlTemplate = false, cutTailZeros = false) {\r\n const template = (useUrlTemplate) ? base64UrlTemplate : base64Template;\r\n function indexOf(toSearch) {\r\n for (let i = 0; i < 64; i++) {\r\n if (template.charAt(i) === toSearch)\r\n return i;\r\n }\r\n return 64;\r\n }\r\n function test(incoming) {\r\n return ((incoming === 64) ? 0x00 : incoming);\r\n }\r\n let i = 0;\r\n let output = \"\";\r\n while (i < input.length) {\r\n const enc1 = indexOf(input.charAt(i++));\r\n const enc2 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const enc3 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const enc4 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++));\r\n const chr1 = (test(enc1) << 2) | (test(enc2) >> 4);\r\n const chr2 = ((test(enc2) & 0x0F) << 4) | (test(enc3) >> 2);\r\n const chr3 = ((test(enc3) & 0x03) << 6) | test(enc4);\r\n output += String.fromCharCode(chr1);\r\n if (enc3 !== 64) {\r\n output += String.fromCharCode(chr2);\r\n }\r\n if (enc4 !== 64) {\r\n output += String.fromCharCode(chr3);\r\n }\r\n }\r\n if (cutTailZeros) {\r\n const outputLength = output.length;\r\n let nonZeroStart = (-1);\r\n for (let i = (outputLength - 1); i >= 0; i--) {\r\n if (output.charCodeAt(i) !== 0) {\r\n nonZeroStart = i;\r\n break;\r\n }\r\n }\r\n if (nonZeroStart !== (-1)) {\r\n output = output.slice(0, nonZeroStart + 1);\r\n }\r\n else {\r\n output = \"\";\r\n }\r\n }\r\n return output;\r\n}\r\nfunction arrayBufferToString(buffer) {\r\n let resultString = \"\";\r\n const view = new Uint8Array(buffer);\r\n for (const element of view) {\r\n resultString += String.fromCharCode(element);\r\n }\r\n return resultString;\r\n}\r\nfunction stringToArrayBuffer(str) {\r\n const stringLength = str.length;\r\n const resultBuffer = new ArrayBuffer(stringLength);\r\n const resultView = new Uint8Array(resultBuffer);\r\n for (let i = 0; i < stringLength; i++) {\r\n resultView[i] = str.charCodeAt(i);\r\n }\r\n return resultBuffer;\r\n}\r\nconst log2 = Math.log(2);\r\nfunction nearestPowerOf2(length) {\r\n const base = (Math.log(length) / log2);\r\n const floor = Math.floor(base);\r\n const round = Math.round(base);\r\n return ((floor === round) ? floor : round);\r\n}\r\nfunction clearProps(object, propsArray) {\r\n for (const prop of propsArray) {\r\n delete object[prop];\r\n }\r\n}\n\nexport { arrayBufferToString, bufferToHexCodes, checkBufferParams, clearProps, fromBase64, getParametersValue, getUTCDate, isEqualBuffer, nearestPowerOf2, padNumber, stringToArrayBuffer, toBase64, utilConcatBuf, utilConcatView, utilDecodeTC, utilEncodeTC, utilFromBase, utilToBase };\n","/*!\n * Copyright (c) 2014, GMO GlobalSign\n * Copyright (c) 2015-2022, Peculiar Ventures\n * All rights reserved.\n * \n * Author 2014-2019, Yury Strozhevsky\n * \n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n * \n * * Redistributions of source code must retain the above copyright notice, this\n * list of conditions and the following disclaimer.\n * \n * * Redistributions in binary form must reproduce the above copyright notice, this\n * list of conditions and the following disclaimer in the documentation and/or\n * other materials provided with the distribution.\n * \n * * Neither the name of the copyright holder nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR\n * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON\n * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n * \n */\n\nimport * as pvtsutils from 'pvtsutils';\nimport * as pvutils from 'pvutils';\n\nfunction assertBigInt() {\n if (typeof BigInt === \"undefined\") {\n throw new Error(\"BigInt is not defined. Your environment doesn't implement BigInt.\");\n }\n}\nfunction concat(buffers) {\n let outputLength = 0;\n let prevLength = 0;\n for (let i = 0; i < buffers.length; i++) {\n const buffer = buffers[i];\n outputLength += buffer.byteLength;\n }\n const retView = new Uint8Array(outputLength);\n for (let i = 0; i < buffers.length; i++) {\n const buffer = buffers[i];\n retView.set(new Uint8Array(buffer), prevLength);\n prevLength += buffer.byteLength;\n }\n return retView.buffer;\n}\nfunction checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) {\n if (!(inputBuffer instanceof Uint8Array)) {\n baseBlock.error = \"Wrong parameter: inputBuffer must be 'Uint8Array'\";\n return false;\n }\n if (!inputBuffer.byteLength) {\n baseBlock.error = \"Wrong parameter: inputBuffer has zero length\";\n return false;\n }\n if (inputOffset < 0) {\n baseBlock.error = \"Wrong parameter: inputOffset less than zero\";\n return false;\n }\n if (inputLength < 0) {\n baseBlock.error = \"Wrong parameter: inputLength less than zero\";\n return false;\n }\n if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) {\n baseBlock.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\n return false;\n }\n return true;\n}\n\nclass ViewWriter {\n constructor() {\n this.items = [];\n }\n write(buf) {\n this.items.push(buf);\n }\n final() {\n return concat(this.items);\n }\n}\n\nconst powers2 = [new Uint8Array([1])];\nconst digitsString = \"0123456789\";\nconst NAME = \"name\";\nconst VALUE_HEX_VIEW = \"valueHexView\";\nconst IS_HEX_ONLY = \"isHexOnly\";\nconst ID_BLOCK = \"idBlock\";\nconst TAG_CLASS = \"tagClass\";\nconst TAG_NUMBER = \"tagNumber\";\nconst IS_CONSTRUCTED = \"isConstructed\";\nconst FROM_BER = \"fromBER\";\nconst TO_BER = \"toBER\";\nconst LOCAL = \"local\";\nconst EMPTY_STRING = \"\";\nconst EMPTY_BUFFER = new ArrayBuffer(0);\nconst EMPTY_VIEW = new Uint8Array(0);\nconst END_OF_CONTENT_NAME = \"EndOfContent\";\nconst OCTET_STRING_NAME = \"OCTET STRING\";\nconst BIT_STRING_NAME = \"BIT STRING\";\n\nfunction HexBlock(BaseClass) {\n var _a;\n return _a = class Some extends BaseClass {\n get valueHex() {\n return this.valueHexView.slice().buffer;\n }\n set valueHex(value) {\n this.valueHexView = new Uint8Array(value);\n }\n constructor(...args) {\n var _b;\n super(...args);\n const params = args[0] || {};\n this.isHexOnly = (_b = params.isHexOnly) !== null && _b !== void 0 ? _b : false;\n this.valueHexView = params.valueHex ? pvtsutils.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n const endLength = inputOffset + inputLength;\n this.valueHexView = view.subarray(inputOffset, endLength);\n if (!this.valueHexView.length) {\n this.warnings.push(\"Zero buffer length\");\n return inputOffset;\n }\n this.blockLength = inputLength;\n return endLength;\n }\n toBER(sizeOnly = false) {\n if (!this.isHexOnly) {\n this.error = \"Flag 'isHexOnly' is not set, abort\";\n return EMPTY_BUFFER;\n }\n if (sizeOnly) {\n return new ArrayBuffer(this.valueHexView.byteLength);\n }\n return (this.valueHexView.byteLength === this.valueHexView.buffer.byteLength)\n ? this.valueHexView.buffer\n : this.valueHexView.slice().buffer;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n isHexOnly: this.isHexOnly,\n valueHex: pvtsutils.Convert.ToHex(this.valueHexView),\n };\n }\n },\n _a.NAME = \"hexBlock\",\n _a;\n}\n\nclass LocalBaseBlock {\n static blockName() {\n return this.NAME;\n }\n get valueBeforeDecode() {\n return this.valueBeforeDecodeView.slice().buffer;\n }\n set valueBeforeDecode(value) {\n this.valueBeforeDecodeView = new Uint8Array(value);\n }\n constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW, } = {}) {\n this.blockLength = blockLength;\n this.error = error;\n this.warnings = warnings;\n this.valueBeforeDecodeView = pvtsutils.BufferSourceConverter.toUint8Array(valueBeforeDecode);\n }\n toJSON() {\n return {\n blockName: this.constructor.NAME,\n blockLength: this.blockLength,\n error: this.error,\n warnings: this.warnings,\n valueBeforeDecode: pvtsutils.Convert.ToHex(this.valueBeforeDecodeView),\n };\n }\n}\nLocalBaseBlock.NAME = \"baseBlock\";\n\nclass ValueBlock extends LocalBaseBlock {\n fromBER(_inputBuffer, _inputOffset, _inputLength) {\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\n }\n toBER(_sizeOnly, _writer) {\n throw TypeError(\"User need to make a specific function in a class which extends 'ValueBlock'\");\n }\n}\nValueBlock.NAME = \"valueBlock\";\n\nclass LocalIdentificationBlock extends HexBlock(LocalBaseBlock) {\n constructor({ idBlock = {} } = {}) {\n var _a, _b, _c, _d;\n super();\n if (idBlock) {\n this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false;\n this.valueHexView = idBlock.valueHex\n ? pvtsutils.BufferSourceConverter.toUint8Array(idBlock.valueHex)\n : EMPTY_VIEW;\n this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1;\n this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1;\n this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false;\n }\n else {\n this.tagClass = -1;\n this.tagNumber = -1;\n this.isConstructed = false;\n }\n }\n toBER(sizeOnly = false) {\n let firstOctet = 0;\n switch (this.tagClass) {\n case 1:\n firstOctet |= 0x00;\n break;\n case 2:\n firstOctet |= 0x40;\n break;\n case 3:\n firstOctet |= 0x80;\n break;\n case 4:\n firstOctet |= 0xC0;\n break;\n default:\n this.error = \"Unknown tag class\";\n return EMPTY_BUFFER;\n }\n if (this.isConstructed)\n firstOctet |= 0x20;\n if (this.tagNumber < 31 && !this.isHexOnly) {\n const retView = new Uint8Array(1);\n if (!sizeOnly) {\n let number = this.tagNumber;\n number &= 0x1F;\n firstOctet |= number;\n retView[0] = firstOctet;\n }\n return retView.buffer;\n }\n if (!this.isHexOnly) {\n const encodedBuf = pvutils.utilToBase(this.tagNumber, 7);\n const encodedView = new Uint8Array(encodedBuf);\n const size = encodedBuf.byteLength;\n const retView = new Uint8Array(size + 1);\n retView[0] = (firstOctet | 0x1F);\n if (!sizeOnly) {\n for (let i = 0; i < (size - 1); i++)\n retView[i + 1] = encodedView[i] | 0x80;\n retView[size] = encodedView[size - 1];\n }\n return retView.buffer;\n }\n const retView = new Uint8Array(this.valueHexView.byteLength + 1);\n retView[0] = (firstOctet | 0x1F);\n if (!sizeOnly) {\n const curView = this.valueHexView;\n for (let i = 0; i < (curView.length - 1); i++)\n retView[i + 1] = curView[i] | 0x80;\n retView[this.valueHexView.byteLength] = curView[curView.length - 1];\n }\n return retView.buffer;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const inputView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\n if (intBuffer.length === 0) {\n this.error = \"Zero buffer length\";\n return -1;\n }\n const tagClassMask = intBuffer[0] & 0xC0;\n switch (tagClassMask) {\n case 0x00:\n this.tagClass = (1);\n break;\n case 0x40:\n this.tagClass = (2);\n break;\n case 0x80:\n this.tagClass = (3);\n break;\n case 0xC0:\n this.tagClass = (4);\n break;\n default:\n this.error = \"Unknown tag class\";\n return -1;\n }\n this.isConstructed = (intBuffer[0] & 0x20) === 0x20;\n this.isHexOnly = false;\n const tagNumberMask = intBuffer[0] & 0x1F;\n if (tagNumberMask !== 0x1F) {\n this.tagNumber = (tagNumberMask);\n this.blockLength = 1;\n }\n else {\n let count = 1;\n let intTagNumberBuffer = this.valueHexView = new Uint8Array(255);\n let tagNumberBufferMaxLength = 255;\n while (intBuffer[count] & 0x80) {\n intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F;\n count++;\n if (count >= intBuffer.length) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n if (count === tagNumberBufferMaxLength) {\n tagNumberBufferMaxLength += 255;\n const tempBufferView = new Uint8Array(tagNumberBufferMaxLength);\n for (let i = 0; i < intTagNumberBuffer.length; i++)\n tempBufferView[i] = intTagNumberBuffer[i];\n intTagNumberBuffer = this.valueHexView = new Uint8Array(tagNumberBufferMaxLength);\n }\n }\n this.blockLength = (count + 1);\n intTagNumberBuffer[count - 1] = intBuffer[count] & 0x7F;\n const tempBufferView = new Uint8Array(count);\n for (let i = 0; i < count; i++)\n tempBufferView[i] = intTagNumberBuffer[i];\n intTagNumberBuffer = this.valueHexView = new Uint8Array(count);\n intTagNumberBuffer.set(tempBufferView);\n if (this.blockLength <= 9)\n this.tagNumber = pvutils.utilFromBase(intTagNumberBuffer, 7);\n else {\n this.isHexOnly = true;\n this.warnings.push(\"Tag too long, represented as hex-coded\");\n }\n }\n if (((this.tagClass === 1))\n && (this.isConstructed)) {\n switch (this.tagNumber) {\n case 1:\n case 2:\n case 5:\n case 6:\n case 9:\n case 13:\n case 14:\n case 23:\n case 24:\n case 31:\n case 32:\n case 33:\n case 34:\n this.error = \"Constructed encoding used for primitive type\";\n return -1;\n }\n }\n return (inputOffset + this.blockLength);\n }\n toJSON() {\n return {\n ...super.toJSON(),\n tagClass: this.tagClass,\n tagNumber: this.tagNumber,\n isConstructed: this.isConstructed,\n };\n }\n}\nLocalIdentificationBlock.NAME = \"identificationBlock\";\n\nclass LocalLengthBlock extends LocalBaseBlock {\n constructor({ lenBlock = {} } = {}) {\n var _a, _b, _c;\n super();\n this.isIndefiniteForm = (_a = lenBlock.isIndefiniteForm) !== null && _a !== void 0 ? _a : false;\n this.longFormUsed = (_b = lenBlock.longFormUsed) !== null && _b !== void 0 ? _b : false;\n this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = view.subarray(inputOffset, inputOffset + inputLength);\n if (intBuffer.length === 0) {\n this.error = \"Zero buffer length\";\n return -1;\n }\n if (intBuffer[0] === 0xFF) {\n this.error = \"Length block 0xFF is reserved by standard\";\n return -1;\n }\n this.isIndefiniteForm = intBuffer[0] === 0x80;\n if (this.isIndefiniteForm) {\n this.blockLength = 1;\n return (inputOffset + this.blockLength);\n }\n this.longFormUsed = !!(intBuffer[0] & 0x80);\n if (this.longFormUsed === false) {\n this.length = (intBuffer[0]);\n this.blockLength = 1;\n return (inputOffset + this.blockLength);\n }\n const count = intBuffer[0] & 0x7F;\n if (count > 8) {\n this.error = \"Too big integer\";\n return -1;\n }\n if ((count + 1) > intBuffer.length) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n const lenOffset = inputOffset + 1;\n const lengthBufferView = view.subarray(lenOffset, lenOffset + count);\n if (lengthBufferView[count - 1] === 0x00)\n this.warnings.push(\"Needlessly long encoded length\");\n this.length = pvutils.utilFromBase(lengthBufferView, 8);\n if (this.longFormUsed && (this.length <= 127))\n this.warnings.push(\"Unnecessary usage of long length form\");\n this.blockLength = count + 1;\n return (inputOffset + this.blockLength);\n }\n toBER(sizeOnly = false) {\n let retBuf;\n let retView;\n if (this.length > 127)\n this.longFormUsed = true;\n if (this.isIndefiniteForm) {\n retBuf = new ArrayBuffer(1);\n if (sizeOnly === false) {\n retView = new Uint8Array(retBuf);\n retView[0] = 0x80;\n }\n return retBuf;\n }\n if (this.longFormUsed) {\n const encodedBuf = pvutils.utilToBase(this.length, 8);\n if (encodedBuf.byteLength > 127) {\n this.error = \"Too big length\";\n return (EMPTY_BUFFER);\n }\n retBuf = new ArrayBuffer(encodedBuf.byteLength + 1);\n if (sizeOnly)\n return retBuf;\n const encodedView = new Uint8Array(encodedBuf);\n retView = new Uint8Array(retBuf);\n retView[0] = encodedBuf.byteLength | 0x80;\n for (let i = 0; i < encodedBuf.byteLength; i++)\n retView[i + 1] = encodedView[i];\n return retBuf;\n }\n retBuf = new ArrayBuffer(1);\n if (sizeOnly === false) {\n retView = new Uint8Array(retBuf);\n retView[0] = this.length;\n }\n return retBuf;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n isIndefiniteForm: this.isIndefiniteForm,\n longFormUsed: this.longFormUsed,\n length: this.length,\n };\n }\n}\nLocalLengthBlock.NAME = \"lengthBlock\";\n\nconst typeStore = {};\n\nclass BaseBlock extends LocalBaseBlock {\n constructor({ name = EMPTY_STRING, optional = false, primitiveSchema, ...parameters } = {}, valueBlockType) {\n super(parameters);\n this.name = name;\n this.optional = optional;\n if (primitiveSchema) {\n this.primitiveSchema = primitiveSchema;\n }\n this.idBlock = new LocalIdentificationBlock(parameters);\n this.lenBlock = new LocalLengthBlock(parameters);\n this.valueBlock = valueBlockType ? new valueBlockType(parameters) : new ValueBlock(parameters);\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm)\n ? inputLength\n : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n toBER(sizeOnly, writer) {\n const _writer = writer || new ViewWriter();\n if (!writer) {\n prepareIndefiniteForm(this);\n }\n const idBlockBuf = this.idBlock.toBER(sizeOnly);\n _writer.write(idBlockBuf);\n if (this.lenBlock.isIndefiniteForm) {\n _writer.write(new Uint8Array([0x80]).buffer);\n this.valueBlock.toBER(sizeOnly, _writer);\n _writer.write(new ArrayBuffer(2));\n }\n else {\n const valueBlockBuf = this.valueBlock.toBER(sizeOnly);\n this.lenBlock.length = valueBlockBuf.byteLength;\n const lenBlockBuf = this.lenBlock.toBER(sizeOnly);\n _writer.write(lenBlockBuf);\n _writer.write(valueBlockBuf);\n }\n if (!writer) {\n return _writer.final();\n }\n return EMPTY_BUFFER;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n idBlock: this.idBlock.toJSON(),\n lenBlock: this.lenBlock.toJSON(),\n valueBlock: this.valueBlock.toJSON(),\n name: this.name,\n optional: this.optional,\n };\n if (this.primitiveSchema)\n object.primitiveSchema = this.primitiveSchema.toJSON();\n return object;\n }\n toString(encoding = \"ascii\") {\n if (encoding === \"ascii\") {\n return this.onAsciiEncoding();\n }\n return pvtsutils.Convert.ToHex(this.toBER());\n }\n onAsciiEncoding() {\n const name = this.constructor.NAME;\n const value = pvtsutils.Convert.ToHex(this.valueBlock.valueBeforeDecodeView);\n return `${name} : ${value}`;\n }\n isEqual(other) {\n if (this === other) {\n return true;\n }\n if (!(other instanceof this.constructor)) {\n return false;\n }\n const thisRaw = this.toBER();\n const otherRaw = other.toBER();\n return pvutils.isEqualBuffer(thisRaw, otherRaw);\n }\n}\nBaseBlock.NAME = \"BaseBlock\";\nfunction prepareIndefiniteForm(baseBlock) {\n var _a;\n if (baseBlock instanceof typeStore.Constructed) {\n for (const value of baseBlock.valueBlock.value) {\n if (prepareIndefiniteForm(value)) {\n baseBlock.lenBlock.isIndefiniteForm = true;\n }\n }\n }\n return !!((_a = baseBlock.lenBlock) === null || _a === void 0 ? void 0 : _a.isIndefiniteForm);\n}\n\nclass BaseStringBlock extends BaseBlock {\n getValue() {\n return this.valueBlock.value;\n }\n setValue(value) {\n this.valueBlock.value = value;\n }\n constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) {\n super(parameters, stringValueBlockType);\n if (value) {\n this.fromString(value);\n }\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm)\n ? inputLength\n : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n this.fromBuffer(this.valueBlock.valueHexView);\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : '${this.valueBlock.value}'`;\n }\n}\nBaseStringBlock.NAME = \"BaseStringBlock\";\n\nclass LocalPrimitiveValueBlock extends HexBlock(ValueBlock) {\n constructor({ isHexOnly = true, ...parameters } = {}) {\n super(parameters);\n this.isHexOnly = isHexOnly;\n }\n}\nLocalPrimitiveValueBlock.NAME = \"PrimitiveValueBlock\";\n\nvar _a$w;\nclass Primitive extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalPrimitiveValueBlock);\n this.idBlock.isConstructed = false;\n }\n}\n_a$w = Primitive;\n(() => {\n typeStore.Primitive = _a$w;\n})();\nPrimitive.NAME = \"PRIMITIVE\";\n\nfunction localChangeType(inputObject, newType) {\n if (inputObject instanceof newType) {\n return inputObject;\n }\n const newObject = new newType();\n newObject.idBlock = inputObject.idBlock;\n newObject.lenBlock = inputObject.lenBlock;\n newObject.warnings = inputObject.warnings;\n newObject.valueBeforeDecodeView = inputObject.valueBeforeDecodeView;\n return newObject;\n}\nfunction localFromBER(inputBuffer, inputOffset = 0, inputLength = inputBuffer.length) {\n const incomingOffset = inputOffset;\n let returnObject = new BaseBlock({}, ValueBlock);\n const baseBlock = new LocalBaseBlock();\n if (!checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength)) {\n returnObject.error = baseBlock.error;\n return {\n offset: -1,\n result: returnObject,\n };\n }\n const intBuffer = inputBuffer.subarray(inputOffset, inputOffset + inputLength);\n if (!intBuffer.length) {\n returnObject.error = \"Zero buffer length\";\n return {\n offset: -1,\n result: returnObject,\n };\n }\n let resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength);\n if (returnObject.idBlock.warnings.length) {\n returnObject.warnings.concat(returnObject.idBlock.warnings);\n }\n if (resultOffset === -1) {\n returnObject.error = returnObject.idBlock.error;\n return {\n offset: -1,\n result: returnObject,\n };\n }\n inputOffset = resultOffset;\n inputLength -= returnObject.idBlock.blockLength;\n resultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength);\n if (returnObject.lenBlock.warnings.length) {\n returnObject.warnings.concat(returnObject.lenBlock.warnings);\n }\n if (resultOffset === -1) {\n returnObject.error = returnObject.lenBlock.error;\n return {\n offset: -1,\n result: returnObject,\n };\n }\n inputOffset = resultOffset;\n inputLength -= returnObject.lenBlock.blockLength;\n if (!returnObject.idBlock.isConstructed\n && returnObject.lenBlock.isIndefiniteForm) {\n returnObject.error = \"Indefinite length form used for primitive encoding form\";\n return {\n offset: -1,\n result: returnObject,\n };\n }\n let newASN1Type = BaseBlock;\n switch (returnObject.idBlock.tagClass) {\n case 1:\n if ((returnObject.idBlock.tagNumber >= 37)\n && (returnObject.idBlock.isHexOnly === false)) {\n returnObject.error = \"UNIVERSAL 37 and upper tags are reserved by ASN.1 standard\";\n return {\n offset: -1,\n result: returnObject,\n };\n }\n switch (returnObject.idBlock.tagNumber) {\n case 0:\n if ((returnObject.idBlock.isConstructed)\n && (returnObject.lenBlock.length > 0)) {\n returnObject.error = \"Type [UNIVERSAL 0] is reserved\";\n return {\n offset: -1,\n result: returnObject,\n };\n }\n newASN1Type = typeStore.EndOfContent;\n break;\n case 1:\n newASN1Type = typeStore.Boolean;\n break;\n case 2:\n newASN1Type = typeStore.Integer;\n break;\n case 3:\n newASN1Type = typeStore.BitString;\n break;\n case 4:\n newASN1Type = typeStore.OctetString;\n break;\n case 5:\n newASN1Type = typeStore.Null;\n break;\n case 6:\n newASN1Type = typeStore.ObjectIdentifier;\n break;\n case 10:\n newASN1Type = typeStore.Enumerated;\n break;\n case 12:\n newASN1Type = typeStore.Utf8String;\n break;\n case 13:\n newASN1Type = typeStore.RelativeObjectIdentifier;\n break;\n case 14:\n newASN1Type = typeStore.TIME;\n break;\n case 15:\n returnObject.error = \"[UNIVERSAL 15] is reserved by ASN.1 standard\";\n return {\n offset: -1,\n result: returnObject,\n };\n case 16:\n newASN1Type = typeStore.Sequence;\n break;\n case 17:\n newASN1Type = typeStore.Set;\n break;\n case 18:\n newASN1Type = typeStore.NumericString;\n break;\n case 19:\n newASN1Type = typeStore.PrintableString;\n break;\n case 20:\n newASN1Type = typeStore.TeletexString;\n break;\n case 21:\n newASN1Type = typeStore.VideotexString;\n break;\n case 22:\n newASN1Type = typeStore.IA5String;\n break;\n case 23:\n newASN1Type = typeStore.UTCTime;\n break;\n case 24:\n newASN1Type = typeStore.GeneralizedTime;\n break;\n case 25:\n newASN1Type = typeStore.GraphicString;\n break;\n case 26:\n newASN1Type = typeStore.VisibleString;\n break;\n case 27:\n newASN1Type = typeStore.GeneralString;\n break;\n case 28:\n newASN1Type = typeStore.UniversalString;\n break;\n case 29:\n newASN1Type = typeStore.CharacterString;\n break;\n case 30:\n newASN1Type = typeStore.BmpString;\n break;\n case 31:\n newASN1Type = typeStore.DATE;\n break;\n case 32:\n newASN1Type = typeStore.TimeOfDay;\n break;\n case 33:\n newASN1Type = typeStore.DateTime;\n break;\n case 34:\n newASN1Type = typeStore.Duration;\n break;\n default: {\n const newObject = returnObject.idBlock.isConstructed\n ? new typeStore.Constructed()\n : new typeStore.Primitive();\n newObject.idBlock = returnObject.idBlock;\n newObject.lenBlock = returnObject.lenBlock;\n newObject.warnings = returnObject.warnings;\n returnObject = newObject;\n }\n }\n break;\n case 2:\n case 3:\n case 4:\n default: {\n newASN1Type = returnObject.idBlock.isConstructed\n ? typeStore.Constructed\n : typeStore.Primitive;\n }\n }\n returnObject = localChangeType(returnObject, newASN1Type);\n resultOffset = returnObject.fromBER(inputBuffer, inputOffset, returnObject.lenBlock.isIndefiniteForm ? inputLength : returnObject.lenBlock.length);\n returnObject.valueBeforeDecodeView = inputBuffer.subarray(incomingOffset, incomingOffset + returnObject.blockLength);\n return {\n offset: resultOffset,\n result: returnObject,\n };\n}\nfunction fromBER(inputBuffer) {\n if (!inputBuffer.byteLength) {\n const result = new BaseBlock({}, ValueBlock);\n result.error = \"Input buffer has zero length\";\n return {\n offset: -1,\n result,\n };\n }\n return localFromBER(pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength);\n}\n\nfunction checkLen(indefiniteLength, length) {\n if (indefiniteLength) {\n return 1;\n }\n return length;\n}\nclass LocalConstructedValueBlock extends ValueBlock {\n constructor({ value = [], isIndefiniteForm = false, ...parameters } = {}) {\n super(parameters);\n this.value = value;\n this.isIndefiniteForm = isIndefiniteForm;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const view = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, view, inputOffset, inputLength)) {\n return -1;\n }\n this.valueBeforeDecodeView = view.subarray(inputOffset, inputOffset + inputLength);\n if (this.valueBeforeDecodeView.length === 0) {\n this.warnings.push(\"Zero buffer length\");\n return inputOffset;\n }\n let currentOffset = inputOffset;\n while (checkLen(this.isIndefiniteForm, inputLength) > 0) {\n const returnObject = localFromBER(view, currentOffset, inputLength);\n if (returnObject.offset === -1) {\n this.error = returnObject.result.error;\n this.warnings.concat(returnObject.result.warnings);\n return -1;\n }\n currentOffset = returnObject.offset;\n this.blockLength += returnObject.result.blockLength;\n inputLength -= returnObject.result.blockLength;\n this.value.push(returnObject.result);\n if (this.isIndefiniteForm && returnObject.result.constructor.NAME === END_OF_CONTENT_NAME) {\n break;\n }\n }\n if (this.isIndefiniteForm) {\n if (this.value[this.value.length - 1].constructor.NAME === END_OF_CONTENT_NAME) {\n this.value.pop();\n }\n else {\n this.warnings.push(\"No EndOfContent block encoded\");\n }\n }\n return currentOffset;\n }\n toBER(sizeOnly, writer) {\n const _writer = writer || new ViewWriter();\n for (let i = 0; i < this.value.length; i++) {\n this.value[i].toBER(sizeOnly, _writer);\n }\n if (!writer) {\n return _writer.final();\n }\n return EMPTY_BUFFER;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n isIndefiniteForm: this.isIndefiniteForm,\n value: [],\n };\n for (const value of this.value) {\n object.value.push(value.toJSON());\n }\n return object;\n }\n}\nLocalConstructedValueBlock.NAME = \"ConstructedValueBlock\";\n\nvar _a$v;\nclass Constructed extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalConstructedValueBlock);\n this.idBlock.isConstructed = true;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\n const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length);\n if (resultOffset === -1) {\n this.error = this.valueBlock.error;\n return resultOffset;\n }\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n if (!this.valueBlock.error.length)\n this.blockLength += this.valueBlock.blockLength;\n return resultOffset;\n }\n onAsciiEncoding() {\n const values = [];\n for (const value of this.valueBlock.value) {\n values.push(value.toString(\"ascii\").split(\"\\n\").map((o) => ` ${o}`).join(\"\\n\"));\n }\n const blockName = this.idBlock.tagClass === 3\n ? `[${this.idBlock.tagNumber}]`\n : this.constructor.NAME;\n return values.length\n ? `${blockName} :\\n${values.join(\"\\n\")}`\n : `${blockName} :`;\n }\n}\n_a$v = Constructed;\n(() => {\n typeStore.Constructed = _a$v;\n})();\nConstructed.NAME = \"CONSTRUCTED\";\n\nclass LocalEndOfContentValueBlock extends ValueBlock {\n fromBER(inputBuffer, inputOffset, _inputLength) {\n return inputOffset;\n }\n toBER(_sizeOnly) {\n return EMPTY_BUFFER;\n }\n}\nLocalEndOfContentValueBlock.override = \"EndOfContentValueBlock\";\n\nvar _a$u;\nclass EndOfContent extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalEndOfContentValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 0;\n }\n}\n_a$u = EndOfContent;\n(() => {\n typeStore.EndOfContent = _a$u;\n})();\nEndOfContent.NAME = END_OF_CONTENT_NAME;\n\nvar _a$t;\nclass Null extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, ValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 5;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n if (this.lenBlock.length > 0)\n this.warnings.push(\"Non-zero length of value block for Null type\");\n if (!this.idBlock.error.length)\n this.blockLength += this.idBlock.blockLength;\n if (!this.lenBlock.error.length)\n this.blockLength += this.lenBlock.blockLength;\n this.blockLength += inputLength;\n if ((inputOffset + inputLength) > inputBuffer.byteLength) {\n this.error = \"End of input reached before message was fully decoded (inconsistent offset and length values)\";\n return -1;\n }\n return (inputOffset + inputLength);\n }\n toBER(sizeOnly, writer) {\n const retBuf = new ArrayBuffer(2);\n if (!sizeOnly) {\n const retView = new Uint8Array(retBuf);\n retView[0] = 0x05;\n retView[1] = 0x00;\n }\n if (writer) {\n writer.write(retBuf);\n }\n return retBuf;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME}`;\n }\n}\n_a$t = Null;\n(() => {\n typeStore.Null = _a$t;\n})();\nNull.NAME = \"NULL\";\n\nclass LocalBooleanValueBlock extends HexBlock(ValueBlock) {\n get value() {\n for (const octet of this.valueHexView) {\n if (octet > 0) {\n return true;\n }\n }\n return false;\n }\n set value(value) {\n this.valueHexView[0] = value ? 0xFF : 0x00;\n }\n constructor({ value, ...parameters } = {}) {\n super(parameters);\n if (parameters.valueHex) {\n this.valueHexView = pvtsutils.BufferSourceConverter.toUint8Array(parameters.valueHex);\n }\n else {\n this.valueHexView = new Uint8Array(1);\n }\n if (value) {\n this.value = value;\n }\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const inputView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\n return -1;\n }\n this.valueHexView = inputView.subarray(inputOffset, inputOffset + inputLength);\n if (inputLength > 1)\n this.warnings.push(\"Boolean value encoded in more then 1 octet\");\n this.isHexOnly = true;\n pvutils.utilDecodeTC.call(this);\n this.blockLength = inputLength;\n return (inputOffset + inputLength);\n }\n toBER() {\n return this.valueHexView.slice();\n }\n toJSON() {\n return {\n ...super.toJSON(),\n value: this.value,\n };\n }\n}\nLocalBooleanValueBlock.NAME = \"BooleanValueBlock\";\n\nvar _a$s;\nclass Boolean extends BaseBlock {\n getValue() {\n return this.valueBlock.value;\n }\n setValue(value) {\n this.valueBlock.value = value;\n }\n constructor(parameters = {}) {\n super(parameters, LocalBooleanValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 1;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${this.getValue}`;\n }\n}\n_a$s = Boolean;\n(() => {\n typeStore.Boolean = _a$s;\n})();\nBoolean.NAME = \"BOOLEAN\";\n\nclass LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock) {\n constructor({ isConstructed = false, ...parameters } = {}) {\n super(parameters);\n this.isConstructed = isConstructed;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n let resultOffset = 0;\n if (this.isConstructed) {\n this.isHexOnly = false;\n resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\n if (resultOffset === -1)\n return resultOffset;\n for (let i = 0; i < this.value.length; i++) {\n const currentBlockName = this.value[i].constructor.NAME;\n if (currentBlockName === END_OF_CONTENT_NAME) {\n if (this.isIndefiniteForm)\n break;\n else {\n this.error = \"EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only\";\n return -1;\n }\n }\n if (currentBlockName !== OCTET_STRING_NAME) {\n this.error = \"OCTET STRING may consists of OCTET STRINGs only\";\n return -1;\n }\n }\n }\n else {\n this.isHexOnly = true;\n resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\n this.blockLength = inputLength;\n }\n return resultOffset;\n }\n toBER(sizeOnly, writer) {\n if (this.isConstructed)\n return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer);\n return sizeOnly\n ? new ArrayBuffer(this.valueHexView.byteLength)\n : this.valueHexView.slice().buffer;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n isConstructed: this.isConstructed,\n };\n }\n}\nLocalOctetStringValueBlock.NAME = \"OctetStringValueBlock\";\n\nvar _a$r;\nclass OctetString extends BaseBlock {\n constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) {\n var _b, _c;\n (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length));\n super({\n idBlock: {\n isConstructed: parameters.isConstructed,\n ...idBlock,\n },\n lenBlock: {\n ...lenBlock,\n isIndefiniteForm: !!parameters.isIndefiniteForm,\n },\n ...parameters,\n }, LocalOctetStringValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 4;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n this.valueBlock.isConstructed = this.idBlock.isConstructed;\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\n if (inputLength === 0) {\n if (this.idBlock.error.length === 0)\n this.blockLength += this.idBlock.blockLength;\n if (this.lenBlock.error.length === 0)\n this.blockLength += this.lenBlock.blockLength;\n return inputOffset;\n }\n if (!this.valueBlock.isConstructed) {\n const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer;\n const buf = view.subarray(inputOffset, inputOffset + inputLength);\n try {\n if (buf.byteLength) {\n const asn = localFromBER(buf, 0, buf.byteLength);\n if (asn.offset !== -1 && asn.offset === inputLength) {\n this.valueBlock.value = [asn.result];\n }\n }\n }\n catch {\n }\n }\n return super.fromBER(inputBuffer, inputOffset, inputLength);\n }\n onAsciiEncoding() {\n if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {\n return Constructed.prototype.onAsciiEncoding.call(this);\n }\n const name = this.constructor.NAME;\n const value = pvtsutils.Convert.ToHex(this.valueBlock.valueHexView);\n return `${name} : ${value}`;\n }\n getValue() {\n if (!this.idBlock.isConstructed) {\n return this.valueBlock.valueHexView.slice().buffer;\n }\n const array = [];\n for (const content of this.valueBlock.value) {\n if (content instanceof _a$r) {\n array.push(content.valueBlock.valueHexView);\n }\n }\n return pvtsutils.BufferSourceConverter.concat(array);\n }\n}\n_a$r = OctetString;\n(() => {\n typeStore.OctetString = _a$r;\n})();\nOctetString.NAME = OCTET_STRING_NAME;\n\nclass LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) {\n constructor({ unusedBits = 0, isConstructed = false, ...parameters } = {}) {\n super(parameters);\n this.unusedBits = unusedBits;\n this.isConstructed = isConstructed;\n this.blockLength = this.valueHexView.byteLength;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n if (!inputLength) {\n return inputOffset;\n }\n let resultOffset = -1;\n if (this.isConstructed) {\n resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength);\n if (resultOffset === -1)\n return resultOffset;\n for (const value of this.value) {\n const currentBlockName = value.constructor.NAME;\n if (currentBlockName === END_OF_CONTENT_NAME) {\n if (this.isIndefiniteForm)\n break;\n else {\n this.error = \"EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only\";\n return -1;\n }\n }\n if (currentBlockName !== BIT_STRING_NAME) {\n this.error = \"BIT STRING may consists of BIT STRINGs only\";\n return -1;\n }\n const valueBlock = value.valueBlock;\n if ((this.unusedBits > 0) && (valueBlock.unusedBits > 0)) {\n this.error = \"Using of \\\"unused bits\\\" inside constructive BIT STRING allowed for least one only\";\n return -1;\n }\n this.unusedBits = valueBlock.unusedBits;\n }\n return resultOffset;\n }\n const inputView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\n this.unusedBits = intBuffer[0];\n if (this.unusedBits > 7) {\n this.error = \"Unused bits for BitString must be in range 0-7\";\n return -1;\n }\n if (!this.unusedBits) {\n const buf = intBuffer.subarray(1);\n try {\n if (buf.byteLength) {\n const asn = localFromBER(buf, 0, buf.byteLength);\n if (asn.offset !== -1 && asn.offset === (inputLength - 1)) {\n this.value = [asn.result];\n }\n }\n }\n catch {\n }\n }\n this.valueHexView = intBuffer.subarray(1);\n this.blockLength = intBuffer.length;\n return (inputOffset + inputLength);\n }\n toBER(sizeOnly, writer) {\n if (this.isConstructed) {\n return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer);\n }\n if (sizeOnly) {\n return new ArrayBuffer(this.valueHexView.byteLength + 1);\n }\n if (!this.valueHexView.byteLength) {\n const empty = new Uint8Array(1);\n empty[0] = 0;\n return empty.buffer;\n }\n const retView = new Uint8Array(this.valueHexView.length + 1);\n retView[0] = this.unusedBits;\n retView.set(this.valueHexView, 1);\n return retView.buffer;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n unusedBits: this.unusedBits,\n isConstructed: this.isConstructed,\n };\n }\n}\nLocalBitStringValueBlock.NAME = \"BitStringValueBlock\";\n\nvar _a$q;\nclass BitString extends BaseBlock {\n constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) {\n var _b, _c;\n (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length));\n super({\n idBlock: {\n isConstructed: parameters.isConstructed,\n ...idBlock,\n },\n lenBlock: {\n ...lenBlock,\n isIndefiniteForm: !!parameters.isIndefiniteForm,\n },\n ...parameters,\n }, LocalBitStringValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 3;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n this.valueBlock.isConstructed = this.idBlock.isConstructed;\n this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm;\n return super.fromBER(inputBuffer, inputOffset, inputLength);\n }\n onAsciiEncoding() {\n if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) {\n return Constructed.prototype.onAsciiEncoding.call(this);\n }\n else {\n const bits = [];\n const valueHex = this.valueBlock.valueHexView;\n for (const byte of valueHex) {\n bits.push(byte.toString(2).padStart(8, \"0\"));\n }\n const bitsStr = bits.join(\"\");\n const name = this.constructor.NAME;\n const value = bitsStr.substring(0, bitsStr.length - this.valueBlock.unusedBits);\n return `${name} : ${value}`;\n }\n }\n}\n_a$q = BitString;\n(() => {\n typeStore.BitString = _a$q;\n})();\nBitString.NAME = BIT_STRING_NAME;\n\nvar _a$p;\nfunction viewAdd(first, second) {\n const c = new Uint8Array([0]);\n const firstView = new Uint8Array(first);\n const secondView = new Uint8Array(second);\n let firstViewCopy = firstView.slice(0);\n const firstViewCopyLength = firstViewCopy.length - 1;\n const secondViewCopy = secondView.slice(0);\n const secondViewCopyLength = secondViewCopy.length - 1;\n let value = 0;\n const max = (secondViewCopyLength < firstViewCopyLength) ? firstViewCopyLength : secondViewCopyLength;\n let counter = 0;\n for (let i = max; i >= 0; i--, counter++) {\n switch (true) {\n case (counter < secondViewCopy.length):\n value = firstViewCopy[firstViewCopyLength - counter] + secondViewCopy[secondViewCopyLength - counter] + c[0];\n break;\n default:\n value = firstViewCopy[firstViewCopyLength - counter] + c[0];\n }\n c[0] = value / 10;\n switch (true) {\n case (counter >= firstViewCopy.length):\n firstViewCopy = pvutils.utilConcatView(new Uint8Array([value % 10]), firstViewCopy);\n break;\n default:\n firstViewCopy[firstViewCopyLength - counter] = value % 10;\n }\n }\n if (c[0] > 0)\n firstViewCopy = pvutils.utilConcatView(c, firstViewCopy);\n return firstViewCopy;\n}\nfunction power2(n) {\n if (n >= powers2.length) {\n for (let p = powers2.length; p <= n; p++) {\n const c = new Uint8Array([0]);\n let digits = (powers2[p - 1]).slice(0);\n for (let i = (digits.length - 1); i >= 0; i--) {\n const newValue = new Uint8Array([(digits[i] << 1) + c[0]]);\n c[0] = newValue[0] / 10;\n digits[i] = newValue[0] % 10;\n }\n if (c[0] > 0)\n digits = pvutils.utilConcatView(c, digits);\n powers2.push(digits);\n }\n }\n return powers2[n];\n}\nfunction viewSub(first, second) {\n let b = 0;\n const firstView = new Uint8Array(first);\n const secondView = new Uint8Array(second);\n const firstViewCopy = firstView.slice(0);\n const firstViewCopyLength = firstViewCopy.length - 1;\n const secondViewCopy = secondView.slice(0);\n const secondViewCopyLength = secondViewCopy.length - 1;\n let value;\n let counter = 0;\n for (let i = secondViewCopyLength; i >= 0; i--, counter++) {\n value = firstViewCopy[firstViewCopyLength - counter] - secondViewCopy[secondViewCopyLength - counter] - b;\n switch (true) {\n case (value < 0):\n b = 1;\n firstViewCopy[firstViewCopyLength - counter] = value + 10;\n break;\n default:\n b = 0;\n firstViewCopy[firstViewCopyLength - counter] = value;\n }\n }\n if (b > 0) {\n for (let i = (firstViewCopyLength - secondViewCopyLength + 1); i >= 0; i--, counter++) {\n value = firstViewCopy[firstViewCopyLength - counter] - b;\n if (value < 0) {\n b = 1;\n firstViewCopy[firstViewCopyLength - counter] = value + 10;\n }\n else {\n b = 0;\n firstViewCopy[firstViewCopyLength - counter] = value;\n break;\n }\n }\n }\n return firstViewCopy.slice();\n}\nclass LocalIntegerValueBlock extends HexBlock(ValueBlock) {\n setValueHex() {\n if (this.valueHexView.length >= 4) {\n this.warnings.push(\"Too big Integer for decoding, hex only\");\n this.isHexOnly = true;\n this._valueDec = 0;\n }\n else {\n this.isHexOnly = false;\n if (this.valueHexView.length > 0) {\n this._valueDec = pvutils.utilDecodeTC.call(this);\n }\n }\n }\n constructor({ value, ...parameters } = {}) {\n super(parameters);\n this._valueDec = 0;\n if (parameters.valueHex) {\n this.setValueHex();\n }\n if (value !== undefined) {\n this.valueDec = value;\n }\n }\n set valueDec(v) {\n this._valueDec = v;\n this.isHexOnly = false;\n this.valueHexView = new Uint8Array(pvutils.utilEncodeTC(v));\n }\n get valueDec() {\n return this._valueDec;\n }\n fromDER(inputBuffer, inputOffset, inputLength, expectedLength = 0) {\n const offset = this.fromBER(inputBuffer, inputOffset, inputLength);\n if (offset === -1)\n return offset;\n const view = this.valueHexView;\n if ((view[0] === 0x00) && ((view[1] & 0x80) !== 0)) {\n this.valueHexView = view.subarray(1);\n }\n else {\n if (expectedLength !== 0) {\n if (view.length < expectedLength) {\n if ((expectedLength - view.length) > 1)\n expectedLength = view.length + 1;\n this.valueHexView = view.subarray(expectedLength - view.length);\n }\n }\n }\n return offset;\n }\n toDER(sizeOnly = false) {\n const view = this.valueHexView;\n switch (true) {\n case ((view[0] & 0x80) !== 0):\n {\n const updatedView = new Uint8Array(this.valueHexView.length + 1);\n updatedView[0] = 0x00;\n updatedView.set(view, 1);\n this.valueHexView = updatedView;\n }\n break;\n case ((view[0] === 0x00) && ((view[1] & 0x80) === 0)):\n {\n this.valueHexView = this.valueHexView.subarray(1);\n }\n break;\n }\n return this.toBER(sizeOnly);\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength);\n if (resultOffset === -1) {\n return resultOffset;\n }\n this.setValueHex();\n return resultOffset;\n }\n toBER(sizeOnly) {\n return sizeOnly\n ? new ArrayBuffer(this.valueHexView.length)\n : this.valueHexView.slice().buffer;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n valueDec: this.valueDec,\n };\n }\n toString() {\n const firstBit = (this.valueHexView.length * 8) - 1;\n let digits = new Uint8Array((this.valueHexView.length * 8) / 3);\n let bitNumber = 0;\n let currentByte;\n const asn1View = this.valueHexView;\n let result = \"\";\n let flag = false;\n for (let byteNumber = (asn1View.byteLength - 1); byteNumber >= 0; byteNumber--) {\n currentByte = asn1View[byteNumber];\n for (let i = 0; i < 8; i++) {\n if ((currentByte & 1) === 1) {\n switch (bitNumber) {\n case firstBit:\n digits = viewSub(power2(bitNumber), digits);\n result = \"-\";\n break;\n default:\n digits = viewAdd(digits, power2(bitNumber));\n }\n }\n bitNumber++;\n currentByte >>= 1;\n }\n }\n for (let i = 0; i < digits.length; i++) {\n if (digits[i])\n flag = true;\n if (flag)\n result += digitsString.charAt(digits[i]);\n }\n if (flag === false)\n result += digitsString.charAt(0);\n return result;\n }\n}\n_a$p = LocalIntegerValueBlock;\nLocalIntegerValueBlock.NAME = \"IntegerValueBlock\";\n(() => {\n Object.defineProperty(_a$p.prototype, \"valueHex\", {\n set: function (v) {\n this.valueHexView = new Uint8Array(v);\n this.setValueHex();\n },\n get: function () {\n return this.valueHexView.slice().buffer;\n },\n });\n})();\n\nvar _a$o;\nclass Integer extends BaseBlock {\n constructor(parameters = {}) {\n super(parameters, LocalIntegerValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 2;\n }\n toBigInt() {\n assertBigInt();\n return BigInt(this.valueBlock.toString());\n }\n static fromBigInt(value) {\n assertBigInt();\n const bigIntValue = BigInt(value);\n const writer = new ViewWriter();\n const hex = bigIntValue.toString(16).replace(/^-/, \"\");\n const view = new Uint8Array(pvtsutils.Convert.FromHex(hex));\n if (bigIntValue < 0) {\n const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0));\n first[0] |= 0x80;\n const firstInt = BigInt(`0x${pvtsutils.Convert.ToHex(first)}`);\n const secondInt = firstInt + bigIntValue;\n const second = pvtsutils.BufferSourceConverter.toUint8Array(pvtsutils.Convert.FromHex(secondInt.toString(16)));\n second[0] |= 0x80;\n writer.write(second);\n }\n else {\n if (view[0] & 0x80) {\n writer.write(new Uint8Array([0]));\n }\n writer.write(view);\n }\n const res = new _a$o({ valueHex: writer.final() });\n return res;\n }\n convertToDER() {\n const integer = new _a$o({ valueHex: this.valueBlock.valueHexView });\n integer.valueBlock.toDER();\n return integer;\n }\n convertFromDER() {\n return new _a$o({\n valueHex: this.valueBlock.valueHexView[0] === 0\n ? this.valueBlock.valueHexView.subarray(1)\n : this.valueBlock.valueHexView,\n });\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${this.valueBlock.toString()}`;\n }\n}\n_a$o = Integer;\n(() => {\n typeStore.Integer = _a$o;\n})();\nInteger.NAME = \"INTEGER\";\n\nvar _a$n;\nclass Enumerated extends Integer {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 10;\n }\n}\n_a$n = Enumerated;\n(() => {\n typeStore.Enumerated = _a$n;\n})();\nEnumerated.NAME = \"ENUMERATED\";\n\nclass LocalSidValueBlock extends HexBlock(ValueBlock) {\n constructor({ valueDec = -1, isFirstSid = false, ...parameters } = {}) {\n super(parameters);\n this.valueDec = valueDec;\n this.isFirstSid = isFirstSid;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n if (!inputLength) {\n return inputOffset;\n }\n const inputView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength)) {\n return -1;\n }\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\n this.valueHexView = new Uint8Array(inputLength);\n for (let i = 0; i < inputLength; i++) {\n this.valueHexView[i] = intBuffer[i] & 0x7F;\n this.blockLength++;\n if ((intBuffer[i] & 0x80) === 0x00)\n break;\n }\n const tempView = new Uint8Array(this.blockLength);\n for (let i = 0; i < this.blockLength; i++) {\n tempView[i] = this.valueHexView[i];\n }\n this.valueHexView = tempView;\n if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n if (this.valueHexView[0] === 0x00)\n this.warnings.push(\"Needlessly long format of SID encoding\");\n if (this.blockLength <= 8)\n this.valueDec = pvutils.utilFromBase(this.valueHexView, 7);\n else {\n this.isHexOnly = true;\n this.warnings.push(\"Too big SID for decoding, hex only\");\n }\n return (inputOffset + this.blockLength);\n }\n set valueBigInt(value) {\n assertBigInt();\n let bits = BigInt(value).toString(2);\n while (bits.length % 7) {\n bits = \"0\" + bits;\n }\n const bytes = new Uint8Array(bits.length / 7);\n for (let i = 0; i < bytes.length; i++) {\n bytes[i] = parseInt(bits.slice(i * 7, i * 7 + 7), 2) + (i + 1 < bytes.length ? 0x80 : 0);\n }\n this.fromBER(bytes.buffer, 0, bytes.length);\n }\n toBER(sizeOnly) {\n if (this.isHexOnly) {\n if (sizeOnly)\n return (new ArrayBuffer(this.valueHexView.byteLength));\n const curView = this.valueHexView;\n const retView = new Uint8Array(this.blockLength);\n for (let i = 0; i < (this.blockLength - 1); i++)\n retView[i] = curView[i] | 0x80;\n retView[this.blockLength - 1] = curView[this.blockLength - 1];\n return retView.buffer;\n }\n const encodedBuf = pvutils.utilToBase(this.valueDec, 7);\n if (encodedBuf.byteLength === 0) {\n this.error = \"Error during encoding SID value\";\n return EMPTY_BUFFER;\n }\n const retView = new Uint8Array(encodedBuf.byteLength);\n if (!sizeOnly) {\n const encodedView = new Uint8Array(encodedBuf);\n const len = encodedBuf.byteLength - 1;\n for (let i = 0; i < len; i++)\n retView[i] = encodedView[i] | 0x80;\n retView[len] = encodedView[len];\n }\n return retView;\n }\n toString() {\n let result = \"\";\n if (this.isHexOnly)\n result = pvtsutils.Convert.ToHex(this.valueHexView);\n else {\n if (this.isFirstSid) {\n let sidValue = this.valueDec;\n if (this.valueDec <= 39)\n result = \"0.\";\n else {\n if (this.valueDec <= 79) {\n result = \"1.\";\n sidValue -= 40;\n }\n else {\n result = \"2.\";\n sidValue -= 80;\n }\n }\n result += sidValue.toString();\n }\n else\n result = this.valueDec.toString();\n }\n return result;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n valueDec: this.valueDec,\n isFirstSid: this.isFirstSid,\n };\n }\n}\nLocalSidValueBlock.NAME = \"sidBlock\";\n\nclass LocalObjectIdentifierValueBlock extends ValueBlock {\n constructor({ value = EMPTY_STRING, ...parameters } = {}) {\n super(parameters);\n this.value = [];\n if (value) {\n this.fromString(value);\n }\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n let resultOffset = inputOffset;\n while (inputLength > 0) {\n const sidBlock = new LocalSidValueBlock();\n resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\n if (resultOffset === -1) {\n this.blockLength = 0;\n this.error = sidBlock.error;\n return resultOffset;\n }\n if (this.value.length === 0)\n sidBlock.isFirstSid = true;\n this.blockLength += sidBlock.blockLength;\n inputLength -= sidBlock.blockLength;\n this.value.push(sidBlock);\n }\n return resultOffset;\n }\n toBER(sizeOnly) {\n const retBuffers = [];\n for (let i = 0; i < this.value.length; i++) {\n const valueBuf = this.value[i].toBER(sizeOnly);\n if (valueBuf.byteLength === 0) {\n this.error = this.value[i].error;\n return EMPTY_BUFFER;\n }\n retBuffers.push(valueBuf);\n }\n return concat(retBuffers);\n }\n fromString(string) {\n this.value = [];\n let pos1 = 0;\n let pos2 = 0;\n let sid = \"\";\n let flag = false;\n do {\n pos2 = string.indexOf(\".\", pos1);\n if (pos2 === -1)\n sid = string.substring(pos1);\n else\n sid = string.substring(pos1, pos2);\n pos1 = pos2 + 1;\n if (flag) {\n const sidBlock = this.value[0];\n let plus = 0;\n switch (sidBlock.valueDec) {\n case 0:\n break;\n case 1:\n plus = 40;\n break;\n case 2:\n plus = 80;\n break;\n default:\n this.value = [];\n return;\n }\n const parsedSID = parseInt(sid, 10);\n if (isNaN(parsedSID))\n return;\n sidBlock.valueDec = parsedSID + plus;\n flag = false;\n }\n else {\n const sidBlock = new LocalSidValueBlock();\n if (sid > Number.MAX_SAFE_INTEGER) {\n assertBigInt();\n const sidValue = BigInt(sid);\n sidBlock.valueBigInt = sidValue;\n }\n else {\n sidBlock.valueDec = parseInt(sid, 10);\n if (isNaN(sidBlock.valueDec))\n return;\n }\n if (!this.value.length) {\n sidBlock.isFirstSid = true;\n flag = true;\n }\n this.value.push(sidBlock);\n }\n } while (pos2 !== -1);\n }\n toString() {\n let result = \"\";\n let isHexOnly = false;\n for (let i = 0; i < this.value.length; i++) {\n isHexOnly = this.value[i].isHexOnly;\n let sidStr = this.value[i].toString();\n if (i !== 0)\n result = `${result}.`;\n if (isHexOnly) {\n sidStr = `{${sidStr}}`;\n if (this.value[i].isFirstSid)\n result = `2.{${sidStr} - 80}`;\n else\n result += sidStr;\n }\n else\n result += sidStr;\n }\n return result;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n value: this.toString(),\n sidArray: [],\n };\n for (let i = 0; i < this.value.length; i++) {\n object.sidArray.push(this.value[i].toJSON());\n }\n return object;\n }\n}\nLocalObjectIdentifierValueBlock.NAME = \"ObjectIdentifierValueBlock\";\n\nvar _a$m;\nclass ObjectIdentifier extends BaseBlock {\n getValue() {\n return this.valueBlock.toString();\n }\n setValue(value) {\n this.valueBlock.fromString(value);\n }\n constructor(parameters = {}) {\n super(parameters, LocalObjectIdentifierValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 6;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${this.valueBlock.toString() || \"empty\"}`;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n value: this.getValue(),\n };\n }\n}\n_a$m = ObjectIdentifier;\n(() => {\n typeStore.ObjectIdentifier = _a$m;\n})();\nObjectIdentifier.NAME = \"OBJECT IDENTIFIER\";\n\nclass LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) {\n constructor({ valueDec = 0, ...parameters } = {}) {\n super(parameters);\n this.valueDec = valueDec;\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n if (inputLength === 0)\n return inputOffset;\n const inputView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n if (!checkBufferParams(this, inputView, inputOffset, inputLength))\n return -1;\n const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength);\n this.valueHexView = new Uint8Array(inputLength);\n for (let i = 0; i < inputLength; i++) {\n this.valueHexView[i] = intBuffer[i] & 0x7F;\n this.blockLength++;\n if ((intBuffer[i] & 0x80) === 0x00)\n break;\n }\n const tempView = new Uint8Array(this.blockLength);\n for (let i = 0; i < this.blockLength; i++)\n tempView[i] = this.valueHexView[i];\n this.valueHexView = tempView;\n if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) {\n this.error = \"End of input reached before message was fully decoded\";\n return -1;\n }\n if (this.valueHexView[0] === 0x00)\n this.warnings.push(\"Needlessly long format of SID encoding\");\n if (this.blockLength <= 8)\n this.valueDec = pvutils.utilFromBase(this.valueHexView, 7);\n else {\n this.isHexOnly = true;\n this.warnings.push(\"Too big SID for decoding, hex only\");\n }\n return (inputOffset + this.blockLength);\n }\n toBER(sizeOnly) {\n if (this.isHexOnly) {\n if (sizeOnly)\n return (new ArrayBuffer(this.valueHexView.byteLength));\n const curView = this.valueHexView;\n const retView = new Uint8Array(this.blockLength);\n for (let i = 0; i < (this.blockLength - 1); i++)\n retView[i] = curView[i] | 0x80;\n retView[this.blockLength - 1] = curView[this.blockLength - 1];\n return retView.buffer;\n }\n const encodedBuf = pvutils.utilToBase(this.valueDec, 7);\n if (encodedBuf.byteLength === 0) {\n this.error = \"Error during encoding SID value\";\n return EMPTY_BUFFER;\n }\n const retView = new Uint8Array(encodedBuf.byteLength);\n if (!sizeOnly) {\n const encodedView = new Uint8Array(encodedBuf);\n const len = encodedBuf.byteLength - 1;\n for (let i = 0; i < len; i++)\n retView[i] = encodedView[i] | 0x80;\n retView[len] = encodedView[len];\n }\n return retView.buffer;\n }\n toString() {\n let result = \"\";\n if (this.isHexOnly)\n result = pvtsutils.Convert.ToHex(this.valueHexView);\n else {\n result = this.valueDec.toString();\n }\n return result;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n valueDec: this.valueDec,\n };\n }\n}\nLocalRelativeSidValueBlock.NAME = \"relativeSidBlock\";\n\nclass LocalRelativeObjectIdentifierValueBlock extends ValueBlock {\n constructor({ value = EMPTY_STRING, ...parameters } = {}) {\n super(parameters);\n this.value = [];\n if (value) {\n this.fromString(value);\n }\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n let resultOffset = inputOffset;\n while (inputLength > 0) {\n const sidBlock = new LocalRelativeSidValueBlock();\n resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength);\n if (resultOffset === -1) {\n this.blockLength = 0;\n this.error = sidBlock.error;\n return resultOffset;\n }\n this.blockLength += sidBlock.blockLength;\n inputLength -= sidBlock.blockLength;\n this.value.push(sidBlock);\n }\n return resultOffset;\n }\n toBER(sizeOnly, _writer) {\n const retBuffers = [];\n for (let i = 0; i < this.value.length; i++) {\n const valueBuf = this.value[i].toBER(sizeOnly);\n if (valueBuf.byteLength === 0) {\n this.error = this.value[i].error;\n return EMPTY_BUFFER;\n }\n retBuffers.push(valueBuf);\n }\n return concat(retBuffers);\n }\n fromString(string) {\n this.value = [];\n let pos1 = 0;\n let pos2 = 0;\n let sid = \"\";\n do {\n pos2 = string.indexOf(\".\", pos1);\n if (pos2 === -1)\n sid = string.substring(pos1);\n else\n sid = string.substring(pos1, pos2);\n pos1 = pos2 + 1;\n const sidBlock = new LocalRelativeSidValueBlock();\n sidBlock.valueDec = parseInt(sid, 10);\n if (isNaN(sidBlock.valueDec))\n return true;\n this.value.push(sidBlock);\n } while (pos2 !== -1);\n return true;\n }\n toString() {\n let result = \"\";\n let isHexOnly = false;\n for (let i = 0; i < this.value.length; i++) {\n isHexOnly = this.value[i].isHexOnly;\n let sidStr = this.value[i].toString();\n if (i !== 0)\n result = `${result}.`;\n if (isHexOnly) {\n sidStr = `{${sidStr}}`;\n result += sidStr;\n }\n else\n result += sidStr;\n }\n return result;\n }\n toJSON() {\n const object = {\n ...super.toJSON(),\n value: this.toString(),\n sidArray: [],\n };\n for (let i = 0; i < this.value.length; i++)\n object.sidArray.push(this.value[i].toJSON());\n return object;\n }\n}\nLocalRelativeObjectIdentifierValueBlock.NAME = \"RelativeObjectIdentifierValueBlock\";\n\nvar _a$l;\nclass RelativeObjectIdentifier extends BaseBlock {\n getValue() {\n return this.valueBlock.toString();\n }\n setValue(value) {\n this.valueBlock.fromString(value);\n }\n constructor(parameters = {}) {\n super(parameters, LocalRelativeObjectIdentifierValueBlock);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 13;\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${this.valueBlock.toString() || \"empty\"}`;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n value: this.getValue(),\n };\n }\n}\n_a$l = RelativeObjectIdentifier;\n(() => {\n typeStore.RelativeObjectIdentifier = _a$l;\n})();\nRelativeObjectIdentifier.NAME = \"RelativeObjectIdentifier\";\n\nvar _a$k;\nclass Sequence extends Constructed {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 16;\n }\n}\n_a$k = Sequence;\n(() => {\n typeStore.Sequence = _a$k;\n})();\nSequence.NAME = \"SEQUENCE\";\n\nvar _a$j;\nclass Set extends Constructed {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 17;\n }\n}\n_a$j = Set;\n(() => {\n typeStore.Set = _a$j;\n})();\nSet.NAME = \"SET\";\n\nclass LocalStringValueBlock extends HexBlock(ValueBlock) {\n constructor({ ...parameters } = {}) {\n super(parameters);\n this.isHexOnly = true;\n this.value = EMPTY_STRING;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n value: this.value,\n };\n }\n}\nLocalStringValueBlock.NAME = \"StringValueBlock\";\n\nclass LocalSimpleStringValueBlock extends LocalStringValueBlock {\n}\nLocalSimpleStringValueBlock.NAME = \"SimpleStringValueBlock\";\n\nclass LocalSimpleStringBlock extends BaseStringBlock {\n constructor({ ...parameters } = {}) {\n super(parameters, LocalSimpleStringValueBlock);\n }\n fromBuffer(inputBuffer) {\n this.valueBlock.value = String.fromCharCode.apply(null, pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer));\n }\n fromString(inputString) {\n const strLen = inputString.length;\n const view = this.valueBlock.valueHexView = new Uint8Array(strLen);\n for (let i = 0; i < strLen; i++)\n view[i] = inputString.charCodeAt(i);\n this.valueBlock.value = inputString;\n }\n}\nLocalSimpleStringBlock.NAME = \"SIMPLE STRING\";\n\nclass LocalUtf8StringValueBlock extends LocalSimpleStringBlock {\n fromBuffer(inputBuffer) {\n this.valueBlock.valueHexView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n try {\n this.valueBlock.value = pvtsutils.Convert.ToUtf8String(inputBuffer);\n }\n catch (ex) {\n this.warnings.push(`Error during \"decodeURIComponent\": ${ex}, using raw string`);\n this.valueBlock.value = pvtsutils.Convert.ToBinary(inputBuffer);\n }\n }\n fromString(inputString) {\n this.valueBlock.valueHexView = new Uint8Array(pvtsutils.Convert.FromUtf8String(inputString));\n this.valueBlock.value = inputString;\n }\n}\nLocalUtf8StringValueBlock.NAME = \"Utf8StringValueBlock\";\n\nvar _a$i;\nclass Utf8String extends LocalUtf8StringValueBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 12;\n }\n}\n_a$i = Utf8String;\n(() => {\n typeStore.Utf8String = _a$i;\n})();\nUtf8String.NAME = \"UTF8String\";\n\nclass LocalBmpStringValueBlock extends LocalSimpleStringBlock {\n fromBuffer(inputBuffer) {\n this.valueBlock.value = pvtsutils.Convert.ToUtf16String(inputBuffer);\n this.valueBlock.valueHexView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer);\n }\n fromString(inputString) {\n this.valueBlock.value = inputString;\n this.valueBlock.valueHexView = new Uint8Array(pvtsutils.Convert.FromUtf16String(inputString));\n }\n}\nLocalBmpStringValueBlock.NAME = \"BmpStringValueBlock\";\n\nvar _a$h;\nclass BmpString extends LocalBmpStringValueBlock {\n constructor({ ...parameters } = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 30;\n }\n}\n_a$h = BmpString;\n(() => {\n typeStore.BmpString = _a$h;\n})();\nBmpString.NAME = \"BMPString\";\n\nclass LocalUniversalStringValueBlock extends LocalSimpleStringBlock {\n fromBuffer(inputBuffer) {\n const copyBuffer = ArrayBuffer.isView(inputBuffer) ? inputBuffer.slice().buffer : inputBuffer.slice(0);\n const valueView = new Uint8Array(copyBuffer);\n for (let i = 0; i < valueView.length; i += 4) {\n valueView[i] = valueView[i + 3];\n valueView[i + 1] = valueView[i + 2];\n valueView[i + 2] = 0x00;\n valueView[i + 3] = 0x00;\n }\n this.valueBlock.value = String.fromCharCode.apply(null, new Uint32Array(copyBuffer));\n }\n fromString(inputString) {\n const strLength = inputString.length;\n const valueHexView = this.valueBlock.valueHexView = new Uint8Array(strLength * 4);\n for (let i = 0; i < strLength; i++) {\n const codeBuf = pvutils.utilToBase(inputString.charCodeAt(i), 8);\n const codeView = new Uint8Array(codeBuf);\n if (codeView.length > 4)\n continue;\n const dif = 4 - codeView.length;\n for (let j = (codeView.length - 1); j >= 0; j--)\n valueHexView[i * 4 + j + dif] = codeView[j];\n }\n this.valueBlock.value = inputString;\n }\n}\nLocalUniversalStringValueBlock.NAME = \"UniversalStringValueBlock\";\n\nvar _a$g;\nclass UniversalString extends LocalUniversalStringValueBlock {\n constructor({ ...parameters } = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 28;\n }\n}\n_a$g = UniversalString;\n(() => {\n typeStore.UniversalString = _a$g;\n})();\nUniversalString.NAME = \"UniversalString\";\n\nvar _a$f;\nclass NumericString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 18;\n }\n}\n_a$f = NumericString;\n(() => {\n typeStore.NumericString = _a$f;\n})();\nNumericString.NAME = \"NumericString\";\n\nvar _a$e;\nclass PrintableString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 19;\n }\n}\n_a$e = PrintableString;\n(() => {\n typeStore.PrintableString = _a$e;\n})();\nPrintableString.NAME = \"PrintableString\";\n\nvar _a$d;\nclass TeletexString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 20;\n }\n}\n_a$d = TeletexString;\n(() => {\n typeStore.TeletexString = _a$d;\n})();\nTeletexString.NAME = \"TeletexString\";\n\nvar _a$c;\nclass VideotexString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 21;\n }\n}\n_a$c = VideotexString;\n(() => {\n typeStore.VideotexString = _a$c;\n})();\nVideotexString.NAME = \"VideotexString\";\n\nvar _a$b;\nclass IA5String extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 22;\n }\n}\n_a$b = IA5String;\n(() => {\n typeStore.IA5String = _a$b;\n})();\nIA5String.NAME = \"IA5String\";\n\nvar _a$a;\nclass GraphicString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 25;\n }\n}\n_a$a = GraphicString;\n(() => {\n typeStore.GraphicString = _a$a;\n})();\nGraphicString.NAME = \"GraphicString\";\n\nvar _a$9;\nclass VisibleString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 26;\n }\n}\n_a$9 = VisibleString;\n(() => {\n typeStore.VisibleString = _a$9;\n})();\nVisibleString.NAME = \"VisibleString\";\n\nvar _a$8;\nclass GeneralString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 27;\n }\n}\n_a$8 = GeneralString;\n(() => {\n typeStore.GeneralString = _a$8;\n})();\nGeneralString.NAME = \"GeneralString\";\n\nvar _a$7;\nclass CharacterString extends LocalSimpleStringBlock {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 29;\n }\n}\n_a$7 = CharacterString;\n(() => {\n typeStore.CharacterString = _a$7;\n})();\nCharacterString.NAME = \"CharacterString\";\n\nvar _a$6;\nclass UTCTime extends VisibleString {\n constructor({ value, valueDate, ...parameters } = {}) {\n super(parameters);\n this.year = 0;\n this.month = 0;\n this.day = 0;\n this.hour = 0;\n this.minute = 0;\n this.second = 0;\n if (value) {\n this.fromString(value);\n this.valueBlock.valueHexView = new Uint8Array(value.length);\n for (let i = 0; i < value.length; i++)\n this.valueBlock.valueHexView[i] = value.charCodeAt(i);\n }\n if (valueDate) {\n this.fromDate(valueDate);\n this.valueBlock.valueHexView = new Uint8Array(this.toBuffer());\n }\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 23;\n }\n fromBuffer(inputBuffer) {\n this.fromString(String.fromCharCode.apply(null, pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer)));\n }\n toBuffer() {\n const str = this.toString();\n const buffer = new ArrayBuffer(str.length);\n const view = new Uint8Array(buffer);\n for (let i = 0; i < str.length; i++)\n view[i] = str.charCodeAt(i);\n return buffer;\n }\n fromDate(inputDate) {\n this.year = inputDate.getUTCFullYear();\n this.month = inputDate.getUTCMonth() + 1;\n this.day = inputDate.getUTCDate();\n this.hour = inputDate.getUTCHours();\n this.minute = inputDate.getUTCMinutes();\n this.second = inputDate.getUTCSeconds();\n }\n toDate() {\n return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second)));\n }\n fromString(inputString) {\n const parser = /(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})Z/ig;\n const parserArray = parser.exec(inputString);\n if (parserArray === null) {\n this.error = \"Wrong input string for conversion\";\n return;\n }\n const year = parseInt(parserArray[1], 10);\n if (year >= 50)\n this.year = 1900 + year;\n else\n this.year = 2000 + year;\n this.month = parseInt(parserArray[2], 10);\n this.day = parseInt(parserArray[3], 10);\n this.hour = parseInt(parserArray[4], 10);\n this.minute = parseInt(parserArray[5], 10);\n this.second = parseInt(parserArray[6], 10);\n }\n toString(encoding = \"iso\") {\n if (encoding === \"iso\") {\n const outputArray = new Array(7);\n outputArray[0] = pvutils.padNumber(((this.year < 2000) ? (this.year - 1900) : (this.year - 2000)), 2);\n outputArray[1] = pvutils.padNumber(this.month, 2);\n outputArray[2] = pvutils.padNumber(this.day, 2);\n outputArray[3] = pvutils.padNumber(this.hour, 2);\n outputArray[4] = pvutils.padNumber(this.minute, 2);\n outputArray[5] = pvutils.padNumber(this.second, 2);\n outputArray[6] = \"Z\";\n return outputArray.join(\"\");\n }\n return super.toString(encoding);\n }\n onAsciiEncoding() {\n return `${this.constructor.NAME} : ${this.toDate().toISOString()}`;\n }\n toJSON() {\n return {\n ...super.toJSON(),\n year: this.year,\n month: this.month,\n day: this.day,\n hour: this.hour,\n minute: this.minute,\n second: this.second,\n };\n }\n}\n_a$6 = UTCTime;\n(() => {\n typeStore.UTCTime = _a$6;\n})();\nUTCTime.NAME = \"UTCTime\";\n\nvar _a$5;\nclass GeneralizedTime extends UTCTime {\n constructor(parameters = {}) {\n var _b;\n super(parameters);\n (_b = this.millisecond) !== null && _b !== void 0 ? _b : (this.millisecond = 0);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 24;\n }\n fromDate(inputDate) {\n super.fromDate(inputDate);\n this.millisecond = inputDate.getUTCMilliseconds();\n }\n toDate() {\n const utcDate = Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond);\n return (new Date(utcDate));\n }\n fromString(inputString) {\n let isUTC = false;\n let timeString = \"\";\n let dateTimeString = \"\";\n let fractionPart = 0;\n let parser;\n let hourDifference = 0;\n let minuteDifference = 0;\n if (inputString[inputString.length - 1] === \"Z\") {\n timeString = inputString.substring(0, inputString.length - 1);\n isUTC = true;\n }\n else {\n const number = new Number(inputString[inputString.length - 1]);\n if (isNaN(number.valueOf()))\n throw new Error(\"Wrong input string for conversion\");\n timeString = inputString;\n }\n if (isUTC) {\n if (timeString.indexOf(\"+\") !== -1)\n throw new Error(\"Wrong input string for conversion\");\n if (timeString.indexOf(\"-\") !== -1)\n throw new Error(\"Wrong input string for conversion\");\n }\n else {\n let multiplier = 1;\n let differencePosition = timeString.indexOf(\"+\");\n let differenceString = \"\";\n if (differencePosition === -1) {\n differencePosition = timeString.indexOf(\"-\");\n multiplier = -1;\n }\n if (differencePosition !== -1) {\n differenceString = timeString.substring(differencePosition + 1);\n timeString = timeString.substring(0, differencePosition);\n if ((differenceString.length !== 2) && (differenceString.length !== 4))\n throw new Error(\"Wrong input string for conversion\");\n let number = parseInt(differenceString.substring(0, 2), 10);\n if (isNaN(number.valueOf()))\n throw new Error(\"Wrong input string for conversion\");\n hourDifference = multiplier * number;\n if (differenceString.length === 4) {\n number = parseInt(differenceString.substring(2, 4), 10);\n if (isNaN(number.valueOf()))\n throw new Error(\"Wrong input string for conversion\");\n minuteDifference = multiplier * number;\n }\n }\n }\n let fractionPointPosition = timeString.indexOf(\".\");\n if (fractionPointPosition === -1)\n fractionPointPosition = timeString.indexOf(\",\");\n if (fractionPointPosition !== -1) {\n const fractionPartCheck = new Number(`0${timeString.substring(fractionPointPosition)}`);\n if (isNaN(fractionPartCheck.valueOf()))\n throw new Error(\"Wrong input string for conversion\");\n fractionPart = fractionPartCheck.valueOf();\n dateTimeString = timeString.substring(0, fractionPointPosition);\n }\n else\n dateTimeString = timeString;\n switch (true) {\n case (dateTimeString.length === 8):\n parser = /(\\d{4})(\\d{2})(\\d{2})/ig;\n if (fractionPointPosition !== -1)\n throw new Error(\"Wrong input string for conversion\");\n break;\n case (dateTimeString.length === 10):\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})/ig;\n if (fractionPointPosition !== -1) {\n let fractionResult = 60 * fractionPart;\n this.minute = Math.floor(fractionResult);\n fractionResult = 60 * (fractionResult - this.minute);\n this.second = Math.floor(fractionResult);\n fractionResult = 1000 * (fractionResult - this.second);\n this.millisecond = Math.floor(fractionResult);\n }\n break;\n case (dateTimeString.length === 12):\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\n if (fractionPointPosition !== -1) {\n let fractionResult = 60 * fractionPart;\n this.second = Math.floor(fractionResult);\n fractionResult = 1000 * (fractionResult - this.second);\n this.millisecond = Math.floor(fractionResult);\n }\n break;\n case (dateTimeString.length === 14):\n parser = /(\\d{4})(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{2})/ig;\n if (fractionPointPosition !== -1) {\n const fractionResult = 1000 * fractionPart;\n this.millisecond = Math.floor(fractionResult);\n }\n break;\n default:\n throw new Error(\"Wrong input string for conversion\");\n }\n const parserArray = parser.exec(dateTimeString);\n if (parserArray === null)\n throw new Error(\"Wrong input string for conversion\");\n for (let j = 1; j < parserArray.length; j++) {\n switch (j) {\n case 1:\n this.year = parseInt(parserArray[j], 10);\n break;\n case 2:\n this.month = parseInt(parserArray[j], 10);\n break;\n case 3:\n this.day = parseInt(parserArray[j], 10);\n break;\n case 4:\n this.hour = parseInt(parserArray[j], 10) + hourDifference;\n break;\n case 5:\n this.minute = parseInt(parserArray[j], 10) + minuteDifference;\n break;\n case 6:\n this.second = parseInt(parserArray[j], 10);\n break;\n default:\n throw new Error(\"Wrong input string for conversion\");\n }\n }\n if (isUTC === false) {\n const tempDate = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond);\n this.year = tempDate.getUTCFullYear();\n this.month = tempDate.getUTCMonth();\n this.day = tempDate.getUTCDay();\n this.hour = tempDate.getUTCHours();\n this.minute = tempDate.getUTCMinutes();\n this.second = tempDate.getUTCSeconds();\n this.millisecond = tempDate.getUTCMilliseconds();\n }\n }\n toString(encoding = \"iso\") {\n if (encoding === \"iso\") {\n const outputArray = [];\n outputArray.push(pvutils.padNumber(this.year, 4));\n outputArray.push(pvutils.padNumber(this.month, 2));\n outputArray.push(pvutils.padNumber(this.day, 2));\n outputArray.push(pvutils.padNumber(this.hour, 2));\n outputArray.push(pvutils.padNumber(this.minute, 2));\n outputArray.push(pvutils.padNumber(this.second, 2));\n if (this.millisecond !== 0) {\n outputArray.push(\".\");\n outputArray.push(pvutils.padNumber(this.millisecond, 3));\n }\n outputArray.push(\"Z\");\n return outputArray.join(\"\");\n }\n return super.toString(encoding);\n }\n toJSON() {\n return {\n ...super.toJSON(),\n millisecond: this.millisecond,\n };\n }\n}\n_a$5 = GeneralizedTime;\n(() => {\n typeStore.GeneralizedTime = _a$5;\n})();\nGeneralizedTime.NAME = \"GeneralizedTime\";\n\nvar _a$4;\nclass DATE extends Utf8String {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 31;\n }\n}\n_a$4 = DATE;\n(() => {\n typeStore.DATE = _a$4;\n})();\nDATE.NAME = \"DATE\";\n\nvar _a$3;\nclass TimeOfDay extends Utf8String {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 32;\n }\n}\n_a$3 = TimeOfDay;\n(() => {\n typeStore.TimeOfDay = _a$3;\n})();\nTimeOfDay.NAME = \"TimeOfDay\";\n\nvar _a$2;\nclass DateTime extends Utf8String {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 33;\n }\n}\n_a$2 = DateTime;\n(() => {\n typeStore.DateTime = _a$2;\n})();\nDateTime.NAME = \"DateTime\";\n\nvar _a$1;\nclass Duration extends Utf8String {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 34;\n }\n}\n_a$1 = Duration;\n(() => {\n typeStore.Duration = _a$1;\n})();\nDuration.NAME = \"Duration\";\n\nvar _a;\nclass TIME extends Utf8String {\n constructor(parameters = {}) {\n super(parameters);\n this.idBlock.tagClass = 1;\n this.idBlock.tagNumber = 14;\n }\n}\n_a = TIME;\n(() => {\n typeStore.TIME = _a;\n})();\nTIME.NAME = \"TIME\";\n\nclass Any {\n constructor({ name = EMPTY_STRING, optional = false } = {}) {\n this.name = name;\n this.optional = optional;\n }\n}\n\nclass Choice extends Any {\n constructor({ value = [], ...parameters } = {}) {\n super(parameters);\n this.value = value;\n }\n}\n\nclass Repeated extends Any {\n constructor({ value = new Any(), local = false, ...parameters } = {}) {\n super(parameters);\n this.value = value;\n this.local = local;\n }\n}\n\nclass RawData {\n get data() {\n return this.dataView.slice().buffer;\n }\n set data(value) {\n this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(value);\n }\n constructor({ data = EMPTY_VIEW } = {}) {\n this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(data);\n }\n fromBER(inputBuffer, inputOffset, inputLength) {\n const endLength = inputOffset + inputLength;\n this.dataView = pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength);\n return endLength;\n }\n toBER(_sizeOnly) {\n return this.dataView.slice().buffer;\n }\n}\n\nfunction compareSchema(root, inputData, inputSchema) {\n if (inputSchema instanceof Choice) {\n for (const element of inputSchema.value) {\n const result = compareSchema(root, inputData, element);\n if (result.verified) {\n return {\n verified: true,\n result: root,\n };\n }\n }\n {\n const _result = {\n verified: false,\n result: { error: \"Wrong values for Choice type\" },\n };\n if (inputSchema.hasOwnProperty(NAME))\n _result.name = inputSchema.name;\n return _result;\n }\n }\n if (inputSchema instanceof Any) {\n if (inputSchema.hasOwnProperty(NAME))\n root[inputSchema.name] = inputData;\n return {\n verified: true,\n result: root,\n };\n }\n if ((root instanceof Object) === false) {\n return {\n verified: false,\n result: { error: \"Wrong root object\" },\n };\n }\n if ((inputData instanceof Object) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 data\" },\n };\n }\n if ((inputSchema instanceof Object) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if ((ID_BLOCK in inputSchema) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if ((FROM_BER in inputSchema.idBlock) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if ((TO_BER in inputSchema.idBlock) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n const encodedId = inputSchema.idBlock.toBER(false);\n if (encodedId.byteLength === 0) {\n return {\n verified: false,\n result: { error: \"Error encoding idBlock for ASN.1 schema\" },\n };\n }\n const decodedOffset = inputSchema.idBlock.fromBER(encodedId, 0, encodedId.byteLength);\n if (decodedOffset === -1) {\n return {\n verified: false,\n result: { error: \"Error decoding idBlock for ASN.1 schema\" },\n };\n }\n if (inputSchema.idBlock.hasOwnProperty(TAG_CLASS) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if (inputSchema.idBlock.tagClass !== inputData.idBlock.tagClass) {\n return {\n verified: false,\n result: root,\n };\n }\n if (inputSchema.idBlock.hasOwnProperty(TAG_NUMBER) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if (inputSchema.idBlock.tagNumber !== inputData.idBlock.tagNumber) {\n return {\n verified: false,\n result: root,\n };\n }\n if (inputSchema.idBlock.hasOwnProperty(IS_CONSTRUCTED) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if (inputSchema.idBlock.isConstructed !== inputData.idBlock.isConstructed) {\n return {\n verified: false,\n result: root,\n };\n }\n if (!(IS_HEX_ONLY in inputSchema.idBlock)) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n if (inputSchema.idBlock.isHexOnly !== inputData.idBlock.isHexOnly) {\n return {\n verified: false,\n result: root,\n };\n }\n if (inputSchema.idBlock.isHexOnly) {\n if ((VALUE_HEX_VIEW in inputSchema.idBlock) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema\" },\n };\n }\n const schemaView = inputSchema.idBlock.valueHexView;\n const asn1View = inputData.idBlock.valueHexView;\n if (schemaView.length !== asn1View.length) {\n return {\n verified: false,\n result: root,\n };\n }\n for (let i = 0; i < schemaView.length; i++) {\n if (schemaView[i] !== asn1View[1]) {\n return {\n verified: false,\n result: root,\n };\n }\n }\n }\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name)\n root[inputSchema.name] = inputData;\n }\n if (inputSchema instanceof typeStore.Constructed) {\n let admission = 0;\n let result = {\n verified: false,\n result: { error: \"Unknown error\" },\n };\n let maxLength = inputSchema.valueBlock.value.length;\n if (maxLength > 0) {\n if (inputSchema.valueBlock.value[0] instanceof Repeated) {\n maxLength = inputData.valueBlock.value.length;\n }\n }\n if (maxLength === 0) {\n return {\n verified: true,\n result: root,\n };\n }\n if ((inputData.valueBlock.value.length === 0)\n && (inputSchema.valueBlock.value.length !== 0)) {\n let _optional = true;\n for (let i = 0; i < inputSchema.valueBlock.value.length; i++)\n _optional = _optional && (inputSchema.valueBlock.value[i].optional || false);\n if (_optional) {\n return {\n verified: true,\n result: root,\n };\n }\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name)\n delete root[inputSchema.name];\n }\n root.error = \"Inconsistent object length\";\n return {\n verified: false,\n result: root,\n };\n }\n for (let i = 0; i < maxLength; i++) {\n if ((i - admission) >= inputData.valueBlock.value.length) {\n if (inputSchema.valueBlock.value[i].optional === false) {\n const _result = {\n verified: false,\n result: root,\n };\n root.error = \"Inconsistent length between ASN.1 data and schema\";\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name) {\n delete root[inputSchema.name];\n _result.name = inputSchema.name;\n }\n }\n return _result;\n }\n }\n else {\n if (inputSchema.valueBlock.value[0] instanceof Repeated) {\n result = compareSchema(root, inputData.valueBlock.value[i], inputSchema.valueBlock.value[0].value);\n if (result.verified === false) {\n if (inputSchema.valueBlock.value[0].optional)\n admission++;\n else {\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name)\n delete root[inputSchema.name];\n }\n return result;\n }\n }\n if ((NAME in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].name.length > 0)) {\n let arrayRoot = {};\n if ((LOCAL in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].local))\n arrayRoot = inputData;\n else\n arrayRoot = root;\n if (typeof arrayRoot[inputSchema.valueBlock.value[0].name] === \"undefined\")\n arrayRoot[inputSchema.valueBlock.value[0].name] = [];\n arrayRoot[inputSchema.valueBlock.value[0].name].push(inputData.valueBlock.value[i]);\n }\n }\n else {\n result = compareSchema(root, inputData.valueBlock.value[i - admission], inputSchema.valueBlock.value[i]);\n if (result.verified === false) {\n if (inputSchema.valueBlock.value[i].optional)\n admission++;\n else {\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name)\n delete root[inputSchema.name];\n }\n return result;\n }\n }\n }\n }\n }\n if (result.verified === false) {\n const _result = {\n verified: false,\n result: root,\n };\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name) {\n delete root[inputSchema.name];\n _result.name = inputSchema.name;\n }\n }\n return _result;\n }\n return {\n verified: true,\n result: root,\n };\n }\n if (inputSchema.primitiveSchema\n && (VALUE_HEX_VIEW in inputData.valueBlock)) {\n const asn1 = localFromBER(inputData.valueBlock.valueHexView);\n if (asn1.offset === -1) {\n const _result = {\n verified: false,\n result: asn1.result,\n };\n if (inputSchema.name) {\n inputSchema.name = inputSchema.name.replace(/^\\s+|\\s+$/g, EMPTY_STRING);\n if (inputSchema.name) {\n delete root[inputSchema.name];\n _result.name = inputSchema.name;\n }\n }\n return _result;\n }\n return compareSchema(root, asn1.result, inputSchema.primitiveSchema);\n }\n return {\n verified: true,\n result: root,\n };\n}\nfunction verifySchema(inputBuffer, inputSchema) {\n if ((inputSchema instanceof Object) === false) {\n return {\n verified: false,\n result: { error: \"Wrong ASN.1 schema type\" },\n };\n }\n const asn1 = localFromBER(pvtsutils.BufferSourceConverter.toUint8Array(inputBuffer));\n if (asn1.offset === -1) {\n return {\n verified: false,\n result: asn1.result,\n };\n }\n return compareSchema(asn1.result, asn1.result, inputSchema);\n}\n\nexport { Any, BaseBlock, BaseStringBlock, BitString, BmpString, Boolean, CharacterString, Choice, Constructed, DATE, DateTime, Duration, EndOfContent, Enumerated, GeneralString, GeneralizedTime, GraphicString, HexBlock, IA5String, Integer, Null, NumericString, ObjectIdentifier, OctetString, Primitive, PrintableString, RawData, RelativeObjectIdentifier, Repeated, Sequence, Set, TIME, TeletexString, TimeOfDay, UTCTime, UniversalString, Utf8String, ValueBlock, VideotexString, ViewWriter, VisibleString, compareSchema, fromBER, verifySchema };\n","export var AsnTypeTypes;\n(function (AsnTypeTypes) {\n AsnTypeTypes[AsnTypeTypes[\"Sequence\"] = 0] = \"Sequence\";\n AsnTypeTypes[AsnTypeTypes[\"Set\"] = 1] = \"Set\";\n AsnTypeTypes[AsnTypeTypes[\"Choice\"] = 2] = \"Choice\";\n})(AsnTypeTypes || (AsnTypeTypes = {}));\nexport var AsnPropTypes;\n(function (AsnPropTypes) {\n AsnPropTypes[AsnPropTypes[\"Any\"] = 1] = \"Any\";\n AsnPropTypes[AsnPropTypes[\"Boolean\"] = 2] = \"Boolean\";\n AsnPropTypes[AsnPropTypes[\"OctetString\"] = 3] = \"OctetString\";\n AsnPropTypes[AsnPropTypes[\"BitString\"] = 4] = \"BitString\";\n AsnPropTypes[AsnPropTypes[\"Integer\"] = 5] = \"Integer\";\n AsnPropTypes[AsnPropTypes[\"Enumerated\"] = 6] = \"Enumerated\";\n AsnPropTypes[AsnPropTypes[\"ObjectIdentifier\"] = 7] = \"ObjectIdentifier\";\n AsnPropTypes[AsnPropTypes[\"Utf8String\"] = 8] = \"Utf8String\";\n AsnPropTypes[AsnPropTypes[\"BmpString\"] = 9] = \"BmpString\";\n AsnPropTypes[AsnPropTypes[\"UniversalString\"] = 10] = \"UniversalString\";\n AsnPropTypes[AsnPropTypes[\"NumericString\"] = 11] = \"NumericString\";\n AsnPropTypes[AsnPropTypes[\"PrintableString\"] = 12] = \"PrintableString\";\n AsnPropTypes[AsnPropTypes[\"TeletexString\"] = 13] = \"TeletexString\";\n AsnPropTypes[AsnPropTypes[\"VideotexString\"] = 14] = \"VideotexString\";\n AsnPropTypes[AsnPropTypes[\"IA5String\"] = 15] = \"IA5String\";\n AsnPropTypes[AsnPropTypes[\"GraphicString\"] = 16] = \"GraphicString\";\n AsnPropTypes[AsnPropTypes[\"VisibleString\"] = 17] = \"VisibleString\";\n AsnPropTypes[AsnPropTypes[\"GeneralString\"] = 18] = \"GeneralString\";\n AsnPropTypes[AsnPropTypes[\"CharacterString\"] = 19] = \"CharacterString\";\n AsnPropTypes[AsnPropTypes[\"UTCTime\"] = 20] = \"UTCTime\";\n AsnPropTypes[AsnPropTypes[\"GeneralizedTime\"] = 21] = \"GeneralizedTime\";\n AsnPropTypes[AsnPropTypes[\"DATE\"] = 22] = \"DATE\";\n AsnPropTypes[AsnPropTypes[\"TimeOfDay\"] = 23] = \"TimeOfDay\";\n AsnPropTypes[AsnPropTypes[\"DateTime\"] = 24] = \"DateTime\";\n AsnPropTypes[AsnPropTypes[\"Duration\"] = 25] = \"Duration\";\n AsnPropTypes[AsnPropTypes[\"TIME\"] = 26] = \"TIME\";\n AsnPropTypes[AsnPropTypes[\"Null\"] = 27] = \"Null\";\n})(AsnPropTypes || (AsnPropTypes = {}));\n","import * as asn1js from \"asn1js\";\nimport { BufferSourceConverter } from \"pvtsutils\";\nexport class BitString {\n constructor(params, unusedBits = 0) {\n this.unusedBits = 0;\n this.value = new ArrayBuffer(0);\n if (params) {\n if (typeof params === \"number\") {\n this.fromNumber(params);\n }\n else if (BufferSourceConverter.isBufferSource(params)) {\n this.unusedBits = unusedBits;\n this.value = BufferSourceConverter.toArrayBuffer(params);\n }\n else {\n throw TypeError(\"Unsupported type of 'params' argument for BitString\");\n }\n }\n }\n fromASN(asn) {\n if (!(asn instanceof asn1js.BitString)) {\n throw new TypeError(\"Argument 'asn' is not instance of ASN.1 BitString\");\n }\n this.unusedBits = asn.valueBlock.unusedBits;\n this.value = asn.valueBlock.valueHex;\n return this;\n }\n toASN() {\n return new asn1js.BitString({ unusedBits: this.unusedBits, valueHex: this.value });\n }\n toSchema(name) {\n return new asn1js.BitString({ name });\n }\n toNumber() {\n let res = \"\";\n const uintArray = new Uint8Array(this.value);\n for (const octet of uintArray) {\n res += octet.toString(2).padStart(8, \"0\");\n }\n res = res.split(\"\").reverse().join(\"\");\n if (this.unusedBits) {\n res = res.slice(this.unusedBits).padStart(this.unusedBits, \"0\");\n }\n return parseInt(res, 2);\n }\n fromNumber(value) {\n let bits = value.toString(2);\n const octetSize = (bits.length + 7) >> 3;\n this.unusedBits = (octetSize << 3) - bits.length;\n const octets = new Uint8Array(octetSize);\n bits = bits\n .padStart(octetSize << 3, \"0\")\n .split(\"\")\n .reverse()\n .join(\"\");\n let index = 0;\n while (index < octetSize) {\n octets[index] = parseInt(bits.slice(index << 3, (index << 3) + 8), 2);\n index++;\n }\n this.value = octets.buffer;\n }\n}\n","import * as asn1js from \"asn1js\";\nimport { BufferSourceConverter } from \"pvtsutils\";\nexport class OctetString {\n get byteLength() {\n return this.buffer.byteLength;\n }\n get byteOffset() {\n return 0;\n }\n constructor(param) {\n if (typeof param === \"number\") {\n this.buffer = new ArrayBuffer(param);\n }\n else {\n if (BufferSourceConverter.isBufferSource(param)) {\n this.buffer = BufferSourceConverter.toArrayBuffer(param);\n }\n else if (Array.isArray(param)) {\n this.buffer = new Uint8Array(param);\n }\n else {\n this.buffer = new ArrayBuffer(0);\n }\n }\n }\n fromASN(asn) {\n if (!(asn instanceof asn1js.OctetString)) {\n throw new TypeError(\"Argument 'asn' is not instance of ASN.1 OctetString\");\n }\n this.buffer = asn.valueBlock.valueHex;\n return this;\n }\n toASN() {\n return new asn1js.OctetString({ valueHex: this.buffer });\n }\n toSchema(name) {\n return new asn1js.OctetString({ name });\n }\n}\n","import * as asn1js from \"asn1js\";\nimport { AsnPropTypes } from \"./enums\";\nimport { OctetString } from \"./types/index\";\nexport const AsnAnyConverter = {\n fromASN: (value) => value instanceof asn1js.Null ? null : value.valueBeforeDecodeView,\n toASN: (value) => {\n if (value === null) {\n return new asn1js.Null();\n }\n const schema = asn1js.fromBER(value);\n if (schema.result.error) {\n throw new Error(schema.result.error);\n }\n return schema.result;\n },\n};\nexport const AsnIntegerConverter = {\n fromASN: (value) => value.valueBlock.valueHexView.byteLength >= 4\n ? value.valueBlock.toString()\n : value.valueBlock.valueDec,\n toASN: (value) => new asn1js.Integer({ value: +value }),\n};\nexport const AsnEnumeratedConverter = {\n fromASN: (value) => value.valueBlock.valueDec,\n toASN: (value) => new asn1js.Enumerated({ value }),\n};\nexport const AsnIntegerArrayBufferConverter = {\n fromASN: (value) => value.valueBlock.valueHexView,\n toASN: (value) => new asn1js.Integer({ valueHex: value }),\n};\nexport const AsnIntegerBigIntConverter = {\n fromASN: (value) => value.toBigInt(),\n toASN: (value) => asn1js.Integer.fromBigInt(value),\n};\nexport const AsnBitStringConverter = {\n fromASN: (value) => value.valueBlock.valueHexView,\n toASN: (value) => new asn1js.BitString({ valueHex: value }),\n};\nexport const AsnObjectIdentifierConverter = {\n fromASN: (value) => value.valueBlock.toString(),\n toASN: (value) => new asn1js.ObjectIdentifier({ value }),\n};\nexport const AsnBooleanConverter = {\n fromASN: (value) => value.valueBlock.value,\n toASN: (value) => new asn1js.Boolean({ value }),\n};\nexport const AsnOctetStringConverter = {\n fromASN: (value) => value.valueBlock.valueHexView,\n toASN: (value) => new asn1js.OctetString({ valueHex: value }),\n};\nexport const AsnConstructedOctetStringConverter = {\n fromASN: (value) => new OctetString(value.getValue()),\n toASN: (value) => value.toASN(),\n};\nfunction createStringConverter(Asn1Type) {\n return {\n fromASN: (value) => value.valueBlock.value,\n toASN: (value) => new Asn1Type({ value }),\n };\n}\nexport const AsnUtf8StringConverter = createStringConverter(asn1js.Utf8String);\nexport const AsnBmpStringConverter = createStringConverter(asn1js.BmpString);\nexport const AsnUniversalStringConverter = createStringConverter(asn1js.UniversalString);\nexport const AsnNumericStringConverter = createStringConverter(asn1js.NumericString);\nexport const AsnPrintableStringConverter = createStringConverter(asn1js.PrintableString);\nexport const AsnTeletexStringConverter = createStringConverter(asn1js.TeletexString);\nexport const AsnVideotexStringConverter = createStringConverter(asn1js.VideotexString);\nexport const AsnIA5StringConverter = createStringConverter(asn1js.IA5String);\nexport const AsnGraphicStringConverter = createStringConverter(asn1js.GraphicString);\nexport const AsnVisibleStringConverter = createStringConverter(asn1js.VisibleString);\nexport const AsnGeneralStringConverter = createStringConverter(asn1js.GeneralString);\nexport const AsnCharacterStringConverter = createStringConverter(asn1js.CharacterString);\nexport const AsnUTCTimeConverter = {\n fromASN: (value) => value.toDate(),\n toASN: (value) => new asn1js.UTCTime({ valueDate: value }),\n};\nexport const AsnGeneralizedTimeConverter = {\n fromASN: (value) => value.toDate(),\n toASN: (value) => new asn1js.GeneralizedTime({ valueDate: value }),\n};\nexport const AsnNullConverter = {\n fromASN: () => null,\n toASN: () => {\n return new asn1js.Null();\n },\n};\nexport function defaultConverter(type) {\n switch (type) {\n case AsnPropTypes.Any:\n return AsnAnyConverter;\n case AsnPropTypes.BitString:\n return AsnBitStringConverter;\n case AsnPropTypes.BmpString:\n return AsnBmpStringConverter;\n case AsnPropTypes.Boolean:\n return AsnBooleanConverter;\n case AsnPropTypes.CharacterString:\n return AsnCharacterStringConverter;\n case AsnPropTypes.Enumerated:\n return AsnEnumeratedConverter;\n case AsnPropTypes.GeneralString:\n return AsnGeneralStringConverter;\n case AsnPropTypes.GeneralizedTime:\n return AsnGeneralizedTimeConverter;\n case AsnPropTypes.GraphicString:\n return AsnGraphicStringConverter;\n case AsnPropTypes.IA5String:\n return AsnIA5StringConverter;\n case AsnPropTypes.Integer:\n return AsnIntegerConverter;\n case AsnPropTypes.Null:\n return AsnNullConverter;\n case AsnPropTypes.NumericString:\n return AsnNumericStringConverter;\n case AsnPropTypes.ObjectIdentifier:\n return AsnObjectIdentifierConverter;\n case AsnPropTypes.OctetString:\n return AsnOctetStringConverter;\n case AsnPropTypes.PrintableString:\n return AsnPrintableStringConverter;\n case AsnPropTypes.TeletexString:\n return AsnTeletexStringConverter;\n case AsnPropTypes.UTCTime:\n return AsnUTCTimeConverter;\n case AsnPropTypes.UniversalString:\n return AsnUniversalStringConverter;\n case AsnPropTypes.Utf8String:\n return AsnUtf8StringConverter;\n case AsnPropTypes.VideotexString:\n return AsnVideotexStringConverter;\n case AsnPropTypes.VisibleString:\n return AsnVisibleStringConverter;\n default:\n return null;\n }\n}\n","export function isConvertible(target) {\n if (typeof target === \"function\" && target.prototype) {\n if (target.prototype.toASN && target.prototype.fromASN) {\n return true;\n }\n else {\n return isConvertible(target.prototype);\n }\n }\n else {\n return !!(target && typeof target === \"object\" && \"toASN\" in target && \"fromASN\" in target);\n }\n}\nexport function isTypeOfArray(target) {\n var _a;\n if (target) {\n const proto = Object.getPrototypeOf(target);\n if (((_a = proto === null || proto === void 0 ? void 0 : proto.prototype) === null || _a === void 0 ? void 0 : _a.constructor) === Array) {\n return true;\n }\n return isTypeOfArray(proto);\n }\n return false;\n}\nexport function isArrayEqual(bytes1, bytes2) {\n if (!(bytes1 && bytes2)) {\n return false;\n }\n if (bytes1.byteLength !== bytes2.byteLength) {\n return false;\n }\n const b1 = new Uint8Array(bytes1);\n const b2 = new Uint8Array(bytes2);\n for (let i = 0; i < bytes1.byteLength; i++) {\n if (b1[i] !== b2[i]) {\n return false;\n }\n }\n return true;\n}\n","import { AsnSchemaStorage } from \"./schema\";\nexport const schemaStorage = new AsnSchemaStorage();\n","import * as asn1js from \"asn1js\";\nimport { AsnPropTypes, AsnTypeTypes } from \"./enums\";\nimport { isConvertible } from \"./helper\";\nexport class AsnSchemaStorage {\n constructor() {\n this.items = new WeakMap();\n }\n has(target) {\n return this.items.has(target);\n }\n get(target, checkSchema = false) {\n const schema = this.items.get(target);\n if (!schema) {\n throw new Error(`Cannot get schema for '${target.prototype.constructor.name}' target`);\n }\n if (checkSchema && !schema.schema) {\n throw new Error(`Schema '${target.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`);\n }\n return schema;\n }\n cache(target) {\n const schema = this.get(target);\n if (!schema.schema) {\n schema.schema = this.create(target, true);\n }\n }\n createDefault(target) {\n const schema = { type: AsnTypeTypes.Sequence, items: {} };\n const parentSchema = this.findParentSchema(target);\n if (parentSchema) {\n Object.assign(schema, parentSchema);\n schema.items = Object.assign({}, schema.items, parentSchema.items);\n }\n return schema;\n }\n create(target, useNames) {\n const schema = this.items.get(target) || this.createDefault(target);\n const asn1Value = [];\n for (const key in schema.items) {\n const item = schema.items[key];\n const name = useNames ? key : \"\";\n let asn1Item;\n if (typeof item.type === \"number\") {\n const Asn1TypeName = AsnPropTypes[item.type];\n const Asn1Type = asn1js[Asn1TypeName];\n if (!Asn1Type) {\n throw new Error(`Cannot get ASN1 class by name '${Asn1TypeName}'`);\n }\n asn1Item = new Asn1Type({ name });\n }\n else if (isConvertible(item.type)) {\n const instance = new item.type();\n asn1Item = instance.toSchema(name);\n }\n else if (item.optional) {\n const itemSchema = this.get(item.type);\n if (itemSchema.type === AsnTypeTypes.Choice) {\n asn1Item = new asn1js.Any({ name });\n }\n else {\n asn1Item = this.create(item.type, false);\n asn1Item.name = name;\n }\n }\n else {\n asn1Item = new asn1js.Any({ name });\n }\n const optional = !!item.optional || item.defaultValue !== undefined;\n if (item.repeated) {\n asn1Item.name = \"\";\n const Container = item.repeated === \"set\" ? asn1js.Set : asn1js.Sequence;\n asn1Item = new Container({\n name: \"\",\n value: [new asn1js.Repeated({ name, value: asn1Item })],\n });\n }\n if (item.context !== null && item.context !== undefined) {\n if (item.implicit) {\n if (typeof item.type === \"number\" || isConvertible(item.type)) {\n const Container = item.repeated ? asn1js.Constructed : asn1js.Primitive;\n asn1Value.push(new Container({ name, optional, idBlock: { tagClass: 3, tagNumber: item.context } }));\n }\n else {\n this.cache(item.type);\n const isRepeated = !!item.repeated;\n let value = !isRepeated ? this.get(item.type, true).schema : asn1Item;\n value =\n \"valueBlock\" in value\n ? value.valueBlock.value\n :\n value.value;\n asn1Value.push(new asn1js.Constructed({\n name: !isRepeated ? name : \"\",\n optional,\n idBlock: { tagClass: 3, tagNumber: item.context },\n value: value,\n }));\n }\n }\n else {\n asn1Value.push(new asn1js.Constructed({\n optional,\n idBlock: { tagClass: 3, tagNumber: item.context },\n value: [asn1Item],\n }));\n }\n }\n else {\n asn1Item.optional = optional;\n asn1Value.push(asn1Item);\n }\n }\n switch (schema.type) {\n case AsnTypeTypes.Sequence:\n return new asn1js.Sequence({ value: asn1Value, name: \"\" });\n case AsnTypeTypes.Set:\n return new asn1js.Set({ value: asn1Value, name: \"\" });\n case AsnTypeTypes.Choice:\n return new asn1js.Choice({ value: asn1Value, name: \"\" });\n default:\n throw new Error(`Unsupported ASN1 type in use`);\n }\n }\n set(target, schema) {\n this.items.set(target, schema);\n return this;\n }\n findParentSchema(target) {\n const parent = Object.getPrototypeOf(target);\n if (parent) {\n const schema = this.items.get(parent);\n return schema || this.findParentSchema(parent);\n }\n return null;\n }\n}\n","import * as converters from \"./converters\";\nimport { AsnTypeTypes } from \"./enums\";\nimport { schemaStorage } from \"./storage\";\nexport const AsnType = (options) => (target) => {\n let schema;\n if (!schemaStorage.has(target)) {\n schema = schemaStorage.createDefault(target);\n schemaStorage.set(target, schema);\n }\n else {\n schema = schemaStorage.get(target);\n }\n Object.assign(schema, options);\n};\nexport const AsnChoiceType = () => AsnType({ type: AsnTypeTypes.Choice });\nexport const AsnSetType = (options) => AsnType({ type: AsnTypeTypes.Set, ...options });\nexport const AsnSequenceType = (options) => AsnType({ type: AsnTypeTypes.Sequence, ...options });\nexport const AsnProp = (options) => (target, propertyKey) => {\n let schema;\n if (!schemaStorage.has(target.constructor)) {\n schema = schemaStorage.createDefault(target.constructor);\n schemaStorage.set(target.constructor, schema);\n }\n else {\n schema = schemaStorage.get(target.constructor);\n }\n const copyOptions = Object.assign({}, options);\n if (typeof copyOptions.type === \"number\" && !copyOptions.converter) {\n const defaultConverter = converters.defaultConverter(options.type);\n if (!defaultConverter) {\n throw new Error(`Cannot get default converter for property '${propertyKey}' of ${target.constructor.name}`);\n }\n copyOptions.converter = defaultConverter;\n }\n copyOptions.raw = options.raw;\n schema.items[propertyKey] = copyOptions;\n};\n","export class AsnSchemaValidationError extends Error {\n constructor() {\n super(...arguments);\n this.schemas = [];\n }\n}\n","import * as asn1js from \"asn1js\";\nimport { AsnPropTypes, AsnTypeTypes } from \"./enums\";\nimport * as converters from \"./converters\";\nimport { AsnSchemaValidationError } from \"./errors\";\nimport { isConvertible, isTypeOfArray } from \"./helper\";\nimport { schemaStorage } from \"./storage\";\nexport class AsnParser {\n static parse(data, target) {\n const asn1Parsed = asn1js.fromBER(data);\n if (asn1Parsed.result.error) {\n throw new Error(asn1Parsed.result.error);\n }\n const res = this.fromASN(asn1Parsed.result, target);\n return res;\n }\n static fromASN(asn1Schema, target) {\n try {\n if (isConvertible(target)) {\n const value = new target();\n return value.fromASN(asn1Schema);\n }\n const schema = schemaStorage.get(target);\n schemaStorage.cache(target);\n let targetSchema = schema.schema;\n const choiceResult = this.handleChoiceTypes(asn1Schema, schema, target, targetSchema);\n if (choiceResult === null || choiceResult === void 0 ? void 0 : choiceResult.result) {\n return choiceResult.result;\n }\n if (choiceResult === null || choiceResult === void 0 ? void 0 : choiceResult.targetSchema) {\n targetSchema = choiceResult.targetSchema;\n }\n const sequenceResult = this.handleSequenceTypes(asn1Schema, schema, target, targetSchema);\n const res = new target();\n if (isTypeOfArray(target)) {\n return this.handleArrayTypes(asn1Schema, schema, target);\n }\n this.processSchemaItems(schema, sequenceResult, res);\n return res;\n }\n catch (error) {\n if (error instanceof AsnSchemaValidationError) {\n error.schemas.push(target.name);\n }\n throw error;\n }\n }\n static handleChoiceTypes(asn1Schema, schema, target, targetSchema) {\n if (asn1Schema.constructor === asn1js.Constructed &&\n schema.type === AsnTypeTypes.Choice &&\n asn1Schema.idBlock.tagClass === 3) {\n for (const key in schema.items) {\n const schemaItem = schema.items[key];\n if (schemaItem.context === asn1Schema.idBlock.tagNumber && schemaItem.implicit) {\n if (typeof schemaItem.type === \"function\" &&\n schemaStorage.has(schemaItem.type)) {\n const fieldSchema = schemaStorage.get(schemaItem.type);\n if (fieldSchema && fieldSchema.type === AsnTypeTypes.Sequence) {\n const newSeq = new asn1js.Sequence();\n if (\"value\" in asn1Schema.valueBlock &&\n Array.isArray(asn1Schema.valueBlock.value) &&\n \"value\" in newSeq.valueBlock) {\n newSeq.valueBlock.value = asn1Schema.valueBlock.value;\n const fieldValue = this.fromASN(newSeq, schemaItem.type);\n const res = new target();\n res[key] = fieldValue;\n return { result: res };\n }\n }\n }\n }\n }\n }\n else if (asn1Schema.constructor === asn1js.Constructed &&\n schema.type !== AsnTypeTypes.Choice) {\n const newTargetSchema = new asn1js.Constructed({\n idBlock: {\n tagClass: 3,\n tagNumber: asn1Schema.idBlock.tagNumber,\n },\n value: schema.schema.valueBlock.value,\n });\n for (const key in schema.items) {\n delete asn1Schema[key];\n }\n return { targetSchema: newTargetSchema };\n }\n return null;\n }\n static handleSequenceTypes(asn1Schema, schema, target, targetSchema) {\n if (schema.type === AsnTypeTypes.Sequence) {\n const asn1ComparedSchema = asn1js.compareSchema({}, asn1Schema, targetSchema);\n if (!asn1ComparedSchema.verified) {\n throw new AsnSchemaValidationError(`Data does not match to ${target.name} ASN1 schema.${asn1ComparedSchema.result.error ? ` ${asn1ComparedSchema.result.error}` : \"\"}`);\n }\n return asn1ComparedSchema;\n }\n else {\n const asn1ComparedSchema = asn1js.compareSchema({}, asn1Schema, targetSchema);\n if (!asn1ComparedSchema.verified) {\n throw new AsnSchemaValidationError(`Data does not match to ${target.name} ASN1 schema.${asn1ComparedSchema.result.error ? ` ${asn1ComparedSchema.result.error}` : \"\"}`);\n }\n return asn1ComparedSchema;\n }\n }\n static processRepeatedField(asn1Elements, asn1Index, schemaItem) {\n let elementsToProcess = asn1Elements.slice(asn1Index);\n if (elementsToProcess.length === 1 && elementsToProcess[0].constructor.name === \"Sequence\") {\n const seq = elementsToProcess[0];\n if (seq.valueBlock && seq.valueBlock.value && Array.isArray(seq.valueBlock.value)) {\n elementsToProcess = seq.valueBlock.value;\n }\n }\n if (typeof schemaItem.type === \"number\") {\n const converter = converters.defaultConverter(schemaItem.type);\n if (!converter)\n throw new Error(`No converter for ASN.1 type ${schemaItem.type}`);\n return elementsToProcess\n .filter((el) => el && el.valueBlock)\n .map((el) => {\n try {\n return converter.fromASN(el);\n }\n catch {\n return undefined;\n }\n })\n .filter((v) => v !== undefined);\n }\n else {\n return elementsToProcess\n .filter((el) => el && el.valueBlock)\n .map((el) => {\n try {\n return this.fromASN(el, schemaItem.type);\n }\n catch {\n return undefined;\n }\n })\n .filter((v) => v !== undefined);\n }\n }\n static processPrimitiveField(asn1Element, schemaItem) {\n const converter = converters.defaultConverter(schemaItem.type);\n if (!converter)\n throw new Error(`No converter for ASN.1 type ${schemaItem.type}`);\n return converter.fromASN(asn1Element);\n }\n static isOptionalChoiceField(schemaItem) {\n return (schemaItem.optional &&\n typeof schemaItem.type === \"function\" &&\n schemaStorage.has(schemaItem.type) &&\n schemaStorage.get(schemaItem.type).type === AsnTypeTypes.Choice);\n }\n static processOptionalChoiceField(asn1Element, schemaItem) {\n try {\n const value = this.fromASN(asn1Element, schemaItem.type);\n return { processed: true, value };\n }\n catch (err) {\n if (err instanceof AsnSchemaValidationError &&\n /Wrong values for Choice type/.test(err.message)) {\n return { processed: false };\n }\n throw err;\n }\n }\n static handleArrayTypes(asn1Schema, schema, target) {\n if (!(\"value\" in asn1Schema.valueBlock && Array.isArray(asn1Schema.valueBlock.value))) {\n throw new Error(`Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.`);\n }\n const itemType = schema.itemType;\n if (typeof itemType === \"number\") {\n const converter = converters.defaultConverter(itemType);\n if (!converter) {\n throw new Error(`Cannot get default converter for array item of ${target.name} ASN1 schema`);\n }\n return target.from(asn1Schema.valueBlock.value, (element) => converter.fromASN(element));\n }\n else {\n return target.from(asn1Schema.valueBlock.value, (element) => this.fromASN(element, itemType));\n }\n }\n static processSchemaItems(schema, asn1ComparedSchema, res) {\n for (const key in schema.items) {\n const asn1SchemaValue = asn1ComparedSchema.result[key];\n if (!asn1SchemaValue) {\n continue;\n }\n const schemaItem = schema.items[key];\n const schemaItemType = schemaItem.type;\n let parsedValue;\n if (typeof schemaItemType === \"number\" || isConvertible(schemaItemType)) {\n parsedValue = this.processPrimitiveSchemaItem(asn1SchemaValue, schemaItem, schemaItemType);\n }\n else {\n parsedValue = this.processComplexSchemaItem(asn1SchemaValue, schemaItem, schemaItemType);\n }\n if (parsedValue &&\n typeof parsedValue === \"object\" &&\n \"value\" in parsedValue &&\n \"raw\" in parsedValue) {\n res[key] = parsedValue.value;\n res[`${key}Raw`] = parsedValue.raw;\n }\n else {\n res[key] = parsedValue;\n }\n }\n }\n static processPrimitiveSchemaItem(asn1SchemaValue, schemaItem, schemaItemType) {\n var _a;\n const converter = (_a = schemaItem.converter) !== null && _a !== void 0 ? _a : (isConvertible(schemaItemType)\n ? new schemaItemType()\n : null);\n if (!converter) {\n throw new Error(\"Converter is empty\");\n }\n if (schemaItem.repeated) {\n return this.processRepeatedPrimitiveItem(asn1SchemaValue, schemaItem, converter);\n }\n else {\n return this.processSinglePrimitiveItem(asn1SchemaValue, schemaItem, schemaItemType, converter);\n }\n }\n static processRepeatedPrimitiveItem(asn1SchemaValue, schemaItem, converter) {\n if (schemaItem.implicit) {\n const Container = schemaItem.repeated === \"sequence\" ? asn1js.Sequence : asn1js.Set;\n const newItem = new Container();\n newItem.valueBlock = asn1SchemaValue.valueBlock;\n const newItemAsn = asn1js.fromBER(newItem.toBER(false));\n if (newItemAsn.offset === -1) {\n throw new Error(`Cannot parse the child item. ${newItemAsn.result.error}`);\n }\n if (!(\"value\" in newItemAsn.result.valueBlock &&\n Array.isArray(newItemAsn.result.valueBlock.value))) {\n throw new Error(\"Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed.\");\n }\n const value = newItemAsn.result.valueBlock.value;\n return Array.from(value, (element) => converter.fromASN(element));\n }\n else {\n return Array.from(asn1SchemaValue, (element) => converter.fromASN(element));\n }\n }\n static processSinglePrimitiveItem(asn1SchemaValue, schemaItem, schemaItemType, converter) {\n let value = asn1SchemaValue;\n if (schemaItem.implicit) {\n let newItem;\n if (isConvertible(schemaItemType)) {\n newItem = new schemaItemType().toSchema(\"\");\n }\n else {\n const Asn1TypeName = AsnPropTypes[schemaItemType];\n const Asn1Type = asn1js[Asn1TypeName];\n if (!Asn1Type) {\n throw new Error(`Cannot get '${Asn1TypeName}' class from asn1js module`);\n }\n newItem = new Asn1Type();\n }\n newItem.valueBlock = value.valueBlock;\n value = asn1js.fromBER(newItem.toBER(false)).result;\n }\n return converter.fromASN(value);\n }\n static processComplexSchemaItem(asn1SchemaValue, schemaItem, schemaItemType) {\n if (schemaItem.repeated) {\n if (!Array.isArray(asn1SchemaValue)) {\n throw new Error(\"Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable.\");\n }\n return Array.from(asn1SchemaValue, (element) => this.fromASN(element, schemaItemType));\n }\n else {\n const valueToProcess = this.handleImplicitTagging(asn1SchemaValue, schemaItem, schemaItemType);\n if (this.isOptionalChoiceField(schemaItem)) {\n try {\n return this.fromASN(valueToProcess, schemaItemType);\n }\n catch (err) {\n if (err instanceof AsnSchemaValidationError &&\n /Wrong values for Choice type/.test(err.message)) {\n return undefined;\n }\n throw err;\n }\n }\n else {\n const parsedValue = this.fromASN(valueToProcess, schemaItemType);\n if (schemaItem.raw) {\n return {\n value: parsedValue,\n raw: asn1SchemaValue.valueBeforeDecodeView,\n };\n }\n return parsedValue;\n }\n }\n }\n static handleImplicitTagging(asn1SchemaValue, schemaItem, schemaItemType) {\n if (schemaItem.implicit && typeof schemaItem.context === \"number\") {\n const schema = schemaStorage.get(schemaItemType);\n if (schema.type === AsnTypeTypes.Sequence) {\n const newSeq = new asn1js.Sequence();\n if (\"value\" in asn1SchemaValue.valueBlock &&\n Array.isArray(asn1SchemaValue.valueBlock.value) &&\n \"value\" in newSeq.valueBlock) {\n newSeq.valueBlock.value = asn1SchemaValue.valueBlock.value;\n return newSeq;\n }\n }\n else if (schema.type === AsnTypeTypes.Set) {\n const newSet = new asn1js.Set();\n if (\"value\" in asn1SchemaValue.valueBlock &&\n Array.isArray(asn1SchemaValue.valueBlock.value) &&\n \"value\" in newSet.valueBlock) {\n newSet.valueBlock.value = asn1SchemaValue.valueBlock.value;\n return newSet;\n }\n }\n }\n return asn1SchemaValue;\n }\n}\n","import * as asn1js from \"asn1js\";\nimport * as converters from \"./converters\";\nimport { AsnPropTypes, AsnTypeTypes } from \"./enums\";\nimport { isConvertible, isArrayEqual } from \"./helper\";\nimport { schemaStorage } from \"./storage\";\nexport class AsnSerializer {\n static serialize(obj) {\n if (obj instanceof asn1js.BaseBlock) {\n return obj.toBER(false);\n }\n return this.toASN(obj).toBER(false);\n }\n static toASN(obj) {\n if (obj && typeof obj === \"object\" && isConvertible(obj)) {\n return obj.toASN();\n }\n if (!(obj && typeof obj === \"object\")) {\n throw new TypeError(\"Parameter 1 should be type of Object.\");\n }\n const target = obj.constructor;\n const schema = schemaStorage.get(target);\n schemaStorage.cache(target);\n let asn1Value = [];\n if (schema.itemType) {\n if (!Array.isArray(obj)) {\n throw new TypeError(\"Parameter 1 should be type of Array.\");\n }\n if (typeof schema.itemType === \"number\") {\n const converter = converters.defaultConverter(schema.itemType);\n if (!converter) {\n throw new Error(`Cannot get default converter for array item of ${target.name} ASN1 schema`);\n }\n asn1Value = obj.map((o) => converter.toASN(o));\n }\n else {\n asn1Value = obj.map((o) => this.toAsnItem({ type: schema.itemType }, \"[]\", target, o));\n }\n }\n else {\n for (const key in schema.items) {\n const schemaItem = schema.items[key];\n const objProp = obj[key];\n if (objProp === undefined ||\n schemaItem.defaultValue === objProp ||\n (typeof schemaItem.defaultValue === \"object\" &&\n typeof objProp === \"object\" &&\n isArrayEqual(this.serialize(schemaItem.defaultValue), this.serialize(objProp)))) {\n continue;\n }\n const asn1Item = AsnSerializer.toAsnItem(schemaItem, key, target, objProp);\n if (typeof schemaItem.context === \"number\") {\n if (schemaItem.implicit) {\n if (!schemaItem.repeated &&\n (typeof schemaItem.type === \"number\" || isConvertible(schemaItem.type))) {\n const value = {};\n value.valueHex =\n asn1Item instanceof asn1js.Null\n ? asn1Item.valueBeforeDecodeView\n : asn1Item.valueBlock.toBER();\n asn1Value.push(new asn1js.Primitive({\n optional: schemaItem.optional,\n idBlock: {\n tagClass: 3,\n tagNumber: schemaItem.context,\n },\n ...value,\n }));\n }\n else {\n asn1Value.push(new asn1js.Constructed({\n optional: schemaItem.optional,\n idBlock: {\n tagClass: 3,\n tagNumber: schemaItem.context,\n },\n value: asn1Item.valueBlock.value,\n }));\n }\n }\n else {\n asn1Value.push(new asn1js.Constructed({\n optional: schemaItem.optional,\n idBlock: {\n tagClass: 3,\n tagNumber: schemaItem.context,\n },\n value: [asn1Item],\n }));\n }\n }\n else if (schemaItem.repeated) {\n asn1Value = asn1Value.concat(asn1Item);\n }\n else {\n asn1Value.push(asn1Item);\n }\n }\n }\n let asnSchema;\n switch (schema.type) {\n case AsnTypeTypes.Sequence:\n asnSchema = new asn1js.Sequence({ value: asn1Value });\n break;\n case AsnTypeTypes.Set:\n asnSchema = new asn1js.Set({ value: asn1Value });\n break;\n case AsnTypeTypes.Choice:\n if (!asn1Value[0]) {\n throw new Error(`Schema '${target.name}' has wrong data. Choice cannot be empty.`);\n }\n asnSchema = asn1Value[0];\n break;\n }\n return asnSchema;\n }\n static toAsnItem(schemaItem, key, target, objProp) {\n let asn1Item;\n if (typeof schemaItem.type === \"number\") {\n const converter = schemaItem.converter;\n if (!converter) {\n throw new Error(`Property '${key}' doesn't have converter for type ${AsnPropTypes[schemaItem.type]} in schema '${target.name}'`);\n }\n if (schemaItem.repeated) {\n if (!Array.isArray(objProp)) {\n throw new TypeError(\"Parameter 'objProp' should be type of Array.\");\n }\n const items = Array.from(objProp, (element) => converter.toASN(element));\n const Container = schemaItem.repeated === \"sequence\" ? asn1js.Sequence : asn1js.Set;\n asn1Item = new Container({\n value: items,\n });\n }\n else {\n asn1Item = converter.toASN(objProp);\n }\n }\n else {\n if (schemaItem.repeated) {\n if (!Array.isArray(objProp)) {\n throw new TypeError(\"Parameter 'objProp' should be type of Array.\");\n }\n const items = Array.from(objProp, (element) => this.toASN(element));\n const Container = schemaItem.repeated === \"sequence\" ? asn1js.Sequence : asn1js.Set;\n asn1Item = new Container({\n value: items,\n });\n }\n else {\n asn1Item = this.toASN(objProp);\n }\n }\n return asn1Item;\n }\n}\n","export class AsnArray extends Array {\n constructor(items = []) {\n if (typeof items === \"number\") {\n super(items);\n }\n else {\n super();\n for (const item of items) {\n this.push(item);\n }\n }\n }\n}\n","import * as asn1js from \"asn1js\";\nimport { BufferSourceConverter } from \"pvtsutils\";\nimport { AsnParser } from \"./parser\";\nimport { AsnSerializer } from \"./serializer\";\nexport class AsnConvert {\n static serialize(obj) {\n return AsnSerializer.serialize(obj);\n }\n static parse(data, target) {\n return AsnParser.parse(data, target);\n }\n static toString(data) {\n const buf = BufferSourceConverter.isBufferSource(data)\n ? BufferSourceConverter.toArrayBuffer(data)\n : AsnConvert.serialize(data);\n const asn = asn1js.fromBER(buf);\n if (asn.offset === -1) {\n throw new Error(`Cannot decode ASN.1 data. ${asn.result.error}`);\n }\n return asn.result.toString();\n }\n}\n","import tslib from '../tslib.js';\r\nconst {\r\n __extends,\r\n __assign,\r\n __rest,\r\n __decorate,\r\n __param,\r\n __esDecorate,\r\n __runInitializers,\r\n __propKey,\r\n __setFunctionName,\r\n __metadata,\r\n __awaiter,\r\n __generator,\r\n __exportStar,\r\n __createBinding,\r\n __values,\r\n __read,\r\n __spread,\r\n __spreadArrays,\r\n __spreadArray,\r\n __await,\r\n __asyncGenerator,\r\n __asyncDelegator,\r\n __asyncValues,\r\n __makeTemplateObject,\r\n __importStar,\r\n __importDefault,\r\n __classPrivateFieldGet,\r\n __classPrivateFieldSet,\r\n __classPrivateFieldIn,\r\n __addDisposableResource,\r\n __disposeResources,\r\n __rewriteRelativeImportExtension,\r\n} = tslib;\r\nexport {\r\n __extends,\r\n __assign,\r\n __rest,\r\n __decorate,\r\n __param,\r\n __esDecorate,\r\n __runInitializers,\r\n __propKey,\r\n __setFunctionName,\r\n __metadata,\r\n __awaiter,\r\n __generator,\r\n __exportStar,\r\n __createBinding,\r\n __values,\r\n __read,\r\n __spread,\r\n __spreadArrays,\r\n __spreadArray,\r\n __await,\r\n __asyncGenerator,\r\n __asyncDelegator,\r\n __asyncValues,\r\n __makeTemplateObject,\r\n __importStar,\r\n __importDefault,\r\n __classPrivateFieldGet,\r\n __classPrivateFieldSet,\r\n __classPrivateFieldIn,\r\n __addDisposableResource,\r\n __disposeResources,\r\n __rewriteRelativeImportExtension,\r\n};\r\nexport default tslib;\r\n","import { Convert } from \"pvtsutils\";\nexport class IpConverter {\n static isIPv4(ip) {\n return /^(\\d{1,3}\\.){3}\\d{1,3}$/.test(ip);\n }\n static parseIPv4(ip) {\n const parts = ip.split(\".\");\n if (parts.length !== 4) {\n throw new Error(\"Invalid IPv4 address\");\n }\n return parts.map((part) => {\n const num = parseInt(part, 10);\n if (isNaN(num) || num < 0 || num > 255) {\n throw new Error(\"Invalid IPv4 address part\");\n }\n return num;\n });\n }\n static parseIPv6(ip) {\n const expandedIP = this.expandIPv6(ip);\n const parts = expandedIP.split(\":\");\n if (parts.length !== 8) {\n throw new Error(\"Invalid IPv6 address\");\n }\n return parts.reduce((bytes, part) => {\n const num = parseInt(part, 16);\n if (isNaN(num) || num < 0 || num > 0xffff) {\n throw new Error(\"Invalid IPv6 address part\");\n }\n bytes.push((num >> 8) & 0xff);\n bytes.push(num & 0xff);\n return bytes;\n }, []);\n }\n static expandIPv6(ip) {\n if (!ip.includes(\"::\")) {\n return ip;\n }\n const parts = ip.split(\"::\");\n if (parts.length > 2) {\n throw new Error(\"Invalid IPv6 address\");\n }\n const left = parts[0] ? parts[0].split(\":\") : [];\n const right = parts[1] ? parts[1].split(\":\") : [];\n const missing = 8 - (left.length + right.length);\n if (missing < 0) {\n throw new Error(\"Invalid IPv6 address\");\n }\n return [...left, ...Array(missing).fill(\"0\"), ...right].join(\":\");\n }\n static formatIPv6(bytes) {\n const parts = [];\n for (let i = 0; i < 16; i += 2) {\n parts.push(((bytes[i] << 8) | bytes[i + 1]).toString(16));\n }\n return this.compressIPv6(parts.join(\":\"));\n }\n static compressIPv6(ip) {\n const parts = ip.split(\":\");\n let longestZeroStart = -1;\n let longestZeroLength = 0;\n let currentZeroStart = -1;\n let currentZeroLength = 0;\n for (let i = 0; i < parts.length; i++) {\n if (parts[i] === \"0\") {\n if (currentZeroStart === -1) {\n currentZeroStart = i;\n }\n currentZeroLength++;\n }\n else {\n if (currentZeroLength > longestZeroLength) {\n longestZeroStart = currentZeroStart;\n longestZeroLength = currentZeroLength;\n }\n currentZeroStart = -1;\n currentZeroLength = 0;\n }\n }\n if (currentZeroLength > longestZeroLength) {\n longestZeroStart = currentZeroStart;\n longestZeroLength = currentZeroLength;\n }\n if (longestZeroLength > 1) {\n const before = parts.slice(0, longestZeroStart).join(\":\");\n const after = parts.slice(longestZeroStart + longestZeroLength).join(\":\");\n return `${before}::${after}`;\n }\n return ip;\n }\n static parseCIDR(text) {\n const [addr, prefixStr] = text.split(\"/\");\n const prefix = parseInt(prefixStr, 10);\n if (this.isIPv4(addr)) {\n if (prefix < 0 || prefix > 32) {\n throw new Error(\"Invalid IPv4 prefix length\");\n }\n return [this.parseIPv4(addr), prefix];\n }\n else {\n if (prefix < 0 || prefix > 128) {\n throw new Error(\"Invalid IPv6 prefix length\");\n }\n return [this.parseIPv6(addr), prefix];\n }\n }\n static decodeIP(value) {\n if (value.length === 64 && parseInt(value, 16) === 0) {\n return \"::/0\";\n }\n if (value.length !== 16) {\n return value;\n }\n const mask = parseInt(value.slice(8), 16)\n .toString(2)\n .split(\"\")\n .reduce((a, k) => a + +k, 0);\n let ip = value.slice(0, 8).replace(/(.{2})/g, (match) => `${parseInt(match, 16)}.`);\n ip = ip.slice(0, -1);\n return `${ip}/${mask}`;\n }\n static toString(buf) {\n const uint8 = new Uint8Array(buf);\n if (uint8.length === 4) {\n return Array.from(uint8).join(\".\");\n }\n if (uint8.length === 16) {\n return this.formatIPv6(uint8);\n }\n if (uint8.length === 8 || uint8.length === 32) {\n const half = uint8.length / 2;\n const addrBytes = uint8.slice(0, half);\n const maskBytes = uint8.slice(half);\n const isAllZeros = uint8.every((byte) => byte === 0);\n if (isAllZeros) {\n return uint8.length === 8 ? \"0.0.0.0/0\" : \"::/0\";\n }\n const prefixLen = maskBytes.reduce((a, b) => a + (b.toString(2).match(/1/g) || []).length, 0);\n if (uint8.length === 8) {\n const addrStr = Array.from(addrBytes).join(\".\");\n return `${addrStr}/${prefixLen}`;\n }\n else {\n const addrStr = this.formatIPv6(addrBytes);\n return `${addrStr}/${prefixLen}`;\n }\n }\n return this.decodeIP(Convert.ToHex(buf));\n }\n static fromString(text) {\n if (text.includes(\"/\")) {\n const [addr, prefix] = this.parseCIDR(text);\n const maskBytes = new Uint8Array(addr.length);\n let bitsLeft = prefix;\n for (let i = 0; i < maskBytes.length; i++) {\n if (bitsLeft >= 8) {\n maskBytes[i] = 0xff;\n bitsLeft -= 8;\n }\n else if (bitsLeft > 0) {\n maskBytes[i] = 0xff << (8 - bitsLeft);\n bitsLeft = 0;\n }\n }\n const out = new Uint8Array(addr.length * 2);\n out.set(addr, 0);\n out.set(maskBytes, addr.length);\n return out.buffer;\n }\n const bytes = this.isIPv4(text) ? this.parseIPv4(text) : this.parseIPv6(text);\n return new Uint8Array(bytes).buffer;\n }\n}\n","var RelativeDistinguishedName_1, RDNSequence_1, Name_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { Convert } from \"pvtsutils\";\nlet DirectoryString = class DirectoryString {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n toString() {\n return (this.bmpString ||\n this.printableString ||\n this.teletexString ||\n this.universalString ||\n this.utf8String ||\n \"\");\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.TeletexString })\n], DirectoryString.prototype, \"teletexString\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.PrintableString })\n], DirectoryString.prototype, \"printableString\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.UniversalString })\n], DirectoryString.prototype, \"universalString\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Utf8String })\n], DirectoryString.prototype, \"utf8String\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BmpString })\n], DirectoryString.prototype, \"bmpString\", void 0);\nDirectoryString = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], DirectoryString);\nexport { DirectoryString };\nlet AttributeValue = class AttributeValue extends DirectoryString {\n constructor(params = {}) {\n super(params);\n Object.assign(this, params);\n }\n toString() {\n return this.ia5String || (this.anyValue ? Convert.ToHex(this.anyValue) : super.toString());\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String })\n], AttributeValue.prototype, \"ia5String\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], AttributeValue.prototype, \"anyValue\", void 0);\nAttributeValue = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], AttributeValue);\nexport { AttributeValue };\nexport class AttributeTypeAndValue {\n constructor(params = {}) {\n this.type = \"\";\n this.value = new AttributeValue();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], AttributeTypeAndValue.prototype, \"type\", void 0);\n__decorate([\n AsnProp({ type: AttributeValue })\n], AttributeTypeAndValue.prototype, \"value\", void 0);\nlet RelativeDistinguishedName = RelativeDistinguishedName_1 = class RelativeDistinguishedName extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, RelativeDistinguishedName_1.prototype);\n }\n};\nRelativeDistinguishedName = RelativeDistinguishedName_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: AttributeTypeAndValue })\n], RelativeDistinguishedName);\nexport { RelativeDistinguishedName };\nlet RDNSequence = RDNSequence_1 = class RDNSequence extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, RDNSequence_1.prototype);\n }\n};\nRDNSequence = RDNSequence_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: RelativeDistinguishedName })\n], RDNSequence);\nexport { RDNSequence };\nlet Name = Name_1 = class Name extends RDNSequence {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, Name_1.prototype);\n }\n};\nName = Name_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], Name);\nexport { Name };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnOctetStringConverter, } from \"@peculiar/asn1-schema\";\nimport { IpConverter } from \"./ip_converter\";\nimport { DirectoryString, Name } from \"./name\";\nexport const AsnIpConverter = {\n fromASN: (value) => IpConverter.toString(AsnOctetStringConverter.fromASN(value)),\n toASN: (value) => AsnOctetStringConverter.toASN(IpConverter.fromString(value)),\n};\nexport class OtherName {\n constructor(params = {}) {\n this.typeId = \"\";\n this.value = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], OtherName.prototype, \"typeId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], OtherName.prototype, \"value\", void 0);\nexport class EDIPartyName {\n constructor(params = {}) {\n this.partyName = new DirectoryString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: DirectoryString, optional: true, context: 0, implicit: true })\n], EDIPartyName.prototype, \"nameAssigner\", void 0);\n__decorate([\n AsnProp({ type: DirectoryString, context: 1, implicit: true })\n], EDIPartyName.prototype, \"partyName\", void 0);\nlet GeneralName = class GeneralName {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: OtherName, context: 0, implicit: true })\n], GeneralName.prototype, \"otherName\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String, context: 1, implicit: true })\n], GeneralName.prototype, \"rfc822Name\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String, context: 2, implicit: true })\n], GeneralName.prototype, \"dNSName\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 3, implicit: true })\n], GeneralName.prototype, \"x400Address\", void 0);\n__decorate([\n AsnProp({ type: Name, context: 4, implicit: false })\n], GeneralName.prototype, \"directoryName\", void 0);\n__decorate([\n AsnProp({ type: EDIPartyName, context: 5 })\n], GeneralName.prototype, \"ediPartyName\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String, context: 6, implicit: true })\n], GeneralName.prototype, \"uniformResourceIdentifier\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.OctetString,\n context: 7,\n implicit: true,\n converter: AsnIpConverter,\n })\n], GeneralName.prototype, \"iPAddress\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier, context: 8, implicit: true })\n], GeneralName.prototype, \"registeredID\", void 0);\nGeneralName = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], GeneralName);\nexport { GeneralName };\n","export const id_pkix = \"1.3.6.1.5.5.7\";\nexport const id_pe = `${id_pkix}.1`;\nexport const id_qt = `${id_pkix}.2`;\nexport const id_kp = `${id_pkix}.3`;\nexport const id_ad = `${id_pkix}.48`;\nexport const id_qt_csp = `${id_qt}.1`;\nexport const id_qt_unotice = `${id_qt}.2`;\nexport const id_ad_ocsp = `${id_ad}.1`;\nexport const id_ad_caIssuers = `${id_ad}.2`;\nexport const id_ad_timeStamping = `${id_ad}.3`;\nexport const id_ad_caRepository = `${id_ad}.5`;\nexport const id_ce = \"2.5.29\";\n","var AuthorityInfoAccessSyntax_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"../general_name\";\nimport { id_pe } from \"../object_identifiers\";\nexport const id_pe_authorityInfoAccess = `${id_pe}.1`;\nexport class AccessDescription {\n constructor(params = {}) {\n this.accessMethod = \"\";\n this.accessLocation = new GeneralName();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], AccessDescription.prototype, \"accessMethod\", void 0);\n__decorate([\n AsnProp({ type: GeneralName })\n], AccessDescription.prototype, \"accessLocation\", void 0);\nlet AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = class AuthorityInfoAccessSyntax extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, AuthorityInfoAccessSyntax_1.prototype);\n }\n};\nAuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: AccessDescription })\n], AuthorityInfoAccessSyntax);\nexport { AuthorityInfoAccessSyntax };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, OctetString, } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"../general_name\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_authorityKeyIdentifier = `${id_ce}.35`;\nexport class KeyIdentifier extends OctetString {\n}\nexport class AuthorityKeyIdentifier {\n constructor(params = {}) {\n if (params) {\n Object.assign(this, params);\n }\n }\n}\n__decorate([\n AsnProp({ type: KeyIdentifier, context: 0, optional: true, implicit: true })\n], AuthorityKeyIdentifier.prototype, \"keyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: GeneralName, context: 1, optional: true, implicit: true, repeated: \"sequence\" })\n], AuthorityKeyIdentifier.prototype, \"authorityCertIssuer\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Integer,\n context: 2,\n optional: true,\n implicit: true,\n converter: AsnIntegerArrayBufferConverter,\n })\n], AuthorityKeyIdentifier.prototype, \"authorityCertSerialNumber\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_basicConstraints = `${id_ce}.19`;\nexport class BasicConstraints {\n constructor(params = {}) {\n this.cA = false;\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Boolean, defaultValue: false })\n], BasicConstraints.prototype, \"cA\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, optional: true })\n], BasicConstraints.prototype, \"pathLenConstraint\", void 0);\n","var GeneralNames_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"./general_name\";\nimport { AsnArray } from \"@peculiar/asn1-schema\";\nlet GeneralNames = GeneralNames_1 = class GeneralNames extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, GeneralNames_1.prototype);\n }\n};\nGeneralNames = GeneralNames_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: GeneralName })\n], GeneralNames);\nexport { GeneralNames };\n","var CertificateIssuer_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"../general_names\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_certificateIssuer = `${id_ce}.29`;\nlet CertificateIssuer = CertificateIssuer_1 = class CertificateIssuer extends GeneralNames {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, CertificateIssuer_1.prototype);\n }\n};\nCertificateIssuer = CertificateIssuer_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], CertificateIssuer);\nexport { CertificateIssuer };\n","var CertificatePolicies_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_certificatePolicies = `${id_ce}.32`;\nexport const id_ce_certificatePolicies_anyPolicy = `${id_ce_certificatePolicies}.0`;\nlet DisplayText = class DisplayText {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n toString() {\n return this.ia5String || this.visibleString || this.bmpString || this.utf8String || \"\";\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String })\n], DisplayText.prototype, \"ia5String\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.VisibleString })\n], DisplayText.prototype, \"visibleString\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BmpString })\n], DisplayText.prototype, \"bmpString\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Utf8String })\n], DisplayText.prototype, \"utf8String\", void 0);\nDisplayText = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], DisplayText);\nexport { DisplayText };\nexport class NoticeReference {\n constructor(params = {}) {\n this.organization = new DisplayText();\n this.noticeNumbers = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: DisplayText })\n], NoticeReference.prototype, \"organization\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, repeated: \"sequence\" })\n], NoticeReference.prototype, \"noticeNumbers\", void 0);\nexport class UserNotice {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: NoticeReference, optional: true })\n], UserNotice.prototype, \"noticeRef\", void 0);\n__decorate([\n AsnProp({ type: DisplayText, optional: true })\n], UserNotice.prototype, \"explicitText\", void 0);\nlet Qualifier = class Qualifier {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String })\n], Qualifier.prototype, \"cPSuri\", void 0);\n__decorate([\n AsnProp({ type: UserNotice })\n], Qualifier.prototype, \"userNotice\", void 0);\nQualifier = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], Qualifier);\nexport { Qualifier };\nexport class PolicyQualifierInfo {\n constructor(params = {}) {\n this.policyQualifierId = \"\";\n this.qualifier = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], PolicyQualifierInfo.prototype, \"policyQualifierId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], PolicyQualifierInfo.prototype, \"qualifier\", void 0);\nexport class PolicyInformation {\n constructor(params = {}) {\n this.policyIdentifier = \"\";\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], PolicyInformation.prototype, \"policyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: PolicyQualifierInfo, repeated: \"sequence\", optional: true })\n], PolicyInformation.prototype, \"policyQualifiers\", void 0);\nlet CertificatePolicies = CertificatePolicies_1 = class CertificatePolicies extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, CertificatePolicies_1.prototype);\n }\n};\nCertificatePolicies = CertificatePolicies_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: PolicyInformation })\n], CertificatePolicies);\nexport { CertificatePolicies };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_cRLNumber = `${id_ce}.20`;\nlet CRLNumber = class CRLNumber {\n constructor(value = 0) {\n this.value = value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], CRLNumber.prototype, \"value\", void 0);\nCRLNumber = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], CRLNumber);\nexport { CRLNumber };\n","import { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nimport { CRLNumber } from \"./crl_number\";\nexport const id_ce_deltaCRLIndicator = `${id_ce}.27`;\nlet BaseCRLNumber = class BaseCRLNumber extends CRLNumber {\n};\nBaseCRLNumber = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], BaseCRLNumber);\nexport { BaseCRLNumber };\n","var CRLDistributionPoints_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnType, AsnTypeTypes, AsnArray, BitString } from \"@peculiar/asn1-schema\";\nimport { RelativeDistinguishedName } from \"../name\";\nimport { GeneralName } from \"../general_name\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_cRLDistributionPoints = `${id_ce}.31`;\nexport var ReasonFlags;\n(function (ReasonFlags) {\n ReasonFlags[ReasonFlags[\"unused\"] = 1] = \"unused\";\n ReasonFlags[ReasonFlags[\"keyCompromise\"] = 2] = \"keyCompromise\";\n ReasonFlags[ReasonFlags[\"cACompromise\"] = 4] = \"cACompromise\";\n ReasonFlags[ReasonFlags[\"affiliationChanged\"] = 8] = \"affiliationChanged\";\n ReasonFlags[ReasonFlags[\"superseded\"] = 16] = \"superseded\";\n ReasonFlags[ReasonFlags[\"cessationOfOperation\"] = 32] = \"cessationOfOperation\";\n ReasonFlags[ReasonFlags[\"certificateHold\"] = 64] = \"certificateHold\";\n ReasonFlags[ReasonFlags[\"privilegeWithdrawn\"] = 128] = \"privilegeWithdrawn\";\n ReasonFlags[ReasonFlags[\"aACompromise\"] = 256] = \"aACompromise\";\n})(ReasonFlags || (ReasonFlags = {}));\nexport class Reason extends BitString {\n toJSON() {\n const res = [];\n const flags = this.toNumber();\n if (flags & ReasonFlags.aACompromise) {\n res.push(\"aACompromise\");\n }\n if (flags & ReasonFlags.affiliationChanged) {\n res.push(\"affiliationChanged\");\n }\n if (flags & ReasonFlags.cACompromise) {\n res.push(\"cACompromise\");\n }\n if (flags & ReasonFlags.certificateHold) {\n res.push(\"certificateHold\");\n }\n if (flags & ReasonFlags.cessationOfOperation) {\n res.push(\"cessationOfOperation\");\n }\n if (flags & ReasonFlags.keyCompromise) {\n res.push(\"keyCompromise\");\n }\n if (flags & ReasonFlags.privilegeWithdrawn) {\n res.push(\"privilegeWithdrawn\");\n }\n if (flags & ReasonFlags.superseded) {\n res.push(\"superseded\");\n }\n if (flags & ReasonFlags.unused) {\n res.push(\"unused\");\n }\n return res;\n }\n toString() {\n return `[${this.toJSON().join(\", \")}]`;\n }\n}\nlet DistributionPointName = class DistributionPointName {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: GeneralName, context: 0, repeated: \"sequence\", implicit: true })\n], DistributionPointName.prototype, \"fullName\", void 0);\n__decorate([\n AsnProp({ type: RelativeDistinguishedName, context: 1, implicit: true })\n], DistributionPointName.prototype, \"nameRelativeToCRLIssuer\", void 0);\nDistributionPointName = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], DistributionPointName);\nexport { DistributionPointName };\nexport class DistributionPoint {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: DistributionPointName, context: 0, optional: true })\n], DistributionPoint.prototype, \"distributionPoint\", void 0);\n__decorate([\n AsnProp({ type: Reason, context: 1, optional: true, implicit: true })\n], DistributionPoint.prototype, \"reasons\", void 0);\n__decorate([\n AsnProp({ type: GeneralName, context: 2, optional: true, repeated: \"sequence\", implicit: true })\n], DistributionPoint.prototype, \"cRLIssuer\", void 0);\nlet CRLDistributionPoints = CRLDistributionPoints_1 = class CRLDistributionPoints extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, CRLDistributionPoints_1.prototype);\n }\n};\nCRLDistributionPoints = CRLDistributionPoints_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: DistributionPoint })\n], CRLDistributionPoints);\nexport { CRLDistributionPoints };\n","var FreshestCRL_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nimport { CRLDistributionPoints, DistributionPoint } from \"./crl_distribution_points\";\nexport const id_ce_freshestCRL = `${id_ce}.46`;\nlet FreshestCRL = FreshestCRL_1 = class FreshestCRL extends CRLDistributionPoints {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, FreshestCRL_1.prototype);\n }\n};\nFreshestCRL = FreshestCRL_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: DistributionPoint })\n], FreshestCRL);\nexport { FreshestCRL };\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { DistributionPointName, Reason } from \"./crl_distribution_points\";\nimport { id_ce } from \"../object_identifiers\";\nimport { AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport const id_ce_issuingDistributionPoint = `${id_ce}.28`;\nexport class IssuingDistributionPoint {\n constructor(params = {}) {\n this.onlyContainsUserCerts = IssuingDistributionPoint.ONLY;\n this.onlyContainsCACerts = IssuingDistributionPoint.ONLY;\n this.indirectCRL = IssuingDistributionPoint.ONLY;\n this.onlyContainsAttributeCerts = IssuingDistributionPoint.ONLY;\n Object.assign(this, params);\n }\n}\nIssuingDistributionPoint.ONLY = false;\n__decorate([\n AsnProp({ type: DistributionPointName, context: 0, optional: true })\n], IssuingDistributionPoint.prototype, \"distributionPoint\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Boolean,\n context: 1,\n defaultValue: IssuingDistributionPoint.ONLY,\n implicit: true,\n })\n], IssuingDistributionPoint.prototype, \"onlyContainsUserCerts\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Boolean,\n context: 2,\n defaultValue: IssuingDistributionPoint.ONLY,\n implicit: true,\n })\n], IssuingDistributionPoint.prototype, \"onlyContainsCACerts\", void 0);\n__decorate([\n AsnProp({ type: Reason, context: 3, optional: true, implicit: true })\n], IssuingDistributionPoint.prototype, \"onlySomeReasons\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Boolean,\n context: 4,\n defaultValue: IssuingDistributionPoint.ONLY,\n implicit: true,\n })\n], IssuingDistributionPoint.prototype, \"indirectCRL\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Boolean,\n context: 5,\n defaultValue: IssuingDistributionPoint.ONLY,\n implicit: true,\n })\n], IssuingDistributionPoint.prototype, \"onlyContainsAttributeCerts\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_cRLReasons = `${id_ce}.21`;\nexport var CRLReasons;\n(function (CRLReasons) {\n CRLReasons[CRLReasons[\"unspecified\"] = 0] = \"unspecified\";\n CRLReasons[CRLReasons[\"keyCompromise\"] = 1] = \"keyCompromise\";\n CRLReasons[CRLReasons[\"cACompromise\"] = 2] = \"cACompromise\";\n CRLReasons[CRLReasons[\"affiliationChanged\"] = 3] = \"affiliationChanged\";\n CRLReasons[CRLReasons[\"superseded\"] = 4] = \"superseded\";\n CRLReasons[CRLReasons[\"cessationOfOperation\"] = 5] = \"cessationOfOperation\";\n CRLReasons[CRLReasons[\"certificateHold\"] = 6] = \"certificateHold\";\n CRLReasons[CRLReasons[\"removeFromCRL\"] = 8] = \"removeFromCRL\";\n CRLReasons[CRLReasons[\"privilegeWithdrawn\"] = 9] = \"privilegeWithdrawn\";\n CRLReasons[CRLReasons[\"aACompromise\"] = 10] = \"aACompromise\";\n})(CRLReasons || (CRLReasons = {}));\nlet CRLReason = class CRLReason {\n constructor(reason = CRLReasons.unspecified) {\n this.reason = CRLReasons.unspecified;\n this.reason = reason;\n }\n toJSON() {\n return CRLReasons[this.reason];\n }\n toString() {\n return this.toJSON();\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.Enumerated })\n], CRLReason.prototype, \"reason\", void 0);\nCRLReason = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], CRLReason);\nexport { CRLReason };\n","var ExtendedKeyUsage_1;\nimport { __decorate } from \"tslib\";\nimport { AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce, id_kp } from \"../object_identifiers\";\nexport const id_ce_extKeyUsage = `${id_ce}.37`;\nlet ExtendedKeyUsage = ExtendedKeyUsage_1 = class ExtendedKeyUsage extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, ExtendedKeyUsage_1.prototype);\n }\n};\nExtendedKeyUsage = ExtendedKeyUsage_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: AsnPropTypes.ObjectIdentifier })\n], ExtendedKeyUsage);\nexport { ExtendedKeyUsage };\nexport const anyExtendedKeyUsage = `${id_ce_extKeyUsage}.0`;\nexport const id_kp_serverAuth = `${id_kp}.1`;\nexport const id_kp_clientAuth = `${id_kp}.2`;\nexport const id_kp_codeSigning = `${id_kp}.3`;\nexport const id_kp_emailProtection = `${id_kp}.4`;\nexport const id_kp_timeStamping = `${id_kp}.8`;\nexport const id_kp_OCSPSigning = `${id_kp}.9`;\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnIntegerArrayBufferConverter, } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_inhibitAnyPolicy = `${id_ce}.54`;\nlet InhibitAnyPolicy = class InhibitAnyPolicy {\n constructor(value = new ArrayBuffer(0)) {\n this.value = value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], InhibitAnyPolicy.prototype, \"value\", void 0);\nInhibitAnyPolicy = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], InhibitAnyPolicy);\nexport { InhibitAnyPolicy };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_invalidityDate = `${id_ce}.24`;\nlet InvalidityDate = class InvalidityDate {\n constructor(value) {\n this.value = new Date();\n if (value) {\n this.value = value;\n }\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime })\n], InvalidityDate.prototype, \"value\", void 0);\nInvalidityDate = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], InvalidityDate);\nexport { InvalidityDate };\n","var IssueAlternativeName_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"../general_names\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_issuerAltName = `${id_ce}.18`;\nlet IssueAlternativeName = IssueAlternativeName_1 = class IssueAlternativeName extends GeneralNames {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, IssueAlternativeName_1.prototype);\n }\n};\nIssueAlternativeName = IssueAlternativeName_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], IssueAlternativeName);\nexport { IssueAlternativeName };\n","import { BitString } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_keyUsage = `${id_ce}.15`;\nexport var KeyUsageFlags;\n(function (KeyUsageFlags) {\n KeyUsageFlags[KeyUsageFlags[\"digitalSignature\"] = 1] = \"digitalSignature\";\n KeyUsageFlags[KeyUsageFlags[\"nonRepudiation\"] = 2] = \"nonRepudiation\";\n KeyUsageFlags[KeyUsageFlags[\"keyEncipherment\"] = 4] = \"keyEncipherment\";\n KeyUsageFlags[KeyUsageFlags[\"dataEncipherment\"] = 8] = \"dataEncipherment\";\n KeyUsageFlags[KeyUsageFlags[\"keyAgreement\"] = 16] = \"keyAgreement\";\n KeyUsageFlags[KeyUsageFlags[\"keyCertSign\"] = 32] = \"keyCertSign\";\n KeyUsageFlags[KeyUsageFlags[\"cRLSign\"] = 64] = \"cRLSign\";\n KeyUsageFlags[KeyUsageFlags[\"encipherOnly\"] = 128] = \"encipherOnly\";\n KeyUsageFlags[KeyUsageFlags[\"decipherOnly\"] = 256] = \"decipherOnly\";\n})(KeyUsageFlags || (KeyUsageFlags = {}));\nexport class KeyUsage extends BitString {\n toJSON() {\n const flag = this.toNumber();\n const res = [];\n if (flag & KeyUsageFlags.cRLSign) {\n res.push(\"crlSign\");\n }\n if (flag & KeyUsageFlags.dataEncipherment) {\n res.push(\"dataEncipherment\");\n }\n if (flag & KeyUsageFlags.decipherOnly) {\n res.push(\"decipherOnly\");\n }\n if (flag & KeyUsageFlags.digitalSignature) {\n res.push(\"digitalSignature\");\n }\n if (flag & KeyUsageFlags.encipherOnly) {\n res.push(\"encipherOnly\");\n }\n if (flag & KeyUsageFlags.keyAgreement) {\n res.push(\"keyAgreement\");\n }\n if (flag & KeyUsageFlags.keyCertSign) {\n res.push(\"keyCertSign\");\n }\n if (flag & KeyUsageFlags.keyEncipherment) {\n res.push(\"keyEncipherment\");\n }\n if (flag & KeyUsageFlags.nonRepudiation) {\n res.push(\"nonRepudiation\");\n }\n return res;\n }\n toString() {\n return `[${this.toJSON().join(\", \")}]`;\n }\n}\n","var GeneralSubtrees_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"../general_name\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_nameConstraints = `${id_ce}.30`;\nexport class GeneralSubtree {\n constructor(params = {}) {\n this.base = new GeneralName();\n this.minimum = 0;\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralName })\n], GeneralSubtree.prototype, \"base\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, context: 0, defaultValue: 0, implicit: true })\n], GeneralSubtree.prototype, \"minimum\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, context: 1, optional: true, implicit: true })\n], GeneralSubtree.prototype, \"maximum\", void 0);\nlet GeneralSubtrees = GeneralSubtrees_1 = class GeneralSubtrees extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, GeneralSubtrees_1.prototype);\n }\n};\nGeneralSubtrees = GeneralSubtrees_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: GeneralSubtree })\n], GeneralSubtrees);\nexport { GeneralSubtrees };\nexport class NameConstraints {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralSubtrees, context: 0, optional: true, implicit: true })\n], NameConstraints.prototype, \"permittedSubtrees\", void 0);\n__decorate([\n AsnProp({ type: GeneralSubtrees, context: 1, optional: true, implicit: true })\n], NameConstraints.prototype, \"excludedSubtrees\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_policyConstraints = `${id_ce}.36`;\nexport class PolicyConstraints {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({\n type: AsnPropTypes.Integer,\n context: 0,\n implicit: true,\n optional: true,\n converter: AsnIntegerArrayBufferConverter,\n })\n], PolicyConstraints.prototype, \"requireExplicitPolicy\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Integer,\n context: 1,\n implicit: true,\n optional: true,\n converter: AsnIntegerArrayBufferConverter,\n })\n], PolicyConstraints.prototype, \"inhibitPolicyMapping\", void 0);\n","var PolicyMappings_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_policyMappings = `${id_ce}.33`;\nexport class PolicyMapping {\n constructor(params = {}) {\n this.issuerDomainPolicy = \"\";\n this.subjectDomainPolicy = \"\";\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], PolicyMapping.prototype, \"issuerDomainPolicy\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], PolicyMapping.prototype, \"subjectDomainPolicy\", void 0);\nlet PolicyMappings = PolicyMappings_1 = class PolicyMappings extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, PolicyMappings_1.prototype);\n }\n};\nPolicyMappings = PolicyMappings_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: PolicyMapping })\n], PolicyMappings);\nexport { PolicyMappings };\n","var SubjectAlternativeName_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"../general_names\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_subjectAltName = `${id_ce}.17`;\nlet SubjectAlternativeName = SubjectAlternativeName_1 = class SubjectAlternativeName extends GeneralNames {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SubjectAlternativeName_1.prototype);\n }\n};\nSubjectAlternativeName = SubjectAlternativeName_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], SubjectAlternativeName);\nexport { SubjectAlternativeName };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class Attribute {\n constructor(params = {}) {\n this.type = \"\";\n this.values = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], Attribute.prototype, \"type\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, repeated: \"set\" })\n], Attribute.prototype, \"values\", void 0);\n","var SubjectDirectoryAttributes_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { Attribute } from \"../attribute\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_subjectDirectoryAttributes = `${id_ce}.9`;\nlet SubjectDirectoryAttributes = SubjectDirectoryAttributes_1 = class SubjectDirectoryAttributes extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SubjectDirectoryAttributes_1.prototype);\n }\n};\nSubjectDirectoryAttributes = SubjectDirectoryAttributes_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Attribute })\n], SubjectDirectoryAttributes);\nexport { SubjectDirectoryAttributes };\n","import { id_ce } from \"../object_identifiers\";\nimport { KeyIdentifier } from \"./authority_key_identifier\";\nexport const id_ce_subjectKeyIdentifier = `${id_ce}.14`;\nexport class SubjectKeyIdentifier extends KeyIdentifier {\n}\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { id_ce } from \"../object_identifiers\";\nexport const id_ce_privateKeyUsagePeriod = `${id_ce}.16`;\nexport class PrivateKeyUsagePeriod {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime, context: 0, implicit: true, optional: true })\n], PrivateKeyUsagePeriod.prototype, \"notBefore\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true })\n], PrivateKeyUsagePeriod.prototype, \"notAfter\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, BitString } from \"@peculiar/asn1-schema\";\nexport const id_entrust_entrustVersInfo = \"1.2.840.113533.7.65.0\";\nexport var EntrustInfoFlags;\n(function (EntrustInfoFlags) {\n EntrustInfoFlags[EntrustInfoFlags[\"keyUpdateAllowed\"] = 1] = \"keyUpdateAllowed\";\n EntrustInfoFlags[EntrustInfoFlags[\"newExtensions\"] = 2] = \"newExtensions\";\n EntrustInfoFlags[EntrustInfoFlags[\"pKIXCertificate\"] = 4] = \"pKIXCertificate\";\n})(EntrustInfoFlags || (EntrustInfoFlags = {}));\nexport class EntrustInfo extends BitString {\n toJSON() {\n const res = [];\n const flags = this.toNumber();\n if (flags & EntrustInfoFlags.pKIXCertificate) {\n res.push(\"pKIXCertificate\");\n }\n if (flags & EntrustInfoFlags.newExtensions) {\n res.push(\"newExtensions\");\n }\n if (flags & EntrustInfoFlags.keyUpdateAllowed) {\n res.push(\"keyUpdateAllowed\");\n }\n return res;\n }\n toString() {\n return `[${this.toJSON().join(\", \")}]`;\n }\n}\nexport class EntrustVersionInfo {\n constructor(params = {}) {\n this.entrustVers = \"\";\n this.entrustInfoFlags = new EntrustInfo();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralString })\n], EntrustVersionInfo.prototype, \"entrustVers\", void 0);\n__decorate([\n AsnProp({ type: EntrustInfo })\n], EntrustVersionInfo.prototype, \"entrustInfoFlags\", void 0);\n","var SubjectInfoAccessSyntax_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { id_pe } from \"../object_identifiers\";\nimport { AccessDescription } from \"./authority_information_access\";\nexport const id_pe_subjectInfoAccess = `${id_pe}.11`;\nlet SubjectInfoAccessSyntax = SubjectInfoAccessSyntax_1 = class SubjectInfoAccessSyntax extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SubjectInfoAccessSyntax_1.prototype);\n }\n};\nSubjectInfoAccessSyntax = SubjectInfoAccessSyntax_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: AccessDescription })\n], SubjectInfoAccessSyntax);\nexport { SubjectInfoAccessSyntax };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport * as pvtsutils from \"pvtsutils\";\nexport class AlgorithmIdentifier {\n constructor(params = {}) {\n this.algorithm = \"\";\n Object.assign(this, params);\n }\n isEqual(data) {\n return (data instanceof AlgorithmIdentifier &&\n data.algorithm == this.algorithm &&\n ((data.parameters &&\n this.parameters &&\n pvtsutils.isEqual(data.parameters, this.parameters)) ||\n data.parameters === this.parameters));\n }\n}\n__decorate([\n AsnProp({\n type: AsnPropTypes.ObjectIdentifier,\n })\n], AlgorithmIdentifier.prototype, \"algorithm\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Any,\n optional: true,\n })\n], AlgorithmIdentifier.prototype, \"parameters\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"./algorithm_identifier\";\nexport class SubjectPublicKeyInfo {\n constructor(params = {}) {\n this.algorithm = new AlgorithmIdentifier();\n this.subjectPublicKey = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], SubjectPublicKeyInfo.prototype, \"algorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], SubjectPublicKeyInfo.prototype, \"subjectPublicKey\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nlet Time = class Time {\n constructor(time) {\n if (time) {\n if (typeof time === \"string\" || typeof time === \"number\" || time instanceof Date) {\n const date = new Date(time);\n if (date.getUTCFullYear() > 2049) {\n this.generalTime = date;\n }\n else {\n this.utcTime = date;\n }\n }\n else {\n Object.assign(this, time);\n }\n }\n }\n getTime() {\n const time = this.utcTime || this.generalTime;\n if (!time) {\n throw new Error(\"Cannot get time from CHOICE object\");\n }\n return time;\n }\n};\n__decorate([\n AsnProp({\n type: AsnPropTypes.UTCTime,\n })\n], Time.prototype, \"utcTime\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.GeneralizedTime,\n })\n], Time.prototype, \"generalTime\", void 0);\nTime = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], Time);\nexport { Time };\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { Time } from \"./time\";\nexport class Validity {\n constructor(params) {\n this.notBefore = new Time(new Date());\n this.notAfter = new Time(new Date());\n if (params) {\n this.notBefore = new Time(params.notBefore);\n this.notAfter = new Time(params.notAfter);\n }\n }\n}\n__decorate([\n AsnProp({ type: Time })\n], Validity.prototype, \"notBefore\", void 0);\n__decorate([\n AsnProp({ type: Time })\n], Validity.prototype, \"notAfter\", void 0);\n","var Extensions_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from \"@peculiar/asn1-schema\";\nexport class Extension {\n constructor(params = {}) {\n this.extnID = \"\";\n this.critical = Extension.CRITICAL;\n this.extnValue = new OctetString();\n Object.assign(this, params);\n }\n}\nExtension.CRITICAL = false;\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], Extension.prototype, \"extnID\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Boolean,\n defaultValue: Extension.CRITICAL,\n })\n], Extension.prototype, \"critical\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], Extension.prototype, \"extnValue\", void 0);\nlet Extensions = Extensions_1 = class Extensions extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, Extensions_1.prototype);\n }\n};\nExtensions = Extensions_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Extension })\n], Extensions);\nexport { Extensions };\n","export var Version;\n(function (Version) {\n Version[Version[\"v1\"] = 0] = \"v1\";\n Version[Version[\"v2\"] = 1] = \"v2\";\n Version[Version[\"v3\"] = 2] = \"v3\";\n})(Version || (Version = {}));\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"./algorithm_identifier\";\nimport { Name } from \"./name\";\nimport { SubjectPublicKeyInfo } from \"./subject_public_key_info\";\nimport { Validity } from \"./validity\";\nimport { Extensions } from \"./extension\";\nimport { Version } from \"./types\";\nexport class TBSCertificate {\n constructor(params = {}) {\n this.version = Version.v1;\n this.serialNumber = new ArrayBuffer(0);\n this.signature = new AlgorithmIdentifier();\n this.issuer = new Name();\n this.validity = new Validity();\n this.subject = new Name();\n this.subjectPublicKeyInfo = new SubjectPublicKeyInfo();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({\n type: AsnPropTypes.Integer,\n context: 0,\n defaultValue: Version.v1,\n })\n], TBSCertificate.prototype, \"version\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.Integer,\n converter: AsnIntegerArrayBufferConverter,\n })\n], TBSCertificate.prototype, \"serialNumber\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], TBSCertificate.prototype, \"signature\", void 0);\n__decorate([\n AsnProp({ type: Name })\n], TBSCertificate.prototype, \"issuer\", void 0);\n__decorate([\n AsnProp({ type: Validity })\n], TBSCertificate.prototype, \"validity\", void 0);\n__decorate([\n AsnProp({ type: Name })\n], TBSCertificate.prototype, \"subject\", void 0);\n__decorate([\n AsnProp({ type: SubjectPublicKeyInfo })\n], TBSCertificate.prototype, \"subjectPublicKeyInfo\", void 0);\n__decorate([\n AsnProp({\n type: AsnPropTypes.BitString,\n context: 1,\n implicit: true,\n optional: true,\n })\n], TBSCertificate.prototype, \"issuerUniqueID\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString, context: 2, implicit: true, optional: true })\n], TBSCertificate.prototype, \"subjectUniqueID\", void 0);\n__decorate([\n AsnProp({ type: Extensions, context: 3, optional: true })\n], TBSCertificate.prototype, \"extensions\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"./algorithm_identifier\";\nimport { TBSCertificate } from \"./tbs_certificate\";\nexport class Certificate {\n constructor(params = {}) {\n this.tbsCertificate = new TBSCertificate();\n this.signatureAlgorithm = new AlgorithmIdentifier();\n this.signatureValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: TBSCertificate, raw: true })\n], Certificate.prototype, \"tbsCertificate\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], Certificate.prototype, \"signatureAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], Certificate.prototype, \"signatureValue\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"./algorithm_identifier\";\nimport { Name } from \"./name\";\nimport { Time } from \"./time\";\nimport { Extension } from \"./extension\";\nexport class RevokedCertificate {\n constructor(params = {}) {\n this.userCertificate = new ArrayBuffer(0);\n this.revocationDate = new Time();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RevokedCertificate.prototype, \"userCertificate\", void 0);\n__decorate([\n AsnProp({ type: Time })\n], RevokedCertificate.prototype, \"revocationDate\", void 0);\n__decorate([\n AsnProp({ type: Extension, optional: true, repeated: \"sequence\" })\n], RevokedCertificate.prototype, \"crlEntryExtensions\", void 0);\nexport class TBSCertList {\n constructor(params = {}) {\n this.signature = new AlgorithmIdentifier();\n this.issuer = new Name();\n this.thisUpdate = new Time();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, optional: true })\n], TBSCertList.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], TBSCertList.prototype, \"signature\", void 0);\n__decorate([\n AsnProp({ type: Name })\n], TBSCertList.prototype, \"issuer\", void 0);\n__decorate([\n AsnProp({ type: Time })\n], TBSCertList.prototype, \"thisUpdate\", void 0);\n__decorate([\n AsnProp({ type: Time, optional: true })\n], TBSCertList.prototype, \"nextUpdate\", void 0);\n__decorate([\n AsnProp({ type: RevokedCertificate, repeated: \"sequence\", optional: true })\n], TBSCertList.prototype, \"revokedCertificates\", void 0);\n__decorate([\n AsnProp({ type: Extension, optional: true, context: 0, repeated: \"sequence\" })\n], TBSCertList.prototype, \"crlExtensions\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"./algorithm_identifier\";\nimport { TBSCertList } from \"./tbs_cert_list\";\nexport class CertificateList {\n constructor(params = {}) {\n this.tbsCertList = new TBSCertList();\n this.signatureAlgorithm = new AlgorithmIdentifier();\n this.signature = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: TBSCertList, raw: true })\n], CertificateList.prototype, \"tbsCertList\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], CertificateList.prototype, \"signatureAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], CertificateList.prototype, \"signature\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { Name } from \"@peculiar/asn1-x509\";\nexport class IssuerAndSerialNumber {\n constructor(params = {}) {\n this.issuer = new Name();\n this.serialNumber = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: Name })\n], IssuerAndSerialNumber.prototype, \"issuer\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], IssuerAndSerialNumber.prototype, \"serialNumber\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { IssuerAndSerialNumber } from \"./issuer_and_serial_number\";\nimport { SubjectKeyIdentifier } from \"@peculiar/asn1-x509\";\nlet SignerIdentifier = class SignerIdentifier {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true })\n], SignerIdentifier.prototype, \"subjectKeyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: IssuerAndSerialNumber })\n], SignerIdentifier.prototype, \"issuerAndSerialNumber\", void 0);\nSignerIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], SignerIdentifier);\nexport { SignerIdentifier };\n","import { __decorate } from \"tslib\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport { AsnTypeTypes, AsnType } from \"@peculiar/asn1-schema\";\nexport var CMSVersion;\n(function (CMSVersion) {\n CMSVersion[CMSVersion[\"v0\"] = 0] = \"v0\";\n CMSVersion[CMSVersion[\"v1\"] = 1] = \"v1\";\n CMSVersion[CMSVersion[\"v2\"] = 2] = \"v2\";\n CMSVersion[CMSVersion[\"v3\"] = 3] = \"v3\";\n CMSVersion[CMSVersion[\"v4\"] = 4] = \"v4\";\n CMSVersion[CMSVersion[\"v5\"] = 5] = \"v5\";\n})(CMSVersion || (CMSVersion = {}));\nlet DigestAlgorithmIdentifier = class DigestAlgorithmIdentifier extends AlgorithmIdentifier {\n};\nDigestAlgorithmIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], DigestAlgorithmIdentifier);\nexport { DigestAlgorithmIdentifier };\nlet SignatureAlgorithmIdentifier = class SignatureAlgorithmIdentifier extends AlgorithmIdentifier {\n};\nSignatureAlgorithmIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], SignatureAlgorithmIdentifier);\nexport { SignatureAlgorithmIdentifier };\nlet KeyEncryptionAlgorithmIdentifier = class KeyEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {\n};\nKeyEncryptionAlgorithmIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], KeyEncryptionAlgorithmIdentifier);\nexport { KeyEncryptionAlgorithmIdentifier };\nlet ContentEncryptionAlgorithmIdentifier = class ContentEncryptionAlgorithmIdentifier extends AlgorithmIdentifier {\n};\nContentEncryptionAlgorithmIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], ContentEncryptionAlgorithmIdentifier);\nexport { ContentEncryptionAlgorithmIdentifier };\nlet MessageAuthenticationCodeAlgorithm = class MessageAuthenticationCodeAlgorithm extends AlgorithmIdentifier {\n};\nMessageAuthenticationCodeAlgorithm = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], MessageAuthenticationCodeAlgorithm);\nexport { MessageAuthenticationCodeAlgorithm };\nlet KeyDerivationAlgorithmIdentifier = class KeyDerivationAlgorithmIdentifier extends AlgorithmIdentifier {\n};\nKeyDerivationAlgorithmIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], KeyDerivationAlgorithmIdentifier);\nexport { KeyDerivationAlgorithmIdentifier };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class Attribute {\n constructor(params = {}) {\n this.attrType = \"\";\n this.attrValues = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], Attribute.prototype, \"attrType\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, repeated: \"set\" })\n], Attribute.prototype, \"attrValues\", void 0);\n","var SignerInfos_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from \"@peculiar/asn1-schema\";\nimport { SignerIdentifier } from \"./signer_identifier\";\nimport { CMSVersion, SignatureAlgorithmIdentifier, DigestAlgorithmIdentifier } from \"./types\";\nimport { Attribute } from \"./attribute\";\nexport class SignerInfo {\n constructor(params = {}) {\n this.version = CMSVersion.v0;\n this.sid = new SignerIdentifier();\n this.digestAlgorithm = new DigestAlgorithmIdentifier();\n this.signatureAlgorithm = new SignatureAlgorithmIdentifier();\n this.signature = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], SignerInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: SignerIdentifier })\n], SignerInfo.prototype, \"sid\", void 0);\n__decorate([\n AsnProp({ type: DigestAlgorithmIdentifier })\n], SignerInfo.prototype, \"digestAlgorithm\", void 0);\n__decorate([\n AsnProp({\n type: Attribute,\n repeated: \"set\",\n context: 0,\n implicit: true,\n optional: true,\n raw: true,\n })\n], SignerInfo.prototype, \"signedAttrs\", void 0);\n__decorate([\n AsnProp({ type: SignatureAlgorithmIdentifier })\n], SignerInfo.prototype, \"signatureAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], SignerInfo.prototype, \"signature\", void 0);\n__decorate([\n AsnProp({ type: Attribute, repeated: \"set\", context: 1, implicit: true, optional: true })\n], SignerInfo.prototype, \"unsignedAttrs\", void 0);\nlet SignerInfos = SignerInfos_1 = class SignerInfos extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SignerInfos_1.prototype);\n }\n};\nSignerInfos = SignerInfos_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: SignerInfo })\n], SignerInfos);\nexport { SignerInfos };\n","import { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { SignerInfo } from \"../signer_info\";\nexport const id_counterSignature = \"1.2.840.113549.1.9.6\";\nlet CounterSignature = class CounterSignature extends SignerInfo {\n};\nCounterSignature = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], CounterSignature);\nexport { CounterSignature };\n","import { __decorate } from \"tslib\";\nimport { Time } from \"@peculiar/asn1-x509\";\nimport { AsnTypeTypes, AsnType } from \"@peculiar/asn1-schema\";\nexport const id_signingTime = \"1.2.840.113549.1.9.5\";\nlet SigningTime = class SigningTime extends Time {\n};\nSigningTime = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], SigningTime);\nexport { SigningTime };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralName, Attribute } from \"@peculiar/asn1-x509\";\nexport class ACClearAttrs {\n constructor(params = {}) {\n this.acIssuer = new GeneralName();\n this.acSerial = 0;\n this.attrs = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralName })\n], ACClearAttrs.prototype, \"acIssuer\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], ACClearAttrs.prototype, \"acSerial\", void 0);\n__decorate([\n AsnProp({ type: Attribute, repeated: \"sequence\" })\n], ACClearAttrs.prototype, \"attrs\", void 0);\n","var AttrSpec_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnPropTypes, AsnArray } from \"@peculiar/asn1-schema\";\nlet AttrSpec = AttrSpec_1 = class AttrSpec extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, AttrSpec_1.prototype);\n }\n};\nAttrSpec = AttrSpec_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: AsnPropTypes.ObjectIdentifier })\n], AttrSpec);\nexport { AttrSpec };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AttrSpec } from \"./attr_spec\";\nexport class AAControls {\n constructor(params = {}) {\n this.permitUnSpecified = true;\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, optional: true })\n], AAControls.prototype, \"pathLenConstraint\", void 0);\n__decorate([\n AsnProp({ type: AttrSpec, implicit: true, context: 0, optional: true })\n], AAControls.prototype, \"permittedAttrs\", void 0);\n__decorate([\n AsnProp({ type: AttrSpec, implicit: true, context: 1, optional: true })\n], AAControls.prototype, \"excludedAttrs\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Boolean, defaultValue: true })\n], AAControls.prototype, \"permitUnSpecified\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"@peculiar/asn1-x509\";\nexport class IssuerSerial {\n constructor(params = {}) {\n this.issuer = new GeneralNames();\n this.serial = new ArrayBuffer(0);\n this.issuerUID = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralNames })\n], IssuerSerial.prototype, \"issuer\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], IssuerSerial.prototype, \"serial\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString, optional: true })\n], IssuerSerial.prototype, \"issuerUID\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nexport var DigestedObjectType;\n(function (DigestedObjectType) {\n DigestedObjectType[DigestedObjectType[\"publicKey\"] = 0] = \"publicKey\";\n DigestedObjectType[DigestedObjectType[\"publicKeyCert\"] = 1] = \"publicKeyCert\";\n DigestedObjectType[DigestedObjectType[\"otherObjectTypes\"] = 2] = \"otherObjectTypes\";\n})(DigestedObjectType || (DigestedObjectType = {}));\nexport class ObjectDigestInfo {\n constructor(params = {}) {\n this.digestedObjectType = DigestedObjectType.publicKey;\n this.digestAlgorithm = new AlgorithmIdentifier();\n this.objectDigest = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Enumerated })\n], ObjectDigestInfo.prototype, \"digestedObjectType\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier, optional: true })\n], ObjectDigestInfo.prototype, \"otherObjectTypeID\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], ObjectDigestInfo.prototype, \"digestAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], ObjectDigestInfo.prototype, \"objectDigest\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"@peculiar/asn1-x509\";\nimport { IssuerSerial } from \"./issuer_serial\";\nimport { ObjectDigestInfo } from \"./object_digest_info\";\nexport class V2Form {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralNames, optional: true })\n], V2Form.prototype, \"issuerName\", void 0);\n__decorate([\n AsnProp({ type: IssuerSerial, context: 0, implicit: true, optional: true })\n], V2Form.prototype, \"baseCertificateID\", void 0);\n__decorate([\n AsnProp({ type: ObjectDigestInfo, context: 1, implicit: true, optional: true })\n], V2Form.prototype, \"objectDigestInfo\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnProp } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"@peculiar/asn1-x509\";\nimport { V2Form } from \"./v2_form\";\nlet AttCertIssuer = class AttCertIssuer {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: GeneralName, repeated: \"sequence\" })\n], AttCertIssuer.prototype, \"v1Form\", void 0);\n__decorate([\n AsnProp({ type: V2Form, context: 0, implicit: true })\n], AttCertIssuer.prototype, \"v2Form\", void 0);\nAttCertIssuer = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], AttCertIssuer);\nexport { AttCertIssuer };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class AttCertValidityPeriod {\n constructor(params = {}) {\n this.notBeforeTime = new Date();\n this.notAfterTime = new Date();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime })\n], AttCertValidityPeriod.prototype, \"notBeforeTime\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime })\n], AttCertValidityPeriod.prototype, \"notAfterTime\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { IssuerSerial } from \"./issuer_serial\";\nimport { GeneralNames } from \"@peculiar/asn1-x509\";\nimport { ObjectDigestInfo } from \"./object_digest_info\";\nexport class Holder {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: IssuerSerial, implicit: true, context: 0, optional: true })\n], Holder.prototype, \"baseCertificateID\", void 0);\n__decorate([\n AsnProp({ type: GeneralNames, implicit: true, context: 1, optional: true })\n], Holder.prototype, \"entityName\", void 0);\n__decorate([\n AsnProp({ type: ObjectDigestInfo, implicit: true, context: 2, optional: true })\n], Holder.prototype, \"objectDigestInfo\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier, Attribute, Extensions, } from \"@peculiar/asn1-x509\";\nimport { Holder } from \"./holder\";\nimport { AttCertIssuer } from \"./attr_cert_issuer\";\nimport { AttCertValidityPeriod } from \"./attr_cert_validity_period\";\nexport var AttCertVersion;\n(function (AttCertVersion) {\n AttCertVersion[AttCertVersion[\"v2\"] = 1] = \"v2\";\n})(AttCertVersion || (AttCertVersion = {}));\nexport class AttributeCertificateInfo {\n constructor(params = {}) {\n this.version = AttCertVersion.v2;\n this.holder = new Holder();\n this.issuer = new AttCertIssuer();\n this.signature = new AlgorithmIdentifier();\n this.serialNumber = new ArrayBuffer(0);\n this.attrCertValidityPeriod = new AttCertValidityPeriod();\n this.attributes = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], AttributeCertificateInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: Holder })\n], AttributeCertificateInfo.prototype, \"holder\", void 0);\n__decorate([\n AsnProp({ type: AttCertIssuer })\n], AttributeCertificateInfo.prototype, \"issuer\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], AttributeCertificateInfo.prototype, \"signature\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], AttributeCertificateInfo.prototype, \"serialNumber\", void 0);\n__decorate([\n AsnProp({ type: AttCertValidityPeriod })\n], AttributeCertificateInfo.prototype, \"attrCertValidityPeriod\", void 0);\n__decorate([\n AsnProp({ type: Attribute, repeated: \"sequence\" })\n], AttributeCertificateInfo.prototype, \"attributes\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString, optional: true })\n], AttributeCertificateInfo.prototype, \"issuerUniqueID\", void 0);\n__decorate([\n AsnProp({ type: Extensions, optional: true })\n], AttributeCertificateInfo.prototype, \"extensions\", void 0);\n","import { BitString } from \"@peculiar/asn1-schema\";\nexport var ClassListFlags;\n(function (ClassListFlags) {\n ClassListFlags[ClassListFlags[\"unmarked\"] = 1] = \"unmarked\";\n ClassListFlags[ClassListFlags[\"unclassified\"] = 2] = \"unclassified\";\n ClassListFlags[ClassListFlags[\"restricted\"] = 4] = \"restricted\";\n ClassListFlags[ClassListFlags[\"confidential\"] = 8] = \"confidential\";\n ClassListFlags[ClassListFlags[\"secret\"] = 16] = \"secret\";\n ClassListFlags[ClassListFlags[\"topSecret\"] = 32] = \"topSecret\";\n})(ClassListFlags || (ClassListFlags = {}));\nexport class ClassList extends BitString {\n}\n","var Targets_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnType, AsnTypeTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"@peculiar/asn1-x509\";\nimport { IssuerSerial } from \"./issuer_serial\";\nimport { ObjectDigestInfo } from \"./object_digest_info\";\nexport class TargetCert {\n constructor(params = {}) {\n this.targetCertificate = new IssuerSerial();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: IssuerSerial })\n], TargetCert.prototype, \"targetCertificate\", void 0);\n__decorate([\n AsnProp({ type: GeneralName, optional: true })\n], TargetCert.prototype, \"targetName\", void 0);\n__decorate([\n AsnProp({ type: ObjectDigestInfo, optional: true })\n], TargetCert.prototype, \"certDigestInfo\", void 0);\nlet Target = class Target {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: GeneralName, context: 0, implicit: true })\n], Target.prototype, \"targetName\", void 0);\n__decorate([\n AsnProp({ type: GeneralName, context: 1, implicit: true })\n], Target.prototype, \"targetGroup\", void 0);\n__decorate([\n AsnProp({ type: TargetCert, context: 2, implicit: true })\n], Target.prototype, \"targetCert\", void 0);\nTarget = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], Target);\nexport { Target };\nlet Targets = Targets_1 = class Targets extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, Targets_1.prototype);\n }\n};\nTargets = Targets_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Target })\n], Targets);\nexport { Targets };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport { AttributeCertificateInfo } from \"./attribute_certificate_info\";\nexport class AttributeCertificate {\n constructor(params = {}) {\n this.acinfo = new AttributeCertificateInfo();\n this.signatureAlgorithm = new AlgorithmIdentifier();\n this.signatureValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AttributeCertificateInfo })\n], AttributeCertificate.prototype, \"acinfo\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], AttributeCertificate.prototype, \"signatureAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], AttributeCertificate.prototype, \"signatureValue\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class SecurityCategory {\n constructor(params = {}) {\n this.type = \"\";\n this.value = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier, implicit: true, context: 0 })\n], SecurityCategory.prototype, \"type\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, implicit: true, context: 1 })\n], SecurityCategory.prototype, \"value\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { ClassList, ClassListFlags } from \"./class_list\";\nimport { SecurityCategory } from \"./security_category\";\nexport class Clearance {\n constructor(params = {}) {\n this.policyId = \"\";\n this.classList = new ClassList(ClassListFlags.unclassified);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], Clearance.prototype, \"policyId\", void 0);\n__decorate([\n AsnProp({ type: ClassList, defaultValue: new ClassList(ClassListFlags.unclassified) })\n], Clearance.prototype, \"classList\", void 0);\n__decorate([\n AsnProp({ type: SecurityCategory, repeated: \"set\" })\n], Clearance.prototype, \"securityCategories\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, OctetString, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { GeneralNames } from \"@peculiar/asn1-x509\";\nexport class IetfAttrSyntaxValueChoices {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: OctetString })\n], IetfAttrSyntaxValueChoices.prototype, \"cotets\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], IetfAttrSyntaxValueChoices.prototype, \"oid\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Utf8String })\n], IetfAttrSyntaxValueChoices.prototype, \"string\", void 0);\nexport class IetfAttrSyntax {\n constructor(params = {}) {\n this.values = [];\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralNames, implicit: true, context: 0, optional: true })\n], IetfAttrSyntax.prototype, \"policyAuthority\", void 0);\n__decorate([\n AsnProp({ type: IetfAttrSyntaxValueChoices, repeated: \"sequence\" })\n], IetfAttrSyntax.prototype, \"values\", void 0);\n","var ProxyInfo_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { Targets } from \"./target\";\nlet ProxyInfo = ProxyInfo_1 = class ProxyInfo extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, ProxyInfo_1.prototype);\n }\n};\nProxyInfo = ProxyInfo_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Targets })\n], ProxyInfo);\nexport { ProxyInfo };\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { GeneralNames, GeneralName } from \"@peculiar/asn1-x509\";\nexport class RoleSyntax {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralNames, implicit: true, context: 0, optional: true })\n], RoleSyntax.prototype, \"roleAuthority\", void 0);\n__decorate([\n AsnProp({ type: GeneralName, implicit: true, context: 1 })\n], RoleSyntax.prototype, \"roleName\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, OctetString } from \"@peculiar/asn1-schema\";\nimport { GeneralName } from \"@peculiar/asn1-x509\";\nexport class SvceAuthInfo {\n constructor(params = {}) {\n this.service = new GeneralName();\n this.ident = new GeneralName();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: GeneralName })\n], SvceAuthInfo.prototype, \"service\", void 0);\n__decorate([\n AsnProp({ type: GeneralName })\n], SvceAuthInfo.prototype, \"ident\", void 0);\n__decorate([\n AsnProp({ type: OctetString, optional: true })\n], SvceAuthInfo.prototype, \"authInfo\", void 0);\n","var CertificateSet_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { Certificate } from \"@peculiar/asn1-x509\";\nimport { AttributeCertificate } from \"@peculiar/asn1-x509-attr\";\nexport class OtherCertificateFormat {\n constructor(params = {}) {\n this.otherCertFormat = \"\";\n this.otherCert = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], OtherCertificateFormat.prototype, \"otherCertFormat\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], OtherCertificateFormat.prototype, \"otherCert\", void 0);\nlet CertificateChoices = class CertificateChoices {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: Certificate })\n], CertificateChoices.prototype, \"certificate\", void 0);\n__decorate([\n AsnProp({ type: AttributeCertificate, context: 2, implicit: true })\n], CertificateChoices.prototype, \"v2AttrCert\", void 0);\n__decorate([\n AsnProp({ type: OtherCertificateFormat, context: 3, implicit: true })\n], CertificateChoices.prototype, \"other\", void 0);\nCertificateChoices = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], CertificateChoices);\nexport { CertificateChoices };\nlet CertificateSet = CertificateSet_1 = class CertificateSet extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, CertificateSet_1.prototype);\n }\n};\nCertificateSet = CertificateSet_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: CertificateChoices })\n], CertificateSet);\nexport { CertificateSet };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class ContentInfo {\n constructor(params = {}) {\n this.contentType = \"\";\n this.content = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], ContentInfo.prototype, \"contentType\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], ContentInfo.prototype, \"content\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, OctetString } from \"@peculiar/asn1-schema\";\nlet EncapsulatedContent = class EncapsulatedContent {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: OctetString })\n], EncapsulatedContent.prototype, \"single\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], EncapsulatedContent.prototype, \"any\", void 0);\nEncapsulatedContent = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], EncapsulatedContent);\nexport { EncapsulatedContent };\nexport class EncapsulatedContentInfo {\n constructor(params = {}) {\n this.eContentType = \"\";\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], EncapsulatedContentInfo.prototype, \"eContentType\", void 0);\n__decorate([\n AsnProp({ type: EncapsulatedContent, context: 0, optional: true })\n], EncapsulatedContentInfo.prototype, \"eContent\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnConstructedOctetStringConverter, AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, OctetString, } from \"@peculiar/asn1-schema\";\nimport { ContentEncryptionAlgorithmIdentifier } from \"./types\";\nlet EncryptedContent = class EncryptedContent {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: OctetString, context: 0, implicit: true, optional: true })\n], EncryptedContent.prototype, \"value\", void 0);\n__decorate([\n AsnProp({\n type: OctetString,\n converter: AsnConstructedOctetStringConverter,\n context: 0,\n implicit: true,\n optional: true,\n repeated: \"sequence\",\n })\n], EncryptedContent.prototype, \"constructedValue\", void 0);\nEncryptedContent = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], EncryptedContent);\nexport { EncryptedContent };\nexport class EncryptedContentInfo {\n constructor(params = {}) {\n this.contentType = \"\";\n this.contentEncryptionAlgorithm = new ContentEncryptionAlgorithmIdentifier();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], EncryptedContentInfo.prototype, \"contentType\", void 0);\n__decorate([\n AsnProp({ type: ContentEncryptionAlgorithmIdentifier })\n], EncryptedContentInfo.prototype, \"contentEncryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: EncryptedContent, optional: true })\n], EncryptedContentInfo.prototype, \"encryptedContent\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class OtherKeyAttribute {\n constructor(params = {}) {\n this.keyAttrId = \"\";\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], OtherKeyAttribute.prototype, \"keyAttrId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, optional: true })\n], OtherKeyAttribute.prototype, \"keyAttr\", void 0);\n","var RecipientEncryptedKeys_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from \"@peculiar/asn1-schema\";\nimport { CMSVersion, KeyEncryptionAlgorithmIdentifier } from \"./types\";\nimport { IssuerAndSerialNumber } from \"./issuer_and_serial_number\";\nimport { AlgorithmIdentifier, SubjectKeyIdentifier } from \"@peculiar/asn1-x509\";\nimport { OtherKeyAttribute } from \"./other_key_attribute\";\nexport class RecipientKeyIdentifier {\n constructor(params = {}) {\n this.subjectKeyIdentifier = new SubjectKeyIdentifier();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: SubjectKeyIdentifier })\n], RecipientKeyIdentifier.prototype, \"subjectKeyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime, optional: true })\n], RecipientKeyIdentifier.prototype, \"date\", void 0);\n__decorate([\n AsnProp({ type: OtherKeyAttribute, optional: true })\n], RecipientKeyIdentifier.prototype, \"other\", void 0);\nlet KeyAgreeRecipientIdentifier = class KeyAgreeRecipientIdentifier {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: RecipientKeyIdentifier, context: 0, implicit: true, optional: true })\n], KeyAgreeRecipientIdentifier.prototype, \"rKeyId\", void 0);\n__decorate([\n AsnProp({ type: IssuerAndSerialNumber, optional: true })\n], KeyAgreeRecipientIdentifier.prototype, \"issuerAndSerialNumber\", void 0);\nKeyAgreeRecipientIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], KeyAgreeRecipientIdentifier);\nexport { KeyAgreeRecipientIdentifier };\nexport class RecipientEncryptedKey {\n constructor(params = {}) {\n this.rid = new KeyAgreeRecipientIdentifier();\n this.encryptedKey = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: KeyAgreeRecipientIdentifier })\n], RecipientEncryptedKey.prototype, \"rid\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], RecipientEncryptedKey.prototype, \"encryptedKey\", void 0);\nlet RecipientEncryptedKeys = RecipientEncryptedKeys_1 = class RecipientEncryptedKeys extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, RecipientEncryptedKeys_1.prototype);\n }\n};\nRecipientEncryptedKeys = RecipientEncryptedKeys_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: RecipientEncryptedKey })\n], RecipientEncryptedKeys);\nexport { RecipientEncryptedKeys };\nexport class OriginatorPublicKey {\n constructor(params = {}) {\n this.algorithm = new AlgorithmIdentifier();\n this.publicKey = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], OriginatorPublicKey.prototype, \"algorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], OriginatorPublicKey.prototype, \"publicKey\", void 0);\nlet OriginatorIdentifierOrKey = class OriginatorIdentifierOrKey {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true, optional: true })\n], OriginatorIdentifierOrKey.prototype, \"subjectKeyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: OriginatorPublicKey, context: 1, implicit: true, optional: true })\n], OriginatorIdentifierOrKey.prototype, \"originatorKey\", void 0);\n__decorate([\n AsnProp({ type: IssuerAndSerialNumber, optional: true })\n], OriginatorIdentifierOrKey.prototype, \"issuerAndSerialNumber\", void 0);\nOriginatorIdentifierOrKey = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], OriginatorIdentifierOrKey);\nexport { OriginatorIdentifierOrKey };\nexport class KeyAgreeRecipientInfo {\n constructor(params = {}) {\n this.version = CMSVersion.v3;\n this.originator = new OriginatorIdentifierOrKey();\n this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();\n this.recipientEncryptedKeys = new RecipientEncryptedKeys();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], KeyAgreeRecipientInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: OriginatorIdentifierOrKey, context: 0 })\n], KeyAgreeRecipientInfo.prototype, \"originator\", void 0);\n__decorate([\n AsnProp({ type: OctetString, context: 1, optional: true })\n], KeyAgreeRecipientInfo.prototype, \"ukm\", void 0);\n__decorate([\n AsnProp({ type: KeyEncryptionAlgorithmIdentifier })\n], KeyAgreeRecipientInfo.prototype, \"keyEncryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: RecipientEncryptedKeys })\n], KeyAgreeRecipientInfo.prototype, \"recipientEncryptedKeys\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, OctetString } from \"@peculiar/asn1-schema\";\nimport { CMSVersion, KeyEncryptionAlgorithmIdentifier } from \"./types\";\nimport { IssuerAndSerialNumber } from \"./issuer_and_serial_number\";\nimport { SubjectKeyIdentifier } from \"@peculiar/asn1-x509\";\nlet RecipientIdentifier = class RecipientIdentifier {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: SubjectKeyIdentifier, context: 0, implicit: true })\n], RecipientIdentifier.prototype, \"subjectKeyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: IssuerAndSerialNumber })\n], RecipientIdentifier.prototype, \"issuerAndSerialNumber\", void 0);\nRecipientIdentifier = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], RecipientIdentifier);\nexport { RecipientIdentifier };\nexport class KeyTransRecipientInfo {\n constructor(params = {}) {\n this.version = CMSVersion.v0;\n this.rid = new RecipientIdentifier();\n this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();\n this.encryptedKey = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], KeyTransRecipientInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: RecipientIdentifier })\n], KeyTransRecipientInfo.prototype, \"rid\", void 0);\n__decorate([\n AsnProp({ type: KeyEncryptionAlgorithmIdentifier })\n], KeyTransRecipientInfo.prototype, \"keyEncryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], KeyTransRecipientInfo.prototype, \"encryptedKey\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, OctetString } from \"@peculiar/asn1-schema\";\nimport { OtherKeyAttribute } from \"./other_key_attribute\";\nimport { CMSVersion, KeyEncryptionAlgorithmIdentifier } from \"./types\";\nexport class KEKIdentifier {\n constructor(params = {}) {\n this.keyIdentifier = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: OctetString })\n], KEKIdentifier.prototype, \"keyIdentifier\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime, optional: true })\n], KEKIdentifier.prototype, \"date\", void 0);\n__decorate([\n AsnProp({ type: OtherKeyAttribute, optional: true })\n], KEKIdentifier.prototype, \"other\", void 0);\nexport class KEKRecipientInfo {\n constructor(params = {}) {\n this.version = CMSVersion.v4;\n this.kekid = new KEKIdentifier();\n this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();\n this.encryptedKey = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], KEKRecipientInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: KEKIdentifier })\n], KEKRecipientInfo.prototype, \"kekid\", void 0);\n__decorate([\n AsnProp({ type: KeyEncryptionAlgorithmIdentifier })\n], KEKRecipientInfo.prototype, \"keyEncryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], KEKRecipientInfo.prototype, \"encryptedKey\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, OctetString } from \"@peculiar/asn1-schema\";\nimport { CMSVersion, KeyDerivationAlgorithmIdentifier, KeyEncryptionAlgorithmIdentifier, } from \"./types\";\nexport class PasswordRecipientInfo {\n constructor(params = {}) {\n this.version = CMSVersion.v0;\n this.keyEncryptionAlgorithm = new KeyEncryptionAlgorithmIdentifier();\n this.encryptedKey = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], PasswordRecipientInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: KeyDerivationAlgorithmIdentifier, context: 0, optional: true })\n], PasswordRecipientInfo.prototype, \"keyDerivationAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: KeyEncryptionAlgorithmIdentifier })\n], PasswordRecipientInfo.prototype, \"keyEncryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], PasswordRecipientInfo.prototype, \"encryptedKey\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { KeyAgreeRecipientInfo } from \"./key_agree_recipient_info\";\nimport { KeyTransRecipientInfo } from \"./key_trans_recipient_info\";\nimport { KEKRecipientInfo } from \"./kek_recipient_info\";\nimport { PasswordRecipientInfo } from \"./password_recipient_info\";\nexport class OtherRecipientInfo {\n constructor(params = {}) {\n this.oriType = \"\";\n this.oriValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], OtherRecipientInfo.prototype, \"oriType\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], OtherRecipientInfo.prototype, \"oriValue\", void 0);\nlet RecipientInfo = class RecipientInfo {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: KeyTransRecipientInfo, optional: true })\n], RecipientInfo.prototype, \"ktri\", void 0);\n__decorate([\n AsnProp({ type: KeyAgreeRecipientInfo, context: 1, implicit: true, optional: true })\n], RecipientInfo.prototype, \"kari\", void 0);\n__decorate([\n AsnProp({ type: KEKRecipientInfo, context: 2, implicit: true, optional: true })\n], RecipientInfo.prototype, \"kekri\", void 0);\n__decorate([\n AsnProp({ type: PasswordRecipientInfo, context: 3, implicit: true, optional: true })\n], RecipientInfo.prototype, \"pwri\", void 0);\n__decorate([\n AsnProp({ type: OtherRecipientInfo, context: 4, implicit: true, optional: true })\n], RecipientInfo.prototype, \"ori\", void 0);\nRecipientInfo = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], RecipientInfo);\nexport { RecipientInfo };\n","var RecipientInfos_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { RecipientInfo } from \"./recipient_info\";\nlet RecipientInfos = RecipientInfos_1 = class RecipientInfos extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, RecipientInfos_1.prototype);\n }\n};\nRecipientInfos = RecipientInfos_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: RecipientInfo })\n], RecipientInfos);\nexport { RecipientInfos };\n","var RevocationInfoChoices_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnType, AsnTypeTypes, AsnArray } from \"@peculiar/asn1-schema\";\nimport { id_pkix } from \"@peculiar/asn1-x509\";\nexport const id_ri = `${id_pkix}.16`;\nexport const id_ri_ocsp_response = `${id_ri}.2`;\nexport const id_ri_scvp = `${id_ri}.4`;\nexport class OtherRevocationInfoFormat {\n constructor(params = {}) {\n this.otherRevInfoFormat = \"\";\n this.otherRevInfo = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], OtherRevocationInfoFormat.prototype, \"otherRevInfoFormat\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], OtherRevocationInfoFormat.prototype, \"otherRevInfo\", void 0);\nlet RevocationInfoChoice = class RevocationInfoChoice {\n constructor(params = {}) {\n this.other = new OtherRevocationInfoFormat();\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: OtherRevocationInfoFormat, context: 1, implicit: true })\n], RevocationInfoChoice.prototype, \"other\", void 0);\nRevocationInfoChoice = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], RevocationInfoChoice);\nexport { RevocationInfoChoice };\nlet RevocationInfoChoices = RevocationInfoChoices_1 = class RevocationInfoChoices extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, RevocationInfoChoices_1.prototype);\n }\n};\nRevocationInfoChoices = RevocationInfoChoices_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: RevocationInfoChoice })\n], RevocationInfoChoices);\nexport { RevocationInfoChoices };\n","import { __decorate } from \"tslib\";\nimport { AsnProp } from \"@peculiar/asn1-schema\";\nimport { CertificateSet } from \"./certificate_choices\";\nimport { RevocationInfoChoices } from \"./revocation_info_choice\";\nexport class OriginatorInfo {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: CertificateSet, context: 0, implicit: true, optional: true })\n], OriginatorInfo.prototype, \"certs\", void 0);\n__decorate([\n AsnProp({ type: RevocationInfoChoices, context: 1, implicit: true, optional: true })\n], OriginatorInfo.prototype, \"crls\", void 0);\n","var UnprotectedAttributes_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { CMSVersion } from \"./types\";\nimport { Attribute } from \"./attribute\";\nimport { RecipientInfos } from \"./recipient_infos\";\nimport { OriginatorInfo } from \"./originator_info\";\nimport { EncryptedContentInfo } from \"./encrypted_content_info\";\nlet UnprotectedAttributes = UnprotectedAttributes_1 = class UnprotectedAttributes extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, UnprotectedAttributes_1.prototype);\n }\n};\nUnprotectedAttributes = UnprotectedAttributes_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: Attribute })\n], UnprotectedAttributes);\nexport { UnprotectedAttributes };\nexport class EnvelopedData {\n constructor(params = {}) {\n this.version = CMSVersion.v0;\n this.recipientInfos = new RecipientInfos();\n this.encryptedContentInfo = new EncryptedContentInfo();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], EnvelopedData.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: OriginatorInfo, context: 0, implicit: true, optional: true })\n], EnvelopedData.prototype, \"originatorInfo\", void 0);\n__decorate([\n AsnProp({ type: RecipientInfos })\n], EnvelopedData.prototype, \"recipientInfos\", void 0);\n__decorate([\n AsnProp({ type: EncryptedContentInfo })\n], EnvelopedData.prototype, \"encryptedContentInfo\", void 0);\n__decorate([\n AsnProp({ type: UnprotectedAttributes, context: 1, implicit: true, optional: true })\n], EnvelopedData.prototype, \"unprotectedAttrs\", void 0);\n","export const id_ct_contentInfo = \"1.2.840.113549.1.9.16.1.6\";\nexport const id_data = \"1.2.840.113549.1.7.1\";\nexport const id_signedData = \"1.2.840.113549.1.7.2\";\nexport const id_envelopedData = \"1.2.840.113549.1.7.3\";\nexport const id_digestedData = \"1.2.840.113549.1.7.5\";\nexport const id_encryptedData = \"1.2.840.113549.1.7.6\";\nexport const id_authData = \"1.2.840.113549.1.9.16.1.2\";\n","var DigestAlgorithmIdentifiers_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { CertificateSet } from \"./certificate_choices\";\nimport { CMSVersion, DigestAlgorithmIdentifier } from \"./types\";\nimport { EncapsulatedContentInfo } from \"./encapsulated_content_info\";\nimport { RevocationInfoChoices } from \"./revocation_info_choice\";\nimport { SignerInfos } from \"./signer_info\";\nlet DigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = class DigestAlgorithmIdentifiers extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, DigestAlgorithmIdentifiers_1.prototype);\n }\n};\nDigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: DigestAlgorithmIdentifier })\n], DigestAlgorithmIdentifiers);\nexport { DigestAlgorithmIdentifiers };\nexport class SignedData {\n constructor(params = {}) {\n this.version = CMSVersion.v0;\n this.digestAlgorithms = new DigestAlgorithmIdentifiers();\n this.encapContentInfo = new EncapsulatedContentInfo();\n this.signerInfos = new SignerInfos();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], SignedData.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: DigestAlgorithmIdentifiers })\n], SignedData.prototype, \"digestAlgorithms\", void 0);\n__decorate([\n AsnProp({ type: EncapsulatedContentInfo })\n], SignedData.prototype, \"encapContentInfo\", void 0);\n__decorate([\n AsnProp({ type: CertificateSet, context: 0, implicit: true, optional: true })\n], SignedData.prototype, \"certificates\", void 0);\n__decorate([\n AsnProp({ type: RevocationInfoChoices, context: 1, implicit: true, optional: true })\n], SignedData.prototype, \"crls\", void 0);\n__decorate([\n AsnProp({ type: SignerInfos })\n], SignedData.prototype, \"signerInfos\", void 0);\n","export const id_ecPublicKey = \"1.2.840.10045.2.1\";\nexport const id_ecDH = \"1.3.132.1.12\";\nexport const id_ecMQV = \"1.3.132.1.13\";\nexport const id_ecdsaWithSHA1 = \"1.2.840.10045.4.1\";\nexport const id_ecdsaWithSHA224 = \"1.2.840.10045.4.3.1\";\nexport const id_ecdsaWithSHA256 = \"1.2.840.10045.4.3.2\";\nexport const id_ecdsaWithSHA384 = \"1.2.840.10045.4.3.3\";\nexport const id_ecdsaWithSHA512 = \"1.2.840.10045.4.3.4\";\nexport const id_secp192r1 = \"1.2.840.10045.3.1.1\";\nexport const id_sect163k1 = \"1.3.132.0.1\";\nexport const id_sect163r2 = \"1.3.132.0.15\";\nexport const id_secp224r1 = \"1.3.132.0.33\";\nexport const id_sect233k1 = \"1.3.132.0.26\";\nexport const id_sect233r1 = \"1.3.132.0.27\";\nexport const id_secp256r1 = \"1.2.840.10045.3.1.7\";\nexport const id_sect283k1 = \"1.3.132.0.16\";\nexport const id_sect283r1 = \"1.3.132.0.17\";\nexport const id_secp384r1 = \"1.3.132.0.34\";\nexport const id_sect409k1 = \"1.3.132.0.36\";\nexport const id_sect409r1 = \"1.3.132.0.37\";\nexport const id_secp521r1 = \"1.3.132.0.35\";\nexport const id_sect571k1 = \"1.3.132.0.38\";\nexport const id_sect571r1 = \"1.3.132.0.39\";\n","import { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport * as oid from \"./object_identifiers\";\nfunction create(algorithm) {\n return new AlgorithmIdentifier({ algorithm });\n}\nexport const ecdsaWithSHA1 = create(oid.id_ecdsaWithSHA1);\nexport const ecdsaWithSHA224 = create(oid.id_ecdsaWithSHA224);\nexport const ecdsaWithSHA256 = create(oid.id_ecdsaWithSHA256);\nexport const ecdsaWithSHA384 = create(oid.id_ecdsaWithSHA384);\nexport const ecdsaWithSHA512 = create(oid.id_ecdsaWithSHA512);\n","import { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes, OctetString, AsnIntegerArrayBufferConverter, } from \"@peculiar/asn1-schema\";\nlet FieldID = class FieldID {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], FieldID.prototype, \"fieldType\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any })\n], FieldID.prototype, \"parameters\", void 0);\nFieldID = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], FieldID);\nexport { FieldID };\nexport class ECPoint extends OctetString {\n}\nexport class FieldElement extends OctetString {\n}\nlet Curve = class Curve {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.OctetString })\n], Curve.prototype, \"a\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.OctetString })\n], Curve.prototype, \"b\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString, optional: true })\n], Curve.prototype, \"seed\", void 0);\nCurve = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], Curve);\nexport { Curve };\nexport var ECPVer;\n(function (ECPVer) {\n ECPVer[ECPVer[\"ecpVer1\"] = 1] = \"ecpVer1\";\n})(ECPVer || (ECPVer = {}));\nlet SpecifiedECDomain = class SpecifiedECDomain {\n constructor(params = {}) {\n this.version = ECPVer.ecpVer1;\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], SpecifiedECDomain.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: FieldID })\n], SpecifiedECDomain.prototype, \"fieldID\", void 0);\n__decorate([\n AsnProp({ type: Curve })\n], SpecifiedECDomain.prototype, \"curve\", void 0);\n__decorate([\n AsnProp({ type: ECPoint })\n], SpecifiedECDomain.prototype, \"base\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], SpecifiedECDomain.prototype, \"order\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, optional: true })\n], SpecifiedECDomain.prototype, \"cofactor\", void 0);\nSpecifiedECDomain = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], SpecifiedECDomain);\nexport { SpecifiedECDomain };\n","import { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { SpecifiedECDomain } from \"./rfc3279\";\nlet ECParameters = class ECParameters {\n constructor(params = {}) {\n Object.assign(this, params);\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], ECParameters.prototype, \"namedCurve\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Null })\n], ECParameters.prototype, \"implicitCurve\", void 0);\n__decorate([\n AsnProp({ type: SpecifiedECDomain })\n], ECParameters.prototype, \"specifiedCurve\", void 0);\nECParameters = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], ECParameters);\nexport { ECParameters };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, OctetString } from \"@peculiar/asn1-schema\";\nimport { ECParameters } from \"./ec_parameters\";\nexport class ECPrivateKey {\n constructor(params = {}) {\n this.version = 1;\n this.privateKey = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], ECPrivateKey.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], ECPrivateKey.prototype, \"privateKey\", void 0);\n__decorate([\n AsnProp({ type: ECParameters, context: 0, optional: true })\n], ECPrivateKey.prototype, \"parameters\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString, context: 1, optional: true })\n], ECPrivateKey.prototype, \"publicKey\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nexport class ECDSASigValue {\n constructor(params = {}) {\n this.r = new ArrayBuffer(0);\n this.s = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], ECDSASigValue.prototype, \"r\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], ECDSASigValue.prototype, \"s\", void 0);\n","export const id_pkcs_1 = \"1.2.840.113549.1.1\";\nexport const id_rsaEncryption = `${id_pkcs_1}.1`;\nexport const id_RSAES_OAEP = `${id_pkcs_1}.7`;\nexport const id_pSpecified = `${id_pkcs_1}.9`;\nexport const id_RSASSA_PSS = `${id_pkcs_1}.10`;\nexport const id_md2WithRSAEncryption = `${id_pkcs_1}.2`;\nexport const id_md5WithRSAEncryption = `${id_pkcs_1}.4`;\nexport const id_sha1WithRSAEncryption = `${id_pkcs_1}.5`;\nexport const id_sha224WithRSAEncryption = `${id_pkcs_1}.14`;\nexport const id_ssha224WithRSAEncryption = id_sha224WithRSAEncryption;\nexport const id_sha256WithRSAEncryption = `${id_pkcs_1}.11`;\nexport const id_sha384WithRSAEncryption = `${id_pkcs_1}.12`;\nexport const id_sha512WithRSAEncryption = `${id_pkcs_1}.13`;\nexport const id_sha512_224WithRSAEncryption = `${id_pkcs_1}.15`;\nexport const id_sha512_256WithRSAEncryption = `${id_pkcs_1}.16`;\nexport const id_sha1 = \"1.3.14.3.2.26\";\nexport const id_sha224 = \"2.16.840.1.101.3.4.2.4\";\nexport const id_sha256 = \"2.16.840.1.101.3.4.2.1\";\nexport const id_sha384 = \"2.16.840.1.101.3.4.2.2\";\nexport const id_sha512 = \"2.16.840.1.101.3.4.2.3\";\nexport const id_sha512_224 = \"2.16.840.1.101.3.4.2.5\";\nexport const id_sha512_256 = \"2.16.840.1.101.3.4.2.6\";\nexport const id_md2 = \"1.2.840.113549.2.2\";\nexport const id_md5 = \"1.2.840.113549.2.5\";\nexport const id_mgf1 = `${id_pkcs_1}.8`;\n","import { AsnConvert, AsnOctetStringConverter } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport * as oid from \"./object_identifiers\";\nfunction create(algorithm) {\n return new AlgorithmIdentifier({ algorithm, parameters: null });\n}\nexport const md2 = create(oid.id_md2);\nexport const md4 = create(oid.id_md5);\nexport const sha1 = create(oid.id_sha1);\nexport const sha224 = create(oid.id_sha224);\nexport const sha256 = create(oid.id_sha256);\nexport const sha384 = create(oid.id_sha384);\nexport const sha512 = create(oid.id_sha512);\nexport const sha512_224 = create(oid.id_sha512_224);\nexport const sha512_256 = create(oid.id_sha512_256);\nexport const mgf1SHA1 = new AlgorithmIdentifier({\n algorithm: oid.id_mgf1,\n parameters: AsnConvert.serialize(sha1),\n});\nexport const pSpecifiedEmpty = new AlgorithmIdentifier({\n algorithm: oid.id_pSpecified,\n parameters: AsnConvert.serialize(AsnOctetStringConverter.toASN(new Uint8Array([\n 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18,\n 0x90, 0xaf, 0xd8, 0x07, 0x09,\n ]).buffer)),\n});\nexport const rsaEncryption = create(oid.id_rsaEncryption);\nexport const md2WithRSAEncryption = create(oid.id_md2WithRSAEncryption);\nexport const md5WithRSAEncryption = create(oid.id_md5WithRSAEncryption);\nexport const sha1WithRSAEncryption = create(oid.id_sha1WithRSAEncryption);\nexport const sha224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);\nexport const sha256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);\nexport const sha384WithRSAEncryption = create(oid.id_sha384WithRSAEncryption);\nexport const sha512WithRSAEncryption = create(oid.id_sha512WithRSAEncryption);\nexport const sha512_224WithRSAEncryption = create(oid.id_sha512_224WithRSAEncryption);\nexport const sha512_256WithRSAEncryption = create(oid.id_sha512_256WithRSAEncryption);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnConvert } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport { id_mgf1, id_RSAES_OAEP } from \"../object_identifiers\";\nimport { sha1, mgf1SHA1, pSpecifiedEmpty } from \"../algorithms\";\nexport class RsaEsOaepParams {\n constructor(params = {}) {\n this.hashAlgorithm = new AlgorithmIdentifier(sha1);\n this.maskGenAlgorithm = new AlgorithmIdentifier({\n algorithm: id_mgf1,\n parameters: AsnConvert.serialize(sha1),\n });\n this.pSourceAlgorithm = new AlgorithmIdentifier(pSpecifiedEmpty);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })\n], RsaEsOaepParams.prototype, \"hashAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })\n], RsaEsOaepParams.prototype, \"maskGenAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier, context: 2, defaultValue: pSpecifiedEmpty })\n], RsaEsOaepParams.prototype, \"pSourceAlgorithm\", void 0);\nexport const RSAES_OAEP = new AlgorithmIdentifier({\n algorithm: id_RSAES_OAEP,\n parameters: AsnConvert.serialize(new RsaEsOaepParams()),\n});\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnConvert, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport { id_mgf1, id_RSASSA_PSS } from \"../object_identifiers\";\nimport { sha1, mgf1SHA1 } from \"../algorithms\";\nexport class RsaSaPssParams {\n constructor(params = {}) {\n this.hashAlgorithm = new AlgorithmIdentifier(sha1);\n this.maskGenAlgorithm = new AlgorithmIdentifier({\n algorithm: id_mgf1,\n parameters: AsnConvert.serialize(sha1),\n });\n this.saltLength = 20;\n this.trailerField = 1;\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier, context: 0, defaultValue: sha1 })\n], RsaSaPssParams.prototype, \"hashAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier, context: 1, defaultValue: mgf1SHA1 })\n], RsaSaPssParams.prototype, \"maskGenAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, context: 2, defaultValue: 20 })\n], RsaSaPssParams.prototype, \"saltLength\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, context: 3, defaultValue: 1 })\n], RsaSaPssParams.prototype, \"trailerField\", void 0);\nexport const RSASSA_PSS = new AlgorithmIdentifier({\n algorithm: id_RSASSA_PSS,\n parameters: AsnConvert.serialize(new RsaSaPssParams()),\n});\n","import { __decorate } from \"tslib\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nimport { AsnProp, OctetString } from \"@peculiar/asn1-schema\";\nexport class DigestInfo {\n constructor(params = {}) {\n this.digestAlgorithm = new AlgorithmIdentifier();\n this.digest = new OctetString();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], DigestInfo.prototype, \"digestAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], DigestInfo.prototype, \"digest\", void 0);\n","var OtherPrimeInfos_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter, AsnArray, AsnType, AsnTypeTypes, } from \"@peculiar/asn1-schema\";\nexport class OtherPrimeInfo {\n constructor(params = {}) {\n this.prime = new ArrayBuffer(0);\n this.exponent = new ArrayBuffer(0);\n this.coefficient = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], OtherPrimeInfo.prototype, \"prime\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], OtherPrimeInfo.prototype, \"exponent\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], OtherPrimeInfo.prototype, \"coefficient\", void 0);\nlet OtherPrimeInfos = OtherPrimeInfos_1 = class OtherPrimeInfos extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, OtherPrimeInfos_1.prototype);\n }\n};\nOtherPrimeInfos = OtherPrimeInfos_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: OtherPrimeInfo })\n], OtherPrimeInfos);\nexport { OtherPrimeInfos };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nimport { OtherPrimeInfos } from \"./other_prime_info\";\nexport class RSAPrivateKey {\n constructor(params = {}) {\n this.version = 0;\n this.modulus = new ArrayBuffer(0);\n this.publicExponent = new ArrayBuffer(0);\n this.privateExponent = new ArrayBuffer(0);\n this.prime1 = new ArrayBuffer(0);\n this.prime2 = new ArrayBuffer(0);\n this.exponent1 = new ArrayBuffer(0);\n this.exponent2 = new ArrayBuffer(0);\n this.coefficient = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], RSAPrivateKey.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"modulus\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"publicExponent\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"privateExponent\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"prime1\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"prime2\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"exponent1\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"exponent2\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPrivateKey.prototype, \"coefficient\", void 0);\n__decorate([\n AsnProp({ type: OtherPrimeInfos, optional: true })\n], RSAPrivateKey.prototype, \"otherPrimeInfos\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnIntegerArrayBufferConverter } from \"@peculiar/asn1-schema\";\nexport class RSAPublicKey {\n constructor(params = {}) {\n this.modulus = new ArrayBuffer(0);\n this.publicExponent = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPublicKey.prototype, \"modulus\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, converter: AsnIntegerArrayBufferConverter })\n], RSAPublicKey.prototype, \"publicExponent\", void 0);\n","var Lifecycle;\n(function (Lifecycle) {\n Lifecycle[Lifecycle[\"Transient\"] = 0] = \"Transient\";\n Lifecycle[Lifecycle[\"Singleton\"] = 1] = \"Singleton\";\n Lifecycle[Lifecycle[\"ResolutionScoped\"] = 2] = \"ResolutionScoped\";\n Lifecycle[Lifecycle[\"ContainerScoped\"] = 3] = \"ContainerScoped\";\n})(Lifecycle || (Lifecycle = {}));\nexport default Lifecycle;\n","export function isClassProvider(provider) {\n return !!provider.useClass;\n}\n","export function isFactoryProvider(provider) {\n return !!provider.useFactory;\n}\n","import { __read, __spread } from \"tslib\";\nvar DelayedConstructor = (function () {\n function DelayedConstructor(wrap) {\n this.wrap = wrap;\n this.reflectMethods = [\n \"get\",\n \"getPrototypeOf\",\n \"setPrototypeOf\",\n \"getOwnPropertyDescriptor\",\n \"defineProperty\",\n \"has\",\n \"set\",\n \"deleteProperty\",\n \"apply\",\n \"construct\",\n \"ownKeys\"\n ];\n }\n DelayedConstructor.prototype.createProxy = function (createObject) {\n var _this = this;\n var target = {};\n var init = false;\n var value;\n var delayedObject = function () {\n if (!init) {\n value = createObject(_this.wrap());\n init = true;\n }\n return value;\n };\n return new Proxy(target, this.createHandler(delayedObject));\n };\n DelayedConstructor.prototype.createHandler = function (delayedObject) {\n var handler = {};\n var install = function (name) {\n handler[name] = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n args[0] = delayedObject();\n var method = Reflect[name];\n return method.apply(void 0, __spread(args));\n };\n };\n this.reflectMethods.forEach(install);\n return handler;\n };\n return DelayedConstructor;\n}());\nexport { DelayedConstructor };\nexport function delay(wrappedConstructor) {\n if (typeof wrappedConstructor === \"undefined\") {\n throw new Error(\"Attempt to `delay` undefined. Constructor must be wrapped in a callback\");\n }\n return new DelayedConstructor(wrappedConstructor);\n}\n","import { DelayedConstructor } from \"../lazy-helpers\";\nexport function isNormalToken(token) {\n return typeof token === \"string\" || typeof token === \"symbol\";\n}\nexport function isTokenDescriptor(descriptor) {\n return (typeof descriptor === \"object\" &&\n \"token\" in descriptor &&\n \"multiple\" in descriptor);\n}\nexport function isTransformDescriptor(descriptor) {\n return (typeof descriptor === \"object\" &&\n \"token\" in descriptor &&\n \"transform\" in descriptor);\n}\nexport function isConstructorToken(token) {\n return typeof token === \"function\" || token instanceof DelayedConstructor;\n}\n","export function isTokenProvider(provider) {\n return !!provider.useToken;\n}\n","export function isValueProvider(provider) {\n return provider.useValue != undefined;\n}\n","var RegistryBase = (function () {\n function RegistryBase() {\n this._registryMap = new Map();\n }\n RegistryBase.prototype.entries = function () {\n return this._registryMap.entries();\n };\n RegistryBase.prototype.getAll = function (key) {\n this.ensure(key);\n return this._registryMap.get(key);\n };\n RegistryBase.prototype.get = function (key) {\n this.ensure(key);\n var value = this._registryMap.get(key);\n return value[value.length - 1] || null;\n };\n RegistryBase.prototype.set = function (key, value) {\n this.ensure(key);\n this._registryMap.get(key).push(value);\n };\n RegistryBase.prototype.setAll = function (key, value) {\n this._registryMap.set(key, value);\n };\n RegistryBase.prototype.has = function (key) {\n this.ensure(key);\n return this._registryMap.get(key).length > 0;\n };\n RegistryBase.prototype.clear = function () {\n this._registryMap.clear();\n };\n RegistryBase.prototype.ensure = function (key) {\n if (!this._registryMap.has(key)) {\n this._registryMap.set(key, []);\n }\n };\n return RegistryBase;\n}());\nexport default RegistryBase;\n","import { __extends } from \"tslib\";\nimport RegistryBase from \"./registry-base\";\nvar Registry = (function (_super) {\n __extends(Registry, _super);\n function Registry() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Registry;\n}(RegistryBase));\nexport default Registry;\n","var ResolutionContext = (function () {\n function ResolutionContext() {\n this.scopedResolutions = new Map();\n }\n return ResolutionContext;\n}());\nexport default ResolutionContext;\n","import { __extends } from \"tslib\";\nimport RegistryBase from \"./registry-base\";\nvar PreResolutionInterceptors = (function (_super) {\n __extends(PreResolutionInterceptors, _super);\n function PreResolutionInterceptors() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return PreResolutionInterceptors;\n}(RegistryBase));\nexport { PreResolutionInterceptors };\nvar PostResolutionInterceptors = (function (_super) {\n __extends(PostResolutionInterceptors, _super);\n function PostResolutionInterceptors() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return PostResolutionInterceptors;\n}(RegistryBase));\nexport { PostResolutionInterceptors };\nvar Interceptors = (function () {\n function Interceptors() {\n this.preResolution = new PreResolutionInterceptors();\n this.postResolution = new PostResolutionInterceptors();\n }\n return Interceptors;\n}());\nexport default Interceptors;\n","import { __awaiter, __generator, __read, __spread, __values } from \"tslib\";\nimport { isClassProvider, isFactoryProvider, isNormalToken, isTokenProvider, isValueProvider } from \"./providers\";\nimport { isProvider } from \"./providers/provider\";\nimport { isConstructorToken, isTokenDescriptor, isTransformDescriptor } from \"./providers/injection-token\";\nimport Registry from \"./registry\";\nimport Lifecycle from \"./types/lifecycle\";\nimport ResolutionContext from \"./resolution-context\";\nimport { formatErrorCtor } from \"./error-helpers\";\nimport { DelayedConstructor } from \"./lazy-helpers\";\nimport { isDisposable } from \"./types/disposable\";\nimport Interceptors from \"./interceptors\";\nexport var typeInfo = new Map();\nvar InternalDependencyContainer = (function () {\n function InternalDependencyContainer(parent) {\n this.parent = parent;\n this._registry = new Registry();\n this.interceptors = new Interceptors();\n this.disposed = false;\n this.disposables = new Set();\n }\n InternalDependencyContainer.prototype.register = function (token, providerOrConstructor, options) {\n if (options === void 0) { options = { lifecycle: Lifecycle.Transient }; }\n this.ensureNotDisposed();\n var provider;\n if (!isProvider(providerOrConstructor)) {\n provider = { useClass: providerOrConstructor };\n }\n else {\n provider = providerOrConstructor;\n }\n if (isTokenProvider(provider)) {\n var path = [token];\n var tokenProvider = provider;\n while (tokenProvider != null) {\n var currentToken = tokenProvider.useToken;\n if (path.includes(currentToken)) {\n throw new Error(\"Token registration cycle detected! \" + __spread(path, [currentToken]).join(\" -> \"));\n }\n path.push(currentToken);\n var registration = this._registry.get(currentToken);\n if (registration && isTokenProvider(registration.provider)) {\n tokenProvider = registration.provider;\n }\n else {\n tokenProvider = null;\n }\n }\n }\n if (options.lifecycle === Lifecycle.Singleton ||\n options.lifecycle == Lifecycle.ContainerScoped ||\n options.lifecycle == Lifecycle.ResolutionScoped) {\n if (isValueProvider(provider) || isFactoryProvider(provider)) {\n throw new Error(\"Cannot use lifecycle \\\"\" + Lifecycle[options.lifecycle] + \"\\\" with ValueProviders or FactoryProviders\");\n }\n }\n this._registry.set(token, { provider: provider, options: options });\n return this;\n };\n InternalDependencyContainer.prototype.registerType = function (from, to) {\n this.ensureNotDisposed();\n if (isNormalToken(to)) {\n return this.register(from, {\n useToken: to\n });\n }\n return this.register(from, {\n useClass: to\n });\n };\n InternalDependencyContainer.prototype.registerInstance = function (token, instance) {\n this.ensureNotDisposed();\n return this.register(token, {\n useValue: instance\n });\n };\n InternalDependencyContainer.prototype.registerSingleton = function (from, to) {\n this.ensureNotDisposed();\n if (isNormalToken(from)) {\n if (isNormalToken(to)) {\n return this.register(from, {\n useToken: to\n }, { lifecycle: Lifecycle.Singleton });\n }\n else if (to) {\n return this.register(from, {\n useClass: to\n }, { lifecycle: Lifecycle.Singleton });\n }\n throw new Error('Cannot register a type name as a singleton without a \"to\" token');\n }\n var useClass = from;\n if (to && !isNormalToken(to)) {\n useClass = to;\n }\n return this.register(from, {\n useClass: useClass\n }, { lifecycle: Lifecycle.Singleton });\n };\n InternalDependencyContainer.prototype.resolve = function (token, context, isOptional) {\n if (context === void 0) { context = new ResolutionContext(); }\n if (isOptional === void 0) { isOptional = false; }\n this.ensureNotDisposed();\n var registration = this.getRegistration(token);\n if (!registration && isNormalToken(token)) {\n if (isOptional) {\n return undefined;\n }\n throw new Error(\"Attempted to resolve unregistered dependency token: \\\"\" + token.toString() + \"\\\"\");\n }\n this.executePreResolutionInterceptor(token, \"Single\");\n if (registration) {\n var result = this.resolveRegistration(registration, context);\n this.executePostResolutionInterceptor(token, result, \"Single\");\n return result;\n }\n if (isConstructorToken(token)) {\n var result = this.construct(token, context);\n this.executePostResolutionInterceptor(token, result, \"Single\");\n return result;\n }\n throw new Error(\"Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.\");\n };\n InternalDependencyContainer.prototype.executePreResolutionInterceptor = function (token, resolutionType) {\n var e_1, _a;\n if (this.interceptors.preResolution.has(token)) {\n var remainingInterceptors = [];\n try {\n for (var _b = __values(this.interceptors.preResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var interceptor = _c.value;\n if (interceptor.options.frequency != \"Once\") {\n remainingInterceptors.push(interceptor);\n }\n interceptor.callback(token, resolutionType);\n }\n }\n catch (e_1_1) { e_1 = { error: e_1_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_1) throw e_1.error; }\n }\n this.interceptors.preResolution.setAll(token, remainingInterceptors);\n }\n };\n InternalDependencyContainer.prototype.executePostResolutionInterceptor = function (token, result, resolutionType) {\n var e_2, _a;\n if (this.interceptors.postResolution.has(token)) {\n var remainingInterceptors = [];\n try {\n for (var _b = __values(this.interceptors.postResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) {\n var interceptor = _c.value;\n if (interceptor.options.frequency != \"Once\") {\n remainingInterceptors.push(interceptor);\n }\n interceptor.callback(token, result, resolutionType);\n }\n }\n catch (e_2_1) { e_2 = { error: e_2_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_2) throw e_2.error; }\n }\n this.interceptors.postResolution.setAll(token, remainingInterceptors);\n }\n };\n InternalDependencyContainer.prototype.resolveRegistration = function (registration, context) {\n this.ensureNotDisposed();\n if (registration.options.lifecycle === Lifecycle.ResolutionScoped &&\n context.scopedResolutions.has(registration)) {\n return context.scopedResolutions.get(registration);\n }\n var isSingleton = registration.options.lifecycle === Lifecycle.Singleton;\n var isContainerScoped = registration.options.lifecycle === Lifecycle.ContainerScoped;\n var returnInstance = isSingleton || isContainerScoped;\n var resolved;\n if (isValueProvider(registration.provider)) {\n resolved = registration.provider.useValue;\n }\n else if (isTokenProvider(registration.provider)) {\n resolved = returnInstance\n ? registration.instance ||\n (registration.instance = this.resolve(registration.provider.useToken, context))\n : this.resolve(registration.provider.useToken, context);\n }\n else if (isClassProvider(registration.provider)) {\n resolved = returnInstance\n ? registration.instance ||\n (registration.instance = this.construct(registration.provider.useClass, context))\n : this.construct(registration.provider.useClass, context);\n }\n else if (isFactoryProvider(registration.provider)) {\n resolved = registration.provider.useFactory(this);\n }\n else {\n resolved = this.construct(registration.provider, context);\n }\n if (registration.options.lifecycle === Lifecycle.ResolutionScoped) {\n context.scopedResolutions.set(registration, resolved);\n }\n return resolved;\n };\n InternalDependencyContainer.prototype.resolveAll = function (token, context, isOptional) {\n var _this = this;\n if (context === void 0) { context = new ResolutionContext(); }\n if (isOptional === void 0) { isOptional = false; }\n this.ensureNotDisposed();\n var registrations = this.getAllRegistrations(token);\n if (!registrations && isNormalToken(token)) {\n if (isOptional) {\n return [];\n }\n throw new Error(\"Attempted to resolve unregistered dependency token: \\\"\" + token.toString() + \"\\\"\");\n }\n this.executePreResolutionInterceptor(token, \"All\");\n if (registrations) {\n var result_1 = registrations.map(function (item) {\n return _this.resolveRegistration(item, context);\n });\n this.executePostResolutionInterceptor(token, result_1, \"All\");\n return result_1;\n }\n var result = [this.construct(token, context)];\n this.executePostResolutionInterceptor(token, result, \"All\");\n return result;\n };\n InternalDependencyContainer.prototype.isRegistered = function (token, recursive) {\n if (recursive === void 0) { recursive = false; }\n this.ensureNotDisposed();\n return (this._registry.has(token) ||\n (recursive &&\n (this.parent || false) &&\n this.parent.isRegistered(token, true)));\n };\n InternalDependencyContainer.prototype.reset = function () {\n this.ensureNotDisposed();\n this._registry.clear();\n this.interceptors.preResolution.clear();\n this.interceptors.postResolution.clear();\n };\n InternalDependencyContainer.prototype.clearInstances = function () {\n var e_3, _a;\n this.ensureNotDisposed();\n try {\n for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1];\n this._registry.setAll(token, registrations\n .filter(function (registration) { return !isValueProvider(registration.provider); })\n .map(function (registration) {\n registration.instance = undefined;\n return registration;\n }));\n }\n }\n catch (e_3_1) { e_3 = { error: e_3_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_3) throw e_3.error; }\n }\n };\n InternalDependencyContainer.prototype.createChildContainer = function () {\n var e_4, _a;\n this.ensureNotDisposed();\n var childContainer = new InternalDependencyContainer(this);\n try {\n for (var _b = __values(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) {\n var _d = __read(_c.value, 2), token = _d[0], registrations = _d[1];\n if (registrations.some(function (_a) {\n var options = _a.options;\n return options.lifecycle === Lifecycle.ContainerScoped;\n })) {\n childContainer._registry.setAll(token, registrations.map(function (registration) {\n if (registration.options.lifecycle === Lifecycle.ContainerScoped) {\n return {\n provider: registration.provider,\n options: registration.options\n };\n }\n return registration;\n }));\n }\n }\n }\n catch (e_4_1) { e_4 = { error: e_4_1 }; }\n finally {\n try {\n if (_c && !_c.done && (_a = _b.return)) _a.call(_b);\n }\n finally { if (e_4) throw e_4.error; }\n }\n return childContainer;\n };\n InternalDependencyContainer.prototype.beforeResolution = function (token, callback, options) {\n if (options === void 0) { options = { frequency: \"Always\" }; }\n this.interceptors.preResolution.set(token, {\n callback: callback,\n options: options\n });\n };\n InternalDependencyContainer.prototype.afterResolution = function (token, callback, options) {\n if (options === void 0) { options = { frequency: \"Always\" }; }\n this.interceptors.postResolution.set(token, {\n callback: callback,\n options: options\n });\n };\n InternalDependencyContainer.prototype.dispose = function () {\n return __awaiter(this, void 0, void 0, function () {\n var promises;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n this.disposed = true;\n promises = [];\n this.disposables.forEach(function (disposable) {\n var maybePromise = disposable.dispose();\n if (maybePromise) {\n promises.push(maybePromise);\n }\n });\n return [4, Promise.all(promises)];\n case 1:\n _a.sent();\n return [2];\n }\n });\n });\n };\n InternalDependencyContainer.prototype.getRegistration = function (token) {\n if (this.isRegistered(token)) {\n return this._registry.get(token);\n }\n if (this.parent) {\n return this.parent.getRegistration(token);\n }\n return null;\n };\n InternalDependencyContainer.prototype.getAllRegistrations = function (token) {\n if (this.isRegistered(token)) {\n return this._registry.getAll(token);\n }\n if (this.parent) {\n return this.parent.getAllRegistrations(token);\n }\n return null;\n };\n InternalDependencyContainer.prototype.construct = function (ctor, context) {\n var _this = this;\n if (ctor instanceof DelayedConstructor) {\n return ctor.createProxy(function (target) {\n return _this.resolve(target, context);\n });\n }\n var instance = (function () {\n var paramInfo = typeInfo.get(ctor);\n if (!paramInfo || paramInfo.length === 0) {\n if (ctor.length === 0) {\n return new ctor();\n }\n else {\n throw new Error(\"TypeInfo not known for \\\"\" + ctor.name + \"\\\"\");\n }\n }\n var params = paramInfo.map(_this.resolveParams(context, ctor));\n return new (ctor.bind.apply(ctor, __spread([void 0], params)))();\n })();\n if (isDisposable(instance)) {\n this.disposables.add(instance);\n }\n return instance;\n };\n InternalDependencyContainer.prototype.resolveParams = function (context, ctor) {\n var _this = this;\n return function (param, idx) {\n var _a, _b, _c;\n try {\n if (isTokenDescriptor(param)) {\n if (isTransformDescriptor(param)) {\n return param.multiple\n ? (_a = _this.resolve(param.transform)).transform.apply(_a, __spread([_this.resolveAll(param.token, new ResolutionContext(), param.isOptional)], param.transformArgs)) : (_b = _this.resolve(param.transform)).transform.apply(_b, __spread([_this.resolve(param.token, context, param.isOptional)], param.transformArgs));\n }\n else {\n return param.multiple\n ? _this.resolveAll(param.token, new ResolutionContext(), param.isOptional)\n : _this.resolve(param.token, context, param.isOptional);\n }\n }\n else if (isTransformDescriptor(param)) {\n return (_c = _this.resolve(param.transform, context)).transform.apply(_c, __spread([_this.resolve(param.token, context)], param.transformArgs));\n }\n return _this.resolve(param, context);\n }\n catch (e) {\n throw new Error(formatErrorCtor(ctor, idx, e));\n }\n };\n };\n InternalDependencyContainer.prototype.ensureNotDisposed = function () {\n if (this.disposed) {\n throw new Error(\"This container has been disposed, you cannot interact with a disposed container\");\n }\n };\n return InternalDependencyContainer;\n}());\nexport var instance = new InternalDependencyContainer();\nexport default instance;\n","import { isClassProvider } from \"./class-provider\";\nimport { isValueProvider } from \"./value-provider\";\nimport { isTokenProvider } from \"./token-provider\";\nimport { isFactoryProvider } from \"./factory-provider\";\nexport function isProvider(provider) {\n return (isClassProvider(provider) ||\n isValueProvider(provider) ||\n isTokenProvider(provider) ||\n isFactoryProvider(provider));\n}\n","export function isDisposable(value) {\n if (typeof value.dispose !== \"function\")\n return false;\n var disposeFun = value.dispose;\n if (disposeFun.length > 0) {\n return false;\n }\n return true;\n}\n","import { __read, __spread } from \"tslib\";\nfunction formatDependency(params, idx) {\n if (params === null) {\n return \"at position #\" + idx;\n }\n var argName = params.split(\",\")[idx].trim();\n return \"\\\"\" + argName + \"\\\" at position #\" + idx;\n}\nfunction composeErrorMessage(msg, e, indent) {\n if (indent === void 0) { indent = \" \"; }\n return __spread([msg], e.message.split(\"\\n\").map(function (l) { return indent + l; })).join(\"\\n\");\n}\nexport function formatErrorCtor(ctor, paramIdx, error) {\n var _a = __read(ctor.toString().match(/constructor\\(([\\w, ]+)\\)/) || [], 2), _b = _a[1], params = _b === void 0 ? null : _b;\n var dep = formatDependency(params, paramIdx);\n return composeErrorMessage(\"Cannot inject the dependency \" + dep + \" of \\\"\" + ctor.name + \"\\\" constructor. Reason:\", error);\n}\n","import { getParamInfo } from \"../reflection-helpers\";\nimport { typeInfo } from \"../dependency-container\";\nimport { instance as globalContainer } from \"../dependency-container\";\nfunction injectable(options) {\n return function (target) {\n typeInfo.set(target, getParamInfo(target));\n if (options && options.token) {\n if (!Array.isArray(options.token)) {\n globalContainer.register(options.token, target);\n }\n else {\n options.token.forEach(function (token) {\n globalContainer.register(token, target);\n });\n }\n }\n };\n}\nexport default injectable;\n","export var INJECTION_TOKEN_METADATA_KEY = \"injectionTokens\";\nexport function getParamInfo(target) {\n var params = Reflect.getMetadata(\"design:paramtypes\", target) || [];\n var injectionTokens = Reflect.getOwnMetadata(INJECTION_TOKEN_METADATA_KEY, target) || {};\n Object.keys(injectionTokens).forEach(function (key) {\n params[+key] = injectionTokens[key];\n });\n return params;\n}\nexport function defineInjectionTokenMetadata(data, transform) {\n return function (target, _propertyKey, parameterIndex) {\n var descriptors = Reflect.getOwnMetadata(INJECTION_TOKEN_METADATA_KEY, target) || {};\n descriptors[parameterIndex] = transform\n ? {\n token: data,\n transform: transform.transformToken,\n transformArgs: transform.args || []\n }\n : data;\n Reflect.defineMetadata(INJECTION_TOKEN_METADATA_KEY, descriptors, target);\n };\n}\n","if (typeof Reflect === \"undefined\" || !Reflect.getMetadata) {\n throw new Error(\"tsyringe requires a reflect polyfill. Please add 'import \\\"reflect-metadata\\\"' to the top of your entry point.\");\n}\nexport { Lifecycle } from \"./types\";\nexport * from \"./decorators\";\nexport * from \"./factories\";\nexport * from \"./providers\";\nexport { delay } from \"./lazy-helpers\";\nexport { instance as container } from \"./dependency-container\";\n","var PKCS12AttrSet_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nexport class PKCS12Attribute {\n constructor(params = {}) {\n this.attrId = \"\";\n this.attrValues = [];\n Object.assign(params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], PKCS12Attribute.prototype, \"attrId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, repeated: \"set\" })\n], PKCS12Attribute.prototype, \"attrValues\", void 0);\nlet PKCS12AttrSet = PKCS12AttrSet_1 = class PKCS12AttrSet extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, PKCS12AttrSet_1.prototype);\n }\n};\nPKCS12AttrSet = PKCS12AttrSet_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: PKCS12Attribute })\n], PKCS12AttrSet);\nexport { PKCS12AttrSet };\n","var AuthenticatedSafe_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { ContentInfo } from \"@peculiar/asn1-cms\";\nlet AuthenticatedSafe = AuthenticatedSafe_1 = class AuthenticatedSafe extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, AuthenticatedSafe_1.prototype);\n }\n};\nAuthenticatedSafe = AuthenticatedSafe_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: ContentInfo })\n], AuthenticatedSafe);\nexport { AuthenticatedSafe };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { id_pkcs_9 } from \"./types\";\nexport class CertBag {\n constructor(params = {}) {\n this.certId = \"\";\n this.certValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], CertBag.prototype, \"certId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], CertBag.prototype, \"certValue\", void 0);\nexport const id_certTypes = `${id_pkcs_9}.22`;\nexport const id_x509Certificate = `${id_certTypes}.1`;\nexport const id_sdsiCertificate = `${id_certTypes}.2`;\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { id_pkcs_9 } from \"./types\";\nexport class CRLBag {\n constructor(params = {}) {\n this.crlId = \"\";\n this.crltValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], CRLBag.prototype, \"crlId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], CRLBag.prototype, \"crltValue\", void 0);\nexport const id_crlTypes = `${id_pkcs_9}.23`;\nexport const id_x509CRL = `${id_crlTypes}.1`;\n","import { __decorate } from \"tslib\";\nimport { AsnProp, OctetString } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nexport class EncryptedData extends OctetString {\n}\nexport class EncryptedPrivateKeyInfo {\n constructor(params = {}) {\n this.encryptionAlgorithm = new AlgorithmIdentifier();\n this.encryptedData = new EncryptedData();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], EncryptedPrivateKeyInfo.prototype, \"encryptionAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: EncryptedData })\n], EncryptedPrivateKeyInfo.prototype, \"encryptedData\", void 0);\n","var Attributes_1;\nimport { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes, AsnArray, AsnType, AsnTypeTypes, OctetString, } from \"@peculiar/asn1-schema\";\nimport { AlgorithmIdentifier, Attribute } from \"@peculiar/asn1-x509\";\nexport var Version;\n(function (Version) {\n Version[Version[\"v1\"] = 0] = \"v1\";\n})(Version || (Version = {}));\nexport class PrivateKey extends OctetString {\n}\nlet Attributes = Attributes_1 = class Attributes extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, Attributes_1.prototype);\n }\n};\nAttributes = Attributes_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Attribute })\n], Attributes);\nexport { Attributes };\nexport class PrivateKeyInfo {\n constructor(params = {}) {\n this.version = Version.v1;\n this.privateKeyAlgorithm = new AlgorithmIdentifier();\n this.privateKey = new PrivateKey();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], PrivateKeyInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], PrivateKeyInfo.prototype, \"privateKeyAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: PrivateKey })\n], PrivateKeyInfo.prototype, \"privateKey\", void 0);\n__decorate([\n AsnProp({ type: Attributes, implicit: true, context: 0, optional: true })\n], PrivateKeyInfo.prototype, \"attributes\", void 0);\n","import { __decorate } from \"tslib\";\nimport { PrivateKeyInfo } from \"@peculiar/asn1-pkcs8\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nlet KeyBag = class KeyBag extends PrivateKeyInfo {\n};\nKeyBag = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], KeyBag);\nexport { KeyBag };\n","import { __decorate } from \"tslib\";\nimport { EncryptedPrivateKeyInfo } from \"@peculiar/asn1-pkcs8\";\nimport { AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nlet PKCS8ShroudedKeyBag = class PKCS8ShroudedKeyBag extends EncryptedPrivateKeyInfo {\n};\nPKCS8ShroudedKeyBag = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], PKCS8ShroudedKeyBag);\nexport { PKCS8ShroudedKeyBag };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nexport class SecretBag {\n constructor(params = {}) {\n this.secretTypeId = \"\";\n this.secretValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], SecretBag.prototype, \"secretTypeId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], SecretBag.prototype, \"secretValue\", void 0);\n","import { __decorate } from \"tslib\";\nimport { DigestInfo } from \"@peculiar/asn1-rsa\";\nimport { AsnProp, AsnPropTypes, OctetString } from \"@peculiar/asn1-schema\";\nexport class MacData {\n constructor(params = {}) {\n this.mac = new DigestInfo();\n this.macSalt = new OctetString();\n this.iterations = 1;\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: DigestInfo })\n], MacData.prototype, \"mac\", void 0);\n__decorate([\n AsnProp({ type: OctetString })\n], MacData.prototype, \"macSalt\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer, defaultValue: 1 })\n], MacData.prototype, \"iterations\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { ContentInfo } from \"@peculiar/asn1-cms\";\nimport { MacData } from \"./mac_data\";\nexport class PFX {\n constructor(params = {}) {\n this.version = 3;\n this.authSafe = new ContentInfo();\n this.macData = new MacData();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], PFX.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: ContentInfo })\n], PFX.prototype, \"authSafe\", void 0);\n__decorate([\n AsnProp({ type: MacData, optional: true })\n], PFX.prototype, \"macData\", void 0);\n","var SafeContents_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes, AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { PKCS12Attribute } from \"./attribute\";\nexport class SafeBag {\n constructor(params = {}) {\n this.bagId = \"\";\n this.bagValue = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], SafeBag.prototype, \"bagId\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.Any, context: 0 })\n], SafeBag.prototype, \"bagValue\", void 0);\n__decorate([\n AsnProp({ type: PKCS12Attribute, repeated: \"set\", optional: true })\n], SafeBag.prototype, \"bagAttributes\", void 0);\nlet SafeContents = SafeContents_1 = class SafeContents extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SafeContents_1.prototype);\n }\n};\nSafeContents = SafeContents_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: SafeBag })\n], SafeContents);\nexport { SafeContents };\n","var ExtensionRequest_1, ExtendedCertificateAttributes_1, SMIMECapabilities_1;\nimport { __decorate } from \"tslib\";\nimport { AsnType, AsnTypeTypes, AsnPropTypes, AsnProp, OctetString, AsnArray, } from \"@peculiar/asn1-schema\";\nimport * as cms from \"@peculiar/asn1-cms\";\nimport * as pfx from \"@peculiar/asn1-pfx\";\nimport * as pkcs8 from \"@peculiar/asn1-pkcs8\";\nimport * as x509 from \"@peculiar/asn1-x509\";\nimport * as attr from \"@peculiar/asn1-x509-attr\";\nexport const id_pkcs9 = \"1.2.840.113549.1.9\";\nexport const id_pkcs9_mo = `${id_pkcs9}.0`;\nexport const id_pkcs9_oc = `${id_pkcs9}.24`;\nexport const id_pkcs9_at = `${id_pkcs9}.25`;\nexport const id_pkcs9_sx = `${id_pkcs9}.26`;\nexport const id_pkcs9_mr = `${id_pkcs9}.27`;\nexport const id_pkcs9_oc_pkcsEntity = `${id_pkcs9_oc}.1`;\nexport const id_pkcs9_oc_naturalPerson = `${id_pkcs9_oc}.2`;\nexport const id_pkcs9_at_emailAddress = `${id_pkcs9}.1`;\nexport const id_pkcs9_at_unstructuredName = `${id_pkcs9}.2`;\nexport const id_pkcs9_at_contentType = `${id_pkcs9}.3`;\nexport const id_pkcs9_at_messageDigest = `${id_pkcs9}.4`;\nexport const id_pkcs9_at_signingTime = `${id_pkcs9}.5`;\nexport const id_pkcs9_at_counterSignature = `${id_pkcs9}.6`;\nexport const id_pkcs9_at_challengePassword = `${id_pkcs9}.7`;\nexport const id_pkcs9_at_unstructuredAddress = `${id_pkcs9}.8`;\nexport const id_pkcs9_at_extendedCertificateAttributes = `${id_pkcs9}.9`;\nexport const id_pkcs9_at_signingDescription = `${id_pkcs9}.13`;\nexport const id_pkcs9_at_extensionRequest = `${id_pkcs9}.14`;\nexport const id_pkcs9_at_smimeCapabilities = `${id_pkcs9}.15`;\nexport const id_pkcs9_at_friendlyName = `${id_pkcs9}.20`;\nexport const id_pkcs9_at_localKeyId = `${id_pkcs9}.21`;\nexport const id_pkcs9_at_userPKCS12 = `2.16.840.1.113730.3.1.216`;\nexport const id_pkcs9_at_pkcs15Token = `${id_pkcs9_at}.1`;\nexport const id_pkcs9_at_encryptedPrivateKeyInfo = `${id_pkcs9_at}.2`;\nexport const id_pkcs9_at_randomNonce = `${id_pkcs9_at}.3`;\nexport const id_pkcs9_at_sequenceNumber = `${id_pkcs9_at}.4`;\nexport const id_pkcs9_at_pkcs7PDU = `${id_pkcs9_at}.5`;\nexport const id_ietf_at = `1.3.6.1.5.5.7.9`;\nexport const id_pkcs9_at_dateOfBirth = `${id_ietf_at}.1`;\nexport const id_pkcs9_at_placeOfBirth = `${id_ietf_at}.2`;\nexport const id_pkcs9_at_gender = `${id_ietf_at}.3`;\nexport const id_pkcs9_at_countryOfCitizenship = `${id_ietf_at}.4`;\nexport const id_pkcs9_at_countryOfResidence = `${id_ietf_at}.5`;\nexport const id_pkcs9_sx_pkcs9String = `${id_pkcs9_sx}.1`;\nexport const id_pkcs9_sx_signingTime = `${id_pkcs9_sx}.2`;\nexport const id_pkcs9_mr_caseIgnoreMatch = `${id_pkcs9_mr}.1`;\nexport const id_pkcs9_mr_signingTimeMatch = `${id_pkcs9_mr}.2`;\nexport const id_smime = `${id_pkcs9}.16`;\nexport const id_certTypes = `${id_pkcs9}.22`;\nexport const crlTypes = `${id_pkcs9}.23`;\nexport const id_at_pseudonym = `${attr.id_at}.65`;\nlet PKCS9String = class PKCS9String extends x509.DirectoryString {\n constructor(params = {}) {\n super(params);\n }\n toString() {\n const o = {};\n o.toString();\n return this.ia5String || super.toString();\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String })\n], PKCS9String.prototype, \"ia5String\", void 0);\nPKCS9String = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], PKCS9String);\nexport { PKCS9String };\nlet Pkcs7PDU = class Pkcs7PDU extends cms.ContentInfo {\n};\nPkcs7PDU = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], Pkcs7PDU);\nexport { Pkcs7PDU };\nlet UserPKCS12 = class UserPKCS12 extends pfx.PFX {\n};\nUserPKCS12 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], UserPKCS12);\nexport { UserPKCS12 };\nlet EncryptedPrivateKeyInfo = class EncryptedPrivateKeyInfo extends pkcs8.EncryptedPrivateKeyInfo {\n};\nEncryptedPrivateKeyInfo = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], EncryptedPrivateKeyInfo);\nexport { EncryptedPrivateKeyInfo };\nlet EmailAddress = class EmailAddress {\n constructor(value = \"\") {\n this.value = value;\n }\n toString() {\n return this.value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.IA5String })\n], EmailAddress.prototype, \"value\", void 0);\nEmailAddress = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], EmailAddress);\nexport { EmailAddress };\nlet UnstructuredName = class UnstructuredName extends PKCS9String {\n};\nUnstructuredName = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], UnstructuredName);\nexport { UnstructuredName };\nlet UnstructuredAddress = class UnstructuredAddress extends x509.DirectoryString {\n};\nUnstructuredAddress = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], UnstructuredAddress);\nexport { UnstructuredAddress };\nlet DateOfBirth = class DateOfBirth {\n constructor(value = new Date()) {\n this.value = value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.GeneralizedTime })\n], DateOfBirth.prototype, \"value\", void 0);\nDateOfBirth = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], DateOfBirth);\nexport { DateOfBirth };\nlet PlaceOfBirth = class PlaceOfBirth extends x509.DirectoryString {\n};\nPlaceOfBirth = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], PlaceOfBirth);\nexport { PlaceOfBirth };\nlet Gender = class Gender {\n constructor(value = \"M\") {\n this.value = value;\n }\n toString() {\n return this.value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.PrintableString })\n], Gender.prototype, \"value\", void 0);\nGender = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], Gender);\nexport { Gender };\nlet CountryOfCitizenship = class CountryOfCitizenship {\n constructor(value = \"\") {\n this.value = value;\n }\n toString() {\n return this.value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.PrintableString })\n], CountryOfCitizenship.prototype, \"value\", void 0);\nCountryOfCitizenship = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], CountryOfCitizenship);\nexport { CountryOfCitizenship };\nlet CountryOfResidence = class CountryOfResidence extends CountryOfCitizenship {\n};\nCountryOfResidence = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], CountryOfResidence);\nexport { CountryOfResidence };\nlet Pseudonym = class Pseudonym extends x509.DirectoryString {\n};\nPseudonym = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], Pseudonym);\nexport { Pseudonym };\nlet ContentType = class ContentType {\n constructor(value = \"\") {\n this.value = value;\n }\n toString() {\n return this.value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.ObjectIdentifier })\n], ContentType.prototype, \"value\", void 0);\nContentType = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], ContentType);\nexport { ContentType };\nexport class MessageDigest extends OctetString {\n}\nlet SigningTime = class SigningTime extends x509.Time {\n};\nSigningTime = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], SigningTime);\nexport { SigningTime };\nexport class RandomNonce extends OctetString {\n}\nlet SequenceNumber = class SequenceNumber {\n constructor(value = 0) {\n this.value = value;\n }\n toString() {\n return this.value.toString();\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], SequenceNumber.prototype, \"value\", void 0);\nSequenceNumber = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], SequenceNumber);\nexport { SequenceNumber };\nlet CounterSignature = class CounterSignature extends cms.SignerInfo {\n};\nCounterSignature = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], CounterSignature);\nexport { CounterSignature };\nlet ChallengePassword = class ChallengePassword extends x509.DirectoryString {\n};\nChallengePassword = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], ChallengePassword);\nexport { ChallengePassword };\nlet ExtensionRequest = ExtensionRequest_1 = class ExtensionRequest extends x509.Extensions {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, ExtensionRequest_1.prototype);\n }\n};\nExtensionRequest = ExtensionRequest_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], ExtensionRequest);\nexport { ExtensionRequest };\nlet ExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = class ExtendedCertificateAttributes extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, ExtendedCertificateAttributes_1.prototype);\n }\n};\nExtendedCertificateAttributes = ExtendedCertificateAttributes_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Set, itemType: cms.Attribute })\n], ExtendedCertificateAttributes);\nexport { ExtendedCertificateAttributes };\nlet FriendlyName = class FriendlyName {\n constructor(value = \"\") {\n this.value = value;\n }\n toString() {\n return this.value;\n }\n};\n__decorate([\n AsnProp({ type: AsnPropTypes.BmpString })\n], FriendlyName.prototype, \"value\", void 0);\nFriendlyName = __decorate([\n AsnType({ type: AsnTypeTypes.Choice })\n], FriendlyName);\nexport { FriendlyName };\nexport class LocalKeyId extends OctetString {\n}\nexport class SigningDescription extends x509.DirectoryString {\n}\nlet SMIMECapability = class SMIMECapability extends x509.AlgorithmIdentifier {\n};\nSMIMECapability = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence })\n], SMIMECapability);\nexport { SMIMECapability };\nlet SMIMECapabilities = SMIMECapabilities_1 = class SMIMECapabilities extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, SMIMECapabilities_1.prototype);\n }\n};\nSMIMECapabilities = SMIMECapabilities_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: SMIMECapability })\n], SMIMECapabilities);\nexport { SMIMECapabilities };\n","var Attributes_1;\nimport { __decorate } from \"tslib\";\nimport { AsnArray, AsnType, AsnTypeTypes } from \"@peculiar/asn1-schema\";\nimport { Attribute } from \"@peculiar/asn1-x509\";\nlet Attributes = Attributes_1 = class Attributes extends AsnArray {\n constructor(items) {\n super(items);\n Object.setPrototypeOf(this, Attributes_1.prototype);\n }\n};\nAttributes = Attributes_1 = __decorate([\n AsnType({ type: AsnTypeTypes.Sequence, itemType: Attribute })\n], Attributes);\nexport { Attributes };\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { Name, SubjectPublicKeyInfo } from \"@peculiar/asn1-x509\";\nimport { Attributes } from \"./attributes\";\nexport class CertificationRequestInfo {\n constructor(params = {}) {\n this.version = 0;\n this.subject = new Name();\n this.subjectPKInfo = new SubjectPublicKeyInfo();\n this.attributes = new Attributes();\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: AsnPropTypes.Integer })\n], CertificationRequestInfo.prototype, \"version\", void 0);\n__decorate([\n AsnProp({ type: Name })\n], CertificationRequestInfo.prototype, \"subject\", void 0);\n__decorate([\n AsnProp({ type: SubjectPublicKeyInfo })\n], CertificationRequestInfo.prototype, \"subjectPKInfo\", void 0);\n__decorate([\n AsnProp({ type: Attributes, implicit: true, context: 0, optional: true })\n], CertificationRequestInfo.prototype, \"attributes\", void 0);\n","import { __decorate } from \"tslib\";\nimport { AsnProp, AsnPropTypes } from \"@peculiar/asn1-schema\";\nimport { CertificationRequestInfo } from \"./certification_request_info\";\nimport { AlgorithmIdentifier } from \"@peculiar/asn1-x509\";\nexport class CertificationRequest {\n constructor(params = {}) {\n this.certificationRequestInfo = new CertificationRequestInfo();\n this.signatureAlgorithm = new AlgorithmIdentifier();\n this.signature = new ArrayBuffer(0);\n Object.assign(this, params);\n }\n}\n__decorate([\n AsnProp({ type: CertificationRequestInfo, raw: true })\n], CertificationRequest.prototype, \"certificationRequestInfo\", void 0);\n__decorate([\n AsnProp({ type: AlgorithmIdentifier })\n], CertificationRequest.prototype, \"signatureAlgorithm\", void 0);\n__decorate([\n AsnProp({ type: AsnPropTypes.BitString })\n], CertificationRequest.prototype, \"signature\", void 0);\n","/*!\n * MIT License\n * \n * Copyright (c) Peculiar Ventures. All rights reserved.\n * \n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n * \n */\nimport 'reflect-metadata';\nimport { AsnConvert, OctetString, AsnUtf8StringConverter } from '@peculiar/asn1-schema';\nimport * as asn1X509 from '@peculiar/asn1-x509';\nimport { AlgorithmIdentifier, Extension as Extension$1, Name as Name$1, RelativeDistinguishedName, AttributeTypeAndValue, SubjectPublicKeyInfo, BasicConstraints, id_ce_basicConstraints, KeyUsage, id_ce_keyUsage, Attribute as Attribute$1, Version, Extensions, Certificate, RevokedCertificate, Time, id_ce_invalidityDate, InvalidityDate, id_ce_cRLReasons, CRLReason, CertificateList } from '@peculiar/asn1-x509';\nimport { BufferSourceConverter, isEqual, Convert, combine } from 'pvtsutils';\nimport * as asn1Cms from '@peculiar/asn1-cms';\nimport * as asn1Ecc from '@peculiar/asn1-ecc';\nimport { id_ecPublicKey, ECDSASigValue } from '@peculiar/asn1-ecc';\nimport * as asn1Rsa from '@peculiar/asn1-rsa';\nimport { id_RSASSA_PSS, id_rsaEncryption, RSAPublicKey, id_sha512, id_sha384, id_sha256, id_sha1 } from '@peculiar/asn1-rsa';\nimport { __decorate } from 'tslib';\nimport { container, injectable } from 'tsyringe';\nimport * as asnPkcs9 from '@peculiar/asn1-pkcs9';\nimport { id_pkcs9_at_extensionRequest } from '@peculiar/asn1-pkcs9';\nimport { CertificationRequest, CertificationRequestInfo } from '@peculiar/asn1-csr';\n\nconst diAlgorithm = \"crypto.algorithm\";\nclass AlgorithmProvider {\n getAlgorithms() {\n return container.resolveAll(diAlgorithm);\n }\n toAsnAlgorithm(alg) {\n ({ ...alg });\n for (const algorithm of this.getAlgorithms()) {\n const res = algorithm.toAsnAlgorithm(alg);\n if (res) {\n return res;\n }\n }\n if (/^[0-9.]+$/.test(alg.name)) {\n const res = new AlgorithmIdentifier({\n algorithm: alg.name,\n });\n if (\"parameters\" in alg) {\n const unknown = alg;\n res.parameters = unknown.parameters;\n }\n return res;\n }\n throw new Error(\"Cannot convert WebCrypto algorithm to ASN.1 algorithm\");\n }\n toWebAlgorithm(alg) {\n for (const algorithm of this.getAlgorithms()) {\n const res = algorithm.toWebAlgorithm(alg);\n if (res) {\n return res;\n }\n }\n const unknown = {\n name: alg.algorithm,\n parameters: alg.parameters,\n };\n return unknown;\n }\n}\nconst diAlgorithmProvider = \"crypto.algorithmProvider\";\ncontainer.registerSingleton(diAlgorithmProvider, AlgorithmProvider);\n\nvar EcAlgorithm_1;\nconst idVersionOne = \"1.3.36.3.3.2.8.1.1\";\nconst idBrainpoolP160r1 = `${idVersionOne}.1`;\nconst idBrainpoolP160t1 = `${idVersionOne}.2`;\nconst idBrainpoolP192r1 = `${idVersionOne}.3`;\nconst idBrainpoolP192t1 = `${idVersionOne}.4`;\nconst idBrainpoolP224r1 = `${idVersionOne}.5`;\nconst idBrainpoolP224t1 = `${idVersionOne}.6`;\nconst idBrainpoolP256r1 = `${idVersionOne}.7`;\nconst idBrainpoolP256t1 = `${idVersionOne}.8`;\nconst idBrainpoolP320r1 = `${idVersionOne}.9`;\nconst idBrainpoolP320t1 = `${idVersionOne}.10`;\nconst idBrainpoolP384r1 = `${idVersionOne}.11`;\nconst idBrainpoolP384t1 = `${idVersionOne}.12`;\nconst idBrainpoolP512r1 = `${idVersionOne}.13`;\nconst idBrainpoolP512t1 = `${idVersionOne}.14`;\nconst brainpoolP160r1 = \"brainpoolP160r1\";\nconst brainpoolP160t1 = \"brainpoolP160t1\";\nconst brainpoolP192r1 = \"brainpoolP192r1\";\nconst brainpoolP192t1 = \"brainpoolP192t1\";\nconst brainpoolP224r1 = \"brainpoolP224r1\";\nconst brainpoolP224t1 = \"brainpoolP224t1\";\nconst brainpoolP256r1 = \"brainpoolP256r1\";\nconst brainpoolP256t1 = \"brainpoolP256t1\";\nconst brainpoolP320r1 = \"brainpoolP320r1\";\nconst brainpoolP320t1 = \"brainpoolP320t1\";\nconst brainpoolP384r1 = \"brainpoolP384r1\";\nconst brainpoolP384t1 = \"brainpoolP384t1\";\nconst brainpoolP512r1 = \"brainpoolP512r1\";\nconst brainpoolP512t1 = \"brainpoolP512t1\";\nconst ECDSA = \"ECDSA\";\nlet EcAlgorithm = EcAlgorithm_1 = class EcAlgorithm {\n toAsnAlgorithm(alg) {\n switch (alg.name.toLowerCase()) {\n case ECDSA.toLowerCase():\n if (\"hash\" in alg) {\n const hash = typeof alg.hash === \"string\" ? alg.hash : alg.hash.name;\n switch (hash.toLowerCase()) {\n case \"sha-1\":\n return asn1Ecc.ecdsaWithSHA1;\n case \"sha-256\":\n return asn1Ecc.ecdsaWithSHA256;\n case \"sha-384\":\n return asn1Ecc.ecdsaWithSHA384;\n case \"sha-512\":\n return asn1Ecc.ecdsaWithSHA512;\n }\n }\n else if (\"namedCurve\" in alg) {\n let parameters = \"\";\n switch (alg.namedCurve) {\n case \"P-256\":\n parameters = asn1Ecc.id_secp256r1;\n break;\n case \"K-256\":\n parameters = EcAlgorithm_1.SECP256K1;\n break;\n case \"P-384\":\n parameters = asn1Ecc.id_secp384r1;\n break;\n case \"P-521\":\n parameters = asn1Ecc.id_secp521r1;\n break;\n case brainpoolP160r1:\n parameters = idBrainpoolP160r1;\n break;\n case brainpoolP160t1:\n parameters = idBrainpoolP160t1;\n break;\n case brainpoolP192r1:\n parameters = idBrainpoolP192r1;\n break;\n case brainpoolP192t1:\n parameters = idBrainpoolP192t1;\n break;\n case brainpoolP224r1:\n parameters = idBrainpoolP224r1;\n break;\n case brainpoolP224t1:\n parameters = idBrainpoolP224t1;\n break;\n case brainpoolP256r1:\n parameters = idBrainpoolP256r1;\n break;\n case brainpoolP256t1:\n parameters = idBrainpoolP256t1;\n break;\n case brainpoolP320r1:\n parameters = idBrainpoolP320r1;\n break;\n case brainpoolP320t1:\n parameters = idBrainpoolP320t1;\n break;\n case brainpoolP384r1:\n parameters = idBrainpoolP384r1;\n break;\n case brainpoolP384t1:\n parameters = idBrainpoolP384t1;\n break;\n case brainpoolP512r1:\n parameters = idBrainpoolP512r1;\n break;\n case brainpoolP512t1:\n parameters = idBrainpoolP512t1;\n break;\n }\n if (parameters) {\n return new AlgorithmIdentifier({\n algorithm: asn1Ecc.id_ecPublicKey,\n parameters: AsnConvert.serialize(new asn1Ecc.ECParameters({ namedCurve: parameters })),\n });\n }\n }\n }\n return null;\n }\n toWebAlgorithm(alg) {\n switch (alg.algorithm) {\n case asn1Ecc.id_ecdsaWithSHA1:\n return { name: ECDSA, hash: { name: \"SHA-1\" } };\n case asn1Ecc.id_ecdsaWithSHA256:\n return { name: ECDSA, hash: { name: \"SHA-256\" } };\n case asn1Ecc.id_ecdsaWithSHA384:\n return { name: ECDSA, hash: { name: \"SHA-384\" } };\n case asn1Ecc.id_ecdsaWithSHA512:\n return { name: ECDSA, hash: { name: \"SHA-512\" } };\n case asn1Ecc.id_ecPublicKey: {\n if (!alg.parameters) {\n throw new TypeError(\"Cannot get required parameters from EC algorithm\");\n }\n const parameters = AsnConvert.parse(alg.parameters, asn1Ecc.ECParameters);\n switch (parameters.namedCurve) {\n case asn1Ecc.id_secp256r1:\n return { name: ECDSA, namedCurve: \"P-256\" };\n case EcAlgorithm_1.SECP256K1:\n return { name: ECDSA, namedCurve: \"K-256\" };\n case asn1Ecc.id_secp384r1:\n return { name: ECDSA, namedCurve: \"P-384\" };\n case asn1Ecc.id_secp521r1:\n return { name: ECDSA, namedCurve: \"P-521\" };\n case idBrainpoolP160r1:\n return { name: ECDSA, namedCurve: brainpoolP160r1 };\n case idBrainpoolP160t1:\n return { name: ECDSA, namedCurve: brainpoolP160t1 };\n case idBrainpoolP192r1:\n return { name: ECDSA, namedCurve: brainpoolP192r1 };\n case idBrainpoolP192t1:\n return { name: ECDSA, namedCurve: brainpoolP192t1 };\n case idBrainpoolP224r1:\n return { name: ECDSA, namedCurve: brainpoolP224r1 };\n case idBrainpoolP224t1:\n return { name: ECDSA, namedCurve: brainpoolP224t1 };\n case idBrainpoolP256r1:\n return { name: ECDSA, namedCurve: brainpoolP256r1 };\n case idBrainpoolP256t1:\n return { name: ECDSA, namedCurve: brainpoolP256t1 };\n case idBrainpoolP320r1:\n return { name: ECDSA, namedCurve: brainpoolP320r1 };\n case idBrainpoolP320t1:\n return { name: ECDSA, namedCurve: brainpoolP320t1 };\n case idBrainpoolP384r1:\n return { name: ECDSA, namedCurve: brainpoolP384r1 };\n case idBrainpoolP384t1:\n return { name: ECDSA, namedCurve: brainpoolP384t1 };\n case idBrainpoolP512r1:\n return { name: ECDSA, namedCurve: brainpoolP512r1 };\n case idBrainpoolP512t1:\n return { name: ECDSA, namedCurve: brainpoolP512t1 };\n }\n }\n }\n return null;\n }\n};\nEcAlgorithm.SECP256K1 = \"1.3.132.0.10\";\nEcAlgorithm = EcAlgorithm_1 = __decorate([\n injectable()\n], EcAlgorithm);\ncontainer.registerSingleton(diAlgorithm, EcAlgorithm);\n\nconst NAME = Symbol(\"name\");\nconst VALUE = Symbol(\"value\");\nclass TextObject {\n constructor(name, items = {}, value = \"\") {\n this[NAME] = name;\n this[VALUE] = value;\n for (const key in items) {\n this[key] = items[key];\n }\n }\n}\nTextObject.NAME = NAME;\nTextObject.VALUE = VALUE;\nclass DefaultAlgorithmSerializer {\n static toTextObject(alg) {\n const obj = new TextObject(\"Algorithm Identifier\", {}, OidSerializer.toString(alg.algorithm));\n if (alg.parameters) {\n switch (alg.algorithm) {\n case asn1Ecc.id_ecPublicKey: {\n const ecAlg = new EcAlgorithm().toWebAlgorithm(alg);\n if (ecAlg && \"namedCurve\" in ecAlg) {\n obj[\"Named Curve\"] = ecAlg.namedCurve;\n }\n else {\n obj[\"Parameters\"] = alg.parameters;\n }\n break;\n }\n default:\n obj[\"Parameters\"] = alg.parameters;\n }\n }\n return obj;\n }\n}\nclass OidSerializer {\n static toString(oid) {\n const name = this.items[oid];\n if (name) {\n return name;\n }\n return oid;\n }\n}\nOidSerializer.items = {\n [asn1Rsa.id_sha1]: \"sha1\",\n [asn1Rsa.id_sha224]: \"sha224\",\n [asn1Rsa.id_sha256]: \"sha256\",\n [asn1Rsa.id_sha384]: \"sha384\",\n [asn1Rsa.id_sha512]: \"sha512\",\n [asn1Rsa.id_rsaEncryption]: \"rsaEncryption\",\n [asn1Rsa.id_sha1WithRSAEncryption]: \"sha1WithRSAEncryption\",\n [asn1Rsa.id_sha224WithRSAEncryption]: \"sha224WithRSAEncryption\",\n [asn1Rsa.id_sha256WithRSAEncryption]: \"sha256WithRSAEncryption\",\n [asn1Rsa.id_sha384WithRSAEncryption]: \"sha384WithRSAEncryption\",\n [asn1Rsa.id_sha512WithRSAEncryption]: \"sha512WithRSAEncryption\",\n [asn1Ecc.id_ecPublicKey]: \"ecPublicKey\",\n [asn1Ecc.id_ecdsaWithSHA1]: \"ecdsaWithSHA1\",\n [asn1Ecc.id_ecdsaWithSHA224]: \"ecdsaWithSHA224\",\n [asn1Ecc.id_ecdsaWithSHA256]: \"ecdsaWithSHA256\",\n [asn1Ecc.id_ecdsaWithSHA384]: \"ecdsaWithSHA384\",\n [asn1Ecc.id_ecdsaWithSHA512]: \"ecdsaWithSHA512\",\n [asn1X509.id_kp_serverAuth]: \"TLS WWW server authentication\",\n [asn1X509.id_kp_clientAuth]: \"TLS WWW client authentication\",\n [asn1X509.id_kp_codeSigning]: \"Code Signing\",\n [asn1X509.id_kp_emailProtection]: \"E-mail Protection\",\n [asn1X509.id_kp_timeStamping]: \"Time Stamping\",\n [asn1X509.id_kp_OCSPSigning]: \"OCSP Signing\",\n [asn1Cms.id_signedData]: \"Signed Data\",\n};\nclass TextConverter {\n static serialize(obj) {\n return this.serializeObj(obj).join(\"\\n\");\n }\n static pad(deep = 0) {\n return \"\".padStart(2 * deep, \" \");\n }\n static serializeObj(obj, deep = 0) {\n const res = [];\n let pad = this.pad(deep++);\n let value = \"\";\n const objValue = obj[TextObject.VALUE];\n if (objValue) {\n value = ` ${objValue}`;\n }\n res.push(`${pad}${obj[TextObject.NAME]}:${value}`);\n pad = this.pad(deep);\n for (const key in obj) {\n if (typeof key === \"symbol\") {\n continue;\n }\n const value = obj[key];\n const keyValue = key ? `${key}: ` : \"\";\n if (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"boolean\") {\n res.push(`${pad}${keyValue}${value}`);\n }\n else if (value instanceof Date) {\n res.push(`${pad}${keyValue}${value.toUTCString()}`);\n }\n else if (Array.isArray(value)) {\n for (const obj of value) {\n obj[TextObject.NAME] = key;\n res.push(...this.serializeObj(obj, deep));\n }\n }\n else if (value instanceof TextObject) {\n value[TextObject.NAME] = key;\n res.push(...this.serializeObj(value, deep));\n }\n else if (BufferSourceConverter.isBufferSource(value)) {\n if (key) {\n res.push(`${pad}${keyValue}`);\n res.push(...this.serializeBufferSource(value, deep + 1));\n }\n else {\n res.push(...this.serializeBufferSource(value, deep));\n }\n }\n else if (\"toTextObject\" in value) {\n const obj = value.toTextObject();\n obj[TextObject.NAME] = key;\n res.push(...this.serializeObj(obj, deep));\n }\n else {\n throw new TypeError(\"Cannot serialize data in text format. Unsupported type.\");\n }\n }\n return res;\n }\n static serializeBufferSource(buffer, deep = 0) {\n const pad = this.pad(deep);\n const view = BufferSourceConverter.toUint8Array(buffer);\n const res = [];\n for (let i = 0; i < view.length;) {\n const row = [];\n for (let j = 0; j < 16 && i < view.length; j++) {\n if (j === 8) {\n row.push(\"\");\n }\n const hex = view[i++].toString(16).padStart(2, \"0\");\n row.push(hex);\n }\n res.push(`${pad}${row.join(\" \")}`);\n }\n return res;\n }\n static serializeAlgorithm(alg) {\n return this.algorithmSerializer.toTextObject(alg);\n }\n}\nTextConverter.oidSerializer = OidSerializer;\nTextConverter.algorithmSerializer = DefaultAlgorithmSerializer;\n\nclass AsnData {\n constructor(...args) {\n if (args.length === 1) {\n const asn = args[0];\n this.rawData = AsnConvert.serialize(asn);\n this.onInit(asn);\n }\n else {\n const asn = AsnConvert.parse(args[0], args[1]);\n this.rawData = BufferSourceConverter.toArrayBuffer(args[0]);\n this.onInit(asn);\n }\n }\n equal(data) {\n if (data instanceof AsnData) {\n return isEqual(data.rawData, this.rawData);\n }\n return false;\n }\n toString(format = \"text\") {\n switch (format) {\n case \"asn\":\n return AsnConvert.toString(this.rawData);\n case \"text\":\n return TextConverter.serialize(this.toTextObject());\n case \"hex\":\n return Convert.ToHex(this.rawData);\n case \"base64\":\n return Convert.ToBase64(this.rawData);\n case \"base64url\":\n return Convert.ToBase64Url(this.rawData);\n default:\n throw TypeError(\"Argument 'format' is unsupported value\");\n }\n }\n getTextName() {\n const constructor = this.constructor;\n return constructor.NAME;\n }\n toTextObject() {\n const obj = this.toTextObjectEmpty();\n obj[\"\"] = this.rawData;\n return obj;\n }\n toTextObjectEmpty(value) {\n return new TextObject(this.getTextName(), {}, value);\n }\n}\nAsnData.NAME = \"ASN\";\n\nclass Extension extends AsnData {\n constructor(...args) {\n let raw;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n raw = BufferSourceConverter.toArrayBuffer(args[0]);\n }\n else {\n raw = AsnConvert.serialize(new Extension$1({\n extnID: args[0],\n critical: args[1],\n extnValue: new OctetString(BufferSourceConverter.toArrayBuffer(args[2])),\n }));\n }\n super(raw, Extension$1);\n }\n onInit(asn) {\n this.type = asn.extnID;\n this.critical = asn.critical;\n this.value = asn.extnValue.buffer;\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[\"\"] = this.value;\n return obj;\n }\n toTextObjectWithoutValue() {\n const obj = this.toTextObjectEmpty(this.critical ? \"critical\" : undefined);\n if (obj[TextObject.NAME] === Extension.NAME) {\n obj[TextObject.NAME] = OidSerializer.toString(this.type);\n }\n return obj;\n }\n}\n\nvar _a;\nclass CryptoProvider {\n static isCryptoKeyPair(data) {\n return data && data.privateKey && data.publicKey;\n }\n static isCryptoKey(data) {\n return data && data.usages && data.type && data.algorithm && data.extractable !== undefined;\n }\n constructor() {\n this.items = new Map();\n this[_a] = \"CryptoProvider\";\n if (typeof self !== \"undefined\" && typeof crypto !== \"undefined\") {\n this.set(CryptoProvider.DEFAULT, crypto);\n }\n else if (typeof global !== \"undefined\" && global.crypto && global.crypto.subtle) {\n this.set(CryptoProvider.DEFAULT, global.crypto);\n }\n }\n clear() {\n this.items.clear();\n }\n delete(key) {\n return this.items.delete(key);\n }\n forEach(callbackfn, thisArg) {\n return this.items.forEach(callbackfn, thisArg);\n }\n has(key) {\n return this.items.has(key);\n }\n get size() {\n return this.items.size;\n }\n entries() {\n return this.items.entries();\n }\n keys() {\n return this.items.keys();\n }\n values() {\n return this.items.values();\n }\n [Symbol.iterator]() {\n return this.items[Symbol.iterator]();\n }\n get(key = CryptoProvider.DEFAULT) {\n const crypto = this.items.get(key.toLowerCase());\n if (!crypto) {\n throw new Error(`Cannot get Crypto by name '${key}'`);\n }\n return crypto;\n }\n set(key, value) {\n if (typeof key === \"string\") {\n if (!value) {\n throw new TypeError(\"Argument 'value' is required\");\n }\n this.items.set(key.toLowerCase(), value);\n }\n else {\n this.items.set(CryptoProvider.DEFAULT, key);\n }\n return this;\n }\n}\n_a = Symbol.toStringTag;\nCryptoProvider.DEFAULT = \"default\";\nconst cryptoProvider = new CryptoProvider();\n\nconst OID_REGEX = /^[0-2](?:\\.[1-9][0-9]*)+$/;\nfunction isOID(id) {\n return new RegExp(OID_REGEX).test(id);\n}\nclass NameIdentifier {\n constructor(names = {}) {\n this.items = {};\n for (const id in names) {\n this.register(id, names[id]);\n }\n }\n get(idOrName) {\n return this.items[idOrName] || null;\n }\n findId(idOrName) {\n if (!isOID(idOrName)) {\n return this.get(idOrName);\n }\n return idOrName;\n }\n register(id, name) {\n this.items[id] = name;\n this.items[name] = id;\n }\n}\nconst names = new NameIdentifier();\nnames.register(\"CN\", \"2.5.4.3\");\nnames.register(\"L\", \"2.5.4.7\");\nnames.register(\"ST\", \"2.5.4.8\");\nnames.register(\"O\", \"2.5.4.10\");\nnames.register(\"OU\", \"2.5.4.11\");\nnames.register(\"C\", \"2.5.4.6\");\nnames.register(\"DC\", \"0.9.2342.19200300.100.1.25\");\nnames.register(\"E\", \"1.2.840.113549.1.9.1\");\nnames.register(\"G\", \"2.5.4.42\");\nnames.register(\"I\", \"2.5.4.43\");\nnames.register(\"SN\", \"2.5.4.4\");\nnames.register(\"T\", \"2.5.4.12\");\nfunction replaceUnknownCharacter(text, char) {\n return `\\\\${Convert.ToHex(Convert.FromUtf8String(char)).toUpperCase()}`;\n}\nfunction escape(data) {\n return data\n .replace(/([,+\"\\\\<>;])/g, \"\\\\$1\")\n .replace(/^([ #])/, \"\\\\$1\")\n .replace(/([ ]$)/, \"\\\\$1\")\n .replace(/([\\r\\n\\t])/, replaceUnknownCharacter);\n}\nclass Name {\n static isASCII(text) {\n for (let i = 0; i < text.length; i++) {\n const code = text.charCodeAt(i);\n if (code > 0xFF) {\n return false;\n }\n }\n return true;\n }\n static isPrintableString(text) {\n return /^[A-Za-z0-9 '()+,-./:=?]*$/g.test(text);\n }\n constructor(data, extraNames = {}) {\n this.extraNames = new NameIdentifier();\n this.asn = new Name$1();\n for (const key in extraNames) {\n if (Object.prototype.hasOwnProperty.call(extraNames, key)) {\n const value = extraNames[key];\n this.extraNames.register(key, value);\n }\n }\n if (typeof data === \"string\") {\n this.asn = this.fromString(data);\n }\n else if (data instanceof Name$1) {\n this.asn = data;\n }\n else if (BufferSourceConverter.isBufferSource(data)) {\n this.asn = AsnConvert.parse(data, Name$1);\n }\n else {\n this.asn = this.fromJSON(data);\n }\n }\n getField(idOrName) {\n const id = this.extraNames.findId(idOrName) || names.findId(idOrName);\n const res = [];\n for (const name of this.asn) {\n for (const rdn of name) {\n if (rdn.type === id) {\n res.push(rdn.value.toString());\n }\n }\n }\n return res;\n }\n getName(idOrName) {\n return this.extraNames.get(idOrName) || names.get(idOrName);\n }\n toString() {\n return this.asn.map(rdn => rdn.map(o => {\n const type = this.getName(o.type) || o.type;\n const value = o.value.anyValue\n ? `#${Convert.ToHex(o.value.anyValue)}`\n : escape(o.value.toString());\n return `${type}=${value}`;\n })\n .join(\"+\"))\n .join(\", \");\n }\n toJSON() {\n var _a;\n const json = [];\n for (const rdn of this.asn) {\n const jsonItem = {};\n for (const attr of rdn) {\n const type = this.getName(attr.type) || attr.type;\n (_a = jsonItem[type]) !== null && _a !== void 0 ? _a : (jsonItem[type] = []);\n jsonItem[type].push(attr.value.anyValue ? `#${Convert.ToHex(attr.value.anyValue)}` : attr.value.toString());\n }\n json.push(jsonItem);\n }\n return json;\n }\n fromString(data) {\n const asn = new Name$1();\n const regex = /(\\d\\.[\\d.]*\\d|[A-Za-z]+)=((?:\"\")|(?:\".*?[^\\\\]\")|(?:[^,+].*?(?:[^\\\\][,+]))|(?:))([,+])?/g;\n let matches = null;\n let level = \",\";\n while (matches = regex.exec(`${data},`)) {\n let [, type, value] = matches;\n const lastChar = value[value.length - 1];\n if (lastChar === \",\" || lastChar === \"+\") {\n value = value.slice(0, value.length - 1);\n matches[3] = lastChar;\n }\n const next = matches[3];\n type = this.getTypeOid(type);\n const attr = this.createAttribute(type, value);\n if (level === \"+\") {\n asn[asn.length - 1].push(attr);\n }\n else {\n asn.push(new RelativeDistinguishedName([attr]));\n }\n level = next;\n }\n return asn;\n }\n fromJSON(data) {\n const asn = new Name$1();\n for (const item of data) {\n const asnRdn = new RelativeDistinguishedName();\n for (const type in item) {\n const typeId = this.getTypeOid(type);\n const values = item[type];\n for (const value of values) {\n const asnAttr = this.createAttribute(typeId, value);\n asnRdn.push(asnAttr);\n }\n }\n asn.push(asnRdn);\n }\n return asn;\n }\n getTypeOid(type) {\n if (!/[\\d.]+/.test(type)) {\n type = this.getName(type) || \"\";\n }\n if (!type) {\n throw new Error(`Cannot get OID for name type '${type}'`);\n }\n return type;\n }\n createAttribute(type, value) {\n const attr = new AttributeTypeAndValue({ type });\n if (typeof value === \"object\") {\n for (const key in value) {\n switch (key) {\n case \"ia5String\":\n attr.value.ia5String = value[key];\n break;\n case \"utf8String\":\n attr.value.utf8String = value[key];\n break;\n case \"universalString\":\n attr.value.universalString = value[key];\n break;\n case \"bmpString\":\n attr.value.bmpString = value[key];\n break;\n case \"printableString\":\n attr.value.printableString = value[key];\n break;\n }\n }\n }\n else if (value[0] === \"#\") {\n attr.value.anyValue = Convert.FromHex(value.slice(1));\n }\n else {\n const processedValue = this.processStringValue(value);\n if (type === this.getName(\"E\") || type === this.getName(\"DC\")) {\n attr.value.ia5String = processedValue;\n }\n else {\n if (Name.isPrintableString(processedValue)) {\n attr.value.printableString = processedValue;\n }\n else {\n attr.value.utf8String = processedValue;\n }\n }\n }\n return attr;\n }\n processStringValue(value) {\n const quotedMatches = /\"(.*?[^\\\\])?\"/.exec(value);\n if (quotedMatches) {\n value = quotedMatches[1];\n }\n return value\n .replace(/\\\\0a/ig, \"\\n\")\n .replace(/\\\\0d/ig, \"\\r\")\n .replace(/\\\\0g/ig, \"\\t\")\n .replace(/\\\\(.)/g, \"$1\");\n }\n toArrayBuffer() {\n return AsnConvert.serialize(this.asn);\n }\n async getThumbprint(...args) {\n var _a;\n let crypto;\n let algorithm = \"SHA-1\";\n if (args.length >= 1 && !((_a = args[0]) === null || _a === void 0 ? void 0 : _a.subtle)) {\n algorithm = args[0] || algorithm;\n crypto = args[1] || cryptoProvider.get();\n }\n else {\n crypto = args[0] || cryptoProvider.get();\n }\n return await crypto.subtle.digest(algorithm, this.toArrayBuffer());\n }\n}\n\nconst ERR_GN_CONSTRUCTOR = \"Cannot initialize GeneralName from ASN.1 data.\";\nconst ERR_GN_STRING_FORMAT = `${ERR_GN_CONSTRUCTOR} Unsupported string format in use.`;\nconst ERR_GUID = `${ERR_GN_CONSTRUCTOR} Value doesn't match to GUID regular expression.`;\nconst GUID_REGEX = /^([0-9a-f]{8})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{4})-?([0-9a-f]{12})$/i;\nconst id_GUID = \"1.3.6.1.4.1.311.25.1\";\nconst id_UPN = \"1.3.6.1.4.1.311.20.2.3\";\nconst DNS = \"dns\";\nconst DN = \"dn\";\nconst EMAIL = \"email\";\nconst IP = \"ip\";\nconst URL = \"url\";\nconst GUID = \"guid\";\nconst UPN = \"upn\";\nconst REGISTERED_ID = \"id\";\nclass GeneralName extends AsnData {\n constructor(...args) {\n let name;\n if (args.length === 2) {\n switch (args[0]) {\n case DN: {\n const derName = new Name(args[1]).toArrayBuffer();\n const asnName = AsnConvert.parse(derName, asn1X509.Name);\n name = new asn1X509.GeneralName({ directoryName: asnName });\n break;\n }\n case DNS:\n name = new asn1X509.GeneralName({ dNSName: args[1] });\n break;\n case EMAIL:\n name = new asn1X509.GeneralName({ rfc822Name: args[1] });\n break;\n case GUID: {\n const matches = new RegExp(GUID_REGEX, \"i\").exec(args[1]);\n if (!matches) {\n throw new Error(\"Cannot parse GUID value. Value doesn't match to regular expression\");\n }\n const hex = matches\n .slice(1)\n .map((o, i) => {\n if (i < 3) {\n return Convert.ToHex(new Uint8Array(Convert.FromHex(o)).reverse());\n }\n return o;\n })\n .join(\"\");\n name = new asn1X509.GeneralName({\n otherName: new asn1X509.OtherName({\n typeId: id_GUID,\n value: AsnConvert.serialize(new OctetString(Convert.FromHex(hex))),\n }),\n });\n break;\n }\n case IP:\n name = new asn1X509.GeneralName({ iPAddress: args[1] });\n break;\n case REGISTERED_ID:\n name = new asn1X509.GeneralName({ registeredID: args[1] });\n break;\n case UPN: {\n name = new asn1X509.GeneralName({\n otherName: new asn1X509.OtherName({\n typeId: id_UPN,\n value: AsnConvert.serialize(AsnUtf8StringConverter.toASN(args[1])),\n })\n });\n break;\n }\n case URL:\n name = new asn1X509.GeneralName({ uniformResourceIdentifier: args[1] });\n break;\n default:\n throw new Error(\"Cannot create GeneralName. Unsupported type of the name\");\n }\n }\n else if (BufferSourceConverter.isBufferSource(args[0])) {\n name = AsnConvert.parse(args[0], asn1X509.GeneralName);\n }\n else {\n name = args[0];\n }\n super(name);\n }\n onInit(asn) {\n if (asn.dNSName != undefined) {\n this.type = DNS;\n this.value = asn.dNSName;\n }\n else if (asn.rfc822Name != undefined) {\n this.type = EMAIL;\n this.value = asn.rfc822Name;\n }\n else if (asn.iPAddress != undefined) {\n this.type = IP;\n this.value = asn.iPAddress;\n }\n else if (asn.uniformResourceIdentifier != undefined) {\n this.type = URL;\n this.value = asn.uniformResourceIdentifier;\n }\n else if (asn.registeredID != undefined) {\n this.type = REGISTERED_ID;\n this.value = asn.registeredID;\n }\n else if (asn.directoryName != undefined) {\n this.type = DN;\n this.value = new Name(asn.directoryName).toString();\n }\n else if (asn.otherName != undefined) {\n if (asn.otherName.typeId === id_GUID) {\n this.type = GUID;\n const guid = AsnConvert.parse(asn.otherName.value, OctetString);\n const matches = new RegExp(GUID_REGEX, \"i\").exec(Convert.ToHex(guid));\n if (!matches) {\n throw new Error(ERR_GUID);\n }\n this.value = matches\n .slice(1)\n .map((o, i) => {\n if (i < 3) {\n return Convert.ToHex(new Uint8Array(Convert.FromHex(o)).reverse());\n }\n return o;\n })\n .join(\"-\");\n }\n else if (asn.otherName.typeId === id_UPN) {\n this.type = UPN;\n this.value = AsnConvert.parse(asn.otherName.value, asn1X509.DirectoryString).toString();\n }\n else {\n throw new Error(ERR_GN_STRING_FORMAT);\n }\n }\n else {\n throw new Error(ERR_GN_STRING_FORMAT);\n }\n }\n toJSON() {\n return {\n type: this.type,\n value: this.value,\n };\n }\n toTextObject() {\n let type;\n switch (this.type) {\n case DN:\n case DNS:\n case GUID:\n case IP:\n case REGISTERED_ID:\n case UPN:\n case URL:\n type = this.type.toUpperCase();\n break;\n case EMAIL:\n type = \"Email\";\n break;\n default:\n throw new Error(\"Unsupported GeneralName type\");\n }\n let value = this.value;\n if (this.type === REGISTERED_ID) {\n value = OidSerializer.toString(value);\n }\n return new TextObject(type, undefined, value);\n }\n}\nclass GeneralNames extends AsnData {\n constructor(params) {\n let names;\n if (params instanceof asn1X509.GeneralNames) {\n names = params;\n }\n else if (Array.isArray(params)) {\n const items = [];\n for (const name of params) {\n if (name instanceof asn1X509.GeneralName) {\n items.push(name);\n }\n else {\n const asnName = AsnConvert.parse(new GeneralName(name.type, name.value).rawData, asn1X509.GeneralName);\n items.push(asnName);\n }\n }\n names = new asn1X509.GeneralNames(items);\n }\n else if (BufferSourceConverter.isBufferSource(params)) {\n names = AsnConvert.parse(params, asn1X509.GeneralNames);\n }\n else {\n throw new Error(\"Cannot initialize GeneralNames. Incorrect incoming arguments\");\n }\n super(names);\n }\n onInit(asn) {\n const items = [];\n for (const asnName of asn) {\n let name = null;\n try {\n name = new GeneralName(asnName);\n }\n catch {\n continue;\n }\n items.push(name);\n }\n this.items = items;\n }\n toJSON() {\n return this.items.map(o => o.toJSON());\n }\n toTextObject() {\n const res = super.toTextObjectEmpty();\n for (const name of this.items) {\n const nameObj = name.toTextObject();\n let field = res[nameObj[TextObject.NAME]];\n if (!Array.isArray(field)) {\n field = [];\n res[nameObj[TextObject.NAME]] = field;\n }\n field.push(nameObj);\n }\n return res;\n }\n}\nGeneralNames.NAME = \"GeneralNames\";\n\nconst rPaddingTag = \"-{5}\";\nconst rEolChars = \"\\\\n\";\nconst rNameTag = `[^${rEolChars}]+`;\nconst rBeginTag = `${rPaddingTag}BEGIN (${rNameTag}(?=${rPaddingTag}))${rPaddingTag}`;\nconst rEndTag = `${rPaddingTag}END \\\\1${rPaddingTag}`;\nconst rEolGroup = \"\\\\n\";\nconst rHeaderKey = `[^:${rEolChars}]+`;\nconst rHeaderValue = `(?:[^${rEolChars}]+${rEolGroup}(?: +[^${rEolChars}]+${rEolGroup})*)`;\nconst rBase64Chars = \"[a-zA-Z0-9=+/]+\";\nconst rBase64 = `(?:${rBase64Chars}${rEolGroup})+`;\nconst rPem = `${rBeginTag}${rEolGroup}(?:((?:${rHeaderKey}: ${rHeaderValue})+))?${rEolGroup}?(${rBase64})${rEndTag}`;\nclass PemConverter {\n static isPem(data) {\n return typeof data === \"string\"\n && new RegExp(rPem, \"g\").test(data);\n }\n static decodeWithHeaders(pem) {\n pem = pem.replace(/\\r/g, \"\");\n const pattern = new RegExp(rPem, \"g\");\n const res = [];\n let matches = null;\n while (matches = pattern.exec(pem)) {\n const base64 = matches[3]\n .replace(new RegExp(`[${rEolChars}]+`, \"g\"), \"\");\n const pemStruct = {\n type: matches[1],\n headers: [],\n rawData: Convert.FromBase64(base64),\n };\n const headersString = matches[2];\n if (headersString) {\n const headers = headersString.split(new RegExp(rEolGroup, \"g\"));\n let lastHeader = null;\n for (const header of headers) {\n const [key, value] = header.split(/:(.*)/);\n if (value === undefined) {\n if (!lastHeader) {\n throw new Error(\"Cannot parse PEM string. Incorrect header value\");\n }\n lastHeader.value += key.trim();\n }\n else {\n if (lastHeader) {\n pemStruct.headers.push(lastHeader);\n }\n lastHeader = { key, value: value.trim() };\n }\n }\n if (lastHeader) {\n pemStruct.headers.push(lastHeader);\n }\n }\n res.push(pemStruct);\n }\n return res;\n }\n static decode(pem) {\n const blocks = this.decodeWithHeaders(pem);\n return blocks.map(o => o.rawData);\n }\n static decodeFirst(pem) {\n const items = this.decode(pem);\n if (!items.length) {\n throw new RangeError(\"PEM string doesn't contain any objects\");\n }\n return items[0];\n }\n static encode(rawData, tag) {\n if (Array.isArray(rawData)) {\n const raws = new Array();\n if (tag) {\n rawData.forEach(element => {\n if (!BufferSourceConverter.isBufferSource(element)) {\n throw new TypeError(\"Cannot encode array of BufferSource in PEM format. Not all items of the array are BufferSource\");\n }\n raws.push(this.encodeStruct({\n type: tag,\n rawData: BufferSourceConverter.toArrayBuffer(element),\n }));\n });\n }\n else {\n rawData.forEach(element => {\n if (!(\"type\" in element)) {\n throw new TypeError(\"Cannot encode array of PemStruct in PEM format. Not all items of the array are PemStrut\");\n }\n raws.push(this.encodeStruct(element));\n });\n }\n return raws.join(\"\\n\");\n }\n else {\n if (!tag) {\n throw new Error(\"Required argument 'tag' is missed\");\n }\n return this.encodeStruct({\n type: tag,\n rawData: BufferSourceConverter.toArrayBuffer(rawData),\n });\n }\n }\n static encodeStruct(pem) {\n var _a;\n const upperCaseType = pem.type.toLocaleUpperCase();\n const res = [];\n res.push(`-----BEGIN ${upperCaseType}-----`);\n if ((_a = pem.headers) === null || _a === void 0 ? void 0 : _a.length) {\n for (const header of pem.headers) {\n res.push(`${header.key}: ${header.value}`);\n }\n res.push(\"\");\n }\n const base64 = Convert.ToBase64(pem.rawData);\n let sliced;\n let offset = 0;\n const rows = Array();\n while (offset < base64.length) {\n if (base64.length - offset < 64) {\n sliced = base64.substring(offset);\n }\n else {\n sliced = base64.substring(offset, offset + 64);\n offset += 64;\n }\n if (sliced.length !== 0) {\n rows.push(sliced);\n if (sliced.length < 64) {\n break;\n }\n }\n else {\n break;\n }\n }\n res.push(...rows);\n res.push(`-----END ${upperCaseType}-----`);\n return res.join(\"\\n\");\n }\n}\nPemConverter.CertificateTag = \"CERTIFICATE\";\nPemConverter.CrlTag = \"CRL\";\nPemConverter.CertificateRequestTag = \"CERTIFICATE REQUEST\";\nPemConverter.PublicKeyTag = \"PUBLIC KEY\";\nPemConverter.PrivateKeyTag = \"PRIVATE KEY\";\n\nclass PemData extends AsnData {\n static isAsnEncoded(data) {\n return BufferSourceConverter.isBufferSource(data) || typeof data === \"string\";\n }\n static toArrayBuffer(raw) {\n if (typeof raw === \"string\") {\n if (PemConverter.isPem(raw)) {\n return PemConverter.decode(raw)[0];\n }\n else if (Convert.isHex(raw)) {\n return Convert.FromHex(raw);\n }\n else if (Convert.isBase64(raw)) {\n return Convert.FromBase64(raw);\n }\n else if (Convert.isBase64Url(raw)) {\n return Convert.FromBase64Url(raw);\n }\n else {\n throw new TypeError(\"Unsupported format of 'raw' argument. Must be one of DER, PEM, HEX, Base64, or Base4Url\");\n }\n }\n else {\n const stringRaw = Convert.ToBinary(raw);\n if (PemConverter.isPem(stringRaw)) {\n return PemConverter.decode(stringRaw)[0];\n }\n else if (Convert.isHex(stringRaw)) {\n return Convert.FromHex(stringRaw);\n }\n else if (Convert.isBase64(stringRaw)) {\n return Convert.FromBase64(stringRaw);\n }\n else if (Convert.isBase64Url(stringRaw)) {\n return Convert.FromBase64Url(stringRaw);\n }\n return BufferSourceConverter.toArrayBuffer(raw);\n }\n }\n constructor(...args) {\n if (PemData.isAsnEncoded(args[0])) {\n super(PemData.toArrayBuffer(args[0]), args[1]);\n }\n else {\n super(args[0]);\n }\n }\n toString(format = \"pem\") {\n switch (format) {\n case \"pem\":\n return PemConverter.encode(this.rawData, this.tag);\n default:\n return super.toString(format);\n }\n }\n}\n\nclass PublicKey extends PemData {\n static async create(data, crypto = cryptoProvider.get()) {\n if (data instanceof PublicKey) {\n return data;\n }\n else if (CryptoProvider.isCryptoKey(data)) {\n if (data.type !== \"public\") {\n throw new TypeError(\"Public key is required\");\n }\n const spki = await crypto.subtle.exportKey(\"spki\", data);\n return new PublicKey(spki);\n }\n else if (data.publicKey) {\n return data.publicKey;\n }\n else if (BufferSourceConverter.isBufferSource(data)) {\n return new PublicKey(data);\n }\n else {\n throw new TypeError(\"Unsupported PublicKeyType\");\n }\n }\n constructor(param) {\n if (PemData.isAsnEncoded(param)) {\n super(param, SubjectPublicKeyInfo);\n }\n else {\n super(param);\n }\n this.tag = PemConverter.PublicKeyTag;\n }\n async export(...args) {\n let crypto;\n let keyUsages = [\"verify\"];\n let algorithm = { hash: \"SHA-256\", ...this.algorithm };\n if (args.length > 1) {\n algorithm = args[0] || algorithm;\n keyUsages = args[1] || keyUsages;\n crypto = args[2] || cryptoProvider.get();\n }\n else {\n crypto = args[0] || cryptoProvider.get();\n }\n let raw = this.rawData;\n const asnSpki = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);\n if (asnSpki.algorithm.algorithm === id_RSASSA_PSS) {\n raw = convertSpkiToRsaPkcs1(asnSpki, raw);\n }\n return crypto.subtle.importKey(\"spki\", raw, algorithm, true, keyUsages);\n }\n onInit(asn) {\n const algProv = container.resolve(diAlgorithmProvider);\n const algorithm = this.algorithm = algProv.toWebAlgorithm(asn.algorithm);\n switch (asn.algorithm.algorithm) {\n case id_rsaEncryption:\n {\n const rsaPublicKey = AsnConvert.parse(asn.subjectPublicKey, RSAPublicKey);\n const modulus = BufferSourceConverter.toUint8Array(rsaPublicKey.modulus);\n algorithm.publicExponent = BufferSourceConverter.toUint8Array(rsaPublicKey.publicExponent);\n algorithm.modulusLength = (!modulus[0] ? modulus.slice(1) : modulus).byteLength << 3;\n break;\n }\n }\n }\n async getThumbprint(...args) {\n var _a;\n let crypto;\n let algorithm = \"SHA-1\";\n if (args.length >= 1 && !((_a = args[0]) === null || _a === void 0 ? void 0 : _a.subtle)) {\n algorithm = args[0] || algorithm;\n crypto = args[1] || cryptoProvider.get();\n }\n else {\n crypto = args[0] || cryptoProvider.get();\n }\n return await crypto.subtle.digest(algorithm, this.rawData);\n }\n async getKeyIdentifier(...args) {\n let crypto;\n let algorithm = \"SHA-1\";\n if (args.length === 1) {\n if (typeof args[0] === \"string\") {\n algorithm = args[0];\n crypto = cryptoProvider.get();\n }\n else {\n crypto = args[0];\n }\n }\n else if (args.length === 2) {\n algorithm = args[0];\n crypto = args[1];\n }\n else {\n crypto = cryptoProvider.get();\n }\n const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);\n return await crypto.subtle.digest(algorithm, asn.subjectPublicKey);\n }\n toTextObject() {\n const obj = this.toTextObjectEmpty();\n const asn = AsnConvert.parse(this.rawData, SubjectPublicKeyInfo);\n obj[\"Algorithm\"] = TextConverter.serializeAlgorithm(asn.algorithm);\n switch (asn.algorithm.algorithm) {\n case id_ecPublicKey:\n obj[\"EC Point\"] = asn.subjectPublicKey;\n break;\n case id_rsaEncryption:\n default:\n obj[\"Raw Data\"] = asn.subjectPublicKey;\n }\n return obj;\n }\n}\nfunction convertSpkiToRsaPkcs1(asnSpki, raw) {\n asnSpki.algorithm = new AlgorithmIdentifier({\n algorithm: id_rsaEncryption,\n parameters: null,\n });\n raw = AsnConvert.serialize(asnSpki);\n return raw;\n}\n\nclass AuthorityKeyIdentifierExtension extends Extension {\n static async create(param, critical = false, crypto = cryptoProvider.get()) {\n if (\"name\" in param && \"serialNumber\" in param) {\n return new AuthorityKeyIdentifierExtension(param, critical);\n }\n const key = await PublicKey.create(param, crypto);\n const id = await key.getKeyIdentifier(crypto);\n return new AuthorityKeyIdentifierExtension(Convert.ToHex(id), critical);\n }\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else if (typeof args[0] === \"string\") {\n const value = new asn1X509.AuthorityKeyIdentifier({ keyIdentifier: new asn1X509.KeyIdentifier(Convert.FromHex(args[0])) });\n super(asn1X509.id_ce_authorityKeyIdentifier, args[1], AsnConvert.serialize(value));\n }\n else {\n const certId = args[0];\n const certIdName = certId.name instanceof GeneralNames\n ? AsnConvert.parse(certId.name.rawData, asn1X509.GeneralNames)\n : certId.name;\n const value = new asn1X509.AuthorityKeyIdentifier({\n authorityCertIssuer: certIdName,\n authorityCertSerialNumber: Convert.FromHex(certId.serialNumber),\n });\n super(asn1X509.id_ce_authorityKeyIdentifier, args[1], AsnConvert.serialize(value));\n }\n }\n onInit(asn) {\n super.onInit(asn);\n const aki = AsnConvert.parse(asn.extnValue, asn1X509.AuthorityKeyIdentifier);\n if (aki.keyIdentifier) {\n this.keyId = Convert.ToHex(aki.keyIdentifier);\n }\n if (aki.authorityCertIssuer || aki.authorityCertSerialNumber) {\n this.certId = {\n name: aki.authorityCertIssuer || [],\n serialNumber: aki.authorityCertSerialNumber ? Convert.ToHex(aki.authorityCertSerialNumber) : \"\",\n };\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n const asn = AsnConvert.parse(this.value, asn1X509.AuthorityKeyIdentifier);\n if (asn.authorityCertIssuer) {\n obj[\"Authority Issuer\"] = new GeneralNames(asn.authorityCertIssuer).toTextObject();\n }\n if (asn.authorityCertSerialNumber) {\n obj[\"Authority Serial Number\"] = asn.authorityCertSerialNumber;\n }\n if (asn.keyIdentifier) {\n obj[\"\"] = asn.keyIdentifier;\n }\n return obj;\n }\n}\nAuthorityKeyIdentifierExtension.NAME = \"Authority Key Identifier\";\n\nclass BasicConstraintsExtension extends Extension {\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n const value = AsnConvert.parse(this.value, BasicConstraints);\n this.ca = value.cA;\n this.pathLength = value.pathLenConstraint;\n }\n else {\n const value = new BasicConstraints({\n cA: args[0],\n pathLenConstraint: args[1],\n });\n super(id_ce_basicConstraints, args[2], AsnConvert.serialize(value));\n this.ca = args[0];\n this.pathLength = args[1];\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n if (this.ca) {\n obj[\"CA\"] = this.ca;\n }\n if (this.pathLength !== undefined) {\n obj[\"Path Length\"] = this.pathLength;\n }\n return obj;\n }\n}\nBasicConstraintsExtension.NAME = \"Basic Constraints\";\n\nvar ExtendedKeyUsage;\n(function (ExtendedKeyUsage) {\n ExtendedKeyUsage[\"serverAuth\"] = \"1.3.6.1.5.5.7.3.1\";\n ExtendedKeyUsage[\"clientAuth\"] = \"1.3.6.1.5.5.7.3.2\";\n ExtendedKeyUsage[\"codeSigning\"] = \"1.3.6.1.5.5.7.3.3\";\n ExtendedKeyUsage[\"emailProtection\"] = \"1.3.6.1.5.5.7.3.4\";\n ExtendedKeyUsage[\"timeStamping\"] = \"1.3.6.1.5.5.7.3.8\";\n ExtendedKeyUsage[\"ocspSigning\"] = \"1.3.6.1.5.5.7.3.9\";\n})(ExtendedKeyUsage || (ExtendedKeyUsage = {}));\nclass ExtendedKeyUsageExtension extends Extension {\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n const value = AsnConvert.parse(this.value, asn1X509.ExtendedKeyUsage);\n this.usages = value.map(o => o);\n }\n else {\n const value = new asn1X509.ExtendedKeyUsage(args[0]);\n super(asn1X509.id_ce_extKeyUsage, args[1], AsnConvert.serialize(value));\n this.usages = args[0];\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[\"\"] = this.usages.map(o => OidSerializer.toString(o)).join(\", \");\n return obj;\n }\n}\nExtendedKeyUsageExtension.NAME = \"Extended Key Usages\";\n\nvar KeyUsageFlags;\n(function (KeyUsageFlags) {\n KeyUsageFlags[KeyUsageFlags[\"digitalSignature\"] = 1] = \"digitalSignature\";\n KeyUsageFlags[KeyUsageFlags[\"nonRepudiation\"] = 2] = \"nonRepudiation\";\n KeyUsageFlags[KeyUsageFlags[\"keyEncipherment\"] = 4] = \"keyEncipherment\";\n KeyUsageFlags[KeyUsageFlags[\"dataEncipherment\"] = 8] = \"dataEncipherment\";\n KeyUsageFlags[KeyUsageFlags[\"keyAgreement\"] = 16] = \"keyAgreement\";\n KeyUsageFlags[KeyUsageFlags[\"keyCertSign\"] = 32] = \"keyCertSign\";\n KeyUsageFlags[KeyUsageFlags[\"cRLSign\"] = 64] = \"cRLSign\";\n KeyUsageFlags[KeyUsageFlags[\"encipherOnly\"] = 128] = \"encipherOnly\";\n KeyUsageFlags[KeyUsageFlags[\"decipherOnly\"] = 256] = \"decipherOnly\";\n})(KeyUsageFlags || (KeyUsageFlags = {}));\nclass KeyUsagesExtension extends Extension {\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n const value = AsnConvert.parse(this.value, KeyUsage);\n this.usages = value.toNumber();\n }\n else {\n const value = new KeyUsage(args[0]);\n super(id_ce_keyUsage, args[1], AsnConvert.serialize(value));\n this.usages = args[0];\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n const asn = AsnConvert.parse(this.value, KeyUsage);\n obj[\"\"] = asn.toJSON().join(\", \");\n return obj;\n }\n}\nKeyUsagesExtension.NAME = \"Key Usages\";\n\nclass SubjectKeyIdentifierExtension extends Extension {\n static async create(publicKey, critical = false, crypto = cryptoProvider.get()) {\n const key = await PublicKey.create(publicKey, crypto);\n const id = await key.getKeyIdentifier(crypto);\n return new SubjectKeyIdentifierExtension(Convert.ToHex(id), critical);\n }\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n const value = AsnConvert.parse(this.value, asn1X509.SubjectKeyIdentifier);\n this.keyId = Convert.ToHex(value);\n }\n else {\n const identifier = typeof args[0] === \"string\"\n ? Convert.FromHex(args[0])\n : args[0];\n const value = new asn1X509.SubjectKeyIdentifier(identifier);\n super(asn1X509.id_ce_subjectKeyIdentifier, args[1], AsnConvert.serialize(value));\n this.keyId = Convert.ToHex(identifier);\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n const asn = AsnConvert.parse(this.value, asn1X509.SubjectKeyIdentifier);\n obj[\"\"] = asn;\n return obj;\n }\n}\nSubjectKeyIdentifierExtension.NAME = \"Subject Key Identifier\";\n\nclass SubjectAlternativeNameExtension extends Extension {\n constructor(...args) {\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else {\n super(asn1X509.id_ce_subjectAltName, args[1], new GeneralNames(args[0] || []).rawData);\n }\n }\n onInit(asn) {\n super.onInit(asn);\n const value = AsnConvert.parse(asn.extnValue, asn1X509.SubjectAlternativeName);\n this.names = new GeneralNames(value);\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n const namesObj = this.names.toTextObject();\n for (const key in namesObj) {\n obj[key] = namesObj[key];\n }\n return obj;\n }\n}\nSubjectAlternativeNameExtension.NAME = \"Subject Alternative Name\";\n\nclass ExtensionFactory {\n static register(id, type) {\n this.items.set(id, type);\n }\n static create(data) {\n const extension = new Extension(data);\n const Type = this.items.get(extension.type);\n if (Type) {\n return new Type(data);\n }\n return extension;\n }\n}\nExtensionFactory.items = new Map();\n\nclass CertificatePolicyExtension extends Extension {\n constructor(...args) {\n var _a;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n const asnPolicies = AsnConvert.parse(this.value, asn1X509.CertificatePolicies);\n this.policies = asnPolicies.map(o => o.policyIdentifier);\n }\n else {\n const policies = args[0];\n const critical = (_a = args[1]) !== null && _a !== void 0 ? _a : false;\n const value = new asn1X509.CertificatePolicies(policies.map(o => (new asn1X509.PolicyInformation({\n policyIdentifier: o,\n }))));\n super(asn1X509.id_ce_certificatePolicies, critical, AsnConvert.serialize(value));\n this.policies = policies;\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[\"Policy\"] = this.policies.map(o => new TextObject(\"\", {}, OidSerializer.toString(o)));\n return obj;\n }\n}\nCertificatePolicyExtension.NAME = \"Certificate Policies\";\nExtensionFactory.register(asn1X509.id_ce_certificatePolicies, CertificatePolicyExtension);\n\nclass CRLDistributionPointsExtension extends Extension {\n constructor(...args) {\n var _a;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else if (Array.isArray(args[0]) && typeof args[0][0] === \"string\") {\n const urls = args[0];\n const dps = urls.map(url => {\n return new asn1X509.DistributionPoint({\n distributionPoint: new asn1X509.DistributionPointName({\n fullName: [new asn1X509.GeneralName({ uniformResourceIdentifier: url })],\n }),\n });\n });\n const value = new asn1X509.CRLDistributionPoints(dps);\n super(asn1X509.id_ce_cRLDistributionPoints, args[1], AsnConvert.serialize(value));\n }\n else {\n const value = new asn1X509.CRLDistributionPoints(args[0]);\n super(asn1X509.id_ce_cRLDistributionPoints, args[1], AsnConvert.serialize(value));\n }\n (_a = this.distributionPoints) !== null && _a !== void 0 ? _a : (this.distributionPoints = []);\n }\n onInit(asn) {\n super.onInit(asn);\n const crlExt = AsnConvert.parse(asn.extnValue, asn1X509.CRLDistributionPoints);\n this.distributionPoints = crlExt;\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[\"Distribution Point\"] = this.distributionPoints.map(dp => {\n var _a;\n const dpObj = {};\n if (dp.distributionPoint) {\n dpObj[\"\"] = (_a = dp.distributionPoint.fullName) === null || _a === void 0 ? void 0 : _a.map(name => new GeneralName(name).toString()).join(\", \");\n }\n if (dp.reasons) {\n dpObj[\"Reasons\"] = dp.reasons.toString();\n }\n if (dp.cRLIssuer) {\n dpObj[\"CRL Issuer\"] = dp.cRLIssuer.map(issuer => issuer.toString()).join(\", \");\n }\n return dpObj;\n });\n return obj;\n }\n}\nCRLDistributionPointsExtension.NAME = \"CRL Distribution Points\";\n\nclass AuthorityInfoAccessExtension extends Extension {\n constructor(...args) {\n var _a, _b, _c, _d;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else if (args[0] instanceof asn1X509.AuthorityInfoAccessSyntax) {\n const value = new asn1X509.AuthorityInfoAccessSyntax(args[0]);\n super(asn1X509.id_pe_authorityInfoAccess, args[1], AsnConvert.serialize(value));\n }\n else {\n const params = args[0];\n const value = new asn1X509.AuthorityInfoAccessSyntax();\n addAccessDescriptions(value, params, asn1X509.id_ad_ocsp, \"ocsp\");\n addAccessDescriptions(value, params, asn1X509.id_ad_caIssuers, \"caIssuers\");\n addAccessDescriptions(value, params, asn1X509.id_ad_timeStamping, \"timeStamping\");\n addAccessDescriptions(value, params, asn1X509.id_ad_caRepository, \"caRepository\");\n super(asn1X509.id_pe_authorityInfoAccess, args[1], AsnConvert.serialize(value));\n }\n (_a = this.ocsp) !== null && _a !== void 0 ? _a : (this.ocsp = []);\n (_b = this.caIssuers) !== null && _b !== void 0 ? _b : (this.caIssuers = []);\n (_c = this.timeStamping) !== null && _c !== void 0 ? _c : (this.timeStamping = []);\n (_d = this.caRepository) !== null && _d !== void 0 ? _d : (this.caRepository = []);\n }\n onInit(asn) {\n super.onInit(asn);\n this.ocsp = [];\n this.caIssuers = [];\n this.timeStamping = [];\n this.caRepository = [];\n const aia = AsnConvert.parse(asn.extnValue, asn1X509.AuthorityInfoAccessSyntax);\n aia.forEach(accessDescription => {\n switch (accessDescription.accessMethod) {\n case asn1X509.id_ad_ocsp:\n this.ocsp.push(new GeneralName(accessDescription.accessLocation));\n break;\n case asn1X509.id_ad_caIssuers:\n this.caIssuers.push(new GeneralName(accessDescription.accessLocation));\n break;\n case asn1X509.id_ad_timeStamping:\n this.timeStamping.push(new GeneralName(accessDescription.accessLocation));\n break;\n case asn1X509.id_ad_caRepository:\n this.caRepository.push(new GeneralName(accessDescription.accessLocation));\n break;\n }\n });\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n if (this.ocsp.length) {\n addUrlsToObject(obj, \"OCSP\", this.ocsp);\n }\n if (this.caIssuers.length) {\n addUrlsToObject(obj, \"CA Issuers\", this.caIssuers);\n }\n if (this.timeStamping.length) {\n addUrlsToObject(obj, \"Time Stamping\", this.timeStamping);\n }\n if (this.caRepository.length) {\n addUrlsToObject(obj, \"CA Repository\", this.caRepository);\n }\n return obj;\n }\n}\nAuthorityInfoAccessExtension.NAME = \"Authority Info Access\";\nfunction addUrlsToObject(obj, key, urls) {\n if (urls.length === 1) {\n obj[key] = urls[0].toTextObject();\n }\n else {\n const names = new TextObject(\"\");\n urls.forEach((name, index) => {\n const nameObj = name.toTextObject();\n const indexedKey = `${nameObj[TextObject.NAME]} ${index + 1}`;\n let field = names[indexedKey];\n if (!Array.isArray(field)) {\n field = [];\n names[indexedKey] = field;\n }\n field.push(nameObj);\n });\n obj[key] = names;\n }\n}\nfunction addAccessDescriptions(value, params, method, key) {\n const items = params[key];\n if (items) {\n const array = Array.isArray(items) ? items : [items];\n array.forEach(url => {\n if (typeof url === \"string\") {\n url = new GeneralName(\"url\", url);\n }\n value.push(new asn1X509.AccessDescription({\n accessMethod: method,\n accessLocation: AsnConvert.parse(url.rawData, asn1X509.GeneralName),\n }));\n });\n }\n}\n\nclass Attribute extends AsnData {\n constructor(...args) {\n let raw;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n raw = BufferSourceConverter.toArrayBuffer(args[0]);\n }\n else {\n const type = args[0];\n const values = Array.isArray(args[1]) ? args[1].map(o => BufferSourceConverter.toArrayBuffer(o)) : [];\n raw = AsnConvert.serialize(new Attribute$1({ type, values }));\n }\n super(raw, Attribute$1);\n }\n onInit(asn) {\n this.type = asn.type;\n this.values = asn.values;\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[\"Value\"] = this.values.map(o => new TextObject(\"\", { \"\": o }));\n return obj;\n }\n toTextObjectWithoutValue() {\n const obj = this.toTextObjectEmpty();\n if (obj[TextObject.NAME] === Attribute.NAME) {\n obj[TextObject.NAME] = OidSerializer.toString(this.type);\n }\n return obj;\n }\n}\nAttribute.NAME = \"Attribute\";\n\nclass ChallengePasswordAttribute extends Attribute {\n constructor(...args) {\n var _a;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else {\n const value = new asnPkcs9.ChallengePassword({\n printableString: args[0],\n });\n super(asnPkcs9.id_pkcs9_at_challengePassword, [AsnConvert.serialize(value)]);\n }\n (_a = this.password) !== null && _a !== void 0 ? _a : (this.password = \"\");\n }\n onInit(asn) {\n super.onInit(asn);\n if (this.values[0]) {\n const value = AsnConvert.parse(this.values[0], asnPkcs9.ChallengePassword);\n this.password = value.toString();\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n obj[TextObject.VALUE] = this.password;\n return obj;\n }\n}\nChallengePasswordAttribute.NAME = \"Challenge Password\";\n\nclass ExtensionsAttribute extends Attribute {\n constructor(...args) {\n var _a;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n super(args[0]);\n }\n else {\n const extensions = args[0];\n const value = new asn1X509.Extensions();\n for (const extension of extensions) {\n value.push(AsnConvert.parse(extension.rawData, asn1X509.Extension));\n }\n super(asnPkcs9.id_pkcs9_at_extensionRequest, [AsnConvert.serialize(value)]);\n }\n (_a = this.items) !== null && _a !== void 0 ? _a : (this.items = []);\n }\n onInit(asn) {\n super.onInit(asn);\n if (this.values[0]) {\n const value = AsnConvert.parse(this.values[0], asn1X509.Extensions);\n this.items = value.map(o => ExtensionFactory.create(AsnConvert.serialize(o)));\n }\n }\n toTextObject() {\n const obj = this.toTextObjectWithoutValue();\n const extensions = this.items.map(o => o.toTextObject());\n for (const extension of extensions) {\n obj[extension[TextObject.NAME]] = extension;\n }\n return obj;\n }\n}\nExtensionsAttribute.NAME = \"Extensions\";\n\nclass AttributeFactory {\n static register(id, type) {\n this.items.set(id, type);\n }\n static create(data) {\n const attribute = new Attribute(data);\n const Type = this.items.get(attribute.type);\n if (Type) {\n return new Type(data);\n }\n return attribute;\n }\n}\nAttributeFactory.items = new Map();\n\nconst diAsnSignatureFormatter = \"crypto.signatureFormatter\";\nclass AsnDefaultSignatureFormatter {\n toAsnSignature(algorithm, signature) {\n return BufferSourceConverter.toArrayBuffer(signature);\n }\n toWebSignature(algorithm, signature) {\n return BufferSourceConverter.toArrayBuffer(signature);\n }\n}\n\nvar RsaAlgorithm_1;\nlet RsaAlgorithm = RsaAlgorithm_1 = class RsaAlgorithm {\n static createPssParams(hash, saltLength) {\n const hashAlgorithm = RsaAlgorithm_1.getHashAlgorithm(hash);\n if (!hashAlgorithm) {\n return null;\n }\n return new asn1Rsa.RsaSaPssParams({\n hashAlgorithm,\n maskGenAlgorithm: new AlgorithmIdentifier({\n algorithm: asn1Rsa.id_mgf1,\n parameters: AsnConvert.serialize(hashAlgorithm),\n }),\n saltLength,\n });\n }\n static getHashAlgorithm(alg) {\n const algProv = container.resolve(diAlgorithmProvider);\n if (typeof alg === \"string\") {\n return algProv.toAsnAlgorithm({ name: alg });\n }\n if (typeof alg === \"object\" && alg && \"name\" in alg) {\n return algProv.toAsnAlgorithm(alg);\n }\n return null;\n }\n toAsnAlgorithm(alg) {\n switch (alg.name.toLowerCase()) {\n case \"rsassa-pkcs1-v1_5\":\n if (\"hash\" in alg) {\n let hash;\n if (typeof alg.hash === \"string\") {\n hash = alg.hash;\n }\n else if (alg.hash && typeof alg.hash === \"object\"\n && \"name\" in alg.hash && typeof alg.hash.name === \"string\") {\n hash = alg.hash.name.toUpperCase();\n }\n else {\n throw new Error(\"Cannot get hash algorithm name\");\n }\n switch (hash.toLowerCase()) {\n case \"sha-1\":\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha1WithRSAEncryption, parameters: null });\n case \"sha-256\":\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha256WithRSAEncryption, parameters: null });\n case \"sha-384\":\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha384WithRSAEncryption, parameters: null });\n case \"sha-512\":\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_sha512WithRSAEncryption, parameters: null });\n }\n }\n else {\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_rsaEncryption, parameters: null });\n }\n break;\n case \"rsa-pss\":\n if (\"hash\" in alg) {\n if (!(\"saltLength\" in alg && typeof alg.saltLength === \"number\")) {\n throw new Error(\"Cannot get 'saltLength' from 'alg' argument\");\n }\n const pssParams = RsaAlgorithm_1.createPssParams(alg.hash, alg.saltLength);\n if (!pssParams) {\n throw new Error(\"Cannot create PSS parameters\");\n }\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_RSASSA_PSS, parameters: AsnConvert.serialize(pssParams) });\n }\n else {\n return new AlgorithmIdentifier({ algorithm: asn1Rsa.id_RSASSA_PSS, parameters: null });\n }\n }\n return null;\n }\n toWebAlgorithm(alg) {\n switch (alg.algorithm) {\n case asn1Rsa.id_rsaEncryption:\n return { name: \"RSASSA-PKCS1-v1_5\" };\n case asn1Rsa.id_sha1WithRSAEncryption:\n return { name: \"RSASSA-PKCS1-v1_5\", hash: { name: \"SHA-1\" } };\n case asn1Rsa.id_sha256WithRSAEncryption:\n return { name: \"RSASSA-PKCS1-v1_5\", hash: { name: \"SHA-256\" } };\n case asn1Rsa.id_sha384WithRSAEncryption:\n return { name: \"RSASSA-PKCS1-v1_5\", hash: { name: \"SHA-384\" } };\n case asn1Rsa.id_sha512WithRSAEncryption:\n return { name: \"RSASSA-PKCS1-v1_5\", hash: { name: \"SHA-512\" } };\n case asn1Rsa.id_RSASSA_PSS:\n if (alg.parameters) {\n const pssParams = AsnConvert.parse(alg.parameters, asn1Rsa.RsaSaPssParams);\n const algProv = container.resolve(diAlgorithmProvider);\n const hashAlg = algProv.toWebAlgorithm(pssParams.hashAlgorithm);\n return {\n name: \"RSA-PSS\",\n hash: hashAlg,\n saltLength: pssParams.saltLength,\n };\n }\n else {\n return { name: \"RSA-PSS\" };\n }\n }\n return null;\n }\n};\nRsaAlgorithm = RsaAlgorithm_1 = __decorate([\n injectable()\n], RsaAlgorithm);\ncontainer.registerSingleton(diAlgorithm, RsaAlgorithm);\n\nlet ShaAlgorithm = class ShaAlgorithm {\n toAsnAlgorithm(alg) {\n switch (alg.name.toLowerCase()) {\n case \"sha-1\":\n return new AlgorithmIdentifier({ algorithm: id_sha1 });\n case \"sha-256\":\n return new AlgorithmIdentifier({ algorithm: id_sha256 });\n case \"sha-384\":\n return new AlgorithmIdentifier({ algorithm: id_sha384 });\n case \"sha-512\":\n return new AlgorithmIdentifier({ algorithm: id_sha512 });\n }\n return null;\n }\n toWebAlgorithm(alg) {\n switch (alg.algorithm) {\n case id_sha1:\n return { name: \"SHA-1\" };\n case id_sha256:\n return { name: \"SHA-256\" };\n case id_sha384:\n return { name: \"SHA-384\" };\n case id_sha512:\n return { name: \"SHA-512\" };\n }\n return null;\n }\n};\nShaAlgorithm = __decorate([\n injectable()\n], ShaAlgorithm);\ncontainer.registerSingleton(diAlgorithm, ShaAlgorithm);\n\nclass AsnEcSignatureFormatter {\n addPadding(pointSize, data) {\n const bytes = BufferSourceConverter.toUint8Array(data);\n const res = new Uint8Array(pointSize);\n res.set(bytes, pointSize - bytes.length);\n return res;\n }\n removePadding(data, positive = false) {\n let bytes = BufferSourceConverter.toUint8Array(data);\n for (let i = 0; i < bytes.length; i++) {\n if (!bytes[i]) {\n continue;\n }\n bytes = bytes.slice(i);\n break;\n }\n if (positive && bytes[0] > 127) {\n const result = new Uint8Array(bytes.length + 1);\n result.set(bytes, 1);\n return result.buffer;\n }\n return bytes.buffer;\n }\n toAsnSignature(algorithm, signature) {\n if (algorithm.name === \"ECDSA\") {\n const namedCurve = algorithm.namedCurve;\n const pointSize = AsnEcSignatureFormatter.namedCurveSize.get(namedCurve) || AsnEcSignatureFormatter.defaultNamedCurveSize;\n const ecSignature = new ECDSASigValue();\n const uint8Signature = BufferSourceConverter.toUint8Array(signature);\n ecSignature.r = this.removePadding(uint8Signature.slice(0, pointSize), true);\n ecSignature.s = this.removePadding(uint8Signature.slice(pointSize, pointSize + pointSize), true);\n return AsnConvert.serialize(ecSignature);\n }\n return null;\n }\n toWebSignature(algorithm, signature) {\n if (algorithm.name === \"ECDSA\") {\n const ecSigValue = AsnConvert.parse(signature, ECDSASigValue);\n const namedCurve = algorithm.namedCurve;\n const pointSize = AsnEcSignatureFormatter.namedCurveSize.get(namedCurve) || AsnEcSignatureFormatter.defaultNamedCurveSize;\n const r = this.addPadding(pointSize, this.removePadding(ecSigValue.r));\n const s = this.addPadding(pointSize, this.removePadding(ecSigValue.s));\n return combine(r, s);\n }\n return null;\n }\n}\nAsnEcSignatureFormatter.namedCurveSize = new Map();\nAsnEcSignatureFormatter.defaultNamedCurveSize = 32;\n\nconst idX25519 = \"1.3.101.110\";\nconst idX448 = \"1.3.101.111\";\nconst idEd25519 = \"1.3.101.112\";\nconst idEd448 = \"1.3.101.113\";\nlet EdAlgorithm = class EdAlgorithm {\n toAsnAlgorithm(alg) {\n let algorithm = null;\n switch (alg.name.toLowerCase()) {\n case \"ed25519\":\n algorithm = idEd25519;\n break;\n case \"x25519\":\n algorithm = idX25519;\n break;\n case \"eddsa\":\n switch (alg.namedCurve.toLowerCase()) {\n case \"ed25519\":\n algorithm = idEd25519;\n break;\n case \"ed448\":\n algorithm = idEd448;\n break;\n }\n break;\n case \"ecdh-es\":\n switch (alg.namedCurve.toLowerCase()) {\n case \"x25519\":\n algorithm = idX25519;\n break;\n case \"x448\":\n algorithm = idX448;\n break;\n }\n }\n if (algorithm) {\n return new AlgorithmIdentifier({\n algorithm,\n });\n }\n return null;\n }\n toWebAlgorithm(alg) {\n switch (alg.algorithm) {\n case idEd25519:\n return { name: \"Ed25519\" };\n case idEd448:\n return { name: \"EdDSA\", namedCurve: \"Ed448\" };\n case idX25519:\n return { name: \"X25519\" };\n case idX448:\n return { name: \"ECDH-ES\", namedCurve: \"X448\" };\n }\n return null;\n }\n};\nEdAlgorithm = __decorate([\n injectable()\n], EdAlgorithm);\ncontainer.registerSingleton(diAlgorithm, EdAlgorithm);\n\nclass Pkcs10CertificateRequest extends PemData {\n constructor(param) {\n if (PemData.isAsnEncoded(param)) {\n super(param, CertificationRequest);\n }\n else {\n super(param);\n }\n this.tag = PemConverter.CertificateRequestTag;\n }\n onInit(asn) {\n this.tbs = AsnConvert.serialize(asn.certificationRequestInfo);\n this.publicKey = new PublicKey(asn.certificationRequestInfo.subjectPKInfo);\n const algProv = container.resolve(diAlgorithmProvider);\n this.signatureAlgorithm = algProv.toWebAlgorithm(asn.signatureAlgorithm);\n this.signature = asn.signature;\n this.attributes = asn.certificationRequestInfo.attributes\n .map(o => AttributeFactory.create(AsnConvert.serialize(o)));\n const extensions = this.getAttribute(id_pkcs9_at_extensionRequest);\n this.extensions = [];\n if (extensions instanceof ExtensionsAttribute) {\n this.extensions = extensions.items;\n }\n this.subjectName = new Name(asn.certificationRequestInfo.subject);\n this.subject = this.subjectName.toString();\n }\n getAttribute(type) {\n for (const attr of this.attributes) {\n if (attr.type === type) {\n return attr;\n }\n }\n return null;\n }\n getAttributes(type) {\n return this.attributes.filter(o => o.type === type);\n }\n getExtension(type) {\n for (const ext of this.extensions) {\n if (ext.type === type) {\n return ext;\n }\n }\n return null;\n }\n getExtensions(type) {\n return this.extensions.filter(o => o.type === type);\n }\n async verify(crypto = cryptoProvider.get()) {\n const algorithm = { ...this.publicKey.algorithm, ...this.signatureAlgorithm };\n const publicKey = await this.publicKey.export(algorithm, [\"verify\"], crypto);\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let signature = null;\n for (const signatureFormatter of signatureFormatters) {\n signature = signatureFormatter.toWebSignature(algorithm, this.signature);\n if (signature) {\n break;\n }\n }\n if (!signature) {\n throw Error(\"Cannot convert WebCrypto signature value to ASN.1 format\");\n }\n const ok = await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);\n return ok;\n }\n toTextObject() {\n const obj = this.toTextObjectEmpty();\n const req = AsnConvert.parse(this.rawData, CertificationRequest);\n const tbs = req.certificationRequestInfo;\n const data = new TextObject(\"\", {\n \"Version\": `${Version[tbs.version]} (${tbs.version})`,\n \"Subject\": this.subject,\n \"Subject Public Key Info\": this.publicKey,\n });\n if (this.attributes.length) {\n const attrs = new TextObject(\"\");\n for (const ext of this.attributes) {\n const attrObj = ext.toTextObject();\n attrs[attrObj[TextObject.NAME]] = attrObj;\n }\n data[\"Attributes\"] = attrs;\n }\n obj[\"Data\"] = data;\n obj[\"Signature\"] = new TextObject(\"\", {\n \"Algorithm\": TextConverter.serializeAlgorithm(req.signatureAlgorithm),\n \"\": req.signature,\n });\n return obj;\n }\n}\nPkcs10CertificateRequest.NAME = \"PKCS#10 Certificate Request\";\n\nclass Pkcs10CertificateRequestGenerator {\n static async create(params, crypto = cryptoProvider.get()) {\n if (!params.keys.privateKey) {\n throw new Error(\"Bad field 'keys' in 'params' argument. 'privateKey' is empty\");\n }\n if (!params.keys.publicKey) {\n throw new Error(\"Bad field 'keys' in 'params' argument. 'publicKey' is empty\");\n }\n const spki = await crypto.subtle.exportKey(\"spki\", params.keys.publicKey);\n const asnReq = new CertificationRequest({\n certificationRequestInfo: new CertificationRequestInfo({\n subjectPKInfo: AsnConvert.parse(spki, SubjectPublicKeyInfo),\n }),\n });\n if (params.name) {\n const name = params.name instanceof Name\n ? params.name\n : new Name(params.name);\n asnReq.certificationRequestInfo.subject = AsnConvert.parse(name.toArrayBuffer(), Name$1);\n }\n if (params.attributes) {\n for (const o of params.attributes) {\n asnReq.certificationRequestInfo.attributes.push(AsnConvert.parse(o.rawData, Attribute$1));\n }\n }\n if (params.extensions && params.extensions.length) {\n const attr = new Attribute$1({ type: id_pkcs9_at_extensionRequest });\n const extensions = new Extensions();\n for (const o of params.extensions) {\n extensions.push(AsnConvert.parse(o.rawData, Extension$1));\n }\n attr.values.push(AsnConvert.serialize(extensions));\n asnReq.certificationRequestInfo.attributes.push(attr);\n }\n const signingAlgorithm = { ...params.signingAlgorithm, ...params.keys.privateKey.algorithm };\n const algProv = container.resolve(diAlgorithmProvider);\n asnReq.signatureAlgorithm = algProv.toAsnAlgorithm(signingAlgorithm);\n const tbs = AsnConvert.serialize(asnReq.certificationRequestInfo);\n const signature = await crypto.subtle.sign(signingAlgorithm, params.keys.privateKey, tbs);\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let asnSignature = null;\n for (const signatureFormatter of signatureFormatters) {\n asnSignature = signatureFormatter.toAsnSignature(signingAlgorithm, signature);\n if (asnSignature) {\n break;\n }\n }\n if (!asnSignature) {\n throw Error(\"Cannot convert WebCrypto signature value to ASN.1 format\");\n }\n asnReq.signature = asnSignature;\n return new Pkcs10CertificateRequest(AsnConvert.serialize(asnReq));\n }\n}\n\nclass X509Certificate extends PemData {\n constructor(param) {\n if (PemData.isAsnEncoded(param)) {\n super(param, Certificate);\n }\n else {\n super(param);\n }\n this.tag = PemConverter.CertificateTag;\n }\n onInit(asn) {\n const tbs = asn.tbsCertificate;\n this.tbs = AsnConvert.serialize(tbs);\n this.serialNumber = Convert.ToHex(tbs.serialNumber);\n this.subjectName = new Name(tbs.subject);\n this.subject = new Name(tbs.subject).toString();\n this.issuerName = new Name(tbs.issuer);\n this.issuer = this.issuerName.toString();\n const algProv = container.resolve(diAlgorithmProvider);\n this.signatureAlgorithm = algProv.toWebAlgorithm(asn.signatureAlgorithm);\n this.signature = asn.signatureValue;\n const notBefore = tbs.validity.notBefore.utcTime || tbs.validity.notBefore.generalTime;\n if (!notBefore) {\n throw new Error(\"Cannot get 'notBefore' value\");\n }\n this.notBefore = notBefore;\n const notAfter = tbs.validity.notAfter.utcTime || tbs.validity.notAfter.generalTime;\n if (!notAfter) {\n throw new Error(\"Cannot get 'notAfter' value\");\n }\n this.notAfter = notAfter;\n this.extensions = [];\n if (tbs.extensions) {\n this.extensions = tbs.extensions.map(o => ExtensionFactory.create(AsnConvert.serialize(o)));\n }\n this.publicKey = new PublicKey(tbs.subjectPublicKeyInfo);\n }\n getExtension(type) {\n for (const ext of this.extensions) {\n if (typeof type === \"string\") {\n if (ext.type === type) {\n return ext;\n }\n }\n else {\n if (ext instanceof type) {\n return ext;\n }\n }\n }\n return null;\n }\n getExtensions(type) {\n return this.extensions.filter(o => {\n if (typeof type === \"string\") {\n return o.type === type;\n }\n else {\n return o instanceof type;\n }\n });\n }\n async verify(params = {}, crypto = cryptoProvider.get()) {\n let keyAlgorithm;\n let publicKey;\n const paramsKey = params.publicKey;\n try {\n if (!paramsKey) {\n keyAlgorithm = { ...this.publicKey.algorithm, ...this.signatureAlgorithm };\n publicKey = await this.publicKey.export(keyAlgorithm, [\"verify\"], crypto);\n }\n else if (\"publicKey\" in paramsKey) {\n keyAlgorithm = { ...paramsKey.publicKey.algorithm, ...this.signatureAlgorithm };\n publicKey = await paramsKey.publicKey.export(keyAlgorithm, [\"verify\"], crypto);\n }\n else if (paramsKey instanceof PublicKey) {\n keyAlgorithm = { ...paramsKey.algorithm, ...this.signatureAlgorithm };\n publicKey = await paramsKey.export(keyAlgorithm, [\"verify\"], crypto);\n }\n else if (BufferSourceConverter.isBufferSource(paramsKey)) {\n const key = new PublicKey(paramsKey);\n keyAlgorithm = { ...key.algorithm, ...this.signatureAlgorithm };\n publicKey = await key.export(keyAlgorithm, [\"verify\"], crypto);\n }\n else {\n keyAlgorithm = { ...paramsKey.algorithm, ...this.signatureAlgorithm };\n publicKey = paramsKey;\n }\n }\n catch (e) {\n return false;\n }\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let signature = null;\n for (const signatureFormatter of signatureFormatters) {\n signature = signatureFormatter.toWebSignature(keyAlgorithm, this.signature);\n if (signature) {\n break;\n }\n }\n if (!signature) {\n throw Error(\"Cannot convert ASN.1 signature value to WebCrypto format\");\n }\n const ok = await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);\n if (params.signatureOnly) {\n return ok;\n }\n else {\n const date = params.date || new Date();\n const time = date.getTime();\n return ok && this.notBefore.getTime() < time && time < this.notAfter.getTime();\n }\n }\n async getThumbprint(...args) {\n let crypto;\n let algorithm = \"SHA-1\";\n if (args[0]) {\n if (!args[0].subtle) {\n algorithm = args[0] || algorithm;\n crypto = args[1];\n }\n else {\n crypto = args[0];\n }\n }\n crypto !== null && crypto !== void 0 ? crypto : (crypto = cryptoProvider.get());\n return await crypto.subtle.digest(algorithm, this.rawData);\n }\n async isSelfSigned(crypto = cryptoProvider.get()) {\n return this.subject === this.issuer && await this.verify({ signatureOnly: true }, crypto);\n }\n toTextObject() {\n const obj = this.toTextObjectEmpty();\n const cert = AsnConvert.parse(this.rawData, Certificate);\n const tbs = cert.tbsCertificate;\n const data = new TextObject(\"\", {\n \"Version\": `${Version[tbs.version]} (${tbs.version})`,\n \"Serial Number\": tbs.serialNumber,\n \"Signature Algorithm\": TextConverter.serializeAlgorithm(tbs.signature),\n \"Issuer\": this.issuer,\n \"Validity\": new TextObject(\"\", {\n \"Not Before\": tbs.validity.notBefore.getTime(),\n \"Not After\": tbs.validity.notAfter.getTime(),\n }),\n \"Subject\": this.subject,\n \"Subject Public Key Info\": this.publicKey,\n });\n if (tbs.issuerUniqueID) {\n data[\"Issuer Unique ID\"] = tbs.issuerUniqueID;\n }\n if (tbs.subjectUniqueID) {\n data[\"Subject Unique ID\"] = tbs.subjectUniqueID;\n }\n if (this.extensions.length) {\n const extensions = new TextObject(\"\");\n for (const ext of this.extensions) {\n const extObj = ext.toTextObject();\n extensions[extObj[TextObject.NAME]] = extObj;\n }\n data[\"Extensions\"] = extensions;\n }\n obj[\"Data\"] = data;\n obj[\"Signature\"] = new TextObject(\"\", {\n \"Algorithm\": TextConverter.serializeAlgorithm(cert.signatureAlgorithm),\n \"\": cert.signatureValue,\n });\n return obj;\n }\n}\nX509Certificate.NAME = \"Certificate\";\n\nclass X509Certificates extends Array {\n constructor(param) {\n super();\n if (PemData.isAsnEncoded(param)) {\n this.import(param);\n }\n else if (param instanceof X509Certificate) {\n this.push(param);\n }\n else if (Array.isArray(param)) {\n for (const item of param) {\n this.push(item);\n }\n }\n }\n export(format) {\n const signedData = new asn1Cms.SignedData();\n signedData.version = 1;\n signedData.encapContentInfo.eContentType = asn1Cms.id_data;\n signedData.encapContentInfo.eContent = new asn1Cms.EncapsulatedContent({\n single: new OctetString(),\n });\n signedData.certificates = new asn1Cms.CertificateSet(this.map(o => new asn1Cms.CertificateChoices({\n certificate: AsnConvert.parse(o.rawData, Certificate)\n })));\n const cms = new asn1Cms.ContentInfo({\n contentType: asn1Cms.id_signedData,\n content: AsnConvert.serialize(signedData),\n });\n const raw = AsnConvert.serialize(cms);\n if (format === \"raw\") {\n return raw;\n }\n return this.toString(format);\n }\n import(data) {\n const raw = PemData.toArrayBuffer(data);\n const cms = AsnConvert.parse(raw, asn1Cms.ContentInfo);\n if (cms.contentType !== asn1Cms.id_signedData) {\n throw new TypeError(\"Cannot parse CMS package. Incoming data is not a SignedData object.\");\n }\n const signedData = AsnConvert.parse(cms.content, asn1Cms.SignedData);\n this.clear();\n for (const item of signedData.certificates || []) {\n if (item.certificate) {\n this.push(new X509Certificate(item.certificate));\n }\n }\n }\n clear() {\n while (this.pop()) {\n }\n }\n toString(format = \"pem\") {\n const raw = this.export(\"raw\");\n switch (format) {\n case \"pem\":\n return PemConverter.encode(raw, \"CMS\");\n case \"pem-chain\":\n return this\n .map(o => o.toString(\"pem\"))\n .join(\"\\n\");\n case \"asn\":\n return AsnConvert.toString(raw);\n case \"hex\":\n return Convert.ToHex(raw);\n case \"base64\":\n return Convert.ToBase64(raw);\n case \"base64url\":\n return Convert.ToBase64Url(raw);\n case \"text\":\n return TextConverter.serialize(this.toTextObject());\n default:\n throw TypeError(\"Argument 'format' is unsupported value\");\n }\n }\n toTextObject() {\n const contentInfo = AsnConvert.parse(this.export(\"raw\"), asn1Cms.ContentInfo);\n const signedData = AsnConvert.parse(contentInfo.content, asn1Cms.SignedData);\n const obj = new TextObject(\"X509Certificates\", {\n \"Content Type\": OidSerializer.toString(contentInfo.contentType),\n \"Content\": new TextObject(\"\", {\n \"Version\": `${asn1Cms.CMSVersion[signedData.version]} (${signedData.version})`,\n \"Certificates\": new TextObject(\"\", { \"Certificate\": this.map(o => o.toTextObject()) }),\n }),\n });\n return obj;\n }\n}\n\nclass X509ChainBuilder {\n constructor(params = {}) {\n this.certificates = [];\n if (params.certificates) {\n this.certificates = params.certificates;\n }\n }\n async build(cert, crypto = cryptoProvider.get()) {\n const chain = new X509Certificates(cert);\n let current = cert;\n while (current = await this.findIssuer(current, crypto)) {\n const thumbprint = await current.getThumbprint(crypto);\n for (const item of chain) {\n const thumbprint2 = await item.getThumbprint(crypto);\n if (isEqual(thumbprint, thumbprint2)) {\n throw new Error(\"Cannot build a certificate chain. Circular dependency.\");\n }\n }\n chain.push(current);\n }\n return chain;\n }\n async findIssuer(cert, crypto = cryptoProvider.get()) {\n if (!await cert.isSelfSigned(crypto)) {\n const akiExt = cert.getExtension(asn1X509.id_ce_authorityKeyIdentifier);\n for (const item of this.certificates) {\n if (item.subject !== cert.issuer) {\n continue;\n }\n if (akiExt) {\n if (akiExt.keyId) {\n const skiExt = item.getExtension(asn1X509.id_ce_subjectKeyIdentifier);\n if (skiExt && skiExt.keyId !== akiExt.keyId) {\n continue;\n }\n }\n else if (akiExt.certId) {\n const sanExt = item.getExtension(asn1X509.id_ce_subjectAltName);\n if (sanExt &&\n !(akiExt.certId.serialNumber === item.serialNumber && isEqual(AsnConvert.serialize(akiExt.certId.name), AsnConvert.serialize(sanExt)))) {\n continue;\n }\n }\n }\n try {\n const algorithm = { ...item.publicKey.algorithm, ...cert.signatureAlgorithm };\n const publicKey = await item.publicKey.export(algorithm, [\"verify\"], crypto);\n const ok = await cert.verify({ publicKey, signatureOnly: true }, crypto);\n if (!ok) {\n continue;\n }\n }\n catch (e) {\n continue;\n }\n return item;\n }\n }\n return null;\n }\n}\n\nclass X509CertificateGenerator {\n static async createSelfSigned(params, crypto = cryptoProvider.get()) {\n if (!params.keys.privateKey) {\n throw new Error(\"Bad field 'keys' in 'params' argument. 'privateKey' is empty\");\n }\n if (!params.keys.publicKey) {\n throw new Error(\"Bad field 'keys' in 'params' argument. 'publicKey' is empty\");\n }\n return this.create({\n serialNumber: params.serialNumber,\n subject: params.name,\n issuer: params.name,\n notBefore: params.notBefore,\n notAfter: params.notAfter,\n publicKey: params.keys.publicKey,\n signingKey: params.keys.privateKey,\n signingAlgorithm: params.signingAlgorithm,\n extensions: params.extensions,\n }, crypto);\n }\n static async create(params, crypto = cryptoProvider.get()) {\n var _a;\n let spki;\n if (params.publicKey instanceof PublicKey) {\n spki = params.publicKey.rawData;\n }\n else if (\"publicKey\" in params.publicKey) {\n spki = params.publicKey.publicKey.rawData;\n }\n else if (BufferSourceConverter.isBufferSource(params.publicKey)) {\n spki = params.publicKey;\n }\n else {\n spki = await crypto.subtle.exportKey(\"spki\", params.publicKey);\n }\n const serialNumber = params.serialNumber\n ? BufferSourceConverter.toUint8Array(Convert.FromHex(params.serialNumber))\n : crypto.getRandomValues(new Uint8Array(16));\n if (serialNumber[0] > 0x7F) {\n serialNumber[0] &= 0x7F;\n }\n if (serialNumber.length > 1 && serialNumber[0] === 0) {\n serialNumber[1] |= 0x80;\n }\n const notBefore = params.notBefore || new Date();\n const notAfter = params.notAfter || new Date(notBefore.getTime() + 31536000000);\n const asnX509 = new asn1X509.Certificate({\n tbsCertificate: new asn1X509.TBSCertificate({\n version: asn1X509.Version.v3,\n serialNumber: serialNumber,\n validity: new asn1X509.Validity({\n notBefore,\n notAfter,\n }),\n extensions: new asn1X509.Extensions(((_a = params.extensions) === null || _a === void 0 ? void 0 : _a.map(o => AsnConvert.parse(o.rawData, asn1X509.Extension))) || []),\n subjectPublicKeyInfo: AsnConvert.parse(spki, asn1X509.SubjectPublicKeyInfo),\n }),\n });\n if (params.subject) {\n const name = params.subject instanceof Name\n ? params.subject\n : new Name(params.subject);\n asnX509.tbsCertificate.subject = AsnConvert.parse(name.toArrayBuffer(), asn1X509.Name);\n }\n if (params.issuer) {\n const name = params.issuer instanceof Name\n ? params.issuer\n : new Name(params.issuer);\n asnX509.tbsCertificate.issuer = AsnConvert.parse(name.toArrayBuffer(), asn1X509.Name);\n }\n const defaultSigningAlgorithm = {\n hash: \"SHA-256\",\n };\n const signatureAlgorithm = (\"signingKey\" in params)\n ? { ...defaultSigningAlgorithm, ...params.signingAlgorithm, ...params.signingKey.algorithm }\n : { ...defaultSigningAlgorithm, ...params.signingAlgorithm };\n const algProv = container.resolve(diAlgorithmProvider);\n asnX509.tbsCertificate.signature = asnX509.signatureAlgorithm = algProv.toAsnAlgorithm(signatureAlgorithm);\n const tbs = AsnConvert.serialize(asnX509.tbsCertificate);\n const signatureValue = (\"signingKey\" in params)\n ? await crypto.subtle.sign(signatureAlgorithm, params.signingKey, tbs)\n : params.signature;\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let asnSignature = null;\n for (const signatureFormatter of signatureFormatters) {\n asnSignature = signatureFormatter.toAsnSignature(signatureAlgorithm, signatureValue);\n if (asnSignature) {\n break;\n }\n }\n if (!asnSignature) {\n throw Error(\"Cannot convert ASN.1 signature value to WebCrypto format\");\n }\n asnX509.signatureValue = asnSignature;\n return new X509Certificate(AsnConvert.serialize(asnX509));\n }\n}\n\nvar X509CrlReason;\n(function (X509CrlReason) {\n X509CrlReason[X509CrlReason[\"unspecified\"] = 0] = \"unspecified\";\n X509CrlReason[X509CrlReason[\"keyCompromise\"] = 1] = \"keyCompromise\";\n X509CrlReason[X509CrlReason[\"cACompromise\"] = 2] = \"cACompromise\";\n X509CrlReason[X509CrlReason[\"affiliationChanged\"] = 3] = \"affiliationChanged\";\n X509CrlReason[X509CrlReason[\"superseded\"] = 4] = \"superseded\";\n X509CrlReason[X509CrlReason[\"cessationOfOperation\"] = 5] = \"cessationOfOperation\";\n X509CrlReason[X509CrlReason[\"certificateHold\"] = 6] = \"certificateHold\";\n X509CrlReason[X509CrlReason[\"removeFromCRL\"] = 8] = \"removeFromCRL\";\n X509CrlReason[X509CrlReason[\"privilegeWithdrawn\"] = 9] = \"privilegeWithdrawn\";\n X509CrlReason[X509CrlReason[\"aACompromise\"] = 10] = \"aACompromise\";\n})(X509CrlReason || (X509CrlReason = {}));\nclass X509CrlEntry extends AsnData {\n constructor(...args) {\n let raw;\n if (BufferSourceConverter.isBufferSource(args[0])) {\n raw = BufferSourceConverter.toArrayBuffer(args[0]);\n }\n else {\n raw = AsnConvert.serialize(new RevokedCertificate({\n userCertificate: args[0],\n revocationDate: new Time(args[1]),\n crlEntryExtensions: args[2],\n }));\n }\n super(raw, RevokedCertificate);\n }\n onInit(asn) {\n this.serialNumber = Convert.ToHex(asn.userCertificate);\n this.revocationDate = asn.revocationDate.getTime();\n this.extensions = [];\n if (asn.crlEntryExtensions) {\n this.extensions = asn.crlEntryExtensions.map((o) => {\n const extension = ExtensionFactory.create(AsnConvert.serialize(o));\n switch (extension.type) {\n case id_ce_cRLReasons:\n this.reason = AsnConvert.parse(extension.value, CRLReason).reason;\n break;\n case id_ce_invalidityDate:\n this.invalidity = AsnConvert.parse(extension.value, InvalidityDate).value;\n break;\n }\n return extension;\n });\n }\n }\n}\n\nclass X509Crl extends PemData {\n constructor(param) {\n if (PemData.isAsnEncoded(param)) {\n super(param, CertificateList);\n }\n else {\n super(param);\n }\n this.tag = PemConverter.CrlTag;\n }\n onInit(asn) {\n var _a, _b;\n const tbs = asn.tbsCertList;\n this.tbs = AsnConvert.serialize(tbs);\n this.version = tbs.version;\n const algProv = container.resolve(diAlgorithmProvider);\n this.signatureAlgorithm = algProv.toWebAlgorithm(asn.signatureAlgorithm);\n this.tbsCertListSignatureAlgorithm = tbs.signature;\n this.certListSignatureAlgorithm = asn.signatureAlgorithm;\n this.signature = asn.signature;\n this.issuerName = new Name(tbs.issuer);\n this.issuer = this.issuerName.toString();\n const thisUpdate = tbs.thisUpdate.getTime();\n if (!thisUpdate) {\n throw new Error(\"Cannot get 'thisUpdate' value\");\n }\n this.thisUpdate = thisUpdate;\n const nextUpdate = (_a = tbs.nextUpdate) === null || _a === void 0 ? void 0 : _a.getTime();\n this.nextUpdate = nextUpdate;\n this.entries = ((_b = tbs.revokedCertificates) === null || _b === void 0 ? void 0 : _b.map(o => new X509CrlEntry(AsnConvert.serialize(o)))) || [];\n this.extensions = [];\n if (tbs.crlExtensions) {\n this.extensions = tbs.crlExtensions.map((o) => ExtensionFactory.create(AsnConvert.serialize(o)));\n }\n }\n getExtension(type) {\n for (const ext of this.extensions) {\n if (typeof type === \"string\") {\n if (ext.type === type) {\n return ext;\n }\n }\n else {\n if (ext instanceof type) {\n return ext;\n }\n }\n }\n return null;\n }\n getExtensions(type) {\n return this.extensions.filter((o) => {\n if (typeof type === \"string\") {\n return o.type === type;\n }\n else {\n return o instanceof type;\n }\n });\n }\n async verify(params, crypto = cryptoProvider.get()) {\n if (!this.certListSignatureAlgorithm.isEqual(this.tbsCertListSignatureAlgorithm)) {\n throw new Error(\"algorithm identifier in the sequence tbsCertList and CertificateList mismatch\");\n }\n let keyAlgorithm;\n let publicKey;\n const paramsKey = params.publicKey;\n try {\n if (paramsKey instanceof X509Certificate) {\n keyAlgorithm = {\n ...paramsKey.publicKey.algorithm,\n ...paramsKey.signatureAlgorithm,\n };\n publicKey = await paramsKey.publicKey.export(keyAlgorithm, [\"verify\"]);\n }\n else if (paramsKey instanceof PublicKey) {\n keyAlgorithm = { ...paramsKey.algorithm, ...this.signature };\n publicKey = await paramsKey.export(keyAlgorithm, [\"verify\"]);\n }\n else {\n keyAlgorithm = { ...paramsKey.algorithm, ...this.signature };\n publicKey = paramsKey;\n }\n }\n catch (e) {\n return false;\n }\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let signature = null;\n for (const signatureFormatter of signatureFormatters) {\n signature = signatureFormatter.toWebSignature(keyAlgorithm, this.signature);\n if (signature) {\n break;\n }\n }\n if (!signature) {\n throw Error(\"Cannot convert ASN.1 signature value to WebCrypto format\");\n }\n return await crypto.subtle.verify(this.signatureAlgorithm, publicKey, signature, this.tbs);\n }\n async getThumbprint(...args) {\n let crypto;\n let algorithm = \"SHA-1\";\n if (args[0]) {\n if (!args[0].subtle) {\n algorithm = args[0] || algorithm;\n crypto = args[1];\n }\n else {\n crypto = args[0];\n }\n }\n crypto !== null && crypto !== void 0 ? crypto : (crypto = cryptoProvider.get());\n return await crypto.subtle.digest(algorithm, this.rawData);\n }\n findRevoked(certOrSerialNumber) {\n const serialNumber = typeof certOrSerialNumber === \"string\" ? certOrSerialNumber : certOrSerialNumber.serialNumber;\n for (const entry of this.entries) {\n if (entry.serialNumber === serialNumber) {\n return entry;\n }\n }\n return null;\n }\n}\n\nclass X509CrlGenerator {\n static async create(params, crypto = cryptoProvider.get()) {\n var _a;\n const name = params.issuer instanceof Name\n ? params.issuer\n : new Name(params.issuer);\n const asnX509Crl = new asn1X509.CertificateList({\n tbsCertList: new asn1X509.TBSCertList({\n version: asn1X509.Version.v2,\n issuer: AsnConvert.parse(name.toArrayBuffer(), asn1X509.Name),\n thisUpdate: new Time(params.thisUpdate || new Date()),\n }),\n });\n if (params.nextUpdate) {\n asnX509Crl.tbsCertList.nextUpdate = new Time(params.nextUpdate);\n }\n if (params.extensions && params.extensions.length) {\n asnX509Crl.tbsCertList.crlExtensions = new asn1X509.Extensions(params.extensions.map(o => AsnConvert.parse(o.rawData, asn1X509.Extension)) || []);\n }\n if (params.entries && params.entries.length) {\n asnX509Crl.tbsCertList.revokedCertificates = [];\n for (const entry of params.entries) {\n const userCertificate = PemData.toArrayBuffer(entry.serialNumber);\n const index = asnX509Crl.tbsCertList.revokedCertificates.findIndex(cert => isEqual(cert.userCertificate, userCertificate));\n if (index > -1) {\n throw new Error(`Certificate serial number ${entry.serialNumber} already exists in tbsCertList`);\n }\n const revokedCert = new RevokedCertificate({\n userCertificate: userCertificate,\n revocationDate: new Time(entry.revocationDate || new Date())\n });\n if (\"extensions\" in entry && ((_a = entry.extensions) === null || _a === void 0 ? void 0 : _a.length)) {\n revokedCert.crlEntryExtensions = entry.extensions.map(o => AsnConvert.parse(o.rawData, asn1X509.Extension));\n }\n else {\n revokedCert.crlEntryExtensions = [];\n }\n if (!(entry instanceof X509CrlEntry)) {\n if (entry.reason) {\n revokedCert.crlEntryExtensions.push(new asn1X509.Extension({\n extnID: asn1X509.id_ce_cRLReasons,\n critical: false,\n extnValue: new OctetString(AsnConvert.serialize(new asn1X509.CRLReason(entry.reason))),\n }));\n }\n if (entry.invalidity) {\n revokedCert.crlEntryExtensions.push(new asn1X509.Extension({\n extnID: asn1X509.id_ce_invalidityDate,\n critical: false,\n extnValue: new OctetString(AsnConvert.serialize(new asn1X509.InvalidityDate(entry.invalidity))),\n }));\n }\n if (entry.issuer) {\n const name = params.issuer instanceof Name\n ? params.issuer\n : new Name(params.issuer);\n revokedCert.crlEntryExtensions.push(new asn1X509.Extension({\n extnID: asn1X509.id_ce_certificateIssuer,\n critical: false,\n extnValue: new OctetString(AsnConvert.serialize(AsnConvert.parse(name.toArrayBuffer(), asn1X509.Name))),\n }));\n }\n }\n asnX509Crl.tbsCertList.revokedCertificates.push(revokedCert);\n }\n }\n const signingAlgorithm = { ...params.signingAlgorithm, ...params.signingKey.algorithm };\n const algProv = container.resolve(diAlgorithmProvider);\n asnX509Crl.tbsCertList.signature = asnX509Crl.signatureAlgorithm = algProv.toAsnAlgorithm(signingAlgorithm);\n const tbs = AsnConvert.serialize(asnX509Crl.tbsCertList);\n const signature = await crypto.subtle.sign(signingAlgorithm, params.signingKey, tbs);\n const signatureFormatters = container.resolveAll(diAsnSignatureFormatter).reverse();\n let asnSignature = null;\n for (const signatureFormatter of signatureFormatters) {\n asnSignature = signatureFormatter.toAsnSignature(signingAlgorithm, signature);\n if (asnSignature) {\n break;\n }\n }\n if (!asnSignature) {\n throw Error(\"Cannot convert ASN.1 signature value to WebCrypto format\");\n }\n asnX509Crl.signature = asnSignature;\n return new X509Crl(AsnConvert.serialize(asnX509Crl));\n }\n}\n\nExtensionFactory.register(asn1X509.id_ce_basicConstraints, BasicConstraintsExtension);\nExtensionFactory.register(asn1X509.id_ce_extKeyUsage, ExtendedKeyUsageExtension);\nExtensionFactory.register(asn1X509.id_ce_keyUsage, KeyUsagesExtension);\nExtensionFactory.register(asn1X509.id_ce_subjectKeyIdentifier, SubjectKeyIdentifierExtension);\nExtensionFactory.register(asn1X509.id_ce_authorityKeyIdentifier, AuthorityKeyIdentifierExtension);\nExtensionFactory.register(asn1X509.id_ce_subjectAltName, SubjectAlternativeNameExtension);\nExtensionFactory.register(asn1X509.id_ce_cRLDistributionPoints, CRLDistributionPointsExtension);\nExtensionFactory.register(asn1X509.id_pe_authorityInfoAccess, AuthorityInfoAccessExtension);\nAttributeFactory.register(asnPkcs9.id_pkcs9_at_challengePassword, ChallengePasswordAttribute);\nAttributeFactory.register(asnPkcs9.id_pkcs9_at_extensionRequest, ExtensionsAttribute);\ncontainer.registerSingleton(diAsnSignatureFormatter, AsnDefaultSignatureFormatter);\ncontainer.registerSingleton(diAsnSignatureFormatter, AsnEcSignatureFormatter);\nAsnEcSignatureFormatter.namedCurveSize.set(\"P-256\", 32);\nAsnEcSignatureFormatter.namedCurveSize.set(\"K-256\", 32);\nAsnEcSignatureFormatter.namedCurveSize.set(\"P-384\", 48);\nAsnEcSignatureFormatter.namedCurveSize.set(\"P-521\", 66);\n\nexport { AlgorithmProvider, AsnData, AsnDefaultSignatureFormatter, AsnEcSignatureFormatter, Attribute, AttributeFactory, AuthorityInfoAccessExtension, AuthorityKeyIdentifierExtension, BasicConstraintsExtension, CRLDistributionPointsExtension, CertificatePolicyExtension, ChallengePasswordAttribute, CryptoProvider, DefaultAlgorithmSerializer, EcAlgorithm, EdAlgorithm, ExtendedKeyUsage, ExtendedKeyUsageExtension, Extension, ExtensionFactory, ExtensionsAttribute, GeneralName, GeneralNames, KeyUsageFlags, KeyUsagesExtension, Name, NameIdentifier, OidSerializer, PemConverter, Pkcs10CertificateRequest, Pkcs10CertificateRequestGenerator, PublicKey, RsaAlgorithm, ShaAlgorithm, SubjectAlternativeNameExtension, SubjectKeyIdentifierExtension, TextConverter, TextObject, X509Certificate, X509CertificateGenerator, X509Certificates, X509ChainBuilder, X509Crl, X509CrlEntry, X509CrlGenerator, X509CrlReason, cryptoProvider, diAlgorithm, diAlgorithmProvider, diAsnSignatureFormatter, idEd25519, idEd448, idX25519, idX448 };\n","import { SizeExceedsPaddingSizeError, } from '../../errors/data.js';\nexport function pad(hexOrBytes, { dir, size = 32 } = {}) {\n if (typeof hexOrBytes === 'string')\n return padHex(hexOrBytes, { dir, size });\n return padBytes(hexOrBytes, { dir, size });\n}\nexport function padHex(hex_, { dir, size = 32 } = {}) {\n if (size === null)\n return hex_;\n const hex = hex_.replace('0x', '');\n if (hex.length > size * 2)\n throw new SizeExceedsPaddingSizeError({\n size: Math.ceil(hex.length / 2),\n targetSize: size,\n type: 'hex',\n });\n return `0x${hex[dir === 'right' ? 'padEnd' : 'padStart'](size * 2, '0')}`;\n}\nexport function padBytes(bytes, { dir, size = 32 } = {}) {\n if (size === null)\n return bytes;\n if (bytes.length > size)\n throw new SizeExceedsPaddingSizeError({\n size: bytes.length,\n targetSize: size,\n type: 'bytes',\n });\n const paddedBytes = new Uint8Array(size);\n for (let i = 0; i < size; i++) {\n const padEnd = dir === 'right';\n paddedBytes[padEnd ? i : size - i - 1] =\n bytes[padEnd ? i : bytes.length - i - 1];\n }\n return paddedBytes;\n}\n//# sourceMappingURL=pad.js.map","/* The MIT License (MIT)\n *\n * Copyright 2015-2018 Peter A. Bigot\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * all copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n * THE SOFTWARE.\n */\n/**\n * Support for translating between Uint8Array instances and JavaScript\n * native types.\n *\n * {@link module:Layout~Layout|Layout} is the basis of a class\n * hierarchy that associates property names with sequences of encoded\n * bytes.\n *\n * Layouts are supported for these scalar (numeric) types:\n * * {@link module:Layout~UInt|Unsigned integers in little-endian\n * format} with {@link module:Layout.u8|8-bit}, {@link\n * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit},\n * {@link module:Layout.u32|32-bit}, {@link\n * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit}\n * representation ranges;\n * * {@link module:Layout~UIntBE|Unsigned integers in big-endian\n * format} with {@link module:Layout.u16be|16-bit}, {@link\n * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit},\n * {@link module:Layout.u40be|40-bit}, and {@link\n * module:Layout.u48be|48-bit} representation ranges;\n * * {@link module:Layout~Int|Signed integers in little-endian\n * format} with {@link module:Layout.s8|8-bit}, {@link\n * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit},\n * {@link module:Layout.s32|32-bit}, {@link\n * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit}\n * representation ranges;\n * * {@link module:Layout~IntBE|Signed integers in big-endian format}\n * with {@link module:Layout.s16be|16-bit}, {@link\n * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit},\n * {@link module:Layout.s40be|40-bit}, and {@link\n * module:Layout.s48be|48-bit} representation ranges;\n * * 64-bit integral values that decode to an exact (if magnitude is\n * less than 2^53) or nearby integral Number in {@link\n * module:Layout.nu64|unsigned little-endian}, {@link\n * module:Layout.nu64be|unsigned big-endian}, {@link\n * module:Layout.ns64|signed little-endian}, and {@link\n * module:Layout.ns64be|unsigned big-endian} encodings;\n * * 32-bit floating point values with {@link\n * module:Layout.f32|little-endian} and {@link\n * module:Layout.f32be|big-endian} representations;\n * * 64-bit floating point values with {@link\n * module:Layout.f64|little-endian} and {@link\n * module:Layout.f64be|big-endian} representations;\n * * {@link module:Layout.const|Constants} that take no space in the\n * encoded expression.\n *\n * and for these aggregate types:\n * * {@link module:Layout.seq|Sequence}s of instances of a {@link\n * module:Layout~Layout|Layout}, with JavaScript representation as\n * an Array and constant or data-dependent {@link\n * module:Layout~Sequence#count|length};\n * * {@link module:Layout.struct|Structure}s that aggregate a\n * heterogeneous sequence of {@link module:Layout~Layout|Layout}\n * instances, with JavaScript representation as an Object;\n * * {@link module:Layout.union|Union}s that support multiple {@link\n * module:Layout~VariantLayout|variant layouts} over a fixed\n * (padded) or variable (not padded) span of bytes, using an\n * unsigned integer at the start of the data or a separate {@link\n * module:Layout.unionLayoutDiscriminator|layout element} to\n * determine which layout to use when interpreting the buffer\n * contents;\n * * {@link module:Layout.bits|BitStructure}s that contain a sequence\n * of individual {@link\n * module:Layout~BitStructure#addField|BitField}s packed into an 8,\n * 16, 24, or 32-bit unsigned integer starting at the least- or\n * most-significant bit;\n * * {@link module:Layout.cstr|C strings} of varying length;\n * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link\n * module:Layout~Blob#length|length} raw data.\n *\n * All {@link module:Layout~Layout|Layout} instances are immutable\n * after construction, to prevent internal state from becoming\n * inconsistent.\n *\n * @local Layout\n * @local ExternalLayout\n * @local GreedyCount\n * @local OffsetLayout\n * @local UInt\n * @local UIntBE\n * @local Int\n * @local IntBE\n * @local NearUInt64\n * @local NearUInt64BE\n * @local NearInt64\n * @local NearInt64BE\n * @local Float\n * @local FloatBE\n * @local Double\n * @local DoubleBE\n * @local Sequence\n * @local Structure\n * @local UnionDiscriminator\n * @local UnionLayoutDiscriminator\n * @local Union\n * @local VariantLayout\n * @local BitStructure\n * @local BitField\n * @local Boolean\n * @local Blob\n * @local CString\n * @local Constant\n * @local bindConstructorLayout\n * @module Layout\n * @license MIT\n * @author Peter A. Bigot\n * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}\n */\n'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.s16 = exports.s8 = exports.nu64be = exports.u48be = exports.u40be = exports.u32be = exports.u24be = exports.u16be = exports.nu64 = exports.u48 = exports.u40 = exports.u32 = exports.u24 = exports.u16 = exports.u8 = exports.offset = exports.greedy = exports.Constant = exports.UTF8 = exports.CString = exports.Blob = exports.Boolean = exports.BitField = exports.BitStructure = exports.VariantLayout = exports.Union = exports.UnionLayoutDiscriminator = exports.UnionDiscriminator = exports.Structure = exports.Sequence = exports.DoubleBE = exports.Double = exports.FloatBE = exports.Float = exports.NearInt64BE = exports.NearInt64 = exports.NearUInt64BE = exports.NearUInt64 = exports.IntBE = exports.Int = exports.UIntBE = exports.UInt = exports.OffsetLayout = exports.GreedyCount = exports.ExternalLayout = exports.bindConstructorLayout = exports.nameWithProperty = exports.Layout = exports.uint8ArrayToBuffer = exports.checkUint8Array = void 0;\nexports.constant = exports.utf8 = exports.cstr = exports.blob = exports.unionLayoutDiscriminator = exports.union = exports.seq = exports.bits = exports.struct = exports.f64be = exports.f64 = exports.f32be = exports.f32 = exports.ns64be = exports.s48be = exports.s40be = exports.s32be = exports.s24be = exports.s16be = exports.ns64 = exports.s48 = exports.s40 = exports.s32 = exports.s24 = void 0;\nconst buffer_1 = require(\"buffer\");\n/* Check if a value is a Uint8Array.\n *\n * @ignore */\nfunction checkUint8Array(b) {\n if (!(b instanceof Uint8Array)) {\n throw new TypeError('b must be a Uint8Array');\n }\n}\nexports.checkUint8Array = checkUint8Array;\n/* Create a Buffer instance from a Uint8Array.\n *\n * @ignore */\nfunction uint8ArrayToBuffer(b) {\n checkUint8Array(b);\n return buffer_1.Buffer.from(b.buffer, b.byteOffset, b.length);\n}\nexports.uint8ArrayToBuffer = uint8ArrayToBuffer;\n/**\n * Base class for layout objects.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * Layout#encode|encode} or {@link Layout#decode|decode} functions.\n *\n * @param {Number} span - Initializer for {@link Layout#span|span}. The\n * parameter must be an integer; a negative value signifies that the\n * span is {@link Layout#getSpan|value-specific}.\n *\n * @param {string} [property] - Initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n */\nclass Layout {\n constructor(span, property) {\n if (!Number.isInteger(span)) {\n throw new TypeError('span must be an integer');\n }\n /** The span of the layout in bytes.\n *\n * Positive values are generally expected.\n *\n * Zero will only appear in {@link Constant}s and in {@link\n * Sequence}s where the {@link Sequence#count|count} is zero.\n *\n * A negative value indicates that the span is value-specific, and\n * must be obtained using {@link Layout#getSpan|getSpan}. */\n this.span = span;\n /** The property name used when this layout is represented in an\n * Object.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances. If left undefined the span of the unnamed layout will\n * be treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Function to create an Object into which decoded properties will\n * be written.\n *\n * Used only for layouts that {@link Layout#decode|decode} to Object\n * instances, which means:\n * * {@link Structure}\n * * {@link Union}\n * * {@link VariantLayout}\n * * {@link BitStructure}\n *\n * If left undefined the JavaScript representation of these layouts\n * will be Object instances.\n *\n * See {@link bindConstructorLayout}.\n */\n makeDestinationObject() {\n return {};\n }\n /**\n * Calculate the span of a specific instance of a layout.\n *\n * @param {Uint8Array} b - the buffer that contains an encoded instance.\n *\n * @param {Number} [offset] - the offset at which the encoded instance\n * starts. If absent a zero offset is inferred.\n *\n * @return {Number} - the number of bytes covered by the layout\n * instance. If this method is not overridden in a subclass the\n * definition-time constant {@link Layout#span|span} will be\n * returned.\n *\n * @throws {RangeError} - if the length of the value cannot be\n * determined.\n */\n getSpan(b, offset) {\n if (0 > this.span) {\n throw new RangeError('indeterminate span');\n }\n return this.span;\n }\n /**\n * Replicate the layout using a new property.\n *\n * This function must be used to get a structurally-equivalent layout\n * with a different name since all {@link Layout} instances are\n * immutable.\n *\n * **NOTE** This is a shallow copy. All fields except {@link\n * Layout#property|property} are strictly equal to the origin layout.\n *\n * @param {String} property - the value for {@link\n * Layout#property|property} in the replica.\n *\n * @returns {Layout} - the copy with {@link Layout#property|property}\n * set to `property`.\n */\n replicate(property) {\n const rv = Object.create(this.constructor.prototype);\n Object.assign(rv, this);\n rv.property = property;\n return rv;\n }\n /**\n * Create an object from layout properties and an array of values.\n *\n * **NOTE** This function returns `undefined` if invoked on a layout\n * that does not return its value as an Object. Objects are\n * returned for things that are a {@link Structure}, which includes\n * {@link VariantLayout|variant layouts} if they are structures, and\n * excludes {@link Union}s. If you want this feature for a union\n * you must use {@link Union.getVariant|getVariant} to select the\n * desired layout.\n *\n * @param {Array} values - an array of values that correspond to the\n * default order for properties. As with {@link Layout#decode|decode}\n * layout elements that have no property name are skipped when\n * iterating over the array values. Only the top-level properties are\n * assigned; arguments are not assigned to properties of contained\n * layouts. Any unused values are ignored.\n *\n * @return {(Object|undefined)}\n */\n fromArray(values) {\n return undefined;\n }\n}\nexports.Layout = Layout;\n/* Provide text that carries a name (such as for a function that will\n * be throwing an error) annotated with the property of a given layout\n * (such as one for which the value was unacceptable).\n *\n * @ignore */\nfunction nameWithProperty(name, lo) {\n if (lo.property) {\n return name + '[' + lo.property + ']';\n }\n return name;\n}\nexports.nameWithProperty = nameWithProperty;\n/**\n * Augment a class so that instances can be encoded/decoded using a\n * given layout.\n *\n * Calling this function couples `Class` with `layout` in several ways:\n *\n * * `Class.layout_` becomes a static member property equal to `layout`;\n * * `layout.boundConstructor_` becomes a static member property equal\n * to `Class`;\n * * The {@link Layout#makeDestinationObject|makeDestinationObject()}\n * property of `layout` is set to a function that returns a `new\n * Class()`;\n * * `Class.decode(b, offset)` becomes a static member function that\n * delegates to {@link Layout#decode|layout.decode}. The\n * synthesized function may be captured and extended.\n * * `Class.prototype.encode(b, offset)` provides an instance member\n * function that delegates to {@link Layout#encode|layout.encode}\n * with `src` set to `this`. The synthesized function may be\n * captured and extended, but when the extension is invoked `this`\n * must be explicitly bound to the instance.\n *\n * @param {class} Class - a JavaScript class with a nullary\n * constructor.\n *\n * @param {Layout} layout - the {@link Layout} instance used to encode\n * instances of `Class`.\n */\n// `Class` must be a constructor Function, but the assignment of a `layout_` property to it makes it difficult to type\n// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types\nfunction bindConstructorLayout(Class, layout) {\n if ('function' !== typeof Class) {\n throw new TypeError('Class must be constructor');\n }\n if (Object.prototype.hasOwnProperty.call(Class, 'layout_')) {\n throw new Error('Class is already bound to a layout');\n }\n if (!(layout && (layout instanceof Layout))) {\n throw new TypeError('layout must be a Layout');\n }\n if (Object.prototype.hasOwnProperty.call(layout, 'boundConstructor_')) {\n throw new Error('layout is already bound to a constructor');\n }\n Class.layout_ = layout;\n layout.boundConstructor_ = Class;\n layout.makeDestinationObject = (() => new Class());\n Object.defineProperty(Class.prototype, 'encode', {\n value(b, offset) {\n return layout.encode(this, b, offset);\n },\n writable: true,\n });\n Object.defineProperty(Class, 'decode', {\n value(b, offset) {\n return layout.decode(b, offset);\n },\n writable: true,\n });\n}\nexports.bindConstructorLayout = bindConstructorLayout;\n/**\n * An object that behaves like a layout but does not consume space\n * within its containing layout.\n *\n * This is primarily used to obtain metadata about a member, such as a\n * {@link OffsetLayout} that can provide data about a {@link\n * Layout#getSpan|value-specific span}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support {@link\n * ExternalLayout#isCount|isCount} or other {@link Layout} functions.\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @abstract\n * @augments {Layout}\n */\nclass ExternalLayout extends Layout {\n /**\n * Return `true` iff the external layout decodes to an unsigned\n * integer layout.\n *\n * In that case it can be used as the source of {@link\n * Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths},\n * or as {@link UnionLayoutDiscriminator#layout|external union\n * discriminators}.\n *\n * @abstract\n */\n isCount() {\n throw new Error('ExternalLayout is abstract');\n }\n}\nexports.ExternalLayout = ExternalLayout;\n/**\n * An {@link ExternalLayout} that determines its {@link\n * Layout#decode|value} based on offset into and length of the buffer\n * on which it is invoked.\n *\n * *Factory*: {@link module:Layout.greedy|greedy}\n *\n * @param {Number} [elementSpan] - initializer for {@link\n * GreedyCount#elementSpan|elementSpan}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {ExternalLayout}\n */\nclass GreedyCount extends ExternalLayout {\n constructor(elementSpan = 1, property) {\n if ((!Number.isInteger(elementSpan)) || (0 >= elementSpan)) {\n throw new TypeError('elementSpan must be a (positive) integer');\n }\n super(-1, property);\n /** The layout for individual elements of the sequence. The value\n * must be a positive integer. If not provided, the value will be\n * 1. */\n this.elementSpan = elementSpan;\n }\n /** @override */\n isCount() {\n return true;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const rem = b.length - offset;\n return Math.floor(rem / this.elementSpan);\n }\n /** @override */\n encode(src, b, offset) {\n return 0;\n }\n}\nexports.GreedyCount = GreedyCount;\n/**\n * An {@link ExternalLayout} that supports accessing a {@link Layout}\n * at a fixed offset from the start of another Layout. The offset may\n * be before, within, or after the base layout.\n *\n * *Factory*: {@link module:Layout.offset|offset}\n *\n * @param {Layout} layout - initializer for {@link\n * OffsetLayout#layout|layout}, modulo `property`.\n *\n * @param {Number} [offset] - Initializes {@link\n * OffsetLayout#offset|offset}. Defaults to zero.\n *\n * @param {string} [property] - Optional new property name for a\n * {@link Layout#replicate| replica} of `layout` to be used as {@link\n * OffsetLayout#layout|layout}. If not provided the `layout` is used\n * unchanged.\n *\n * @augments {Layout}\n */\nclass OffsetLayout extends ExternalLayout {\n constructor(layout, offset = 0, property) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if (!Number.isInteger(offset)) {\n throw new TypeError('offset must be integer or undefined');\n }\n super(layout.span, property || layout.property);\n /** The subordinated layout. */\n this.layout = layout;\n /** The location of {@link OffsetLayout#layout} relative to the\n * start of another layout.\n *\n * The value may be positive or negative, but an error will thrown\n * if at the point of use it goes outside the span of the Uint8Array\n * being accessed. */\n this.offset = offset;\n }\n /** @override */\n isCount() {\n return ((this.layout instanceof UInt)\n || (this.layout instanceof UIntBE));\n }\n /** @override */\n decode(b, offset = 0) {\n return this.layout.decode(b, offset + this.offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n return this.layout.encode(src, b, offset + this.offset);\n }\n}\nexports.OffsetLayout = OffsetLayout;\n/**\n * Represent an unsigned integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.u8|u8}, {@link\n * module:Layout.u16|u16}, {@link module:Layout.u24|u24}, {@link\n * module:Layout.u32|u32}, {@link module:Layout.u40|u40}, {@link\n * module:Layout.u48|u48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UInt extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UInt = UInt;\n/**\n * Represent an unsigned integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.u8be|u8be}, {@link\n * module:Layout.u16be|u16be}, {@link module:Layout.u24be|u24be},\n * {@link module:Layout.u32be|u32be}, {@link\n * module:Layout.u40be|u40be}, {@link module:Layout.u48be|u48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UIntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readUIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeUIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.UIntBE = UIntBE;\n/**\n * Represent a signed integer in little-endian format.\n *\n * *Factory*: {@link module:Layout.s8|s8}, {@link\n * module:Layout.s16|s16}, {@link module:Layout.s24|s24}, {@link\n * module:Layout.s32|s32}, {@link module:Layout.s40|s40}, {@link\n * module:Layout.s48|s48}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Int extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntLE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntLE(src, offset, this.span);\n return this.span;\n }\n}\nexports.Int = Int;\n/**\n * Represent a signed integer in big-endian format.\n *\n * *Factory*: {@link module:Layout.s8be|s8be}, {@link\n * module:Layout.s16be|s16be}, {@link module:Layout.s24be|s24be},\n * {@link module:Layout.s32be|s32be}, {@link\n * module:Layout.s40be|s40be}, {@link module:Layout.s48be|s48be}\n *\n * @param {Number} span - initializer for {@link Layout#span|span}.\n * The parameter can range from 1 through 6.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass IntBE extends Layout {\n constructor(span, property) {\n super(span, property);\n if (6 < this.span) {\n throw new RangeError('span must not exceed 6 bytes');\n }\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readIntBE(offset, this.span);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeIntBE(src, offset, this.span);\n return this.span;\n }\n}\nexports.IntBE = IntBE;\nconst V2E32 = Math.pow(2, 32);\n/* True modulus high and low 32-bit words, where low word is always\n * non-negative. */\nfunction divmodInt64(src) {\n const hi32 = Math.floor(src / V2E32);\n const lo32 = src - (hi32 * V2E32);\n return { hi32, lo32 };\n}\n/* Reconstruct Number from quotient and non-negative remainder */\nfunction roundedInt64(hi32, lo32) {\n return hi32 * V2E32 + lo32;\n}\n/**\n * Represent an unsigned 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64|nu64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readUInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeUInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64 = NearUInt64;\n/**\n * Represent an unsigned 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.nu64be|nu64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearUInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readUInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearUInt64BE = NearUInt64BE;\n/**\n * Represent a signed 64-bit integer in little-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64|ns64}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64 extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const lo32 = buffer.readUInt32LE(offset);\n const hi32 = buffer.readInt32LE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeUInt32LE(split.lo32, offset);\n buffer.writeInt32LE(split.hi32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64 = NearInt64;\n/**\n * Represent a signed 64-bit integer in big-endian format when\n * encoded and as a near integral JavaScript Number when decoded.\n *\n * *Factory*: {@link module:Layout.ns64be|ns64be}\n *\n * **NOTE** Values with magnitude greater than 2^52 may not decode to\n * the exact value of the encoded representation.\n *\n * @augments {Layout}\n */\nclass NearInt64BE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n const buffer = uint8ArrayToBuffer(b);\n const hi32 = buffer.readInt32BE(offset);\n const lo32 = buffer.readUInt32BE(offset + 4);\n return roundedInt64(hi32, lo32);\n }\n /** @override */\n encode(src, b, offset = 0) {\n const split = divmodInt64(src);\n const buffer = uint8ArrayToBuffer(b);\n buffer.writeInt32BE(split.hi32, offset);\n buffer.writeUInt32BE(split.lo32, offset + 4);\n return 8;\n }\n}\nexports.NearInt64BE = NearInt64BE;\n/**\n * Represent a 32-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f32|f32}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Float extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatLE(src, offset);\n return 4;\n }\n}\nexports.Float = Float;\n/**\n * Represent a 32-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f32be|f32be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass FloatBE extends Layout {\n constructor(property) {\n super(4, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readFloatBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeFloatBE(src, offset);\n return 4;\n }\n}\nexports.FloatBE = FloatBE;\n/**\n * Represent a 64-bit floating point number in little-endian format.\n *\n * *Factory*: {@link module:Layout.f64|f64}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Double extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleLE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleLE(src, offset);\n return 8;\n }\n}\nexports.Double = Double;\n/**\n * Represent a 64-bit floating point number in big-endian format.\n *\n * *Factory*: {@link module:Layout.f64be|f64be}\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass DoubleBE extends Layout {\n constructor(property) {\n super(8, property);\n }\n /** @override */\n decode(b, offset = 0) {\n return uint8ArrayToBuffer(b).readDoubleBE(offset);\n }\n /** @override */\n encode(src, b, offset = 0) {\n uint8ArrayToBuffer(b).writeDoubleBE(src, offset);\n return 8;\n }\n}\nexports.DoubleBE = DoubleBE;\n/**\n * Represent a contiguous sequence of a specific layout as an Array.\n *\n * *Factory*: {@link module:Layout.seq|seq}\n *\n * @param {Layout} elementLayout - initializer for {@link\n * Sequence#elementLayout|elementLayout}.\n *\n * @param {(Number|ExternalLayout)} count - initializer for {@link\n * Sequence#count|count}. The parameter must be either a positive\n * integer or an instance of {@link ExternalLayout}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Sequence extends Layout {\n constructor(elementLayout, count, property) {\n if (!(elementLayout instanceof Layout)) {\n throw new TypeError('elementLayout must be a Layout');\n }\n if (!(((count instanceof ExternalLayout) && count.isCount())\n || (Number.isInteger(count) && (0 <= count)))) {\n throw new TypeError('count must be non-negative integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if ((!(count instanceof ExternalLayout))\n && (0 < elementLayout.span)) {\n span = count * elementLayout.span;\n }\n super(span, property);\n /** The layout for individual elements of the sequence. */\n this.elementLayout = elementLayout;\n /** The number of elements in the sequence.\n *\n * This will be either a non-negative integer or an instance of\n * {@link ExternalLayout} for which {@link\n * ExternalLayout#isCount|isCount()} is `true`. */\n this.count = count;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n if (0 < this.elementLayout.span) {\n span = count * this.elementLayout.span;\n }\n else {\n let idx = 0;\n while (idx < count) {\n span += this.elementLayout.getSpan(b, offset + span);\n ++idx;\n }\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n const rv = [];\n let i = 0;\n let count = this.count;\n if (count instanceof ExternalLayout) {\n count = count.decode(b, offset);\n }\n while (i < count) {\n rv.push(this.elementLayout.decode(b, offset));\n offset += this.elementLayout.getSpan(b, offset);\n i += 1;\n }\n return rv;\n }\n /** Implement {@link Layout#encode|encode} for {@link Sequence}.\n *\n * **NOTE** If `src` is shorter than {@link Sequence#count|count} then\n * the unused space in the buffer is left unchanged. If `src` is\n * longer than {@link Sequence#count|count} the unneeded elements are\n * ignored.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset = 0) {\n const elo = this.elementLayout;\n const span = src.reduce((span, v) => {\n return span + elo.encode(v, b, offset + span);\n }, 0);\n if (this.count instanceof ExternalLayout) {\n this.count.encode(src.length, b, offset);\n }\n return span;\n }\n}\nexports.Sequence = Sequence;\n/**\n * Represent a contiguous sequence of arbitrary layout elements as an\n * Object.\n *\n * *Factory*: {@link module:Layout.struct|struct}\n *\n * **NOTE** The {@link Layout#span|span} of the structure is variable\n * if any layout in {@link Structure#fields|fields} has a variable\n * span. When {@link Layout#encode|encoding} we must have a value for\n * all variable-length fields, or we wouldn't be able to figure out\n * how much space to use for storage. We can only identify the value\n * for a field when it has a {@link Layout#property|property}. As\n * such, although a structure may contain both unnamed fields and\n * variable-length fields, it cannot contain an unnamed\n * variable-length field.\n *\n * @param {Layout[]} fields - initializer for {@link\n * Structure#fields|fields}. An error is raised if this contains a\n * variable-length field for which a {@link Layout#property|property}\n * is not defined.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @param {Boolean} [decodePrefixes] - initializer for {@link\n * Structure#decodePrefixes|property}.\n *\n * @throws {Error} - if `fields` contains an unnamed variable-length\n * layout.\n *\n * @augments {Layout}\n */\nclass Structure extends Layout {\n constructor(fields, property, decodePrefixes) {\n if (!(Array.isArray(fields)\n && fields.reduce((acc, v) => acc && (v instanceof Layout), true))) {\n throw new TypeError('fields must be array of Layout instances');\n }\n if (('boolean' === typeof property)\n && (undefined === decodePrefixes)) {\n decodePrefixes = property;\n property = undefined;\n }\n /* Verify absence of unnamed variable-length fields. */\n for (const fd of fields) {\n if ((0 > fd.span)\n && (undefined === fd.property)) {\n throw new Error('fields cannot contain unnamed variable-length layout');\n }\n }\n let span = -1;\n try {\n span = fields.reduce((span, fd) => span + fd.getSpan(), 0);\n }\n catch (e) {\n // ignore error\n }\n super(span, property);\n /** The sequence of {@link Layout} values that comprise the\n * structure.\n *\n * The individual elements need not be the same type, and may be\n * either scalar or aggregate layouts. If a member layout leaves\n * its {@link Layout#property|property} undefined the\n * corresponding region of the buffer associated with the element\n * will not be mutated.\n *\n * @type {Layout[]} */\n this.fields = fields;\n /** Control behavior of {@link Layout#decode|decode()} given short\n * buffers.\n *\n * In some situations a structure many be extended with additional\n * fields over time, with older installations providing only a\n * prefix of the full structure. If this property is `true`\n * decoding will accept those buffers and leave subsequent fields\n * undefined, as long as the buffer ends at a field boundary.\n * Defaults to `false`. */\n this.decodePrefixes = !!decodePrefixes;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n let span = 0;\n try {\n span = this.fields.reduce((span, fd) => {\n const fsp = fd.getSpan(b, offset);\n offset += fsp;\n return span + fsp;\n }, 0);\n }\n catch (e) {\n throw new RangeError('indeterminate span');\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n checkUint8Array(b);\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b, offset);\n }\n offset += fd.getSpan(b, offset);\n if (this.decodePrefixes\n && (b.length === offset)) {\n break;\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Structure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the buffer is\n * left unmodified. */\n encode(src, b, offset = 0) {\n const firstOffset = offset;\n let lastOffset = 0;\n let lastWrote = 0;\n for (const fd of this.fields) {\n let span = fd.span;\n lastWrote = (0 < span) ? span : 0;\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n lastWrote = fd.encode(fv, b, offset);\n if (0 > span) {\n /* Read the as-encoded span, which is not necessarily the\n * same as what we wrote. */\n span = fd.getSpan(b, offset);\n }\n }\n }\n lastOffset = offset;\n offset += span;\n }\n /* Use (lastOffset + lastWrote) instead of offset because the last\n * item may have had a dynamic length and we don't want to include\n * the padding between it and the end of the space reserved for\n * it. */\n return (lastOffset + lastWrote) - firstOffset;\n }\n /** @override */\n fromArray(values) {\n const dest = this.makeDestinationObject();\n for (const fd of this.fields) {\n if ((undefined !== fd.property)\n && (0 < values.length)) {\n dest[fd.property] = values.shift();\n }\n }\n return dest;\n }\n /**\n * Get access to the layout of a given property.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Layout} - the layout associated with `property`, or\n * undefined if there is no such property.\n */\n layoutFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n /**\n * Get the offset of a structure member.\n *\n * @param {String} property - the structure member of interest.\n *\n * @return {Number} - the offset in bytes to the start of `property`\n * within the structure, or undefined if `property` is not a field\n * within the structure. If the property is a member but follows a\n * variable-length structure member a negative number will be\n * returned.\n */\n offsetOf(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n let offset = 0;\n for (const fd of this.fields) {\n if (fd.property === property) {\n return offset;\n }\n if (0 > fd.span) {\n offset = -1;\n }\n else if (0 <= offset) {\n offset += fd.span;\n }\n }\n return undefined;\n }\n}\nexports.Structure = Structure;\n/**\n * An object that can provide a {@link\n * Union#discriminator|discriminator} API for {@link Union}.\n *\n * **NOTE** This is an abstract base class; you can create instances\n * if it amuses you, but they won't support the {@link\n * UnionDiscriminator#encode|encode} or {@link\n * UnionDiscriminator#decode|decode} functions.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}.\n *\n * @abstract\n */\nclass UnionDiscriminator {\n constructor(property) {\n /** The {@link Layout#property|property} to be used when the\n * discriminator is referenced in isolation (generally when {@link\n * Union#decode|Union decode} cannot delegate to a specific\n * variant). */\n this.property = property;\n }\n /** Analog to {@link Layout#decode|Layout decode} for union discriminators.\n *\n * The implementation of this method need not reference the buffer if\n * variant information is available through other means. */\n decode(b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n /** Analog to {@link Layout#decode|Layout encode} for union discriminators.\n *\n * The implementation of this method need not store the value if\n * variant information is maintained through other means. */\n encode(src, b, offset) {\n throw new Error('UnionDiscriminator is abstract');\n }\n}\nexports.UnionDiscriminator = UnionDiscriminator;\n/**\n * An object that can provide a {@link\n * UnionDiscriminator|discriminator API} for {@link Union} using an\n * unsigned integral {@link Layout} instance located either inside or\n * outside the union.\n *\n * @param {ExternalLayout} layout - initializes {@link\n * UnionLayoutDiscriminator#layout|layout}. Must satisfy {@link\n * ExternalLayout#isCount|isCount()}.\n *\n * @param {string} [property] - Default for {@link\n * UnionDiscriminator#property|property}, superseding the property\n * from `layout`, but defaulting to `variant` if neither `property`\n * nor layout provide a property name.\n *\n * @augments {UnionDiscriminator}\n */\nclass UnionLayoutDiscriminator extends UnionDiscriminator {\n constructor(layout, property) {\n if (!((layout instanceof ExternalLayout)\n && layout.isCount())) {\n throw new TypeError('layout must be an unsigned integer ExternalLayout');\n }\n super(property || layout.property || 'variant');\n /** The {@link ExternalLayout} used to access the discriminator\n * value. */\n this.layout = layout;\n }\n /** Delegate decoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n decode(b, offset) {\n return this.layout.decode(b, offset);\n }\n /** Delegate encoding to {@link UnionLayoutDiscriminator#layout|layout}. */\n encode(src, b, offset) {\n return this.layout.encode(src, b, offset);\n }\n}\nexports.UnionLayoutDiscriminator = UnionLayoutDiscriminator;\n/**\n * Represent any number of span-compatible layouts.\n *\n * *Factory*: {@link module:Layout.union|union}\n *\n * If the union has a {@link Union#defaultLayout|default layout} that\n * layout must have a non-negative {@link Layout#span|span}. The span\n * of a fixed-span union includes its {@link\n * Union#discriminator|discriminator} if the variant is a {@link\n * Union#usesPrefixDiscriminator|prefix of the union}, plus the span\n * of its {@link Union#defaultLayout|default layout}.\n *\n * If the union does not have a default layout then the encoded span\n * of the union depends on the encoded span of its variant (which may\n * be fixed or variable).\n *\n * {@link VariantLayout#layout|Variant layout}s are added through\n * {@link Union#addVariant|addVariant}. If the union has a default\n * layout, the span of the {@link VariantLayout#layout|layout\n * contained by the variant} must not exceed the span of the {@link\n * Union#defaultLayout|default layout} (minus the span of a {@link\n * Union#usesPrefixDiscriminator|prefix disriminator}, if used). The\n * span of the variant will equal the span of the union itself.\n *\n * The variant for a buffer can only be identified from the {@link\n * Union#discriminator|discriminator} {@link\n * UnionDiscriminator#property|property} (in the case of the {@link\n * Union#defaultLayout|default layout}), or by using {@link\n * Union#getVariant|getVariant} and examining the resulting {@link\n * VariantLayout} instance.\n *\n * A variant compatible with a JavaScript object can be identified\n * using {@link Union#getSourceVariant|getSourceVariant}.\n *\n * @param {(UnionDiscriminator|ExternalLayout|Layout)} discr - How to\n * identify the layout used to interpret the union contents. The\n * parameter must be an instance of {@link UnionDiscriminator}, an\n * {@link ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}, or {@link UInt} (or {@link\n * UIntBE}). When a non-external layout element is passed the layout\n * appears at the start of the union. In all cases the (synthesized)\n * {@link UnionDiscriminator} instance is recorded as {@link\n * Union#discriminator|discriminator}.\n *\n * @param {(Layout|null)} defaultLayout - initializer for {@link\n * Union#defaultLayout|defaultLayout}. If absent defaults to `null`.\n * If `null` there is no default layout: the union has data-dependent\n * length and attempts to decode or encode unrecognized variants will\n * throw an exception. A {@link Layout} instance must have a\n * non-negative {@link Layout#span|span}, and if it lacks a {@link\n * Layout#property|property} the {@link\n * Union#defaultLayout|defaultLayout} will be a {@link\n * Layout#replicate|replica} with property `content`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Union extends Layout {\n constructor(discr, defaultLayout, property) {\n let discriminator;\n if ((discr instanceof UInt)\n || (discr instanceof UIntBE)) {\n discriminator = new UnionLayoutDiscriminator(new OffsetLayout(discr));\n }\n else if ((discr instanceof ExternalLayout)\n && discr.isCount()) {\n discriminator = new UnionLayoutDiscriminator(discr);\n }\n else if (!(discr instanceof UnionDiscriminator)) {\n throw new TypeError('discr must be a UnionDiscriminator '\n + 'or an unsigned integer layout');\n }\n else {\n discriminator = discr;\n }\n if (undefined === defaultLayout) {\n defaultLayout = null;\n }\n if (!((null === defaultLayout)\n || (defaultLayout instanceof Layout))) {\n throw new TypeError('defaultLayout must be null or a Layout');\n }\n if (null !== defaultLayout) {\n if (0 > defaultLayout.span) {\n throw new Error('defaultLayout must have constant span');\n }\n if (undefined === defaultLayout.property) {\n defaultLayout = defaultLayout.replicate('content');\n }\n }\n /* The union span can be estimated only if there's a default\n * layout. The union spans its default layout, plus any prefix\n * variant layout. By construction both layouts, if present, have\n * non-negative span. */\n let span = -1;\n if (defaultLayout) {\n span = defaultLayout.span;\n if ((0 <= span) && ((discr instanceof UInt)\n || (discr instanceof UIntBE))) {\n span += discriminator.layout.span;\n }\n }\n super(span, property);\n /** The interface for the discriminator value in isolation.\n *\n * This a {@link UnionDiscriminator} either passed to the\n * constructor or synthesized from the `discr` constructor\n * argument. {@link\n * Union#usesPrefixDiscriminator|usesPrefixDiscriminator} will be\n * `true` iff the `discr` parameter was a non-offset {@link\n * Layout} instance. */\n this.discriminator = discriminator;\n /** `true` if the {@link Union#discriminator|discriminator} is the\n * first field in the union.\n *\n * If `false` the discriminator is obtained from somewhere\n * else. */\n this.usesPrefixDiscriminator = (discr instanceof UInt)\n || (discr instanceof UIntBE);\n /** The layout for non-discriminator content when the value of the\n * discriminator is not recognized.\n *\n * This is the value passed to the constructor. It is\n * structurally equivalent to the second component of {@link\n * Union#layout|layout} but may have a different property\n * name. */\n this.defaultLayout = defaultLayout;\n /** A registry of allowed variants.\n *\n * The keys are unsigned integers which should be compatible with\n * {@link Union.discriminator|discriminator}. The property value\n * is the corresponding {@link VariantLayout} instances assigned\n * to this union by {@link Union#addVariant|addVariant}.\n *\n * **NOTE** The registry remains mutable so that variants can be\n * {@link Union#addVariant|added} at any time. Users should not\n * manipulate the content of this property. */\n this.registry = {};\n /* Private variable used when invoking getSourceVariant */\n let boundGetSourceVariant = this.defaultGetSourceVariant.bind(this);\n /** Function to infer the variant selected by a source object.\n *\n * Defaults to {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant} but may\n * be overridden using {@link\n * Union#configGetSourceVariant|configGetSourceVariant}.\n *\n * @param {Object} src - as with {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * @returns {(undefined|VariantLayout)} The default variant\n * (`undefined`) or first registered variant that uses a property\n * available in `src`. */\n this.getSourceVariant = function (src) {\n return boundGetSourceVariant(src);\n };\n /** Function to override the implementation of {@link\n * Union#getSourceVariant|getSourceVariant}.\n *\n * Use this if the desired variant cannot be identified using the\n * algorithm of {@link\n * Union#defaultGetSourceVariant|defaultGetSourceVariant}.\n *\n * **NOTE** The provided function will be invoked bound to this\n * Union instance, providing local access to {@link\n * Union#registry|registry}.\n *\n * @param {Function} gsv - a function that follows the API of\n * {@link Union#defaultGetSourceVariant|defaultGetSourceVariant}. */\n this.configGetSourceVariant = function (gsv) {\n boundGetSourceVariant = gsv.bind(this);\n };\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n return this.span;\n }\n /* Default layouts always have non-negative span, so we don't have\n * one and we have to recognize the variant which will in turn\n * determine the span. */\n const vlo = this.getVariant(b, offset);\n if (!vlo) {\n throw new Error('unable to determine span for unrecognized variant');\n }\n return vlo.getSpan(b, offset);\n }\n /**\n * Method to infer a registered Union variant compatible with `src`.\n *\n * The first satisfied rule in the following sequence defines the\n * return value:\n * * If `src` has properties matching the Union discriminator and\n * the default layout, `undefined` is returned regardless of the\n * value of the discriminator property (this ensures the default\n * layout will be used);\n * * If `src` has a property matching the Union discriminator, the\n * value of the discriminator identifies a registered variant, and\n * either (a) the variant has no layout, or (b) `src` has the\n * variant's property, then the variant is returned (because the\n * source satisfies the constraints of the variant it identifies);\n * * If `src` does not have a property matching the Union\n * discriminator, but does have a property matching a registered\n * variant, then the variant is returned (because the source\n * matches a variant without an explicit conflict);\n * * An error is thrown (because we either can't identify a variant,\n * or we were explicitly told the variant but can't satisfy it).\n *\n * @param {Object} src - an object presumed to be compatible with\n * the content of the Union.\n *\n * @return {(undefined|VariantLayout)} - as described above.\n *\n * @throws {Error} - if `src` cannot be associated with a default or\n * registered variant.\n */\n defaultGetSourceVariant(src) {\n if (Object.prototype.hasOwnProperty.call(src, this.discriminator.property)) {\n if (this.defaultLayout && this.defaultLayout.property\n && Object.prototype.hasOwnProperty.call(src, this.defaultLayout.property)) {\n return undefined;\n }\n const vlo = this.registry[src[this.discriminator.property]];\n if (vlo\n && ((!vlo.layout)\n || (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)))) {\n return vlo;\n }\n }\n else {\n for (const tag in this.registry) {\n const vlo = this.registry[tag];\n if (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)) {\n return vlo;\n }\n }\n }\n throw new Error('unable to infer src variant');\n }\n /** Implement {@link Layout#decode|decode} for {@link Union}.\n *\n * If the variant is {@link Union#addVariant|registered} the return\n * value is an instance of that variant, with no explicit\n * discriminator. Otherwise the {@link Union#defaultLayout|default\n * layout} is used to decode the content. */\n decode(b, offset = 0) {\n let dest;\n const dlo = this.discriminator;\n const discr = dlo.decode(b, offset);\n const clo = this.registry[discr];\n if (undefined === clo) {\n const defaultLayout = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dest = this.makeDestinationObject();\n dest[dlo.property] = discr;\n // defaultLayout.property can be undefined, but this is allowed by buffer-layout\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n dest[defaultLayout.property] = defaultLayout.decode(b, offset + contentOffset);\n }\n else {\n dest = clo.decode(b, offset);\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link Union}.\n *\n * This API assumes the `src` object is consistent with the union's\n * {@link Union#defaultLayout|default layout}. To encode variants\n * use the appropriate variant-specific {@link VariantLayout#encode}\n * method. */\n encode(src, b, offset = 0) {\n const vlo = this.getSourceVariant(src);\n if (undefined === vlo) {\n const dlo = this.discriminator;\n // this.defaultLayout is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const clo = this.defaultLayout;\n let contentOffset = 0;\n if (this.usesPrefixDiscriminator) {\n contentOffset = dlo.layout.span;\n }\n dlo.encode(src[dlo.property], b, offset);\n // clo.property is not undefined when vlo is undefined\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return contentOffset + clo.encode(src[clo.property], b, offset + contentOffset);\n }\n return vlo.encode(src, b, offset);\n }\n /** Register a new variant structure within a union. The newly\n * created variant is returned.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} layout - initializer for {@link\n * VariantLayout#layout|layout}.\n *\n * @param {String} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {VariantLayout} */\n addVariant(variant, layout, property) {\n const rv = new VariantLayout(this, variant, layout, property);\n this.registry[variant] = rv;\n return rv;\n }\n /**\n * Get the layout associated with a registered variant.\n *\n * If `vb` does not produce a registered variant the function returns\n * `undefined`.\n *\n * @param {(Number|Uint8Array)} vb - either the variant number, or a\n * buffer from which the discriminator is to be read.\n *\n * @param {Number} offset - offset into `vb` for the start of the\n * union. Used only when `vb` is an instance of {Uint8Array}.\n *\n * @return {({VariantLayout}|undefined)}\n */\n getVariant(vb, offset = 0) {\n let variant;\n if (vb instanceof Uint8Array) {\n variant = this.discriminator.decode(vb, offset);\n }\n else {\n variant = vb;\n }\n return this.registry[variant];\n }\n}\nexports.Union = Union;\n/**\n * Represent a specific variant within a containing union.\n *\n * **NOTE** The {@link Layout#span|span} of the variant may include\n * the span of the {@link Union#discriminator|discriminator} used to\n * identify it, but values read and written using the variant strictly\n * conform to the content of {@link VariantLayout#layout|layout}.\n *\n * **NOTE** User code should not invoke this constructor directly. Use\n * the union {@link Union#addVariant|addVariant} helper method.\n *\n * @param {Union} union - initializer for {@link\n * VariantLayout#union|union}.\n *\n * @param {Number} variant - initializer for {@link\n * VariantLayout#variant|variant}.\n *\n * @param {Layout} [layout] - initializer for {@link\n * VariantLayout#layout|layout}. If absent the variant carries no\n * data.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}. Unlike many other layouts, variant\n * layouts normally include a property name so they can be identified\n * within their containing {@link Union}. The property identifier may\n * be absent only if `layout` is is absent.\n *\n * @augments {Layout}\n */\nclass VariantLayout extends Layout {\n constructor(union, variant, layout, property) {\n if (!(union instanceof Union)) {\n throw new TypeError('union must be a Union');\n }\n if ((!Number.isInteger(variant)) || (0 > variant)) {\n throw new TypeError('variant must be a (non-negative) integer');\n }\n if (('string' === typeof layout)\n && (undefined === property)) {\n property = layout;\n layout = null;\n }\n if (layout) {\n if (!(layout instanceof Layout)) {\n throw new TypeError('layout must be a Layout');\n }\n if ((null !== union.defaultLayout)\n && (0 <= layout.span)\n && (layout.span > union.defaultLayout.span)) {\n throw new Error('variant span exceeds span of containing union');\n }\n if ('string' !== typeof property) {\n throw new TypeError('variant must have a String property');\n }\n }\n let span = union.span;\n if (0 > union.span) {\n span = layout ? layout.span : 0;\n if ((0 <= span) && union.usesPrefixDiscriminator) {\n span += union.discriminator.layout.span;\n }\n }\n super(span, property);\n /** The {@link Union} to which this variant belongs. */\n this.union = union;\n /** The unsigned integral value identifying this variant within\n * the {@link Union#discriminator|discriminator} of the containing\n * union. */\n this.variant = variant;\n /** The {@link Layout} to be used when reading/writing the\n * non-discriminator part of the {@link\n * VariantLayout#union|union}. If `null` the variant carries no\n * data. */\n this.layout = layout || null;\n }\n /** @override */\n getSpan(b, offset = 0) {\n if (0 <= this.span) {\n /* Will be equal to the containing union span if that is not\n * variable. */\n return this.span;\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n /* Span is defined solely by the variant (and prefix discriminator) */\n let span = 0;\n if (this.layout) {\n span = this.layout.getSpan(b, offset + contentOffset);\n }\n return contentOffset + span;\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n if (this !== this.union.getVariant(b, offset)) {\n throw new Error('variant mismatch');\n }\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout) {\n dest[this.property] = this.layout.decode(b, offset + contentOffset);\n }\n else if (this.property) {\n dest[this.property] = true;\n }\n else if (this.union.usesPrefixDiscriminator) {\n dest[this.union.discriminator.property] = this.variant;\n }\n return dest;\n }\n /** @override */\n encode(src, b, offset = 0) {\n let contentOffset = 0;\n if (this.union.usesPrefixDiscriminator) {\n contentOffset = this.union.discriminator.layout.span;\n }\n if (this.layout\n && (!Object.prototype.hasOwnProperty.call(src, this.property))) {\n throw new TypeError('variant lacks property ' + this.property);\n }\n this.union.discriminator.encode(this.variant, b, offset);\n let span = contentOffset;\n if (this.layout) {\n this.layout.encode(src[this.property], b, offset + contentOffset);\n span += this.layout.getSpan(b, offset + contentOffset);\n if ((0 <= this.union.span)\n && (span > this.union.span)) {\n throw new Error('encoded variant overruns containing union');\n }\n }\n return span;\n }\n /** Delegate {@link Layout#fromArray|fromArray} to {@link\n * VariantLayout#layout|layout}. */\n fromArray(values) {\n if (this.layout) {\n return this.layout.fromArray(values);\n }\n return undefined;\n }\n}\nexports.VariantLayout = VariantLayout;\n/** JavaScript chose to define bitwise operations as operating on\n * signed 32-bit values in 2's complement form, meaning any integer\n * with bit 31 set is going to look negative. For right shifts that's\n * not a problem, because `>>>` is a logical shift, but for every\n * other bitwise operator we have to compensate for possible negative\n * results. */\nfunction fixBitwiseResult(v) {\n if (0 > v) {\n v += 0x100000000;\n }\n return v;\n}\n/**\n * Contain a sequence of bit fields as an unsigned integer.\n *\n * *Factory*: {@link module:Layout.bits|bits}\n *\n * This is a container element; within it there are {@link BitField}\n * instances that provide the extracted properties. The container\n * simply defines the aggregate representation and its bit ordering.\n * The representation is an object containing properties with numeric\n * or {@link Boolean} values.\n *\n * {@link BitField}s are added with the {@link\n * BitStructure#addField|addField} and {@link\n * BitStructure#addBoolean|addBoolean} methods.\n\n * @param {Layout} word - initializer for {@link\n * BitStructure#word|word}. The parameter must be an instance of\n * {@link UInt} (or {@link UIntBE}) that is no more than 4 bytes wide.\n *\n * @param {bool} [msb] - `true` if the bit numbering starts at the\n * most significant bit of the containing word; `false` (default) if\n * it starts at the least significant bit of the containing word. If\n * the parameter at this position is a string and `property` is\n * `undefined` the value of this argument will instead be used as the\n * value of `property`.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass BitStructure extends Layout {\n constructor(word, msb, property) {\n if (!((word instanceof UInt)\n || (word instanceof UIntBE))) {\n throw new TypeError('word must be a UInt or UIntBE layout');\n }\n if (('string' === typeof msb)\n && (undefined === property)) {\n property = msb;\n msb = false;\n }\n if (4 < word.span) {\n throw new RangeError('word cannot exceed 32 bits');\n }\n super(word.span, property);\n /** The layout used for the packed value. {@link BitField}\n * instances are packed sequentially depending on {@link\n * BitStructure#msb|msb}. */\n this.word = word;\n /** Whether the bit sequences are packed starting at the most\n * significant bit growing down (`true`), or the least significant\n * bit growing up (`false`).\n *\n * **NOTE** Regardless of this value, the least significant bit of\n * any {@link BitField} value is the least significant bit of the\n * corresponding section of the packed value. */\n this.msb = !!msb;\n /** The sequence of {@link BitField} layouts that comprise the\n * packed structure.\n *\n * **NOTE** The array remains mutable to allow fields to be {@link\n * BitStructure#addField|added} after construction. Users should\n * not manipulate the content of this property.*/\n this.fields = [];\n /* Storage for the value. Capture a variable instead of using an\n * instance property because we don't want anything to change the\n * value without going through the mutator. */\n let value = 0;\n this._packedSetValue = function (v) {\n value = fixBitwiseResult(v);\n return this;\n };\n this._packedGetValue = function () {\n return value;\n };\n }\n /** @override */\n decode(b, offset = 0) {\n const dest = this.makeDestinationObject();\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n dest[fd.property] = fd.decode(b);\n }\n }\n return dest;\n }\n /** Implement {@link Layout#encode|encode} for {@link BitStructure}.\n *\n * If `src` is missing a property for a member with a defined {@link\n * Layout#property|property} the corresponding region of the packed\n * value is left unmodified. Unused bits are also left unmodified. */\n encode(src, b, offset = 0) {\n const value = this.word.decode(b, offset);\n this._packedSetValue(value);\n for (const fd of this.fields) {\n if (undefined !== fd.property) {\n const fv = src[fd.property];\n if (undefined !== fv) {\n fd.encode(fv);\n }\n }\n }\n return this.word.encode(this._packedGetValue(), b, offset);\n }\n /** Register a new bitfield with a containing bit structure. The\n * resulting bitfield is returned.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {BitField} */\n addField(bits, property) {\n const bf = new BitField(this, bits, property);\n this.fields.push(bf);\n return bf;\n }\n /** As with {@link BitStructure#addField|addField} for single-bit\n * fields with `boolean` value representation.\n *\n * @param {string} property - initializer for {@link\n * Layout#property|property}.\n *\n * @return {Boolean} */\n // `Boolean` conflicts with the native primitive type\n // eslint-disable-next-line @typescript-eslint/ban-types\n addBoolean(property) {\n // This is my Boolean, not the Javascript one.\n const bf = new Boolean(this, property);\n this.fields.push(bf);\n return bf;\n }\n /**\n * Get access to the bit field for a given property.\n *\n * @param {String} property - the bit field of interest.\n *\n * @return {BitField} - the field associated with `property`, or\n * undefined if there is no such property.\n */\n fieldFor(property) {\n if ('string' !== typeof property) {\n throw new TypeError('property must be string');\n }\n for (const fd of this.fields) {\n if (fd.property === property) {\n return fd;\n }\n }\n return undefined;\n }\n}\nexports.BitStructure = BitStructure;\n/**\n * Represent a sequence of bits within a {@link BitStructure}.\n *\n * All bit field values are represented as unsigned integers.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addField|addField} helper\n * method.\n *\n * **NOTE** BitField instances are not instances of {@link Layout}\n * since {@link Layout#span|span} measures 8-bit units.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {Number} bits - initializer for {@link BitField#bits|bits}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n */\nclass BitField {\n constructor(container, bits, property) {\n if (!(container instanceof BitStructure)) {\n throw new TypeError('container must be a BitStructure');\n }\n if ((!Number.isInteger(bits)) || (0 >= bits)) {\n throw new TypeError('bits must be positive integer');\n }\n const totalBits = 8 * container.span;\n const usedBits = container.fields.reduce((sum, fd) => sum + fd.bits, 0);\n if ((bits + usedBits) > totalBits) {\n throw new Error('bits too long for span remainder ('\n + (totalBits - usedBits) + ' of '\n + totalBits + ' remain)');\n }\n /** The {@link BitStructure} instance to which this bit field\n * belongs. */\n this.container = container;\n /** The span of this value in bits. */\n this.bits = bits;\n /** A mask of {@link BitField#bits|bits} bits isolating value bits\n * that fit within the field.\n *\n * That is, it masks a value that has not yet been shifted into\n * position within its containing packed integer. */\n this.valueMask = (1 << bits) - 1;\n if (32 === bits) { // shifted value out of range\n this.valueMask = 0xFFFFFFFF;\n }\n /** The offset of the value within the containing packed unsigned\n * integer. The least significant bit of the packed value is at\n * offset zero, regardless of bit ordering used. */\n this.start = usedBits;\n if (this.container.msb) {\n this.start = totalBits - usedBits - bits;\n }\n /** A mask of {@link BitField#bits|bits} isolating the field value\n * within the containing packed unsigned integer. */\n this.wordMask = fixBitwiseResult(this.valueMask << this.start);\n /** The property name used when this bitfield is represented in an\n * Object.\n *\n * Intended to be functionally equivalent to {@link\n * Layout#property}.\n *\n * If left undefined the corresponding span of bits will be\n * treated as padding: it will not be mutated by {@link\n * Layout#encode|encode} nor represented as a property in the\n * decoded Object. */\n this.property = property;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field. */\n decode(b, offset) {\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(word & this.wordMask);\n const value = wordValue >>> this.start;\n return value;\n }\n /** Store a value into the corresponding subsequence of the containing\n * bit field.\n *\n * **NOTE** This is not a specialization of {@link\n * Layout#encode|Layout.encode} and there is no return value. */\n encode(value) {\n if ('number' !== typeof value\n || !Number.isInteger(value)\n || (value !== fixBitwiseResult(value & this.valueMask))) {\n throw new TypeError(nameWithProperty('BitField.encode', this)\n + ' value must be integer not exceeding ' + this.valueMask);\n }\n const word = this.container._packedGetValue();\n const wordValue = fixBitwiseResult(value << this.start);\n this.container._packedSetValue(fixBitwiseResult(word & ~this.wordMask)\n | wordValue);\n }\n}\nexports.BitField = BitField;\n/**\n * Represent a single bit within a {@link BitStructure} as a\n * JavaScript boolean.\n *\n * **NOTE** User code should not invoke this constructor directly.\n * Use the container {@link BitStructure#addBoolean|addBoolean} helper\n * method.\n *\n * @param {BitStructure} container - initializer for {@link\n * BitField#container|container}.\n *\n * @param {string} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {BitField}\n */\n/* eslint-disable no-extend-native */\nclass Boolean extends BitField {\n constructor(container, property) {\n super(container, 1, property);\n }\n /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}.\n *\n * @returns {boolean} */\n decode(b, offset) {\n return !!super.decode(b, offset);\n }\n /** @override */\n encode(value) {\n if ('boolean' === typeof value) {\n // BitField requires integer values\n value = +value;\n }\n super.encode(value);\n }\n}\nexports.Boolean = Boolean;\n/* eslint-enable no-extend-native */\n/**\n * Contain a fixed-length block of arbitrary data, represented as a\n * Uint8Array.\n *\n * *Factory*: {@link module:Layout.blob|blob}\n *\n * @param {(Number|ExternalLayout)} length - initializes {@link\n * Blob#length|length}.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Blob extends Layout {\n constructor(length, property) {\n if (!(((length instanceof ExternalLayout) && length.isCount())\n || (Number.isInteger(length) && (0 <= length)))) {\n throw new TypeError('length must be positive integer '\n + 'or an unsigned integer ExternalLayout');\n }\n let span = -1;\n if (!(length instanceof ExternalLayout)) {\n span = length;\n }\n super(span, property);\n /** The number of bytes in the blob.\n *\n * This may be a non-negative integer, or an instance of {@link\n * ExternalLayout} that satisfies {@link\n * ExternalLayout#isCount|isCount()}. */\n this.length = length;\n }\n /** @override */\n getSpan(b, offset) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return span;\n }\n /** @override */\n decode(b, offset = 0) {\n let span = this.span;\n if (0 > span) {\n span = this.length.decode(b, offset);\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span);\n }\n /** Implement {@link Layout#encode|encode} for {@link Blob}.\n *\n * **NOTE** If {@link Layout#count|count} is an instance of {@link\n * ExternalLayout} then the length of `src` will be encoded as the\n * count after `src` is encoded. */\n encode(src, b, offset) {\n let span = this.length;\n if (this.length instanceof ExternalLayout) {\n span = src.length;\n }\n if (!(src instanceof Uint8Array && span === src.length)) {\n throw new TypeError(nameWithProperty('Blob.encode', this)\n + ' requires (length ' + span + ') Uint8Array as src');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Uint8Array');\n }\n const srcBuffer = uint8ArrayToBuffer(src);\n uint8ArrayToBuffer(b).write(srcBuffer.toString('hex'), offset, span, 'hex');\n if (this.length instanceof ExternalLayout) {\n this.length.encode(span, b, offset);\n }\n return span;\n }\n}\nexports.Blob = Blob;\n/**\n * Contain a `NUL`-terminated UTF8 string.\n *\n * *Factory*: {@link module:Layout.cstr|cstr}\n *\n * **NOTE** Any UTF8 string that incorporates a zero-valued byte will\n * not be correctly decoded by this layout.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass CString extends Layout {\n constructor(property) {\n super(-1, property);\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n let idx = offset;\n while ((idx < b.length) && (0 !== b[idx])) {\n idx += 1;\n }\n return 1 + idx - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n const buffer = uint8ArrayToBuffer(b);\n srcb.copy(buffer, offset);\n buffer[offset + span] = 0;\n return span + 1;\n }\n}\nexports.CString = CString;\n/**\n * Contain a UTF8 string with implicit length.\n *\n * *Factory*: {@link module:Layout.utf8|utf8}\n *\n * **NOTE** Because the length is implicit in the size of the buffer\n * this layout should be used only in isolation, or in a situation\n * where the length can be expressed by operating on a slice of the\n * containing buffer.\n *\n * @param {Number} [maxSpan] - the maximum length allowed for encoded\n * string content. If not provided there is no bound on the allowed\n * content.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass UTF8 extends Layout {\n constructor(maxSpan, property) {\n if (('string' === typeof maxSpan) && (undefined === property)) {\n property = maxSpan;\n maxSpan = undefined;\n }\n if (undefined === maxSpan) {\n maxSpan = -1;\n }\n else if (!Number.isInteger(maxSpan)) {\n throw new TypeError('maxSpan must be an integer');\n }\n super(-1, property);\n /** The maximum span of the layout in bytes.\n *\n * Positive values are generally expected. Zero is abnormal.\n * Attempts to encode or decode a value that exceeds this length\n * will throw a `RangeError`.\n *\n * A negative value indicates that there is no bound on the length\n * of the content. */\n this.maxSpan = maxSpan;\n }\n /** @override */\n getSpan(b, offset = 0) {\n checkUint8Array(b);\n return b.length - offset;\n }\n /** @override */\n decode(b, offset = 0) {\n const span = this.getSpan(b, offset);\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8');\n }\n /** @override */\n encode(src, b, offset = 0) {\n /* Must force this to a string, lest it be a number and the\n * \"utf8-encoding\" below actually allocate a buffer of length\n * src */\n if ('string' !== typeof src) {\n src = String(src);\n }\n const srcb = buffer_1.Buffer.from(src, 'utf8');\n const span = srcb.length;\n if ((0 <= this.maxSpan)\n && (this.maxSpan < span)) {\n throw new RangeError('text length exceeds maxSpan');\n }\n if ((offset + span) > b.length) {\n throw new RangeError('encoding overruns Buffer');\n }\n srcb.copy(uint8ArrayToBuffer(b), offset);\n return span;\n }\n}\nexports.UTF8 = UTF8;\n/**\n * Contain a constant value.\n *\n * This layout may be used in cases where a JavaScript value can be\n * inferred without an expression in the binary encoding. An example\n * would be a {@link VariantLayout|variant layout} where the content\n * is implied by the union {@link Union#discriminator|discriminator}.\n *\n * @param {Object|Number|String} value - initializer for {@link\n * Constant#value|value}. If the value is an object (or array) and\n * the application intends the object to remain unchanged regardless\n * of what is done to values decoded by this layout, the value should\n * be frozen prior passing it to this constructor.\n *\n * @param {String} [property] - initializer for {@link\n * Layout#property|property}.\n *\n * @augments {Layout}\n */\nclass Constant extends Layout {\n constructor(value, property) {\n super(0, property);\n /** The value produced by this constant when the layout is {@link\n * Constant#decode|decoded}.\n *\n * Any JavaScript value including `null` and `undefined` is\n * permitted.\n *\n * **WARNING** If `value` passed in the constructor was not\n * frozen, it is possible for users of decoded values to change\n * the content of the value. */\n this.value = value;\n }\n /** @override */\n decode(b, offset) {\n return this.value;\n }\n /** @override */\n encode(src, b, offset) {\n /* Constants take no space */\n return 0;\n }\n}\nexports.Constant = Constant;\n/** Factory for {@link GreedyCount}. */\nexports.greedy = ((elementSpan, property) => new GreedyCount(elementSpan, property));\n/** Factory for {@link OffsetLayout}. */\nexports.offset = ((layout, offset, property) => new OffsetLayout(layout, offset, property));\n/** Factory for {@link UInt|unsigned int layouts} spanning one\n * byte. */\nexports.u8 = ((property) => new UInt(1, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16 = ((property) => new UInt(2, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24 = ((property) => new UInt(3, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32 = ((property) => new UInt(4, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40 = ((property) => new UInt(5, property));\n/** Factory for {@link UInt|little-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48 = ((property) => new UInt(6, property));\n/** Factory for {@link NearUInt64|little-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64 = ((property) => new NearUInt64(property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning two bytes. */\nexports.u16be = ((property) => new UIntBE(2, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning three bytes. */\nexports.u24be = ((property) => new UIntBE(3, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning four bytes. */\nexports.u32be = ((property) => new UIntBE(4, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning five bytes. */\nexports.u40be = ((property) => new UIntBE(5, property));\n/** Factory for {@link UInt|big-endian unsigned int layouts}\n * spanning six bytes. */\nexports.u48be = ((property) => new UIntBE(6, property));\n/** Factory for {@link NearUInt64BE|big-endian unsigned int\n * layouts} interpreted as Numbers. */\nexports.nu64be = ((property) => new NearUInt64BE(property));\n/** Factory for {@link Int|signed int layouts} spanning one\n * byte. */\nexports.s8 = ((property) => new Int(1, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning two bytes. */\nexports.s16 = ((property) => new Int(2, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning three bytes. */\nexports.s24 = ((property) => new Int(3, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning four bytes. */\nexports.s32 = ((property) => new Int(4, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning five bytes. */\nexports.s40 = ((property) => new Int(5, property));\n/** Factory for {@link Int|little-endian signed int layouts}\n * spanning six bytes. */\nexports.s48 = ((property) => new Int(6, property));\n/** Factory for {@link NearInt64|little-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64 = ((property) => new NearInt64(property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning two bytes. */\nexports.s16be = ((property) => new IntBE(2, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning three bytes. */\nexports.s24be = ((property) => new IntBE(3, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning four bytes. */\nexports.s32be = ((property) => new IntBE(4, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning five bytes. */\nexports.s40be = ((property) => new IntBE(5, property));\n/** Factory for {@link Int|big-endian signed int layouts}\n * spanning six bytes. */\nexports.s48be = ((property) => new IntBE(6, property));\n/** Factory for {@link NearInt64BE|big-endian signed int layouts}\n * interpreted as Numbers. */\nexports.ns64be = ((property) => new NearInt64BE(property));\n/** Factory for {@link Float|little-endian 32-bit floating point} values. */\nexports.f32 = ((property) => new Float(property));\n/** Factory for {@link FloatBE|big-endian 32-bit floating point} values. */\nexports.f32be = ((property) => new FloatBE(property));\n/** Factory for {@link Double|little-endian 64-bit floating point} values. */\nexports.f64 = ((property) => new Double(property));\n/** Factory for {@link DoubleBE|big-endian 64-bit floating point} values. */\nexports.f64be = ((property) => new DoubleBE(property));\n/** Factory for {@link Structure} values. */\nexports.struct = ((fields, property, decodePrefixes) => new Structure(fields, property, decodePrefixes));\n/** Factory for {@link BitStructure} values. */\nexports.bits = ((word, msb, property) => new BitStructure(word, msb, property));\n/** Factory for {@link Sequence} values. */\nexports.seq = ((elementLayout, count, property) => new Sequence(elementLayout, count, property));\n/** Factory for {@link Union} values. */\nexports.union = ((discr, defaultLayout, property) => new Union(discr, defaultLayout, property));\n/** Factory for {@link UnionLayoutDiscriminator} values. */\nexports.unionLayoutDiscriminator = ((layout, property) => new UnionLayoutDiscriminator(layout, property));\n/** Factory for {@link Blob} values. */\nexports.blob = ((length, property) => new Blob(length, property));\n/** Factory for {@link CString} values. */\nexports.cstr = ((property) => new CString(property));\n/** Factory for {@link UTF8} values. */\nexports.utf8 = ((maxSpan, property) => new UTF8(maxSpan, property));\n/** Factory for {@link Constant} values. */\nexports.constant = ((value, property) => new Constant(value, property));\n//# sourceMappingURL=Layout.js.map","/**\n * Methods for elliptic curve multiplication by scalars.\n * Contains wNAF, pippenger.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { bitLen, bitMask, validateObject } from \"../utils.js\";\nimport { Field, FpInvertBatch, nLength, validateField } from \"./modular.js\";\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nexport function negateCt(condition, item) {\n const neg = item.negate();\n return condition ? neg : item;\n}\n/**\n * Takes a bunch of Projective Points but executes only one\n * inversion on all of them. Inversion is very slow operation,\n * so this improves performance massively.\n * Optimization: converts a list of projective points to a list of identical points with Z=1.\n */\nexport function normalizeZ(c, points) {\n const invertedZs = FpInvertBatch(c.Fp, points.map((p) => p.Z));\n return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i])));\n}\nfunction validateW(W, bits) {\n if (!Number.isSafeInteger(W) || W <= 0 || W > bits)\n throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W);\n}\nfunction calcWOpts(W, scalarBits) {\n validateW(W, scalarBits);\n const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero\n const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero\n const maxNumber = 2 ** W; // W=8 256\n const mask = bitMask(W); // W=8 255 == mask 0b11111111\n const shiftBy = BigInt(W); // W=8 8\n return { windows, windowSize, mask, maxNumber, shiftBy };\n}\nfunction calcOffsets(n, window, wOpts) {\n const { windowSize, mask, maxNumber, shiftBy } = wOpts;\n let wbits = Number(n & mask); // extract W bits.\n let nextN = n >> shiftBy; // shift number by W bits.\n // What actually happens here:\n // const highestBit = Number(mask ^ (mask >> 1n));\n // let wbits2 = wbits - 1; // skip zero\n // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~);\n // split if bits > max: +224 => 256-32\n if (wbits > windowSize) {\n // we skip zero, which means instead of `>= size-1`, we do `> size`\n wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here.\n nextN += _1n; // +256 (carry)\n }\n const offsetStart = window * windowSize;\n const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero\n const isZero = wbits === 0; // is current window slice a 0?\n const isNeg = wbits < 0; // is current window slice negative?\n const isNegF = window % 2 !== 0; // fake random statement for noise\n const offsetF = offsetStart; // fake offset for noise\n return { nextN, offset, isZero, isNeg, isNegF, offsetF };\n}\nfunction validateMSMPoints(points, c) {\n if (!Array.isArray(points))\n throw new Error('array expected');\n points.forEach((p, i) => {\n if (!(p instanceof c))\n throw new Error('invalid point at index ' + i);\n });\n}\nfunction validateMSMScalars(scalars, field) {\n if (!Array.isArray(scalars))\n throw new Error('array of scalars expected');\n scalars.forEach((s, i) => {\n if (!field.isValid(s))\n throw new Error('invalid scalar at index ' + i);\n });\n}\n// Since points in different groups cannot be equal (different object constructor),\n// we can have single place to store precomputes.\n// Allows to make points frozen / immutable.\nconst pointPrecomputes = new WeakMap();\nconst pointWindowSizes = new WeakMap();\nfunction getW(P) {\n // To disable precomputes:\n // return 1;\n return pointWindowSizes.get(P) || 1;\n}\nfunction assert0(n) {\n if (n !== _0n)\n throw new Error('invalid wNAF');\n}\n/**\n * Elliptic curve multiplication of Point by scalar. Fragile.\n * Table generation takes **30MB of ram and 10ms on high-end CPU**,\n * but may take much longer on slow devices. Actual generation will happen on\n * first call of `multiply()`. By default, `BASE` point is precomputed.\n *\n * Scalars should always be less than curve order: this should be checked inside of a curve itself.\n * Creates precomputation tables for fast multiplication:\n * - private scalar is split by fixed size windows of W bits\n * - every window point is collected from window's table & added to accumulator\n * - since windows are different, same point inside tables won't be accessed more than once per calc\n * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar)\n * - +1 window is neccessary for wNAF\n * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication\n *\n * @todo Research returning 2d JS array of windows, instead of a single window.\n * This would allow windows to be in different memory locations\n */\nexport class wNAF {\n // Parametrized with a given Point class (not individual point)\n constructor(Point, bits) {\n this.BASE = Point.BASE;\n this.ZERO = Point.ZERO;\n this.Fn = Point.Fn;\n this.bits = bits;\n }\n // non-const time multiplication ladder\n _unsafeLadder(elm, n, p = this.ZERO) {\n let d = elm;\n while (n > _0n) {\n if (n & _1n)\n p = p.add(d);\n d = d.double();\n n >>= _1n;\n }\n return p;\n }\n /**\n * Creates a wNAF precomputation window. Used for caching.\n * Default window size is set by `utils.precompute()` and is equal to 8.\n * Number of precomputed points depends on the curve size:\n * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:\n * - 𝑊 is the window size\n * - 𝑛 is the bitlength of the curve order.\n * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.\n * @param point Point instance\n * @param W window size\n * @returns precomputed point tables flattened to a single array\n */\n precomputeWindow(point, W) {\n const { windows, windowSize } = calcWOpts(W, this.bits);\n const points = [];\n let p = point;\n let base = p;\n for (let window = 0; window < windows; window++) {\n base = p;\n points.push(base);\n // i=1, bc we skip 0\n for (let i = 1; i < windowSize; i++) {\n base = base.add(p);\n points.push(base);\n }\n p = base.double();\n }\n return points;\n }\n /**\n * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.\n * More compact implementation:\n * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541\n * @returns real and fake (for const-time) points\n */\n wNAF(W, precomputes, n) {\n // Scalar should be smaller than field order\n if (!this.Fn.isValid(n))\n throw new Error('invalid scalar');\n // Accumulators\n let p = this.ZERO;\n let f = this.BASE;\n // This code was first written with assumption that 'f' and 'p' will never be infinity point:\n // since each addition is multiplied by 2 ** W, it cannot cancel each other. However,\n // there is negate now: it is possible that negated element from low value\n // would be the same as high element, which will create carry into next window.\n // It's not obvious how this can fail, but still worth investigating later.\n const wo = calcWOpts(W, this.bits);\n for (let window = 0; window < wo.windows; window++) {\n // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise\n const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo);\n n = nextN;\n if (isZero) {\n // bits are 0: add garbage to fake point\n // Important part for const-time getPublicKey: add random \"noise\" point to f.\n f = f.add(negateCt(isNegF, precomputes[offsetF]));\n }\n else {\n // bits are 1: add to result point\n p = p.add(negateCt(isNeg, precomputes[offset]));\n }\n }\n assert0(n);\n // Return both real and fake points: JIT won't eliminate f.\n // At this point there is a way to F be infinity-point even if p is not,\n // which makes it less const-time: around 1 bigint multiply.\n return { p, f };\n }\n /**\n * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.\n * @param acc accumulator point to add result of multiplication\n * @returns point\n */\n wNAFUnsafe(W, precomputes, n, acc = this.ZERO) {\n const wo = calcWOpts(W, this.bits);\n for (let window = 0; window < wo.windows; window++) {\n if (n === _0n)\n break; // Early-exit, skip 0 value\n const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo);\n n = nextN;\n if (isZero) {\n // Window bits are 0: skip processing.\n // Move to next window.\n continue;\n }\n else {\n const item = precomputes[offset];\n acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM\n }\n }\n assert0(n);\n return acc;\n }\n getPrecomputes(W, point, transform) {\n // Calculate precomputes on a first run, reuse them after\n let comp = pointPrecomputes.get(point);\n if (!comp) {\n comp = this.precomputeWindow(point, W);\n if (W !== 1) {\n // Doing transform outside of if brings 15% perf hit\n if (typeof transform === 'function')\n comp = transform(comp);\n pointPrecomputes.set(point, comp);\n }\n }\n return comp;\n }\n cached(point, scalar, transform) {\n const W = getW(point);\n return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar);\n }\n unsafe(point, scalar, transform, prev) {\n const W = getW(point);\n if (W === 1)\n return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster\n return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev);\n }\n // We calculate precomputes for elliptic curve point multiplication\n // using windowed method. This specifies window size and\n // stores precomputed values. Usually only base point would be precomputed.\n createCache(P, W) {\n validateW(W, this.bits);\n pointWindowSizes.set(P, W);\n pointPrecomputes.delete(P);\n }\n hasCache(elm) {\n return getW(elm) !== 1;\n }\n}\n/**\n * Endomorphism-specific multiplication for Koblitz curves.\n * Cost: 128 dbl, 0-256 adds.\n */\nexport function mulEndoUnsafe(Point, point, k1, k2) {\n let acc = point;\n let p1 = Point.ZERO;\n let p2 = Point.ZERO;\n while (k1 > _0n || k2 > _0n) {\n if (k1 & _1n)\n p1 = p1.add(acc);\n if (k2 & _1n)\n p2 = p2.add(acc);\n acc = acc.double();\n k1 >>= _1n;\n k2 >>= _1n;\n }\n return { p1, p2 };\n}\n/**\n * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).\n * 30x faster vs naive addition on L=4096, 10x faster than precomputes.\n * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL.\n * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0.\n * @param c Curve Point constructor\n * @param fieldN field over CURVE.N - important that it's not over CURVE.P\n * @param points array of L curve points\n * @param scalars array of L scalars (aka secret keys / bigints)\n */\nexport function pippenger(c, fieldN, points, scalars) {\n // If we split scalars by some window (let's say 8 bits), every chunk will only\n // take 256 buckets even if there are 4096 scalars, also re-uses double.\n // TODO:\n // - https://eprint.iacr.org/2024/750.pdf\n // - https://tches.iacr.org/index.php/TCHES/article/view/10287\n // 0 is accepted in scalars\n validateMSMPoints(points, c);\n validateMSMScalars(scalars, fieldN);\n const plength = points.length;\n const slength = scalars.length;\n if (plength !== slength)\n throw new Error('arrays of points and scalars must have equal length');\n // if (plength === 0) throw new Error('array must be of length >= 2');\n const zero = c.ZERO;\n const wbits = bitLen(BigInt(plength));\n let windowSize = 1; // bits\n if (wbits > 12)\n windowSize = wbits - 3;\n else if (wbits > 4)\n windowSize = wbits - 2;\n else if (wbits > 0)\n windowSize = 2;\n const MASK = bitMask(windowSize);\n const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array\n const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize;\n let sum = zero;\n for (let i = lastBits; i >= 0; i -= windowSize) {\n buckets.fill(zero);\n for (let j = 0; j < slength; j++) {\n const scalar = scalars[j];\n const wbits = Number((scalar >> BigInt(i)) & MASK);\n buckets[wbits] = buckets[wbits].add(points[j]);\n }\n let resI = zero; // not using this will do small speed-up, but will lose ct\n // Skip first bucket, because it is zero\n for (let j = buckets.length - 1, sumI = zero; j > 0; j--) {\n sumI = sumI.add(buckets[j]);\n resI = resI.add(sumI);\n }\n sum = sum.add(resI);\n if (i !== 0)\n for (let j = 0; j < windowSize; j++)\n sum = sum.double();\n }\n return sum;\n}\n/**\n * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...).\n * @param c Curve Point constructor\n * @param fieldN field over CURVE.N - important that it's not over CURVE.P\n * @param points array of L curve points\n * @returns function which multiplies points with scaars\n */\nexport function precomputeMSMUnsafe(c, fieldN, points, windowSize) {\n /**\n * Performance Analysis of Window-based Precomputation\n *\n * Base Case (256-bit scalar, 8-bit window):\n * - Standard precomputation requires:\n * - 31 additions per scalar × 256 scalars = 7,936 ops\n * - Plus 255 summary additions = 8,191 total ops\n * Note: Summary additions can be optimized via accumulator\n *\n * Chunked Precomputation Analysis:\n * - Using 32 chunks requires:\n * - 255 additions per chunk\n * - 256 doublings\n * - Total: (255 × 32) + 256 = 8,416 ops\n *\n * Memory Usage Comparison:\n * Window Size | Standard Points | Chunked Points\n * ------------|-----------------|---------------\n * 4-bit | 520 | 15\n * 8-bit | 4,224 | 255\n * 10-bit | 13,824 | 1,023\n * 16-bit | 557,056 | 65,535\n *\n * Key Advantages:\n * 1. Enables larger window sizes due to reduced memory overhead\n * 2. More efficient for smaller scalar counts:\n * - 16 chunks: (16 × 255) + 256 = 4,336 ops\n * - ~2x faster than standard 8,191 ops\n *\n * Limitations:\n * - Not suitable for plain precomputes (requires 256 constant doublings)\n * - Performance degrades with larger scalar counts:\n * - Optimal for ~256 scalars\n * - Less efficient for 4096+ scalars (Pippenger preferred)\n */\n validateW(windowSize, fieldN.BITS);\n validateMSMPoints(points, c);\n const zero = c.ZERO;\n const tableSize = 2 ** windowSize - 1; // table size (without zero)\n const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item\n const MASK = bitMask(windowSize);\n const tables = points.map((p) => {\n const res = [];\n for (let i = 0, acc = p; i < tableSize; i++) {\n res.push(acc);\n acc = acc.add(p);\n }\n return res;\n });\n return (scalars) => {\n validateMSMScalars(scalars, fieldN);\n if (scalars.length > points.length)\n throw new Error('array of scalars must be smaller than array of points');\n let res = zero;\n for (let i = 0; i < chunks; i++) {\n // No need to double if accumulator is still zero.\n if (res !== zero)\n for (let j = 0; j < windowSize; j++)\n res = res.double();\n const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize);\n for (let j = 0; j < scalars.length; j++) {\n const n = scalars[j];\n const curr = Number((n >> shiftBy) & MASK);\n if (!curr)\n continue; // skip zero scalars chunks\n res = res.add(tables[j][curr - 1]);\n }\n }\n return res;\n };\n}\n// TODO: remove\n/** @deprecated */\nexport function validateBasic(curve) {\n validateField(curve.Fp);\n validateObject(curve, {\n n: 'bigint',\n h: 'bigint',\n Gx: 'field',\n Gy: 'field',\n }, {\n nBitLength: 'isSafeInteger',\n nByteLength: 'isSafeInteger',\n });\n // Set defaults\n return Object.freeze({\n ...nLength(curve.n, curve.nBitLength),\n ...curve,\n ...{ p: curve.Fp.ORDER },\n });\n}\nfunction createField(order, field, isLE) {\n if (field) {\n if (field.ORDER !== order)\n throw new Error('Field.ORDER must match order: Fp == p, Fn == n');\n validateField(field);\n return field;\n }\n else {\n return Field(order, { isLE });\n }\n}\n/** Validates CURVE opts and creates fields */\nexport function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) {\n if (FpFnLE === undefined)\n FpFnLE = type === 'edwards';\n if (!CURVE || typeof CURVE !== 'object')\n throw new Error(`expected valid ${type} CURVE object`);\n for (const p of ['p', 'n', 'h']) {\n const val = CURVE[p];\n if (!(typeof val === 'bigint' && val > _0n))\n throw new Error(`CURVE.${p} must be positive bigint`);\n }\n const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE);\n const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE);\n const _b = type === 'weierstrass' ? 'b' : 'd';\n const params = ['Gx', 'Gy', 'a', _b];\n for (const p of params) {\n // @ts-ignore\n if (!Fp.isValid(CURVE[p]))\n throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);\n }\n CURVE = Object.freeze(Object.assign({}, CURVE));\n return { CURVE, Fp, Fn };\n}\n//# sourceMappingURL=curve.js.map","export const etherUnits = {\n gwei: 9,\n wei: 18,\n};\nexport const gweiUnits = {\n ether: -9,\n wei: 9,\n};\nexport const weiUnits = {\n ether: -18,\n gwei: -9,\n};\n//# sourceMappingURL=unit.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n/*\n * Browser-compatible JavaScript MD5\n *\n * Modification of JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\nfunction md5(bytes) {\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = new Uint8Array(msg.length);\n\n for (let i = 0; i < msg.length; ++i) {\n bytes[i] = msg.charCodeAt(i);\n }\n }\n\n return md5ToHexEncodedArray(wordsToMd5(bytesToWords(bytes), bytes.length * 8));\n}\n/*\n * Convert an array of little-endian words to an array of bytes\n */\n\n\nfunction md5ToHexEncodedArray(input) {\n const output = [];\n const length32 = input.length * 32;\n const hexTab = '0123456789abcdef';\n\n for (let i = 0; i < length32; i += 8) {\n const x = input[i >> 5] >>> i % 32 & 0xff;\n const hex = parseInt(hexTab.charAt(x >>> 4 & 0x0f) + hexTab.charAt(x & 0x0f), 16);\n output.push(hex);\n }\n\n return output;\n}\n/**\n * Calculate output length with padding and bit length\n */\n\n\nfunction getOutputLength(inputLength8) {\n return (inputLength8 + 64 >>> 9 << 4) + 14 + 1;\n}\n/*\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n */\n\n\nfunction wordsToMd5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32;\n x[getOutputLength(len) - 1] = len;\n let a = 1732584193;\n let b = -271733879;\n let c = -1732584194;\n let d = 271733878;\n\n for (let i = 0; i < x.length; i += 16) {\n const olda = a;\n const oldb = b;\n const oldc = c;\n const oldd = d;\n a = md5ff(a, b, c, d, x[i], 7, -680876936);\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586);\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819);\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330);\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897);\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426);\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341);\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983);\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416);\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417);\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063);\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162);\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682);\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101);\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290);\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329);\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510);\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632);\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713);\n b = md5gg(b, c, d, a, x[i], 20, -373897302);\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691);\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083);\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335);\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848);\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438);\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690);\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961);\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501);\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467);\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784);\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473);\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734);\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558);\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463);\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562);\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556);\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060);\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353);\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632);\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640);\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174);\n d = md5hh(d, a, b, c, x[i], 11, -358537222);\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979);\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189);\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487);\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835);\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520);\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651);\n a = md5ii(a, b, c, d, x[i], 6, -198630844);\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415);\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905);\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055);\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571);\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606);\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523);\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799);\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359);\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744);\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380);\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649);\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070);\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379);\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259);\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551);\n a = safeAdd(a, olda);\n b = safeAdd(b, oldb);\n c = safeAdd(c, oldc);\n d = safeAdd(d, oldd);\n }\n\n return [a, b, c, d];\n}\n/*\n * Convert an array bytes to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n */\n\n\nfunction bytesToWords(input) {\n if (input.length === 0) {\n return [];\n }\n\n const length8 = input.length * 8;\n const output = new Uint32Array(getOutputLength(length8));\n\n for (let i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input[i / 8] & 0xff) << i % 32;\n }\n\n return output;\n}\n/*\n * Add integers, wrapping at 2^32. This uses 16-bit operations internally\n * to work around bugs in some JS interpreters.\n */\n\n\nfunction safeAdd(x, y) {\n const lsw = (x & 0xffff) + (y & 0xffff);\n const msw = (x >> 16) + (y >> 16) + (lsw >> 16);\n return msw << 16 | lsw & 0xffff;\n}\n/*\n * Bitwise rotate a 32-bit number to the left.\n */\n\n\nfunction bitRotateLeft(num, cnt) {\n return num << cnt | num >>> 32 - cnt;\n}\n/*\n * These functions implement the four basic operations the algorithm uses.\n */\n\n\nfunction md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b);\n}\n\nfunction md5ff(a, b, c, d, x, s, t) {\n return md5cmn(b & c | ~b & d, a, b, x, s, t);\n}\n\nfunction md5gg(a, b, c, d, x, s, t) {\n return md5cmn(b & d | c & ~d, a, b, x, s, t);\n}\n\nfunction md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t);\n}\n\nfunction md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t);\n}\n\nvar _default = md5;\nexports.default = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = /^(?:[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;\nexports.default = _default;","/**\n * The base error class of hpke-js.\n * @group Errors\n */\nexport class HpkeError extends Error {\n constructor(e) {\n let message;\n if (e instanceof Error) {\n message = e.message;\n }\n else if (typeof e === \"string\") {\n message = e;\n }\n else {\n message = \"\";\n }\n super(message);\n this.name = this.constructor.name;\n }\n}\n/**\n * Invalid parameter.\n * @group Errors\n */\nexport class InvalidParamError extends HpkeError {\n}\n/**\n * KEM input or output validation failure.\n * @group Errors\n */\nexport class ValidationError extends HpkeError {\n}\n/**\n * Public or private key serialization failure.\n * @group Errors\n */\nexport class SerializeError extends HpkeError {\n}\n/**\n * Public or private key deserialization failure.\n * @group Errors\n */\nexport class DeserializeError extends HpkeError {\n}\n/**\n * encap() failure.\n * @group Errors\n */\nexport class EncapError extends HpkeError {\n}\n/**\n * decap() failure.\n * @group Errors\n */\nexport class DecapError extends HpkeError {\n}\n/**\n * Secret export failure.\n * @group Errors\n */\nexport class ExportError extends HpkeError {\n}\n/**\n * seal() failure.\n * @group Errors\n */\nexport class SealError extends HpkeError {\n}\n/**\n * open() failure.\n * @group Errors\n */\nexport class OpenError extends HpkeError {\n}\n/**\n * Sequence number overflow on the encryption context.\n * @group Errors\n */\nexport class MessageLimitReachedError extends HpkeError {\n}\n/**\n * Key pair derivation failure.\n * @group Errors\n */\nexport class DeriveKeyPairError extends HpkeError {\n}\n/**\n * Not supported failure.\n * @group Errors\n */\nexport class NotSupportedError extends HpkeError {\n}\n","const dntGlobals = {};\nexport const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);\nfunction createMergeProxy(baseObj, extObj) {\n return new Proxy(baseObj, {\n get(_target, prop, _receiver) {\n if (prop in extObj) {\n return extObj[prop];\n }\n else {\n return baseObj[prop];\n }\n },\n set(_target, prop, value) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n baseObj[prop] = value;\n return true;\n },\n deleteProperty(_target, prop) {\n let success = false;\n if (prop in extObj) {\n delete extObj[prop];\n success = true;\n }\n if (prop in baseObj) {\n delete baseObj[prop];\n success = true;\n }\n return success;\n },\n ownKeys(_target) {\n const baseKeys = Reflect.ownKeys(baseObj);\n const extKeys = Reflect.ownKeys(extObj);\n const extKeysSet = new Set(extKeys);\n return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];\n },\n defineProperty(_target, prop, desc) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n Reflect.defineProperty(baseObj, prop, desc);\n return true;\n },\n getOwnPropertyDescriptor(_target, prop) {\n if (prop in extObj) {\n return Reflect.getOwnPropertyDescriptor(extObj, prop);\n }\n else {\n return Reflect.getOwnPropertyDescriptor(baseObj, prop);\n }\n },\n has(_target, prop) {\n return prop in extObj || prop in baseObj;\n },\n });\n}\n","import * as dntShim from \"../_dnt.shims.js\";\nimport { NotSupportedError } from \"./errors.js\";\nasync function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n}\nexport class NativeAlgorithm {\n constructor() {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n }\n async _setup() {\n if (this._api !== undefined) {\n return;\n }\n this._api = await loadSubtleCrypto();\n }\n}\n","/**\n * The supported HPKE modes.\n */\nexport const Mode = {\n Base: 0x00,\n Psk: 0x01,\n Auth: 0x02,\n AuthPsk: 0x03,\n};\n/**\n * The supported Key Encapsulation Mechanism (KEM) identifiers.\n */\nexport const KemId = {\n NotAssigned: 0x0000,\n DhkemP256HkdfSha256: 0x0010,\n DhkemP384HkdfSha384: 0x0011,\n DhkemP521HkdfSha512: 0x0012,\n DhkemSecp256k1HkdfSha256: 0x0013,\n DhkemX25519HkdfSha256: 0x0020,\n DhkemX448HkdfSha512: 0x0021,\n HybridkemX25519Kyber768: 0x0030,\n MlKem512: 0x0040,\n MlKem768: 0x0041,\n MlKem1024: 0x0042,\n XWing: 0x647a,\n};\n/**\n * The supported Key Derivation Function (KDF) identifiers.\n */\nexport const KdfId = {\n HkdfSha256: 0x0001,\n HkdfSha384: 0x0002,\n HkdfSha512: 0x0003,\n};\n/**\n * The supported Authenticated Encryption with Associated Data (AEAD) identifiers.\n */\nexport const AeadId = {\n Aes128Gcm: 0x0001,\n Aes256Gcm: 0x0002,\n Chacha20Poly1305: 0x0003,\n ExportOnly: 0xFFFF,\n};\n","// The input length limit (psk, psk_id, info, exporter_context, ikm).\nexport const INPUT_LENGTH_LIMIT = 8192;\nexport const INFO_LENGTH_LIMIT = 65536;\n// The minimum length of a PSK.\nexport const MINIMUM_PSK_LENGTH = 32;\n// b\"\"\nexport const EMPTY = new Uint8Array(0);\n","// b\"KEM\"\nexport const SUITE_ID_HEADER_KEM = new Uint8Array([\n 75,\n 69,\n 77,\n 0,\n 0,\n]);\n","import * as dntShim from \"../../_dnt.shims.js\";\nimport { KemId } from \"../identifiers.js\";\nexport const isDenoV1 = () => \n// deno-lint-ignore no-explicit-any\ndntShim.dntGlobalThis.process === undefined;\n/**\n * Checks whether the runtime is Deno or not (Node.js).\n * @returns boolean - true if the runtime is Deno, false Node.js.\n */\nexport function isDeno() {\n // deno-lint-ignore no-explicit-any\n if (dntShim.dntGlobalThis.process === undefined) {\n return true;\n }\n // deno-lint-ignore no-explicit-any\n return dntShim.dntGlobalThis.process?.versions?.deno !== undefined;\n}\n/**\n * Checks whetehr the type of input is CryptoKeyPair or not.\n */\nexport const isCryptoKeyPair = (x) => typeof x === \"object\" &&\n x !== null &&\n typeof x.privateKey === \"object\" &&\n typeof x.publicKey === \"object\";\n/**\n * Converts integer to octet string. I2OSP implementation.\n */\nexport function i2Osp(n, w) {\n if (w <= 0) {\n throw new Error(\"i2Osp: too small size\");\n }\n if (n >= 256 ** w) {\n throw new Error(\"i2Osp: too large integer\");\n }\n const ret = new Uint8Array(w);\n for (let i = 0; i < w && n; i++) {\n ret[w - (i + 1)] = n % 256;\n n = n >> 8;\n }\n return ret;\n}\n/**\n * Concatenates two Uint8Arrays.\n * @param a Uint8Array\n * @param b Uint8Array\n * @returns Concatenated Uint8Array\n */\nexport function concat(a, b) {\n const ret = new Uint8Array(a.length + b.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n return ret;\n}\n/**\n * Decodes Base64Url-encoded data.\n * @param v Base64Url-encoded string\n * @returns Uint8Array\n */\nexport function base64UrlToBytes(v) {\n const base64 = v.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const byteString = atob(base64);\n const ret = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n ret[i] = byteString.charCodeAt(i);\n }\n return ret;\n}\n/**\n * Encodes Uint8Array to Base64Url.\n * @param v Uint8Array\n * @returns Base64Url-encoded string\n */\nexport function bytesToBase64Url(v) {\n return btoa(String.fromCharCode(...v))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=*$/g, \"\");\n}\n/**\n * Decodes hex string to Uint8Array.\n * @param v Hex string\n * @returns Uint8Array\n * @throws Error if the input is not a hex string.\n */\nexport function hexToBytes(v) {\n if (v.length === 0) {\n return new Uint8Array([]);\n }\n const res = v.match(/[\\da-f]{2}/gi);\n if (res == null) {\n throw new Error(\"Not hex string.\");\n }\n return new Uint8Array(res.map(function (h) {\n return parseInt(h, 16);\n }));\n}\n/**\n * Encodes Uint8Array to hex string.\n * @param v Uint8Array\n * @returns Hex string\n */\nexport function bytesToHex(v) {\n return [...v].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * Converts KemId to KeyAlgorithm.\n * @param kem KemId\n * @returns KeyAlgorithm\n */\nexport function kemToKeyGenAlgorithm(kem) {\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n return {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n };\n case KemId.DhkemP384HkdfSha384:\n return {\n name: \"ECDH\",\n namedCurve: \"P-384\",\n };\n case KemId.DhkemP521HkdfSha512:\n return {\n name: \"ECDH\",\n namedCurve: \"P-521\",\n };\n default:\n // case KemId.DhkemX25519HkdfSha256\n return {\n name: \"X25519\",\n };\n }\n}\nexport async function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (_e) {\n throw new Error(\"Failed to load SubtleCrypto\");\n }\n}\nexport async function loadCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto;\n }\n catch (_e) {\n throw new Error(\"Web Cryptograph API not supported\");\n }\n}\n/**\n * XOR for Uint8Array.\n */\nexport function xor(a, b) {\n if (a.byteLength !== b.byteLength) {\n throw new Error(\"xor: different length inputs\");\n }\n const buf = new Uint8Array(a.byteLength);\n for (let i = 0; i < a.byteLength; i++) {\n buf[i] = a[i] ^ b[i];\n }\n return buf;\n}\n","import { EMPTY, INPUT_LENGTH_LIMIT } from \"../consts.js\";\nimport { DecapError, EncapError, InvalidParamError } from \"../errors.js\";\nimport { SUITE_ID_HEADER_KEM } from \"../interfaces/kemInterface.js\";\nimport { concat, i2Osp, isCryptoKeyPair } from \"../utils/misc.js\";\n// b\"eae_prk\"\nconst LABEL_EAE_PRK = new Uint8Array([101, 97, 101, 95, 112, 114, 107]);\n// b\"shared_secret\"\n// deno-fmt-ignore\nconst LABEL_SHARED_SECRET = new Uint8Array([\n 115, 104, 97, 114, 101, 100, 95, 115, 101, 99,\n 114, 101, 116,\n]);\nfunction concat3(a, b, c) {\n const ret = new Uint8Array(a.length + b.length + c.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n ret.set(c, a.length + b.length);\n return ret;\n}\nexport class Dhkem {\n constructor(id, prim, kdf) {\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_prim\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.id = id;\n this._prim = prim;\n this._kdf = kdf;\n const suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);\n suiteId.set(i2Osp(this.id, 2), 3);\n this._kdf.init(suiteId);\n }\n async serializePublicKey(key) {\n return await this._prim.serializePublicKey(key);\n }\n async deserializePublicKey(key) {\n return await this._prim.deserializePublicKey(key);\n }\n async serializePrivateKey(key) {\n return await this._prim.serializePrivateKey(key);\n }\n async deserializePrivateKey(key) {\n return await this._prim.deserializePrivateKey(key);\n }\n async importKey(format, key, isPublic = true) {\n return await this._prim.importKey(format, key, isPublic);\n }\n async generateKeyPair() {\n return await this._prim.generateKeyPair();\n }\n async deriveKeyPair(ikm) {\n if (ikm.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long ikm\");\n }\n return await this._prim.deriveKeyPair(ikm);\n }\n async encap(params) {\n let ke;\n if (params.ekm === undefined) {\n ke = await this.generateKeyPair();\n }\n else if (isCryptoKeyPair(params.ekm)) {\n // params.ekm is only used for testing.\n ke = params.ekm;\n }\n else {\n // params.ekm is only used for testing.\n ke = await this.deriveKeyPair(params.ekm);\n }\n const enc = await this._prim.serializePublicKey(ke.publicKey);\n const pkrm = await this._prim.serializePublicKey(params.recipientPublicKey);\n try {\n let dh;\n if (params.senderKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n }\n else {\n const sks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.privateKey\n : params.senderKey;\n const dh1 = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n const dh2 = new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderKey === undefined) {\n kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n }\n else {\n const pks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.publicKey\n : await this._prim.derivePublicKey(params.senderKey);\n const pksm = await this._prim.serializePublicKey(pks);\n kemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm));\n }\n const sharedSecret = await this._generateSharedSecret(dh, kemContext);\n return {\n enc: enc,\n sharedSecret: sharedSecret,\n };\n }\n catch (e) {\n throw new EncapError(e);\n }\n }\n async decap(params) {\n const pke = await this._prim.deserializePublicKey(params.enc);\n const skr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.privateKey\n : params.recipientKey;\n const pkr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.publicKey\n : await this._prim.derivePublicKey(params.recipientKey);\n const pkrm = await this._prim.serializePublicKey(pkr);\n try {\n let dh;\n if (params.senderPublicKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(skr, pke));\n }\n else {\n const dh1 = new Uint8Array(await this._prim.dh(skr, pke));\n const dh2 = new Uint8Array(await this._prim.dh(skr, params.senderPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderPublicKey === undefined) {\n kemContext = concat(new Uint8Array(params.enc), new Uint8Array(pkrm));\n }\n else {\n const pksm = await this._prim.serializePublicKey(params.senderPublicKey);\n kemContext = new Uint8Array(params.enc.byteLength + pkrm.byteLength + pksm.byteLength);\n kemContext.set(new Uint8Array(params.enc), 0);\n kemContext.set(new Uint8Array(pkrm), params.enc.byteLength);\n kemContext.set(new Uint8Array(pksm), params.enc.byteLength + pkrm.byteLength);\n }\n return await this._generateSharedSecret(dh, kemContext);\n }\n catch (e) {\n throw new DecapError(e);\n }\n }\n async _generateSharedSecret(dh, kemContext) {\n const labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh);\n const labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize);\n return await this._kdf.extractAndExpand(EMPTY.buffer, labeledIkm.buffer, labeledInfo.buffer, this.secretSize);\n }\n}\n","// The key usages for KEM.\nexport const KEM_USAGES = [\"deriveBits\"];\n// b\"dkp_prk\"\nexport const LABEL_DKP_PRK = new Uint8Array([\n 100,\n 107,\n 112,\n 95,\n 112,\n 114,\n 107,\n]);\n// b\"sk\"\nexport const LABEL_SK = new Uint8Array([115, 107]);\n","/**\n * The minimum inplementation of bignum to derive an EC key pair.\n */\nexport class Bignum {\n constructor(size) {\n Object.defineProperty(this, \"_num\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._num = new Uint8Array(size);\n }\n val() {\n return this._num;\n }\n reset() {\n this._num.fill(0);\n }\n set(src) {\n if (src.length !== this._num.length) {\n throw new Error(\"Bignum.set: invalid argument\");\n }\n this._num.set(src);\n }\n isZero() {\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n lessThan(v) {\n if (v.length !== this._num.length) {\n throw new Error(\"Bignum.lessThan: invalid argument\");\n }\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] < v[i]) {\n return true;\n }\n if (this._num[i] > v[i]) {\n return false;\n }\n }\n return false;\n }\n}\n","import { NativeAlgorithm } from \"../../algorithm.js\";\nimport { EMPTY } from \"../../consts.js\";\nimport { DeriveKeyPairError, DeserializeError, NotSupportedError, SerializeError, } from \"../../errors.js\";\nimport { KemId } from \"../../identifiers.js\";\nimport { KEM_USAGES, LABEL_DKP_PRK } from \"../../interfaces/dhkemPrimitives.js\";\nimport { Bignum } from \"../../utils/bignum.js\";\nimport { base64UrlToBytes, i2Osp } from \"../../utils/misc.js\";\n// b\"candidate\"\n// deno-fmt-ignore\nconst LABEL_CANDIDATE = new Uint8Array([\n 99, 97, 110, 100, 105, 100, 97, 116, 101,\n]);\n// the order of the curve being used.\n// deno-fmt-ignore\nconst ORDER_P_256 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84,\n 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51,\n]);\n// deno-fmt-ignore\nconst ORDER_P_384 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf,\n 0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a,\n 0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73,\n]);\n// deno-fmt-ignore\nconst ORDER_P_521 = new Uint8Array([\n 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f,\n 0x96, 0x6b, 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09,\n 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c,\n 0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38,\n 0x64, 0x09,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_256 = new Uint8Array([\n 48, 65, 2, 1, 0, 48, 19, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 8, 42, 134,\n 72, 206, 61, 3, 1, 7, 4, 39, 48, 37,\n 2, 1, 1, 4, 32,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_384 = new Uint8Array([\n 48, 78, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 34, 4, 55, 48, 53, 2, 1, 1,\n 4, 48,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_521 = new Uint8Array([\n 48, 96, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 35, 4, 73, 48, 71, 2, 1, 1,\n 4, 66,\n]);\nexport class Ec extends NativeAlgorithm {\n constructor(kem, hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // EC specific arguments for deriving key pair.\n Object.defineProperty(this, \"_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_bitmask\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._hkdf = hkdf;\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n this._alg = { name: \"ECDH\", namedCurve: \"P-256\" };\n this._nPk = 65;\n this._nSk = 32;\n this._nDh = 32;\n this._order = ORDER_P_256;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_256;\n break;\n case KemId.DhkemP384HkdfSha384:\n this._alg = { name: \"ECDH\", namedCurve: \"P-384\" };\n this._nPk = 97;\n this._nSk = 48;\n this._nDh = 48;\n this._order = ORDER_P_384;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_384;\n break;\n default:\n // case KemId.DhkemP521HkdfSha512:\n this._alg = { name: \"ECDH\", namedCurve: \"P-521\" };\n this._nPk = 133;\n this._nSk = 66;\n this._nDh = 66;\n this._order = ORDER_P_521;\n this._bitmask = 0x01;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_521;\n break;\n }\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(this._alg, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const bn = new Bignum(this._nSk);\n for (let counter = 0; bn.isZero() || !bn.lessThan(this._order); counter++) {\n if (counter > 255) {\n throw new Error(\"Faild to derive a key pair\");\n }\n const bytes = new Uint8Array(await this._hkdf.labeledExpand(dkpPrk, LABEL_CANDIDATE, i2Osp(counter, 1), this._nSk));\n bytes[0] = bytes[0] & this._bitmask;\n bn.set(bytes);\n }\n const sk = await this._deserializePkcs8Key(bn.val());\n bn.reset();\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n try {\n await this._setup();\n const bits = await this._api.deriveBits({\n name: \"ECDH\",\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.crv === \"undefined\" || key.crv !== this._alg.namedCurve) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { EMPTY } from \"../consts.js\";\nimport { InvalidParamError } from \"../errors.js\";\nimport { KdfId } from \"../identifiers.js\";\nimport { NativeAlgorithm } from \"../algorithm.js\";\n// b\"HPKE-v1\"\nconst HPKE_VERSION = new Uint8Array([72, 80, 75, 69, 45, 118, 49]);\nexport class HkdfNative extends NativeAlgorithm {\n constructor() {\n super();\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: EMPTY\n });\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n init(suiteId) {\n this._suiteId = suiteId;\n }\n buildLabeledIkm(label, ikm) {\n this._checkInit();\n const ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength);\n ret.set(HPKE_VERSION, 0);\n ret.set(this._suiteId, 7);\n ret.set(label, 7 + this._suiteId.byteLength);\n ret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n buildLabeledInfo(label, info, len) {\n this._checkInit();\n const ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength);\n ret.set(new Uint8Array([0, len]), 0);\n ret.set(HPKE_VERSION, 2);\n ret.set(this._suiteId, 9);\n ret.set(label, 9 + this._suiteId.byteLength);\n ret.set(info, 9 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n async extract(salt, ikm) {\n await this._setup();\n if (salt.byteLength === 0) {\n salt = new ArrayBuffer(this.hashSize);\n }\n if (salt.byteLength !== this.hashSize) {\n throw new InvalidParamError(\"The salt length must be the same as the hashSize\");\n }\n const key = await this._api.importKey(\"raw\", salt, this.algHash, false, [\n \"sign\",\n ]);\n return await this._api.sign(\"HMAC\", key, ikm);\n }\n async expand(prk, info, len) {\n await this._setup();\n const key = await this._api.importKey(\"raw\", prk, this.algHash, false, [\n \"sign\",\n ]);\n const okm = new ArrayBuffer(len);\n const p = new Uint8Array(okm);\n let prev = EMPTY;\n const mid = new Uint8Array(info);\n const tail = new Uint8Array(1);\n if (len > 255 * this.hashSize) {\n throw new Error(\"Entropy limit reached\");\n }\n const tmp = new Uint8Array(this.hashSize + mid.length + 1);\n for (let i = 1, cur = 0; cur < p.length; i++) {\n tail[0] = i;\n tmp.set(prev, 0);\n tmp.set(mid, prev.length);\n tmp.set(tail, prev.length + mid.length);\n prev = new Uint8Array(await this._api.sign(\"HMAC\", key, tmp.slice(0, prev.length + mid.length + 1)));\n if (p.length - cur >= prev.length) {\n p.set(prev, cur);\n cur += prev.length;\n }\n else {\n p.set(prev.slice(0, p.length - cur), cur);\n cur += p.length - cur;\n }\n }\n return okm;\n }\n async extractAndExpand(salt, ikm, info, len) {\n await this._setup();\n const baseKey = await this._api.importKey(\"raw\", ikm, \"HKDF\", false, [\"deriveBits\"]);\n return await this._api.deriveBits({\n name: \"HKDF\",\n hash: this.algHash.hash,\n salt: salt,\n info: info,\n }, baseKey, len * 8);\n }\n async labeledExtract(salt, label, ikm) {\n return await this.extract(salt, this.buildLabeledIkm(label, ikm).buffer);\n }\n async labeledExpand(prk, label, info, len) {\n return await this.expand(prk, this.buildLabeledInfo(label, info, len).buffer, len);\n }\n _checkInit() {\n if (this._suiteId === EMPTY) {\n throw new Error(\"Not initialized. Call init()\");\n }\n }\n}\nexport class HkdfSha256Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha256 (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n /** 32 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n}\nexport class HkdfSha384Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha384 (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha384\n });\n /** 48 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-384\",\n length: 384,\n }\n });\n }\n}\nexport class HkdfSha512Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha512 (0x0003) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha512\n });\n /** 64 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-512\",\n length: 512,\n }\n });\n }\n}\n","// The key usages for AEAD.\nexport const AEAD_USAGES = [\"encrypt\", \"decrypt\"];\n","/**\n * This file is based on noble-curves (https://github.com/paulmillr/noble-curves).\n *\n * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/abstract/montgomery.ts\n */\n/**\n * Montgomery curve methods. It's not really whole montgomery curve,\n * just bunch of very specific methods for X25519 / X448 from\n * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748)\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes, aInRange, bytesToNumberLE, copyBytes, numberToBytesLE, randomBytesAsync, validateObject, } from \"../utils/noble.js\";\nimport { createKeygen } from \"./curve.js\";\nimport { mod } from \"./modular.js\";\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nfunction validateOpts(curve) {\n validateObject(curve, {\n adjustScalarBytes: \"function\",\n powPminus2: \"function\",\n });\n return Object.freeze({ ...curve });\n}\nexport function montgomery(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE;\n const is25519 = type === \"x25519\";\n if (!is25519 && type !== \"x448\")\n throw new Error(\"invalid type\");\n const randomBytes_ = rand || randomBytesAsync;\n const montgomeryBits = is25519 ? 255 : 448;\n const fieldLen = is25519 ? 32 : 56;\n const Gu = is25519 ? BigInt(9) : BigInt(5);\n // RFC 7748 #5:\n // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and\n // (156326 - 2) / 4 = 39081 for curve448/X448\n // const a = is25519 ? 156326n : 486662n;\n const a24 = is25519 ? BigInt(121665) : BigInt(39081);\n // RFC: x25519 \"the resulting integer is of the form 2^254 plus\n // eight times a value between 0 and 2^251 - 1 (inclusive)\"\n // x448: \"2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)\"\n const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447);\n const maxAdded = is25519\n ? BigInt(8) * _2n ** BigInt(251) - _1n\n : BigInt(4) * _2n ** BigInt(445) - _1n;\n const maxScalar = minScalar + maxAdded + _1n; // (inclusive)\n const modP = (n) => mod(n, P);\n const GuBytes = encodeU(Gu);\n function encodeU(u) {\n return numberToBytesLE(modP(u), fieldLen);\n }\n function decodeU(u) {\n const _u = copyBytes(abytes(u, fieldLen, \"uCoordinate\"));\n // RFC: When receiving such an array, implementations of X25519\n // (but not X448) MUST mask the most significant bit in the final byte.\n if (is25519)\n _u[31] &= 127; // 0b0111_1111\n // RFC: Implementations MUST accept non-canonical values and process them as\n // if they had been reduced modulo the field prime. The non-canonical\n // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224\n // - 1 through 2^448 - 1 for X448.\n return modP(bytesToNumberLE(_u));\n }\n function decodeScalar(scalar) {\n return bytesToNumberLE(adjustScalarBytes(copyBytes(abytes(scalar, fieldLen, \"scalar\"))));\n }\n function scalarMult(scalar, u) {\n const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar));\n // Some public keys are useless, of low-order. Curve author doesn't think\n // it needs to be validated, but we do it nonetheless.\n // https://cr.yp.to/ecdh.html#validate\n if (pu === _0n)\n throw new Error(\"invalid private or public key received\");\n return encodeU(pu);\n }\n // Computes public key from private. By doing scalar multiplication of base point.\n function scalarMultBase(scalar) {\n return scalarMult(scalar, GuBytes);\n }\n const getPublicKey = scalarMultBase;\n const getSharedSecret = scalarMult;\n // cswap from RFC7748 \"example code\"\n function cswap(swap, x_2, x_3) {\n // dummy = mask(swap) AND (x_2 XOR x_3)\n // Where mask(swap) is the all-1 or all-0 word of the same length as x_2\n // and x_3, computed, e.g., as mask(swap) = 0 - swap.\n const dummy = modP(swap * (x_2 - x_3));\n x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy\n x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy\n return { x_2, x_3 };\n }\n /**\n * Montgomery x-only multiplication ladder.\n * @param pointU u coordinate (x) on Montgomery Curve 25519\n * @param scalar by which the point would be multiplied\n * @returns new Point on Montgomery curve\n */\n function montgomeryLadder(u, scalar) {\n aInRange(\"u\", u, _0n, P);\n aInRange(\"scalar\", scalar, minScalar, maxScalar);\n const k = scalar;\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n swap = k_t;\n const A = x_2 + z_2;\n const AA = modP(A * A);\n const B = x_2 - z_2;\n const BB = modP(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = modP(D * A);\n const CB = modP(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = modP(dacb * dacb);\n z_3 = modP(x_1 * modP(da_cb * da_cb));\n x_2 = modP(AA * BB);\n z_2 = modP(E * (AA + modP(a24 * E)));\n }\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent\n return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2))\n }\n const lengths = {\n secretKey: fieldLen,\n publicKey: fieldLen,\n seed: fieldLen,\n };\n const randomSecretKey = async (seed) => {\n if (seed === undefined) {\n seed = await randomBytes_(fieldLen);\n }\n abytes(seed, lengths.seed, \"seed\");\n return seed;\n };\n const utils = { randomSecretKey };\n return Object.freeze({\n keygen: createKeygen(randomSecretKey, getPublicKey),\n getSharedSecret,\n getPublicKey,\n scalarMult,\n scalarMultBase,\n utils,\n GuBytes: GuBytes.slice(),\n lengths,\n });\n}\n","import { AEAD_USAGES, AeadId, NativeAlgorithm } from \"@hpke/common\";\nexport class AesGcmContext extends NativeAlgorithm {\n constructor(key) {\n super();\n Object.defineProperty(this, \"_rawKey\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n this._rawKey = key;\n }\n async seal(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const ct = await this._api.encrypt(alg, this._key, data);\n return ct;\n }\n async open(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const pt = await this._api.decrypt(alg, this._key, data);\n return pt;\n }\n async _setupKey() {\n if (this._key !== undefined) {\n return;\n }\n await this._setup();\n const key = await this._importKey(this._rawKey);\n (new Uint8Array(this._rawKey)).fill(0);\n this._key = key;\n return;\n }\n async _importKey(key) {\n return await this._api.importKey(\"raw\", key, { name: \"AES-GCM\" }, true, AEAD_USAGES);\n }\n}\n/**\n * The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class Aes128Gcm {\n constructor() {\n /** AeadId.Aes128Gcm (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes128Gcm\n });\n /** 16 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n createEncryptionContext(key) {\n return new AesGcmContext(key);\n }\n}\n/**\n * The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class Aes256Gcm extends Aes128Gcm {\n constructor() {\n super(...arguments);\n /** AeadId.Aes256Gcm (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes256Gcm\n });\n /** 32 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n}\n","import { NotSupportedError } from \"@hpke/common\";\nexport function emitNotSupported() {\n return new Promise((_resolve, reject) => {\n reject(new NotSupportedError(\"Not supported\"));\n });\n}\n","import { ExportError, INPUT_LENGTH_LIMIT, InvalidParamError, } from \"@hpke/common\";\nimport { emitNotSupported } from \"./utils/emitNotSupported.js\";\n// b\"sec\"\nconst LABEL_SEC = new Uint8Array([115, 101, 99]);\nexport class ExporterContextImpl {\n constructor(api, kdf, exporterSecret) {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exporterSecret\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._api = api;\n this._kdf = kdf;\n this.exporterSecret = exporterSecret;\n }\n async seal(_data, _aad) {\n return await emitNotSupported();\n }\n async open(_data, _aad) {\n return await emitNotSupported();\n }\n async export(exporterContext, len) {\n if (exporterContext.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long exporter context\");\n }\n try {\n return await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(exporterContext), len);\n }\n catch (e) {\n throw new ExportError(e);\n }\n }\n}\nexport class RecipientExporterContextImpl extends ExporterContextImpl {\n}\nexport class SenderExporterContextImpl extends ExporterContextImpl {\n constructor(api, kdf, exporterSecret, enc) {\n super(api, kdf, exporterSecret);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.enc = enc;\n return;\n }\n}\n","import { i2Osp, MessageLimitReachedError, xor } from \"@hpke/common\";\nimport { ExporterContextImpl } from \"./exporterContext.js\";\nexport class EncryptionContextImpl extends ExporterContextImpl {\n constructor(api, kdf, params) {\n super(api, kdf, params.exporterSecret);\n // AEAD id.\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a key for the algorithm.\n Object.defineProperty(this, \"_nK\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a nonce for the algorithm.\n Object.defineProperty(this, \"_nN\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of an authentication tag for the algorithm.\n Object.defineProperty(this, \"_nT\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The end-to-end encryption key information.\n Object.defineProperty(this, \"_ctx\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n if (params.key === undefined || params.baseNonce === undefined ||\n params.seq === undefined) {\n throw new Error(\"Required parameters are missing\");\n }\n this._aead = params.aead;\n this._nK = this._aead.keySize;\n this._nN = this._aead.nonceSize;\n this._nT = this._aead.tagSize;\n const key = this._aead.createEncryptionContext(params.key);\n this._ctx = {\n key: key,\n baseNonce: params.baseNonce,\n seq: params.seq,\n };\n }\n computeNonce(k) {\n const seqBytes = i2Osp(k.seq, k.baseNonce.byteLength);\n return xor(k.baseNonce, seqBytes).buffer;\n }\n incrementSeq(k) {\n // if (this.seq >= (1 << (8 * this.baseNonce.byteLength)) - 1) {\n if (k.seq > Number.MAX_SAFE_INTEGER) {\n throw new MessageLimitReachedError(\"Message limit reached\");\n }\n k.seq += 1;\n return;\n }\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _Mutex_locked;\nexport class Mutex {\n constructor() {\n _Mutex_locked.set(this, Promise.resolve());\n }\n async lock() {\n let releaseLock;\n const nextLock = new Promise((resolve) => {\n releaseLock = resolve;\n });\n const previousLock = __classPrivateFieldGet(this, _Mutex_locked, \"f\");\n __classPrivateFieldSet(this, _Mutex_locked, nextLock, \"f\");\n await previousLock;\n return releaseLock;\n }\n}\n_Mutex_locked = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _RecipientContextImpl_mutex;\nimport { EMPTY, OpenError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class RecipientContextImpl extends EncryptionContextImpl {\n constructor() {\n super(...arguments);\n _RecipientContextImpl_mutex.set(this, void 0);\n }\n async open(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _RecipientContextImpl_mutex, __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\").lock();\n let pt;\n try {\n pt = await this._ctx.key.open(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new OpenError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return pt;\n }\n}\n_RecipientContextImpl_mutex = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _SenderContextImpl_mutex;\nimport { EMPTY, SealError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class SenderContextImpl extends EncryptionContextImpl {\n constructor(api, kdf, params, enc) {\n super(api, kdf, params);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n _SenderContextImpl_mutex.set(this, void 0);\n this.enc = enc;\n }\n async seal(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _SenderContextImpl_mutex, __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\").lock();\n let ct;\n try {\n ct = await this._ctx.key.seal(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new SealError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return ct;\n }\n}\n_SenderContextImpl_mutex = new WeakMap();\n","import { AeadId, EMPTY, i2Osp, INFO_LENGTH_LIMIT, INPUT_LENGTH_LIMIT, InvalidParamError, MINIMUM_PSK_LENGTH, Mode, NativeAlgorithm, } from \"@hpke/common\";\nimport { RecipientExporterContextImpl, SenderExporterContextImpl, } from \"./exporterContext.js\";\nimport { RecipientContextImpl } from \"./recipientContext.js\";\nimport { SenderContextImpl } from \"./senderContext.js\";\n// b\"base_nonce\"\n// deno-fmt-ignore\nconst LABEL_BASE_NONCE = new Uint8Array([\n 98, 97, 115, 101, 95, 110, 111, 110, 99, 101,\n]);\n// b\"exp\"\nconst LABEL_EXP = new Uint8Array([101, 120, 112]);\n// b\"info_hash\"\n// deno-fmt-ignore\nconst LABEL_INFO_HASH = new Uint8Array([\n 105, 110, 102, 111, 95, 104, 97, 115, 104,\n]);\n// b\"key\"\nconst LABEL_KEY = new Uint8Array([107, 101, 121]);\n// b\"psk_id_hash\"\n// deno-fmt-ignore\nconst LABEL_PSK_ID_HASH = new Uint8Array([\n 112, 115, 107, 95, 105, 100, 95, 104, 97, 115, 104,\n]);\n// b\"secret\"\nconst LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]);\n// b\"HPKE\"\n// deno-fmt-ignore\nconst SUITE_ID_HEADER_HPKE = new Uint8Array([\n 72, 80, 75, 69, 0, 0, 0, 0, 0, 0,\n]);\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This is the super class of {@link CipherSuite} and the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - DHKEM(X25519, HKDF-SHA256)\n * - DHKEM(X448, HKDF-SHA512)\n * - ChaCha20Poly1305\n *\n * In addtion, the HKDF functions contained in this class can only derive\n * keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * // Use an extension module.\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuiteNative extends NativeAlgorithm {\n /**\n * @param params A set of parameters for building a cipher suite.\n *\n * If the error occurred, throws {@link InvalidParamError}.\n *\n * @throws {@link InvalidParamError}\n */\n constructor(params) {\n super();\n Object.defineProperty(this, \"_kem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // KEM\n if (typeof params.kem === \"number\") {\n throw new InvalidParamError(\"KemId cannot be used\");\n }\n this._kem = params.kem;\n // KDF\n if (typeof params.kdf === \"number\") {\n throw new InvalidParamError(\"KdfId cannot be used\");\n }\n this._kdf = params.kdf;\n // AEAD\n if (typeof params.aead === \"number\") {\n throw new InvalidParamError(\"AeadId cannot be used\");\n }\n this._aead = params.aead;\n this._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE);\n this._suiteId.set(i2Osp(this._kem.id, 2), 4);\n this._suiteId.set(i2Osp(this._kdf.id, 2), 6);\n this._suiteId.set(i2Osp(this._aead.id, 2), 8);\n this._kdf.init(this._suiteId);\n }\n /**\n * Gets the KEM context of the ciphersuite.\n */\n get kem() {\n return this._kem;\n }\n /**\n * Gets the KDF context of the ciphersuite.\n */\n get kdf() {\n return this._kdf;\n }\n /**\n * Gets the AEAD context of the ciphersuite.\n */\n get aead() {\n return this._aead;\n }\n /**\n * Creates an encryption context for a sender.\n *\n * If the error occurred, throws {@link DecapError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the sender encryption context.\n * @returns A sender encryption context.\n * @throws {@link EncapError}, {@link ValidationError}\n */\n async createSenderContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const dh = await this._kem.encap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params);\n }\n /**\n * Creates an encryption context for a recipient.\n *\n * If the error occurred, throws {@link DecapError}\n * | {@link DeserializeError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the recipient encryption context.\n * @returns A recipient encryption context.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError}\n */\n async createRecipientContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const sharedSecret = await this._kem.decap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderPublicKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderPublicKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleR(mode, sharedSecret, params);\n }\n /**\n * Encrypts a message to a recipient.\n *\n * If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`.\n *\n * @param params A set of parameters for building a sender encryption context.\n * @param pt A plain text as bytes to be encrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A cipher text and an encapsulated key as bytes.\n * @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError}\n */\n async seal(params, pt, aad = EMPTY.buffer) {\n const ctx = await this.createSenderContext(params);\n return {\n ct: await ctx.seal(pt, aad),\n enc: ctx.enc,\n };\n }\n /**\n * Decrypts a message from a sender.\n *\n * If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`.\n *\n * @param params A set of parameters for building a recipient encryption context.\n * @param ct An encrypted text as bytes to be decrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A decrypted plain text as bytes.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError}\n */\n async open(params, ct, aad = EMPTY.buffer) {\n const ctx = await this.createRecipientContext(params);\n return await ctx.open(ct, aad);\n }\n // private verifyPskInputs(mode: Mode, params: KeyScheduleParams) {\n // const gotPsk = (params.psk !== undefined);\n // const gotPskId = (params.psk !== undefined && params.psk.id.byteLength > 0);\n // if (gotPsk !== gotPskId) {\n // throw new Error('Inconsistent PSK inputs');\n // }\n // if (gotPsk && (mode === Mode.Base || mode === Mode.Auth)) {\n // throw new Error('PSK input provided when not needed');\n // }\n // if (!gotPsk && (mode === Mode.Psk || mode === Mode.AuthPsk)) {\n // throw new Error('Missing required PSK input');\n // }\n // return;\n // }\n async _keySchedule(mode, sharedSecret, params) {\n // Currently, there is no point in executing this function\n // because this hpke library does not allow users to explicitly specify the mode.\n //\n // this.verifyPskInputs(mode, params);\n const pskId = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.id);\n const pskIdHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_PSK_ID_HASH, pskId);\n const info = params.info === undefined\n ? EMPTY\n : new Uint8Array(params.info);\n const infoHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_INFO_HASH, info);\n const keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength);\n keyScheduleContext.set(new Uint8Array([mode]), 0);\n keyScheduleContext.set(new Uint8Array(pskIdHash), 1);\n keyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength);\n const psk = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.key);\n const ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk)\n .buffer;\n const exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize).buffer;\n const exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize);\n if (this._aead.id === AeadId.ExportOnly) {\n return { aead: this._aead, exporterSecret: exporterSecret };\n }\n const keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize).buffer;\n const key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize);\n const baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize).buffer;\n const baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize);\n return {\n aead: this._aead,\n exporterSecret: exporterSecret,\n key: key,\n baseNonce: new Uint8Array(baseNonce),\n seq: 0,\n };\n }\n async _keyScheduleS(mode, sharedSecret, enc, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc);\n }\n return new SenderContextImpl(this._api, this._kdf, res, enc);\n }\n async _keyScheduleR(mode, sharedSecret, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret);\n }\n return new RecipientContextImpl(this._api, this._kdf, res);\n }\n _validateInputLength(params) {\n if (params.info !== undefined &&\n params.info.byteLength > INFO_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long info\");\n }\n if (params.psk !== undefined) {\n if (params.psk.key.byteLength < MINIMUM_PSK_LENGTH) {\n throw new InvalidParamError(`PSK must have at least ${MINIMUM_PSK_LENGTH} bytes`);\n }\n if (params.psk.key.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.key\");\n }\n if (params.psk.id.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.id\");\n }\n }\n return;\n }\n}\n","import { Dhkem, Ec, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, KemId, } from \"@hpke/common\";\nexport class DhkemP256HkdfSha256Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha256Native();\n const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf);\n super(KemId.DhkemP256HkdfSha256, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP256HkdfSha256\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n }\n}\nexport class DhkemP384HkdfSha384Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha384Native();\n const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf);\n super(KemId.DhkemP384HkdfSha384, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP384HkdfSha384\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n }\n}\nexport class DhkemP521HkdfSha512Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha512Native();\n const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf);\n super(KemId.DhkemP521HkdfSha512, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP521HkdfSha512\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n }\n}\n","import { HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, } from \"@hpke/common\";\nimport { CipherSuiteNative } from \"./cipherSuiteNative.js\";\nimport { DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, } from \"./kems/dhkemNative.js\";\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This class is the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - `DHKEM(X25519, HKDF-SHA256)`\n * - `DHKEM(X448, HKDF-SHA512)`\n * - `ChaCha20Poly1305`\n *\n * In addtion, the HKDF functions contained in this `CipherSuiteNative`\n * class can only derive keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuite extends CipherSuiteNative {\n}\n/**\n * The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP256HkdfSha256`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP256HkdfSha256 extends DhkemP256HkdfSha256Native {\n}\n/**\n * The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP384HkdfSha384`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP384HkdfSha384 extends DhkemP384HkdfSha384Native {\n}\n/**\n * The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP521HkdfSha512`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class DhkemP521HkdfSha512 extends DhkemP521HkdfSha512Native {\n}\n/**\n * The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha256 extends HkdfSha256Native {\n}\n/**\n * The HKDF-SHA384 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha384`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha384 extends HkdfSha384Native {\n}\n/**\n * The HKDF-SHA512 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha512`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class HkdfSha512 extends HkdfSha512Native {\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X25519\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X25519 = new Uint8Array([\n 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20,\n]);\nexport class X25519 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 32;\n this._nSk = 32;\n this._nDh = 32;\n this._pkcs8AlgId = PKCS8_ALG_ID_X25519;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X448\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X448 = new Uint8Array([\n 0x30, 0x46, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6f, 0x04, 0x3a, 0x04, 0x38,\n]);\nexport class X448 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 56;\n this._nSk = 56;\n this._nDh = 56;\n this._pkcs8AlgId = PKCS8_ALG_ID_X448;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","export const version = '2.45.0';\n//# sourceMappingURL=version.js.map","import { version } from './version.js';\nlet errorConfig = {\n getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath\n ? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`\n : undefined,\n version: `viem@${version}`,\n};\nexport function setErrorConfig(config) {\n errorConfig = config;\n}\nexport class BaseError extends Error {\n constructor(shortMessage, args = {}) {\n const details = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.details;\n if (args.cause?.message)\n return args.cause.message;\n return args.details;\n })();\n const docsPath = (() => {\n if (args.cause instanceof BaseError)\n return args.cause.docsPath || args.docsPath;\n return args.docsPath;\n })();\n const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });\n const message = [\n shortMessage || 'An error occurred.',\n '',\n ...(args.metaMessages ? [...args.metaMessages, ''] : []),\n ...(docsUrl ? [`Docs: ${docsUrl}`] : []),\n ...(details ? [`Details: ${details}`] : []),\n ...(errorConfig.version ? [`Version: ${errorConfig.version}`] : []),\n ].join('\\n');\n super(message, args.cause ? { cause: args.cause } : undefined);\n Object.defineProperty(this, \"details\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"docsPath\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"metaMessages\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"shortMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"version\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"name\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 'BaseError'\n });\n this.details = details;\n this.docsPath = docsPath;\n this.metaMessages = args.metaMessages;\n this.name = args.name ?? this.name;\n this.shortMessage = shortMessage;\n this.version = version;\n }\n walk(fn) {\n return walk(this, fn);\n }\n}\nfunction walk(err, fn) {\n if (fn?.(err))\n return err;\n if (err &&\n typeof err === 'object' &&\n 'cause' in err &&\n err.cause !== undefined)\n return walk(err.cause, fn);\n return fn ? null : err;\n}\n//# sourceMappingURL=base.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = _default;\nexports.URL = exports.DNS = void 0;\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n\n const bytes = [];\n\n for (let i = 0; i < str.length; ++i) {\n bytes.push(str.charCodeAt(i));\n }\n\n return bytes;\n}\n\nconst DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\nexports.DNS = DNS;\nconst URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\nexports.URL = URL;\n\nfunction _default(name, version, hashfunc) {\n function generateUUID(value, namespace, buf, offset) {\n if (typeof value === 'string') {\n value = stringToBytes(value);\n }\n\n if (typeof namespace === 'string') {\n namespace = (0, _parse.default)(namespace);\n }\n\n if (namespace.length !== 16) {\n throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');\n } // Compute hash of namespace and value, Per 4.3\n // Future: Use spread syntax when supported on all platforms, e.g. `bytes =\n // hashfunc([...namespace, ... value])`\n\n\n let bytes = new Uint8Array(16 + value.length);\n bytes.set(namespace);\n bytes.set(value, namespace.length);\n bytes = hashfunc(bytes);\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = bytes[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.default)(bytes);\n } // Function#name is not settable on some platforms (#270)\n\n\n try {\n generateUUID.name = name; // eslint-disable-next-line no-empty\n } catch (err) {} // For CommonJS default export support\n\n\n generateUUID.DNS = DNS;\n generateUUID.URL = URL;\n return generateUUID;\n}","/**\n * Hex, bytes and number utilities.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes as abytes_, bytesToHex as bytesToHex_, concatBytes as concatBytes_, hexToBytes as hexToBytes_, isBytes as isBytes_, } from '@noble/hashes/utils.js';\nexport { abytes, anumber, bytesToHex, bytesToUtf8, concatBytes, hexToBytes, isBytes, randomBytes, utf8ToBytes, } from '@noble/hashes/utils.js';\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nexport function abool(title, value) {\n if (typeof value !== 'boolean')\n throw new Error(title + ' boolean expected, got ' + value);\n}\n// tmp name until v2\nexport function _abool2(value, title = '') {\n if (typeof value !== 'boolean') {\n const prefix = title && `\"${title}\"`;\n throw new Error(prefix + 'expected boolean, got type=' + typeof value);\n }\n return value;\n}\n// tmp name until v2\n/** Asserts something is Uint8Array. */\nexport function _abytes2(value, length, title = '') {\n const bytes = isBytes_(value);\n const len = value?.length;\n const needsLen = length !== undefined;\n if (!bytes || (needsLen && len !== length)) {\n const prefix = title && `\"${title}\" `;\n const ofLen = needsLen ? ` of length ${length}` : '';\n const got = bytes ? `length=${len}` : `type=${typeof value}`;\n throw new Error(prefix + 'expected Uint8Array' + ofLen + ', got ' + got);\n }\n return value;\n}\n// Used in weierstrass, der\nexport function numberToHexUnpadded(num) {\n const hex = num.toString(16);\n return hex.length & 1 ? '0' + hex : hex;\n}\nexport function hexToNumber(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex_(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n abytes_(bytes);\n return hexToNumber(bytesToHex_(Uint8Array.from(bytes).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n return hexToBytes_(n.toString(16).padStart(len * 2, '0'));\n}\nexport function numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n// Unpadded, rarely used\nexport function numberToVarBytesBE(n) {\n return hexToBytes_(numberToHexUnpadded(n));\n}\n/**\n * Takes hex string or Uint8Array, converts to Uint8Array.\n * Validates output length.\n * Will throw error for other types.\n * @param title descriptive title for an error e.g. 'secret key'\n * @param hex hex string or Uint8Array\n * @param expectedLength optional, will compare to result array's length\n * @returns\n */\nexport function ensureBytes(title, hex, expectedLength) {\n let res;\n if (typeof hex === 'string') {\n try {\n res = hexToBytes_(hex);\n }\n catch (e) {\n throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e);\n }\n }\n else if (isBytes_(hex)) {\n // Uint8Array.from() instead of hash.slice() because node.js Buffer\n // is instance of Uint8Array, and its slice() creates **mutable** copy\n res = Uint8Array.from(hex);\n }\n else {\n throw new Error(title + ' must be hex string or Uint8Array');\n }\n const len = res.length;\n if (typeof expectedLength === 'number' && len !== expectedLength)\n throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len);\n return res;\n}\n// Compares 2 u8a-s in kinda constant time\nexport function equalBytes(a, b) {\n if (a.length !== b.length)\n return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++)\n diff |= a[i] ^ b[i];\n return diff === 0;\n}\n/**\n * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,\n * and Buffer#slice creates mutable copy. Never use Buffers!\n */\nexport function copyBytes(bytes) {\n return Uint8Array.from(bytes);\n}\n/**\n * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols\n * Should be safe to use for things expected to be ASCII.\n * Returns exact same result as utf8ToBytes for ASCII or throws.\n */\nexport function asciiToBytes(ascii) {\n return Uint8Array.from(ascii, (c, i) => {\n const charCode = c.charCodeAt(0);\n if (c.length !== 1 || charCode > 127) {\n throw new Error(`string contains non-ASCII character \"${ascii[i]}\" with code ${charCode} at position ${i}`);\n }\n return charCode;\n });\n}\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\n// export const utf8ToBytes: typeof utf8ToBytes_ = utf8ToBytes_;\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\n// export const bytesToUtf8: typeof bytesToUtf8_ = bytesToUtf8_;\n// Is positive bigint\nconst isPosBig = (n) => typeof n === 'bigint' && _0n <= n;\nexport function inRange(n, min, max) {\n return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts min <= n < max. NOTE: It's < max and not <= max.\n * @example\n * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)\n */\nexport function aInRange(title, n, min, max) {\n // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n // consider P=256n, min=0n, max=P\n // - a for min=0 would require -1: `inRange('x', x, -1n, P)`\n // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`\n // - our way is the cleanest: `inRange('x', x, 0n, P)\n if (!inRange(n, min, max))\n throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n);\n}\n// Bit operations\n/**\n * Calculates amount of bits in a bigint.\n * Same as `n.toString(2).length`\n * TODO: merge with nLength in modular\n */\nexport function bitLen(n) {\n let len;\n for (len = 0; n > _0n; n >>= _1n, len += 1)\n ;\n return len;\n}\n/**\n * Gets single bit at position.\n * NOTE: first bit position is 0 (same as arrays)\n * Same as `!!+Array.from(n.toString(2)).reverse()[pos]`\n */\nexport function bitGet(n, pos) {\n return (n >> BigInt(pos)) & _1n;\n}\n/**\n * Sets single bit at position.\n */\nexport function bitSet(n, pos, value) {\n return n | ((value ? _1n : _0n) << BigInt(pos));\n}\n/**\n * Calculate mask for N bits. Not using ** operator with bigints because of old engines.\n * Same as BigInt(`0b${Array(i).fill('1').join('')}`)\n */\nexport const bitMask = (n) => (_1n << BigInt(n)) - _1n;\n/**\n * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n * @returns function that will call DRBG until 2nd arg returns something meaningful\n * @example\n * const drbg = createHmacDRBG(32, 32, hmac);\n * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined\n */\nexport function createHmacDrbg(hashLen, qByteLen, hmacFn) {\n if (typeof hashLen !== 'number' || hashLen < 2)\n throw new Error('hashLen must be a number');\n if (typeof qByteLen !== 'number' || qByteLen < 2)\n throw new Error('qByteLen must be a number');\n if (typeof hmacFn !== 'function')\n throw new Error('hmacFn must be a function');\n // Step B, Step C: set hashLen to 8*ceil(hlen/8)\n const u8n = (len) => new Uint8Array(len); // creates Uint8Array\n const u8of = (byte) => Uint8Array.of(byte); // another shortcut\n let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs.\n let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same\n let i = 0; // Iterations counter, will throw when over 1000\n const reset = () => {\n v.fill(1);\n k.fill(0);\n i = 0;\n };\n const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values)\n const reseed = (seed = u8n(0)) => {\n // HMAC-DRBG reseed() function. Steps D-G\n k = h(u8of(0x00), seed); // k = hmac(k || v || 0x00 || seed)\n v = h(); // v = hmac(k || v)\n if (seed.length === 0)\n return;\n k = h(u8of(0x01), seed); // k = hmac(k || v || 0x01 || seed)\n v = h(); // v = hmac(k || v)\n };\n const gen = () => {\n // HMAC-DRBG generate() function\n if (i++ >= 1000)\n throw new Error('drbg: tried 1000 values');\n let len = 0;\n const out = [];\n while (len < qByteLen) {\n v = h();\n const sl = v.slice();\n out.push(sl);\n len += v.length;\n }\n return concatBytes_(...out);\n };\n const genUntil = (seed, pred) => {\n reset();\n reseed(seed); // Steps D-G\n let res = undefined; // Step H: grind until k is in [1..n-1]\n while (!(res = pred(gen())))\n reseed();\n reset();\n return res;\n };\n return genUntil;\n}\n// Validating curves and fields\nconst validatorFns = {\n bigint: (val) => typeof val === 'bigint',\n function: (val) => typeof val === 'function',\n boolean: (val) => typeof val === 'boolean',\n string: (val) => typeof val === 'string',\n stringOrUint8Array: (val) => typeof val === 'string' || isBytes_(val),\n isSafeInteger: (val) => Number.isSafeInteger(val),\n array: (val) => Array.isArray(val),\n field: (val, object) => object.Fp.isValid(val),\n hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen),\n};\n// type Record = { [P in K]: T; }\nexport function validateObject(object, validators, optValidators = {}) {\n const checkField = (fieldName, type, isOptional) => {\n const checkVal = validatorFns[type];\n if (typeof checkVal !== 'function')\n throw new Error('invalid validator function');\n const val = object[fieldName];\n if (isOptional && val === undefined)\n return;\n if (!checkVal(val, object)) {\n throw new Error('param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val);\n }\n };\n for (const [fieldName, type] of Object.entries(validators))\n checkField(fieldName, type, false);\n for (const [fieldName, type] of Object.entries(optValidators))\n checkField(fieldName, type, true);\n return object;\n}\n// validate type tests\n// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 };\n// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok!\n// // Should fail type-check\n// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' });\n// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' });\n// const z3 = validateObject(o, { test: 'boolean', z: 'bug' });\n// const z4 = validateObject(o, { a: 'boolean', z: 'bug' });\nexport function isHash(val) {\n return typeof val === 'function' && Number.isSafeInteger(val.outputLen);\n}\nexport function _validateObject(object, fields, optFields = {}) {\n if (!object || typeof object !== 'object')\n throw new Error('expected valid options object');\n function checkField(fieldName, expectedType, isOpt) {\n const val = object[fieldName];\n if (isOpt && val === undefined)\n return;\n const current = typeof val;\n if (current !== expectedType || val === null)\n throw new Error(`param \"${fieldName}\" is invalid: expected ${expectedType}, got ${current}`);\n }\n Object.entries(fields).forEach(([k, v]) => checkField(k, v, false));\n Object.entries(optFields).forEach(([k, v]) => checkField(k, v, true));\n}\n/**\n * throws not implemented error\n */\nexport const notImplemented = () => {\n throw new Error('not implemented');\n};\n/**\n * Memoizes (caches) computation result.\n * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed.\n */\nexport function memoized(fn) {\n const map = new WeakMap();\n return (arg, ...args) => {\n const val = map.get(arg);\n if (val !== undefined)\n return val;\n const computed = fn(arg, ...args);\n map.set(arg, computed);\n return computed;\n };\n}\n//# sourceMappingURL=utils.js.map","import { keccak_256 } from '@noble/hashes/sha3';\nimport { isHex } from '../data/isHex.js';\nimport { toBytes } from '../encoding/toBytes.js';\nimport { toHex } from '../encoding/toHex.js';\nexport function keccak256(value, to_) {\n const to = to_ || 'hex';\n const bytes = keccak_256(isHex(value, { strict: false }) ? toBytes(value) : value);\n if (to === 'bytes')\n return bytes;\n return toHex(bytes);\n}\n//# sourceMappingURL=keccak256.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nObject.defineProperty(exports, \"v1\", {\n enumerable: true,\n get: function () {\n return _v.default;\n }\n});\nObject.defineProperty(exports, \"v3\", {\n enumerable: true,\n get: function () {\n return _v2.default;\n }\n});\nObject.defineProperty(exports, \"v4\", {\n enumerable: true,\n get: function () {\n return _v3.default;\n }\n});\nObject.defineProperty(exports, \"v5\", {\n enumerable: true,\n get: function () {\n return _v4.default;\n }\n});\nObject.defineProperty(exports, \"NIL\", {\n enumerable: true,\n get: function () {\n return _nil.default;\n }\n});\nObject.defineProperty(exports, \"version\", {\n enumerable: true,\n get: function () {\n return _version.default;\n }\n});\nObject.defineProperty(exports, \"validate\", {\n enumerable: true,\n get: function () {\n return _validate.default;\n }\n});\nObject.defineProperty(exports, \"stringify\", {\n enumerable: true,\n get: function () {\n return _stringify.default;\n }\n});\nObject.defineProperty(exports, \"parse\", {\n enumerable: true,\n get: function () {\n return _parse.default;\n }\n});\n\nvar _v = _interopRequireDefault(require(\"./v1.js\"));\n\nvar _v2 = _interopRequireDefault(require(\"./v3.js\"));\n\nvar _v3 = _interopRequireDefault(require(\"./v4.js\"));\n\nvar _v4 = _interopRequireDefault(require(\"./v5.js\"));\n\nvar _nil = _interopRequireDefault(require(\"./nil.js\"));\n\nvar _version = _interopRequireDefault(require(\"./version.js\"));\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nvar _parse = _interopRequireDefault(require(\"./parse.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nconst byteToHex = [];\n\nfor (let i = 0; i < 256; ++i) {\n byteToHex.push((i + 0x100).toString(16).substr(1));\n}\n\nfunction stringify(arr, offset = 0) {\n // Note: Be careful editing this code! It's been tuned for performance\n // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434\n const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one\n // of the following:\n // - One or more input array values don't map to a hex octet (leading to\n // \"undefined\" in the uuid)\n // - Invalid input values for the RFC `version` or `variant` fields\n\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Stringified UUID is invalid');\n }\n\n return uuid;\n}\n\nvar _default = stringify;\nexports.default = _default;","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bech32m = exports.bech32 = void 0;\nconst ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';\nconst ALPHABET_MAP = {};\nfor (let z = 0; z < ALPHABET.length; z++) {\n const x = ALPHABET.charAt(z);\n ALPHABET_MAP[x] = z;\n}\nfunction polymodStep(pre) {\n const b = pre >> 25;\n return (((pre & 0x1ffffff) << 5) ^\n (-((b >> 0) & 1) & 0x3b6a57b2) ^\n (-((b >> 1) & 1) & 0x26508e6d) ^\n (-((b >> 2) & 1) & 0x1ea119fa) ^\n (-((b >> 3) & 1) & 0x3d4233dd) ^\n (-((b >> 4) & 1) & 0x2a1462b3));\n}\nfunction prefixChk(prefix) {\n let chk = 1;\n for (let i = 0; i < prefix.length; ++i) {\n const c = prefix.charCodeAt(i);\n if (c < 33 || c > 126)\n return 'Invalid prefix (' + prefix + ')';\n chk = polymodStep(chk) ^ (c >> 5);\n }\n chk = polymodStep(chk);\n for (let i = 0; i < prefix.length; ++i) {\n const v = prefix.charCodeAt(i);\n chk = polymodStep(chk) ^ (v & 0x1f);\n }\n return chk;\n}\nfunction convert(data, inBits, outBits, pad) {\n let value = 0;\n let bits = 0;\n const maxV = (1 << outBits) - 1;\n const result = [];\n for (let i = 0; i < data.length; ++i) {\n value = (value << inBits) | data[i];\n bits += inBits;\n while (bits >= outBits) {\n bits -= outBits;\n result.push((value >> bits) & maxV);\n }\n }\n if (pad) {\n if (bits > 0) {\n result.push((value << (outBits - bits)) & maxV);\n }\n }\n else {\n if (bits >= inBits)\n return 'Excess padding';\n if ((value << (outBits - bits)) & maxV)\n return 'Non-zero padding';\n }\n return result;\n}\nfunction toWords(bytes) {\n return convert(bytes, 8, 5, true);\n}\nfunction fromWordsUnsafe(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n}\nfunction fromWords(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n throw new Error(res);\n}\nfunction getLibraryFromEncoding(encoding) {\n let ENCODING_CONST;\n if (encoding === 'bech32') {\n ENCODING_CONST = 1;\n }\n else {\n ENCODING_CONST = 0x2bc830a3;\n }\n function encode(prefix, words, LIMIT) {\n LIMIT = LIMIT || 90;\n if (prefix.length + 7 + words.length > LIMIT)\n throw new TypeError('Exceeds length limit');\n prefix = prefix.toLowerCase();\n // determine chk mod\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n throw new Error(chk);\n let result = prefix + '1';\n for (let i = 0; i < words.length; ++i) {\n const x = words[i];\n if (x >> 5 !== 0)\n throw new Error('Non 5-bit word');\n chk = polymodStep(chk) ^ x;\n result += ALPHABET.charAt(x);\n }\n for (let i = 0; i < 6; ++i) {\n chk = polymodStep(chk);\n }\n chk ^= ENCODING_CONST;\n for (let i = 0; i < 6; ++i) {\n const v = (chk >> ((5 - i) * 5)) & 0x1f;\n result += ALPHABET.charAt(v);\n }\n return result;\n }\n function __decode(str, LIMIT) {\n LIMIT = LIMIT || 90;\n if (str.length < 8)\n return str + ' too short';\n if (str.length > LIMIT)\n return 'Exceeds length limit';\n // don't allow mixed case\n const lowered = str.toLowerCase();\n const uppered = str.toUpperCase();\n if (str !== lowered && str !== uppered)\n return 'Mixed-case string ' + str;\n str = lowered;\n const split = str.lastIndexOf('1');\n if (split === -1)\n return 'No separator character for ' + str;\n if (split === 0)\n return 'Missing prefix for ' + str;\n const prefix = str.slice(0, split);\n const wordChars = str.slice(split + 1);\n if (wordChars.length < 6)\n return 'Data too short';\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n return chk;\n const words = [];\n for (let i = 0; i < wordChars.length; ++i) {\n const c = wordChars.charAt(i);\n const v = ALPHABET_MAP[c];\n if (v === undefined)\n return 'Unknown character ' + c;\n chk = polymodStep(chk) ^ v;\n // not in the checksum?\n if (i + 6 >= wordChars.length)\n continue;\n words.push(v);\n }\n if (chk !== ENCODING_CONST)\n return 'Invalid checksum for ' + str;\n return { prefix, words };\n }\n function decodeUnsafe(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n }\n function decode(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n throw new Error(res);\n }\n return {\n decodeUnsafe,\n decode,\n encode,\n toWords,\n fromWordsUnsafe,\n fromWords,\n };\n}\nexports.bech32 = getLibraryFromEncoding('bech32');\nexports.bech32m = getLibraryFromEncoding('bech32m');\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _validate = _interopRequireDefault(require(\"./validate.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction parse(uuid) {\n if (!(0, _validate.default)(uuid)) {\n throw TypeError('Invalid UUID');\n }\n\n let v;\n const arr = new Uint8Array(16); // Parse ########-....-....-....-............\n\n arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;\n arr[1] = v >>> 16 & 0xff;\n arr[2] = v >>> 8 & 0xff;\n arr[3] = v & 0xff; // Parse ........-####-....-....-............\n\n arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;\n arr[5] = v & 0xff; // Parse ........-....-####-....-............\n\n arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;\n arr[7] = v & 0xff; // Parse ........-....-....-####-............\n\n arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;\n arr[9] = v & 0xff; // Parse ........-....-....-....-############\n // (Use \"/\" to avoid 32-bit truncation when bit-shifting high-order bytes)\n\n arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;\n arr[11] = v / 0x100000000 & 0xff;\n arr[12] = v >>> 24 & 0xff;\n arr[13] = v >>> 16 & 0xff;\n arr[14] = v >>> 8 & 0xff;\n arr[15] = v & 0xff;\n return arr;\n}\n\nvar _default = parse;\nexports.default = _default;","/*\r\n * The MIT License (MIT)\r\n *\r\n * Copyright (c) 2014 Patrick Gansterer \r\n *\r\n * Permission is hereby granted, free of charge, to any person obtaining a copy\r\n * of this software and associated documentation files (the \"Software\"), to deal\r\n * in the Software without restriction, including without limitation the rights\r\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n * copies of the Software, and to permit persons to whom the Software is\r\n * furnished to do so, subject to the following conditions:\r\n *\r\n * The above copyright notice and this permission notice shall be included in all\r\n * copies or substantial portions of the Software.\r\n *\r\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r\n * SOFTWARE.\r\n */\r\n\r\n(function(global, undefined) { \"use strict\";\r\nvar POW_2_24 = Math.pow(2, -24),\r\n POW_2_32 = Math.pow(2, 32),\r\n POW_2_53 = Math.pow(2, 53);\r\n\r\nfunction encode(value) {\r\n var data = new ArrayBuffer(256);\r\n var dataView = new DataView(data);\r\n var lastLength;\r\n var offset = 0;\r\n\r\n function ensureSpace(length) {\r\n var newByteLength = data.byteLength;\r\n var requiredLength = offset + length;\r\n while (newByteLength < requiredLength)\r\n newByteLength *= 2;\r\n if (newByteLength !== data.byteLength) {\r\n var oldDataView = dataView;\r\n data = new ArrayBuffer(newByteLength);\r\n dataView = new DataView(data);\r\n var uint32count = (offset + 3) >> 2;\r\n for (var i = 0; i < uint32count; ++i)\r\n dataView.setUint32(i * 4, oldDataView.getUint32(i * 4));\r\n }\r\n\r\n lastLength = length;\r\n return dataView;\r\n }\r\n function write() {\r\n offset += lastLength;\r\n }\r\n function writeFloat64(value) {\r\n write(ensureSpace(8).setFloat64(offset, value));\r\n }\r\n function writeUint8(value) {\r\n write(ensureSpace(1).setUint8(offset, value));\r\n }\r\n function writeUint8Array(value) {\r\n var dataView = ensureSpace(value.length);\r\n for (var i = 0; i < value.length; ++i)\r\n dataView.setUint8(offset + i, value[i]);\r\n write();\r\n }\r\n function writeUint16(value) {\r\n write(ensureSpace(2).setUint16(offset, value));\r\n }\r\n function writeUint32(value) {\r\n write(ensureSpace(4).setUint32(offset, value));\r\n }\r\n function writeUint64(value) {\r\n var low = value % POW_2_32;\r\n var high = (value - low) / POW_2_32;\r\n var dataView = ensureSpace(8);\r\n dataView.setUint32(offset, high);\r\n dataView.setUint32(offset + 4, low);\r\n write();\r\n }\r\n function writeTypeAndLength(type, length) {\r\n if (length < 24) {\r\n writeUint8(type << 5 | length);\r\n } else if (length < 0x100) {\r\n writeUint8(type << 5 | 24);\r\n writeUint8(length);\r\n } else if (length < 0x10000) {\r\n writeUint8(type << 5 | 25);\r\n writeUint16(length);\r\n } else if (length < 0x100000000) {\r\n writeUint8(type << 5 | 26);\r\n writeUint32(length);\r\n } else {\r\n writeUint8(type << 5 | 27);\r\n writeUint64(length);\r\n }\r\n }\r\n \r\n function encodeItem(value) {\r\n var i;\r\n\r\n if (value === false)\r\n return writeUint8(0xf4);\r\n if (value === true)\r\n return writeUint8(0xf5);\r\n if (value === null)\r\n return writeUint8(0xf6);\r\n if (value === undefined)\r\n return writeUint8(0xf7);\r\n \r\n switch (typeof value) {\r\n case \"number\":\r\n if (Math.floor(value) === value) {\r\n if (0 <= value && value <= POW_2_53)\r\n return writeTypeAndLength(0, value);\r\n if (-POW_2_53 <= value && value < 0)\r\n return writeTypeAndLength(1, -(value + 1));\r\n }\r\n writeUint8(0xfb);\r\n return writeFloat64(value);\r\n\r\n case \"string\":\r\n var utf8data = [];\r\n for (i = 0; i < value.length; ++i) {\r\n var charCode = value.charCodeAt(i);\r\n if (charCode < 0x80) {\r\n utf8data.push(charCode);\r\n } else if (charCode < 0x800) {\r\n utf8data.push(0xc0 | charCode >> 6);\r\n utf8data.push(0x80 | charCode & 0x3f);\r\n } else if (charCode < 0xd800) {\r\n utf8data.push(0xe0 | charCode >> 12);\r\n utf8data.push(0x80 | (charCode >> 6) & 0x3f);\r\n utf8data.push(0x80 | charCode & 0x3f);\r\n } else {\r\n charCode = (charCode & 0x3ff) << 10;\r\n charCode |= value.charCodeAt(++i) & 0x3ff;\r\n charCode += 0x10000;\r\n\r\n utf8data.push(0xf0 | charCode >> 18);\r\n utf8data.push(0x80 | (charCode >> 12) & 0x3f);\r\n utf8data.push(0x80 | (charCode >> 6) & 0x3f);\r\n utf8data.push(0x80 | charCode & 0x3f);\r\n }\r\n }\r\n\r\n writeTypeAndLength(3, utf8data.length);\r\n return writeUint8Array(utf8data);\r\n\r\n default:\r\n var length;\r\n if (Array.isArray(value)) {\r\n length = value.length;\r\n writeTypeAndLength(4, length);\r\n for (i = 0; i < length; ++i)\r\n encodeItem(value[i]);\r\n } else if (value instanceof Uint8Array) {\r\n writeTypeAndLength(2, value.length);\r\n writeUint8Array(value);\r\n } else {\r\n var keys = Object.keys(value);\r\n length = keys.length;\r\n writeTypeAndLength(5, length);\r\n for (i = 0; i < length; ++i) {\r\n var key = keys[i];\r\n encodeItem(key);\r\n encodeItem(value[key]);\r\n }\r\n }\r\n }\r\n }\r\n \r\n encodeItem(value);\r\n\r\n if (\"slice\" in data)\r\n return data.slice(0, offset);\r\n \r\n var ret = new ArrayBuffer(offset);\r\n var retView = new DataView(ret);\r\n for (var i = 0; i < offset; ++i)\r\n retView.setUint8(i, dataView.getUint8(i));\r\n return ret;\r\n}\r\n\r\nfunction decode(data, tagger, simpleValue) {\r\n var dataView = new DataView(data);\r\n var offset = 0;\r\n \r\n if (typeof tagger !== \"function\")\r\n tagger = function(value) { return value; };\r\n if (typeof simpleValue !== \"function\")\r\n simpleValue = function() { return undefined; };\r\n\r\n function read(value, length) {\r\n offset += length;\r\n return value;\r\n }\r\n function readArrayBuffer(length) {\r\n return read(new Uint8Array(data, offset, length), length);\r\n }\r\n function readFloat16() {\r\n var tempArrayBuffer = new ArrayBuffer(4);\r\n var tempDataView = new DataView(tempArrayBuffer);\r\n var value = readUint16();\r\n\r\n var sign = value & 0x8000;\r\n var exponent = value & 0x7c00;\r\n var fraction = value & 0x03ff;\r\n \r\n if (exponent === 0x7c00)\r\n exponent = 0xff << 10;\r\n else if (exponent !== 0)\r\n exponent += (127 - 15) << 10;\r\n else if (fraction !== 0)\r\n return fraction * POW_2_24;\r\n \r\n tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13);\r\n return tempDataView.getFloat32(0);\r\n }\r\n function readFloat32() {\r\n return read(dataView.getFloat32(offset), 4);\r\n }\r\n function readFloat64() {\r\n return read(dataView.getFloat64(offset), 8);\r\n }\r\n function readUint8() {\r\n return read(dataView.getUint8(offset), 1);\r\n }\r\n function readUint16() {\r\n return read(dataView.getUint16(offset), 2);\r\n }\r\n function readUint32() {\r\n return read(dataView.getUint32(offset), 4);\r\n }\r\n function readUint64() {\r\n return readUint32() * POW_2_32 + readUint32();\r\n }\r\n function readBreak() {\r\n if (dataView.getUint8(offset) !== 0xff)\r\n return false;\r\n offset += 1;\r\n return true;\r\n }\r\n function readLength(additionalInformation) {\r\n if (additionalInformation < 24)\r\n return additionalInformation;\r\n if (additionalInformation === 24)\r\n return readUint8();\r\n if (additionalInformation === 25)\r\n return readUint16();\r\n if (additionalInformation === 26)\r\n return readUint32();\r\n if (additionalInformation === 27)\r\n return readUint64();\r\n if (additionalInformation === 31)\r\n return -1;\r\n throw \"Invalid length encoding\";\r\n }\r\n function readIndefiniteStringLength(majorType) {\r\n var initialByte = readUint8();\r\n if (initialByte === 0xff)\r\n return -1;\r\n var length = readLength(initialByte & 0x1f);\r\n if (length < 0 || (initialByte >> 5) !== majorType)\r\n throw \"Invalid indefinite length element\";\r\n return length;\r\n }\r\n\r\n function appendUtf16data(utf16data, length) {\r\n for (var i = 0; i < length; ++i) {\r\n var value = readUint8();\r\n if (value & 0x80) {\r\n if (value < 0xe0) {\r\n value = (value & 0x1f) << 6\r\n | (readUint8() & 0x3f);\r\n length -= 1;\r\n } else if (value < 0xf0) {\r\n value = (value & 0x0f) << 12\r\n | (readUint8() & 0x3f) << 6\r\n | (readUint8() & 0x3f);\r\n length -= 2;\r\n } else {\r\n value = (value & 0x0f) << 18\r\n | (readUint8() & 0x3f) << 12\r\n | (readUint8() & 0x3f) << 6\r\n | (readUint8() & 0x3f);\r\n length -= 3;\r\n }\r\n }\r\n\r\n if (value < 0x10000) {\r\n utf16data.push(value);\r\n } else {\r\n value -= 0x10000;\r\n utf16data.push(0xd800 | (value >> 10));\r\n utf16data.push(0xdc00 | (value & 0x3ff));\r\n }\r\n }\r\n }\r\n\r\n function decodeItem() {\r\n var initialByte = readUint8();\r\n var majorType = initialByte >> 5;\r\n var additionalInformation = initialByte & 0x1f;\r\n var i;\r\n var length;\r\n\r\n if (majorType === 7) {\r\n switch (additionalInformation) {\r\n case 25:\r\n return readFloat16();\r\n case 26:\r\n return readFloat32();\r\n case 27:\r\n return readFloat64();\r\n }\r\n }\r\n\r\n length = readLength(additionalInformation);\r\n if (length < 0 && (majorType < 2 || 6 < majorType))\r\n throw \"Invalid length\";\r\n\r\n switch (majorType) {\r\n case 0:\r\n return length;\r\n case 1:\r\n return -1 - length;\r\n case 2:\r\n if (length < 0) {\r\n var elements = [];\r\n var fullArrayLength = 0;\r\n while ((length = readIndefiniteStringLength(majorType)) >= 0) {\r\n fullArrayLength += length;\r\n elements.push(readArrayBuffer(length));\r\n }\r\n var fullArray = new Uint8Array(fullArrayLength);\r\n var fullArrayOffset = 0;\r\n for (i = 0; i < elements.length; ++i) {\r\n fullArray.set(elements[i], fullArrayOffset);\r\n fullArrayOffset += elements[i].length;\r\n }\r\n return fullArray;\r\n }\r\n return readArrayBuffer(length);\r\n case 3:\r\n var utf16data = [];\r\n if (length < 0) {\r\n while ((length = readIndefiniteStringLength(majorType)) >= 0)\r\n appendUtf16data(utf16data, length);\r\n } else\r\n appendUtf16data(utf16data, length);\r\n return String.fromCharCode.apply(null, utf16data);\r\n case 4:\r\n var retArray;\r\n if (length < 0) {\r\n retArray = [];\r\n while (!readBreak())\r\n retArray.push(decodeItem());\r\n } else {\r\n retArray = new Array(length);\r\n for (i = 0; i < length; ++i)\r\n retArray[i] = decodeItem();\r\n }\r\n return retArray;\r\n case 5:\r\n var retObject = {};\r\n for (i = 0; i < length || length < 0 && !readBreak(); ++i) {\r\n var key = decodeItem();\r\n retObject[key] = decodeItem();\r\n }\r\n return retObject;\r\n case 6:\r\n return tagger(decodeItem(), length);\r\n case 7:\r\n switch (length) {\r\n case 20:\r\n return false;\r\n case 21:\r\n return true;\r\n case 22:\r\n return null;\r\n case 23:\r\n return undefined;\r\n default:\r\n return simpleValue(length);\r\n }\r\n }\r\n }\r\n\r\n var ret = decodeItem();\r\n if (offset !== data.byteLength)\r\n throw \"Remaining bytes\";\r\n return ret;\r\n}\r\n\r\nvar obj = { encode: encode, decode: decode };\r\n\r\nif (typeof define === \"function\" && define.amd)\r\n define(\"cbor/cbor\", obj);\r\nelse if (typeof module !== 'undefined' && module.exports)\r\n module.exports = obj;\r\nelse if (!global.CBOR)\r\n global.CBOR = obj;\r\n\r\n})(this);\r\n","/**\n * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y².\n * For design rationale of types / exports, see weierstrass module documentation.\n * Untwisted Edwards curves exist, but they aren't used in real-world protocols.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { _validateObject, _abool2 as abool, _abytes2 as abytes, aInRange, bytesToHex, bytesToNumberLE, concatBytes, copyBytes, ensureBytes, isBytes, memoized, notImplemented, randomBytes as randomBytesWeb, } from \"../utils.js\";\nimport { _createCurveFields, normalizeZ, pippenger, wNAF, } from \"./curve.js\";\nimport { Field } from \"./modular.js\";\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8);\nfunction isEdValidXY(Fp, CURVE, x, y) {\n const x2 = Fp.sqr(x);\n const y2 = Fp.sqr(y);\n const left = Fp.add(Fp.mul(CURVE.a, x2), y2);\n const right = Fp.add(Fp.ONE, Fp.mul(CURVE.d, Fp.mul(x2, y2)));\n return Fp.eql(left, right);\n}\nexport function edwards(params, extraOpts = {}) {\n const validated = _createCurveFields('edwards', params, extraOpts, extraOpts.FpFnLE);\n const { Fp, Fn } = validated;\n let CURVE = validated.CURVE;\n const { h: cofactor } = CURVE;\n _validateObject(extraOpts, {}, { uvRatio: 'function' });\n // Important:\n // There are some places where Fp.BYTES is used instead of nByteLength.\n // So far, everything has been tested with curves of Fp.BYTES == nByteLength.\n // TODO: test and find curves which behave otherwise.\n const MASK = _2n << (BigInt(Fn.BYTES * 8) - _1n);\n const modP = (n) => Fp.create(n); // Function overrides\n // sqrt(u/v)\n const uvRatio = extraOpts.uvRatio ||\n ((u, v) => {\n try {\n return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) };\n }\n catch (e) {\n return { isValid: false, value: _0n };\n }\n });\n // Validate whether the passed curve params are valid.\n // equation ax² + y² = 1 + dx²y² should work for generator point.\n if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy))\n throw new Error('bad curve params: generator point');\n /**\n * Asserts coordinate is valid: 0 <= n < MASK.\n * Coordinates >= Fp.ORDER are allowed for zip215.\n */\n function acoord(title, n, banZero = false) {\n const min = banZero ? _1n : _0n;\n aInRange('coordinate ' + title, n, min, MASK);\n return n;\n }\n function aextpoint(other) {\n if (!(other instanceof Point))\n throw new Error('ExtendedPoint expected');\n }\n // Converts Extended point to default (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n const toAffineMemo = memoized((p, iz) => {\n const { X, Y, Z } = p;\n const is0 = p.is0();\n if (iz == null)\n iz = is0 ? _8n : Fp.inv(Z); // 8 was chosen arbitrarily\n const x = modP(X * iz);\n const y = modP(Y * iz);\n const zz = Fp.mul(Z, iz);\n if (is0)\n return { x: _0n, y: _1n };\n if (zz !== _1n)\n throw new Error('invZ was invalid');\n return { x, y };\n });\n const assertValidMemo = memoized((p) => {\n const { a, d } = CURVE;\n if (p.is0())\n throw new Error('bad point: ZERO'); // TODO: optimize, with vars below?\n // Equation in affine coordinates: ax² + y² = 1 + dx²y²\n // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y²\n const { X, Y, Z, T } = p;\n const X2 = modP(X * X); // X²\n const Y2 = modP(Y * Y); // Y²\n const Z2 = modP(Z * Z); // Z²\n const Z4 = modP(Z2 * Z2); // Z⁴\n const aX2 = modP(X2 * a); // aX²\n const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z²\n const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y²\n if (left !== right)\n throw new Error('bad point: equation left != right (1)');\n // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T\n const XY = modP(X * Y);\n const ZT = modP(Z * T);\n if (XY !== ZT)\n throw new Error('bad point: equation left != right (2)');\n return true;\n });\n // Extended Point works in extended coordinates: (X, Y, Z, T) ∋ (x=X/Z, y=Y/Z, T=xy).\n // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates\n class Point {\n constructor(X, Y, Z, T) {\n this.X = acoord('x', X);\n this.Y = acoord('y', Y);\n this.Z = acoord('z', Z, true);\n this.T = acoord('t', T);\n Object.freeze(this);\n }\n static CURVE() {\n return CURVE;\n }\n static fromAffine(p) {\n if (p instanceof Point)\n throw new Error('extended point not allowed');\n const { x, y } = p || {};\n acoord('x', x);\n acoord('y', y);\n return new Point(x, y, _1n, modP(x * y));\n }\n // Uses algo from RFC8032 5.1.3.\n static fromBytes(bytes, zip215 = false) {\n const len = Fp.BYTES;\n const { a, d } = CURVE;\n bytes = copyBytes(abytes(bytes, len, 'point'));\n abool(zip215, 'zip215');\n const normed = copyBytes(bytes); // copy again, we'll manipulate it\n const lastByte = bytes[len - 1]; // select last byte\n normed[len - 1] = lastByte & ~0x80; // clear last bit\n const y = bytesToNumberLE(normed);\n // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5.\n // RFC8032 prohibits >= p, but ZIP215 doesn't\n // zip215=true: 0 <= y < MASK (2^256 for ed25519)\n // zip215=false: 0 <= y < P (2^255-19 for ed25519)\n const max = zip215 ? MASK : Fp.ORDER;\n aInRange('point.y', y, _0n, max);\n // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case:\n // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a)\n const y2 = modP(y * y); // denominator is always non-0 mod p.\n const u = modP(y2 - _1n); // u = y² - 1\n const v = modP(d * y2 - a); // v = d y² + 1.\n let { isValid, value: x } = uvRatio(u, v); // √(u/v)\n if (!isValid)\n throw new Error('bad point: invalid y coordinate');\n const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper\n const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit\n if (!zip215 && x === _0n && isLastByteOdd)\n // if x=0 and x_0 = 1, fail\n throw new Error('bad point: x=0 and x_0=1');\n if (isLastByteOdd !== isXOdd)\n x = modP(-x); // if x_0 != x mod 2, set x = p-x\n return Point.fromAffine({ x, y });\n }\n static fromHex(bytes, zip215 = false) {\n return Point.fromBytes(ensureBytes('point', bytes), zip215);\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n precompute(windowSize = 8, isLazy = true) {\n wnaf.createCache(this, windowSize);\n if (!isLazy)\n this.multiply(_2n); // random number\n return this;\n }\n // Useful in fromAffine() - not for fromBytes(), which always created valid points.\n assertValidity() {\n assertValidMemo(this);\n }\n // Compare one point to another.\n equals(other) {\n aextpoint(other);\n const { X: X1, Y: Y1, Z: Z1 } = this;\n const { X: X2, Y: Y2, Z: Z2 } = other;\n const X1Z2 = modP(X1 * Z2);\n const X2Z1 = modP(X2 * Z1);\n const Y1Z2 = modP(Y1 * Z2);\n const Y2Z1 = modP(Y2 * Z1);\n return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n negate() {\n // Flips point sign to a negative one (-x, y in affine coords)\n return new Point(modP(-this.X), this.Y, this.Z, modP(-this.T));\n }\n // Fast algo for doubling Extended Point.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd\n // Cost: 4M + 4S + 1*a + 6add + 1*2.\n double() {\n const { a } = CURVE;\n const { X: X1, Y: Y1, Z: Z1 } = this;\n const A = modP(X1 * X1); // A = X12\n const B = modP(Y1 * Y1); // B = Y12\n const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12\n const D = modP(a * A); // D = a*A\n const x1y1 = X1 + Y1;\n const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B\n const G = D + B; // G = D+B\n const F = G - C; // F = G-C\n const H = D - B; // H = D-B\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n // Fast algo for adding 2 Extended Points.\n // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd\n // Cost: 9M + 1*a + 1*d + 7add.\n add(other) {\n aextpoint(other);\n const { a, d } = CURVE;\n const { X: X1, Y: Y1, Z: Z1, T: T1 } = this;\n const { X: X2, Y: Y2, Z: Z2, T: T2 } = other;\n const A = modP(X1 * X2); // A = X1*X2\n const B = modP(Y1 * Y2); // B = Y1*Y2\n const C = modP(T1 * d * T2); // C = T1*d*T2\n const D = modP(Z1 * Z2); // D = Z1*Z2\n const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B\n const F = D - C; // F = D-C\n const G = D + C; // G = D+C\n const H = modP(B - a * A); // H = B-a*A\n const X3 = modP(E * F); // X3 = E*F\n const Y3 = modP(G * H); // Y3 = G*H\n const T3 = modP(E * H); // T3 = E*H\n const Z3 = modP(F * G); // Z3 = F*G\n return new Point(X3, Y3, Z3, T3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n // Constant-time multiplication.\n multiply(scalar) {\n // 1 <= scalar < L\n if (!Fn.isValidNot0(scalar))\n throw new Error('invalid scalar: expected 1 <= sc < curve.n');\n const { p, f } = wnaf.cached(this, scalar, (p) => normalizeZ(Point, p));\n return normalizeZ(Point, [p, f])[0];\n }\n // Non-constant-time multiplication. Uses double-and-add algorithm.\n // It's faster, but should only be used when you don't care about\n // an exposed private key e.g. sig verification.\n // Does NOT allow scalars higher than CURVE.n.\n // Accepts optional accumulator to merge with multiply (important for sparse scalars)\n multiplyUnsafe(scalar, acc = Point.ZERO) {\n // 0 <= scalar < L\n if (!Fn.isValid(scalar))\n throw new Error('invalid scalar: expected 0 <= sc < curve.n');\n if (scalar === _0n)\n return Point.ZERO;\n if (this.is0() || scalar === _1n)\n return this;\n return wnaf.unsafe(this, scalar, (p) => normalizeZ(Point, p), acc);\n }\n // Checks if point is of small order.\n // If you add something to small order point, you will have \"dirty\"\n // point with torsion component.\n // Multiplies point by cofactor and checks if the result is 0.\n isSmallOrder() {\n return this.multiplyUnsafe(cofactor).is0();\n }\n // Multiplies point by curve order and checks if the result is 0.\n // Returns `false` is the point is dirty.\n isTorsionFree() {\n return wnaf.unsafe(this, CURVE.n).is0();\n }\n // Converts Extended point to default (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n toAffine(invertedZ) {\n return toAffineMemo(this, invertedZ);\n }\n clearCofactor() {\n if (cofactor === _1n)\n return this;\n return this.multiplyUnsafe(cofactor);\n }\n toBytes() {\n const { x, y } = this.toAffine();\n // Fp.toBytes() allows non-canonical encoding of y (>= p).\n const bytes = Fp.toBytes(y);\n // Each y has 2 valid points: (x, y), (x,-y).\n // When compressing, it's enough to store y and use the last byte to encode sign of x\n bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0;\n return bytes;\n }\n toHex() {\n return bytesToHex(this.toBytes());\n }\n toString() {\n return ``;\n }\n // TODO: remove\n get ex() {\n return this.X;\n }\n get ey() {\n return this.Y;\n }\n get ez() {\n return this.Z;\n }\n get et() {\n return this.T;\n }\n static normalizeZ(points) {\n return normalizeZ(Point, points);\n }\n static msm(points, scalars) {\n return pippenger(Point, Fn, points, scalars);\n }\n _setWindowSize(windowSize) {\n this.precompute(windowSize);\n }\n toRawBytes() {\n return this.toBytes();\n }\n }\n // base / generator point\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy));\n // zero / infinity / identity point\n Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0\n // math field\n Point.Fp = Fp;\n // scalar field\n Point.Fn = Fn;\n const wnaf = new wNAF(Point, Fn.BITS);\n Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms.\n return Point;\n}\n/**\n * Base class for prime-order points like Ristretto255 and Decaf448.\n * These points eliminate cofactor issues by representing equivalence classes\n * of Edwards curve points.\n */\nexport class PrimeEdwardsPoint {\n constructor(ep) {\n this.ep = ep;\n }\n // Static methods that must be implemented by subclasses\n static fromBytes(_bytes) {\n notImplemented();\n }\n static fromHex(_hex) {\n notImplemented();\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n // Common implementations\n clearCofactor() {\n // no-op for prime-order groups\n return this;\n }\n assertValidity() {\n this.ep.assertValidity();\n }\n toAffine(invertedZ) {\n return this.ep.toAffine(invertedZ);\n }\n toHex() {\n return bytesToHex(this.toBytes());\n }\n toString() {\n return this.toHex();\n }\n isTorsionFree() {\n return true;\n }\n isSmallOrder() {\n return false;\n }\n add(other) {\n this.assertSame(other);\n return this.init(this.ep.add(other.ep));\n }\n subtract(other) {\n this.assertSame(other);\n return this.init(this.ep.subtract(other.ep));\n }\n multiply(scalar) {\n return this.init(this.ep.multiply(scalar));\n }\n multiplyUnsafe(scalar) {\n return this.init(this.ep.multiplyUnsafe(scalar));\n }\n double() {\n return this.init(this.ep.double());\n }\n negate() {\n return this.init(this.ep.negate());\n }\n precompute(windowSize, isLazy) {\n return this.init(this.ep.precompute(windowSize, isLazy));\n }\n /** @deprecated use `toBytes` */\n toRawBytes() {\n return this.toBytes();\n }\n}\n/**\n * Initializes EdDSA signatures over given Edwards curve.\n */\nexport function eddsa(Point, cHash, eddsaOpts = {}) {\n if (typeof cHash !== 'function')\n throw new Error('\"hash\" function param is required');\n _validateObject(eddsaOpts, {}, {\n adjustScalarBytes: 'function',\n randomBytes: 'function',\n domain: 'function',\n prehash: 'function',\n mapToCurve: 'function',\n });\n const { prehash } = eddsaOpts;\n const { BASE, Fp, Fn } = Point;\n const randomBytes = eddsaOpts.randomBytes || randomBytesWeb;\n const adjustScalarBytes = eddsaOpts.adjustScalarBytes || ((bytes) => bytes);\n const domain = eddsaOpts.domain ||\n ((data, ctx, phflag) => {\n abool(phflag, 'phflag');\n if (ctx.length || phflag)\n throw new Error('Contexts/pre-hash are not supported');\n return data;\n }); // NOOP\n // Little-endian SHA512 with modulo n\n function modN_LE(hash) {\n return Fn.create(bytesToNumberLE(hash)); // Not Fn.fromBytes: it has length limit\n }\n // Get the hashed private scalar per RFC8032 5.1.5\n function getPrivateScalar(key) {\n const len = lengths.secretKey;\n key = ensureBytes('private key', key, len);\n // Hash private key with curve's hash function to produce uniformingly random input\n // Check byte lengths: ensure(64, h(ensure(32, key)))\n const hashed = ensureBytes('hashed private key', cHash(key), 2 * len);\n const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE\n const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6)\n const scalar = modN_LE(head); // The actual private scalar\n return { head, prefix, scalar };\n }\n /** Convenience method that creates public key from scalar. RFC8032 5.1.5 */\n function getExtendedPublicKey(secretKey) {\n const { head, prefix, scalar } = getPrivateScalar(secretKey);\n const point = BASE.multiply(scalar); // Point on Edwards curve aka public key\n const pointBytes = point.toBytes();\n return { head, prefix, scalar, point, pointBytes };\n }\n /** Calculates EdDSA pub key. RFC8032 5.1.5. */\n function getPublicKey(secretKey) {\n return getExtendedPublicKey(secretKey).pointBytes;\n }\n // int('LE', SHA512(dom2(F, C) || msgs)) mod N\n function hashDomainToScalar(context = Uint8Array.of(), ...msgs) {\n const msg = concatBytes(...msgs);\n return modN_LE(cHash(domain(msg, ensureBytes('context', context), !!prehash)));\n }\n /** Signs message with privateKey. RFC8032 5.1.6 */\n function sign(msg, secretKey, options = {}) {\n msg = ensureBytes('message', msg);\n if (prehash)\n msg = prehash(msg); // for ed25519ph etc.\n const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey);\n const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M)\n const R = BASE.multiply(r).toBytes(); // R = rG\n const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M)\n const s = Fn.create(r + k * scalar); // S = (r + k * s) mod L\n if (!Fn.isValid(s))\n throw new Error('sign failed: invalid s'); // 0 <= s < L\n const rs = concatBytes(R, Fn.toBytes(s));\n return abytes(rs, lengths.signature, 'result');\n }\n // verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex:\n const verifyOpts = { zip215: true };\n /**\n * Verifies EdDSA signature against message and public key. RFC8032 5.1.7.\n * An extended group equation is checked.\n */\n function verify(sig, msg, publicKey, options = verifyOpts) {\n const { context, zip215 } = options;\n const len = lengths.signature;\n sig = ensureBytes('signature', sig, len);\n msg = ensureBytes('message', msg);\n publicKey = ensureBytes('publicKey', publicKey, lengths.publicKey);\n if (zip215 !== undefined)\n abool(zip215, 'zip215');\n if (prehash)\n msg = prehash(msg); // for ed25519ph, etc\n const mid = len / 2;\n const r = sig.subarray(0, mid);\n const s = bytesToNumberLE(sig.subarray(mid, len));\n let A, R, SB;\n try {\n // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5.\n // zip215=true: 0 <= y < MASK (2^256 for ed25519)\n // zip215=false: 0 <= y < P (2^255-19 for ed25519)\n A = Point.fromBytes(publicKey, zip215);\n R = Point.fromBytes(r, zip215);\n SB = BASE.multiplyUnsafe(s); // 0 <= s < l is done inside\n }\n catch (error) {\n return false;\n }\n if (!zip215 && A.isSmallOrder())\n return false; // zip215 allows public keys of small order\n const k = hashDomainToScalar(context, R.toBytes(), A.toBytes(), msg);\n const RkA = R.add(A.multiplyUnsafe(k));\n // Extended group equation\n // [8][S]B = [8]R + [8][k]A'\n return RkA.subtract(SB).clearCofactor().is0();\n }\n const _size = Fp.BYTES; // 32 for ed25519, 57 for ed448\n const lengths = {\n secretKey: _size,\n publicKey: _size,\n signature: 2 * _size,\n seed: _size,\n };\n function randomSecretKey(seed = randomBytes(lengths.seed)) {\n return abytes(seed, lengths.seed, 'seed');\n }\n function keygen(seed) {\n const secretKey = utils.randomSecretKey(seed);\n return { secretKey, publicKey: getPublicKey(secretKey) };\n }\n function isValidSecretKey(key) {\n return isBytes(key) && key.length === Fn.BYTES;\n }\n function isValidPublicKey(key, zip215) {\n try {\n return !!Point.fromBytes(key, zip215);\n }\n catch (error) {\n return false;\n }\n }\n const utils = {\n getExtendedPublicKey,\n randomSecretKey,\n isValidSecretKey,\n isValidPublicKey,\n /**\n * Converts ed public key to x public key. Uses formula:\n * - ed25519:\n * - `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)`\n * - `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))`\n * - ed448:\n * - `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)`\n * - `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))`\n */\n toMontgomery(publicKey) {\n const { y } = Point.fromBytes(publicKey);\n const size = lengths.publicKey;\n const is25519 = size === 32;\n if (!is25519 && size !== 57)\n throw new Error('only defined for 25519 and 448');\n const u = is25519 ? Fp.div(_1n + y, _1n - y) : Fp.div(y - _1n, y + _1n);\n return Fp.toBytes(u);\n },\n toMontgomerySecret(secretKey) {\n const size = lengths.secretKey;\n abytes(secretKey, size);\n const hashed = cHash(secretKey.subarray(0, size));\n return adjustScalarBytes(hashed).subarray(0, size);\n },\n /** @deprecated */\n randomPrivateKey: randomSecretKey,\n /** @deprecated */\n precompute(windowSize = 8, point = Point.BASE) {\n return point.precompute(windowSize, false);\n },\n };\n return Object.freeze({\n keygen,\n getPublicKey,\n sign,\n verify,\n utils,\n Point,\n lengths,\n });\n}\nfunction _eddsa_legacy_opts_to_new(c) {\n const CURVE = {\n a: c.a,\n d: c.d,\n p: c.Fp.ORDER,\n n: c.n,\n h: c.h,\n Gx: c.Gx,\n Gy: c.Gy,\n };\n const Fp = c.Fp;\n const Fn = Field(CURVE.n, c.nBitLength, true);\n const curveOpts = { Fp, Fn, uvRatio: c.uvRatio };\n const eddsaOpts = {\n randomBytes: c.randomBytes,\n adjustScalarBytes: c.adjustScalarBytes,\n domain: c.domain,\n prehash: c.prehash,\n mapToCurve: c.mapToCurve,\n };\n return { CURVE, curveOpts, hash: c.hash, eddsaOpts };\n}\nfunction _eddsa_new_output_to_legacy(c, eddsa) {\n const Point = eddsa.Point;\n const legacy = Object.assign({}, eddsa, {\n ExtendedPoint: Point,\n CURVE: c,\n nBitLength: Point.Fn.BITS,\n nByteLength: Point.Fn.BYTES,\n });\n return legacy;\n}\n// TODO: remove. Use eddsa\nexport function twistedEdwards(c) {\n const { CURVE, curveOpts, hash, eddsaOpts } = _eddsa_legacy_opts_to_new(c);\n const Point = edwards(CURVE, curveOpts);\n const EDDSA = eddsa(Point, hash, eddsaOpts);\n return _eddsa_new_output_to_legacy(c, EDDSA);\n}\n//# sourceMappingURL=edwards.js.map","import { _validateObject, abytes, bytesToNumberBE, concatBytes, isBytes, isHash, utf8ToBytes, } from \"../utils.js\";\nimport { FpInvertBatch, mod } from \"./modular.js\";\n// Octet Stream to Integer. \"spec\" implementation of os2ip is 2.5x slower vs bytesToNumberBE.\nconst os2ip = bytesToNumberBE;\n// Integer to Octet Stream (numberToBytesBE)\nfunction i2osp(value, length) {\n anum(value);\n anum(length);\n if (value < 0 || value >= 1 << (8 * length))\n throw new Error('invalid I2OSP input: ' + value);\n const res = Array.from({ length }).fill(0);\n for (let i = length - 1; i >= 0; i--) {\n res[i] = value & 0xff;\n value >>>= 8;\n }\n return new Uint8Array(res);\n}\nfunction strxor(a, b) {\n const arr = new Uint8Array(a.length);\n for (let i = 0; i < a.length; i++) {\n arr[i] = a[i] ^ b[i];\n }\n return arr;\n}\nfunction anum(item) {\n if (!Number.isSafeInteger(item))\n throw new Error('number expected');\n}\nfunction normDST(DST) {\n if (!isBytes(DST) && typeof DST !== 'string')\n throw new Error('DST must be Uint8Array or string');\n return typeof DST === 'string' ? utf8ToBytes(DST) : DST;\n}\n/**\n * Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits.\n * [RFC 9380 5.3.1](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1).\n */\nexport function expand_message_xmd(msg, DST, lenInBytes, H) {\n abytes(msg);\n anum(lenInBytes);\n DST = normDST(DST);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n if (DST.length > 255)\n DST = H(concatBytes(utf8ToBytes('H2C-OVERSIZE-DST-'), DST));\n const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H;\n const ell = Math.ceil(lenInBytes / b_in_bytes);\n if (lenInBytes > 65535 || ell > 255)\n throw new Error('expand_message_xmd: invalid lenInBytes');\n const DST_prime = concatBytes(DST, i2osp(DST.length, 1));\n const Z_pad = i2osp(0, r_in_bytes);\n const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str\n const b = new Array(ell);\n const b_0 = H(concatBytes(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime));\n b[0] = H(concatBytes(b_0, i2osp(1, 1), DST_prime));\n for (let i = 1; i <= ell; i++) {\n const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime];\n b[i] = H(concatBytes(...args));\n }\n const pseudo_random_bytes = concatBytes(...b);\n return pseudo_random_bytes.slice(0, lenInBytes);\n}\n/**\n * Produces a uniformly random byte string using an extendable-output function (XOF) H.\n * 1. The collision resistance of H MUST be at least k bits.\n * 2. H MUST be an XOF that has been proved indifferentiable from\n * a random oracle under a reasonable cryptographic assumption.\n * [RFC 9380 5.3.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2).\n */\nexport function expand_message_xof(msg, DST, lenInBytes, k, H) {\n abytes(msg);\n anum(lenInBytes);\n DST = normDST(DST);\n // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3\n // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8));\n if (DST.length > 255) {\n const dkLen = Math.ceil((2 * k) / 8);\n DST = H.create({ dkLen }).update(utf8ToBytes('H2C-OVERSIZE-DST-')).update(DST).digest();\n }\n if (lenInBytes > 65535 || DST.length > 255)\n throw new Error('expand_message_xof: invalid lenInBytes');\n return (H.create({ dkLen: lenInBytes })\n .update(msg)\n .update(i2osp(lenInBytes, 2))\n // 2. DST_prime = DST || I2OSP(len(DST), 1)\n .update(DST)\n .update(i2osp(DST.length, 1))\n .digest());\n}\n/**\n * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F.\n * [RFC 9380 5.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.2).\n * @param msg a byte string containing the message to hash\n * @param count the number of elements of F to output\n * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above\n * @returns [u_0, ..., u_(count - 1)], a list of field elements.\n */\nexport function hash_to_field(msg, count, options) {\n _validateObject(options, {\n p: 'bigint',\n m: 'number',\n k: 'number',\n hash: 'function',\n });\n const { p, k, m, hash, expand, DST } = options;\n if (!isHash(options.hash))\n throw new Error('expected valid hash');\n abytes(msg);\n anum(count);\n const log2p = p.toString(2).length;\n const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above\n const len_in_bytes = count * m * L;\n let prb; // pseudo_random_bytes\n if (expand === 'xmd') {\n prb = expand_message_xmd(msg, DST, len_in_bytes, hash);\n }\n else if (expand === 'xof') {\n prb = expand_message_xof(msg, DST, len_in_bytes, k, hash);\n }\n else if (expand === '_internal_pass') {\n // for internal tests only\n prb = msg;\n }\n else {\n throw new Error('expand must be \"xmd\" or \"xof\"');\n }\n const u = new Array(count);\n for (let i = 0; i < count; i++) {\n const e = new Array(m);\n for (let j = 0; j < m; j++) {\n const elm_offset = L * (j + i * m);\n const tv = prb.subarray(elm_offset, elm_offset + L);\n e[j] = mod(os2ip(tv), p);\n }\n u[i] = e;\n }\n return u;\n}\nexport function isogenyMap(field, map) {\n // Make same order as in spec\n const coeff = map.map((i) => Array.from(i).reverse());\n return (x, y) => {\n const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i)));\n // 6.6.3\n // Exceptional cases of iso_map are inputs that cause the denominator of\n // either rational function to evaluate to zero; such cases MUST return\n // the identity point on E.\n const [xd_inv, yd_inv] = FpInvertBatch(field, [xd, yd], true);\n x = field.mul(xn, xd_inv); // xNum / xDen\n y = field.mul(y, field.mul(yn, yd_inv)); // y * (yNum / yDev)\n return { x, y };\n };\n}\nexport const _DST_scalar = utf8ToBytes('HashToScalar-');\n/** Creates hash-to-curve methods from EC Point and mapToCurve function. See {@link H2CHasher}. */\nexport function createHasher(Point, mapToCurve, defaults) {\n if (typeof mapToCurve !== 'function')\n throw new Error('mapToCurve() must be defined');\n function map(num) {\n return Point.fromAffine(mapToCurve(num));\n }\n function clear(initial) {\n const P = initial.clearCofactor();\n if (P.equals(Point.ZERO))\n return Point.ZERO; // zero will throw in assert\n P.assertValidity();\n return P;\n }\n return {\n defaults,\n hashToCurve(msg, options) {\n const opts = Object.assign({}, defaults, options);\n const u = hash_to_field(msg, 2, opts);\n const u0 = map(u[0]);\n const u1 = map(u[1]);\n return clear(u0.add(u1));\n },\n encodeToCurve(msg, options) {\n const optsDst = defaults.encodeDST ? { DST: defaults.encodeDST } : {};\n const opts = Object.assign({}, defaults, optsDst, options);\n const u = hash_to_field(msg, 1, opts);\n const u0 = map(u[0]);\n return clear(u0);\n },\n /** See {@link H2CHasher} */\n mapToCurve(scalars) {\n if (!Array.isArray(scalars))\n throw new Error('expected array of bigints');\n for (const i of scalars)\n if (typeof i !== 'bigint')\n throw new Error('expected array of bigints');\n return clear(map(scalars));\n },\n // hash_to_scalar can produce 0: https://www.rfc-editor.org/errata/eid8393\n // RFC 9380, draft-irtf-cfrg-bbs-signatures-08\n hashToScalar(msg, options) {\n // @ts-ignore\n const N = Point.Fn.ORDER;\n const opts = Object.assign({}, defaults, { p: N, m: 1, DST: _DST_scalar }, options);\n return hash_to_field(msg, 1, opts)[0][0];\n },\n };\n}\n//# sourceMappingURL=hash-to-curve.js.map","/**\n * ed25519 Twisted Edwards curve with following addons:\n * - X25519 ECDH\n * - Ristretto cofactor elimination\n * - Elligator hash-to-group / point indistinguishability\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha512 } from '@noble/hashes/sha2.js';\nimport { abytes, concatBytes, utf8ToBytes } from '@noble/hashes/utils.js';\nimport { pippenger } from \"./abstract/curve.js\";\nimport { PrimeEdwardsPoint, twistedEdwards, } from \"./abstract/edwards.js\";\nimport { _DST_scalar, createHasher, expand_message_xmd, } from \"./abstract/hash-to-curve.js\";\nimport { Field, FpInvertBatch, FpSqrtEven, isNegativeLE, mod, pow2, } from \"./abstract/modular.js\";\nimport { montgomery } from \"./abstract/montgomery.js\";\nimport { bytesToNumberLE, ensureBytes, equalBytes } from \"./utils.js\";\n// prettier-ignore\nconst _0n = /* @__PURE__ */ BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3);\n// prettier-ignore\nconst _5n = BigInt(5), _8n = BigInt(8);\n// P = 2n**255n-19n\nconst ed25519_CURVE_p = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed');\n// N = 2n**252n + 27742317777372353535851937790883648493n\n// a = Fp.create(BigInt(-1))\n// d = -121665/121666 a.k.a. Fp.neg(121665 * Fp.inv(121666))\nconst ed25519_CURVE = /* @__PURE__ */ (() => ({\n p: ed25519_CURVE_p,\n n: BigInt('0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed'),\n h: _8n,\n a: BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec'),\n d: BigInt('0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3'),\n Gx: BigInt('0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a'),\n Gy: BigInt('0x6666666666666666666666666666666666666666666666666666666666666658'),\n}))();\nfunction ed25519_pow_2_252_3(x) {\n // prettier-ignore\n const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80);\n const P = ed25519_CURVE_p;\n const x2 = (x * x) % P;\n const b2 = (x2 * x) % P; // x^3, 11\n const b4 = (pow2(b2, _2n, P) * b2) % P; // x^15, 1111\n const b5 = (pow2(b4, _1n, P) * x) % P; // x^31\n const b10 = (pow2(b5, _5n, P) * b5) % P;\n const b20 = (pow2(b10, _10n, P) * b10) % P;\n const b40 = (pow2(b20, _20n, P) * b20) % P;\n const b80 = (pow2(b40, _40n, P) * b40) % P;\n const b160 = (pow2(b80, _80n, P) * b80) % P;\n const b240 = (pow2(b160, _80n, P) * b80) % P;\n const b250 = (pow2(b240, _10n, P) * b10) % P;\n const pow_p_5_8 = (pow2(b250, _2n, P) * x) % P;\n // ^ To pow to (p+3)/8, multiply it by x.\n return { pow_p_5_8, b2 };\n}\nfunction adjustScalarBytes(bytes) {\n // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar,\n // set the three least significant bits of the first byte\n bytes[0] &= 248; // 0b1111_1000\n // and the most significant bit of the last to zero,\n bytes[31] &= 127; // 0b0111_1111\n // set the second most significant bit of the last byte to 1\n bytes[31] |= 64; // 0b0100_0000\n return bytes;\n}\n// √(-1) aka √(a) aka 2^((p-1)/4)\n// Fp.sqrt(Fp.neg(1))\nconst ED25519_SQRT_M1 = /* @__PURE__ */ BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752');\n// sqrt(u/v)\nfunction uvRatio(u, v) {\n const P = ed25519_CURVE_p;\n const v3 = mod(v * v * v, P); // v³\n const v7 = mod(v3 * v3 * v, P); // v⁷\n // (p+3)/8 and (p-5)/8\n const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8;\n let x = mod(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8\n const vx2 = mod(v * x * x, P); // vx²\n const root1 = x; // First root candidate\n const root2 = mod(x * ED25519_SQRT_M1, P); // Second root candidate\n const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root\n const useRoot2 = vx2 === mod(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4)\n const noRoot = vx2 === mod(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1)\n if (useRoot1)\n x = root1;\n if (useRoot2 || noRoot)\n x = root2; // We return root2 anyway, for const-time\n if (isNegativeLE(x, P))\n x = mod(-x, P);\n return { isValid: useRoot1 || useRoot2, value: x };\n}\nconst Fp = /* @__PURE__ */ (() => Field(ed25519_CURVE.p, { isLE: true }))();\nconst Fn = /* @__PURE__ */ (() => Field(ed25519_CURVE.n, { isLE: true }))();\nconst ed25519Defaults = /* @__PURE__ */ (() => ({\n ...ed25519_CURVE,\n Fp,\n hash: sha512,\n adjustScalarBytes,\n // dom2\n // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3.\n // Constant-time, u/√v\n uvRatio,\n}))();\n/**\n * ed25519 curve with EdDSA signatures.\n * @example\n * import { ed25519 } from '@noble/curves/ed25519';\n * const { secretKey, publicKey } = ed25519.keygen();\n * const msg = new TextEncoder().encode('hello');\n * const sig = ed25519.sign(msg, priv);\n * ed25519.verify(sig, msg, pub); // Default mode: follows ZIP215\n * ed25519.verify(sig, msg, pub, { zip215: false }); // RFC8032 / FIPS 186-5\n */\nexport const ed25519 = /* @__PURE__ */ (() => twistedEdwards(ed25519Defaults))();\nfunction ed25519_domain(data, ctx, phflag) {\n if (ctx.length > 255)\n throw new Error('Context is too big');\n return concatBytes(utf8ToBytes('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data);\n}\n/** Context of ed25519. Uses context for domain separation. */\nexport const ed25519ctx = /* @__PURE__ */ (() => twistedEdwards({\n ...ed25519Defaults,\n domain: ed25519_domain,\n}))();\n/** Prehashed version of ed25519. Accepts already-hashed messages in sign() and verify(). */\nexport const ed25519ph = /* @__PURE__ */ (() => twistedEdwards(Object.assign({}, ed25519Defaults, {\n domain: ed25519_domain,\n prehash: sha512,\n})))();\n/**\n * ECDH using curve25519 aka x25519.\n * @example\n * import { x25519 } from '@noble/curves/ed25519';\n * const priv = 'a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4';\n * const pub = 'e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c';\n * x25519.getSharedSecret(priv, pub) === x25519.scalarMult(priv, pub); // aliases\n * x25519.getPublicKey(priv) === x25519.scalarMultBase(priv);\n * x25519.getPublicKey(x25519.utils.randomSecretKey());\n */\nexport const x25519 = /* @__PURE__ */ (() => {\n const P = Fp.ORDER;\n return montgomery({\n P,\n type: 'x25519',\n powPminus2: (x) => {\n // x^(p-2) aka x^(2^255-21)\n const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x);\n return mod(pow2(pow_p_5_8, _3n, P) * b2, P);\n },\n adjustScalarBytes,\n });\n})();\n// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator)\n// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since\n// SageMath returns different root first and everything falls apart\nconst ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)(); // 1. c1 = (q + 3) / 8 # Integer arithmetic\nconst ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n, ELL2_C1))(); // 2. c2 = 2^c1\nconst ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))(); // 3. c3 = sqrt(-1)\n// prettier-ignore\nfunction map_to_curve_elligator2_curve25519(u) {\n const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n; // 4. c4 = (q - 5) / 8 # Integer arithmetic\n const ELL2_J = BigInt(486662);\n let tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1\n let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not\n let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2)\n let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2\n let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3\n let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd\n gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd\n gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2\n gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2\n let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2\n tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4\n tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3\n tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3\n tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7\n let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8)\n y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8)\n let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3\n tv2 = Fp.sqr(y11); // 19. tv2 = y11^2\n tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd\n let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1\n let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt\n let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd\n let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u\n y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2\n let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3\n let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1)\n tv2 = Fp.sqr(y21); // 28. tv2 = y21^2\n tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd\n let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2\n let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt\n tv2 = Fp.sqr(y1); // 32. tv2 = y1^2\n tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd\n let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1\n let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2\n let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2\n let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y\n y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4)\n return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1)\n}\nconst ELL2_C1_EDWARDS = /* @__PURE__ */ (() => FpSqrtEven(Fp, Fp.neg(BigInt(486664))))(); // sgn0(c1) MUST equal 0\nfunction map_to_curve_elligator2_edwards25519(u) {\n const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) =\n // map_to_curve_elligator2_curve25519(u)\n let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd\n xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1\n let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM\n let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd\n let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d)\n let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd\n let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0\n xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e)\n xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e)\n yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e)\n yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e)\n const [xd_inv, yd_inv] = FpInvertBatch(Fp, [xd, yd], true); // batch division\n return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) }; // 13. return (xn, xd, yn, yd)\n}\n/** Hashing to ed25519 points / field. RFC 9380 methods. */\nexport const ed25519_hasher = /* @__PURE__ */ (() => createHasher(ed25519.Point, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), {\n DST: 'edwards25519_XMD:SHA-512_ELL2_RO_',\n encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_',\n p: ed25519_CURVE_p,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha512,\n}))();\n// √(-1) aka √(a) aka 2^((p-1)/4)\nconst SQRT_M1 = ED25519_SQRT_M1;\n// √(ad - 1)\nconst SQRT_AD_MINUS_ONE = /* @__PURE__ */ BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235');\n// 1 / √(a-d)\nconst INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578');\n// 1-d²\nconst ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838');\n// (d-1)²\nconst D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952');\n// Calculates 1/√(number)\nconst invertSqrt = (number) => uvRatio(_1n, number);\nconst MAX_255B = /* @__PURE__ */ BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff');\nconst bytes255ToNumberLE = (bytes) => ed25519.Point.Fp.create(bytesToNumberLE(bytes) & MAX_255B);\n/**\n * Computes Elligator map for Ristretto255.\n * Described in [RFC9380](https://www.rfc-editor.org/rfc/rfc9380#appendix-B) and on\n * the [website](https://ristretto.group/formulas/elligator.html).\n */\nfunction calcElligatorRistrettoMap(r0) {\n const { d } = ed25519_CURVE;\n const P = ed25519_CURVE_p;\n const mod = (n) => Fp.create(n);\n const r = mod(SQRT_M1 * r0 * r0); // 1\n const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2\n let c = BigInt(-1); // 3\n const D = mod((c - d * r) * mod(r + d)); // 4\n let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5\n let s_ = mod(s * r0); // 6\n if (!isNegativeLE(s_, P))\n s_ = mod(-s_);\n if (!Ns_D_is_sq)\n s = s_; // 7\n if (!Ns_D_is_sq)\n c = r; // 8\n const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9\n const s2 = s * s;\n const W0 = mod((s + s) * D); // 10\n const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11\n const W2 = mod(_1n - s2); // 12\n const W3 = mod(_1n + s2); // 13\n return new ed25519.Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2));\n}\nfunction ristretto255_map(bytes) {\n abytes(bytes, 64);\n const r1 = bytes255ToNumberLE(bytes.subarray(0, 32));\n const R1 = calcElligatorRistrettoMap(r1);\n const r2 = bytes255ToNumberLE(bytes.subarray(32, 64));\n const R2 = calcElligatorRistrettoMap(r2);\n return new _RistrettoPoint(R1.add(R2));\n}\n/**\n * Wrapper over Edwards Point for ristretto255.\n *\n * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be\n * a source of bugs for protocols like ring signatures. Ristretto was created to solve this.\n * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint,\n * but it should work in its own namespace: do not combine those two.\n * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496).\n */\nclass _RistrettoPoint extends PrimeEdwardsPoint {\n constructor(ep) {\n super(ep);\n }\n static fromAffine(ap) {\n return new _RistrettoPoint(ed25519.Point.fromAffine(ap));\n }\n assertSame(other) {\n if (!(other instanceof _RistrettoPoint))\n throw new Error('RistrettoPoint expected');\n }\n init(ep) {\n return new _RistrettoPoint(ep);\n }\n /** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */\n static hashToCurve(hex) {\n return ristretto255_map(ensureBytes('ristrettoHash', hex, 64));\n }\n static fromBytes(bytes) {\n abytes(bytes, 32);\n const { a, d } = ed25519_CURVE;\n const P = ed25519_CURVE_p;\n const mod = (n) => Fp.create(n);\n const s = bytes255ToNumberLE(bytes);\n // 1. Check that s_bytes is the canonical encoding of a field element, or else abort.\n // 3. Check that s is non-negative, or else abort\n if (!equalBytes(Fp.toBytes(s), bytes) || isNegativeLE(s, P))\n throw new Error('invalid ristretto255 encoding 1');\n const s2 = mod(s * s);\n const u1 = mod(_1n + a * s2); // 4 (a is -1)\n const u2 = mod(_1n - a * s2); // 5\n const u1_2 = mod(u1 * u1);\n const u2_2 = mod(u2 * u2);\n const v = mod(a * d * u1_2 - u2_2); // 6\n const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7\n const Dx = mod(I * u2); // 8\n const Dy = mod(I * Dx * v); // 9\n let x = mod((s + s) * Dx); // 10\n if (isNegativeLE(x, P))\n x = mod(-x); // 10\n const y = mod(u1 * Dy); // 11\n const t = mod(x * y); // 12\n if (!isValid || isNegativeLE(t, P) || y === _0n)\n throw new Error('invalid ristretto255 encoding 2');\n return new _RistrettoPoint(new ed25519.Point(x, y, _1n, t));\n }\n /**\n * Converts ristretto-encoded string to ristretto point.\n * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode).\n * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding\n */\n static fromHex(hex) {\n return _RistrettoPoint.fromBytes(ensureBytes('ristrettoHex', hex, 32));\n }\n static msm(points, scalars) {\n return pippenger(_RistrettoPoint, ed25519.Point.Fn, points, scalars);\n }\n /**\n * Encodes ristretto point to Uint8Array.\n * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode).\n */\n toBytes() {\n let { X, Y, Z, T } = this.ep;\n const P = ed25519_CURVE_p;\n const mod = (n) => Fp.create(n);\n const u1 = mod(mod(Z + Y) * mod(Z - Y)); // 1\n const u2 = mod(X * Y); // 2\n // Square root always exists\n const u2sq = mod(u2 * u2);\n const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3\n const D1 = mod(invsqrt * u1); // 4\n const D2 = mod(invsqrt * u2); // 5\n const zInv = mod(D1 * D2 * T); // 6\n let D; // 7\n if (isNegativeLE(T * zInv, P)) {\n let _x = mod(Y * SQRT_M1);\n let _y = mod(X * SQRT_M1);\n X = _x;\n Y = _y;\n D = mod(D1 * INVSQRT_A_MINUS_D);\n }\n else {\n D = D2; // 8\n }\n if (isNegativeLE(X * zInv, P))\n Y = mod(-Y); // 9\n let s = mod((Z - Y) * D); // 10 (check footer's note, no sqrt(-a))\n if (isNegativeLE(s, P))\n s = mod(-s);\n return Fp.toBytes(s); // 11\n }\n /**\n * Compares two Ristretto points.\n * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals).\n */\n equals(other) {\n this.assertSame(other);\n const { X: X1, Y: Y1 } = this.ep;\n const { X: X2, Y: Y2 } = other.ep;\n const mod = (n) => Fp.create(n);\n // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2)\n const one = mod(X1 * Y2) === mod(Y1 * X2);\n const two = mod(Y1 * Y2) === mod(X1 * X2);\n return one || two;\n }\n is0() {\n return this.equals(_RistrettoPoint.ZERO);\n }\n}\n// Do NOT change syntax: the following gymnastics is done,\n// because typescript strips comments, which makes bundlers disable tree-shaking.\n// prettier-ignore\n_RistrettoPoint.BASE = \n/* @__PURE__ */ (() => new _RistrettoPoint(ed25519.Point.BASE))();\n// prettier-ignore\n_RistrettoPoint.ZERO = \n/* @__PURE__ */ (() => new _RistrettoPoint(ed25519.Point.ZERO))();\n// prettier-ignore\n_RistrettoPoint.Fp = \n/* @__PURE__ */ (() => Fp)();\n// prettier-ignore\n_RistrettoPoint.Fn = \n/* @__PURE__ */ (() => Fn)();\nexport const ristretto255 = { Point: _RistrettoPoint };\n/** Hashing to ristretto255 points / field. RFC 9380 methods. */\nexport const ristretto255_hasher = {\n hashToCurve(msg, options) {\n const DST = options?.DST || 'ristretto255_XMD:SHA-512_R255MAP_RO_';\n const xmd = expand_message_xmd(msg, DST, 64, sha512);\n return ristretto255_map(xmd);\n },\n hashToScalar(msg, options = { DST: _DST_scalar }) {\n const xmd = expand_message_xmd(msg, options.DST, 64, sha512);\n return Fn.create(bytesToNumberLE(xmd));\n },\n};\n// export const ristretto255_oprf: OPRF = createORPF({\n// name: 'ristretto255-SHA512',\n// Point: RistrettoPoint,\n// hash: sha512,\n// hashToGroup: ristretto255_hasher.hashToCurve,\n// hashToScalar: ristretto255_hasher.hashToScalar,\n// });\n/**\n * Weird / bogus points, useful for debugging.\n * All 8 ed25519 points of 8-torsion subgroup can be generated from the point\n * T = `26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`.\n * ⟨T⟩ = { O, T, 2T, 3T, 4T, 5T, 6T, 7T }\n */\nexport const ED25519_TORSION_SUBGROUP = [\n '0100000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a',\n '0000000000000000000000000000000000000000000000000000000000000080',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05',\n 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f',\n '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85',\n '0000000000000000000000000000000000000000000000000000000000000000',\n 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa',\n];\n/** @deprecated use `ed25519.utils.toMontgomery` */\nexport function edwardsToMontgomeryPub(edwardsPub) {\n return ed25519.utils.toMontgomery(ensureBytes('pub', edwardsPub));\n}\n/** @deprecated use `ed25519.utils.toMontgomery` */\nexport const edwardsToMontgomery = edwardsToMontgomeryPub;\n/** @deprecated use `ed25519.utils.toMontgomerySecret` */\nexport function edwardsToMontgomeryPriv(edwardsPriv) {\n return ed25519.utils.toMontgomerySecret(ensureBytes('pub', edwardsPriv));\n}\n/** @deprecated use `ristretto255.Point` */\nexport const RistrettoPoint = _RistrettoPoint;\n/** @deprecated use `import { ed25519_hasher } from '@noble/curves/ed25519.js';` */\nexport const hashToCurve = /* @__PURE__ */ (() => ed25519_hasher.hashToCurve)();\n/** @deprecated use `import { ed25519_hasher } from '@noble/curves/ed25519.js';` */\nexport const encodeToCurve = /* @__PURE__ */ (() => ed25519_hasher.encodeToCurve)();\n/** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */\nexport const hashToRistretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)();\n/** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */\nexport const hash_to_ristretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)();\n//# sourceMappingURL=ed25519.js.map","// src/codes.ts\nvar SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 1;\nvar SOLANA_ERROR__INVALID_NONCE = 2;\nvar SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 3;\nvar SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 4;\nvar SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH = 5;\nvar SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 6;\nvar SOLANA_ERROR__MALFORMED_BIGINT_STRING = 7;\nvar SOLANA_ERROR__MALFORMED_NUMBER_STRING = 8;\nvar SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 9;\nvar SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR = 10;\nvar SOLANA_ERROR__JSON_RPC__PARSE_ERROR = -32700;\nvar SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR = -32603;\nvar SOLANA_ERROR__JSON_RPC__INVALID_PARAMS = -32602;\nvar SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND = -32601;\nvar SOLANA_ERROR__JSON_RPC__INVALID_REQUEST = -32600;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED = -32016;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION = -32015;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET = -32014;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH = -32013;\nvar SOLANA_ERROR__JSON_RPC__SCAN_ERROR = -32012;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE = -32011;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX = -32010;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED = -32009;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT = -32008;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED = -32007;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE = -32006;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY = -32005;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE = -32004;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE = -32003;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE = -32002;\nvar SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP = -32001;\nvar SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH = 28e5;\nvar SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE = 2800001;\nvar SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS = 2800002;\nvar SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY = 2800003;\nvar SOLANA_ERROR__ADDRESSES__MALFORMED_PDA = 2800004;\nvar SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE = 2800005;\nvar SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 2800006;\nvar SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED = 2800007;\nvar SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE = 2800008;\nvar SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED = 2800009;\nvar SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER = 2800010;\nvar SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS = 2800011;\nvar SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = 323e4;\nvar SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND = 32300001;\nvar SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT = 3230002;\nvar SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = 3230003;\nvar SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = 3230004;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT = 361e4;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED = 3610001;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED = 3610002;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED = 3610003;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED = 3610004;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED = 3610005;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED = 3610006;\nvar SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY = 3610007;\nvar SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED = 3611e3;\nvar SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH = 3704e3;\nvar SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704001;\nvar SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH = 3704002;\nvar SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704003;\nvar SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY = 3704004;\nvar SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS = 4128e3;\nvar SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA = 4128001;\nvar SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH = 4128002;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN = 4615e3;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR = 4615001;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT = 4615002;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA = 4615003;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA = 4615004;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL = 4615005;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS = 4615006;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID = 4615007;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE = 4615008;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED = 4615009;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT = 4615010;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION = 4615011;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID = 4615012;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE = 4615015;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED = 4615016;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX = 4615017;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED = 4615018;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED = 4615019;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 4615020;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED = 4615021;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE = 4615022;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED = 4615023;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 4615024;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM = 4615026;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR = 4615027;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED = 4615028;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE = 4615029;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID = 4615031;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH = 4615032;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT = 4615033;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED = 4615034;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4615035;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS = 4615036;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC = 4615037;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED = 4615038;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION = 4615039;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE = 4615041;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE = 4615042;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE = 4615043;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY = 4615044;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR = 4615045;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT = 4615046;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER = 4615047;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW = 4615048;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR = 4615049;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER = 4615050;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED = 4615052;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053;\nvar SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054;\nvar SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508e3;\nvar SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER = 5508001;\nvar SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER = 5508002;\nvar SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003;\nvar SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004;\nvar SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER = 5508005;\nvar SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006;\nvar SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007;\nvar SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008;\nvar SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009;\nvar SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010;\nvar SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED = 5508011;\nvar SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663e3;\nvar SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001;\nvar SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002;\nvar SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME = 5663003;\nvar SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE = 5663004;\nvar SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663005;\nvar SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663006;\nvar SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663007;\nvar SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663008;\nvar SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING = 5663009;\nvar SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING = 5663010;\nvar SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING = 5663011;\nvar SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING = 5663012;\nvar SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING = 5663013;\nvar SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE = 5663014;\nvar SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION = 5663015;\nvar SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES = 5663016;\nvar SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH = 5663017;\nvar SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT = 5663018;\nvar SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT = 5663019;\nvar SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT = 5663020;\nvar SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN = 705e4;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE = 7050001;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE = 7050002;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND = 7050003;\nvar SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND = 7050004;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE = 7050005;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE = 7050006;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED = 7050007;\nvar SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND = 7050008;\nvar SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP = 7050009;\nvar SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE = 7050010;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX = 7050011;\nvar SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE = 7050012;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION = 7050013;\nvar SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE = 7050014;\nvar SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE = 7050015;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 7050016;\nvar SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017;\nvar SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION = 7050018;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT = 7050019;\nvar SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020;\nvar SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021;\nvar SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS = 7050022;\nvar SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT = 7050027;\nvar SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028;\nvar SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029;\nvar SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION = 7050030;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT = 7050031;\nvar SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032;\nvar SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033;\nvar SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED = 7050034;\nvar SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035;\nvar SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION = 7050036;\nvar SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY = 8078e3;\nvar SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH = 8078001;\nvar SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = 8078002;\nvar SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = 8078003;\nvar SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004;\nvar SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH = 8078005;\nvar SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006;\nvar SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS = 8078007;\nvar SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = 8078008;\nvar SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT = 8078009;\nvar SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT = 8078010;\nvar SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE = 8078011;\nvar SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE = 8078012;\nvar SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH = 8078013;\nvar SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE = 8078014;\nvar SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT = 8078015;\nvar SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE = 8078016;\nvar SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE = 8078017;\nvar SOLANA_ERROR__CODECS__INVALID_CONSTANT = 8078018;\nvar SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE = 8078019;\nvar SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL = 8078020;\nvar SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES = 8078021;\nvar SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS = 8078022;\nvar SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 81e5;\nvar SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001;\nvar SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002;\nvar SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD = 8100003;\nvar SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN = 819e4;\nvar SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001;\nvar SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002;\nvar SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED = 8190003;\nvar SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT = 8190004;\nvar SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING = 99e5;\nvar SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE = 9900001;\nvar SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING = 9900002;\nvar SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE = 9900003;\nvar SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED = 9900004;\n\n// src/context.ts\nfunction encodeValue(value) {\n if (Array.isArray(value)) {\n const commaSeparatedValues = value.map(encodeValue).join(\n \"%2C%20\"\n /* \", \" */\n );\n return \"%5B\" + commaSeparatedValues + /* \"]\" */\n \"%5D\";\n } else if (typeof value === \"bigint\") {\n return `${value}n`;\n } else {\n return encodeURIComponent(\n String(\n value != null && Object.getPrototypeOf(value) === null ? (\n // Plain objects with no prototype don't have a `toString` method.\n // Convert them before stringifying them.\n { ...value }\n ) : value\n )\n );\n }\n}\nfunction encodeObjectContextEntry([key, value]) {\n return `${key}=${encodeValue(value)}`;\n}\nfunction encodeContextObject(context) {\n const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join(\"&\");\n return btoa(searchParamsString);\n}\n\n// src/messages.ts\nvar SolanaErrorMessages = {\n [SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: \"Account not found at address: $address\",\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: \"Not all accounts were decoded. Encoded accounts found at addresses: $addresses.\",\n [SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: \"Expected decoded account at address: $address\",\n [SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: \"Failed to decode account data at address: $address\",\n [SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: \"Accounts not found at addresses: $addresses\",\n [SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED]: \"Unable to find a viable program address bump seed.\",\n [SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: \"$putativeAddress is not a base58-encoded address.\",\n [SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: \"Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.\",\n [SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY]: \"The `CryptoKey` must be an `Ed25519` public key.\",\n [SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS]: \"$putativeOffCurveAddress is not a base58-encoded off-curve address.\",\n [SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE]: \"Invalid seeds; point must fall off the Ed25519 curve.\",\n [SOLANA_ERROR__ADDRESSES__MALFORMED_PDA]: \"Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].\",\n [SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: \"A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.\",\n [SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: \"The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.\",\n [SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: \"Expected program derived address bump to be in the range [0, 255], got: $bump.\",\n [SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER]: \"Program address cannot end with PDA marker.\",\n [SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: \"Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.\",\n [SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: \"Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.\",\n [SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: \"The network has progressed past the last block for which this transaction could have been committed.\",\n [SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: \"Codec [$codecDescription] cannot decode empty byte arrays.\",\n [SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]: \"Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.\",\n [SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]: \"Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].\",\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: \"Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].\",\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: \"Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].\",\n [SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: \"Encoder and decoder must either both be fixed-size or variable-size.\",\n [SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: \"Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.\",\n [SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH]: \"Expected a fixed-size codec, got a variable-size one.\",\n [SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]: \"Codec [$codecDescription] expected a positive byte length, got $bytesLength.\",\n [SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH]: \"Expected a variable-size codec, got a fixed-size one.\",\n [SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]: \"Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].\",\n [SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: \"Codec [$codecDescription] expected $expected bytes, got $bytesLength.\",\n [SOLANA_ERROR__CODECS__INVALID_CONSTANT]: \"Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].\",\n [SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]: \"Invalid discriminated union variant. Expected one of [$variants], got $value.\",\n [SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]: \"Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.\",\n [SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]: \"Invalid literal union variant. Expected one of [$variants], got $value.\",\n [SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: \"Expected [$codecDescription] to have $expected items, got $actual.\",\n [SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: \"Invalid value $value for base $base with alphabet $alphabet.\",\n [SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]: \"Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.\",\n [SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: \"Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.\",\n [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: \"Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.\",\n [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: \"Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].\",\n [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: \"Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.\",\n [SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED]: \"No random values implementation could be found.\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: \"instruction requires an uninitialized account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]: \"instruction tries to borrow reference for an account which is already borrowed\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: \"instruction left account with an outstanding borrowed reference\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED]: \"program other than the account's owner changed the size of the account data\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL]: \"account data too small for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE]: \"instruction expected an executable account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT]: \"An account does not have enough lamports to be rent-exempt\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW]: \"Program arithmetic overflowed\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: \"Failed to serialize or deserialize account data: $encodedData\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: \"Builtin programs must consume compute units\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH]: \"Cross-program invocation call depth too deep\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED]: \"Computational budget exceeded\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: \"custom program error: #$code\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX]: \"instruction contains duplicate accounts\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC]: \"instruction modifications of multiply-passed account differ\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: \"executable accounts must be rent exempt\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED]: \"instruction changed executable accounts data\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE]: \"instruction changed the balance of an executable account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED]: \"instruction changed executable bit of an account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED]: \"instruction modified data of an account it does not own\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND]: \"instruction spent from the balance of an account it does not own\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR]: \"generic instruction error\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER]: \"Provided owner is not allowed\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE]: \"Account is immutable\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY]: \"Incorrect authority provided\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID]: \"incorrect program id for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS]: \"insufficient funds for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA]: \"invalid account data for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER]: \"Invalid account owner\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT]: \"invalid program argument\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR]: \"program returned invalid error code\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA]: \"invalid instruction data\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC]: \"Failed to reallocate account data\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS]: \"Provided seeds do not result in a valid address\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: \"Accounts data allocations exceeded the maximum allowed per transaction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED]: \"Max accounts exceeded\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: \"Max instruction trace length exceeded\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED]: \"Length of the seed is too long for address generation\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT]: \"An account required by the instruction is missing\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE]: \"missing required signature for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID]: \"instruction illegally modified the program id of an account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: \"insufficient account keys for instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION]: \"Cross-program invocation with unauthorized signer or writable account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE]: \"Failed to create program execution environment\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE]: \"Program failed to compile\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE]: \"Program failed to complete\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED]: \"instruction modified data of a read-only account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE]: \"instruction changed the balance of a read-only account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED]: \"Cross-program invocation reentrancy not allowed for this instruction\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED]: \"instruction modified rent epoch of an account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION]: \"sum of account balances before and after instruction do not match\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT]: \"instruction requires an initialized account\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: \"\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID]: \"Unsupported program id\",\n [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR]: \"Unsupported sysvar\",\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: \"The instruction does not have any accounts.\",\n [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: \"The instruction does not have any data.\",\n [SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: \"Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.\",\n [SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]: \"Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.\",\n [SOLANA_ERROR__INVALID_NONCE]: \"The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`\",\n [SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: \"Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant\",\n [SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]: \"Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.\",\n [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE]: \"Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant\",\n [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING]: \"Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant\",\n [SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: \"Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant\",\n [SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: \"JSON-RPC error: Internal JSON-RPC error ($__serverMessage)\",\n [SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: \"JSON-RPC error: Invalid method parameter(s) ($__serverMessage)\",\n [SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]: \"JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)\",\n [SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]: \"JSON-RPC error: The method does not exist / is not available ($__serverMessage)\",\n [SOLANA_ERROR__JSON_RPC__PARSE_ERROR]: \"JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)\",\n [SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: \"Minimum context slot has not been reached\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: \"Node is unhealthy; behind by $numSlotsBehind slots\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: \"No snapshot\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: \"Transaction simulation failed\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE]: \"Transaction history is not available from this node\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: \"$__serverMessage\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH]: \"Transaction signature length mismatch\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE]: \"Transaction signature verification failure\",\n [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: \"$__serverMessage\",\n [SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: \"Key pair bytes must be of length 64, got $byteLength.\",\n [SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: \"Expected private key bytes with length 32. Actual length: $actualLength.\",\n [SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: \"Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.\",\n [SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY]: \"The provided private key does not match the provided public key.\",\n [SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: \"Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.\",\n [SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: \"Lamports value must be in the range [0, 2e64-1]\",\n [SOLANA_ERROR__MALFORMED_BIGINT_STRING]: \"`$value` cannot be parsed as a `BigInt`\",\n [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: \"$message\",\n [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: \"`$value` cannot be parsed as a `Number`\",\n [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: \"No nonce account could be found at address `$nonceAccountAddress`\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: \"The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED]: \"WebSocket was closed before payload could be added to the send buffer\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED]: \"WebSocket connection closed\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: \"WebSocket failed to connect\",\n [SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID]: \"Failed to obtain a subscription id from the server\",\n [SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: \"Could not find an API plan for RPC method: `$method`\",\n [SOLANA_ERROR__RPC__INTEGER_OVERFLOW]: \"The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.\",\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: \"HTTP error ($statusCode): $message\",\n [SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: \"HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.\",\n [SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: \"Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.\",\n [SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: \"The provided value does not implement the `KeyPairSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: \"The provided value does not implement the `MessageModifyingSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: \"The provided value does not implement the `MessagePartialSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: \"The provided value does not implement any of the `MessageSigner` interfaces\",\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: \"The provided value does not implement the `TransactionModifyingSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: \"The provided value does not implement the `TransactionPartialSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: \"The provided value does not implement the `TransactionSendingSigner` interface\",\n [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: \"The provided value does not implement any of the `TransactionSigner` interfaces\",\n [SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: \"More than one `TransactionSendingSigner` was identified.\",\n [SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING]: \"No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.\",\n [SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED]: \"Wallet account signers do not support signing multiple messages/transactions in a single operation\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: \"Cannot export a non-extractable key.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED]: \"No digest implementation could be found.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT]: \"Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED]: \"This runtime does not support the generation of Ed25519 key pairs.\\n\\nInstall @solana/webcrypto-ed25519-polyfill and call its `install` function before generating keys in environments that do not support Ed25519.\\n\\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED]: \"No signature verification implementation could be found.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED]: \"No key generation implementation could be found.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED]: \"No signing implementation could be found.\",\n [SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED]: \"No key export implementation could be found.\",\n [SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: \"Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: \"Transaction processing left an account with an outstanding borrowed reference\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE]: \"Account in use\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE]: \"Account loaded twice\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND]: \"Attempt to debit an account but found no record of a prior credit.\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND]: \"Transaction loads an address table account that doesn't exist\",\n [SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED]: \"This transaction has already been processed\",\n [SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND]: \"Blockhash not found\",\n [SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP]: \"Loader call chain is too deep\",\n [SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE]: \"Transactions are currently disabled due to cluster maintenance\",\n [SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: \"Transaction contains a duplicate instruction ($index) that is not allowed\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE]: \"Insufficient funds for fee\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: \"Transaction results in an account ($accountIndex) with insufficient funds for rent\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE]: \"This account may not be used to pay transaction fees\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX]: \"Transaction contains an invalid account reference\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA]: \"Transaction loads an address table account with invalid data\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: \"Transaction address table lookup uses an invalid index\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: \"Transaction loads an address table account with an invalid owner\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: \"LoadedAccountsDataSizeLimit set for transaction must be greater than 0.\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION]: \"This program may not be used for executing instructions\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT]: \"Transaction leaves an account with a lower balance than rent-exempt minimum\",\n [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT]: \"Transaction loads a writable account that cannot be written\",\n [SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: \"Transaction exceeded max loaded accounts data size cap\",\n [SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE]: \"Transaction requires a fee but has no signature present\",\n [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND]: \"Attempt to load a program that does not exist\",\n [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: \"Execution of the program referenced by account at index $accountIndex is temporarily restricted.\",\n [SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED]: \"ResanitizationNeeded\",\n [SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE]: \"Transaction failed to sanitize accounts offsets correctly\",\n [SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE]: \"Transaction did not pass signature verification\",\n [SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS]: \"Transaction locked too many accounts\",\n [SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION]: \"Sum of account balances before and after transaction do not match\",\n [SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: \"The transaction failed with the error `$errorName`\",\n [SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION]: \"Transaction version is unsupported\",\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: \"Transaction would exceed account data limit within the block\",\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: \"Transaction would exceed total account data limit\",\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: \"Transaction would exceed max account limit within the block\",\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: \"Transaction would exceed max Block Cost Limit\",\n [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: \"Transaction would exceed max Vote Cost Limit\",\n [SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]: \"Attempted to sign a transaction with an address that is not a signer for it\",\n [SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: \"Transaction is missing an address at index: $index.\",\n [SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES]: \"Transaction has no expected signers therefore it cannot be encoded\",\n [SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]: \"Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes\",\n [SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME]: \"Transaction does not have a blockhash lifetime\",\n [SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME]: \"Transaction is not a durable nonce transaction\",\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: \"Contents of these address lookup tables unknown: $lookupTableAddresses\",\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]: \"Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved\",\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: \"No fee payer set in CompiledTransaction\",\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: \"Could not find program address at index $index\",\n [SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT]: \"Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more\",\n [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]: \"Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more\",\n [SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: \"Transaction is missing a fee payer.\",\n [SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]: \"Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.\",\n [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE]: \"Transaction first instruction is not advance nonce account instruction.\",\n [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING]: \"Transaction with no instructions cannot be durable nonce transaction.\",\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]: \"This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees\",\n [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]: \"This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable\",\n [SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]: \"The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.\",\n [SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: \"Transaction is missing signatures for addresses: $addresses.\",\n [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: \"Transaction version must be in the range [0, 127]. `$actualVersion` given\"\n};\n\n// src/message-formatter.ts\nvar START_INDEX = \"i\";\nvar TYPE = \"t\";\nfunction getHumanReadableErrorMessage(code, context = {}) {\n const messageFormatString = SolanaErrorMessages[code];\n if (messageFormatString.length === 0) {\n return \"\";\n }\n let state;\n function commitStateUpTo(endIndex) {\n if (state[TYPE] === 2 /* Variable */) {\n const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex);\n fragments.push(\n variableName in context ? (\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `${context[variableName]}`\n ) : `$${variableName}`\n );\n } else if (state[TYPE] === 1 /* Text */) {\n fragments.push(messageFormatString.slice(state[START_INDEX], endIndex));\n }\n }\n const fragments = [];\n messageFormatString.split(\"\").forEach((char, ii) => {\n if (ii === 0) {\n state = {\n [START_INDEX]: 0,\n [TYPE]: messageFormatString[0] === \"\\\\\" ? 0 /* EscapeSequence */ : messageFormatString[0] === \"$\" ? 2 /* Variable */ : 1 /* Text */\n };\n return;\n }\n let nextState;\n switch (state[TYPE]) {\n case 0 /* EscapeSequence */:\n nextState = { [START_INDEX]: ii, [TYPE]: 1 /* Text */ };\n break;\n case 1 /* Text */:\n if (char === \"\\\\\") {\n nextState = { [START_INDEX]: ii, [TYPE]: 0 /* EscapeSequence */ };\n } else if (char === \"$\") {\n nextState = { [START_INDEX]: ii, [TYPE]: 2 /* Variable */ };\n }\n break;\n case 2 /* Variable */:\n if (char === \"\\\\\") {\n nextState = { [START_INDEX]: ii, [TYPE]: 0 /* EscapeSequence */ };\n } else if (char === \"$\") {\n nextState = { [START_INDEX]: ii, [TYPE]: 2 /* Variable */ };\n } else if (!char.match(/\\w/)) {\n nextState = { [START_INDEX]: ii, [TYPE]: 1 /* Text */ };\n }\n break;\n }\n if (nextState) {\n if (state !== nextState) {\n commitStateUpTo(ii);\n }\n state = nextState;\n }\n });\n commitStateUpTo();\n return fragments.join(\"\");\n}\nfunction getErrorMessage(code, context = {}) {\n if (process.env.NODE_ENV !== \"production\") {\n return getHumanReadableErrorMessage(code, context);\n } else {\n let decodingAdviceMessage = `Solana error #${code}; Decode this error by running \\`npx @solana/errors decode -- ${code}`;\n if (Object.keys(context).length) {\n decodingAdviceMessage += ` '${encodeContextObject(context)}'`;\n }\n return `${decodingAdviceMessage}\\``;\n }\n}\n\n// src/error.ts\nfunction isSolanaError(e, code) {\n const isSolanaError2 = e instanceof Error && e.name === \"SolanaError\";\n if (isSolanaError2) {\n if (code !== void 0) {\n return e.context.__code === code;\n }\n return true;\n }\n return false;\n}\nvar SolanaError = class extends Error {\n /**\n * Indicates the root cause of this {@link SolanaError}, if any.\n *\n * For example, a transaction error might have an instruction error as its root cause. In this\n * case, you will be able to access the instruction error on the transaction error as `cause`.\n */\n cause = this.cause;\n /**\n * Contains context that can assist in understanding or recovering from a {@link SolanaError}.\n */\n context;\n constructor(...[code, contextAndErrorOptions]) {\n let context;\n let errorOptions;\n if (contextAndErrorOptions) {\n const { cause, ...contextRest } = contextAndErrorOptions;\n if (cause) {\n errorOptions = { cause };\n }\n if (Object.keys(contextRest).length > 0) {\n context = contextRest;\n }\n }\n const message = getErrorMessage(code, context);\n super(message, errorOptions);\n this.context = {\n __code: code,\n ...context\n };\n this.name = \"SolanaError\";\n }\n};\n\n// src/stack-trace.ts\nfunction safeCaptureStackTrace(...args) {\n if (\"captureStackTrace\" in Error && typeof Error.captureStackTrace === \"function\") {\n Error.captureStackTrace(...args);\n }\n}\n\n// src/rpc-enum-errors.ts\nfunction getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) {\n let rpcErrorName;\n let rpcErrorContext;\n if (typeof rpcEnumError === \"string\") {\n rpcErrorName = rpcEnumError;\n } else {\n rpcErrorName = Object.keys(rpcEnumError)[0];\n rpcErrorContext = rpcEnumError[rpcErrorName];\n }\n const codeOffset = orderedErrorNames.indexOf(rpcErrorName);\n const errorCode = errorCodeBaseOffset + codeOffset;\n const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext);\n const err = new SolanaError(errorCode, errorContext);\n safeCaptureStackTrace(err, constructorOpt);\n return err;\n}\n\n// src/instruction-error.ts\nvar ORDERED_ERROR_NAMES = [\n // Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs\n // If this list ever gets too large, consider implementing a compression strategy like this:\n // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47\n \"GenericError\",\n \"InvalidArgument\",\n \"InvalidInstructionData\",\n \"InvalidAccountData\",\n \"AccountDataTooSmall\",\n \"InsufficientFunds\",\n \"IncorrectProgramId\",\n \"MissingRequiredSignature\",\n \"AccountAlreadyInitialized\",\n \"UninitializedAccount\",\n \"UnbalancedInstruction\",\n \"ModifiedProgramId\",\n \"ExternalAccountLamportSpend\",\n \"ExternalAccountDataModified\",\n \"ReadonlyLamportChange\",\n \"ReadonlyDataModified\",\n \"DuplicateAccountIndex\",\n \"ExecutableModified\",\n \"RentEpochModified\",\n \"NotEnoughAccountKeys\",\n \"AccountDataSizeChanged\",\n \"AccountNotExecutable\",\n \"AccountBorrowFailed\",\n \"AccountBorrowOutstanding\",\n \"DuplicateAccountOutOfSync\",\n \"Custom\",\n \"InvalidError\",\n \"ExecutableDataModified\",\n \"ExecutableLamportChange\",\n \"ExecutableAccountNotRentExempt\",\n \"UnsupportedProgramId\",\n \"CallDepth\",\n \"MissingAccount\",\n \"ReentrancyNotAllowed\",\n \"MaxSeedLengthExceeded\",\n \"InvalidSeeds\",\n \"InvalidRealloc\",\n \"ComputationalBudgetExceeded\",\n \"PrivilegeEscalation\",\n \"ProgramEnvironmentSetupFailure\",\n \"ProgramFailedToComplete\",\n \"ProgramFailedToCompile\",\n \"Immutable\",\n \"IncorrectAuthority\",\n \"BorshIoError\",\n \"AccountNotRentExempt\",\n \"InvalidAccountOwner\",\n \"ArithmeticOverflow\",\n \"UnsupportedSysvar\",\n \"IllegalOwner\",\n \"MaxAccountsDataAllocationsExceeded\",\n \"MaxAccountsExceeded\",\n \"MaxInstructionTraceLengthExceeded\",\n \"BuiltinProgramsMustConsumeComputeUnits\"\n];\nfunction getSolanaErrorFromInstructionError(index, instructionError) {\n const numberIndex = Number(index);\n return getSolanaErrorFromRpcError(\n {\n errorCodeBaseOffset: 4615001,\n getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {\n if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN) {\n return {\n errorName: rpcErrorName,\n index: numberIndex,\n ...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null\n };\n } else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM) {\n return {\n code: Number(rpcErrorContext),\n index: numberIndex\n };\n } else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR) {\n return {\n encodedData: rpcErrorContext,\n index: numberIndex\n };\n }\n return { index: numberIndex };\n },\n orderedErrorNames: ORDERED_ERROR_NAMES,\n rpcEnumError: instructionError\n },\n getSolanaErrorFromInstructionError\n );\n}\n\n// src/transaction-error.ts\nvar ORDERED_ERROR_NAMES2 = [\n // Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs\n // If this list ever gets too large, consider implementing a compression strategy like this:\n // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47\n \"AccountInUse\",\n \"AccountLoadedTwice\",\n \"AccountNotFound\",\n \"ProgramAccountNotFound\",\n \"InsufficientFundsForFee\",\n \"InvalidAccountForFee\",\n \"AlreadyProcessed\",\n \"BlockhashNotFound\",\n // `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError`\n \"CallChainTooDeep\",\n \"MissingSignatureForFee\",\n \"InvalidAccountIndex\",\n \"SignatureFailure\",\n \"InvalidProgramForExecution\",\n \"SanitizeFailure\",\n \"ClusterMaintenance\",\n \"AccountBorrowOutstanding\",\n \"WouldExceedMaxBlockCostLimit\",\n \"UnsupportedVersion\",\n \"InvalidWritableAccount\",\n \"WouldExceedMaxAccountCostLimit\",\n \"WouldExceedAccountDataBlockLimit\",\n \"TooManyAccountLocks\",\n \"AddressLookupTableNotFound\",\n \"InvalidAddressLookupTableOwner\",\n \"InvalidAddressLookupTableData\",\n \"InvalidAddressLookupTableIndex\",\n \"InvalidRentPayingAccount\",\n \"WouldExceedMaxVoteCostLimit\",\n \"WouldExceedAccountDataTotalLimit\",\n \"DuplicateInstruction\",\n \"InsufficientFundsForRent\",\n \"MaxLoadedAccountsDataSizeExceeded\",\n \"InvalidLoadedAccountsDataSizeLimit\",\n \"ResanitizationNeeded\",\n \"ProgramExecutionTemporarilyRestricted\",\n \"UnbalancedTransaction\"\n];\nfunction getSolanaErrorFromTransactionError(transactionError) {\n if (typeof transactionError === \"object\" && \"InstructionError\" in transactionError) {\n return getSolanaErrorFromInstructionError(\n ...transactionError.InstructionError\n );\n }\n return getSolanaErrorFromRpcError(\n {\n errorCodeBaseOffset: 7050001,\n getErrorContext(errorCode, rpcErrorName, rpcErrorContext) {\n if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN) {\n return {\n errorName: rpcErrorName,\n ...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null\n };\n } else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION) {\n return {\n index: Number(rpcErrorContext)\n };\n } else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) {\n return {\n accountIndex: Number(rpcErrorContext.account_index)\n };\n }\n },\n orderedErrorNames: ORDERED_ERROR_NAMES2,\n rpcEnumError: transactionError\n },\n getSolanaErrorFromTransactionError\n );\n}\n\n// src/json-rpc-error.ts\nfunction getSolanaErrorFromJsonRpcError(putativeErrorResponse) {\n let out;\n if (isRpcErrorResponse(putativeErrorResponse)) {\n const { code: rawCode, data, message } = putativeErrorResponse;\n const code = Number(rawCode);\n if (code === SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE) {\n const { err, ...preflightErrorContext } = data;\n const causeObject = err ? { cause: getSolanaErrorFromTransactionError(err) } : null;\n out = new SolanaError(SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, {\n ...preflightErrorContext,\n ...causeObject\n });\n } else {\n let errorContext;\n switch (code) {\n case SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR:\n case SOLANA_ERROR__JSON_RPC__INVALID_PARAMS:\n case SOLANA_ERROR__JSON_RPC__INVALID_REQUEST:\n case SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND:\n case SOLANA_ERROR__JSON_RPC__PARSE_ERROR:\n case SOLANA_ERROR__JSON_RPC__SCAN_ERROR:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE:\n case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION:\n errorContext = { __serverMessage: message };\n break;\n default:\n if (typeof data === \"object\" && !Array.isArray(data)) {\n errorContext = data;\n }\n }\n out = new SolanaError(code, errorContext);\n }\n } else {\n const message = typeof putativeErrorResponse === \"object\" && putativeErrorResponse !== null && \"message\" in putativeErrorResponse && typeof putativeErrorResponse.message === \"string\" ? putativeErrorResponse.message : \"Malformed JSON-RPC error with no message attribute\";\n out = new SolanaError(SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR, { error: putativeErrorResponse, message });\n }\n safeCaptureStackTrace(out, getSolanaErrorFromJsonRpcError);\n return out;\n}\nfunction isRpcErrorResponse(value) {\n return typeof value === \"object\" && value !== null && \"code\" in value && \"message\" in value && (typeof value.code === \"number\" || typeof value.code === \"bigint\") && typeof value.message === \"string\";\n}\n\nexport { SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND, SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED, SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT, SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT, SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND, SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED, SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS, SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH, SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY, SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS, SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE, SOLANA_ERROR__ADDRESSES__MALFORMED_PDA, SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED, SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED, SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE, SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER, SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS, SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH, SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH, SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH, SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__INVALID_CONSTANT, SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT, SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT, SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT, SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS, SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE, SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE, SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE, SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT, SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW, SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR, SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS, SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH, SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED, SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM, SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX, SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE, SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED, SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED, SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND, SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR, SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER, SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE, SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY, SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID, SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC, SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED, SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED, SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT, SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE, SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID, SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS, SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE, SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE, SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED, SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE, SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED, SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED, SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION, SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT, SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN, SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID, SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR, SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS, SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA, SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH, SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH, SOLANA_ERROR__INVALID_NONCE, SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING, SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED, SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE, SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING, SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE, SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR, SOLANA_ERROR__JSON_RPC__INVALID_PARAMS, SOLANA_ERROR__JSON_RPC__INVALID_REQUEST, SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND, SOLANA_ERROR__JSON_RPC__PARSE_ERROR, SOLANA_ERROR__JSON_RPC__SCAN_ERROR, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE, SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION, SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH, SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH, SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH, SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY, SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE, SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE, SOLANA_ERROR__MALFORMED_BIGINT_STRING, SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR, SOLANA_ERROR__MALFORMED_NUMBER_STRING, SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED, SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT, SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID, SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD, SOLANA_ERROR__RPC__INTEGER_OVERFLOW, SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR, SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN, SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS, SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER, SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER, SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS, SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING, SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY, SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT, SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED, SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED, SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE, SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND, SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND, SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED, SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND, SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP, SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE, SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION, SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE, SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT, SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT, SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED, SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE, SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND, SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED, SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED, SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE, SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE, SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS, SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION, SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN, SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT, SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT, SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION, SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING, SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES, SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT, SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME, SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING, SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND, SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT, SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING, SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING, SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE, SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES, SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE, SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH, SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING, SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE, SolanaError, getSolanaErrorFromInstructionError, getSolanaErrorFromJsonRpcError, getSolanaErrorFromTransactionError, isSolanaError, safeCaptureStackTrace };\n//# sourceMappingURL=index.browser.mjs.map\n//# sourceMappingURL=index.browser.mjs.map","import { SolanaError, SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH, SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH, SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH, SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL } from '@solana/errors';\n\n// src/add-codec-sentinel.ts\n\n// src/bytes.ts\nvar mergeBytes = (byteArrays) => {\n const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);\n if (nonEmptyByteArrays.length === 0) {\n return byteArrays.length ? byteArrays[0] : new Uint8Array();\n }\n if (nonEmptyByteArrays.length === 1) {\n return nonEmptyByteArrays[0];\n }\n const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n nonEmptyByteArrays.forEach((arr) => {\n result.set(arr, offset);\n offset += arr.length;\n });\n return result;\n};\nvar padBytes = (bytes, length) => {\n if (bytes.length >= length) return bytes;\n const paddedBytes = new Uint8Array(length).fill(0);\n paddedBytes.set(bytes);\n return paddedBytes;\n};\nvar fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);\nfunction containsBytes(data, bytes, offset) {\n const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length);\n if (slice.length !== bytes.length) return false;\n return bytes.every((b, i) => b === slice[i]);\n}\nfunction getEncodedSize(value, encoder) {\n return \"fixedSize\" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);\n}\nfunction createEncoder(encoder) {\n return Object.freeze({\n ...encoder,\n encode: (value) => {\n const bytes = new Uint8Array(getEncodedSize(value, encoder));\n encoder.write(value, bytes, 0);\n return bytes;\n }\n });\n}\nfunction createDecoder(decoder) {\n return Object.freeze({\n ...decoder,\n decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]\n });\n}\nfunction createCodec(codec) {\n return Object.freeze({\n ...codec,\n decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],\n encode: (value) => {\n const bytes = new Uint8Array(getEncodedSize(value, codec));\n codec.write(value, bytes, 0);\n return bytes;\n }\n });\n}\nfunction isFixedSize(codec) {\n return \"fixedSize\" in codec && typeof codec.fixedSize === \"number\";\n}\nfunction assertIsFixedSize(codec) {\n if (!isFixedSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH);\n }\n}\nfunction isVariableSize(codec) {\n return !isFixedSize(codec);\n}\nfunction assertIsVariableSize(codec) {\n if (!isVariableSize(codec)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH);\n }\n}\nfunction combineCodec(encoder, decoder) {\n if (isFixedSize(encoder) !== isFixedSize(decoder)) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH);\n }\n if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, {\n decoderFixedSize: decoder.fixedSize,\n encoderFixedSize: encoder.fixedSize\n });\n }\n if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, {\n decoderMaxSize: decoder.maxSize,\n encoderMaxSize: encoder.maxSize\n });\n }\n return {\n ...decoder,\n ...encoder,\n decode: decoder.decode,\n encode: encoder.encode,\n read: decoder.read,\n write: encoder.write\n };\n}\n\n// src/add-codec-sentinel.ts\nfunction addEncoderSentinel(encoder, sentinel) {\n const write = (value, bytes, offset) => {\n const encoderBytes = encoder.encode(value);\n if (findSentinelIndex(encoderBytes, sentinel) >= 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, {\n encodedBytes: encoderBytes,\n hexEncodedBytes: hexBytes(encoderBytes),\n hexSentinel: hexBytes(sentinel),\n sentinel\n });\n }\n bytes.set(encoderBytes, offset);\n offset += encoderBytes.length;\n bytes.set(sentinel, offset);\n offset += sentinel.length;\n return offset;\n };\n if (isFixedSize(encoder)) {\n return createEncoder({ ...encoder, fixedSize: encoder.fixedSize + sentinel.length, write });\n }\n return createEncoder({\n ...encoder,\n ...encoder.maxSize != null ? { maxSize: encoder.maxSize + sentinel.length } : {},\n getSizeFromValue: (value) => encoder.getSizeFromValue(value) + sentinel.length,\n write\n });\n}\nfunction addDecoderSentinel(decoder, sentinel) {\n const read = (bytes, offset) => {\n const candidateBytes = offset === 0 ? bytes : bytes.slice(offset);\n const sentinelIndex = findSentinelIndex(candidateBytes, sentinel);\n if (sentinelIndex === -1) {\n throw new SolanaError(SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, {\n decodedBytes: candidateBytes,\n hexDecodedBytes: hexBytes(candidateBytes),\n hexSentinel: hexBytes(sentinel),\n sentinel\n });\n }\n const preSentinelBytes = candidateBytes.slice(0, sentinelIndex);\n return [decoder.decode(preSentinelBytes), offset + preSentinelBytes.length + sentinel.length];\n };\n if (isFixedSize(decoder)) {\n return createDecoder({ ...decoder, fixedSize: decoder.fixedSize + sentinel.length, read });\n }\n return createDecoder({\n ...decoder,\n ...decoder.maxSize != null ? { maxSize: decoder.maxSize + sentinel.length } : {},\n read\n });\n}\nfunction addCodecSentinel(codec, sentinel) {\n return combineCodec(addEncoderSentinel(codec, sentinel), addDecoderSentinel(codec, sentinel));\n}\nfunction findSentinelIndex(bytes, sentinel) {\n return bytes.findIndex((byte, index, arr) => {\n if (sentinel.length === 1) return byte === sentinel[0];\n return containsBytes(arr, sentinel, index);\n });\n}\nfunction hexBytes(bytes) {\n return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, \"0\"), \"\");\n}\nfunction assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {\n if (bytes.length - offset <= 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, {\n codecDescription\n });\n }\n}\nfunction assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {\n const bytesLength = bytes.length - offset;\n if (bytesLength < expected) {\n throw new SolanaError(SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, {\n bytesLength,\n codecDescription,\n expected\n });\n }\n}\nfunction assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLength) {\n if (offset < 0 || offset > bytesLength) {\n throw new SolanaError(SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, {\n bytesLength,\n codecDescription,\n offset\n });\n }\n}\n\n// src/add-codec-size-prefix.ts\nfunction addEncoderSizePrefix(encoder, prefix) {\n const write = (value, bytes, offset) => {\n const encoderBytes = encoder.encode(value);\n offset = prefix.write(encoderBytes.length, bytes, offset);\n bytes.set(encoderBytes, offset);\n return offset + encoderBytes.length;\n };\n if (isFixedSize(prefix) && isFixedSize(encoder)) {\n return createEncoder({ ...encoder, fixedSize: prefix.fixedSize + encoder.fixedSize, write });\n }\n const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;\n const encoderMaxSize = isFixedSize(encoder) ? encoder.fixedSize : encoder.maxSize ?? null;\n const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null;\n return createEncoder({\n ...encoder,\n ...maxSize !== null ? { maxSize } : {},\n getSizeFromValue: (value) => {\n const encoderSize = getEncodedSize(value, encoder);\n return getEncodedSize(encoderSize, prefix) + encoderSize;\n },\n write\n });\n}\nfunction addDecoderSizePrefix(decoder, prefix) {\n const read = (bytes, offset) => {\n const [bigintSize, decoderOffset] = prefix.read(bytes, offset);\n const size = Number(bigintSize);\n offset = decoderOffset;\n if (offset > 0 || bytes.length > size) {\n bytes = bytes.slice(offset, offset + size);\n }\n assertByteArrayHasEnoughBytesForCodec(\"addDecoderSizePrefix\", size, bytes);\n return [decoder.decode(bytes), offset + size];\n };\n if (isFixedSize(prefix) && isFixedSize(decoder)) {\n return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read });\n }\n const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null;\n const decoderMaxSize = isFixedSize(decoder) ? decoder.fixedSize : decoder.maxSize ?? null;\n const maxSize = prefixMaxSize !== null && decoderMaxSize !== null ? prefixMaxSize + decoderMaxSize : null;\n return createDecoder({ ...decoder, ...maxSize !== null ? { maxSize } : {}, read });\n}\nfunction addCodecSizePrefix(codec, prefix) {\n return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix));\n}\n\n// src/fix-codec-size.ts\nfunction fixEncoderSize(encoder, fixedBytes) {\n return createEncoder({\n fixedSize: fixedBytes,\n write: (value, bytes, offset) => {\n const variableByteArray = encoder.encode(value);\n const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;\n bytes.set(fixedByteArray, offset);\n return offset + fixedBytes;\n }\n });\n}\nfunction fixDecoderSize(decoder, fixedBytes) {\n return createDecoder({\n fixedSize: fixedBytes,\n read: (bytes, offset) => {\n assertByteArrayHasEnoughBytesForCodec(\"fixCodecSize\", fixedBytes, bytes, offset);\n if (offset > 0 || bytes.length > fixedBytes) {\n bytes = bytes.slice(offset, offset + fixedBytes);\n }\n if (isFixedSize(decoder)) {\n bytes = fixBytes(bytes, decoder.fixedSize);\n }\n const [value] = decoder.read(bytes, 0);\n return [value, offset + fixedBytes];\n }\n });\n}\nfunction fixCodecSize(codec, fixedBytes) {\n return combineCodec(fixEncoderSize(codec, fixedBytes), fixDecoderSize(codec, fixedBytes));\n}\n\n// src/offset-codec.ts\nfunction offsetEncoder(encoder, config) {\n return createEncoder({\n ...encoder,\n write: (value, bytes, preOffset) => {\n const wrapBytes = (offset) => modulo(offset, bytes.length);\n const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;\n assertByteArrayOffsetIsNotOutOfRange(\"offsetEncoder\", newPreOffset, bytes.length);\n const postOffset = encoder.write(value, bytes, newPreOffset);\n const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset;\n assertByteArrayOffsetIsNotOutOfRange(\"offsetEncoder\", newPostOffset, bytes.length);\n return newPostOffset;\n }\n });\n}\nfunction offsetDecoder(decoder, config) {\n return createDecoder({\n ...decoder,\n read: (bytes, preOffset) => {\n const wrapBytes = (offset) => modulo(offset, bytes.length);\n const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset;\n assertByteArrayOffsetIsNotOutOfRange(\"offsetDecoder\", newPreOffset, bytes.length);\n const [value, postOffset] = decoder.read(bytes, newPreOffset);\n const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset;\n assertByteArrayOffsetIsNotOutOfRange(\"offsetDecoder\", newPostOffset, bytes.length);\n return [value, newPostOffset];\n }\n });\n}\nfunction offsetCodec(codec, config) {\n return combineCodec(offsetEncoder(codec, config), offsetDecoder(codec, config));\n}\nfunction modulo(dividend, divisor) {\n if (divisor === 0) return 0;\n return (dividend % divisor + divisor) % divisor;\n}\nfunction resizeEncoder(encoder, resize) {\n if (isFixedSize(encoder)) {\n const fixedSize = resize(encoder.fixedSize);\n if (fixedSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: fixedSize,\n codecDescription: \"resizeEncoder\"\n });\n }\n return createEncoder({ ...encoder, fixedSize });\n }\n return createEncoder({\n ...encoder,\n getSizeFromValue: (value) => {\n const newSize = resize(encoder.getSizeFromValue(value));\n if (newSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: newSize,\n codecDescription: \"resizeEncoder\"\n });\n }\n return newSize;\n }\n });\n}\nfunction resizeDecoder(decoder, resize) {\n if (isFixedSize(decoder)) {\n const fixedSize = resize(decoder.fixedSize);\n if (fixedSize < 0) {\n throw new SolanaError(SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, {\n bytesLength: fixedSize,\n codecDescription: \"resizeDecoder\"\n });\n }\n return createDecoder({ ...decoder, fixedSize });\n }\n return decoder;\n}\nfunction resizeCodec(codec, resize) {\n return combineCodec(resizeEncoder(codec, resize), resizeDecoder(codec, resize));\n}\n\n// src/pad-codec.ts\nfunction padLeftEncoder(encoder, offset) {\n return offsetEncoder(\n resizeEncoder(encoder, (size) => size + offset),\n { preOffset: ({ preOffset }) => preOffset + offset }\n );\n}\nfunction padRightEncoder(encoder, offset) {\n return offsetEncoder(\n resizeEncoder(encoder, (size) => size + offset),\n { postOffset: ({ postOffset }) => postOffset + offset }\n );\n}\nfunction padLeftDecoder(decoder, offset) {\n return offsetDecoder(\n resizeDecoder(decoder, (size) => size + offset),\n { preOffset: ({ preOffset }) => preOffset + offset }\n );\n}\nfunction padRightDecoder(decoder, offset) {\n return offsetDecoder(\n resizeDecoder(decoder, (size) => size + offset),\n { postOffset: ({ postOffset }) => postOffset + offset }\n );\n}\nfunction padLeftCodec(codec, offset) {\n return combineCodec(padLeftEncoder(codec, offset), padLeftDecoder(codec, offset));\n}\nfunction padRightCodec(codec, offset) {\n return combineCodec(padRightEncoder(codec, offset), padRightDecoder(codec, offset));\n}\n\n// src/reverse-codec.ts\nfunction copySourceToTargetInReverse(source, target_WILL_MUTATE, sourceOffset, sourceLength, targetOffset = 0) {\n while (sourceOffset < --sourceLength) {\n const leftValue = source[sourceOffset];\n target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceLength];\n target_WILL_MUTATE[sourceLength + targetOffset] = leftValue;\n sourceOffset++;\n }\n if (sourceOffset === sourceLength) {\n target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceOffset];\n }\n}\nfunction reverseEncoder(encoder) {\n assertIsFixedSize(encoder);\n return createEncoder({\n ...encoder,\n write: (value, bytes, offset) => {\n const newOffset = encoder.write(value, bytes, offset);\n copySourceToTargetInReverse(\n bytes,\n bytes,\n offset,\n offset + encoder.fixedSize\n );\n return newOffset;\n }\n });\n}\nfunction reverseDecoder(decoder) {\n assertIsFixedSize(decoder);\n return createDecoder({\n ...decoder,\n read: (bytes, offset) => {\n const reversedBytes = bytes.slice();\n copySourceToTargetInReverse(\n bytes,\n reversedBytes,\n offset,\n offset + decoder.fixedSize\n );\n return decoder.read(reversedBytes, offset);\n }\n });\n}\nfunction reverseCodec(codec) {\n return combineCodec(reverseEncoder(codec), reverseDecoder(codec));\n}\n\n// src/transform-codec.ts\nfunction transformEncoder(encoder, unmap) {\n return createEncoder({\n ...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,\n write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)\n });\n}\nfunction transformDecoder(decoder, map) {\n return createDecoder({\n ...decoder,\n read: (bytes, offset) => {\n const [value, newOffset] = decoder.read(bytes, offset);\n return [map(value, bytes, offset), newOffset];\n }\n });\n}\nfunction transformCodec(codec, unmap, map) {\n return createCodec({\n ...transformEncoder(codec, unmap),\n read: map ? transformDecoder(codec, map).read : codec.read\n });\n}\n\nexport { addCodecSentinel, addCodecSizePrefix, addDecoderSentinel, addDecoderSizePrefix, addEncoderSentinel, addEncoderSizePrefix, assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertByteArrayOffsetIsNotOutOfRange, assertIsFixedSize, assertIsVariableSize, combineCodec, containsBytes, createCodec, createDecoder, createEncoder, fixBytes, fixCodecSize, fixDecoderSize, fixEncoderSize, getEncodedSize, isFixedSize, isVariableSize, mergeBytes, offsetCodec, offsetDecoder, offsetEncoder, padBytes, padLeftCodec, padLeftDecoder, padLeftEncoder, padRightCodec, padRightDecoder, padRightEncoder, resizeCodec, resizeDecoder, resizeEncoder, reverseCodec, reverseDecoder, reverseEncoder, transformCodec, transformDecoder, transformEncoder };\n//# sourceMappingURL=index.browser.mjs.map\n//# sourceMappingURL=index.browser.mjs.map","import { SolanaError, SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE } from '@solana/errors';\nimport { combineCodec, createDecoder, createEncoder, assertByteArrayIsNotEmptyForCodec, assertByteArrayHasEnoughBytesForCodec } from '@solana/codecs-core';\n\n// src/assertions.ts\nfunction assertNumberIsBetweenForCodec(codecDescription, min, max, value) {\n if (value < min || value > max) {\n throw new SolanaError(SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, {\n codecDescription,\n max,\n min,\n value\n });\n }\n}\n\n// src/common.ts\nvar Endian = /* @__PURE__ */ ((Endian2) => {\n Endian2[Endian2[\"Little\"] = 0] = \"Little\";\n Endian2[Endian2[\"Big\"] = 1] = \"Big\";\n return Endian2;\n})(Endian || {});\nfunction isLittleEndian(config) {\n return config?.endian === 1 /* Big */ ? false : true;\n}\nfunction numberEncoderFactory(input) {\n return createEncoder({\n fixedSize: input.size,\n write(value, bytes, offset) {\n if (input.range) {\n assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);\n }\n const arrayBuffer = new ArrayBuffer(input.size);\n input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));\n bytes.set(new Uint8Array(arrayBuffer), offset);\n return offset + input.size;\n }\n });\n}\nfunction numberDecoderFactory(input) {\n return createDecoder({\n fixedSize: input.size,\n read(bytes, offset = 0) {\n assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);\n assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);\n const view = new DataView(toArrayBuffer(bytes, offset, input.size));\n return [input.get(view, isLittleEndian(input.config)), offset + input.size];\n }\n });\n}\nfunction toArrayBuffer(bytes, offset, length) {\n const bytesOffset = bytes.byteOffset + (offset ?? 0);\n const bytesLength = length ?? bytes.byteLength;\n return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);\n}\n\n// src/f32.ts\nvar getF32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"f32\",\n set: (view, value, le) => view.setFloat32(0, Number(value), le),\n size: 4\n});\nvar getF32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getFloat32(0, le),\n name: \"f32\",\n size: 4\n});\nvar getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config));\nvar getF64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"f64\",\n set: (view, value, le) => view.setFloat64(0, Number(value), le),\n size: 8\n});\nvar getF64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getFloat64(0, le),\n name: \"f64\",\n size: 8\n});\nvar getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config));\nvar getI128Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i128\",\n range: [-BigInt(\"0x7fffffffffffffffffffffffffffffff\") - 1n, BigInt(\"0x7fffffffffffffffffffffffffffffff\")],\n set: (view, value, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const rightMask = 0xffffffffffffffffn;\n view.setBigInt64(leftOffset, BigInt(value) >> 64n, le);\n view.setBigUint64(rightOffset, BigInt(value) & rightMask, le);\n },\n size: 16\n});\nvar getI128Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const left = view.getBigInt64(leftOffset, le);\n const right = view.getBigUint64(rightOffset, le);\n return (left << 64n) + right;\n },\n name: \"i128\",\n size: 16\n});\nvar getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config));\nvar getI16Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i16\",\n range: [-Number(\"0x7fff\") - 1, Number(\"0x7fff\")],\n set: (view, value, le) => view.setInt16(0, Number(value), le),\n size: 2\n});\nvar getI16Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getInt16(0, le),\n name: \"i16\",\n size: 2\n});\nvar getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config));\nvar getI32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i32\",\n range: [-Number(\"0x7fffffff\") - 1, Number(\"0x7fffffff\")],\n set: (view, value, le) => view.setInt32(0, Number(value), le),\n size: 4\n});\nvar getI32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getInt32(0, le),\n name: \"i32\",\n size: 4\n});\nvar getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config));\nvar getI64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i64\",\n range: [-BigInt(\"0x7fffffffffffffff\") - 1n, BigInt(\"0x7fffffffffffffff\")],\n set: (view, value, le) => view.setBigInt64(0, BigInt(value), le),\n size: 8\n});\nvar getI64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getBigInt64(0, le),\n name: \"i64\",\n size: 8\n});\nvar getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config));\nvar getI8Encoder = () => numberEncoderFactory({\n name: \"i8\",\n range: [-Number(\"0x7f\") - 1, Number(\"0x7f\")],\n set: (view, value) => view.setInt8(0, Number(value)),\n size: 1\n});\nvar getI8Decoder = () => numberDecoderFactory({\n get: (view) => view.getInt8(0),\n name: \"i8\",\n size: 1\n});\nvar getI8Codec = () => combineCodec(getI8Encoder(), getI8Decoder());\nvar getShortU16Encoder = () => createEncoder({\n getSizeFromValue: (value) => {\n if (value <= 127) return 1;\n if (value <= 16383) return 2;\n return 3;\n },\n maxSize: 3,\n write: (value, bytes, offset) => {\n assertNumberIsBetweenForCodec(\"shortU16\", 0, 65535, value);\n const shortU16Bytes = [0];\n for (let ii = 0; ; ii += 1) {\n const alignedValue = Number(value) >> ii * 7;\n if (alignedValue === 0) {\n break;\n }\n const nextSevenBits = 127 & alignedValue;\n shortU16Bytes[ii] = nextSevenBits;\n if (ii > 0) {\n shortU16Bytes[ii - 1] |= 128;\n }\n }\n bytes.set(shortU16Bytes, offset);\n return offset + shortU16Bytes.length;\n }\n});\nvar getShortU16Decoder = () => createDecoder({\n maxSize: 3,\n read: (bytes, offset) => {\n let value = 0;\n let byteCount = 0;\n while (++byteCount) {\n const byteIndex = byteCount - 1;\n const currentByte = bytes[offset + byteIndex];\n const nextSevenBits = 127 & currentByte;\n value |= nextSevenBits << byteIndex * 7;\n if ((currentByte & 128) === 0) {\n break;\n }\n }\n return [value, offset + byteCount];\n }\n});\nvar getShortU16Codec = () => combineCodec(getShortU16Encoder(), getShortU16Decoder());\nvar getU128Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u128\",\n range: [0n, BigInt(\"0xffffffffffffffffffffffffffffffff\")],\n set: (view, value, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const rightMask = 0xffffffffffffffffn;\n view.setBigUint64(leftOffset, BigInt(value) >> 64n, le);\n view.setBigUint64(rightOffset, BigInt(value) & rightMask, le);\n },\n size: 16\n});\nvar getU128Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const left = view.getBigUint64(leftOffset, le);\n const right = view.getBigUint64(rightOffset, le);\n return (left << 64n) + right;\n },\n name: \"u128\",\n size: 16\n});\nvar getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config));\nvar getU16Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u16\",\n range: [0, Number(\"0xffff\")],\n set: (view, value, le) => view.setUint16(0, Number(value), le),\n size: 2\n});\nvar getU16Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getUint16(0, le),\n name: \"u16\",\n size: 2\n});\nvar getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config));\nvar getU32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u32\",\n range: [0, Number(\"0xffffffff\")],\n set: (view, value, le) => view.setUint32(0, Number(value), le),\n size: 4\n});\nvar getU32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getUint32(0, le),\n name: \"u32\",\n size: 4\n});\nvar getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config));\nvar getU64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u64\",\n range: [0n, BigInt(\"0xffffffffffffffff\")],\n set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),\n size: 8\n});\nvar getU64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getBigUint64(0, le),\n name: \"u64\",\n size: 8\n});\nvar getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config));\nvar getU8Encoder = () => numberEncoderFactory({\n name: \"u8\",\n range: [0, Number(\"0xff\")],\n set: (view, value) => view.setUint8(0, Number(value)),\n size: 1\n});\nvar getU8Decoder = () => numberDecoderFactory({\n get: (view) => view.getUint8(0),\n name: \"u8\",\n size: 1\n});\nvar getU8Codec = () => combineCodec(getU8Encoder(), getU8Decoder());\n\nexport { Endian, assertNumberIsBetweenForCodec, getF32Codec, getF32Decoder, getF32Encoder, getF64Codec, getF64Decoder, getF64Encoder, getI128Codec, getI128Decoder, getI128Encoder, getI16Codec, getI16Decoder, getI16Encoder, getI32Codec, getI32Decoder, getI32Encoder, getI64Codec, getI64Decoder, getI64Encoder, getI8Codec, getI8Decoder, getI8Encoder, getShortU16Codec, getShortU16Decoder, getShortU16Encoder, getU128Codec, getU128Decoder, getU128Encoder, getU16Codec, getU16Decoder, getU16Encoder, getU32Codec, getU32Decoder, getU32Encoder, getU64Codec, getU64Decoder, getU64Encoder, getU8Codec, getU8Decoder, getU8Encoder };\n//# sourceMappingURL=index.browser.mjs.map\n//# sourceMappingURL=index.browser.mjs.map","/**\n * A `StructFailure` represents a single specific failure in validation.\n */\n/**\n * `StructError` objects are thrown (or returned) when validation fails.\n *\n * Validation logic is design to exit early for maximum performance. The error\n * represents the first error encountered during validation. For more detail,\n * the `error.failures` property is a generator function that can be run to\n * continue validation and receive all the failures in the data.\n */\nclass StructError extends TypeError {\n constructor(failure, failures) {\n let cached;\n const { message, explanation, ...rest } = failure;\n const { path } = failure;\n const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`;\n super(explanation ?? msg);\n if (explanation != null)\n this.cause = msg;\n Object.assign(this, rest);\n this.name = this.constructor.name;\n this.failures = () => {\n return (cached ?? (cached = [failure, ...failures()]));\n };\n }\n}\n\n/**\n * Check if a value is an iterator.\n */\nfunction isIterable(x) {\n return isObject(x) && typeof x[Symbol.iterator] === 'function';\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isObject(x) {\n return typeof x === 'object' && x != null;\n}\n/**\n * Check if a value is a non-array object.\n */\nfunction isNonArrayObject(x) {\n return isObject(x) && !Array.isArray(x);\n}\n/**\n * Check if a value is a plain object.\n */\nfunction isPlainObject(x) {\n if (Object.prototype.toString.call(x) !== '[object Object]') {\n return false;\n }\n const prototype = Object.getPrototypeOf(x);\n return prototype === null || prototype === Object.prototype;\n}\n/**\n * Return a value as a printable string.\n */\nfunction print(value) {\n if (typeof value === 'symbol') {\n return value.toString();\n }\n return typeof value === 'string' ? JSON.stringify(value) : `${value}`;\n}\n/**\n * Shifts (removes and returns) the first value from the `input` iterator.\n * Like `Array.prototype.shift()` but for an `Iterator`.\n */\nfunction shiftIterator(input) {\n const { done, value } = input.next();\n return done ? undefined : value;\n}\n/**\n * Convert a single validation result to a failure.\n */\nfunction toFailure(result, context, struct, value) {\n if (result === true) {\n return;\n }\n else if (result === false) {\n result = {};\n }\n else if (typeof result === 'string') {\n result = { message: result };\n }\n const { path, branch } = context;\n const { type } = struct;\n const { refinement, message = `Expected a value of type \\`${type}\\`${refinement ? ` with refinement \\`${refinement}\\`` : ''}, but received: \\`${print(value)}\\``, } = result;\n return {\n value,\n type,\n refinement,\n key: path[path.length - 1],\n path,\n branch,\n ...result,\n message,\n };\n}\n/**\n * Convert a validation result to an iterable of failures.\n */\nfunction* toFailures(result, context, struct, value) {\n if (!isIterable(result)) {\n result = [result];\n }\n for (const r of result) {\n const failure = toFailure(r, context, struct, value);\n if (failure) {\n yield failure;\n }\n }\n}\n/**\n * Check a value against a struct, traversing deeply into nested values, and\n * returning an iterator of failures or success.\n */\nfunction* run(value, struct, options = {}) {\n const { path = [], branch = [value], coerce = false, mask = false } = options;\n const ctx = { path, branch, mask };\n if (coerce) {\n value = struct.coercer(value, ctx);\n }\n let status = 'valid';\n for (const failure of struct.validator(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_valid';\n yield [failure, undefined];\n }\n for (let [k, v, s] of struct.entries(value, ctx)) {\n const ts = run(v, s, {\n path: k === undefined ? path : [...path, k],\n branch: k === undefined ? branch : [...branch, v],\n coerce,\n mask,\n message: options.message,\n });\n for (const t of ts) {\n if (t[0]) {\n status = t[0].refinement != null ? 'not_refined' : 'not_valid';\n yield [t[0], undefined];\n }\n else if (coerce) {\n v = t[1];\n if (k === undefined) {\n value = v;\n }\n else if (value instanceof Map) {\n value.set(k, v);\n }\n else if (value instanceof Set) {\n value.add(v);\n }\n else if (isObject(value)) {\n if (v !== undefined || k in value)\n value[k] = v;\n }\n }\n }\n }\n if (status !== 'not_valid') {\n for (const failure of struct.refiner(value, ctx)) {\n failure.explanation = options.message;\n status = 'not_refined';\n yield [failure, undefined];\n }\n }\n if (status === 'valid') {\n yield [undefined, value];\n }\n}\n\n/**\n * `Struct` objects encapsulate the validation logic for a specific type of\n * values. Once constructed, you use the `assert`, `is` or `validate` helpers to\n * validate unknown input data against the struct.\n */\nclass Struct {\n constructor(props) {\n const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props;\n this.type = type;\n this.schema = schema;\n this.entries = entries;\n this.coercer = coercer;\n if (validator) {\n this.validator = (value, context) => {\n const result = validator(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.validator = () => [];\n }\n if (refiner) {\n this.refiner = (value, context) => {\n const result = refiner(value, context);\n return toFailures(result, context, this, value);\n };\n }\n else {\n this.refiner = () => [];\n }\n }\n /**\n * Assert that a value passes the struct's validation, throwing if it doesn't.\n */\n assert(value, message) {\n return assert(value, this, message);\n }\n /**\n * Create a value with the struct's coercion logic, then validate it.\n */\n create(value, message) {\n return create(value, this, message);\n }\n /**\n * Check if a value passes the struct's validation.\n */\n is(value) {\n return is(value, this);\n }\n /**\n * Mask a value, coercing and validating it, but returning only the subset of\n * properties defined by the struct's schema. Masking applies recursively to\n * props of `object` structs only.\n */\n mask(value, message) {\n return mask(value, this, message);\n }\n /**\n * Validate a value with the struct's validation logic, returning a tuple\n * representing the result.\n *\n * You may optionally pass `true` for the `coerce` argument to coerce\n * the value before attempting to validate it. If you do, the result will\n * contain the coerced result when successful. Also, `mask` will turn on\n * masking of the unknown `object` props recursively if passed.\n */\n validate(value, options = {}) {\n return validate(value, this, options);\n }\n}\n/**\n * Assert that a value passes a struct, throwing if it doesn't.\n */\nfunction assert(value, struct, message) {\n const result = validate(value, struct, { message });\n if (result[0]) {\n throw result[0];\n }\n}\n/**\n * Create a value with the coercion logic of struct and validate it.\n */\nfunction create(value, struct, message) {\n const result = validate(value, struct, { coerce: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Mask a value, returning only the subset of properties defined by a struct.\n */\nfunction mask(value, struct, message) {\n const result = validate(value, struct, { coerce: true, mask: true, message });\n if (result[0]) {\n throw result[0];\n }\n else {\n return result[1];\n }\n}\n/**\n * Check if a value passes a struct.\n */\nfunction is(value, struct) {\n const result = validate(value, struct);\n return !result[0];\n}\n/**\n * Validate a value against a struct, returning an error if invalid, or the\n * value (with potential coercion) if valid.\n */\nfunction validate(value, struct, options = {}) {\n const tuples = run(value, struct, options);\n const tuple = shiftIterator(tuples);\n if (tuple[0]) {\n const error = new StructError(tuple[0], function* () {\n for (const t of tuples) {\n if (t[0]) {\n yield t[0];\n }\n }\n });\n return [error, undefined];\n }\n else {\n const v = tuple[1];\n return [undefined, v];\n }\n}\n\nfunction assign(...Structs) {\n const isType = Structs[0].type === 'type';\n const schemas = Structs.map((s) => s.schema);\n const schema = Object.assign({}, ...schemas);\n return isType ? type(schema) : object(schema);\n}\n/**\n * Define a new struct type with a custom validation function.\n */\nfunction define(name, validator) {\n return new Struct({ type: name, schema: null, validator });\n}\n/**\n * Create a new struct based on an existing struct, but the value is allowed to\n * be `undefined`. `log` will be called if the value is not `undefined`.\n */\nfunction deprecated(struct, log) {\n return new Struct({\n ...struct,\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n validator(value, ctx) {\n if (value === undefined) {\n return true;\n }\n else {\n log(value, ctx);\n return struct.validator(value, ctx);\n }\n },\n });\n}\n/**\n * Create a struct with dynamic validation logic.\n *\n * The callback will receive the value currently being validated, and must\n * return a struct object to validate it with. This can be useful to model\n * validation logic that changes based on its input.\n */\nfunction dynamic(fn) {\n return new Struct({\n type: 'dynamic',\n schema: null,\n *entries(value, ctx) {\n const struct = fn(value, ctx);\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n const struct = fn(value, ctx);\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n const struct = fn(value, ctx);\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n const struct = fn(value, ctx);\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a struct with lazily evaluated validation logic.\n *\n * The first time validation is run with the struct, the callback will be called\n * and must return a struct object to use. This is useful for cases where you\n * want to have self-referential structs for nested data structures to avoid a\n * circular definition problem.\n */\nfunction lazy(fn) {\n let struct;\n return new Struct({\n type: 'lazy',\n schema: null,\n *entries(value, ctx) {\n struct ?? (struct = fn());\n yield* struct.entries(value, ctx);\n },\n validator(value, ctx) {\n struct ?? (struct = fn());\n return struct.validator(value, ctx);\n },\n coercer(value, ctx) {\n struct ?? (struct = fn());\n return struct.coercer(value, ctx);\n },\n refiner(value, ctx) {\n struct ?? (struct = fn());\n return struct.refiner(value, ctx);\n },\n });\n}\n/**\n * Create a new struct based on an existing object struct, but excluding\n * specific properties.\n *\n * Like TypeScript's `Omit` utility.\n */\nfunction omit(struct, keys) {\n const { schema } = struct;\n const subschema = { ...schema };\n for (const key of keys) {\n delete subschema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Create a new struct based on an existing object struct, but with all of its\n * properties allowed to be `undefined`.\n *\n * Like TypeScript's `Partial` utility.\n */\nfunction partial(struct) {\n const isStruct = struct instanceof Struct;\n const schema = isStruct ? { ...struct.schema } : { ...struct };\n for (const key in schema) {\n schema[key] = optional(schema[key]);\n }\n if (isStruct && struct.type === 'type') {\n return type(schema);\n }\n return object(schema);\n}\n/**\n * Create a new struct based on an existing object struct, but only including\n * specific properties.\n *\n * Like TypeScript's `Pick` utility.\n */\nfunction pick(struct, keys) {\n const { schema } = struct;\n const subschema = {};\n for (const key of keys) {\n subschema[key] = schema[key];\n }\n switch (struct.type) {\n case 'type':\n return type(subschema);\n default:\n return object(subschema);\n }\n}\n/**\n * Define a new struct type with a custom validation function.\n *\n * @deprecated This function has been renamed to `define`.\n */\nfunction struct(name, validator) {\n console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.');\n return define(name, validator);\n}\n\n/**\n * Ensure that any value passes validation.\n */\nfunction any() {\n return define('any', () => true);\n}\nfunction array(Element) {\n return new Struct({\n type: 'array',\n schema: Element,\n *entries(value) {\n if (Element && Array.isArray(value)) {\n for (const [i, v] of value.entries()) {\n yield [i, v, Element];\n }\n }\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array value, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a bigint.\n */\nfunction bigint() {\n return define('bigint', (value) => {\n return typeof value === 'bigint';\n });\n}\n/**\n * Ensure that a value is a boolean.\n */\nfunction boolean() {\n return define('boolean', (value) => {\n return typeof value === 'boolean';\n });\n}\n/**\n * Ensure that a value is a valid `Date`.\n *\n * Note: this also ensures that the value is *not* an invalid `Date` object,\n * which can occur when parsing a date fails but still returns a `Date`.\n */\nfunction date() {\n return define('date', (value) => {\n return ((value instanceof Date && !isNaN(value.getTime())) ||\n `Expected a valid \\`Date\\` object, but received: ${print(value)}`);\n });\n}\nfunction enums(values) {\n const schema = {};\n const description = values.map((v) => print(v)).join();\n for (const key of values) {\n schema[key] = key;\n }\n return new Struct({\n type: 'enums',\n schema,\n validator(value) {\n return (values.includes(value) ||\n `Expected one of \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a function.\n */\nfunction func() {\n return define('func', (value) => {\n return (typeof value === 'function' ||\n `Expected a function, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an instance of a specific class.\n */\nfunction instance(Class) {\n return define('instance', (value) => {\n return (value instanceof Class ||\n `Expected a \\`${Class.name}\\` instance, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is an integer.\n */\nfunction integer() {\n return define('integer', (value) => {\n return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) ||\n `Expected an integer, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value matches all of a set of types.\n */\nfunction intersection(Structs) {\n return new Struct({\n type: 'intersection',\n schema: null,\n *entries(value, ctx) {\n for (const S of Structs) {\n yield* S.entries(value, ctx);\n }\n },\n *validator(value, ctx) {\n for (const S of Structs) {\n yield* S.validator(value, ctx);\n }\n },\n *refiner(value, ctx) {\n for (const S of Structs) {\n yield* S.refiner(value, ctx);\n }\n },\n });\n}\nfunction literal(constant) {\n const description = print(constant);\n const t = typeof constant;\n return new Struct({\n type: 'literal',\n schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null,\n validator(value) {\n return (value === constant ||\n `Expected the literal \\`${description}\\`, but received: ${print(value)}`);\n },\n });\n}\nfunction map(Key, Value) {\n return new Struct({\n type: 'map',\n schema: null,\n *entries(value) {\n if (Key && Value && value instanceof Map) {\n for (const [k, v] of value.entries()) {\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n coercer(value) {\n return value instanceof Map ? new Map(value) : value;\n },\n validator(value) {\n return (value instanceof Map ||\n `Expected a \\`Map\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that no value ever passes validation.\n */\nfunction never() {\n return define('never', () => false);\n}\n/**\n * Augment an existing struct to allow `null` values.\n */\nfunction nullable(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === null || struct.validator(value, ctx),\n refiner: (value, ctx) => value === null || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is a number.\n */\nfunction number() {\n return define('number', (value) => {\n return ((typeof value === 'number' && !isNaN(value)) ||\n `Expected a number, but received: ${print(value)}`);\n });\n}\nfunction object(schema) {\n const knowns = schema ? Object.keys(schema) : [];\n const Never = never();\n return new Struct({\n type: 'object',\n schema: schema ? schema : null,\n *entries(value) {\n if (schema && isObject(value)) {\n const unknowns = new Set(Object.keys(value));\n for (const key of knowns) {\n unknowns.delete(key);\n yield [key, value[key], schema[key]];\n }\n for (const key of unknowns) {\n yield [key, value[key], Never];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value, ctx) {\n if (!isNonArrayObject(value)) {\n return value;\n }\n const coerced = { ...value };\n // The `object` struct has special behaviour enabled by the mask flag.\n // When masking, properties that are not in the schema are deleted from\n // the coerced object instead of eventually failing validaiton.\n if (ctx.mask && schema) {\n for (const key in coerced) {\n if (schema[key] === undefined) {\n delete coerced[key];\n }\n }\n }\n return coerced;\n },\n });\n}\n/**\n * Augment a struct to allow `undefined` values.\n */\nfunction optional(struct) {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === undefined || struct.validator(value, ctx),\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n });\n}\n/**\n * Ensure that a value is an object with keys and values of specific types, but\n * without ensuring any specific shape of properties.\n *\n * Like TypeScript's `Record` utility.\n */\nfunction record(Key, Value) {\n return new Struct({\n type: 'record',\n schema: null,\n *entries(value) {\n if (isObject(value)) {\n for (const k in value) {\n const v = value[k];\n yield [k, k, Key];\n yield [k, v, Value];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value is a `RegExp`.\n *\n * Note: this does not test the value against the regular expression! For that\n * you need to use the `pattern()` refinement.\n */\nfunction regexp() {\n return define('regexp', (value) => {\n return value instanceof RegExp;\n });\n}\nfunction set(Element) {\n return new Struct({\n type: 'set',\n schema: null,\n *entries(value) {\n if (Element && value instanceof Set) {\n for (const v of value) {\n yield [v, v, Element];\n }\n }\n },\n coercer(value) {\n return value instanceof Set ? new Set(value) : value;\n },\n validator(value) {\n return (value instanceof Set ||\n `Expected a \\`Set\\` object, but received: ${print(value)}`);\n },\n });\n}\n/**\n * Ensure that a value is a string.\n */\nfunction string() {\n return define('string', (value) => {\n return (typeof value === 'string' ||\n `Expected a string, but received: ${print(value)}`);\n });\n}\n/**\n * Ensure that a value is a tuple of a specific length, and that each of its\n * elements is of a specific type.\n */\nfunction tuple(Structs) {\n const Never = never();\n return new Struct({\n type: 'tuple',\n schema: null,\n *entries(value) {\n if (Array.isArray(value)) {\n const length = Math.max(Structs.length, value.length);\n for (let i = 0; i < length; i++) {\n yield [i, value[i], Structs[i] || Never];\n }\n }\n },\n validator(value) {\n return (Array.isArray(value) ||\n `Expected an array, but received: ${print(value)}`);\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value;\n },\n });\n}\n/**\n * Ensure that a value has a set of known properties of specific types.\n *\n * Note: Unrecognized properties are allowed and untouched. This is similar to\n * how TypeScript's structural typing works.\n */\nfunction type(schema) {\n const keys = Object.keys(schema);\n return new Struct({\n type: 'type',\n schema,\n *entries(value) {\n if (isObject(value)) {\n for (const k of keys) {\n yield [k, value[k], schema[k]];\n }\n }\n },\n validator(value) {\n return (isNonArrayObject(value) ||\n `Expected an object, but received: ${print(value)}`);\n },\n coercer(value) {\n return isNonArrayObject(value) ? { ...value } : value;\n },\n });\n}\n/**\n * Ensure that a value matches one of a set of types.\n */\nfunction union(Structs) {\n const description = Structs.map((s) => s.type).join(' | ');\n return new Struct({\n type: 'union',\n schema: null,\n coercer(value, ctx) {\n for (const S of Structs) {\n const [error, coerced] = S.validate(value, {\n coerce: true,\n mask: ctx.mask,\n });\n if (!error) {\n return coerced;\n }\n }\n return value;\n },\n validator(value, ctx) {\n const failures = [];\n for (const S of Structs) {\n const [...tuples] = run(value, S, ctx);\n const [first] = tuples;\n if (!first[0]) {\n return [];\n }\n else {\n for (const [failure] of tuples) {\n if (failure) {\n failures.push(failure);\n }\n }\n }\n }\n return [\n `Expected the value to satisfy a union of \\`${description}\\`, but received: ${print(value)}`,\n ...failures,\n ];\n },\n });\n}\n/**\n * Ensure that any value passes validation, without widening its type to `any`.\n */\nfunction unknown() {\n return define('unknown', () => true);\n}\n\n/**\n * Augment a `Struct` to add an additional coercion step to its input.\n *\n * This allows you to transform input data before validating it, to increase the\n * likelihood that it passes validation—for example for default values, parsing\n * different formats, etc.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction coerce(struct, condition, coercer) {\n return new Struct({\n ...struct,\n coercer: (value, ctx) => {\n return is(value, condition)\n ? struct.coercer(coercer(value, ctx), ctx)\n : struct.coercer(value, ctx);\n },\n });\n}\n/**\n * Augment a struct to replace `undefined` values with a default.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction defaulted(struct, fallback, options = {}) {\n return coerce(struct, unknown(), (x) => {\n const f = typeof fallback === 'function' ? fallback() : fallback;\n if (x === undefined) {\n return f;\n }\n if (!options.strict && isPlainObject(x) && isPlainObject(f)) {\n const ret = { ...x };\n let changed = false;\n for (const key in f) {\n if (ret[key] === undefined) {\n ret[key] = f[key];\n changed = true;\n }\n }\n if (changed) {\n return ret;\n }\n }\n return x;\n });\n}\n/**\n * Augment a struct to trim string inputs.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\nfunction trimmed(struct) {\n return coerce(struct, string(), (x) => x.trim());\n}\n\n/**\n * Ensure that a string, array, map, or set is empty.\n */\nfunction empty(struct) {\n return refine(struct, 'empty', (value) => {\n const size = getSize(value);\n return (size === 0 ||\n `Expected an empty ${struct.type} but received one with a size of \\`${size}\\``);\n });\n}\nfunction getSize(value) {\n if (value instanceof Map || value instanceof Set) {\n return value.size;\n }\n else {\n return value.length;\n }\n}\n/**\n * Ensure that a number or date is below a threshold.\n */\nfunction max(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'max', (value) => {\n return exclusive\n ? value < threshold\n : value <= threshold ||\n `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a number or date is above a threshold.\n */\nfunction min(struct, threshold, options = {}) {\n const { exclusive } = options;\n return refine(struct, 'min', (value) => {\n return exclusive\n ? value > threshold\n : value >= threshold ||\n `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \\`${value}\\``;\n });\n}\n/**\n * Ensure that a string, array, map or set is not empty.\n */\nfunction nonempty(struct) {\n return refine(struct, 'nonempty', (value) => {\n const size = getSize(value);\n return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`);\n });\n}\n/**\n * Ensure that a string matches a regular expression.\n */\nfunction pattern(struct, regexp) {\n return refine(struct, 'pattern', (value) => {\n return (regexp.test(value) ||\n `Expected a ${struct.type} matching \\`/${regexp.source}/\\` but received \"${value}\"`);\n });\n}\n/**\n * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.\n */\nfunction size(struct, min, max = min) {\n const expected = `Expected a ${struct.type}`;\n const of = min === max ? `of \\`${min}\\`` : `between \\`${min}\\` and \\`${max}\\``;\n return refine(struct, 'size', (value) => {\n if (typeof value === 'number' || value instanceof Date) {\n return ((min <= value && value <= max) ||\n `${expected} ${of} but received \\`${value}\\``);\n }\n else if (value instanceof Map || value instanceof Set) {\n const { size } = value;\n return ((min <= size && size <= max) ||\n `${expected} with a size ${of} but received one with a size of \\`${size}\\``);\n }\n else {\n const { length } = value;\n return ((min <= length && length <= max) ||\n `${expected} with a length ${of} but received one with a length of \\`${length}\\``);\n }\n });\n}\n/**\n * Augment a `Struct` to add an additional refinement to the validation.\n *\n * The refiner function is guaranteed to receive a value of the struct's type,\n * because the struct's existing validation will already have passed. This\n * allows you to layer additional validation on top of existing structs.\n */\nfunction refine(struct, name, refiner) {\n return new Struct({\n ...struct,\n *refiner(value, ctx) {\n yield* struct.refiner(value, ctx);\n const result = refiner(value, ctx);\n const failures = toFailures(result, ctx, struct, value);\n for (const failure of failures) {\n yield { ...failure, refinement: name };\n }\n },\n });\n}\n\nexport { Struct, StructError, any, array, assert, assign, bigint, boolean, coerce, create, date, defaulted, define, deprecated, dynamic, empty, enums, func, instance, integer, intersection, is, lazy, literal, map, mask, max, min, never, nonempty, nullable, number, object, omit, optional, partial, pattern, pick, record, refine, regexp, set, size, string, struct, trimmed, tuple, type, union, unknown, validate };\n//# sourceMappingURL=index.mjs.map\n","import { Buffer } from 'buffer';\nimport { EventEmitter } from 'eventemitter3';\n\n// node_modules/esbuild-plugin-polyfill-node/polyfills/buffer.js\nvar WebSocketBrowserImpl = class extends EventEmitter {\n socket;\n /** Instantiate a WebSocket class\n * @constructor\n * @param {String} address - url to a websocket server\n * @param {WebSocketBrowserOptions} options - websocket options\n * @return {WebSocketBrowserImpl} - returns a WebSocket instance\n */\n constructor(address, options) {\n super();\n this.socket = new window.WebSocket(address, options.protocols);\n this.socket.onopen = () => this.emit(\"open\");\n this.socket.onmessage = (event) => this.emit(\"message\", event.data);\n this.socket.onerror = (error) => this.emit(\"error\", error);\n this.socket.onclose = (event) => {\n this.emit(\"close\", event.code, event.reason);\n };\n }\n /**\n * Sends data through a websocket connection\n * @method\n * @param {(String|Object)} data - data to be sent via websocket\n * @param {Object} optionsOrCallback - ws options\n * @param {Function} callback - a callback called once the data is sent\n * @return {Undefined}\n */\n send(data, optionsOrCallback, callback) {\n const cb = callback || optionsOrCallback;\n try {\n this.socket.send(data);\n cb();\n } catch (error) {\n cb(error);\n }\n }\n /**\n * Closes an underlying socket\n * @method\n * @param {Number} code - status code explaining why the connection is being closed\n * @param {String} reason - a description why the connection is closing\n * @return {Undefined}\n * @throws {Error}\n */\n close(code, reason) {\n this.socket.close(code, reason);\n }\n addEventListener(type, listener, options) {\n this.socket.addEventListener(type, listener, options);\n }\n};\nfunction WebSocket(address, options) {\n return new WebSocketBrowserImpl(address, options);\n}\n\n// src/lib/utils.ts\nvar DefaultDataPack = class {\n encode(value) {\n return JSON.stringify(value);\n }\n decode(value) {\n return JSON.parse(value);\n }\n};\n\n// src/lib/client.ts\nvar CommonClient = class extends EventEmitter {\n address;\n rpc_id;\n queue;\n options;\n autoconnect;\n ready;\n reconnect;\n reconnect_timer_id;\n reconnect_interval;\n max_reconnects;\n rest_options;\n current_reconnects;\n generate_request_id;\n socket;\n webSocketFactory;\n dataPack;\n /**\n * Instantiate a Client class.\n * @constructor\n * @param {webSocketFactory} webSocketFactory - factory method for WebSocket\n * @param {String} address - url to a websocket server\n * @param {Object} options - ws options object with reconnect parameters\n * @param {Function} generate_request_id - custom generation request Id\n * @param {DataPack} dataPack - data pack contains encoder and decoder\n * @return {CommonClient}\n */\n constructor(webSocketFactory, address = \"ws://localhost:8080\", {\n autoconnect = true,\n reconnect = true,\n reconnect_interval = 1e3,\n max_reconnects = 5,\n ...rest_options\n } = {}, generate_request_id, dataPack) {\n super();\n this.webSocketFactory = webSocketFactory;\n this.queue = {};\n this.rpc_id = 0;\n this.address = address;\n this.autoconnect = autoconnect;\n this.ready = false;\n this.reconnect = reconnect;\n this.reconnect_timer_id = void 0;\n this.reconnect_interval = reconnect_interval;\n this.max_reconnects = max_reconnects;\n this.rest_options = rest_options;\n this.current_reconnects = 0;\n this.generate_request_id = generate_request_id || (() => typeof this.rpc_id === \"number\" ? ++this.rpc_id : Number(this.rpc_id) + 1);\n if (!dataPack) this.dataPack = new DefaultDataPack();\n else this.dataPack = dataPack;\n if (this.autoconnect)\n this._connect(this.address, {\n autoconnect: this.autoconnect,\n reconnect: this.reconnect,\n reconnect_interval: this.reconnect_interval,\n max_reconnects: this.max_reconnects,\n ...this.rest_options\n });\n }\n /**\n * Connects to a defined server if not connected already.\n * @method\n * @return {Undefined}\n */\n connect() {\n if (this.socket) return;\n this._connect(this.address, {\n autoconnect: this.autoconnect,\n reconnect: this.reconnect,\n reconnect_interval: this.reconnect_interval,\n max_reconnects: this.max_reconnects,\n ...this.rest_options\n });\n }\n /**\n * Calls a registered RPC method on server.\n * @method\n * @param {String} method - RPC method name\n * @param {Object|Array} params - optional method parameters\n * @param {Number} timeout - RPC reply timeout value\n * @param {Object} ws_opts - options passed to ws\n * @return {Promise}\n */\n call(method, params, timeout, ws_opts) {\n if (!ws_opts && \"object\" === typeof timeout) {\n ws_opts = timeout;\n timeout = null;\n }\n return new Promise((resolve, reject) => {\n if (!this.ready) return reject(new Error(\"socket not ready\"));\n const rpc_id = this.generate_request_id(method, params);\n const message = {\n jsonrpc: \"2.0\",\n method,\n params: params || void 0,\n id: rpc_id\n };\n this.socket.send(this.dataPack.encode(message), ws_opts, (error) => {\n if (error) return reject(error);\n this.queue[rpc_id] = { promise: [resolve, reject] };\n if (timeout) {\n this.queue[rpc_id].timeout = setTimeout(() => {\n delete this.queue[rpc_id];\n reject(new Error(\"reply timeout\"));\n }, timeout);\n }\n });\n });\n }\n /**\n * Logins with the other side of the connection.\n * @method\n * @param {Object} params - Login credentials object\n * @return {Promise}\n */\n async login(params) {\n const resp = await this.call(\"rpc.login\", params);\n if (!resp) throw new Error(\"authentication failed\");\n return resp;\n }\n /**\n * Fetches a list of client's methods registered on server.\n * @method\n * @return {Array}\n */\n async listMethods() {\n return await this.call(\"__listMethods\");\n }\n /**\n * Sends a JSON-RPC 2.0 notification to server.\n * @method\n * @param {String} method - RPC method name\n * @param {Object} params - optional method parameters\n * @return {Promise}\n */\n notify(method, params) {\n return new Promise((resolve, reject) => {\n if (!this.ready) return reject(new Error(\"socket not ready\"));\n const message = {\n jsonrpc: \"2.0\",\n method,\n params\n };\n this.socket.send(this.dataPack.encode(message), (error) => {\n if (error) return reject(error);\n resolve();\n });\n });\n }\n /**\n * Subscribes for a defined event.\n * @method\n * @param {String|Array} event - event name\n * @return {Undefined}\n * @throws {Error}\n */\n async subscribe(event) {\n if (typeof event === \"string\") event = [event];\n const result = await this.call(\"rpc.on\", event);\n if (typeof event === \"string\" && result[event] !== \"ok\")\n throw new Error(\n \"Failed subscribing to an event '\" + event + \"' with: \" + result[event]\n );\n return result;\n }\n /**\n * Unsubscribes from a defined event.\n * @method\n * @param {String|Array} event - event name\n * @return {Undefined}\n * @throws {Error}\n */\n async unsubscribe(event) {\n if (typeof event === \"string\") event = [event];\n const result = await this.call(\"rpc.off\", event);\n if (typeof event === \"string\" && result[event] !== \"ok\")\n throw new Error(\"Failed unsubscribing from an event with: \" + result);\n return result;\n }\n /**\n * Closes a WebSocket connection gracefully.\n * @method\n * @param {Number} code - socket close code\n * @param {String} data - optional data to be sent before closing\n * @return {Undefined}\n */\n close(code, data) {\n if (this.socket) this.socket.close(code || 1e3, data);\n }\n /**\n * Enable / disable automatic reconnection.\n * @method\n * @param {Boolean} reconnect - enable / disable reconnection\n * @return {Undefined}\n */\n setAutoReconnect(reconnect) {\n this.reconnect = reconnect;\n }\n /**\n * Set the interval between reconnection attempts.\n * @method\n * @param {Number} interval - reconnection interval in milliseconds\n * @return {Undefined}\n */\n setReconnectInterval(interval) {\n this.reconnect_interval = interval;\n }\n /**\n * Set the maximum number of reconnection attempts.\n * @method\n * @param {Number} max_reconnects - maximum reconnection attempts\n * @return {Undefined}\n */\n setMaxReconnects(max_reconnects) {\n this.max_reconnects = max_reconnects;\n }\n /**\n * Get the current number of reconnection attempts made.\n * @method\n * @return {Number} current reconnection attempts\n */\n getCurrentReconnects() {\n return this.current_reconnects;\n }\n /**\n * Get the maximum number of reconnection attempts.\n * @method\n * @return {Number} maximum reconnection attempts\n */\n getMaxReconnects() {\n return this.max_reconnects;\n }\n /**\n * Check if the client is currently attempting to reconnect.\n * @method\n * @return {Boolean} true if reconnection is in progress\n */\n isReconnecting() {\n return this.reconnect_timer_id !== void 0;\n }\n /**\n * Check if the client will attempt to reconnect on the next close event.\n * @method\n * @return {Boolean} true if reconnection will be attempted\n */\n willReconnect() {\n return this.reconnect && (this.max_reconnects === 0 || this.current_reconnects < this.max_reconnects);\n }\n /**\n * Connection/Message handler.\n * @method\n * @private\n * @param {String} address - WebSocket API address\n * @param {Object} options - ws options object\n * @return {Undefined}\n */\n _connect(address, options) {\n clearTimeout(this.reconnect_timer_id);\n this.socket = this.webSocketFactory(address, options);\n this.socket.addEventListener(\"open\", () => {\n this.ready = true;\n this.emit(\"open\");\n this.current_reconnects = 0;\n });\n this.socket.addEventListener(\"message\", ({ data: message }) => {\n if (message instanceof ArrayBuffer)\n message = Buffer.from(message).toString();\n try {\n message = this.dataPack.decode(message);\n } catch (error) {\n return;\n }\n if (message.notification && this.listeners(message.notification).length) {\n if (!Object.keys(message.params).length)\n return this.emit(message.notification);\n const args = [message.notification];\n if (message.params.constructor === Object) args.push(message.params);\n else\n for (let i = 0; i < message.params.length; i++)\n args.push(message.params[i]);\n return Promise.resolve().then(() => {\n this.emit.apply(this, args);\n });\n }\n if (!this.queue[message.id]) {\n if (message.method) {\n return Promise.resolve().then(() => {\n this.emit(message.method, message?.params);\n });\n }\n return;\n }\n if (\"error\" in message === \"result\" in message)\n this.queue[message.id].promise[1](\n new Error(\n 'Server response malformed. Response must include either \"result\" or \"error\", but not both.'\n )\n );\n if (this.queue[message.id].timeout)\n clearTimeout(this.queue[message.id].timeout);\n if (message.error) this.queue[message.id].promise[1](message.error);\n else this.queue[message.id].promise[0](message.result);\n delete this.queue[message.id];\n });\n this.socket.addEventListener(\"error\", (error) => this.emit(\"error\", error));\n this.socket.addEventListener(\"close\", ({ code, reason }) => {\n if (this.ready)\n setTimeout(() => this.emit(\"close\", code, reason), 0);\n this.ready = false;\n this.socket = void 0;\n if (code === 1e3) return;\n this.current_reconnects++;\n if (this.reconnect && (this.max_reconnects > this.current_reconnects || this.max_reconnects === 0))\n this.reconnect_timer_id = setTimeout(\n () => this._connect(address, options),\n this.reconnect_interval\n );\n else if (this.reconnect && this.max_reconnects > 0 && this.current_reconnects >= this.max_reconnects) {\n setTimeout(() => this.emit(\"max_reconnects_reached\", code, reason), 1);\n }\n });\n }\n};\n\n// src/index.browser.ts\nvar Client = class extends CommonClient {\n constructor(address = \"ws://localhost:8080\", {\n autoconnect = true,\n reconnect = true,\n reconnect_interval = 1e3,\n max_reconnects = 5,\n ...rest_options\n } = {}, generate_request_id) {\n super(\n WebSocket,\n address,\n {\n autoconnect,\n reconnect,\n reconnect_interval,\n max_reconnects,\n ...rest_options\n },\n generate_request_id\n );\n }\n};\n\nexport { Client, CommonClient, DefaultDataPack, WebSocket };\n//# sourceMappingURL=index.browser.mjs.map\n//# sourceMappingURL=index.browser.mjs.map","import { Buffer } from 'buffer';\nimport { ed25519 } from '@noble/curves/ed25519';\nimport BN from 'bn.js';\nimport bs58 from 'bs58';\nimport { sha256 } from '@noble/hashes/sha256';\nimport { serialize, deserialize, deserializeUnchecked } from 'borsh';\nimport * as BufferLayout from '@solana/buffer-layout';\nimport { blob } from '@solana/buffer-layout';\nimport { getU64Codec, getU64Encoder } from '@solana/codecs-numbers';\nimport { coerce, instance, string, tuple, literal, unknown, type, number, array, nullable, optional, boolean, record, union, create, any, assert as assert$1 } from 'superstruct';\nimport RpcClient from 'jayson/lib/client/browser';\nimport { CommonClient, WebSocket } from 'rpc-websockets';\nimport { keccak_256 } from '@noble/hashes/sha3';\nimport { secp256k1 } from '@noble/curves/secp256k1';\n\n/**\n * A 64 byte secret key, the first 32 bytes of which is the\n * private scalar and the last 32 bytes is the public key.\n * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/\n */\n\n/**\n * Ed25519 Keypair\n */\n\nconst generatePrivateKey = ed25519.utils.randomPrivateKey;\nconst generateKeypair = () => {\n const privateScalar = ed25519.utils.randomPrivateKey();\n const publicKey = getPublicKey(privateScalar);\n const secretKey = new Uint8Array(64);\n secretKey.set(privateScalar);\n secretKey.set(publicKey, 32);\n return {\n publicKey,\n secretKey\n };\n};\nconst getPublicKey = ed25519.getPublicKey;\nfunction isOnCurve(publicKey) {\n try {\n ed25519.ExtendedPoint.fromHex(publicKey);\n return true;\n } catch {\n return false;\n }\n}\nconst sign = (message, secretKey) => ed25519.sign(message, secretKey.slice(0, 32));\nconst verify = ed25519.verify;\n\nconst toBuffer = arr => {\n if (Buffer.isBuffer(arr)) {\n return arr;\n } else if (arr instanceof Uint8Array) {\n return Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength);\n } else {\n return Buffer.from(arr);\n }\n};\n\n// Class wrapping a plain object\nclass Struct {\n constructor(properties) {\n Object.assign(this, properties);\n }\n encode() {\n return Buffer.from(serialize(SOLANA_SCHEMA, this));\n }\n static decode(data) {\n return deserialize(SOLANA_SCHEMA, this, data);\n }\n static decodeUnchecked(data) {\n return deserializeUnchecked(SOLANA_SCHEMA, this, data);\n }\n}\n\n// Class representing a Rust-compatible enum, since enums are only strings or\n// numbers in pure JS\nclass Enum extends Struct {\n constructor(properties) {\n super(properties);\n this.enum = '';\n if (Object.keys(properties).length !== 1) {\n throw new Error('Enum can only take single value');\n }\n Object.keys(properties).map(key => {\n this.enum = key;\n });\n }\n}\nconst SOLANA_SCHEMA = new Map();\n\nvar _PublicKey;\n\n/**\n * Maximum length of derived pubkey seed\n */\nconst MAX_SEED_LENGTH = 32;\n\n/**\n * Size of public key in bytes\n */\nconst PUBLIC_KEY_LENGTH = 32;\n\n/**\n * Value to be converted into public key\n */\n\n/**\n * JSON object representation of PublicKey class\n */\n\nfunction isPublicKeyData(value) {\n return value._bn !== undefined;\n}\n\n// local counter used by PublicKey.unique()\nlet uniquePublicKeyCounter = 1;\n\n/**\n * A public key\n */\nclass PublicKey extends Struct {\n /**\n * Create a new PublicKey object\n * @param value ed25519 public key as buffer or base-58 encoded string\n */\n constructor(value) {\n super({});\n /** @internal */\n this._bn = void 0;\n if (isPublicKeyData(value)) {\n this._bn = value._bn;\n } else {\n if (typeof value === 'string') {\n // assume base 58 encoding by default\n const decoded = bs58.decode(value);\n if (decoded.length != PUBLIC_KEY_LENGTH) {\n throw new Error(`Invalid public key input`);\n }\n this._bn = new BN(decoded);\n } else {\n this._bn = new BN(value);\n }\n if (this._bn.byteLength() > PUBLIC_KEY_LENGTH) {\n throw new Error(`Invalid public key input`);\n }\n }\n }\n\n /**\n * Returns a unique PublicKey for tests and benchmarks using a counter\n */\n static unique() {\n const key = new PublicKey(uniquePublicKeyCounter);\n uniquePublicKeyCounter += 1;\n return new PublicKey(key.toBuffer());\n }\n\n /**\n * Default public key value. The base58-encoded string representation is all ones (as seen below)\n * The underlying BN number is 32 bytes that are all zeros\n */\n\n /**\n * Checks if two publicKeys are equal\n */\n equals(publicKey) {\n return this._bn.eq(publicKey._bn);\n }\n\n /**\n * Return the base-58 representation of the public key\n */\n toBase58() {\n return bs58.encode(this.toBytes());\n }\n toJSON() {\n return this.toBase58();\n }\n\n /**\n * Return the byte array representation of the public key in big endian\n */\n toBytes() {\n const buf = this.toBuffer();\n return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength);\n }\n\n /**\n * Return the Buffer representation of the public key in big endian\n */\n toBuffer() {\n const b = this._bn.toArrayLike(Buffer);\n if (b.length === PUBLIC_KEY_LENGTH) {\n return b;\n }\n const zeroPad = Buffer.alloc(32);\n b.copy(zeroPad, 32 - b.length);\n return zeroPad;\n }\n get [Symbol.toStringTag]() {\n return `PublicKey(${this.toString()})`;\n }\n\n /**\n * Return the base-58 representation of the public key\n */\n toString() {\n return this.toBase58();\n }\n\n /**\n * Derive a public key from another key, a seed, and a program ID.\n * The program ID will also serve as the owner of the public key, giving\n * it permission to write data to the account.\n */\n /* eslint-disable require-await */\n static async createWithSeed(fromPublicKey, seed, programId) {\n const buffer = Buffer.concat([fromPublicKey.toBuffer(), Buffer.from(seed), programId.toBuffer()]);\n const publicKeyBytes = sha256(buffer);\n return new PublicKey(publicKeyBytes);\n }\n\n /**\n * Derive a program address from seeds and a program ID.\n */\n /* eslint-disable require-await */\n static createProgramAddressSync(seeds, programId) {\n let buffer = Buffer.alloc(0);\n seeds.forEach(function (seed) {\n if (seed.length > MAX_SEED_LENGTH) {\n throw new TypeError(`Max seed length exceeded`);\n }\n buffer = Buffer.concat([buffer, toBuffer(seed)]);\n });\n buffer = Buffer.concat([buffer, programId.toBuffer(), Buffer.from('ProgramDerivedAddress')]);\n const publicKeyBytes = sha256(buffer);\n if (isOnCurve(publicKeyBytes)) {\n throw new Error(`Invalid seeds, address must fall off the curve`);\n }\n return new PublicKey(publicKeyBytes);\n }\n\n /**\n * Async version of createProgramAddressSync\n * For backwards compatibility\n *\n * @deprecated Use {@link createProgramAddressSync} instead\n */\n /* eslint-disable require-await */\n static async createProgramAddress(seeds, programId) {\n return this.createProgramAddressSync(seeds, programId);\n }\n\n /**\n * Find a valid program address\n *\n * Valid program addresses must fall off the ed25519 curve. This function\n * iterates a nonce until it finds one that when combined with the seeds\n * results in a valid program address.\n */\n static findProgramAddressSync(seeds, programId) {\n let nonce = 255;\n let address;\n while (nonce != 0) {\n try {\n const seedsWithNonce = seeds.concat(Buffer.from([nonce]));\n address = this.createProgramAddressSync(seedsWithNonce, programId);\n } catch (err) {\n if (err instanceof TypeError) {\n throw err;\n }\n nonce--;\n continue;\n }\n return [address, nonce];\n }\n throw new Error(`Unable to find a viable program address nonce`);\n }\n\n /**\n * Async version of findProgramAddressSync\n * For backwards compatibility\n *\n * @deprecated Use {@link findProgramAddressSync} instead\n */\n static async findProgramAddress(seeds, programId) {\n return this.findProgramAddressSync(seeds, programId);\n }\n\n /**\n * Check that a pubkey is on the ed25519 curve.\n */\n static isOnCurve(pubkeyData) {\n const pubkey = new PublicKey(pubkeyData);\n return isOnCurve(pubkey.toBytes());\n }\n}\n_PublicKey = PublicKey;\nPublicKey.default = new _PublicKey('11111111111111111111111111111111');\nSOLANA_SCHEMA.set(PublicKey, {\n kind: 'struct',\n fields: [['_bn', 'u256']]\n});\n\n/**\n * An account key pair (public and secret keys).\n *\n * @deprecated since v1.10.0, please use {@link Keypair} instead.\n */\nclass Account {\n /**\n * Create a new Account object\n *\n * If the secretKey parameter is not provided a new key pair is randomly\n * created for the account\n *\n * @param secretKey Secret key for the account\n */\n constructor(secretKey) {\n /** @internal */\n this._publicKey = void 0;\n /** @internal */\n this._secretKey = void 0;\n if (secretKey) {\n const secretKeyBuffer = toBuffer(secretKey);\n if (secretKey.length !== 64) {\n throw new Error('bad secret key size');\n }\n this._publicKey = secretKeyBuffer.slice(32, 64);\n this._secretKey = secretKeyBuffer.slice(0, 32);\n } else {\n this._secretKey = toBuffer(generatePrivateKey());\n this._publicKey = toBuffer(getPublicKey(this._secretKey));\n }\n }\n\n /**\n * The public key for this account\n */\n get publicKey() {\n return new PublicKey(this._publicKey);\n }\n\n /**\n * The **unencrypted** secret key for this account. The first 32 bytes\n * is the private scalar and the last 32 bytes is the public key.\n * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/\n */\n get secretKey() {\n return Buffer.concat([this._secretKey, this._publicKey], 64);\n }\n}\n\nconst BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader1111111111111111111111111111111111');\n\n/**\n * Maximum over-the-wire size of a Transaction\n *\n * 1280 is IPv6 minimum MTU\n * 40 bytes is the size of the IPv6 header\n * 8 bytes is the size of the fragment header\n */\nconst PACKET_DATA_SIZE = 1280 - 40 - 8;\nconst VERSION_PREFIX_MASK = 0x7f;\nconst SIGNATURE_LENGTH_IN_BYTES = 64;\n\nclass TransactionExpiredBlockheightExceededError extends Error {\n constructor(signature) {\n super(`Signature ${signature} has expired: block height exceeded.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredBlockheightExceededError.prototype, 'name', {\n value: 'TransactionExpiredBlockheightExceededError'\n});\nclass TransactionExpiredTimeoutError extends Error {\n constructor(signature, timeoutSeconds) {\n super(`Transaction was not confirmed in ${timeoutSeconds.toFixed(2)} seconds. It is ` + 'unknown if it succeeded or failed. Check signature ' + `${signature} using the Solana Explorer or CLI tools.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredTimeoutError.prototype, 'name', {\n value: 'TransactionExpiredTimeoutError'\n});\nclass TransactionExpiredNonceInvalidError extends Error {\n constructor(signature) {\n super(`Signature ${signature} has expired: the nonce is no longer valid.`);\n this.signature = void 0;\n this.signature = signature;\n }\n}\nObject.defineProperty(TransactionExpiredNonceInvalidError.prototype, 'name', {\n value: 'TransactionExpiredNonceInvalidError'\n});\n\nclass MessageAccountKeys {\n constructor(staticAccountKeys, accountKeysFromLookups) {\n this.staticAccountKeys = void 0;\n this.accountKeysFromLookups = void 0;\n this.staticAccountKeys = staticAccountKeys;\n this.accountKeysFromLookups = accountKeysFromLookups;\n }\n keySegments() {\n const keySegments = [this.staticAccountKeys];\n if (this.accountKeysFromLookups) {\n keySegments.push(this.accountKeysFromLookups.writable);\n keySegments.push(this.accountKeysFromLookups.readonly);\n }\n return keySegments;\n }\n get(index) {\n for (const keySegment of this.keySegments()) {\n if (index < keySegment.length) {\n return keySegment[index];\n } else {\n index -= keySegment.length;\n }\n }\n return;\n }\n get length() {\n return this.keySegments().flat().length;\n }\n compileInstructions(instructions) {\n // Bail early if any account indexes would overflow a u8\n const U8_MAX = 255;\n if (this.length > U8_MAX + 1) {\n throw new Error('Account index overflow encountered during compilation');\n }\n const keyIndexMap = new Map();\n this.keySegments().flat().forEach((key, index) => {\n keyIndexMap.set(key.toBase58(), index);\n });\n const findKeyIndex = key => {\n const keyIndex = keyIndexMap.get(key.toBase58());\n if (keyIndex === undefined) throw new Error('Encountered an unknown instruction account key during compilation');\n return keyIndex;\n };\n return instructions.map(instruction => {\n return {\n programIdIndex: findKeyIndex(instruction.programId),\n accountKeyIndexes: instruction.keys.map(meta => findKeyIndex(meta.pubkey)),\n data: instruction.data\n };\n });\n }\n}\n\n/**\n * Layout for a public key\n */\nconst publicKey = (property = 'publicKey') => {\n return BufferLayout.blob(32, property);\n};\n\n/**\n * Layout for a signature\n */\nconst signature = (property = 'signature') => {\n return BufferLayout.blob(64, property);\n};\n/**\n * Layout for a Rust String type\n */\nconst rustString = (property = 'string') => {\n const rsl = BufferLayout.struct([BufferLayout.u32('length'), BufferLayout.u32('lengthPadding'), BufferLayout.blob(BufferLayout.offset(BufferLayout.u32(), -8), 'chars')], property);\n const _decode = rsl.decode.bind(rsl);\n const _encode = rsl.encode.bind(rsl);\n const rslShim = rsl;\n rslShim.decode = (b, offset) => {\n const data = _decode(b, offset);\n return data['chars'].toString();\n };\n rslShim.encode = (str, b, offset) => {\n const data = {\n chars: Buffer.from(str, 'utf8')\n };\n return _encode(data, b, offset);\n };\n rslShim.alloc = str => {\n return BufferLayout.u32().span + BufferLayout.u32().span + Buffer.from(str, 'utf8').length;\n };\n return rslShim;\n};\n\n/**\n * Layout for an Authorized object\n */\nconst authorized = (property = 'authorized') => {\n return BufferLayout.struct([publicKey('staker'), publicKey('withdrawer')], property);\n};\n\n/**\n * Layout for a Lockup object\n */\nconst lockup = (property = 'lockup') => {\n return BufferLayout.struct([BufferLayout.ns64('unixTimestamp'), BufferLayout.ns64('epoch'), publicKey('custodian')], property);\n};\n\n/**\n * Layout for a VoteInit object\n */\nconst voteInit = (property = 'voteInit') => {\n return BufferLayout.struct([publicKey('nodePubkey'), publicKey('authorizedVoter'), publicKey('authorizedWithdrawer'), BufferLayout.u8('commission')], property);\n};\n\n/**\n * Layout for a VoteAuthorizeWithSeedArgs object\n */\nconst voteAuthorizeWithSeedArgs = (property = 'voteAuthorizeWithSeedArgs') => {\n return BufferLayout.struct([BufferLayout.u32('voteAuthorizationType'), publicKey('currentAuthorityDerivedKeyOwnerPubkey'), rustString('currentAuthorityDerivedKeySeed'), publicKey('newAuthorized')], property);\n};\nfunction getAlloc(type, fields) {\n const getItemAlloc = item => {\n if (item.span >= 0) {\n return item.span;\n } else if (typeof item.alloc === 'function') {\n return item.alloc(fields[item.property]);\n } else if ('count' in item && 'elementLayout' in item) {\n const field = fields[item.property];\n if (Array.isArray(field)) {\n return field.length * getItemAlloc(item.elementLayout);\n }\n } else if ('fields' in item) {\n // This is a `Structure` whose size needs to be recursively measured.\n return getAlloc({\n layout: item\n }, fields[item.property]);\n }\n // Couldn't determine allocated size of layout\n return 0;\n };\n let alloc = 0;\n type.layout.fields.forEach(item => {\n alloc += getItemAlloc(item);\n });\n return alloc;\n}\n\nfunction decodeLength(bytes) {\n let len = 0;\n let size = 0;\n for (;;) {\n let elem = bytes.shift();\n len |= (elem & 0x7f) << size * 7;\n size += 1;\n if ((elem & 0x80) === 0) {\n break;\n }\n }\n return len;\n}\nfunction encodeLength(bytes, len) {\n let rem_len = len;\n for (;;) {\n let elem = rem_len & 0x7f;\n rem_len >>= 7;\n if (rem_len == 0) {\n bytes.push(elem);\n break;\n } else {\n elem |= 0x80;\n bytes.push(elem);\n }\n }\n}\n\nfunction assert (condition, message) {\n if (!condition) {\n throw new Error(message || 'Assertion failed');\n }\n}\n\nclass CompiledKeys {\n constructor(payer, keyMetaMap) {\n this.payer = void 0;\n this.keyMetaMap = void 0;\n this.payer = payer;\n this.keyMetaMap = keyMetaMap;\n }\n static compile(instructions, payer) {\n const keyMetaMap = new Map();\n const getOrInsertDefault = pubkey => {\n const address = pubkey.toBase58();\n let keyMeta = keyMetaMap.get(address);\n if (keyMeta === undefined) {\n keyMeta = {\n isSigner: false,\n isWritable: false,\n isInvoked: false\n };\n keyMetaMap.set(address, keyMeta);\n }\n return keyMeta;\n };\n const payerKeyMeta = getOrInsertDefault(payer);\n payerKeyMeta.isSigner = true;\n payerKeyMeta.isWritable = true;\n for (const ix of instructions) {\n getOrInsertDefault(ix.programId).isInvoked = true;\n for (const accountMeta of ix.keys) {\n const keyMeta = getOrInsertDefault(accountMeta.pubkey);\n keyMeta.isSigner ||= accountMeta.isSigner;\n keyMeta.isWritable ||= accountMeta.isWritable;\n }\n }\n return new CompiledKeys(payer, keyMetaMap);\n }\n getMessageComponents() {\n const mapEntries = [...this.keyMetaMap.entries()];\n assert(mapEntries.length <= 256, 'Max static account keys length exceeded');\n const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable);\n const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable);\n const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable);\n const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable);\n const header = {\n numRequiredSignatures: writableSigners.length + readonlySigners.length,\n numReadonlySignedAccounts: readonlySigners.length,\n numReadonlyUnsignedAccounts: readonlyNonSigners.length\n };\n\n // sanity checks\n {\n assert(writableSigners.length > 0, 'Expected at least one writable signer key');\n const [payerAddress] = writableSigners[0];\n assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer');\n }\n const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey(address)), ...readonlySigners.map(([address]) => new PublicKey(address)), ...writableNonSigners.map(([address]) => new PublicKey(address)), ...readonlyNonSigners.map(([address]) => new PublicKey(address))];\n return [header, staticAccountKeys];\n }\n extractTableLookup(lookupTable) {\n const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable);\n const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable);\n\n // Don't extract lookup if no keys were found\n if (writableIndexes.length === 0 && readonlyIndexes.length === 0) {\n return;\n }\n return [{\n accountKey: lookupTable.key,\n writableIndexes,\n readonlyIndexes\n }, {\n writable: drainedWritableKeys,\n readonly: drainedReadonlyKeys\n }];\n }\n\n /** @internal */\n drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) {\n const lookupTableIndexes = new Array();\n const drainedKeys = new Array();\n for (const [address, keyMeta] of this.keyMetaMap.entries()) {\n if (keyMetaFilter(keyMeta)) {\n const key = new PublicKey(address);\n const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key));\n if (lookupTableIndex >= 0) {\n assert(lookupTableIndex < 256, 'Max lookup table index exceeded');\n lookupTableIndexes.push(lookupTableIndex);\n drainedKeys.push(key);\n this.keyMetaMap.delete(address);\n }\n }\n }\n return [lookupTableIndexes, drainedKeys];\n }\n}\n\nconst END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';\n\n/**\n * Delegates to `Array#shift`, but throws if the array is zero-length.\n */\nfunction guardedShift(byteArray) {\n if (byteArray.length === 0) {\n throw new Error(END_OF_BUFFER_ERROR_MESSAGE);\n }\n return byteArray.shift();\n}\n\n/**\n * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of\n * the array.\n */\nfunction guardedSplice(byteArray, ...args) {\n const [start] = args;\n if (args.length === 2 // Implies that `deleteCount` was supplied\n ? start + (args[1] ?? 0) > byteArray.length : start >= byteArray.length) {\n throw new Error(END_OF_BUFFER_ERROR_MESSAGE);\n }\n return byteArray.splice(...args);\n}\n\n/**\n * An instruction to execute by a program\n *\n * @property {number} programIdIndex\n * @property {number[]} accounts\n * @property {string} data\n */\n\n/**\n * Message constructor arguments\n */\n\n/**\n * List of instructions to be processed atomically\n */\nclass Message {\n constructor(args) {\n this.header = void 0;\n this.accountKeys = void 0;\n this.recentBlockhash = void 0;\n this.instructions = void 0;\n this.indexToProgramIds = new Map();\n this.header = args.header;\n this.accountKeys = args.accountKeys.map(account => new PublicKey(account));\n this.recentBlockhash = args.recentBlockhash;\n this.instructions = args.instructions;\n this.instructions.forEach(ix => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex]));\n }\n get version() {\n return 'legacy';\n }\n get staticAccountKeys() {\n return this.accountKeys;\n }\n get compiledInstructions() {\n return this.instructions.map(ix => ({\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes: ix.accounts,\n data: bs58.decode(ix.data)\n }));\n }\n get addressTableLookups() {\n return [];\n }\n getAccountKeys() {\n return new MessageAccountKeys(this.staticAccountKeys);\n }\n static compile(args) {\n const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);\n const [header, staticAccountKeys] = compiledKeys.getMessageComponents();\n const accountKeys = new MessageAccountKeys(staticAccountKeys);\n const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({\n programIdIndex: ix.programIdIndex,\n accounts: ix.accountKeyIndexes,\n data: bs58.encode(ix.data)\n }));\n return new Message({\n header,\n accountKeys: staticAccountKeys,\n recentBlockhash: args.recentBlockhash,\n instructions\n });\n }\n isAccountSigner(index) {\n return index < this.header.numRequiredSignatures;\n }\n isAccountWritable(index) {\n const numSignedAccounts = this.header.numRequiredSignatures;\n if (index >= this.header.numRequiredSignatures) {\n const unsignedAccountIndex = index - numSignedAccounts;\n const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts;\n const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;\n return unsignedAccountIndex < numWritableUnsignedAccounts;\n } else {\n const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;\n return index < numWritableSignedAccounts;\n }\n }\n isProgramId(index) {\n return this.indexToProgramIds.has(index);\n }\n programIds() {\n return [...this.indexToProgramIds.values()];\n }\n nonProgramIds() {\n return this.accountKeys.filter((_, index) => !this.isProgramId(index));\n }\n serialize() {\n const numKeys = this.accountKeys.length;\n let keyCount = [];\n encodeLength(keyCount, numKeys);\n const instructions = this.instructions.map(instruction => {\n const {\n accounts,\n programIdIndex\n } = instruction;\n const data = Array.from(bs58.decode(instruction.data));\n let keyIndicesCount = [];\n encodeLength(keyIndicesCount, accounts.length);\n let dataCount = [];\n encodeLength(dataCount, data.length);\n return {\n programIdIndex,\n keyIndicesCount: Buffer.from(keyIndicesCount),\n keyIndices: accounts,\n dataLength: Buffer.from(dataCount),\n data\n };\n });\n let instructionCount = [];\n encodeLength(instructionCount, instructions.length);\n let instructionBuffer = Buffer.alloc(PACKET_DATA_SIZE);\n Buffer.from(instructionCount).copy(instructionBuffer);\n let instructionBufferLength = instructionCount.length;\n instructions.forEach(instruction => {\n const instructionLayout = BufferLayout.struct([BufferLayout.u8('programIdIndex'), BufferLayout.blob(instruction.keyIndicesCount.length, 'keyIndicesCount'), BufferLayout.seq(BufferLayout.u8('keyIndex'), instruction.keyIndices.length, 'keyIndices'), BufferLayout.blob(instruction.dataLength.length, 'dataLength'), BufferLayout.seq(BufferLayout.u8('userdatum'), instruction.data.length, 'data')]);\n const length = instructionLayout.encode(instruction, instructionBuffer, instructionBufferLength);\n instructionBufferLength += length;\n });\n instructionBuffer = instructionBuffer.slice(0, instructionBufferLength);\n const signDataLayout = BufferLayout.struct([BufferLayout.blob(1, 'numRequiredSignatures'), BufferLayout.blob(1, 'numReadonlySignedAccounts'), BufferLayout.blob(1, 'numReadonlyUnsignedAccounts'), BufferLayout.blob(keyCount.length, 'keyCount'), BufferLayout.seq(publicKey('key'), numKeys, 'keys'), publicKey('recentBlockhash')]);\n const transaction = {\n numRequiredSignatures: Buffer.from([this.header.numRequiredSignatures]),\n numReadonlySignedAccounts: Buffer.from([this.header.numReadonlySignedAccounts]),\n numReadonlyUnsignedAccounts: Buffer.from([this.header.numReadonlyUnsignedAccounts]),\n keyCount: Buffer.from(keyCount),\n keys: this.accountKeys.map(key => toBuffer(key.toBytes())),\n recentBlockhash: bs58.decode(this.recentBlockhash)\n };\n let signData = Buffer.alloc(2048);\n const length = signDataLayout.encode(transaction, signData);\n instructionBuffer.copy(signData, length);\n return signData.slice(0, length + instructionBuffer.length);\n }\n\n /**\n * Decode a compiled message into a Message object.\n */\n static from(buffer) {\n // Slice up wire data\n let byteArray = [...buffer];\n const numRequiredSignatures = guardedShift(byteArray);\n if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) {\n throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()');\n }\n const numReadonlySignedAccounts = guardedShift(byteArray);\n const numReadonlyUnsignedAccounts = guardedShift(byteArray);\n const accountCount = decodeLength(byteArray);\n let accountKeys = [];\n for (let i = 0; i < accountCount; i++) {\n const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);\n accountKeys.push(new PublicKey(Buffer.from(account)));\n }\n const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH);\n const instructionCount = decodeLength(byteArray);\n let instructions = [];\n for (let i = 0; i < instructionCount; i++) {\n const programIdIndex = guardedShift(byteArray);\n const accountCount = decodeLength(byteArray);\n const accounts = guardedSplice(byteArray, 0, accountCount);\n const dataLength = decodeLength(byteArray);\n const dataSlice = guardedSplice(byteArray, 0, dataLength);\n const data = bs58.encode(Buffer.from(dataSlice));\n instructions.push({\n programIdIndex,\n accounts,\n data\n });\n }\n const messageArgs = {\n header: {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n },\n recentBlockhash: bs58.encode(Buffer.from(recentBlockhash)),\n accountKeys,\n instructions\n };\n return new Message(messageArgs);\n }\n}\n\n/**\n * Message constructor arguments\n */\n\nclass MessageV0 {\n constructor(args) {\n this.header = void 0;\n this.staticAccountKeys = void 0;\n this.recentBlockhash = void 0;\n this.compiledInstructions = void 0;\n this.addressTableLookups = void 0;\n this.header = args.header;\n this.staticAccountKeys = args.staticAccountKeys;\n this.recentBlockhash = args.recentBlockhash;\n this.compiledInstructions = args.compiledInstructions;\n this.addressTableLookups = args.addressTableLookups;\n }\n get version() {\n return 0;\n }\n get numAccountKeysFromLookups() {\n let count = 0;\n for (const lookup of this.addressTableLookups) {\n count += lookup.readonlyIndexes.length + lookup.writableIndexes.length;\n }\n return count;\n }\n getAccountKeys(args) {\n let accountKeysFromLookups;\n if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) {\n if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) {\n throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups');\n }\n accountKeysFromLookups = args.accountKeysFromLookups;\n } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) {\n accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts);\n } else if (this.addressTableLookups.length > 0) {\n throw new Error('Failed to get account keys because address table lookups were not resolved');\n }\n return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups);\n }\n isAccountSigner(index) {\n return index < this.header.numRequiredSignatures;\n }\n isAccountWritable(index) {\n const numSignedAccounts = this.header.numRequiredSignatures;\n const numStaticAccountKeys = this.staticAccountKeys.length;\n if (index >= numStaticAccountKeys) {\n const lookupAccountKeysIndex = index - numStaticAccountKeys;\n const numWritableLookupAccountKeys = this.addressTableLookups.reduce((count, lookup) => count + lookup.writableIndexes.length, 0);\n return lookupAccountKeysIndex < numWritableLookupAccountKeys;\n } else if (index >= this.header.numRequiredSignatures) {\n const unsignedAccountIndex = index - numSignedAccounts;\n const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts;\n const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts;\n return unsignedAccountIndex < numWritableUnsignedAccounts;\n } else {\n const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts;\n return index < numWritableSignedAccounts;\n }\n }\n resolveAddressTableLookups(addressLookupTableAccounts) {\n const accountKeysFromLookups = {\n writable: [],\n readonly: []\n };\n for (const tableLookup of this.addressTableLookups) {\n const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey));\n if (!tableAccount) {\n throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`);\n }\n for (const index of tableLookup.writableIndexes) {\n if (index < tableAccount.state.addresses.length) {\n accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]);\n } else {\n throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);\n }\n }\n for (const index of tableLookup.readonlyIndexes) {\n if (index < tableAccount.state.addresses.length) {\n accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]);\n } else {\n throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`);\n }\n }\n }\n return accountKeysFromLookups;\n }\n static compile(args) {\n const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey);\n const addressTableLookups = new Array();\n const accountKeysFromLookups = {\n writable: new Array(),\n readonly: new Array()\n };\n const lookupTableAccounts = args.addressLookupTableAccounts || [];\n for (const lookupTable of lookupTableAccounts) {\n const extractResult = compiledKeys.extractTableLookup(lookupTable);\n if (extractResult !== undefined) {\n const [addressTableLookup, {\n writable,\n readonly\n }] = extractResult;\n addressTableLookups.push(addressTableLookup);\n accountKeysFromLookups.writable.push(...writable);\n accountKeysFromLookups.readonly.push(...readonly);\n }\n }\n const [header, staticAccountKeys] = compiledKeys.getMessageComponents();\n const accountKeys = new MessageAccountKeys(staticAccountKeys, accountKeysFromLookups);\n const compiledInstructions = accountKeys.compileInstructions(args.instructions);\n return new MessageV0({\n header,\n staticAccountKeys,\n recentBlockhash: args.recentBlockhash,\n compiledInstructions,\n addressTableLookups\n });\n }\n serialize() {\n const encodedStaticAccountKeysLength = Array();\n encodeLength(encodedStaticAccountKeysLength, this.staticAccountKeys.length);\n const serializedInstructions = this.serializeInstructions();\n const encodedInstructionsLength = Array();\n encodeLength(encodedInstructionsLength, this.compiledInstructions.length);\n const serializedAddressTableLookups = this.serializeAddressTableLookups();\n const encodedAddressTableLookupsLength = Array();\n encodeLength(encodedAddressTableLookupsLength, this.addressTableLookups.length);\n const messageLayout = BufferLayout.struct([BufferLayout.u8('prefix'), BufferLayout.struct([BufferLayout.u8('numRequiredSignatures'), BufferLayout.u8('numReadonlySignedAccounts'), BufferLayout.u8('numReadonlyUnsignedAccounts')], 'header'), BufferLayout.blob(encodedStaticAccountKeysLength.length, 'staticAccountKeysLength'), BufferLayout.seq(publicKey(), this.staticAccountKeys.length, 'staticAccountKeys'), publicKey('recentBlockhash'), BufferLayout.blob(encodedInstructionsLength.length, 'instructionsLength'), BufferLayout.blob(serializedInstructions.length, 'serializedInstructions'), BufferLayout.blob(encodedAddressTableLookupsLength.length, 'addressTableLookupsLength'), BufferLayout.blob(serializedAddressTableLookups.length, 'serializedAddressTableLookups')]);\n const serializedMessage = new Uint8Array(PACKET_DATA_SIZE);\n const MESSAGE_VERSION_0_PREFIX = 1 << 7;\n const serializedMessageLength = messageLayout.encode({\n prefix: MESSAGE_VERSION_0_PREFIX,\n header: this.header,\n staticAccountKeysLength: new Uint8Array(encodedStaticAccountKeysLength),\n staticAccountKeys: this.staticAccountKeys.map(key => key.toBytes()),\n recentBlockhash: bs58.decode(this.recentBlockhash),\n instructionsLength: new Uint8Array(encodedInstructionsLength),\n serializedInstructions,\n addressTableLookupsLength: new Uint8Array(encodedAddressTableLookupsLength),\n serializedAddressTableLookups\n }, serializedMessage);\n return serializedMessage.slice(0, serializedMessageLength);\n }\n serializeInstructions() {\n let serializedLength = 0;\n const serializedInstructions = new Uint8Array(PACKET_DATA_SIZE);\n for (const instruction of this.compiledInstructions) {\n const encodedAccountKeyIndexesLength = Array();\n encodeLength(encodedAccountKeyIndexesLength, instruction.accountKeyIndexes.length);\n const encodedDataLength = Array();\n encodeLength(encodedDataLength, instruction.data.length);\n const instructionLayout = BufferLayout.struct([BufferLayout.u8('programIdIndex'), BufferLayout.blob(encodedAccountKeyIndexesLength.length, 'encodedAccountKeyIndexesLength'), BufferLayout.seq(BufferLayout.u8(), instruction.accountKeyIndexes.length, 'accountKeyIndexes'), BufferLayout.blob(encodedDataLength.length, 'encodedDataLength'), BufferLayout.blob(instruction.data.length, 'data')]);\n serializedLength += instructionLayout.encode({\n programIdIndex: instruction.programIdIndex,\n encodedAccountKeyIndexesLength: new Uint8Array(encodedAccountKeyIndexesLength),\n accountKeyIndexes: instruction.accountKeyIndexes,\n encodedDataLength: new Uint8Array(encodedDataLength),\n data: instruction.data\n }, serializedInstructions, serializedLength);\n }\n return serializedInstructions.slice(0, serializedLength);\n }\n serializeAddressTableLookups() {\n let serializedLength = 0;\n const serializedAddressTableLookups = new Uint8Array(PACKET_DATA_SIZE);\n for (const lookup of this.addressTableLookups) {\n const encodedWritableIndexesLength = Array();\n encodeLength(encodedWritableIndexesLength, lookup.writableIndexes.length);\n const encodedReadonlyIndexesLength = Array();\n encodeLength(encodedReadonlyIndexesLength, lookup.readonlyIndexes.length);\n const addressTableLookupLayout = BufferLayout.struct([publicKey('accountKey'), BufferLayout.blob(encodedWritableIndexesLength.length, 'encodedWritableIndexesLength'), BufferLayout.seq(BufferLayout.u8(), lookup.writableIndexes.length, 'writableIndexes'), BufferLayout.blob(encodedReadonlyIndexesLength.length, 'encodedReadonlyIndexesLength'), BufferLayout.seq(BufferLayout.u8(), lookup.readonlyIndexes.length, 'readonlyIndexes')]);\n serializedLength += addressTableLookupLayout.encode({\n accountKey: lookup.accountKey.toBytes(),\n encodedWritableIndexesLength: new Uint8Array(encodedWritableIndexesLength),\n writableIndexes: lookup.writableIndexes,\n encodedReadonlyIndexesLength: new Uint8Array(encodedReadonlyIndexesLength),\n readonlyIndexes: lookup.readonlyIndexes\n }, serializedAddressTableLookups, serializedLength);\n }\n return serializedAddressTableLookups.slice(0, serializedLength);\n }\n static deserialize(serializedMessage) {\n let byteArray = [...serializedMessage];\n const prefix = guardedShift(byteArray);\n const maskedPrefix = prefix & VERSION_PREFIX_MASK;\n assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`);\n const version = maskedPrefix;\n assert(version === 0, `Expected versioned message with version 0 but found version ${version}`);\n const header = {\n numRequiredSignatures: guardedShift(byteArray),\n numReadonlySignedAccounts: guardedShift(byteArray),\n numReadonlyUnsignedAccounts: guardedShift(byteArray)\n };\n const staticAccountKeys = [];\n const staticAccountKeysLength = decodeLength(byteArray);\n for (let i = 0; i < staticAccountKeysLength; i++) {\n staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)));\n }\n const recentBlockhash = bs58.encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const instructionCount = decodeLength(byteArray);\n const compiledInstructions = [];\n for (let i = 0; i < instructionCount; i++) {\n const programIdIndex = guardedShift(byteArray);\n const accountKeyIndexesLength = decodeLength(byteArray);\n const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength);\n const dataLength = decodeLength(byteArray);\n const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength));\n compiledInstructions.push({\n programIdIndex,\n accountKeyIndexes,\n data\n });\n }\n const addressTableLookupsCount = decodeLength(byteArray);\n const addressTableLookups = [];\n for (let i = 0; i < addressTableLookupsCount; i++) {\n const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const writableIndexesLength = decodeLength(byteArray);\n const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength);\n const readonlyIndexesLength = decodeLength(byteArray);\n const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength);\n addressTableLookups.push({\n accountKey,\n writableIndexes,\n readonlyIndexes\n });\n }\n return new MessageV0({\n header,\n staticAccountKeys,\n recentBlockhash,\n compiledInstructions,\n addressTableLookups\n });\n }\n}\n\n// eslint-disable-next-line no-redeclare\nconst VersionedMessage = {\n deserializeMessageVersion(serializedMessage) {\n const prefix = serializedMessage[0];\n const maskedPrefix = prefix & VERSION_PREFIX_MASK;\n\n // if the highest bit of the prefix is not set, the message is not versioned\n if (maskedPrefix === prefix) {\n return 'legacy';\n }\n\n // the lower 7 bits of the prefix indicate the message version\n return maskedPrefix;\n },\n deserialize: serializedMessage => {\n const version = VersionedMessage.deserializeMessageVersion(serializedMessage);\n if (version === 'legacy') {\n return Message.from(serializedMessage);\n }\n if (version === 0) {\n return MessageV0.deserialize(serializedMessage);\n } else {\n throw new Error(`Transaction message version ${version} deserialization is not supported`);\n }\n }\n};\n\n/** @internal */\n\n/**\n * Transaction signature as base-58 encoded string\n */\n\nlet TransactionStatus = /*#__PURE__*/function (TransactionStatus) {\n TransactionStatus[TransactionStatus[\"BLOCKHEIGHT_EXCEEDED\"] = 0] = \"BLOCKHEIGHT_EXCEEDED\";\n TransactionStatus[TransactionStatus[\"PROCESSED\"] = 1] = \"PROCESSED\";\n TransactionStatus[TransactionStatus[\"TIMED_OUT\"] = 2] = \"TIMED_OUT\";\n TransactionStatus[TransactionStatus[\"NONCE_INVALID\"] = 3] = \"NONCE_INVALID\";\n return TransactionStatus;\n}({});\n\n/**\n * Default (empty) signature\n */\nconst DEFAULT_SIGNATURE = Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0);\n\n/**\n * Account metadata used to define instructions\n */\n\n/**\n * List of TransactionInstruction object fields that may be initialized at construction\n */\n\n/**\n * Configuration object for Transaction.serialize()\n */\n\n/**\n * @internal\n */\n\n/**\n * Transaction Instruction class\n */\nclass TransactionInstruction {\n constructor(opts) {\n /**\n * Public keys to include in this transaction\n * Boolean represents whether this pubkey needs to sign the transaction\n */\n this.keys = void 0;\n /**\n * Program Id to execute\n */\n this.programId = void 0;\n /**\n * Program input\n */\n this.data = Buffer.alloc(0);\n this.programId = opts.programId;\n this.keys = opts.keys;\n if (opts.data) {\n this.data = opts.data;\n }\n }\n\n /**\n * @internal\n */\n toJSON() {\n return {\n keys: this.keys.map(({\n pubkey,\n isSigner,\n isWritable\n }) => ({\n pubkey: pubkey.toJSON(),\n isSigner,\n isWritable\n })),\n programId: this.programId.toJSON(),\n data: [...this.data]\n };\n }\n}\n\n/**\n * Pair of signature and corresponding public key\n */\n\n/**\n * List of Transaction object fields that may be initialized at construction\n */\n\n// For backward compatibility; an unfortunate consequence of being\n// forced to over-export types by the documentation generator.\n// See https://github.com/solana-labs/solana/pull/25820\n\n/**\n * Blockhash-based transactions have a lifetime that are defined by\n * the blockhash they include. Any transaction whose blockhash is\n * too old will be rejected.\n */\n\n/**\n * Use these options to construct a durable nonce transaction.\n */\n\n/**\n * Nonce information to be used to build an offline Transaction.\n */\n\n/**\n * @internal\n */\n\n/**\n * Transaction class\n */\nclass Transaction {\n /**\n * The first (payer) Transaction signature\n *\n * @returns {Buffer | null} Buffer of payer's signature\n */\n get signature() {\n if (this.signatures.length > 0) {\n return this.signatures[0].signature;\n }\n return null;\n }\n\n /**\n * The transaction fee payer\n */\n\n // Construct a transaction with a blockhash and lastValidBlockHeight\n\n // Construct a transaction using a durable nonce\n\n /**\n * @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version.\n * Please supply a `TransactionBlockhashCtor` instead.\n */\n\n /**\n * Construct an empty Transaction\n */\n constructor(opts) {\n /**\n * Signatures for the transaction. Typically created by invoking the\n * `sign()` method\n */\n this.signatures = [];\n this.feePayer = void 0;\n /**\n * The instructions to atomically execute\n */\n this.instructions = [];\n /**\n * A recent transaction id. Must be populated by the caller\n */\n this.recentBlockhash = void 0;\n /**\n * the last block chain can advance to before tx is declared expired\n * */\n this.lastValidBlockHeight = void 0;\n /**\n * Optional Nonce information. If populated, transaction will use a durable\n * Nonce hash instead of a recentBlockhash. Must be populated by the caller\n */\n this.nonceInfo = void 0;\n /**\n * If this is a nonce transaction this represents the minimum slot from which\n * to evaluate if the nonce has advanced when attempting to confirm the\n * transaction. This protects against a case where the transaction confirmation\n * logic loads the nonce account from an old slot and assumes the mismatch in\n * nonce value implies that the nonce has been advanced.\n */\n this.minNonceContextSlot = void 0;\n /**\n * @internal\n */\n this._message = void 0;\n /**\n * @internal\n */\n this._json = void 0;\n if (!opts) {\n return;\n }\n if (opts.feePayer) {\n this.feePayer = opts.feePayer;\n }\n if (opts.signatures) {\n this.signatures = opts.signatures;\n }\n if (Object.prototype.hasOwnProperty.call(opts, 'nonceInfo')) {\n const {\n minContextSlot,\n nonceInfo\n } = opts;\n this.minNonceContextSlot = minContextSlot;\n this.nonceInfo = nonceInfo;\n } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) {\n const {\n blockhash,\n lastValidBlockHeight\n } = opts;\n this.recentBlockhash = blockhash;\n this.lastValidBlockHeight = lastValidBlockHeight;\n } else {\n const {\n recentBlockhash,\n nonceInfo\n } = opts;\n if (nonceInfo) {\n this.nonceInfo = nonceInfo;\n }\n this.recentBlockhash = recentBlockhash;\n }\n }\n\n /**\n * @internal\n */\n toJSON() {\n return {\n recentBlockhash: this.recentBlockhash || null,\n feePayer: this.feePayer ? this.feePayer.toJSON() : null,\n nonceInfo: this.nonceInfo ? {\n nonce: this.nonceInfo.nonce,\n nonceInstruction: this.nonceInfo.nonceInstruction.toJSON()\n } : null,\n instructions: this.instructions.map(instruction => instruction.toJSON()),\n signers: this.signatures.map(({\n publicKey\n }) => {\n return publicKey.toJSON();\n })\n };\n }\n\n /**\n * Add one or more instructions to this Transaction\n *\n * @param {Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields >} items - Instructions to add to the Transaction\n */\n add(...items) {\n if (items.length === 0) {\n throw new Error('No instructions');\n }\n items.forEach(item => {\n if ('instructions' in item) {\n this.instructions = this.instructions.concat(item.instructions);\n } else if ('data' in item && 'programId' in item && 'keys' in item) {\n this.instructions.push(item);\n } else {\n this.instructions.push(new TransactionInstruction(item));\n }\n });\n return this;\n }\n\n /**\n * Compile transaction data\n */\n compileMessage() {\n if (this._message && JSON.stringify(this.toJSON()) === JSON.stringify(this._json)) {\n return this._message;\n }\n let recentBlockhash;\n let instructions;\n if (this.nonceInfo) {\n recentBlockhash = this.nonceInfo.nonce;\n if (this.instructions[0] != this.nonceInfo.nonceInstruction) {\n instructions = [this.nonceInfo.nonceInstruction, ...this.instructions];\n } else {\n instructions = this.instructions;\n }\n } else {\n recentBlockhash = this.recentBlockhash;\n instructions = this.instructions;\n }\n if (!recentBlockhash) {\n throw new Error('Transaction recentBlockhash required');\n }\n if (instructions.length < 1) {\n console.warn('No instructions provided');\n }\n let feePayer;\n if (this.feePayer) {\n feePayer = this.feePayer;\n } else if (this.signatures.length > 0 && this.signatures[0].publicKey) {\n // Use implicit fee payer\n feePayer = this.signatures[0].publicKey;\n } else {\n throw new Error('Transaction fee payer required');\n }\n for (let i = 0; i < instructions.length; i++) {\n if (instructions[i].programId === undefined) {\n throw new Error(`Transaction instruction index ${i} has undefined program id`);\n }\n }\n const programIds = [];\n const accountMetas = [];\n instructions.forEach(instruction => {\n instruction.keys.forEach(accountMeta => {\n accountMetas.push({\n ...accountMeta\n });\n });\n const programId = instruction.programId.toString();\n if (!programIds.includes(programId)) {\n programIds.push(programId);\n }\n });\n\n // Append programID account metas\n programIds.forEach(programId => {\n accountMetas.push({\n pubkey: new PublicKey(programId),\n isSigner: false,\n isWritable: false\n });\n });\n\n // Cull duplicate account metas\n const uniqueMetas = [];\n accountMetas.forEach(accountMeta => {\n const pubkeyString = accountMeta.pubkey.toString();\n const uniqueIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.toString() === pubkeyString;\n });\n if (uniqueIndex > -1) {\n uniqueMetas[uniqueIndex].isWritable = uniqueMetas[uniqueIndex].isWritable || accountMeta.isWritable;\n uniqueMetas[uniqueIndex].isSigner = uniqueMetas[uniqueIndex].isSigner || accountMeta.isSigner;\n } else {\n uniqueMetas.push(accountMeta);\n }\n });\n\n // Sort. Prioritizing first by signer, then by writable\n uniqueMetas.sort(function (x, y) {\n if (x.isSigner !== y.isSigner) {\n // Signers always come before non-signers\n return x.isSigner ? -1 : 1;\n }\n if (x.isWritable !== y.isWritable) {\n // Writable accounts always come before read-only accounts\n return x.isWritable ? -1 : 1;\n }\n // Otherwise, sort by pubkey, stringwise.\n const options = {\n localeMatcher: 'best fit',\n usage: 'sort',\n sensitivity: 'variant',\n ignorePunctuation: false,\n numeric: false,\n caseFirst: 'lower'\n };\n return x.pubkey.toBase58().localeCompare(y.pubkey.toBase58(), 'en', options);\n });\n\n // Move fee payer to the front\n const feePayerIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.equals(feePayer);\n });\n if (feePayerIndex > -1) {\n const [payerMeta] = uniqueMetas.splice(feePayerIndex, 1);\n payerMeta.isSigner = true;\n payerMeta.isWritable = true;\n uniqueMetas.unshift(payerMeta);\n } else {\n uniqueMetas.unshift({\n pubkey: feePayer,\n isSigner: true,\n isWritable: true\n });\n }\n\n // Disallow unknown signers\n for (const signature of this.signatures) {\n const uniqueIndex = uniqueMetas.findIndex(x => {\n return x.pubkey.equals(signature.publicKey);\n });\n if (uniqueIndex > -1) {\n if (!uniqueMetas[uniqueIndex].isSigner) {\n uniqueMetas[uniqueIndex].isSigner = true;\n 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.');\n }\n } else {\n throw new Error(`unknown signer: ${signature.publicKey.toString()}`);\n }\n }\n let numRequiredSignatures = 0;\n let numReadonlySignedAccounts = 0;\n let numReadonlyUnsignedAccounts = 0;\n\n // Split out signing from non-signing keys and count header values\n const signedKeys = [];\n const unsignedKeys = [];\n uniqueMetas.forEach(({\n pubkey,\n isSigner,\n isWritable\n }) => {\n if (isSigner) {\n signedKeys.push(pubkey.toString());\n numRequiredSignatures += 1;\n if (!isWritable) {\n numReadonlySignedAccounts += 1;\n }\n } else {\n unsignedKeys.push(pubkey.toString());\n if (!isWritable) {\n numReadonlyUnsignedAccounts += 1;\n }\n }\n });\n const accountKeys = signedKeys.concat(unsignedKeys);\n const compiledInstructions = instructions.map(instruction => {\n const {\n data,\n programId\n } = instruction;\n return {\n programIdIndex: accountKeys.indexOf(programId.toString()),\n accounts: instruction.keys.map(meta => accountKeys.indexOf(meta.pubkey.toString())),\n data: bs58.encode(data)\n };\n });\n compiledInstructions.forEach(instruction => {\n assert(instruction.programIdIndex >= 0);\n instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0));\n });\n return new Message({\n header: {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n },\n accountKeys,\n recentBlockhash,\n instructions: compiledInstructions\n });\n }\n\n /**\n * @internal\n */\n _compile() {\n const message = this.compileMessage();\n const signedKeys = message.accountKeys.slice(0, message.header.numRequiredSignatures);\n if (this.signatures.length === signedKeys.length) {\n const valid = this.signatures.every((pair, index) => {\n return signedKeys[index].equals(pair.publicKey);\n });\n if (valid) return message;\n }\n this.signatures = signedKeys.map(publicKey => ({\n signature: null,\n publicKey\n }));\n return message;\n }\n\n /**\n * Get a buffer of the Transaction data that need to be covered by signatures\n */\n serializeMessage() {\n return this._compile().serialize();\n }\n\n /**\n * Get the estimated fee associated with a transaction\n *\n * @param {Connection} connection Connection to RPC Endpoint.\n *\n * @returns {Promise} The estimated fee for the transaction\n */\n async getEstimatedFee(connection) {\n return (await connection.getFeeForMessage(this.compileMessage())).value;\n }\n\n /**\n * Specify the public keys which will be used to sign the Transaction.\n * The first signer will be used as the transaction fee payer account.\n *\n * Signatures can be added with either `partialSign` or `addSignature`\n *\n * @deprecated Deprecated since v0.84.0. Only the fee payer needs to be\n * specified and it can be set in the Transaction constructor or with the\n * `feePayer` property.\n */\n setSigners(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n const seen = new Set();\n this.signatures = signers.filter(publicKey => {\n const key = publicKey.toString();\n if (seen.has(key)) {\n return false;\n } else {\n seen.add(key);\n return true;\n }\n }).map(publicKey => ({\n signature: null,\n publicKey\n }));\n }\n\n /**\n * Sign the Transaction with the specified signers. Multiple signatures may\n * be applied to a Transaction. The first signature is considered \"primary\"\n * and is used identify and confirm transactions.\n *\n * If the Transaction `feePayer` is not set, the first signer will be used\n * as the transaction fee payer account.\n *\n * Transaction fields should not be modified after the first call to `sign`,\n * as doing so may invalidate the signature and cause the Transaction to be\n * rejected.\n *\n * The Transaction must be assigned a valid `recentBlockhash` before invoking this method\n *\n * @param {Array} signers Array of signers that will sign the transaction\n */\n sign(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n\n // Dedupe signers\n const seen = new Set();\n const uniqueSigners = [];\n for (const signer of signers) {\n const key = signer.publicKey.toString();\n if (seen.has(key)) {\n continue;\n } else {\n seen.add(key);\n uniqueSigners.push(signer);\n }\n }\n this.signatures = uniqueSigners.map(signer => ({\n signature: null,\n publicKey: signer.publicKey\n }));\n const message = this._compile();\n this._partialSign(message, ...uniqueSigners);\n }\n\n /**\n * Partially sign a transaction with the specified accounts. All accounts must\n * correspond to either the fee payer or a signer account in the transaction\n * instructions.\n *\n * All the caveats from the `sign` method apply to `partialSign`\n *\n * @param {Array} signers Array of signers that will sign the transaction\n */\n partialSign(...signers) {\n if (signers.length === 0) {\n throw new Error('No signers');\n }\n\n // Dedupe signers\n const seen = new Set();\n const uniqueSigners = [];\n for (const signer of signers) {\n const key = signer.publicKey.toString();\n if (seen.has(key)) {\n continue;\n } else {\n seen.add(key);\n uniqueSigners.push(signer);\n }\n }\n const message = this._compile();\n this._partialSign(message, ...uniqueSigners);\n }\n\n /**\n * @internal\n */\n _partialSign(message, ...signers) {\n const signData = message.serialize();\n signers.forEach(signer => {\n const signature = sign(signData, signer.secretKey);\n this._addSignature(signer.publicKey, toBuffer(signature));\n });\n }\n\n /**\n * Add an externally created signature to a transaction. The public key\n * must correspond to either the fee payer or a signer account in the transaction\n * instructions.\n *\n * @param {PublicKey} pubkey Public key that will be added to the transaction.\n * @param {Buffer} signature An externally created signature to add to the transaction.\n */\n addSignature(pubkey, signature) {\n this._compile(); // Ensure signatures array is populated\n this._addSignature(pubkey, signature);\n }\n\n /**\n * @internal\n */\n _addSignature(pubkey, signature) {\n assert(signature.length === 64);\n const index = this.signatures.findIndex(sigpair => pubkey.equals(sigpair.publicKey));\n if (index < 0) {\n throw new Error(`unknown signer: ${pubkey.toString()}`);\n }\n this.signatures[index].signature = Buffer.from(signature);\n }\n\n /**\n * Verify signatures of a Transaction\n * Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one.\n * If no boolean is provided, we expect a fully signed Transaction by default.\n *\n * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction\n */\n verifySignatures(requireAllSignatures = true) {\n const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures);\n return !signatureErrors;\n }\n\n /**\n * @internal\n */\n _getMessageSignednessErrors(message, requireAllSignatures) {\n const errors = {};\n for (const {\n signature,\n publicKey\n } of this.signatures) {\n if (signature === null) {\n if (requireAllSignatures) {\n (errors.missing ||= []).push(publicKey);\n }\n } else {\n if (!verify(signature, message, publicKey.toBytes())) {\n (errors.invalid ||= []).push(publicKey);\n }\n }\n }\n return errors.invalid || errors.missing ? errors : undefined;\n }\n\n /**\n * Serialize the Transaction in the wire format.\n *\n * @param {Buffer} [config] Config of transaction.\n *\n * @returns {Buffer} Signature of transaction in wire format.\n */\n serialize(config) {\n const {\n requireAllSignatures,\n verifySignatures\n } = Object.assign({\n requireAllSignatures: true,\n verifySignatures: true\n }, config);\n const signData = this.serializeMessage();\n if (verifySignatures) {\n const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures);\n if (sigErrors) {\n let errorMessage = 'Signature verification failed.';\n if (sigErrors.invalid) {\n errorMessage += `\\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\\`].`;\n }\n if (sigErrors.missing) {\n errorMessage += `\\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\\`].`;\n }\n throw new Error(errorMessage);\n }\n }\n return this._serialize(signData);\n }\n\n /**\n * @internal\n */\n _serialize(signData) {\n const {\n signatures\n } = this;\n const signatureCount = [];\n encodeLength(signatureCount, signatures.length);\n const transactionLength = signatureCount.length + signatures.length * 64 + signData.length;\n const wireTransaction = Buffer.alloc(transactionLength);\n assert(signatures.length < 256);\n Buffer.from(signatureCount).copy(wireTransaction, 0);\n signatures.forEach(({\n signature\n }, index) => {\n if (signature !== null) {\n assert(signature.length === 64, `signature has invalid length`);\n Buffer.from(signature).copy(wireTransaction, signatureCount.length + index * 64);\n }\n });\n signData.copy(wireTransaction, signatureCount.length + signatures.length * 64);\n assert(wireTransaction.length <= PACKET_DATA_SIZE, `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`);\n return wireTransaction;\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get keys() {\n assert(this.instructions.length === 1);\n return this.instructions[0].keys.map(keyObj => keyObj.pubkey);\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get programId() {\n assert(this.instructions.length === 1);\n return this.instructions[0].programId;\n }\n\n /**\n * Deprecated method\n * @internal\n */\n get data() {\n assert(this.instructions.length === 1);\n return this.instructions[0].data;\n }\n\n /**\n * Parse a wire transaction into a Transaction object.\n *\n * @param {Buffer | Uint8Array | Array} buffer Signature of wire Transaction\n *\n * @returns {Transaction} Transaction associated with the signature\n */\n static from(buffer) {\n // Slice up wire data\n let byteArray = [...buffer];\n const signatureCount = decodeLength(byteArray);\n let signatures = [];\n for (let i = 0; i < signatureCount; i++) {\n const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);\n signatures.push(bs58.encode(Buffer.from(signature)));\n }\n return Transaction.populate(Message.from(byteArray), signatures);\n }\n\n /**\n * Populate Transaction object from message and signatures\n *\n * @param {Message} message Message of transaction\n * @param {Array} signatures List of signatures to assign to the transaction\n *\n * @returns {Transaction} The populated Transaction\n */\n static populate(message, signatures = []) {\n const transaction = new Transaction();\n transaction.recentBlockhash = message.recentBlockhash;\n if (message.header.numRequiredSignatures > 0) {\n transaction.feePayer = message.accountKeys[0];\n }\n signatures.forEach((signature, index) => {\n const sigPubkeyPair = {\n signature: signature == bs58.encode(DEFAULT_SIGNATURE) ? null : bs58.decode(signature),\n publicKey: message.accountKeys[index]\n };\n transaction.signatures.push(sigPubkeyPair);\n });\n message.instructions.forEach(instruction => {\n const keys = instruction.accounts.map(account => {\n const pubkey = message.accountKeys[account];\n return {\n pubkey,\n isSigner: transaction.signatures.some(keyObj => keyObj.publicKey.toString() === pubkey.toString()) || message.isAccountSigner(account),\n isWritable: message.isAccountWritable(account)\n };\n });\n transaction.instructions.push(new TransactionInstruction({\n keys,\n programId: message.accountKeys[instruction.programIdIndex],\n data: bs58.decode(instruction.data)\n }));\n });\n transaction._message = message;\n transaction._json = transaction.toJSON();\n return transaction;\n }\n}\n\nclass TransactionMessage {\n constructor(args) {\n this.payerKey = void 0;\n this.instructions = void 0;\n this.recentBlockhash = void 0;\n this.payerKey = args.payerKey;\n this.instructions = args.instructions;\n this.recentBlockhash = args.recentBlockhash;\n }\n static decompile(message, args) {\n const {\n header,\n compiledInstructions,\n recentBlockhash\n } = message;\n const {\n numRequiredSignatures,\n numReadonlySignedAccounts,\n numReadonlyUnsignedAccounts\n } = header;\n const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts;\n assert(numWritableSignedAccounts > 0, 'Message header is invalid');\n const numWritableUnsignedAccounts = message.staticAccountKeys.length - numRequiredSignatures - numReadonlyUnsignedAccounts;\n assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid');\n const accountKeys = message.getAccountKeys(args);\n const payerKey = accountKeys.get(0);\n if (payerKey === undefined) {\n throw new Error('Failed to decompile message because no account keys were found');\n }\n const instructions = [];\n for (const compiledIx of compiledInstructions) {\n const keys = [];\n for (const keyIndex of compiledIx.accountKeyIndexes) {\n const pubkey = accountKeys.get(keyIndex);\n if (pubkey === undefined) {\n throw new Error(`Failed to find key for account key index ${keyIndex}`);\n }\n const isSigner = keyIndex < numRequiredSignatures;\n let isWritable;\n if (isSigner) {\n isWritable = keyIndex < numWritableSignedAccounts;\n } else if (keyIndex < accountKeys.staticAccountKeys.length) {\n isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts;\n } else {\n isWritable = keyIndex - accountKeys.staticAccountKeys.length <\n // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above\n accountKeys.accountKeysFromLookups.writable.length;\n }\n keys.push({\n pubkey,\n isSigner: keyIndex < header.numRequiredSignatures,\n isWritable\n });\n }\n const programId = accountKeys.get(compiledIx.programIdIndex);\n if (programId === undefined) {\n throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`);\n }\n instructions.push(new TransactionInstruction({\n programId,\n data: toBuffer(compiledIx.data),\n keys\n }));\n }\n return new TransactionMessage({\n payerKey,\n instructions,\n recentBlockhash\n });\n }\n compileToLegacyMessage() {\n return Message.compile({\n payerKey: this.payerKey,\n recentBlockhash: this.recentBlockhash,\n instructions: this.instructions\n });\n }\n compileToV0Message(addressLookupTableAccounts) {\n return MessageV0.compile({\n payerKey: this.payerKey,\n recentBlockhash: this.recentBlockhash,\n instructions: this.instructions,\n addressLookupTableAccounts\n });\n }\n}\n\n/**\n * Versioned transaction class\n */\nclass VersionedTransaction {\n get version() {\n return this.message.version;\n }\n constructor(message, signatures) {\n this.signatures = void 0;\n this.message = void 0;\n if (signatures !== undefined) {\n assert(signatures.length === message.header.numRequiredSignatures, 'Expected signatures length to be equal to the number of required signatures');\n this.signatures = signatures;\n } else {\n const defaultSignatures = [];\n for (let i = 0; i < message.header.numRequiredSignatures; i++) {\n defaultSignatures.push(new Uint8Array(SIGNATURE_LENGTH_IN_BYTES));\n }\n this.signatures = defaultSignatures;\n }\n this.message = message;\n }\n serialize() {\n const serializedMessage = this.message.serialize();\n const encodedSignaturesLength = Array();\n encodeLength(encodedSignaturesLength, this.signatures.length);\n const transactionLayout = BufferLayout.struct([BufferLayout.blob(encodedSignaturesLength.length, 'encodedSignaturesLength'), BufferLayout.seq(signature(), this.signatures.length, 'signatures'), BufferLayout.blob(serializedMessage.length, 'serializedMessage')]);\n const serializedTransaction = new Uint8Array(2048);\n const serializedTransactionLength = transactionLayout.encode({\n encodedSignaturesLength: new Uint8Array(encodedSignaturesLength),\n signatures: this.signatures,\n serializedMessage\n }, serializedTransaction);\n return serializedTransaction.slice(0, serializedTransactionLength);\n }\n static deserialize(serializedTransaction) {\n let byteArray = [...serializedTransaction];\n const signatures = [];\n const signaturesLength = decodeLength(byteArray);\n for (let i = 0; i < signaturesLength; i++) {\n signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES)));\n }\n const message = VersionedMessage.deserialize(new Uint8Array(byteArray));\n return new VersionedTransaction(message, signatures);\n }\n sign(signers) {\n const messageData = this.message.serialize();\n const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);\n for (const signer of signers) {\n const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(signer.publicKey));\n assert(signerIndex >= 0, `Cannot sign with non signer key ${signer.publicKey.toBase58()}`);\n this.signatures[signerIndex] = sign(messageData, signer.secretKey);\n }\n }\n addSignature(publicKey, signature) {\n assert(signature.byteLength === 64, 'Signature must be 64 bytes long');\n const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures);\n const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(publicKey));\n assert(signerIndex >= 0, `Can not add signature; \\`${publicKey.toBase58()}\\` is not required to sign this transaction`);\n this.signatures[signerIndex] = signature;\n }\n}\n\n// TODO: These constants should be removed in favor of reading them out of a\n// Syscall account\n\n/**\n * @internal\n */\nconst NUM_TICKS_PER_SECOND = 160;\n\n/**\n * @internal\n */\nconst DEFAULT_TICKS_PER_SLOT = 64;\n\n/**\n * @internal\n */\nconst NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT;\n\n/**\n * @internal\n */\nconst MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND;\n\nconst SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111');\nconst SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111');\nconst SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111');\nconst SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey('SysvarRecentB1ockHashes11111111111111111111');\nconst SYSVAR_RENT_PUBKEY = new PublicKey('SysvarRent111111111111111111111111111111111');\nconst SYSVAR_REWARDS_PUBKEY = new PublicKey('SysvarRewards111111111111111111111111111111');\nconst SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey('SysvarS1otHashes111111111111111111111111111');\nconst SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey('SysvarS1otHistory11111111111111111111111111');\nconst SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey('SysvarStakeHistory1111111111111111111111111');\n\nclass SendTransactionError extends Error {\n constructor({\n action,\n signature,\n transactionMessage,\n logs\n }) {\n const maybeLogsOutput = logs ? `Logs: \\n${JSON.stringify(logs.slice(-10), null, 2)}. ` : '';\n const guideText = '\\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.';\n let message;\n switch (action) {\n case 'send':\n message = `Transaction ${signature} resulted in an error. \\n` + `${transactionMessage}. ` + maybeLogsOutput + guideText;\n break;\n case 'simulate':\n message = `Simulation failed. \\nMessage: ${transactionMessage}. \\n` + maybeLogsOutput + guideText;\n break;\n default:\n {\n message = `Unknown action '${(a => a)(action)}'`;\n }\n }\n super(message);\n this.signature = void 0;\n this.transactionMessage = void 0;\n this.transactionLogs = void 0;\n this.signature = signature;\n this.transactionMessage = transactionMessage;\n this.transactionLogs = logs ? logs : undefined;\n }\n get transactionError() {\n return {\n message: this.transactionMessage,\n logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined\n };\n }\n\n /* @deprecated Use `await getLogs()` instead */\n get logs() {\n const cachedLogs = this.transactionLogs;\n if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) {\n return undefined;\n }\n return cachedLogs;\n }\n async getLogs(connection) {\n if (!Array.isArray(this.transactionLogs)) {\n this.transactionLogs = new Promise((resolve, reject) => {\n connection.getTransaction(this.signature).then(tx => {\n if (tx && tx.meta && tx.meta.logMessages) {\n const logs = tx.meta.logMessages;\n this.transactionLogs = logs;\n resolve(logs);\n } else {\n reject(new Error('Log messages not found'));\n }\n }).catch(reject);\n });\n }\n return await this.transactionLogs;\n }\n}\n\n// Keep in sync with client/src/rpc_custom_errors.rs\n// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/\nconst SolanaJSONRPCErrorCode = {\n JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001,\n JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002,\n JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003,\n JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004,\n JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005,\n JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006,\n JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007,\n JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008,\n JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009,\n JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010,\n JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011,\n JSON_RPC_SCAN_ERROR: -32012,\n JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013,\n JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014,\n JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015,\n JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016\n};\nclass SolanaJSONRPCError extends Error {\n constructor({\n code,\n message,\n data\n }, customMessage) {\n super(customMessage != null ? `${customMessage}: ${message}` : message);\n this.code = void 0;\n this.data = void 0;\n this.code = code;\n this.data = data;\n this.name = 'SolanaJSONRPCError';\n }\n}\n\n/**\n * Sign, send and confirm a transaction.\n *\n * If `commitment` option is not specified, defaults to 'max' commitment.\n *\n * @param {Connection} connection\n * @param {Transaction} transaction\n * @param {Array} signers\n * @param {ConfirmOptions} [options]\n * @returns {Promise}\n */\nasync function sendAndConfirmTransaction(connection, transaction, signers, options) {\n const sendOptions = options && {\n skipPreflight: options.skipPreflight,\n preflightCommitment: options.preflightCommitment || options.commitment,\n maxRetries: options.maxRetries,\n minContextSlot: options.minContextSlot\n };\n const signature = await connection.sendTransaction(transaction, signers, sendOptions);\n let status;\n if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) {\n status = (await connection.confirmTransaction({\n abortSignal: options?.abortSignal,\n signature: signature,\n blockhash: transaction.recentBlockhash,\n lastValidBlockHeight: transaction.lastValidBlockHeight\n }, options && options.commitment)).value;\n } else if (transaction.minNonceContextSlot != null && transaction.nonceInfo != null) {\n const {\n nonceInstruction\n } = transaction.nonceInfo;\n const nonceAccountPubkey = nonceInstruction.keys[0].pubkey;\n status = (await connection.confirmTransaction({\n abortSignal: options?.abortSignal,\n minContextSlot: transaction.minNonceContextSlot,\n nonceAccountPubkey,\n nonceValue: transaction.nonceInfo.nonce,\n signature\n }, options && options.commitment)).value;\n } else {\n if (options?.abortSignal != null) {\n console.warn('sendAndConfirmTransaction(): A transaction with a deprecated confirmation strategy was ' + 'supplied along with an `abortSignal`. Only transactions having `lastValidBlockHeight` ' + 'or a combination of `nonceInfo` and `minNonceContextSlot` are abortable.');\n }\n status = (await connection.confirmTransaction(signature, options && options.commitment)).value;\n }\n if (status.err) {\n if (signature != null) {\n throw new SendTransactionError({\n action: 'send',\n signature: signature,\n transactionMessage: `Status: (${JSON.stringify(status)})`\n });\n }\n throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`);\n }\n return signature;\n}\n\n// zzz\nfunction sleep(ms) {\n return new Promise(resolve => setTimeout(resolve, ms));\n}\n\n/**\n * @internal\n */\n\n/**\n * Populate a buffer of instruction data using an InstructionType\n * @internal\n */\nfunction encodeData(type, fields) {\n const allocLength = type.layout.span >= 0 ? type.layout.span : getAlloc(type, fields);\n const data = Buffer.alloc(allocLength);\n const layoutFields = Object.assign({\n instruction: type.index\n }, fields);\n type.layout.encode(layoutFields, data);\n return data;\n}\n\n/**\n * Decode instruction data buffer using an InstructionType\n * @internal\n */\nfunction decodeData$1(type, buffer) {\n let data;\n try {\n data = type.layout.decode(buffer);\n } catch (err) {\n throw new Error('invalid instruction; ' + err);\n }\n if (data.instruction !== type.index) {\n throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`);\n }\n return data;\n}\n\n/**\n * https://github.com/solana-labs/solana/blob/90bedd7e067b5b8f3ddbb45da00a4e9cabb22c62/sdk/src/fee_calculator.rs#L7-L11\n *\n * @internal\n */\nconst FeeCalculatorLayout = BufferLayout.nu64('lamportsPerSignature');\n\n/**\n * Calculator for transaction fees.\n *\n * @deprecated Deprecated since Solana v1.8.0.\n */\n\n/**\n * See https://github.com/solana-labs/solana/blob/0ea2843ec9cdc517572b8e62c959f41b55cf4453/sdk/src/nonce_state.rs#L29-L32\n *\n * @internal\n */\nconst NonceAccountLayout = BufferLayout.struct([BufferLayout.u32('version'), BufferLayout.u32('state'), publicKey('authorizedPubkey'), publicKey('nonce'), BufferLayout.struct([FeeCalculatorLayout], 'feeCalculator')]);\nconst NONCE_ACCOUNT_LENGTH = NonceAccountLayout.span;\n\n/**\n * A durable nonce is a 32 byte value encoded as a base58 string.\n */\n\n/**\n * NonceAccount class\n */\nclass NonceAccount {\n /**\n * @internal\n */\n constructor(args) {\n this.authorizedPubkey = void 0;\n this.nonce = void 0;\n this.feeCalculator = void 0;\n this.authorizedPubkey = args.authorizedPubkey;\n this.nonce = args.nonce;\n this.feeCalculator = args.feeCalculator;\n }\n\n /**\n * Deserialize NonceAccount from the account data.\n *\n * @param buffer account data\n * @return NonceAccount\n */\n static fromAccountData(buffer) {\n const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0);\n return new NonceAccount({\n authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey),\n nonce: new PublicKey(nonceAccount.nonce).toString(),\n feeCalculator: nonceAccount.feeCalculator\n });\n }\n}\n\nfunction u64(property) {\n const layout = blob(8 /* bytes */, property);\n const decode = layout.decode.bind(layout);\n const encode = layout.encode.bind(layout);\n const bigIntLayout = layout;\n const codec = getU64Codec();\n bigIntLayout.decode = (buffer, offset) => {\n const src = decode(buffer, offset);\n return codec.decode(src);\n };\n bigIntLayout.encode = (bigInt, buffer, offset) => {\n const src = codec.encode(bigInt);\n return encode(src, buffer, offset);\n };\n return bigIntLayout;\n}\n\n/**\n * Create account system transaction params\n */\n\n/**\n * Transfer system transaction params\n */\n\n/**\n * Assign system transaction params\n */\n\n/**\n * Create account with seed system transaction params\n */\n\n/**\n * Create nonce account system transaction params\n */\n\n/**\n * Create nonce account with seed system transaction params\n */\n\n/**\n * Initialize nonce account system instruction params\n */\n\n/**\n * Advance nonce account system instruction params\n */\n\n/**\n * Withdraw nonce account system transaction params\n */\n\n/**\n * Authorize nonce account system transaction params\n */\n\n/**\n * Allocate account system transaction params\n */\n\n/**\n * Allocate account with seed system transaction params\n */\n\n/**\n * Assign account with seed system transaction params\n */\n\n/**\n * Transfer with seed system transaction params\n */\n\n/** Decoded transfer system transaction instruction */\n\n/** Decoded transferWithSeed system transaction instruction */\n\n/**\n * System Instruction class\n */\nclass SystemInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a system instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a SystemInstruction');\n }\n return type;\n }\n\n /**\n * Decode a create account system instruction and retrieve the instruction params.\n */\n static decodeCreateAccount(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n lamports,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n newAccountPubkey: instruction.keys[1].pubkey,\n lamports,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a transfer system instruction and retrieve the instruction params.\n */\n static decodeTransfer(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n lamports\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a transfer with seed system instruction and retrieve the instruction params.\n */\n static decodeTransferWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports,\n seed,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n basePubkey: instruction.keys[1].pubkey,\n toPubkey: instruction.keys[2].pubkey,\n lamports,\n seed,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an allocate system instruction and retrieve the instruction params.\n */\n static decodeAllocate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n space\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n space\n };\n }\n\n /**\n * Decode an allocate with seed system instruction and retrieve the instruction params.\n */\n static decodeAllocateWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n base,\n seed,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an assign system instruction and retrieve the instruction params.\n */\n static decodeAssign(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode an assign with seed system instruction and retrieve the instruction params.\n */\n static decodeAssignWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 1);\n const {\n base,\n seed,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data);\n return {\n accountPubkey: instruction.keys[0].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a create account with seed system instruction and retrieve the instruction params.\n */\n static decodeCreateWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n base,\n seed,\n lamports,\n space,\n programId\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed, instruction.data);\n return {\n fromPubkey: instruction.keys[0].pubkey,\n newAccountPubkey: instruction.keys[1].pubkey,\n basePubkey: new PublicKey(base),\n seed,\n lamports,\n space,\n programId: new PublicKey(programId)\n };\n }\n\n /**\n * Decode a nonce initialize system instruction and retrieve the instruction params.\n */\n static decodeNonceInitialize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n authorized\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: new PublicKey(authorized)\n };\n }\n\n /**\n * Decode a nonce advance system instruction and retrieve the instruction params.\n */\n static decodeNonceAdvance(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey\n };\n }\n\n /**\n * Decode a nonce withdraw system instruction and retrieve the instruction params.\n */\n static decodeNonceWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 5);\n const {\n lamports\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a nonce authorize system instruction and retrieve the instruction params.\n */\n static decodeNonceAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n authorized\n } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount, instruction.data);\n return {\n noncePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[1].pubkey,\n newAuthorizedPubkey: new PublicKey(authorized)\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(SystemProgram.programId)) {\n throw new Error('invalid instruction; programId is not SystemProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid SystemInstructionType's\n */\n\n/**\n * An enumeration of valid system InstructionType's\n * @internal\n */\nconst SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({\n Create: {\n index: 0,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports'), BufferLayout.ns64('space'), publicKey('programId')])\n },\n Assign: {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('programId')])\n },\n Transfer: {\n index: 2,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64('lamports')])\n },\n CreateWithSeed: {\n index: 3,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('base'), rustString('seed'), BufferLayout.ns64('lamports'), BufferLayout.ns64('space'), publicKey('programId')])\n },\n AdvanceNonceAccount: {\n index: 4,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n WithdrawNonceAccount: {\n index: 5,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])\n },\n InitializeNonceAccount: {\n index: 6,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('authorized')])\n },\n AuthorizeNonceAccount: {\n index: 7,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('authorized')])\n },\n Allocate: {\n index: 8,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('space')])\n },\n AllocateWithSeed: {\n index: 9,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('base'), rustString('seed'), BufferLayout.ns64('space'), publicKey('programId')])\n },\n AssignWithSeed: {\n index: 10,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('base'), rustString('seed'), publicKey('programId')])\n },\n TransferWithSeed: {\n index: 11,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])\n },\n UpgradeNonceAccount: {\n index: 12,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n }\n});\n\n/**\n * Factory class for transactions to interact with the System program\n */\nclass SystemProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the System program\n */\n\n /**\n * Generate a transaction instruction that creates a new account\n */\n static createAccount(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Create;\n const data = encodeData(type, {\n lamports: params.lamports,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.newAccountPubkey,\n isSigner: true,\n isWritable: true\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that transfers lamports from one account to another\n */\n static transfer(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed;\n data = encodeData(type, {\n lamports: BigInt(params.lamports),\n seed: params.seed,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.fromPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Transfer;\n data = encodeData(type, {\n lamports: BigInt(params.lamports)\n });\n keys = [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that assigns an account to a program\n */\n static assign(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed;\n data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Assign;\n data = encodeData(type, {\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: true,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that creates a new account at\n * an address generated with `from`, a seed, and programId\n */\n static createAccountWithSeed(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed;\n const data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n lamports: params.lamports,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n let keys = [{\n pubkey: params.fromPubkey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: params.newAccountPubkey,\n isSigner: false,\n isWritable: true\n }];\n if (!params.basePubkey.equals(params.fromPubkey)) {\n keys.push({\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction that creates a new Nonce account\n */\n static createNonceAccount(params) {\n const transaction = new Transaction();\n if ('basePubkey' in params && 'seed' in params) {\n transaction.add(SystemProgram.createAccountWithSeed({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.noncePubkey,\n basePubkey: params.basePubkey,\n seed: params.seed,\n lamports: params.lamports,\n space: NONCE_ACCOUNT_LENGTH,\n programId: this.programId\n }));\n } else {\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.noncePubkey,\n lamports: params.lamports,\n space: NONCE_ACCOUNT_LENGTH,\n programId: this.programId\n }));\n }\n const initParams = {\n noncePubkey: params.noncePubkey,\n authorizedPubkey: params.authorizedPubkey\n };\n transaction.add(this.nonceInitialize(initParams));\n return transaction;\n }\n\n /**\n * Generate an instruction to initialize a Nonce account\n */\n static nonceInitialize(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount;\n const data = encodeData(type, {\n authorized: toBuffer(params.authorizedPubkey.toBuffer())\n });\n const instructionData = {\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate an instruction to advance the nonce in a Nonce account\n */\n static nonceAdvance(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount;\n const data = encodeData(type);\n const instructionData = {\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a transaction instruction that withdraws lamports from a Nonce account\n */\n static nonceWithdraw(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount;\n const data = encodeData(type, {\n lamports: params.lamports\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that authorizes a new PublicKey as the authority\n * on a Nonce account.\n */\n static nonceAuthorize(params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount;\n const data = encodeData(type, {\n authorized: toBuffer(params.newAuthorizedPubkey.toBuffer())\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: params.noncePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction instruction that allocates space in an account without funding\n */\n static allocate(params) {\n let data;\n let keys;\n if ('basePubkey' in params) {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed;\n data = encodeData(type, {\n base: toBuffer(params.basePubkey.toBuffer()),\n seed: params.seed,\n space: params.space,\n programId: toBuffer(params.programId.toBuffer())\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.basePubkey,\n isSigner: true,\n isWritable: false\n }];\n } else {\n const type = SYSTEM_INSTRUCTION_LAYOUTS.Allocate;\n data = encodeData(type, {\n space: params.space\n });\n keys = [{\n pubkey: params.accountPubkey,\n isSigner: true,\n isWritable: true\n }];\n }\n return new TransactionInstruction({\n keys,\n programId: this.programId,\n data\n });\n }\n}\nSystemProgram.programId = new PublicKey('11111111111111111111111111111111');\n\n// Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the\n// rest of the Transaction fields\n//\n// TODO: replace 300 with a proper constant for the size of the other\n// Transaction fields\nconst CHUNK_SIZE = PACKET_DATA_SIZE - 300;\n\n/**\n * Program loader interface\n */\nclass Loader {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Amount of program data placed in each load Transaction\n */\n\n /**\n * Minimum number of signatures required to load a program not including\n * retries\n *\n * Can be used to calculate transaction fees\n */\n static getMinNumSignatures(dataLength) {\n return 2 * (\n // Every transaction requires two signatures (payer + program)\n Math.ceil(dataLength / Loader.chunkSize) + 1 +\n // Add one for Create transaction\n 1) // Add one for Finalize transaction\n ;\n }\n\n /**\n * Loads a generic program\n *\n * @param connection The connection to use\n * @param payer System account that pays to load the program\n * @param program Account to load the program into\n * @param programId Public key that identifies the loader\n * @param data Program octets\n * @return true if program was loaded successfully, false if program was already loaded\n */\n static async load(connection, payer, program, programId, data) {\n {\n const balanceNeeded = await connection.getMinimumBalanceForRentExemption(data.length);\n\n // Fetch program account info to check if it has already been created\n const programInfo = await connection.getAccountInfo(program.publicKey, 'confirmed');\n let transaction = null;\n if (programInfo !== null) {\n if (programInfo.executable) {\n console.error('Program load failed, account is already executable');\n return false;\n }\n if (programInfo.data.length !== data.length) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.allocate({\n accountPubkey: program.publicKey,\n space: data.length\n }));\n }\n if (!programInfo.owner.equals(programId)) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.assign({\n accountPubkey: program.publicKey,\n programId\n }));\n }\n if (programInfo.lamports < balanceNeeded) {\n transaction = transaction || new Transaction();\n transaction.add(SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: program.publicKey,\n lamports: balanceNeeded - programInfo.lamports\n }));\n }\n } else {\n transaction = new Transaction().add(SystemProgram.createAccount({\n fromPubkey: payer.publicKey,\n newAccountPubkey: program.publicKey,\n lamports: balanceNeeded > 0 ? balanceNeeded : 1,\n space: data.length,\n programId\n }));\n }\n\n // If the account is already created correctly, skip this step\n // and proceed directly to loading instructions\n if (transaction !== null) {\n await sendAndConfirmTransaction(connection, transaction, [payer, program], {\n commitment: 'confirmed'\n });\n }\n }\n const dataLayout = BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.u32('offset'), BufferLayout.u32('bytesLength'), BufferLayout.u32('bytesLengthPadding'), BufferLayout.seq(BufferLayout.u8('byte'), BufferLayout.offset(BufferLayout.u32(), -8), 'bytes')]);\n const chunkSize = Loader.chunkSize;\n let offset = 0;\n let array = data;\n let transactions = [];\n while (array.length > 0) {\n const bytes = array.slice(0, chunkSize);\n const data = Buffer.alloc(chunkSize + 16);\n dataLayout.encode({\n instruction: 0,\n // Load instruction\n offset,\n bytes: bytes,\n bytesLength: 0,\n bytesLengthPadding: 0\n }, data);\n const transaction = new Transaction().add({\n keys: [{\n pubkey: program.publicKey,\n isSigner: true,\n isWritable: true\n }],\n programId,\n data\n });\n transactions.push(sendAndConfirmTransaction(connection, transaction, [payer, program], {\n commitment: 'confirmed'\n }));\n\n // Delay between sends in an attempt to reduce rate limit errors\n if (connection._rpcEndpoint.includes('solana.com')) {\n const REQUESTS_PER_SECOND = 4;\n await sleep(1000 / REQUESTS_PER_SECOND);\n }\n offset += chunkSize;\n array = array.slice(chunkSize);\n }\n await Promise.all(transactions);\n\n // Finalize the account loaded with program data for execution\n {\n const dataLayout = BufferLayout.struct([BufferLayout.u32('instruction')]);\n const data = Buffer.alloc(dataLayout.span);\n dataLayout.encode({\n instruction: 1 // Finalize instruction\n }, data);\n const transaction = new Transaction().add({\n keys: [{\n pubkey: program.publicKey,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId,\n data\n });\n const deployCommitment = 'processed';\n const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], {\n preflightCommitment: deployCommitment\n });\n const {\n context,\n value\n } = await connection.confirmTransaction({\n signature: finalizeSignature,\n lastValidBlockHeight: transaction.lastValidBlockHeight,\n blockhash: transaction.recentBlockhash\n }, deployCommitment);\n if (value.err) {\n throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`);\n }\n // We prevent programs from being usable until the slot after their deployment.\n // See https://github.com/solana-labs/solana/pull/29654\n while (true // eslint-disable-line no-constant-condition\n ) {\n try {\n const currentSlot = await connection.getSlot({\n commitment: deployCommitment\n });\n if (currentSlot > context.slot) {\n break;\n }\n } catch {\n /* empty */\n }\n await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2)));\n }\n }\n\n // success\n return true;\n }\n}\nLoader.chunkSize = CHUNK_SIZE;\n\n/**\n * @deprecated Deprecated since Solana v1.17.20.\n */\nconst BPF_LOADER_PROGRAM_ID = new PublicKey('BPFLoader2111111111111111111111111111111111');\n\n/**\n * Factory class for transactions to interact with a program loader\n *\n * @deprecated Deprecated since Solana v1.17.20.\n */\nclass BpfLoader {\n /**\n * Minimum number of signatures required to load a program not including\n * retries\n *\n * Can be used to calculate transaction fees\n */\n static getMinNumSignatures(dataLength) {\n return Loader.getMinNumSignatures(dataLength);\n }\n\n /**\n * Load a SBF program\n *\n * @param connection The connection to use\n * @param payer Account that will pay program loading fees\n * @param program Account to load the program into\n * @param elf The entire ELF containing the SBF program\n * @param loaderProgramId The program id of the BPF loader to use\n * @return true if program was loaded successfully, false if program was already loaded\n */\n static load(connection, payer, program, elf, loaderProgramId) {\n return Loader.load(connection, payer, program, loaderProgramId, elf);\n }\n}\n\nfunction getDefaultExportFromCjs (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nvar fastStableStringify$1;\nvar hasRequiredFastStableStringify;\n\nfunction requireFastStableStringify () {\n\tif (hasRequiredFastStableStringify) return fastStableStringify$1;\n\thasRequiredFastStableStringify = 1;\n\tvar objToString = Object.prototype.toString;\n\tvar objKeys = Object.keys || function(obj) {\n\t\t\tvar keys = [];\n\t\t\tfor (var name in obj) {\n\t\t\t\tkeys.push(name);\n\t\t\t}\n\t\t\treturn keys;\n\t\t};\n\n\tfunction stringify(val, isArrayProp) {\n\t\tvar i, max, str, keys, key, propVal, toStr;\n\t\tif (val === true) {\n\t\t\treturn \"true\";\n\t\t}\n\t\tif (val === false) {\n\t\t\treturn \"false\";\n\t\t}\n\t\tswitch (typeof val) {\n\t\t\tcase \"object\":\n\t\t\t\tif (val === null) {\n\t\t\t\t\treturn null;\n\t\t\t\t} else if (val.toJSON && typeof val.toJSON === \"function\") {\n\t\t\t\t\treturn stringify(val.toJSON(), isArrayProp);\n\t\t\t\t} else {\n\t\t\t\t\ttoStr = objToString.call(val);\n\t\t\t\t\tif (toStr === \"[object Array]\") {\n\t\t\t\t\t\tstr = '[';\n\t\t\t\t\t\tmax = val.length - 1;\n\t\t\t\t\t\tfor(i = 0; i < max; i++) {\n\t\t\t\t\t\t\tstr += stringify(val[i], true) + ',';\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (max > -1) {\n\t\t\t\t\t\t\tstr += stringify(val[i], true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn str + ']';\n\t\t\t\t\t} else if (toStr === \"[object Object]\") {\n\t\t\t\t\t\t// only object is left\n\t\t\t\t\t\tkeys = objKeys(val).sort();\n\t\t\t\t\t\tmax = keys.length;\n\t\t\t\t\t\tstr = \"\";\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\twhile (i < max) {\n\t\t\t\t\t\t\tkey = keys[i];\n\t\t\t\t\t\t\tpropVal = stringify(val[key], false);\n\t\t\t\t\t\t\tif (propVal !== undefined) {\n\t\t\t\t\t\t\t\tif (str) {\n\t\t\t\t\t\t\t\t\tstr += ',';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tstr += JSON.stringify(key) + ':' + propVal;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn '{' + str + '}';\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn JSON.stringify(val);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\tcase \"function\":\n\t\t\tcase \"undefined\":\n\t\t\t\treturn isArrayProp ? null : undefined;\n\t\t\tcase \"string\":\n\t\t\t\treturn JSON.stringify(val);\n\t\t\tdefault:\n\t\t\t\treturn isFinite(val) ? val : null;\n\t\t}\n\t}\n\n\tfastStableStringify$1 = function(val) {\n\t\tvar returnVal = stringify(val, false);\n\t\tif (returnVal !== undefined) {\n\t\t\treturn ''+ returnVal;\n\t\t}\n\t};\n\treturn fastStableStringify$1;\n}\n\nvar fastStableStringifyExports = /*@__PURE__*/ requireFastStableStringify();\nvar fastStableStringify = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringifyExports);\n\nconst MINIMUM_SLOT_PER_EPOCH = 32;\n\n// Returns the number of trailing zeros in the binary representation of self.\nfunction trailingZeros(n) {\n let trailingZeros = 0;\n while (n > 1) {\n n /= 2;\n trailingZeros++;\n }\n return trailingZeros;\n}\n\n// Returns the smallest power of two greater than or equal to n\nfunction nextPowerOfTwo(n) {\n if (n === 0) return 1;\n n--;\n n |= n >> 1;\n n |= n >> 2;\n n |= n >> 4;\n n |= n >> 8;\n n |= n >> 16;\n n |= n >> 32;\n return n + 1;\n}\n\n/**\n * Epoch schedule\n * (see https://docs.solana.com/terminology#epoch)\n * Can be retrieved with the {@link Connection.getEpochSchedule} method\n */\nclass EpochSchedule {\n constructor(slotsPerEpoch, leaderScheduleSlotOffset, warmup, firstNormalEpoch, firstNormalSlot) {\n /** The maximum number of slots in each epoch */\n this.slotsPerEpoch = void 0;\n /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */\n this.leaderScheduleSlotOffset = void 0;\n /** Indicates whether epochs start short and grow */\n this.warmup = void 0;\n /** The first epoch with `slotsPerEpoch` slots */\n this.firstNormalEpoch = void 0;\n /** The first slot of `firstNormalEpoch` */\n this.firstNormalSlot = void 0;\n this.slotsPerEpoch = slotsPerEpoch;\n this.leaderScheduleSlotOffset = leaderScheduleSlotOffset;\n this.warmup = warmup;\n this.firstNormalEpoch = firstNormalEpoch;\n this.firstNormalSlot = firstNormalSlot;\n }\n getEpoch(slot) {\n return this.getEpochAndSlotIndex(slot)[0];\n }\n getEpochAndSlotIndex(slot) {\n if (slot < this.firstNormalSlot) {\n const epoch = trailingZeros(nextPowerOfTwo(slot + MINIMUM_SLOT_PER_EPOCH + 1)) - trailingZeros(MINIMUM_SLOT_PER_EPOCH) - 1;\n const epochLen = this.getSlotsInEpoch(epoch);\n const slotIndex = slot - (epochLen - MINIMUM_SLOT_PER_EPOCH);\n return [epoch, slotIndex];\n } else {\n const normalSlotIndex = slot - this.firstNormalSlot;\n const normalEpochIndex = Math.floor(normalSlotIndex / this.slotsPerEpoch);\n const epoch = this.firstNormalEpoch + normalEpochIndex;\n const slotIndex = normalSlotIndex % this.slotsPerEpoch;\n return [epoch, slotIndex];\n }\n }\n getFirstSlotInEpoch(epoch) {\n if (epoch <= this.firstNormalEpoch) {\n return (Math.pow(2, epoch) - 1) * MINIMUM_SLOT_PER_EPOCH;\n } else {\n return (epoch - this.firstNormalEpoch) * this.slotsPerEpoch + this.firstNormalSlot;\n }\n }\n getLastSlotInEpoch(epoch) {\n return this.getFirstSlotInEpoch(epoch) + this.getSlotsInEpoch(epoch) - 1;\n }\n getSlotsInEpoch(epoch) {\n if (epoch < this.firstNormalEpoch) {\n return Math.pow(2, epoch + trailingZeros(MINIMUM_SLOT_PER_EPOCH));\n } else {\n return this.slotsPerEpoch;\n }\n }\n}\n\nvar fetchImpl = globalThis.fetch;\n\nclass RpcWebSocketClient extends CommonClient {\n constructor(address, options, generate_request_id) {\n const webSocketFactory = url => {\n const rpc = WebSocket(url, {\n autoconnect: true,\n max_reconnects: 5,\n reconnect: true,\n reconnect_interval: 1000,\n ...options\n });\n if ('socket' in rpc) {\n this.underlyingSocket = rpc.socket;\n } else {\n this.underlyingSocket = rpc;\n }\n return rpc;\n };\n super(webSocketFactory, address, options, generate_request_id);\n this.underlyingSocket = void 0;\n }\n call(...args) {\n const readyState = this.underlyingSocket?.readyState;\n if (readyState === 1 /* WebSocket.OPEN */) {\n return super.call(...args);\n }\n return Promise.reject(new Error('Tried to call a JSON-RPC method `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')'));\n }\n notify(...args) {\n const readyState = this.underlyingSocket?.readyState;\n if (readyState === 1 /* WebSocket.OPEN */) {\n return super.notify(...args);\n }\n return Promise.reject(new Error('Tried to send a JSON-RPC notification `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')'));\n }\n}\n\n/**\n * @internal\n */\n\n/**\n * Decode account data buffer using an AccountType\n * @internal\n */\nfunction decodeData(type, data) {\n let decoded;\n try {\n decoded = type.layout.decode(data);\n } catch (err) {\n throw new Error('invalid instruction; ' + err);\n }\n if (decoded.typeIndex !== type.index) {\n throw new Error(`invalid account data; account type mismatch ${decoded.typeIndex} != ${type.index}`);\n }\n return decoded;\n}\n\n/// The serialized size of lookup table metadata\nconst LOOKUP_TABLE_META_SIZE = 56;\nclass AddressLookupTableAccount {\n constructor(args) {\n this.key = void 0;\n this.state = void 0;\n this.key = args.key;\n this.state = args.state;\n }\n isActive() {\n const U64_MAX = BigInt('0xffffffffffffffff');\n return this.state.deactivationSlot === U64_MAX;\n }\n static deserialize(accountData) {\n const meta = decodeData(LookupTableMetaLayout, accountData);\n const serializedAddressesLen = accountData.length - LOOKUP_TABLE_META_SIZE;\n assert(serializedAddressesLen >= 0, 'lookup table is invalid');\n assert(serializedAddressesLen % 32 === 0, 'lookup table is invalid');\n const numSerializedAddresses = serializedAddressesLen / 32;\n const {\n addresses\n } = BufferLayout.struct([BufferLayout.seq(publicKey(), numSerializedAddresses, 'addresses')]).decode(accountData.slice(LOOKUP_TABLE_META_SIZE));\n return {\n deactivationSlot: meta.deactivationSlot,\n lastExtendedSlot: meta.lastExtendedSlot,\n lastExtendedSlotStartIndex: meta.lastExtendedStartIndex,\n authority: meta.authority.length !== 0 ? new PublicKey(meta.authority[0]) : undefined,\n addresses: addresses.map(address => new PublicKey(address))\n };\n }\n}\nconst LookupTableMetaLayout = {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u32('typeIndex'), u64('deactivationSlot'), BufferLayout.nu64('lastExtendedSlot'), BufferLayout.u8('lastExtendedStartIndex'), BufferLayout.u8(),\n // option\n BufferLayout.seq(publicKey(), BufferLayout.offset(BufferLayout.u8(), -1), 'authority')])\n};\n\nconst URL_RE = /^[^:]+:\\/\\/([^:[]+|\\[[^\\]]+\\])(:\\d+)?(.*)/i;\nfunction makeWebsocketUrl(endpoint) {\n const matches = endpoint.match(URL_RE);\n if (matches == null) {\n throw TypeError(`Failed to validate endpoint URL \\`${endpoint}\\``);\n }\n const [_,\n // eslint-disable-line @typescript-eslint/no-unused-vars\n hostish, portWithColon, rest] = matches;\n const protocol = endpoint.startsWith('https:') ? 'wss:' : 'ws:';\n const startPort = portWithColon == null ? null : parseInt(portWithColon.slice(1), 10);\n const websocketPort =\n // Only shift the port by +1 as a convention for ws(s) only if given endpoint\n // is explicitly specifying the endpoint port (HTTP-based RPC), assuming\n // we're directly trying to connect to agave-validator's ws listening port.\n // When the endpoint omits the port, we're connecting to the protocol\n // default ports: http(80) or https(443) and it's assumed we're behind a reverse\n // proxy which manages WebSocket upgrade and backend port redirection.\n startPort == null ? '' : `:${startPort + 1}`;\n return `${protocol}//${hostish}${websocketPort}${rest}`;\n}\n\nconst PublicKeyFromString = coerce(instance(PublicKey), string(), value => new PublicKey(value));\nconst RawAccountDataResult = tuple([string(), literal('base64')]);\nconst BufferFromRawAccountData = coerce(instance(Buffer), RawAccountDataResult, value => Buffer.from(value[0], 'base64'));\n\n/**\n * Attempt to use a recent blockhash for up to 30 seconds\n * @internal\n */\nconst BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000;\n\n/**\n * HACK.\n * Copied from rpc-websockets/dist/lib/client.\n * Otherwise, `yarn build` fails with:\n * https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d\n */\n\n/** @internal */\n/** @internal */\n/** @internal */\n/** @internal */\n\n/** @internal */\n/**\n * @internal\n * Every subscription contains the args used to open the subscription with\n * the server, and a list of callers interested in notifications.\n */\n\n/**\n * @internal\n * A subscription may be in various states of connectedness. Only when it is\n * fully connected will it have a server subscription id associated with it.\n * This id can be returned to the server to unsubscribe the client entirely.\n */\n\n/**\n * A type that encapsulates a subscription's RPC method\n * names and notification (callback) signature.\n */\n\n/**\n * @internal\n * Utility type that keeps tagged unions intact while omitting properties.\n */\n\n/**\n * @internal\n * This type represents a single subscribable 'topic.' It's made up of:\n *\n * - The args used to open the subscription with the server,\n * - The state of the subscription, in terms of its connectedness, and\n * - The set of callbacks to call when the server publishes notifications\n *\n * This record gets indexed by `SubscriptionConfigHash` and is used to\n * set up subscriptions, fan out notifications, and track subscription state.\n */\n\n/**\n * @internal\n */\n\n/**\n * Extra contextual information for RPC responses\n */\n\n/**\n * Options for sending transactions\n */\n\n/**\n * Options for confirming transactions\n */\n\n/**\n * Options for getConfirmedSignaturesForAddress2\n */\n\n/**\n * Options for getSignaturesForAddress\n */\n\n/**\n * RPC Response with extra contextual information\n */\n\n/**\n * A strategy for confirming transactions that uses the last valid\n * block height for a given blockhash to check for transaction expiration.\n */\n\n/**\n * A strategy for confirming durable nonce transactions.\n */\n\n/**\n * Properties shared by all transaction confirmation strategies\n */\n\n/**\n * This type represents all transaction confirmation strategies\n */\n\n/* @internal */\nfunction assertEndpointUrl(putativeUrl) {\n if (/^https?:/.test(putativeUrl) === false) {\n throw new TypeError('Endpoint URL must start with `http:` or `https:`.');\n }\n return putativeUrl;\n}\n\n/** @internal */\nfunction extractCommitmentFromConfig(commitmentOrConfig) {\n let commitment;\n let config;\n if (typeof commitmentOrConfig === 'string') {\n commitment = commitmentOrConfig;\n } else if (commitmentOrConfig) {\n const {\n commitment: specifiedCommitment,\n ...specifiedConfig\n } = commitmentOrConfig;\n commitment = specifiedCommitment;\n config = specifiedConfig;\n }\n return {\n commitment,\n config\n };\n}\n\n/**\n * @internal\n */\nfunction applyDefaultMemcmpEncodingToFilters(filters) {\n return filters.map(filter => 'memcmp' in filter ? {\n ...filter,\n memcmp: {\n ...filter.memcmp,\n encoding: filter.memcmp.encoding ?? 'base58'\n }\n } : filter);\n}\n\n/**\n * @internal\n */\nfunction createRpcResult(result) {\n return union([type({\n jsonrpc: literal('2.0'),\n id: string(),\n result\n }), type({\n jsonrpc: literal('2.0'),\n id: string(),\n error: type({\n code: unknown(),\n message: string(),\n data: optional(any())\n })\n })]);\n}\nconst UnknownRpcResult = createRpcResult(unknown());\n\n/**\n * @internal\n */\nfunction jsonRpcResult(schema) {\n return coerce(createRpcResult(schema), UnknownRpcResult, value => {\n if ('error' in value) {\n return value;\n } else {\n return {\n ...value,\n result: create(value.result, schema)\n };\n }\n });\n}\n\n/**\n * @internal\n */\nfunction jsonRpcResultAndContext(value) {\n return jsonRpcResult(type({\n context: type({\n slot: number()\n }),\n value\n }));\n}\n\n/**\n * @internal\n */\nfunction notificationResultAndContext(value) {\n return type({\n context: type({\n slot: number()\n }),\n value\n });\n}\n\n/**\n * @internal\n */\nfunction versionedMessageFromResponse(version, response) {\n if (version === 0) {\n return new MessageV0({\n header: response.header,\n staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)),\n recentBlockhash: response.recentBlockhash,\n compiledInstructions: response.instructions.map(ix => ({\n programIdIndex: ix.programIdIndex,\n accountKeyIndexes: ix.accounts,\n data: bs58.decode(ix.data)\n })),\n addressTableLookups: response.addressTableLookups\n });\n } else {\n return new Message(response);\n }\n}\n\n/**\n * The level of commitment desired when querying state\n *
\n *   'processed': Query the most recent block which has reached 1 confirmation by the connected node\n *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster\n *   'finalized': Query the most recent block which has been finalized by the cluster\n * 
\n */\n\n// Deprecated as of v1.5.5\n\n/**\n * A subset of Commitment levels, which are at least optimistically confirmed\n *
\n *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster\n *   'finalized': Query the most recent block which has been finalized by the cluster\n * 
\n */\n\n/**\n * Filter for largest accounts query\n *
\n *   'circulating':    Return the largest accounts that are part of the circulating supply\n *   'nonCirculating': Return the largest accounts that are not part of the circulating supply\n * 
\n */\n\n/**\n * Configuration object for changing `getAccountInfo` query behavior\n */\n\n/**\n * Configuration object for changing `getBalance` query behavior\n */\n\n/**\n * Configuration object for changing `getBlock` query behavior\n */\n\n/**\n * Configuration object for changing `getBlock` query behavior\n */\n\n/**\n * Configuration object for changing `getStakeMinimumDelegation` query behavior\n */\n\n/**\n * Configuration object for changing `getBlockHeight` query behavior\n */\n\n/**\n * Configuration object for changing `getEpochInfo` query behavior\n */\n\n/**\n * Configuration object for changing `getInflationReward` query behavior\n */\n\n/**\n * Configuration object for changing `getLatestBlockhash` query behavior\n */\n\n/**\n * Configuration object for changing `isBlockhashValid` query behavior\n */\n\n/**\n * Configuration object for changing `getSlot` query behavior\n */\n\n/**\n * Configuration object for changing `getSlotLeader` query behavior\n */\n\n/**\n * Configuration object for changing `getTransaction` query behavior\n */\n\n/**\n * Configuration object for changing `getTransaction` query behavior\n */\n\n/**\n * Configuration object for changing `getLargestAccounts` query behavior\n */\n\n/**\n * Configuration object for changing `getSupply` request behavior\n */\n\n/**\n * Configuration object for changing query behavior\n */\n\n/**\n * Information describing a cluster node\n */\n\n/**\n * Information describing a vote account\n */\n\n/**\n * A collection of cluster vote accounts\n */\n\n/**\n * Network Inflation\n * (see https://docs.solana.com/implemented-proposals/ed_overview)\n */\n\nconst GetInflationGovernorResult = type({\n foundation: number(),\n foundationTerm: number(),\n initial: number(),\n taper: number(),\n terminal: number()\n});\n\n/**\n * The inflation reward for an epoch\n */\n\n/**\n * Expected JSON RPC response for the \"getInflationReward\" message\n */\nconst GetInflationRewardResult = jsonRpcResult(array(nullable(type({\n epoch: number(),\n effectiveSlot: number(),\n amount: number(),\n postBalance: number(),\n commission: optional(nullable(number()))\n}))));\n\n/**\n * Configuration object for changing `getRecentPrioritizationFees` query behavior\n */\n\n/**\n * Expected JSON RPC response for the \"getRecentPrioritizationFees\" message\n */\nconst GetRecentPrioritizationFeesResult = array(type({\n slot: number(),\n prioritizationFee: number()\n}));\n/**\n * Expected JSON RPC response for the \"getInflationRate\" message\n */\nconst GetInflationRateResult = type({\n total: number(),\n validator: number(),\n foundation: number(),\n epoch: number()\n});\n\n/**\n * Information about the current epoch\n */\n\nconst GetEpochInfoResult = type({\n epoch: number(),\n slotIndex: number(),\n slotsInEpoch: number(),\n absoluteSlot: number(),\n blockHeight: optional(number()),\n transactionCount: optional(number())\n});\nconst GetEpochScheduleResult = type({\n slotsPerEpoch: number(),\n leaderScheduleSlotOffset: number(),\n warmup: boolean(),\n firstNormalEpoch: number(),\n firstNormalSlot: number()\n});\n\n/**\n * Leader schedule\n * (see https://docs.solana.com/terminology#leader-schedule)\n */\n\nconst GetLeaderScheduleResult = record(string(), array(number()));\n\n/**\n * Transaction error or null\n */\nconst TransactionErrorResult = nullable(union([type({}), string()]));\n\n/**\n * Signature status for a transaction\n */\nconst SignatureStatusResult = type({\n err: TransactionErrorResult\n});\n\n/**\n * Transaction signature received notification\n */\nconst SignatureReceivedResult = literal('receivedSignature');\n\n/**\n * Version info for a node\n */\n\nconst VersionResult = type({\n 'solana-core': string(),\n 'feature-set': optional(number())\n});\nconst ParsedInstructionStruct = type({\n program: string(),\n programId: PublicKeyFromString,\n parsed: unknown()\n});\nconst PartiallyDecodedInstructionStruct = type({\n programId: PublicKeyFromString,\n accounts: array(PublicKeyFromString),\n data: string()\n});\nconst SimulatedTransactionResponseStruct = jsonRpcResultAndContext(type({\n err: nullable(union([type({}), string()])),\n logs: nullable(array(string())),\n accounts: optional(nullable(array(nullable(type({\n executable: boolean(),\n owner: string(),\n lamports: number(),\n data: array(string()),\n rentEpoch: optional(number())\n }))))),\n unitsConsumed: optional(number()),\n returnData: optional(nullable(type({\n programId: string(),\n data: tuple([string(), literal('base64')])\n }))),\n innerInstructions: optional(nullable(array(type({\n index: number(),\n instructions: array(union([ParsedInstructionStruct, PartiallyDecodedInstructionStruct]))\n }))))\n}));\n\n/**\n * Metadata for a parsed confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead.\n */\n\n/**\n * Collection of addresses loaded by a transaction using address table lookups\n */\n\n/**\n * Metadata for a parsed transaction on the ledger\n */\n\n/**\n * Metadata for a confirmed transaction on the ledger\n */\n\n/**\n * A processed transaction from the RPC API\n */\n\n/**\n * A processed transaction from the RPC API\n */\n\n/**\n * A processed transaction message from the RPC API\n */\n\n/**\n * A confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0.\n */\n\n/**\n * A partially decoded transaction instruction\n */\n\n/**\n * A parsed transaction message account\n */\n\n/**\n * A parsed transaction instruction\n */\n\n/**\n * A parsed address table lookup\n */\n\n/**\n * A parsed transaction message\n */\n\n/**\n * A parsed transaction\n */\n\n/**\n * A parsed and confirmed transaction on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead.\n */\n\n/**\n * A parsed transaction on the ledger with meta\n */\n\n/**\n * A processed block fetched from the RPC API\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`\n */\n\n/**\n * A block with parsed transactions\n */\n\n/**\n * A block with parsed transactions where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A block with parsed transactions where the `transactionDetails` mode is `none`\n */\n\n/**\n * A processed block fetched from the RPC API\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts`\n */\n\n/**\n * A processed block fetched from the RPC API where the `transactionDetails` mode is `none`\n */\n\n/**\n * A confirmed block on the ledger\n *\n * @deprecated Deprecated since RPC v1.8.0.\n */\n\n/**\n * A Block on the ledger with signatures only\n */\n\n/**\n * recent block production information\n */\n\n/**\n * Expected JSON RPC response for the \"getBlockProduction\" message\n */\nconst BlockProductionResponseStruct = jsonRpcResultAndContext(type({\n byIdentity: record(string(), array(number())),\n range: type({\n firstSlot: number(),\n lastSlot: number()\n })\n}));\n\n/**\n * A performance sample\n */\n\nfunction createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent) {\n const fetch = customFetch ? customFetch : fetchImpl;\n let agent;\n {\n if (httpAgent != null) {\n console.warn('You have supplied an `httpAgent` when creating a `Connection` in a browser environment.' + 'It has been ignored; `httpAgent` is only used in Node environments.');\n }\n }\n let fetchWithMiddleware;\n if (fetchMiddleware) {\n fetchWithMiddleware = async (info, init) => {\n const modifiedFetchArgs = await new Promise((resolve, reject) => {\n try {\n fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));\n } catch (error) {\n reject(error);\n }\n });\n return await fetch(...modifiedFetchArgs);\n };\n }\n const clientBrowser = new RpcClient(async (request, callback) => {\n const options = {\n method: 'POST',\n body: request,\n agent,\n headers: Object.assign({\n 'Content-Type': 'application/json'\n }, httpHeaders || {}, COMMON_HTTP_HEADERS)\n };\n try {\n let too_many_requests_retries = 5;\n let res;\n let waitTime = 500;\n for (;;) {\n if (fetchWithMiddleware) {\n res = await fetchWithMiddleware(url, options);\n } else {\n res = await fetch(url, options);\n }\n if (res.status !== 429 /* Too many requests */) {\n break;\n }\n if (disableRetryOnRateLimit === true) {\n break;\n }\n too_many_requests_retries -= 1;\n if (too_many_requests_retries === 0) {\n break;\n }\n console.error(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`);\n await sleep(waitTime);\n waitTime *= 2;\n }\n const text = await res.text();\n if (res.ok) {\n callback(null, text);\n } else {\n callback(new Error(`${res.status} ${res.statusText}: ${text}`));\n }\n } catch (err) {\n if (err instanceof Error) callback(err);\n }\n }, {});\n return clientBrowser;\n}\nfunction createRpcRequest(client) {\n return (method, args) => {\n return new Promise((resolve, reject) => {\n client.request(method, args, (err, response) => {\n if (err) {\n reject(err);\n return;\n }\n resolve(response);\n });\n });\n };\n}\nfunction createRpcBatchRequest(client) {\n return requests => {\n return new Promise((resolve, reject) => {\n // Do nothing if requests is empty\n if (requests.length === 0) resolve([]);\n const batch = requests.map(params => {\n return client.request(params.methodName, params.args);\n });\n client.request(batch, (err, response) => {\n if (err) {\n reject(err);\n return;\n }\n resolve(response);\n });\n });\n };\n}\n\n/**\n * Expected JSON RPC response for the \"getInflationGovernor\" message\n */\nconst GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult);\n\n/**\n * Expected JSON RPC response for the \"getInflationRate\" message\n */\nconst GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult);\n\n/**\n * Expected JSON RPC response for the \"getRecentPrioritizationFees\" message\n */\nconst GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult);\n\n/**\n * Expected JSON RPC response for the \"getEpochInfo\" message\n */\nconst GetEpochInfoRpcResult = jsonRpcResult(GetEpochInfoResult);\n\n/**\n * Expected JSON RPC response for the \"getEpochSchedule\" message\n */\nconst GetEpochScheduleRpcResult = jsonRpcResult(GetEpochScheduleResult);\n\n/**\n * Expected JSON RPC response for the \"getLeaderSchedule\" message\n */\nconst GetLeaderScheduleRpcResult = jsonRpcResult(GetLeaderScheduleResult);\n\n/**\n * Expected JSON RPC response for the \"minimumLedgerSlot\" and \"getFirstAvailableBlock\" messages\n */\nconst SlotRpcResult = jsonRpcResult(number());\n\n/**\n * Supply\n */\n\n/**\n * Expected JSON RPC response for the \"getSupply\" message\n */\nconst GetSupplyRpcResult = jsonRpcResultAndContext(type({\n total: number(),\n circulating: number(),\n nonCirculating: number(),\n nonCirculatingAccounts: array(PublicKeyFromString)\n}));\n\n/**\n * Token amount object which returns a token amount in different formats\n * for various client use cases.\n */\n\n/**\n * Expected JSON RPC structure for token amounts\n */\nconst TokenAmountResult = type({\n amount: string(),\n uiAmount: nullable(number()),\n decimals: number(),\n uiAmountString: optional(string())\n});\n\n/**\n * Token address and balance.\n */\n\n/**\n * Expected JSON RPC response for the \"getTokenLargestAccounts\" message\n */\nconst GetTokenLargestAccountsResult = jsonRpcResultAndContext(array(type({\n address: PublicKeyFromString,\n amount: string(),\n uiAmount: nullable(number()),\n decimals: number(),\n uiAmountString: optional(string())\n})));\n\n/**\n * Expected JSON RPC response for the \"getTokenAccountsByOwner\" message\n */\nconst GetTokenAccountsByOwner = jsonRpcResultAndContext(array(type({\n pubkey: PublicKeyFromString,\n account: type({\n executable: boolean(),\n owner: PublicKeyFromString,\n lamports: number(),\n data: BufferFromRawAccountData,\n rentEpoch: number()\n })\n})));\nconst ParsedAccountDataResult = type({\n program: string(),\n parsed: unknown(),\n space: number()\n});\n\n/**\n * Expected JSON RPC response for the \"getTokenAccountsByOwner\" message with parsed data\n */\nconst GetParsedTokenAccountsByOwner = jsonRpcResultAndContext(array(type({\n pubkey: PublicKeyFromString,\n account: type({\n executable: boolean(),\n owner: PublicKeyFromString,\n lamports: number(),\n data: ParsedAccountDataResult,\n rentEpoch: number()\n })\n})));\n\n/**\n * Pair of an account address and its balance\n */\n\n/**\n * Expected JSON RPC response for the \"getLargestAccounts\" message\n */\nconst GetLargestAccountsRpcResult = jsonRpcResultAndContext(array(type({\n lamports: number(),\n address: PublicKeyFromString\n})));\n\n/**\n * @internal\n */\nconst AccountInfoResult = type({\n executable: boolean(),\n owner: PublicKeyFromString,\n lamports: number(),\n data: BufferFromRawAccountData,\n rentEpoch: number()\n});\n\n/**\n * @internal\n */\nconst KeyedAccountInfoResult = type({\n pubkey: PublicKeyFromString,\n account: AccountInfoResult\n});\nconst ParsedOrRawAccountData = coerce(union([instance(Buffer), ParsedAccountDataResult]), union([RawAccountDataResult, ParsedAccountDataResult]), value => {\n if (Array.isArray(value)) {\n return create(value, BufferFromRawAccountData);\n } else {\n return value;\n }\n});\n\n/**\n * @internal\n */\nconst ParsedAccountInfoResult = type({\n executable: boolean(),\n owner: PublicKeyFromString,\n lamports: number(),\n data: ParsedOrRawAccountData,\n rentEpoch: number()\n});\nconst KeyedParsedAccountInfoResult = type({\n pubkey: PublicKeyFromString,\n account: ParsedAccountInfoResult\n});\n\n/**\n * @internal\n */\nconst StakeActivationResult = type({\n state: union([literal('active'), literal('inactive'), literal('activating'), literal('deactivating')]),\n active: number(),\n inactive: number()\n});\n\n/**\n * Expected JSON RPC response for the \"getConfirmedSignaturesForAddress2\" message\n */\n\nconst GetConfirmedSignaturesForAddress2RpcResult = jsonRpcResult(array(type({\n signature: string(),\n slot: number(),\n err: TransactionErrorResult,\n memo: nullable(string()),\n blockTime: optional(nullable(number()))\n})));\n\n/**\n * Expected JSON RPC response for the \"getSignaturesForAddress\" message\n */\nconst GetSignaturesForAddressRpcResult = jsonRpcResult(array(type({\n signature: string(),\n slot: number(),\n err: TransactionErrorResult,\n memo: nullable(string()),\n blockTime: optional(nullable(number()))\n})));\n\n/***\n * Expected JSON RPC response for the \"accountNotification\" message\n */\nconst AccountNotificationResult = type({\n subscription: number(),\n result: notificationResultAndContext(AccountInfoResult)\n});\n\n/**\n * @internal\n */\nconst ProgramAccountInfoResult = type({\n pubkey: PublicKeyFromString,\n account: AccountInfoResult\n});\n\n/***\n * Expected JSON RPC response for the \"programNotification\" message\n */\nconst ProgramAccountNotificationResult = type({\n subscription: number(),\n result: notificationResultAndContext(ProgramAccountInfoResult)\n});\n\n/**\n * @internal\n */\nconst SlotInfoResult = type({\n parent: number(),\n slot: number(),\n root: number()\n});\n\n/**\n * Expected JSON RPC response for the \"slotNotification\" message\n */\nconst SlotNotificationResult = type({\n subscription: number(),\n result: SlotInfoResult\n});\n\n/**\n * Slot updates which can be used for tracking the live progress of a cluster.\n * - `\"firstShredReceived\"`: connected node received the first shred of a block.\n * Indicates that a new block that is being produced.\n * - `\"completed\"`: connected node has received all shreds of a block. Indicates\n * a block was recently produced.\n * - `\"optimisticConfirmation\"`: block was optimistically confirmed by the\n * cluster. It is not guaranteed that an optimistic confirmation notification\n * will be sent for every finalized blocks.\n * - `\"root\"`: the connected node rooted this block.\n * - `\"createdBank\"`: the connected node has started validating this block.\n * - `\"frozen\"`: the connected node has validated this block.\n * - `\"dead\"`: the connected node failed to validate this block.\n */\n\n/**\n * @internal\n */\nconst SlotUpdateResult = union([type({\n type: union([literal('firstShredReceived'), literal('completed'), literal('optimisticConfirmation'), literal('root')]),\n slot: number(),\n timestamp: number()\n}), type({\n type: literal('createdBank'),\n parent: number(),\n slot: number(),\n timestamp: number()\n}), type({\n type: literal('frozen'),\n slot: number(),\n timestamp: number(),\n stats: type({\n numTransactionEntries: number(),\n numSuccessfulTransactions: number(),\n numFailedTransactions: number(),\n maxTransactionsPerEntry: number()\n })\n}), type({\n type: literal('dead'),\n slot: number(),\n timestamp: number(),\n err: string()\n})]);\n\n/**\n * Expected JSON RPC response for the \"slotsUpdatesNotification\" message\n */\nconst SlotUpdateNotificationResult = type({\n subscription: number(),\n result: SlotUpdateResult\n});\n\n/**\n * Expected JSON RPC response for the \"signatureNotification\" message\n */\nconst SignatureNotificationResult = type({\n subscription: number(),\n result: notificationResultAndContext(union([SignatureStatusResult, SignatureReceivedResult]))\n});\n\n/**\n * Expected JSON RPC response for the \"rootNotification\" message\n */\nconst RootNotificationResult = type({\n subscription: number(),\n result: number()\n});\nconst ContactInfoResult = type({\n pubkey: string(),\n gossip: nullable(string()),\n tpu: nullable(string()),\n rpc: nullable(string()),\n version: nullable(string())\n});\nconst VoteAccountInfoResult = type({\n votePubkey: string(),\n nodePubkey: string(),\n activatedStake: number(),\n epochVoteAccount: boolean(),\n epochCredits: array(tuple([number(), number(), number()])),\n commission: number(),\n lastVote: number(),\n rootSlot: nullable(number())\n});\n\n/**\n * Expected JSON RPC response for the \"getVoteAccounts\" message\n */\nconst GetVoteAccounts = jsonRpcResult(type({\n current: array(VoteAccountInfoResult),\n delinquent: array(VoteAccountInfoResult)\n}));\nconst ConfirmationStatus = union([literal('processed'), literal('confirmed'), literal('finalized')]);\nconst SignatureStatusResponse = type({\n slot: number(),\n confirmations: nullable(number()),\n err: TransactionErrorResult,\n confirmationStatus: optional(ConfirmationStatus)\n});\n\n/**\n * Expected JSON RPC response for the \"getSignatureStatuses\" message\n */\nconst GetSignatureStatusesRpcResult = jsonRpcResultAndContext(array(nullable(SignatureStatusResponse)));\n\n/**\n * Expected JSON RPC response for the \"getMinimumBalanceForRentExemption\" message\n */\nconst GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult(number());\nconst AddressTableLookupStruct = type({\n accountKey: PublicKeyFromString,\n writableIndexes: array(number()),\n readonlyIndexes: array(number())\n});\nconst ConfirmedTransactionResult = type({\n signatures: array(string()),\n message: type({\n accountKeys: array(string()),\n header: type({\n numRequiredSignatures: number(),\n numReadonlySignedAccounts: number(),\n numReadonlyUnsignedAccounts: number()\n }),\n instructions: array(type({\n accounts: array(number()),\n data: string(),\n programIdIndex: number()\n })),\n recentBlockhash: string(),\n addressTableLookups: optional(array(AddressTableLookupStruct))\n })\n});\nconst AnnotatedAccountKey = type({\n pubkey: PublicKeyFromString,\n signer: boolean(),\n writable: boolean(),\n source: optional(union([literal('transaction'), literal('lookupTable')]))\n});\nconst ConfirmedTransactionAccountsModeResult = type({\n accountKeys: array(AnnotatedAccountKey),\n signatures: array(string())\n});\nconst ParsedInstructionResult = type({\n parsed: unknown(),\n program: string(),\n programId: PublicKeyFromString\n});\nconst RawInstructionResult = type({\n accounts: array(PublicKeyFromString),\n data: string(),\n programId: PublicKeyFromString\n});\nconst InstructionResult = union([RawInstructionResult, ParsedInstructionResult]);\nconst UnknownInstructionResult = union([type({\n parsed: unknown(),\n program: string(),\n programId: string()\n}), type({\n accounts: array(string()),\n data: string(),\n programId: string()\n})]);\nconst ParsedOrRawInstruction = coerce(InstructionResult, UnknownInstructionResult, value => {\n if ('accounts' in value) {\n return create(value, RawInstructionResult);\n } else {\n return create(value, ParsedInstructionResult);\n }\n});\n\n/**\n * @internal\n */\nconst ParsedConfirmedTransactionResult = type({\n signatures: array(string()),\n message: type({\n accountKeys: array(AnnotatedAccountKey),\n instructions: array(ParsedOrRawInstruction),\n recentBlockhash: string(),\n addressTableLookups: optional(nullable(array(AddressTableLookupStruct)))\n })\n});\nconst TokenBalanceResult = type({\n accountIndex: number(),\n mint: string(),\n owner: optional(string()),\n programId: optional(string()),\n uiTokenAmount: TokenAmountResult\n});\nconst LoadedAddressesResult = type({\n writable: array(PublicKeyFromString),\n readonly: array(PublicKeyFromString)\n});\n\n/**\n * @internal\n */\nconst ConfirmedTransactionMetaResult = type({\n err: TransactionErrorResult,\n fee: number(),\n innerInstructions: optional(nullable(array(type({\n index: number(),\n instructions: array(type({\n accounts: array(number()),\n data: string(),\n programIdIndex: number()\n }))\n })))),\n preBalances: array(number()),\n postBalances: array(number()),\n logMessages: optional(nullable(array(string()))),\n preTokenBalances: optional(nullable(array(TokenBalanceResult))),\n postTokenBalances: optional(nullable(array(TokenBalanceResult))),\n loadedAddresses: optional(LoadedAddressesResult),\n computeUnitsConsumed: optional(number()),\n costUnits: optional(number())\n});\n\n/**\n * @internal\n */\nconst ParsedConfirmedTransactionMetaResult = type({\n err: TransactionErrorResult,\n fee: number(),\n innerInstructions: optional(nullable(array(type({\n index: number(),\n instructions: array(ParsedOrRawInstruction)\n })))),\n preBalances: array(number()),\n postBalances: array(number()),\n logMessages: optional(nullable(array(string()))),\n preTokenBalances: optional(nullable(array(TokenBalanceResult))),\n postTokenBalances: optional(nullable(array(TokenBalanceResult))),\n loadedAddresses: optional(LoadedAddressesResult),\n computeUnitsConsumed: optional(number()),\n costUnits: optional(number())\n});\nconst TransactionVersionStruct = union([literal(0), literal('legacy')]);\n\n/** @internal */\nconst RewardsResult = type({\n pubkey: string(),\n lamports: number(),\n postBalance: nullable(number()),\n rewardType: nullable(string()),\n commission: optional(nullable(number()))\n});\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message\n */\nconst GetBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n transactions: array(type({\n transaction: ConfirmedTransactionResult,\n meta: nullable(ConfirmedTransactionMetaResult),\n version: optional(TransactionVersionStruct)\n })),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message when `transactionDetails` is `none`\n */\nconst GetNoneModeBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message when `transactionDetails` is `accounts`\n */\nconst GetAccountsModeBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n transactions: array(type({\n transaction: ConfirmedTransactionAccountsModeResult,\n meta: nullable(ConfirmedTransactionMetaResult),\n version: optional(TransactionVersionStruct)\n })),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message\n */\nconst GetParsedBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n transactions: array(type({\n transaction: ParsedConfirmedTransactionResult,\n meta: nullable(ParsedConfirmedTransactionMetaResult),\n version: optional(TransactionVersionStruct)\n })),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message when `transactionDetails` is `accounts`\n */\nconst GetParsedAccountsModeBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n transactions: array(type({\n transaction: ConfirmedTransactionAccountsModeResult,\n meta: nullable(ParsedConfirmedTransactionMetaResult),\n version: optional(TransactionVersionStruct)\n })),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getBlock\" message when `transactionDetails` is `none`\n */\nconst GetParsedNoneModeBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number()),\n blockHeight: nullable(number())\n})));\n\n/**\n * Expected JSON RPC response for the \"getConfirmedBlock\" message\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetBlockRpcResult} instead.\n */\nconst GetConfirmedBlockRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n transactions: array(type({\n transaction: ConfirmedTransactionResult,\n meta: nullable(ConfirmedTransactionMetaResult)\n })),\n rewards: optional(array(RewardsResult)),\n blockTime: nullable(number())\n})));\n\n/**\n * Expected JSON RPC response for the \"getBlock\" message\n */\nconst GetBlockSignaturesRpcResult = jsonRpcResult(nullable(type({\n blockhash: string(),\n previousBlockhash: string(),\n parentSlot: number(),\n signatures: array(string()),\n blockTime: nullable(number())\n})));\n\n/**\n * Expected JSON RPC response for the \"getTransaction\" message\n */\nconst GetTransactionRpcResult = jsonRpcResult(nullable(type({\n slot: number(),\n meta: nullable(ConfirmedTransactionMetaResult),\n blockTime: optional(nullable(number())),\n transaction: ConfirmedTransactionResult,\n version: optional(TransactionVersionStruct)\n})));\n\n/**\n * Expected parsed JSON RPC response for the \"getTransaction\" message\n */\nconst GetParsedTransactionRpcResult = jsonRpcResult(nullable(type({\n slot: number(),\n transaction: ParsedConfirmedTransactionResult,\n meta: nullable(ParsedConfirmedTransactionMetaResult),\n blockTime: optional(nullable(number())),\n version: optional(TransactionVersionStruct)\n})));\n\n/**\n * Expected JSON RPC response for the \"getLatestBlockhash\" message\n */\nconst GetLatestBlockhashRpcResult = jsonRpcResultAndContext(type({\n blockhash: string(),\n lastValidBlockHeight: number()\n}));\n\n/**\n * Expected JSON RPC response for the \"isBlockhashValid\" message\n */\nconst IsBlockhashValidRpcResult = jsonRpcResultAndContext(boolean());\nconst PerfSampleResult = type({\n slot: number(),\n numTransactions: number(),\n numSlots: number(),\n samplePeriodSecs: number()\n});\n\n/*\n * Expected JSON RPC response for \"getRecentPerformanceSamples\" message\n */\nconst GetRecentPerformanceSamplesRpcResult = jsonRpcResult(array(PerfSampleResult));\n\n/**\n * Expected JSON RPC response for the \"getFeeCalculatorForBlockhash\" message\n */\nconst GetFeeCalculatorRpcResult = jsonRpcResultAndContext(nullable(type({\n feeCalculator: type({\n lamportsPerSignature: number()\n })\n})));\n\n/**\n * Expected JSON RPC response for the \"requestAirdrop\" message\n */\nconst RequestAirdropRpcResult = jsonRpcResult(string());\n\n/**\n * Expected JSON RPC response for the \"sendTransaction\" message\n */\nconst SendTransactionRpcResult = jsonRpcResult(string());\n\n/**\n * Information about the latest slot being processed by a node\n */\n\n/**\n * Parsed account data\n */\n\n/**\n * Stake Activation data\n */\n\n/**\n * Data slice argument for getProgramAccounts\n */\n\n/**\n * Memory comparison filter for getProgramAccounts\n */\n\n/**\n * Data size comparison filter for getProgramAccounts\n */\n\n/**\n * A filter object for getProgramAccounts\n */\n\n/**\n * Configuration object for getProgramAccounts requests\n */\n\n/**\n * Configuration object for getParsedProgramAccounts\n */\n\n/**\n * Configuration object for getMultipleAccounts\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getStakeActivation`\n */\n\n/**\n * Configuration object for `getNonce`\n */\n\n/**\n * Configuration object for `getNonceAndContext`\n */\n\n/**\n * Information describing an account\n */\n\n/**\n * Account information identified by pubkey\n */\n\n/**\n * Callback function for account change notifications\n */\n\n/**\n * Callback function for program account change notifications\n */\n\n/**\n * Callback function for slot change notifications\n */\n\n/**\n * Callback function for slot update notifications\n */\n\n/**\n * Callback function for signature status notifications\n */\n\n/**\n * Signature status notification with transaction result\n */\n\n/**\n * Signature received notification\n */\n\n/**\n * Callback function for signature notifications\n */\n\n/**\n * Signature subscription options\n */\n\n/**\n * Callback function for root change notifications\n */\n\n/**\n * @internal\n */\nconst LogsResult = type({\n err: TransactionErrorResult,\n logs: array(string()),\n signature: string()\n});\n\n/**\n * Logs result.\n */\n\n/**\n * Expected JSON RPC response for the \"logsNotification\" message.\n */\nconst LogsNotificationResult = type({\n result: notificationResultAndContext(LogsResult),\n subscription: number()\n});\n\n/**\n * Filter for log subscriptions.\n */\n\n/**\n * Callback function for log notifications.\n */\n\n/**\n * Signature result\n */\n\n/**\n * Transaction error\n */\n\n/**\n * Transaction confirmation status\n *
\n *   'processed': Transaction landed in a block which has reached 1 confirmation by the connected node\n *   'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster\n *   'finalized': Transaction landed in a block which has been finalized by the cluster\n * 
\n */\n\n/**\n * Signature status\n */\n\n/**\n * A confirmed signature with its status\n */\n\n/**\n * An object defining headers to be passed to the RPC server\n */\n\n/**\n * The type of the JavaScript `fetch()` API\n */\n\n/**\n * A callback used to augment the outgoing HTTP request\n */\n\n/**\n * Configuration for instantiating a Connection\n */\n\n/** @internal */\nconst COMMON_HTTP_HEADERS = {\n 'solana-client': `js/${\"1.0.0-maintenance\"}`\n};\n\n/**\n * A connection to a fullnode JSON RPC endpoint\n */\nclass Connection {\n /**\n * Establish a JSON RPC connection\n *\n * @param endpoint URL to the fullnode JSON RPC endpoint\n * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object\n */\n constructor(endpoint, _commitmentOrConfig) {\n /** @internal */\n this._commitment = void 0;\n /** @internal */\n this._confirmTransactionInitialTimeout = void 0;\n /** @internal */\n this._rpcEndpoint = void 0;\n /** @internal */\n this._rpcWsEndpoint = void 0;\n /** @internal */\n this._rpcClient = void 0;\n /** @internal */\n this._rpcRequest = void 0;\n /** @internal */\n this._rpcBatchRequest = void 0;\n /** @internal */\n this._rpcWebSocket = void 0;\n /** @internal */\n this._rpcWebSocketConnected = false;\n /** @internal */\n this._rpcWebSocketHeartbeat = null;\n /** @internal */\n this._rpcWebSocketIdleTimeout = null;\n /** @internal\n * A number that we increment every time an active connection closes.\n * Used to determine whether the same socket connection that was open\n * when an async operation started is the same one that's active when\n * its continuation fires.\n *\n */\n this._rpcWebSocketGeneration = 0;\n /** @internal */\n this._disableBlockhashCaching = false;\n /** @internal */\n this._pollingBlockhash = false;\n /** @internal */\n this._blockhashInfo = {\n latestBlockhash: null,\n lastFetch: 0,\n transactionSignatures: [],\n simulatedSignatures: []\n };\n /** @internal */\n this._nextClientSubscriptionId = 0;\n /** @internal */\n this._subscriptionDisposeFunctionsByClientSubscriptionId = {};\n /** @internal */\n this._subscriptionHashByClientSubscriptionId = {};\n /** @internal */\n this._subscriptionStateChangeCallbacksByHash = {};\n /** @internal */\n this._subscriptionCallbacksByServerSubscriptionId = {};\n /** @internal */\n this._subscriptionsByHash = {};\n /**\n * Special case.\n * After a signature is processed, RPCs automatically dispose of the\n * subscription on the server side. We need to track which of these\n * subscriptions have been disposed in such a way, so that we know\n * whether the client is dealing with a not-yet-processed signature\n * (in which case we must tear down the server subscription) or an\n * already-processed signature (in which case the client can simply\n * clear out the subscription locally without telling the server).\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n /** @internal */\n this._subscriptionsAutoDisposedByRpc = new Set();\n /*\n * Returns the current block height of the node\n */\n this.getBlockHeight = (() => {\n const requestPromises = {};\n return async commitmentOrConfig => {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const requestHash = fastStableStringify(args);\n requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => {\n try {\n const unsafeRes = await this._rpcRequest('getBlockHeight', args);\n const res = create(unsafeRes, jsonRpcResult(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block height information');\n }\n return res.result;\n } finally {\n delete requestPromises[requestHash];\n }\n })();\n return await requestPromises[requestHash];\n };\n })();\n let wsEndpoint;\n let httpHeaders;\n let fetch;\n let fetchMiddleware;\n let disableRetryOnRateLimit;\n let httpAgent;\n if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') {\n this._commitment = _commitmentOrConfig;\n } else if (_commitmentOrConfig) {\n this._commitment = _commitmentOrConfig.commitment;\n this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout;\n wsEndpoint = _commitmentOrConfig.wsEndpoint;\n httpHeaders = _commitmentOrConfig.httpHeaders;\n fetch = _commitmentOrConfig.fetch;\n fetchMiddleware = _commitmentOrConfig.fetchMiddleware;\n disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit;\n httpAgent = _commitmentOrConfig.httpAgent;\n }\n this._rpcEndpoint = assertEndpointUrl(endpoint);\n this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);\n this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent);\n this._rpcRequest = createRpcRequest(this._rpcClient);\n this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient);\n this._rpcWebSocket = new RpcWebSocketClient(this._rpcWsEndpoint, {\n autoconnect: false,\n max_reconnects: Infinity\n });\n this._rpcWebSocket.on('open', this._wsOnOpen.bind(this));\n this._rpcWebSocket.on('error', this._wsOnError.bind(this));\n this._rpcWebSocket.on('close', this._wsOnClose.bind(this));\n this._rpcWebSocket.on('accountNotification', this._wsOnAccountNotification.bind(this));\n this._rpcWebSocket.on('programNotification', this._wsOnProgramAccountNotification.bind(this));\n this._rpcWebSocket.on('slotNotification', this._wsOnSlotNotification.bind(this));\n this._rpcWebSocket.on('slotsUpdatesNotification', this._wsOnSlotUpdatesNotification.bind(this));\n this._rpcWebSocket.on('signatureNotification', this._wsOnSignatureNotification.bind(this));\n this._rpcWebSocket.on('rootNotification', this._wsOnRootNotification.bind(this));\n this._rpcWebSocket.on('logsNotification', this._wsOnLogsNotification.bind(this));\n }\n\n /**\n * The default commitment used for requests\n */\n get commitment() {\n return this._commitment;\n }\n\n /**\n * The RPC endpoint\n */\n get rpcEndpoint() {\n return this._rpcEndpoint;\n }\n\n /**\n * Fetch the balance for the specified public key, return with context\n */\n async getBalanceAndContext(publicKey, commitmentOrConfig) {\n /** @internal */\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getBalance', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the balance for the specified public key\n */\n async getBalance(publicKey, commitmentOrConfig) {\n return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => {\n throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e);\n });\n }\n\n /**\n * Fetch the estimated production time of a block\n */\n async getBlockTime(slot) {\n const unsafeRes = await this._rpcRequest('getBlockTime', [slot]);\n const res = create(unsafeRes, jsonRpcResult(nullable(number())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the lowest slot that the node has information about in its ledger.\n * This value may increase over time if the node is configured to purge older ledger data\n */\n async getMinimumLedgerSlot() {\n const unsafeRes = await this._rpcRequest('minimumLedgerSlot', []);\n const res = create(unsafeRes, jsonRpcResult(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot');\n }\n return res.result;\n }\n\n /**\n * Fetch the slot of the lowest confirmed block that has not been purged from the ledger\n */\n async getFirstAvailableBlock() {\n const unsafeRes = await this._rpcRequest('getFirstAvailableBlock', []);\n const res = create(unsafeRes, SlotRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get first available block');\n }\n return res.result;\n }\n\n /**\n * Fetch information about the current supply\n */\n async getSupply(config) {\n let configArg = {};\n if (typeof config === 'string') {\n configArg = {\n commitment: config\n };\n } else if (config) {\n configArg = {\n ...config,\n commitment: config && config.commitment || this.commitment\n };\n } else {\n configArg = {\n commitment: this.commitment\n };\n }\n const unsafeRes = await this._rpcRequest('getSupply', [configArg]);\n const res = create(unsafeRes, GetSupplyRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get supply');\n }\n return res.result;\n }\n\n /**\n * Fetch the current supply of a token mint\n */\n async getTokenSupply(tokenMintAddress, commitment) {\n const args = this._buildArgs([tokenMintAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenSupply', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token supply');\n }\n return res.result;\n }\n\n /**\n * Fetch the current balance of a token account\n */\n async getTokenAccountBalance(tokenAddress, commitment) {\n const args = this._buildArgs([tokenAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenAccountBalance', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(TokenAmountResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token account balance');\n }\n return res.result;\n }\n\n /**\n * Fetch all the token accounts owned by the specified account\n *\n * @return {Promise}\n */\n async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n let _args = [ownerAddress.toBase58()];\n if ('mint' in filter) {\n _args.push({\n mint: filter.mint.toBase58()\n });\n } else {\n _args.push({\n programId: filter.programId.toBase58()\n });\n }\n const args = this._buildArgs(_args, commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);\n const res = create(unsafeRes, GetTokenAccountsByOwner);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch parsed token accounts owned by the specified account\n *\n * @return {Promise}>>>}\n */\n async getParsedTokenAccountsByOwner(ownerAddress, filter, commitment) {\n let _args = [ownerAddress.toBase58()];\n if ('mint' in filter) {\n _args.push({\n mint: filter.mint.toBase58()\n });\n } else {\n _args.push({\n programId: filter.programId.toBase58()\n });\n }\n const args = this._buildArgs(_args, commitment, 'jsonParsed');\n const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args);\n const res = create(unsafeRes, GetParsedTokenAccountsByOwner);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch the 20 largest accounts with their current balances\n */\n async getLargestAccounts(config) {\n const arg = {\n ...config,\n commitment: config && config.commitment || this.commitment\n };\n const args = arg.filter || arg.commitment ? [arg] : [];\n const unsafeRes = await this._rpcRequest('getLargestAccounts', args);\n const res = create(unsafeRes, GetLargestAccountsRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch the 20 largest token accounts with their current balances\n * for a given mint.\n */\n async getTokenLargestAccounts(mintAddress, commitment) {\n const args = this._buildArgs([mintAddress.toBase58()], commitment);\n const unsafeRes = await this._rpcRequest('getTokenLargestAccounts', args);\n const res = create(unsafeRes, GetTokenLargestAccountsResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for the specified public key, return with context\n */\n async getAccountInfoAndContext(publicKey, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getAccountInfo', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(nullable(AccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch parsed account info for the specified public key\n */\n async getParsedAccountInfo(publicKey, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getAccountInfo', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(nullable(ParsedAccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for the specified public key\n */\n async getAccountInfo(publicKey, commitmentOrConfig) {\n try {\n const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig);\n return res.value;\n } catch (e) {\n throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);\n }\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys, return with context\n */\n async getMultipleParsedAccounts(publicKeys, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const keys = publicKeys.map(key => key.toBase58());\n const args = this._buildArgs([keys], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(ParsedAccountInfoResult))));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys, return with context\n */\n async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const keys = publicKeys.map(key => key.toBase58());\n const args = this._buildArgs([keys], commitment, 'base64', config);\n const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(array(nullable(AccountInfoResult))));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the account info for multiple accounts specified by an array of public keys\n */\n async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) {\n const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig);\n return res.value;\n }\n\n /**\n * Returns epoch activation information for a stake account that has been delegated\n *\n * @deprecated Deprecated since RPC v1.18; will be removed in a future version.\n */\n async getStakeActivation(publicKey, commitmentOrConfig, epoch) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, {\n ...config,\n epoch: epoch != null ? epoch : config?.epoch\n });\n const unsafeRes = await this._rpcRequest('getStakeActivation', args);\n const res = create(unsafeRes, jsonRpcResult(StakeActivationResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch all the accounts owned by the specified program id\n *\n * @return {Promise}>>}\n */\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async getProgramAccounts(programId, configOrCommitment) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(configOrCommitment);\n const {\n encoding,\n ...configWithoutEncoding\n } = config || {};\n const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', {\n ...configWithoutEncoding,\n ...(configWithoutEncoding.filters ? {\n filters: applyDefaultMemcmpEncodingToFilters(configWithoutEncoding.filters)\n } : null)\n });\n const unsafeRes = await this._rpcRequest('getProgramAccounts', args);\n const baseSchema = array(KeyedAccountInfoResult);\n const res = configWithoutEncoding.withContext === true ? create(unsafeRes, jsonRpcResultAndContext(baseSchema)) : create(unsafeRes, jsonRpcResult(baseSchema));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);\n }\n return res.result;\n }\n\n /**\n * Fetch and parse all the accounts owned by the specified program id\n *\n * @return {Promise}>>}\n */\n async getParsedProgramAccounts(programId, configOrCommitment) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(configOrCommitment);\n const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getProgramAccounts', args);\n const res = create(unsafeRes, jsonRpcResult(array(KeyedParsedAccountInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`);\n }\n return res.result;\n }\n\n /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async confirmTransaction(strategy, commitment) {\n let rawSignature;\n if (typeof strategy == 'string') {\n rawSignature = strategy;\n } else {\n const config = strategy;\n if (config.abortSignal?.aborted) {\n return Promise.reject(config.abortSignal.reason);\n }\n rawSignature = config.signature;\n }\n let decodedSignature;\n try {\n decodedSignature = bs58.decode(rawSignature);\n } catch (err) {\n throw new Error('signature must be base58 encoded: ' + rawSignature);\n }\n assert(decodedSignature.length === 64, 'signature has invalid length');\n if (typeof strategy === 'string') {\n return await this.confirmTransactionUsingLegacyTimeoutStrategy({\n commitment: commitment || this.commitment,\n signature: rawSignature\n });\n } else if ('lastValidBlockHeight' in strategy) {\n return await this.confirmTransactionUsingBlockHeightExceedanceStrategy({\n commitment: commitment || this.commitment,\n strategy\n });\n } else {\n return await this.confirmTransactionUsingDurableNonceStrategy({\n commitment: commitment || this.commitment,\n strategy\n });\n }\n }\n getCancellationPromise(signal) {\n return new Promise((_, reject) => {\n if (signal == null) {\n return;\n }\n if (signal.aborted) {\n reject(signal.reason);\n } else {\n signal.addEventListener('abort', () => {\n reject(signal.reason);\n });\n }\n });\n }\n getTransactionConfirmationPromise({\n commitment,\n signature\n }) {\n let signatureSubscriptionId;\n let disposeSignatureSubscriptionStateChangeObserver;\n let done = false;\n const confirmationPromise = new Promise((resolve, reject) => {\n try {\n signatureSubscriptionId = this.onSignature(signature, (result, context) => {\n signatureSubscriptionId = undefined;\n const response = {\n context,\n value: result\n };\n resolve({\n __type: TransactionStatus.PROCESSED,\n response\n });\n }, commitment);\n const subscriptionSetupPromise = new Promise(resolveSubscriptionSetup => {\n if (signatureSubscriptionId == null) {\n resolveSubscriptionSetup();\n } else {\n disposeSignatureSubscriptionStateChangeObserver = this._onSubscriptionStateChange(signatureSubscriptionId, nextState => {\n if (nextState === 'subscribed') {\n resolveSubscriptionSetup();\n }\n });\n }\n });\n (async () => {\n await subscriptionSetupPromise;\n if (done) return;\n const response = await this.getSignatureStatus(signature);\n if (done) return;\n if (response == null) {\n return;\n }\n const {\n context,\n value\n } = response;\n if (value == null) {\n return;\n }\n if (value?.err) {\n reject(value.err);\n } else {\n switch (commitment) {\n case 'confirmed':\n case 'single':\n case 'singleGossip':\n {\n if (value.confirmationStatus === 'processed') {\n return;\n }\n break;\n }\n case 'finalized':\n case 'max':\n case 'root':\n {\n if (value.confirmationStatus === 'processed' || value.confirmationStatus === 'confirmed') {\n return;\n }\n break;\n }\n // exhaust enums to ensure full coverage\n case 'processed':\n case 'recent':\n }\n done = true;\n resolve({\n __type: TransactionStatus.PROCESSED,\n response: {\n context,\n value\n }\n });\n }\n })();\n } catch (err) {\n reject(err);\n }\n });\n const abortConfirmation = () => {\n if (disposeSignatureSubscriptionStateChangeObserver) {\n disposeSignatureSubscriptionStateChangeObserver();\n disposeSignatureSubscriptionStateChangeObserver = undefined;\n }\n if (signatureSubscriptionId != null) {\n this.removeSignatureListener(signatureSubscriptionId);\n signatureSubscriptionId = undefined;\n }\n };\n return {\n abortConfirmation,\n confirmationPromise\n };\n }\n async confirmTransactionUsingBlockHeightExceedanceStrategy({\n commitment,\n strategy: {\n abortSignal,\n lastValidBlockHeight,\n signature\n }\n }) {\n let done = false;\n const expiryPromise = new Promise(resolve => {\n const checkBlockHeight = async () => {\n try {\n const blockHeight = await this.getBlockHeight(commitment);\n return blockHeight;\n } catch (_e) {\n return -1;\n }\n };\n (async () => {\n let currentBlockHeight = await checkBlockHeight();\n if (done) return;\n while (currentBlockHeight <= lastValidBlockHeight) {\n await sleep(1000);\n if (done) return;\n currentBlockHeight = await checkBlockHeight();\n if (done) return;\n }\n resolve({\n __type: TransactionStatus.BLOCKHEIGHT_EXCEEDED\n });\n })();\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n const cancellationPromise = this.getCancellationPromise(abortSignal);\n let result;\n try {\n const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n throw new TransactionExpiredBlockheightExceededError(signature);\n }\n } finally {\n done = true;\n abortConfirmation();\n }\n return result;\n }\n async confirmTransactionUsingDurableNonceStrategy({\n commitment,\n strategy: {\n abortSignal,\n minContextSlot,\n nonceAccountPubkey,\n nonceValue,\n signature\n }\n }) {\n let done = false;\n const expiryPromise = new Promise(resolve => {\n let currentNonceValue = nonceValue;\n let lastCheckedSlot = null;\n const getCurrentNonceValue = async () => {\n try {\n const {\n context,\n value: nonceAccount\n } = await this.getNonceAndContext(nonceAccountPubkey, {\n commitment,\n minContextSlot\n });\n lastCheckedSlot = context.slot;\n return nonceAccount?.nonce;\n } catch (e) {\n // If for whatever reason we can't reach/read the nonce\n // account, just keep using the last-known value.\n return currentNonceValue;\n }\n };\n (async () => {\n currentNonceValue = await getCurrentNonceValue();\n if (done) return;\n while (true // eslint-disable-line no-constant-condition\n ) {\n if (nonceValue !== currentNonceValue) {\n resolve({\n __type: TransactionStatus.NONCE_INVALID,\n slotInWhichNonceDidAdvance: lastCheckedSlot\n });\n return;\n }\n await sleep(2000);\n if (done) return;\n currentNonceValue = await getCurrentNonceValue();\n if (done) return;\n }\n })();\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n const cancellationPromise = this.getCancellationPromise(abortSignal);\n let result;\n try {\n const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n // Double check that the transaction is indeed unconfirmed.\n let signatureStatus;\n while (true // eslint-disable-line no-constant-condition\n ) {\n const status = await this.getSignatureStatus(signature);\n if (status == null) {\n break;\n }\n if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) {\n await sleep(400);\n continue;\n }\n signatureStatus = status;\n break;\n }\n if (signatureStatus?.value) {\n const commitmentForStatus = commitment || 'finalized';\n const {\n confirmationStatus\n } = signatureStatus.value;\n switch (commitmentForStatus) {\n case 'processed':\n case 'recent':\n if (confirmationStatus !== 'processed' && confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n case 'confirmed':\n case 'single':\n case 'singleGossip':\n if (confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n case 'finalized':\n case 'max':\n case 'root':\n if (confirmationStatus !== 'finalized') {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n break;\n default:\n // Exhaustive switch.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n (_ => {})(commitmentForStatus);\n }\n result = {\n context: signatureStatus.context,\n value: {\n err: signatureStatus.value.err\n }\n };\n } else {\n throw new TransactionExpiredNonceInvalidError(signature);\n }\n }\n } finally {\n done = true;\n abortConfirmation();\n }\n return result;\n }\n async confirmTransactionUsingLegacyTimeoutStrategy({\n commitment,\n signature\n }) {\n let timeoutId;\n const expiryPromise = new Promise(resolve => {\n let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000;\n switch (commitment) {\n case 'processed':\n case 'recent':\n case 'single':\n case 'confirmed':\n case 'singleGossip':\n {\n timeoutMs = this._confirmTransactionInitialTimeout || 30 * 1000;\n break;\n }\n }\n timeoutId = setTimeout(() => resolve({\n __type: TransactionStatus.TIMED_OUT,\n timeoutMs\n }), timeoutMs);\n });\n const {\n abortConfirmation,\n confirmationPromise\n } = this.getTransactionConfirmationPromise({\n commitment,\n signature\n });\n let result;\n try {\n const outcome = await Promise.race([confirmationPromise, expiryPromise]);\n if (outcome.__type === TransactionStatus.PROCESSED) {\n result = outcome.response;\n } else {\n throw new TransactionExpiredTimeoutError(signature, outcome.timeoutMs / 1000);\n }\n } finally {\n clearTimeout(timeoutId);\n abortConfirmation();\n }\n return result;\n }\n\n /**\n * Return the list of nodes that are currently participating in the cluster\n */\n async getClusterNodes() {\n const unsafeRes = await this._rpcRequest('getClusterNodes', []);\n const res = create(unsafeRes, jsonRpcResult(array(ContactInfoResult)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes');\n }\n return res.result;\n }\n\n /**\n * Return the list of nodes that are currently participating in the cluster\n */\n async getVoteAccounts(commitment) {\n const args = this._buildArgs([], commitment);\n const unsafeRes = await this._rpcRequest('getVoteAccounts', args);\n const res = create(unsafeRes, GetVoteAccounts);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts');\n }\n return res.result;\n }\n\n /**\n * Fetch the current slot that the node is processing\n */\n async getSlot(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getSlot', args);\n const res = create(unsafeRes, jsonRpcResult(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot');\n }\n return res.result;\n }\n\n /**\n * Fetch the current slot leader of the cluster\n */\n async getSlotLeader(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getSlotLeader', args);\n const res = create(unsafeRes, jsonRpcResult(string()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot leader');\n }\n return res.result;\n }\n\n /**\n * Fetch `limit` number of slot leaders starting from `startSlot`\n *\n * @param startSlot fetch slot leaders starting from this slot\n * @param limit number of slot leaders to return\n */\n async getSlotLeaders(startSlot, limit) {\n const args = [startSlot, limit];\n const unsafeRes = await this._rpcRequest('getSlotLeaders', args);\n const res = create(unsafeRes, jsonRpcResult(array(PublicKeyFromString)));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders');\n }\n return res.result;\n }\n\n /**\n * Fetch the current status of a signature\n */\n async getSignatureStatus(signature, config) {\n const {\n context,\n value: values\n } = await this.getSignatureStatuses([signature], config);\n assert(values.length === 1);\n const value = values[0];\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the current statuses of a batch of signatures\n */\n async getSignatureStatuses(signatures, config) {\n const params = [signatures];\n if (config) {\n params.push(config);\n }\n const unsafeRes = await this._rpcRequest('getSignatureStatuses', params);\n const res = create(unsafeRes, GetSignatureStatusesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get signature status');\n }\n return res.result;\n }\n\n /**\n * Fetch the current transaction count of the cluster\n */\n async getTransactionCount(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getTransactionCount', args);\n const res = create(unsafeRes, jsonRpcResult(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction count');\n }\n return res.result;\n }\n\n /**\n * Fetch the current total currency supply of the cluster in lamports\n *\n * @deprecated Deprecated since RPC v1.2.8. Please use {@link getSupply} instead.\n */\n async getTotalSupply(commitment) {\n const result = await this.getSupply({\n commitment,\n excludeNonCirculatingAccountsList: true\n });\n return result.value.total;\n }\n\n /**\n * Fetch the cluster InflationGovernor parameters\n */\n async getInflationGovernor(commitment) {\n const args = this._buildArgs([], commitment);\n const unsafeRes = await this._rpcRequest('getInflationGovernor', args);\n const res = create(unsafeRes, GetInflationGovernorRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation');\n }\n return res.result;\n }\n\n /**\n * Fetch the inflation reward for a list of addresses for an epoch\n */\n async getInflationReward(addresses, epoch, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined /* encoding */, {\n ...config,\n epoch: epoch != null ? epoch : config?.epoch\n });\n const unsafeRes = await this._rpcRequest('getInflationReward', args);\n const res = create(unsafeRes, GetInflationRewardResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward');\n }\n return res.result;\n }\n\n /**\n * Fetch the specific inflation values for the current epoch\n */\n async getInflationRate() {\n const unsafeRes = await this._rpcRequest('getInflationRate', []);\n const res = create(unsafeRes, GetInflationRateRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate');\n }\n return res.result;\n }\n\n /**\n * Fetch the Epoch Info parameters\n */\n async getEpochInfo(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getEpochInfo', args);\n const res = create(unsafeRes, GetEpochInfoRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get epoch info');\n }\n return res.result;\n }\n\n /**\n * Fetch the Epoch Schedule parameters\n */\n async getEpochSchedule() {\n const unsafeRes = await this._rpcRequest('getEpochSchedule', []);\n const res = create(unsafeRes, GetEpochScheduleRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule');\n }\n const epochSchedule = res.result;\n return new EpochSchedule(epochSchedule.slotsPerEpoch, epochSchedule.leaderScheduleSlotOffset, epochSchedule.warmup, epochSchedule.firstNormalEpoch, epochSchedule.firstNormalSlot);\n }\n\n /**\n * Fetch the leader schedule for the current epoch\n * @return {Promise>}\n */\n async getLeaderSchedule() {\n const unsafeRes = await this._rpcRequest('getLeaderSchedule', []);\n const res = create(unsafeRes, GetLeaderScheduleRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule');\n }\n return res.result;\n }\n\n /**\n * Fetch the minimum balance needed to exempt an account of `dataLength`\n * size from rent\n */\n async getMinimumBalanceForRentExemption(dataLength, commitment) {\n const args = this._buildArgs([dataLength], commitment);\n const unsafeRes = await this._rpcRequest('getMinimumBalanceForRentExemption', args);\n const res = create(unsafeRes, GetMinimumBalanceForRentExemptionRpcResult);\n if ('error' in res) {\n console.warn('Unable to fetch minimum balance for rent exemption');\n return 0;\n }\n return res.result;\n }\n\n /**\n * Fetch a recent blockhash from the cluster, return with context\n * @return {Promise>}\n *\n * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead.\n */\n async getRecentBlockhashAndContext(commitment) {\n const {\n context,\n value: {\n blockhash\n }\n } = await this.getLatestBlockhashAndContext(commitment);\n const feeCalculator = {\n get lamportsPerSignature() {\n throw new Error('The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is ' + 'no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee ' + 'for a given message.');\n },\n toJSON() {\n return {};\n }\n };\n return {\n context,\n value: {\n blockhash,\n feeCalculator\n }\n };\n }\n\n /**\n * Fetch recent performance samples\n * @return {Promise>}\n */\n async getRecentPerformanceSamples(limit) {\n const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []);\n const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples');\n }\n return res.result;\n }\n\n /**\n * Fetch the fee calculator for a recent blockhash from the cluster, return with context\n *\n * @deprecated Deprecated since RPC v1.9.0. Please use {@link getFeeForMessage} instead.\n */\n async getFeeCalculatorForBlockhash(blockhash, commitment) {\n const args = this._buildArgs([blockhash], commitment);\n const unsafeRes = await this._rpcRequest('getFeeCalculatorForBlockhash', args);\n const res = create(unsafeRes, GetFeeCalculatorRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator');\n }\n const {\n context,\n value\n } = res.result;\n return {\n context,\n value: value !== null ? value.feeCalculator : null\n };\n }\n\n /**\n * Fetch the fee for a message from the cluster, return with context\n */\n async getFeeForMessage(message, commitment) {\n const wireMessage = toBuffer(message.serialize()).toString('base64');\n const args = this._buildArgs([wireMessage], commitment);\n const unsafeRes = await this._rpcRequest('getFeeForMessage', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(nullable(number())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get fee for message');\n }\n if (res.result === null) {\n throw new Error('invalid blockhash');\n }\n return res.result;\n }\n\n /**\n * Fetch a list of prioritization fees from recent blocks.\n */\n async getRecentPrioritizationFees(config) {\n const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58());\n const args = accounts?.length ? [accounts] : [];\n const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args);\n const res = create(unsafeRes, GetRecentPrioritizationFeesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees');\n }\n return res.result;\n }\n /**\n * Fetch a recent blockhash from the cluster\n * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>}\n *\n * @deprecated Deprecated since RPC v1.8.0. Please use {@link getLatestBlockhash} instead.\n */\n async getRecentBlockhash(commitment) {\n try {\n const res = await this.getRecentBlockhashAndContext(commitment);\n return res.value;\n } catch (e) {\n throw new Error('failed to get recent blockhash: ' + e);\n }\n }\n\n /**\n * Fetch the latest blockhash from the cluster\n * @return {Promise}\n */\n async getLatestBlockhash(commitmentOrConfig) {\n try {\n const res = await this.getLatestBlockhashAndContext(commitmentOrConfig);\n return res.value;\n } catch (e) {\n throw new Error('failed to get recent blockhash: ' + e);\n }\n }\n\n /**\n * Fetch the latest blockhash from the cluster\n * @return {Promise}\n */\n async getLatestBlockhashAndContext(commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getLatestBlockhash', args);\n const res = create(unsafeRes, GetLatestBlockhashRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash');\n }\n return res.result;\n }\n\n /**\n * Returns whether a blockhash is still valid or not\n */\n async isBlockhashValid(blockhash, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgs([blockhash], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('isBlockhashValid', args);\n const res = create(unsafeRes, IsBlockhashValidRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to determine if the blockhash `' + blockhash + '`is valid');\n }\n return res.result;\n }\n\n /**\n * Fetch the node version\n */\n async getVersion() {\n const unsafeRes = await this._rpcRequest('getVersion', []);\n const res = create(unsafeRes, jsonRpcResult(VersionResult));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get version');\n }\n return res.result;\n }\n\n /**\n * Fetch the genesis hash\n */\n async getGenesisHash() {\n const unsafeRes = await this._rpcRequest('getGenesisHash', []);\n const res = create(unsafeRes, jsonRpcResult(string()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash');\n }\n return res.result;\n }\n\n /**\n * Fetch a processed block from the cluster.\n *\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n\n /**\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by\n * setting the `maxSupportedTransactionVersion` property.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a processed block from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a processed block from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getBlock(slot, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getBlock', args);\n try {\n switch (config?.transactionDetails) {\n case 'accounts':\n {\n const res = create(unsafeRes, GetAccountsModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n case 'none':\n {\n const res = create(unsafeRes, GetNoneModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n default:\n {\n const res = create(unsafeRes, GetBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n const {\n result\n } = res;\n return result ? {\n ...result,\n transactions: result.transactions.map(({\n transaction,\n meta,\n version\n }) => ({\n meta,\n transaction: {\n ...transaction,\n message: versionedMessageFromResponse(version, transaction.message)\n },\n version\n }))\n } : null;\n }\n }\n } catch (e) {\n throw new SolanaJSONRPCError(e, 'failed to get confirmed block');\n }\n }\n\n /**\n * Fetch parsed transaction details for a confirmed or finalized block\n */\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n async getParsedBlock(slot, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getBlock', args);\n try {\n switch (config?.transactionDetails) {\n case 'accounts':\n {\n const res = create(unsafeRes, GetParsedAccountsModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n case 'none':\n {\n const res = create(unsafeRes, GetParsedNoneModeBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n default:\n {\n const res = create(unsafeRes, GetParsedBlockRpcResult);\n if ('error' in res) {\n throw res.error;\n }\n return res.result;\n }\n }\n } catch (e) {\n throw new SolanaJSONRPCError(e, 'failed to get block');\n }\n }\n /*\n * Returns recent block production information from the current or previous epoch\n */\n async getBlockProduction(configOrCommitment) {\n let extra;\n let commitment;\n if (typeof configOrCommitment === 'string') {\n commitment = configOrCommitment;\n } else if (configOrCommitment) {\n const {\n commitment: c,\n ...rest\n } = configOrCommitment;\n commitment = c;\n extra = rest;\n }\n const args = this._buildArgs([], commitment, 'base64', extra);\n const unsafeRes = await this._rpcRequest('getBlockProduction', args);\n const res = create(unsafeRes, BlockProductionResponseStruct);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block production information');\n }\n return res.result;\n }\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n *\n * @deprecated Instead, call `getTransaction` using a\n * `GetVersionedTransactionConfig` by setting the\n * `maxSupportedTransactionVersion` property.\n */\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch a confirmed or finalized transaction from the cluster.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getTransaction(signature, rawConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(rawConfig);\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config);\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = create(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n const result = res.result;\n if (!result) return result;\n return {\n ...result,\n transaction: {\n ...result.transaction,\n message: versionedMessageFromResponse(result.version, result.transaction.message)\n }\n };\n }\n\n /**\n * Fetch parsed transaction details for a confirmed or finalized transaction\n */\n async getParsedTransaction(signature, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = create(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n return res.result;\n }\n\n /**\n * Fetch parsed transaction details for a batch of confirmed transactions\n */\n async getParsedTransactions(signatures, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config);\n return {\n methodName: 'getTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = create(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transactions');\n }\n return res.result;\n });\n return res;\n }\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}.\n *\n * @deprecated Instead, call `getTransactions` using a\n * `GetVersionedTransactionConfig` by setting the\n * `maxSupportedTransactionVersion` property.\n */\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link\n * VersionedTransactionResponse}.\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Fetch transaction details for a batch of confirmed transactions.\n * Similar to {@link getParsedTransactions} but returns a {@link\n * VersionedTransactionResponse}.\n */\n // eslint-disable-next-line no-dupe-class-members\n async getTransactions(signatures, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config);\n return {\n methodName: 'getTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = create(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transactions');\n }\n const result = res.result;\n if (!result) return result;\n return {\n ...result,\n transaction: {\n ...result.transaction,\n message: versionedMessageFromResponse(result.version, result.transaction.message)\n }\n };\n });\n return res;\n }\n\n /**\n * Fetch a list of Transactions and transaction statuses from the cluster\n * for a confirmed block.\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead.\n */\n async getConfirmedBlock(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment);\n const unsafeRes = await this._rpcRequest('getBlock', args);\n const res = create(unsafeRes, GetConfirmedBlockRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Confirmed block ' + slot + ' not found');\n }\n const block = {\n ...result,\n transactions: result.transactions.map(({\n transaction,\n meta\n }) => {\n const message = new Message(transaction.message);\n return {\n meta,\n transaction: {\n ...transaction,\n message\n }\n };\n })\n };\n return {\n ...block,\n transactions: block.transactions.map(({\n transaction,\n meta\n }) => {\n return {\n meta,\n transaction: Transaction.populate(transaction.message, transaction.signatures)\n };\n })\n };\n }\n\n /**\n * Fetch confirmed blocks between two slots\n */\n async getBlocks(startSlot, endSlot, commitment) {\n const args = this._buildArgsAtLeastConfirmed(endSlot !== undefined ? [startSlot, endSlot] : [startSlot], commitment);\n const unsafeRes = await this._rpcRequest('getBlocks', args);\n const res = create(unsafeRes, jsonRpcResult(array(number())));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get blocks');\n }\n return res.result;\n }\n\n /**\n * Fetch a list of Signatures from the cluster for a block, excluding rewards\n */\n async getBlockSignatures(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {\n transactionDetails: 'signatures',\n rewards: false\n });\n const unsafeRes = await this._rpcRequest('getBlock', args);\n const res = create(unsafeRes, GetBlockSignaturesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Block ' + slot + ' not found');\n }\n return result;\n }\n\n /**\n * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead.\n */\n async getConfirmedBlockSignatures(slot, commitment) {\n const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, {\n transactionDetails: 'signatures',\n rewards: false\n });\n const unsafeRes = await this._rpcRequest('getBlock', args);\n const res = create(unsafeRes, GetBlockSignaturesRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block');\n }\n const result = res.result;\n if (!result) {\n throw new Error('Confirmed block ' + slot + ' not found');\n }\n return result;\n }\n\n /**\n * Fetch a transaction details for a confirmed transaction\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead.\n */\n async getConfirmedTransaction(signature, commitment) {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment);\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = create(unsafeRes, GetTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get transaction');\n }\n const result = res.result;\n if (!result) return result;\n const message = new Message(result.transaction.message);\n const signatures = result.transaction.signatures;\n return {\n ...result,\n transaction: Transaction.populate(message, signatures)\n };\n }\n\n /**\n * Fetch parsed transaction details for a confirmed transaction\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead.\n */\n async getParsedConfirmedTransaction(signature, commitment) {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');\n const unsafeRes = await this._rpcRequest('getTransaction', args);\n const res = create(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction');\n }\n return res.result;\n }\n\n /**\n * Fetch parsed transaction details for a batch of confirmed transactions\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead.\n */\n async getParsedConfirmedTransactions(signatures, commitment) {\n const batch = signatures.map(signature => {\n const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed');\n return {\n methodName: 'getTransaction',\n args\n };\n });\n const unsafeRes = await this._rpcBatchRequest(batch);\n const res = unsafeRes.map(unsafeRes => {\n const res = create(unsafeRes, GetParsedTransactionRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions');\n }\n return res.result;\n });\n return res;\n }\n\n /**\n * Fetch a list of all the confirmed signatures for transactions involving an address\n * within a specified slot range. Max range allowed is 10,000 slots.\n *\n * @deprecated Deprecated since RPC v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead.\n *\n * @param address queried address\n * @param startSlot start slot, inclusive\n * @param endSlot end slot, inclusive\n */\n async getConfirmedSignaturesForAddress(address, startSlot, endSlot) {\n let options = {};\n let firstAvailableBlock = await this.getFirstAvailableBlock();\n while (!('until' in options)) {\n startSlot--;\n if (startSlot <= 0 || startSlot < firstAvailableBlock) {\n break;\n }\n try {\n const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized');\n if (block.signatures.length > 0) {\n options.until = block.signatures[block.signatures.length - 1].toString();\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes('skipped')) {\n continue;\n } else {\n throw err;\n }\n }\n }\n let highestConfirmedRoot = await this.getSlot('finalized');\n while (!('before' in options)) {\n endSlot++;\n if (endSlot > highestConfirmedRoot) {\n break;\n }\n try {\n const block = await this.getConfirmedBlockSignatures(endSlot);\n if (block.signatures.length > 0) {\n options.before = block.signatures[block.signatures.length - 1].toString();\n }\n } catch (err) {\n if (err instanceof Error && err.message.includes('skipped')) {\n continue;\n } else {\n throw err;\n }\n }\n }\n const confirmedSignatureInfo = await this.getConfirmedSignaturesForAddress2(address, options);\n return confirmedSignatureInfo.map(info => info.signature);\n }\n\n /**\n * Returns confirmed signatures for transactions involving an\n * address backwards in time from the provided signature or most recent confirmed block\n *\n * @deprecated Deprecated since RPC v1.7.0. Please use {@link getSignaturesForAddress} instead.\n */\n async getConfirmedSignaturesForAddress2(address, options, commitment) {\n const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);\n const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args);\n const res = create(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address');\n }\n return res.result;\n }\n\n /**\n * Returns confirmed signatures for transactions involving an\n * address backwards in time from the provided signature or most recent confirmed block\n *\n *\n * @param address queried address\n * @param options\n */\n async getSignaturesForAddress(address, options, commitment) {\n const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options);\n const unsafeRes = await this._rpcRequest('getSignaturesForAddress', args);\n const res = create(unsafeRes, GetSignaturesForAddressRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address');\n }\n return res.result;\n }\n async getAddressLookupTable(accountKey, config) {\n const {\n context,\n value: accountInfo\n } = await this.getAccountInfoAndContext(accountKey, config);\n let value = null;\n if (accountInfo !== null) {\n value = new AddressLookupTableAccount({\n key: accountKey,\n state: AddressLookupTableAccount.deserialize(accountInfo.data)\n });\n }\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the contents of a Nonce account from the cluster, return with context\n */\n async getNonceAndContext(nonceAccount, commitmentOrConfig) {\n const {\n context,\n value: accountInfo\n } = await this.getAccountInfoAndContext(nonceAccount, commitmentOrConfig);\n let value = null;\n if (accountInfo !== null) {\n value = NonceAccount.fromAccountData(accountInfo.data);\n }\n return {\n context,\n value\n };\n }\n\n /**\n * Fetch the contents of a Nonce account from the cluster\n */\n async getNonce(nonceAccount, commitmentOrConfig) {\n return await this.getNonceAndContext(nonceAccount, commitmentOrConfig).then(x => x.value).catch(e => {\n throw new Error('failed to get nonce for account ' + nonceAccount.toBase58() + ': ' + e);\n });\n }\n\n /**\n * Request an allocation of lamports to the specified address\n *\n * ```typescript\n * import { Connection, PublicKey, LAMPORTS_PER_SOL } from \"@solana/web3.js\";\n *\n * (async () => {\n * const connection = new Connection(\"https://api.testnet.solana.com\", \"confirmed\");\n * const myAddress = new PublicKey(\"2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM\");\n * const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL);\n * await connection.confirmTransaction(signature);\n * })();\n * ```\n */\n async requestAirdrop(to, lamports) {\n const unsafeRes = await this._rpcRequest('requestAirdrop', [to.toBase58(), lamports]);\n const res = create(unsafeRes, RequestAirdropRpcResult);\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`);\n }\n return res.result;\n }\n\n /**\n * @internal\n */\n async _blockhashWithExpiryBlockHeight(disableCache) {\n if (!disableCache) {\n // Wait for polling to finish\n while (this._pollingBlockhash) {\n await sleep(100);\n }\n const timeSinceFetch = Date.now() - this._blockhashInfo.lastFetch;\n const expired = timeSinceFetch >= BLOCKHASH_CACHE_TIMEOUT_MS;\n if (this._blockhashInfo.latestBlockhash !== null && !expired) {\n return this._blockhashInfo.latestBlockhash;\n }\n }\n return await this._pollNewBlockhash();\n }\n\n /**\n * @internal\n */\n async _pollNewBlockhash() {\n this._pollingBlockhash = true;\n try {\n const startTime = Date.now();\n const cachedLatestBlockhash = this._blockhashInfo.latestBlockhash;\n const cachedBlockhash = cachedLatestBlockhash ? cachedLatestBlockhash.blockhash : null;\n for (let i = 0; i < 50; i++) {\n const latestBlockhash = await this.getLatestBlockhash('finalized');\n if (cachedBlockhash !== latestBlockhash.blockhash) {\n this._blockhashInfo = {\n latestBlockhash,\n lastFetch: Date.now(),\n transactionSignatures: [],\n simulatedSignatures: []\n };\n return latestBlockhash;\n }\n\n // Sleep for approximately half a slot\n await sleep(MS_PER_SLOT / 2);\n }\n throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`);\n } finally {\n this._pollingBlockhash = false;\n }\n }\n\n /**\n * get the stake minimum delegation\n */\n async getStakeMinimumDelegation(config) {\n const {\n commitment,\n config: configArg\n } = extractCommitmentFromConfig(config);\n const args = this._buildArgs([], commitment, 'base64', configArg);\n const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args);\n const res = create(unsafeRes, jsonRpcResultAndContext(number()));\n if ('error' in res) {\n throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`);\n }\n return res.result;\n }\n\n /**\n * Simulate a transaction\n *\n * @deprecated Instead, call {@link simulateTransaction} with {@link\n * VersionedTransaction} and {@link SimulateTransactionConfig} parameters\n */\n\n /**\n * Simulate a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Simulate a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) {\n if ('message' in transactionOrMessage) {\n const versionedTx = transactionOrMessage;\n const wireTransaction = versionedTx.serialize();\n const encodedTransaction = Buffer.from(wireTransaction).toString('base64');\n if (Array.isArray(configOrSigners) || includeAccounts !== undefined) {\n throw new Error('Invalid arguments');\n }\n const config = configOrSigners || {};\n config.encoding = 'base64';\n if (!('commitment' in config)) {\n config.commitment = this.commitment;\n }\n if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) {\n config.innerInstructions = configOrSigners.innerInstructions;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('simulateTransaction', args);\n const res = create(unsafeRes, SimulatedTransactionResponseStruct);\n if ('error' in res) {\n throw new Error('failed to simulate transaction: ' + res.error.message);\n }\n return res.result;\n }\n let transaction;\n if (transactionOrMessage instanceof Transaction) {\n let originalTx = transactionOrMessage;\n transaction = new Transaction();\n transaction.feePayer = originalTx.feePayer;\n transaction.instructions = transactionOrMessage.instructions;\n transaction.nonceInfo = originalTx.nonceInfo;\n transaction.signatures = originalTx.signatures;\n } else {\n transaction = Transaction.populate(transactionOrMessage);\n // HACK: this function relies on mutating the populated transaction\n transaction._message = transaction._json = undefined;\n }\n if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) {\n throw new Error('Invalid arguments');\n }\n const signers = configOrSigners;\n if (transaction.nonceInfo && signers) {\n transaction.sign(...signers);\n } else {\n let disableCache = this._disableBlockhashCaching;\n for (;;) {\n const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache);\n transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;\n transaction.recentBlockhash = latestBlockhash.blockhash;\n if (!signers) break;\n transaction.sign(...signers);\n if (!transaction.signature) {\n throw new Error('!signature'); // should never happen\n }\n const signature = transaction.signature.toString('base64');\n if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) {\n // The signature of this transaction has not been seen before with the\n // current recentBlockhash, all done. Let's break\n this._blockhashInfo.simulatedSignatures.push(signature);\n break;\n } else {\n // This transaction would be treated as duplicate (its derived signature\n // matched to one of already recorded signatures).\n // So, we must fetch a new blockhash for a different signature by disabling\n // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS).\n disableCache = true;\n }\n }\n }\n const message = transaction._compile();\n const signData = message.serialize();\n const wireTransaction = transaction._serialize(signData);\n const encodedTransaction = wireTransaction.toString('base64');\n const config = {\n encoding: 'base64',\n commitment: this.commitment\n };\n if (includeAccounts) {\n const addresses = (Array.isArray(includeAccounts) ? includeAccounts : message.nonProgramIds()).map(key => key.toBase58());\n config['accounts'] = {\n encoding: 'base64',\n addresses\n };\n }\n if (signers) {\n config.sigVerify = true;\n }\n if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) {\n config.innerInstructions = configOrSigners.innerInstructions;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('simulateTransaction', args);\n const res = create(unsafeRes, SimulatedTransactionResponseStruct);\n if ('error' in res) {\n let logs;\n if ('data' in res.error) {\n logs = res.error.data.logs;\n if (logs && Array.isArray(logs)) {\n const traceIndent = '\\n ';\n const logTrace = traceIndent + logs.join(traceIndent);\n console.error(res.error.message, logTrace);\n }\n }\n throw new SendTransactionError({\n action: 'simulate',\n signature: '',\n transactionMessage: res.error.message,\n logs: logs\n });\n }\n return res.result;\n }\n\n /**\n * Sign and send a transaction\n *\n * @deprecated Instead, call {@link sendTransaction} with a {@link\n * VersionedTransaction}\n */\n\n /**\n * Send a signed transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n\n /**\n * Sign and send a transaction\n */\n // eslint-disable-next-line no-dupe-class-members\n async sendTransaction(transaction, signersOrOptions, options) {\n if ('version' in transaction) {\n if (signersOrOptions && Array.isArray(signersOrOptions)) {\n throw new Error('Invalid arguments');\n }\n const wireTransaction = transaction.serialize();\n return await this.sendRawTransaction(wireTransaction, signersOrOptions);\n }\n if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) {\n throw new Error('Invalid arguments');\n }\n const signers = signersOrOptions;\n if (transaction.nonceInfo) {\n transaction.sign(...signers);\n } else {\n let disableCache = this._disableBlockhashCaching;\n for (;;) {\n const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache);\n transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight;\n transaction.recentBlockhash = latestBlockhash.blockhash;\n transaction.sign(...signers);\n if (!transaction.signature) {\n throw new Error('!signature'); // should never happen\n }\n const signature = transaction.signature.toString('base64');\n if (!this._blockhashInfo.transactionSignatures.includes(signature)) {\n // The signature of this transaction has not been seen before with the\n // current recentBlockhash, all done. Let's break\n this._blockhashInfo.transactionSignatures.push(signature);\n break;\n } else {\n // This transaction would be treated as duplicate (its derived signature\n // matched to one of already recorded signatures).\n // So, we must fetch a new blockhash for a different signature by disabling\n // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS).\n disableCache = true;\n }\n }\n }\n const wireTransaction = transaction.serialize();\n return await this.sendRawTransaction(wireTransaction, options);\n }\n\n /**\n * Send a transaction that has already been signed and serialized into the\n * wire format\n */\n async sendRawTransaction(rawTransaction, options) {\n const encodedTransaction = toBuffer(rawTransaction).toString('base64');\n const result = await this.sendEncodedTransaction(encodedTransaction, options);\n return result;\n }\n\n /**\n * Send a transaction that has already been signed, serialized into the\n * wire format, and encoded as a base64 string\n */\n async sendEncodedTransaction(encodedTransaction, options) {\n const config = {\n encoding: 'base64'\n };\n const skipPreflight = options && options.skipPreflight;\n const preflightCommitment = skipPreflight === true ? 'processed' // FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed.\n : options && options.preflightCommitment || this.commitment;\n if (options && options.maxRetries != null) {\n config.maxRetries = options.maxRetries;\n }\n if (options && options.minContextSlot != null) {\n config.minContextSlot = options.minContextSlot;\n }\n if (skipPreflight) {\n config.skipPreflight = skipPreflight;\n }\n if (preflightCommitment) {\n config.preflightCommitment = preflightCommitment;\n }\n const args = [encodedTransaction, config];\n const unsafeRes = await this._rpcRequest('sendTransaction', args);\n const res = create(unsafeRes, SendTransactionRpcResult);\n if ('error' in res) {\n let logs = undefined;\n if ('data' in res.error) {\n logs = res.error.data.logs;\n }\n throw new SendTransactionError({\n action: skipPreflight ? 'send' : 'simulate',\n signature: '',\n transactionMessage: res.error.message,\n logs: logs\n });\n }\n return res.result;\n }\n\n /**\n * @internal\n */\n _wsOnOpen() {\n this._rpcWebSocketConnected = true;\n this._rpcWebSocketHeartbeat = setInterval(() => {\n // Ping server every 5s to prevent idle timeouts\n (async () => {\n try {\n await this._rpcWebSocket.notify('ping');\n // eslint-disable-next-line no-empty\n } catch {}\n })();\n }, 5000);\n this._updateSubscriptions();\n }\n\n /**\n * @internal\n */\n _wsOnError(err) {\n this._rpcWebSocketConnected = false;\n console.error('ws error:', err.message);\n }\n\n /**\n * @internal\n */\n _wsOnClose(code) {\n this._rpcWebSocketConnected = false;\n this._rpcWebSocketGeneration = (this._rpcWebSocketGeneration + 1) % Number.MAX_SAFE_INTEGER;\n if (this._rpcWebSocketIdleTimeout) {\n clearTimeout(this._rpcWebSocketIdleTimeout);\n this._rpcWebSocketIdleTimeout = null;\n }\n if (this._rpcWebSocketHeartbeat) {\n clearInterval(this._rpcWebSocketHeartbeat);\n this._rpcWebSocketHeartbeat = null;\n }\n if (code === 1000) {\n // explicit close, check if any subscriptions have been made since close\n this._updateSubscriptions();\n return;\n }\n\n // implicit close, prepare subscriptions for auto-reconnect\n this._subscriptionCallbacksByServerSubscriptionId = {};\n Object.entries(this._subscriptionsByHash).forEach(([hash, subscription]) => {\n this._setSubscription(hash, {\n ...subscription,\n state: 'pending'\n });\n });\n }\n\n /**\n * @internal\n */\n _setSubscription(hash, nextSubscription) {\n const prevState = this._subscriptionsByHash[hash]?.state;\n this._subscriptionsByHash[hash] = nextSubscription;\n if (prevState !== nextSubscription.state) {\n const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash];\n if (stateChangeCallbacks) {\n stateChangeCallbacks.forEach(cb => {\n try {\n cb(nextSubscription.state);\n // eslint-disable-next-line no-empty\n } catch {}\n });\n }\n }\n }\n\n /**\n * @internal\n */\n _onSubscriptionStateChange(clientSubscriptionId, callback) {\n const hash = this._subscriptionHashByClientSubscriptionId[clientSubscriptionId];\n if (hash == null) {\n return () => {};\n }\n const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash] ||= new Set();\n stateChangeCallbacks.add(callback);\n return () => {\n stateChangeCallbacks.delete(callback);\n if (stateChangeCallbacks.size === 0) {\n delete this._subscriptionStateChangeCallbacksByHash[hash];\n }\n };\n }\n\n /**\n * @internal\n */\n async _updateSubscriptions() {\n if (Object.keys(this._subscriptionsByHash).length === 0) {\n if (this._rpcWebSocketConnected) {\n this._rpcWebSocketConnected = false;\n this._rpcWebSocketIdleTimeout = setTimeout(() => {\n this._rpcWebSocketIdleTimeout = null;\n try {\n this._rpcWebSocket.close();\n } catch (err) {\n // swallow error if socket has already been closed.\n if (err instanceof Error) {\n console.log(`Error when closing socket connection: ${err.message}`);\n }\n }\n }, 500);\n }\n return;\n }\n if (this._rpcWebSocketIdleTimeout !== null) {\n clearTimeout(this._rpcWebSocketIdleTimeout);\n this._rpcWebSocketIdleTimeout = null;\n this._rpcWebSocketConnected = true;\n }\n if (!this._rpcWebSocketConnected) {\n this._rpcWebSocket.connect();\n return;\n }\n const activeWebSocketGeneration = this._rpcWebSocketGeneration;\n const isCurrentConnectionStillActive = () => {\n return activeWebSocketGeneration === this._rpcWebSocketGeneration;\n };\n await Promise.all(\n // Don't be tempted to change this to `Object.entries`. We call\n // `_updateSubscriptions` recursively when processing the state,\n // so it's important that we look up the *current* version of\n // each subscription, every time we process a hash.\n Object.keys(this._subscriptionsByHash).map(async hash => {\n const subscription = this._subscriptionsByHash[hash];\n if (subscription === undefined) {\n // This entry has since been deleted. Skip.\n return;\n }\n switch (subscription.state) {\n case 'pending':\n case 'unsubscribed':\n if (subscription.callbacks.size === 0) {\n /**\n * You can end up here when:\n *\n * - a subscription has recently unsubscribed\n * without having new callbacks added to it\n * while the unsubscribe was in flight, or\n * - when a pending subscription has its\n * listeners removed before a request was\n * sent to the server.\n *\n * Being that nobody is interested in this\n * subscription any longer, delete it.\n */\n delete this._subscriptionsByHash[hash];\n if (subscription.state === 'unsubscribed') {\n delete this._subscriptionCallbacksByServerSubscriptionId[subscription.serverSubscriptionId];\n }\n await this._updateSubscriptions();\n return;\n }\n await (async () => {\n const {\n args,\n method\n } = subscription;\n try {\n this._setSubscription(hash, {\n ...subscription,\n state: 'subscribing'\n });\n const serverSubscriptionId = await this._rpcWebSocket.call(method, args);\n this._setSubscription(hash, {\n ...subscription,\n serverSubscriptionId,\n state: 'subscribed'\n });\n this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId] = subscription.callbacks;\n await this._updateSubscriptions();\n } catch (e) {\n console.error(`Received ${e instanceof Error ? '' : 'JSON-RPC '}error calling \\`${method}\\``, {\n args,\n error: e\n });\n if (!isCurrentConnectionStillActive()) {\n return;\n }\n // TODO: Maybe add an 'errored' state or a retry limit?\n this._setSubscription(hash, {\n ...subscription,\n state: 'pending'\n });\n await this._updateSubscriptions();\n }\n })();\n break;\n case 'subscribed':\n if (subscription.callbacks.size === 0) {\n // By the time we successfully set up a subscription\n // with the server, the client stopped caring about it.\n // Tear it down now.\n await (async () => {\n const {\n serverSubscriptionId,\n unsubscribeMethod\n } = subscription;\n if (this._subscriptionsAutoDisposedByRpc.has(serverSubscriptionId)) {\n /**\n * Special case.\n * If we're dealing with a subscription that has been auto-\n * disposed by the RPC, then we can skip the RPC call to\n * tear down the subscription here.\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n this._subscriptionsAutoDisposedByRpc.delete(serverSubscriptionId);\n } else {\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribing'\n });\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribing'\n });\n try {\n await this._rpcWebSocket.call(unsubscribeMethod, [serverSubscriptionId]);\n } catch (e) {\n if (e instanceof Error) {\n console.error(`${unsubscribeMethod} error:`, e.message);\n }\n if (!isCurrentConnectionStillActive()) {\n return;\n }\n // TODO: Maybe add an 'errored' state or a retry limit?\n this._setSubscription(hash, {\n ...subscription,\n state: 'subscribed'\n });\n await this._updateSubscriptions();\n return;\n }\n }\n this._setSubscription(hash, {\n ...subscription,\n state: 'unsubscribed'\n });\n await this._updateSubscriptions();\n })();\n }\n break;\n }\n }));\n }\n\n /**\n * @internal\n */\n _handleServerNotification(serverSubscriptionId, callbackArgs) {\n const callbacks = this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId];\n if (callbacks === undefined) {\n return;\n }\n callbacks.forEach(cb => {\n try {\n cb(\n // I failed to find a way to convince TypeScript that `cb` is of type\n // `TCallback` which is certainly compatible with `Parameters`.\n // See https://github.com/microsoft/TypeScript/issues/47615\n // @ts-ignore\n ...callbackArgs);\n } catch (e) {\n console.error(e);\n }\n });\n }\n\n /**\n * @internal\n */\n _wsOnAccountNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, AccountNotificationResult);\n this._handleServerNotification(subscription, [result.value, result.context]);\n }\n\n /**\n * @internal\n */\n _makeSubscription(subscriptionConfig,\n /**\n * When preparing `args` for a call to `_makeSubscription`, be sure\n * to carefully apply a default `commitment` property, if necessary.\n *\n * - If the user supplied a `commitment` use that.\n * - Otherwise, if the `Connection::commitment` is set, use that.\n * - Otherwise, set it to the RPC server default: `finalized`.\n *\n * This is extremely important to ensure that these two fundamentally\n * identical subscriptions produce the same identifying hash:\n *\n * - A subscription made without specifying a commitment.\n * - A subscription made where the commitment specified is the same\n * as the default applied to the subscription above.\n *\n * Example; these two subscriptions must produce the same hash:\n *\n * - An `accountSubscribe` subscription for `'PUBKEY'`\n * - An `accountSubscribe` subscription for `'PUBKEY'` with commitment\n * `'finalized'`.\n *\n * See the 'making a subscription with defaulted params omitted' test\n * in `connection-subscriptions.ts` for more.\n */\n args) {\n const clientSubscriptionId = this._nextClientSubscriptionId++;\n const hash = fastStableStringify([subscriptionConfig.method, args]);\n const existingSubscription = this._subscriptionsByHash[hash];\n if (existingSubscription === undefined) {\n this._subscriptionsByHash[hash] = {\n ...subscriptionConfig,\n args,\n callbacks: new Set([subscriptionConfig.callback]),\n state: 'pending'\n };\n } else {\n existingSubscription.callbacks.add(subscriptionConfig.callback);\n }\n this._subscriptionHashByClientSubscriptionId[clientSubscriptionId] = hash;\n this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId] = async () => {\n delete this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId];\n delete this._subscriptionHashByClientSubscriptionId[clientSubscriptionId];\n const subscription = this._subscriptionsByHash[hash];\n assert(subscription !== undefined, `Could not find a \\`Subscription\\` when tearing down client subscription #${clientSubscriptionId}`);\n subscription.callbacks.delete(subscriptionConfig.callback);\n await this._updateSubscriptions();\n };\n this._updateSubscriptions();\n return clientSubscriptionId;\n }\n\n /**\n * Register a callback to be invoked whenever the specified account changes\n *\n * @param publicKey Public key of the account to monitor\n * @param callback Function to invoke whenever the account is changed\n * @param config\n * @return subscription id\n */\n\n /** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n onAccountChange(publicKey, callback, commitmentOrConfig) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([publicKey.toBase58()], commitment || this._commitment || 'finalized',\n // Apply connection/server default.\n 'base64', config);\n return this._makeSubscription({\n callback,\n method: 'accountSubscribe',\n unsubscribeMethod: 'accountUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister an account notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeAccountChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change');\n }\n\n /**\n * @internal\n */\n _wsOnProgramAccountNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, ProgramAccountNotificationResult);\n this._handleServerNotification(subscription, [{\n accountId: result.value.pubkey,\n accountInfo: result.value.account\n }, result.context]);\n }\n\n /**\n * Register a callback to be invoked whenever accounts owned by the\n * specified program change\n *\n * @param programId Public key of the program to monitor\n * @param callback Function to invoke whenever the account is changed\n * @param config\n * @return subscription id\n */\n\n /** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */\n // eslint-disable-next-line no-dupe-class-members\n\n // eslint-disable-next-line no-dupe-class-members\n onProgramAccountChange(programId, callback, commitmentOrConfig, maybeFilters) {\n const {\n commitment,\n config\n } = extractCommitmentFromConfig(commitmentOrConfig);\n const args = this._buildArgs([programId.toBase58()], commitment || this._commitment || 'finalized',\n // Apply connection/server default.\n 'base64' /* encoding */, config ? config : maybeFilters ? {\n filters: applyDefaultMemcmpEncodingToFilters(maybeFilters)\n } : undefined /* extra */);\n return this._makeSubscription({\n callback,\n method: 'programSubscribe',\n unsubscribeMethod: 'programUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister an account notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeProgramAccountChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change');\n }\n\n /**\n * Registers a callback to be invoked whenever logs are emitted.\n */\n onLogs(filter, callback, commitment) {\n const args = this._buildArgs([typeof filter === 'object' ? {\n mentions: [filter.toString()]\n } : filter], commitment || this._commitment || 'finalized' // Apply connection/server default.\n );\n return this._makeSubscription({\n callback,\n method: 'logsSubscribe',\n unsubscribeMethod: 'logsUnsubscribe'\n }, args);\n }\n\n /**\n * Deregister a logs callback.\n *\n * @param clientSubscriptionId client subscription id to deregister.\n */\n async removeOnLogsListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs');\n }\n\n /**\n * @internal\n */\n _wsOnLogsNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, LogsNotificationResult);\n this._handleServerNotification(subscription, [result.value, result.context]);\n }\n\n /**\n * @internal\n */\n _wsOnSlotNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, SlotNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon slot changes\n *\n * @param callback Function to invoke whenever the slot changes\n * @return subscription id\n */\n onSlotChange(callback) {\n return this._makeSubscription({\n callback,\n method: 'slotSubscribe',\n unsubscribeMethod: 'slotUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a slot notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSlotChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change');\n }\n\n /**\n * @internal\n */\n _wsOnSlotUpdatesNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, SlotUpdateNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s\n * may be useful to track live progress of a cluster.\n *\n * @param callback Function to invoke whenever the slot updates\n * @return subscription id\n */\n onSlotUpdate(callback) {\n return this._makeSubscription({\n callback,\n method: 'slotsUpdatesSubscribe',\n unsubscribeMethod: 'slotsUpdatesUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a slot update notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSlotUpdateListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update');\n }\n\n /**\n * @internal\n */\n\n async _unsubscribeClientSubscription(clientSubscriptionId, subscriptionName) {\n const dispose = this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId];\n if (dispose) {\n await dispose();\n } else {\n console.warn('Ignored unsubscribe request because an active subscription with id ' + `\\`${clientSubscriptionId}\\` for '${subscriptionName}' events ` + 'could not be found.');\n }\n }\n _buildArgs(args, override, encoding, extra) {\n const commitment = override || this._commitment;\n if (commitment || encoding || extra) {\n let options = {};\n if (encoding) {\n options.encoding = encoding;\n }\n if (commitment) {\n options.commitment = commitment;\n }\n if (extra) {\n options = Object.assign(options, extra);\n }\n args.push(options);\n }\n return args;\n }\n\n /**\n * @internal\n */\n _buildArgsAtLeastConfirmed(args, override, encoding, extra) {\n const commitment = override || this._commitment;\n if (commitment && !['confirmed', 'finalized'].includes(commitment)) {\n throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`');\n }\n return this._buildArgs(args, override, encoding, extra);\n }\n\n /**\n * @internal\n */\n _wsOnSignatureNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, SignatureNotificationResult);\n if (result.value !== 'receivedSignature') {\n /**\n * Special case.\n * After a signature is processed, RPCs automatically dispose of the\n * subscription on the server side. We need to track which of these\n * subscriptions have been disposed in such a way, so that we know\n * whether the client is dealing with a not-yet-processed signature\n * (in which case we must tear down the server subscription) or an\n * already-processed signature (in which case the client can simply\n * clear out the subscription locally without telling the server).\n *\n * NOTE: There is a proposal to eliminate this special case, here:\n * https://github.com/solana-labs/solana/issues/18892\n */\n this._subscriptionsAutoDisposedByRpc.add(subscription);\n }\n this._handleServerNotification(subscription, result.value === 'receivedSignature' ? [{\n type: 'received'\n }, result.context] : [{\n type: 'status',\n result: result.value\n }, result.context]);\n }\n\n /**\n * Register a callback to be invoked upon signature updates\n *\n * @param signature Transaction signature string in base 58\n * @param callback Function to invoke on signature notifications\n * @param commitment Specify the commitment level signature must reach before notification\n * @return subscription id\n */\n onSignature(signature, callback, commitment) {\n const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default.\n );\n const clientSubscriptionId = this._makeSubscription({\n callback: (notification, context) => {\n if (notification.type === 'status') {\n callback(notification.result, context);\n // Signatures subscriptions are auto-removed by the RPC service\n // so no need to explicitly send an unsubscribe message.\n try {\n this.removeSignatureListener(clientSubscriptionId);\n // eslint-disable-next-line no-empty\n } catch (_err) {\n // Already removed.\n }\n }\n },\n method: 'signatureSubscribe',\n unsubscribeMethod: 'signatureUnsubscribe'\n }, args);\n return clientSubscriptionId;\n }\n\n /**\n * Register a callback to be invoked when a transaction is\n * received and/or processed.\n *\n * @param signature Transaction signature string in base 58\n * @param callback Function to invoke on signature notifications\n * @param options Enable received notifications and set the commitment\n * level that signature must reach before notification\n * @return subscription id\n */\n onSignatureWithOptions(signature, callback, options) {\n const {\n commitment,\n ...extra\n } = {\n ...options,\n commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default.\n };\n const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra);\n const clientSubscriptionId = this._makeSubscription({\n callback: (notification, context) => {\n callback(notification, context);\n // Signatures subscriptions are auto-removed by the RPC service\n // so no need to explicitly send an unsubscribe message.\n try {\n this.removeSignatureListener(clientSubscriptionId);\n // eslint-disable-next-line no-empty\n } catch (_err) {\n // Already removed.\n }\n },\n method: 'signatureSubscribe',\n unsubscribeMethod: 'signatureUnsubscribe'\n }, args);\n return clientSubscriptionId;\n }\n\n /**\n * Deregister a signature notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeSignatureListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result');\n }\n\n /**\n * @internal\n */\n _wsOnRootNotification(notification) {\n const {\n result,\n subscription\n } = create(notification, RootNotificationResult);\n this._handleServerNotification(subscription, [result]);\n }\n\n /**\n * Register a callback to be invoked upon root changes\n *\n * @param callback Function to invoke whenever the root changes\n * @return subscription id\n */\n onRootChange(callback) {\n return this._makeSubscription({\n callback,\n method: 'rootSubscribe',\n unsubscribeMethod: 'rootUnsubscribe'\n }, [] /* args */);\n }\n\n /**\n * Deregister a root notification callback\n *\n * @param clientSubscriptionId client subscription id to deregister\n */\n async removeRootChangeListener(clientSubscriptionId) {\n await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change');\n }\n}\n\n/**\n * Keypair signer interface\n */\n\n/**\n * An account keypair used for signing transactions.\n */\nclass Keypair {\n /**\n * Create a new keypair instance.\n * Generate random keypair if no {@link Ed25519Keypair} is provided.\n *\n * @param {Ed25519Keypair} keypair ed25519 keypair\n */\n constructor(keypair) {\n this._keypair = void 0;\n this._keypair = keypair ?? generateKeypair();\n }\n\n /**\n * Generate a new random keypair\n *\n * @returns {Keypair} Keypair\n */\n static generate() {\n return new Keypair(generateKeypair());\n }\n\n /**\n * Create a keypair from a raw secret key byte array.\n *\n * This method should only be used to recreate a keypair from a previously\n * generated secret key. Generating keypairs from a random seed should be done\n * with the {@link Keypair.fromSeed} method.\n *\n * @throws error if the provided secret key is invalid and validation is not skipped.\n *\n * @param secretKey secret key byte array\n * @param options skip secret key validation\n *\n * @returns {Keypair} Keypair\n */\n static fromSecretKey(secretKey, options) {\n if (secretKey.byteLength !== 64) {\n throw new Error('bad secret key size');\n }\n const publicKey = secretKey.slice(32, 64);\n if (!options || !options.skipValidation) {\n const privateScalar = secretKey.slice(0, 32);\n const computedPublicKey = getPublicKey(privateScalar);\n for (let ii = 0; ii < 32; ii++) {\n if (publicKey[ii] !== computedPublicKey[ii]) {\n throw new Error('provided secretKey is invalid');\n }\n }\n }\n return new Keypair({\n publicKey,\n secretKey\n });\n }\n\n /**\n * Generate a keypair from a 32 byte seed.\n *\n * @param seed seed byte array\n *\n * @returns {Keypair} Keypair\n */\n static fromSeed(seed) {\n const publicKey = getPublicKey(seed);\n const secretKey = new Uint8Array(64);\n secretKey.set(seed);\n secretKey.set(publicKey, 32);\n return new Keypair({\n publicKey,\n secretKey\n });\n }\n\n /**\n * The public key for this keypair\n *\n * @returns {PublicKey} PublicKey\n */\n get publicKey() {\n return new PublicKey(this._keypair.publicKey);\n }\n\n /**\n * The raw secret key for this keypair\n * @returns {Uint8Array} Secret key in an array of Uint8 bytes\n */\n get secretKey() {\n return new Uint8Array(this._keypair.secretKey);\n }\n}\n\n/**\n * An enumeration of valid LookupTableInstructionType's\n */\n\n/**\n * An enumeration of valid address lookup table InstructionType's\n * @internal\n */\nconst LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({\n CreateLookupTable: {\n index: 0,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64('recentSlot'), BufferLayout.u8('bumpSeed')])\n },\n FreezeLookupTable: {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n ExtendLookupTable: {\n index: 2,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), u64(), BufferLayout.seq(publicKey(), BufferLayout.offset(BufferLayout.u32(), -8), 'addresses')])\n },\n DeactivateLookupTable: {\n index: 3,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n CloseLookupTable: {\n index: 4,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n }\n});\nclass AddressLookupTableInstruction {\n /**\n * @internal\n */\n constructor() {}\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u32('instruction');\n const index = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [layoutType, layout] of Object.entries(LOOKUP_TABLE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == index) {\n type = layoutType;\n break;\n }\n }\n if (!type) {\n throw new Error('Invalid Instruction. Should be a LookupTable Instruction');\n }\n return type;\n }\n static decodeCreateLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 4);\n const {\n recentSlot\n } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable, instruction.data);\n return {\n authority: instruction.keys[1].pubkey,\n payer: instruction.keys[2].pubkey,\n recentSlot: Number(recentSlot)\n };\n }\n static decodeExtendLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n if (instruction.keys.length < 2) {\n throw new Error(`invalid instruction; found ${instruction.keys.length} keys, expected at least 2`);\n }\n const {\n addresses\n } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable, instruction.data);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey,\n payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : undefined,\n addresses: addresses.map(buffer => new PublicKey(buffer))\n };\n }\n static decodeCloseLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 3);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey,\n recipient: instruction.keys[2].pubkey\n };\n }\n static decodeFreezeLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 2);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey\n };\n }\n static decodeDeactivateLookupTable(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeysLength(instruction.keys, 2);\n return {\n lookupTable: instruction.keys[0].pubkey,\n authority: instruction.keys[1].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(AddressLookupTableProgram.programId)) {\n throw new Error('invalid instruction; programId is not AddressLookupTable Program');\n }\n }\n /**\n * @internal\n */\n static checkKeysLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\nclass AddressLookupTableProgram {\n /**\n * @internal\n */\n constructor() {}\n static createLookupTable(params) {\n const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync([params.authority.toBuffer(), getU64Encoder().encode(params.recentSlot)], this.programId);\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable;\n const data = encodeData(type, {\n recentSlot: BigInt(params.recentSlot),\n bumpSeed: bumpSeed\n });\n const keys = [{\n pubkey: lookupTableAddress,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.payer,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SystemProgram.programId,\n isSigner: false,\n isWritable: false\n }];\n return [new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n }), lookupTableAddress];\n }\n static freezeLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.FreezeLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static extendLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable;\n const data = encodeData(type, {\n addresses: params.addresses.map(addr => addr.toBytes())\n });\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n if (params.payer) {\n keys.push({\n pubkey: params.payer,\n isSigner: true,\n isWritable: true\n }, {\n pubkey: SystemProgram.programId,\n isSigner: false,\n isWritable: false\n });\n }\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static deactivateLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n static closeLookupTable(params) {\n const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable;\n const data = encodeData(type);\n const keys = [{\n pubkey: params.lookupTable,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: params.authority,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: params.recipient,\n isSigner: false,\n isWritable: true\n }];\n return new TransactionInstruction({\n programId: this.programId,\n keys: keys,\n data: data\n });\n }\n}\nAddressLookupTableProgram.programId = new PublicKey('AddressLookupTab1e1111111111111111111111111');\n\n/**\n * Compute Budget Instruction class\n */\nclass ComputeBudgetInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a compute budget instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u8('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a ComputeBudgetInstruction');\n }\n return type;\n }\n\n /**\n * Decode request units compute budget instruction and retrieve the instruction params.\n */\n static decodeRequestUnits(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n units,\n additionalFee\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits, instruction.data);\n return {\n units,\n additionalFee\n };\n }\n\n /**\n * Decode request heap frame compute budget instruction and retrieve the instruction params.\n */\n static decodeRequestHeapFrame(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n bytes\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame, instruction.data);\n return {\n bytes\n };\n }\n\n /**\n * Decode set compute unit limit compute budget instruction and retrieve the instruction params.\n */\n static decodeSetComputeUnitLimit(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n units\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data);\n return {\n units\n };\n }\n\n /**\n * Decode set compute unit price compute budget instruction and retrieve the instruction params.\n */\n static decodeSetComputeUnitPrice(instruction) {\n this.checkProgramId(instruction.programId);\n const {\n microLamports\n } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data);\n return {\n microLamports\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(ComputeBudgetProgram.programId)) {\n throw new Error('invalid instruction; programId is not ComputeBudgetProgram');\n }\n }\n}\n\n/**\n * An enumeration of valid ComputeBudgetInstructionType's\n */\n\n/**\n * Request units instruction params\n */\n\n/**\n * Request heap frame instruction params\n */\n\n/**\n * Set compute unit limit instruction params\n */\n\n/**\n * Set compute unit price instruction params\n */\n\n/**\n * An enumeration of valid ComputeBudget InstructionType's\n * @internal\n */\nconst COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({\n RequestUnits: {\n index: 0,\n layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('units'), BufferLayout.u32('additionalFee')])\n },\n RequestHeapFrame: {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('bytes')])\n },\n SetComputeUnitLimit: {\n index: 2,\n layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('units')])\n },\n SetComputeUnitPrice: {\n index: 3,\n layout: BufferLayout.struct([BufferLayout.u8('instruction'), u64('microLamports')])\n }\n});\n\n/**\n * Factory class for transaction instructions to interact with the Compute Budget program\n */\nclass ComputeBudgetProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Compute Budget program\n */\n\n /**\n * @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice}\n */\n static requestUnits(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static requestHeapFrame(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static setComputeUnitLimit(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;\n const data = encodeData(type, params);\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n static setComputeUnitPrice(params) {\n const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;\n const data = encodeData(type, {\n microLamports: BigInt(params.microLamports)\n });\n return new TransactionInstruction({\n keys: [],\n programId: this.programId,\n data\n });\n }\n}\nComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');\n\nconst PRIVATE_KEY_BYTES$1 = 64;\nconst PUBLIC_KEY_BYTES$1 = 32;\nconst SIGNATURE_BYTES = 64;\n\n/**\n * Params for creating an ed25519 instruction using a public key\n */\n\n/**\n * Params for creating an ed25519 instruction using a private key\n */\n\nconst ED25519_INSTRUCTION_LAYOUT = BufferLayout.struct([BufferLayout.u8('numSignatures'), BufferLayout.u8('padding'), BufferLayout.u16('signatureOffset'), BufferLayout.u16('signatureInstructionIndex'), BufferLayout.u16('publicKeyOffset'), BufferLayout.u16('publicKeyInstructionIndex'), BufferLayout.u16('messageDataOffset'), BufferLayout.u16('messageDataSize'), BufferLayout.u16('messageInstructionIndex')]);\nclass Ed25519Program {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the ed25519 program\n */\n\n /**\n * Create an ed25519 instruction with a public key and signature. The\n * public key must be a buffer that is 32 bytes long, and the signature\n * must be a buffer of 64 bytes.\n */\n static createInstructionWithPublicKey(params) {\n const {\n publicKey,\n message,\n signature,\n instructionIndex\n } = params;\n assert(publicKey.length === PUBLIC_KEY_BYTES$1, `Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${publicKey.length} bytes`);\n assert(signature.length === SIGNATURE_BYTES, `Signature must be ${SIGNATURE_BYTES} bytes but received ${signature.length} bytes`);\n const publicKeyOffset = ED25519_INSTRUCTION_LAYOUT.span;\n const signatureOffset = publicKeyOffset + publicKey.length;\n const messageDataOffset = signatureOffset + signature.length;\n const numSignatures = 1;\n const instructionData = Buffer.alloc(messageDataOffset + message.length);\n const index = instructionIndex == null ? 0xffff // An index of `u16::MAX` makes it default to the current instruction.\n : instructionIndex;\n ED25519_INSTRUCTION_LAYOUT.encode({\n numSignatures,\n padding: 0,\n signatureOffset,\n signatureInstructionIndex: index,\n publicKeyOffset,\n publicKeyInstructionIndex: index,\n messageDataOffset,\n messageDataSize: message.length,\n messageInstructionIndex: index\n }, instructionData);\n instructionData.fill(publicKey, publicKeyOffset);\n instructionData.fill(signature, signatureOffset);\n instructionData.fill(message, messageDataOffset);\n return new TransactionInstruction({\n keys: [],\n programId: Ed25519Program.programId,\n data: instructionData\n });\n }\n\n /**\n * Create an ed25519 instruction with a private key. The private key\n * must be a buffer that is 64 bytes long.\n */\n static createInstructionWithPrivateKey(params) {\n const {\n privateKey,\n message,\n instructionIndex\n } = params;\n assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`);\n try {\n const keypair = Keypair.fromSecretKey(privateKey);\n const publicKey = keypair.publicKey.toBytes();\n const signature = sign(message, keypair.secretKey);\n return this.createInstructionWithPublicKey({\n publicKey,\n message,\n signature,\n instructionIndex\n });\n } catch (error) {\n throw new Error(`Error creating instruction; ${error}`);\n }\n }\n}\nEd25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111');\n\nconst ecdsaSign = (msgHash, privKey) => {\n const signature = secp256k1.sign(msgHash, privKey);\n return [signature.toCompactRawBytes(), signature.recovery];\n};\nsecp256k1.utils.isValidPrivateKey;\nconst publicKeyCreate = secp256k1.getPublicKey;\n\nconst PRIVATE_KEY_BYTES = 32;\nconst ETHEREUM_ADDRESS_BYTES = 20;\nconst PUBLIC_KEY_BYTES = 64;\nconst SIGNATURE_OFFSETS_SERIALIZED_SIZE = 11;\n\n/**\n * Params for creating an secp256k1 instruction using a public key\n */\n\n/**\n * Params for creating an secp256k1 instruction using an Ethereum address\n */\n\n/**\n * Params for creating an secp256k1 instruction using a private key\n */\n\nconst SECP256K1_INSTRUCTION_LAYOUT = BufferLayout.struct([BufferLayout.u8('numSignatures'), BufferLayout.u16('signatureOffset'), BufferLayout.u8('signatureInstructionIndex'), BufferLayout.u16('ethAddressOffset'), BufferLayout.u8('ethAddressInstructionIndex'), BufferLayout.u16('messageDataOffset'), BufferLayout.u16('messageDataSize'), BufferLayout.u8('messageInstructionIndex'), BufferLayout.blob(20, 'ethAddress'), BufferLayout.blob(64, 'signature'), BufferLayout.u8('recoveryId')]);\nclass Secp256k1Program {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the secp256k1 program\n */\n\n /**\n * Construct an Ethereum address from a secp256k1 public key buffer.\n * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer\n */\n static publicKeyToEthAddress(publicKey) {\n assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`);\n try {\n return Buffer.from(keccak_256(toBuffer(publicKey))).slice(-ETHEREUM_ADDRESS_BYTES);\n } catch (error) {\n throw new Error(`Error constructing Ethereum address: ${error}`);\n }\n }\n\n /**\n * Create an secp256k1 instruction with a public key. The public key\n * must be a buffer that is 64 bytes long.\n */\n static createInstructionWithPublicKey(params) {\n const {\n publicKey,\n message,\n signature,\n recoveryId,\n instructionIndex\n } = params;\n return Secp256k1Program.createInstructionWithEthAddress({\n ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey),\n message,\n signature,\n recoveryId,\n instructionIndex\n });\n }\n\n /**\n * Create an secp256k1 instruction with an Ethereum address. The address\n * must be a hex string or a buffer that is 20 bytes long.\n */\n static createInstructionWithEthAddress(params) {\n const {\n ethAddress: rawAddress,\n message,\n signature,\n recoveryId,\n instructionIndex = 0\n } = params;\n let ethAddress;\n if (typeof rawAddress === 'string') {\n if (rawAddress.startsWith('0x')) {\n ethAddress = Buffer.from(rawAddress.substr(2), 'hex');\n } else {\n ethAddress = Buffer.from(rawAddress, 'hex');\n }\n } else {\n ethAddress = rawAddress;\n }\n assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, `Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`);\n const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE;\n const ethAddressOffset = dataStart;\n const signatureOffset = dataStart + ethAddress.length;\n const messageDataOffset = signatureOffset + signature.length + 1;\n const numSignatures = 1;\n const instructionData = Buffer.alloc(SECP256K1_INSTRUCTION_LAYOUT.span + message.length);\n SECP256K1_INSTRUCTION_LAYOUT.encode({\n numSignatures,\n signatureOffset,\n signatureInstructionIndex: instructionIndex,\n ethAddressOffset,\n ethAddressInstructionIndex: instructionIndex,\n messageDataOffset,\n messageDataSize: message.length,\n messageInstructionIndex: instructionIndex,\n signature: toBuffer(signature),\n ethAddress: toBuffer(ethAddress),\n recoveryId\n }, instructionData);\n instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span);\n return new TransactionInstruction({\n keys: [],\n programId: Secp256k1Program.programId,\n data: instructionData\n });\n }\n\n /**\n * Create an secp256k1 instruction with a private key. The private key\n * must be a buffer that is 32 bytes long.\n */\n static createInstructionWithPrivateKey(params) {\n const {\n privateKey: pkey,\n message,\n instructionIndex\n } = params;\n assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`);\n try {\n const privateKey = toBuffer(pkey);\n const publicKey = publicKeyCreate(privateKey, false /* isCompressed */).slice(1); // throw away leading byte\n const messageHash = Buffer.from(keccak_256(toBuffer(message)));\n const [signature, recoveryId] = ecdsaSign(messageHash, privateKey);\n return this.createInstructionWithPublicKey({\n publicKey,\n message,\n signature,\n recoveryId,\n instructionIndex\n });\n } catch (error) {\n throw new Error(`Error creating instruction; ${error}`);\n }\n }\n}\nSecp256k1Program.programId = new PublicKey('KeccakSecp256k11111111111111111111111111111');\n\nvar _Lockup;\n\n/**\n * Address of the stake config account which configures the rate\n * of stake warmup and cooldown as well as the slashing penalty.\n */\nconst STAKE_CONFIG_ID = new PublicKey('StakeConfig11111111111111111111111111111111');\n\n/**\n * Stake account authority info\n */\nclass Authorized {\n /**\n * Create a new Authorized object\n * @param staker the stake authority\n * @param withdrawer the withdraw authority\n */\n constructor(staker, withdrawer) {\n /** stake authority */\n this.staker = void 0;\n /** withdraw authority */\n this.withdrawer = void 0;\n this.staker = staker;\n this.withdrawer = withdrawer;\n }\n}\n/**\n * Stake account lockup info\n */\nclass Lockup {\n /**\n * Create a new Lockup object\n */\n constructor(unixTimestamp, epoch, custodian) {\n /** Unix timestamp of lockup expiration */\n this.unixTimestamp = void 0;\n /** Epoch of lockup expiration */\n this.epoch = void 0;\n /** Lockup custodian authority */\n this.custodian = void 0;\n this.unixTimestamp = unixTimestamp;\n this.epoch = epoch;\n this.custodian = custodian;\n }\n\n /**\n * Default, inactive Lockup value\n */\n}\n_Lockup = Lockup;\nLockup.default = new _Lockup(0, 0, PublicKey.default);\n/**\n * Create stake account transaction params\n */\n/**\n * Create stake account with seed transaction params\n */\n/**\n * Initialize stake instruction params\n */\n/**\n * Delegate stake instruction params\n */\n/**\n * Authorize stake instruction params\n */\n/**\n * Authorize stake instruction params using a derived key\n */\n/**\n * Split stake instruction params\n */\n/**\n * Split with seed transaction params\n */\n/**\n * Withdraw stake instruction params\n */\n/**\n * Deactivate stake instruction params\n */\n/**\n * Merge stake instruction params\n */\n/**\n * Stake Instruction class\n */\nclass StakeInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a stake instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(STAKE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a StakeInstruction');\n }\n return type;\n }\n\n /**\n * Decode a initialize stake instruction and retrieve the instruction params.\n */\n static decodeInitialize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n authorized,\n lockup\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n authorized: new Authorized(new PublicKey(authorized.staker), new PublicKey(authorized.withdrawer)),\n lockup: new Lockup(lockup.unixTimestamp, lockup.epoch, new PublicKey(lockup.custodian))\n };\n }\n\n /**\n * Decode a delegate stake instruction and retrieve the instruction params.\n */\n static decodeDelegate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 6);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Delegate, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n votePubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[5].pubkey\n };\n }\n\n /**\n * Decode an authorize stake instruction and retrieve the instruction params.\n */\n static decodeAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n newAuthorized,\n stakeAuthorizationType\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n stakeAuthorizationType: {\n index: stakeAuthorizationType\n }\n };\n if (instruction.keys.length > 3) {\n o.custodianPubkey = instruction.keys[3].pubkey;\n }\n return o;\n }\n\n /**\n * Decode an authorize-with-seed stake instruction and retrieve the instruction params.\n */\n static decodeAuthorizeWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 2);\n const {\n newAuthorized,\n stakeAuthorizationType,\n authoritySeed,\n authorityOwner\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n authorityBase: instruction.keys[1].pubkey,\n authoritySeed: authoritySeed,\n authorityOwner: new PublicKey(authorityOwner),\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n stakeAuthorizationType: {\n index: stakeAuthorizationType\n }\n };\n if (instruction.keys.length > 3) {\n o.custodianPubkey = instruction.keys[3].pubkey;\n }\n return o;\n }\n\n /**\n * Decode a split stake instruction and retrieve the instruction params.\n */\n static decodeSplit(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Split, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n splitStakePubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n lamports\n };\n }\n\n /**\n * Decode a merge stake instruction and retrieve the instruction params.\n */\n static decodeMerge(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Merge, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n sourceStakePubKey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey\n };\n }\n\n /**\n * Decode a withdraw stake instruction and retrieve the instruction params.\n */\n static decodeWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 5);\n const {\n lamports\n } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data);\n const o = {\n stakePubkey: instruction.keys[0].pubkey,\n toPubkey: instruction.keys[1].pubkey,\n authorizedPubkey: instruction.keys[4].pubkey,\n lamports\n };\n if (instruction.keys.length > 5) {\n o.custodianPubkey = instruction.keys[5].pubkey;\n }\n return o;\n }\n\n /**\n * Decode a deactivate stake instruction and retrieve the instruction params.\n */\n static decodeDeactivate(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Deactivate, instruction.data);\n return {\n stakePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(StakeProgram.programId)) {\n throw new Error('invalid instruction; programId is not StakeProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid StakeInstructionType's\n */\n\n/**\n * An enumeration of valid stake InstructionType's\n * @internal\n */\nconst STAKE_INSTRUCTION_LAYOUTS = Object.freeze({\n Initialize: {\n index: 0,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), authorized(), lockup()])\n },\n Authorize: {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('newAuthorized'), BufferLayout.u32('stakeAuthorizationType')])\n },\n Delegate: {\n index: 2,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n Split: {\n index: 3,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])\n },\n Withdraw: {\n index: 4,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])\n },\n Deactivate: {\n index: 5,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n Merge: {\n index: 7,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n AuthorizeWithSeed: {\n index: 8,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('newAuthorized'), BufferLayout.u32('stakeAuthorizationType'), rustString('authoritySeed'), publicKey('authorityOwner')])\n }\n});\n\n/**\n * Stake authorization type\n */\n\n/**\n * An enumeration of valid StakeAuthorizationLayout's\n */\nconst StakeAuthorizationLayout = Object.freeze({\n Staker: {\n index: 0\n },\n Withdrawer: {\n index: 1\n }\n});\n\n/**\n * Factory class for transactions to interact with the Stake program\n */\nclass StakeProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Stake program\n */\n\n /**\n * Generate an Initialize instruction to add to a Stake Create transaction\n */\n static initialize(params) {\n const {\n stakePubkey,\n authorized,\n lockup: maybeLockup\n } = params;\n const lockup = maybeLockup || Lockup.default;\n const type = STAKE_INSTRUCTION_LAYOUTS.Initialize;\n const data = encodeData(type, {\n authorized: {\n staker: toBuffer(authorized.staker.toBuffer()),\n withdrawer: toBuffer(authorized.withdrawer.toBuffer())\n },\n lockup: {\n unixTimestamp: lockup.unixTimestamp,\n epoch: lockup.epoch,\n custodian: toBuffer(lockup.custodian.toBuffer())\n }\n });\n const instructionData = {\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a Transaction that creates a new Stake account at\n * an address generated with `from`, a seed, and the Stake programId\n */\n static createAccountWithSeed(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccountWithSeed({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.stakePubkey,\n basePubkey: params.basePubkey,\n seed: params.seed,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n const {\n stakePubkey,\n authorized,\n lockup\n } = params;\n return transaction.add(this.initialize({\n stakePubkey,\n authorized,\n lockup\n }));\n }\n\n /**\n * Generate a Transaction that creates a new Stake account\n */\n static createAccount(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.stakePubkey,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n const {\n stakePubkey,\n authorized,\n lockup\n } = params;\n return transaction.add(this.initialize({\n stakePubkey,\n authorized,\n lockup\n }));\n }\n\n /**\n * Generate a Transaction that delegates Stake tokens to a validator\n * Vote PublicKey. This transaction can also be used to redelegate Stake\n * to a new validator Vote PublicKey.\n */\n static delegate(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n votePubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Delegate;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: votePubkey,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: STAKE_CONFIG_ID,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that authorizes a new PublicKey as Staker\n * or Withdrawer on the Stake account.\n */\n static authorize(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n newAuthorizedPubkey,\n stakeAuthorizationType,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Authorize;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n stakeAuthorizationType: stakeAuthorizationType.index\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that authorizes a new PublicKey as Staker\n * or Withdrawer on the Stake account.\n */\n static authorizeWithSeed(params) {\n const {\n stakePubkey,\n authorityBase,\n authoritySeed,\n authorityOwner,\n newAuthorizedPubkey,\n stakeAuthorizationType,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n stakeAuthorizationType: stakeAuthorizationType.index,\n authoritySeed: authoritySeed,\n authorityOwner: toBuffer(authorityOwner.toBuffer())\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorityBase,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * @internal\n */\n static splitInstruction(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n lamports\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Split;\n const data = encodeData(type, {\n lamports\n });\n return new TransactionInstruction({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: splitStakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that splits Stake tokens into another stake account\n */\n static split(params,\n // Compute the cost of allocating the new stake account in lamports\n rentExemptReserve) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.authorizedPubkey,\n newAccountPubkey: params.splitStakePubkey,\n lamports: rentExemptReserve,\n space: this.space,\n programId: this.programId\n }));\n return transaction.add(this.splitInstruction(params));\n }\n\n /**\n * Generate a Transaction that splits Stake tokens into another account\n * derived from a base public key and seed\n */\n static splitWithSeed(params,\n // If this stake account is new, compute the cost of allocating it in lamports\n rentExemptReserve) {\n const {\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n basePubkey,\n seed,\n lamports\n } = params;\n const transaction = new Transaction();\n transaction.add(SystemProgram.allocate({\n accountPubkey: splitStakePubkey,\n basePubkey,\n seed,\n space: this.space,\n programId: this.programId\n }));\n if (rentExemptReserve && rentExemptReserve > 0) {\n transaction.add(SystemProgram.transfer({\n fromPubkey: params.authorizedPubkey,\n toPubkey: splitStakePubkey,\n lamports: rentExemptReserve\n }));\n }\n return transaction.add(this.splitInstruction({\n stakePubkey,\n authorizedPubkey,\n splitStakePubkey,\n lamports\n }));\n }\n\n /**\n * Generate a Transaction that merges Stake accounts.\n */\n static merge(params) {\n const {\n stakePubkey,\n sourceStakePubKey,\n authorizedPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Merge;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: sourceStakePubKey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that withdraws deactivated Stake tokens.\n */\n static withdraw(params) {\n const {\n stakePubkey,\n authorizedPubkey,\n toPubkey,\n lamports,\n custodianPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Withdraw;\n const data = encodeData(type, {\n lamports\n });\n const keys = [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_STAKE_HISTORY_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n if (custodianPubkey) {\n keys.push({\n pubkey: custodianPubkey,\n isSigner: true,\n isWritable: false\n });\n }\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a Transaction that deactivates Stake tokens.\n */\n static deactivate(params) {\n const {\n stakePubkey,\n authorizedPubkey\n } = params;\n const type = STAKE_INSTRUCTION_LAYOUTS.Deactivate;\n const data = encodeData(type);\n return new Transaction().add({\n keys: [{\n pubkey: stakePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n });\n }\n}\nStakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111111');\n/**\n * Max space of a Stake account\n *\n * This is generated from the solana-stake-program StakeState struct as\n * `StakeStateV2::size_of()`:\n * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html\n */\nStakeProgram.space = 200;\n\n/**\n * Vote account info\n */\nclass VoteInit {\n /** [0, 100] */\n\n constructor(nodePubkey, authorizedVoter, authorizedWithdrawer, commission) {\n this.nodePubkey = void 0;\n this.authorizedVoter = void 0;\n this.authorizedWithdrawer = void 0;\n this.commission = void 0;\n this.nodePubkey = nodePubkey;\n this.authorizedVoter = authorizedVoter;\n this.authorizedWithdrawer = authorizedWithdrawer;\n this.commission = commission;\n }\n}\n\n/**\n * Create vote account transaction params\n */\n\n/**\n * InitializeAccount instruction params\n */\n\n/**\n * Authorize instruction params\n */\n\n/**\n * AuthorizeWithSeed instruction params\n */\n\n/**\n * Withdraw from vote account transaction params\n */\n\n/**\n * Update validator identity (node pubkey) vote account instruction params.\n */\n\n/**\n * Vote Instruction class\n */\nclass VoteInstruction {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Decode a vote instruction and retrieve the instruction type.\n */\n static decodeInstructionType(instruction) {\n this.checkProgramId(instruction.programId);\n const instructionTypeLayout = BufferLayout.u32('instruction');\n const typeIndex = instructionTypeLayout.decode(instruction.data);\n let type;\n for (const [ixType, layout] of Object.entries(VOTE_INSTRUCTION_LAYOUTS)) {\n if (layout.index == typeIndex) {\n type = ixType;\n break;\n }\n }\n if (!type) {\n throw new Error('Instruction type incorrect; not a VoteInstruction');\n }\n return type;\n }\n\n /**\n * Decode an initialize vote instruction and retrieve the instruction params.\n */\n static decodeInitializeAccount(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 4);\n const {\n voteInit\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.InitializeAccount, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n nodePubkey: instruction.keys[3].pubkey,\n voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission)\n };\n }\n\n /**\n * Decode an authorize instruction and retrieve the instruction params.\n */\n static decodeAuthorize(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n newAuthorized,\n voteAuthorizationType\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n authorizedPubkey: instruction.keys[2].pubkey,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n voteAuthorizationType: {\n index: voteAuthorizationType\n }\n };\n }\n\n /**\n * Decode an authorize instruction and retrieve the instruction params.\n */\n static decodeAuthorizeWithSeed(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n voteAuthorizeWithSeedArgs: {\n currentAuthorityDerivedKeyOwnerPubkey,\n currentAuthorityDerivedKeySeed,\n newAuthorized,\n voteAuthorizationType\n }\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data);\n return {\n currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey,\n currentAuthorityDerivedKeyOwnerPubkey: new PublicKey(currentAuthorityDerivedKeyOwnerPubkey),\n currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed,\n newAuthorizedPubkey: new PublicKey(newAuthorized),\n voteAuthorizationType: {\n index: voteAuthorizationType\n },\n votePubkey: instruction.keys[0].pubkey\n };\n }\n\n /**\n * Decode a withdraw instruction and retrieve the instruction params.\n */\n static decodeWithdraw(instruction) {\n this.checkProgramId(instruction.programId);\n this.checkKeyLength(instruction.keys, 3);\n const {\n lamports\n } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data);\n return {\n votePubkey: instruction.keys[0].pubkey,\n authorizedWithdrawerPubkey: instruction.keys[2].pubkey,\n lamports,\n toPubkey: instruction.keys[1].pubkey\n };\n }\n\n /**\n * @internal\n */\n static checkProgramId(programId) {\n if (!programId.equals(VoteProgram.programId)) {\n throw new Error('invalid instruction; programId is not VoteProgram');\n }\n }\n\n /**\n * @internal\n */\n static checkKeyLength(keys, expectedLength) {\n if (keys.length < expectedLength) {\n throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`);\n }\n }\n}\n\n/**\n * An enumeration of valid VoteInstructionType's\n */\n\n/** @internal */\n\nconst VOTE_INSTRUCTION_LAYOUTS = Object.freeze({\n InitializeAccount: {\n index: 0,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteInit()])\n },\n Authorize: {\n index: 1,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), publicKey('newAuthorized'), BufferLayout.u32('voteAuthorizationType')])\n },\n Withdraw: {\n index: 3,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), BufferLayout.ns64('lamports')])\n },\n UpdateValidatorIdentity: {\n index: 4,\n layout: BufferLayout.struct([BufferLayout.u32('instruction')])\n },\n AuthorizeWithSeed: {\n index: 10,\n layout: BufferLayout.struct([BufferLayout.u32('instruction'), voteAuthorizeWithSeedArgs()])\n }\n});\n\n/**\n * VoteAuthorize type\n */\n\n/**\n * An enumeration of valid VoteAuthorization layouts.\n */\nconst VoteAuthorizationLayout = Object.freeze({\n Voter: {\n index: 0\n },\n Withdrawer: {\n index: 1\n }\n});\n\n/**\n * Factory class for transactions to interact with the Vote program\n */\nclass VoteProgram {\n /**\n * @internal\n */\n constructor() {}\n\n /**\n * Public key that identifies the Vote program\n */\n\n /**\n * Generate an Initialize instruction.\n */\n static initializeAccount(params) {\n const {\n votePubkey,\n nodePubkey,\n voteInit\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.InitializeAccount;\n const data = encodeData(type, {\n voteInit: {\n nodePubkey: toBuffer(voteInit.nodePubkey.toBuffer()),\n authorizedVoter: toBuffer(voteInit.authorizedVoter.toBuffer()),\n authorizedWithdrawer: toBuffer(voteInit.authorizedWithdrawer.toBuffer()),\n commission: voteInit.commission\n }\n });\n const instructionData = {\n keys: [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_RENT_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: nodePubkey,\n isSigner: true,\n isWritable: false\n }],\n programId: this.programId,\n data\n };\n return new TransactionInstruction(instructionData);\n }\n\n /**\n * Generate a transaction that creates a new Vote account.\n */\n static createAccount(params) {\n const transaction = new Transaction();\n transaction.add(SystemProgram.createAccount({\n fromPubkey: params.fromPubkey,\n newAccountPubkey: params.votePubkey,\n lamports: params.lamports,\n space: this.space,\n programId: this.programId\n }));\n return transaction.add(this.initializeAccount({\n votePubkey: params.votePubkey,\n nodePubkey: params.voteInit.nodePubkey,\n voteInit: params.voteInit\n }));\n }\n\n /**\n * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account.\n */\n static authorize(params) {\n const {\n votePubkey,\n authorizedPubkey,\n newAuthorizedPubkey,\n voteAuthorizationType\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.Authorize;\n const data = encodeData(type, {\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n voteAuthorizationType: voteAuthorizationType.index\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: authorizedPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account\n * where the current Voter or Withdrawer authority is a derived key.\n */\n static authorizeWithSeed(params) {\n const {\n currentAuthorityDerivedKeyBasePubkey,\n currentAuthorityDerivedKeyOwnerPubkey,\n currentAuthorityDerivedKeySeed,\n newAuthorizedPubkey,\n voteAuthorizationType,\n votePubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed;\n const data = encodeData(type, {\n voteAuthorizeWithSeedArgs: {\n currentAuthorityDerivedKeyOwnerPubkey: toBuffer(currentAuthorityDerivedKeyOwnerPubkey.toBuffer()),\n currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed,\n newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()),\n voteAuthorizationType: voteAuthorizationType.index\n }\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: SYSVAR_CLOCK_PUBKEY,\n isSigner: false,\n isWritable: false\n }, {\n pubkey: currentAuthorityDerivedKeyBasePubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction to withdraw from a Vote account.\n */\n static withdraw(params) {\n const {\n votePubkey,\n authorizedWithdrawerPubkey,\n lamports,\n toPubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.Withdraw;\n const data = encodeData(type, {\n lamports\n });\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: toPubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: authorizedWithdrawerPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n\n /**\n * Generate a transaction to withdraw safely from a Vote account.\n *\n * This function was created as a safeguard for vote accounts running validators, `safeWithdraw`\n * checks that the withdraw amount will not exceed the specified balance while leaving enough left\n * to cover rent. If you wish to close the vote account by withdrawing the full amount, call the\n * `withdraw` method directly.\n */\n static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) {\n if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) {\n throw new Error('Withdraw will leave vote account with insufficient funds.');\n }\n return VoteProgram.withdraw(params);\n }\n\n /**\n * Generate a transaction to update the validator identity (node pubkey) of a Vote account.\n */\n static updateValidatorIdentity(params) {\n const {\n votePubkey,\n authorizedWithdrawerPubkey,\n nodePubkey\n } = params;\n const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity;\n const data = encodeData(type);\n const keys = [{\n pubkey: votePubkey,\n isSigner: false,\n isWritable: true\n }, {\n pubkey: nodePubkey,\n isSigner: true,\n isWritable: false\n }, {\n pubkey: authorizedWithdrawerPubkey,\n isSigner: true,\n isWritable: false\n }];\n return new Transaction().add({\n keys,\n programId: this.programId,\n data\n });\n }\n}\nVoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111');\n/**\n * Max space of a Vote account\n *\n * This is generated from the solana-vote-program VoteState struct as\n * `VoteState::size_of()`:\n * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of\n *\n * KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342\n */\nVoteProgram.space = 3762;\n\nconst VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111');\n\n/**\n * @internal\n */\n\n/**\n * Info used to identity validators.\n */\n\nconst InfoString = type({\n name: string(),\n website: optional(string()),\n details: optional(string()),\n iconUrl: optional(string()),\n keybaseUsername: optional(string())\n});\n\n/**\n * ValidatorInfo class\n */\nclass ValidatorInfo {\n /**\n * Construct a valid ValidatorInfo\n *\n * @param key validator public key\n * @param info validator information\n */\n constructor(key, info) {\n /**\n * validator public key\n */\n this.key = void 0;\n /**\n * validator information\n */\n this.info = void 0;\n this.key = key;\n this.info = info;\n }\n\n /**\n * Deserialize ValidatorInfo from the config account data. Exactly two config\n * keys are required in the data.\n *\n * @param buffer config account data\n * @return null if info was not found\n */\n static fromConfigData(buffer) {\n let byteArray = [...buffer];\n const configKeyCount = decodeLength(byteArray);\n if (configKeyCount !== 2) return null;\n const configKeys = [];\n for (let i = 0; i < 2; i++) {\n const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH));\n const isSigner = guardedShift(byteArray) === 1;\n configKeys.push({\n publicKey,\n isSigner\n });\n }\n if (configKeys[0].publicKey.equals(VALIDATOR_INFO_KEY)) {\n if (configKeys[1].isSigner) {\n const rawInfo = rustString().decode(Buffer.from(byteArray));\n const info = JSON.parse(rawInfo);\n assert$1(info, InfoString);\n return new ValidatorInfo(configKeys[1].publicKey, info);\n }\n }\n return null;\n }\n}\n\nconst VOTE_PROGRAM_ID = new PublicKey('Vote111111111111111111111111111111111111111');\n\n/**\n * History of how many credits earned by the end of each epoch\n */\n\n/**\n * See https://github.com/solana-labs/solana/blob/8a12ed029cfa38d4a45400916c2463fb82bbec8c/programs/vote_api/src/vote_state.rs#L68-L88\n *\n * @internal\n */\nconst VoteAccountLayout = BufferLayout.struct([publicKey('nodePubkey'), publicKey('authorizedWithdrawer'), BufferLayout.u8('commission'), BufferLayout.nu64(),\n// votes.length\nBufferLayout.seq(BufferLayout.struct([BufferLayout.nu64('slot'), BufferLayout.u32('confirmationCount')]), BufferLayout.offset(BufferLayout.u32(), -8), 'votes'), BufferLayout.u8('rootSlotValid'), BufferLayout.nu64('rootSlot'), BufferLayout.nu64(),\n// authorizedVoters.length\nBufferLayout.seq(BufferLayout.struct([BufferLayout.nu64('epoch'), publicKey('authorizedVoter')]), BufferLayout.offset(BufferLayout.u32(), -8), 'authorizedVoters'), BufferLayout.struct([BufferLayout.seq(BufferLayout.struct([publicKey('authorizedPubkey'), BufferLayout.nu64('epochOfLastAuthorizedSwitch'), BufferLayout.nu64('targetEpoch')]), 32, 'buf'), BufferLayout.nu64('idx'), BufferLayout.u8('isEmpty')], 'priorVoters'), BufferLayout.nu64(),\n// epochCredits.length\nBufferLayout.seq(BufferLayout.struct([BufferLayout.nu64('epoch'), BufferLayout.nu64('credits'), BufferLayout.nu64('prevCredits')]), BufferLayout.offset(BufferLayout.u32(), -8), 'epochCredits'), BufferLayout.struct([BufferLayout.nu64('slot'), BufferLayout.nu64('timestamp')], 'lastTimestamp')]);\n/**\n * VoteAccount class\n */\nclass VoteAccount {\n /**\n * @internal\n */\n constructor(args) {\n this.nodePubkey = void 0;\n this.authorizedWithdrawer = void 0;\n this.commission = void 0;\n this.rootSlot = void 0;\n this.votes = void 0;\n this.authorizedVoters = void 0;\n this.priorVoters = void 0;\n this.epochCredits = void 0;\n this.lastTimestamp = void 0;\n this.nodePubkey = args.nodePubkey;\n this.authorizedWithdrawer = args.authorizedWithdrawer;\n this.commission = args.commission;\n this.rootSlot = args.rootSlot;\n this.votes = args.votes;\n this.authorizedVoters = args.authorizedVoters;\n this.priorVoters = args.priorVoters;\n this.epochCredits = args.epochCredits;\n this.lastTimestamp = args.lastTimestamp;\n }\n\n /**\n * Deserialize VoteAccount from the account data.\n *\n * @param buffer account data\n * @return VoteAccount\n */\n static fromAccountData(buffer) {\n const versionOffset = 4;\n const va = VoteAccountLayout.decode(toBuffer(buffer), versionOffset);\n let rootSlot = va.rootSlot;\n if (!va.rootSlotValid) {\n rootSlot = null;\n }\n return new VoteAccount({\n nodePubkey: new PublicKey(va.nodePubkey),\n authorizedWithdrawer: new PublicKey(va.authorizedWithdrawer),\n commission: va.commission,\n votes: va.votes,\n rootSlot,\n authorizedVoters: va.authorizedVoters.map(parseAuthorizedVoter),\n priorVoters: getPriorVoters(va.priorVoters),\n epochCredits: va.epochCredits,\n lastTimestamp: va.lastTimestamp\n });\n }\n}\nfunction parseAuthorizedVoter({\n authorizedVoter,\n epoch\n}) {\n return {\n epoch,\n authorizedVoter: new PublicKey(authorizedVoter)\n };\n}\nfunction parsePriorVoters({\n authorizedPubkey,\n epochOfLastAuthorizedSwitch,\n targetEpoch\n}) {\n return {\n authorizedPubkey: new PublicKey(authorizedPubkey),\n epochOfLastAuthorizedSwitch,\n targetEpoch\n };\n}\nfunction getPriorVoters({\n buf,\n idx,\n isEmpty\n}) {\n if (isEmpty) {\n return [];\n }\n return [...buf.slice(idx + 1).map(parsePriorVoters), ...buf.slice(0, idx).map(parsePriorVoters)];\n}\n\nconst endpoint = {\n http: {\n devnet: 'http://api.devnet.solana.com',\n testnet: 'http://api.testnet.solana.com',\n 'mainnet-beta': 'http://api.mainnet-beta.solana.com/'\n },\n https: {\n devnet: 'https://api.devnet.solana.com',\n testnet: 'https://api.testnet.solana.com',\n 'mainnet-beta': 'https://api.mainnet-beta.solana.com/'\n }\n};\n/**\n * Retrieves the RPC API URL for the specified cluster\n * @param {Cluster} [cluster=\"devnet\"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet-beta'\n * @param {boolean} [tls=\"http\"] - Use TLS when connecting to cluster.\n *\n * @returns {string} URL string of the RPC endpoint\n */\nfunction clusterApiUrl(cluster, tls) {\n const key = tls === false ? 'http' : 'https';\n if (!cluster) {\n return endpoint[key]['devnet'];\n }\n const url = endpoint[key][cluster];\n if (!url) {\n throw new Error(`Unknown ${key} cluster: ${cluster}`);\n }\n return url;\n}\n\n/**\n * Send and confirm a raw transaction\n *\n * If `commitment` option is not specified, defaults to 'max' commitment.\n *\n * @param {Connection} connection\n * @param {Buffer} rawTransaction\n * @param {TransactionConfirmationStrategy} confirmationStrategy\n * @param {ConfirmOptions} [options]\n * @returns {Promise}\n */\n\n/**\n * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy`\n * is no longer supported and will be removed in a future version.\n */\n// eslint-disable-next-line no-redeclare\n\n// eslint-disable-next-line no-redeclare\nasync function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) {\n let confirmationStrategy;\n let options;\n if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'lastValidBlockHeight')) {\n confirmationStrategy = confirmationStrategyOrConfirmOptions;\n options = maybeConfirmOptions;\n } else if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'nonceValue')) {\n confirmationStrategy = confirmationStrategyOrConfirmOptions;\n options = maybeConfirmOptions;\n } else {\n options = confirmationStrategyOrConfirmOptions;\n }\n const sendOptions = options && {\n skipPreflight: options.skipPreflight,\n preflightCommitment: options.preflightCommitment || options.commitment,\n minContextSlot: options.minContextSlot\n };\n const signature = await connection.sendRawTransaction(rawTransaction, sendOptions);\n const commitment = options && options.commitment;\n const confirmationPromise = confirmationStrategy ? connection.confirmTransaction(confirmationStrategy, commitment) : connection.confirmTransaction(signature, commitment);\n const status = (await confirmationPromise).value;\n if (status.err) {\n if (signature != null) {\n throw new SendTransactionError({\n action: sendOptions?.skipPreflight ? 'send' : 'simulate',\n signature: signature,\n transactionMessage: `Status: (${JSON.stringify(status)})`\n });\n }\n throw new Error(`Raw transaction ${signature} failed (${JSON.stringify(status)})`);\n }\n return signature;\n}\n\n/**\n * There are 1-billion lamports in one SOL\n */\nconst LAMPORTS_PER_SOL = 1000000000;\n\nexport { Account, AddressLookupTableAccount, AddressLookupTableInstruction, AddressLookupTableProgram, Authorized, BLOCKHASH_CACHE_TIMEOUT_MS, BPF_LOADER_DEPRECATED_PROGRAM_ID, BPF_LOADER_PROGRAM_ID, BpfLoader, COMPUTE_BUDGET_INSTRUCTION_LAYOUTS, ComputeBudgetInstruction, ComputeBudgetProgram, Connection, Ed25519Program, Enum, EpochSchedule, FeeCalculatorLayout, Keypair, LAMPORTS_PER_SOL, LOOKUP_TABLE_INSTRUCTION_LAYOUTS, Loader, Lockup, MAX_SEED_LENGTH, Message, MessageAccountKeys, MessageV0, NONCE_ACCOUNT_LENGTH, NonceAccount, PACKET_DATA_SIZE, PUBLIC_KEY_LENGTH, PublicKey, SIGNATURE_LENGTH_IN_BYTES, SOLANA_SCHEMA, STAKE_CONFIG_ID, STAKE_INSTRUCTION_LAYOUTS, SYSTEM_INSTRUCTION_LAYOUTS, SYSVAR_CLOCK_PUBKEY, SYSVAR_EPOCH_SCHEDULE_PUBKEY, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RECENT_BLOCKHASHES_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_REWARDS_PUBKEY, SYSVAR_SLOT_HASHES_PUBKEY, SYSVAR_SLOT_HISTORY_PUBKEY, SYSVAR_STAKE_HISTORY_PUBKEY, Secp256k1Program, SendTransactionError, SolanaJSONRPCError, SolanaJSONRPCErrorCode, StakeAuthorizationLayout, StakeInstruction, StakeProgram, Struct, SystemInstruction, SystemProgram, Transaction, TransactionExpiredBlockheightExceededError, TransactionExpiredNonceInvalidError, TransactionExpiredTimeoutError, TransactionInstruction, TransactionMessage, TransactionStatus, VALIDATOR_INFO_KEY, VERSION_PREFIX_MASK, VOTE_PROGRAM_ID, ValidatorInfo, VersionedMessage, VersionedTransaction, VoteAccount, VoteAuthorizationLayout, VoteInit, VoteInstruction, VoteProgram, clusterApiUrl, sendAndConfirmRawTransaction, sendAndConfirmTransaction };\n//# sourceMappingURL=index.browser.esm.js.map\n","/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global global, define, Symbol, Reflect, Promise, SuppressedError, Iterator */\r\nvar __extends;\r\nvar __assign;\r\nvar __rest;\r\nvar __decorate;\r\nvar __param;\r\nvar __esDecorate;\r\nvar __runInitializers;\r\nvar __propKey;\r\nvar __setFunctionName;\r\nvar __metadata;\r\nvar __awaiter;\r\nvar __generator;\r\nvar __exportStar;\r\nvar __values;\r\nvar __read;\r\nvar __spread;\r\nvar __spreadArrays;\r\nvar __spreadArray;\r\nvar __await;\r\nvar __asyncGenerator;\r\nvar __asyncDelegator;\r\nvar __asyncValues;\r\nvar __makeTemplateObject;\r\nvar __importStar;\r\nvar __importDefault;\r\nvar __classPrivateFieldGet;\r\nvar __classPrivateFieldSet;\r\nvar __classPrivateFieldIn;\r\nvar __createBinding;\r\nvar __addDisposableResource;\r\nvar __disposeResources;\r\nvar __rewriteRelativeImportExtension;\r\n(function (factory) {\r\n var root = typeof global === \"object\" ? global : typeof self === \"object\" ? self : typeof this === \"object\" ? this : {};\r\n if (typeof define === \"function\" && define.amd) {\r\n define(\"tslib\", [\"exports\"], function (exports) { factory(createExporter(root, createExporter(exports))); });\r\n }\r\n else if (typeof module === \"object\" && typeof module.exports === \"object\") {\r\n factory(createExporter(root, createExporter(module.exports)));\r\n }\r\n else {\r\n factory(createExporter(root));\r\n }\r\n function createExporter(exports, previous) {\r\n if (exports !== root) {\r\n if (typeof Object.create === \"function\") {\r\n Object.defineProperty(exports, \"__esModule\", { value: true });\r\n }\r\n else {\r\n exports.__esModule = true;\r\n }\r\n }\r\n return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };\r\n }\r\n})\r\n(function (exporter) {\r\n var extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n\r\n __extends = function (d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n };\r\n\r\n __assign = Object.assign || function (t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n };\r\n\r\n __rest = function (s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n };\r\n\r\n __decorate = function (decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n };\r\n\r\n __param = function (paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n };\r\n\r\n __esDecorate = function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\r\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\r\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\r\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\r\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\r\n var _, done = false;\r\n for (var i = decorators.length - 1; i >= 0; i--) {\r\n var context = {};\r\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\r\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\r\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\r\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\r\n if (kind === \"accessor\") {\r\n if (result === void 0) continue;\r\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\r\n if (_ = accept(result.get)) descriptor.get = _;\r\n if (_ = accept(result.set)) descriptor.set = _;\r\n if (_ = accept(result.init)) initializers.unshift(_);\r\n }\r\n else if (_ = accept(result)) {\r\n if (kind === \"field\") initializers.unshift(_);\r\n else descriptor[key] = _;\r\n }\r\n }\r\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\r\n done = true;\r\n };\r\n\r\n __runInitializers = function (thisArg, initializers, value) {\r\n var useValue = arguments.length > 2;\r\n for (var i = 0; i < initializers.length; i++) {\r\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\r\n }\r\n return useValue ? value : void 0;\r\n };\r\n\r\n __propKey = function (x) {\r\n return typeof x === \"symbol\" ? x : \"\".concat(x);\r\n };\r\n\r\n __setFunctionName = function (f, name, prefix) {\r\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\r\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\r\n };\r\n\r\n __metadata = function (metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n };\r\n\r\n __awaiter = function (thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n };\r\n\r\n __generator = function (thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\r\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n };\r\n\r\n __exportStar = function(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n };\r\n\r\n __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n }) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n });\r\n\r\n __values = function (o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n };\r\n\r\n __read = function (o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n };\r\n\r\n /** @deprecated */\r\n __spread = function () {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n };\r\n\r\n /** @deprecated */\r\n __spreadArrays = function () {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n };\r\n\r\n __spreadArray = function (to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n };\r\n\r\n __await = function (v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n };\r\n\r\n __asyncGenerator = function (thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\r\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n };\r\n\r\n __asyncDelegator = function (o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\r\n };\r\n\r\n __asyncValues = function (o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n };\r\n\r\n __makeTemplateObject = function (cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n };\r\n\r\n var __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n }) : function(o, v) {\r\n o[\"default\"] = v;\r\n };\r\n\r\n var ownKeys = function(o) {\r\n ownKeys = Object.getOwnPropertyNames || function (o) {\r\n var ar = [];\r\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\r\n return ar;\r\n };\r\n return ownKeys(o);\r\n };\r\n\r\n __importStar = function (mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n };\r\n\r\n __importDefault = function (mod) {\r\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\r\n };\r\n\r\n __classPrivateFieldGet = function (receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n };\r\n\r\n __classPrivateFieldSet = function (receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n };\r\n\r\n __classPrivateFieldIn = function (state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n };\r\n\r\n __addDisposableResource = function (env, value, async) {\r\n if (value !== null && value !== void 0) {\r\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\r\n var dispose, inner;\r\n if (async) {\r\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\r\n dispose = value[Symbol.asyncDispose];\r\n }\r\n if (dispose === void 0) {\r\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\r\n dispose = value[Symbol.dispose];\r\n if (async) inner = dispose;\r\n }\r\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\r\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\r\n env.stack.push({ value: value, dispose: dispose, async: async });\r\n }\r\n else if (async) {\r\n env.stack.push({ async: true });\r\n }\r\n return value;\r\n };\r\n\r\n var _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n };\r\n\r\n __disposeResources = function (env) {\r\n function fail(e) {\r\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\r\n env.hasError = true;\r\n }\r\n var r, s = 0;\r\n function next() {\r\n while (r = env.stack.pop()) {\r\n try {\r\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\r\n if (r.dispose) {\r\n var result = r.dispose.call(r.value);\r\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\r\n }\r\n else s |= 1;\r\n }\r\n catch (e) {\r\n fail(e);\r\n }\r\n }\r\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\r\n if (env.hasError) throw env.error;\r\n }\r\n return next();\r\n };\r\n\r\n __rewriteRelativeImportExtension = function (path, preserveJsx) {\r\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\r\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\r\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\r\n });\r\n }\r\n return path;\r\n };\r\n\r\n exporter(\"__extends\", __extends);\r\n exporter(\"__assign\", __assign);\r\n exporter(\"__rest\", __rest);\r\n exporter(\"__decorate\", __decorate);\r\n exporter(\"__param\", __param);\r\n exporter(\"__esDecorate\", __esDecorate);\r\n exporter(\"__runInitializers\", __runInitializers);\r\n exporter(\"__propKey\", __propKey);\r\n exporter(\"__setFunctionName\", __setFunctionName);\r\n exporter(\"__metadata\", __metadata);\r\n exporter(\"__awaiter\", __awaiter);\r\n exporter(\"__generator\", __generator);\r\n exporter(\"__exportStar\", __exportStar);\r\n exporter(\"__createBinding\", __createBinding);\r\n exporter(\"__values\", __values);\r\n exporter(\"__read\", __read);\r\n exporter(\"__spread\", __spread);\r\n exporter(\"__spreadArrays\", __spreadArrays);\r\n exporter(\"__spreadArray\", __spreadArray);\r\n exporter(\"__await\", __await);\r\n exporter(\"__asyncGenerator\", __asyncGenerator);\r\n exporter(\"__asyncDelegator\", __asyncDelegator);\r\n exporter(\"__asyncValues\", __asyncValues);\r\n exporter(\"__makeTemplateObject\", __makeTemplateObject);\r\n exporter(\"__importStar\", __importStar);\r\n exporter(\"__importDefault\", __importDefault);\r\n exporter(\"__classPrivateFieldGet\", __classPrivateFieldGet);\r\n exporter(\"__classPrivateFieldSet\", __classPrivateFieldSet);\r\n exporter(\"__classPrivateFieldIn\", __classPrivateFieldIn);\r\n exporter(\"__addDisposableResource\", __addDisposableResource);\r\n exporter(\"__disposeResources\", __disposeResources);\r\n exporter(\"__rewriteRelativeImportExtension\", __rewriteRelativeImportExtension);\r\n});\r\n\r\n0 && (module.exports = {\r\n __extends: __extends,\r\n __assign: __assign,\r\n __rest: __rest,\r\n __decorate: __decorate,\r\n __param: __param,\r\n __esDecorate: __esDecorate,\r\n __runInitializers: __runInitializers,\r\n __propKey: __propKey,\r\n __setFunctionName: __setFunctionName,\r\n __metadata: __metadata,\r\n __awaiter: __awaiter,\r\n __generator: __generator,\r\n __exportStar: __exportStar,\r\n __createBinding: __createBinding,\r\n __values: __values,\r\n __read: __read,\r\n __spread: __spread,\r\n __spreadArrays: __spreadArrays,\r\n __spreadArray: __spreadArray,\r\n __await: __await,\r\n __asyncGenerator: __asyncGenerator,\r\n __asyncDelegator: __asyncDelegator,\r\n __asyncValues: __asyncValues,\r\n __makeTemplateObject: __makeTemplateObject,\r\n __importStar: __importStar,\r\n __importDefault: __importDefault,\r\n __classPrivateFieldGet: __classPrivateFieldGet,\r\n __classPrivateFieldSet: __classPrivateFieldSet,\r\n __classPrivateFieldIn: __classPrivateFieldIn,\r\n __addDisposableResource: __addDisposableResource,\r\n __disposeResources: __disposeResources,\r\n __rewriteRelativeImportExtension: __rewriteRelativeImportExtension,\r\n});\r\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.deserializeUnchecked = exports.deserialize = exports.serialize = exports.BinaryReader = exports.BinaryWriter = exports.BorshError = exports.baseDecode = exports.baseEncode = void 0;\nconst bn_js_1 = __importDefault(require(\"bn.js\"));\nconst bs58_1 = __importDefault(require(\"bs58\"));\n// TODO: Make sure this polyfill not included when not required\nconst encoding = __importStar(require(\"text-encoding-utf-8\"));\nconst ResolvedTextDecoder = typeof TextDecoder !== \"function\" ? encoding.TextDecoder : TextDecoder;\nconst textDecoder = new ResolvedTextDecoder(\"utf-8\", { fatal: true });\nfunction baseEncode(value) {\n if (typeof value === \"string\") {\n value = Buffer.from(value, \"utf8\");\n }\n return bs58_1.default.encode(Buffer.from(value));\n}\nexports.baseEncode = baseEncode;\nfunction baseDecode(value) {\n return Buffer.from(bs58_1.default.decode(value));\n}\nexports.baseDecode = baseDecode;\nconst INITIAL_LENGTH = 1024;\nclass BorshError extends Error {\n constructor(message) {\n super(message);\n this.fieldPath = [];\n this.originalMessage = message;\n }\n addToFieldPath(fieldName) {\n this.fieldPath.splice(0, 0, fieldName);\n // NOTE: Modifying message directly as jest doesn't use .toString()\n this.message = this.originalMessage + \": \" + this.fieldPath.join(\".\");\n }\n}\nexports.BorshError = BorshError;\n/// Binary encoder.\nclass BinaryWriter {\n constructor() {\n this.buf = Buffer.alloc(INITIAL_LENGTH);\n this.length = 0;\n }\n maybeResize() {\n if (this.buf.length < 16 + this.length) {\n this.buf = Buffer.concat([this.buf, Buffer.alloc(INITIAL_LENGTH)]);\n }\n }\n writeU8(value) {\n this.maybeResize();\n this.buf.writeUInt8(value, this.length);\n this.length += 1;\n }\n writeU16(value) {\n this.maybeResize();\n this.buf.writeUInt16LE(value, this.length);\n this.length += 2;\n }\n writeU32(value) {\n this.maybeResize();\n this.buf.writeUInt32LE(value, this.length);\n this.length += 4;\n }\n writeU64(value) {\n this.maybeResize();\n this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray(\"le\", 8)));\n }\n writeU128(value) {\n this.maybeResize();\n this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray(\"le\", 16)));\n }\n writeU256(value) {\n this.maybeResize();\n this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray(\"le\", 32)));\n }\n writeU512(value) {\n this.maybeResize();\n this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray(\"le\", 64)));\n }\n writeBuffer(buffer) {\n // Buffer.from is needed as this.buf.subarray can return plain Uint8Array in browser\n this.buf = Buffer.concat([\n Buffer.from(this.buf.subarray(0, this.length)),\n buffer,\n Buffer.alloc(INITIAL_LENGTH),\n ]);\n this.length += buffer.length;\n }\n writeString(str) {\n this.maybeResize();\n const b = Buffer.from(str, \"utf8\");\n this.writeU32(b.length);\n this.writeBuffer(b);\n }\n writeFixedArray(array) {\n this.writeBuffer(Buffer.from(array));\n }\n writeArray(array, fn) {\n this.maybeResize();\n this.writeU32(array.length);\n for (const elem of array) {\n this.maybeResize();\n fn(elem);\n }\n }\n toArray() {\n return this.buf.subarray(0, this.length);\n }\n}\nexports.BinaryWriter = BinaryWriter;\nfunction handlingRangeError(target, propertyKey, propertyDescriptor) {\n const originalMethod = propertyDescriptor.value;\n propertyDescriptor.value = function (...args) {\n try {\n return originalMethod.apply(this, args);\n }\n catch (e) {\n if (e instanceof RangeError) {\n const code = e.code;\n if ([\"ERR_BUFFER_OUT_OF_BOUNDS\", \"ERR_OUT_OF_RANGE\"].indexOf(code) >= 0) {\n throw new BorshError(\"Reached the end of buffer when deserializing\");\n }\n }\n throw e;\n }\n };\n}\nclass BinaryReader {\n constructor(buf) {\n this.buf = buf;\n this.offset = 0;\n }\n readU8() {\n const value = this.buf.readUInt8(this.offset);\n this.offset += 1;\n return value;\n }\n readU16() {\n const value = this.buf.readUInt16LE(this.offset);\n this.offset += 2;\n return value;\n }\n readU32() {\n const value = this.buf.readUInt32LE(this.offset);\n this.offset += 4;\n return value;\n }\n readU64() {\n const buf = this.readBuffer(8);\n return new bn_js_1.default(buf, \"le\");\n }\n readU128() {\n const buf = this.readBuffer(16);\n return new bn_js_1.default(buf, \"le\");\n }\n readU256() {\n const buf = this.readBuffer(32);\n return new bn_js_1.default(buf, \"le\");\n }\n readU512() {\n const buf = this.readBuffer(64);\n return new bn_js_1.default(buf, \"le\");\n }\n readBuffer(len) {\n if (this.offset + len > this.buf.length) {\n throw new BorshError(`Expected buffer length ${len} isn't within bounds`);\n }\n const result = this.buf.slice(this.offset, this.offset + len);\n this.offset += len;\n return result;\n }\n readString() {\n const len = this.readU32();\n const buf = this.readBuffer(len);\n try {\n // NOTE: Using TextDecoder to fail on invalid UTF-8\n return textDecoder.decode(buf);\n }\n catch (e) {\n throw new BorshError(`Error decoding UTF-8 string: ${e}`);\n }\n }\n readFixedArray(len) {\n return new Uint8Array(this.readBuffer(len));\n }\n readArray(fn) {\n const len = this.readU32();\n const result = Array();\n for (let i = 0; i < len; ++i) {\n result.push(fn());\n }\n return result;\n }\n}\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU8\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU16\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU32\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU64\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU128\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU256\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readU512\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readString\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readFixedArray\", null);\n__decorate([\n handlingRangeError\n], BinaryReader.prototype, \"readArray\", null);\nexports.BinaryReader = BinaryReader;\nfunction capitalizeFirstLetter(string) {\n return string.charAt(0).toUpperCase() + string.slice(1);\n}\nfunction serializeField(schema, fieldName, value, fieldType, writer) {\n try {\n // TODO: Handle missing values properly (make sure they never result in just skipped write)\n if (typeof fieldType === \"string\") {\n writer[`write${capitalizeFirstLetter(fieldType)}`](value);\n }\n else if (fieldType instanceof Array) {\n if (typeof fieldType[0] === \"number\") {\n if (value.length !== fieldType[0]) {\n throw new BorshError(`Expecting byte array of length ${fieldType[0]}, but got ${value.length} bytes`);\n }\n writer.writeFixedArray(value);\n }\n else if (fieldType.length === 2 && typeof fieldType[1] === \"number\") {\n if (value.length !== fieldType[1]) {\n throw new BorshError(`Expecting byte array of length ${fieldType[1]}, but got ${value.length} bytes`);\n }\n for (let i = 0; i < fieldType[1]; i++) {\n serializeField(schema, null, value[i], fieldType[0], writer);\n }\n }\n else {\n writer.writeArray(value, (item) => {\n serializeField(schema, fieldName, item, fieldType[0], writer);\n });\n }\n }\n else if (fieldType.kind !== undefined) {\n switch (fieldType.kind) {\n case \"option\": {\n if (value === null || value === undefined) {\n writer.writeU8(0);\n }\n else {\n writer.writeU8(1);\n serializeField(schema, fieldName, value, fieldType.type, writer);\n }\n break;\n }\n case \"map\": {\n writer.writeU32(value.size);\n value.forEach((val, key) => {\n serializeField(schema, fieldName, key, fieldType.key, writer);\n serializeField(schema, fieldName, val, fieldType.value, writer);\n });\n break;\n }\n default:\n throw new BorshError(`FieldType ${fieldType} unrecognized`);\n }\n }\n else {\n serializeStruct(schema, value, writer);\n }\n }\n catch (error) {\n if (error instanceof BorshError) {\n error.addToFieldPath(fieldName);\n }\n throw error;\n }\n}\nfunction serializeStruct(schema, obj, writer) {\n if (typeof obj.borshSerialize === \"function\") {\n obj.borshSerialize(writer);\n return;\n }\n const structSchema = schema.get(obj.constructor);\n if (!structSchema) {\n throw new BorshError(`Class ${obj.constructor.name} is missing in schema`);\n }\n if (structSchema.kind === \"struct\") {\n structSchema.fields.map(([fieldName, fieldType]) => {\n serializeField(schema, fieldName, obj[fieldName], fieldType, writer);\n });\n }\n else if (structSchema.kind === \"enum\") {\n const name = obj[structSchema.field];\n for (let idx = 0; idx < structSchema.values.length; ++idx) {\n const [fieldName, fieldType] = structSchema.values[idx];\n if (fieldName === name) {\n writer.writeU8(idx);\n serializeField(schema, fieldName, obj[fieldName], fieldType, writer);\n break;\n }\n }\n }\n else {\n throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${obj.constructor.name}`);\n }\n}\n/// Serialize given object using schema of the form:\n/// { class_name -> [ [field_name, field_type], .. ], .. }\nfunction serialize(schema, obj, Writer = BinaryWriter) {\n const writer = new Writer();\n serializeStruct(schema, obj, writer);\n return writer.toArray();\n}\nexports.serialize = serialize;\nfunction deserializeField(schema, fieldName, fieldType, reader) {\n try {\n if (typeof fieldType === \"string\") {\n return reader[`read${capitalizeFirstLetter(fieldType)}`]();\n }\n if (fieldType instanceof Array) {\n if (typeof fieldType[0] === \"number\") {\n return reader.readFixedArray(fieldType[0]);\n }\n else if (typeof fieldType[1] === \"number\") {\n const arr = [];\n for (let i = 0; i < fieldType[1]; i++) {\n arr.push(deserializeField(schema, null, fieldType[0], reader));\n }\n return arr;\n }\n else {\n return reader.readArray(() => deserializeField(schema, fieldName, fieldType[0], reader));\n }\n }\n if (fieldType.kind === \"option\") {\n const option = reader.readU8();\n if (option) {\n return deserializeField(schema, fieldName, fieldType.type, reader);\n }\n return undefined;\n }\n if (fieldType.kind === \"map\") {\n let map = new Map();\n const length = reader.readU32();\n for (let i = 0; i < length; i++) {\n const key = deserializeField(schema, fieldName, fieldType.key, reader);\n const val = deserializeField(schema, fieldName, fieldType.value, reader);\n map.set(key, val);\n }\n return map;\n }\n return deserializeStruct(schema, fieldType, reader);\n }\n catch (error) {\n if (error instanceof BorshError) {\n error.addToFieldPath(fieldName);\n }\n throw error;\n }\n}\nfunction deserializeStruct(schema, classType, reader) {\n if (typeof classType.borshDeserialize === \"function\") {\n return classType.borshDeserialize(reader);\n }\n const structSchema = schema.get(classType);\n if (!structSchema) {\n throw new BorshError(`Class ${classType.name} is missing in schema`);\n }\n if (structSchema.kind === \"struct\") {\n const result = {};\n for (const [fieldName, fieldType] of schema.get(classType).fields) {\n result[fieldName] = deserializeField(schema, fieldName, fieldType, reader);\n }\n return new classType(result);\n }\n if (structSchema.kind === \"enum\") {\n const idx = reader.readU8();\n if (idx >= structSchema.values.length) {\n throw new BorshError(`Enum index: ${idx} is out of range`);\n }\n const [fieldName, fieldType] = structSchema.values[idx];\n const fieldValue = deserializeField(schema, fieldName, fieldType, reader);\n return new classType({ [fieldName]: fieldValue });\n }\n throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${classType.constructor.name}`);\n}\n/// Deserializes object from bytes using schema.\nfunction deserialize(schema, classType, buffer, Reader = BinaryReader) {\n const reader = new Reader(buffer);\n const result = deserializeStruct(schema, classType, reader);\n if (reader.offset < buffer.length) {\n throw new BorshError(`Unexpected ${buffer.length - reader.offset} bytes after deserialized data`);\n }\n return result;\n}\nexports.deserialize = deserialize;\n/// Deserializes object from bytes using schema, without checking the length read\nfunction deserializeUnchecked(schema, classType, buffer, Reader = BinaryReader) {\n const reader = new Reader(buffer);\n return deserializeStruct(schema, classType, reader);\n}\nexports.deserializeUnchecked = deserializeUnchecked;\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","/**\n * HMAC: RFC2104 message authentication code.\n * @module\n */\nimport { abytes, aexists, ahash, clean, Hash, toBytes } from \"./utils.js\";\nexport class HMAC extends Hash {\n constructor(hash, _key) {\n super();\n this.finished = false;\n this.destroyed = false;\n ahash(hash);\n const key = toBytes(_key);\n this.iHash = hash.create();\n if (typeof this.iHash.update !== 'function')\n throw new Error('Expected instance of class which extends utils.Hash');\n this.blockLen = this.iHash.blockLen;\n this.outputLen = this.iHash.outputLen;\n const blockLen = this.blockLen;\n const pad = new Uint8Array(blockLen);\n // blockLen can be bigger than outputLen\n pad.set(key.length > blockLen ? hash.create().update(key).digest() : key);\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36;\n this.iHash.update(pad);\n // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone\n this.oHash = hash.create();\n // Undo internal XOR && apply outer XOR\n for (let i = 0; i < pad.length; i++)\n pad[i] ^= 0x36 ^ 0x5c;\n this.oHash.update(pad);\n clean(pad);\n }\n update(buf) {\n aexists(this);\n this.iHash.update(buf);\n return this;\n }\n digestInto(out) {\n aexists(this);\n abytes(out, this.outputLen);\n this.finished = true;\n this.iHash.digestInto(out);\n this.oHash.update(out);\n this.oHash.digestInto(out);\n this.destroy();\n }\n digest() {\n const out = new Uint8Array(this.oHash.outputLen);\n this.digestInto(out);\n return out;\n }\n _cloneInto(to) {\n // Create new instance without calling constructor since key already in state and we don't know it.\n to || (to = Object.create(Object.getPrototypeOf(this), {}));\n const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this;\n to = to;\n to.finished = finished;\n to.destroyed = destroyed;\n to.blockLen = blockLen;\n to.outputLen = outputLen;\n to.oHash = oHash._cloneInto(to.oHash);\n to.iHash = iHash._cloneInto(to.iHash);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n destroy() {\n this.destroyed = true;\n this.oHash.destroy();\n this.iHash.destroy();\n }\n}\n/**\n * HMAC: RFC2104 message authentication code.\n * @param hash - function that would be used e.g. sha256\n * @param key - message key\n * @param message - message data\n * @example\n * import { hmac } from '@noble/hashes/hmac';\n * import { sha256 } from '@noble/hashes/sha2';\n * const mac1 = hmac(sha256, 'key', 'message');\n */\nexport const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest();\nhmac.create = (hash, key) => new HMAC(hash, key);\n//# sourceMappingURL=hmac.js.map","/**\n * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b.\n *\n * ### Design rationale for types\n *\n * * Interaction between classes from different curves should fail:\n * `k256.Point.BASE.add(p256.Point.BASE)`\n * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime\n * * Different calls of `curve()` would return different classes -\n * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve,\n * it won't affect others\n *\n * TypeScript can't infer types for classes created inside a function. Classes is one instance\n * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create\n * unique type for every function call.\n *\n * We can use generic types via some param, like curve opts, but that would:\n * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params)\n * which is hard to debug.\n * 2. Params can be generic and we can't enforce them to be constant value:\n * if somebody creates curve from non-constant params,\n * it would be allowed to interact with other curves with non-constant params\n *\n * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { hmac as nobleHmac } from '@noble/hashes/hmac.js';\nimport { ahash } from '@noble/hashes/utils';\nimport { _validateObject, _abool2 as abool, _abytes2 as abytes, aInRange, bitLen, bitMask, bytesToHex, bytesToNumberBE, concatBytes, createHmacDrbg, ensureBytes, hexToBytes, inRange, isBytes, memoized, numberToHexUnpadded, randomBytes as randomBytesWeb, } from \"../utils.js\";\nimport { _createCurveFields, mulEndoUnsafe, negateCt, normalizeZ, pippenger, wNAF, } from \"./curve.js\";\nimport { Field, FpInvertBatch, getMinHashLength, mapHashToField, nLength, validateField, } from \"./modular.js\";\n// We construct basis in such way that den is always positive and equals n, but num sign depends on basis (not on secret value)\nconst divNearest = (num, den) => (num + (num >= 0 ? den : -den) / _2n) / den;\n/**\n * Splits scalar for GLV endomorphism.\n */\nexport function _splitEndoScalar(k, basis, n) {\n // Split scalar into two such that part is ~half bits: `abs(part) < sqrt(N)`\n // Since part can be negative, we need to do this on point.\n // TODO: verifyScalar function which consumes lambda\n const [[a1, b1], [a2, b2]] = basis;\n const c1 = divNearest(b2 * k, n);\n const c2 = divNearest(-b1 * k, n);\n // |k1|/|k2| is < sqrt(N), but can be negative.\n // If we do `k1 mod N`, we'll get big scalar (`> sqrt(N)`): so, we do cheaper negation instead.\n let k1 = k - c1 * a1 - c2 * a2;\n let k2 = -c1 * b1 - c2 * b2;\n const k1neg = k1 < _0n;\n const k2neg = k2 < _0n;\n if (k1neg)\n k1 = -k1;\n if (k2neg)\n k2 = -k2;\n // Double check that resulting scalar less than half bits of N: otherwise wNAF will fail.\n // This should only happen on wrong basises. Also, math inside is too complex and I don't trust it.\n const MAX_NUM = bitMask(Math.ceil(bitLen(n) / 2)) + _1n; // Half bits of N\n if (k1 < _0n || k1 >= MAX_NUM || k2 < _0n || k2 >= MAX_NUM) {\n throw new Error('splitScalar (endomorphism): failed, k=' + k);\n }\n return { k1neg, k1, k2neg, k2 };\n}\nfunction validateSigFormat(format) {\n if (!['compact', 'recovered', 'der'].includes(format))\n throw new Error('Signature format must be \"compact\", \"recovered\", or \"der\"');\n return format;\n}\nfunction validateSigOpts(opts, def) {\n const optsn = {};\n for (let optName of Object.keys(def)) {\n // @ts-ignore\n optsn[optName] = opts[optName] === undefined ? def[optName] : opts[optName];\n }\n abool(optsn.lowS, 'lowS');\n abool(optsn.prehash, 'prehash');\n if (optsn.format !== undefined)\n validateSigFormat(optsn.format);\n return optsn;\n}\nexport class DERErr extends Error {\n constructor(m = '') {\n super(m);\n }\n}\n/**\n * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format:\n *\n * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S]\n *\n * Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html\n */\nexport const DER = {\n // asn.1 DER encoding utils\n Err: DERErr,\n // Basic building block is TLV (Tag-Length-Value)\n _tlv: {\n encode: (tag, data) => {\n const { Err: E } = DER;\n if (tag < 0 || tag > 256)\n throw new E('tlv.encode: wrong tag');\n if (data.length & 1)\n throw new E('tlv.encode: unpadded data');\n const dataLen = data.length / 2;\n const len = numberToHexUnpadded(dataLen);\n if ((len.length / 2) & 128)\n throw new E('tlv.encode: long form length too big');\n // length of length with long form flag\n const lenLen = dataLen > 127 ? numberToHexUnpadded((len.length / 2) | 128) : '';\n const t = numberToHexUnpadded(tag);\n return t + lenLen + len + data;\n },\n // v - value, l - left bytes (unparsed)\n decode(tag, data) {\n const { Err: E } = DER;\n let pos = 0;\n if (tag < 0 || tag > 256)\n throw new E('tlv.encode: wrong tag');\n if (data.length < 2 || data[pos++] !== tag)\n throw new E('tlv.decode: wrong tlv');\n const first = data[pos++];\n const isLong = !!(first & 128); // First bit of first length byte is flag for short/long form\n let length = 0;\n if (!isLong)\n length = first;\n else {\n // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)]\n const lenLen = first & 127;\n if (!lenLen)\n throw new E('tlv.decode(long): indefinite length not supported');\n if (lenLen > 4)\n throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js\n const lengthBytes = data.subarray(pos, pos + lenLen);\n if (lengthBytes.length !== lenLen)\n throw new E('tlv.decode: length bytes not complete');\n if (lengthBytes[0] === 0)\n throw new E('tlv.decode(long): zero leftmost byte');\n for (const b of lengthBytes)\n length = (length << 8) | b;\n pos += lenLen;\n if (length < 128)\n throw new E('tlv.decode(long): not minimal encoding');\n }\n const v = data.subarray(pos, pos + length);\n if (v.length !== length)\n throw new E('tlv.decode: wrong value length');\n return { v, l: data.subarray(pos + length) };\n },\n },\n // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag,\n // since we always use positive integers here. It must always be empty:\n // - add zero byte if exists\n // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding)\n _int: {\n encode(num) {\n const { Err: E } = DER;\n if (num < _0n)\n throw new E('integer: negative integers are not allowed');\n let hex = numberToHexUnpadded(num);\n // Pad with zero byte if negative flag is present\n if (Number.parseInt(hex[0], 16) & 0b1000)\n hex = '00' + hex;\n if (hex.length & 1)\n throw new E('unexpected DER parsing assertion: unpadded hex');\n return hex;\n },\n decode(data) {\n const { Err: E } = DER;\n if (data[0] & 128)\n throw new E('invalid signature integer: negative');\n if (data[0] === 0x00 && !(data[1] & 128))\n throw new E('invalid signature integer: unnecessary leading zero');\n return bytesToNumberBE(data);\n },\n },\n toSig(hex) {\n // parse DER signature\n const { Err: E, _int: int, _tlv: tlv } = DER;\n const data = ensureBytes('signature', hex);\n const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data);\n if (seqLeftBytes.length)\n throw new E('invalid signature: left bytes after parsing');\n const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes);\n const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes);\n if (sLeftBytes.length)\n throw new E('invalid signature: left bytes after parsing');\n return { r: int.decode(rBytes), s: int.decode(sBytes) };\n },\n hexFromSig(sig) {\n const { _tlv: tlv, _int: int } = DER;\n const rs = tlv.encode(0x02, int.encode(sig.r));\n const ss = tlv.encode(0x02, int.encode(sig.s));\n const seq = rs + ss;\n return tlv.encode(0x30, seq);\n },\n};\n// Be friendly to bad ECMAScript parsers by not using bigint literals\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4);\nexport function _normFnElement(Fn, key) {\n const { BYTES: expected } = Fn;\n let num;\n if (typeof key === 'bigint') {\n num = key;\n }\n else {\n let bytes = ensureBytes('private key', key);\n try {\n num = Fn.fromBytes(bytes);\n }\n catch (error) {\n throw new Error(`invalid private key: expected ui8a of size ${expected}, got ${typeof key}`);\n }\n }\n if (!Fn.isValidNot0(num))\n throw new Error('invalid private key: out of range [1..N-1]');\n return num;\n}\n/**\n * Creates weierstrass Point constructor, based on specified curve options.\n *\n * @example\n```js\nconst opts = {\n p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'),\n n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),\n h: BigInt(1),\n a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'),\n b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'),\n Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),\n Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),\n};\nconst p256_Point = weierstrass(opts);\n```\n */\nexport function weierstrassN(params, extraOpts = {}) {\n const validated = _createCurveFields('weierstrass', params, extraOpts);\n const { Fp, Fn } = validated;\n let CURVE = validated.CURVE;\n const { h: cofactor, n: CURVE_ORDER } = CURVE;\n _validateObject(extraOpts, {}, {\n allowInfinityPoint: 'boolean',\n clearCofactor: 'function',\n isTorsionFree: 'function',\n fromBytes: 'function',\n toBytes: 'function',\n endo: 'object',\n wrapPrivateKey: 'boolean',\n });\n const { endo } = extraOpts;\n if (endo) {\n // validateObject(endo, { beta: 'bigint', splitScalar: 'function' });\n if (!Fp.is0(CURVE.a) || typeof endo.beta !== 'bigint' || !Array.isArray(endo.basises)) {\n throw new Error('invalid endo: expected \"beta\": bigint and \"basises\": array');\n }\n }\n const lengths = getWLengths(Fp, Fn);\n function assertCompressionIsSupported() {\n if (!Fp.isOdd)\n throw new Error('compression is not supported: Field does not have .isOdd()');\n }\n // Implements IEEE P1363 point encoding\n function pointToBytes(_c, point, isCompressed) {\n const { x, y } = point.toAffine();\n const bx = Fp.toBytes(x);\n abool(isCompressed, 'isCompressed');\n if (isCompressed) {\n assertCompressionIsSupported();\n const hasEvenY = !Fp.isOdd(y);\n return concatBytes(pprefix(hasEvenY), bx);\n }\n else {\n return concatBytes(Uint8Array.of(0x04), bx, Fp.toBytes(y));\n }\n }\n function pointFromBytes(bytes) {\n abytes(bytes, undefined, 'Point');\n const { publicKey: comp, publicKeyUncompressed: uncomp } = lengths; // e.g. for 32-byte: 33, 65\n const length = bytes.length;\n const head = bytes[0];\n const tail = bytes.subarray(1);\n // No actual validation is done here: use .assertValidity()\n if (length === comp && (head === 0x02 || head === 0x03)) {\n const x = Fp.fromBytes(tail);\n if (!Fp.isValid(x))\n throw new Error('bad point: is not on curve, wrong x');\n const y2 = weierstrassEquation(x); // y² = x³ + ax + b\n let y;\n try {\n y = Fp.sqrt(y2); // y = y² ^ (p+1)/4\n }\n catch (sqrtError) {\n const err = sqrtError instanceof Error ? ': ' + sqrtError.message : '';\n throw new Error('bad point: is not on curve, sqrt error' + err);\n }\n assertCompressionIsSupported();\n const isYOdd = Fp.isOdd(y); // (y & _1n) === _1n;\n const isHeadOdd = (head & 1) === 1; // ECDSA-specific\n if (isHeadOdd !== isYOdd)\n y = Fp.neg(y);\n return { x, y };\n }\n else if (length === uncomp && head === 0x04) {\n // TODO: more checks\n const L = Fp.BYTES;\n const x = Fp.fromBytes(tail.subarray(0, L));\n const y = Fp.fromBytes(tail.subarray(L, L * 2));\n if (!isValidXY(x, y))\n throw new Error('bad point: is not on curve');\n return { x, y };\n }\n else {\n throw new Error(`bad point: got length ${length}, expected compressed=${comp} or uncompressed=${uncomp}`);\n }\n }\n const encodePoint = extraOpts.toBytes || pointToBytes;\n const decodePoint = extraOpts.fromBytes || pointFromBytes;\n function weierstrassEquation(x) {\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x² * x\n return Fp.add(Fp.add(x3, Fp.mul(x, CURVE.a)), CURVE.b); // x³ + a * x + b\n }\n // TODO: move top-level\n /** Checks whether equation holds for given x, y: y² == x³ + ax + b */\n function isValidXY(x, y) {\n const left = Fp.sqr(y); // y²\n const right = weierstrassEquation(x); // x³ + ax + b\n return Fp.eql(left, right);\n }\n // Validate whether the passed curve params are valid.\n // Test 1: equation y² = x³ + ax + b should work for generator point.\n if (!isValidXY(CURVE.Gx, CURVE.Gy))\n throw new Error('bad curve params: generator point');\n // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0.\n // Guarantees curve is genus-1, smooth (non-singular).\n const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n);\n const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27));\n if (Fp.is0(Fp.add(_4a3, _27b2)))\n throw new Error('bad curve params: a or b');\n /** Asserts coordinate is valid: 0 <= n < Fp.ORDER. */\n function acoord(title, n, banZero = false) {\n if (!Fp.isValid(n) || (banZero && Fp.is0(n)))\n throw new Error(`bad point coordinate ${title}`);\n return n;\n }\n function aprjpoint(other) {\n if (!(other instanceof Point))\n throw new Error('ProjectivePoint expected');\n }\n function splitEndoScalarN(k) {\n if (!endo || !endo.basises)\n throw new Error('no endo');\n return _splitEndoScalar(k, endo.basises, Fn.ORDER);\n }\n // Memoized toAffine / validity check. They are heavy. Points are immutable.\n // Converts Projective point to affine (x, y) coordinates.\n // Can accept precomputed Z^-1 - for example, from invertBatch.\n // (X, Y, Z) ∋ (x=X/Z, y=Y/Z)\n const toAffineMemo = memoized((p, iz) => {\n const { X, Y, Z } = p;\n // Fast-path for normalized points\n if (Fp.eql(Z, Fp.ONE))\n return { x: X, y: Y };\n const is0 = p.is0();\n // If invZ was 0, we return zero point. However we still want to execute\n // all operations, so we replace invZ with a random number, 1.\n if (iz == null)\n iz = is0 ? Fp.ONE : Fp.inv(Z);\n const x = Fp.mul(X, iz);\n const y = Fp.mul(Y, iz);\n const zz = Fp.mul(Z, iz);\n if (is0)\n return { x: Fp.ZERO, y: Fp.ZERO };\n if (!Fp.eql(zz, Fp.ONE))\n throw new Error('invZ was invalid');\n return { x, y };\n });\n // NOTE: on exception this will crash 'cached' and no value will be set.\n // Otherwise true will be return\n const assertValidMemo = memoized((p) => {\n if (p.is0()) {\n // (0, 1, 0) aka ZERO is invalid in most contexts.\n // In BLS, ZERO can be serialized, so we allow it.\n // (0, 0, 0) is invalid representation of ZERO.\n if (extraOpts.allowInfinityPoint && !Fp.is0(p.Y))\n return;\n throw new Error('bad point: ZERO');\n }\n // Some 3rd-party test vectors require different wording between here & `fromCompressedHex`\n const { x, y } = p.toAffine();\n if (!Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('bad point: x or y not field elements');\n if (!isValidXY(x, y))\n throw new Error('bad point: equation left != right');\n if (!p.isTorsionFree())\n throw new Error('bad point: not in prime-order subgroup');\n return true;\n });\n function finishEndo(endoBeta, k1p, k2p, k1neg, k2neg) {\n k2p = new Point(Fp.mul(k2p.X, endoBeta), k2p.Y, k2p.Z);\n k1p = negateCt(k1neg, k1p);\n k2p = negateCt(k2neg, k2p);\n return k1p.add(k2p);\n }\n /**\n * Projective Point works in 3d / projective (homogeneous) coordinates:(X, Y, Z) ∋ (x=X/Z, y=Y/Z).\n * Default Point works in 2d / affine coordinates: (x, y).\n * We're doing calculations in projective, because its operations don't require costly inversion.\n */\n class Point {\n /** Does NOT validate if the point is valid. Use `.assertValidity()`. */\n constructor(X, Y, Z) {\n this.X = acoord('x', X);\n this.Y = acoord('y', Y, true);\n this.Z = acoord('z', Z);\n Object.freeze(this);\n }\n static CURVE() {\n return CURVE;\n }\n /** Does NOT validate if the point is valid. Use `.assertValidity()`. */\n static fromAffine(p) {\n const { x, y } = p || {};\n if (!p || !Fp.isValid(x) || !Fp.isValid(y))\n throw new Error('invalid affine point');\n if (p instanceof Point)\n throw new Error('projective point not allowed');\n // (0, 0) would've produced (0, 0, 1) - instead, we need (0, 1, 0)\n if (Fp.is0(x) && Fp.is0(y))\n return Point.ZERO;\n return new Point(x, y, Fp.ONE);\n }\n static fromBytes(bytes) {\n const P = Point.fromAffine(decodePoint(abytes(bytes, undefined, 'point')));\n P.assertValidity();\n return P;\n }\n static fromHex(hex) {\n return Point.fromBytes(ensureBytes('pointHex', hex));\n }\n get x() {\n return this.toAffine().x;\n }\n get y() {\n return this.toAffine().y;\n }\n /**\n *\n * @param windowSize\n * @param isLazy true will defer table computation until the first multiplication\n * @returns\n */\n precompute(windowSize = 8, isLazy = true) {\n wnaf.createCache(this, windowSize);\n if (!isLazy)\n this.multiply(_3n); // random number\n return this;\n }\n // TODO: return `this`\n /** A point on curve is valid if it conforms to equation. */\n assertValidity() {\n assertValidMemo(this);\n }\n hasEvenY() {\n const { y } = this.toAffine();\n if (!Fp.isOdd)\n throw new Error(\"Field doesn't support isOdd\");\n return !Fp.isOdd(y);\n }\n /** Compare one point to another. */\n equals(other) {\n aprjpoint(other);\n const { X: X1, Y: Y1, Z: Z1 } = this;\n const { X: X2, Y: Y2, Z: Z2 } = other;\n const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1));\n const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1));\n return U1 && U2;\n }\n /** Flips point to one corresponding to (x, -y) in Affine coordinates. */\n negate() {\n return new Point(this.X, Fp.neg(this.Y), this.Z);\n }\n // Renes-Costello-Batina exception-free doubling formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 3\n // Cost: 8M + 3S + 3*a + 2*b3 + 15add.\n double() {\n const { a, b } = CURVE;\n const b3 = Fp.mul(b, _3n);\n const { X: X1, Y: Y1, Z: Z1 } = this;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n let t0 = Fp.mul(X1, X1); // step 1\n let t1 = Fp.mul(Y1, Y1);\n let t2 = Fp.mul(Z1, Z1);\n let t3 = Fp.mul(X1, Y1);\n t3 = Fp.add(t3, t3); // step 5\n Z3 = Fp.mul(X1, Z1);\n Z3 = Fp.add(Z3, Z3);\n X3 = Fp.mul(a, Z3);\n Y3 = Fp.mul(b3, t2);\n Y3 = Fp.add(X3, Y3); // step 10\n X3 = Fp.sub(t1, Y3);\n Y3 = Fp.add(t1, Y3);\n Y3 = Fp.mul(X3, Y3);\n X3 = Fp.mul(t3, X3);\n Z3 = Fp.mul(b3, Z3); // step 15\n t2 = Fp.mul(a, t2);\n t3 = Fp.sub(t0, t2);\n t3 = Fp.mul(a, t3);\n t3 = Fp.add(t3, Z3);\n Z3 = Fp.add(t0, t0); // step 20\n t0 = Fp.add(Z3, t0);\n t0 = Fp.add(t0, t2);\n t0 = Fp.mul(t0, t3);\n Y3 = Fp.add(Y3, t0);\n t2 = Fp.mul(Y1, Z1); // step 25\n t2 = Fp.add(t2, t2);\n t0 = Fp.mul(t2, t3);\n X3 = Fp.sub(X3, t0);\n Z3 = Fp.mul(t2, t1);\n Z3 = Fp.add(Z3, Z3); // step 30\n Z3 = Fp.add(Z3, Z3);\n return new Point(X3, Y3, Z3);\n }\n // Renes-Costello-Batina exception-free addition formula.\n // There is 30% faster Jacobian formula, but it is not complete.\n // https://eprint.iacr.org/2015/1060, algorithm 1\n // Cost: 12M + 0S + 3*a + 3*b3 + 23add.\n add(other) {\n aprjpoint(other);\n const { X: X1, Y: Y1, Z: Z1 } = this;\n const { X: X2, Y: Y2, Z: Z2 } = other;\n let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore\n const a = CURVE.a;\n const b3 = Fp.mul(CURVE.b, _3n);\n let t0 = Fp.mul(X1, X2); // step 1\n let t1 = Fp.mul(Y1, Y2);\n let t2 = Fp.mul(Z1, Z2);\n let t3 = Fp.add(X1, Y1);\n let t4 = Fp.add(X2, Y2); // step 5\n t3 = Fp.mul(t3, t4);\n t4 = Fp.add(t0, t1);\n t3 = Fp.sub(t3, t4);\n t4 = Fp.add(X1, Z1);\n let t5 = Fp.add(X2, Z2); // step 10\n t4 = Fp.mul(t4, t5);\n t5 = Fp.add(t0, t2);\n t4 = Fp.sub(t4, t5);\n t5 = Fp.add(Y1, Z1);\n X3 = Fp.add(Y2, Z2); // step 15\n t5 = Fp.mul(t5, X3);\n X3 = Fp.add(t1, t2);\n t5 = Fp.sub(t5, X3);\n Z3 = Fp.mul(a, t4);\n X3 = Fp.mul(b3, t2); // step 20\n Z3 = Fp.add(X3, Z3);\n X3 = Fp.sub(t1, Z3);\n Z3 = Fp.add(t1, Z3);\n Y3 = Fp.mul(X3, Z3);\n t1 = Fp.add(t0, t0); // step 25\n t1 = Fp.add(t1, t0);\n t2 = Fp.mul(a, t2);\n t4 = Fp.mul(b3, t4);\n t1 = Fp.add(t1, t2);\n t2 = Fp.sub(t0, t2); // step 30\n t2 = Fp.mul(a, t2);\n t4 = Fp.add(t4, t2);\n t0 = Fp.mul(t1, t4);\n Y3 = Fp.add(Y3, t0);\n t0 = Fp.mul(t5, t4); // step 35\n X3 = Fp.mul(t3, X3);\n X3 = Fp.sub(X3, t0);\n t0 = Fp.mul(t3, t1);\n Z3 = Fp.mul(t5, Z3);\n Z3 = Fp.add(Z3, t0); // step 40\n return new Point(X3, Y3, Z3);\n }\n subtract(other) {\n return this.add(other.negate());\n }\n is0() {\n return this.equals(Point.ZERO);\n }\n /**\n * Constant time multiplication.\n * Uses wNAF method. Windowed method may be 10% faster,\n * but takes 2x longer to generate and consumes 2x memory.\n * Uses precomputes when available.\n * Uses endomorphism for Koblitz curves.\n * @param scalar by which the point would be multiplied\n * @returns New point\n */\n multiply(scalar) {\n const { endo } = extraOpts;\n if (!Fn.isValidNot0(scalar))\n throw new Error('invalid scalar: out of range'); // 0 is invalid\n let point, fake; // Fake point is used to const-time mult\n const mul = (n) => wnaf.cached(this, n, (p) => normalizeZ(Point, p));\n /** See docs for {@link EndomorphismOpts} */\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(scalar);\n const { p: k1p, f: k1f } = mul(k1);\n const { p: k2p, f: k2f } = mul(k2);\n fake = k1f.add(k2f);\n point = finishEndo(endo.beta, k1p, k2p, k1neg, k2neg);\n }\n else {\n const { p, f } = mul(scalar);\n point = p;\n fake = f;\n }\n // Normalize `z` for both points, but return only real one\n return normalizeZ(Point, [point, fake])[0];\n }\n /**\n * Non-constant-time multiplication. Uses double-and-add algorithm.\n * It's faster, but should only be used when you don't care about\n * an exposed secret key e.g. sig verification, which works over *public* keys.\n */\n multiplyUnsafe(sc) {\n const { endo } = extraOpts;\n const p = this;\n if (!Fn.isValid(sc))\n throw new Error('invalid scalar: out of range'); // 0 is valid\n if (sc === _0n || p.is0())\n return Point.ZERO;\n if (sc === _1n)\n return p; // fast-path\n if (wnaf.hasCache(this))\n return this.multiply(sc);\n if (endo) {\n const { k1neg, k1, k2neg, k2 } = splitEndoScalarN(sc);\n const { p1, p2 } = mulEndoUnsafe(Point, p, k1, k2); // 30% faster vs wnaf.unsafe\n return finishEndo(endo.beta, p1, p2, k1neg, k2neg);\n }\n else {\n return wnaf.unsafe(p, sc);\n }\n }\n multiplyAndAddUnsafe(Q, a, b) {\n const sum = this.multiplyUnsafe(a).add(Q.multiplyUnsafe(b));\n return sum.is0() ? undefined : sum;\n }\n /**\n * Converts Projective point to affine (x, y) coordinates.\n * @param invertedZ Z^-1 (inverted zero) - optional, precomputation is useful for invertBatch\n */\n toAffine(invertedZ) {\n return toAffineMemo(this, invertedZ);\n }\n /**\n * Checks whether Point is free of torsion elements (is in prime subgroup).\n * Always torsion-free for cofactor=1 curves.\n */\n isTorsionFree() {\n const { isTorsionFree } = extraOpts;\n if (cofactor === _1n)\n return true;\n if (isTorsionFree)\n return isTorsionFree(Point, this);\n return wnaf.unsafe(this, CURVE_ORDER).is0();\n }\n clearCofactor() {\n const { clearCofactor } = extraOpts;\n if (cofactor === _1n)\n return this; // Fast-path\n if (clearCofactor)\n return clearCofactor(Point, this);\n return this.multiplyUnsafe(cofactor);\n }\n isSmallOrder() {\n // can we use this.clearCofactor()?\n return this.multiplyUnsafe(cofactor).is0();\n }\n toBytes(isCompressed = true) {\n abool(isCompressed, 'isCompressed');\n this.assertValidity();\n return encodePoint(Point, this, isCompressed);\n }\n toHex(isCompressed = true) {\n return bytesToHex(this.toBytes(isCompressed));\n }\n toString() {\n return ``;\n }\n // TODO: remove\n get px() {\n return this.X;\n }\n get py() {\n return this.X;\n }\n get pz() {\n return this.Z;\n }\n toRawBytes(isCompressed = true) {\n return this.toBytes(isCompressed);\n }\n _setWindowSize(windowSize) {\n this.precompute(windowSize);\n }\n static normalizeZ(points) {\n return normalizeZ(Point, points);\n }\n static msm(points, scalars) {\n return pippenger(Point, Fn, points, scalars);\n }\n static fromPrivateKey(privateKey) {\n return Point.BASE.multiply(_normFnElement(Fn, privateKey));\n }\n }\n // base / generator point\n Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE);\n // zero / infinity / identity point\n Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0\n // math field\n Point.Fp = Fp;\n // scalar field\n Point.Fn = Fn;\n const bits = Fn.BITS;\n const wnaf = new wNAF(Point, extraOpts.endo ? Math.ceil(bits / 2) : bits);\n Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms.\n return Point;\n}\n// Points start with byte 0x02 when y is even; otherwise 0x03\nfunction pprefix(hasEvenY) {\n return Uint8Array.of(hasEvenY ? 0x02 : 0x03);\n}\n/**\n * Implementation of the Shallue and van de Woestijne method for any weierstrass curve.\n * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular.\n * b = True and y = sqrt(u / v) if (u / v) is square in F, and\n * b = False and y = sqrt(Z * (u / v)) otherwise.\n * @param Fp\n * @param Z\n * @returns\n */\nexport function SWUFpSqrtRatio(Fp, Z) {\n // Generic implementation\n const q = Fp.ORDER;\n let l = _0n;\n for (let o = q - _1n; o % _2n === _0n; o /= _2n)\n l += _1n;\n const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1.\n // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<.\n // 2n ** c1 == 2n << (c1-1)\n const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n);\n const _2n_pow_c1 = _2n_pow_c1_1 * _2n;\n const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic\n const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic\n const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic\n const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic\n const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2\n const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2)\n let sqrtRatio = (u, v) => {\n let tv1 = c6; // 1. tv1 = c6\n let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4\n let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2\n tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v\n let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3\n tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3\n tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2\n tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v\n tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u\n let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2\n tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5\n let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1\n tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7\n tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR)\n tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR)\n // 17. for i in (c1, c1 - 1, ..., 2):\n for (let i = c1; i > _1n; i--) {\n let tv5 = i - _2n; // 18. tv5 = i - 2\n tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5\n let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5\n const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1\n tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1\n tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1\n tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1\n tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1)\n tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1)\n }\n return { isValid: isQR, value: tv3 };\n };\n if (Fp.ORDER % _4n === _3n) {\n // sqrt_ratio_3mod4(u, v)\n const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic\n const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z)\n sqrtRatio = (u, v) => {\n let tv1 = Fp.sqr(v); // 1. tv1 = v^2\n const tv2 = Fp.mul(u, v); // 2. tv2 = u * v\n tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2\n let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1\n y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2\n const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2\n const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v\n const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u\n let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR)\n return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2\n };\n }\n // No curves uses that\n // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8\n return sqrtRatio;\n}\n/**\n * Simplified Shallue-van de Woestijne-Ulas Method\n * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2\n */\nexport function mapToCurveSimpleSWU(Fp, opts) {\n validateField(Fp);\n const { A, B, Z } = opts;\n if (!Fp.isValid(A) || !Fp.isValid(B) || !Fp.isValid(Z))\n throw new Error('mapToCurveSimpleSWU: invalid opts');\n const sqrtRatio = SWUFpSqrtRatio(Fp, Z);\n if (!Fp.isOdd)\n throw new Error('Field does not have .isOdd()');\n // Input: u, an element of F.\n // Output: (x, y), a point on E.\n return (u) => {\n // prettier-ignore\n let tv1, tv2, tv3, tv4, tv5, tv6, x, y;\n tv1 = Fp.sqr(u); // 1. tv1 = u^2\n tv1 = Fp.mul(tv1, Z); // 2. tv1 = Z * tv1\n tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2\n tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1\n tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1\n tv3 = Fp.mul(tv3, B); // 6. tv3 = B * tv3\n tv4 = Fp.cmov(Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0)\n tv4 = Fp.mul(tv4, A); // 8. tv4 = A * tv4\n tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2\n tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2\n tv5 = Fp.mul(tv6, A); // 11. tv5 = A * tv6\n tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5\n tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3\n tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4\n tv5 = Fp.mul(tv6, B); // 15. tv5 = B * tv6\n tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5\n x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3\n const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6)\n y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1\n y = Fp.mul(y, value); // 20. y = y * y1\n x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square)\n y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square)\n const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y)\n y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1)\n const tv4_inv = FpInvertBatch(Fp, [tv4], true)[0];\n x = Fp.mul(x, tv4_inv); // 25. x = x / tv4\n return { x, y };\n };\n}\nfunction getWLengths(Fp, Fn) {\n return {\n secretKey: Fn.BYTES,\n publicKey: 1 + Fp.BYTES,\n publicKeyUncompressed: 1 + 2 * Fp.BYTES,\n publicKeyHasPrefix: true,\n signature: 2 * Fn.BYTES,\n };\n}\n/**\n * Sometimes users only need getPublicKey, getSharedSecret, and secret key handling.\n * This helper ensures no signature functionality is present. Less code, smaller bundle size.\n */\nexport function ecdh(Point, ecdhOpts = {}) {\n const { Fn } = Point;\n const randomBytes_ = ecdhOpts.randomBytes || randomBytesWeb;\n const lengths = Object.assign(getWLengths(Point.Fp, Fn), { seed: getMinHashLength(Fn.ORDER) });\n function isValidSecretKey(secretKey) {\n try {\n return !!_normFnElement(Fn, secretKey);\n }\n catch (error) {\n return false;\n }\n }\n function isValidPublicKey(publicKey, isCompressed) {\n const { publicKey: comp, publicKeyUncompressed } = lengths;\n try {\n const l = publicKey.length;\n if (isCompressed === true && l !== comp)\n return false;\n if (isCompressed === false && l !== publicKeyUncompressed)\n return false;\n return !!Point.fromBytes(publicKey);\n }\n catch (error) {\n return false;\n }\n }\n /**\n * Produces cryptographically secure secret key from random of size\n * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible.\n */\n function randomSecretKey(seed = randomBytes_(lengths.seed)) {\n return mapHashToField(abytes(seed, lengths.seed, 'seed'), Fn.ORDER);\n }\n /**\n * Computes public key for a secret key. Checks for validity of the secret key.\n * @param isCompressed whether to return compact (default), or full key\n * @returns Public key, full when isCompressed=false; short when isCompressed=true\n */\n function getPublicKey(secretKey, isCompressed = true) {\n return Point.BASE.multiply(_normFnElement(Fn, secretKey)).toBytes(isCompressed);\n }\n function keygen(seed) {\n const secretKey = randomSecretKey(seed);\n return { secretKey, publicKey: getPublicKey(secretKey) };\n }\n /**\n * Quick and dirty check for item being public key. Does not validate hex, or being on-curve.\n */\n function isProbPub(item) {\n if (typeof item === 'bigint')\n return false;\n if (item instanceof Point)\n return true;\n const { secretKey, publicKey, publicKeyUncompressed } = lengths;\n if (Fn.allowedLengths || secretKey === publicKey)\n return undefined;\n const l = ensureBytes('key', item).length;\n return l === publicKey || l === publicKeyUncompressed;\n }\n /**\n * ECDH (Elliptic Curve Diffie Hellman).\n * Computes shared public key from secret key A and public key B.\n * Checks: 1) secret key validity 2) shared key is on-curve.\n * Does NOT hash the result.\n * @param isCompressed whether to return compact (default), or full key\n * @returns shared public key\n */\n function getSharedSecret(secretKeyA, publicKeyB, isCompressed = true) {\n if (isProbPub(secretKeyA) === true)\n throw new Error('first arg must be private key');\n if (isProbPub(publicKeyB) === false)\n throw new Error('second arg must be public key');\n const s = _normFnElement(Fn, secretKeyA);\n const b = Point.fromHex(publicKeyB); // checks for being on-curve\n return b.multiply(s).toBytes(isCompressed);\n }\n const utils = {\n isValidSecretKey,\n isValidPublicKey,\n randomSecretKey,\n // TODO: remove\n isValidPrivateKey: isValidSecretKey,\n randomPrivateKey: randomSecretKey,\n normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),\n precompute(windowSize = 8, point = Point.BASE) {\n return point.precompute(windowSize, false);\n },\n };\n return Object.freeze({ getPublicKey, getSharedSecret, keygen, Point, utils, lengths });\n}\n/**\n * Creates ECDSA signing interface for given elliptic curve `Point` and `hash` function.\n * We need `hash` for 2 features:\n * 1. Message prehash-ing. NOT used if `sign` / `verify` are called with `prehash: false`\n * 2. k generation in `sign`, using HMAC-drbg(hash)\n *\n * ECDSAOpts are only rarely needed.\n *\n * @example\n * ```js\n * const p256_Point = weierstrass(...);\n * const p256_sha256 = ecdsa(p256_Point, sha256);\n * const p256_sha224 = ecdsa(p256_Point, sha224);\n * const p256_sha224_r = ecdsa(p256_Point, sha224, { randomBytes: (length) => { ... } });\n * ```\n */\nexport function ecdsa(Point, hash, ecdsaOpts = {}) {\n ahash(hash);\n _validateObject(ecdsaOpts, {}, {\n hmac: 'function',\n lowS: 'boolean',\n randomBytes: 'function',\n bits2int: 'function',\n bits2int_modN: 'function',\n });\n const randomBytes = ecdsaOpts.randomBytes || randomBytesWeb;\n const hmac = ecdsaOpts.hmac ||\n ((key, ...msgs) => nobleHmac(hash, key, concatBytes(...msgs)));\n const { Fp, Fn } = Point;\n const { ORDER: CURVE_ORDER, BITS: fnBits } = Fn;\n const { keygen, getPublicKey, getSharedSecret, utils, lengths } = ecdh(Point, ecdsaOpts);\n const defaultSigOpts = {\n prehash: false,\n lowS: typeof ecdsaOpts.lowS === 'boolean' ? ecdsaOpts.lowS : false,\n format: undefined, //'compact' as ECDSASigFormat,\n extraEntropy: false,\n };\n const defaultSigOpts_format = 'compact';\n function isBiggerThanHalfOrder(number) {\n const HALF = CURVE_ORDER >> _1n;\n return number > HALF;\n }\n function validateRS(title, num) {\n if (!Fn.isValidNot0(num))\n throw new Error(`invalid signature ${title}: out of range 1..Point.Fn.ORDER`);\n return num;\n }\n function validateSigLength(bytes, format) {\n validateSigFormat(format);\n const size = lengths.signature;\n const sizer = format === 'compact' ? size : format === 'recovered' ? size + 1 : undefined;\n return abytes(bytes, sizer, `${format} signature`);\n }\n /**\n * ECDSA signature with its (r, s) properties. Supports compact, recovered & DER representations.\n */\n class Signature {\n constructor(r, s, recovery) {\n this.r = validateRS('r', r); // r in [1..N-1];\n this.s = validateRS('s', s); // s in [1..N-1];\n if (recovery != null)\n this.recovery = recovery;\n Object.freeze(this);\n }\n static fromBytes(bytes, format = defaultSigOpts_format) {\n validateSigLength(bytes, format);\n let recid;\n if (format === 'der') {\n const { r, s } = DER.toSig(abytes(bytes));\n return new Signature(r, s);\n }\n if (format === 'recovered') {\n recid = bytes[0];\n format = 'compact';\n bytes = bytes.subarray(1);\n }\n const L = Fn.BYTES;\n const r = bytes.subarray(0, L);\n const s = bytes.subarray(L, L * 2);\n return new Signature(Fn.fromBytes(r), Fn.fromBytes(s), recid);\n }\n static fromHex(hex, format) {\n return this.fromBytes(hexToBytes(hex), format);\n }\n addRecoveryBit(recovery) {\n return new Signature(this.r, this.s, recovery);\n }\n recoverPublicKey(messageHash) {\n const FIELD_ORDER = Fp.ORDER;\n const { r, s, recovery: rec } = this;\n if (rec == null || ![0, 1, 2, 3].includes(rec))\n throw new Error('recovery id invalid');\n // ECDSA recovery is hard for cofactor > 1 curves.\n // In sign, `r = q.x mod n`, and here we recover q.x from r.\n // While recovering q.x >= n, we need to add r+n for cofactor=1 curves.\n // However, for cofactor>1, r+n may not get q.x:\n // r+n*i would need to be done instead where i is unknown.\n // To easily get i, we either need to:\n // a. increase amount of valid recid values (4, 5...); OR\n // b. prohibit non-prime-order signatures (recid > 1).\n const hasCofactor = CURVE_ORDER * _2n < FIELD_ORDER;\n if (hasCofactor && rec > 1)\n throw new Error('recovery id is ambiguous for h>1 curve');\n const radj = rec === 2 || rec === 3 ? r + CURVE_ORDER : r;\n if (!Fp.isValid(radj))\n throw new Error('recovery id 2 or 3 invalid');\n const x = Fp.toBytes(radj);\n const R = Point.fromBytes(concatBytes(pprefix((rec & 1) === 0), x));\n const ir = Fn.inv(radj); // r^-1\n const h = bits2int_modN(ensureBytes('msgHash', messageHash)); // Truncate hash\n const u1 = Fn.create(-h * ir); // -hr^-1\n const u2 = Fn.create(s * ir); // sr^-1\n // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1). unsafe is fine: there is no private data.\n const Q = Point.BASE.multiplyUnsafe(u1).add(R.multiplyUnsafe(u2));\n if (Q.is0())\n throw new Error('point at infinify');\n Q.assertValidity();\n return Q;\n }\n // Signatures should be low-s, to prevent malleability.\n hasHighS() {\n return isBiggerThanHalfOrder(this.s);\n }\n toBytes(format = defaultSigOpts_format) {\n validateSigFormat(format);\n if (format === 'der')\n return hexToBytes(DER.hexFromSig(this));\n const r = Fn.toBytes(this.r);\n const s = Fn.toBytes(this.s);\n if (format === 'recovered') {\n if (this.recovery == null)\n throw new Error('recovery bit must be present');\n return concatBytes(Uint8Array.of(this.recovery), r, s);\n }\n return concatBytes(r, s);\n }\n toHex(format) {\n return bytesToHex(this.toBytes(format));\n }\n // TODO: remove\n assertValidity() { }\n static fromCompact(hex) {\n return Signature.fromBytes(ensureBytes('sig', hex), 'compact');\n }\n static fromDER(hex) {\n return Signature.fromBytes(ensureBytes('sig', hex), 'der');\n }\n normalizeS() {\n return this.hasHighS() ? new Signature(this.r, Fn.neg(this.s), this.recovery) : this;\n }\n toDERRawBytes() {\n return this.toBytes('der');\n }\n toDERHex() {\n return bytesToHex(this.toBytes('der'));\n }\n toCompactRawBytes() {\n return this.toBytes('compact');\n }\n toCompactHex() {\n return bytesToHex(this.toBytes('compact'));\n }\n }\n // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets.\n // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int.\n // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same.\n // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors\n const bits2int = ecdsaOpts.bits2int ||\n function bits2int_def(bytes) {\n // Our custom check \"just in case\", for protection against DoS\n if (bytes.length > 8192)\n throw new Error('input is too large');\n // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m)\n // for some cases, since bytes.length * 8 is not actual bitLength.\n const num = bytesToNumberBE(bytes); // check for == u8 done here\n const delta = bytes.length * 8 - fnBits; // truncate to nBitLength leftmost bits\n return delta > 0 ? num >> BigInt(delta) : num;\n };\n const bits2int_modN = ecdsaOpts.bits2int_modN ||\n function bits2int_modN_def(bytes) {\n return Fn.create(bits2int(bytes)); // can't use bytesToNumberBE here\n };\n // Pads output with zero as per spec\n const ORDER_MASK = bitMask(fnBits);\n /** Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. */\n function int2octets(num) {\n // IMPORTANT: the check ensures working for case `Fn.BYTES != Fn.BITS * 8`\n aInRange('num < 2^' + fnBits, num, _0n, ORDER_MASK);\n return Fn.toBytes(num);\n }\n function validateMsgAndHash(message, prehash) {\n abytes(message, undefined, 'message');\n return prehash ? abytes(hash(message), undefined, 'prehashed message') : message;\n }\n /**\n * Steps A, D of RFC6979 3.2.\n * Creates RFC6979 seed; converts msg/privKey to numbers.\n * Used only in sign, not in verify.\n *\n * Warning: we cannot assume here that message has same amount of bytes as curve order,\n * this will be invalid at least for P521. Also it can be bigger for P224 + SHA256.\n */\n function prepSig(message, privateKey, opts) {\n if (['recovered', 'canonical'].some((k) => k in opts))\n throw new Error('sign() legacy options not supported');\n const { lowS, prehash, extraEntropy } = validateSigOpts(opts, defaultSigOpts);\n message = validateMsgAndHash(message, prehash); // RFC6979 3.2 A: h1 = H(m)\n // We can't later call bits2octets, since nested bits2int is broken for curves\n // with fnBits % 8 !== 0. Because of that, we unwrap it here as int2octets call.\n // const bits2octets = (bits) => int2octets(bits2int_modN(bits))\n const h1int = bits2int_modN(message);\n const d = _normFnElement(Fn, privateKey); // validate secret key, convert to bigint\n const seedArgs = [int2octets(d), int2octets(h1int)];\n // extraEntropy. RFC6979 3.6: additional k' (optional).\n if (extraEntropy != null && extraEntropy !== false) {\n // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k')\n // gen random bytes OR pass as-is\n const e = extraEntropy === true ? randomBytes(lengths.secretKey) : extraEntropy;\n seedArgs.push(ensureBytes('extraEntropy', e)); // check for being bytes\n }\n const seed = concatBytes(...seedArgs); // Step D of RFC6979 3.2\n const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash!\n // Converts signature params into point w r/s, checks result for validity.\n // To transform k => Signature:\n // q = k⋅G\n // r = q.x mod n\n // s = k^-1(m + rd) mod n\n // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to\n // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it:\n // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT\n function k2sig(kBytes) {\n // RFC 6979 Section 3.2, step 3: k = bits2int(T)\n // Important: all mod() calls here must be done over N\n const k = bits2int(kBytes); // mod n, not mod p\n if (!Fn.isValidNot0(k))\n return; // Valid scalars (including k) must be in 1..N-1\n const ik = Fn.inv(k); // k^-1 mod n\n const q = Point.BASE.multiply(k).toAffine(); // q = k⋅G\n const r = Fn.create(q.x); // r = q.x mod n\n if (r === _0n)\n return;\n const s = Fn.create(ik * Fn.create(m + r * d)); // Not using blinding here, see comment above\n if (s === _0n)\n return;\n let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n)\n let normS = s;\n if (lowS && isBiggerThanHalfOrder(s)) {\n normS = Fn.neg(s); // if lowS was passed, ensure s is always\n recovery ^= 1; // // in the bottom half of N\n }\n return new Signature(r, normS, recovery); // use normS, not s\n }\n return { seed, k2sig };\n }\n /**\n * Signs message hash with a secret key.\n *\n * ```\n * sign(m, d) where\n * k = rfc6979_hmac_drbg(m, d)\n * (x, y) = G × k\n * r = x mod n\n * s = (m + dr) / k mod n\n * ```\n */\n function sign(message, secretKey, opts = {}) {\n message = ensureBytes('message', message);\n const { seed, k2sig } = prepSig(message, secretKey, opts); // Steps A, D of RFC6979 3.2.\n const drbg = createHmacDrbg(hash.outputLen, Fn.BYTES, hmac);\n const sig = drbg(seed, k2sig); // Steps B, C, D, E, F, G\n return sig;\n }\n function tryParsingSig(sg) {\n // Try to deduce format\n let sig = undefined;\n const isHex = typeof sg === 'string' || isBytes(sg);\n const isObj = !isHex &&\n sg !== null &&\n typeof sg === 'object' &&\n typeof sg.r === 'bigint' &&\n typeof sg.s === 'bigint';\n if (!isHex && !isObj)\n throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance');\n if (isObj) {\n sig = new Signature(sg.r, sg.s);\n }\n else if (isHex) {\n try {\n sig = Signature.fromBytes(ensureBytes('sig', sg), 'der');\n }\n catch (derError) {\n if (!(derError instanceof DER.Err))\n throw derError;\n }\n if (!sig) {\n try {\n sig = Signature.fromBytes(ensureBytes('sig', sg), 'compact');\n }\n catch (error) {\n return false;\n }\n }\n }\n if (!sig)\n return false;\n return sig;\n }\n /**\n * Verifies a signature against message and public key.\n * Rejects lowS signatures by default: see {@link ECDSAVerifyOpts}.\n * Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf:\n *\n * ```\n * verify(r, s, h, P) where\n * u1 = hs^-1 mod n\n * u2 = rs^-1 mod n\n * R = u1⋅G + u2⋅P\n * mod(R.x, n) == r\n * ```\n */\n function verify(signature, message, publicKey, opts = {}) {\n const { lowS, prehash, format } = validateSigOpts(opts, defaultSigOpts);\n publicKey = ensureBytes('publicKey', publicKey);\n message = validateMsgAndHash(ensureBytes('message', message), prehash);\n if ('strict' in opts)\n throw new Error('options.strict was renamed to lowS');\n const sig = format === undefined\n ? tryParsingSig(signature)\n : Signature.fromBytes(ensureBytes('sig', signature), format);\n if (sig === false)\n return false;\n try {\n const P = Point.fromBytes(publicKey);\n if (lowS && sig.hasHighS())\n return false;\n const { r, s } = sig;\n const h = bits2int_modN(message); // mod n, not mod p\n const is = Fn.inv(s); // s^-1 mod n\n const u1 = Fn.create(h * is); // u1 = hs^-1 mod n\n const u2 = Fn.create(r * is); // u2 = rs^-1 mod n\n const R = Point.BASE.multiplyUnsafe(u1).add(P.multiplyUnsafe(u2)); // u1⋅G + u2⋅P\n if (R.is0())\n return false;\n const v = Fn.create(R.x); // v = r.x mod n\n return v === r;\n }\n catch (e) {\n return false;\n }\n }\n function recoverPublicKey(signature, message, opts = {}) {\n const { prehash } = validateSigOpts(opts, defaultSigOpts);\n message = validateMsgAndHash(message, prehash);\n return Signature.fromBytes(signature, 'recovered').recoverPublicKey(message).toBytes();\n }\n return Object.freeze({\n keygen,\n getPublicKey,\n getSharedSecret,\n utils,\n lengths,\n Point,\n sign,\n verify,\n recoverPublicKey,\n Signature,\n hash,\n });\n}\n/** @deprecated use `weierstrass` in newer releases */\nexport function weierstrassPoints(c) {\n const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);\n const Point = weierstrassN(CURVE, curveOpts);\n return _weierstrass_new_output_to_legacy(c, Point);\n}\nfunction _weierstrass_legacy_opts_to_new(c) {\n const CURVE = {\n a: c.a,\n b: c.b,\n p: c.Fp.ORDER,\n n: c.n,\n h: c.h,\n Gx: c.Gx,\n Gy: c.Gy,\n };\n const Fp = c.Fp;\n let allowedLengths = c.allowedPrivateKeyLengths\n ? Array.from(new Set(c.allowedPrivateKeyLengths.map((l) => Math.ceil(l / 2))))\n : undefined;\n const Fn = Field(CURVE.n, {\n BITS: c.nBitLength,\n allowedLengths: allowedLengths,\n modFromBytes: c.wrapPrivateKey,\n });\n const curveOpts = {\n Fp,\n Fn,\n allowInfinityPoint: c.allowInfinityPoint,\n endo: c.endo,\n isTorsionFree: c.isTorsionFree,\n clearCofactor: c.clearCofactor,\n fromBytes: c.fromBytes,\n toBytes: c.toBytes,\n };\n return { CURVE, curveOpts };\n}\nfunction _ecdsa_legacy_opts_to_new(c) {\n const { CURVE, curveOpts } = _weierstrass_legacy_opts_to_new(c);\n const ecdsaOpts = {\n hmac: c.hmac,\n randomBytes: c.randomBytes,\n lowS: c.lowS,\n bits2int: c.bits2int,\n bits2int_modN: c.bits2int_modN,\n };\n return { CURVE, curveOpts, hash: c.hash, ecdsaOpts };\n}\nexport function _legacyHelperEquat(Fp, a, b) {\n /**\n * y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y².\n * @returns y²\n */\n function weierstrassEquation(x) {\n const x2 = Fp.sqr(x); // x * x\n const x3 = Fp.mul(x2, x); // x² * x\n return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x³ + a * x + b\n }\n return weierstrassEquation;\n}\nfunction _weierstrass_new_output_to_legacy(c, Point) {\n const { Fp, Fn } = Point;\n function isWithinCurveOrder(num) {\n return inRange(num, _1n, Fn.ORDER);\n }\n const weierstrassEquation = _legacyHelperEquat(Fp, c.a, c.b);\n return Object.assign({}, {\n CURVE: c,\n Point: Point,\n ProjectivePoint: Point,\n normPrivateKeyToScalar: (key) => _normFnElement(Fn, key),\n weierstrassEquation,\n isWithinCurveOrder,\n });\n}\nfunction _ecdsa_new_output_to_legacy(c, _ecdsa) {\n const Point = _ecdsa.Point;\n return Object.assign({}, _ecdsa, {\n ProjectivePoint: Point,\n CURVE: Object.assign({}, c, nLength(Point.Fn.ORDER, Point.Fn.BITS)),\n });\n}\n// _ecdsa_legacy\nexport function weierstrass(c) {\n const { CURVE, curveOpts, hash, ecdsaOpts } = _ecdsa_legacy_opts_to_new(c);\n const Point = weierstrassN(CURVE, curveOpts);\n const signs = ecdsa(Point, hash, ecdsaOpts);\n return _ecdsa_new_output_to_legacy(c, signs);\n}\n//# sourceMappingURL=weierstrass.js.map","/**\n * SECG secp256k1. See [pdf](https://www.secg.org/sec2-v2.pdf).\n *\n * Belongs to Koblitz curves: it has efficiently-computable GLV endomorphism ψ,\n * check out {@link EndomorphismOpts}. Seems to be rigid (not backdoored).\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { sha256 } from '@noble/hashes/sha2.js';\nimport { randomBytes } from '@noble/hashes/utils.js';\nimport { createCurve } from \"./_shortw_utils.js\";\nimport { createHasher, isogenyMap, } from \"./abstract/hash-to-curve.js\";\nimport { Field, mapHashToField, mod, pow2 } from \"./abstract/modular.js\";\nimport { _normFnElement, mapToCurveSimpleSWU, } from \"./abstract/weierstrass.js\";\nimport { bytesToNumberBE, concatBytes, ensureBytes, inRange, numberToBytesBE, utf8ToBytes, } from \"./utils.js\";\n// Seems like generator was produced from some seed:\n// `Point.BASE.multiply(Point.Fn.inv(2n, N)).toAffine().x`\n// // gives short x 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63n\nconst secp256k1_CURVE = {\n p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'),\n n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'),\n h: BigInt(1),\n a: BigInt(0),\n b: BigInt(7),\n Gx: BigInt('0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'),\n Gy: BigInt('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'),\n};\nconst secp256k1_ENDO = {\n beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'),\n basises: [\n [BigInt('0x3086d221a7d46bcde86c90e49284eb15'), -BigInt('0xe4437ed6010e88286f547fa90abfe4c3')],\n [BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'), BigInt('0x3086d221a7d46bcde86c90e49284eb15')],\n ],\n};\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\n/**\n * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit.\n * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00]\n */\nfunction sqrtMod(y) {\n const P = secp256k1_CURVE.p;\n // prettier-ignore\n const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22);\n // prettier-ignore\n const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88);\n const b2 = (y * y * y) % P; // x^3, 11\n const b3 = (b2 * b2 * y) % P; // x^7\n const b6 = (pow2(b3, _3n, P) * b3) % P;\n const b9 = (pow2(b6, _3n, P) * b3) % P;\n const b11 = (pow2(b9, _2n, P) * b2) % P;\n const b22 = (pow2(b11, _11n, P) * b11) % P;\n const b44 = (pow2(b22, _22n, P) * b22) % P;\n const b88 = (pow2(b44, _44n, P) * b44) % P;\n const b176 = (pow2(b88, _88n, P) * b88) % P;\n const b220 = (pow2(b176, _44n, P) * b44) % P;\n const b223 = (pow2(b220, _3n, P) * b3) % P;\n const t1 = (pow2(b223, _23n, P) * b22) % P;\n const t2 = (pow2(t1, _6n, P) * b2) % P;\n const root = pow2(t2, _2n, P);\n if (!Fpk1.eql(Fpk1.sqr(root), y))\n throw new Error('Cannot find square root');\n return root;\n}\nconst Fpk1 = Field(secp256k1_CURVE.p, { sqrt: sqrtMod });\n/**\n * secp256k1 curve, ECDSA and ECDH methods.\n *\n * Field: `2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n`\n *\n * @example\n * ```js\n * import { secp256k1 } from '@noble/curves/secp256k1';\n * const { secretKey, publicKey } = secp256k1.keygen();\n * const msg = new TextEncoder().encode('hello');\n * const sig = secp256k1.sign(msg, secretKey);\n * const isValid = secp256k1.verify(sig, msg, publicKey) === true;\n * ```\n */\nexport const secp256k1 = createCurve({ ...secp256k1_CURVE, Fp: Fpk1, lowS: true, endo: secp256k1_ENDO }, sha256);\n// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code.\n// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\n/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */\nconst TAGGED_HASH_PREFIXES = {};\nfunction taggedHash(tag, ...messages) {\n let tagP = TAGGED_HASH_PREFIXES[tag];\n if (tagP === undefined) {\n const tagH = sha256(utf8ToBytes(tag));\n tagP = concatBytes(tagH, tagH);\n TAGGED_HASH_PREFIXES[tag] = tagP;\n }\n return sha256(concatBytes(tagP, ...messages));\n}\n// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03\nconst pointToBytes = (point) => point.toBytes(true).slice(1);\nconst Pointk1 = /* @__PURE__ */ (() => secp256k1.Point)();\nconst hasEven = (y) => y % _2n === _0n;\n// Calculate point, scalar and bytes\nfunction schnorrGetExtPubKey(priv) {\n const { Fn, BASE } = Pointk1;\n const d_ = _normFnElement(Fn, priv);\n const p = BASE.multiply(d_); // P = d'⋅G; 0 < d' < n check is done inside\n const scalar = hasEven(p.y) ? d_ : Fn.neg(d_);\n return { scalar, bytes: pointToBytes(p) };\n}\n/**\n * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point.\n * @returns valid point checked for being on-curve\n */\nfunction lift_x(x) {\n const Fp = Fpk1;\n if (!Fp.isValidNot0(x))\n throw new Error('invalid x: Fail if x ≥ p');\n const xx = Fp.create(x * x);\n const c = Fp.create(xx * x + BigInt(7)); // Let c = x³ + 7 mod p.\n let y = Fp.sqrt(c); // Let y = c^(p+1)/4 mod p. Same as sqrt().\n // Return the unique point P such that x(P) = x and\n // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise.\n if (!hasEven(y))\n y = Fp.neg(y);\n const p = Pointk1.fromAffine({ x, y });\n p.assertValidity();\n return p;\n}\nconst num = bytesToNumberBE;\n/**\n * Create tagged hash, convert it to bigint, reduce modulo-n.\n */\nfunction challenge(...args) {\n return Pointk1.Fn.create(num(taggedHash('BIP0340/challenge', ...args)));\n}\n/**\n * Schnorr public key is just `x` coordinate of Point as per BIP340.\n */\nfunction schnorrGetPublicKey(secretKey) {\n return schnorrGetExtPubKey(secretKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G)\n}\n/**\n * Creates Schnorr signature as per BIP340. Verifies itself before returning anything.\n * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous.\n */\nfunction schnorrSign(message, secretKey, auxRand = randomBytes(32)) {\n const { Fn } = Pointk1;\n const m = ensureBytes('message', message);\n const { bytes: px, scalar: d } = schnorrGetExtPubKey(secretKey); // checks for isWithinCurveOrder\n const a = ensureBytes('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array\n const t = Fn.toBytes(d ^ num(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a)\n const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m)\n // Let k' = int(rand) mod n. Fail if k' = 0. Let R = k'⋅G\n const { bytes: rx, scalar: k } = schnorrGetExtPubKey(rand);\n const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n.\n const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n).\n sig.set(rx, 0);\n sig.set(Fn.toBytes(Fn.create(k + e * d)), 32);\n // If Verify(bytes(P), m, sig) (see below) returns failure, abort\n if (!schnorrVerify(sig, m, px))\n throw new Error('sign: Invalid signature produced');\n return sig;\n}\n/**\n * Verifies Schnorr signature.\n * Will swallow errors & return false except for initial type validation of arguments.\n */\nfunction schnorrVerify(signature, message, publicKey) {\n const { Fn, BASE } = Pointk1;\n const sig = ensureBytes('signature', signature, 64);\n const m = ensureBytes('message', message);\n const pub = ensureBytes('publicKey', publicKey, 32);\n try {\n const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails\n const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p.\n if (!inRange(r, _1n, secp256k1_CURVE.p))\n return false;\n const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n.\n if (!inRange(s, _1n, secp256k1_CURVE.n))\n return false;\n // int(challenge(bytes(r)||bytes(P)||m))%n\n const e = challenge(Fn.toBytes(r), pointToBytes(P), m);\n // R = s⋅G - e⋅P, where -eP == (n-e)P\n const R = BASE.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e)));\n const { x, y } = R.toAffine();\n // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r.\n if (R.is0() || !hasEven(y) || x !== r)\n return false;\n return true;\n }\n catch (error) {\n return false;\n }\n}\n/**\n * Schnorr signatures over secp256k1.\n * https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki\n * @example\n * ```js\n * import { schnorr } from '@noble/curves/secp256k1';\n * const { secretKey, publicKey } = schnorr.keygen();\n * // const publicKey = schnorr.getPublicKey(secretKey);\n * const msg = new TextEncoder().encode('hello');\n * const sig = schnorr.sign(msg, secretKey);\n * const isValid = schnorr.verify(sig, msg, publicKey);\n * ```\n */\nexport const schnorr = /* @__PURE__ */ (() => {\n const size = 32;\n const seedLength = 48;\n const randomSecretKey = (seed = randomBytes(seedLength)) => {\n return mapHashToField(seed, secp256k1_CURVE.n);\n };\n // TODO: remove\n secp256k1.utils.randomSecretKey;\n function keygen(seed) {\n const secretKey = randomSecretKey(seed);\n return { secretKey, publicKey: schnorrGetPublicKey(secretKey) };\n }\n return {\n keygen,\n getPublicKey: schnorrGetPublicKey,\n sign: schnorrSign,\n verify: schnorrVerify,\n Point: Pointk1,\n utils: {\n randomSecretKey: randomSecretKey,\n randomPrivateKey: randomSecretKey,\n taggedHash,\n // TODO: remove\n lift_x,\n pointToBytes,\n numberToBytesBE,\n bytesToNumberBE,\n mod,\n },\n lengths: {\n secretKey: size,\n publicKey: size,\n publicKeyHasPrefix: false,\n signature: size * 2,\n seed: seedLength,\n },\n };\n})();\nconst isoMap = /* @__PURE__ */ (() => isogenyMap(Fpk1, [\n // xNum\n [\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7',\n '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581',\n '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262',\n '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c',\n ],\n // xDen\n [\n '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b',\n '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n // yNum\n [\n '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c',\n '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3',\n '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931',\n '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84',\n ],\n // yDen\n [\n '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b',\n '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573',\n '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f',\n '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1\n ],\n].map((i) => i.map((j) => BigInt(j)))))();\nconst mapSWU = /* @__PURE__ */ (() => mapToCurveSimpleSWU(Fpk1, {\n A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'),\n B: BigInt('1771'),\n Z: Fpk1.create(BigInt('-11')),\n}))();\n/** Hashing / encoding to secp256k1 points / field. RFC 9380 methods. */\nexport const secp256k1_hasher = /* @__PURE__ */ (() => createHasher(secp256k1.Point, (scalars) => {\n const { x, y } = mapSWU(Fpk1.create(scalars[0]));\n return isoMap(x, y);\n}, {\n DST: 'secp256k1_XMD:SHA-256_SSWU_RO_',\n encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_',\n p: Fpk1.ORDER,\n m: 1,\n k: 128,\n expand: 'xmd',\n hash: sha256,\n}))();\n/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */\nexport const hashToCurve = /* @__PURE__ */ (() => secp256k1_hasher.hashToCurve)();\n/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */\nexport const encodeToCurve = /* @__PURE__ */ (() => secp256k1_hasher.encodeToCurve)();\n//# sourceMappingURL=secp256k1.js.map","/**\n * Utilities for short weierstrass curves, combined with noble-hashes.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { weierstrass } from \"./abstract/weierstrass.js\";\n/** connects noble-curves to noble-hashes */\nexport function getHash(hash) {\n return { hash };\n}\n/** @deprecated use new `weierstrass()` and `ecdsa()` methods */\nexport function createCurve(curveDef, defHash) {\n const create = (hash) => weierstrass({ ...curveDef, hash: hash });\n return { ...create(defHash), create };\n}\n//# sourceMappingURL=_shortw_utils.js.map","'use strict';\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = default_1;\nvar bs58_1 = __importDefault(require(\"bs58\"));\nfunction default_1(checksumFn) {\n // Encode a buffer as a base58-check encoded string\n function encode(payload) {\n var payloadU8 = Uint8Array.from(payload);\n var checksum = checksumFn(payloadU8);\n var length = payloadU8.length + 4;\n var both = new Uint8Array(length);\n both.set(payloadU8, 0);\n both.set(checksum.subarray(0, 4), payloadU8.length);\n return bs58_1.default.encode(both);\n }\n function decodeRaw(buffer) {\n var payload = buffer.slice(0, -4);\n var checksum = buffer.slice(-4);\n var newChecksum = checksumFn(payload);\n // eslint-disable-next-line\n if (checksum[0] ^ newChecksum[0] |\n checksum[1] ^ newChecksum[1] |\n checksum[2] ^ newChecksum[2] |\n checksum[3] ^ newChecksum[3])\n return;\n return payload;\n }\n // Decode a base58-check encoded string to a buffer, no result if checksum is wrong\n function decodeUnsafe(str) {\n var buffer = bs58_1.default.decodeUnsafe(str);\n if (buffer == null)\n return;\n return decodeRaw(buffer);\n }\n function decode(str) {\n var buffer = bs58_1.default.decode(str);\n var payload = decodeRaw(buffer);\n if (payload == null)\n throw new Error('Invalid checksum');\n return payload;\n }\n return {\n encode: encode,\n decode: decode,\n decodeUnsafe: decodeUnsafe\n };\n}\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _md = _interopRequireDefault(require(\"./md5.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v3 = (0, _v.default)('v3', 0x30, _md.default);\nvar _default = v3;\nexports.default = _default;","'use strict';\n\nconst uuid = require('uuid').v4;\n\n/**\n * Generates a JSON-RPC 1.0 or 2.0 request\n * @param {String} method Name of method to call\n * @param {Array|Object} params Array of parameters passed to the method as specified, or an object of parameter names and corresponding value\n * @param {String|Number|null} [id] Request ID can be a string, number, null for explicit notification or left out for automatic generation\n * @param {Object} [options]\n * @param {Number} [options.version=2] JSON-RPC version to use (1 or 2)\n * @param {Boolean} [options.notificationIdNull=false] When true, version 2 requests will set id to null instead of omitting it\n * @param {Function} [options.generator] Passed the request, and the options object and is expected to return a request ID\n * @throws {TypeError} If any of the parameters are invalid\n * @return {Object} A JSON-RPC 1.0 or 2.0 request\n * @memberOf Utils\n */\nconst generateRequest = function(method, params, id, options) {\n if(typeof method !== 'string') {\n throw new TypeError(method + ' must be a string');\n }\n\n options = options || {};\n\n // check valid version provided\n const version = typeof options.version === 'number' ? options.version : 2;\n if (version !== 1 && version !== 2) {\n throw new TypeError(version + ' must be 1 or 2');\n }\n\n const request = {\n method: method\n };\n\n if(version === 2) {\n request.jsonrpc = '2.0';\n }\n\n if(params) {\n // params given, but invalid?\n if(typeof params !== 'object' && !Array.isArray(params)) {\n throw new TypeError(params + ' must be an object, array or omitted');\n }\n request.params = params;\n }\n\n // if id was left out, generate one (null means explicit notification)\n if(typeof(id) === 'undefined') {\n const generator = typeof options.generator === 'function' ? options.generator : function() { return uuid(); };\n request.id = generator(request, options);\n } else if (version === 2 && id === null) {\n // we have a version 2 notification\n if (options.notificationIdNull) {\n request.id = null; // id will not be set at all unless option provided\n }\n } else {\n request.id = id;\n }\n\n return request;\n};\n\nmodule.exports = generateRequest;\n","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _v = _interopRequireDefault(require(\"./v35.js\"));\n\nvar _sha = _interopRequireDefault(require(\"./sha1.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nconst v5 = (0, _v.default)('v5', 0x50, _sha.default);\nvar _default = v5;\nexports.default = _default;","import { SliceOffsetOutOfBoundsError, } from '../../errors/data.js';\nimport { isHex } from './isHex.js';\nimport { size } from './size.js';\n/**\n * @description Returns a section of the hex or byte array given a start/end bytes offset.\n *\n * @param value The hex or byte array to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function slice(value, start, end, { strict } = {}) {\n if (isHex(value, { strict: false }))\n return sliceHex(value, start, end, {\n strict,\n });\n return sliceBytes(value, start, end, {\n strict,\n });\n}\nfunction assertStartOffset(value, start) {\n if (typeof start === 'number' && start > 0 && start > size(value) - 1)\n throw new SliceOffsetOutOfBoundsError({\n offset: start,\n position: 'start',\n size: size(value),\n });\n}\nfunction assertEndOffset(value, start, end) {\n if (typeof start === 'number' &&\n typeof end === 'number' &&\n size(value) !== end - start) {\n throw new SliceOffsetOutOfBoundsError({\n offset: end,\n position: 'end',\n size: size(value),\n });\n }\n}\n/**\n * @description Returns a section of the byte array given a start/end bytes offset.\n *\n * @param value The byte array to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function sliceBytes(value_, start, end, { strict } = {}) {\n assertStartOffset(value_, start);\n const value = value_.slice(start, end);\n if (strict)\n assertEndOffset(value, start, end);\n return value;\n}\n/**\n * @description Returns a section of the hex value given a start/end bytes offset.\n *\n * @param value The hex value to slice.\n * @param start The start offset (in bytes).\n * @param end The end offset (in bytes).\n */\nexport function sliceHex(value_, start, end, { strict } = {}) {\n assertStartOffset(value_, start);\n const value = `0x${value_\n .replace('0x', '')\n .slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`;\n if (strict)\n assertEndOffset(value, start, end);\n return value;\n}\n//# sourceMappingURL=slice.js.map","import { versionedHashVersionKzg } from '../constants/kzg.js';\nimport { BaseError } from './base.js';\nexport class BlobSizeTooLargeError extends BaseError {\n constructor({ maxSize, size }) {\n super('Blob size is too large.', {\n metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`],\n name: 'BlobSizeTooLargeError',\n });\n }\n}\nexport class EmptyBlobError extends BaseError {\n constructor() {\n super('Blob data must not be empty.', { name: 'EmptyBlobError' });\n }\n}\nexport class InvalidVersionedHashSizeError extends BaseError {\n constructor({ hash, size, }) {\n super(`Versioned hash \"${hash}\" size is invalid.`, {\n metaMessages: ['Expected: 32', `Received: ${size}`],\n name: 'InvalidVersionedHashSizeError',\n });\n }\n}\nexport class InvalidVersionedHashVersionError extends BaseError {\n constructor({ hash, version, }) {\n super(`Versioned hash \"${hash}\" version is invalid.`, {\n metaMessages: [\n `Expected: ${versionedHashVersionKzg}`,\n `Received: ${version}`,\n ],\n name: 'InvalidVersionedHashVersionError',\n });\n }\n}\n//# sourceMappingURL=blob.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction v4(options, buf, offset) {\n options = options || {};\n\n const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n\n\n rnds[6] = rnds[6] & 0x0f | 0x40;\n rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided\n\n if (buf) {\n offset = offset || 0;\n\n for (let i = 0; i < 16; ++i) {\n buf[offset + i] = rnds[i];\n }\n\n return buf;\n }\n\n return (0, _stringify.default)(rnds);\n}\n\nvar _default = v4;\nexports.default = _default;","import { IntegerOutOfRangeError, } from '../../errors/encoding.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nconst hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0'));\n/**\n * Encodes a string, number, bigint, or ByteArray into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex\n * - Example: https://viem.sh/docs/utilities/toHex#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world')\n * // '0x48656c6c6f20776f726c6421'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex(420)\n * // '0x1a4'\n *\n * @example\n * import { toHex } from 'viem'\n * const data = toHex('Hello world', { size: 32 })\n * // '0x48656c6c6f20776f726c64210000000000000000000000000000000000000000'\n */\nexport function toHex(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToHex(value, opts);\n if (typeof value === 'string') {\n return stringToHex(value, opts);\n }\n if (typeof value === 'boolean')\n return boolToHex(value, opts);\n return bytesToHex(value, opts);\n}\n/**\n * Encodes a boolean into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#booltohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true)\n * // '0x1'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(false)\n * // '0x0'\n *\n * @example\n * import { boolToHex } from 'viem'\n * const data = boolToHex(true, { size: 32 })\n * // '0x0000000000000000000000000000000000000000000000000000000000000001'\n */\nexport function boolToHex(value, opts = {}) {\n const hex = `0x${Number(value)}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a bytes array into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#bytestohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { bytesToHex } from 'viem'\n * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function bytesToHex(value, opts = {}) {\n let string = '';\n for (let i = 0; i < value.length; i++) {\n string += hexes[value[i]];\n }\n const hex = `0x${string}`;\n if (typeof opts.size === 'number') {\n assertSize(hex, { size: opts.size });\n return pad(hex, { dir: 'right', size: opts.size });\n }\n return hex;\n}\n/**\n * Encodes a number or bigint into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420)\n * // '0x1a4'\n *\n * @example\n * import { numberToHex } from 'viem'\n * const data = numberToHex(420, { size: 32 })\n * // '0x00000000000000000000000000000000000000000000000000000000000001a4'\n */\nexport function numberToHex(value_, opts = {}) {\n const { signed, size } = opts;\n const value = BigInt(value_);\n let maxValue;\n if (size) {\n if (signed)\n maxValue = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n else\n maxValue = 2n ** (BigInt(size) * 8n) - 1n;\n }\n else if (typeof value_ === 'number') {\n maxValue = BigInt(Number.MAX_SAFE_INTEGER);\n }\n const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0;\n if ((maxValue && value > maxValue) || value < minValue) {\n const suffix = typeof value_ === 'bigint' ? 'n' : '';\n throw new IntegerOutOfRangeError({\n max: maxValue ? `${maxValue}${suffix}` : undefined,\n min: `${minValue}${suffix}`,\n signed,\n size,\n value: `${value_}${suffix}`,\n });\n }\n const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`;\n if (size)\n return pad(hex, { size });\n return hex;\n}\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string into a hex string\n *\n * - Docs: https://viem.sh/docs/utilities/toHex#stringtohex\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Hex value.\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!')\n * // '0x48656c6c6f20576f726c6421'\n *\n * @example\n * import { stringToHex } from 'viem'\n * const data = stringToHex('Hello World!', { size: 32 })\n * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000'\n */\nexport function stringToHex(value_, opts = {}) {\n const value = encoder.encode(value_);\n return bytesToHex(value, opts);\n}\n//# sourceMappingURL=toHex.js.map","'use strict';\n\n// This is free and unencumbered software released into the public domain.\n// See LICENSE.md for more information.\n\n//\n// Utilities\n//\n\n/**\n * @param {number} a The number to test.\n * @param {number} min The minimum value in the range, inclusive.\n * @param {number} max The maximum value in the range, inclusive.\n * @return {boolean} True if a >= min and a <= max.\n */\nfunction inRange(a, min, max) {\n return min <= a && a <= max;\n}\n\n/**\n * @param {*} o\n * @return {Object}\n */\nfunction ToDictionary(o) {\n if (o === undefined) return {};\n if (o === Object(o)) return o;\n throw TypeError('Could not convert argument to dictionary');\n}\n\n/**\n * @param {string} string Input string of UTF-16 code units.\n * @return {!Array.} Code points.\n */\nfunction stringToCodePoints(string) {\n // https://heycam.github.io/webidl/#dfn-obtain-unicode\n\n // 1. Let S be the DOMString value.\n var s = String(string);\n\n // 2. Let n be the length of S.\n var n = s.length;\n\n // 3. Initialize i to 0.\n var i = 0;\n\n // 4. Initialize U to be an empty sequence of Unicode characters.\n var u = [];\n\n // 5. While i < n:\n while (i < n) {\n\n // 1. Let c be the code unit in S at index i.\n var c = s.charCodeAt(i);\n\n // 2. Depending on the value of c:\n\n // c < 0xD800 or c > 0xDFFF\n if (c < 0xD800 || c > 0xDFFF) {\n // Append to U the Unicode character with code point c.\n u.push(c);\n }\n\n // 0xDC00 ≤ c ≤ 0xDFFF\n else if (0xDC00 <= c && c <= 0xDFFF) {\n // Append to U a U+FFFD REPLACEMENT CHARACTER.\n u.push(0xFFFD);\n }\n\n // 0xD800 ≤ c ≤ 0xDBFF\n else if (0xD800 <= c && c <= 0xDBFF) {\n // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT\n // CHARACTER.\n if (i === n - 1) {\n u.push(0xFFFD);\n }\n // 2. Otherwise, i < n−1:\n else {\n // 1. Let d be the code unit in S at index i+1.\n var d = string.charCodeAt(i + 1);\n\n // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:\n if (0xDC00 <= d && d <= 0xDFFF) {\n // 1. Let a be c & 0x3FF.\n var a = c & 0x3FF;\n\n // 2. Let b be d & 0x3FF.\n var b = d & 0x3FF;\n\n // 3. Append to U the Unicode character with code point\n // 2^16+2^10*a+b.\n u.push(0x10000 + (a << 10) + b);\n\n // 4. Set i to i+1.\n i += 1;\n }\n\n // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a\n // U+FFFD REPLACEMENT CHARACTER.\n else {\n u.push(0xFFFD);\n }\n }\n }\n\n // 3. Set i to i+1.\n i += 1;\n }\n\n // 6. Return U.\n return u;\n}\n\n/**\n * @param {!Array.} code_points Array of code points.\n * @return {string} string String of UTF-16 code units.\n */\nfunction codePointsToString(code_points) {\n var s = '';\n for (var i = 0; i < code_points.length; ++i) {\n var cp = code_points[i];\n if (cp <= 0xFFFF) {\n s += String.fromCharCode(cp);\n } else {\n cp -= 0x10000;\n s += String.fromCharCode((cp >> 10) + 0xD800,\n (cp & 0x3FF) + 0xDC00);\n }\n }\n return s;\n}\n\n\n//\n// Implementation of Encoding specification\n// https://encoding.spec.whatwg.org/\n//\n\n//\n// 3. Terminology\n//\n\n/**\n * End-of-stream is a special token that signifies no more tokens\n * are in the stream.\n * @const\n */ var end_of_stream = -1;\n\n/**\n * A stream represents an ordered sequence of tokens.\n *\n * @constructor\n * @param {!(Array.|Uint8Array)} tokens Array of tokens that provide the\n * stream.\n */\nfunction Stream(tokens) {\n /** @type {!Array.} */\n this.tokens = [].slice.call(tokens);\n}\n\nStream.prototype = {\n /**\n * @return {boolean} True if end-of-stream has been hit.\n */\n endOfStream: function() {\n return !this.tokens.length;\n },\n\n /**\n * When a token is read from a stream, the first token in the\n * stream must be returned and subsequently removed, and\n * end-of-stream must be returned otherwise.\n *\n * @return {number} Get the next token from the stream, or\n * end_of_stream.\n */\n read: function() {\n if (!this.tokens.length)\n return end_of_stream;\n return this.tokens.shift();\n },\n\n /**\n * When one or more tokens are prepended to a stream, those tokens\n * must be inserted, in given order, before the first token in the\n * stream.\n *\n * @param {(number|!Array.)} token The token(s) to prepend to the stream.\n */\n prepend: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.unshift(tokens.pop());\n } else {\n this.tokens.unshift(token);\n }\n },\n\n /**\n * When one or more tokens are pushed to a stream, those tokens\n * must be inserted, in given order, after the last token in the\n * stream.\n *\n * @param {(number|!Array.)} token The tokens(s) to prepend to the stream.\n */\n push: function(token) {\n if (Array.isArray(token)) {\n var tokens = /**@type {!Array.}*/(token);\n while (tokens.length)\n this.tokens.push(tokens.shift());\n } else {\n this.tokens.push(token);\n }\n }\n};\n\n//\n// 4. Encodings\n//\n\n// 4.1 Encoders and decoders\n\n/** @const */\nvar finished = -1;\n\n/**\n * @param {boolean} fatal If true, decoding errors raise an exception.\n * @param {number=} opt_code_point Override the standard fallback code point.\n * @return {number} The code point to insert on a decoding error.\n */\nfunction decoderError(fatal, opt_code_point) {\n if (fatal)\n throw TypeError('Decoder error');\n return opt_code_point || 0xFFFD;\n}\n\n//\n// 7. API\n//\n\n/** @const */ var DEFAULT_ENCODING = 'utf-8';\n\n// 7.1 Interface TextDecoder\n\n/**\n * @constructor\n * @param {string=} encoding The label of the encoding;\n * defaults to 'utf-8'.\n * @param {Object=} options\n */\nfunction TextDecoder(encoding, options) {\n if (!(this instanceof TextDecoder)) {\n return new TextDecoder(encoding, options);\n }\n encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;\n if (encoding !== DEFAULT_ENCODING) {\n throw new Error('Encoding not supported. Only utf-8 is supported');\n }\n options = ToDictionary(options);\n\n /** @private @type {boolean} */\n this._streaming = false;\n /** @private @type {boolean} */\n this._BOMseen = false;\n /** @private @type {?Decoder} */\n this._decoder = null;\n /** @private @type {boolean} */\n this._fatal = Boolean(options['fatal']);\n /** @private @type {boolean} */\n this._ignoreBOM = Boolean(options['ignoreBOM']);\n\n Object.defineProperty(this, 'encoding', {value: 'utf-8'});\n Object.defineProperty(this, 'fatal', {value: this._fatal});\n Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});\n}\n\nTextDecoder.prototype = {\n /**\n * @param {ArrayBufferView=} input The buffer of bytes to decode.\n * @param {Object=} options\n * @return {string} The decoded string.\n */\n decode: function decode(input, options) {\n var bytes;\n if (typeof input === 'object' && input instanceof ArrayBuffer) {\n bytes = new Uint8Array(input);\n } else if (typeof input === 'object' && 'buffer' in input &&\n input.buffer instanceof ArrayBuffer) {\n bytes = new Uint8Array(input.buffer,\n input.byteOffset,\n input.byteLength);\n } else {\n bytes = new Uint8Array(0);\n }\n\n options = ToDictionary(options);\n\n if (!this._streaming) {\n this._decoder = new UTF8Decoder({fatal: this._fatal});\n this._BOMseen = false;\n }\n this._streaming = Boolean(options['stream']);\n\n var input_stream = new Stream(bytes);\n\n var code_points = [];\n\n /** @type {?(number|!Array.)} */\n var result;\n\n while (!input_stream.endOfStream()) {\n result = this._decoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (result === null)\n continue;\n if (Array.isArray(result))\n code_points.push.apply(code_points, /**@type {!Array.}*/(result));\n else\n code_points.push(result);\n }\n if (!this._streaming) {\n do {\n result = this._decoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (result === null)\n continue;\n if (Array.isArray(result))\n code_points.push.apply(code_points, /**@type {!Array.}*/(result));\n else\n code_points.push(result);\n } while (!input_stream.endOfStream());\n this._decoder = null;\n }\n\n if (code_points.length) {\n // If encoding is one of utf-8, utf-16be, and utf-16le, and\n // ignore BOM flag and BOM seen flag are unset, run these\n // subsubsteps:\n if (['utf-8'].indexOf(this.encoding) !== -1 &&\n !this._ignoreBOM && !this._BOMseen) {\n // If token is U+FEFF, set BOM seen flag.\n if (code_points[0] === 0xFEFF) {\n this._BOMseen = true;\n code_points.shift();\n } else {\n // Otherwise, if token is not end-of-stream, set BOM seen\n // flag and append token to output.\n this._BOMseen = true;\n }\n }\n }\n\n return codePointsToString(code_points);\n }\n};\n\n// 7.2 Interface TextEncoder\n\n/**\n * @constructor\n * @param {string=} encoding The label of the encoding;\n * defaults to 'utf-8'.\n * @param {Object=} options\n */\nfunction TextEncoder(encoding, options) {\n if (!(this instanceof TextEncoder))\n return new TextEncoder(encoding, options);\n encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;\n if (encoding !== DEFAULT_ENCODING) {\n throw new Error('Encoding not supported. Only utf-8 is supported');\n }\n options = ToDictionary(options);\n\n /** @private @type {boolean} */\n this._streaming = false;\n /** @private @type {?Encoder} */\n this._encoder = null;\n /** @private @type {{fatal: boolean}} */\n this._options = {fatal: Boolean(options['fatal'])};\n\n Object.defineProperty(this, 'encoding', {value: 'utf-8'});\n}\n\nTextEncoder.prototype = {\n /**\n * @param {string=} opt_string The string to encode.\n * @param {Object=} options\n * @return {Uint8Array} Encoded bytes, as a Uint8Array.\n */\n encode: function encode(opt_string, options) {\n opt_string = opt_string ? String(opt_string) : '';\n options = ToDictionary(options);\n\n // NOTE: This option is nonstandard. None of the encodings\n // permitted for encoding (i.e. UTF-8, UTF-16) are stateful,\n // so streaming is not necessary.\n if (!this._streaming)\n this._encoder = new UTF8Encoder(this._options);\n this._streaming = Boolean(options['stream']);\n\n var bytes = [];\n var input_stream = new Stream(stringToCodePoints(opt_string));\n /** @type {?(number|!Array.)} */\n var result;\n while (!input_stream.endOfStream()) {\n result = this._encoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (Array.isArray(result))\n bytes.push.apply(bytes, /**@type {!Array.}*/(result));\n else\n bytes.push(result);\n }\n if (!this._streaming) {\n while (true) {\n result = this._encoder.handler(input_stream, input_stream.read());\n if (result === finished)\n break;\n if (Array.isArray(result))\n bytes.push.apply(bytes, /**@type {!Array.}*/(result));\n else\n bytes.push(result);\n }\n this._encoder = null;\n }\n return new Uint8Array(bytes);\n }\n};\n\n//\n// 8. The encoding\n//\n\n// 8.1 utf-8\n\n/**\n * @constructor\n * @implements {Decoder}\n * @param {{fatal: boolean}} options\n */\nfunction UTF8Decoder(options) {\n var fatal = options.fatal;\n\n // utf-8's decoder's has an associated utf-8 code point, utf-8\n // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8\n // lower boundary (initially 0x80), and a utf-8 upper boundary\n // (initially 0xBF).\n var /** @type {number} */ utf8_code_point = 0,\n /** @type {number} */ utf8_bytes_seen = 0,\n /** @type {number} */ utf8_bytes_needed = 0,\n /** @type {number} */ utf8_lower_boundary = 0x80,\n /** @type {number} */ utf8_upper_boundary = 0xBF;\n\n /**\n * @param {Stream} stream The stream of bytes being decoded.\n * @param {number} bite The next byte read from the stream.\n * @return {?(number|!Array.)} The next code point(s)\n * decoded, or null if not enough data exists in the input\n * stream to decode a complete code point.\n */\n this.handler = function(stream, bite) {\n // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,\n // set utf-8 bytes needed to 0 and return error.\n if (bite === end_of_stream && utf8_bytes_needed !== 0) {\n utf8_bytes_needed = 0;\n return decoderError(fatal);\n }\n\n // 2. If byte is end-of-stream, return finished.\n if (bite === end_of_stream)\n return finished;\n\n // 3. If utf-8 bytes needed is 0, based on byte:\n if (utf8_bytes_needed === 0) {\n\n // 0x00 to 0x7F\n if (inRange(bite, 0x00, 0x7F)) {\n // Return a code point whose value is byte.\n return bite;\n }\n\n // 0xC2 to 0xDF\n if (inRange(bite, 0xC2, 0xDF)) {\n // Set utf-8 bytes needed to 1 and utf-8 code point to byte\n // − 0xC0.\n utf8_bytes_needed = 1;\n utf8_code_point = bite - 0xC0;\n }\n\n // 0xE0 to 0xEF\n else if (inRange(bite, 0xE0, 0xEF)) {\n // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.\n if (bite === 0xE0)\n utf8_lower_boundary = 0xA0;\n // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.\n if (bite === 0xED)\n utf8_upper_boundary = 0x9F;\n // 3. Set utf-8 bytes needed to 2 and utf-8 code point to\n // byte − 0xE0.\n utf8_bytes_needed = 2;\n utf8_code_point = bite - 0xE0;\n }\n\n // 0xF0 to 0xF4\n else if (inRange(bite, 0xF0, 0xF4)) {\n // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.\n if (bite === 0xF0)\n utf8_lower_boundary = 0x90;\n // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.\n if (bite === 0xF4)\n utf8_upper_boundary = 0x8F;\n // 3. Set utf-8 bytes needed to 3 and utf-8 code point to\n // byte − 0xF0.\n utf8_bytes_needed = 3;\n utf8_code_point = bite - 0xF0;\n }\n\n // Otherwise\n else {\n // Return error.\n return decoderError(fatal);\n }\n\n // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code\n // point to utf-8 code point << (6 × utf-8 bytes needed) and\n // return continue.\n utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed);\n return null;\n }\n\n // 4. If byte is not in the range utf-8 lower boundary to utf-8\n // upper boundary, run these substeps:\n if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {\n\n // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8\n // bytes seen to 0, set utf-8 lower boundary to 0x80, and set\n // utf-8 upper boundary to 0xBF.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 2. Prepend byte to stream.\n stream.prepend(bite);\n\n // 3. Return error.\n return decoderError(fatal);\n }\n\n // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary\n // to 0xBF.\n utf8_lower_boundary = 0x80;\n utf8_upper_boundary = 0xBF;\n\n // 6. Increase utf-8 bytes seen by one and set utf-8 code point\n // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes\n // needed − utf-8 bytes seen)).\n utf8_bytes_seen += 1;\n utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen));\n\n // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed,\n // continue.\n if (utf8_bytes_seen !== utf8_bytes_needed)\n return null;\n\n // 8. Let code point be utf-8 code point.\n var code_point = utf8_code_point;\n\n // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes\n // seen to 0.\n utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;\n\n // 10. Return a code point whose value is code point.\n return code_point;\n };\n}\n\n/**\n * @constructor\n * @implements {Encoder}\n * @param {{fatal: boolean}} options\n */\nfunction UTF8Encoder(options) {\n var fatal = options.fatal;\n /**\n * @param {Stream} stream Input stream.\n * @param {number} code_point Next code point read from the stream.\n * @return {(number|!Array.)} Byte(s) to emit.\n */\n this.handler = function(stream, code_point) {\n // 1. If code point is end-of-stream, return finished.\n if (code_point === end_of_stream)\n return finished;\n\n // 2. If code point is in the range U+0000 to U+007F, return a\n // byte whose value is code point.\n if (inRange(code_point, 0x0000, 0x007f))\n return code_point;\n\n // 3. Set count and offset based on the range code point is in:\n var count, offset;\n // U+0080 to U+07FF: 1 and 0xC0\n if (inRange(code_point, 0x0080, 0x07FF)) {\n count = 1;\n offset = 0xC0;\n }\n // U+0800 to U+FFFF: 2 and 0xE0\n else if (inRange(code_point, 0x0800, 0xFFFF)) {\n count = 2;\n offset = 0xE0;\n }\n // U+10000 to U+10FFFF: 3 and 0xF0\n else if (inRange(code_point, 0x10000, 0x10FFFF)) {\n count = 3;\n offset = 0xF0;\n }\n\n // 4.Let bytes be a byte sequence whose first byte is (code\n // point >> (6 × count)) + offset.\n var bytes = [(code_point >> (6 * count)) + offset];\n\n // 5. Run these substeps while count is greater than 0:\n while (count > 0) {\n\n // 1. Set temp to code point >> (6 × (count − 1)).\n var temp = code_point >> (6 * (count - 1));\n\n // 2. Append to bytes 0x80 | (temp & 0x3F).\n bytes.push(0x80 | (temp & 0x3F));\n\n // 3. Decrease count by one.\n count -= 1;\n }\n\n // 6. Return bytes bytes, in order.\n return bytes;\n };\n}\n\nexports.TextEncoder = TextEncoder;\nexports.TextDecoder = TextDecoder;","import { BaseError } from './base.js';\nexport class InvalidAddressError extends BaseError {\n constructor({ address }) {\n super(`Address \"${address}\" is invalid.`, {\n metaMessages: [\n '- Address must be a hex value of 20 bytes (40 hex characters).',\n '- Address must match its checksum counterpart.',\n ],\n name: 'InvalidAddressError',\n });\n }\n}\n//# sourceMappingURL=address.js.map","import { BaseError } from './base.js';\nexport class IntegerOutOfRangeError extends BaseError {\n constructor({ max, min, signed, size, value, }) {\n super(`Number \"${value}\" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' });\n }\n}\nexport class InvalidBytesBooleanError extends BaseError {\n constructor(bytes) {\n super(`Bytes value \"${bytes}\" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, {\n name: 'InvalidBytesBooleanError',\n });\n }\n}\nexport class InvalidHexBooleanError extends BaseError {\n constructor(hex) {\n super(`Hex value \"${hex}\" is not a valid boolean. The hex value must be \"0x0\" (false) or \"0x1\" (true).`, { name: 'InvalidHexBooleanError' });\n }\n}\nexport class InvalidHexValueError extends BaseError {\n constructor(value) {\n super(`Hex value \"${value}\" is an odd length (${value.length}). It must be an even length.`, { name: 'InvalidHexValueError' });\n }\n}\nexport class SizeOverflowError extends BaseError {\n constructor({ givenSize, maxSize }) {\n super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: 'SizeOverflowError' });\n }\n}\n//# sourceMappingURL=encoding.js.map","/**\n * SHA2-512 a.k.a. sha512 and sha384. It is slower than sha256 in js because u64 operations are slow.\n *\n * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and\n * [the paper on truncated SHA512/256](https://eprint.iacr.org/2010/548.pdf).\n * @module\n * @deprecated\n */\nimport { SHA384 as SHA384n, sha384 as sha384n, sha512_224 as sha512_224n, SHA512_224 as SHA512_224n, sha512_256 as sha512_256n, SHA512_256 as SHA512_256n, SHA512 as SHA512n, sha512 as sha512n, } from \"./sha2.js\";\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA512 = SHA512n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha512 = sha512n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA384 = SHA384n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha384 = sha384n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA512_224 = SHA512_224n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha512_224 = sha512_224n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA512_256 = SHA512_256n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha512_256 = sha512_256n;\n//# sourceMappingURL=sha512.js.map","import { BaseError } from './base.js';\nexport class NegativeOffsetError extends BaseError {\n constructor({ offset }) {\n super(`Offset \\`${offset}\\` cannot be negative.`, {\n name: 'NegativeOffsetError',\n });\n }\n}\nexport class PositionOutOfBoundsError extends BaseError {\n constructor({ length, position }) {\n super(`Position \\`${position}\\` is out of bounds (\\`0 < position < ${length}\\`).`, { name: 'PositionOutOfBoundsError' });\n }\n}\nexport class RecursiveReadLimitExceededError extends BaseError {\n constructor({ count, limit }) {\n super(`Recursive read limit of \\`${limit}\\` exceeded (recursive read count: \\`${count}\\`).`, { name: 'RecursiveReadLimitExceededError' });\n }\n}\n//# sourceMappingURL=cursor.js.map","import { NegativeOffsetError, PositionOutOfBoundsError, RecursiveReadLimitExceededError, } from '../errors/cursor.js';\nconst staticCursor = {\n bytes: new Uint8Array(),\n dataView: new DataView(new ArrayBuffer(0)),\n position: 0,\n positionReadCount: new Map(),\n recursiveReadCount: 0,\n recursiveReadLimit: Number.POSITIVE_INFINITY,\n assertReadLimit() {\n if (this.recursiveReadCount >= this.recursiveReadLimit)\n throw new RecursiveReadLimitExceededError({\n count: this.recursiveReadCount + 1,\n limit: this.recursiveReadLimit,\n });\n },\n assertPosition(position) {\n if (position < 0 || position > this.bytes.length - 1)\n throw new PositionOutOfBoundsError({\n length: this.bytes.length,\n position,\n });\n },\n decrementPosition(offset) {\n if (offset < 0)\n throw new NegativeOffsetError({ offset });\n const position = this.position - offset;\n this.assertPosition(position);\n this.position = position;\n },\n getReadCount(position) {\n return this.positionReadCount.get(position || this.position) || 0;\n },\n incrementPosition(offset) {\n if (offset < 0)\n throw new NegativeOffsetError({ offset });\n const position = this.position + offset;\n this.assertPosition(position);\n this.position = position;\n },\n inspectByte(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position);\n return this.bytes[position];\n },\n inspectBytes(length, position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + length - 1);\n return this.bytes.subarray(position, position + length);\n },\n inspectUint8(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position);\n return this.bytes[position];\n },\n inspectUint16(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 1);\n return this.dataView.getUint16(position);\n },\n inspectUint24(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 2);\n return ((this.dataView.getUint16(position) << 8) +\n this.dataView.getUint8(position + 2));\n },\n inspectUint32(position_) {\n const position = position_ ?? this.position;\n this.assertPosition(position + 3);\n return this.dataView.getUint32(position);\n },\n pushByte(byte) {\n this.assertPosition(this.position);\n this.bytes[this.position] = byte;\n this.position++;\n },\n pushBytes(bytes) {\n this.assertPosition(this.position + bytes.length - 1);\n this.bytes.set(bytes, this.position);\n this.position += bytes.length;\n },\n pushUint8(value) {\n this.assertPosition(this.position);\n this.bytes[this.position] = value;\n this.position++;\n },\n pushUint16(value) {\n this.assertPosition(this.position + 1);\n this.dataView.setUint16(this.position, value);\n this.position += 2;\n },\n pushUint24(value) {\n this.assertPosition(this.position + 2);\n this.dataView.setUint16(this.position, value >> 8);\n this.dataView.setUint8(this.position + 2, value & ~4294967040);\n this.position += 3;\n },\n pushUint32(value) {\n this.assertPosition(this.position + 3);\n this.dataView.setUint32(this.position, value);\n this.position += 4;\n },\n readByte() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectByte();\n this.position++;\n return value;\n },\n readBytes(length, size) {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectBytes(length);\n this.position += size ?? length;\n return value;\n },\n readUint8() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint8();\n this.position += 1;\n return value;\n },\n readUint16() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint16();\n this.position += 2;\n return value;\n },\n readUint24() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint24();\n this.position += 3;\n return value;\n },\n readUint32() {\n this.assertReadLimit();\n this._touch();\n const value = this.inspectUint32();\n this.position += 4;\n return value;\n },\n get remaining() {\n return this.bytes.length - this.position;\n },\n setPosition(position) {\n const oldPosition = this.position;\n this.assertPosition(position);\n this.position = position;\n return () => (this.position = oldPosition);\n },\n _touch() {\n if (this.recursiveReadLimit === Number.POSITIVE_INFINITY)\n return;\n const count = this.getReadCount();\n this.positionReadCount.set(this.position, count + 1);\n if (count > 0)\n this.recursiveReadCount++;\n },\n};\nexport function createCursor(bytes, { recursiveReadLimit = 8_192 } = {}) {\n const cursor = Object.create(staticCursor);\n cursor.bytes = bytes;\n cursor.dataView = new DataView(bytes.buffer ?? bytes, bytes.byteOffset, bytes.byteLength);\n cursor.positionReadCount = new Map();\n cursor.recursiveReadLimit = recursiveReadLimit;\n return cursor;\n}\n//# sourceMappingURL=cursor.js.map","import { InvalidAddressError } from '../../errors/address.js';\nimport { stringToBytes, } from '../encoding/toBytes.js';\nimport { keccak256 } from '../hash/keccak256.js';\nimport { LruMap } from '../lru.js';\nimport { isAddress } from './isAddress.js';\nconst checksumAddressCache = /*#__PURE__*/ new LruMap(8192);\nexport function checksumAddress(address_, \n/**\n * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the\n * wider Ethereum ecosystem, meaning it will break when validated against an application/tool\n * that relies on EIP-55 checksum encoding (checksum without chainId).\n *\n * It is highly recommended to not use this feature unless you\n * know what you are doing.\n *\n * See more: https://github.com/ethereum/EIPs/issues/1121\n */\nchainId) {\n if (checksumAddressCache.has(`${address_}.${chainId}`))\n return checksumAddressCache.get(`${address_}.${chainId}`);\n const hexAddress = chainId\n ? `${chainId}${address_.toLowerCase()}`\n : address_.substring(2).toLowerCase();\n const hash = keccak256(stringToBytes(hexAddress), 'bytes');\n const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split('');\n for (let i = 0; i < 40; i += 2) {\n if (hash[i >> 1] >> 4 >= 8 && address[i]) {\n address[i] = address[i].toUpperCase();\n }\n if ((hash[i >> 1] & 0x0f) >= 8 && address[i + 1]) {\n address[i + 1] = address[i + 1].toUpperCase();\n }\n }\n const result = `0x${address.join('')}`;\n checksumAddressCache.set(`${address_}.${chainId}`, result);\n return result;\n}\nexport function getAddress(address, \n/**\n * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the\n * wider Ethereum ecosystem, meaning it will break when validated against an application/tool\n * that relies on EIP-55 checksum encoding (checksum without chainId).\n *\n * It is highly recommended to not use this feature unless you\n * know what you are doing.\n *\n * See more: https://github.com/ethereum/EIPs/issues/1121\n */\nchainId) {\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n return checksumAddress(address, chainId);\n}\n//# sourceMappingURL=getAddress.js.map","import { BaseError } from '../../errors/base.js';\nimport { isHex } from '../data/isHex.js';\nimport { pad } from '../data/pad.js';\nimport { assertSize } from './fromHex.js';\nimport { numberToHex, } from './toHex.js';\nconst encoder = /*#__PURE__*/ new TextEncoder();\n/**\n * Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes\n * - Example: https://viem.sh/docs/utilities/toBytes#usage\n *\n * @param value Value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes('Hello world')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { toBytes } from 'viem'\n * const data = toBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function toBytes(value, opts = {}) {\n if (typeof value === 'number' || typeof value === 'bigint')\n return numberToBytes(value, opts);\n if (typeof value === 'boolean')\n return boolToBytes(value, opts);\n if (isHex(value))\n return hexToBytes(value, opts);\n return stringToBytes(value, opts);\n}\n/**\n * Encodes a boolean into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#booltobytes\n *\n * @param value Boolean value to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true)\n * // Uint8Array([1])\n *\n * @example\n * import { boolToBytes } from 'viem'\n * const data = boolToBytes(true, { size: 32 })\n * // Uint8Array([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, 0, 1])\n */\nexport function boolToBytes(value, opts = {}) {\n const bytes = new Uint8Array(1);\n bytes[0] = Number(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { size: opts.size });\n }\n return bytes;\n}\n// We use very optimized technique to convert hex string to byte array\nconst charCodeMap = {\n zero: 48,\n nine: 57,\n A: 65,\n F: 70,\n a: 97,\n f: 102,\n};\nfunction charCodeToBase16(char) {\n if (char >= charCodeMap.zero && char <= charCodeMap.nine)\n return char - charCodeMap.zero;\n if (char >= charCodeMap.A && char <= charCodeMap.F)\n return char - (charCodeMap.A - 10);\n if (char >= charCodeMap.a && char <= charCodeMap.f)\n return char - (charCodeMap.a - 10);\n return undefined;\n}\n/**\n * Encodes a hex string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#hextobytes\n *\n * @param hex Hex string to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33])\n *\n * @example\n * import { hexToBytes } from 'viem'\n * const data = hexToBytes('0x48656c6c6f20776f726c6421', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function hexToBytes(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = pad(hex, { dir: 'right', size: opts.size });\n }\n let hexString = hex.slice(2);\n if (hexString.length % 2)\n hexString = `0${hexString}`;\n const length = hexString.length / 2;\n const bytes = new Uint8Array(length);\n for (let index = 0, j = 0; index < length; index++) {\n const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++));\n const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++));\n if (nibbleLeft === undefined || nibbleRight === undefined) {\n throw new BaseError(`Invalid byte sequence (\"${hexString[j - 2]}${hexString[j - 1]}\" in \"${hexString}\").`);\n }\n bytes[index] = nibbleLeft * 16 + nibbleRight;\n }\n return bytes;\n}\n/**\n * Encodes a number into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#numbertobytes\n *\n * @param value Number to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420)\n * // Uint8Array([1, 164])\n *\n * @example\n * import { numberToBytes } from 'viem'\n * const data = numberToBytes(420, { size: 4 })\n * // Uint8Array([0, 0, 1, 164])\n */\nexport function numberToBytes(value, opts) {\n const hex = numberToHex(value, opts);\n return hexToBytes(hex);\n}\n/**\n * Encodes a UTF-8 string into a byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/toBytes#stringtobytes\n *\n * @param value String to encode.\n * @param opts Options.\n * @returns Byte array value.\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!')\n * // Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33])\n *\n * @example\n * import { stringToBytes } from 'viem'\n * const data = stringToBytes('Hello world!', { size: 32 })\n * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])\n */\nexport function stringToBytes(value, opts = {}) {\n const bytes = encoder.encode(value);\n if (typeof opts.size === 'number') {\n assertSize(bytes, { size: opts.size });\n return pad(bytes, { dir: 'right', size: opts.size });\n }\n return bytes;\n}\n//# sourceMappingURL=toBytes.js.map","import { isHex } from './isHex.js';\n/**\n * @description Retrieves the size of the value (in bytes).\n *\n * @param value The value (hex or byte array) to retrieve the size of.\n * @returns The size of the value (in bytes).\n */\nexport function size(value) {\n if (isHex(value, { strict: false }))\n return Math.ceil((value.length - 2) / 2);\n return value.length;\n}\n//# sourceMappingURL=size.js.map","'use strict'\n// base-x encoding / decoding\n// Copyright (c) 2018 base-x contributors\n// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)\n// Distributed under the MIT software license, see the accompanying\n// file LICENSE or http://www.opensource.org/licenses/mit-license.php.\n// @ts-ignore\nvar _Buffer = require('safe-buffer').Buffer\nfunction base (ALPHABET) {\n if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }\n var BASE_MAP = new Uint8Array(256)\n for (var j = 0; j < BASE_MAP.length; j++) {\n BASE_MAP[j] = 255\n }\n for (var i = 0; i < ALPHABET.length; i++) {\n var x = ALPHABET.charAt(i)\n var xc = x.charCodeAt(0)\n if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }\n BASE_MAP[xc] = i\n }\n var BASE = ALPHABET.length\n var LEADER = ALPHABET.charAt(0)\n var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up\n var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up\n function encode (source) {\n if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source) }\n if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }\n if (source.length === 0) { return '' }\n // Skip & count leading zeroes.\n var zeroes = 0\n var length = 0\n var pbegin = 0\n var pend = source.length\n while (pbegin !== pend && source[pbegin] === 0) {\n pbegin++\n zeroes++\n }\n // Allocate enough space in big-endian base58 representation.\n var size = ((pend - pbegin) * iFACTOR + 1) >>> 0\n var b58 = new Uint8Array(size)\n // Process the bytes.\n while (pbegin !== pend) {\n var carry = source[pbegin]\n // Apply \"b58 = b58 * 256 + ch\".\n var i = 0\n for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {\n carry += (256 * b58[it1]) >>> 0\n b58[it1] = (carry % BASE) >>> 0\n carry = (carry / BASE) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n pbegin++\n }\n // Skip leading zeroes in base58 result.\n var it2 = size - length\n while (it2 !== size && b58[it2] === 0) {\n it2++\n }\n // Translate the result into a string.\n var str = LEADER.repeat(zeroes)\n for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) }\n return str\n }\n function decodeUnsafe (source) {\n if (typeof source !== 'string') { throw new TypeError('Expected String') }\n if (source.length === 0) { return _Buffer.alloc(0) }\n var psz = 0\n // Skip and count leading '1's.\n var zeroes = 0\n var length = 0\n while (source[psz] === LEADER) {\n zeroes++\n psz++\n }\n // Allocate enough space in big-endian base256 representation.\n var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up.\n var b256 = new Uint8Array(size)\n // Process the characters.\n while (psz < source.length) {\n // Find code of next character\n var charCode = source.charCodeAt(psz)\n // Base map can not be indexed using char code\n if (charCode > 255) { return }\n // Decode character\n var carry = BASE_MAP[charCode]\n // Invalid character\n if (carry === 255) { return }\n var i = 0\n for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {\n carry += (BASE * b256[it3]) >>> 0\n b256[it3] = (carry % 256) >>> 0\n carry = (carry / 256) >>> 0\n }\n if (carry !== 0) { throw new Error('Non-zero carry') }\n length = i\n psz++\n }\n // Skip leading zeroes in b256.\n var it4 = size - length\n while (it4 !== size && b256[it4] === 0) {\n it4++\n }\n var vch = _Buffer.allocUnsafe(zeroes + (size - it4))\n vch.fill(0x00, 0, zeroes)\n var j = zeroes\n while (it4 !== size) {\n vch[j++] = b256[it4++]\n }\n return vch\n }\n function decode (string) {\n var buffer = decodeUnsafe(string)\n if (buffer) { return buffer }\n throw new Error('Non-base' + BASE + ' character')\n }\n return {\n encode: encode,\n decodeUnsafe: decodeUnsafe,\n decode: decode\n }\n}\nmodule.exports = base\n","import { formatEther } from '../utils/unit/formatEther.js';\nimport { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nexport function prettyPrint(args) {\n const entries = Object.entries(args)\n .map(([key, value]) => {\n if (value === undefined || value === false)\n return null;\n return [key, value];\n })\n .filter(Boolean);\n const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);\n return entries\n .map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`)\n .join('\\n');\n}\nexport class FeeConflictError extends BaseError {\n constructor() {\n super([\n 'Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.',\n 'Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.',\n ].join('\\n'), { name: 'FeeConflictError' });\n }\n}\nexport class InvalidLegacyVError extends BaseError {\n constructor({ v }) {\n super(`Invalid \\`v\\` value \"${v}\". Expected 27 or 28.`, {\n name: 'InvalidLegacyVError',\n });\n }\n}\nexport class InvalidSerializableTransactionError extends BaseError {\n constructor({ transaction }) {\n super('Cannot infer a transaction type from provided transaction.', {\n metaMessages: [\n 'Provided Transaction:',\n '{',\n prettyPrint(transaction),\n '}',\n '',\n 'To infer the type, either provide:',\n '- a `type` to the Transaction, or',\n '- an EIP-1559 Transaction with `maxFeePerGas`, or',\n '- an EIP-2930 Transaction with `gasPrice` & `accessList`, or',\n '- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or',\n '- an EIP-7702 Transaction with `authorizationList`, or',\n '- a Legacy Transaction with `gasPrice`',\n ],\n name: 'InvalidSerializableTransactionError',\n });\n }\n}\nexport class InvalidSerializedTransactionTypeError extends BaseError {\n constructor({ serializedType }) {\n super(`Serialized transaction type \"${serializedType}\" is invalid.`, {\n name: 'InvalidSerializedTransactionType',\n });\n Object.defineProperty(this, \"serializedType\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.serializedType = serializedType;\n }\n}\nexport class InvalidSerializedTransactionError extends BaseError {\n constructor({ attributes, serializedTransaction, type, }) {\n const missing = Object.entries(attributes)\n .map(([key, value]) => (typeof value === 'undefined' ? key : undefined))\n .filter(Boolean);\n super(`Invalid serialized transaction of type \"${type}\" was provided.`, {\n metaMessages: [\n `Serialized Transaction: \"${serializedTransaction}\"`,\n missing.length > 0 ? `Missing Attributes: ${missing.join(', ')}` : '',\n ].filter(Boolean),\n name: 'InvalidSerializedTransactionError',\n });\n Object.defineProperty(this, \"serializedTransaction\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"type\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.serializedTransaction = serializedTransaction;\n this.type = type;\n }\n}\nexport class InvalidStorageKeySizeError extends BaseError {\n constructor({ storageKey }) {\n super(`Size for storage key \"${storageKey}\" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: 'InvalidStorageKeySizeError' });\n }\n}\nexport class TransactionExecutionError extends BaseError {\n constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, }) {\n const prettyArgs = prettyPrint({\n chain: chain && `${chain?.name} (id: ${chain?.id})`,\n from: account?.address,\n to,\n value: typeof value !== 'undefined' &&\n `${formatEther(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`,\n data,\n gas,\n gasPrice: typeof gasPrice !== 'undefined' && `${formatGwei(gasPrice)} gwei`,\n maxFeePerGas: typeof maxFeePerGas !== 'undefined' &&\n `${formatGwei(maxFeePerGas)} gwei`,\n maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' &&\n `${formatGwei(maxPriorityFeePerGas)} gwei`,\n nonce,\n });\n super(cause.shortMessage, {\n cause,\n docsPath,\n metaMessages: [\n ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []),\n 'Request Arguments:',\n prettyArgs,\n ].filter(Boolean),\n name: 'TransactionExecutionError',\n });\n Object.defineProperty(this, \"cause\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.cause = cause;\n }\n}\nexport class TransactionNotFoundError extends BaseError {\n constructor({ blockHash, blockNumber, blockTag, hash, index, }) {\n let identifier = 'Transaction';\n if (blockTag && index !== undefined)\n identifier = `Transaction at block time \"${blockTag}\" at index \"${index}\"`;\n if (blockHash && index !== undefined)\n identifier = `Transaction at block hash \"${blockHash}\" at index \"${index}\"`;\n if (blockNumber && index !== undefined)\n identifier = `Transaction at block number \"${blockNumber}\" at index \"${index}\"`;\n if (hash)\n identifier = `Transaction with hash \"${hash}\"`;\n super(`${identifier} could not be found.`, {\n name: 'TransactionNotFoundError',\n });\n }\n}\nexport class TransactionReceiptNotFoundError extends BaseError {\n constructor({ hash }) {\n super(`Transaction receipt with hash \"${hash}\" could not be found. The Transaction may not be processed on a block yet.`, {\n name: 'TransactionReceiptNotFoundError',\n });\n }\n}\nexport class TransactionReceiptRevertedError extends BaseError {\n constructor({ receipt }) {\n super(`Transaction with hash \"${receipt.transactionHash}\" reverted.`, {\n metaMessages: [\n 'The receipt marked the transaction as \"reverted\". This could mean that the function on the contract you are trying to call threw an error.',\n ' ',\n 'You can attempt to extract the revert reason by:',\n '- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract',\n '- using the `call` Action with raw `data`',\n ],\n name: 'TransactionReceiptRevertedError',\n });\n Object.defineProperty(this, \"receipt\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.receipt = receipt;\n }\n}\nexport class WaitForTransactionReceiptTimeoutError extends BaseError {\n constructor({ hash }) {\n super(`Timed out while waiting for transaction with hash \"${hash}\" to be confirmed.`, { name: 'WaitForTransactionReceiptTimeoutError' });\n }\n}\n//# sourceMappingURL=transaction.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = rng;\n// Unique ID creation requires a high quality random # generator. In the browser we therefore\n// require the crypto API and do not support built-in fallback to lower quality random number\n// generators (like Math.random()).\nlet getRandomValues;\nconst rnds8 = new Uint8Array(16);\n\nfunction rng() {\n // lazy load so that environments that need to polyfill have a chance to do so\n if (!getRandomValues) {\n // getRandomValues needs to be invoked in a context where \"this\" is a Crypto implementation. Also,\n // find the complete implementation of crypto (msCrypto) on IE11.\n getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);\n\n if (!getRandomValues) {\n throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');\n }\n }\n\n return getRandomValues(rnds8);\n}","import { BaseError } from '../../errors/base.js';\nimport { InvalidHexValueError, } from '../../errors/encoding.js';\nimport { createCursor, } from '../cursor.js';\nimport { hexToBytes } from './toBytes.js';\nimport { bytesToHex } from './toHex.js';\nexport function fromRlp(value, to = 'hex') {\n const bytes = (() => {\n if (typeof value === 'string') {\n if (value.length > 3 && value.length % 2 !== 0)\n throw new InvalidHexValueError(value);\n return hexToBytes(value);\n }\n return value;\n })();\n const cursor = createCursor(bytes, {\n recursiveReadLimit: Number.POSITIVE_INFINITY,\n });\n const result = fromRlpCursor(cursor, to);\n return result;\n}\nfunction fromRlpCursor(cursor, to = 'hex') {\n if (cursor.bytes.length === 0)\n return (to === 'hex' ? bytesToHex(cursor.bytes) : cursor.bytes);\n const prefix = cursor.readByte();\n if (prefix < 0x80)\n cursor.decrementPosition(1);\n // bytes\n if (prefix < 0xc0) {\n const length = readLength(cursor, prefix, 0x80);\n const bytes = cursor.readBytes(length);\n return (to === 'hex' ? bytesToHex(bytes) : bytes);\n }\n // list\n const length = readLength(cursor, prefix, 0xc0);\n return readList(cursor, length, to);\n}\nfunction readLength(cursor, prefix, offset) {\n if (offset === 0x80 && prefix < 0x80)\n return 1;\n if (prefix <= offset + 55)\n return prefix - offset;\n if (prefix === offset + 55 + 1)\n return cursor.readUint8();\n if (prefix === offset + 55 + 2)\n return cursor.readUint16();\n if (prefix === offset + 55 + 3)\n return cursor.readUint24();\n if (prefix === offset + 55 + 4)\n return cursor.readUint32();\n throw new BaseError('Invalid RLP prefix');\n}\nfunction readList(cursor, length, to) {\n const position = cursor.position;\n const value = [];\n while (cursor.position - position < length)\n value.push(fromRlpCursor(cursor, to));\n return value;\n}\n//# sourceMappingURL=fromRlp.js.map","import { InvalidAddressError, } from '../../errors/address.js';\nimport { InvalidLegacyVError, InvalidSerializedTransactionError, } from '../../errors/transaction.js';\nimport { isAddress } from '../address/isAddress.js';\nimport { toBlobSidecars } from '../blob/toBlobSidecars.js';\nimport { isHex } from '../data/isHex.js';\nimport { padHex } from '../data/pad.js';\nimport { trim } from '../data/trim.js';\nimport { hexToBigInt, hexToNumber, } from '../encoding/fromHex.js';\nimport { fromRlp } from '../encoding/fromRlp.js';\nimport { isHash } from '../hash/isHash.js';\nimport { assertTransactionEIP1559, assertTransactionEIP2930, assertTransactionEIP4844, assertTransactionEIP7702, assertTransactionLegacy, } from './assertTransaction.js';\nimport { getSerializedTransactionType, } from './getSerializedTransactionType.js';\nexport function parseTransaction(serializedTransaction) {\n const type = getSerializedTransactionType(serializedTransaction);\n if (type === 'eip1559')\n return parseTransactionEIP1559(serializedTransaction);\n if (type === 'eip2930')\n return parseTransactionEIP2930(serializedTransaction);\n if (type === 'eip4844')\n return parseTransactionEIP4844(serializedTransaction);\n if (type === 'eip7702')\n return parseTransactionEIP7702(serializedTransaction);\n return parseTransactionLegacy(serializedTransaction);\n}\nfunction parseTransactionEIP7702(serializedTransaction) {\n const transactionArray = toTransactionArray(serializedTransaction);\n const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, authorizationList, v, r, s,] = transactionArray;\n if (transactionArray.length !== 10 && transactionArray.length !== 13)\n throw new InvalidSerializedTransactionError({\n attributes: {\n chainId,\n nonce,\n maxPriorityFeePerGas,\n maxFeePerGas,\n gas,\n to,\n value,\n data,\n accessList,\n authorizationList,\n ...(transactionArray.length > 9\n ? {\n v,\n r,\n s,\n }\n : {}),\n },\n serializedTransaction,\n type: 'eip7702',\n });\n const transaction = {\n chainId: hexToNumber(chainId),\n type: 'eip7702',\n };\n if (isHex(to) && to !== '0x')\n transaction.to = to;\n if (isHex(gas) && gas !== '0x')\n transaction.gas = hexToBigInt(gas);\n if (isHex(data) && data !== '0x')\n transaction.data = data;\n if (isHex(nonce))\n transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce);\n if (isHex(value) && value !== '0x')\n transaction.value = hexToBigInt(value);\n if (isHex(maxFeePerGas) && maxFeePerGas !== '0x')\n transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);\n if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== '0x')\n transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);\n if (accessList.length !== 0 && accessList !== '0x')\n transaction.accessList = parseAccessList(accessList);\n if (authorizationList.length !== 0 && authorizationList !== '0x')\n transaction.authorizationList = parseAuthorizationList(authorizationList);\n assertTransactionEIP7702(transaction);\n const signature = transactionArray.length === 13\n ? parseEIP155Signature(transactionArray)\n : undefined;\n return { ...signature, ...transaction };\n}\nfunction parseTransactionEIP4844(serializedTransaction) {\n const transactionOrWrapperArray = toTransactionArray(serializedTransaction);\n const hasNetworkWrapper = transactionOrWrapperArray.length === 4;\n const transactionArray = hasNetworkWrapper\n ? transactionOrWrapperArray[0]\n : transactionOrWrapperArray;\n const wrapperArray = hasNetworkWrapper\n ? transactionOrWrapperArray.slice(1)\n : [];\n const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, maxFeePerBlobGas, blobVersionedHashes, v, r, s,] = transactionArray;\n const [blobs, commitments, proofs] = wrapperArray;\n if (!(transactionArray.length === 11 || transactionArray.length === 14))\n throw new InvalidSerializedTransactionError({\n attributes: {\n chainId,\n nonce,\n maxPriorityFeePerGas,\n maxFeePerGas,\n gas,\n to,\n value,\n data,\n accessList,\n ...(transactionArray.length > 9\n ? {\n v,\n r,\n s,\n }\n : {}),\n },\n serializedTransaction,\n type: 'eip4844',\n });\n const transaction = {\n blobVersionedHashes: blobVersionedHashes,\n chainId: hexToNumber(chainId),\n to,\n type: 'eip4844',\n };\n if (isHex(gas) && gas !== '0x')\n transaction.gas = hexToBigInt(gas);\n if (isHex(data) && data !== '0x')\n transaction.data = data;\n if (isHex(nonce))\n transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce);\n if (isHex(value) && value !== '0x')\n transaction.value = hexToBigInt(value);\n if (isHex(maxFeePerBlobGas) && maxFeePerBlobGas !== '0x')\n transaction.maxFeePerBlobGas = hexToBigInt(maxFeePerBlobGas);\n if (isHex(maxFeePerGas) && maxFeePerGas !== '0x')\n transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);\n if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== '0x')\n transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);\n if (accessList.length !== 0 && accessList !== '0x')\n transaction.accessList = parseAccessList(accessList);\n if (blobs && commitments && proofs)\n transaction.sidecars = toBlobSidecars({\n blobs: blobs,\n commitments: commitments,\n proofs: proofs,\n });\n assertTransactionEIP4844(transaction);\n const signature = transactionArray.length === 14\n ? parseEIP155Signature(transactionArray)\n : undefined;\n return { ...signature, ...transaction };\n}\nfunction parseTransactionEIP1559(serializedTransaction) {\n const transactionArray = toTransactionArray(serializedTransaction);\n const [chainId, nonce, maxPriorityFeePerGas, maxFeePerGas, gas, to, value, data, accessList, v, r, s,] = transactionArray;\n if (!(transactionArray.length === 9 || transactionArray.length === 12))\n throw new InvalidSerializedTransactionError({\n attributes: {\n chainId,\n nonce,\n maxPriorityFeePerGas,\n maxFeePerGas,\n gas,\n to,\n value,\n data,\n accessList,\n ...(transactionArray.length > 9\n ? {\n v,\n r,\n s,\n }\n : {}),\n },\n serializedTransaction,\n type: 'eip1559',\n });\n const transaction = {\n chainId: hexToNumber(chainId),\n type: 'eip1559',\n };\n if (isHex(to) && to !== '0x')\n transaction.to = to;\n if (isHex(gas) && gas !== '0x')\n transaction.gas = hexToBigInt(gas);\n if (isHex(data) && data !== '0x')\n transaction.data = data;\n if (isHex(nonce))\n transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce);\n if (isHex(value) && value !== '0x')\n transaction.value = hexToBigInt(value);\n if (isHex(maxFeePerGas) && maxFeePerGas !== '0x')\n transaction.maxFeePerGas = hexToBigInt(maxFeePerGas);\n if (isHex(maxPriorityFeePerGas) && maxPriorityFeePerGas !== '0x')\n transaction.maxPriorityFeePerGas = hexToBigInt(maxPriorityFeePerGas);\n if (accessList.length !== 0 && accessList !== '0x')\n transaction.accessList = parseAccessList(accessList);\n assertTransactionEIP1559(transaction);\n const signature = transactionArray.length === 12\n ? parseEIP155Signature(transactionArray)\n : undefined;\n return { ...signature, ...transaction };\n}\nfunction parseTransactionEIP2930(serializedTransaction) {\n const transactionArray = toTransactionArray(serializedTransaction);\n const [chainId, nonce, gasPrice, gas, to, value, data, accessList, v, r, s] = transactionArray;\n if (!(transactionArray.length === 8 || transactionArray.length === 11))\n throw new InvalidSerializedTransactionError({\n attributes: {\n chainId,\n nonce,\n gasPrice,\n gas,\n to,\n value,\n data,\n accessList,\n ...(transactionArray.length > 8\n ? {\n v,\n r,\n s,\n }\n : {}),\n },\n serializedTransaction,\n type: 'eip2930',\n });\n const transaction = {\n chainId: hexToNumber(chainId),\n type: 'eip2930',\n };\n if (isHex(to) && to !== '0x')\n transaction.to = to;\n if (isHex(gas) && gas !== '0x')\n transaction.gas = hexToBigInt(gas);\n if (isHex(data) && data !== '0x')\n transaction.data = data;\n if (isHex(nonce))\n transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce);\n if (isHex(value) && value !== '0x')\n transaction.value = hexToBigInt(value);\n if (isHex(gasPrice) && gasPrice !== '0x')\n transaction.gasPrice = hexToBigInt(gasPrice);\n if (accessList.length !== 0 && accessList !== '0x')\n transaction.accessList = parseAccessList(accessList);\n assertTransactionEIP2930(transaction);\n const signature = transactionArray.length === 11\n ? parseEIP155Signature(transactionArray)\n : undefined;\n return { ...signature, ...transaction };\n}\nfunction parseTransactionLegacy(serializedTransaction) {\n const transactionArray = fromRlp(serializedTransaction, 'hex');\n const [nonce, gasPrice, gas, to, value, data, chainIdOrV_, r, s] = transactionArray;\n if (!(transactionArray.length === 6 || transactionArray.length === 9))\n throw new InvalidSerializedTransactionError({\n attributes: {\n nonce,\n gasPrice,\n gas,\n to,\n value,\n data,\n ...(transactionArray.length > 6\n ? {\n v: chainIdOrV_,\n r,\n s,\n }\n : {}),\n },\n serializedTransaction,\n type: 'legacy',\n });\n const transaction = {\n type: 'legacy',\n };\n if (isHex(to) && to !== '0x')\n transaction.to = to;\n if (isHex(gas) && gas !== '0x')\n transaction.gas = hexToBigInt(gas);\n if (isHex(data) && data !== '0x')\n transaction.data = data;\n if (isHex(nonce))\n transaction.nonce = nonce === '0x' ? 0 : hexToNumber(nonce);\n if (isHex(value) && value !== '0x')\n transaction.value = hexToBigInt(value);\n if (isHex(gasPrice) && gasPrice !== '0x')\n transaction.gasPrice = hexToBigInt(gasPrice);\n assertTransactionLegacy(transaction);\n if (transactionArray.length === 6)\n return transaction;\n const chainIdOrV = isHex(chainIdOrV_) && chainIdOrV_ !== '0x'\n ? hexToBigInt(chainIdOrV_)\n : 0n;\n if (s === '0x' && r === '0x') {\n if (chainIdOrV > 0)\n transaction.chainId = Number(chainIdOrV);\n return transaction;\n }\n const v = chainIdOrV;\n const chainId = Number((v - 35n) / 2n);\n if (chainId > 0)\n transaction.chainId = chainId;\n else if (v !== 27n && v !== 28n)\n throw new InvalidLegacyVError({ v });\n transaction.v = v;\n transaction.s = s;\n transaction.r = r;\n transaction.yParity = v % 2n === 0n ? 1 : 0;\n return transaction;\n}\nexport function toTransactionArray(serializedTransaction) {\n return fromRlp(`0x${serializedTransaction.slice(4)}`, 'hex');\n}\nexport function parseAccessList(accessList_) {\n const accessList = [];\n for (let i = 0; i < accessList_.length; i++) {\n const [address, storageKeys] = accessList_[i];\n if (!isAddress(address, { strict: false }))\n throw new InvalidAddressError({ address });\n accessList.push({\n address: address,\n storageKeys: storageKeys.map((key) => (isHash(key) ? key : trim(key))),\n });\n }\n return accessList;\n}\nfunction parseAuthorizationList(serializedAuthorizationList) {\n const authorizationList = [];\n for (let i = 0; i < serializedAuthorizationList.length; i++) {\n const [chainId, address, nonce, yParity, r, s] = serializedAuthorizationList[i];\n authorizationList.push({\n address,\n chainId: chainId === '0x' ? 0 : hexToNumber(chainId),\n nonce: nonce === '0x' ? 0 : hexToNumber(nonce),\n ...parseEIP155Signature([yParity, r, s]),\n });\n }\n return authorizationList;\n}\nfunction parseEIP155Signature(transactionArray) {\n const signature = transactionArray.slice(-3);\n const v = signature[0] === '0x' || hexToBigInt(signature[0]) === 0n ? 27n : 28n;\n return {\n r: padHex(signature[1], { size: 32 }),\n s: padHex(signature[2], { size: 32 }),\n v,\n yParity: v === 27n ? 0 : 1,\n };\n}\n//# sourceMappingURL=parseTransaction.js.map","import { InvalidSerializedTransactionTypeError, } from '../../errors/transaction.js';\nimport { sliceHex } from '../data/slice.js';\nimport { hexToNumber } from '../encoding/fromHex.js';\nexport function getSerializedTransactionType(serializedTransaction) {\n const serializedType = sliceHex(serializedTransaction, 0, 1);\n if (serializedType === '0x04')\n return 'eip7702';\n if (serializedType === '0x03')\n return 'eip4844';\n if (serializedType === '0x02')\n return 'eip1559';\n if (serializedType === '0x01')\n return 'eip2930';\n if (serializedType !== '0x' && hexToNumber(serializedType) >= 0xc0)\n return 'legacy';\n throw new InvalidSerializedTransactionTypeError({ serializedType });\n}\n//# sourceMappingURL=getSerializedTransactionType.js.map","import { isHex } from '../data/isHex.js';\nimport { size } from '../data/size.js';\nexport function isHash(hash) {\n return isHex(hash) && size(hash) === 32;\n}\n//# sourceMappingURL=isHash.js.map","// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md#parameters\nexport const versionedHashVersionKzg = 1;\n//# sourceMappingURL=kzg.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\nvar _default = '00000000-0000-0000-0000-000000000000';\nexports.default = _default;","export function isHex(value, { strict = true } = {}) {\n if (!value)\n return false;\n if (typeof value !== 'string')\n return false;\n return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith('0x');\n}\n//# sourceMappingURL=isHex.js.map","import { BaseError } from './base.js';\nexport class SliceOffsetOutOfBoundsError extends BaseError {\n constructor({ offset, position, size, }) {\n super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset \"${offset}\" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' });\n }\n}\nexport class SizeExceedsPaddingSizeError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' });\n }\n}\nexport class InvalidBytesLengthError extends BaseError {\n constructor({ size, targetSize, type, }) {\n super(`${type.charAt(0).toUpperCase()}${type\n .slice(1)\n .toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size} ${type} long.`, { name: 'InvalidBytesLengthError' });\n }\n}\n//# sourceMappingURL=data.js.map","/**\n * Map with a LRU (Least recently used) policy.\n *\n * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU\n */\nexport class LruMap extends Map {\n constructor(size) {\n super();\n Object.defineProperty(this, \"maxSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.maxSize = size;\n }\n get(key) {\n const value = super.get(key);\n if (super.has(key) && value !== undefined) {\n this.delete(key);\n super.set(key, value);\n }\n return value;\n }\n set(key, value) {\n super.set(key, value);\n if (this.maxSize && this.size > this.maxSize) {\n const firstKey = this.keys().next().value;\n if (firstKey)\n this.delete(firstKey);\n }\n return this;\n }\n}\n//# sourceMappingURL=lru.js.map","import { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Compute commitments from a list of blobs.\n *\n * @example\n * ```ts\n * import { blobsToCommitments, toBlobs } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * ```\n */\nexport function blobsToCommitments(parameters) {\n const { kzg } = parameters;\n const to = parameters.to ?? (typeof parameters.blobs[0] === 'string' ? 'hex' : 'bytes');\n const blobs = (typeof parameters.blobs[0] === 'string'\n ? parameters.blobs.map((x) => hexToBytes(x))\n : parameters.blobs);\n const commitments = [];\n for (const blob of blobs)\n commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob)));\n return (to === 'bytes'\n ? commitments\n : commitments.map((x) => bytesToHex(x)));\n}\n//# sourceMappingURL=blobsToCommitments.js.map","// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md#parameters\n/** Blob limit per transaction. */\nconst blobsPerTransaction = 6;\n/** The number of bytes in a BLS scalar field element. */\nexport const bytesPerFieldElement = 32;\n/** The number of field elements in a blob. */\nexport const fieldElementsPerBlob = 4096;\n/** The number of bytes in a blob. */\nexport const bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob;\n/** Blob bytes limit per transaction. */\nexport const maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction -\n // terminator byte (0x80).\n 1 -\n // zero byte (0x00) appended to each field element.\n 1 * fieldElementsPerBlob * blobsPerTransaction;\n//# sourceMappingURL=blob.js.map","import { blobsToCommitments, } from './blobsToCommitments.js';\nimport { blobsToProofs } from './blobsToProofs.js';\nimport { toBlobs } from './toBlobs.js';\n/**\n * Transforms arbitrary data (or blobs, commitments, & proofs) into a sidecar array.\n *\n * @example\n * ```ts\n * import { toBlobSidecars, stringToHex } from 'viem'\n *\n * const sidecars = toBlobSidecars({ data: stringToHex('hello world') })\n * ```\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * toBlobs,\n * blobsToProofs,\n * toBlobSidecars,\n * stringToHex\n * } from 'viem'\n *\n * const blobs = toBlobs({ data: stringToHex('hello world') })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const proofs = blobsToProofs({ blobs, commitments, kzg })\n *\n * const sidecars = toBlobSidecars({ blobs, commitments, proofs })\n * ```\n */\nexport function toBlobSidecars(parameters) {\n const { data, kzg, to } = parameters;\n const blobs = parameters.blobs ?? toBlobs({ data: data, to });\n const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg: kzg, to });\n const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg: kzg, to });\n const sidecars = [];\n for (let i = 0; i < blobs.length; i++)\n sidecars.push({\n blob: blobs[i],\n commitment: commitments[i],\n proof: proofs[i],\n });\n return sidecars;\n}\n//# sourceMappingURL=toBlobSidecars.js.map","import { bytesPerBlob, bytesPerFieldElement, fieldElementsPerBlob, maxBytesPerTransaction, } from '../../constants/blob.js';\nimport { BlobSizeTooLargeError, EmptyBlobError, } from '../../errors/blob.js';\nimport { createCursor } from '../cursor.js';\nimport { size } from '../data/size.js';\nimport { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Transforms arbitrary data to blobs.\n *\n * @example\n * ```ts\n * import { toBlobs, stringToHex } from 'viem'\n *\n * const blobs = toBlobs({ data: stringToHex('hello world') })\n * ```\n */\nexport function toBlobs(parameters) {\n const to = parameters.to ?? (typeof parameters.data === 'string' ? 'hex' : 'bytes');\n const data = (typeof parameters.data === 'string'\n ? hexToBytes(parameters.data)\n : parameters.data);\n const size_ = size(data);\n if (!size_)\n throw new EmptyBlobError();\n if (size_ > maxBytesPerTransaction)\n throw new BlobSizeTooLargeError({\n maxSize: maxBytesPerTransaction,\n size: size_,\n });\n const blobs = [];\n let active = true;\n let position = 0;\n while (active) {\n const blob = createCursor(new Uint8Array(bytesPerBlob));\n let size = 0;\n while (size < fieldElementsPerBlob) {\n const bytes = data.slice(position, position + (bytesPerFieldElement - 1));\n // Push a zero byte so the field element doesn't overflow the BLS modulus.\n blob.pushByte(0x00);\n // Push the current segment of data bytes.\n blob.pushBytes(bytes);\n // If we detect that the current segment of data bytes is less than 31 bytes,\n // we can stop processing and push a terminator byte to indicate the end of the blob.\n if (bytes.length < 31) {\n blob.pushByte(0x80);\n active = false;\n break;\n }\n size++;\n position += 31;\n }\n blobs.push(blob);\n }\n return (to === 'bytes'\n ? blobs.map((x) => x.bytes)\n : blobs.map((x) => bytesToHex(x.bytes)));\n}\n//# sourceMappingURL=toBlobs.js.map","import { IntegerOutOfRangeError, InvalidHexBooleanError, SizeOverflowError, } from '../../errors/encoding.js';\nimport { size as size_ } from '../data/size.js';\nimport { trim } from '../data/trim.js';\nimport { hexToBytes } from './toBytes.js';\nexport function assertSize(hexOrBytes, { size }) {\n if (size_(hexOrBytes) > size)\n throw new SizeOverflowError({\n givenSize: size_(hexOrBytes),\n maxSize: size,\n });\n}\n/**\n * Decodes a hex string into a string, number, bigint, boolean, or byte array.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex\n * - Example: https://viem.sh/docs/utilities/fromHex#usage\n *\n * @param hex Hex string to decode.\n * @param toOrOpts Type to convert to or options.\n * @returns Decoded value.\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x1a4', 'number')\n * // 420\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c6421', 'string')\n * // 'Hello world'\n *\n * @example\n * import { fromHex } from 'viem'\n * const data = fromHex('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * to: 'string'\n * })\n * // 'Hello world'\n */\nexport function fromHex(hex, toOrOpts) {\n const opts = typeof toOrOpts === 'string' ? { to: toOrOpts } : toOrOpts;\n const to = opts.to;\n if (to === 'number')\n return hexToNumber(hex, opts);\n if (to === 'bigint')\n return hexToBigInt(hex, opts);\n if (to === 'string')\n return hexToString(hex, opts);\n if (to === 'boolean')\n return hexToBool(hex, opts);\n return hexToBytes(hex, opts);\n}\n/**\n * Decodes a hex value into a bigint.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobigint\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns BigInt value.\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x1a4', { signed: true })\n * // 420n\n *\n * @example\n * import { hexToBigInt } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420n\n */\nexport function hexToBigInt(hex, opts = {}) {\n const { signed } = opts;\n if (opts.size)\n assertSize(hex, { size: opts.size });\n const value = BigInt(hex);\n if (!signed)\n return value;\n const size = (hex.length - 2) / 2;\n const max = (1n << (BigInt(size) * 8n - 1n)) - 1n;\n if (value <= max)\n return value;\n return value - BigInt(`0x${'f'.padStart(size * 2, 'f')}`) - 1n;\n}\n/**\n * Decodes a hex value into a boolean.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextobool\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Boolean value.\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x01')\n * // true\n *\n * @example\n * import { hexToBool } from 'viem'\n * const data = hexToBool('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 })\n * // true\n */\nexport function hexToBool(hex_, opts = {}) {\n let hex = hex_;\n if (opts.size) {\n assertSize(hex, { size: opts.size });\n hex = trim(hex);\n }\n if (trim(hex) === '0x00')\n return false;\n if (trim(hex) === '0x01')\n return true;\n throw new InvalidHexBooleanError(hex);\n}\n/**\n * Decodes a hex string into a number.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextonumber\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns Number value.\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToNumber('0x1a4')\n * // 420\n *\n * @example\n * import { hexToNumber } from 'viem'\n * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 })\n * // 420\n */\nexport function hexToNumber(hex, opts = {}) {\n const value = hexToBigInt(hex, opts);\n const number = Number(value);\n if (!Number.isSafeInteger(number))\n throw new IntegerOutOfRangeError({\n max: `${Number.MAX_SAFE_INTEGER}`,\n min: `${Number.MIN_SAFE_INTEGER}`,\n signed: opts.signed,\n size: opts.size,\n value: `${value}n`,\n });\n return number;\n}\n/**\n * Decodes a hex value into a UTF-8 string.\n *\n * - Docs: https://viem.sh/docs/utilities/fromHex#hextostring\n *\n * @param hex Hex value to decode.\n * @param opts Options.\n * @returns String value.\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c6421')\n * // 'Hello world!'\n *\n * @example\n * import { hexToString } from 'viem'\n * const data = hexToString('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', {\n * size: 32,\n * })\n * // 'Hello world'\n */\nexport function hexToString(hex, opts = {}) {\n let bytes = hexToBytes(hex);\n if (opts.size) {\n assertSize(bytes, { size: opts.size });\n bytes = trim(bytes, { dir: 'right' });\n }\n return new TextDecoder().decode(bytes);\n}\n//# sourceMappingURL=fromHex.js.map","var basex = require('base-x')\nvar ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n\nmodule.exports = basex(ALPHABET)\n","/**\n * Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..\n *\n * - Docs: https://viem.sh/docs/utilities/formatUnits\n *\n * @example\n * import { formatUnits } from 'viem'\n *\n * formatUnits(420000000000n, 9)\n * // '420'\n */\nexport function formatUnits(value, decimals) {\n let display = value.toString();\n const negative = display.startsWith('-');\n if (negative)\n display = display.slice(1);\n display = display.padStart(decimals, '0');\n let [integer, fraction] = [\n display.slice(0, display.length - decimals),\n display.slice(display.length - decimals),\n ];\n fraction = fraction.replace(/(0+)$/, '');\n return `${negative ? '-' : ''}${integer || '0'}${fraction ? `.${fraction}` : ''}`;\n}\n//# sourceMappingURL=formatUnits.js.map","/**\n * SHA3 (keccak) hash function, based on a new \"Sponge function\" design.\n * Different from older hashes, the internal state is bigger than output size.\n *\n * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),\n * [Website](https://keccak.team/keccak.html),\n * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).\n *\n * Check out `sha3-addons` module for cSHAKE, k12, and others.\n * @module\n */\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from \"./_u64.js\";\n// prettier-ignore\nimport { abytes, aexists, anumber, aoutput, clean, createHasher, createXOFer, Hash, swap32IfBE, toBytes, u32 } from \"./utils.js\";\n// No __PURE__ annotations in sha3 header:\n// EVERYTHING is in fact used on every export.\n// Various per round constants calculations\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nconst _7n = BigInt(7);\nconst _256n = BigInt(256);\nconst _0x71n = BigInt(0x71);\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = [];\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst IOTAS = split(_SHA3_IOTA, true);\nconst SHA3_IOTA_H = IOTAS[0];\nconst SHA3_IOTA_L = IOTAS[1];\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n/** `keccakf1600` internal function, additionally allows to adjust round count. */\nexport function keccakP(s, rounds = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++)\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++)\n B[x] = s[y + x];\n for (let x = 0; x < 10; x++)\n s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n clean(B);\n}\n/** Keccak sponge function. */\nexport class Keccak extends Hash {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n super();\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n this.enableXOF = false;\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n // Can be passed from user as dkLen\n anumber(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n // 0 < blockLen < 200\n if (!(0 < blockLen && blockLen < 200))\n throw new Error('only keccak-f1600 function is supported');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n clone() {\n return this._cloneInto();\n }\n keccak() {\n swap32IfBE(this.state32);\n keccakP(this.state32, this.rounds);\n swap32IfBE(this.state32);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n aexists(this);\n data = toBytes(data);\n abytes(data);\n const { blockLen, state } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n aexists(this, false);\n abytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF)\n throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes) {\n anumber(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n aoutput(out, this);\n if (this.finished)\n throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n clean(this.state);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds));\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst gen = (suffix, blockLen, outputLen) => createHasher(() => new Keccak(blockLen, suffix, outputLen));\n/** SHA3-224 hash function. */\nexport const sha3_224 = /* @__PURE__ */ (() => gen(0x06, 144, 224 / 8))();\n/** SHA3-256 hash function. Different from keccak-256. */\nexport const sha3_256 = /* @__PURE__ */ (() => gen(0x06, 136, 256 / 8))();\n/** SHA3-384 hash function. */\nexport const sha3_384 = /* @__PURE__ */ (() => gen(0x06, 104, 384 / 8))();\n/** SHA3-512 hash function. */\nexport const sha3_512 = /* @__PURE__ */ (() => gen(0x06, 72, 512 / 8))();\n/** keccak-224 hash function. */\nexport const keccak_224 = /* @__PURE__ */ (() => gen(0x01, 144, 224 / 8))();\n/** keccak-256 hash function. Different from SHA3-256. */\nexport const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))();\n/** keccak-384 hash function. */\nexport const keccak_384 = /* @__PURE__ */ (() => gen(0x01, 104, 384 / 8))();\n/** keccak-512 hash function. */\nexport const keccak_512 = /* @__PURE__ */ (() => gen(0x01, 72, 512 / 8))();\nconst genShake = (suffix, blockLen, outputLen) => createXOFer((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true));\n/** SHAKE128 XOF with 128-bit security. */\nexport const shake128 = /* @__PURE__ */ (() => genShake(0x1f, 168, 128 / 8))();\n/** SHAKE256 XOF with 256-bit security. */\nexport const shake256 = /* @__PURE__ */ (() => genShake(0x1f, 136, 256 / 8))();\n//# sourceMappingURL=sha3.js.map","// TODO(v3): Convert to sync.\nimport { secp256k1 } from '@noble/curves/secp256k1';\nimport { isHex } from '../../utils/data/isHex.js';\nimport { hexToBytes, } from '../../utils/encoding/toBytes.js';\nimport { numberToHex, } from '../../utils/encoding/toHex.js';\nimport { serializeSignature } from '../../utils/signature/serializeSignature.js';\nlet extraEntropy = false;\n/**\n * Sets extra entropy for signing functions.\n */\nexport function setSignEntropy(entropy) {\n if (!entropy)\n throw new Error('must be a `true` or a hex value.');\n extraEntropy = entropy;\n}\n/**\n * @description Signs a hash with a given private key.\n *\n * @param hash The hash to sign.\n * @param privateKey The private key to sign with.\n *\n * @returns The signature.\n */\nexport async function sign({ hash, privateKey, to = 'object', }) {\n const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), {\n lowS: true,\n extraEntropy: isHex(extraEntropy, { strict: false })\n ? hexToBytes(extraEntropy)\n : extraEntropy,\n });\n const signature = {\n r: numberToHex(r, { size: 32 }),\n s: numberToHex(s, { size: 32 }),\n v: recovery ? 28n : 27n,\n yParity: recovery,\n };\n return (() => {\n if (to === 'bytes' || to === 'hex')\n return serializeSignature({ ...signature, to });\n return signature;\n })();\n}\n//# sourceMappingURL=sign.js.map","import { secp256k1 } from '@noble/curves/secp256k1';\nimport { hexToBigInt } from '../encoding/fromHex.js';\nimport { hexToBytes } from '../encoding/toBytes.js';\n/**\n * @description Converts a signature into hex format.\n *\n * @param signature The signature to convert.\n * @returns The signature in hex format.\n *\n * @example\n * serializeSignature({\n * r: '0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf',\n * s: '0x4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db8',\n * yParity: 1\n * })\n * // \"0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db81c\"\n */\nexport function serializeSignature({ r, s, to = 'hex', v, yParity, }) {\n const yParity_ = (() => {\n if (yParity === 0 || yParity === 1)\n return yParity;\n if (v && (v === 27n || v === 28n || v >= 35n))\n return v % 2n === 0n ? 1 : 0;\n throw new Error('Invalid `v` or `yParity` value');\n })();\n const signature = `0x${new secp256k1.Signature(hexToBigInt(r), hexToBigInt(s)).toCompactHex()}${yParity_ === 0 ? '1b' : '1c'}`;\n if (to === 'hex')\n return signature;\n return hexToBytes(signature);\n}\n//# sourceMappingURL=serializeSignature.js.map","export function concat(values) {\n if (typeof values[0] === 'string')\n return concatHex(values);\n return concatBytes(values);\n}\nexport function concatBytes(values) {\n let length = 0;\n for (const arr of values) {\n length += arr.length;\n }\n const result = new Uint8Array(length);\n let offset = 0;\n for (const arr of values) {\n result.set(arr, offset);\n offset += arr.length;\n }\n return result;\n}\nexport function concatHex(values) {\n return `0x${values.reduce((acc, x) => acc + x.replace('0x', ''), '')}`;\n}\n//# sourceMappingURL=concat.js.map","import { BaseError } from '../../errors/base.js';\nimport { createCursor, } from '../cursor.js';\nimport { hexToBytes } from './toBytes.js';\nimport { bytesToHex } from './toHex.js';\nexport function toRlp(bytes, to = 'hex') {\n const encodable = getEncodable(bytes);\n const cursor = createCursor(new Uint8Array(encodable.length));\n encodable.encode(cursor);\n if (to === 'hex')\n return bytesToHex(cursor.bytes);\n return cursor.bytes;\n}\nexport function bytesToRlp(bytes, to = 'bytes') {\n return toRlp(bytes, to);\n}\nexport function hexToRlp(hex, to = 'hex') {\n return toRlp(hex, to);\n}\nfunction getEncodable(bytes) {\n if (Array.isArray(bytes))\n return getEncodableList(bytes.map((x) => getEncodable(x)));\n return getEncodableBytes(bytes);\n}\nfunction getEncodableList(list) {\n const bodyLength = list.reduce((acc, x) => acc + x.length, 0);\n const sizeOfBodyLength = getSizeOfLength(bodyLength);\n const length = (() => {\n if (bodyLength <= 55)\n return 1 + bodyLength;\n return 1 + sizeOfBodyLength + bodyLength;\n })();\n return {\n length,\n encode(cursor) {\n if (bodyLength <= 55) {\n cursor.pushByte(0xc0 + bodyLength);\n }\n else {\n cursor.pushByte(0xc0 + 55 + sizeOfBodyLength);\n if (sizeOfBodyLength === 1)\n cursor.pushUint8(bodyLength);\n else if (sizeOfBodyLength === 2)\n cursor.pushUint16(bodyLength);\n else if (sizeOfBodyLength === 3)\n cursor.pushUint24(bodyLength);\n else\n cursor.pushUint32(bodyLength);\n }\n for (const { encode } of list) {\n encode(cursor);\n }\n },\n };\n}\nfunction getEncodableBytes(bytesOrHex) {\n const bytes = typeof bytesOrHex === 'string' ? hexToBytes(bytesOrHex) : bytesOrHex;\n const sizeOfBytesLength = getSizeOfLength(bytes.length);\n const length = (() => {\n if (bytes.length === 1 && bytes[0] < 0x80)\n return 1;\n if (bytes.length <= 55)\n return 1 + bytes.length;\n return 1 + sizeOfBytesLength + bytes.length;\n })();\n return {\n length,\n encode(cursor) {\n if (bytes.length === 1 && bytes[0] < 0x80) {\n cursor.pushBytes(bytes);\n }\n else if (bytes.length <= 55) {\n cursor.pushByte(0x80 + bytes.length);\n cursor.pushBytes(bytes);\n }\n else {\n cursor.pushByte(0x80 + 55 + sizeOfBytesLength);\n if (sizeOfBytesLength === 1)\n cursor.pushUint8(bytes.length);\n else if (sizeOfBytesLength === 2)\n cursor.pushUint16(bytes.length);\n else if (sizeOfBytesLength === 3)\n cursor.pushUint24(bytes.length);\n else\n cursor.pushUint32(bytes.length);\n cursor.pushBytes(bytes);\n }\n },\n };\n}\nfunction getSizeOfLength(length) {\n if (length < 2 ** 8)\n return 1;\n if (length < 2 ** 16)\n return 2;\n if (length < 2 ** 24)\n return 3;\n if (length < 2 ** 32)\n return 4;\n throw new BaseError('Length is too large.');\n}\n//# sourceMappingURL=toRlp.js.map","import { concatHex } from '../data/concat.js';\nimport { hexToBytes } from '../encoding/toBytes.js';\nimport { numberToHex } from '../encoding/toHex.js';\nimport { toRlp } from '../encoding/toRlp.js';\nimport { keccak256 } from '../hash/keccak256.js';\n/**\n * Computes an Authorization hash in [EIP-7702 format](https://eips.ethereum.org/EIPS/eip-7702): `keccak256('0x05' || rlp([chain_id, address, nonce]))`.\n */\nexport function hashAuthorization(parameters) {\n const { chainId, nonce, to } = parameters;\n const address = parameters.contractAddress ?? parameters.address;\n const hash = keccak256(concatHex([\n '0x05',\n toRlp([\n chainId ? numberToHex(chainId) : '0x',\n address,\n nonce ? numberToHex(nonce) : '0x',\n ]),\n ]));\n if (to === 'bytes')\n return hexToBytes(hash);\n return hash;\n}\n//# sourceMappingURL=hashAuthorization.js.map","export const presignMessagePrefix = '\\x19Ethereum Signed Message:\\n';\n//# sourceMappingURL=strings.js.map","import { keccak256 } from '../hash/keccak256.js';\nimport { toPrefixedMessage } from './toPrefixedMessage.js';\nexport function hashMessage(message, to_) {\n return keccak256(toPrefixedMessage(message), to_);\n}\n//# sourceMappingURL=hashMessage.js.map","import { presignMessagePrefix } from '../../constants/strings.js';\nimport { concat } from '../data/concat.js';\nimport { size } from '../data/size.js';\nimport { bytesToHex, stringToHex, } from '../encoding/toHex.js';\nexport function toPrefixedMessage(message_) {\n const message = (() => {\n if (typeof message_ === 'string')\n return stringToHex(message_);\n if (typeof message_.raw === 'string')\n return message_.raw;\n return bytesToHex(message_.raw);\n })();\n const prefix = stringToHex(`${presignMessagePrefix}${size(message)}`);\n return concat([prefix, message]);\n}\n//# sourceMappingURL=toPrefixedMessage.js.map","import { bytesToHex } from '../encoding/toHex.js';\nimport { sha256 } from '../hash/sha256.js';\n/**\n * Transform a commitment to it's versioned hash.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * commitmentToVersionedHash,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const [commitment] = blobsToCommitments({ blobs, kzg })\n * const versionedHash = commitmentToVersionedHash({ commitment })\n * ```\n */\nexport function commitmentToVersionedHash(parameters) {\n const { commitment, version = 1 } = parameters;\n const to = parameters.to ?? (typeof commitment === 'string' ? 'hex' : 'bytes');\n const versionedHash = sha256(commitment, 'bytes');\n versionedHash.set([version], 0);\n return (to === 'bytes' ? versionedHash : bytesToHex(versionedHash));\n}\n//# sourceMappingURL=commitmentToVersionedHash.js.map","import { sha256 as noble_sha256 } from '@noble/hashes/sha256';\nimport { isHex } from '../data/isHex.js';\nimport { toBytes } from '../encoding/toBytes.js';\nimport { toHex } from '../encoding/toHex.js';\nexport function sha256(value, to_) {\n const to = to_ || 'hex';\n const bytes = noble_sha256(isHex(value, { strict: false }) ? toBytes(value) : value);\n if (to === 'bytes')\n return bytes;\n return toHex(bytes);\n}\n//# sourceMappingURL=sha256.js.map","import { InvalidAddressError, } from '../../errors/address.js';\nimport { InvalidStorageKeySizeError, } from '../../errors/transaction.js';\nimport { isAddress } from '../address/isAddress.js';\n/*\n * Serialize an EIP-2930 access list\n * @remarks\n * Use to create a transaction serializer with support for EIP-2930 access lists\n *\n * @param accessList - Array of objects of address and arrays of Storage Keys\n * @throws InvalidAddressError, InvalidStorageKeySizeError\n * @returns Array of hex strings\n */\nexport function serializeAccessList(accessList) {\n if (!accessList || accessList.length === 0)\n return [];\n const serializedAccessList = [];\n for (let i = 0; i < accessList.length; i++) {\n const { address, storageKeys } = accessList[i];\n for (let j = 0; j < storageKeys.length; j++) {\n if (storageKeys[j].length - 2 !== 64) {\n throw new InvalidStorageKeySizeError({ storageKey: storageKeys[j] });\n }\n }\n if (!isAddress(address, { strict: false })) {\n throw new InvalidAddressError({ address });\n }\n serializedAccessList.push([address, storageKeys]);\n }\n return serializedAccessList;\n}\n//# sourceMappingURL=serializeAccessList.js.map","import { InvalidLegacyVError, } from '../../errors/transaction.js';\nimport { serializeAuthorizationList, } from '../authorization/serializeAuthorizationList.js';\nimport { blobsToCommitments, } from '../blob/blobsToCommitments.js';\nimport { blobsToProofs, } from '../blob/blobsToProofs.js';\nimport { commitmentsToVersionedHashes, } from '../blob/commitmentsToVersionedHashes.js';\nimport { toBlobSidecars, } from '../blob/toBlobSidecars.js';\nimport { concatHex } from '../data/concat.js';\nimport { trim } from '../data/trim.js';\nimport { bytesToHex, numberToHex, } from '../encoding/toHex.js';\nimport { toRlp } from '../encoding/toRlp.js';\nimport { assertTransactionEIP1559, assertTransactionEIP2930, assertTransactionEIP4844, assertTransactionEIP7702, assertTransactionLegacy, } from './assertTransaction.js';\nimport { getTransactionType, } from './getTransactionType.js';\nimport { serializeAccessList, } from './serializeAccessList.js';\nexport function serializeTransaction(transaction, signature) {\n const type = getTransactionType(transaction);\n if (type === 'eip1559')\n return serializeTransactionEIP1559(transaction, signature);\n if (type === 'eip2930')\n return serializeTransactionEIP2930(transaction, signature);\n if (type === 'eip4844')\n return serializeTransactionEIP4844(transaction, signature);\n if (type === 'eip7702')\n return serializeTransactionEIP7702(transaction, signature);\n return serializeTransactionLegacy(transaction, signature);\n}\nfunction serializeTransactionEIP7702(transaction, signature) {\n const { authorizationList, chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data, } = transaction;\n assertTransactionEIP7702(transaction);\n const serializedAccessList = serializeAccessList(accessList);\n const serializedAuthorizationList = serializeAuthorizationList(authorizationList);\n return concatHex([\n '0x04',\n toRlp([\n numberToHex(chainId),\n nonce ? numberToHex(nonce) : '0x',\n maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',\n maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',\n gas ? numberToHex(gas) : '0x',\n to ?? '0x',\n value ? numberToHex(value) : '0x',\n data ?? '0x',\n serializedAccessList,\n serializedAuthorizationList,\n ...toYParitySignatureArray(transaction, signature),\n ]),\n ]);\n}\nfunction serializeTransactionEIP4844(transaction, signature) {\n const { chainId, gas, nonce, to, value, maxFeePerBlobGas, maxFeePerGas, maxPriorityFeePerGas, accessList, data, } = transaction;\n assertTransactionEIP4844(transaction);\n let blobVersionedHashes = transaction.blobVersionedHashes;\n let sidecars = transaction.sidecars;\n // If `blobs` are passed, we will need to compute the KZG commitments & proofs.\n if (transaction.blobs &&\n (typeof blobVersionedHashes === 'undefined' ||\n typeof sidecars === 'undefined')) {\n const blobs = (typeof transaction.blobs[0] === 'string'\n ? transaction.blobs\n : transaction.blobs.map((x) => bytesToHex(x)));\n const kzg = transaction.kzg;\n const commitments = blobsToCommitments({\n blobs,\n kzg,\n });\n if (typeof blobVersionedHashes === 'undefined')\n blobVersionedHashes = commitmentsToVersionedHashes({\n commitments,\n });\n if (typeof sidecars === 'undefined') {\n const proofs = blobsToProofs({ blobs, commitments, kzg });\n sidecars = toBlobSidecars({ blobs, commitments, proofs });\n }\n }\n const serializedAccessList = serializeAccessList(accessList);\n const serializedTransaction = [\n numberToHex(chainId),\n nonce ? numberToHex(nonce) : '0x',\n maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',\n maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',\n gas ? numberToHex(gas) : '0x',\n to ?? '0x',\n value ? numberToHex(value) : '0x',\n data ?? '0x',\n serializedAccessList,\n maxFeePerBlobGas ? numberToHex(maxFeePerBlobGas) : '0x',\n blobVersionedHashes ?? [],\n ...toYParitySignatureArray(transaction, signature),\n ];\n const blobs = [];\n const commitments = [];\n const proofs = [];\n if (sidecars)\n for (let i = 0; i < sidecars.length; i++) {\n const { blob, commitment, proof } = sidecars[i];\n blobs.push(blob);\n commitments.push(commitment);\n proofs.push(proof);\n }\n return concatHex([\n '0x03',\n sidecars\n ? // If sidecars are enabled, envelope turns into a \"wrapper\":\n toRlp([serializedTransaction, blobs, commitments, proofs])\n : // If sidecars are disabled, standard envelope is used:\n toRlp(serializedTransaction),\n ]);\n}\nfunction serializeTransactionEIP1559(transaction, signature) {\n const { chainId, gas, nonce, to, value, maxFeePerGas, maxPriorityFeePerGas, accessList, data, } = transaction;\n assertTransactionEIP1559(transaction);\n const serializedAccessList = serializeAccessList(accessList);\n const serializedTransaction = [\n numberToHex(chainId),\n nonce ? numberToHex(nonce) : '0x',\n maxPriorityFeePerGas ? numberToHex(maxPriorityFeePerGas) : '0x',\n maxFeePerGas ? numberToHex(maxFeePerGas) : '0x',\n gas ? numberToHex(gas) : '0x',\n to ?? '0x',\n value ? numberToHex(value) : '0x',\n data ?? '0x',\n serializedAccessList,\n ...toYParitySignatureArray(transaction, signature),\n ];\n return concatHex([\n '0x02',\n toRlp(serializedTransaction),\n ]);\n}\nfunction serializeTransactionEIP2930(transaction, signature) {\n const { chainId, gas, data, nonce, to, value, accessList, gasPrice } = transaction;\n assertTransactionEIP2930(transaction);\n const serializedAccessList = serializeAccessList(accessList);\n const serializedTransaction = [\n numberToHex(chainId),\n nonce ? numberToHex(nonce) : '0x',\n gasPrice ? numberToHex(gasPrice) : '0x',\n gas ? numberToHex(gas) : '0x',\n to ?? '0x',\n value ? numberToHex(value) : '0x',\n data ?? '0x',\n serializedAccessList,\n ...toYParitySignatureArray(transaction, signature),\n ];\n return concatHex([\n '0x01',\n toRlp(serializedTransaction),\n ]);\n}\nfunction serializeTransactionLegacy(transaction, signature) {\n const { chainId = 0, gas, data, nonce, to, value, gasPrice } = transaction;\n assertTransactionLegacy(transaction);\n let serializedTransaction = [\n nonce ? numberToHex(nonce) : '0x',\n gasPrice ? numberToHex(gasPrice) : '0x',\n gas ? numberToHex(gas) : '0x',\n to ?? '0x',\n value ? numberToHex(value) : '0x',\n data ?? '0x',\n ];\n if (signature) {\n const v = (() => {\n // EIP-155 (inferred chainId)\n if (signature.v >= 35n) {\n const inferredChainId = (signature.v - 35n) / 2n;\n if (inferredChainId > 0)\n return signature.v;\n return 27n + (signature.v === 35n ? 0n : 1n);\n }\n // EIP-155 (explicit chainId)\n if (chainId > 0)\n return BigInt(chainId * 2) + BigInt(35n + signature.v - 27n);\n // Pre-EIP-155 (no chainId)\n const v = 27n + (signature.v === 27n ? 0n : 1n);\n if (signature.v !== v)\n throw new InvalidLegacyVError({ v: signature.v });\n return v;\n })();\n const r = trim(signature.r);\n const s = trim(signature.s);\n serializedTransaction = [\n ...serializedTransaction,\n numberToHex(v),\n r === '0x00' ? '0x' : r,\n s === '0x00' ? '0x' : s,\n ];\n }\n else if (chainId > 0) {\n serializedTransaction = [\n ...serializedTransaction,\n numberToHex(chainId),\n '0x',\n '0x',\n ];\n }\n return toRlp(serializedTransaction);\n}\nexport function toYParitySignatureArray(transaction, signature_) {\n const signature = signature_ ?? transaction;\n const { v, yParity } = signature;\n if (typeof signature.r === 'undefined')\n return [];\n if (typeof signature.s === 'undefined')\n return [];\n if (typeof v === 'undefined' && typeof yParity === 'undefined')\n return [];\n const r = trim(signature.r);\n const s = trim(signature.s);\n const yParity_ = (() => {\n if (typeof yParity === 'number')\n return yParity ? numberToHex(1) : '0x';\n if (v === 0n)\n return '0x';\n if (v === 1n)\n return numberToHex(1);\n return v === 27n ? '0x' : numberToHex(1);\n })();\n return [yParity_, r === '0x00' ? '0x' : r, s === '0x00' ? '0x' : s];\n}\n//# sourceMappingURL=serializeTransaction.js.map","import { InvalidSerializableTransactionError, } from '../../errors/transaction.js';\nexport function getTransactionType(transaction) {\n if (transaction.type)\n return transaction.type;\n if (typeof transaction.authorizationList !== 'undefined')\n return 'eip7702';\n if (typeof transaction.blobs !== 'undefined' ||\n typeof transaction.blobVersionedHashes !== 'undefined' ||\n typeof transaction.maxFeePerBlobGas !== 'undefined' ||\n typeof transaction.sidecars !== 'undefined')\n return 'eip4844';\n if (typeof transaction.maxFeePerGas !== 'undefined' ||\n typeof transaction.maxPriorityFeePerGas !== 'undefined') {\n return 'eip1559';\n }\n if (typeof transaction.gasPrice !== 'undefined') {\n if (typeof transaction.accessList !== 'undefined')\n return 'eip2930';\n return 'legacy';\n }\n throw new InvalidSerializableTransactionError({ transaction });\n}\n//# sourceMappingURL=getTransactionType.js.map","import { commitmentToVersionedHash, } from './commitmentToVersionedHash.js';\n/**\n * Transform a list of commitments to their versioned hashes.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * commitmentsToVersionedHashes,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const versionedHashes = commitmentsToVersionedHashes({ commitments })\n * ```\n */\nexport function commitmentsToVersionedHashes(parameters) {\n const { commitments, version } = parameters;\n const to = parameters.to ?? (typeof commitments[0] === 'string' ? 'hex' : 'bytes');\n const hashes = [];\n for (const commitment of commitments) {\n hashes.push(commitmentToVersionedHash({\n commitment,\n to,\n version,\n }));\n }\n return hashes;\n}\n//# sourceMappingURL=commitmentsToVersionedHashes.js.map","import { toHex } from '../encoding/toHex.js';\nimport { toYParitySignatureArray } from '../transaction/serializeTransaction.js';\n/*\n * Serializes an EIP-7702 authorization list.\n */\nexport function serializeAuthorizationList(authorizationList) {\n if (!authorizationList || authorizationList.length === 0)\n return [];\n const serializedAuthorizationList = [];\n for (const authorization of authorizationList) {\n const { chainId, nonce, ...signature } = authorization;\n const contractAddress = authorization.address;\n serializedAuthorizationList.push([\n chainId ? toHex(chainId) : '0x',\n contractAddress,\n nonce ? toHex(nonce) : '0x',\n ...toYParitySignatureArray({}, signature),\n ]);\n }\n return serializedAuthorizationList;\n}\n//# sourceMappingURL=serializeAuthorizationList.js.map","import { formatAbiItem, formatAbiParams } from '../utils/abi/formatAbiItem.js';\nimport { size } from '../utils/data/size.js';\nimport { BaseError } from './base.js';\nexport class AbiConstructorNotFoundError extends BaseError {\n constructor({ docsPath }) {\n super([\n 'A constructor was not found on the ABI.',\n 'Make sure you are using the correct ABI and that the constructor exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiConstructorNotFoundError',\n });\n }\n}\nexport class AbiConstructorParamsNotFoundError extends BaseError {\n constructor({ docsPath }) {\n super([\n 'Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.',\n 'Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiConstructorParamsNotFoundError',\n });\n }\n}\nexport class AbiDecodingDataSizeInvalidError extends BaseError {\n constructor({ data, size }) {\n super([\n `Data size of ${size} bytes is invalid.`,\n 'Size must be in increments of 32 bytes (size % 32 === 0).',\n ].join('\\n'), {\n metaMessages: [`Data: ${data} (${size} bytes)`],\n name: 'AbiDecodingDataSizeInvalidError',\n });\n }\n}\nexport class AbiDecodingDataSizeTooSmallError extends BaseError {\n constructor({ data, params, size, }) {\n super([`Data size of ${size} bytes is too small for given parameters.`].join('\\n'), {\n metaMessages: [\n `Params: (${formatAbiParams(params, { includeName: true })})`,\n `Data: ${data} (${size} bytes)`,\n ],\n name: 'AbiDecodingDataSizeTooSmallError',\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"params\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"size\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.data = data;\n this.params = params;\n this.size = size;\n }\n}\nexport class AbiDecodingZeroDataError extends BaseError {\n constructor() {\n super('Cannot decode zero data (\"0x\") with ABI parameters.', {\n name: 'AbiDecodingZeroDataError',\n });\n }\n}\nexport class AbiEncodingArrayLengthMismatchError extends BaseError {\n constructor({ expectedLength, givenLength, type, }) {\n super([\n `ABI encoding array length mismatch for type ${type}.`,\n `Expected length: ${expectedLength}`,\n `Given length: ${givenLength}`,\n ].join('\\n'), { name: 'AbiEncodingArrayLengthMismatchError' });\n }\n}\nexport class AbiEncodingBytesSizeMismatchError extends BaseError {\n constructor({ expectedSize, value }) {\n super(`Size of bytes \"${value}\" (bytes${size(value)}) does not match expected size (bytes${expectedSize}).`, { name: 'AbiEncodingBytesSizeMismatchError' });\n }\n}\nexport class AbiEncodingLengthMismatchError extends BaseError {\n constructor({ expectedLength, givenLength, }) {\n super([\n 'ABI encoding params/values length mismatch.',\n `Expected length (params): ${expectedLength}`,\n `Given length (values): ${givenLength}`,\n ].join('\\n'), { name: 'AbiEncodingLengthMismatchError' });\n }\n}\nexport class AbiErrorInputsNotFoundError extends BaseError {\n constructor(errorName, { docsPath }) {\n super([\n `Arguments (\\`args\\`) were provided to \"${errorName}\", but \"${errorName}\" on the ABI does not contain any parameters (\\`inputs\\`).`,\n 'Cannot encode error result without knowing what the parameter types are.',\n 'Make sure you are using the correct ABI and that the inputs exist on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorInputsNotFoundError',\n });\n }\n}\nexport class AbiErrorNotFoundError extends BaseError {\n constructor(errorName, { docsPath } = {}) {\n super([\n `Error ${errorName ? `\"${errorName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the error exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorNotFoundError',\n });\n }\n}\nexport class AbiErrorSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded error signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the error exists on it.',\n `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiErrorSignatureNotFoundError',\n });\n Object.defineProperty(this, \"signature\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.signature = signature;\n }\n}\nexport class AbiEventSignatureEmptyTopicsError extends BaseError {\n constructor({ docsPath }) {\n super('Cannot extract event signature from empty topics.', {\n docsPath,\n name: 'AbiEventSignatureEmptyTopicsError',\n });\n }\n}\nexport class AbiEventSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded event signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the event exists on it.',\n `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiEventSignatureNotFoundError',\n });\n }\n}\nexport class AbiEventNotFoundError extends BaseError {\n constructor(eventName, { docsPath } = {}) {\n super([\n `Event ${eventName ? `\"${eventName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the event exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiEventNotFoundError',\n });\n }\n}\nexport class AbiFunctionNotFoundError extends BaseError {\n constructor(functionName, { docsPath } = {}) {\n super([\n `Function ${functionName ? `\"${functionName}\" ` : ''}not found on ABI.`,\n 'Make sure you are using the correct ABI and that the function exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionNotFoundError',\n });\n }\n}\nexport class AbiFunctionOutputsNotFoundError extends BaseError {\n constructor(functionName, { docsPath }) {\n super([\n `Function \"${functionName}\" does not contain any \\`outputs\\` on ABI.`,\n 'Cannot decode function result without knowing what the parameter types are.',\n 'Make sure you are using the correct ABI and that the function exists on it.',\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionOutputsNotFoundError',\n });\n }\n}\nexport class AbiFunctionSignatureNotFoundError extends BaseError {\n constructor(signature, { docsPath }) {\n super([\n `Encoded function signature \"${signature}\" not found on ABI.`,\n 'Make sure you are using the correct ABI and that the function exists on it.',\n `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`,\n ].join('\\n'), {\n docsPath,\n name: 'AbiFunctionSignatureNotFoundError',\n });\n }\n}\nexport class AbiItemAmbiguityError extends BaseError {\n constructor(x, y) {\n super('Found ambiguous types in overloaded ABI items.', {\n metaMessages: [\n `\\`${x.type}\\` in \\`${formatAbiItem(x.abiItem)}\\`, and`,\n `\\`${y.type}\\` in \\`${formatAbiItem(y.abiItem)}\\``,\n '',\n 'These types encode differently and cannot be distinguished at runtime.',\n 'Remove one of the ambiguous items in the ABI.',\n ],\n name: 'AbiItemAmbiguityError',\n });\n }\n}\nexport class BytesSizeMismatchError extends BaseError {\n constructor({ expectedSize, givenSize, }) {\n super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, {\n name: 'BytesSizeMismatchError',\n });\n }\n}\nexport class DecodeLogDataMismatch extends BaseError {\n constructor({ abiItem, data, params, size, }) {\n super([\n `Data size of ${size} bytes is too small for non-indexed event parameters.`,\n ].join('\\n'), {\n metaMessages: [\n `Params: (${formatAbiParams(params, { includeName: true })})`,\n `Data: ${data} (${size} bytes)`,\n ],\n name: 'DecodeLogDataMismatch',\n });\n Object.defineProperty(this, \"abiItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"data\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"params\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"size\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.abiItem = abiItem;\n this.data = data;\n this.params = params;\n this.size = size;\n }\n}\nexport class DecodeLogTopicsMismatch extends BaseError {\n constructor({ abiItem, param, }) {\n super([\n `Expected a topic for indexed event parameter${param.name ? ` \"${param.name}\"` : ''} on event \"${formatAbiItem(abiItem, { includeName: true })}\".`,\n ].join('\\n'), { name: 'DecodeLogTopicsMismatch' });\n Object.defineProperty(this, \"abiItem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.abiItem = abiItem;\n }\n}\nexport class InvalidAbiEncodingTypeError extends BaseError {\n constructor(type, { docsPath }) {\n super([\n `Type \"${type}\" is not a valid encoding type.`,\n 'Please provide a valid ABI type.',\n ].join('\\n'), { docsPath, name: 'InvalidAbiEncodingType' });\n }\n}\nexport class InvalidAbiDecodingTypeError extends BaseError {\n constructor(type, { docsPath }) {\n super([\n `Type \"${type}\" is not a valid decoding type.`,\n 'Please provide a valid ABI type.',\n ].join('\\n'), { docsPath, name: 'InvalidAbiDecodingType' });\n }\n}\nexport class InvalidArrayError extends BaseError {\n constructor(value) {\n super([`Value \"${value}\" is not a valid array.`].join('\\n'), {\n name: 'InvalidArrayError',\n });\n }\n}\nexport class InvalidDefinitionTypeError extends BaseError {\n constructor(type) {\n super([\n `\"${type}\" is not a valid definition type.`,\n 'Valid types: \"function\", \"event\", \"error\"',\n ].join('\\n'), { name: 'InvalidDefinitionTypeError' });\n }\n}\nexport class UnsupportedPackedAbiType extends BaseError {\n constructor(type) {\n super(`Type \"${type}\" is not supported for packed encoding.`, {\n name: 'UnsupportedPackedAbiType',\n });\n }\n}\n//# sourceMappingURL=abi.js.map","export const arrayRegex = /^(.*)\\[([0-9]*)\\]$/;\n// `bytes`: binary type of `M` bytes, `0 < M <= 32`\n// https://regexr.com/6va55\nexport const bytesRegex = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/;\n// `(u)int`: (un)signed integer type of `M` bits, `0 < M <= 256`, `M % 8 == 0`\n// https://regexr.com/6v8hp\nexport const integerRegex = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;\n//# sourceMappingURL=regex.js.map","import { AbiEncodingArrayLengthMismatchError, AbiEncodingBytesSizeMismatchError, AbiEncodingLengthMismatchError, InvalidAbiEncodingTypeError, InvalidArrayError, } from '../../errors/abi.js';\nimport { InvalidAddressError, } from '../../errors/address.js';\nimport { BaseError } from '../../errors/base.js';\nimport { IntegerOutOfRangeError } from '../../errors/encoding.js';\nimport { isAddress } from '../address/isAddress.js';\nimport { concat } from '../data/concat.js';\nimport { padHex } from '../data/pad.js';\nimport { size } from '../data/size.js';\nimport { slice } from '../data/slice.js';\nimport { boolToHex, numberToHex, stringToHex, } from '../encoding/toHex.js';\nimport { integerRegex } from '../regex.js';\n/**\n * @description Encodes a list of primitive values into an ABI-encoded hex value.\n *\n * - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters\n *\n * Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values.\n *\n * @param params - a set of ABI Parameters (params), that can be in the shape of the inputs or outputs attribute of an ABI Item.\n * @param values - a set of values (values) that correspond to the given params.\n * @example\n * ```typescript\n * import { encodeAbiParameters } from 'viem'\n *\n * const encodedData = encodeAbiParameters(\n * [\n * { name: 'x', type: 'string' },\n * { name: 'y', type: 'uint' },\n * { name: 'z', type: 'bool' }\n * ],\n * ['wagmi', 420n, true]\n * )\n * ```\n *\n * You can also pass in Human Readable parameters with the parseAbiParameters utility.\n *\n * @example\n * ```typescript\n * import { encodeAbiParameters, parseAbiParameters } from 'viem'\n *\n * const encodedData = encodeAbiParameters(\n * parseAbiParameters('string x, uint y, bool z'),\n * ['wagmi', 420n, true]\n * )\n * ```\n */\nexport function encodeAbiParameters(params, values) {\n if (params.length !== values.length)\n throw new AbiEncodingLengthMismatchError({\n expectedLength: params.length,\n givenLength: values.length,\n });\n // Prepare the parameters to determine dynamic types to encode.\n const preparedParams = prepareParams({\n params: params,\n values: values,\n });\n const data = encodeParams(preparedParams);\n if (data.length === 0)\n return '0x';\n return data;\n}\nfunction prepareParams({ params, values, }) {\n const preparedParams = [];\n for (let i = 0; i < params.length; i++) {\n preparedParams.push(prepareParam({ param: params[i], value: values[i] }));\n }\n return preparedParams;\n}\nfunction prepareParam({ param, value, }) {\n const arrayComponents = getArrayComponents(param.type);\n if (arrayComponents) {\n const [length, type] = arrayComponents;\n return encodeArray(value, { length, param: { ...param, type } });\n }\n if (param.type === 'tuple') {\n return encodeTuple(value, {\n param: param,\n });\n }\n if (param.type === 'address') {\n return encodeAddress(value);\n }\n if (param.type === 'bool') {\n return encodeBool(value);\n }\n if (param.type.startsWith('uint') || param.type.startsWith('int')) {\n const signed = param.type.startsWith('int');\n const [, , size = '256'] = integerRegex.exec(param.type) ?? [];\n return encodeNumber(value, {\n signed,\n size: Number(size),\n });\n }\n if (param.type.startsWith('bytes')) {\n return encodeBytes(value, { param });\n }\n if (param.type === 'string') {\n return encodeString(value);\n }\n throw new InvalidAbiEncodingTypeError(param.type, {\n docsPath: '/docs/contract/encodeAbiParameters',\n });\n}\nfunction encodeParams(preparedParams) {\n // 1. Compute the size of the static part of the parameters.\n let staticSize = 0;\n for (let i = 0; i < preparedParams.length; i++) {\n const { dynamic, encoded } = preparedParams[i];\n if (dynamic)\n staticSize += 32;\n else\n staticSize += size(encoded);\n }\n // 2. Split the parameters into static and dynamic parts.\n const staticParams = [];\n const dynamicParams = [];\n let dynamicSize = 0;\n for (let i = 0; i < preparedParams.length; i++) {\n const { dynamic, encoded } = preparedParams[i];\n if (dynamic) {\n staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 }));\n dynamicParams.push(encoded);\n dynamicSize += size(encoded);\n }\n else {\n staticParams.push(encoded);\n }\n }\n // 3. Concatenate static and dynamic parts.\n return concat([...staticParams, ...dynamicParams]);\n}\nfunction encodeAddress(value) {\n if (!isAddress(value))\n throw new InvalidAddressError({ address: value });\n return { dynamic: false, encoded: padHex(value.toLowerCase()) };\n}\nfunction encodeArray(value, { length, param, }) {\n const dynamic = length === null;\n if (!Array.isArray(value))\n throw new InvalidArrayError(value);\n if (!dynamic && value.length !== length)\n throw new AbiEncodingArrayLengthMismatchError({\n expectedLength: length,\n givenLength: value.length,\n type: `${param.type}[${length}]`,\n });\n let dynamicChild = false;\n const preparedParams = [];\n for (let i = 0; i < value.length; i++) {\n const preparedParam = prepareParam({ param, value: value[i] });\n if (preparedParam.dynamic)\n dynamicChild = true;\n preparedParams.push(preparedParam);\n }\n if (dynamic || dynamicChild) {\n const data = encodeParams(preparedParams);\n if (dynamic) {\n const length = numberToHex(preparedParams.length, { size: 32 });\n return {\n dynamic: true,\n encoded: preparedParams.length > 0 ? concat([length, data]) : length,\n };\n }\n if (dynamicChild)\n return { dynamic: true, encoded: data };\n }\n return {\n dynamic: false,\n encoded: concat(preparedParams.map(({ encoded }) => encoded)),\n };\n}\nfunction encodeBytes(value, { param }) {\n const [, paramSize] = param.type.split('bytes');\n const bytesSize = size(value);\n if (!paramSize) {\n let value_ = value;\n // If the size is not divisible by 32 bytes, pad the end\n // with empty bytes to the ceiling 32 bytes.\n if (bytesSize % 32 !== 0)\n value_ = padHex(value_, {\n dir: 'right',\n size: Math.ceil((value.length - 2) / 2 / 32) * 32,\n });\n return {\n dynamic: true,\n encoded: concat([padHex(numberToHex(bytesSize, { size: 32 })), value_]),\n };\n }\n if (bytesSize !== Number.parseInt(paramSize, 10))\n throw new AbiEncodingBytesSizeMismatchError({\n expectedSize: Number.parseInt(paramSize, 10),\n value,\n });\n return { dynamic: false, encoded: padHex(value, { dir: 'right' }) };\n}\nfunction encodeBool(value) {\n if (typeof value !== 'boolean')\n throw new BaseError(`Invalid boolean value: \"${value}\" (type: ${typeof value}). Expected: \\`true\\` or \\`false\\`.`);\n return { dynamic: false, encoded: padHex(boolToHex(value)) };\n}\nfunction encodeNumber(value, { signed, size = 256 }) {\n if (typeof size === 'number') {\n const max = 2n ** (BigInt(size) - (signed ? 1n : 0n)) - 1n;\n const min = signed ? -max - 1n : 0n;\n if (value > max || value < min)\n throw new IntegerOutOfRangeError({\n max: max.toString(),\n min: min.toString(),\n signed,\n size: size / 8,\n value: value.toString(),\n });\n }\n return {\n dynamic: false,\n encoded: numberToHex(value, {\n size: 32,\n signed,\n }),\n };\n}\nfunction encodeString(value) {\n const hexValue = stringToHex(value);\n const partsLength = Math.ceil(size(hexValue) / 32);\n const parts = [];\n for (let i = 0; i < partsLength; i++) {\n parts.push(padHex(slice(hexValue, i * 32, (i + 1) * 32), {\n dir: 'right',\n }));\n }\n return {\n dynamic: true,\n encoded: concat([\n padHex(numberToHex(size(hexValue), { size: 32 })),\n ...parts,\n ]),\n };\n}\nfunction encodeTuple(value, { param }) {\n let dynamic = false;\n const preparedParams = [];\n for (let i = 0; i < param.components.length; i++) {\n const param_ = param.components[i];\n const index = Array.isArray(value) ? i : param_.name;\n const preparedParam = prepareParam({\n param: param_,\n value: value[index],\n });\n preparedParams.push(preparedParam);\n if (preparedParam.dynamic)\n dynamic = true;\n }\n return {\n dynamic,\n encoded: dynamic\n ? encodeParams(preparedParams)\n : concat(preparedParams.map(({ encoded }) => encoded)),\n };\n}\nexport function getArrayComponents(type) {\n const matches = type.match(/^(.*)\\[(\\d+)?\\]$/);\n return matches\n ? // Return `null` if the array is dynamic.\n [matches[2] ? Number(matches[2]) : null, matches[1]]\n : undefined;\n}\n//# sourceMappingURL=encodeAbiParameters.js.map","import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nexport class InvalidDomainError extends BaseError {\n constructor({ domain }) {\n super(`Invalid domain \"${stringify(domain)}\".`, {\n metaMessages: ['Must be a valid EIP-712 domain.'],\n });\n }\n}\nexport class InvalidPrimaryTypeError extends BaseError {\n constructor({ primaryType, types, }) {\n super(`Invalid primary type \\`${primaryType}\\` must be one of \\`${JSON.stringify(Object.keys(types))}\\`.`, {\n docsPath: '/api/glossary/Errors#typeddatainvalidprimarytypeerror',\n metaMessages: ['Check that the primary type is a key in `types`.'],\n });\n }\n}\nexport class InvalidStructTypeError extends BaseError {\n constructor({ type }) {\n super(`Struct type \"${type}\" is invalid.`, {\n metaMessages: ['Struct type must not be a Solidity type.'],\n name: 'InvalidStructTypeError',\n });\n }\n}\n//# sourceMappingURL=typedData.js.map","export const stringify = (value, replacer, space) => JSON.stringify(value, (key, value_) => {\n const value = typeof value_ === 'bigint' ? value_.toString() : value_;\n return typeof replacer === 'function' ? replacer(key, value) : value;\n}, space);\n//# sourceMappingURL=stringify.js.map","import { BytesSizeMismatchError } from '../errors/abi.js';\nimport { InvalidAddressError } from '../errors/address.js';\nimport { InvalidDomainError, InvalidPrimaryTypeError, InvalidStructTypeError, } from '../errors/typedData.js';\nimport { isAddress } from './address/isAddress.js';\nimport { size } from './data/size.js';\nimport { numberToHex } from './encoding/toHex.js';\nimport { bytesRegex, integerRegex } from './regex.js';\nimport { hashDomain, } from './signature/hashTypedData.js';\nimport { stringify } from './stringify.js';\nexport function serializeTypedData(parameters) {\n const { domain: domain_, message: message_, primaryType, types, } = parameters;\n const normalizeData = (struct, data_) => {\n const data = { ...data_ };\n for (const param of struct) {\n const { name, type } = param;\n if (type === 'address')\n data[name] = data[name].toLowerCase();\n }\n return data;\n };\n const domain = (() => {\n if (!types.EIP712Domain)\n return {};\n if (!domain_)\n return {};\n return normalizeData(types.EIP712Domain, domain_);\n })();\n const message = (() => {\n if (primaryType === 'EIP712Domain')\n return undefined;\n return normalizeData(types[primaryType], message_);\n })();\n return stringify({ domain, message, primaryType, types });\n}\nexport function validateTypedData(parameters) {\n const { domain, message, primaryType, types } = parameters;\n const validateData = (struct, data) => {\n for (const param of struct) {\n const { name, type } = param;\n const value = data[name];\n const integerMatch = type.match(integerRegex);\n if (integerMatch &&\n (typeof value === 'number' || typeof value === 'bigint')) {\n const [_type, base, size_] = integerMatch;\n // If number cannot be cast to a sized hex value, it is out of range\n // and will throw.\n numberToHex(value, {\n signed: base === 'int',\n size: Number.parseInt(size_, 10) / 8,\n });\n }\n if (type === 'address' && typeof value === 'string' && !isAddress(value))\n throw new InvalidAddressError({ address: value });\n const bytesMatch = type.match(bytesRegex);\n if (bytesMatch) {\n const [_type, size_] = bytesMatch;\n if (size_ && size(value) !== Number.parseInt(size_, 10))\n throw new BytesSizeMismatchError({\n expectedSize: Number.parseInt(size_, 10),\n givenSize: size(value),\n });\n }\n const struct = types[type];\n if (struct) {\n validateReference(type);\n validateData(struct, value);\n }\n }\n };\n // Validate domain types.\n if (types.EIP712Domain && domain) {\n if (typeof domain !== 'object')\n throw new InvalidDomainError({ domain });\n validateData(types.EIP712Domain, domain);\n }\n // Validate message types.\n if (primaryType !== 'EIP712Domain') {\n if (types[primaryType])\n validateData(types[primaryType], message);\n else\n throw new InvalidPrimaryTypeError({ primaryType, types });\n }\n}\nexport function getTypesForEIP712Domain({ domain, }) {\n return [\n typeof domain?.name === 'string' && { name: 'name', type: 'string' },\n domain?.version && { name: 'version', type: 'string' },\n (typeof domain?.chainId === 'number' ||\n typeof domain?.chainId === 'bigint') && {\n name: 'chainId',\n type: 'uint256',\n },\n domain?.verifyingContract && {\n name: 'verifyingContract',\n type: 'address',\n },\n domain?.salt && { name: 'salt', type: 'bytes32' },\n ].filter(Boolean);\n}\nexport function domainSeparator({ domain }) {\n return hashDomain({\n domain: domain,\n types: {\n EIP712Domain: getTypesForEIP712Domain({ domain }),\n },\n });\n}\n/** @internal */\nfunction validateReference(type) {\n // Struct type must not be a Solidity type.\n if (type === 'address' ||\n type === 'bool' ||\n type === 'string' ||\n type.startsWith('bytes') ||\n type.startsWith('uint') ||\n type.startsWith('int'))\n throw new InvalidStructTypeError({ type });\n}\n//# sourceMappingURL=typedData.js.map","// Implementation forked and adapted from https://github.com/MetaMask/eth-sig-util/blob/main/src/sign-typed-data.ts\nimport { encodeAbiParameters, } from '../abi/encodeAbiParameters.js';\nimport { concat } from '../data/concat.js';\nimport { toHex } from '../encoding/toHex.js';\nimport { keccak256 } from '../hash/keccak256.js';\nimport { getTypesForEIP712Domain, validateTypedData, } from '../typedData.js';\nexport function hashTypedData(parameters) {\n const { domain = {}, message, primaryType, } = parameters;\n const types = {\n EIP712Domain: getTypesForEIP712Domain({ domain }),\n ...parameters.types,\n };\n // Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc\n // as we can't statically check this with TypeScript.\n validateTypedData({\n domain,\n message,\n primaryType,\n types,\n });\n const parts = ['0x1901'];\n if (domain)\n parts.push(hashDomain({\n domain,\n types: types,\n }));\n if (primaryType !== 'EIP712Domain')\n parts.push(hashStruct({\n data: message,\n primaryType,\n types: types,\n }));\n return keccak256(concat(parts));\n}\nexport function hashDomain({ domain, types, }) {\n return hashStruct({\n data: domain,\n primaryType: 'EIP712Domain',\n types: types,\n });\n}\nexport function hashStruct({ data, primaryType, types, }) {\n const encoded = encodeData({\n data: data,\n primaryType,\n types: types,\n });\n return keccak256(encoded);\n}\nfunction encodeData({ data, primaryType, types, }) {\n const encodedTypes = [{ type: 'bytes32' }];\n const encodedValues = [hashType({ primaryType, types })];\n for (const field of types[primaryType]) {\n const [type, value] = encodeField({\n types,\n name: field.name,\n type: field.type,\n value: data[field.name],\n });\n encodedTypes.push(type);\n encodedValues.push(value);\n }\n return encodeAbiParameters(encodedTypes, encodedValues);\n}\nfunction hashType({ primaryType, types, }) {\n const encodedHashType = toHex(encodeType({ primaryType, types }));\n return keccak256(encodedHashType);\n}\nexport function encodeType({ primaryType, types, }) {\n let result = '';\n const unsortedDeps = findTypeDependencies({ primaryType, types });\n unsortedDeps.delete(primaryType);\n const deps = [primaryType, ...Array.from(unsortedDeps).sort()];\n for (const type of deps) {\n result += `${type}(${types[type]\n .map(({ name, type: t }) => `${t} ${name}`)\n .join(',')})`;\n }\n return result;\n}\nfunction findTypeDependencies({ primaryType: primaryType_, types, }, results = new Set()) {\n const match = primaryType_.match(/^\\w*/u);\n const primaryType = match?.[0];\n if (results.has(primaryType) || types[primaryType] === undefined) {\n return results;\n }\n results.add(primaryType);\n for (const field of types[primaryType]) {\n findTypeDependencies({ primaryType: field.type, types }, results);\n }\n return results;\n}\nfunction encodeField({ types, name, type, value, }) {\n if (types[type] !== undefined) {\n return [\n { type: 'bytes32' },\n keccak256(encodeData({ data: value, primaryType: type, types })),\n ];\n }\n if (type === 'bytes')\n return [{ type: 'bytes32' }, keccak256(value)];\n if (type === 'string')\n return [{ type: 'bytes32' }, keccak256(toHex(value))];\n if (type.lastIndexOf(']') === type.length - 1) {\n const parsedType = type.slice(0, type.lastIndexOf('['));\n const typeValuePairs = value.map((item) => encodeField({\n name,\n type: parsedType,\n types,\n value: item,\n }));\n return [\n { type: 'bytes32' },\n keccak256(encodeAbiParameters(typeValuePairs.map(([t]) => t), typeValuePairs.map(([, v]) => v))),\n ];\n }\n return [{ type }, value];\n}\n//# sourceMappingURL=hashTypedData.js.map","import { secp256k1 } from '@noble/curves/secp256k1';\nimport { toHex } from '../utils/encoding/toHex.js';\nimport { toAccount } from './toAccount.js';\nimport { publicKeyToAddress, } from './utils/publicKeyToAddress.js';\nimport { sign } from './utils/sign.js';\nimport { signAuthorization } from './utils/signAuthorization.js';\nimport { signMessage } from './utils/signMessage.js';\nimport { signTransaction, } from './utils/signTransaction.js';\nimport { signTypedData, } from './utils/signTypedData.js';\n/**\n * @description Creates an Account from a private key.\n *\n * @returns A Private Key Account.\n */\nexport function privateKeyToAccount(privateKey, options = {}) {\n const { nonceManager } = options;\n const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false));\n const address = publicKeyToAddress(publicKey);\n const account = toAccount({\n address,\n nonceManager,\n async sign({ hash }) {\n return sign({ hash, privateKey, to: 'hex' });\n },\n async signAuthorization(authorization) {\n return signAuthorization({ ...authorization, privateKey });\n },\n async signMessage({ message }) {\n return signMessage({ message, privateKey });\n },\n async signTransaction(transaction, { serializer } = {}) {\n return signTransaction({ privateKey, transaction, serializer });\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey });\n },\n });\n return {\n ...account,\n publicKey,\n source: 'privateKey',\n };\n}\n//# sourceMappingURL=privateKeyToAccount.js.map","import { checksumAddress, } from '../../utils/address/getAddress.js';\nimport { keccak256, } from '../../utils/hash/keccak256.js';\n/**\n * @description Converts an ECDSA public key to an address.\n *\n * @param publicKey The public key to convert.\n *\n * @returns The address.\n */\nexport function publicKeyToAddress(publicKey) {\n const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);\n return checksumAddress(`0x${address}`);\n}\n//# sourceMappingURL=publicKeyToAddress.js.map","// TODO(v3): Rename to `toLocalAccount` + add `source` property to define source (privateKey, mnemonic, hdKey, etc).\nimport { InvalidAddressError, } from '../errors/address.js';\nimport { isAddress, } from '../utils/address/isAddress.js';\n/**\n * @description Creates an Account from a custom signing implementation.\n *\n * @returns A Local Account.\n */\nexport function toAccount(source) {\n if (typeof source === 'string') {\n if (!isAddress(source, { strict: false }))\n throw new InvalidAddressError({ address: source });\n return {\n address: source,\n type: 'json-rpc',\n };\n }\n if (!isAddress(source.address, { strict: false }))\n throw new InvalidAddressError({ address: source.address });\n return {\n address: source.address,\n nonceManager: source.nonceManager,\n sign: source.sign,\n signAuthorization: source.signAuthorization,\n signMessage: source.signMessage,\n signTransaction: source.signTransaction,\n signTypedData: source.signTypedData,\n source: 'custom',\n type: 'local',\n };\n}\n//# sourceMappingURL=toAccount.js.map","import { hashAuthorization, } from '../../utils/authorization/hashAuthorization.js';\nimport { sign, } from './sign.js';\n/**\n * Signs an Authorization hash in [EIP-7702 format](https://eips.ethereum.org/EIPS/eip-7702): `keccak256('0x05' || rlp([chain_id, address, nonce]))`.\n */\nexport async function signAuthorization(parameters) {\n const { chainId, nonce, privateKey, to = 'object' } = parameters;\n const address = parameters.contractAddress ?? parameters.address;\n const signature = await sign({\n hash: hashAuthorization({ address, chainId, nonce }),\n privateKey,\n to,\n });\n if (to === 'object')\n return {\n address,\n chainId,\n nonce,\n ...signature,\n };\n return signature;\n}\n//# sourceMappingURL=signAuthorization.js.map","import { hashMessage, } from '../../utils/signature/hashMessage.js';\nimport { sign } from './sign.js';\n/**\n * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\n */\nexport async function signMessage({ message, privateKey, }) {\n return await sign({ hash: hashMessage(message), privateKey, to: 'hex' });\n}\n//# sourceMappingURL=signMessage.js.map","import { keccak256, } from '../../utils/hash/keccak256.js';\nimport { serializeTransaction, } from '../../utils/transaction/serializeTransaction.js';\nimport { sign } from './sign.js';\nexport async function signTransaction(parameters) {\n const { privateKey, transaction, serializer = serializeTransaction, } = parameters;\n const signableTransaction = (() => {\n // For EIP-4844 Transactions, we want to sign the transaction payload body (tx_payload_body) without the sidecars (ie. without the network wrapper).\n // See: https://github.com/ethereum/EIPs/blob/e00f4daa66bd56e2dbd5f1d36d09fd613811a48b/EIPS/eip-4844.md#networking\n if (transaction.type === 'eip4844')\n return {\n ...transaction,\n sidecars: false,\n };\n return transaction;\n })();\n const signature = await sign({\n hash: keccak256(await serializer(signableTransaction)),\n privateKey,\n });\n return (await serializer(transaction, signature));\n}\n//# sourceMappingURL=signTransaction.js.map","import { hashTypedData, } from '../../utils/signature/hashTypedData.js';\nimport { sign } from './sign.js';\n/**\n * @description Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712):\n * `sign(keccak256(\"\\x19\\x01\" ‖ domainSeparator ‖ hashStruct(message)))`.\n *\n * @returns The signature.\n */\nexport async function signTypedData(parameters) {\n const { privateKey, ...typedData } = parameters;\n return await sign({\n hash: hashTypedData(typedData),\n privateKey,\n to: 'hex',\n });\n}\n//# sourceMappingURL=signTypedData.js.map","'use strict'\n\nexports.byteLength = byteLength\nexports.toByteArray = toByteArray\nexports.fromByteArray = fromByteArray\n\nvar lookup = []\nvar revLookup = []\nvar Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array\n\nvar code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\nfor (var i = 0, len = code.length; i < len; ++i) {\n lookup[i] = code[i]\n revLookup[code.charCodeAt(i)] = i\n}\n\n// Support decoding URL-safe base64 strings, as Node.js does.\n// See: https://en.wikipedia.org/wiki/Base64#URL_applications\nrevLookup['-'.charCodeAt(0)] = 62\nrevLookup['_'.charCodeAt(0)] = 63\n\nfunction getLens (b64) {\n var len = b64.length\n\n if (len % 4 > 0) {\n throw new Error('Invalid string. Length must be a multiple of 4')\n }\n\n // Trim off extra bytes after placeholder bytes are found\n // See: https://github.com/beatgammit/base64-js/issues/42\n var validLen = b64.indexOf('=')\n if (validLen === -1) validLen = len\n\n var placeHoldersLen = validLen === len\n ? 0\n : 4 - (validLen % 4)\n\n return [validLen, placeHoldersLen]\n}\n\n// base64 is 4/3 + up to two characters of the original data\nfunction byteLength (b64) {\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction _byteLength (b64, validLen, placeHoldersLen) {\n return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen\n}\n\nfunction toByteArray (b64) {\n var tmp\n var lens = getLens(b64)\n var validLen = lens[0]\n var placeHoldersLen = lens[1]\n\n var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))\n\n var curByte = 0\n\n // if there are placeholders, only get up to the last complete 4 chars\n var len = placeHoldersLen > 0\n ? validLen - 4\n : validLen\n\n var i\n for (i = 0; i < len; i += 4) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 18) |\n (revLookup[b64.charCodeAt(i + 1)] << 12) |\n (revLookup[b64.charCodeAt(i + 2)] << 6) |\n revLookup[b64.charCodeAt(i + 3)]\n arr[curByte++] = (tmp >> 16) & 0xFF\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 2) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 2) |\n (revLookup[b64.charCodeAt(i + 1)] >> 4)\n arr[curByte++] = tmp & 0xFF\n }\n\n if (placeHoldersLen === 1) {\n tmp =\n (revLookup[b64.charCodeAt(i)] << 10) |\n (revLookup[b64.charCodeAt(i + 1)] << 4) |\n (revLookup[b64.charCodeAt(i + 2)] >> 2)\n arr[curByte++] = (tmp >> 8) & 0xFF\n arr[curByte++] = tmp & 0xFF\n }\n\n return arr\n}\n\nfunction tripletToBase64 (num) {\n return lookup[num >> 18 & 0x3F] +\n lookup[num >> 12 & 0x3F] +\n lookup[num >> 6 & 0x3F] +\n lookup[num & 0x3F]\n}\n\nfunction encodeChunk (uint8, start, end) {\n var tmp\n var output = []\n for (var i = start; i < end; i += 3) {\n tmp =\n ((uint8[i] << 16) & 0xFF0000) +\n ((uint8[i + 1] << 8) & 0xFF00) +\n (uint8[i + 2] & 0xFF)\n output.push(tripletToBase64(tmp))\n }\n return output.join('')\n}\n\nfunction fromByteArray (uint8) {\n var tmp\n var len = uint8.length\n var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes\n var parts = []\n var maxChunkLength = 16383 // must be multiple of 3\n\n // go through the array every three bytes, we'll deal with trailing stuff later\n for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {\n parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)))\n }\n\n // pad the end with zeros, but make sure to not forget the extra bytes\n if (extraBytes === 1) {\n tmp = uint8[len - 1]\n parts.push(\n lookup[tmp >> 2] +\n lookup[(tmp << 4) & 0x3F] +\n '=='\n )\n } else if (extraBytes === 2) {\n tmp = (uint8[len - 2] << 8) + uint8[len - 1]\n parts.push(\n lookup[tmp >> 10] +\n lookup[(tmp >> 4) & 0x3F] +\n lookup[(tmp << 2) & 0x3F] +\n '='\n )\n }\n\n return parts.join('')\n}\n","/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */\nconst P = 2n ** 255n - 19n; // ed25519 is twisted edwards curve\nconst N = 2n ** 252n + 27742317777372353535851937790883648493n; // curve's (group) order\nconst Gx = 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an; // base point x\nconst Gy = 0x6666666666666666666666666666666666666666666666666666666666666658n; // base point y\nconst CURVE = {\n a: -1n,\n d: 37095705934669439343138083508754565189542113879843219016388785533085940283555n,\n p: P, n: N, h: 8, Gx, Gy // field prime, curve (group) order, cofactor\n};\nconst err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace\nconst str = (s) => typeof s === 'string'; // is string\nconst au8 = (a, l) => // is Uint8Array (of specific length)\n !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ?\n err('Uint8Array expected') : a;\nconst u8n = (data) => new Uint8Array(data); // creates Uint8Array\nconst toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a\nconst mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division\nconst isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is xyzt point\nlet Gpows = undefined; // precomputes for base point G\nclass Point {\n constructor(ex, ey, ez, et) {\n this.ex = ex;\n this.ey = ey;\n this.ez = ez;\n this.et = et;\n }\n static fromAffine(p) { return new Point(p.x, p.y, 1n, mod(p.x * p.y)); }\n static fromHex(hex, strict = true) {\n const { d } = CURVE;\n hex = toU8(hex, 32);\n const normed = hex.slice(); // copy the array to not mess it up\n normed[31] = hex[31] & ~0x80; // adjust first LE byte = last BE byte\n const y = b2n_LE(normed); // decode as little-endian, convert to num\n if (y === 0n) { // y=0 is valid, proceed\n }\n else {\n if (strict && !(0n < y && y < P))\n err('bad y coord 1'); // strict=true [1..P-1]\n if (!strict && !(0n < y && y < 2n ** 256n))\n err('bad y coord 2'); // strict=false [1..2^256-1]\n }\n const y2 = mod(y * y); // y²\n const u = mod(y2 - 1n); // u=y²-1\n const v = mod(d * y2 + 1n); // v=dy²+1\n let { isValid, value: x } = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root\n if (!isValid)\n err('bad y coordinate 3'); // not square root: bad point\n const isXOdd = (x & 1n) === 1n; // adjust sign of x coordinate\n const isHeadOdd = (hex[31] & 0x80) !== 0;\n if (isHeadOdd !== isXOdd)\n x = mod(-x);\n return new Point(x, y, 1n, mod(x * y)); // Z=1, T=xy\n }\n get x() { return this.toAffine().x; } // .x, .y will call expensive toAffine.\n get y() { return this.toAffine().y; } // Should be used with care.\n equals(other) {\n const { ex: X1, ey: Y1, ez: Z1 } = this;\n const { ex: X2, ey: Y2, ez: Z2 } = isPoint(other); // isPoint() checks class equality\n const X1Z2 = mod(X1 * Z2), X2Z1 = mod(X2 * Z1);\n const Y1Z2 = mod(Y1 * Z2), Y2Z1 = mod(Y2 * Z1);\n return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;\n }\n is0() { return this.equals(I); }\n negate() {\n return new Point(mod(-this.ex), this.ey, this.ez, mod(-this.et));\n }\n double() {\n const { ex: X1, ey: Y1, ez: Z1 } = this; // Cost: 4M + 4S + 1*a + 6add + 1*2\n const { a } = CURVE; // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd\n const A = mod(X1 * X1);\n const B = mod(Y1 * Y1);\n const C = mod(2n * mod(Z1 * Z1));\n const D = mod(a * A);\n const x1y1 = X1 + Y1;\n const E = mod(mod(x1y1 * x1y1) - A - B);\n const G = D + B;\n const F = G - C;\n const H = D - B;\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new Point(X3, Y3, Z3, T3);\n }\n add(other) {\n const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; // Cost: 8M + 1*k + 8add + 1*2.\n const { ex: X2, ey: Y2, ez: Z2, et: T2 } = isPoint(other); // doesn't check if other on-curve\n const { a, d } = CURVE; // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3\n const A = mod(X1 * X2);\n const B = mod(Y1 * Y2);\n const C = mod(T1 * d * T2);\n const D = mod(Z1 * Z2);\n const E = mod((X1 + Y1) * (X2 + Y2) - A - B);\n const F = mod(D - C);\n const G = mod(D + C);\n const H = mod(B - a * A);\n const X3 = mod(E * F);\n const Y3 = mod(G * H);\n const T3 = mod(E * H);\n const Z3 = mod(F * G);\n return new Point(X3, Y3, Z3, T3);\n }\n mul(n, safe = true) {\n if (n === 0n)\n return safe === true ? err('cannot multiply by 0') : I;\n if (!(typeof n === 'bigint' && 0n < n && n < N))\n err('invalid scalar, must be < L');\n if (!safe && this.is0() || n === 1n)\n return this; // safe=true bans 0. safe=false allows 0.\n if (this.equals(G))\n return wNAF(n).p; // use wNAF precomputes for base points\n let p = I, f = G; // init result point & fake point\n for (let d = this; n > 0n; d = d.double(), n >>= 1n) { // double-and-add ladder\n if (n & 1n)\n p = p.add(d); // if bit is present, add to point\n else if (safe)\n f = f.add(d); // if not, add to fake for timing safety\n }\n return p;\n }\n multiply(scalar) { return this.mul(scalar); } // Aliases for compatibilty\n clearCofactor() { return this.mul(BigInt(CURVE.h), false); } // multiply by cofactor\n isSmallOrder() { return this.clearCofactor().is0(); } // check if P is small order\n isTorsionFree() {\n let p = this.mul(N / 2n, false).double(); // ensures the point is not \"bad\".\n if (N % 2n)\n p = p.add(this); // P^(N+1) // P*N == (P*(N/2))*2+P\n return p.is0();\n }\n toAffine() {\n const { ex: x, ey: y, ez: z } = this; // (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy)\n if (this.is0())\n return { x: 0n, y: 0n }; // fast-path for zero point\n const iz = invert(z); // z^-1: invert z\n if (mod(z * iz) !== 1n)\n err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math\n return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1\n }\n toRawBytes() {\n const { x, y } = this.toAffine(); // convert to affine 2d point\n const b = n2b_32LE(y); // encode number to 32 bytes\n b[31] |= x & 1n ? 0x80 : 0; // store sign in first LE byte\n return b;\n }\n toHex() { return b2h(this.toRawBytes()); } // encode to hex string\n}\nPoint.BASE = new Point(Gx, Gy, 1n, mod(Gx * Gy)); // Generator / Base point\nPoint.ZERO = new Point(0n, 1n, 1n, 0n); // Identity / Zero point\nconst { BASE: G, ZERO: I } = Point; // Generator, identity points\nconst padh = (num, pad) => num.toString(16).padStart(pad, '0');\nconst b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex\nconst h2b = (hex) => {\n const l = hex.length; // error if not string,\n if (!str(hex) || l % 2)\n err('hex invalid 1'); // or has odd length like 3, 5.\n const arr = u8n(l / 2); // create result array\n for (let i = 0; i < arr.length; i++) {\n const j = i * 2;\n const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr\n const b = Number.parseInt(h, 16); // byte, created from string part\n if (Number.isNaN(b) || b < 0)\n err('hex invalid 2'); // byte must be valid 0 <= byte < 256\n arr[i] = b;\n }\n return arr;\n};\nconst n2b_32LE = (num) => h2b(padh(num, 32 * 2)).reverse(); // number to bytes LE\nconst b2n_LE = (b) => BigInt('0x' + b2h(u8n(au8(b)).reverse())); // bytes LE to num\nconst concatB = (...arrs) => {\n const r = u8n(arrs.reduce((sum, a) => sum + au8(a).length, 0)); // create u8a of summed length\n let pad = 0; // walk through each array,\n arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type\n return r;\n};\nconst invert = (num, md = P) => {\n if (num === 0n || md <= 0n)\n err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now\n let a = mod(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n;\n while (a !== 0n) { // uses euclidean gcd algorithm\n const q = b / a, r = b % a; // not constant-time\n const m = x - u * q, n = y - v * q;\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point\n};\nconst pow2 = (x, power) => {\n let r = x;\n while (power-- > 0n) {\n r *= r;\n r %= P;\n }\n return r;\n};\nconst pow_2_252_3 = (x) => {\n const x2 = (x * x) % P; // x^2, bits 1\n const b2 = (x2 * x) % P; // x^3, bits 11\n const b4 = (pow2(b2, 2n) * b2) % P; // x^(2^4-1), bits 1111\n const b5 = (pow2(b4, 1n) * x) % P; // x^(2^5-1), bits 11111\n const b10 = (pow2(b5, 5n) * b5) % P; // x^(2^10)\n const b20 = (pow2(b10, 10n) * b10) % P; // x^(2^20)\n const b40 = (pow2(b20, 20n) * b20) % P; // x^(2^40)\n const b80 = (pow2(b40, 40n) * b40) % P; // x^(2^80)\n const b160 = (pow2(b80, 80n) * b80) % P; // x^(2^160)\n const b240 = (pow2(b160, 80n) * b80) % P; // x^(2^240)\n const b250 = (pow2(b240, 10n) * b10) % P; // x^(2^250)\n const pow_p_5_8 = (pow2(b250, 2n) * x) % P; // < To pow to (p+3)/8, multiply it by x.\n return { pow_p_5_8, b2 };\n};\nconst RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n; // √-1\nconst uvRatio = (u, v) => {\n const v3 = mod(v * v * v); // v³\n const v7 = mod(v3 * v3 * v); // v⁷\n const pow = pow_2_252_3(u * v7).pow_p_5_8; // (uv⁷)^(p-5)/8\n let x = mod(u * v3 * pow); // (uv³)(uv⁷)^(p-5)/8\n const vx2 = mod(v * x * x); // vx²\n const root1 = x; // First root candidate\n const root2 = mod(x * RM1); // Second root candidate; RM1 is √-1\n const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root\n const useRoot2 = vx2 === mod(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4)\n const noRoot = vx2 === mod(-u * RM1); // There is no valid root, vx² = -u√-1\n if (useRoot1)\n x = root1;\n if (useRoot2 || noRoot)\n x = root2; // We return root2 anyway, for const-time\n if ((mod(x) & 1n) === 1n)\n x = mod(-x); // edIsNegative\n return { isValid: useRoot1 || useRoot2, value: x };\n};\nconst modL_LE = (hash) => mod(b2n_LE(hash), N); // modulo L; but little-endian\nlet _shaS;\nconst sha512a = (...m) => etc.sha512Async(...m); // Async SHA512\nconst sha512s = (...m) => // Sync SHA512, not set by default\n typeof _shaS === 'function' ? _shaS(...m) : err('etc.sha512Sync not set');\nconst hash2extK = (hashed) => {\n const head = hashed.slice(0, 32); // slice creates a copy, unlike subarray\n head[0] &= 248; // Clamp bits: 0b1111_1000,\n head[31] &= 127; // 0b0111_1111,\n head[31] |= 64; // 0b0100_0000\n const prefix = hashed.slice(32, 64); // private key \"prefix\"\n const scalar = modL_LE(head); // modular division over curve order\n const point = G.mul(scalar); // public key point\n const pointBytes = point.toRawBytes(); // point serialized to Uint8Array\n return { head, prefix, scalar, point, pointBytes };\n};\n// RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point.\nconst getExtendedPublicKeyAsync = (priv) => sha512a(toU8(priv, 32)).then(hash2extK);\nconst getExtendedPublicKey = (priv) => hash2extK(sha512s(toU8(priv, 32)));\nconst getPublicKeyAsync = (priv) => getExtendedPublicKeyAsync(priv).then(p => p.pointBytes);\nconst getPublicKey = (priv) => getExtendedPublicKey(priv).pointBytes;\nfunction hashFinish(asynchronous, res) {\n if (asynchronous)\n return sha512a(res.hashable).then(res.finish);\n return res.finish(sha512s(res.hashable));\n}\nconst _sign = (e, rBytes, msg) => {\n const { pointBytes: P, scalar: s } = e;\n const r = modL_LE(rBytes); // r was created outside, reduce it modulo L\n const R = G.mul(r).toRawBytes(); // R = [r]B\n const hashable = concatB(R, P, msg); // dom2(F, C) || R || A || PH(M)\n const finish = (hashed) => {\n const S = mod(r + modL_LE(hashed) * s, N); // S = (r + k * s) mod L; 0 <= s < l\n return au8(concatB(R, n2b_32LE(S)), 64); // 64-byte sig: 32b R.x + 32b LE(S)\n };\n return { hashable, finish };\n};\nconst signAsync = async (msg, privKey) => {\n const m = toU8(msg); // RFC8032 5.1.6: sign msg with key async\n const e = await getExtendedPublicKeyAsync(privKey); // pub,prfx\n const rBytes = await sha512a(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M))\n return hashFinish(true, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature\n};\nconst sign = (msg, privKey) => {\n const m = toU8(msg); // RFC8032 5.1.6: sign msg with key sync\n const e = getExtendedPublicKey(privKey); // pub,prfx\n const rBytes = sha512s(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M))\n return hashFinish(false, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature\n};\nconst _verify = (sig, msg, pub) => {\n msg = toU8(msg); // Message hex str/Bytes\n sig = toU8(sig, 64); // Signature hex str/Bytes, must be 64 bytes\n const A = Point.fromHex(pub, false); // public key A decoded\n const R = Point.fromHex(sig.slice(0, 32), false); // 0 <= R < 2^256: ZIP215 R can be >= P\n const s = b2n_LE(sig.slice(32, 64)); // Decode second half as an integer S\n const SB = G.mul(s, false); // in the range 0 <= s < L\n const hashable = concatB(R.toRawBytes(), A.toRawBytes(), msg); // dom2(F, C) || R || A || PH(M)\n const finish = (hashed) => {\n const k = modL_LE(hashed); // decode in little-endian, modulo L\n const RkA = R.add(A.mul(k, false)); // [8]R + [8][k]A'\n return RkA.add(SB.negate()).clearCofactor().is0(); // [8][S]B = [8]R + [8][k]A'\n };\n return { hashable, finish };\n};\n// RFC8032 5.1.7: verification async, sync\nconst verifyAsync = async (s, m, p) => hashFinish(true, _verify(s, m, p));\nconst verify = (s, m, p) => hashFinish(false, _verify(s, m, p));\nconst cr = () => // We support: 1) browsers 2) node.js 19+\n typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined;\nconst etc = {\n bytesToHex: b2h, hexToBytes: h2b, concatBytes: concatB,\n mod, invert,\n randomBytes: (len) => {\n const crypto = cr(); // Can be shimmed in node.js <= 18 to prevent error:\n // import { webcrypto } from 'node:crypto';\n // if (!globalThis.crypto) globalThis.crypto = webcrypto;\n if (!crypto)\n err('crypto.getRandomValues must be defined');\n return crypto.getRandomValues(u8n(len));\n },\n sha512Async: async (...messages) => {\n const crypto = cr();\n if (!crypto)\n err('crypto.subtle or etc.sha512Async must be defined');\n const m = concatB(...messages);\n return u8n(await crypto.subtle.digest('SHA-512', m.buffer));\n },\n sha512Sync: undefined, // Actual logic below\n};\nObject.defineProperties(etc, { sha512Sync: {\n configurable: false, get() { return _shaS; }, set(f) { if (!_shaS)\n _shaS = f; },\n } });\nconst utils = {\n getExtendedPublicKeyAsync, getExtendedPublicKey,\n randomPrivateKey: () => etc.randomBytes(32),\n precompute(w = 8, p = G) { p.multiply(3n); return p; }, // no-op\n};\nconst W = 8; // Precomputes-related code. W = window size\nconst precompute = () => {\n const points = []; // 10x sign(), 2x verify(). To achieve this,\n const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate\n let p = G, b = p; // a lot of points related to base point G.\n for (let w = 0; w < windows; w++) { // Points are stored in array and used\n b = p; // any time Gx multiplication is done.\n points.push(b); // They consume 16-32 MiB of RAM.\n for (let i = 1; i < 2 ** (W - 1); i++) {\n b = b.add(p);\n points.push(b);\n }\n p = b.double(); // Precomputes don't speed-up getSharedKey,\n } // which multiplies user point by scalar,\n return points; // when precomputes are using base point\n};\nconst wNAF = (n) => {\n // Compared to other point mult methods,\n const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction\n const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate\n let p = I, f = G; // f must be G, or could become I in the end\n const windows = 1 + 256 / W; // W=8 17 windows\n const wsize = 2 ** (W - 1); // W=8 128 window size\n const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111\n const maxNum = 2 ** W; // W=8 256\n const shiftBy = BigInt(W); // W=8 8\n for (let w = 0; w < windows; w++) {\n const off = w * wsize;\n let wbits = Number(n & mask); // extract W bits.\n n >>= shiftBy; // shift number by W bits.\n if (wbits > wsize) {\n wbits -= maxNum;\n n += 1n;\n } // split if bits > max: +224 => 256-32\n const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both\n const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both\n if (wbits === 0) {\n f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point\n }\n else { // ^ can't add off2, off2 = I\n p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point\n }\n }\n return { p, f }; // return both real and fake points for JIT\n}; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul()\nexport { getPublicKey, getPublicKeyAsync, sign, verify, // Remove the export to easily use in REPL\nsignAsync, verifyAsync, CURVE, etc, utils, Point as ExtendedPoint }; // envs like browser console\n","/**\n * Utils for modular division and fields.\n * Field over 11 is a finite (Galois) field is integer number operations `mod 11`.\n * There is no division: it is replaced by modular multiplicative inverse.\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { _validateObject, anumber, bitMask, bytesToNumberBE, bytesToNumberLE, ensureBytes, numberToBytesBE, numberToBytesLE, } from \"../utils.js\";\n// prettier-ignore\nconst _0n = BigInt(0), _1n = BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3);\n// prettier-ignore\nconst _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _7n = /* @__PURE__ */ BigInt(7);\n// prettier-ignore\nconst _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9), _16n = /* @__PURE__ */ BigInt(16);\n// Calculates a modulo b\nexport function mod(a, b) {\n const result = a % b;\n return result >= _0n ? result : b + result;\n}\n/**\n * Efficiently raise num to power and do modular division.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n * @example\n * pow(2n, 6n, 11n) // 64n % 11n == 9n\n */\nexport function pow(num, power, modulo) {\n return FpPow(Field(modulo), num, power);\n}\n/** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */\nexport function pow2(x, power, modulo) {\n let res = x;\n while (power-- > _0n) {\n res *= res;\n res %= modulo;\n }\n return res;\n}\n/**\n * Inverses number over modulo.\n * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/).\n */\nexport function invert(number, modulo) {\n if (number === _0n)\n throw new Error('invert: expected non-zero number');\n if (modulo <= _0n)\n throw new Error('invert: expected positive modulus, got ' + modulo);\n // Fermat's little theorem \"CT-like\" version inv(n) = n^(m-2) mod m is 30x slower.\n let a = mod(number, modulo);\n let b = modulo;\n // prettier-ignore\n let x = _0n, y = _1n, u = _1n, v = _0n;\n while (a !== _0n) {\n // JIT applies optimization if those two lines follow each other\n const q = b / a;\n const r = b % a;\n const m = x - u * q;\n const n = y - v * q;\n // prettier-ignore\n b = a, a = r, x = u, y = v, u = m, v = n;\n }\n const gcd = b;\n if (gcd !== _1n)\n throw new Error('invert: does not exist');\n return mod(x, modulo);\n}\nfunction assertIsSquare(Fp, root, n) {\n if (!Fp.eql(Fp.sqr(root), n))\n throw new Error('Cannot find square root');\n}\n// Not all roots are possible! Example which will throw:\n// const NUM =\n// n = 72057594037927816n;\n// Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab'));\nfunction sqrt3mod4(Fp, n) {\n const p1div4 = (Fp.ORDER + _1n) / _4n;\n const root = Fp.pow(n, p1div4);\n assertIsSquare(Fp, root, n);\n return root;\n}\nfunction sqrt5mod8(Fp, n) {\n const p5div8 = (Fp.ORDER - _5n) / _8n;\n const n2 = Fp.mul(n, _2n);\n const v = Fp.pow(n2, p5div8);\n const nv = Fp.mul(n, v);\n const i = Fp.mul(Fp.mul(nv, _2n), v);\n const root = Fp.mul(nv, Fp.sub(i, Fp.ONE));\n assertIsSquare(Fp, root, n);\n return root;\n}\n// Based on RFC9380, Kong algorithm\n// prettier-ignore\nfunction sqrt9mod16(P) {\n const Fp_ = Field(P);\n const tn = tonelliShanks(P);\n const c1 = tn(Fp_, Fp_.neg(Fp_.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F\n const c2 = tn(Fp_, c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F\n const c3 = tn(Fp_, Fp_.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F\n const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic\n return (Fp, n) => {\n let tv1 = Fp.pow(n, c4); // 1. tv1 = x^c4\n let tv2 = Fp.mul(tv1, c1); // 2. tv2 = c1 * tv1\n const tv3 = Fp.mul(tv1, c2); // 3. tv3 = c2 * tv1\n const tv4 = Fp.mul(tv1, c3); // 4. tv4 = c3 * tv1\n const e1 = Fp.eql(Fp.sqr(tv2), n); // 5. e1 = (tv2^2) == x\n const e2 = Fp.eql(Fp.sqr(tv3), n); // 6. e2 = (tv3^2) == x\n tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x\n tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x\n const e3 = Fp.eql(Fp.sqr(tv2), n); // 9. e3 = (tv2^2) == x\n const root = Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select sqrt from tv1 & tv2\n assertIsSquare(Fp, root, n);\n return root;\n };\n}\n/**\n * Tonelli-Shanks square root search algorithm.\n * 1. https://eprint.iacr.org/2012/685.pdf (page 12)\n * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks\n * @param P field order\n * @returns function that takes field Fp (created from P) and number n\n */\nexport function tonelliShanks(P) {\n // Initialization (precomputation).\n // Caching initialization could boost perf by 7%.\n if (P < _3n)\n throw new Error('sqrt is not defined for small field');\n // Factor P - 1 = Q * 2^S, where Q is odd\n let Q = P - _1n;\n let S = 0;\n while (Q % _2n === _0n) {\n Q /= _2n;\n S++;\n }\n // Find the first quadratic non-residue Z >= 2\n let Z = _2n;\n const _Fp = Field(P);\n while (FpLegendre(_Fp, Z) === 1) {\n // Basic primality test for P. After x iterations, chance of\n // not finding quadratic non-residue is 2^x, so 2^1000.\n if (Z++ > 1000)\n throw new Error('Cannot find square root: probably non-prime P');\n }\n // Fast-path; usually done before Z, but we do \"primality test\".\n if (S === 1)\n return sqrt3mod4;\n // Slow-path\n // TODO: test on Fp2 and others\n let cc = _Fp.pow(Z, Q); // c = z^Q\n const Q1div2 = (Q + _1n) / _2n;\n return function tonelliSlow(Fp, n) {\n if (Fp.is0(n))\n return n;\n // Check if n is a quadratic residue using Legendre symbol\n if (FpLegendre(Fp, n) !== 1)\n throw new Error('Cannot find square root');\n // Initialize variables for the main loop\n let M = S;\n let c = Fp.mul(Fp.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp\n let t = Fp.pow(n, Q); // t = n^Q, first guess at the fudge factor\n let R = Fp.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root\n // Main loop\n // while t != 1\n while (!Fp.eql(t, Fp.ONE)) {\n if (Fp.is0(t))\n return Fp.ZERO; // if t=0 return R=0\n let i = 1;\n // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P)\n let t_tmp = Fp.sqr(t); // t^(2^1)\n while (!Fp.eql(t_tmp, Fp.ONE)) {\n i++;\n t_tmp = Fp.sqr(t_tmp); // t^(2^2)...\n if (i === M)\n throw new Error('Cannot find square root');\n }\n // Calculate the exponent for b: 2^(M - i - 1)\n const exponent = _1n << BigInt(M - i - 1); // bigint is important\n const b = Fp.pow(c, exponent); // b = 2^(M - i - 1)\n // Update variables\n M = i;\n c = Fp.sqr(b); // c = b^2\n t = Fp.mul(t, c); // t = (t * b^2)\n R = Fp.mul(R, b); // R = R*b\n }\n return R;\n };\n}\n/**\n * Square root for a finite field. Will try optimized versions first:\n *\n * 1. P ≡ 3 (mod 4)\n * 2. P ≡ 5 (mod 8)\n * 3. P ≡ 9 (mod 16)\n * 4. Tonelli-Shanks algorithm\n *\n * Different algorithms can give different roots, it is up to user to decide which one they want.\n * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve).\n */\nexport function FpSqrt(P) {\n // P ≡ 3 (mod 4) => √n = n^((P+1)/4)\n if (P % _4n === _3n)\n return sqrt3mod4;\n // P ≡ 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf\n if (P % _8n === _5n)\n return sqrt5mod8;\n // P ≡ 9 (mod 16) => Kong algorithm, page 11 of https://eprint.iacr.org/2012/685.pdf (algorithm 4)\n if (P % _16n === _9n)\n return sqrt9mod16(P);\n // Tonelli-Shanks algorithm\n return tonelliShanks(P);\n}\n// Little-endian check for first LE bit (last BE bit);\nexport const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n;\n// prettier-ignore\nconst FIELD_FIELDS = [\n 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr',\n 'eql', 'add', 'sub', 'mul', 'pow', 'div',\n 'addN', 'subN', 'mulN', 'sqrN'\n];\nexport function validateField(field) {\n const initial = {\n ORDER: 'bigint',\n MASK: 'bigint',\n BYTES: 'number',\n BITS: 'number',\n };\n const opts = FIELD_FIELDS.reduce((map, val) => {\n map[val] = 'function';\n return map;\n }, initial);\n _validateObject(field, opts);\n // const max = 16384;\n // if (field.BYTES < 1 || field.BYTES > max) throw new Error('invalid field');\n // if (field.BITS < 1 || field.BITS > 8 * max) throw new Error('invalid field');\n return field;\n}\n// Generic field functions\n/**\n * Same as `pow` but for Fp: non-constant-time.\n * Unsafe in some contexts: uses ladder, so can expose bigint bits.\n */\nexport function FpPow(Fp, num, power) {\n if (power < _0n)\n throw new Error('invalid exponent, negatives unsupported');\n if (power === _0n)\n return Fp.ONE;\n if (power === _1n)\n return num;\n let p = Fp.ONE;\n let d = num;\n while (power > _0n) {\n if (power & _1n)\n p = Fp.mul(p, d);\n d = Fp.sqr(d);\n power >>= _1n;\n }\n return p;\n}\n/**\n * Efficiently invert an array of Field elements.\n * Exception-free. Will return `undefined` for 0 elements.\n * @param passZero map 0 to 0 (instead of undefined)\n */\nexport function FpInvertBatch(Fp, nums, passZero = false) {\n const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined);\n // Walk from first to last, multiply them by each other MOD p\n const multipliedAcc = nums.reduce((acc, num, i) => {\n if (Fp.is0(num))\n return acc;\n inverted[i] = acc;\n return Fp.mul(acc, num);\n }, Fp.ONE);\n // Invert last element\n const invertedAcc = Fp.inv(multipliedAcc);\n // Walk from last to first, multiply them by inverted each other MOD p\n nums.reduceRight((acc, num, i) => {\n if (Fp.is0(num))\n return acc;\n inverted[i] = Fp.mul(acc, inverted[i]);\n return Fp.mul(acc, num);\n }, invertedAcc);\n return inverted;\n}\n// TODO: remove\nexport function FpDiv(Fp, lhs, rhs) {\n return Fp.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, Fp.ORDER) : Fp.inv(rhs));\n}\n/**\n * Legendre symbol.\n * Legendre constant is used to calculate Legendre symbol (a | p)\n * which denotes the value of a^((p-1)/2) (mod p).\n *\n * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue\n * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue\n * * (a | p) ≡ 0 if a ≡ 0 (mod p)\n */\nexport function FpLegendre(Fp, n) {\n // We can use 3rd argument as optional cache of this value\n // but seems unneeded for now. The operation is very fast.\n const p1mod2 = (Fp.ORDER - _1n) / _2n;\n const powered = Fp.pow(n, p1mod2);\n const yes = Fp.eql(powered, Fp.ONE);\n const zero = Fp.eql(powered, Fp.ZERO);\n const no = Fp.eql(powered, Fp.neg(Fp.ONE));\n if (!yes && !zero && !no)\n throw new Error('invalid Legendre symbol result');\n return yes ? 1 : zero ? 0 : -1;\n}\n// This function returns True whenever the value x is a square in the field F.\nexport function FpIsSquare(Fp, n) {\n const l = FpLegendre(Fp, n);\n return l === 1;\n}\n// CURVE.n lengths\nexport function nLength(n, nBitLength) {\n // Bit size, byte size of CURVE.n\n if (nBitLength !== undefined)\n anumber(nBitLength);\n const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length;\n const nByteLength = Math.ceil(_nBitLength / 8);\n return { nBitLength: _nBitLength, nByteLength };\n}\n/**\n * Creates a finite field. Major performance optimizations:\n * * 1. Denormalized operations like mulN instead of mul.\n * * 2. Identical object shape: never add or remove keys.\n * * 3. `Object.freeze`.\n * Fragile: always run a benchmark on a change.\n * Security note: operations don't check 'isValid' for all elements for performance reasons,\n * it is caller responsibility to check this.\n * This is low-level code, please make sure you know what you're doing.\n *\n * Note about field properties:\n * * CHARACTERISTIC p = prime number, number of elements in main subgroup.\n * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`.\n *\n * @param ORDER field order, probably prime, or could be composite\n * @param bitLen how many bits the field consumes\n * @param isLE (default: false) if encoding / decoding should be in little-endian\n * @param redef optional faster redefinitions of sqrt and other methods\n */\nexport function Field(ORDER, bitLenOrOpts, // TODO: use opts only in v2?\nisLE = false, opts = {}) {\n if (ORDER <= _0n)\n throw new Error('invalid field: expected ORDER > 0, got ' + ORDER);\n let _nbitLength = undefined;\n let _sqrt = undefined;\n let modFromBytes = false;\n let allowedLengths = undefined;\n if (typeof bitLenOrOpts === 'object' && bitLenOrOpts != null) {\n if (opts.sqrt || isLE)\n throw new Error('cannot specify opts in two arguments');\n const _opts = bitLenOrOpts;\n if (_opts.BITS)\n _nbitLength = _opts.BITS;\n if (_opts.sqrt)\n _sqrt = _opts.sqrt;\n if (typeof _opts.isLE === 'boolean')\n isLE = _opts.isLE;\n if (typeof _opts.modFromBytes === 'boolean')\n modFromBytes = _opts.modFromBytes;\n allowedLengths = _opts.allowedLengths;\n }\n else {\n if (typeof bitLenOrOpts === 'number')\n _nbitLength = bitLenOrOpts;\n if (opts.sqrt)\n _sqrt = opts.sqrt;\n }\n const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, _nbitLength);\n if (BYTES > 2048)\n throw new Error('invalid field: expected ORDER of <= 2048 bytes');\n let sqrtP; // cached sqrtP\n const f = Object.freeze({\n ORDER,\n isLE,\n BITS,\n BYTES,\n MASK: bitMask(BITS),\n ZERO: _0n,\n ONE: _1n,\n allowedLengths: allowedLengths,\n create: (num) => mod(num, ORDER),\n isValid: (num) => {\n if (typeof num !== 'bigint')\n throw new Error('invalid field element: expected bigint, got ' + typeof num);\n return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible\n },\n is0: (num) => num === _0n,\n // is valid and invertible\n isValidNot0: (num) => !f.is0(num) && f.isValid(num),\n isOdd: (num) => (num & _1n) === _1n,\n neg: (num) => mod(-num, ORDER),\n eql: (lhs, rhs) => lhs === rhs,\n sqr: (num) => mod(num * num, ORDER),\n add: (lhs, rhs) => mod(lhs + rhs, ORDER),\n sub: (lhs, rhs) => mod(lhs - rhs, ORDER),\n mul: (lhs, rhs) => mod(lhs * rhs, ORDER),\n pow: (num, power) => FpPow(f, num, power),\n div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),\n // Same as above, but doesn't normalize\n sqrN: (num) => num * num,\n addN: (lhs, rhs) => lhs + rhs,\n subN: (lhs, rhs) => lhs - rhs,\n mulN: (lhs, rhs) => lhs * rhs,\n inv: (num) => invert(num, ORDER),\n sqrt: _sqrt ||\n ((n) => {\n if (!sqrtP)\n sqrtP = FpSqrt(ORDER);\n return sqrtP(f, n);\n }),\n toBytes: (num) => (isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES)),\n fromBytes: (bytes, skipValidation = true) => {\n if (allowedLengths) {\n if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) {\n throw new Error('Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length);\n }\n const padded = new Uint8Array(BYTES);\n // isLE add 0 to right, !isLE to the left.\n padded.set(bytes, isLE ? 0 : padded.length - bytes.length);\n bytes = padded;\n }\n if (bytes.length !== BYTES)\n throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length);\n let scalar = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n if (modFromBytes)\n scalar = mod(scalar, ORDER);\n if (!skipValidation)\n if (!f.isValid(scalar))\n throw new Error('invalid field element: outside of range 0..ORDER');\n // NOTE: we don't validate scalar here, please use isValid. This done such way because some\n // protocol may allow non-reduced scalar that reduced later or changed some other way.\n return scalar;\n },\n // TODO: we don't need it here, move out to separate fn\n invertBatch: (lst) => FpInvertBatch(f, lst),\n // We can't move this out because Fp6, Fp12 implement it\n // and it's unclear what to return in there.\n cmov: (a, b, c) => (c ? b : a),\n });\n return Object.freeze(f);\n}\n// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)?\n// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG).\n// which mean we cannot force this via opts.\n// Not sure what to do with randomBytes, we can accept it inside opts if wanted.\n// Probably need to export getMinHashLength somewhere?\n// random(bytes?: Uint8Array, unsafeAllowZero = false, unsafeAllowBias = false) {\n// const LEN = !unsafeAllowBias ? getMinHashLength(ORDER) : BYTES;\n// if (bytes === undefined) bytes = randomBytes(LEN); // _opts.randomBytes?\n// const num = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);\n// // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n// const reduced = unsafeAllowZero ? mod(num, ORDER) : mod(num, ORDER - _1n) + _1n;\n// return reduced;\n// },\nexport function FpSqrtOdd(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(\"Field doesn't have isOdd\");\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? root : Fp.neg(root);\n}\nexport function FpSqrtEven(Fp, elm) {\n if (!Fp.isOdd)\n throw new Error(\"Field doesn't have isOdd\");\n const root = Fp.sqrt(elm);\n return Fp.isOdd(root) ? Fp.neg(root) : root;\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field).\n * Which makes it slightly more biased, less secure.\n * @deprecated use `mapKeyToField` instead\n */\nexport function hashToPrivateScalar(hash, groupOrder, isLE = false) {\n hash = ensureBytes('privateHash', hash);\n const hashLen = hash.length;\n const minLen = nLength(groupOrder).nByteLength + 8;\n if (minLen < 24 || hashLen < minLen || hashLen > 1024)\n throw new Error('hashToPrivateScalar: expected ' + minLen + '-1024 bytes of input, got ' + hashLen);\n const num = isLE ? bytesToNumberLE(hash) : bytesToNumberBE(hash);\n return mod(num, groupOrder - _1n) + _1n;\n}\n/**\n * Returns total number of bytes consumed by the field element.\n * For example, 32 bytes for usual 256-bit weierstrass curve.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of field\n */\nexport function getFieldBytesLength(fieldOrder) {\n if (typeof fieldOrder !== 'bigint')\n throw new Error('field order must be bigint');\n const bitLength = fieldOrder.toString(2).length;\n return Math.ceil(bitLength / 8);\n}\n/**\n * Returns minimal amount of bytes that can be safely reduced\n * by field order.\n * Should be 2^-128 for 128-bit curve such as P256.\n * @param fieldOrder number of field elements, usually CURVE.n\n * @returns byte length of target hash\n */\nexport function getMinHashLength(fieldOrder) {\n const length = getFieldBytesLength(fieldOrder);\n return length + Math.ceil(length / 2);\n}\n/**\n * \"Constant-time\" private key generation utility.\n * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF\n * and convert them into private scalar, with the modulo bias being negligible.\n * Needs at least 48 bytes of input for 32-byte private key.\n * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/\n * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final\n * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5\n * @param hash hash output from SHA3 or a similar function\n * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n)\n * @param isLE interpret hash bytes as LE num\n * @returns valid private scalar\n */\nexport function mapHashToField(key, fieldOrder, isLE = false) {\n const len = key.length;\n const fieldLen = getFieldBytesLength(fieldOrder);\n const minLen = getMinHashLength(fieldOrder);\n // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings.\n if (len < 16 || len < minLen || len > 1024)\n throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len);\n const num = isLE ? bytesToNumberLE(key) : bytesToNumberBE(key);\n // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0\n const reduced = mod(num, fieldOrder - _1n) + _1n;\n return isLE ? numberToBytesLE(reduced, fieldLen) : numberToBytesBE(reduced, fieldLen);\n}\n//# sourceMappingURL=modular.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\n// Adapted from Chris Veness' SHA1 code at\n// http://www.movable-type.co.uk/scripts/sha1.html\nfunction f(s, x, y, z) {\n switch (s) {\n case 0:\n return x & y ^ ~x & z;\n\n case 1:\n return x ^ y ^ z;\n\n case 2:\n return x & y ^ x & z ^ y & z;\n\n case 3:\n return x ^ y ^ z;\n }\n}\n\nfunction ROTL(x, n) {\n return x << n | x >>> 32 - n;\n}\n\nfunction sha1(bytes) {\n const K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6];\n const H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0];\n\n if (typeof bytes === 'string') {\n const msg = unescape(encodeURIComponent(bytes)); // UTF8 escape\n\n bytes = [];\n\n for (let i = 0; i < msg.length; ++i) {\n bytes.push(msg.charCodeAt(i));\n }\n } else if (!Array.isArray(bytes)) {\n // Convert Array-like to Array\n bytes = Array.prototype.slice.call(bytes);\n }\n\n bytes.push(0x80);\n const l = bytes.length / 4 + 2;\n const N = Math.ceil(l / 16);\n const M = new Array(N);\n\n for (let i = 0; i < N; ++i) {\n const arr = new Uint32Array(16);\n\n for (let j = 0; j < 16; ++j) {\n arr[j] = bytes[i * 64 + j * 4] << 24 | bytes[i * 64 + j * 4 + 1] << 16 | bytes[i * 64 + j * 4 + 2] << 8 | bytes[i * 64 + j * 4 + 3];\n }\n\n M[i] = arr;\n }\n\n M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32);\n M[N - 1][14] = Math.floor(M[N - 1][14]);\n M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff;\n\n for (let i = 0; i < N; ++i) {\n const W = new Uint32Array(80);\n\n for (let t = 0; t < 16; ++t) {\n W[t] = M[i][t];\n }\n\n for (let t = 16; t < 80; ++t) {\n W[t] = ROTL(W[t - 3] ^ W[t - 8] ^ W[t - 14] ^ W[t - 16], 1);\n }\n\n let a = H[0];\n let b = H[1];\n let c = H[2];\n let d = H[3];\n let e = H[4];\n\n for (let t = 0; t < 80; ++t) {\n const s = Math.floor(t / 20);\n const T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[t] >>> 0;\n e = d;\n d = c;\n c = ROTL(b, 30) >>> 0;\n b = a;\n a = T;\n }\n\n H[0] = H[0] + a >>> 0;\n H[1] = H[1] + b >>> 0;\n H[2] = H[2] + c >>> 0;\n H[3] = H[3] + d >>> 0;\n H[4] = H[4] + e >>> 0;\n }\n\n return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff];\n}\n\nvar _default = sha1;\nexports.default = _default;","/**\n * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3.\n *\n * To break sha256 using birthday attack, attackers need to try 2^128 hashes.\n * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n *\n * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n * @deprecated\n */\nimport { SHA224 as SHA224n, sha224 as sha224n, SHA256 as SHA256n, sha256 as sha256n, } from \"./sha2.js\";\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA256 = SHA256n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha256 = sha256n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const SHA224 = SHA224n;\n/** @deprecated Use import from `noble/hashes/sha2` module */\nexport const sha224 = sha224n;\n//# sourceMappingURL=sha256.js.map","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nconst base64 = require('base64-js')\nconst ieee754 = require('ieee754')\nconst customInspectSymbol =\n (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation\n ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation\n : null\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\nconst K_MAX_LENGTH = 0x7fffffff\nexports.kMaxLength = K_MAX_LENGTH\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Print warning and recommend using `buffer` v4.x which has an Object\n * implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * We report that the browser does not support typed arrays if the are not subclassable\n * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array`\n * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support\n * for __proto__ and has a buggy typed array implementation.\n */\nBuffer.TYPED_ARRAY_SUPPORT = typedArraySupport()\n\nif (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' &&\n typeof console.error === 'function') {\n console.error(\n 'This browser lacks typed array (Uint8Array) support which is required by ' +\n '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.'\n )\n}\n\nfunction typedArraySupport () {\n // Can typed array instances can be augmented?\n try {\n const arr = new Uint8Array(1)\n const proto = { foo: function () { return 42 } }\n Object.setPrototypeOf(proto, Uint8Array.prototype)\n Object.setPrototypeOf(arr, proto)\n return arr.foo() === 42\n } catch (e) {\n return false\n }\n}\n\nObject.defineProperty(Buffer.prototype, 'parent', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.buffer\n }\n})\n\nObject.defineProperty(Buffer.prototype, 'offset', {\n enumerable: true,\n get: function () {\n if (!Buffer.isBuffer(this)) return undefined\n return this.byteOffset\n }\n})\n\nfunction createBuffer (length) {\n if (length > K_MAX_LENGTH) {\n throw new RangeError('The value \"' + length + '\" is invalid for option \"size\"')\n }\n // Return an augmented `Uint8Array` instance\n const buf = new Uint8Array(length)\n Object.setPrototypeOf(buf, Buffer.prototype)\n return buf\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new TypeError(\n 'The \"string\" argument must be of type string. Received type number'\n )\n }\n return allocUnsafe(arg)\n }\n return from(arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\nfunction from (value, encodingOrOffset, length) {\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n if (ArrayBuffer.isView(value)) {\n return fromArrayView(value)\n }\n\n if (value == null) {\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n }\n\n if (isInstance(value, ArrayBuffer) ||\n (value && isInstance(value.buffer, ArrayBuffer))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof SharedArrayBuffer !== 'undefined' &&\n (isInstance(value, SharedArrayBuffer) ||\n (value && isInstance(value.buffer, SharedArrayBuffer)))) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'number') {\n throw new TypeError(\n 'The \"value\" argument must not be of type number. Received type number'\n )\n }\n\n const valueOf = value.valueOf && value.valueOf()\n if (valueOf != null && valueOf !== value) {\n return Buffer.from(valueOf, encodingOrOffset, length)\n }\n\n const b = fromObject(value)\n if (b) return b\n\n if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null &&\n typeof value[Symbol.toPrimitive] === 'function') {\n return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length)\n }\n\n throw new TypeError(\n 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' +\n 'or Array-like Object. Received type ' + (typeof value)\n )\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(value, encodingOrOffset, length)\n}\n\n// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug:\n// https://github.com/feross/buffer/pull/148\nObject.setPrototypeOf(Buffer.prototype, Uint8Array.prototype)\nObject.setPrototypeOf(Buffer, Uint8Array)\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be of type number')\n } else if (size < 0) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n}\n\nfunction alloc (size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpreted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(size).fill(fill, encoding)\n : createBuffer(size).fill(fill)\n }\n return createBuffer(size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(size, fill, encoding)\n}\n\nfunction allocUnsafe (size) {\n assertSize(size)\n return createBuffer(size < 0 ? 0 : checked(size) | 0)\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(size)\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n\n const length = byteLength(string, encoding) | 0\n let buf = createBuffer(length)\n\n const actual = buf.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n buf = buf.slice(0, actual)\n }\n\n return buf\n}\n\nfunction fromArrayLike (array) {\n const length = array.length < 0 ? 0 : checked(array.length) | 0\n const buf = createBuffer(length)\n for (let i = 0; i < length; i += 1) {\n buf[i] = array[i] & 255\n }\n return buf\n}\n\nfunction fromArrayView (arrayView) {\n if (isInstance(arrayView, Uint8Array)) {\n const copy = new Uint8Array(arrayView)\n return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength)\n }\n return fromArrayLike(arrayView)\n}\n\nfunction fromArrayBuffer (array, byteOffset, length) {\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\"offset\" is outside of buffer bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\"length\" is outside of buffer bounds')\n }\n\n let buf\n if (byteOffset === undefined && length === undefined) {\n buf = new Uint8Array(array)\n } else if (length === undefined) {\n buf = new Uint8Array(array, byteOffset)\n } else {\n buf = new Uint8Array(array, byteOffset, length)\n }\n\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(buf, Buffer.prototype)\n\n return buf\n}\n\nfunction fromObject (obj) {\n if (Buffer.isBuffer(obj)) {\n const len = checked(obj.length) | 0\n const buf = createBuffer(len)\n\n if (buf.length === 0) {\n return buf\n }\n\n obj.copy(buf, 0, 0, len)\n return buf\n }\n\n if (obj.length !== undefined) {\n if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) {\n return createBuffer(0)\n }\n return fromArrayLike(obj)\n }\n\n if (obj.type === 'Buffer' && Array.isArray(obj.data)) {\n return fromArrayLike(obj.data)\n }\n}\n\nfunction checked (length) {\n // Note: cannot use `length < K_MAX_LENGTH` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= K_MAX_LENGTH) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return b != null && b._isBuffer === true &&\n b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false\n}\n\nBuffer.compare = function compare (a, b) {\n if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength)\n if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength)\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError(\n 'The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array'\n )\n }\n\n if (a === b) return 0\n\n let x = a.length\n let y = b.length\n\n for (let i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!Array.isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n let i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n const buffer = Buffer.allocUnsafe(length)\n let pos = 0\n for (i = 0; i < list.length; ++i) {\n let buf = list[i]\n if (isInstance(buf, Uint8Array)) {\n if (pos + buf.length > buffer.length) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n buf.copy(buffer, pos)\n } else {\n Uint8Array.prototype.set.call(\n buffer,\n buf,\n pos\n )\n }\n } else if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n } else {\n buf.copy(buffer, pos)\n }\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n throw new TypeError(\n 'The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. ' +\n 'Received type ' + typeof string\n )\n }\n\n const len = string.length\n const mustMatch = (arguments.length > 2 && arguments[2] === true)\n if (!mustMatch && len === 0) return 0\n\n // Use a for loop to avoid recursion\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) {\n return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8\n }\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n let loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coercion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package)\n// to detect a Buffer instance. It's not possible to use `instanceof Buffer`\n// reliably in a browserify context because there could be multiple different\n// copies of the 'buffer' package in use. This method works even for Buffer\n// instances that were created from another copy of the `buffer` package.\n// See: https://github.com/feross/buffer/issues/154\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n const i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n const len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (let i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n const len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (let i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n const len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (let i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n const length = this.length\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.toLocaleString = Buffer.prototype.toString\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n let str = ''\n const max = exports.INSPECT_MAX_BYTES\n str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim()\n if (this.length > max) str += ' ... '\n return ''\n}\nif (customInspectSymbol) {\n Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (isInstance(target, Uint8Array)) {\n target = Buffer.from(target, target.offset, target.byteLength)\n }\n if (!Buffer.isBuffer(target)) {\n throw new TypeError(\n 'The \"target\" argument must be one of type Buffer or Uint8Array. ' +\n 'Received type ' + (typeof target)\n )\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n let x = thisEnd - thisStart\n let y = end - start\n const len = Math.min(x, y)\n\n const thisCopy = this.slice(thisStart, thisEnd)\n const targetCopy = target.slice(start, end)\n\n for (let i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (numberIsNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [val], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n let indexSize = 1\n let arrLength = arr.length\n let valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n let i\n if (dir) {\n let foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n let found = true\n for (let j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n const remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n const strLen = string.length\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n let i\n for (i = 0; i < length; ++i) {\n const parsed = parseInt(string.substr(i * 2, 2), 16)\n if (numberIsNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset >>> 0\n if (isFinite(length)) {\n length = length >>> 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n const remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n let loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n case 'latin1':\n case 'binary':\n return asciiWrite(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n const res = []\n\n let i = start\n while (i < end) {\n const firstByte = buf[i]\n let codePoint = null\n let bytesPerSequence = (firstByte > 0xEF)\n ? 4\n : (firstByte > 0xDF)\n ? 3\n : (firstByte > 0xBF)\n ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n let secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nconst MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n const len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n let res = ''\n let i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n let ret = ''\n end = Math.min(buf.length, end)\n\n for (let i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n const len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n let out = ''\n for (let i = start; i < end; ++i) {\n out += hexSliceLookupTable[buf[i]]\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n const bytes = buf.slice(start, end)\n let res = ''\n // If bytes.length is odd, the last 8 bits must be ignored (same as node.js)\n for (let i = 0; i < bytes.length - 1; i += 2) {\n res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256))\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n const len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n const newBuf = this.subarray(start, end)\n // Return an augmented `Uint8Array` instance\n Object.setPrototypeOf(newBuf, Buffer.prototype)\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUintLE =\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUintBE =\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n let val = this[offset + --byteLength]\n let mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUint8 =\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUint16LE =\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUint16BE =\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUint32LE =\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUint32BE =\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const lo = first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24\n\n const hi = this[++offset] +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n last * 2 ** 24\n\n return BigInt(lo) + (BigInt(hi) << BigInt(32))\n})\n\nBuffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const hi = first * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n const lo = this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last\n\n return (BigInt(hi) << BigInt(32)) + BigInt(lo)\n})\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let val = this[offset]\n let mul = 1\n let i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n let i = byteLength\n let mul = 1\n let val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 2, this.length)\n const val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = this[offset + 4] +\n this[offset + 5] * 2 ** 8 +\n this[offset + 6] * 2 ** 16 +\n (last << 24) // Overflow\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(first +\n this[++offset] * 2 ** 8 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 24)\n})\n\nBuffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) {\n offset = offset >>> 0\n validateNumber(offset, 'offset')\n const first = this[offset]\n const last = this[offset + 7]\n if (first === undefined || last === undefined) {\n boundsError(offset, this.length - 8)\n }\n\n const val = (first << 24) + // Overflow\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n this[++offset]\n\n return (BigInt(val) << BigInt(32)) +\n BigInt(this[++offset] * 2 ** 24 +\n this[++offset] * 2 ** 16 +\n this[++offset] * 2 ** 8 +\n last)\n})\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n offset = offset >>> 0\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUintLE =\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let mul = 1\n let i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUintBE =\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n byteLength = byteLength >>> 0\n if (!noAssert) {\n const maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n let i = byteLength - 1\n let mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUint8 =\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeUint16LE =\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeUint16BE =\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeUint32LE =\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeUint32BE =\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nfunction wrtBigUInt64LE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n lo = lo >> 8\n buf[offset++] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n hi = hi >> 8\n buf[offset++] = hi\n return offset\n}\n\nfunction wrtBigUInt64BE (buf, value, offset, min, max) {\n checkIntBI(value, min, max, buf, offset, 7)\n\n let lo = Number(value & BigInt(0xffffffff))\n buf[offset + 7] = lo\n lo = lo >> 8\n buf[offset + 6] = lo\n lo = lo >> 8\n buf[offset + 5] = lo\n lo = lo >> 8\n buf[offset + 4] = lo\n let hi = Number(value >> BigInt(32) & BigInt(0xffffffff))\n buf[offset + 3] = hi\n hi = hi >> 8\n buf[offset + 2] = hi\n hi = hi >> 8\n buf[offset + 1] = hi\n hi = hi >> 8\n buf[offset] = hi\n return offset + 8\n}\n\nBuffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff'))\n})\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = 0\n let mul = 1\n let sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n const limit = Math.pow(2, (8 * byteLength) - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n let i = byteLength - 1\n let mul = 1\n let sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n return offset + 4\n}\n\nBuffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) {\n return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nBuffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) {\n return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff'))\n})\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n value = +value\n offset = offset >>> 0\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer')\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('Index out of range')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n const len = end - start\n\n if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') {\n // Use built-in when available, missing from IE11\n this.copyWithin(targetStart, start, end)\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, end),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n if (val.length === 1) {\n const code = val.charCodeAt(0)\n if ((encoding === 'utf8' && code < 128) ||\n encoding === 'latin1') {\n // Fast path: If `val` fits into a single byte, use that numeric value.\n val = code\n }\n }\n } else if (typeof val === 'number') {\n val = val & 255\n } else if (typeof val === 'boolean') {\n val = Number(val)\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n let i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n const bytes = Buffer.isBuffer(val)\n ? val\n : Buffer.from(val, encoding)\n const len = bytes.length\n if (len === 0) {\n throw new TypeError('The value \"' + val +\n '\" is invalid for argument \"value\"')\n }\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// CUSTOM ERRORS\n// =============\n\n// Simplified versions from Node, changed for Buffer-only usage\nconst errors = {}\nfunction E (sym, getMessage, Base) {\n errors[sym] = class NodeError extends Base {\n constructor () {\n super()\n\n Object.defineProperty(this, 'message', {\n value: getMessage.apply(this, arguments),\n writable: true,\n configurable: true\n })\n\n // Add the error code to the name to include it in the stack trace.\n this.name = `${this.name} [${sym}]`\n // Access the stack to generate the error message including the error code\n // from the name.\n this.stack // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n delete this.name\n }\n\n get code () {\n return sym\n }\n\n set code (value) {\n Object.defineProperty(this, 'code', {\n configurable: true,\n enumerable: true,\n value,\n writable: true\n })\n }\n\n toString () {\n return `${this.name} [${sym}]: ${this.message}`\n }\n }\n}\n\nE('ERR_BUFFER_OUT_OF_BOUNDS',\n function (name) {\n if (name) {\n return `${name} is outside of buffer bounds`\n }\n\n return 'Attempt to access memory outside buffer bounds'\n }, RangeError)\nE('ERR_INVALID_ARG_TYPE',\n function (name, actual) {\n return `The \"${name}\" argument must be of type number. Received type ${typeof actual}`\n }, TypeError)\nE('ERR_OUT_OF_RANGE',\n function (str, range, input) {\n let msg = `The value of \"${str}\" is out of range.`\n let received = input\n if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {\n received = addNumericalSeparator(String(input))\n } else if (typeof input === 'bigint') {\n received = String(input)\n if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) {\n received = addNumericalSeparator(received)\n }\n received += 'n'\n }\n msg += ` It must be ${range}. Received ${received}`\n return msg\n }, RangeError)\n\nfunction addNumericalSeparator (val) {\n let res = ''\n let i = val.length\n const start = val[0] === '-' ? 1 : 0\n for (; i >= start + 4; i -= 3) {\n res = `_${val.slice(i - 3, i)}${res}`\n }\n return `${val.slice(0, i)}${res}`\n}\n\n// CHECK FUNCTIONS\n// ===============\n\nfunction checkBounds (buf, offset, byteLength) {\n validateNumber(offset, 'offset')\n if (buf[offset] === undefined || buf[offset + byteLength] === undefined) {\n boundsError(offset, buf.length - (byteLength + 1))\n }\n}\n\nfunction checkIntBI (value, min, max, buf, offset, byteLength) {\n if (value > max || value < min) {\n const n = typeof min === 'bigint' ? 'n' : ''\n let range\n if (byteLength > 3) {\n if (min === 0 || min === BigInt(0)) {\n range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}`\n } else {\n range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` +\n `${(byteLength + 1) * 8 - 1}${n}`\n }\n } else {\n range = `>= ${min}${n} and <= ${max}${n}`\n }\n throw new errors.ERR_OUT_OF_RANGE('value', range, value)\n }\n checkBounds(buf, offset, byteLength)\n}\n\nfunction validateNumber (value, name) {\n if (typeof value !== 'number') {\n throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value)\n }\n}\n\nfunction boundsError (value, length, type) {\n if (Math.floor(value) !== value) {\n validateNumber(value, type)\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value)\n }\n\n if (length < 0) {\n throw new errors.ERR_BUFFER_OUT_OF_BOUNDS()\n }\n\n throw new errors.ERR_OUT_OF_RANGE(type || 'offset',\n `>= ${type ? 1 : 0} and <= ${length}`,\n value)\n}\n\n// HELPER FUNCTIONS\n// ================\n\nconst INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node takes equal signs as end of the Base64 encoding\n str = str.split('=')[0]\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = str.trim().replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n let codePoint\n const length = string.length\n let leadSurrogate = null\n const bytes = []\n\n for (let i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n let c, hi, lo\n const byteArray = []\n for (let i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n let i\n for (i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\n// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass\n// the `instanceof` check but they should be treated as of that type.\n// See: https://github.com/feross/buffer/issues/166\nfunction isInstance (obj, type) {\n return obj instanceof type ||\n (obj != null && obj.constructor != null && obj.constructor.name != null &&\n obj.constructor.name === type.name)\n}\nfunction numberIsNaN (obj) {\n // For IE11 support\n return obj !== obj // eslint-disable-line no-self-compare\n}\n\n// Create lookup table for `toString('hex')`\n// See: https://github.com/feross/buffer/issues/219\nconst hexSliceLookupTable = (function () {\n const alphabet = '0123456789abcdef'\n const table = new Array(256)\n for (let i = 0; i < 16; ++i) {\n const i16 = i * 16\n for (let j = 0; j < 16; ++j) {\n table[i16 + j] = alphabet[i] + alphabet[j]\n }\n }\n return table\n})()\n\n// Return not function with Error if BigInt not supported\nfunction defineBigIntMethod (fn) {\n return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn\n}\n\nfunction BufferBigIntNotDefined () {\n throw new Error('BigInt not supported')\n}\n","/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { Hash, abytes, aexists, aoutput, clean, createView, toBytes } from \"./utils.js\";\n/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */\nexport function setBigUint64(view, byteOffset, value, isLE) {\n if (typeof view.setBigUint64 === 'function')\n return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n/** Choice: a ? b : c */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport class HashMD extends Hash {\n constructor(blockLen, outputLen, padOffset, isLE) {\n super();\n this.finished = false;\n this.length = 0;\n this.pos = 0;\n this.destroyed = false;\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n data = toBytes(data);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen)\n this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length)\n throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to || (to = new this.constructor());\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */\nexport const SHA224_IV = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n//# sourceMappingURL=_md.js.map","/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from \"./_md.js\";\nimport * as u64 from \"./_u64.js\";\nimport { clean, createHasher, rotr } from \"./utils.js\";\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD {\n constructor(outputLen = 32) {\n super(64, outputLen, 8, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n this.A = SHA256_IV[0] | 0;\n this.B = SHA256_IV[1] | 0;\n this.C = SHA256_IV[2] | 0;\n this.D = SHA256_IV[3] | 0;\n this.E = SHA256_IV[4] | 0;\n this.F = SHA256_IV[5] | 0;\n this.G = SHA256_IV[6] | 0;\n this.H = SHA256_IV[7] | 0;\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4)\n SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\nexport class SHA224 extends SHA256 {\n constructor() {\n super(28);\n this.A = SHA224_IV[0] | 0;\n this.B = SHA224_IV[1] | 0;\n this.C = SHA224_IV[2] | 0;\n this.D = SHA224_IV[3] | 0;\n this.E = SHA224_IV[4] | 0;\n this.F = SHA224_IV[5] | 0;\n this.G = SHA224_IV[6] | 0;\n this.H = SHA224_IV[7] | 0;\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\nexport class SHA512 extends HashMD {\n constructor(outputLen = 64) {\n super(128, outputLen, 16, false);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n // h -- high 32 bits, l -- low 32 bits\n this.Ah = SHA512_IV[0] | 0;\n this.Al = SHA512_IV[1] | 0;\n this.Bh = SHA512_IV[2] | 0;\n this.Bl = SHA512_IV[3] | 0;\n this.Ch = SHA512_IV[4] | 0;\n this.Cl = SHA512_IV[5] | 0;\n this.Dh = SHA512_IV[6] | 0;\n this.Dl = SHA512_IV[7] | 0;\n this.Eh = SHA512_IV[8] | 0;\n this.El = SHA512_IV[9] | 0;\n this.Fh = SHA512_IV[10] | 0;\n this.Fl = SHA512_IV[11] | 0;\n this.Gh = SHA512_IV[12] | 0;\n this.Gl = SHA512_IV[13] | 0;\n this.Hh = SHA512_IV[14] | 0;\n this.Hl = SHA512_IV[15] | 0;\n }\n // prettier-ignore\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\nexport class SHA384 extends SHA512 {\n constructor() {\n super(48);\n this.Ah = SHA384_IV[0] | 0;\n this.Al = SHA384_IV[1] | 0;\n this.Bh = SHA384_IV[2] | 0;\n this.Bl = SHA384_IV[3] | 0;\n this.Ch = SHA384_IV[4] | 0;\n this.Cl = SHA384_IV[5] | 0;\n this.Dh = SHA384_IV[6] | 0;\n this.Dl = SHA384_IV[7] | 0;\n this.Eh = SHA384_IV[8] | 0;\n this.El = SHA384_IV[9] | 0;\n this.Fh = SHA384_IV[10] | 0;\n this.Fl = SHA384_IV[11] | 0;\n this.Gh = SHA384_IV[12] | 0;\n this.Gl = SHA384_IV[13] | 0;\n this.Hh = SHA384_IV[14] | 0;\n this.Hl = SHA384_IV[15] | 0;\n }\n}\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See `test/misc/sha2-gen-iv.js`.\n */\n/** SHA512/224 IV */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n/** SHA512/256 IV */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\nexport class SHA512_224 extends SHA512 {\n constructor() {\n super(28);\n this.Ah = T224_IV[0] | 0;\n this.Al = T224_IV[1] | 0;\n this.Bh = T224_IV[2] | 0;\n this.Bl = T224_IV[3] | 0;\n this.Ch = T224_IV[4] | 0;\n this.Cl = T224_IV[5] | 0;\n this.Dh = T224_IV[6] | 0;\n this.Dl = T224_IV[7] | 0;\n this.Eh = T224_IV[8] | 0;\n this.El = T224_IV[9] | 0;\n this.Fh = T224_IV[10] | 0;\n this.Fl = T224_IV[11] | 0;\n this.Gh = T224_IV[12] | 0;\n this.Gl = T224_IV[13] | 0;\n this.Hh = T224_IV[14] | 0;\n this.Hl = T224_IV[15] | 0;\n }\n}\nexport class SHA512_256 extends SHA512 {\n constructor() {\n super(32);\n this.Ah = T256_IV[0] | 0;\n this.Al = T256_IV[1] | 0;\n this.Bh = T256_IV[2] | 0;\n this.Bl = T256_IV[3] | 0;\n this.Ch = T256_IV[4] | 0;\n this.Cl = T256_IV[5] | 0;\n this.Dh = T256_IV[6] | 0;\n this.Dl = T256_IV[7] | 0;\n this.Eh = T256_IV[8] | 0;\n this.El = T256_IV[9] | 0;\n this.Fh = T256_IV[10] | 0;\n this.Fl = T256_IV[11] | 0;\n this.Gh = T256_IV[12] | 0;\n this.Gl = T256_IV[13] | 0;\n this.Hh = T256_IV[14] | 0;\n this.Hl = T256_IV[15] | 0;\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634.\n *\n * It is the fastest JS hash, even faster than Blake3.\n * To break sha256 using birthday attack, attackers need to try 2^128 hashes.\n * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new SHA256());\n/** SHA2-224 hash function from RFC 4634 */\nexport const sha224 = /* @__PURE__ */ createHasher(() => new SHA224());\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new SHA512());\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new SHA384());\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_256 = /* @__PURE__ */ createHasher(() => new SHA512_256());\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_224 = /* @__PURE__ */ createHasher(() => new SHA512_224());\n//# sourceMappingURL=sha2.js.map","export function trim(hexOrBytes, { dir = 'left' } = {}) {\n let data = typeof hexOrBytes === 'string' ? hexOrBytes.replace('0x', '') : hexOrBytes;\n let sliceLength = 0;\n for (let i = 0; i < data.length - 1; i++) {\n if (data[dir === 'left' ? i : data.length - i - 1].toString() === '0')\n sliceLength++;\n else\n break;\n }\n data =\n dir === 'left'\n ? data.slice(sliceLength)\n : data.slice(0, data.length - sliceLength);\n if (typeof hexOrBytes === 'string') {\n if (data.length === 1 && dir === 'right')\n data = `${data}0`;\n return `0x${data.length % 2 === 1 ? `0${data}` : data}`;\n }\n return data;\n}\n//# sourceMappingURL=trim.js.map","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = void 0;\n\nvar _rng = _interopRequireDefault(require(\"./rng.js\"));\n\nvar _stringify = _interopRequireDefault(require(\"./stringify.js\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\nlet _nodeId;\n\nlet _clockseq; // Previous uuid creation time\n\n\nlet _lastMSecs = 0;\nlet _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details\n\nfunction v1(options, buf, offset) {\n let i = buf && offset || 0;\n const b = buf || new Array(16);\n options = options || {};\n let node = options.node || _nodeId;\n let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n\n if (node == null || clockseq == null) {\n const seedBytes = options.random || (options.rng || _rng.default)();\n\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]];\n }\n\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n } // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n\n\n let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n\n let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs)\n\n const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression\n\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n\n\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n } // Per 4.2.1.2 Throw error if too many uuids are requested\n\n\n if (nsecs >= 10000) {\n throw new Error(\"uuid.v1(): Can't create more than 10M uuids/sec\");\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n\n msecs += 12219292800000; // `time_low`\n\n const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff; // `time_mid`\n\n const tmh = msecs / 0x100000000 * 10000 & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff; // `time_high_and_version`\n\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n\n b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n\n b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low`\n\n b[i++] = clockseq & 0xff; // `node`\n\n for (let n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf || (0, _stringify.default)(b);\n}\n\nvar _default = v1;\nexports.default = _default;","/*! *****************************************************************************\nCopyright (C) Microsoft. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\nvar Reflect;\n(function (Reflect) {\n // Metadata Proposal\n // https://rbuckton.github.io/reflect-metadata/\n (function (factory) {\n var root = typeof globalThis === \"object\" ? globalThis :\n typeof global === \"object\" ? global :\n typeof self === \"object\" ? self :\n typeof this === \"object\" ? this :\n sloppyModeThis();\n var exporter = makeExporter(Reflect);\n if (typeof root.Reflect !== \"undefined\") {\n exporter = makeExporter(root.Reflect, exporter);\n }\n factory(exporter, root);\n if (typeof root.Reflect === \"undefined\") {\n root.Reflect = Reflect;\n }\n function makeExporter(target, previous) {\n return function (key, value) {\n Object.defineProperty(target, key, { configurable: true, writable: true, value: value });\n if (previous)\n previous(key, value);\n };\n }\n function functionThis() {\n try {\n return Function(\"return this;\")();\n }\n catch (_) { }\n }\n function indirectEvalThis() {\n try {\n return (void 0, eval)(\"(function() { return this; })()\");\n }\n catch (_) { }\n }\n function sloppyModeThis() {\n return functionThis() || indirectEvalThis();\n }\n })(function (exporter, root) {\n var hasOwn = Object.prototype.hasOwnProperty;\n // feature test for Symbol support\n var supportsSymbol = typeof Symbol === \"function\";\n var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== \"undefined\" ? Symbol.toPrimitive : \"@@toPrimitive\";\n var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== \"undefined\" ? Symbol.iterator : \"@@iterator\";\n var supportsCreate = typeof Object.create === \"function\"; // feature test for Object.create support\n var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support\n var downLevel = !supportsCreate && !supportsProto;\n var HashMap = {\n // create an object in dictionary mode (a.k.a. \"slow\" mode in v8)\n create: supportsCreate\n ? function () { return MakeDictionary(Object.create(null)); }\n : supportsProto\n ? function () { return MakeDictionary({ __proto__: null }); }\n : function () { return MakeDictionary({}); },\n has: downLevel\n ? function (map, key) { return hasOwn.call(map, key); }\n : function (map, key) { return key in map; },\n get: downLevel\n ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }\n : function (map, key) { return map[key]; },\n };\n // Load global or shim versions of Map, Set, and WeakMap\n var functionPrototype = Object.getPrototypeOf(Function);\n var _Map = typeof Map === \"function\" && typeof Map.prototype.entries === \"function\" ? Map : CreateMapPolyfill();\n var _Set = typeof Set === \"function\" && typeof Set.prototype.entries === \"function\" ? Set : CreateSetPolyfill();\n var _WeakMap = typeof WeakMap === \"function\" ? WeakMap : CreateWeakMapPolyfill();\n var registrySymbol = supportsSymbol ? Symbol.for(\"@reflect-metadata:registry\") : undefined;\n var metadataRegistry = GetOrCreateMetadataRegistry();\n var metadataProvider = CreateMetadataProvider(metadataRegistry);\n /**\n * Applies a set of decorators to a property of a target object.\n * @param decorators An array of decorators.\n * @param target The target object.\n * @param propertyKey (Optional) The property key to decorate.\n * @param attributes (Optional) The property descriptor for the target key.\n * @remarks Decorators are applied in reverse order.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Example = Reflect.decorate(decoratorsArray, Example);\n *\n * // property (on constructor)\n * Reflect.decorate(decoratorsArray, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.decorate(decoratorsArray, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Object.defineProperty(Example, \"staticMethod\",\n * Reflect.decorate(decoratorsArray, Example, \"staticMethod\",\n * Object.getOwnPropertyDescriptor(Example, \"staticMethod\")));\n *\n * // method (on prototype)\n * Object.defineProperty(Example.prototype, \"method\",\n * Reflect.decorate(decoratorsArray, Example.prototype, \"method\",\n * Object.getOwnPropertyDescriptor(Example.prototype, \"method\")));\n *\n */\n function decorate(decorators, target, propertyKey, attributes) {\n if (!IsUndefined(propertyKey)) {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsObject(target))\n throw new TypeError();\n if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))\n throw new TypeError();\n if (IsNull(attributes))\n attributes = undefined;\n propertyKey = ToPropertyKey(propertyKey);\n return DecorateProperty(decorators, target, propertyKey, attributes);\n }\n else {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsConstructor(target))\n throw new TypeError();\n return DecorateConstructor(decorators, target);\n }\n }\n exporter(\"decorate\", decorate);\n // 4.1.2 Reflect.metadata(metadataKey, metadataValue)\n // https://rbuckton.github.io/reflect-metadata/#reflect.metadata\n /**\n * A default metadata decorator factory that can be used on a class, class member, or parameter.\n * @param metadataKey The key for the metadata entry.\n * @param metadataValue The value for the metadata entry.\n * @returns A decorator function.\n * @remarks\n * If `metadataKey` is already defined for the target and target key, the\n * metadataValue for that key will be overwritten.\n * @example\n *\n * // constructor\n * @Reflect.metadata(key, value)\n * class Example {\n * }\n *\n * // property (on constructor, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticProperty;\n * }\n *\n * // property (on prototype, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * property;\n * }\n *\n * // method (on constructor)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticMethod() { }\n * }\n *\n * // method (on prototype)\n * class Example {\n * @Reflect.metadata(key, value)\n * method() { }\n * }\n *\n */\n function metadata(metadataKey, metadataValue) {\n function decorator(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))\n throw new TypeError();\n OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n return decorator;\n }\n exporter(\"metadata\", metadata);\n /**\n * Define a unique metadata entry on the target.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param metadataValue A value that contains attached metadata.\n * @param target The target object on which to define metadata.\n * @param propertyKey (Optional) The property key for the target.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Reflect.defineMetadata(\"custom:annotation\", options, Example);\n *\n * // property (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticMethod\");\n *\n * // method (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"method\");\n *\n * // decorator factory as metadata-producing annotation.\n * function MyAnnotation(options): Decorator {\n * return (target, key?) => Reflect.defineMetadata(\"custom:annotation\", options, target, key);\n * }\n *\n */\n function defineMetadata(metadataKey, metadataValue, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n exporter(\"defineMetadata\", defineMetadata);\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasMetadata\", hasMetadata);\n /**\n * Gets a value indicating whether the target object has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasOwnMetadata\", hasOwnMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getMetadata\", getMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getOwnMetadata\", getOwnMetadata);\n /**\n * Gets the metadata keys defined on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryMetadataKeys(target, propertyKey);\n }\n exporter(\"getMetadataKeys\", getMetadataKeys);\n /**\n * Gets the unique metadata keys defined on the target object.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getOwnMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryOwnMetadataKeys(target, propertyKey);\n }\n exporter(\"getOwnMetadataKeys\", getOwnMetadataKeys);\n /**\n * Deletes the metadata entry from the target object with the provided key.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata entry was found and deleted; otherwise, false.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function deleteMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n var provider = GetMetadataProvider(target, propertyKey, /*Create*/ false);\n if (IsUndefined(provider))\n return false;\n return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"deleteMetadata\", deleteMetadata);\n function DecorateConstructor(decorators, target) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsConstructor(decorated))\n throw new TypeError();\n target = decorated;\n }\n }\n return target;\n }\n function DecorateProperty(decorators, target, propertyKey, descriptor) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target, propertyKey, descriptor);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsObject(decorated))\n throw new TypeError();\n descriptor = decorated;\n }\n }\n return descriptor;\n }\n // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata\n function OrdinaryHasMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return true;\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryHasMetadata(MetadataKey, parent, P);\n return false;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ false);\n if (IsUndefined(provider))\n return false;\n return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P));\n }\n // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata\n function OrdinaryGetMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return OrdinaryGetOwnMetadata(MetadataKey, O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryGetMetadata(MetadataKey, parent, P);\n return undefined;\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ false);\n if (IsUndefined(provider))\n return;\n return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var provider = GetMetadataProvider(O, P, /*Create*/ true);\n provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P);\n }\n // 3.1.6.1 OrdinaryMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys\n function OrdinaryMetadataKeys(O, P) {\n var ownKeys = OrdinaryOwnMetadataKeys(O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (parent === null)\n return ownKeys;\n var parentKeys = OrdinaryMetadataKeys(parent, P);\n if (parentKeys.length <= 0)\n return ownKeys;\n if (ownKeys.length <= 0)\n return parentKeys;\n var set = new _Set();\n var keys = [];\n for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {\n var key = ownKeys_1[_i];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {\n var key = parentKeys_1[_a];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n return keys;\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var provider = GetMetadataProvider(O, P, /*create*/ false);\n if (!provider) {\n return [];\n }\n return provider.OrdinaryOwnMetadataKeys(O, P);\n }\n // 6 ECMAScript Data Types and Values\n // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values\n function Type(x) {\n if (x === null)\n return 1 /* Null */;\n switch (typeof x) {\n case \"undefined\": return 0 /* Undefined */;\n case \"boolean\": return 2 /* Boolean */;\n case \"string\": return 3 /* String */;\n case \"symbol\": return 4 /* Symbol */;\n case \"number\": return 5 /* Number */;\n case \"object\": return x === null ? 1 /* Null */ : 6 /* Object */;\n default: return 6 /* Object */;\n }\n }\n // 6.1.1 The Undefined Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type\n function IsUndefined(x) {\n return x === undefined;\n }\n // 6.1.2 The Null Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type\n function IsNull(x) {\n return x === null;\n }\n // 6.1.5 The Symbol Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type\n function IsSymbol(x) {\n return typeof x === \"symbol\";\n }\n // 6.1.7 The Object Type\n // https://tc39.github.io/ecma262/#sec-object-type\n function IsObject(x) {\n return typeof x === \"object\" ? x !== null : typeof x === \"function\";\n }\n // 7.1 Type Conversion\n // https://tc39.github.io/ecma262/#sec-type-conversion\n // 7.1.1 ToPrimitive(input [, PreferredType])\n // https://tc39.github.io/ecma262/#sec-toprimitive\n function ToPrimitive(input, PreferredType) {\n switch (Type(input)) {\n case 0 /* Undefined */: return input;\n case 1 /* Null */: return input;\n case 2 /* Boolean */: return input;\n case 3 /* String */: return input;\n case 4 /* Symbol */: return input;\n case 5 /* Number */: return input;\n }\n var hint = PreferredType === 3 /* String */ ? \"string\" : PreferredType === 5 /* Number */ ? \"number\" : \"default\";\n var exoticToPrim = GetMethod(input, toPrimitiveSymbol);\n if (exoticToPrim !== undefined) {\n var result = exoticToPrim.call(input, hint);\n if (IsObject(result))\n throw new TypeError();\n return result;\n }\n return OrdinaryToPrimitive(input, hint === \"default\" ? \"number\" : hint);\n }\n // 7.1.1.1 OrdinaryToPrimitive(O, hint)\n // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive\n function OrdinaryToPrimitive(O, hint) {\n if (hint === \"string\") {\n var toString_1 = O.toString;\n if (IsCallable(toString_1)) {\n var result = toString_1.call(O);\n if (!IsObject(result))\n return result;\n }\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n else {\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n var toString_2 = O.toString;\n if (IsCallable(toString_2)) {\n var result = toString_2.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n throw new TypeError();\n }\n // 7.1.2 ToBoolean(argument)\n // https://tc39.github.io/ecma262/2016/#sec-toboolean\n function ToBoolean(argument) {\n return !!argument;\n }\n // 7.1.12 ToString(argument)\n // https://tc39.github.io/ecma262/#sec-tostring\n function ToString(argument) {\n return \"\" + argument;\n }\n // 7.1.14 ToPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-topropertykey\n function ToPropertyKey(argument) {\n var key = ToPrimitive(argument, 3 /* String */);\n if (IsSymbol(key))\n return key;\n return ToString(key);\n }\n // 7.2 Testing and Comparison Operations\n // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations\n // 7.2.2 IsArray(argument)\n // https://tc39.github.io/ecma262/#sec-isarray\n function IsArray(argument) {\n return Array.isArray\n ? Array.isArray(argument)\n : argument instanceof Object\n ? argument instanceof Array\n : Object.prototype.toString.call(argument) === \"[object Array]\";\n }\n // 7.2.3 IsCallable(argument)\n // https://tc39.github.io/ecma262/#sec-iscallable\n function IsCallable(argument) {\n // NOTE: This is an approximation as we cannot check for [[Call]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.4 IsConstructor(argument)\n // https://tc39.github.io/ecma262/#sec-isconstructor\n function IsConstructor(argument) {\n // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.7 IsPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-ispropertykey\n function IsPropertyKey(argument) {\n switch (Type(argument)) {\n case 3 /* String */: return true;\n case 4 /* Symbol */: return true;\n default: return false;\n }\n }\n function SameValueZero(x, y) {\n return x === y || x !== x && y !== y;\n }\n // 7.3 Operations on Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-objects\n // 7.3.9 GetMethod(V, P)\n // https://tc39.github.io/ecma262/#sec-getmethod\n function GetMethod(V, P) {\n var func = V[P];\n if (func === undefined || func === null)\n return undefined;\n if (!IsCallable(func))\n throw new TypeError();\n return func;\n }\n // 7.4 Operations on Iterator Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects\n function GetIterator(obj) {\n var method = GetMethod(obj, iteratorSymbol);\n if (!IsCallable(method))\n throw new TypeError(); // from Call\n var iterator = method.call(obj);\n if (!IsObject(iterator))\n throw new TypeError();\n return iterator;\n }\n // 7.4.4 IteratorValue(iterResult)\n // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue\n function IteratorValue(iterResult) {\n return iterResult.value;\n }\n // 7.4.5 IteratorStep(iterator)\n // https://tc39.github.io/ecma262/#sec-iteratorstep\n function IteratorStep(iterator) {\n var result = iterator.next();\n return result.done ? false : result;\n }\n // 7.4.6 IteratorClose(iterator, completion)\n // https://tc39.github.io/ecma262/#sec-iteratorclose\n function IteratorClose(iterator) {\n var f = iterator[\"return\"];\n if (f)\n f.call(iterator);\n }\n // 9.1 Ordinary Object Internal Methods and Internal Slots\n // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\n // 9.1.1.1 OrdinaryGetPrototypeOf(O)\n // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof\n function OrdinaryGetPrototypeOf(O) {\n var proto = Object.getPrototypeOf(O);\n if (typeof O !== \"function\" || O === functionPrototype)\n return proto;\n // TypeScript doesn't set __proto__ in ES5, as it's non-standard.\n // Try to determine the superclass constructor. Compatible implementations\n // must either set __proto__ on a subclass constructor to the superclass constructor,\n // or ensure each class has a valid `constructor` property on its prototype that\n // points back to the constructor.\n // If this is not the same as Function.[[Prototype]], then this is definately inherited.\n // This is the case when in ES6 or when using __proto__ in a compatible browser.\n if (proto !== functionPrototype)\n return proto;\n // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.\n var prototype = O.prototype;\n var prototypeProto = prototype && Object.getPrototypeOf(prototype);\n if (prototypeProto == null || prototypeProto === Object.prototype)\n return proto;\n // If the constructor was not a function, then we cannot determine the heritage.\n var constructor = prototypeProto.constructor;\n if (typeof constructor !== \"function\")\n return proto;\n // If we have some kind of self-reference, then we cannot determine the heritage.\n if (constructor === O)\n return proto;\n // we have a pretty good guess at the heritage.\n return constructor;\n }\n // Global metadata registry\n // - Allows `import \"reflect-metadata\"` and `import \"reflect-metadata/no-conflict\"` to interoperate.\n // - Uses isolated metadata if `Reflect` is frozen before the registry can be installed.\n /**\n * Creates a registry used to allow multiple `reflect-metadata` providers.\n */\n function CreateMetadataRegistry() {\n var fallback;\n if (!IsUndefined(registrySymbol) &&\n typeof root.Reflect !== \"undefined\" &&\n !(registrySymbol in root.Reflect) &&\n typeof root.Reflect.defineMetadata === \"function\") {\n // interoperate with older version of `reflect-metadata` that did not support a registry.\n fallback = CreateFallbackProvider(root.Reflect);\n }\n var first;\n var second;\n var rest;\n var targetProviderMap = new _WeakMap();\n var registry = {\n registerProvider: registerProvider,\n getProvider: getProvider,\n setProvider: setProvider,\n };\n return registry;\n function registerProvider(provider) {\n if (!Object.isExtensible(registry)) {\n throw new Error(\"Cannot add provider to a frozen registry.\");\n }\n switch (true) {\n case fallback === provider: break;\n case IsUndefined(first):\n first = provider;\n break;\n case first === provider: break;\n case IsUndefined(second):\n second = provider;\n break;\n case second === provider: break;\n default:\n if (rest === undefined)\n rest = new _Set();\n rest.add(provider);\n break;\n }\n }\n function getProviderNoCache(O, P) {\n if (!IsUndefined(first)) {\n if (first.isProviderFor(O, P))\n return first;\n if (!IsUndefined(second)) {\n if (second.isProviderFor(O, P))\n return first;\n if (!IsUndefined(rest)) {\n var iterator = GetIterator(rest);\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n return undefined;\n }\n var provider = IteratorValue(next);\n if (provider.isProviderFor(O, P)) {\n IteratorClose(iterator);\n return provider;\n }\n }\n }\n }\n }\n if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) {\n return fallback;\n }\n return undefined;\n }\n function getProvider(O, P) {\n var providerMap = targetProviderMap.get(O);\n var provider;\n if (!IsUndefined(providerMap)) {\n provider = providerMap.get(P);\n }\n if (!IsUndefined(provider)) {\n return provider;\n }\n provider = getProviderNoCache(O, P);\n if (!IsUndefined(provider)) {\n if (IsUndefined(providerMap)) {\n providerMap = new _Map();\n targetProviderMap.set(O, providerMap);\n }\n providerMap.set(P, provider);\n }\n return provider;\n }\n function hasProvider(provider) {\n if (IsUndefined(provider))\n throw new TypeError();\n return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider);\n }\n function setProvider(O, P, provider) {\n if (!hasProvider(provider)) {\n throw new Error(\"Metadata provider not registered.\");\n }\n var existingProvider = getProvider(O, P);\n if (existingProvider !== provider) {\n if (!IsUndefined(existingProvider)) {\n return false;\n }\n var providerMap = targetProviderMap.get(O);\n if (IsUndefined(providerMap)) {\n providerMap = new _Map();\n targetProviderMap.set(O, providerMap);\n }\n providerMap.set(P, provider);\n }\n return true;\n }\n }\n /**\n * Gets or creates the shared registry of metadata providers.\n */\n function GetOrCreateMetadataRegistry() {\n var metadataRegistry;\n if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {\n metadataRegistry = root.Reflect[registrySymbol];\n }\n if (IsUndefined(metadataRegistry)) {\n metadataRegistry = CreateMetadataRegistry();\n }\n if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) {\n Object.defineProperty(root.Reflect, registrySymbol, {\n enumerable: false,\n configurable: false,\n writable: false,\n value: metadataRegistry\n });\n }\n return metadataRegistry;\n }\n function CreateMetadataProvider(registry) {\n // [[Metadata]] internal slot\n // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots\n var metadata = new _WeakMap();\n var provider = {\n isProviderFor: function (O, P) {\n var targetMetadata = metadata.get(O);\n if (IsUndefined(targetMetadata))\n return false;\n return targetMetadata.has(P);\n },\n OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata,\n OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata,\n OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata,\n OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys,\n OrdinaryDeleteMetadata: OrdinaryDeleteMetadata,\n };\n metadataRegistry.registerProvider(provider);\n return provider;\n function GetOrCreateMetadataMap(O, P, Create) {\n var targetMetadata = metadata.get(O);\n var createdTargetMetadata = false;\n if (IsUndefined(targetMetadata)) {\n if (!Create)\n return undefined;\n targetMetadata = new _Map();\n metadata.set(O, targetMetadata);\n createdTargetMetadata = true;\n }\n var metadataMap = targetMetadata.get(P);\n if (IsUndefined(metadataMap)) {\n if (!Create)\n return undefined;\n metadataMap = new _Map();\n targetMetadata.set(P, metadataMap);\n if (!registry.setProvider(O, P, provider)) {\n targetMetadata.delete(P);\n if (createdTargetMetadata) {\n metadata.delete(O);\n }\n throw new Error(\"Wrong provider for target.\");\n }\n }\n return metadataMap;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return undefined;\n return metadataMap.get(MetadataKey);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);\n metadataMap.set(MetadataKey, MetadataValue);\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var keys = [];\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return keys;\n var keysObj = metadataMap.keys();\n var iterator = GetIterator(keysObj);\n var k = 0;\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n keys.length = k;\n return keys;\n }\n var nextValue = IteratorValue(next);\n try {\n keys[k] = nextValue;\n }\n catch (e) {\n try {\n IteratorClose(iterator);\n }\n finally {\n throw e;\n }\n }\n k++;\n }\n }\n function OrdinaryDeleteMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n if (!metadataMap.delete(MetadataKey))\n return false;\n if (metadataMap.size === 0) {\n var targetMetadata = metadata.get(O);\n if (!IsUndefined(targetMetadata)) {\n targetMetadata.delete(P);\n if (targetMetadata.size === 0) {\n metadata.delete(targetMetadata);\n }\n }\n }\n return true;\n }\n }\n function CreateFallbackProvider(reflect) {\n var defineMetadata = reflect.defineMetadata, hasOwnMetadata = reflect.hasOwnMetadata, getOwnMetadata = reflect.getOwnMetadata, getOwnMetadataKeys = reflect.getOwnMetadataKeys, deleteMetadata = reflect.deleteMetadata;\n var metadataOwner = new _WeakMap();\n var provider = {\n isProviderFor: function (O, P) {\n var metadataPropertySet = metadataOwner.get(O);\n if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) {\n return true;\n }\n if (getOwnMetadataKeys(O, P).length) {\n if (IsUndefined(metadataPropertySet)) {\n metadataPropertySet = new _Set();\n metadataOwner.set(O, metadataPropertySet);\n }\n metadataPropertySet.add(P);\n return true;\n }\n return false;\n },\n OrdinaryDefineOwnMetadata: defineMetadata,\n OrdinaryHasOwnMetadata: hasOwnMetadata,\n OrdinaryGetOwnMetadata: getOwnMetadata,\n OrdinaryOwnMetadataKeys: getOwnMetadataKeys,\n OrdinaryDeleteMetadata: deleteMetadata,\n };\n return provider;\n }\n /**\n * Gets the metadata provider for an object. If the object has no metadata provider and this is for a create operation,\n * then this module's metadata provider is assigned to the object.\n */\n function GetMetadataProvider(O, P, Create) {\n var registeredProvider = metadataRegistry.getProvider(O, P);\n if (!IsUndefined(registeredProvider)) {\n return registeredProvider;\n }\n if (Create) {\n if (metadataRegistry.setProvider(O, P, metadataProvider)) {\n return metadataProvider;\n }\n throw new Error(\"Illegal state.\");\n }\n return undefined;\n }\n // naive Map shim\n function CreateMapPolyfill() {\n var cacheSentinel = {};\n var arraySentinel = [];\n var MapIterator = /** @class */ (function () {\n function MapIterator(keys, values, selector) {\n this._index = 0;\n this._keys = keys;\n this._values = values;\n this._selector = selector;\n }\n MapIterator.prototype[\"@@iterator\"] = function () { return this; };\n MapIterator.prototype[iteratorSymbol] = function () { return this; };\n MapIterator.prototype.next = function () {\n var index = this._index;\n if (index >= 0 && index < this._keys.length) {\n var result = this._selector(this._keys[index], this._values[index]);\n if (index + 1 >= this._keys.length) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n else {\n this._index++;\n }\n return { value: result, done: false };\n }\n return { value: undefined, done: true };\n };\n MapIterator.prototype.throw = function (error) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n throw error;\n };\n MapIterator.prototype.return = function (value) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n return { value: value, done: true };\n };\n return MapIterator;\n }());\n var Map = /** @class */ (function () {\n function Map() {\n this._keys = [];\n this._values = [];\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n Object.defineProperty(Map.prototype, \"size\", {\n get: function () { return this._keys.length; },\n enumerable: true,\n configurable: true\n });\n Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; };\n Map.prototype.get = function (key) {\n var index = this._find(key, /*insert*/ false);\n return index >= 0 ? this._values[index] : undefined;\n };\n Map.prototype.set = function (key, value) {\n var index = this._find(key, /*insert*/ true);\n this._values[index] = value;\n return this;\n };\n Map.prototype.delete = function (key) {\n var index = this._find(key, /*insert*/ false);\n if (index >= 0) {\n var size = this._keys.length;\n for (var i = index + 1; i < size; i++) {\n this._keys[i - 1] = this._keys[i];\n this._values[i - 1] = this._values[i];\n }\n this._keys.length--;\n this._values.length--;\n if (SameValueZero(key, this._cacheKey)) {\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n return true;\n }\n return false;\n };\n Map.prototype.clear = function () {\n this._keys.length = 0;\n this._values.length = 0;\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n };\n Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };\n Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };\n Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };\n Map.prototype[\"@@iterator\"] = function () { return this.entries(); };\n Map.prototype[iteratorSymbol] = function () { return this.entries(); };\n Map.prototype._find = function (key, insert) {\n if (!SameValueZero(this._cacheKey, key)) {\n this._cacheIndex = -1;\n for (var i = 0; i < this._keys.length; i++) {\n if (SameValueZero(this._keys[i], key)) {\n this._cacheIndex = i;\n break;\n }\n }\n }\n if (this._cacheIndex < 0 && insert) {\n this._cacheIndex = this._keys.length;\n this._keys.push(key);\n this._values.push(undefined);\n }\n return this._cacheIndex;\n };\n return Map;\n }());\n return Map;\n function getKey(key, _) {\n return key;\n }\n function getValue(_, value) {\n return value;\n }\n function getEntry(key, value) {\n return [key, value];\n }\n }\n // naive Set shim\n function CreateSetPolyfill() {\n var Set = /** @class */ (function () {\n function Set() {\n this._map = new _Map();\n }\n Object.defineProperty(Set.prototype, \"size\", {\n get: function () { return this._map.size; },\n enumerable: true,\n configurable: true\n });\n Set.prototype.has = function (value) { return this._map.has(value); };\n Set.prototype.add = function (value) { return this._map.set(value, value), this; };\n Set.prototype.delete = function (value) { return this._map.delete(value); };\n Set.prototype.clear = function () { this._map.clear(); };\n Set.prototype.keys = function () { return this._map.keys(); };\n Set.prototype.values = function () { return this._map.keys(); };\n Set.prototype.entries = function () { return this._map.entries(); };\n Set.prototype[\"@@iterator\"] = function () { return this.keys(); };\n Set.prototype[iteratorSymbol] = function () { return this.keys(); };\n return Set;\n }());\n return Set;\n }\n // naive WeakMap shim\n function CreateWeakMapPolyfill() {\n var UUID_SIZE = 16;\n var keys = HashMap.create();\n var rootKey = CreateUniqueKey();\n return /** @class */ (function () {\n function WeakMap() {\n this._key = CreateUniqueKey();\n }\n WeakMap.prototype.has = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.has(table, this._key) : false;\n };\n WeakMap.prototype.get = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.get(table, this._key) : undefined;\n };\n WeakMap.prototype.set = function (target, value) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ true);\n table[this._key] = value;\n return this;\n };\n WeakMap.prototype.delete = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? delete table[this._key] : false;\n };\n WeakMap.prototype.clear = function () {\n // NOTE: not a real clear, just makes the previous data unreachable\n this._key = CreateUniqueKey();\n };\n return WeakMap;\n }());\n function CreateUniqueKey() {\n var key;\n do\n key = \"@@WeakMap@@\" + CreateUUID();\n while (HashMap.has(keys, key));\n keys[key] = true;\n return key;\n }\n function GetOrCreateWeakMapTable(target, create) {\n if (!hasOwn.call(target, rootKey)) {\n if (!create)\n return undefined;\n Object.defineProperty(target, rootKey, { value: HashMap.create() });\n }\n return target[rootKey];\n }\n function FillRandomBytes(buffer, size) {\n for (var i = 0; i < size; ++i)\n buffer[i] = Math.random() * 0xff | 0;\n return buffer;\n }\n function GenRandomBytes(size) {\n if (typeof Uint8Array === \"function\") {\n var array = new Uint8Array(size);\n if (typeof crypto !== \"undefined\") {\n crypto.getRandomValues(array);\n }\n else if (typeof msCrypto !== \"undefined\") {\n msCrypto.getRandomValues(array);\n }\n else {\n FillRandomBytes(array, size);\n }\n return array;\n }\n return FillRandomBytes(new Array(size), size);\n }\n function CreateUUID() {\n var data = GenRandomBytes(UUID_SIZE);\n // mark as random - RFC 4122 § 4.4\n data[6] = data[6] & 0x4f | 0x40;\n data[8] = data[8] & 0xbf | 0x80;\n var result = \"\";\n for (var offset = 0; offset < UUID_SIZE; ++offset) {\n var byte = data[offset];\n if (offset === 4 || offset === 6 || offset === 8)\n result += \"-\";\n if (byte < 16)\n result += \"0\";\n result += byte.toString(16).toLowerCase();\n }\n return result;\n }\n }\n // uses a heuristic used by v8 and chakra to force an object into dictionary mode.\n function MakeDictionary(obj) {\n obj.__ = undefined;\n delete obj.__;\n return obj;\n }\n });\n})(Reflect || (Reflect = {}));\n","export const maxInt8 = 2n ** (8n - 1n) - 1n;\nexport const maxInt16 = 2n ** (16n - 1n) - 1n;\nexport const maxInt24 = 2n ** (24n - 1n) - 1n;\nexport const maxInt32 = 2n ** (32n - 1n) - 1n;\nexport const maxInt40 = 2n ** (40n - 1n) - 1n;\nexport const maxInt48 = 2n ** (48n - 1n) - 1n;\nexport const maxInt56 = 2n ** (56n - 1n) - 1n;\nexport const maxInt64 = 2n ** (64n - 1n) - 1n;\nexport const maxInt72 = 2n ** (72n - 1n) - 1n;\nexport const maxInt80 = 2n ** (80n - 1n) - 1n;\nexport const maxInt88 = 2n ** (88n - 1n) - 1n;\nexport const maxInt96 = 2n ** (96n - 1n) - 1n;\nexport const maxInt104 = 2n ** (104n - 1n) - 1n;\nexport const maxInt112 = 2n ** (112n - 1n) - 1n;\nexport const maxInt120 = 2n ** (120n - 1n) - 1n;\nexport const maxInt128 = 2n ** (128n - 1n) - 1n;\nexport const maxInt136 = 2n ** (136n - 1n) - 1n;\nexport const maxInt144 = 2n ** (144n - 1n) - 1n;\nexport const maxInt152 = 2n ** (152n - 1n) - 1n;\nexport const maxInt160 = 2n ** (160n - 1n) - 1n;\nexport const maxInt168 = 2n ** (168n - 1n) - 1n;\nexport const maxInt176 = 2n ** (176n - 1n) - 1n;\nexport const maxInt184 = 2n ** (184n - 1n) - 1n;\nexport const maxInt192 = 2n ** (192n - 1n) - 1n;\nexport const maxInt200 = 2n ** (200n - 1n) - 1n;\nexport const maxInt208 = 2n ** (208n - 1n) - 1n;\nexport const maxInt216 = 2n ** (216n - 1n) - 1n;\nexport const maxInt224 = 2n ** (224n - 1n) - 1n;\nexport const maxInt232 = 2n ** (232n - 1n) - 1n;\nexport const maxInt240 = 2n ** (240n - 1n) - 1n;\nexport const maxInt248 = 2n ** (248n - 1n) - 1n;\nexport const maxInt256 = 2n ** (256n - 1n) - 1n;\nexport const minInt8 = -(2n ** (8n - 1n));\nexport const minInt16 = -(2n ** (16n - 1n));\nexport const minInt24 = -(2n ** (24n - 1n));\nexport const minInt32 = -(2n ** (32n - 1n));\nexport const minInt40 = -(2n ** (40n - 1n));\nexport const minInt48 = -(2n ** (48n - 1n));\nexport const minInt56 = -(2n ** (56n - 1n));\nexport const minInt64 = -(2n ** (64n - 1n));\nexport const minInt72 = -(2n ** (72n - 1n));\nexport const minInt80 = -(2n ** (80n - 1n));\nexport const minInt88 = -(2n ** (88n - 1n));\nexport const minInt96 = -(2n ** (96n - 1n));\nexport const minInt104 = -(2n ** (104n - 1n));\nexport const minInt112 = -(2n ** (112n - 1n));\nexport const minInt120 = -(2n ** (120n - 1n));\nexport const minInt128 = -(2n ** (128n - 1n));\nexport const minInt136 = -(2n ** (136n - 1n));\nexport const minInt144 = -(2n ** (144n - 1n));\nexport const minInt152 = -(2n ** (152n - 1n));\nexport const minInt160 = -(2n ** (160n - 1n));\nexport const minInt168 = -(2n ** (168n - 1n));\nexport const minInt176 = -(2n ** (176n - 1n));\nexport const minInt184 = -(2n ** (184n - 1n));\nexport const minInt192 = -(2n ** (192n - 1n));\nexport const minInt200 = -(2n ** (200n - 1n));\nexport const minInt208 = -(2n ** (208n - 1n));\nexport const minInt216 = -(2n ** (216n - 1n));\nexport const minInt224 = -(2n ** (224n - 1n));\nexport const minInt232 = -(2n ** (232n - 1n));\nexport const minInt240 = -(2n ** (240n - 1n));\nexport const minInt248 = -(2n ** (248n - 1n));\nexport const minInt256 = -(2n ** (256n - 1n));\nexport const maxUint8 = 2n ** 8n - 1n;\nexport const maxUint16 = 2n ** 16n - 1n;\nexport const maxUint24 = 2n ** 24n - 1n;\nexport const maxUint32 = 2n ** 32n - 1n;\nexport const maxUint40 = 2n ** 40n - 1n;\nexport const maxUint48 = 2n ** 48n - 1n;\nexport const maxUint56 = 2n ** 56n - 1n;\nexport const maxUint64 = 2n ** 64n - 1n;\nexport const maxUint72 = 2n ** 72n - 1n;\nexport const maxUint80 = 2n ** 80n - 1n;\nexport const maxUint88 = 2n ** 88n - 1n;\nexport const maxUint96 = 2n ** 96n - 1n;\nexport const maxUint104 = 2n ** 104n - 1n;\nexport const maxUint112 = 2n ** 112n - 1n;\nexport const maxUint120 = 2n ** 120n - 1n;\nexport const maxUint128 = 2n ** 128n - 1n;\nexport const maxUint136 = 2n ** 136n - 1n;\nexport const maxUint144 = 2n ** 144n - 1n;\nexport const maxUint152 = 2n ** 152n - 1n;\nexport const maxUint160 = 2n ** 160n - 1n;\nexport const maxUint168 = 2n ** 168n - 1n;\nexport const maxUint176 = 2n ** 176n - 1n;\nexport const maxUint184 = 2n ** 184n - 1n;\nexport const maxUint192 = 2n ** 192n - 1n;\nexport const maxUint200 = 2n ** 200n - 1n;\nexport const maxUint208 = 2n ** 208n - 1n;\nexport const maxUint216 = 2n ** 216n - 1n;\nexport const maxUint224 = 2n ** 224n - 1n;\nexport const maxUint232 = 2n ** 232n - 1n;\nexport const maxUint240 = 2n ** 240n - 1n;\nexport const maxUint248 = 2n ** 248n - 1n;\nexport const maxUint256 = 2n ** 256n - 1n;\n//# sourceMappingURL=number.js.map","import { BaseError } from './base.js';\nexport class ChainDoesNotSupportContract extends BaseError {\n constructor({ blockNumber, chain, contract, }) {\n super(`Chain \"${chain.name}\" does not support contract \"${contract.name}\".`, {\n metaMessages: [\n 'This could be due to any of the following:',\n ...(blockNumber &&\n contract.blockCreated &&\n contract.blockCreated > blockNumber\n ? [\n `- The contract \"${contract.name}\" was not deployed until block ${contract.blockCreated} (current block ${blockNumber}).`,\n ]\n : [\n `- The chain does not have the contract \"${contract.name}\" configured.`,\n ]),\n ],\n name: 'ChainDoesNotSupportContract',\n });\n }\n}\nexport class ChainMismatchError extends BaseError {\n constructor({ chain, currentChainId, }) {\n super(`The current chain of the wallet (id: ${currentChainId}) does not match the target chain for the transaction (id: ${chain.id} – ${chain.name}).`, {\n metaMessages: [\n `Current Chain ID: ${currentChainId}`,\n `Expected Chain ID: ${chain.id} – ${chain.name}`,\n ],\n name: 'ChainMismatchError',\n });\n }\n}\nexport class ChainNotFoundError extends BaseError {\n constructor() {\n super([\n 'No chain was provided to the request.',\n 'Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient.',\n ].join('\\n'), {\n name: 'ChainNotFoundError',\n });\n }\n}\nexport class ClientChainNotConfiguredError extends BaseError {\n constructor() {\n super('No chain was provided to the Client.', {\n name: 'ClientChainNotConfiguredError',\n });\n }\n}\nexport class InvalidChainIdError extends BaseError {\n constructor({ chainId }) {\n super(typeof chainId === 'number'\n ? `Chain ID \"${chainId}\" is invalid.`\n : 'Chain ID is invalid.', { name: 'InvalidChainIdError' });\n }\n}\n//# sourceMappingURL=chain.js.map","import { formatGwei } from '../utils/unit/formatGwei.js';\nimport { BaseError } from './base.js';\nexport class ExecutionRevertedError extends BaseError {\n constructor({ cause, message, } = {}) {\n const reason = message\n ?.replace('execution reverted: ', '')\n ?.replace('execution reverted', '');\n super(`Execution reverted ${reason ? `with reason: ${reason}` : 'for an unknown reason'}.`, {\n cause,\n name: 'ExecutionRevertedError',\n });\n }\n}\nObject.defineProperty(ExecutionRevertedError, \"code\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 3\n});\nObject.defineProperty(ExecutionRevertedError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /execution reverted|gas required exceeds allowance/\n});\nexport class FeeCapTooHighError extends BaseError {\n constructor({ cause, maxFeePerGas, } = {}) {\n super(`The fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''}) cannot be higher than the maximum allowed value (2^256-1).`, {\n cause,\n name: 'FeeCapTooHighError',\n });\n }\n}\nObject.defineProperty(FeeCapTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max fee per gas higher than 2\\^256-1|fee cap higher than 2\\^256-1/\n});\nexport class FeeCapTooLowError extends BaseError {\n constructor({ cause, maxFeePerGas, } = {}) {\n super(`The fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ''} gwei) cannot be lower than the block base fee.`, {\n cause,\n name: 'FeeCapTooLowError',\n });\n }\n}\nObject.defineProperty(FeeCapTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/\n});\nexport class NonceTooHighError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is higher than the next one expected.`, { cause, name: 'NonceTooHighError' });\n }\n}\nObject.defineProperty(NonceTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce too high/\n});\nexport class NonceTooLowError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super([\n `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is lower than the current nonce of the account.`,\n 'Try increasing the nonce or find the latest nonce with `getTransactionCount`.',\n ].join('\\n'), { cause, name: 'NonceTooLowError' });\n }\n}\nObject.defineProperty(NonceTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce too low|transaction already imported|already known/\n});\nexport class NonceMaxValueError extends BaseError {\n constructor({ cause, nonce, } = {}) {\n super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}exceeds the maximum allowed nonce.`, { cause, name: 'NonceMaxValueError' });\n }\n}\nObject.defineProperty(NonceMaxValueError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /nonce has max value/\n});\nexport class InsufficientFundsError extends BaseError {\n constructor({ cause } = {}) {\n super([\n 'The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.',\n ].join('\\n'), {\n cause,\n metaMessages: [\n 'This error could arise when the account does not have enough funds to:',\n ' - pay for the total gas fee,',\n ' - pay for the value to send.',\n ' ',\n 'The cost of the transaction is calculated as `gas * gas fee + value`, where:',\n ' - `gas` is the amount of gas needed for transaction to execute,',\n ' - `gas fee` is the gas fee,',\n ' - `value` is the amount of ether to send to the recipient.',\n ],\n name: 'InsufficientFundsError',\n });\n }\n}\nObject.defineProperty(InsufficientFundsError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /insufficient funds|exceeds transaction sender account balance/\n});\nexport class IntrinsicGasTooHighError extends BaseError {\n constructor({ cause, gas, } = {}) {\n super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction exceeds the limit allowed for the block.`, {\n cause,\n name: 'IntrinsicGasTooHighError',\n });\n }\n}\nObject.defineProperty(IntrinsicGasTooHighError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /intrinsic gas too high|gas limit reached/\n});\nexport class IntrinsicGasTooLowError extends BaseError {\n constructor({ cause, gas, } = {}) {\n super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction is too low.`, {\n cause,\n name: 'IntrinsicGasTooLowError',\n });\n }\n}\nObject.defineProperty(IntrinsicGasTooLowError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /intrinsic gas too low/\n});\nexport class TransactionTypeNotSupportedError extends BaseError {\n constructor({ cause }) {\n super('The transaction type is not supported for this chain.', {\n cause,\n name: 'TransactionTypeNotSupportedError',\n });\n }\n}\nObject.defineProperty(TransactionTypeNotSupportedError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /transaction type not valid/\n});\nexport class TipAboveFeeCapError extends BaseError {\n constructor({ cause, maxPriorityFeePerGas, maxFeePerGas, } = {}) {\n super([\n `The provided tip (\\`maxPriorityFeePerGas\\`${maxPriorityFeePerGas\n ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei`\n : ''}) cannot be higher than the fee cap (\\`maxFeePerGas\\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ''}).`,\n ].join('\\n'), {\n cause,\n name: 'TipAboveFeeCapError',\n });\n }\n}\nObject.defineProperty(TipAboveFeeCapError, \"nodeMessage\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/\n});\nexport class UnknownNodeError extends BaseError {\n constructor({ cause }) {\n super(`An error occurred while executing: ${cause?.shortMessage}`, {\n cause,\n name: 'UnknownNodeError',\n });\n }\n}\n//# sourceMappingURL=node.js.map","import { versionedHashVersionKzg } from '../../constants/kzg.js';\nimport { maxUint256 } from '../../constants/number.js';\nimport { InvalidAddressError, } from '../../errors/address.js';\nimport { BaseError } from '../../errors/base.js';\nimport { EmptyBlobError, InvalidVersionedHashSizeError, InvalidVersionedHashVersionError, } from '../../errors/blob.js';\nimport { InvalidChainIdError, } from '../../errors/chain.js';\nimport { FeeCapTooHighError, TipAboveFeeCapError, } from '../../errors/node.js';\nimport { isAddress } from '../address/isAddress.js';\nimport { size } from '../data/size.js';\nimport { slice } from '../data/slice.js';\nimport { hexToNumber } from '../encoding/fromHex.js';\nexport function assertTransactionEIP7702(transaction) {\n const { authorizationList } = transaction;\n if (authorizationList) {\n for (const authorization of authorizationList) {\n const { chainId } = authorization;\n const address = authorization.address;\n if (!isAddress(address))\n throw new InvalidAddressError({ address });\n if (chainId < 0)\n throw new InvalidChainIdError({ chainId });\n }\n }\n assertTransactionEIP1559(transaction);\n}\nexport function assertTransactionEIP4844(transaction) {\n const { blobVersionedHashes } = transaction;\n if (blobVersionedHashes) {\n if (blobVersionedHashes.length === 0)\n throw new EmptyBlobError();\n for (const hash of blobVersionedHashes) {\n const size_ = size(hash);\n const version = hexToNumber(slice(hash, 0, 1));\n if (size_ !== 32)\n throw new InvalidVersionedHashSizeError({ hash, size: size_ });\n if (version !== versionedHashVersionKzg)\n throw new InvalidVersionedHashVersionError({\n hash,\n version,\n });\n }\n }\n assertTransactionEIP1559(transaction);\n}\nexport function assertTransactionEIP1559(transaction) {\n const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction;\n if (chainId <= 0)\n throw new InvalidChainIdError({ chainId });\n if (to && !isAddress(to))\n throw new InvalidAddressError({ address: to });\n if (maxFeePerGas && maxFeePerGas > maxUint256)\n throw new FeeCapTooHighError({ maxFeePerGas });\n if (maxPriorityFeePerGas &&\n maxFeePerGas &&\n maxPriorityFeePerGas > maxFeePerGas)\n throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });\n}\nexport function assertTransactionEIP2930(transaction) {\n const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;\n if (chainId <= 0)\n throw new InvalidChainIdError({ chainId });\n if (to && !isAddress(to))\n throw new InvalidAddressError({ address: to });\n if (maxPriorityFeePerGas || maxFeePerGas)\n throw new BaseError('`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.');\n if (gasPrice && gasPrice > maxUint256)\n throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });\n}\nexport function assertTransactionLegacy(transaction) {\n const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction;\n if (to && !isAddress(to))\n throw new InvalidAddressError({ address: to });\n if (typeof chainId !== 'undefined' && chainId <= 0)\n throw new InvalidChainIdError({ chainId });\n if (maxPriorityFeePerGas || maxFeePerGas)\n throw new BaseError('`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.');\n if (gasPrice && gasPrice > maxUint256)\n throw new FeeCapTooHighError({ maxFeePerGas: gasPrice });\n}\n//# sourceMappingURL=assertTransaction.js.map","/**\n * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.\n * @todo re-check https://issues.chromium.org/issues/42212588\n * @module\n */\nconst U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\nfunction fromBig(n, le = false) {\n if (le)\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\nfunction split(lst, le = false) {\n const len = lst.length;\n let Ah = new Uint32Array(len);\n let Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig };\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n//# sourceMappingURL=_u64.js.map","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n this.length = num === 0 ? 1 : this.length;\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","/**\n * Internal webcrypto alias.\n * We prefer WebCrypto aka globalThis.crypto, which exists in node.js 16+.\n * Falls back to Node.js built-in crypto for Node.js <=v14.\n * See utils.ts for details.\n * @module\n */\n// @ts-ignore\nimport * as nc from 'node:crypto';\nexport const crypto = nc && typeof nc === 'object' && 'webcrypto' in nc\n ? nc.webcrypto\n : nc && typeof nc === 'object' && 'randomBytes' in nc\n ? nc\n : undefined;\n//# sourceMappingURL=cryptoNode.js.map","/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a) {\n return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n/** Asserts something is positive integer. */\nexport function anumber(n) {\n if (!Number.isSafeInteger(n) || n < 0)\n throw new Error('positive integer expected, got ' + n);\n}\n/** Asserts something is Uint8Array. */\nexport function abytes(b, ...lengths) {\n if (!isBytes(b))\n throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n/** Asserts something is hash */\nexport function ahash(h) {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n}\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished)\n throw new Error('Hash#digest() has already been called');\n}\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out, instance) {\n abytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error('digestInto() expects output buffer of length at least ' + min);\n }\n}\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr) {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word, shift) {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n/** The byte swap operation for uint32 */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE = isLE\n ? (n) => n\n : (n) => byteSwap(n);\n/** @deprecated */\nexport const byteSwapIfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\nexport const swap32IfBE = isLE\n ? (u) => u\n : byteSwap32;\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore\ntypeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n if (ch >= asciis._0 && ch <= asciis._9)\n return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F)\n return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f)\n return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== 'string')\n throw new Error('hex string expected, got ' + typeof hex);\n // @ts-ignore\n if (hasHexBuiltin)\n return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2)\n throw new Error('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async () => { };\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(iters, tick, cb) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick)\n continue;\n await nextTick();\n ts += diff;\n }\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== 'string')\n throw new Error('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes) {\n return new TextDecoder().decode(bytes);\n}\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data) {\n if (typeof data === 'string')\n data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\nexport function checkOpts(defaults, opts) {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new Error('options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged;\n}\n/** For runtime check if class implements interface */\nexport class Hash {\n}\n/** Wraps hash function, creating an interface on top of it */\nexport function createHasher(hashCons) {\n const hashC = (msg) => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\nexport function createOptHasher(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport function createXOFer(hashCons) {\n const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({});\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts) => hashCons(opts);\n return hashC;\n}\nexport const wrapConstructor = createHasher;\nexport const wrapConstructorWithOpts = createOptHasher;\nexport const wrapXOFConstructorWithOpts = createXOFer;\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32) {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return Uint8Array.from(crypto.randomBytes(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n//# sourceMappingURL=utils.js.map","import { gweiUnits } from '../../constants/unit.js';\nimport { formatUnits } from './formatUnits.js';\n/**\n * Converts numerical wei to a string representation of gwei.\n *\n * - Docs: https://viem.sh/docs/utilities/formatGwei\n *\n * @example\n * import { formatGwei } from 'viem'\n *\n * formatGwei(1000000000n)\n * // '1'\n */\nexport function formatGwei(wei, unit = 'wei') {\n return formatUnits(wei, gweiUnits[unit]);\n}\n//# sourceMappingURL=formatGwei.js.map","import { LruMap } from '../lru.js';\nimport { checksumAddress } from './getAddress.js';\nconst addressRegex = /^0x[a-fA-F0-9]{40}$/;\n/** @internal */\nexport const isAddressCache = /*#__PURE__*/ new LruMap(8192);\nexport function isAddress(address, options) {\n const { strict = true } = options ?? {};\n const cacheKey = `${address}.${strict}`;\n if (isAddressCache.has(cacheKey))\n return isAddressCache.get(cacheKey);\n const result = (() => {\n if (!addressRegex.test(address))\n return false;\n if (address.toLowerCase() === address)\n return true;\n if (strict)\n return checksumAddress(address) === address;\n return true;\n })();\n isAddressCache.set(cacheKey, result);\n return result;\n}\n//# sourceMappingURL=isAddress.js.map","import { hexToBytes } from '../encoding/toBytes.js';\nimport { bytesToHex } from '../encoding/toHex.js';\n/**\n * Compute the proofs for a list of blobs and their commitments.\n *\n * @example\n * ```ts\n * import {\n * blobsToCommitments,\n * toBlobs\n * } from 'viem'\n * import { kzg } from './kzg'\n *\n * const blobs = toBlobs({ data: '0x1234' })\n * const commitments = blobsToCommitments({ blobs, kzg })\n * const proofs = blobsToProofs({ blobs, commitments, kzg })\n * ```\n */\nexport function blobsToProofs(parameters) {\n const { kzg } = parameters;\n const to = parameters.to ?? (typeof parameters.blobs[0] === 'string' ? 'hex' : 'bytes');\n const blobs = (typeof parameters.blobs[0] === 'string'\n ? parameters.blobs.map((x) => hexToBytes(x))\n : parameters.blobs);\n const commitments = (typeof parameters.commitments[0] === 'string'\n ? parameters.commitments.map((x) => hexToBytes(x))\n : parameters.commitments);\n const proofs = [];\n for (let i = 0; i < blobs.length; i++) {\n const blob = blobs[i];\n const commitment = commitments[i];\n proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment)));\n }\n return (to === 'bytes'\n ? proofs\n : proofs.map((x) => bytesToHex(x)));\n}\n//# sourceMappingURL=blobsToProofs.js.map"],"names":["uuid","generateRequest","ClientBrowser","callServer","options","this","reviver","replacer","generator","version","notificationIdNull","module","exports","prototype","request","method","params","id","callback","self","isBatch","Array","isArray","TypeError","undefined","hasCallback","err","message","JSON","stringify","response","_parseResponse","responseText","parse","length","isError","res","error","isNotError","filter","result","Object","defineProperty","value","obj","_validate","__esModule","default","parseInt","substr","_regex","test","BufferSourceConverter","isArrayBuffer","data","toString","call","toArrayBuffer","byteLength","buffer","byteOffset","toUint8Array","slice","toView","Uint8Array","type","constructor","isArrayBufferView","isBufferSource","ArrayBuffer","isView","isEqual","a","b","aView","bView","i","concat","args","buffers","Function","size","offset","view","set","STRING_TYPE","HEX_REGEX","BASE64_REGEX","BASE64URL_REGEX","Utf8Converter","fromString","text","s","unescape","encodeURIComponent","uintArray","charCodeAt","buf","encodedString","String","fromCharCode","decodeURIComponent","escape","Utf16Converter","littleEndian","arrayBuffer","dataView","DataView","code","getUint16","setUint16","Convert","isHex","isBase64","isBase64Url","ToString","enc","toLowerCase","ToUtf8String","ToBinary","ToHex","ToBase64","ToBase64Url","Error","FromString","str","FromUtf8String","FromBinary","FromHex","FromBase64","FromBase64Url","btoa","binary","Buffer","from","base64","formatted","formatString","atob","base64url","Base64Padding","replace","encoding","DEFAULT_UTF8_ENCODING","stringLength","resultView","len","byte","hexString","c","ToUtf16String","FromUtf16String","padCount","totalByteLength","map","item","reduce","prev","cur","currentPos","forEach","arr","item2","bytes1","bytes2","b1","b2","has","hasOwnProperty","prefix","Events","EE","fn","context","once","addListener","emitter","event","listener","evt","_events","push","_eventsCount","clearEvent","EventEmitter","create","__proto__","eventNames","events","name","names","getOwnPropertySymbols","listeners","handlers","l","ee","listenerCount","emit","a1","a2","a3","a4","a5","arguments","removeListener","apply","j","on","removeAllListeners","off","prefixed","read","isLE","mLen","nBytes","e","m","eLen","eMax","eBias","nBits","d","NaN","Infinity","Math","pow","write","rt","abs","isNaN","floor","log","LN2","__importDefault","mod","sha256_1","base_js_1","sha256","normalizePadding","byteArray","targetLength","paddingLength","padding","fill","expectedZeroCount","zeroCount","encode","decode","decodeUnsafe","unwrap","TextEncoder","derSignature","derSignatureBuf","match","h","index","lengthByte","rLength","r","sLength","rPadded","sPadded","Enclave","utilFromBase","inputBuffer","inputBase","utilToBase","base","reserved","internalReserved","internalValue","biggest","retBuf","retView","basis","utilConcatView","views","outputLength","prevLength","utilDecodeTC","valueHex","condition1","condition2","warnings","bigIntBuffer","bigIntView","bigInt","smallIntBuffer","smallIntView","padNumber","inputNumber","fullLength","dif","join","assertBigInt","BigInt","baseBlock","inputOffset","inputLength","ViewWriter","items","final","powers2","digitsString","NAME","VALUE_HEX_VIEW","IS_HEX_ONLY","ID_BLOCK","TAG_CLASS","TAG_NUMBER","IS_CONSTRUCTED","FROM_BER","TO_BER","LOCAL","EMPTY_STRING","EMPTY_BUFFER","EMPTY_VIEW","END_OF_CONTENT_NAME","OCTET_STRING_NAME","BIT_STRING_NAME","HexBlock","BaseClass","_a","valueHexView","_b","super","isHexOnly","fromBER","endLength","subarray","blockLength","toBER","sizeOnly","toJSON","LocalBaseBlock","blockName","valueBeforeDecode","valueBeforeDecodeView","ValueBlock","_inputBuffer","_inputOffset","_inputLength","_sizeOnly","_writer","LocalIdentificationBlock","idBlock","_c","_d","tagClass","tagNumber","isConstructed","firstOctet","number","encodedBuf","encodedView","curView","inputView","intBuffer","tagNumberMask","count","intTagNumberBuffer","tagNumberBufferMaxLength","tempBufferView","LocalLengthBlock","lenBlock","isIndefiniteForm","longFormUsed","lenOffset","lengthBufferView","typeStore","BaseBlock","optional","primitiveSchema","parameters","valueBlockType","valueBlock","resultOffset","writer","prepareIndefiniteForm","idBlockBuf","valueBlockBuf","lenBlockBuf","object","onAsciiEncoding","other","inputBuffer1","inputBuffer2","view1","view2","Constructed","BaseStringBlock","getValue","setValue","stringValueBlockType","fromBuffer","LocalPrimitiveValueBlock","_a$w","_a$v","_a$u","_a$t","_a$s","_a$r","_a$q","_a$p","_a$o","_a$n","_a$m","_a$l","_a$k","_a$j","_a$i","_a$h","_a$g","_a$f","_a$e","_a$d","_a$c","_a$b","_a$a","_a$9","_a$8","_a$7","_a$6","_a$5","_a$4","_a$3","_a$2","_a$1","AsnPropTypes","AsnTypeTypes","Primitive","localFromBER","incomingOffset","returnObject","newASN1Type","EndOfContent","Boolean","Integer","BitString","OctetString","Null","ObjectIdentifier","Enumerated","Utf8String","RelativeObjectIdentifier","TIME","Sequence","Set","NumericString","PrintableString","TeletexString","VideotexString","IA5String","UTCTime","GeneralizedTime","GraphicString","VisibleString","GeneralString","UniversalString","CharacterString","BmpString","DATE","TimeOfDay","DateTime","Duration","newObject","inputObject","newType","localChangeType","checkLen","indefiniteLength","LocalConstructedValueBlock","currentOffset","pop","values","split","o","LocalEndOfContentValueBlock","override","LocalBooleanValueBlock","octet","LocalOctetStringValueBlock","currentBlockName","asn","array","content","LocalBitStringValueBlock","unusedBits","empty","bits","padStart","bitsStr","substring","viewAdd","first","second","firstView","secondView","firstViewCopy","firstViewCopyLength","secondViewCopy","secondViewCopyLength","counter","power2","n","p","digits","newValue","viewSub","LocalIntegerValueBlock","setValueHex","_valueDec","valueDec","v","modValue","tempBuf","tempView","k","fromDER","expectedLength","toDER","updatedView","firstBit","currentByte","bitNumber","asn1View","flag","byteNumber","charAt","get","toBigInt","fromBigInt","bigIntValue","hex","secondInt","convertToDER","integer","convertFromDER","LocalSidValueBlock","isFirstSid","valueBigInt","bytes","sidValue","LocalObjectIdentifierValueBlock","sidBlock","retBuffers","valueBuf","string","pos1","pos2","sid","indexOf","plus","parsedSID","Number","MAX_SAFE_INTEGER","sidStr","sidArray","LocalRelativeSidValueBlock","LocalRelativeObjectIdentifierValueBlock","LocalStringValueBlock","LocalSimpleStringValueBlock","LocalSimpleStringBlock","inputString","strLen","LocalUtf8StringValueBlock","ex","LocalBmpStringValueBlock","LocalUniversalStringValueBlock","copyBuffer","valueView","Uint32Array","strLength","codeBuf","codeView","valueDate","year","month","day","hour","minute","fromDate","toBuffer","inputDate","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","toDate","Date","UTC","parserArray","exec","outputArray","toISOString","millisecond","getUTCMilliseconds","utcDate","parser","isUTC","timeString","dateTimeString","fractionPart","hourDifference","minuteDifference","valueOf","multiplier","differencePosition","differenceString","fractionPointPosition","fractionPartCheck","fractionResult","tempDate","getUTCDay","Any","Choice","Repeated","local","RawData","compareSchema","root","inputData","inputSchema","element","verified","_result","encodedId","schemaView","admission","maxLength","_optional","arrayRoot","asn1","verifySchema","fromNumber","fromASN","toASN","toSchema","toNumber","reverse","octetSize","octets","param","AsnAnyConverter","schema","AsnIntegerConverter","AsnEnumeratedConverter","AsnIntegerArrayBufferConverter","AsnBitStringConverter","AsnObjectIdentifierConverter","AsnBooleanConverter","AsnOctetStringConverter","AsnConstructedOctetStringConverter","createStringConverter","Asn1Type","AsnUtf8StringConverter","AsnBmpStringConverter","AsnUniversalStringConverter","AsnNumericStringConverter","AsnPrintableStringConverter","AsnTeletexStringConverter","AsnVideotexStringConverter","AsnIA5StringConverter","AsnGraphicStringConverter","AsnVisibleStringConverter","AsnGeneralStringConverter","AsnCharacterStringConverter","AsnUTCTimeConverter","AsnGeneralizedTimeConverter","AsnNullConverter","isConvertible","target","isTypeOfArray","proto","getPrototypeOf","isArrayEqual","schemaStorage","WeakMap","checkSchema","cache","createDefault","parentSchema","findParentSchema","assign","useNames","asn1Value","key","asn1Item","Asn1TypeName","defaultValue","repeated","implicit","Container","isRepeated","parent","AsnType","AsnProp","propertyKey","copyOptions","converter","defaultConverter","raw","AsnSchemaValidationError","schemas","AsnParser","asn1Parsed","asn1Schema","targetSchema","choiceResult","handleChoiceTypes","sequenceResult","handleSequenceTypes","handleArrayTypes","processSchemaItems","schemaItem","fieldSchema","newSeq","fieldValue","newTargetSchema","asn1ComparedSchema","processRepeatedField","asn1Elements","asn1Index","elementsToProcess","seq","el","processPrimitiveField","asn1Element","isOptionalChoiceField","processOptionalChoiceField","processed","itemType","asn1SchemaValue","schemaItemType","parsedValue","processPrimitiveSchemaItem","processComplexSchemaItem","processRepeatedPrimitiveItem","processSinglePrimitiveItem","newItem","newItemAsn","valueToProcess","handleImplicitTagging","newSet","AsnSerializer","serialize","asnSchema","toAsnItem","objProp","AsnArray","__extends","__assign","__rest","__decorate","__param","__esDecorate","__runInitializers","__propKey","__setFunctionName","__metadata","__awaiter","__generator","__exportStar","__createBinding","__values","__read","__spread","__spreadArrays","__spreadArray","__await","__asyncGenerator","__asyncDelegator","__asyncValues","__makeTemplateObject","__importStar","__classPrivateFieldGet","__classPrivateFieldSet","__classPrivateFieldIn","__addDisposableResource","__disposeResources","__rewriteRelativeImportExtension","IpConverter","isIPv4","ip","parseIPv4","parts","part","num","parseIPv6","expandIPv6","includes","left","right","missing","formatIPv6","compressIPv6","longestZeroStart","longestZeroLength","currentZeroStart","currentZeroLength","parseCIDR","addr","prefixStr","decodeIP","mask","uint8","half","addrBytes","maskBytes","every","prefixLen","bitsLeft","out","RelativeDistinguishedName_1","RDNSequence_1","Name_1","DirectoryString","bmpString","printableString","teletexString","universalString","utf8String","AttributeValue","ia5String","anyValue","AttributeTypeAndValue","RelativeDistinguishedName","setPrototypeOf","RDNSequence","AsnIpConverter","OtherName","typeId","EDIPartyName","partyName","id_kp","id_ad","id_ad_ocsp","id_ad_caIssuers","id_ad_timeStamping","id_ad_caRepository","AuthorityInfoAccessSyntax_1","id_pe_authorityInfoAccess","AccessDescription","accessMethod","accessLocation","AuthorityInfoAccessSyntax","id_ce_authorityKeyIdentifier","KeyIdentifier","AuthorityKeyIdentifier","id_ce_basicConstraints","BasicConstraints","cA","GeneralNames_1","CertificateIssuer_1","CertificateIssuer","CertificatePolicies_1","id_ce_certificatePolicies","DisplayText","visibleString","NoticeReference","organization","noticeNumbers","UserNotice","Qualifier","PolicyQualifierInfo","policyQualifierId","qualifier","PolicyInformation","policyIdentifier","CertificatePolicies","CRLNumber","BaseCRLNumber","CRLDistributionPoints_1","id_ce_cRLDistributionPoints","ReasonFlags","Reason","flags","aACompromise","affiliationChanged","cACompromise","certificateHold","cessationOfOperation","keyCompromise","privilegeWithdrawn","superseded","unused","DistributionPointName","DistributionPoint","CRLDistributionPoints","FreshestCRL_1","FreshestCRL","IssuingDistributionPoint","onlyContainsUserCerts","ONLY","onlyContainsCACerts","indirectCRL","onlyContainsAttributeCerts","CRLReasons","CRLReason","reason","unspecified","ExtendedKeyUsage_1","id_ce_extKeyUsage","ExtendedKeyUsage","id_kp_serverAuth","id_kp_clientAuth","id_kp_codeSigning","id_kp_emailProtection","id_kp_timeStamping","id_kp_OCSPSigning","InhibitAnyPolicy","InvalidityDate","IssueAlternativeName_1","IssueAlternativeName","id_ce_keyUsage","KeyUsageFlags","GeneralSubtrees_1","KeyUsage","cRLSign","dataEncipherment","decipherOnly","digitalSignature","encipherOnly","keyAgreement","keyCertSign","keyEncipherment","nonRepudiation","GeneralSubtree","minimum","GeneralSubtrees","NameConstraints","PolicyConstraints","PolicyMappings_1","PolicyMapping","issuerDomainPolicy","subjectDomainPolicy","PolicyMappings","SubjectAlternativeName_1","id_ce_subjectAltName","SubjectAlternativeName","SubjectDirectoryAttributes_1","SubjectDirectoryAttributes","id_ce_subjectKeyIdentifier","SubjectKeyIdentifier","PrivateKeyUsagePeriod","EntrustInfoFlags","SubjectInfoAccessSyntax_1","EntrustInfo","pKIXCertificate","newExtensions","keyUpdateAllowed","EntrustVersionInfo","entrustVers","entrustInfoFlags","SubjectInfoAccessSyntax","AlgorithmIdentifier","algorithm","subjectPublicKey","time","date","generalTime","utcTime","getTime","Validity","notBefore","notAfter","Extensions_1","extnID","critical","CRITICAL","extnValue","Version","TBSCertificate","v1","serialNumber","signature","issuer","validity","subject","subjectPublicKeyInfo","Certificate","tbsCertificate","signatureAlgorithm","signatureValue","userCertificate","revocationDate","TBSCertList","thisUpdate","CertificateList","tbsCertList","IssuerAndSerialNumber","SignerIdentifier","CMSVersion","DigestAlgorithmIdentifier","SignatureAlgorithmIdentifier","KeyEncryptionAlgorithmIdentifier","ContentEncryptionAlgorithmIdentifier","MessageAuthenticationCodeAlgorithm","KeyDerivationAlgorithmIdentifier","Attribute","attrType","attrValues","SignerInfos_1","SignerInfo","v0","digestAlgorithm","SignerInfos","CounterSignature","SigningTime","ACClearAttrs","acIssuer","acSerial","attrs","AttrSpec_1","AttrSpec","AAControls","permitUnSpecified","IssuerSerial","serial","issuerUID","DigestedObjectType","ObjectDigestInfo","digestedObjectType","publicKey","objectDigest","V2Form","AttCertIssuer","AttCertValidityPeriod","notBeforeTime","notAfterTime","Holder","AttCertVersion","ClassListFlags","Targets_1","AttributeCertificateInfo","v2","holder","attrCertValidityPeriod","attributes","AttributeCertificate","acinfo","ClassList","SecurityCategory","Clearance","policyId","classList","unclassified","IetfAttrSyntaxValueChoices","IetfAttrSyntax","TargetCert","targetCertificate","Target","Targets","ProxyInfo_1","ProxyInfo","RoleSyntax","SvceAuthInfo","service","ident","CertificateSet_1","OtherCertificateFormat","otherCertFormat","otherCert","CertificateChoices","CertificateSet","ContentInfo","contentType","EncapsulatedContent","EncapsulatedContentInfo","eContentType","EncryptedContent","EncryptedContentInfo","contentEncryptionAlgorithm","OtherKeyAttribute","keyAttrId","RecipientEncryptedKeys_1","RecipientKeyIdentifier","subjectKeyIdentifier","KeyAgreeRecipientIdentifier","RecipientEncryptedKey","rid","encryptedKey","RecipientEncryptedKeys","OriginatorPublicKey","OriginatorIdentifierOrKey","KeyAgreeRecipientInfo","v3","originator","keyEncryptionAlgorithm","recipientEncryptedKeys","RecipientIdentifier","KeyTransRecipientInfo","KEKIdentifier","keyIdentifier","KEKRecipientInfo","v4","kekid","PasswordRecipientInfo","OtherRecipientInfo","oriType","oriValue","RecipientInfo","RecipientInfos_1","RecipientInfos","RevocationInfoChoices_1","OtherRevocationInfoFormat","otherRevInfoFormat","otherRevInfo","RevocationInfoChoice","RevocationInfoChoices","OriginatorInfo","UnprotectedAttributes_1","UnprotectedAttributes","EnvelopedData","recipientInfos","encryptedContentInfo","id_signedData","DigestAlgorithmIdentifiers_1","DigestAlgorithmIdentifiers","SignedData","digestAlgorithms","encapContentInfo","signerInfos","id_ecPublicKey","id_ecdsaWithSHA1","id_ecdsaWithSHA224","id_ecdsaWithSHA256","id_ecdsaWithSHA384","id_ecdsaWithSHA512","id_secp256r1","id_secp384r1","id_secp521r1","ecdsaWithSHA1","ecdsaWithSHA256","ecdsaWithSHA384","ecdsaWithSHA512","FieldID","Curve","ECPVer","SpecifiedECDomain","ecpVer1","ECParameters","ECPrivateKey","privateKey","ECDSASigValue","id_pkcs_1","id_rsaEncryption","id_RSAES_OAEP","id_pSpecified","id_RSASSA_PSS","id_md2WithRSAEncryption","id_md5WithRSAEncryption","id_sha1WithRSAEncryption","id_sha224WithRSAEncryption","id_sha256WithRSAEncryption","id_sha384WithRSAEncryption","id_sha512WithRSAEncryption","id_sha512_224WithRSAEncryption","id_sha512_256WithRSAEncryption","id_sha1","id_sha224","id_sha256","id_sha384","id_sha512","id_mgf1","sha1","mgf1SHA1","pSpecifiedEmpty","RsaEsOaepParams","hashAlgorithm","maskGenAlgorithm","pSourceAlgorithm","RsaSaPssParams","saltLength","trailerField","DigestInfo","digest","OtherPrimeInfos_1","OtherPrimeInfo","prime","exponent","coefficient","OtherPrimeInfos","RSAPrivateKey","modulus","publicExponent","privateExponent","prime1","prime2","exponent1","exponent2","RSAPublicKey","Lifecycle","isClassProvider","provider","useClass","isFactoryProvider","useFactory","DelayedConstructor","wrap","reflectMethods","createProxy","createObject","_this","init","Proxy","createHandler","delayedObject","handler","_i","Reflect","isNormalToken","token","descriptor","isTokenProvider","useToken","isValueProvider","useValue","RegistryBase","_registryMap","Map","entries","getAll","ensure","setAll","clear","_super","Registry","scopedResolutions","PreResolutionInterceptors","PostResolutionInterceptors","preResolution","postResolution","typeInfo","InternalDependencyContainer","_registry","interceptors","disposed","disposables","register","providerOrConstructor","lifecycle","Transient","ensureNotDisposed","isProvider","path","tokenProvider","currentToken","registration","Singleton","ContainerScoped","ResolutionScoped","registerType","to","registerInstance","instance","registerSingleton","resolve","isOptional","getRegistration","executePreResolutionInterceptor","resolveRegistration","executePostResolutionInterceptor","isConstructorToken","construct","resolutionType","e_1","remainingInterceptors","next","done","interceptor","frequency","e_1_1","return","e_2","e_2_1","resolved","isSingleton","isContainerScoped","returnInstance","resolveAll","registrations","getAllRegistrations","result_1","isRegistered","recursive","reset","clearInstances","e_3","e_3_1","createChildContainer","e_4","childContainer","some","e_4_1","beforeResolution","afterResolution","dispose","promises","label","disposable","maybePromise","Promise","all","sent","ctor","paramInfo","resolveParams","bind","add","idx","multiple","transform","transformArgs","paramIdx","msg","indent","trim","getMetadata","injectionTokens","getOwnMetadata","keys","PKCS12AttrSet_1","PKCS12Attribute","attrId","PKCS12AttrSet","AuthenticatedSafe_1","AuthenticatedSafe","CertBag","certId","certValue","CRLBag","crlId","crltValue","EncryptedData","encryptionAlgorithm","encryptedData","Attributes_1","PrivateKey","Attributes","PrivateKeyInfo","privateKeyAlgorithm","KeyBag","PKCS8ShroudedKeyBag","SecretBag","secretTypeId","secretValue","MacData","mac","macSalt","iterations","PFX","authSafe","macData","SafeContents_1","SafeBag","bagId","bagValue","SafeContents","ExtensionRequest_1","ExtendedCertificateAttributes_1","SMIMECapabilities_1","id_pkcs9","id_pkcs9_at_challengePassword","PKCS9String","Pkcs7PDU","UserPKCS12","EncryptedPrivateKeyInfo","EmailAddress","UnstructuredName","UnstructuredAddress","DateOfBirth","PlaceOfBirth","Gender","CountryOfCitizenship","CountryOfResidence","Pseudonym","ContentType","SequenceNumber","ChallengePassword","ExtensionRequest","ExtendedCertificateAttributes","FriendlyName","SMIMECapability","SMIMECapabilities","subjectPKInfo","certificationRequestInfo","diAlgorithm","diAlgorithmProvider","EcAlgorithm_1","getAlgorithms","toAsnAlgorithm","alg","unknown","toWebAlgorithm","idVersionOne","idBrainpoolP160r1","idBrainpoolP160t1","idBrainpoolP192r1","idBrainpoolP192t1","idBrainpoolP224r1","idBrainpoolP224t1","idBrainpoolP256r1","idBrainpoolP256t1","idBrainpoolP320r1","idBrainpoolP320t1","idBrainpoolP384r1","idBrainpoolP384t1","idBrainpoolP512r1","idBrainpoolP512t1","brainpoolP160r1","brainpoolP160t1","brainpoolP192r1","brainpoolP192t1","brainpoolP224r1","brainpoolP224t1","brainpoolP256r1","brainpoolP256t1","brainpoolP320r1","brainpoolP320t1","brainpoolP384r1","brainpoolP384t1","brainpoolP512r1","brainpoolP512t1","ECDSA","EcAlgorithm","hash","namedCurve","SECP256K1","Symbol","VALUE","TextObject","OidSerializer","oid","TextConverter","serializeObj","pad","deep","objValue","keyValue","toUTCString","serializeBufferSource","toTextObject","row","serializeAlgorithm","algorithmSerializer","oidSerializer","ecAlg","AsnData","rawData","onInit","equal","format","getTextName","toTextObjectEmpty","Extension","toTextObjectWithoutValue","CryptoProvider","isCryptoKeyPair","isCryptoKey","usages","extractable","crypto","DEFAULT","g","subtle","delete","callbackfn","thisArg","iterator","toStringTag","cryptoProvider","OID_REGEX","NameIdentifier","idOrName","findId","RegExp","replaceUnknownCharacter","char","toUpperCase","Name","isASCII","isPrintableString","extraNames","fromJSON","getField","rdn","getName","json","jsonItem","attr","regex","matches","level","lastChar","getTypeOid","createAttribute","asnRdn","asnAttr","processedValue","processStringValue","quotedMatches","getThumbprint","ERR_GN_CONSTRUCTOR","ERR_GN_STRING_FORMAT","ERR_GUID","GUID_REGEX","id_GUID","id_UPN","DNS","DN","EMAIL","IP","URL","GUID","UPN","REGISTERED_ID","GeneralName","derName","asnName","directoryName","dNSName","rfc822Name","otherName","iPAddress","registeredID","uniformResourceIdentifier","guid","GeneralNames","nameObj","field","rPaddingTag","rEolChars","rEolGroup","rPem","PemConverter","isPem","decodeWithHeaders","pem","pattern","pemStruct","headers","headersString","lastHeader","header","decodeFirst","RangeError","tag","raws","encodeStruct","upperCaseType","toLocaleUpperCase","sliced","rows","CertificateTag","CrlTag","CertificateRequestTag","PublicKeyTag","PrivateKeyTag","PemData","isAsnEncoded","stringRaw","PublicKey","spki","exportKey","keyUsages","asnSpki","convertSpkiToRsaPkcs1","importKey","algProv","rsaPublicKey","modulusLength","getKeyIdentifier","AuthorityKeyIdentifierExtension","certIdName","authorityCertIssuer","authorityCertSerialNumber","aki","keyId","BasicConstraintsExtension","ca","pathLength","pathLenConstraint","ExtendedKeyUsageExtension","KeyUsagesExtension","SubjectKeyIdentifierExtension","identifier","SubjectAlternativeNameExtension","namesObj","ExtensionFactory","extension","Type","CertificatePolicyExtension","asnPolicies","policies","CRLDistributionPointsExtension","dps","url","distributionPoint","fullName","distributionPoints","crlExt","dp","dpObj","reasons","cRLIssuer","AuthorityInfoAccessExtension","addAccessDescriptions","ocsp","caIssuers","timeStamping","caRepository","accessDescription","addUrlsToObject","urls","indexedKey","ChallengePasswordAttribute","password","ExtensionsAttribute","extensions","AttributeFactory","attribute","diAsnSignatureFormatter","RsaAlgorithm_1","RsaAlgorithm","createPssParams","getHashAlgorithm","pssParams","ShaAlgorithm","AsnEcSignatureFormatter","addPadding","pointSize","removePadding","positive","toAsnSignature","namedCurveSize","defaultNamedCurveSize","ecSignature","uint8Signature","toWebSignature","ecSigValue","idX25519","idX448","idEd25519","idEd448","EdAlgorithm","tbs","getAttribute","subjectName","getAttributes","getExtension","ext","getExtensions","verify","export","signatureFormatters","signatureFormatter","req","attrObj","X509CrlReason","issuerName","keyAlgorithm","paramsKey","ok","signatureOnly","isSelfSigned","cert","issuerUniqueID","subjectUniqueID","extObj","hexOrBytes","dir","padHex","targetSize","paddedBytes","padEnd","padBytes","hex_","ceil","u8","buffer_1","checkUint8Array","uint8ArrayToBuffer","Layout","span","property","isInteger","makeDestinationObject","getSpan","replicate","rv","fromArray","nameWithProperty","lo","ExternalLayout","isCount","OffsetLayout","layout","UInt","UIntBE","src","readUIntLE","writeUIntLE","readUIntBE","writeUIntBE","V2E32","divmodInt64","hi32","lo32","roundedInt64","NearUInt64","readUInt32LE","writeUInt32LE","NearInt64","readInt32LE","writeInt32LE","elementLayout","elo","Structure","fields","decodePrefixes","acc","fd","fsp","dest","firstOffset","lastOffset","lastWrote","fv","shift","layoutFor","offsetOf","Blob","srcBuffer","_0n","_1n","negateCt","condition","neg","negate","normalizeZ","points","invertedZs","Fp","Z","fromAffine","toAffine","validateW","W","isSafeInteger","calcWOpts","scalarBits","maxNumber","windows","windowSize","shiftBy","calcOffsets","window","wOpts","wbits","nextN","offsetStart","isZero","isNeg","isNegF","offsetF","pointPrecomputes","pointWindowSizes","getW","P","assert0","wNAF","Point","BASE","ZERO","Fn","_unsafeLadder","elm","double","precomputeWindow","point","precomputes","isValid","f","wo","wNAFUnsafe","getPrecomputes","comp","cached","scalar","unsafe","createCache","hasCache","mulEndoUnsafe","k1","k2","p1","p2","pippenger","fieldN","scalars","validateMSMPoints","validateMSMScalars","plength","slength","zero","MASK","buckets","sum","BITS","resI","sumI","createField","order","ORDER","_createCurveFields","CURVE","curveOpts","FpFnLE","val","freeze","etherUnits","gwei","wei","gweiUnits","ether","getOutputLength","inputLength8","safeAdd","x","y","lsw","md5cmn","q","t","cnt","md5ff","md5gg","md5hh","md5ii","input","output","length32","hexTab","md5ToHexEncodedArray","olda","oldb","oldc","oldd","wordsToMd5","length8","bytesToWords","HpkeError","EncapError","DecapError","ExportError","SealError","OpenError","MessageLimitReachedError","DeriveKeyPairError","dntGlobalThis","baseObj","globalThis","_target","prop","_receiver","deleteProperty","success","ownKeys","baseKeys","extKeys","extKeysSet","desc","getOwnPropertyDescriptor","NativeAlgorithm","enumerable","configurable","writable","_setup","_api","async","webcrypto","loadSubtleCrypto","INPUT_LENGTH_LIMIT","w","ret","LABEL_EAE_PRK","LABEL_SHARED_SECRET","Dhkem","prim","kdf","_prim","_kdf","suiteId","serializePublicKey","deserializePublicKey","serializePrivateKey","deserializePrivateKey","isPublic","generateKeyPair","deriveKeyPair","ikm","encap","ke","ekm","pkrm","recipientPublicKey","dh","kemContext","senderKey","sks","pks","derivePublicKey","pksm","concat3","sharedSecret","_generateSharedSecret","decap","pke","skr","recipientKey","pkr","senderPublicKey","labeledIkm","buildLabeledIkm","labeledInfo","buildLabeledInfo","secretSize","extractAndExpand","KEM_USAGES","Bignum","_num","lessThan","LABEL_CANDIDATE","ORDER_P_256","ORDER_P_384","ORDER_P_521","PKCS8_ALG_ID_P_256","PKCS8_ALG_ID_P_384","PKCS8_ALG_ID_P_521","Ec","kem","hkdf","_hkdf","_alg","_nPk","_nSk","_nDh","_order","_bitmask","_pkcs8AlgId","_importRawKey","jwk","byteString","base64UrlToBytes","_importJWK","generateKey","dkpPrk","labeledExtract","bn","labeledExpand","sk","_deserializePkcs8Key","pk","deriveBits","public","crv","pkcs8Key","HPKE_VERSION","HkdfNative","_suiteId","_checkInit","info","extract","salt","hashSize","algHash","sign","expand","prk","okm","mid","tail","tmp","baseKey","HkdfSha256Native","AEAD_USAGES","AesGcmContext","_rawKey","seal","iv","aad","_setupKey","additionalData","encrypt","_key","open","decrypt","_importKey","Aes128Gcm","createEncryptionContext","Aes256Gcm","emitNotSupported","_resolve","reject","LABEL_SEC","ExporterContextImpl","api","exporterSecret","_data","_aad","exporterContext","RecipientExporterContextImpl","SenderExporterContextImpl","EncryptionContextImpl","baseNonce","_aead","aead","_nK","keySize","_nN","nonceSize","_nT","tagSize","_ctx","computeNonce","seqBytes","xor","incrementSeq","_Mutex_locked","Mutex","lock","releaseLock","nextLock","previousLock","receiver","state","kind","_RecipientContextImpl_mutex","RecipientContextImpl","release","pt","_SenderContextImpl_mutex","SenderContextImpl","ct","LABEL_BASE_NONCE","LABEL_EXP","LABEL_INFO_HASH","LABEL_KEY","LABEL_PSK_ID_HASH","LABEL_SECRET","SUITE_ID_HEADER_HPKE","CipherSuiteNative","_kem","createSenderContext","_validateInputLength","mode","psk","_keyScheduleS","createRecipientContext","_keyScheduleR","ctx","_keySchedule","pskId","pskIdHash","infoHash","keyScheduleContext","exporterSecretInfo","keyInfo","baseNonceInfo","DhkemP256HkdfSha256Native","CipherSuite","DhkemP256HkdfSha256","HkdfSha256","errorConfig","docsBaseUrl","docsPath","docsSlug","BaseError","shortMessage","details","cause","docsUrl","metaMessages","walk","hashfunc","generateUUID","namespace","stringToBytes","_parse","_stringify","_interopRequireDefault","_abool2","title","_abytes2","needsLen","numberToHexUnpadded","hexToNumber","bytesToNumberBE","bytesToNumberLE","numberToBytesBE","numberToBytesLE","ensureBytes","equalBytes","diff","copyBytes","isPosBig","aInRange","min","max","inRange","bitLen","bitMask","createHmacDrbg","hashLen","qByteLen","hmacFn","u8n","u8of","of","reseed","seed","gen","sl","pred","_validateObject","optFields","checkField","fieldName","expectedType","isOpt","current","notImplemented","memoized","arg","computed","keccak256","to_","strict","_v3","byteToHex","ALPHABET","ALPHABET_MAP","z","polymodStep","pre","prefixChk","chk","convert","inBits","outBits","maxV","toWords","fromWordsUnsafe","words","fromWords","getLibraryFromEncoding","ENCODING_CONST","__decode","LIMIT","lowered","uppered","lastIndexOf","wordChars","global","POW_2_24","POW_2_32","POW_2_53","lastLength","ensureSpace","newByteLength","requiredLength","oldDataView","uint32count","setUint32","getUint32","writeUint8","setUint8","writeUint8Array","writeTypeAndLength","writeUint16","writeUint32","low","high","writeUint64","encodeItem","setFloat64","writeFloat64","utf8data","charCode","getUint8","tagger","simpleValue","readArrayBuffer","readUint8","readUint16","readUint32","readBreak","readLength","additionalInformation","readIndefiniteStringLength","majorType","initialByte","appendUtf16data","utf16data","decodeItem","tempArrayBuffer","tempDataView","fraction","getFloat32","readFloat16","getFloat64","elements","fullArrayLength","fullArray","fullArrayOffset","retArray","retObject","_2n","_8n","PrimeEdwardsPoint","ep","fromBytes","_bytes","fromHex","_hex","clearCofactor","assertValidity","invertedZ","toHex","toBytes","isTorsionFree","isSmallOrder","assertSame","subtract","multiply","multiplyUnsafe","precompute","isLazy","toRawBytes","eddsaOpts","Gx","Gy","nBitLength","uvRatio","randomBytes","adjustScalarBytes","domain","prehash","mapToCurve","_eddsa_legacy_opts_to_new","extraOpts","validated","cofactor","BYTES","modP","u","sqrt","div","x2","sqr","y2","mul","ONE","eql","isEdValidXY","acoord","banZero","aextpoint","toAffineMemo","iz","X","Y","is0","inv","zz","assertValidMemo","T","X2","Y2","Z2","Z4","aX2","zip215","normed","lastByte","isXOdd","isLastByteOdd","wnaf","equals","X1","Y1","Z1","X1Z2","X2Z1","Y1Z2","Y2Z1","A","B","C","D","x1y1","E","G","F","H","X3","Y3","T3","Z3","T1","T2","isValidNot0","ey","ez","et","msm","_setWindowSize","edwards","eddsa","ExtendedPoint","nByteLength","_eddsa_new_output_to_legacy","cHash","phflag","modN_LE","getExtendedPublicKey","secretKey","head","lengths","hashed","getPrivateScalar","pointBytes","getPublicKey","hashDomainToScalar","msgs","verifyOpts","_size","randomSecretKey","utils","isValidSecretKey","isValidPublicKey","toMontgomery","is25519","toMontgomerySecret","randomPrivateKey","keygen","R","rs","sig","SB","_5n","ed25519_CURVE_p","ed25519_CURVE","ED25519_SQRT_M1","_10n","_20n","_40n","_80n","b4","b5","b10","b20","b40","b80","b160","b240","b250","pow_p_5_8","ed25519_pow_2_252_3","vx2","root1","root2","useRoot1","useRoot2","noRoot","ed25519Defaults","ed25519","SQRT_M1","SQRT_AD_MINUS_ONE","INVSQRT_A_MINUS_D","ONE_MINUS_D_SQ","D_MINUS_ONE_SQ","invertSqrt","MAX_255B","bytes255ToNumberLE","calcElligatorRistrettoMap","r0","Ns","Ns_D_is_sq","s_","Nt","s2","W0","W1","W2","W3","_RistrettoPoint","ap","hashToCurve","R1","R2","ristretto255_map","u1","u2","u1_2","u2_2","I","Dx","Dy","u2sq","invsqrt","D1","D2","zInv","_x","_y","one","two","encodeValue","encodeObjectContextEntry","contextAndErrorOptions","errorOptions","contextRest","decodingAdviceMessage","searchParamsString","encodeContextObject","getErrorMessage","__code","isFixedSize","codec","fixedSize","isLittleEndian","config","endian","numberEncoderFactory","encoder","range","codecDescription","assertNumberIsBetweenForCodec","getSizeFromValue","getEncodedSize","numberDecoderFactory","decoder","assertByteArrayIsNotEmptyForCodec","expected","bytesLength","assertByteArrayHasEnoughBytesForCodec","bytesOffset","getU64Encoder","le","setBigUint64","getU64Codec","decoderFixedSize","encoderFixedSize","maxSize","decoderMaxSize","encoderMaxSize","getBigUint64","getU64Decoder","StructError","failure","failures","explanation","rest","isObject","isNonArrayObject","print","toFailure","struct","branch","refinement","toFailures","run","coerce","coercer","status","validator","ts","refiner","Struct","props","assert","validate","is","tuples","tuple","shiftIterator","Element","Class","literal","constant","description","record","Key","Value","Structs","Never","union","S","coerced","generateKeypair","privateScalar","isOnCurve","isBuffer","properties","SOLANA_SCHEMA","deserialize","decodeUnchecked","deserializeUnchecked","_PublicKey","PUBLIC_KEY_LENGTH","uniquePublicKeyCounter","_bn","isPublicKeyData","decoded","unique","eq","toBase58","toArrayLike","zeroPad","alloc","copy","createWithSeed","fromPublicKey","programId","publicKeyBytes","createProgramAddressSync","seeds","createProgramAddress","findProgramAddressSync","address","nonce","seedsWithNonce","findProgramAddress","pubkeyData","PACKET_DATA_SIZE","TransactionExpiredBlockheightExceededError","TransactionExpiredTimeoutError","timeoutSeconds","toFixed","TransactionExpiredNonceInvalidError","MessageAccountKeys","staticAccountKeys","accountKeysFromLookups","keySegments","readonly","keySegment","flat","compileInstructions","instructions","U8_MAX","keyIndexMap","findKeyIndex","keyIndex","instruction","programIdIndex","accountKeyIndexes","meta","pubkey","rustString","rsl","_decode","_encode","rslShim","chars","getAlloc","getItemAlloc","decodeLength","elem","encodeLength","rem_len","CompiledKeys","payer","keyMetaMap","compile","getOrInsertDefault","keyMeta","isSigner","isWritable","isInvoked","payerKeyMeta","ix","accountMeta","getMessageComponents","mapEntries","writableSigners","readonlySigners","writableNonSigners","readonlyNonSigners","numRequiredSignatures","numReadonlySignedAccounts","numReadonlyUnsignedAccounts","payerAddress","extractTableLookup","lookupTable","writableIndexes","drainedWritableKeys","drainKeysFoundInLookupTable","addresses","readonlyIndexes","drainedReadonlyKeys","accountKey","lookupTableEntries","keyMetaFilter","lookupTableIndexes","drainedKeys","lookupTableIndex","findIndex","entry","END_OF_BUFFER_ERROR_MESSAGE","guardedShift","guardedSplice","start","splice","Message","accountKeys","recentBlockhash","indexToProgramIds","account","compiledInstructions","accounts","addressTableLookups","getAccountKeys","compiledKeys","payerKey","isAccountSigner","isAccountWritable","numSignedAccounts","isProgramId","programIds","nonProgramIds","_","numKeys","keyCount","keyIndicesCount","dataCount","keyIndices","dataLength","instructionCount","instructionBuffer","instructionBufferLength","signDataLayout","transaction","signData","accountCount","dataSlice","messageArgs","MessageV0","numAccountKeysFromLookups","lookup","addressLookupTableAccounts","resolveAddressTableLookups","numStaticAccountKeys","tableLookup","tableAccount","find","lookupTableAccounts","extractResult","addressTableLookup","encodedStaticAccountKeysLength","serializedInstructions","serializeInstructions","encodedInstructionsLength","serializedAddressTableLookups","serializeAddressTableLookups","encodedAddressTableLookupsLength","messageLayout","serializedMessage","serializedMessageLength","staticAccountKeysLength","instructionsLength","addressTableLookupsLength","serializedLength","encodedAccountKeyIndexesLength","encodedDataLength","encodedWritableIndexesLength","encodedReadonlyIndexesLength","maskedPrefix","addressTableLookupsCount","VersionedMessage","deserializeMessageVersion","DEFAULT_SIGNATURE","TransactionInstruction","opts","Transaction","signatures","feePayer","lastValidBlockHeight","nonceInfo","minNonceContextSlot","_message","_json","minContextSlot","blockhash","nonceInstruction","signers","compileMessage","console","warn","accountMetas","uniqueMetas","pubkeyString","uniqueIndex","sort","localeCompare","localeMatcher","usage","sensitivity","ignorePunctuation","numeric","caseFirst","feePayerIndex","payerMeta","unshift","signedKeys","unsignedKeys","_compile","pair","serializeMessage","getEstimatedFee","connection","getFeeForMessage","setSigners","seen","uniqueSigners","signer","_partialSign","partialSign","_addSignature","addSignature","sigpair","verifySignatures","requireAllSignatures","_getMessageSignednessErrors","errors","invalid","sigErrors","errorMessage","_serialize","signatureCount","transactionLength","wireTransaction","keyObj","populate","sigPubkeyPair","VersionedTransaction","defaultSignatures","encodedSignaturesLength","transactionLayout","serializedTransaction","serializedTransactionLength","signaturesLength","messageData","signerPubkeys","signerIndex","SYSVAR_CLOCK_PUBKEY","SYSVAR_RECENT_BLOCKHASHES_PUBKEY","SYSVAR_RENT_PUBKEY","SYSVAR_STAKE_HISTORY_PUBKEY","SendTransactionError","action","transactionMessage","logs","maybeLogsOutput","guideText","transactionLogs","transactionError","cachedLogs","getLogs","getTransaction","then","tx","logMessages","catch","sendAndConfirmTransaction","sendOptions","skipPreflight","preflightCommitment","commitment","maxRetries","sendTransaction","confirmTransaction","abortSignal","nonceAccountPubkey","nonceValue","sleep","ms","setTimeout","encodeData","allocLength","layoutFields","FeeCalculatorLayout","NONCE_ACCOUNT_LENGTH","u64","bigIntLayout","SYSTEM_INSTRUCTION_LAYOUTS","Create","Assign","Transfer","CreateWithSeed","AdvanceNonceAccount","WithdrawNonceAccount","InitializeNonceAccount","AuthorizeNonceAccount","Allocate","AllocateWithSeed","AssignWithSeed","TransferWithSeed","UpgradeNonceAccount","SystemProgram","createAccount","lamports","space","fromPubkey","newAccountPubkey","transfer","basePubkey","toPubkey","accountPubkey","createAccountWithSeed","createNonceAccount","noncePubkey","initParams","authorizedPubkey","nonceInitialize","authorized","instructionData","nonceAdvance","nonceWithdraw","nonceAuthorize","newAuthorizedPubkey","allocate","Loader","getMinNumSignatures","chunkSize","load","program","balanceNeeded","getMinimumBalanceForRentExemption","programInfo","getAccountInfo","executable","owner","dataLayout","transactions","bytesLengthPadding","_rpcEndpoint","REQUESTS_PER_SECOND","deployCommitment","finalizeSignature","getSlot","slot","round","MS_PER_SLOT","fetch","PublicKeyFromString","RawAccountDataResult","BufferFromRawAccountData","createRpcResult","jsonrpc","UnknownRpcResult","jsonRpcResult","jsonRpcResultAndContext","notificationResultAndContext","GetInflationGovernorResult","foundation","foundationTerm","initial","taper","terminal","GetRecentPrioritizationFeesResult","epoch","effectiveSlot","amount","postBalance","commission","prioritizationFee","GetInflationRateResult","total","GetEpochInfoResult","slotIndex","slotsInEpoch","absoluteSlot","blockHeight","transactionCount","GetEpochScheduleResult","slotsPerEpoch","leaderScheduleSlotOffset","warmup","firstNormalEpoch","firstNormalSlot","GetLeaderScheduleResult","TransactionErrorResult","SignatureStatusResult","SignatureReceivedResult","ParsedInstructionStruct","parsed","PartiallyDecodedInstructionStruct","rentEpoch","unitsConsumed","returnData","innerInstructions","byIdentity","firstSlot","lastSlot","circulating","nonCirculating","nonCirculatingAccounts","TokenAmountResult","uiAmount","decimals","uiAmountString","ParsedAccountDataResult","AccountInfoResult","ParsedOrRawAccountData","ParsedAccountInfoResult","ProgramAccountInfoResult","active","inactive","memo","blockTime","subscription","SlotInfoResult","SlotUpdateResult","timestamp","stats","numTransactionEntries","numSuccessfulTransactions","numFailedTransactions","maxTransactionsPerEntry","VoteAccountInfoResult","gossip","tpu","rpc","votePubkey","nodePubkey","activatedStake","epochVoteAccount","epochCredits","lastVote","rootSlot","ConfirmationStatus","delinquent","SignatureStatusResponse","confirmations","confirmationStatus","AddressTableLookupStruct","ConfirmedTransactionResult","AnnotatedAccountKey","source","ConfirmedTransactionAccountsModeResult","ParsedInstructionResult","RawInstructionResult","ParsedOrRawInstruction","ParsedConfirmedTransactionResult","TokenBalanceResult","accountIndex","mint","uiTokenAmount","LoadedAddressesResult","ConfirmedTransactionMetaResult","fee","preBalances","postBalances","preTokenBalances","postTokenBalances","loadedAddresses","computeUnitsConsumed","costUnits","ParsedConfirmedTransactionMetaResult","TransactionVersionStruct","RewardsResult","rewardType","LogsResult","previousBlockhash","parentSlot","rewards","numTransactions","numSlots","samplePeriodSecs","feeCalculator","lamportsPerSignature","Keypair","keypair","_keypair","generate","fromSecretKey","skipValidation","computedPublicKey","ii","fromSeed","CreateLookupTable","FreezeLookupTable","ExtendLookupTable","DeactivateLookupTable","CloseLookupTable","RequestUnits","RequestHeapFrame","SetComputeUnitLimit","SetComputeUnitPrice","ED25519_INSTRUCTION_LAYOUT","Ed25519Program","createInstructionWithPublicKey","instructionIndex","publicKeyOffset","signatureOffset","messageDataOffset","numSignatures","signatureInstructionIndex","publicKeyInstructionIndex","messageDataSize","messageInstructionIndex","createInstructionWithPrivateKey","secp256k1","isValidPrivateKey","publicKeyCreate","SECP256K1_INSTRUCTION_LAYOUT","Secp256k1Program","publicKeyToEthAddress","recoveryId","createInstructionWithEthAddress","ethAddress","rawAddress","startsWith","ethAddressOffset","ethAddressInstructionIndex","pkey","messageHash","msgHash","privKey","toCompactRawBytes","recovery","ecdsaSign","_Lockup","STAKE_CONFIG_ID","Lockup","unixTimestamp","custodian","STAKE_INSTRUCTION_LAYOUTS","Initialize","lockup","Authorize","Delegate","Split","Withdraw","Deactivate","Merge","AuthorizeWithSeed","Staker","Withdrawer","StakeProgram","initialize","stakePubkey","maybeLockup","staker","withdrawer","delegate","authorize","stakeAuthorizationType","custodianPubkey","newAuthorized","authorizeWithSeed","authorityBase","authoritySeed","authorityOwner","splitInstruction","splitStakePubkey","rentExemptReserve","splitWithSeed","merge","sourceStakePubKey","withdraw","deactivate","VOTE_INSTRUCTION_LAYOUTS","InitializeAccount","voteInit","UpdateValidatorIdentity","voteAuthorizeWithSeedArgs","Voter","VoteProgram","initializeAccount","authorizedVoter","authorizedWithdrawer","voteAuthorizationType","currentAuthorityDerivedKeyBasePubkey","currentAuthorityDerivedKeyOwnerPubkey","currentAuthorityDerivedKeySeed","authorizedWithdrawerPubkey","safeWithdraw","currentVoteAccountBalance","rentExemptMinimum","updateValidatorIdentity","website","iconUrl","keybaseUsername","createExporter","previous","exporter","extendStatics","__","propertyIsEnumerable","decorators","decorate","paramIndex","decorator","descriptorIn","contextIn","initializers","extraInitializers","accept","access","addInitializer","metadataKey","metadataValue","metadata","_arguments","fulfilled","step","rejected","body","trys","ops","Iterator","verb","op","ar","il","jl","pack","asyncIterator","AsyncIterator","resume","fulfill","settle","cooked","__setModuleDefault","getOwnPropertyNames","env","inner","asyncDispose","stack","_SuppressedError","SuppressedError","suppressed","fail","hasError","preserveJsx","tsx","cm","factory","BinaryReader","BinaryWriter","BorshError","baseDecode","baseEncode","bn_js_1","bs58_1","textDecoder","TextDecoder","fatal","INITIAL_LENGTH","fieldPath","originalMessage","addToFieldPath","maybeResize","writeU8","writeUInt8","writeU16","writeUInt16LE","writeU32","writeU64","writeBuffer","toArray","writeU128","writeU256","writeU512","writeString","writeFixedArray","writeArray","handlingRangeError","propertyDescriptor","originalMethod","readU8","readUInt8","readU16","readUInt16LE","readU32","readU64","readBuffer","readU128","readU256","readU512","readString","readFixedArray","readArray","capitalizeFirstLetter","serializeField","fieldType","serializeStruct","borshSerialize","structSchema","deserializeField","reader","deserializeStruct","classType","borshDeserialize","Writer","Reader","copyProps","dst","SafeBuffer","encodingOrOffset","allocUnsafe","allocUnsafeSlow","SlowBuffer","HMAC","finished","destroyed","iHash","update","blockLen","outputLen","oHash","digestInto","destroy","_cloneInto","clone","divNearest","den","validateSigFormat","validateSigOpts","def","optsn","optName","lowS","DERErr","DER","Err","_tlv","dataLen","lenLen","pos","lengthBytes","_int","toSig","int","tlv","seqLeftBytes","rBytes","rLeftBytes","sBytes","sLeftBytes","hexFromSig","_3n","_4n","pprefix","hasEvenY","getWLengths","publicKeyUncompressed","publicKeyHasPrefix","weierstrass","ecdsaOpts","allowedLengths","allowedPrivateKeyLengths","modFromBytes","wrapPrivateKey","allowInfinityPoint","endo","_weierstrass_legacy_opts_to_new","hmac","bits2int","bits2int_modN","_ecdsa_legacy_opts_to_new","_ecdsa","ProjectivePoint","_ecdsa_new_output_to_legacy","CURVE_ORDER","fnBits","getSharedSecret","ecdhOpts","randomBytes_","isCompressed","isProbPub","normPrivateKeyToScalar","secretKeyA","publicKeyB","ecdh","defaultSigOpts","extraEntropy","defaultSigOpts_format","isBiggerThanHalfOrder","validateRS","Signature","recid","sizer","validateSigLength","L","addRecoveryBit","recoverPublicKey","FIELD_ORDER","rec","radj","ir","Q","hasHighS","fromCompact","normalizeS","toDERRawBytes","toDERHex","toCompactHex","delta","ORDER_MASK","int2octets","validateMsgAndHash","k2sig","h1int","seedArgs","kBytes","ik","normS","prepSig","drbg","sg","isObj","derError","tryParsingSig","ecdsa","beta","basises","assertCompressionIsSupported","isOdd","encodePoint","bx","decodePoint","uncomp","isValidXY","weierstrassEquation","sqrtError","x3","_4a3","_27b2","aprjpoint","splitEndoScalarN","c1","c2","k1neg","k2neg","MAX_NUM","_splitEndoScalar","finishEndo","endoBeta","k1p","k2p","U1","U2","b3","t0","t1","t2","t3","sub","t4","t5","fake","k1f","k2f","sc","multiplyAndAddUnsafe","px","py","pz","fromPrivateKey","weierstrassN","secp256k1_CURVE","secp256k1_ENDO","Fpk1","_6n","_11n","_22n","_23n","_44n","_88n","b6","b9","b11","b22","b44","b88","b176","b220","b223","curveDef","defHash","createCurve","sha2","checksumFn","decodeRaw","payload","checksum","newChecksum","payloadU8","both","_v","_md","_default","_sha","end","sliceHex","value_","assertStartOffset","assertEndOffset","sliceBytes","position","BlobSizeTooLargeError","EmptyBlobError","InvalidVersionedHashSizeError","InvalidVersionedHashVersionError","_rng","rnds","random","rng","hexes","numberToHex","stringToHex","boolToHex","bytesToHex","signed","maxValue","minValue","suffix","ToDictionary","Stream","tokens","endOfStream","prepend","decoderError","opt_code_point","DEFAULT_ENCODING","_streaming","_BOMseen","_decoder","_fatal","_ignoreBOM","_encoder","_options","UTF8Decoder","utf8_code_point","utf8_bytes_seen","utf8_bytes_needed","utf8_lower_boundary","utf8_upper_boundary","stream","bite","code_point","UTF8Encoder","temp","input_stream","code_points","cp","codePointsToString","opt_string","stringToCodePoints","InvalidAddressError","IntegerOutOfRangeError","InvalidHexValueError","SizeOverflowError","givenSize","sha512","NegativeOffsetError","PositionOutOfBoundsError","RecursiveReadLimitExceededError","limit","staticCursor","positionReadCount","recursiveReadCount","recursiveReadLimit","POSITIVE_INFINITY","assertReadLimit","assertPosition","decrementPosition","getReadCount","incrementPosition","inspectByte","position_","inspectBytes","inspectUint8","inspectUint16","inspectUint24","inspectUint32","pushByte","pushBytes","pushUint8","pushUint16","pushUint24","pushUint32","readByte","_touch","readBytes","readUint24","remaining","setPosition","oldPosition","createCursor","cursor","checksumAddressCache","checksumAddress","address_","chainId","hexAddress","hexToBytes","numberToBytes","boolToBytes","charCodeMap","nine","charCodeToBase16","nibbleLeft","nibbleRight","_Buffer","BASE_MAP","xc","LEADER","FACTOR","iFACTOR","psz","zeroes","b256","carry","it3","it4","vch","pbegin","pend","b58","it1","it2","repeat","prettyPrint","InvalidLegacyVError","InvalidSerializableTransactionError","InvalidSerializedTransactionTypeError","serializedType","InvalidSerializedTransactionError","InvalidStorageKeySizeError","storageKey","getRandomValues","msCrypto","rnds8","fromRlp","fromRlpCursor","readList","parseTransaction","getSerializedTransactionType","transactionArray","toTransactionArray","maxPriorityFeePerGas","maxFeePerGas","gas","accessList","parseAccessList","assertTransaction","parseEIP155Signature","parseTransactionEIP1559","gasPrice","parseTransactionEIP2930","transactionOrWrapperArray","hasNetworkWrapper","wrapperArray","maxFeePerBlobGas","blobVersionedHashes","blobs","commitments","proofs","sidecars","toBlobSidecars","parseTransactionEIP4844","authorizationList","serializedAuthorizationList","yParity","parseAuthorizationList","parseTransactionEIP7702","chainIdOrV_","chainIdOrV","parseTransactionLegacy","accessList_","storageKeys","isAddress","versionedHashVersionKzg","SliceOffsetOutOfBoundsError","SizeExceedsPaddingSizeError","LruMap","firstKey","blobsToCommitments","kzg","blob","blobToKzgCommitment","bytesPerFieldElement","fieldElementsPerBlob","bytesPerBlob","maxBytesPerTransaction","size_","toBlobs","blobsToProofs","proof","assertSize","hexToBigInt","MIN_SAFE_INTEGER","basex","formatUnits","display","negative","_7n","_256n","_0x71n","SHA3_PI","SHA3_ROTL","_SHA3_IOTA","IOTAS","SHA3_IOTA_H","SHA3_IOTA_L","rotlH","rotlL","Keccak","enableXOF","rounds","posOut","state32","keccak","idx1","idx0","B0","B1","Th","Tl","curH","curL","PI","keccakP","take","finish","writeInto","bufferOut","xofInto","xof","keccak_256","yParity_","serializeSignature","concatHex","concatBytes","toRlp","encodable","getEncodable","list","bodyLength","sizeOfBodyLength","getSizeOfLength","getEncodableList","bytesOrHex","sizeOfBytesLength","getEncodableBytes","hashAuthorization","contractAddress","presignMessagePrefix","hashMessage","message_","toPrefixedMessage","commitmentToVersionedHash","versionedHash","serializeAccessList","serializedAccessList","serializeTransaction","getTransactionType","toYParitySignatureArray","serializeTransactionEIP1559","serializeTransactionEIP2930","hashes","commitmentsToVersionedHashes","serializeTransactionEIP4844","authorization","serializeAuthorizationList","serializeTransactionEIP7702","serializeTransactionLegacy","signature_","AbiEncodingArrayLengthMismatchError","givenLength","AbiEncodingBytesSizeMismatchError","expectedSize","AbiEncodingLengthMismatchError","BytesSizeMismatchError","InvalidAbiEncodingTypeError","InvalidArrayError","bytesRegex","integerRegex","encodeAbiParameters","preparedParams","prepareParam","prepareParams","encodeParams","arrayComponents","getArrayComponents","dynamic","dynamicChild","preparedParam","encoded","encodeArray","components","param_","encodeTuple","encodeAddress","encodeBool","encodeNumber","paramSize","bytesSize","encodeBytes","hexValue","partsLength","encodeString","staticSize","staticParams","dynamicParams","dynamicSize","InvalidDomainError","InvalidPrimaryTypeError","primaryType","types","InvalidStructTypeError","getTypesForEIP712Domain","verifyingContract","validateReference","hashTypedData","EIP712Domain","validateData","integerMatch","_type","bytesMatch","validateTypedData","hashStruct","encodedTypes","encodedValues","hashType","encodeField","encodedHashType","unsortedDeps","findTypeDependencies","deps","encodeType","primaryType_","results","parsedType","typeValuePairs","privateKeyToAccount","nonceManager","publicKeyToAddress","signAuthorization","signMessage","signTransaction","signTypedData","toAccount","serializer","signableTransaction","typedData","b64","lens","getLens","validLen","placeHoldersLen","toByteArray","Arr","_byteLength","curByte","revLookup","fromByteArray","extraBytes","maxChunkLength","len2","encodeChunk","tripletToBase64","N","au8","toU8","h2b","isPoint","Gpows","b2n_LE","safe","invert","n2b_32LE","b2h","padh","concatB","arrs","md","pow2","power","RM1","pow_2_252_3","modL_LE","_shaS","sha512s","priv","hash2extK","hashFinish","asynchronous","etc","sha512Async","sha512a","hashable","_sign","cr","messages","sha512Sync","defineProperties","cnd","off1","off2","cnd1","cnd2","_9n","_16n","modulo","assertIsSquare","sqrt3mod4","p1div4","sqrt5mod8","p5div8","n2","nv","tonelliShanks","_Fp","Field","FpLegendre","cc","Q1div2","M","t_tmp","isNegativeLE","FIELD_FIELDS","validateField","FpInvertBatch","nums","passZero","inverted","multipliedAcc","invertedAcc","reduceRight","p1mod2","powered","yes","no","nLength","_nBitLength","bitLenOrOpts","_nbitLength","_sqrt","_opts","sqrtP","lhs","rhs","FpPow","sqrN","addN","subN","mulN","Fp_","tn","c3","c4","tv1","tv2","tv3","tv4","e1","e2","cmov","e3","sqrt9mod16","padded","invertBatch","lst","getFieldBytesLength","fieldOrder","bitLength","getMinHashLength","mapHashToField","fieldLen","minLen","reduced","ROTL","K","SHA256","SHA224","sha224","ieee754","customInspectSymbol","INSPECT_MAX_BYTES","K_MAX_LENGTH","createBuffer","isEncoding","actual","arrayView","isInstance","fromArrayBuffer","fromArrayLike","fromArrayView","SharedArrayBuffer","checked","numberIsNaN","fromObject","toPrimitive","mustMatch","loweredCase","utf8ToBytes","base64ToBytes","slowToString","hexSlice","utf8Slice","asciiSlice","latin1Slice","base64Slice","utf16leSlice","swap","bidirectionalIndexOf","arrayIndexOf","indexSize","arrLength","valLength","readUInt16BE","foundIndex","found","hexWrite","utf8Write","blitBuffer","asciiWrite","asciiToBytes","base64Write","ucs2Write","units","hi","utf16leToBytes","firstByte","codePoint","bytesPerSequence","secondByte","thirdByte","fourthByte","tempCodePoint","codePoints","MAX_ARGUMENTS_LENGTH","decodeCodePointsArray","kMaxLength","TYPED_ARRAY_SUPPORT","foo","typedArraySupport","poolSize","_isBuffer","compare","swap16","swap32","swap64","toLocaleString","inspect","thisStart","thisEnd","thisCopy","targetCopy","isFinite","_arr","hexSliceLookupTable","checkOffset","checkInt","wrtBigUInt64LE","checkIntBI","wrtBigUInt64BE","checkIEEE754","writeFloat","noAssert","writeDouble","newBuf","readUintLE","readUintBE","readUint16LE","readUint16BE","readUint32LE","readUint32BE","readUInt32BE","readBigUInt64LE","defineBigIntMethod","validateNumber","last","boundsError","readBigUInt64BE","readIntLE","readIntBE","readInt8","readInt16LE","readInt16BE","readInt32BE","readBigInt64LE","readBigInt64BE","readFloatLE","readFloatBE","readDoubleLE","readDoubleBE","writeUintLE","writeUintBE","writeUint16LE","writeUint16BE","writeUInt16BE","writeUint32LE","writeUint32BE","writeUInt32BE","writeBigUInt64LE","writeBigUInt64BE","writeIntLE","writeIntBE","writeInt8","writeInt16LE","writeInt16BE","writeInt32BE","writeBigInt64LE","writeBigInt64BE","writeFloatLE","writeFloatBE","writeDoubleLE","writeDoubleBE","targetStart","copyWithin","sym","getMessage","Base","addNumericalSeparator","ERR_OUT_OF_RANGE","checkBounds","ERR_INVALID_ARG_TYPE","ERR_BUFFER_OUT_OF_BOUNDS","received","INVALID_BASE64_RE","leadSurrogate","base64clean","alphabet","table","i16","BufferBigIntNotDefined","Chi","Maj","HashMD","padOffset","process","roundClean","_32n","_u32_max","wh","wl","oview","outLen","SHA256_IV","SHA224_IV","SHA512_IV","SHA256_K","SHA256_W","W15","s0","s1","K512","SHA512_Kh","SHA512_Kl","SHA512_W_H","SHA512_W_L","SHA512","Ah","Al","Bh","Bl","Ch","Cl","Dh","Dl","Eh","El","Fh","Fl","Gh","Gl","Hh","Hl","W15h","W15l","s0h","s0l","W2h","W2l","s1h","s1l","SUMl","SUMh","sigma1h","sigma1l","CHIh","CHIl","T1ll","T1h","T1l","sigma0h","sigma0l","MAJh","MAJl","All","sliceLength","_nodeId","_clockseq","_lastMSecs","_lastNSecs","node","clockseq","seedBytes","msecs","now","nsecs","dt","tl","tmh","functionThis","eval","indirectEvalThis","makeExporter","hasOwn","supportsSymbol","toPrimitiveSymbol","iteratorSymbol","supportsCreate","supportsProto","downLevel","HashMap","MakeDictionary","functionPrototype","_Map","cacheSentinel","arraySentinel","MapIterator","selector","_index","_keys","_values","_selector","throw","_cacheKey","_cacheIndex","_find","SameValueZero","getKey","getEntry","insert","CreateMapPolyfill","_Set","_map","_WeakMap","rootKey","CreateUniqueKey","GetOrCreateWeakMapTable","CreateUUID","FillRandomBytes","GenRandomBytes","CreateWeakMapPolyfill","registrySymbol","for","metadataRegistry","IsUndefined","IsObject","isExtensible","fallback","defineMetadata","reflect","hasOwnMetadata","getOwnMetadataKeys","deleteMetadata","metadataOwner","isProviderFor","O","metadataPropertySet","OrdinaryDefineOwnMetadata","OrdinaryHasOwnMetadata","OrdinaryGetOwnMetadata","OrdinaryOwnMetadataKeys","OrdinaryDeleteMetadata","CreateFallbackProvider","targetProviderMap","registry","registerProvider","getProvider","setProvider","getProviderNoCache","GetIterator","IteratorStep","IteratorValue","IteratorClose","providerMap","hasProvider","existingProvider","CreateMetadataRegistry","GetOrCreateMetadataRegistry","metadataProvider","targetMetadata","MetadataKey","MetadataValue","GetOrCreateMetadataMap","metadataMap","ToBoolean","nextValue","createdTargetMetadata","CreateMetadataProvider","OrdinaryHasMetadata","OrdinaryGetPrototypeOf","IsNull","GetMetadataProvider","OrdinaryGetMetadata","OrdinaryMetadataKeys","parentKeys","ownKeys_1","parentKeys_1","ToPrimitive","PreferredType","hint","exoticToPrim","GetMethod","toString_1","IsCallable","toString_2","OrdinaryToPrimitive","argument","ToPropertyKey","IsArray","IsConstructor","V","func","iterResult","prototypeProto","registeredProvider","decorated","DecorateConstructor","DecorateProperty","IsPropertyKey","maxUint256","InvalidChainIdError","ExecutionRevertedError","FeeCapTooHighError","formatGwei","FeeCapTooLowError","NonceTooHighError","NonceTooLowError","NonceMaxValueError","InsufficientFundsError","IntrinsicGasTooHighError","IntrinsicGasTooLowError","TransactionTypeNotSupportedError","TipAboveFeeCapError","assertTransactionEIP7702","assertTransactionEIP1559","assertTransactionEIP4844","assertTransactionEIP2930","assertTransactionLegacy","U32_MASK64","fromBig","shrSH","_l","shrSL","rotrSH","rotrSL","rotrBH","rotrBL","rotlSH","rotlSL","rotlBH","rotlBL","add3L","add3H","add4L","add4H","add5L","add5H","inherits","superCtor","super_","TempCtor","BN","isBN","red","_init","wordSize","parseHex4Bits","parseHexByte","lowerBound","parseBase","move","cmp","_initNumber","_initArray","_parseHex","_parseBase","_strip","limbLen","limbPow","word","imuln","_iaddn","_move","_expand","_normSign","zeros","groupSizes","groupBases","smallMulTo","ncarry","rword","maxJ","groupSize","groupBase","modrn","idivn","ArrayType","reqLength","_toArrayLikeLE","_toArrayLikeBE","clz32","_countBits","_zeroBits","zeroBits","toTwos","width","inotn","iaddn","fromTwos","testn","notn","ineg","iuor","ior","or","uor","iuand","iand","and","uand","iuxor","ixor","uxor","bytesNeeded","setn","bit","wbit","iadd","isub","comb10MulTo","a0","al0","ah0","al1","ah1","al2","ah2","al3","ah3","al4","ah4","al5","ah5","a6","al6","ah6","a7","al7","ah7","a8","al8","ah8","a9","al9","ah9","b0","bl0","bh0","bl1","bh1","bl2","bh2","bl3","bh3","bl4","bh4","bl5","bh5","bl6","bh6","b7","bl7","bh7","b8","bl8","bh8","bl9","bh9","w0","imul","w1","w2","w3","w4","w5","w6","w7","w8","w9","w10","w11","w12","w13","w14","w15","w16","w17","w18","bigMulTo","hncarry","jumboMulTo","FFTM","mulTo","makeRBT","revBin","rb","permute","rbt","rws","iws","rtws","itws","rtwdf","cos","itwdf","sin","rtwdf_","itwdf_","re","ie","ro","io","rx","guessLen13b","odd","conjugate","normalize13b","ws","convert13b","stub","ph","mulp","rwst","iwst","nrws","nrwst","niwst","rmws","mulf","isNegNum","muln","isqr","toBitArray","iushln","carryMask","newCarry","ishln","iushrn","extended","maskedWords","ishrn","shln","ushln","shrn","ushrn","imaskn","maskn","isubn","addn","subn","iabs","_ishlnsubmul","_wordDiv","bhi","qj","divmod","divn","umod","divRound","dm","r2","andln","modn","egcd","isEven","yp","xp","im","jm","gcd","_invmp","x1","cmpn","invm","bincn","ucmp","gtn","gt","gten","gte","ltn","lt","lten","lte","eqn","Red","toRed","convertTo","_forceRed","fromRed","convertFrom","forceRed","redAdd","redIAdd","redSub","redISub","redShl","shl","redMul","_verify2","redIMul","redSqr","_verify1","redISqr","redSqrt","redInvm","redNeg","redPow","primes","k256","p224","p192","p25519","MPrime","_tmp","K256","P224","P192","P25519","_prime","Mont","imod","rinv","minv","ireduce","rlen","imulK","strip","mod3","nOne","lpow","wnd","currentLen","mont","isBytes","anumber","abytes","ahash","aexists","checkFinished","aoutput","u32","clean","arrays","createView","rotr","byteSwap","swap32IfBE","hasHexBuiltin","asciis","_0","_9","asciiToBase16","ch","hl","al","ai","n1","Hash","createHasher","hashCons","hashC","unit","addressRegex","isAddressCache","cacheKey","computeBlobKzgProof"],"sourceRoot":""} \ No newline at end of file diff --git a/export-and-sign/dist/bundle.66081135e788558705b7.js b/export-and-sign/dist/bundle.66081135e788558705b7.js new file mode 100644 index 00000000..19e54a7d --- /dev/null +++ b/export-and-sign/dist/bundle.66081135e788558705b7.js @@ -0,0 +1,106571 @@ +(self["webpackChunk_turnkey_frames_export_and_sign"] = self["webpackChunk_turnkey_frames_export_and_sign"] || []).push([[96],{ + +/***/ 12: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/base/reporter.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var inherits = __webpack_require__(/*! inherits */ 18628); + +function Reporter(options) { + this._reporterState = { + obj: null, + path: [], + options: options || {}, + errors: [] + }; +} +exports.Reporter = Reporter; + +Reporter.prototype.isError = function isError(obj) { + return obj instanceof ReporterError; +}; + +Reporter.prototype.save = function save() { + var state = this._reporterState; + + return { obj: state.obj, pathLen: state.path.length }; +}; + +Reporter.prototype.restore = function restore(data) { + var state = this._reporterState; + + state.obj = data.obj; + state.path = state.path.slice(0, data.pathLen); +}; + +Reporter.prototype.enterKey = function enterKey(key) { + return this._reporterState.path.push(key); +}; + +Reporter.prototype.exitKey = function exitKey(index) { + var state = this._reporterState; + + state.path = state.path.slice(0, index - 1); +}; + +Reporter.prototype.leaveKey = function leaveKey(index, key, value) { + var state = this._reporterState; + + this.exitKey(index); + if (state.obj !== null) + state.obj[key] = value; +}; + +Reporter.prototype.path = function path() { + return this._reporterState.path.join('/'); +}; + +Reporter.prototype.enterObject = function enterObject() { + var state = this._reporterState; + + var prev = state.obj; + state.obj = {}; + return prev; +}; + +Reporter.prototype.leaveObject = function leaveObject(prev) { + var state = this._reporterState; + + var now = state.obj; + state.obj = prev; + return now; +}; + +Reporter.prototype.error = function error(msg) { + var err; + var state = this._reporterState; + + var inherited = msg instanceof ReporterError; + if (inherited) { + err = msg; + } else { + err = new ReporterError(state.path.map(function(elem) { + return '[' + JSON.stringify(elem) + ']'; + }).join(''), msg.message || msg, msg.stack); + } + + if (!state.options.partial) + throw err; + + if (!inherited) + state.errors.push(err); + + return err; +}; + +Reporter.prototype.wrapResult = function wrapResult(result) { + var state = this._reporterState; + if (!state.options.partial) + return result; + + return { + result: this.isError(result) ? null : result, + errors: state.errors + }; +}; + +function ReporterError(path, msg) { + this.path = path; + this.rethrow(msg); +}; +inherits(ReporterError, Error); + +ReporterError.prototype.rethrow = function rethrow(msg) { + this.message = msg + ' at: ' + (this.path || '(shallow)'); + if (Error.captureStackTrace) + Error.captureStackTrace(this, ReporterError); + + if (!this.stack) { + try { + // IE only adds stack when thrown + throw new Error(this.message); + } catch (e) { + this.stack = e.stack; + } + } + return this; +}; + + +/***/ }), + +/***/ 127: +/*!*************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/applyBind.js ***! + \*************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var bind = __webpack_require__(/*! function-bind */ 94867); +var $apply = __webpack_require__(/*! ./functionApply */ 43920); +var actualApply = __webpack_require__(/*! ./actualApply */ 57846); + +/** @type {import('./applyBind')} */ +module.exports = function applyBind() { + return actualApply(bind, $apply, arguments); +}; + + +/***/ }), + +/***/ 405: +/*!**************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/transaction/assertTransaction.js ***! + \**************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ assertTransactionEIP1559: () => (/* binding */ assertTransactionEIP1559), +/* harmony export */ assertTransactionEIP2930: () => (/* binding */ assertTransactionEIP2930), +/* harmony export */ assertTransactionEIP4844: () => (/* binding */ assertTransactionEIP4844), +/* harmony export */ assertTransactionEIP7702: () => (/* binding */ assertTransactionEIP7702), +/* harmony export */ assertTransactionLegacy: () => (/* binding */ assertTransactionLegacy) +/* harmony export */ }); +/* harmony import */ var _constants_kzg_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../constants/kzg.js */ 63926); +/* harmony import */ var _constants_number_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../constants/number.js */ 71359); +/* harmony import */ var _errors_address_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../errors/address.js */ 44876); +/* harmony import */ var _errors_base_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../errors/base.js */ 87035); +/* harmony import */ var _errors_blob_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../errors/blob.js */ 43201); +/* harmony import */ var _errors_chain_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../errors/chain.js */ 72565); +/* harmony import */ var _errors_node_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../errors/node.js */ 27458); +/* harmony import */ var _address_isAddress_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../address/isAddress.js */ 90355); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../data/size.js */ 58036); +/* harmony import */ var _data_slice_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../data/slice.js */ 49451); +/* harmony import */ var _encoding_fromHex_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../encoding/fromHex.js */ 58269); + + + + + + + + + + + +function assertTransactionEIP7702(transaction) { + const { authorizationList } = transaction; + if (authorizationList) { + for (const authorization of authorizationList) { + const { chainId } = authorization; + const address = authorization.address; + if (!(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_7__.isAddress)(address)) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddressError({ address }); + if (chainId < 0) + throw new _errors_chain_js__WEBPACK_IMPORTED_MODULE_5__.InvalidChainIdError({ chainId }); + } + } + assertTransactionEIP1559(transaction); +} +function assertTransactionEIP4844(transaction) { + const { blobVersionedHashes } = transaction; + if (blobVersionedHashes) { + if (blobVersionedHashes.length === 0) + throw new _errors_blob_js__WEBPACK_IMPORTED_MODULE_4__.EmptyBlobError(); + for (const hash of blobVersionedHashes) { + const size_ = (0,_data_size_js__WEBPACK_IMPORTED_MODULE_8__.size)(hash); + const version = (0,_encoding_fromHex_js__WEBPACK_IMPORTED_MODULE_10__.hexToNumber)((0,_data_slice_js__WEBPACK_IMPORTED_MODULE_9__.slice)(hash, 0, 1)); + if (size_ !== 32) + throw new _errors_blob_js__WEBPACK_IMPORTED_MODULE_4__.InvalidVersionedHashSizeError({ hash, size: size_ }); + if (version !== _constants_kzg_js__WEBPACK_IMPORTED_MODULE_0__.versionedHashVersionKzg) + throw new _errors_blob_js__WEBPACK_IMPORTED_MODULE_4__.InvalidVersionedHashVersionError({ + hash, + version, + }); + } + } + assertTransactionEIP1559(transaction); +} +function assertTransactionEIP1559(transaction) { + const { chainId, maxPriorityFeePerGas, maxFeePerGas, to } = transaction; + if (chainId <= 0) + throw new _errors_chain_js__WEBPACK_IMPORTED_MODULE_5__.InvalidChainIdError({ chainId }); + if (to && !(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_7__.isAddress)(to)) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddressError({ address: to }); + if (maxFeePerGas && maxFeePerGas > _constants_number_js__WEBPACK_IMPORTED_MODULE_1__.maxUint256) + throw new _errors_node_js__WEBPACK_IMPORTED_MODULE_6__.FeeCapTooHighError({ maxFeePerGas }); + if (maxPriorityFeePerGas && + maxFeePerGas && + maxPriorityFeePerGas > maxFeePerGas) + throw new _errors_node_js__WEBPACK_IMPORTED_MODULE_6__.TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas }); +} +function assertTransactionEIP2930(transaction) { + const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction; + if (chainId <= 0) + throw new _errors_chain_js__WEBPACK_IMPORTED_MODULE_5__.InvalidChainIdError({ chainId }); + if (to && !(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_7__.isAddress)(to)) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddressError({ address: to }); + if (maxPriorityFeePerGas || maxFeePerGas) + throw new _errors_base_js__WEBPACK_IMPORTED_MODULE_3__.BaseError('`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.'); + if (gasPrice && gasPrice > _constants_number_js__WEBPACK_IMPORTED_MODULE_1__.maxUint256) + throw new _errors_node_js__WEBPACK_IMPORTED_MODULE_6__.FeeCapTooHighError({ maxFeePerGas: gasPrice }); +} +function assertTransactionLegacy(transaction) { + const { chainId, maxPriorityFeePerGas, gasPrice, maxFeePerGas, to } = transaction; + if (to && !(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_7__.isAddress)(to)) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_2__.InvalidAddressError({ address: to }); + if (typeof chainId !== 'undefined' && chainId <= 0) + throw new _errors_chain_js__WEBPACK_IMPORTED_MODULE_5__.InvalidChainIdError({ chainId }); + if (maxPriorityFeePerGas || maxFeePerGas) + throw new _errors_base_js__WEBPACK_IMPORTED_MODULE_3__.BaseError('`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.'); + if (gasPrice && gasPrice > _constants_number_js__WEBPACK_IMPORTED_MODULE_1__.maxUint256) + throw new _errors_node_js__WEBPACK_IMPORTED_MODULE_6__.FeeCapTooHighError({ maxFeePerGas: gasPrice }); +} +//# sourceMappingURL=assertTransaction.js.map + +/***/ }), + +/***/ 414: +/*!******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_number.js ***! + \******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CRLNumber: () => (/* binding */ CRLNumber), +/* harmony export */ id_ce_cRLNumber: () => (/* binding */ id_ce_cRLNumber) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + +const id_ce_cRLNumber = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.20`; +let CRLNumber = class CRLNumber { + value; + constructor(value = 0) { + this.value = value; + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], CRLNumber.prototype, "value", void 0); +CRLNumber = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], CRLNumber); + + + +/***/ }), + +/***/ 428: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/bytes/concat.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ concat: () => (/* binding */ concat), +/* harmony export */ concatToUint8Array: () => (/* binding */ concatToUint8Array) +/* harmony export */ }); +/* harmony import */ var _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./buffer-source.js */ 93342); + +function concatToUint8Array(buffers) { + const views = []; + let length = 0; + for (const buffer of buffers) { + const view = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(buffer); + views.push(view); + length += view.byteLength; + } + const result = new Uint8Array(length); + let offset = 0; + for (const view of views) { + result.set(view, offset); + offset += view.byteLength; + } + return result; +} +function concat(first, second, ...rest) { + let buffers; + let type; + if (typeof second === "function") { + buffers = Array.from(first); + type = second; + } + else if ((0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isBufferSource)(first)) { + buffers = [first, second, ...rest].filter(_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isBufferSource); + } + else { + buffers = Array.from(first); + if (second) { + buffers.push(second); + } + buffers.push(...rest); + } + const bytes = concatToUint8Array(buffers); + return type ? (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toView)(bytes, type) : bytes.buffer; +} + + +/***/ }), + +/***/ 820: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/attribute.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Attribute: () => (/* binding */ Attribute) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +class Attribute { + type = ""; + values = []; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], Attribute.prototype, "type", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, repeated: "set", + }) +], Attribute.prototype, "values", void 0); + + +/***/ }), + +/***/ 824: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/inject-all-with-transform.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _reflection_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reflection-helpers */ 90635); + +function injectAllWithTransform(token, transformer) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + var data = { + token: token, + multiple: true, + transform: transformer, + transformArgs: args + }; + return (0,_reflection_helpers__WEBPACK_IMPORTED_MODULE_0__.defineInjectionTokenMetadata)(data); +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (injectAllWithTransform); + + +/***/ }), + +/***/ 1689: +/*!********************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/abi/encodeAbiParameters.js ***! + \********************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ encodeAbiParameters: () => (/* binding */ encodeAbiParameters), +/* harmony export */ getArrayComponents: () => (/* binding */ getArrayComponents) +/* harmony export */ }); +/* harmony import */ var _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/abi.js */ 43750); +/* harmony import */ var _errors_address_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../errors/address.js */ 44876); +/* harmony import */ var _errors_base_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../errors/base.js */ 87035); +/* harmony import */ var _errors_encoding_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../errors/encoding.js */ 15923); +/* harmony import */ var _address_isAddress_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../address/isAddress.js */ 90355); +/* harmony import */ var _data_concat_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../data/concat.js */ 22745); +/* harmony import */ var _data_pad_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../data/pad.js */ 89244); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../data/size.js */ 58036); +/* harmony import */ var _data_slice_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../data/slice.js */ 49451); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); +/* harmony import */ var _regex_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../regex.js */ 94631); + + + + + + + + + + + +/** + * @description Encodes a list of primitive values into an ABI-encoded hex value. + * + * - Docs: https://viem.sh/docs/abi/encodeAbiParameters#encodeabiparameters + * + * Generates ABI encoded data using the [ABI specification](https://docs.soliditylang.org/en/latest/abi-spec), given a set of ABI parameters (inputs/outputs) and their corresponding values. + * + * @param params - a set of ABI Parameters (params), that can be in the shape of the inputs or outputs attribute of an ABI Item. + * @param values - a set of values (values) that correspond to the given params. + * @example + * ```typescript + * import { encodeAbiParameters } from 'viem' + * + * const encodedData = encodeAbiParameters( + * [ + * { name: 'x', type: 'string' }, + * { name: 'y', type: 'uint' }, + * { name: 'z', type: 'bool' } + * ], + * ['wagmi', 420n, true] + * ) + * ``` + * + * You can also pass in Human Readable parameters with the parseAbiParameters utility. + * + * @example + * ```typescript + * import { encodeAbiParameters, parseAbiParameters } from 'viem' + * + * const encodedData = encodeAbiParameters( + * parseAbiParameters('string x, uint y, bool z'), + * ['wagmi', 420n, true] + * ) + * ``` + */ +function encodeAbiParameters(params, values) { + if (params.length !== values.length) + throw new _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__.AbiEncodingLengthMismatchError({ + expectedLength: params.length, + givenLength: values.length, + }); + // Prepare the parameters to determine dynamic types to encode. + const preparedParams = prepareParams({ + params: params, + values: values, + }); + const data = encodeParams(preparedParams); + if (data.length === 0) + return '0x'; + return data; +} +function prepareParams({ params, values, }) { + const preparedParams = []; + for (let i = 0; i < params.length; i++) { + preparedParams.push(prepareParam({ param: params[i], value: values[i] })); + } + return preparedParams; +} +function prepareParam({ param, value, }) { + const arrayComponents = getArrayComponents(param.type); + if (arrayComponents) { + const [length, type] = arrayComponents; + return encodeArray(value, { length, param: { ...param, type } }); + } + if (param.type === 'tuple') { + return encodeTuple(value, { + param: param, + }); + } + if (param.type === 'address') { + return encodeAddress(value); + } + if (param.type === 'bool') { + return encodeBool(value); + } + if (param.type.startsWith('uint') || param.type.startsWith('int')) { + const signed = param.type.startsWith('int'); + const [, , size = '256'] = _regex_js__WEBPACK_IMPORTED_MODULE_10__.integerRegex.exec(param.type) ?? []; + return encodeNumber(value, { + signed, + size: Number(size), + }); + } + if (param.type.startsWith('bytes')) { + return encodeBytes(value, { param }); + } + if (param.type === 'string') { + return encodeString(value); + } + throw new _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__.InvalidAbiEncodingTypeError(param.type, { + docsPath: '/docs/contract/encodeAbiParameters', + }); +} +function encodeParams(preparedParams) { + // 1. Compute the size of the static part of the parameters. + let staticSize = 0; + for (let i = 0; i < preparedParams.length; i++) { + const { dynamic, encoded } = preparedParams[i]; + if (dynamic) + staticSize += 32; + else + staticSize += (0,_data_size_js__WEBPACK_IMPORTED_MODULE_7__.size)(encoded); + } + // 2. Split the parameters into static and dynamic parts. + const staticParams = []; + const dynamicParams = []; + let dynamicSize = 0; + for (let i = 0; i < preparedParams.length; i++) { + const { dynamic, encoded } = preparedParams[i]; + if (dynamic) { + staticParams.push((0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.numberToHex)(staticSize + dynamicSize, { size: 32 })); + dynamicParams.push(encoded); + dynamicSize += (0,_data_size_js__WEBPACK_IMPORTED_MODULE_7__.size)(encoded); + } + else { + staticParams.push(encoded); + } + } + // 3. Concatenate static and dynamic parts. + return (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)([...staticParams, ...dynamicParams]); +} +function encodeAddress(value) { + if (!(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_4__.isAddress)(value)) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_1__.InvalidAddressError({ address: value }); + return { dynamic: false, encoded: (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)(value.toLowerCase()) }; +} +function encodeArray(value, { length, param, }) { + const dynamic = length === null; + if (!Array.isArray(value)) + throw new _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__.InvalidArrayError(value); + if (!dynamic && value.length !== length) + throw new _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__.AbiEncodingArrayLengthMismatchError({ + expectedLength: length, + givenLength: value.length, + type: `${param.type}[${length}]`, + }); + let dynamicChild = false; + const preparedParams = []; + for (let i = 0; i < value.length; i++) { + const preparedParam = prepareParam({ param, value: value[i] }); + if (preparedParam.dynamic) + dynamicChild = true; + preparedParams.push(preparedParam); + } + if (dynamic || dynamicChild) { + const data = encodeParams(preparedParams); + if (dynamic) { + const length = (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.numberToHex)(preparedParams.length, { size: 32 }); + return { + dynamic: true, + encoded: preparedParams.length > 0 ? (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)([length, data]) : length, + }; + } + if (dynamicChild) + return { dynamic: true, encoded: data }; + } + return { + dynamic: false, + encoded: (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)(preparedParams.map(({ encoded }) => encoded)), + }; +} +function encodeBytes(value, { param }) { + const [, paramSize] = param.type.split('bytes'); + const bytesSize = (0,_data_size_js__WEBPACK_IMPORTED_MODULE_7__.size)(value); + if (!paramSize) { + let value_ = value; + // If the size is not divisible by 32 bytes, pad the end + // with empty bytes to the ceiling 32 bytes. + if (bytesSize % 32 !== 0) + value_ = (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)(value_, { + dir: 'right', + size: Math.ceil((value.length - 2) / 2 / 32) * 32, + }); + return { + dynamic: true, + encoded: (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)([(0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)((0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.numberToHex)(bytesSize, { size: 32 })), value_]), + }; + } + if (bytesSize !== Number.parseInt(paramSize, 10)) + throw new _errors_abi_js__WEBPACK_IMPORTED_MODULE_0__.AbiEncodingBytesSizeMismatchError({ + expectedSize: Number.parseInt(paramSize, 10), + value, + }); + return { dynamic: false, encoded: (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)(value, { dir: 'right' }) }; +} +function encodeBool(value) { + if (typeof value !== 'boolean') + throw new _errors_base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError(`Invalid boolean value: "${value}" (type: ${typeof value}). Expected: \`true\` or \`false\`.`); + return { dynamic: false, encoded: (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)((0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.boolToHex)(value)) }; +} +function encodeNumber(value, { signed, size = 256 }) { + if (typeof size === 'number') { + const max = 2n ** (BigInt(size) - (signed ? 1n : 0n)) - 1n; + const min = signed ? -max - 1n : 0n; + if (value > max || value < min) + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_3__.IntegerOutOfRangeError({ + max: max.toString(), + min: min.toString(), + signed, + size: size / 8, + value: value.toString(), + }); + } + return { + dynamic: false, + encoded: (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.numberToHex)(value, { + size: 32, + signed, + }), + }; +} +function encodeString(value) { + const hexValue = (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.stringToHex)(value); + const partsLength = Math.ceil((0,_data_size_js__WEBPACK_IMPORTED_MODULE_7__.size)(hexValue) / 32); + const parts = []; + for (let i = 0; i < partsLength; i++) { + parts.push((0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)((0,_data_slice_js__WEBPACK_IMPORTED_MODULE_8__.slice)(hexValue, i * 32, (i + 1) * 32), { + dir: 'right', + })); + } + return { + dynamic: true, + encoded: (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)([ + (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_6__.padHex)((0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_9__.numberToHex)((0,_data_size_js__WEBPACK_IMPORTED_MODULE_7__.size)(hexValue), { size: 32 })), + ...parts, + ]), + }; +} +function encodeTuple(value, { param }) { + let dynamic = false; + const preparedParams = []; + for (let i = 0; i < param.components.length; i++) { + const param_ = param.components[i]; + const index = Array.isArray(value) ? i : param_.name; + const preparedParam = prepareParam({ + param: param_, + value: value[index], + }); + preparedParams.push(preparedParam); + if (preparedParam.dynamic) + dynamic = true; + } + return { + dynamic, + encoded: dynamic + ? encodeParams(preparedParams) + : (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_5__.concat)(preparedParams.map(({ encoded }) => encoded)), + }; +} +function getArrayComponents(type) { + const matches = type.match(/^(.*)\[(\d+)?\]$/); + return matches + ? // Return `null` if the array is dynamic. + [matches[2] ? Number(matches[2]) : null, matches[1]] + : undefined; +} +//# sourceMappingURL=encodeAbiParameters.js.map + +/***/ }), + +/***/ 1781: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/brorand@1.1.0/node_modules/brorand/index.js ***! + \*************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var r; + +module.exports = function rand(len) { + if (!r) + r = new Rand(null); + + return r.generate(len); +}; + +function Rand(rand) { + this.rand = rand; +} +module.exports.Rand = Rand; + +Rand.prototype.generate = function generate(len) { + return this._rand(len); +}; + +// Emulate crypto API using randy +Rand.prototype._rand = function _rand(n) { + if (this.rand.getBytes) + return this.rand.getBytes(n); + + var res = new Uint8Array(n); + for (var i = 0; i < res.length; i++) + res[i] = this.rand.getByte(); + return res; +}; + +if (typeof self === 'object') { + if (self.crypto && self.crypto.getRandomValues) { + // Modern browsers + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.crypto.getRandomValues(arr); + return arr; + }; + } else if (self.msCrypto && self.msCrypto.getRandomValues) { + // IE + Rand.prototype._rand = function _rand(n) { + var arr = new Uint8Array(n); + self.msCrypto.getRandomValues(arr); + return arr; + }; + + // Safari's WebWorkers do not have `crypto` + } else if (typeof window === 'object') { + // Old junk + Rand.prototype._rand = function() { + throw new Error('Not implemented yet'); + }; + } +} else { + // Node.js or Web worker with no crypto support + try { + var crypto = __webpack_require__(/*! crypto */ 80896); + if (typeof crypto.randomBytes !== 'function') + throw new Error('Not supported'); + + Rand.prototype._rand = function _rand(n) { + return crypto.randomBytes(n); + }; + } catch (e) { + } +} + + +/***/ }), + +/***/ 1985: +/*!****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_policies.js ***! + \****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CertificatePolicies: () => (/* binding */ CertificatePolicies), +/* harmony export */ DisplayText: () => (/* binding */ DisplayText), +/* harmony export */ NoticeReference: () => (/* binding */ NoticeReference), +/* harmony export */ PolicyInformation: () => (/* binding */ PolicyInformation), +/* harmony export */ PolicyQualifierInfo: () => (/* binding */ PolicyQualifierInfo), +/* harmony export */ Qualifier: () => (/* binding */ Qualifier), +/* harmony export */ UserNotice: () => (/* binding */ UserNotice), +/* harmony export */ id_ce_certificatePolicies: () => (/* binding */ id_ce_certificatePolicies), +/* harmony export */ id_ce_certificatePolicies_anyPolicy: () => (/* binding */ id_ce_certificatePolicies_anyPolicy) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var CertificatePolicies_1; + + + +const id_ce_certificatePolicies = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.32`; +const id_ce_certificatePolicies_anyPolicy = `${id_ce_certificatePolicies}.0`; +let DisplayText = class DisplayText { + ia5String; + visibleString; + bmpString; + utf8String; + constructor(params = {}) { + Object.assign(this, params); + } + toString() { + return this.ia5String || this.visibleString || this.bmpString || this.utf8String || ""; + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String }) +], DisplayText.prototype, "ia5String", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.VisibleString }) +], DisplayText.prototype, "visibleString", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BmpString }) +], DisplayText.prototype, "bmpString", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Utf8String }) +], DisplayText.prototype, "utf8String", void 0); +DisplayText = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], DisplayText); + +class NoticeReference { + organization = new DisplayText(); + noticeNumbers = []; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: DisplayText }) +], NoticeReference.prototype, "organization", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, repeated: "sequence", + }) +], NoticeReference.prototype, "noticeNumbers", void 0); +class UserNotice { + noticeRef; + explicitText; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: NoticeReference, optional: true, + }) +], UserNotice.prototype, "noticeRef", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: DisplayText, optional: true, + }) +], UserNotice.prototype, "explicitText", void 0); +let Qualifier = class Qualifier { + cPSuri; + userNotice; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String }) +], Qualifier.prototype, "cPSuri", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: UserNotice }) +], Qualifier.prototype, "userNotice", void 0); +Qualifier = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], Qualifier); + +class PolicyQualifierInfo { + policyQualifierId = ""; + qualifier = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], PolicyQualifierInfo.prototype, "policyQualifierId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], PolicyQualifierInfo.prototype, "qualifier", void 0); +class PolicyInformation { + policyIdentifier = ""; + policyQualifiers; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], PolicyInformation.prototype, "policyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: PolicyQualifierInfo, repeated: "sequence", optional: true, + }) +], PolicyInformation.prototype, "policyQualifiers", void 0); +let CertificatePolicies = CertificatePolicies_1 = class CertificatePolicies extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, CertificatePolicies_1.prototype); + } +}; +CertificatePolicies = CertificatePolicies_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: PolicyInformation, + }) +], CertificatePolicies); + + + +/***/ }), + +/***/ 2025: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/base/node.js ***! + \***************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var Reporter = (__webpack_require__(/*! ../base */ 57409).Reporter); +var EncoderBuffer = (__webpack_require__(/*! ../base */ 57409).EncoderBuffer); +var DecoderBuffer = (__webpack_require__(/*! ../base */ 57409).DecoderBuffer); +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); + +// Supported tags +var tags = [ + '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' +]; + +// Public methods list +var methods = [ + 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice', + 'any', 'contains' +].concat(tags); + +// Overrided methods list +var overrided = [ + '_peekTag', '_decodeTag', '_use', + '_decodeStr', '_decodeObjid', '_decodeTime', + '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList', + + '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime', + '_encodeNull', '_encodeInt', '_encodeBool' +]; + +function Node(enc, parent) { + var state = {}; + this._baseState = state; + + state.enc = enc; + + state.parent = parent || null; + state.children = null; + + // State + state.tag = null; + state.args = null; + state.reverseArgs = null; + state.choice = null; + state.optional = false; + state.any = false; + state.obj = false; + state.use = null; + state.useDecoder = null; + state.key = null; + state['default'] = null; + state.explicit = null; + state.implicit = null; + state.contains = null; + + // Should create new instance on each method + if (!state.parent) { + state.children = []; + this._wrap(); + } +} +module.exports = Node; + +var stateProps = [ + 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice', + 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit', + 'implicit', 'contains' +]; + +Node.prototype.clone = function clone() { + var state = this._baseState; + var cstate = {}; + stateProps.forEach(function(prop) { + cstate[prop] = state[prop]; + }); + var res = new this.constructor(cstate.parent); + res._baseState = cstate; + return res; +}; + +Node.prototype._wrap = function wrap() { + var state = this._baseState; + methods.forEach(function(method) { + this[method] = function _wrappedMethod() { + var clone = new this.constructor(this); + state.children.push(clone); + return clone[method].apply(clone, arguments); + }; + }, this); +}; + +Node.prototype._init = function init(body) { + var state = this._baseState; + + assert(state.parent === null); + body.call(this); + + // Filter children + state.children = state.children.filter(function(child) { + return child._baseState.parent === this; + }, this); + assert.equal(state.children.length, 1, 'Root node can have only one child'); +}; + +Node.prototype._useArgs = function useArgs(args) { + var state = this._baseState; + + // Filter children and args + var children = args.filter(function(arg) { + return arg instanceof this.constructor; + }, this); + args = args.filter(function(arg) { + return !(arg instanceof this.constructor); + }, this); + + if (children.length !== 0) { + assert(state.children === null); + state.children = children; + + // Replace parent to maintain backward link + children.forEach(function(child) { + child._baseState.parent = this; + }, this); + } + if (args.length !== 0) { + assert(state.args === null); + state.args = args; + state.reverseArgs = args.map(function(arg) { + if (typeof arg !== 'object' || arg.constructor !== Object) + return arg; + + var res = {}; + Object.keys(arg).forEach(function(key) { + if (key == (key | 0)) + key |= 0; + var value = arg[key]; + res[value] = key; + }); + return res; + }); + } +}; + +// +// Overrided methods +// + +overrided.forEach(function(method) { + Node.prototype[method] = function _overrided() { + var state = this._baseState; + throw new Error(method + ' not implemented for encoding: ' + state.enc); + }; +}); + +// +// Public methods +// + +tags.forEach(function(tag) { + Node.prototype[tag] = function _tagMethod() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + assert(state.tag === null); + state.tag = tag; + + this._useArgs(args); + + return this; + }; +}); + +Node.prototype.use = function use(item) { + assert(item); + var state = this._baseState; + + assert(state.use === null); + state.use = item; + + return this; +}; + +Node.prototype.optional = function optional() { + var state = this._baseState; + + state.optional = true; + + return this; +}; + +Node.prototype.def = function def(val) { + var state = this._baseState; + + assert(state['default'] === null); + state['default'] = val; + state.optional = true; + + return this; +}; + +Node.prototype.explicit = function explicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.explicit = num; + + return this; +}; + +Node.prototype.implicit = function implicit(num) { + var state = this._baseState; + + assert(state.explicit === null && state.implicit === null); + state.implicit = num; + + return this; +}; + +Node.prototype.obj = function obj() { + var state = this._baseState; + var args = Array.prototype.slice.call(arguments); + + state.obj = true; + + if (args.length !== 0) + this._useArgs(args); + + return this; +}; + +Node.prototype.key = function key(newKey) { + var state = this._baseState; + + assert(state.key === null); + state.key = newKey; + + return this; +}; + +Node.prototype.any = function any() { + var state = this._baseState; + + state.any = true; + + return this; +}; + +Node.prototype.choice = function choice(obj) { + var state = this._baseState; + + assert(state.choice === null); + state.choice = obj; + this._useArgs(Object.keys(obj).map(function(key) { + return obj[key]; + })); + + return this; +}; + +Node.prototype.contains = function contains(item) { + var state = this._baseState; + + assert(state.use === null); + state.contains = item; + + return this; +}; + +// +// Decoding +// + +Node.prototype._decode = function decode(input, options) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return input.wrapResult(state.children[0]._decode(input, options)); + + var result = state['default']; + var present = true; + + var prevKey = null; + if (state.key !== null) + prevKey = input.enterKey(state.key); + + // Check if tag is there + if (state.optional) { + var tag = null; + if (state.explicit !== null) + tag = state.explicit; + else if (state.implicit !== null) + tag = state.implicit; + else if (state.tag !== null) + tag = state.tag; + + if (tag === null && !state.any) { + // Trial and Error + var save = input.save(); + try { + if (state.choice === null) + this._decodeGeneric(state.tag, input, options); + else + this._decodeChoice(input, options); + present = true; + } catch (e) { + present = false; + } + input.restore(save); + } else { + present = this._peekTag(input, tag, state.any); + + if (input.isError(present)) + return present; + } + } + + // Push object on stack + var prevObj; + if (state.obj && present) + prevObj = input.enterObject(); + + if (present) { + // Unwrap explicit values + if (state.explicit !== null) { + var explicit = this._decodeTag(input, state.explicit); + if (input.isError(explicit)) + return explicit; + input = explicit; + } + + var start = input.offset; + + // Unwrap implicit and normal values + if (state.use === null && state.choice === null) { + if (state.any) + var save = input.save(); + var body = this._decodeTag( + input, + state.implicit !== null ? state.implicit : state.tag, + state.any + ); + if (input.isError(body)) + return body; + + if (state.any) + result = input.raw(save); + else + input = body; + } + + if (options && options.track && state.tag !== null) + options.track(input.path(), start, input.length, 'tagged'); + + if (options && options.track && state.tag !== null) + options.track(input.path(), input.offset, input.length, 'content'); + + // Select proper method for tag + if (state.any) + result = result; + else if (state.choice === null) + result = this._decodeGeneric(state.tag, input, options); + else + result = this._decodeChoice(input, options); + + if (input.isError(result)) + return result; + + // Decode children + if (!state.any && state.choice === null && state.children !== null) { + state.children.forEach(function decodeChildren(child) { + // NOTE: We are ignoring errors here, to let parser continue with other + // parts of encoded data + child._decode(input, options); + }); + } + + // Decode contained/encoded by schema, only in bit or octet strings + if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) { + var data = new DecoderBuffer(result); + result = this._getUse(state.contains, input._reporterState.obj) + ._decode(data, options); + } + } + + // Pop object + if (state.obj && present) + result = input.leaveObject(prevObj); + + // Set key + if (state.key !== null && (result !== null || present === true)) + input.leaveKey(prevKey, state.key, result); + else if (prevKey !== null) + input.exitKey(prevKey); + + return result; +}; + +Node.prototype._decodeGeneric = function decodeGeneric(tag, input, options) { + var state = this._baseState; + + if (tag === 'seq' || tag === 'set') + return null; + if (tag === 'seqof' || tag === 'setof') + return this._decodeList(input, tag, state.args[0], options); + else if (/str$/.test(tag)) + return this._decodeStr(input, tag, options); + else if (tag === 'objid' && state.args) + return this._decodeObjid(input, state.args[0], state.args[1], options); + else if (tag === 'objid') + return this._decodeObjid(input, null, null, options); + else if (tag === 'gentime' || tag === 'utctime') + return this._decodeTime(input, tag, options); + else if (tag === 'null_') + return this._decodeNull(input, options); + else if (tag === 'bool') + return this._decodeBool(input, options); + else if (tag === 'objDesc') + return this._decodeStr(input, tag, options); + else if (tag === 'int' || tag === 'enum') + return this._decodeInt(input, state.args && state.args[0], options); + + if (state.use !== null) { + return this._getUse(state.use, input._reporterState.obj) + ._decode(input, options); + } else { + return input.error('unknown tag: ' + tag); + } +}; + +Node.prototype._getUse = function _getUse(entity, obj) { + + var state = this._baseState; + // Create altered use decoder if implicit is set + state.useDecoder = this._use(entity, obj); + assert(state.useDecoder._baseState.parent === null); + state.useDecoder = state.useDecoder._baseState.children[0]; + if (state.implicit !== state.useDecoder._baseState.implicit) { + state.useDecoder = state.useDecoder.clone(); + state.useDecoder._baseState.implicit = state.implicit; + } + return state.useDecoder; +}; + +Node.prototype._decodeChoice = function decodeChoice(input, options) { + var state = this._baseState; + var result = null; + var match = false; + + Object.keys(state.choice).some(function(key) { + var save = input.save(); + var node = state.choice[key]; + try { + var value = node._decode(input, options); + if (input.isError(value)) + return false; + + result = { type: key, value: value }; + match = true; + } catch (e) { + input.restore(save); + return false; + } + return true; + }, this); + + if (!match) + return input.error('Choice not matched'); + + return result; +}; + +// +// Encoding +// + +Node.prototype._createEncoderBuffer = function createEncoderBuffer(data) { + return new EncoderBuffer(data, this.reporter); +}; + +Node.prototype._encode = function encode(data, reporter, parent) { + var state = this._baseState; + if (state['default'] !== null && state['default'] === data) + return; + + var result = this._encodeValue(data, reporter, parent); + if (result === undefined) + return; + + if (this._skipDefault(result, reporter, parent)) + return; + + return result; +}; + +Node.prototype._encodeValue = function encode(data, reporter, parent) { + var state = this._baseState; + + // Decode root node + if (state.parent === null) + return state.children[0]._encode(data, reporter || new Reporter()); + + var result = null; + + // Set reporter to share it with a child class + this.reporter = reporter; + + // Check if data is there + if (state.optional && data === undefined) { + if (state['default'] !== null) + data = state['default'] + else + return; + } + + // Encode children first + var content = null; + var primitive = false; + if (state.any) { + // Anything that was given is translated to buffer + result = this._createEncoderBuffer(data); + } else if (state.choice) { + result = this._encodeChoice(data, reporter); + } else if (state.contains) { + content = this._getUse(state.contains, parent)._encode(data, reporter); + primitive = true; + } else if (state.children) { + content = state.children.map(function(child) { + if (child._baseState.tag === 'null_') + return child._encode(null, reporter, data); + + if (child._baseState.key === null) + return reporter.error('Child should have a key'); + var prevKey = reporter.enterKey(child._baseState.key); + + if (typeof data !== 'object') + return reporter.error('Child expected, but input is not object'); + + var res = child._encode(data[child._baseState.key], reporter, data); + reporter.leaveKey(prevKey); + + return res; + }, this).filter(function(child) { + return child; + }); + content = this._createEncoderBuffer(content); + } else { + if (state.tag === 'seqof' || state.tag === 'setof') { + // TODO(indutny): this should be thrown on DSL level + if (!(state.args && state.args.length === 1)) + return reporter.error('Too many args for : ' + state.tag); + + if (!Array.isArray(data)) + return reporter.error('seqof/setof, but data is not Array'); + + var child = this.clone(); + child._baseState.implicit = null; + content = this._createEncoderBuffer(data.map(function(item) { + var state = this._baseState; + + return this._getUse(state.args[0], data)._encode(item, reporter); + }, child)); + } else if (state.use !== null) { + result = this._getUse(state.use, parent)._encode(data, reporter); + } else { + content = this._encodePrimitive(state.tag, data); + primitive = true; + } + } + + // Encode data itself + var result; + if (!state.any && state.choice === null) { + var tag = state.implicit !== null ? state.implicit : state.tag; + var cls = state.implicit === null ? 'universal' : 'context'; + + if (tag === null) { + if (state.use === null) + reporter.error('Tag could be omitted only for .use()'); + } else { + if (state.use === null) + result = this._encodeComposite(tag, primitive, cls, content); + } + } + + // Wrap in explicit + if (state.explicit !== null) + result = this._encodeComposite(state.explicit, false, 'context', result); + + return result; +}; + +Node.prototype._encodeChoice = function encodeChoice(data, reporter) { + var state = this._baseState; + + var node = state.choice[data.type]; + if (!node) { + assert( + false, + data.type + ' not found in ' + + JSON.stringify(Object.keys(state.choice))); + } + return node._encode(data.value, reporter); +}; + +Node.prototype._encodePrimitive = function encodePrimitive(tag, data) { + var state = this._baseState; + + if (/str$/.test(tag)) + return this._encodeStr(data, tag); + else if (tag === 'objid' && state.args) + return this._encodeObjid(data, state.reverseArgs[0], state.args[1]); + else if (tag === 'objid') + return this._encodeObjid(data, null, null); + else if (tag === 'gentime' || tag === 'utctime') + return this._encodeTime(data, tag); + else if (tag === 'null_') + return this._encodeNull(); + else if (tag === 'int' || tag === 'enum') + return this._encodeInt(data, state.args && state.reverseArgs[0]); + else if (tag === 'bool') + return this._encodeBool(data); + else if (tag === 'objDesc') + return this._encodeStr(data, tag); + else + throw new Error('Unsupported tag: ' + tag); +}; + +Node.prototype._isNumstr = function isNumstr(str) { + return /^[0-9 ]*$/.test(str); +}; + +Node.prototype._isPrintstr = function isPrintstr(str) { + return /^[A-Za-z0-9 '\(\)\+,\-\.\/:=\?]*$/.test(str); +}; + + +/***/ }), + +/***/ 2376: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_writable.js ***! + \********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ 44568) +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ 17317); +/**/ + +var Buffer = (__webpack_require__(/*! buffer */ 62266).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 69652); +var _require = __webpack_require__(/*! ./internal/streams/state */ 54527), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(/*! ../errors */ 31788).codes), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__webpack_require__(/*! inherits */ 18628)(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 63146); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 63146); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ 2393: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/readable-browser.js ***! + \****************************************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +exports = module.exports = __webpack_require__(/*! ./lib/_stream_readable.js */ 90150); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = __webpack_require__(/*! ./lib/_stream_writable.js */ 40778); +exports.Duplex = __webpack_require__(/*! ./lib/_stream_duplex.js */ 38720); +exports.Transform = __webpack_require__(/*! ./lib/_stream_transform.js */ 6448); +exports.PassThrough = __webpack_require__(/*! ./lib/_stream_passthrough.js */ 93794); + + +/***/ }), + +/***/ 2397: +/*!***************************************************************************!*\ + !*** ../node_modules/.pnpm/bs58@6.0.0/node_modules/bs58/src/esm/index.js ***! + \***************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var base_x__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! base-x */ 48975); + +var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,base_x__WEBPACK_IMPORTED_MODULE_0__["default"])(ALPHABET)); + + +/***/ }), + +/***/ 2399: +/*!***********************************************************************!*\ + !*** ../node_modules/.pnpm/hasown@2.0.4/node_modules/hasown/index.js ***! + \***********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var call = Function.prototype.call; +var $hasOwn = Object.prototype.hasOwnProperty; +var bind = __webpack_require__(/*! function-bind */ 94867); + +/** @type {import('.')} */ +module.exports = bind.call(call, $hasOwn); + + +/***/ }), + +/***/ 2572: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/holder.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Holder: () => (/* binding */ Holder) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./issuer_serial.js */ 83996); +/* harmony import */ var _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./object_digest_info.js */ 80835); + + + + + +class Holder { + baseCertificateID; + entityName; + objectDigestInfo; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__.IssuerSerial, implicit: true, context: 0, optional: true, + }) +], Holder.prototype, "baseCertificateID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralNames, implicit: true, context: 1, optional: true, + }) +], Holder.prototype, "entityName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__.ObjectDigestInfo, implicit: true, context: 2, optional: true, + }) +], Holder.prototype, "objectDigestInfo", void 0); + + +/***/ }), + +/***/ 2607: +/*!*************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/authorization/serializeAuthorizationList.js ***! + \*************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ serializeAuthorizationList: () => (/* binding */ serializeAuthorizationList) +/* harmony export */ }); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); +/* harmony import */ var _transaction_serializeTransaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../transaction/serializeTransaction.js */ 99857); + + +/* + * Serializes an EIP-7702 authorization list. + */ +function serializeAuthorizationList(authorizationList) { + if (!authorizationList || authorizationList.length === 0) + return []; + const serializedAuthorizationList = []; + for (const authorization of authorizationList) { + const { chainId, nonce, ...signature } = authorization; + const contractAddress = authorization.address; + serializedAuthorizationList.push([ + chainId ? (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_0__.toHex)(chainId) : '0x', + contractAddress, + nonce ? (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_0__.toHex)(nonce) : '0x', + ...(0,_transaction_serializeTransaction_js__WEBPACK_IMPORTED_MODULE_1__.toYParitySignatureArray)({}, signature), + ]); + } + return serializedAuthorizationList; +} +//# sourceMappingURL=serializeAuthorizationList.js.map + +/***/ }), + +/***/ 2629: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/aeads/exportOnly.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ExportOnly: () => (/* binding */ ExportOnly) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); + +/** + * The ExportOnly mode for HPKE AEAD implementing {@link AeadInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.ExportOnly` + * as follows: + * + * @example + * + * ```ts + * import { + * CipherSuite, + * DhkemP256HkdfSha256, + * ExportOnly, + * HkdfSha256, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP256HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new ExportOnly(), + * }); + * ``` + */ +class ExportOnly { + constructor() { + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _hpke_common__WEBPACK_IMPORTED_MODULE_0__.AeadId.ExportOnly + }); + Object.defineProperty(this, "keySize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "nonceSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "tagSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + } + createEncryptionContext(_key) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError("Export only"); + } +} + + +/***/ }), + +/***/ 2998: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/ed25519.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ED25519_TORSION_SUBGROUP: () => (/* binding */ ED25519_TORSION_SUBGROUP), +/* harmony export */ RistrettoPoint: () => (/* binding */ RistrettoPoint), +/* harmony export */ ed25519: () => (/* binding */ ed25519), +/* harmony export */ ed25519_hasher: () => (/* binding */ ed25519_hasher), +/* harmony export */ ed25519ctx: () => (/* binding */ ed25519ctx), +/* harmony export */ ed25519ph: () => (/* binding */ ed25519ph), +/* harmony export */ edwardsToMontgomery: () => (/* binding */ edwardsToMontgomery), +/* harmony export */ edwardsToMontgomeryPriv: () => (/* binding */ edwardsToMontgomeryPriv), +/* harmony export */ edwardsToMontgomeryPub: () => (/* binding */ edwardsToMontgomeryPub), +/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve), +/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve), +/* harmony export */ hashToRistretto255: () => (/* binding */ hashToRistretto255), +/* harmony export */ hash_to_ristretto255: () => (/* binding */ hash_to_ristretto255), +/* harmony export */ ristretto255: () => (/* binding */ ristretto255), +/* harmony export */ ristretto255_hasher: () => (/* binding */ ristretto255_hasher), +/* harmony export */ x25519: () => (/* binding */ x25519) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha2.js */ 19745); +/* harmony import */ var _noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils.js */ 29964); +/* harmony import */ var _abstract_curve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/curve.js */ 47149); +/* harmony import */ var _abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/edwards.js */ 45910); +/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ 89546); +/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/modular.js */ 35072); +/* harmony import */ var _abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./abstract/montgomery.js */ 49475); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils.js */ 74430); +/** + * ed25519 Twisted Edwards curve with following addons: + * - X25519 ECDH + * - Ristretto cofactor elimination + * - Elligator hash-to-group / point indistinguishability + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + + + + + + + +// prettier-ignore +const _0n = /* @__PURE__ */ BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3); +// prettier-ignore +const _5n = BigInt(5), _8n = BigInt(8); +// P = 2n**255n-19n +const ed25519_CURVE_p = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed'); +// N = 2n**252n + 27742317777372353535851937790883648493n +// a = Fp.create(BigInt(-1)) +// d = -121665/121666 a.k.a. Fp.neg(121665 * Fp.inv(121666)) +const ed25519_CURVE = /* @__PURE__ */ (() => ({ + p: ed25519_CURVE_p, + n: BigInt('0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed'), + h: _8n, + a: BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec'), + d: BigInt('0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3'), + Gx: BigInt('0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a'), + Gy: BigInt('0x6666666666666666666666666666666666666666666666666666666666666658'), +}))(); +function ed25519_pow_2_252_3(x) { + // prettier-ignore + const _10n = BigInt(10), _20n = BigInt(20), _40n = BigInt(40), _80n = BigInt(80); + const P = ed25519_CURVE_p; + const x2 = (x * x) % P; + const b2 = (x2 * x) % P; // x^3, 11 + const b4 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b2, _2n, P) * b2) % P; // x^15, 1111 + const b5 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b4, _1n, P) * x) % P; // x^31 + const b10 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b5, _5n, P) * b5) % P; + const b20 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b10, _10n, P) * b10) % P; + const b40 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b20, _20n, P) * b20) % P; + const b80 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b40, _40n, P) * b40) % P; + const b160 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b80, _80n, P) * b80) % P; + const b240 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b160, _80n, P) * b80) % P; + const b250 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b240, _10n, P) * b10) % P; + const pow_p_5_8 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(b250, _2n, P) * x) % P; + // ^ To pow to (p+3)/8, multiply it by x. + return { pow_p_5_8, b2 }; +} +function adjustScalarBytes(bytes) { + // Section 5: For X25519, in order to decode 32 random bytes as an integer scalar, + // set the three least significant bits of the first byte + bytes[0] &= 248; // 0b1111_1000 + // and the most significant bit of the last to zero, + bytes[31] &= 127; // 0b0111_1111 + // set the second most significant bit of the last byte to 1 + bytes[31] |= 64; // 0b0100_0000 + return bytes; +} +// √(-1) aka √(a) aka 2^((p-1)/4) +// Fp.sqrt(Fp.neg(1)) +const ED25519_SQRT_M1 = /* @__PURE__ */ BigInt('19681161376707505956807079304988542015446066515923890162744021073123829784752'); +// sqrt(u/v) +function uvRatio(u, v) { + const P = ed25519_CURVE_p; + const v3 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(v * v * v, P); // v³ + const v7 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(v3 * v3 * v, P); // v⁷ + // (p+3)/8 and (p-5)/8 + const pow = ed25519_pow_2_252_3(u * v7).pow_p_5_8; + let x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(u * v3 * pow, P); // (uv³)(uv⁷)^(p-5)/8 + const vx2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(v * x * x, P); // vx² + const root1 = x; // First root candidate + const root2 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(x * ED25519_SQRT_M1, P); // Second root candidate + const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root + const useRoot2 = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(-u, P); // If vx² = -u, set x <-- x * 2^((p-1)/4) + const noRoot = vx2 === (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(-u * ED25519_SQRT_M1, P); // There is no valid root, vx² = -u√(-1) + if (useRoot1) + x = root1; + if (useRoot2 || noRoot) + x = root2; // We return root2 anyway, for const-time + if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(x, P)) + x = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)(-x, P); + return { isValid: useRoot1 || useRoot2, value: x }; +} +const Fp = /* @__PURE__ */ (() => (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.Field)(ed25519_CURVE.p, { isLE: true }))(); +const Fn = /* @__PURE__ */ (() => (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.Field)(ed25519_CURVE.n, { isLE: true }))(); +const ed25519Defaults = /* @__PURE__ */ (() => ({ + ...ed25519_CURVE, + Fp, + hash: _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha512, + adjustScalarBytes, + // dom2 + // Ratio of u to v. Allows us to combine inversion and square root. Uses algo from RFC8032 5.1.3. + // Constant-time, u/√v + uvRatio, +}))(); +/** + * ed25519 curve with EdDSA signatures. + * @example + * import { ed25519 } from '@noble/curves/ed25519'; + * const { secretKey, publicKey } = ed25519.keygen(); + * const msg = new TextEncoder().encode('hello'); + * const sig = ed25519.sign(msg, priv); + * ed25519.verify(sig, msg, pub); // Default mode: follows ZIP215 + * ed25519.verify(sig, msg, pub, { zip215: false }); // RFC8032 / FIPS 186-5 + */ +const ed25519 = /* @__PURE__ */ (() => (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)(ed25519Defaults))(); +function ed25519_domain(data, ctx, phflag) { + if (ctx.length > 255) + throw new Error('Context is too big'); + return (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)((0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('SigEd25519 no Ed25519 collisions'), new Uint8Array([phflag ? 1 : 0, ctx.length]), ctx, data); +} +/** Context of ed25519. Uses context for domain separation. */ +const ed25519ctx = /* @__PURE__ */ (() => (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)({ + ...ed25519Defaults, + domain: ed25519_domain, +}))(); +/** Prehashed version of ed25519. Accepts already-hashed messages in sign() and verify(). */ +const ed25519ph = /* @__PURE__ */ (() => (0,_abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.twistedEdwards)(Object.assign({}, ed25519Defaults, { + domain: ed25519_domain, + prehash: _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha512, +})))(); +/** + * ECDH using curve25519 aka x25519. + * @example + * import { x25519 } from '@noble/curves/ed25519'; + * const priv = 'a546e36bf0527c9d3b16154b82465edd62144c0ac1fc5a18506a2244ba449ac4'; + * const pub = 'e6db6867583030db3594c1a424b15f7c726624ec26b3353b10a903a6d0ab1c4c'; + * x25519.getSharedSecret(priv, pub) === x25519.scalarMult(priv, pub); // aliases + * x25519.getPublicKey(priv) === x25519.scalarMultBase(priv); + * x25519.getPublicKey(x25519.utils.randomSecretKey()); + */ +const x25519 = /* @__PURE__ */ (() => { + const P = Fp.ORDER; + return (0,_abstract_montgomery_js__WEBPACK_IMPORTED_MODULE_6__.montgomery)({ + P, + type: 'x25519', + powPminus2: (x) => { + // x^(p-2) aka x^(2^255-21) + const { pow_p_5_8, b2 } = ed25519_pow_2_252_3(x); + return (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.mod)((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.pow2)(pow_p_5_8, _3n, P) * b2, P); + }, + adjustScalarBytes, + }); +})(); +// Hash To Curve Elligator2 Map (NOTE: different from ristretto255 elligator) +// NOTE: very important part is usage of FpSqrtEven for ELL2_C1_EDWARDS, since +// SageMath returns different root first and everything falls apart +const ELL2_C1 = /* @__PURE__ */ (() => (ed25519_CURVE_p + _3n) / _8n)(); // 1. c1 = (q + 3) / 8 # Integer arithmetic +const ELL2_C2 = /* @__PURE__ */ (() => Fp.pow(_2n, ELL2_C1))(); // 2. c2 = 2^c1 +const ELL2_C3 = /* @__PURE__ */ (() => Fp.sqrt(Fp.neg(Fp.ONE)))(); // 3. c3 = sqrt(-1) +// prettier-ignore +function map_to_curve_elligator2_curve25519(u) { + const ELL2_C4 = (ed25519_CURVE_p - _5n) / _8n; // 4. c4 = (q - 5) / 8 # Integer arithmetic + const ELL2_J = BigInt(486662); + let tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, _2n); // 2. tv1 = 2 * tv1 + let xd = Fp.add(tv1, Fp.ONE); // 3. xd = tv1 + 1 # Nonzero: -1 is square (mod p), tv1 is not + let x1n = Fp.neg(ELL2_J); // 4. x1n = -J # x1 = x1n / xd = -J / (1 + 2 * u^2) + let tv2 = Fp.sqr(xd); // 5. tv2 = xd^2 + let gxd = Fp.mul(tv2, xd); // 6. gxd = tv2 * xd # gxd = xd^3 + let gx1 = Fp.mul(tv1, ELL2_J); // 7. gx1 = J * tv1 # x1n + J * xd + gx1 = Fp.mul(gx1, x1n); // 8. gx1 = gx1 * x1n # x1n^2 + J * x1n * xd + gx1 = Fp.add(gx1, tv2); // 9. gx1 = gx1 + tv2 # x1n^2 + J * x1n * xd + xd^2 + gx1 = Fp.mul(gx1, x1n); // 10. gx1 = gx1 * x1n # x1n^3 + J * x1n^2 * xd + x1n * xd^2 + let tv3 = Fp.sqr(gxd); // 11. tv3 = gxd^2 + tv2 = Fp.sqr(tv3); // 12. tv2 = tv3^2 # gxd^4 + tv3 = Fp.mul(tv3, gxd); // 13. tv3 = tv3 * gxd # gxd^3 + tv3 = Fp.mul(tv3, gx1); // 14. tv3 = tv3 * gx1 # gx1 * gxd^3 + tv2 = Fp.mul(tv2, tv3); // 15. tv2 = tv2 * tv3 # gx1 * gxd^7 + let y11 = Fp.pow(tv2, ELL2_C4); // 16. y11 = tv2^c4 # (gx1 * gxd^7)^((p - 5) / 8) + y11 = Fp.mul(y11, tv3); // 17. y11 = y11 * tv3 # gx1*gxd^3*(gx1*gxd^7)^((p-5)/8) + let y12 = Fp.mul(y11, ELL2_C3); // 18. y12 = y11 * c3 + tv2 = Fp.sqr(y11); // 19. tv2 = y11^2 + tv2 = Fp.mul(tv2, gxd); // 20. tv2 = tv2 * gxd + let e1 = Fp.eql(tv2, gx1); // 21. e1 = tv2 == gx1 + let y1 = Fp.cmov(y12, y11, e1); // 22. y1 = CMOV(y12, y11, e1) # If g(x1) is square, this is its sqrt + let x2n = Fp.mul(x1n, tv1); // 23. x2n = x1n * tv1 # x2 = x2n / xd = 2 * u^2 * x1n / xd + let y21 = Fp.mul(y11, u); // 24. y21 = y11 * u + y21 = Fp.mul(y21, ELL2_C2); // 25. y21 = y21 * c2 + let y22 = Fp.mul(y21, ELL2_C3); // 26. y22 = y21 * c3 + let gx2 = Fp.mul(gx1, tv1); // 27. gx2 = gx1 * tv1 # g(x2) = gx2 / gxd = 2 * u^2 * g(x1) + tv2 = Fp.sqr(y21); // 28. tv2 = y21^2 + tv2 = Fp.mul(tv2, gxd); // 29. tv2 = tv2 * gxd + let e2 = Fp.eql(tv2, gx2); // 30. e2 = tv2 == gx2 + let y2 = Fp.cmov(y22, y21, e2); // 31. y2 = CMOV(y22, y21, e2) # If g(x2) is square, this is its sqrt + tv2 = Fp.sqr(y1); // 32. tv2 = y1^2 + tv2 = Fp.mul(tv2, gxd); // 33. tv2 = tv2 * gxd + let e3 = Fp.eql(tv2, gx1); // 34. e3 = tv2 == gx1 + let xn = Fp.cmov(x2n, x1n, e3); // 35. xn = CMOV(x2n, x1n, e3) # If e3, x = x1, else x = x2 + let y = Fp.cmov(y2, y1, e3); // 36. y = CMOV(y2, y1, e3) # If e3, y = y1, else y = y2 + let e4 = Fp.isOdd(y); // 37. e4 = sgn0(y) == 1 # Fix sign of y + y = Fp.cmov(y, Fp.neg(y), e3 !== e4); // 38. y = CMOV(y, -y, e3 XOR e4) + return { xMn: xn, xMd: xd, yMn: y, yMd: _1n }; // 39. return (xn, xd, y, 1) +} +const ELL2_C1_EDWARDS = /* @__PURE__ */ (() => (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.FpSqrtEven)(Fp, Fp.neg(BigInt(486664))))(); // sgn0(c1) MUST equal 0 +function map_to_curve_elligator2_edwards25519(u) { + const { xMn, xMd, yMn, yMd } = map_to_curve_elligator2_curve25519(u); // 1. (xMn, xMd, yMn, yMd) = + // map_to_curve_elligator2_curve25519(u) + let xn = Fp.mul(xMn, yMd); // 2. xn = xMn * yMd + xn = Fp.mul(xn, ELL2_C1_EDWARDS); // 3. xn = xn * c1 + let xd = Fp.mul(xMd, yMn); // 4. xd = xMd * yMn # xn / xd = c1 * xM / yM + let yn = Fp.sub(xMn, xMd); // 5. yn = xMn - xMd + let yd = Fp.add(xMn, xMd); // 6. yd = xMn + xMd # (n / d - 1) / (n / d + 1) = (n - d) / (n + d) + let tv1 = Fp.mul(xd, yd); // 7. tv1 = xd * yd + let e = Fp.eql(tv1, Fp.ZERO); // 8. e = tv1 == 0 + xn = Fp.cmov(xn, Fp.ZERO, e); // 9. xn = CMOV(xn, 0, e) + xd = Fp.cmov(xd, Fp.ONE, e); // 10. xd = CMOV(xd, 1, e) + yn = Fp.cmov(yn, Fp.ONE, e); // 11. yn = CMOV(yn, 1, e) + yd = Fp.cmov(yd, Fp.ONE, e); // 12. yd = CMOV(yd, 1, e) + const [xd_inv, yd_inv] = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.FpInvertBatch)(Fp, [xd, yd], true); // batch division + return { x: Fp.mul(xn, xd_inv), y: Fp.mul(yn, yd_inv) }; // 13. return (xn, xd, yn, yd) +} +/** Hashing to ed25519 points / field. RFC 9380 methods. */ +const ed25519_hasher = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__.createHasher)(ed25519.Point, (scalars) => map_to_curve_elligator2_edwards25519(scalars[0]), { + DST: 'edwards25519_XMD:SHA-512_ELL2_RO_', + encodeDST: 'edwards25519_XMD:SHA-512_ELL2_NU_', + p: ed25519_CURVE_p, + m: 1, + k: 128, + expand: 'xmd', + hash: _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha512, +}))(); +// √(-1) aka √(a) aka 2^((p-1)/4) +const SQRT_M1 = ED25519_SQRT_M1; +// √(ad - 1) +const SQRT_AD_MINUS_ONE = /* @__PURE__ */ BigInt('25063068953384623474111414158702152701244531502492656460079210482610430750235'); +// 1 / √(a-d) +const INVSQRT_A_MINUS_D = /* @__PURE__ */ BigInt('54469307008909316920995813868745141605393597292927456921205312896311721017578'); +// 1-d² +const ONE_MINUS_D_SQ = /* @__PURE__ */ BigInt('1159843021668779879193775521855586647937357759715417654439879720876111806838'); +// (d-1)² +const D_MINUS_ONE_SQ = /* @__PURE__ */ BigInt('40440834346308536858101042469323190826248399146238708352240133220865137265952'); +// Calculates 1/√(number) +const invertSqrt = (number) => uvRatio(_1n, number); +const MAX_255B = /* @__PURE__ */ BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'); +const bytes255ToNumberLE = (bytes) => ed25519.Point.Fp.create((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.bytesToNumberLE)(bytes) & MAX_255B); +/** + * Computes Elligator map for Ristretto255. + * Described in [RFC9380](https://www.rfc-editor.org/rfc/rfc9380#appendix-B) and on + * the [website](https://ristretto.group/formulas/elligator.html). + */ +function calcElligatorRistrettoMap(r0) { + const { d } = ed25519_CURVE; + const P = ed25519_CURVE_p; + const mod = (n) => Fp.create(n); + const r = mod(SQRT_M1 * r0 * r0); // 1 + const Ns = mod((r + _1n) * ONE_MINUS_D_SQ); // 2 + let c = BigInt(-1); // 3 + const D = mod((c - d * r) * mod(r + d)); // 4 + let { isValid: Ns_D_is_sq, value: s } = uvRatio(Ns, D); // 5 + let s_ = mod(s * r0); // 6 + if (!(0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(s_, P)) + s_ = mod(-s_); + if (!Ns_D_is_sq) + s = s_; // 7 + if (!Ns_D_is_sq) + c = r; // 8 + const Nt = mod(c * (r - _1n) * D_MINUS_ONE_SQ - D); // 9 + const s2 = s * s; + const W0 = mod((s + s) * D); // 10 + const W1 = mod(Nt * SQRT_AD_MINUS_ONE); // 11 + const W2 = mod(_1n - s2); // 12 + const W3 = mod(_1n + s2); // 13 + return new ed25519.Point(mod(W0 * W3), mod(W2 * W1), mod(W1 * W3), mod(W0 * W2)); +} +function ristretto255_map(bytes) { + (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(bytes, 64); + const r1 = bytes255ToNumberLE(bytes.subarray(0, 32)); + const R1 = calcElligatorRistrettoMap(r1); + const r2 = bytes255ToNumberLE(bytes.subarray(32, 64)); + const R2 = calcElligatorRistrettoMap(r2); + return new _RistrettoPoint(R1.add(R2)); +} +/** + * Wrapper over Edwards Point for ristretto255. + * + * Each ed25519/ExtendedPoint has 8 different equivalent points. This can be + * a source of bugs for protocols like ring signatures. Ristretto was created to solve this. + * Ristretto point operates in X:Y:Z:T extended coordinates like ExtendedPoint, + * but it should work in its own namespace: do not combine those two. + * See [RFC9496](https://www.rfc-editor.org/rfc/rfc9496). + */ +class _RistrettoPoint extends _abstract_edwards_js__WEBPACK_IMPORTED_MODULE_3__.PrimeEdwardsPoint { + constructor(ep) { + super(ep); + } + static fromAffine(ap) { + return new _RistrettoPoint(ed25519.Point.fromAffine(ap)); + } + assertSame(other) { + if (!(other instanceof _RistrettoPoint)) + throw new Error('RistrettoPoint expected'); + } + init(ep) { + return new _RistrettoPoint(ep); + } + /** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */ + static hashToCurve(hex) { + return ristretto255_map((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.ensureBytes)('ristrettoHash', hex, 64)); + } + static fromBytes(bytes) { + (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(bytes, 32); + const { a, d } = ed25519_CURVE; + const P = ed25519_CURVE_p; + const mod = (n) => Fp.create(n); + const s = bytes255ToNumberLE(bytes); + // 1. Check that s_bytes is the canonical encoding of a field element, or else abort. + // 3. Check that s is non-negative, or else abort + if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.equalBytes)(Fp.toBytes(s), bytes) || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(s, P)) + throw new Error('invalid ristretto255 encoding 1'); + const s2 = mod(s * s); + const u1 = mod(_1n + a * s2); // 4 (a is -1) + const u2 = mod(_1n - a * s2); // 5 + const u1_2 = mod(u1 * u1); + const u2_2 = mod(u2 * u2); + const v = mod(a * d * u1_2 - u2_2); // 6 + const { isValid, value: I } = invertSqrt(mod(v * u2_2)); // 7 + const Dx = mod(I * u2); // 8 + const Dy = mod(I * Dx * v); // 9 + let x = mod((s + s) * Dx); // 10 + if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(x, P)) + x = mod(-x); // 10 + const y = mod(u1 * Dy); // 11 + const t = mod(x * y); // 12 + if (!isValid || (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(t, P) || y === _0n) + throw new Error('invalid ristretto255 encoding 2'); + return new _RistrettoPoint(new ed25519.Point(x, y, _1n, t)); + } + /** + * Converts ristretto-encoded string to ristretto point. + * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-decode). + * @param hex Ristretto-encoded 32 bytes. Not every 32-byte string is valid ristretto encoding + */ + static fromHex(hex) { + return _RistrettoPoint.fromBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.ensureBytes)('ristrettoHex', hex, 32)); + } + static msm(points, scalars) { + return (0,_abstract_curve_js__WEBPACK_IMPORTED_MODULE_2__.pippenger)(_RistrettoPoint, ed25519.Point.Fn, points, scalars); + } + /** + * Encodes ristretto point to Uint8Array. + * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-encode). + */ + toBytes() { + let { X, Y, Z, T } = this.ep; + const P = ed25519_CURVE_p; + const mod = (n) => Fp.create(n); + const u1 = mod(mod(Z + Y) * mod(Z - Y)); // 1 + const u2 = mod(X * Y); // 2 + // Square root always exists + const u2sq = mod(u2 * u2); + const { value: invsqrt } = invertSqrt(mod(u1 * u2sq)); // 3 + const D1 = mod(invsqrt * u1); // 4 + const D2 = mod(invsqrt * u2); // 5 + const zInv = mod(D1 * D2 * T); // 6 + let D; // 7 + if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(T * zInv, P)) { + let _x = mod(Y * SQRT_M1); + let _y = mod(X * SQRT_M1); + X = _x; + Y = _y; + D = mod(D1 * INVSQRT_A_MINUS_D); + } + else { + D = D2; // 8 + } + if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(X * zInv, P)) + Y = mod(-Y); // 9 + let s = mod((Z - Y) * D); // 10 (check footer's note, no sqrt(-a)) + if ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_5__.isNegativeLE)(s, P)) + s = mod(-s); + return Fp.toBytes(s); // 11 + } + /** + * Compares two Ristretto points. + * Described in [RFC9496](https://www.rfc-editor.org/rfc/rfc9496#name-equals). + */ + equals(other) { + this.assertSame(other); + const { X: X1, Y: Y1 } = this.ep; + const { X: X2, Y: Y2 } = other.ep; + const mod = (n) => Fp.create(n); + // (x1 * y2 == y1 * x2) | (y1 * y2 == x1 * x2) + const one = mod(X1 * Y2) === mod(Y1 * X2); + const two = mod(Y1 * Y2) === mod(X1 * X2); + return one || two; + } + is0() { + return this.equals(_RistrettoPoint.ZERO); + } +} +// Do NOT change syntax: the following gymnastics is done, +// because typescript strips comments, which makes bundlers disable tree-shaking. +// prettier-ignore +_RistrettoPoint.BASE = +/* @__PURE__ */ (() => new _RistrettoPoint(ed25519.Point.BASE))(); +// prettier-ignore +_RistrettoPoint.ZERO = +/* @__PURE__ */ (() => new _RistrettoPoint(ed25519.Point.ZERO))(); +// prettier-ignore +_RistrettoPoint.Fp = +/* @__PURE__ */ (() => Fp)(); +// prettier-ignore +_RistrettoPoint.Fn = +/* @__PURE__ */ (() => Fn)(); +const ristretto255 = { Point: _RistrettoPoint }; +/** Hashing to ristretto255 points / field. RFC 9380 methods. */ +const ristretto255_hasher = { + hashToCurve(msg, options) { + const DST = options?.DST || 'ristretto255_XMD:SHA-512_R255MAP_RO_'; + const xmd = (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__.expand_message_xmd)(msg, DST, 64, _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha512); + return ristretto255_map(xmd); + }, + hashToScalar(msg, options = { DST: _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__._DST_scalar }) { + const xmd = (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_4__.expand_message_xmd)(msg, options.DST, 64, _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha512); + return Fn.create((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.bytesToNumberLE)(xmd)); + }, +}; +// export const ristretto255_oprf: OPRF = createORPF({ +// name: 'ristretto255-SHA512', +// Point: RistrettoPoint, +// hash: sha512, +// hashToGroup: ristretto255_hasher.hashToCurve, +// hashToScalar: ristretto255_hasher.hashToScalar, +// }); +/** + * Weird / bogus points, useful for debugging. + * All 8 ed25519 points of 8-torsion subgroup can be generated from the point + * T = `26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05`. + * ⟨T⟩ = { O, T, 2T, 3T, 4T, 5T, 6T, 7T } + */ +const ED25519_TORSION_SUBGROUP = [ + '0100000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac037a', + '0000000000000000000000000000000000000000000000000000000000000080', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc05', + 'ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f', + '26e8958fc2b227b045c3f489f2ef98f0d5dfac05d3c63339b13802886d53fc85', + '0000000000000000000000000000000000000000000000000000000000000000', + 'c7176a703d4dd84fba3c0b760d10670f2a2053fa2c39ccc64ec7fd7792ac03fa', +]; +/** @deprecated use `ed25519.utils.toMontgomery` */ +function edwardsToMontgomeryPub(edwardsPub) { + return ed25519.utils.toMontgomery((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.ensureBytes)('pub', edwardsPub)); +} +/** @deprecated use `ed25519.utils.toMontgomery` */ +const edwardsToMontgomery = edwardsToMontgomeryPub; +/** @deprecated use `ed25519.utils.toMontgomerySecret` */ +function edwardsToMontgomeryPriv(edwardsPriv) { + return ed25519.utils.toMontgomerySecret((0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.ensureBytes)('pub', edwardsPriv)); +} +/** @deprecated use `ristretto255.Point` */ +const RistrettoPoint = _RistrettoPoint; +/** @deprecated use `import { ed25519_hasher } from '@noble/curves/ed25519.js';` */ +const hashToCurve = /* @__PURE__ */ (() => ed25519_hasher.hashToCurve)(); +/** @deprecated use `import { ed25519_hasher } from '@noble/curves/ed25519.js';` */ +const encodeToCurve = /* @__PURE__ */ (() => ed25519_hasher.encodeToCurve)(); +/** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */ +const hashToRistretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)(); +/** @deprecated use `import { ristretto255_hasher } from '@noble/curves/ed25519.js';` */ +const hash_to_ristretto255 = /* @__PURE__ */ (() => ristretto255_hasher.hashToCurve)(); +//# sourceMappingURL=ed25519.js.map + +/***/ }), + +/***/ 3029: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/384.js ***! + \************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); + +var SHA512 = __webpack_require__(/*! ./512 */ 18148); + +function SHA384() { + if (!(this instanceof SHA384)) + return new SHA384(); + + SHA512.call(this); + this.h = [ + 0xcbbb9d5d, 0xc1059ed8, + 0x629a292a, 0x367cd507, + 0x9159015a, 0x3070dd17, + 0x152fecd8, 0xf70e5939, + 0x67332667, 0xffc00b31, + 0x8eb44a87, 0x68581511, + 0xdb0c2e0d, 0x64f98fa7, + 0x47b5481d, 0xbefa4fa4 ]; +} +utils.inherits(SHA384, SHA512); +module.exports = SHA384; + +SHA384.blockSize = 1024; +SHA384.outSize = 384; +SHA384.hmacStrength = 192; +SHA384.padLength = 128; + +SHA384.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 12), 'big'); + else + return utils.split32(this.h.slice(0, 12), 'big'); +}; + + +/***/ }), + +/***/ 3043: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/parser.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnParser: () => (/* binding */ AsnParser) +/* harmony export */ }); +/* harmony import */ var asn1js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! asn1js */ 55966); +/* harmony import */ var _peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/utils/bytes */ 15246); +/* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./enums.js */ 55904); +/* harmony import */ var _converters_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./converters.js */ 97057); +/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./errors/index.js */ 3944); +/* harmony import */ var _helper_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./helper.js */ 66676); +/* harmony import */ var _storage_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./storage.js */ 99775); + + + + + + + +class AsnParser { + static parse(data, target, options) { + const asn1Parsed = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER((0,_peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.toArrayBuffer)(data), options?.berOptions); + if (asn1Parsed.result.error) { + throw new Error(asn1Parsed.result.error); + } + const res = this.fromASN(asn1Parsed.result, target, options); + return res; + } + static fromASN(asn1Schema, target, options) { + try { + if ((0,_helper_js__WEBPACK_IMPORTED_MODULE_5__.isConvertible)(target)) { + const value = new target(); + return value.fromASN(asn1Schema); + } + const schema = _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.get(target); + _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.cache(target); + let targetSchema = schema.schema; + const choiceResult = this.handleChoiceTypes(asn1Schema, schema, target, targetSchema, options); + if (choiceResult?.result) { + return choiceResult.result; + } + if (choiceResult?.targetSchema) { + targetSchema = choiceResult.targetSchema; + } + const sequenceResult = this.handleSequenceTypes(asn1Schema, schema, target, targetSchema); + const res = new target(); + if ((0,_helper_js__WEBPACK_IMPORTED_MODULE_5__.isTypeOfArray)(target)) { + return this.handleArrayTypes(asn1Schema, schema, target, options); + } + this.processSchemaItems(schema, sequenceResult, res, options); + return res; + } + catch (error) { + if (error instanceof _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.AsnSchemaValidationError) { + error.schemas.push(target.name); + } + throw error; + } + } + static handleChoiceTypes(asn1Schema, schema, target, targetSchema, options) { + if (asn1Schema.constructor === asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed + && schema.type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Choice + && asn1Schema.idBlock.tagClass === 3) { + for (const key in schema.items) { + const schemaItem = schema.items[key]; + if (schemaItem.context === asn1Schema.idBlock.tagNumber && schemaItem.implicit) { + if (typeof schemaItem.type === "function" + && _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.has(schemaItem.type)) { + const fieldSchema = _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.get(schemaItem.type); + if (fieldSchema && fieldSchema.type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Sequence) { + const newSeq = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence(); + if ("value" in asn1Schema.valueBlock + && Array.isArray(asn1Schema.valueBlock.value) + && "value" in newSeq.valueBlock) { + newSeq.valueBlock.value = asn1Schema.valueBlock.value; + const fieldValue = this.fromASN(newSeq, schemaItem.type, options); + const res = new target(); + res[key] = fieldValue; + return { result: res }; + } + } + } + } + } + } + else if (asn1Schema.constructor === asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed + && schema.type !== _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Choice) { + const newTargetSchema = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed({ + idBlock: { + tagClass: 3, + tagNumber: asn1Schema.idBlock.tagNumber, + }, + value: schema.schema.valueBlock.value, + }); + for (const key in schema.items) { + delete asn1Schema[key]; + } + return { targetSchema: newTargetSchema }; + } + return null; + } + static handleSequenceTypes(asn1Schema, schema, target, targetSchema) { + if (schema.type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Sequence) { + const asn1ComparedSchema = asn1js__WEBPACK_IMPORTED_MODULE_0__.compareSchema({}, asn1Schema, targetSchema); + if (!asn1ComparedSchema.verified) { + throw new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.AsnSchemaValidationError(`Data does not match to ${target.name} ASN1 schema.${asn1ComparedSchema.result.error ? ` ${asn1ComparedSchema.result.error}` : ""}`); + } + return asn1ComparedSchema; + } + else { + const asn1ComparedSchema = asn1js__WEBPACK_IMPORTED_MODULE_0__.compareSchema({}, asn1Schema, targetSchema); + if (!asn1ComparedSchema.verified) { + throw new _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.AsnSchemaValidationError(`Data does not match to ${target.name} ASN1 schema.${asn1ComparedSchema.result.error ? ` ${asn1ComparedSchema.result.error}` : ""}`); + } + return asn1ComparedSchema; + } + } + static processRepeatedField(asn1Elements, asn1Index, schemaItem) { + let elementsToProcess = asn1Elements.slice(asn1Index); + if (elementsToProcess.length === 1 && elementsToProcess[0].constructor.name === "Sequence") { + const seq = elementsToProcess[0]; + if (seq.valueBlock && seq.valueBlock.value && Array.isArray(seq.valueBlock.value)) { + elementsToProcess = seq.valueBlock.value; + } + } + if (typeof schemaItem.type === "number") { + const converter = _converters_js__WEBPACK_IMPORTED_MODULE_3__.defaultConverter(schemaItem.type); + if (!converter) + throw new Error(`No converter for ASN.1 type ${schemaItem.type}`); + return elementsToProcess + .filter((el) => el && el.valueBlock) + .map((el) => { + try { + return converter.fromASN(el); + } + catch { + return undefined; + } + }) + .filter((v) => v !== undefined); + } + else { + return elementsToProcess + .filter((el) => el && el.valueBlock) + .map((el) => { + try { + return this.fromASN(el, schemaItem.type); + } + catch { + return undefined; + } + }) + .filter((v) => v !== undefined); + } + } + static processPrimitiveField(asn1Element, schemaItem) { + const converter = _converters_js__WEBPACK_IMPORTED_MODULE_3__.defaultConverter(schemaItem.type); + if (!converter) + throw new Error(`No converter for ASN.1 type ${schemaItem.type}`); + return converter.fromASN(asn1Element); + } + static isOptionalChoiceField(schemaItem) { + return (schemaItem.optional + && typeof schemaItem.type === "function" + && _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.has(schemaItem.type) + && _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.get(schemaItem.type).type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Choice); + } + static processOptionalChoiceField(asn1Element, schemaItem) { + try { + const value = this.fromASN(asn1Element, schemaItem.type); + return { + processed: true, value, + }; + } + catch (err) { + if (err instanceof _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.AsnSchemaValidationError + && /Wrong values for Choice type/.test(err.message)) { + return { processed: false }; + } + throw err; + } + } + static handleArrayTypes(asn1Schema, schema, target, options) { + if (!("value" in asn1Schema.valueBlock && Array.isArray(asn1Schema.valueBlock.value))) { + throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed."); + } + const itemType = schema.itemType; + if (typeof itemType === "number") { + const converter = _converters_js__WEBPACK_IMPORTED_MODULE_3__.defaultConverter(itemType); + if (!converter) { + throw new Error(`Cannot get default converter for array item of ${target.name} ASN1 schema`); + } + return target.from(asn1Schema.valueBlock.value, (element) => converter.fromASN(element)); + } + else { + return target.from(asn1Schema.valueBlock.value, (element) => this.fromASN(element, itemType, options)); + } + } + static processSchemaItems(schema, asn1ComparedSchema, res, options) { + for (const key in schema.items) { + const asn1SchemaValue = asn1ComparedSchema.result[key]; + if (!asn1SchemaValue) { + continue; + } + const schemaItem = schema.items[key]; + const schemaItemType = schemaItem.type; + let parsedValue; + if (typeof schemaItemType === "number" || (0,_helper_js__WEBPACK_IMPORTED_MODULE_5__.isConvertible)(schemaItemType)) { + parsedValue = this.processPrimitiveSchemaItem(asn1SchemaValue, schemaItem, schemaItemType, options); + } + else { + parsedValue = this.processComplexSchemaItem(asn1SchemaValue, schemaItem, schemaItemType, options); + } + if (parsedValue + && typeof parsedValue === "object" + && "value" in parsedValue + && "raw" in parsedValue) { + res[key] = parsedValue.value; + res[`${key}Raw`] = parsedValue.raw; + } + else { + res[key] = parsedValue; + } + } + } + static processPrimitiveSchemaItem(asn1SchemaValue, schemaItem, schemaItemType, options) { + const converter = schemaItem.converter + ?? ((0,_helper_js__WEBPACK_IMPORTED_MODULE_5__.isConvertible)(schemaItemType) + ? new schemaItemType() + : null); + if (!converter) { + throw new Error("Converter is empty"); + } + if (schemaItem.repeated) { + return this.processRepeatedPrimitiveItem(asn1SchemaValue, schemaItem, converter, options); + } + else { + return this.processSinglePrimitiveItem(asn1SchemaValue, schemaItem, schemaItemType, converter, options); + } + } + static processRepeatedPrimitiveItem(asn1SchemaValue, schemaItem, converter, options) { + if (schemaItem.implicit) { + const Container = schemaItem.repeated === "sequence" ? asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence : asn1js__WEBPACK_IMPORTED_MODULE_0__.Set; + const newItem = new Container(); + newItem.valueBlock = asn1SchemaValue.valueBlock; + const newItemAsn = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(newItem.toBER(false), options?.berOptions); + if (newItemAsn.offset === -1) { + throw new Error(`Cannot parse the child item. ${newItemAsn.result.error}`); + } + if (!("value" in newItemAsn.result.valueBlock + && Array.isArray(newItemAsn.result.valueBlock.value))) { + throw new Error("Cannot get items from the ASN.1 parsed value. ASN.1 object is not constructed."); + } + const value = newItemAsn.result.valueBlock.value; + return Array.from(value, (element) => converter.fromASN(element)); + } + else { + return Array.from(asn1SchemaValue, (element) => converter.fromASN(element)); + } + } + static processSinglePrimitiveItem(asn1SchemaValue, schemaItem, schemaItemType, converter, options) { + let value = asn1SchemaValue; + if (schemaItem.implicit) { + let newItem; + if ((0,_helper_js__WEBPACK_IMPORTED_MODULE_5__.isConvertible)(schemaItemType)) { + newItem = new schemaItemType().toSchema(""); + } + else { + const Asn1TypeName = _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnPropTypes[schemaItemType]; + const Asn1Type = asn1js__WEBPACK_IMPORTED_MODULE_0__[Asn1TypeName]; + if (!Asn1Type) { + throw new Error(`Cannot get '${Asn1TypeName}' class from asn1js module`); + } + newItem = new Asn1Type(); + } + newItem.valueBlock = value.valueBlock; + value = asn1js__WEBPACK_IMPORTED_MODULE_0__.fromBER(newItem.toBER(false), options?.berOptions).result; + } + return converter.fromASN(value); + } + static processComplexSchemaItem(asn1SchemaValue, schemaItem, schemaItemType, options) { + if (schemaItem.repeated) { + if (!Array.isArray(asn1SchemaValue)) { + throw new Error("Cannot get list of items from the ASN.1 parsed value. ASN.1 value should be iterable."); + } + return Array.from(asn1SchemaValue, (element) => this.fromASN(element, schemaItemType, options)); + } + else { + const valueToProcess = this.handleImplicitTagging(asn1SchemaValue, schemaItem, schemaItemType); + if (this.isOptionalChoiceField(schemaItem)) { + try { + return this.fromASN(valueToProcess, schemaItemType, options); + } + catch (err) { + if (err instanceof _errors_index_js__WEBPACK_IMPORTED_MODULE_4__.AsnSchemaValidationError + && /Wrong values for Choice type/.test(err.message)) { + return undefined; + } + throw err; + } + } + else { + const parsedValue = this.fromASN(valueToProcess, schemaItemType, options); + if (schemaItem.raw) { + return { + value: parsedValue, + raw: asn1SchemaValue.valueBeforeDecodeView, + }; + } + return parsedValue; + } + } + } + static handleImplicitTagging(asn1SchemaValue, schemaItem, schemaItemType) { + if (schemaItem.implicit && typeof schemaItem.context === "number") { + const schema = _storage_js__WEBPACK_IMPORTED_MODULE_6__.schemaStorage.get(schemaItemType); + if (schema.type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Sequence) { + const newSeq = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence(); + if ("value" in asn1SchemaValue.valueBlock + && Array.isArray(asn1SchemaValue.valueBlock.value) + && "value" in newSeq.valueBlock) { + newSeq.valueBlock.value = asn1SchemaValue.valueBlock.value; + return newSeq; + } + } + else if (schema.type === _enums_js__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Set) { + const newSet = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Set(); + if ("value" in asn1SchemaValue.valueBlock + && Array.isArray(asn1SchemaValue.valueBlock.value) + && "value" in newSet.valueBlock) { + newSet.valueBlock.value = asn1SchemaValue.valueBlock.value; + return newSet; + } + } + } + return asn1SchemaValue; + } +} + + +/***/ }), + +/***/ 3164: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/curve/base.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ 27019); +var utils = __webpack_require__(/*! ../utils */ 28432); +var getNAF = utils.getNAF; +var getJSF = utils.getJSF; +var assert = utils.assert; + +function BaseCurve(type, conf) { + this.type = type; + this.p = new BN(conf.p, 16); + + // Use Montgomery, when there is no fast reduction for the prime + this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p); + + // Useful for many curves + this.zero = new BN(0).toRed(this.red); + this.one = new BN(1).toRed(this.red); + this.two = new BN(2).toRed(this.red); + + // Curve configuration, optional + this.n = conf.n && new BN(conf.n, 16); + this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed); + + // Temporary arrays + 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; + + // Generalized Greg Maxwell's trick + var adjustCount = this.n && this.p.div(this.n); + if (!adjustCount || adjustCount.cmpn(100) > 0) { + this.redN = null; + } else { + this._maxwellTrick = true; + this.redN = this.n.toRed(this.red); + } +} +module.exports = BaseCurve; + +BaseCurve.prototype.point = function point() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype.validate = function validate() { + throw new Error('Not implemented'); +}; + +BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) { + assert(p.precomputed); + var doubles = p._getDoubles(); + + var naf = getNAF(k, 1, this._bitLength); + var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1); + I /= 3; + + // Translate into more windowed form + var repr = []; + var j; + var nafW; + for (j = 0; j < naf.length; j += doubles.step) { + nafW = 0; + for (var l = j + doubles.step - 1; l >= j; l--) + nafW = (nafW << 1) + naf[l]; + repr.push(nafW); + } + + var a = this.jpoint(null, null, null); + var b = this.jpoint(null, null, null); + for (var i = I; i > 0; i--) { + for (j = 0; j < repr.length; j++) { + nafW = repr[j]; + if (nafW === i) + b = b.mixedAdd(doubles.points[j]); + else if (nafW === -i) + b = b.mixedAdd(doubles.points[j].neg()); + } + a = a.add(b); + } + return a.toP(); +}; + +BaseCurve.prototype._wnafMul = function _wnafMul(p, k) { + var w = 4; + + // Precompute window + var nafPoints = p._getNAFPoints(w); + w = nafPoints.wnd; + var wnd = nafPoints.points; + + // Get NAF form + var naf = getNAF(k, w, this._bitLength); + + // Add `this`*(N+1) for every w-NAF index + var acc = this.jpoint(null, null, null); + for (var i = naf.length - 1; i >= 0; i--) { + // Count zeroes + for (var l = 0; i >= 0 && naf[i] === 0; i--) + l++; + if (i >= 0) + l++; + acc = acc.dblp(l); + + if (i < 0) + break; + var z = naf[i]; + assert(z !== 0); + if (p.type === 'affine') { + // J +- P + if (z > 0) + acc = acc.mixedAdd(wnd[(z - 1) >> 1]); + else + acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg()); + } else { + // J +- J + if (z > 0) + acc = acc.add(wnd[(z - 1) >> 1]); + else + acc = acc.add(wnd[(-z - 1) >> 1].neg()); + } + } + return p.type === 'affine' ? acc.toP() : acc; +}; + +BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, + points, + coeffs, + len, + jacobianResult) { + var wndWidth = this._wnafT1; + var wnd = this._wnafT2; + var naf = this._wnafT3; + + // Fill all arrays + var max = 0; + var i; + var j; + var p; + for (i = 0; i < len; i++) { + p = points[i]; + var nafPoints = p._getNAFPoints(defW); + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; + } + + // Comb small window NAFs + for (i = len - 1; i >= 1; i -= 2) { + var a = i - 1; + var b = i; + if (wndWidth[a] !== 1 || wndWidth[b] !== 1) { + naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength); + naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength); + max = Math.max(naf[a].length, max); + max = Math.max(naf[b].length, max); + continue; + } + + var comb = [ + points[a], /* 1 */ + null, /* 3 */ + null, /* 5 */ + points[b], /* 7 */ + ]; + + // Try to avoid Projective points, if possible + if (points[a].y.cmp(points[b].y) === 0) { + comb[1] = points[a].add(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].add(points[b].neg()); + } else { + comb[1] = points[a].toJ().mixedAdd(points[b]); + comb[2] = points[a].toJ().mixedAdd(points[b].neg()); + } + + var index = [ + -3, /* -1 -1 */ + -1, /* -1 0 */ + -5, /* -1 1 */ + -7, /* 0 -1 */ + 0, /* 0 0 */ + 7, /* 0 1 */ + 5, /* 1 -1 */ + 1, /* 1 0 */ + 3, /* 1 1 */ + ]; + + var jsf = getJSF(coeffs[a], coeffs[b]); + max = Math.max(jsf[0].length, max); + naf[a] = new Array(max); + naf[b] = new Array(max); + for (j = 0; j < max; j++) { + var ja = jsf[0][j] | 0; + var jb = jsf[1][j] | 0; + + naf[a][j] = index[(ja + 1) * 3 + (jb + 1)]; + naf[b][j] = 0; + wnd[a] = comb; + } + } + + var acc = this.jpoint(null, null, null); + var tmp = this._wnafT4; + for (i = max; i >= 0; i--) { + var k = 0; + + while (i >= 0) { + var zero = true; + for (j = 0; j < len; j++) { + tmp[j] = naf[j][i] | 0; + if (tmp[j] !== 0) + zero = false; + } + if (!zero) + break; + k++; + i--; + } + if (i >= 0) + k++; + acc = acc.dblp(k); + if (i < 0) + break; + + for (j = 0; j < len; j++) { + var z = tmp[j]; + p; + if (z === 0) + continue; + else if (z > 0) + p = wnd[j][(z - 1) >> 1]; + else if (z < 0) + p = wnd[j][(-z - 1) >> 1].neg(); + + if (p.type === 'affine') + acc = acc.mixedAdd(p); + else + acc = acc.add(p); + } + } + // Zeroify references + for (i = 0; i < len; i++) + wnd[i] = null; + + if (jacobianResult) + return acc; + else + return acc.toP(); +}; + +function BasePoint(curve, type) { + this.curve = curve; + this.type = type; + this.precomputed = null; +} +BaseCurve.BasePoint = BasePoint; + +BasePoint.prototype.eq = function eq(/*other*/) { + throw new Error('Not implemented'); +}; + +BasePoint.prototype.validate = function validate() { + return this.curve.validate(this); +}; + +BaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + bytes = utils.toArray(bytes, enc); + + var len = this.p.byteLength(); + + // uncompressed, hybrid-odd, hybrid-even + if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) && + bytes.length - 1 === 2 * len) { + if (bytes[0] === 0x06) + assert(bytes[bytes.length - 1] % 2 === 0); + else if (bytes[0] === 0x07) + assert(bytes[bytes.length - 1] % 2 === 1); + + var res = this.point(bytes.slice(1, 1 + len), + bytes.slice(1 + len, 1 + 2 * len)); + + return res; + } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) && + bytes.length - 1 === len) { + return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03); + } + throw new Error('Unknown point format'); +}; + +BasePoint.prototype.encodeCompressed = function encodeCompressed(enc) { + return this.encode(enc, true); +}; + +BasePoint.prototype._encode = function _encode(compact) { + var len = this.curve.p.byteLength(); + var x = this.getX().toArray('be', len); + + if (compact) + return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x); + + return [ 0x04 ].concat(x, this.getY().toArray('be', len)); +}; + +BasePoint.prototype.encode = function encode(enc, compact) { + return utils.encode(this._encode(compact), enc); +}; + +BasePoint.prototype.precompute = function precompute(power) { + if (this.precomputed) + return this; + + var precomputed = { + doubles: null, + naf: null, + beta: null, + }; + precomputed.naf = this._getNAFPoints(8); + precomputed.doubles = this._getDoubles(4, power); + precomputed.beta = this._getBeta(); + this.precomputed = precomputed; + + return this; +}; + +BasePoint.prototype._hasDoubles = function _hasDoubles(k) { + if (!this.precomputed) + return false; + + var doubles = this.precomputed.doubles; + if (!doubles) + return false; + + return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step); +}; + +BasePoint.prototype._getDoubles = function _getDoubles(step, power) { + if (this.precomputed && this.precomputed.doubles) + return this.precomputed.doubles; + + var doubles = [ this ]; + var acc = this; + for (var i = 0; i < power; i += step) { + for (var j = 0; j < step; j++) + acc = acc.dbl(); + doubles.push(acc); + } + return { + step: step, + points: doubles, + }; +}; + +BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { + if (this.precomputed && this.precomputed.naf) + return this.precomputed.naf; + + var res = [ this ]; + var max = (1 << wnd) - 1; + var dbl = max === 1 ? null : this.dbl(); + for (var i = 1; i < max; i++) + res[i] = res[i - 1].add(dbl); + return { + wnd: wnd, + points: res, + }; +}; + +BasePoint.prototype._getBeta = function _getBeta() { + return null; +}; + +BasePoint.prototype.dblp = function dblp(k) { + var r = this; + for (var i = 0; i < k; i++) + r = r.dbl(); + return r; +}; + + +/***/ }), + +/***/ 3376: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+ed25519@2.0.0/node_modules/@noble/ed25519/index.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CURVE: () => (/* binding */ CURVE), +/* harmony export */ ExtendedPoint: () => (/* binding */ Point), +/* harmony export */ etc: () => (/* binding */ etc), +/* harmony export */ getPublicKey: () => (/* binding */ getPublicKey), +/* harmony export */ getPublicKeyAsync: () => (/* binding */ getPublicKeyAsync), +/* harmony export */ sign: () => (/* binding */ sign), +/* harmony export */ signAsync: () => (/* binding */ signAsync), +/* harmony export */ utils: () => (/* binding */ utils), +/* harmony export */ verify: () => (/* binding */ verify), +/* harmony export */ verifyAsync: () => (/* binding */ verifyAsync) +/* harmony export */ }); +/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ +const P = 2n ** 255n - 19n; // ed25519 is twisted edwards curve +const N = 2n ** 252n + 27742317777372353535851937790883648493n; // curve's (group) order +const Gx = 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an; // base point x +const Gy = 0x6666666666666666666666666666666666666666666666666666666666666658n; // base point y +const CURVE = { + a: -1n, + d: 37095705934669439343138083508754565189542113879843219016388785533085940283555n, + p: P, n: N, h: 8, Gx, Gy // field prime, curve (group) order, cofactor +}; +const err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace +const str = (s) => typeof s === 'string'; // is string +const au8 = (a, l) => // is Uint8Array (of specific length) + !(a instanceof Uint8Array) || (typeof l === 'number' && l > 0 && a.length !== l) ? + err('Uint8Array expected') : a; +const u8n = (data) => new Uint8Array(data); // creates Uint8Array +const toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(a), len); // norm(hex/u8a) to u8a +const mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division +const isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is xyzt point +let Gpows = undefined; // precomputes for base point G +class Point { + constructor(ex, ey, ez, et) { + this.ex = ex; + this.ey = ey; + this.ez = ez; + this.et = et; + } + static fromAffine(p) { return new Point(p.x, p.y, 1n, mod(p.x * p.y)); } + static fromHex(hex, strict = true) { + const { d } = CURVE; + hex = toU8(hex, 32); + const normed = hex.slice(); // copy the array to not mess it up + normed[31] = hex[31] & ~0x80; // adjust first LE byte = last BE byte + const y = b2n_LE(normed); // decode as little-endian, convert to num + if (y === 0n) { // y=0 is valid, proceed + } + else { + if (strict && !(0n < y && y < P)) + err('bad y coord 1'); // strict=true [1..P-1] + if (!strict && !(0n < y && y < 2n ** 256n)) + err('bad y coord 2'); // strict=false [1..2^256-1] + } + const y2 = mod(y * y); // y² + const u = mod(y2 - 1n); // u=y²-1 + const v = mod(d * y2 + 1n); // v=dy²+1 + let { isValid, value: x } = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root + if (!isValid) + err('bad y coordinate 3'); // not square root: bad point + const isXOdd = (x & 1n) === 1n; // adjust sign of x coordinate + const isHeadOdd = (hex[31] & 0x80) !== 0; + if (isHeadOdd !== isXOdd) + x = mod(-x); + return new Point(x, y, 1n, mod(x * y)); // Z=1, T=xy + } + get x() { return this.toAffine().x; } // .x, .y will call expensive toAffine. + get y() { return this.toAffine().y; } // Should be used with care. + equals(other) { + const { ex: X1, ey: Y1, ez: Z1 } = this; + const { ex: X2, ey: Y2, ez: Z2 } = isPoint(other); // isPoint() checks class equality + const X1Z2 = mod(X1 * Z2), X2Z1 = mod(X2 * Z1); + const Y1Z2 = mod(Y1 * Z2), Y2Z1 = mod(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + is0() { return this.equals(I); } + negate() { + return new Point(mod(-this.ex), this.ey, this.ez, mod(-this.et)); + } + double() { + const { ex: X1, ey: Y1, ez: Z1 } = this; // Cost: 4M + 4S + 1*a + 6add + 1*2 + const { a } = CURVE; // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + const A = mod(X1 * X1); + const B = mod(Y1 * Y1); + const C = mod(2n * mod(Z1 * Z1)); + const D = mod(a * A); + const x1y1 = X1 + Y1; + const E = mod(mod(x1y1 * x1y1) - A - B); + const G = D + B; + const F = G - C; + const H = D - B; + const X3 = mod(E * F); + const Y3 = mod(G * H); + const T3 = mod(E * H); + const Z3 = mod(F * G); + return new Point(X3, Y3, Z3, T3); + } + add(other) { + const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; // Cost: 8M + 1*k + 8add + 1*2. + const { ex: X2, ey: Y2, ez: Z2, et: T2 } = isPoint(other); // doesn't check if other on-curve + const { a, d } = CURVE; // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 + const A = mod(X1 * X2); + const B = mod(Y1 * Y2); + const C = mod(T1 * d * T2); + const D = mod(Z1 * Z2); + const E = mod((X1 + Y1) * (X2 + Y2) - A - B); + const F = mod(D - C); + const G = mod(D + C); + const H = mod(B - a * A); + const X3 = mod(E * F); + const Y3 = mod(G * H); + const T3 = mod(E * H); + const Z3 = mod(F * G); + return new Point(X3, Y3, Z3, T3); + } + mul(n, safe = true) { + if (n === 0n) + return safe === true ? err('cannot multiply by 0') : I; + if (!(typeof n === 'bigint' && 0n < n && n < N)) + err('invalid scalar, must be < L'); + if (!safe && this.is0() || n === 1n) + return this; // safe=true bans 0. safe=false allows 0. + if (this.equals(G)) + return wNAF(n).p; // use wNAF precomputes for base points + let p = I, f = G; // init result point & fake point + for (let d = this; n > 0n; d = d.double(), n >>= 1n) { // double-and-add ladder + if (n & 1n) + p = p.add(d); // if bit is present, add to point + else if (safe) + f = f.add(d); // if not, add to fake for timing safety + } + return p; + } + multiply(scalar) { return this.mul(scalar); } // Aliases for compatibilty + clearCofactor() { return this.mul(BigInt(CURVE.h), false); } // multiply by cofactor + isSmallOrder() { return this.clearCofactor().is0(); } // check if P is small order + isTorsionFree() { + let p = this.mul(N / 2n, false).double(); // ensures the point is not "bad". + if (N % 2n) + p = p.add(this); // P^(N+1) // P*N == (P*(N/2))*2+P + return p.is0(); + } + toAffine() { + const { ex: x, ey: y, ez: z } = this; // (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy) + if (this.is0()) + return { x: 0n, y: 0n }; // fast-path for zero point + const iz = invert(z); // z^-1: invert z + if (mod(z * iz) !== 1n) + err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math + return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1 + } + toRawBytes() { + const { x, y } = this.toAffine(); // convert to affine 2d point + const b = n2b_32LE(y); // encode number to 32 bytes + b[31] |= x & 1n ? 0x80 : 0; // store sign in first LE byte + return b; + } + toHex() { return b2h(this.toRawBytes()); } // encode to hex string +} +Point.BASE = new Point(Gx, Gy, 1n, mod(Gx * Gy)); // Generator / Base point +Point.ZERO = new Point(0n, 1n, 1n, 0n); // Identity / Zero point +const { BASE: G, ZERO: I } = Point; // Generator, identity points +const padh = (num, pad) => num.toString(16).padStart(pad, '0'); +const b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex +const h2b = (hex) => { + const l = hex.length; // error if not string, + if (!str(hex) || l % 2) + err('hex invalid 1'); // or has odd length like 3, 5. + const arr = u8n(l / 2); // create result array + for (let i = 0; i < arr.length; i++) { + const j = i * 2; + const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr + const b = Number.parseInt(h, 16); // byte, created from string part + if (Number.isNaN(b) || b < 0) + err('hex invalid 2'); // byte must be valid 0 <= byte < 256 + arr[i] = b; + } + return arr; +}; +const n2b_32LE = (num) => h2b(padh(num, 32 * 2)).reverse(); // number to bytes LE +const b2n_LE = (b) => BigInt('0x' + b2h(u8n(au8(b)).reverse())); // bytes LE to num +const concatB = (...arrs) => { + const r = u8n(arrs.reduce((sum, a) => sum + au8(a).length, 0)); // create u8a of summed length + let pad = 0; // walk through each array, + arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type + return r; +}; +const invert = (num, md = P) => { + if (num === 0n || md <= 0n) + err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now + let a = mod(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n; + while (a !== 0n) { // uses euclidean gcd algorithm + const q = b / a, r = b % a; // not constant-time + const m = x - u * q, n = y - v * q; + b = a, a = r, x = u, y = v, u = m, v = n; + } + return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point +}; +const pow2 = (x, power) => { + let r = x; + while (power-- > 0n) { + r *= r; + r %= P; + } + return r; +}; +const pow_2_252_3 = (x) => { + const x2 = (x * x) % P; // x^2, bits 1 + const b2 = (x2 * x) % P; // x^3, bits 11 + const b4 = (pow2(b2, 2n) * b2) % P; // x^(2^4-1), bits 1111 + const b5 = (pow2(b4, 1n) * x) % P; // x^(2^5-1), bits 11111 + const b10 = (pow2(b5, 5n) * b5) % P; // x^(2^10) + const b20 = (pow2(b10, 10n) * b10) % P; // x^(2^20) + const b40 = (pow2(b20, 20n) * b20) % P; // x^(2^40) + const b80 = (pow2(b40, 40n) * b40) % P; // x^(2^80) + const b160 = (pow2(b80, 80n) * b80) % P; // x^(2^160) + const b240 = (pow2(b160, 80n) * b80) % P; // x^(2^240) + const b250 = (pow2(b240, 10n) * b10) % P; // x^(2^250) + const pow_p_5_8 = (pow2(b250, 2n) * x) % P; // < To pow to (p+3)/8, multiply it by x. + return { pow_p_5_8, b2 }; +}; +const RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n; // √-1 +const uvRatio = (u, v) => { + const v3 = mod(v * v * v); // v³ + const v7 = mod(v3 * v3 * v); // v⁷ + const pow = pow_2_252_3(u * v7).pow_p_5_8; // (uv⁷)^(p-5)/8 + let x = mod(u * v3 * pow); // (uv³)(uv⁷)^(p-5)/8 + const vx2 = mod(v * x * x); // vx² + const root1 = x; // First root candidate + const root2 = mod(x * RM1); // Second root candidate; RM1 is √-1 + const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root + const useRoot2 = vx2 === mod(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4) + const noRoot = vx2 === mod(-u * RM1); // There is no valid root, vx² = -u√-1 + if (useRoot1) + x = root1; + if (useRoot2 || noRoot) + x = root2; // We return root2 anyway, for const-time + if ((mod(x) & 1n) === 1n) + x = mod(-x); // edIsNegative + return { isValid: useRoot1 || useRoot2, value: x }; +}; +const modL_LE = (hash) => mod(b2n_LE(hash), N); // modulo L; but little-endian +let _shaS; +const sha512a = (...m) => etc.sha512Async(...m); // Async SHA512 +const sha512s = (...m) => // Sync SHA512, not set by default + typeof _shaS === 'function' ? _shaS(...m) : err('etc.sha512Sync not set'); +const hash2extK = (hashed) => { + const head = hashed.slice(0, 32); // slice creates a copy, unlike subarray + head[0] &= 248; // Clamp bits: 0b1111_1000, + head[31] &= 127; // 0b0111_1111, + head[31] |= 64; // 0b0100_0000 + const prefix = hashed.slice(32, 64); // private key "prefix" + const scalar = modL_LE(head); // modular division over curve order + const point = G.mul(scalar); // public key point + const pointBytes = point.toRawBytes(); // point serialized to Uint8Array + return { head, prefix, scalar, point, pointBytes }; +}; +// RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point. +const getExtendedPublicKeyAsync = (priv) => sha512a(toU8(priv, 32)).then(hash2extK); +const getExtendedPublicKey = (priv) => hash2extK(sha512s(toU8(priv, 32))); +const getPublicKeyAsync = (priv) => getExtendedPublicKeyAsync(priv).then(p => p.pointBytes); +const getPublicKey = (priv) => getExtendedPublicKey(priv).pointBytes; +function hashFinish(asynchronous, res) { + if (asynchronous) + return sha512a(res.hashable).then(res.finish); + return res.finish(sha512s(res.hashable)); +} +const _sign = (e, rBytes, msg) => { + const { pointBytes: P, scalar: s } = e; + const r = modL_LE(rBytes); // r was created outside, reduce it modulo L + const R = G.mul(r).toRawBytes(); // R = [r]B + const hashable = concatB(R, P, msg); // dom2(F, C) || R || A || PH(M) + const finish = (hashed) => { + const S = mod(r + modL_LE(hashed) * s, N); // S = (r + k * s) mod L; 0 <= s < l + return au8(concatB(R, n2b_32LE(S)), 64); // 64-byte sig: 32b R.x + 32b LE(S) + }; + return { hashable, finish }; +}; +const signAsync = async (msg, privKey) => { + const m = toU8(msg); // RFC8032 5.1.6: sign msg with key async + const e = await getExtendedPublicKeyAsync(privKey); // pub,prfx + const rBytes = await sha512a(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) + return hashFinish(true, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature +}; +const sign = (msg, privKey) => { + const m = toU8(msg); // RFC8032 5.1.6: sign msg with key sync + const e = getExtendedPublicKey(privKey); // pub,prfx + const rBytes = sha512s(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) + return hashFinish(false, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature +}; +const _verify = (sig, msg, pub) => { + msg = toU8(msg); // Message hex str/Bytes + sig = toU8(sig, 64); // Signature hex str/Bytes, must be 64 bytes + const A = Point.fromHex(pub, false); // public key A decoded + const R = Point.fromHex(sig.slice(0, 32), false); // 0 <= R < 2^256: ZIP215 R can be >= P + const s = b2n_LE(sig.slice(32, 64)); // Decode second half as an integer S + const SB = G.mul(s, false); // in the range 0 <= s < L + const hashable = concatB(R.toRawBytes(), A.toRawBytes(), msg); // dom2(F, C) || R || A || PH(M) + const finish = (hashed) => { + const k = modL_LE(hashed); // decode in little-endian, modulo L + const RkA = R.add(A.mul(k, false)); // [8]R + [8][k]A' + return RkA.add(SB.negate()).clearCofactor().is0(); // [8][S]B = [8]R + [8][k]A' + }; + return { hashable, finish }; +}; +// RFC8032 5.1.7: verification async, sync +const verifyAsync = async (s, m, p) => hashFinish(true, _verify(s, m, p)); +const verify = (s, m, p) => hashFinish(false, _verify(s, m, p)); +const cr = () => // We support: 1) browsers 2) node.js 19+ + typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; +const etc = { + bytesToHex: b2h, hexToBytes: h2b, concatBytes: concatB, + mod, invert, + randomBytes: (len) => { + const crypto = cr(); // Can be shimmed in node.js <= 18 to prevent error: + // import { webcrypto } from 'node:crypto'; + // if (!globalThis.crypto) globalThis.crypto = webcrypto; + if (!crypto) + err('crypto.getRandomValues must be defined'); + return crypto.getRandomValues(u8n(len)); + }, + sha512Async: async (...messages) => { + const crypto = cr(); + if (!crypto) + err('crypto.subtle or etc.sha512Async must be defined'); + const m = concatB(...messages); + return u8n(await crypto.subtle.digest('SHA-512', m.buffer)); + }, + sha512Sync: undefined, // Actual logic below +}; +Object.defineProperties(etc, { sha512Sync: { + configurable: false, get() { return _shaS; }, set(f) { if (!_shaS) + _shaS = f; }, + } }); +const utils = { + getExtendedPublicKeyAsync, getExtendedPublicKey, + randomPrivateKey: () => etc.randomBytes(32), + precompute(w = 8, p = G) { p.multiply(3n); return p; }, // no-op +}; +const W = 8; // Precomputes-related code. W = window size +const precompute = () => { + const points = []; // 10x sign(), 2x verify(). To achieve this, + const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate + let p = G, b = p; // a lot of points related to base point G. + for (let w = 0; w < windows; w++) { // Points are stored in array and used + b = p; // any time Gx multiplication is done. + points.push(b); // They consume 16-32 MiB of RAM. + for (let i = 1; i < 2 ** (W - 1); i++) { + b = b.add(p); + points.push(b); + } + p = b.double(); // Precomputes don't speed-up getSharedKey, + } // which multiplies user point by scalar, + return points; // when precomputes are using base point +}; +const wNAF = (n) => { + // Compared to other point mult methods, + const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction + const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate + let p = I, f = G; // f must be G, or could become I in the end + const windows = 1 + 256 / W; // W=8 17 windows + const wsize = 2 ** (W - 1); // W=8 128 window size + const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111 + const maxNum = 2 ** W; // W=8 256 + const shiftBy = BigInt(W); // W=8 8 + for (let w = 0; w < windows; w++) { + const off = w * wsize; + let wbits = Number(n & mask); // extract W bits. + n >>= shiftBy; // shift number by W bits. + if (wbits > wsize) { + wbits -= maxNum; + n += 1n; + } // split if bits > max: +224 => 256-32 + const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both + const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both + if (wbits === 0) { + f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point + } + else { // ^ can't add off2, off2 = I + p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point + } + } + return { p, f }; // return both real and fake points for JIT +}; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul() + // envs like browser console + + +/***/ }), + +/***/ 3440: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/bags/key_bag.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KeyBag: () => (/* binding */ KeyBag) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_pkcs8__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-pkcs8 */ 6304); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + + +let KeyBag = class KeyBag extends _peculiar_asn1_pkcs8__WEBPACK_IMPORTED_MODULE_1__.PrivateKeyInfo { +}; +KeyBag = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnTypeTypes.Sequence }) +], KeyBag); + + + +/***/ }), + +/***/ 3598: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/des.js@1.1.0/node_modules/des.js/lib/des/des.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); +var inherits = __webpack_require__(/*! inherits */ 18628); + +var utils = __webpack_require__(/*! ./utils */ 66895); +var Cipher = __webpack_require__(/*! ./cipher */ 30499); + +function DESState() { + this.tmp = new Array(2); + this.keys = null; +} + +function DES(options) { + Cipher.call(this, options); + + var state = new DESState(); + this._desState = state; + + this.deriveKeys(state, options.key); +} +inherits(DES, Cipher); +module.exports = DES; + +DES.create = function create(options) { + return new DES(options); +}; + +var shiftTable = [ + 1, 1, 2, 2, 2, 2, 2, 2, + 1, 2, 2, 2, 2, 2, 2, 1 +]; + +DES.prototype.deriveKeys = function deriveKeys(state, key) { + state.keys = new Array(16 * 2); + + assert.equal(key.length, this.blockSize, 'Invalid key length'); + + var kL = utils.readUInt32BE(key, 0); + var kR = utils.readUInt32BE(key, 4); + + utils.pc1(kL, kR, state.tmp, 0); + kL = state.tmp[0]; + kR = state.tmp[1]; + for (var i = 0; i < state.keys.length; i += 2) { + var shift = shiftTable[i >>> 1]; + kL = utils.r28shl(kL, shift); + kR = utils.r28shl(kR, shift); + utils.pc2(kL, kR, state.keys, i); + } +}; + +DES.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._desState; + + var l = utils.readUInt32BE(inp, inOff); + var r = utils.readUInt32BE(inp, inOff + 4); + + // Initial Permutation + utils.ip(l, r, state.tmp, 0); + l = state.tmp[0]; + r = state.tmp[1]; + + if (this.type === 'encrypt') + this._encrypt(state, l, r, state.tmp, 0); + else + this._decrypt(state, l, r, state.tmp, 0); + + l = state.tmp[0]; + r = state.tmp[1]; + + utils.writeUInt32BE(out, l, outOff); + utils.writeUInt32BE(out, r, outOff + 4); +}; + +DES.prototype._pad = function _pad(buffer, off) { + if (this.padding === false) { + return false; + } + + var value = buffer.length - off; + for (var i = off; i < buffer.length; i++) + buffer[i] = value; + + return true; +}; + +DES.prototype._unpad = function _unpad(buffer) { + if (this.padding === false) { + return buffer; + } + + var pad = buffer[buffer.length - 1]; + for (var i = buffer.length - pad; i < buffer.length; i++) + assert.equal(buffer[i], pad); + + return buffer.slice(0, buffer.length - pad); +}; + +DES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) { + var l = lStart; + var r = rStart; + + // Apply f() x16 times + for (var i = 0; i < state.keys.length; i += 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(r, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = r; + r = (l ^ f) >>> 0; + l = t; + } + + // Reverse Initial Permutation + utils.rip(r, l, out, off); +}; + +DES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) { + var l = rStart; + var r = lStart; + + // Apply f() x16 times + for (var i = state.keys.length - 2; i >= 0; i -= 2) { + var keyL = state.keys[i]; + var keyR = state.keys[i + 1]; + + // f(r, k) + utils.expand(l, state.tmp, 0); + + keyL ^= state.tmp[0]; + keyR ^= state.tmp[1]; + var s = utils.substitute(keyL, keyR); + var f = utils.permute(s); + + var t = l; + l = (r ^ f) >>> 0; + r = t; + } + + // Reverse Initial Permutation + utils.rip(l, r, out, off); +}; + + +/***/ }), + +/***/ 3619: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/curve/mont.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ 27019); +var inherits = __webpack_require__(/*! inherits */ 18628); +var Base = __webpack_require__(/*! ./base */ 3164); + +var utils = __webpack_require__(/*! ../utils */ 28432); + +function MontCurve(conf) { + Base.call(this, 'mont', conf); + + this.a = new BN(conf.a, 16).toRed(this.red); + this.b = new BN(conf.b, 16).toRed(this.red); + this.i4 = new BN(4).toRed(this.red).redInvm(); + this.two = new BN(2).toRed(this.red); + this.a24 = this.i4.redMul(this.a.redAdd(this.two)); +} +inherits(MontCurve, Base); +module.exports = MontCurve; + +MontCurve.prototype.validate = function validate(point) { + var x = point.normalize().x; + var x2 = x.redSqr(); + var rhs = x2.redMul(x).redAdd(x2.redMul(this.a)).redAdd(x); + var y = rhs.redSqrt(); + + return y.redSqr().cmp(rhs) === 0; +}; + +function Point(curve, x, z) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && z === null) { + this.x = this.curve.one; + this.z = this.curve.zero; + } else { + this.x = new BN(x, 16); + this.z = new BN(z, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + } +} +inherits(Point, Base.BasePoint); + +MontCurve.prototype.decodePoint = function decodePoint(bytes, enc) { + return this.point(utils.toArray(bytes, enc), 1); +}; + +MontCurve.prototype.point = function point(x, z) { + return new Point(this, x, z); +}; + +MontCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +Point.prototype.precompute = function precompute() { + // No-op +}; + +Point.prototype._encode = function _encode() { + return this.getX().toArray('be', this.curve.p.byteLength()); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1] || curve.one); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.z.cmpn(0) === 0; +}; + +Point.prototype.dbl = function dbl() { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#doubling-dbl-1987-m-3 + // 2M + 2S + 4A + + // A = X1 + Z1 + var a = this.x.redAdd(this.z); + // AA = A^2 + var aa = a.redSqr(); + // B = X1 - Z1 + var b = this.x.redSub(this.z); + // BB = B^2 + var bb = b.redSqr(); + // C = AA - BB + var c = aa.redSub(bb); + // X3 = AA * BB + var nx = aa.redMul(bb); + // Z3 = C * (BB + A24 * C) + var nz = c.redMul(bb.redAdd(this.curve.a24.redMul(c))); + return this.curve.point(nx, nz); +}; + +Point.prototype.add = function add() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.diffAdd = function diffAdd(p, diff) { + // http://hyperelliptic.org/EFD/g1p/auto-montgom-xz.html#diffadd-dadd-1987-m-3 + // 4M + 2S + 6A + + // A = X2 + Z2 + var a = this.x.redAdd(this.z); + // B = X2 - Z2 + var b = this.x.redSub(this.z); + // C = X3 + Z3 + var c = p.x.redAdd(p.z); + // D = X3 - Z3 + var d = p.x.redSub(p.z); + // DA = D * A + var da = d.redMul(a); + // CB = C * B + var cb = c.redMul(b); + // X5 = Z1 * (DA + CB)^2 + var nx = diff.z.redMul(da.redAdd(cb).redSqr()); + // Z5 = X1 * (DA - CB)^2 + var nz = diff.x.redMul(da.redISub(cb).redSqr()); + return this.curve.point(nx, nz); +}; + +Point.prototype.mul = function mul(k) { + var t = k.clone(); + var a = this; // (N / 2) * Q + Q + var b = this.curve.point(null, null); // (N / 2) * Q + var c = this; // Q + + for (var bits = []; t.cmpn(0) !== 0; t.iushrn(1)) + bits.push(t.andln(1)); + + for (var i = bits.length - 1; i >= 0; i--) { + if (bits[i] === 0) { + // N * Q + Q = ((N / 2) * Q + Q)) + (N / 2) * Q + a = a.diffAdd(b, c); + // N * Q = 2 * ((N / 2) * Q + Q)) + b = b.dbl(); + } else { + // N * Q = ((N / 2) * Q + Q) + ((N / 2) * Q) + b = a.diffAdd(b, c); + // N * Q + Q = 2 * ((N / 2) * Q + Q) + a = a.dbl(); + } + } + return b; +}; + +Point.prototype.mulAdd = function mulAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.jumlAdd = function jumlAdd() { + throw new Error('Not supported on Montgomery curve'); +}; + +Point.prototype.eq = function eq(other) { + return this.getX().cmp(other.getX()) === 0; +}; + +Point.prototype.normalize = function normalize() { + this.x = this.x.redMul(this.z.redInvm()); + this.z = this.curve.one; + return this; +}; + +Point.prototype.getX = function getX() { + // Normalize coordinates + this.normalize(); + + return this.x.fromRed(); +}; + + +/***/ }), + +/***/ 3763: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/abs.js ***! + \***************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./abs')} */ +module.exports = Math.abs; + + +/***/ }), + +/***/ 3944: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/errors/index.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnSchemaValidationError: () => (/* reexport safe */ _schema_validation_js__WEBPACK_IMPORTED_MODULE_0__.AsnSchemaValidationError) +/* harmony export */ }); +/* harmony import */ var _schema_validation_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./schema_validation.js */ 43723); + + + +/***/ }), + +/***/ 4176: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-ecc@2.8.0/node_modules/@peculiar/asn1-ecc/build/es2015/index.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Curve: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.Curve), +/* harmony export */ ECDSASigValue: () => (/* reexport safe */ _ec_signature_value_js__WEBPACK_IMPORTED_MODULE_3__.ECDSASigValue), +/* harmony export */ ECPVer: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.ECPVer), +/* harmony export */ ECParameters: () => (/* reexport safe */ _ec_parameters_js__WEBPACK_IMPORTED_MODULE_1__.ECParameters), +/* harmony export */ ECPoint: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.ECPoint), +/* harmony export */ ECPrivateKey: () => (/* reexport safe */ _ec_private_key_js__WEBPACK_IMPORTED_MODULE_2__.ECPrivateKey), +/* harmony export */ FieldElement: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.FieldElement), +/* harmony export */ FieldID: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.FieldID), +/* harmony export */ SpecifiedECDomain: () => (/* reexport safe */ _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__.SpecifiedECDomain), +/* harmony export */ ecdsaWithSHA1: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_0__.ecdsaWithSHA1), +/* harmony export */ ecdsaWithSHA224: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_0__.ecdsaWithSHA224), +/* harmony export */ ecdsaWithSHA256: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_0__.ecdsaWithSHA256), +/* harmony export */ ecdsaWithSHA384: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_0__.ecdsaWithSHA384), +/* harmony export */ ecdsaWithSHA512: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_0__.ecdsaWithSHA512), +/* harmony export */ id_ecDH: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecDH), +/* harmony export */ id_ecMQV: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecMQV), +/* harmony export */ id_ecPublicKey: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecPublicKey), +/* harmony export */ id_ecdsaWithSHA1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecdsaWithSHA1), +/* harmony export */ id_ecdsaWithSHA224: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecdsaWithSHA224), +/* harmony export */ id_ecdsaWithSHA256: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecdsaWithSHA256), +/* harmony export */ id_ecdsaWithSHA384: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecdsaWithSHA384), +/* harmony export */ id_ecdsaWithSHA512: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ecdsaWithSHA512), +/* harmony export */ id_secp192r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_secp192r1), +/* harmony export */ id_secp224r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_secp224r1), +/* harmony export */ id_secp256r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_secp256r1), +/* harmony export */ id_secp384r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_secp384r1), +/* harmony export */ id_secp521r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_secp521r1), +/* harmony export */ id_sect163k1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect163k1), +/* harmony export */ id_sect163r2: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect163r2), +/* harmony export */ id_sect233k1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect233k1), +/* harmony export */ id_sect233r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect233r1), +/* harmony export */ id_sect283k1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect283k1), +/* harmony export */ id_sect283r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect283r1), +/* harmony export */ id_sect409k1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect409k1), +/* harmony export */ id_sect409r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect409r1), +/* harmony export */ id_sect571k1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect571k1), +/* harmony export */ id_sect571r1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_sect571r1) +/* harmony export */ }); +/* harmony import */ var _algorithms_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./algorithms.js */ 12776); +/* harmony import */ var _ec_parameters_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ec_parameters.js */ 91229); +/* harmony import */ var _ec_private_key_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ec_private_key.js */ 47090); +/* harmony import */ var _ec_signature_value_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ec_signature_value.js */ 93917); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./object_identifiers.js */ 75958); +/* harmony import */ var _rfc3279_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rfc3279.js */ 36480); + + + + + + + + +/***/ }), + +/***/ 4610: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/borsh@0.7.0/node_modules/borsh/lib/index.js ***! + \*************************************************************************/ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +}; +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.deserializeUnchecked = exports.deserialize = exports.serialize = exports.BinaryReader = exports.BinaryWriter = exports.BorshError = exports.baseDecode = exports.baseEncode = void 0; +const bn_js_1 = __importDefault(__webpack_require__(/*! bn.js */ 40113)); +const bs58_1 = __importDefault(__webpack_require__(/*! bs58 */ 34318)); +// TODO: Make sure this polyfill not included when not required +const encoding = __importStar(__webpack_require__(/*! text-encoding-utf-8 */ 70148)); +const ResolvedTextDecoder = typeof TextDecoder !== "function" ? encoding.TextDecoder : TextDecoder; +const textDecoder = new ResolvedTextDecoder("utf-8", { fatal: true }); +function baseEncode(value) { + if (typeof value === "string") { + value = Buffer.from(value, "utf8"); + } + return bs58_1.default.encode(Buffer.from(value)); +} +exports.baseEncode = baseEncode; +function baseDecode(value) { + return Buffer.from(bs58_1.default.decode(value)); +} +exports.baseDecode = baseDecode; +const INITIAL_LENGTH = 1024; +class BorshError extends Error { + constructor(message) { + super(message); + this.fieldPath = []; + this.originalMessage = message; + } + addToFieldPath(fieldName) { + this.fieldPath.splice(0, 0, fieldName); + // NOTE: Modifying message directly as jest doesn't use .toString() + this.message = this.originalMessage + ": " + this.fieldPath.join("."); + } +} +exports.BorshError = BorshError; +/// Binary encoder. +class BinaryWriter { + constructor() { + this.buf = Buffer.alloc(INITIAL_LENGTH); + this.length = 0; + } + maybeResize() { + if (this.buf.length < 16 + this.length) { + this.buf = Buffer.concat([this.buf, Buffer.alloc(INITIAL_LENGTH)]); + } + } + writeU8(value) { + this.maybeResize(); + this.buf.writeUInt8(value, this.length); + this.length += 1; + } + writeU16(value) { + this.maybeResize(); + this.buf.writeUInt16LE(value, this.length); + this.length += 2; + } + writeU32(value) { + this.maybeResize(); + this.buf.writeUInt32LE(value, this.length); + this.length += 4; + } + writeU64(value) { + this.maybeResize(); + this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray("le", 8))); + } + writeU128(value) { + this.maybeResize(); + this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray("le", 16))); + } + writeU256(value) { + this.maybeResize(); + this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray("le", 32))); + } + writeU512(value) { + this.maybeResize(); + this.writeBuffer(Buffer.from(new bn_js_1.default(value).toArray("le", 64))); + } + writeBuffer(buffer) { + // Buffer.from is needed as this.buf.subarray can return plain Uint8Array in browser + this.buf = Buffer.concat([ + Buffer.from(this.buf.subarray(0, this.length)), + buffer, + Buffer.alloc(INITIAL_LENGTH), + ]); + this.length += buffer.length; + } + writeString(str) { + this.maybeResize(); + const b = Buffer.from(str, "utf8"); + this.writeU32(b.length); + this.writeBuffer(b); + } + writeFixedArray(array) { + this.writeBuffer(Buffer.from(array)); + } + writeArray(array, fn) { + this.maybeResize(); + this.writeU32(array.length); + for (const elem of array) { + this.maybeResize(); + fn(elem); + } + } + toArray() { + return this.buf.subarray(0, this.length); + } +} +exports.BinaryWriter = BinaryWriter; +function handlingRangeError(target, propertyKey, propertyDescriptor) { + const originalMethod = propertyDescriptor.value; + propertyDescriptor.value = function (...args) { + try { + return originalMethod.apply(this, args); + } + catch (e) { + if (e instanceof RangeError) { + const code = e.code; + if (["ERR_BUFFER_OUT_OF_BOUNDS", "ERR_OUT_OF_RANGE"].indexOf(code) >= 0) { + throw new BorshError("Reached the end of buffer when deserializing"); + } + } + throw e; + } + }; +} +class BinaryReader { + constructor(buf) { + this.buf = buf; + this.offset = 0; + } + readU8() { + const value = this.buf.readUInt8(this.offset); + this.offset += 1; + return value; + } + readU16() { + const value = this.buf.readUInt16LE(this.offset); + this.offset += 2; + return value; + } + readU32() { + const value = this.buf.readUInt32LE(this.offset); + this.offset += 4; + return value; + } + readU64() { + const buf = this.readBuffer(8); + return new bn_js_1.default(buf, "le"); + } + readU128() { + const buf = this.readBuffer(16); + return new bn_js_1.default(buf, "le"); + } + readU256() { + const buf = this.readBuffer(32); + return new bn_js_1.default(buf, "le"); + } + readU512() { + const buf = this.readBuffer(64); + return new bn_js_1.default(buf, "le"); + } + readBuffer(len) { + if (this.offset + len > this.buf.length) { + throw new BorshError(`Expected buffer length ${len} isn't within bounds`); + } + const result = this.buf.slice(this.offset, this.offset + len); + this.offset += len; + return result; + } + readString() { + const len = this.readU32(); + const buf = this.readBuffer(len); + try { + // NOTE: Using TextDecoder to fail on invalid UTF-8 + return textDecoder.decode(buf); + } + catch (e) { + throw new BorshError(`Error decoding UTF-8 string: ${e}`); + } + } + readFixedArray(len) { + return new Uint8Array(this.readBuffer(len)); + } + readArray(fn) { + const len = this.readU32(); + const result = Array(); + for (let i = 0; i < len; ++i) { + result.push(fn()); + } + return result; + } +} +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU8", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU16", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU32", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU64", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU128", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU256", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readU512", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readString", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readFixedArray", null); +__decorate([ + handlingRangeError +], BinaryReader.prototype, "readArray", null); +exports.BinaryReader = BinaryReader; +function capitalizeFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} +function serializeField(schema, fieldName, value, fieldType, writer) { + try { + // TODO: Handle missing values properly (make sure they never result in just skipped write) + if (typeof fieldType === "string") { + writer[`write${capitalizeFirstLetter(fieldType)}`](value); + } + else if (fieldType instanceof Array) { + if (typeof fieldType[0] === "number") { + if (value.length !== fieldType[0]) { + throw new BorshError(`Expecting byte array of length ${fieldType[0]}, but got ${value.length} bytes`); + } + writer.writeFixedArray(value); + } + else if (fieldType.length === 2 && typeof fieldType[1] === "number") { + if (value.length !== fieldType[1]) { + throw new BorshError(`Expecting byte array of length ${fieldType[1]}, but got ${value.length} bytes`); + } + for (let i = 0; i < fieldType[1]; i++) { + serializeField(schema, null, value[i], fieldType[0], writer); + } + } + else { + writer.writeArray(value, (item) => { + serializeField(schema, fieldName, item, fieldType[0], writer); + }); + } + } + else if (fieldType.kind !== undefined) { + switch (fieldType.kind) { + case "option": { + if (value === null || value === undefined) { + writer.writeU8(0); + } + else { + writer.writeU8(1); + serializeField(schema, fieldName, value, fieldType.type, writer); + } + break; + } + case "map": { + writer.writeU32(value.size); + value.forEach((val, key) => { + serializeField(schema, fieldName, key, fieldType.key, writer); + serializeField(schema, fieldName, val, fieldType.value, writer); + }); + break; + } + default: + throw new BorshError(`FieldType ${fieldType} unrecognized`); + } + } + else { + serializeStruct(schema, value, writer); + } + } + catch (error) { + if (error instanceof BorshError) { + error.addToFieldPath(fieldName); + } + throw error; + } +} +function serializeStruct(schema, obj, writer) { + if (typeof obj.borshSerialize === "function") { + obj.borshSerialize(writer); + return; + } + const structSchema = schema.get(obj.constructor); + if (!structSchema) { + throw new BorshError(`Class ${obj.constructor.name} is missing in schema`); + } + if (structSchema.kind === "struct") { + structSchema.fields.map(([fieldName, fieldType]) => { + serializeField(schema, fieldName, obj[fieldName], fieldType, writer); + }); + } + else if (structSchema.kind === "enum") { + const name = obj[structSchema.field]; + for (let idx = 0; idx < structSchema.values.length; ++idx) { + const [fieldName, fieldType] = structSchema.values[idx]; + if (fieldName === name) { + writer.writeU8(idx); + serializeField(schema, fieldName, obj[fieldName], fieldType, writer); + break; + } + } + } + else { + throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${obj.constructor.name}`); + } +} +/// Serialize given object using schema of the form: +/// { class_name -> [ [field_name, field_type], .. ], .. } +function serialize(schema, obj, Writer = BinaryWriter) { + const writer = new Writer(); + serializeStruct(schema, obj, writer); + return writer.toArray(); +} +exports.serialize = serialize; +function deserializeField(schema, fieldName, fieldType, reader) { + try { + if (typeof fieldType === "string") { + return reader[`read${capitalizeFirstLetter(fieldType)}`](); + } + if (fieldType instanceof Array) { + if (typeof fieldType[0] === "number") { + return reader.readFixedArray(fieldType[0]); + } + else if (typeof fieldType[1] === "number") { + const arr = []; + for (let i = 0; i < fieldType[1]; i++) { + arr.push(deserializeField(schema, null, fieldType[0], reader)); + } + return arr; + } + else { + return reader.readArray(() => deserializeField(schema, fieldName, fieldType[0], reader)); + } + } + if (fieldType.kind === "option") { + const option = reader.readU8(); + if (option) { + return deserializeField(schema, fieldName, fieldType.type, reader); + } + return undefined; + } + if (fieldType.kind === "map") { + let map = new Map(); + const length = reader.readU32(); + for (let i = 0; i < length; i++) { + const key = deserializeField(schema, fieldName, fieldType.key, reader); + const val = deserializeField(schema, fieldName, fieldType.value, reader); + map.set(key, val); + } + return map; + } + return deserializeStruct(schema, fieldType, reader); + } + catch (error) { + if (error instanceof BorshError) { + error.addToFieldPath(fieldName); + } + throw error; + } +} +function deserializeStruct(schema, classType, reader) { + if (typeof classType.borshDeserialize === "function") { + return classType.borshDeserialize(reader); + } + const structSchema = schema.get(classType); + if (!structSchema) { + throw new BorshError(`Class ${classType.name} is missing in schema`); + } + if (structSchema.kind === "struct") { + const result = {}; + for (const [fieldName, fieldType] of schema.get(classType).fields) { + result[fieldName] = deserializeField(schema, fieldName, fieldType, reader); + } + return new classType(result); + } + if (structSchema.kind === "enum") { + const idx = reader.readU8(); + if (idx >= structSchema.values.length) { + throw new BorshError(`Enum index: ${idx} is out of range`); + } + const [fieldName, fieldType] = structSchema.values[idx]; + const fieldValue = deserializeField(schema, fieldName, fieldType, reader); + return new classType({ [fieldName]: fieldValue }); + } + throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${classType.constructor.name}`); +} +/// Deserializes object from bytes using schema. +function deserialize(schema, classType, buffer, Reader = BinaryReader) { + const reader = new Reader(buffer); + const result = deserializeStruct(schema, classType, reader); + if (reader.offset < buffer.length) { + throw new BorshError(`Unexpected ${buffer.length - reader.offset} bytes after deserialized data`); + } + return result; +} +exports.deserialize = deserialize; +/// Deserializes object from bytes using schema, without checking the length read +function deserializeUnchecked(schema, classType, buffer, Reader = BinaryReader) { + const reader = new Reader(buffer); + return deserializeStruct(schema, classType, reader); +} +exports.deserializeUnchecked = deserializeUnchecked; + + +/***/ }), + +/***/ 4678: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/types/disposable.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isDisposable: () => (/* binding */ isDisposable) +/* harmony export */ }); +function isDisposable(value) { + if (typeof value.dispose !== "function") + return false; + var disposeFun = value.dispose; + if (disposeFun.length > 0) { + return false; + } + return true; +} + + +/***/ }), + +/***/ 4695: +/*!*******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/key_agree_recipient_info.js ***! + \*******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KeyAgreeRecipientIdentifier: () => (/* binding */ KeyAgreeRecipientIdentifier), +/* harmony export */ KeyAgreeRecipientInfo: () => (/* binding */ KeyAgreeRecipientInfo), +/* harmony export */ OriginatorIdentifierOrKey: () => (/* binding */ OriginatorIdentifierOrKey), +/* harmony export */ OriginatorPublicKey: () => (/* binding */ OriginatorPublicKey), +/* harmony export */ RecipientEncryptedKey: () => (/* binding */ RecipientEncryptedKey), +/* harmony export */ RecipientEncryptedKeys: () => (/* binding */ RecipientEncryptedKeys), +/* harmony export */ RecipientKeyIdentifier: () => (/* binding */ RecipientKeyIdentifier) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ 96729); +/* harmony import */ var _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./issuer_and_serial_number.js */ 14164); +/* harmony import */ var _other_key_attribute_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./other_key_attribute.js */ 79257); +var RecipientEncryptedKeys_1; + + + + + + +class RecipientKeyIdentifier { + subjectKeyIdentifier = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectKeyIdentifier(); + date; + other; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectKeyIdentifier }) +], RecipientKeyIdentifier.prototype, "subjectKeyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralizedTime, optional: true, + }) +], RecipientKeyIdentifier.prototype, "date", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _other_key_attribute_js__WEBPACK_IMPORTED_MODULE_5__.OtherKeyAttribute, optional: true, + }) +], RecipientKeyIdentifier.prototype, "other", void 0); +let KeyAgreeRecipientIdentifier = class KeyAgreeRecipientIdentifier { + rKeyId; + issuerAndSerialNumber; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: RecipientKeyIdentifier, context: 0, implicit: true, optional: true, + }) +], KeyAgreeRecipientIdentifier.prototype, "rKeyId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_4__.IssuerAndSerialNumber, optional: true, + }) +], KeyAgreeRecipientIdentifier.prototype, "issuerAndSerialNumber", void 0); +KeyAgreeRecipientIdentifier = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], KeyAgreeRecipientIdentifier); + +class RecipientEncryptedKey { + rid = new KeyAgreeRecipientIdentifier(); + encryptedKey = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: KeyAgreeRecipientIdentifier }) +], RecipientEncryptedKey.prototype, "rid", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], RecipientEncryptedKey.prototype, "encryptedKey", void 0); +let RecipientEncryptedKeys = RecipientEncryptedKeys_1 = class RecipientEncryptedKeys extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, RecipientEncryptedKeys_1.prototype); + } +}; +RecipientEncryptedKeys = RecipientEncryptedKeys_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: RecipientEncryptedKey, + }) +], RecipientEncryptedKeys); + +class OriginatorPublicKey { + algorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + publicKey = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], OriginatorPublicKey.prototype, "algorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString }) +], OriginatorPublicKey.prototype, "publicKey", void 0); +let OriginatorIdentifierOrKey = class OriginatorIdentifierOrKey { + subjectKeyIdentifier; + originatorKey; + issuerAndSerialNumber; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectKeyIdentifier, context: 0, implicit: true, optional: true, + }) +], OriginatorIdentifierOrKey.prototype, "subjectKeyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: OriginatorPublicKey, context: 1, implicit: true, optional: true, + }) +], OriginatorIdentifierOrKey.prototype, "originatorKey", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_4__.IssuerAndSerialNumber, optional: true, + }) +], OriginatorIdentifierOrKey.prototype, "issuerAndSerialNumber", void 0); +OriginatorIdentifierOrKey = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], OriginatorIdentifierOrKey); + +class KeyAgreeRecipientInfo { + version = _types_js__WEBPACK_IMPORTED_MODULE_3__.CMSVersion.v3; + originator = new OriginatorIdentifierOrKey(); + ukm; + keyEncryptionAlgorithm = new _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier(); + recipientEncryptedKeys = new RecipientEncryptedKeys(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], KeyAgreeRecipientInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: OriginatorIdentifierOrKey, context: 0, + }) +], KeyAgreeRecipientInfo.prototype, "originator", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString, context: 1, optional: true, + }) +], KeyAgreeRecipientInfo.prototype, "ukm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier }) +], KeyAgreeRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: RecipientEncryptedKeys }) +], KeyAgreeRecipientInfo.prototype, "recipientEncryptedKeys", void 0); + + +/***/ }), + +/***/ 4754: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/extended_key_usage.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ExtendedKeyUsage: () => (/* binding */ ExtendedKeyUsage), +/* harmony export */ anyExtendedKeyUsage: () => (/* binding */ anyExtendedKeyUsage), +/* harmony export */ id_ce_extKeyUsage: () => (/* binding */ id_ce_extKeyUsage), +/* harmony export */ id_kp_OCSPSigning: () => (/* binding */ id_kp_OCSPSigning), +/* harmony export */ id_kp_clientAuth: () => (/* binding */ id_kp_clientAuth), +/* harmony export */ id_kp_codeSigning: () => (/* binding */ id_kp_codeSigning), +/* harmony export */ id_kp_emailProtection: () => (/* binding */ id_kp_emailProtection), +/* harmony export */ id_kp_serverAuth: () => (/* binding */ id_kp_serverAuth), +/* harmony export */ id_kp_timeStamping: () => (/* binding */ id_kp_timeStamping) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var ExtendedKeyUsage_1; + + + +const id_ce_extKeyUsage = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.37`; +let ExtendedKeyUsage = ExtendedKeyUsage_1 = class ExtendedKeyUsage extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, ExtendedKeyUsage_1.prototype); + } +}; +ExtendedKeyUsage = ExtendedKeyUsage_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier, + }) +], ExtendedKeyUsage); + +const anyExtendedKeyUsage = `${id_ce_extKeyUsage}.0`; +const id_kp_serverAuth = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.1`; +const id_kp_clientAuth = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.2`; +const id_kp_codeSigning = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.3`; +const id_kp_emailProtection = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.4`; +const id_kp_timeStamping = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.8`; +const id_kp_OCSPSigning = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_kp}.9`; + + +/***/ }), + +/***/ 5072: +/*!************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/signer_identifier.js ***! + \************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SignerIdentifier: () => (/* binding */ SignerIdentifier) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./issuer_and_serial_number.js */ 14164); + + + + +let SignerIdentifier = class SignerIdentifier { + subjectKeyIdentifier; + issuerAndSerialNumber; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectKeyIdentifier, context: 0, implicit: true, + }) +], SignerIdentifier.prototype, "subjectKeyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_3__.IssuerAndSerialNumber }) +], SignerIdentifier.prototype, "issuerAndSerialNumber", void 0); +SignerIdentifier = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], SignerIdentifier); + + + +/***/ }), + +/***/ 5125: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/streamCipher.js ***! + \**********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var aes = __webpack_require__(/*! ./aes */ 75279) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var Transform = __webpack_require__(/*! cipher-base */ 51141) +var inherits = __webpack_require__(/*! inherits */ 18628) + +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) + + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._mode = mode +} + +inherits(StreamCipher, Transform) + +StreamCipher.prototype._update = function (chunk) { + return this._mode.encrypt(this, chunk, this._decrypt) +} + +StreamCipher.prototype._final = function () { + this._cipher.scrub() +} + +module.exports = StreamCipher + + +/***/ }), + +/***/ 5222: +/*!****************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var hash = exports; + +hash.utils = __webpack_require__(/*! ./hash/utils */ 27152); +hash.common = __webpack_require__(/*! ./hash/common */ 92660); +hash.sha = __webpack_require__(/*! ./hash/sha */ 32659); +hash.ripemd = __webpack_require__(/*! ./hash/ripemd */ 47194); +hash.hmac = __webpack_require__(/*! ./hash/hmac */ 77166); + +// Proxy hash functions to the main object +hash.sha1 = hash.sha.sha1; +hash.sha256 = hash.sha.sha256; +hash.sha224 = hash.sha.sha224; +hash.sha384 = hash.sha.sha384; +hash.sha512 = hash.sha.sha512; +hash.ripemd160 = hash.ripemd.ripemd160; + + +/***/ }), + +/***/ 5330: +/*!***************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/mac_data.js ***! + \***************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ MacData: () => (/* binding */ MacData) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_rsa__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-rsa */ 14828); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + + +class MacData { + mac = new _peculiar_asn1_rsa__WEBPACK_IMPORTED_MODULE_1__.DigestInfo(); + macSalt = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.OctetString(); + iterations = 1; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnProp)({ type: _peculiar_asn1_rsa__WEBPACK_IMPORTED_MODULE_1__.DigestInfo }) +], MacData.prototype, "mac", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.OctetString }) +], MacData.prototype, "macSalt", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnPropTypes.Integer, defaultValue: 1, + }) +], MacData.prototype, "iterations", void 0); + + +/***/ }), + +/***/ 5353: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/curve/index.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var curve = exports; + +curve.base = __webpack_require__(/*! ./base */ 3164); +curve.short = __webpack_require__(/*! ./short */ 85979); +curve.mont = __webpack_require__(/*! ./mont */ 3619); +curve.edwards = __webpack_require__(/*! ./edwards */ 16577); + + +/***/ }), + +/***/ 5827: +/*!****************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/transaction/serializeAccessList.js ***! + \****************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ serializeAccessList: () => (/* binding */ serializeAccessList) +/* harmony export */ }); +/* harmony import */ var _errors_address_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/address.js */ 44876); +/* harmony import */ var _errors_transaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../errors/transaction.js */ 24092); +/* harmony import */ var _address_isAddress_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../address/isAddress.js */ 90355); + + + +/* + * Serialize an EIP-2930 access list + * @remarks + * Use to create a transaction serializer with support for EIP-2930 access lists + * + * @param accessList - Array of objects of address and arrays of Storage Keys + * @throws InvalidAddressError, InvalidStorageKeySizeError + * @returns Array of hex strings + */ +function serializeAccessList(accessList) { + if (!accessList || accessList.length === 0) + return []; + const serializedAccessList = []; + for (let i = 0; i < accessList.length; i++) { + const { address, storageKeys } = accessList[i]; + for (let j = 0; j < storageKeys.length; j++) { + if (storageKeys[j].length - 2 !== 64) { + throw new _errors_transaction_js__WEBPACK_IMPORTED_MODULE_1__.InvalidStorageKeySizeError({ storageKey: storageKeys[j] }); + } + } + if (!(0,_address_isAddress_js__WEBPACK_IMPORTED_MODULE_2__.isAddress)(address, { strict: false })) { + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_0__.InvalidAddressError({ address }); + } + serializedAccessList.push([address, storageKeys]); + } + return serializedAccessList; +} +//# sourceMappingURL=serializeAccessList.js.map + +/***/ }), + +/***/ 5851: +/*!*********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/svce_auth_info.js ***! + \*********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SvceAuthInfo: () => (/* binding */ SvceAuthInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class SvceAuthInfo { + service = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName(); + ident = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName(); + authInfo; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName }) +], SvceAuthInfo.prototype, "service", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName }) +], SvceAuthInfo.prototype, "ident", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString, optional: true, + }) +], SvceAuthInfo.prototype, "authInfo", void 0); + + +/***/ }), + +/***/ 5930: +/*!********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/private_key_usage_period.js ***! + \********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PrivateKeyUsagePeriod: () => (/* binding */ PrivateKeyUsagePeriod), +/* harmony export */ id_ce_privateKeyUsagePeriod: () => (/* binding */ id_ce_privateKeyUsagePeriod) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + +const id_ce_privateKeyUsagePeriod = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.16`; +class PrivateKeyUsagePeriod { + notBefore; + notAfter; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralizedTime, context: 0, implicit: true, optional: true, + }) +], PrivateKeyUsagePeriod.prototype, "notBefore", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralizedTime, context: 1, implicit: true, optional: true, + }) +], PrivateKeyUsagePeriod.prototype, "notAfter", void 0); + + +/***/ }), + +/***/ 6046: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bound@1.0.4/node_modules/call-bound/index.js ***! + \*******************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ 39619); + +var callBindBasic = __webpack_require__(/*! call-bind-apply-helpers */ 26948); + +/** @type {(thisArg: string, searchString: string, position?: number) => number} */ +var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]); + +/** @type {import('.')} */ +module.exports = function callBoundIntrinsic(name, allowMissing) { + /* eslint no-extra-parens: 0 */ + + var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing)); + if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { + return callBindBasic(/** @type {const} */ ([intrinsic])); + } + return intrinsic; +}; + + +/***/ }), + +/***/ 6124: +/*!******************************************************************!*\ + !*** ../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/gOPD.js ***! + \******************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./gOPD')} */ +module.exports = Object.getOwnPropertyDescriptor; + + +/***/ }), + +/***/ 6238: +/*!****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/entrust_version_info.js ***! + \****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ EntrustInfo: () => (/* binding */ EntrustInfo), +/* harmony export */ EntrustInfoFlags: () => (/* binding */ EntrustInfoFlags), +/* harmony export */ EntrustVersionInfo: () => (/* binding */ EntrustVersionInfo), +/* harmony export */ id_entrust_entrustVersInfo: () => (/* binding */ id_entrust_entrustVersInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +const id_entrust_entrustVersInfo = "1.2.840.113533.7.65.0"; +var EntrustInfoFlags; +(function (EntrustInfoFlags) { + EntrustInfoFlags[EntrustInfoFlags["keyUpdateAllowed"] = 1] = "keyUpdateAllowed"; + EntrustInfoFlags[EntrustInfoFlags["newExtensions"] = 2] = "newExtensions"; + EntrustInfoFlags[EntrustInfoFlags["pKIXCertificate"] = 4] = "pKIXCertificate"; +})(EntrustInfoFlags || (EntrustInfoFlags = {})); +class EntrustInfo extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.BitString { + toJSON() { + const res = []; + const flags = this.toNumber(); + if (flags & EntrustInfoFlags.pKIXCertificate) { + res.push("pKIXCertificate"); + } + if (flags & EntrustInfoFlags.newExtensions) { + res.push("newExtensions"); + } + if (flags & EntrustInfoFlags.keyUpdateAllowed) { + res.push("keyUpdateAllowed"); + } + return res; + } + toString() { + return `[${this.toJSON().join(", ")}]`; + } +} +class EntrustVersionInfo { + entrustVers = ""; + entrustInfoFlags = new EntrustInfo(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralString }) +], EntrustVersionInfo.prototype, "entrustVers", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: EntrustInfo }) +], EntrustVersionInfo.prototype, "entrustInfoFlags", void 0); + + +/***/ }), + +/***/ 6304: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pkcs8@2.8.0/node_modules/@peculiar/asn1-pkcs8/build/es2015/index.js ***! + \****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Attributes: () => (/* reexport safe */ _private_key_info_js__WEBPACK_IMPORTED_MODULE_1__.Attributes), +/* harmony export */ EncryptedData: () => (/* reexport safe */ _encrypted_private_key_info_js__WEBPACK_IMPORTED_MODULE_0__.EncryptedData), +/* harmony export */ EncryptedPrivateKeyInfo: () => (/* reexport safe */ _encrypted_private_key_info_js__WEBPACK_IMPORTED_MODULE_0__.EncryptedPrivateKeyInfo), +/* harmony export */ PrivateKey: () => (/* reexport safe */ _private_key_info_js__WEBPACK_IMPORTED_MODULE_1__.PrivateKey), +/* harmony export */ PrivateKeyInfo: () => (/* reexport safe */ _private_key_info_js__WEBPACK_IMPORTED_MODULE_1__.PrivateKeyInfo), +/* harmony export */ Version: () => (/* reexport safe */ _private_key_info_js__WEBPACK_IMPORTED_MODULE_1__.Version) +/* harmony export */ }); +/* harmony import */ var _encrypted_private_key_info_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./encrypted_private_key_info.js */ 62923); +/* harmony import */ var _private_key_info_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./private_key_info.js */ 97094); + + + + +/***/ }), + +/***/ 6448: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_transform.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(/*! ./_stream_duplex */ 38720); + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ 60379)); +util.inherits = __webpack_require__(/*! inherits */ 18628); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +/***/ }), + +/***/ 6613: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var toBuffer = __webpack_require__(/*! ./to-buffer */ 46827); +var Transform = (__webpack_require__(/*! readable-stream */ 2393).Transform); +var inherits = __webpack_require__(/*! inherits */ 18628); + +function HashBase(blockSize) { + Transform.call(this); + + this._block = Buffer.allocUnsafe(blockSize); + this._blockSize = blockSize; + this._blockOffset = 0; + this._length = [0, 0, 0, 0]; + + this._finalized = false; +} + +inherits(HashBase, Transform); + +HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null; + try { + this.update(chunk, encoding); + } catch (err) { + error = err; + } + + callback(error); +}; + +HashBase.prototype._flush = function (callback) { + var error = null; + try { + this.push(this.digest()); + } catch (err) { + error = err; + } + + callback(error); +}; + +HashBase.prototype.update = function (data, encoding) { + if (this._finalized) { + throw new Error('Digest already called'); + } + + var dataBuffer = toBuffer(data, encoding); // asserts correct input type + + // consume data + var block = this._block; + var offset = 0; + while (this._blockOffset + dataBuffer.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) { + block[i] = dataBuffer[offset]; + i += 1; + offset += 1; + } + this._update(); + this._blockOffset = 0; + } + while (offset < dataBuffer.length) { + block[this._blockOffset] = dataBuffer[offset]; + this._blockOffset += 1; + offset += 1; + } + + // update length + for (var j = 0, carry = dataBuffer.length * 8; carry > 0; ++j) { + this._length[j] += carry; + carry = (this._length[j] / 0x0100000000) | 0; + if (carry > 0) { + this._length[j] -= 0x0100000000 * carry; + } + } + + return this; +}; + +HashBase.prototype._update = function () { + throw new Error('_update is not implemented'); +}; + +HashBase.prototype.digest = function (encoding) { + if (this._finalized) { + throw new Error('Digest already called'); + } + this._finalized = true; + + var digest = this._digest(); + if (encoding !== undefined) { + digest = digest.toString(encoding); + } + + // reset state + this._block.fill(0); + this._blockOffset = 0; + for (var i = 0; i < 4; ++i) { + this._length[i] = 0; + } + + return digest; +}; + +HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented'); +}; + +module.exports = HashBase; + + +/***/ }), + +/***/ 6729: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/factories/index.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ instanceCachingFactory: () => (/* reexport safe */ _instance_caching_factory__WEBPACK_IMPORTED_MODULE_0__["default"]), +/* harmony export */ instancePerContainerCachingFactory: () => (/* reexport safe */ _instance_per_container_caching_factory__WEBPACK_IMPORTED_MODULE_1__["default"]), +/* harmony export */ predicateAwareClassFactory: () => (/* reexport safe */ _predicate_aware_class_factory__WEBPACK_IMPORTED_MODULE_2__["default"]) +/* harmony export */ }); +/* harmony import */ var _instance_caching_factory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./instance-caching-factory */ 72441); +/* harmony import */ var _instance_per_container_caching_factory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./instance-per-container-caching-factory */ 80841); +/* harmony import */ var _predicate_aware_class_factory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./predicate-aware-class-factory */ 71045); + + + + + +/***/ }), + +/***/ 6850: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/public-encrypt@4.0.3/node_modules/public-encrypt/privateDecrypt.js ***! + \************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var parseKeys = __webpack_require__(/*! parse-asn1 */ 15210) +var mgf = __webpack_require__(/*! ./mgf */ 41182) +var xor = __webpack_require__(/*! ./xor */ 47341) +var BN = __webpack_require__(/*! bn.js */ 27019) +var crt = __webpack_require__(/*! browserify-rsa */ 45405) +var createHash = __webpack_require__(/*! create-hash */ 88852) +var withPublic = __webpack_require__(/*! ./withPublic */ 99871) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) + +module.exports = function privateDecrypt (privateKey, enc, reverse) { + var padding + if (privateKey.padding) { + padding = privateKey.padding + } else if (reverse) { + padding = 1 + } else { + padding = 4 + } + + var key = parseKeys(privateKey) + var k = key.modulus.byteLength() + if (enc.length > k || new BN(enc).cmp(key.modulus) >= 0) { + throw new Error('decryption error') + } + var msg + if (reverse) { + msg = withPublic(new BN(enc), key) + } else { + msg = crt(enc, key) + } + var zBuffer = Buffer.alloc(k - msg.length) + msg = Buffer.concat([zBuffer, msg], k) + if (padding === 4) { + return oaep(key, msg) + } else if (padding === 1) { + return pkcs1(key, msg, reverse) + } else if (padding === 3) { + return msg + } else { + throw new Error('unknown padding') + } +} + +function oaep (key, msg) { + var k = key.modulus.byteLength() + var iHash = createHash('sha1').update(Buffer.alloc(0)).digest() + var hLen = iHash.length + if (msg[0] !== 0) { + throw new Error('decryption error') + } + var maskedSeed = msg.slice(1, hLen + 1) + var maskedDb = msg.slice(hLen + 1) + var seed = xor(maskedSeed, mgf(maskedDb, hLen)) + var db = xor(maskedDb, mgf(seed, k - hLen - 1)) + if (compare(iHash, db.slice(0, hLen))) { + throw new Error('decryption error') + } + var i = hLen + while (db[i] === 0) { + i++ + } + if (db[i++] !== 1) { + throw new Error('decryption error') + } + return db.slice(i) +} + +function pkcs1 (key, msg, reverse) { + var p1 = msg.slice(0, 2) + var i = 2 + var status = 0 + while (msg[i++] !== 0) { + if (i >= msg.length) { + status++ + break + } + } + var ps = msg.slice(2, i - 1) + + if ((p1.toString('hex') !== '0002' && !reverse) || (p1.toString('hex') !== '0001' && reverse)) { + status++ + } + if (ps.length < 8) { + status++ + } + if (status) { + throw new Error('decryption error') + } + return msg.slice(i) +} +function compare (a, b) { + a = Buffer.from(a) + b = Buffer.from(b) + var dif = 0 + var len = a.length + if (a.length !== b.length) { + dif++ + len = Math.min(a.length, b.length) + } + var i = -1 + while (++i < len) { + dif += (a[i] ^ b[i]) + } + return dif +} + + +/***/ }), + +/***/ 6972: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/rsa_public_key.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ RSAPublicKey: () => (/* binding */ RSAPublicKey) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +class RSAPublicKey { + modulus = new ArrayBuffer(0); + publicExponent = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPublicKey.prototype, "modulus", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPublicKey.prototype, "publicExponent", void 0); + + +/***/ }), + +/***/ 6981: +/*!*****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/singleton.js ***! + \*****************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _injectable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./injectable */ 58930); +/* harmony import */ var _dependency_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dependency-container */ 62625); + + +function singleton() { + return function (target) { + (0,_injectable__WEBPACK_IMPORTED_MODULE_0__["default"])()(target); + _dependency_container__WEBPACK_IMPORTED_MODULE_1__.instance.registerSingleton(target); + }; +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (singleton); + + +/***/ }), + +/***/ 7001: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/define-data-property@1.1.4/node_modules/define-data-property/index.js ***! + \***************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $defineProperty = __webpack_require__(/*! es-define-property */ 69001); + +var $SyntaxError = __webpack_require__(/*! es-errors/syntax */ 70064); +var $TypeError = __webpack_require__(/*! es-errors/type */ 41623); + +var gopd = __webpack_require__(/*! gopd */ 67768); + +/** @type {import('.')} */ +module.exports = function defineDataProperty( + obj, + property, + value +) { + if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) { + throw new $TypeError('`obj` must be an object or a function`'); + } + if (typeof property !== 'string' && typeof property !== 'symbol') { + throw new $TypeError('`property` must be a string or a symbol`'); + } + if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) { + throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null'); + } + if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) { + throw new $TypeError('`nonWritable`, if provided, must be a boolean or null'); + } + if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) { + throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null'); + } + if (arguments.length > 6 && typeof arguments[6] !== 'boolean') { + throw new $TypeError('`loose`, if provided, must be a boolean'); + } + + var nonEnumerable = arguments.length > 3 ? arguments[3] : null; + var nonWritable = arguments.length > 4 ? arguments[4] : null; + var nonConfigurable = arguments.length > 5 ? arguments[5] : null; + var loose = arguments.length > 6 ? arguments[6] : false; + + /* @type {false | TypedPropertyDescriptor} */ + var desc = !!gopd && gopd(obj, property); + + if ($defineProperty) { + $defineProperty(obj, property, { + configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable, + enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable, + value: value, + writable: nonWritable === null && desc ? desc.writable : !nonWritable + }); + } else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) { + // must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable + obj[property] = value; // eslint-disable-line no-param-reassign + } else { + throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.'); + } +}; + + +/***/ }), + +/***/ 7093: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/incr32.js ***! + \****************************************************************************************/ +/***/ ((module) => { + +function incr32 (iv) { + var len = iv.length + var item + while (len--) { + item = iv.readUInt8(len) + if (item === 255) { + iv.writeUInt8(0, len) + } else { + item++ + iv.writeUInt8(item, len) + break + } + } +} +module.exports = incr32 + + +/***/ }), + +/***/ 7527: +/*!********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/bags/cert_bag.js ***! + \********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CertBag: () => (/* binding */ CertBag), +/* harmony export */ id_certTypes: () => (/* binding */ id_certTypes), +/* harmony export */ id_sdsiCertificate: () => (/* binding */ id_sdsiCertificate), +/* harmony export */ id_x509Certificate: () => (/* binding */ id_x509Certificate) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types.js */ 61771); + + + +class CertBag { + certId = ""; + certValue = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], CertBag.prototype, "certId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, context: 0, + }) +], CertBag.prototype, "certValue", void 0); +const id_certTypes = `${_types_js__WEBPACK_IMPORTED_MODULE_2__.id_pkcs_9}.22`; +const id_x509Certificate = `${id_certTypes}.1`; +const id_sdsiCertificate = `${id_certTypes}.2`; + + +/***/ }), + +/***/ 7855: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/pbkdf2@3.1.6/node_modules/pbkdf2/lib/precondition.js ***! + \**********************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +var $isFinite = isFinite; +var MAX_ALLOC = Math.pow(2, 30) - 1; // default in iojs + +module.exports = function (iterations, keylen) { + if (typeof iterations !== 'number') { + throw new TypeError('Iterations not a number'); + } + + if (iterations < 0 || !$isFinite(iterations)) { + throw new TypeError('Bad iterations'); + } + + if (typeof keylen !== 'number') { + throw new TypeError('Key length not a number'); + } + + if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */ + throw new TypeError('Bad key length'); + } + + // `-0` passes the `keylen < 0` guard above (since `-0 < 0` is `false`), but + // the native binding requires a true Int32; `-0` is held as a double and + // aborts the process (SIGABRT) on Node.js 15+. Coerce it to `+0`. + return keylen + 0; +}; + + +/***/ }), + +/***/ 8057: +/*!*****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/rpc-websockets@9.3.9/node_modules/rpc-websockets/dist/index.browser.mjs ***! + \*****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Client: () => (/* binding */ Client), +/* harmony export */ CommonClient: () => (/* binding */ CommonClient), +/* harmony export */ DefaultDataPack: () => (/* binding */ DefaultDataPack), +/* harmony export */ WebSocket: () => (/* binding */ WebSocket) +/* harmony export */ }); +/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ 62266); +/* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! eventemitter3 */ 53628); + + + +// node_modules/esbuild-plugin-polyfill-node/polyfills/buffer.js +var WebSocketBrowserImpl = class extends eventemitter3__WEBPACK_IMPORTED_MODULE_1__.EventEmitter { + socket; + /** Instantiate a WebSocket class + * @constructor + * @param {String} address - url to a websocket server + * @param {WebSocketBrowserOptions} options - websocket options + * @return {WebSocketBrowserImpl} - returns a WebSocket instance + */ + constructor(address, options) { + super(); + this.socket = new window.WebSocket(address, options.protocols); + this.socket.onopen = () => this.emit("open"); + this.socket.onmessage = (event) => this.emit("message", event.data); + this.socket.onerror = (error) => this.emit("error", error); + this.socket.onclose = (event) => { + this.emit("close", event.code, event.reason); + }; + } + /** + * Sends data through a websocket connection + * @method + * @param {(String|Object)} data - data to be sent via websocket + * @param {Object} optionsOrCallback - ws options + * @param {Function} callback - a callback called once the data is sent + * @return {Undefined} + */ + send(data, optionsOrCallback, callback) { + const cb = callback || optionsOrCallback; + try { + this.socket.send(data); + cb(); + } catch (error) { + cb(error); + } + } + /** + * Closes an underlying socket + * @method + * @param {Number} code - status code explaining why the connection is being closed + * @param {String} reason - a description why the connection is closing + * @return {Undefined} + * @throws {Error} + */ + close(code, reason) { + this.socket.close(code, reason); + } + addEventListener(type, listener, options) { + this.socket.addEventListener(type, listener, options); + } +}; +function WebSocket(address, options) { + return new WebSocketBrowserImpl(address, options); +} + +// src/lib/utils.ts +var DefaultDataPack = class { + encode(value) { + return JSON.stringify(value); + } + decode(value) { + return JSON.parse(value); + } +}; + +// src/lib/client.ts +var CommonClient = class extends eventemitter3__WEBPACK_IMPORTED_MODULE_1__.EventEmitter { + address; + rpc_id; + queue; + options; + autoconnect; + ready; + reconnect; + reconnect_timer_id; + reconnect_interval; + max_reconnects; + rest_options; + current_reconnects; + generate_request_id; + socket; + webSocketFactory; + dataPack; + /** + * Instantiate a Client class. + * @constructor + * @param {webSocketFactory} webSocketFactory - factory method for WebSocket + * @param {String} address - url to a websocket server + * @param {Object} options - ws options object with reconnect parameters + * @param {Function} generate_request_id - custom generation request Id + * @param {DataPack} dataPack - data pack contains encoder and decoder + * @return {CommonClient} + */ + constructor(webSocketFactory, address = "ws://localhost:8080", { + autoconnect = true, + reconnect = true, + reconnect_interval = 1e3, + max_reconnects = 5, + ...rest_options + } = {}, generate_request_id, dataPack) { + super(); + this.webSocketFactory = webSocketFactory; + this.queue = {}; + this.rpc_id = 0; + this.address = address; + this.autoconnect = autoconnect; + this.ready = false; + this.reconnect = reconnect; + this.reconnect_timer_id = void 0; + this.reconnect_interval = reconnect_interval; + this.max_reconnects = max_reconnects; + this.rest_options = rest_options; + this.current_reconnects = 0; + this.generate_request_id = generate_request_id || (() => typeof this.rpc_id === "number" ? ++this.rpc_id : Number(this.rpc_id) + 1); + if (!dataPack) this.dataPack = new DefaultDataPack(); + else this.dataPack = dataPack; + if (this.autoconnect) + this._connect(this.address, { + autoconnect: this.autoconnect, + reconnect: this.reconnect, + reconnect_interval: this.reconnect_interval, + max_reconnects: this.max_reconnects, + ...this.rest_options + }); + } + /** + * Connects to a defined server if not connected already. + * @method + * @return {Undefined} + */ + connect() { + if (this.socket) return; + this._connect(this.address, { + autoconnect: this.autoconnect, + reconnect: this.reconnect, + reconnect_interval: this.reconnect_interval, + max_reconnects: this.max_reconnects, + ...this.rest_options + }); + } + /** + * Calls a registered RPC method on server. + * @method + * @param {String} method - RPC method name + * @param {Object|Array} params - optional method parameters + * @param {Number} timeout - RPC reply timeout value + * @param {Object} ws_opts - options passed to ws + * @return {Promise} + */ + call(method, params, timeout, ws_opts) { + if (!ws_opts && "object" === typeof timeout) { + ws_opts = timeout; + timeout = null; + } + return new Promise((resolve, reject) => { + if (!this.ready) return reject(new Error("socket not ready")); + const rpc_id = this.generate_request_id(method, params); + const message = { + jsonrpc: "2.0", + method, + params: params || void 0, + id: rpc_id + }; + this.socket.send(this.dataPack.encode(message), ws_opts, (error) => { + if (error) return reject(error); + this.queue[rpc_id] = { promise: [resolve, reject] }; + if (timeout) { + this.queue[rpc_id].timeout = setTimeout(() => { + delete this.queue[rpc_id]; + reject(new Error("reply timeout")); + }, timeout); + } + }); + }); + } + /** + * Logins with the other side of the connection. + * @method + * @param {Object} params - Login credentials object + * @return {Promise} + */ + async login(params) { + const resp = await this.call("rpc.login", params); + if (!resp) throw new Error("authentication failed"); + return resp; + } + /** + * Fetches a list of client's methods registered on server. + * @method + * @return {Array} + */ + async listMethods() { + return await this.call("__listMethods"); + } + /** + * Sends a JSON-RPC 2.0 notification to server. + * @method + * @param {String} method - RPC method name + * @param {Object} params - optional method parameters + * @return {Promise} + */ + notify(method, params) { + return new Promise((resolve, reject) => { + if (!this.ready) return reject(new Error("socket not ready")); + const message = { + jsonrpc: "2.0", + method, + params + }; + this.socket.send(this.dataPack.encode(message), (error) => { + if (error) return reject(error); + resolve(); + }); + }); + } + /** + * Subscribes for a defined event. + * @method + * @param {String|Array} event - event name + * @return {Undefined} + * @throws {Error} + */ + async subscribe(event) { + if (typeof event === "string") event = [event]; + const result = await this.call("rpc.on", event); + if (typeof event === "string" && result[event] !== "ok") + throw new Error( + "Failed subscribing to an event '" + event + "' with: " + result[event] + ); + return result; + } + /** + * Unsubscribes from a defined event. + * @method + * @param {String|Array} event - event name + * @return {Undefined} + * @throws {Error} + */ + async unsubscribe(event) { + if (typeof event === "string") event = [event]; + const result = await this.call("rpc.off", event); + if (typeof event === "string" && result[event] !== "ok") + throw new Error("Failed unsubscribing from an event with: " + result); + return result; + } + /** + * Closes a WebSocket connection gracefully. + * @method + * @param {Number} code - socket close code + * @param {String} data - optional data to be sent before closing + * @return {Undefined} + */ + close(code, data) { + if (this.socket) this.socket.close(code || 1e3, data); + } + /** + * Enable / disable automatic reconnection. + * @method + * @param {Boolean} reconnect - enable / disable reconnection + * @return {Undefined} + */ + setAutoReconnect(reconnect) { + this.reconnect = reconnect; + } + /** + * Set the interval between reconnection attempts. + * @method + * @param {Number} interval - reconnection interval in milliseconds + * @return {Undefined} + */ + setReconnectInterval(interval) { + this.reconnect_interval = interval; + } + /** + * Set the maximum number of reconnection attempts. + * @method + * @param {Number} max_reconnects - maximum reconnection attempts + * @return {Undefined} + */ + setMaxReconnects(max_reconnects) { + this.max_reconnects = max_reconnects; + } + /** + * Get the current number of reconnection attempts made. + * @method + * @return {Number} current reconnection attempts + */ + getCurrentReconnects() { + return this.current_reconnects; + } + /** + * Get the maximum number of reconnection attempts. + * @method + * @return {Number} maximum reconnection attempts + */ + getMaxReconnects() { + return this.max_reconnects; + } + /** + * Check if the client is currently attempting to reconnect. + * @method + * @return {Boolean} true if reconnection is in progress + */ + isReconnecting() { + return this.reconnect_timer_id !== void 0; + } + /** + * Check if the client will attempt to reconnect on the next close event. + * @method + * @return {Boolean} true if reconnection will be attempted + */ + willReconnect() { + return this.reconnect && (this.max_reconnects === 0 || this.current_reconnects < this.max_reconnects); + } + /** + * Connection/Message handler. + * @method + * @private + * @param {String} address - WebSocket API address + * @param {Object} options - ws options object + * @return {Undefined} + */ + _connect(address, options) { + clearTimeout(this.reconnect_timer_id); + this.socket = this.webSocketFactory(address, options); + this.socket.addEventListener("open", () => { + this.ready = true; + this.emit("open"); + this.current_reconnects = 0; + }); + this.socket.addEventListener("message", ({ data: message }) => { + if (message instanceof ArrayBuffer) + message = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(message).toString(); + try { + message = this.dataPack.decode(message); + } catch (_error) { + return; + } + if (message.notification && this.listeners(message.notification).length) { + if (!Object.keys(message.params).length) + return this.emit(message.notification); + const args = [message.notification]; + if (message.params.constructor === Object) args.push(message.params); + else + for (let i = 0; i < message.params.length; i++) + args.push(message.params[i]); + return Promise.resolve().then(() => { + this.emit.apply(this, args); + }); + } + if (!this.queue[message.id]) { + if (message.method) { + return Promise.resolve().then(() => { + this.emit(message.method, message?.params); + }); + } + return; + } + if ("error" in message === "result" in message) + this.queue[message.id].promise[1]( + new Error( + 'Server response malformed. Response must include either "result" or "error", but not both.' + ) + ); + if (this.queue[message.id].timeout) + clearTimeout(this.queue[message.id].timeout); + if (message.error) this.queue[message.id].promise[1](message.error); + else this.queue[message.id].promise[0](message.result); + delete this.queue[message.id]; + }); + this.socket.addEventListener("error", (error) => this.emit("error", error)); + this.socket.addEventListener("close", ({ code, reason }) => { + if (this.ready) + setTimeout(() => this.emit("close", code, reason), 0); + this.ready = false; + this.socket = void 0; + if (code === 1e3) return; + this.current_reconnects++; + if (this.reconnect && (this.max_reconnects > this.current_reconnects || this.max_reconnects === 0)) + this.reconnect_timer_id = setTimeout( + () => this._connect(address, options), + this.reconnect_interval + ); + else if (this.reconnect && this.max_reconnects > 0 && this.current_reconnects >= this.max_reconnects) { + setTimeout(() => this.emit("max_reconnects_reached", code, reason), 1); + } + }); + } +}; + +// src/index.browser.ts +var Client = class extends CommonClient { + constructor(address = "ws://localhost:8080", { + autoconnect = true, + reconnect = true, + reconnect_interval = 1e3, + max_reconnects = 5, + ...rest_options + } = {}, generate_request_id) { + super( + WebSocket, + address, + { + autoconnect, + reconnect, + reconnect_interval, + max_reconnects, + ...rest_options + }, + generate_request_id + ); + } +}; + + +//# sourceMappingURL=index.browser.mjs.map +//# sourceMappingURL=index.browser.mjs.map + +/***/ }), + +/***/ 8467: +/*!****************************************************************************!*\ + !*** ../node_modules/.pnpm/base-x@3.0.11/node_modules/base-x/src/index.js ***! + \****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +// @ts-ignore +var _Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + var BASE_MAP = new Uint8Array(256) + for (var j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (var i = 0; i < ALPHABET.length; i++) { + var x = ALPHABET.charAt(i) + var xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + var BASE = ALPHABET.length + var LEADER = ALPHABET.charAt(0) + var FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + var iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source) } + if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + var zeroes = 0 + var length = 0 + var pbegin = 0 + var pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + var size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + var b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + var carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + var i = 0 + for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + var it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + var str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return _Buffer.alloc(0) } + var psz = 0 + // Skip and count leading '1's. + var zeroes = 0 + var length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + var size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + var b256 = new Uint8Array(size) + // Process the characters. + while (psz < source.length) { + // Find code of next character + var charCode = source.charCodeAt(psz) + // Base map can not be indexed using char code + if (charCode > 255) { return } + // Decode character + var carry = BASE_MAP[charCode] + // Invalid character + if (carry === 255) { return } + var i = 0 + for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip leading zeroes in b256. + var it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + var vch = _Buffer.allocUnsafe(zeroes + (size - it4)) + vch.fill(0x00, 0, zeroes) + var j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + var buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') + } + return { + encode: encode, + decodeUnsafe: decodeUnsafe, + decode: decode + } +} +module.exports = base + + +/***/ }), + +/***/ 8481: +/*!*************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/name.js ***! + \*************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AttributeTypeAndValue: () => (/* binding */ AttributeTypeAndValue), +/* harmony export */ AttributeValue: () => (/* binding */ AttributeValue), +/* harmony export */ DirectoryString: () => (/* binding */ DirectoryString), +/* harmony export */ Name: () => (/* binding */ Name), +/* harmony export */ RDNSequence: () => (/* binding */ RDNSequence), +/* harmony export */ RelativeDistinguishedName: () => (/* binding */ RelativeDistinguishedName) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_utils_encoding__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/utils/encoding */ 45906); +var RelativeDistinguishedName_1, RDNSequence_1, Name_1; + + + +let DirectoryString = class DirectoryString { + teletexString; + printableString; + universalString; + utf8String; + bmpString; + constructor(params = {}) { + Object.assign(this, params); + } + toString() { + return (this.bmpString + || this.printableString + || this.teletexString + || this.universalString + || this.utf8String + || ""); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.TeletexString }) +], DirectoryString.prototype, "teletexString", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.PrintableString }) +], DirectoryString.prototype, "printableString", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.UniversalString }) +], DirectoryString.prototype, "universalString", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Utf8String }) +], DirectoryString.prototype, "utf8String", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BmpString }) +], DirectoryString.prototype, "bmpString", void 0); +DirectoryString = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], DirectoryString); + +let AttributeValue = class AttributeValue extends DirectoryString { + ia5String; + anyValue; + constructor(params = {}) { + super(params); + Object.assign(this, params); + } + toString() { + return this.ia5String || (this.anyValue ? _peculiar_utils_encoding__WEBPACK_IMPORTED_MODULE_2__.hex.encode(this.anyValue) : super.toString()); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String }) +], AttributeValue.prototype, "ia5String", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], AttributeValue.prototype, "anyValue", void 0); +AttributeValue = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], AttributeValue); + +class AttributeTypeAndValue { + type = ""; + value = new AttributeValue(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], AttributeTypeAndValue.prototype, "type", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: AttributeValue }) +], AttributeTypeAndValue.prototype, "value", void 0); +let RelativeDistinguishedName = RelativeDistinguishedName_1 = class RelativeDistinguishedName extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, RelativeDistinguishedName_1.prototype); + } +}; +RelativeDistinguishedName = RelativeDistinguishedName_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set, itemType: AttributeTypeAndValue, + }) +], RelativeDistinguishedName); + +let RDNSequence = RDNSequence_1 = class RDNSequence extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, RDNSequence_1.prototype); + } +}; +RDNSequence = RDNSequence_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: RelativeDistinguishedName, + }) +], RDNSequence); + +let Name = Name_1 = class Name extends RDNSequence { + constructor(items) { + super(items); + Object.setPrototypeOf(this, Name_1.prototype); + } +}; +Name = Name_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], Name); + + + +/***/ }), + +/***/ 8546: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/randombytes@2.1.0/node_modules/randombytes/browser.js ***! + \***********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// limit of Crypto.getRandomValues() +// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues +var MAX_BYTES = 65536 + +// Node supports requesting up to this number of bytes +// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48 +var MAX_UINT32 = 4294967295 + +function oldBrowser () { + throw new Error('Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11') +} + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto + +if (crypto && crypto.getRandomValues) { + module.exports = randomBytes +} else { + module.exports = oldBrowser +} + +function randomBytes (size, cb) { + // phantomjs needs to throw + if (size > MAX_UINT32) throw new RangeError('requested too many random bytes') + + var bytes = Buffer.allocUnsafe(size) + + if (size > 0) { // getRandomValues fails on IE if size == 0 + if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues + // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues + for (var generated = 0; generated < size; generated += MAX_BYTES) { + // buffer.slice automatically checks if the end is past the end of + // the buffer so we don't have to here + crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES)) + } + } else { + crypto.getRandomValues(bytes) + } + } + + if (typeof cb === 'function') { + return process.nextTick(function () { + cb(null, bytes) + }) + } + + return bytes +} + + +/***/ }), + +/***/ 8677: +/*!********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/hash/isHash.js ***! + \********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isHash: () => (/* binding */ isHash) +/* harmony export */ }); +/* harmony import */ var _data_isHex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../data/isHex.js */ 76816); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/size.js */ 58036); + + +function isHash(hash) { + return (0,_data_isHex_js__WEBPACK_IMPORTED_MODULE_0__.isHex)(hash) && (0,_data_size_js__WEBPACK_IMPORTED_MODULE_1__.size)(hash) === 32; +} +//# sourceMappingURL=isHash.js.map + +/***/ }), + +/***/ 8756: +/*!************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_information_access.js ***! + \************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AccessDescription: () => (/* binding */ AccessDescription), +/* harmony export */ AuthorityInfoAccessSyntax: () => (/* binding */ AuthorityInfoAccessSyntax), +/* harmony export */ id_pe_authorityInfoAccess: () => (/* binding */ id_pe_authorityInfoAccess) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_name_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../general_name.js */ 56804); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var AuthorityInfoAccessSyntax_1; + + + + +const id_pe_authorityInfoAccess = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_pe}.1`; +class AccessDescription { + accessMethod = ""; + accessLocation = new _general_name_js__WEBPACK_IMPORTED_MODULE_2__.GeneralName(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], AccessDescription.prototype, "accessMethod", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _general_name_js__WEBPACK_IMPORTED_MODULE_2__.GeneralName }) +], AccessDescription.prototype, "accessLocation", void 0); +let AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = class AuthorityInfoAccessSyntax extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, AuthorityInfoAccessSyntax_1.prototype); + } +}; +AuthorityInfoAccessSyntax = AuthorityInfoAccessSyntax_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: AccessDescription, + }) +], AuthorityInfoAccessSyntax); + + + +/***/ }), + +/***/ 9441: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/from-browser.js ***! + \*********************************************************************************************************************/ +/***/ ((module) => { + +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; + + +/***/ }), + +/***/ 9950: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/ofb.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var xor = __webpack_require__(/*! buffer-xor */ 67023) + +function getBlock (self) { + self._prev = self._cipher.encryptBlock(self._prev) + return self._prev +} + +exports.encrypt = function (self, chunk) { + while (self._cache.length < chunk.length) { + self._cache = Buffer.concat([self._cache, getBlock(self)]) + } + + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + + +/***/ }), + +/***/ 10102: +/*!********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/encapsulated_content_info.js ***! + \********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ EncapsulatedContent: () => (/* binding */ EncapsulatedContent), +/* harmony export */ EncapsulatedContentInfo: () => (/* binding */ EncapsulatedContentInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +let EncapsulatedContent = class EncapsulatedContent { + single; + any; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], EncapsulatedContent.prototype, "single", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], EncapsulatedContent.prototype, "any", void 0); +EncapsulatedContent = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], EncapsulatedContent); + +class EncapsulatedContentInfo { + eContentType = ""; + eContent; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], EncapsulatedContentInfo.prototype, "eContentType", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: EncapsulatedContent, context: 0, optional: true, + }) +], EncapsulatedContentInfo.prototype, "eContent", void 0); + + +/***/ }), + +/***/ 10463: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@solana+codecs-numbers@2.3.0_typescript@5.4.3/node_modules/@solana/codecs-numbers/dist/index.browser.mjs ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Endian: () => (/* binding */ Endian), +/* harmony export */ assertNumberIsBetweenForCodec: () => (/* binding */ assertNumberIsBetweenForCodec), +/* harmony export */ getF32Codec: () => (/* binding */ getF32Codec), +/* harmony export */ getF32Decoder: () => (/* binding */ getF32Decoder), +/* harmony export */ getF32Encoder: () => (/* binding */ getF32Encoder), +/* harmony export */ getF64Codec: () => (/* binding */ getF64Codec), +/* harmony export */ getF64Decoder: () => (/* binding */ getF64Decoder), +/* harmony export */ getF64Encoder: () => (/* binding */ getF64Encoder), +/* harmony export */ getI128Codec: () => (/* binding */ getI128Codec), +/* harmony export */ getI128Decoder: () => (/* binding */ getI128Decoder), +/* harmony export */ getI128Encoder: () => (/* binding */ getI128Encoder), +/* harmony export */ getI16Codec: () => (/* binding */ getI16Codec), +/* harmony export */ getI16Decoder: () => (/* binding */ getI16Decoder), +/* harmony export */ getI16Encoder: () => (/* binding */ getI16Encoder), +/* harmony export */ getI32Codec: () => (/* binding */ getI32Codec), +/* harmony export */ getI32Decoder: () => (/* binding */ getI32Decoder), +/* harmony export */ getI32Encoder: () => (/* binding */ getI32Encoder), +/* harmony export */ getI64Codec: () => (/* binding */ getI64Codec), +/* harmony export */ getI64Decoder: () => (/* binding */ getI64Decoder), +/* harmony export */ getI64Encoder: () => (/* binding */ getI64Encoder), +/* harmony export */ getI8Codec: () => (/* binding */ getI8Codec), +/* harmony export */ getI8Decoder: () => (/* binding */ getI8Decoder), +/* harmony export */ getI8Encoder: () => (/* binding */ getI8Encoder), +/* harmony export */ getShortU16Codec: () => (/* binding */ getShortU16Codec), +/* harmony export */ getShortU16Decoder: () => (/* binding */ getShortU16Decoder), +/* harmony export */ getShortU16Encoder: () => (/* binding */ getShortU16Encoder), +/* harmony export */ getU128Codec: () => (/* binding */ getU128Codec), +/* harmony export */ getU128Decoder: () => (/* binding */ getU128Decoder), +/* harmony export */ getU128Encoder: () => (/* binding */ getU128Encoder), +/* harmony export */ getU16Codec: () => (/* binding */ getU16Codec), +/* harmony export */ getU16Decoder: () => (/* binding */ getU16Decoder), +/* harmony export */ getU16Encoder: () => (/* binding */ getU16Encoder), +/* harmony export */ getU32Codec: () => (/* binding */ getU32Codec), +/* harmony export */ getU32Decoder: () => (/* binding */ getU32Decoder), +/* harmony export */ getU32Encoder: () => (/* binding */ getU32Encoder), +/* harmony export */ getU64Codec: () => (/* binding */ getU64Codec), +/* harmony export */ getU64Decoder: () => (/* binding */ getU64Decoder), +/* harmony export */ getU64Encoder: () => (/* binding */ getU64Encoder), +/* harmony export */ getU8Codec: () => (/* binding */ getU8Codec), +/* harmony export */ getU8Decoder: () => (/* binding */ getU8Decoder), +/* harmony export */ getU8Encoder: () => (/* binding */ getU8Encoder) +/* harmony export */ }); +/* harmony import */ var _solana_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @solana/errors */ 65061); +/* harmony import */ var _solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @solana/codecs-core */ 17247); + + + +// src/assertions.ts +function assertNumberIsBetweenForCodec(codecDescription, min, max, value) { + if (value < min || value > max) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE, { + codecDescription, + max, + min, + value + }); + } +} + +// src/common.ts +var Endian = /* @__PURE__ */ ((Endian2) => { + Endian2[Endian2["Little"] = 0] = "Little"; + Endian2[Endian2["Big"] = 1] = "Big"; + return Endian2; +})(Endian || {}); +function isLittleEndian(config) { + return config?.endian === 1 /* Big */ ? false : true; +} +function numberEncoderFactory(input) { + return (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.createEncoder)({ + fixedSize: input.size, + write(value, bytes, offset) { + if (input.range) { + assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value); + } + const arrayBuffer = new ArrayBuffer(input.size); + input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config)); + bytes.set(new Uint8Array(arrayBuffer), offset); + return offset + input.size; + } + }); +} +function numberDecoderFactory(input) { + return (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.createDecoder)({ + fixedSize: input.size, + read(bytes, offset = 0) { + (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.assertByteArrayIsNotEmptyForCodec)(input.name, bytes, offset); + (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.assertByteArrayHasEnoughBytesForCodec)(input.name, input.size, bytes, offset); + const view = new DataView(toArrayBuffer(bytes, offset, input.size)); + return [input.get(view, isLittleEndian(input.config)), offset + input.size]; + } + }); +} +function toArrayBuffer(bytes, offset, length) { + const bytesOffset = bytes.byteOffset + (offset ?? 0); + const bytesLength = length ?? bytes.byteLength; + return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength); +} + +// src/f32.ts +var getF32Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "f32", + set: (view, value, le) => view.setFloat32(0, Number(value), le), + size: 4 +}); +var getF32Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getFloat32(0, le), + name: "f32", + size: 4 +}); +var getF32Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getF32Encoder(config), getF32Decoder(config)); +var getF64Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "f64", + set: (view, value, le) => view.setFloat64(0, Number(value), le), + size: 8 +}); +var getF64Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getFloat64(0, le), + name: "f64", + size: 8 +}); +var getF64Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getF64Encoder(config), getF64Decoder(config)); +var getI128Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "i128", + range: [-BigInt("0x7fffffffffffffffffffffffffffffff") - 1n, BigInt("0x7fffffffffffffffffffffffffffffff")], + set: (view, value, le) => { + const leftOffset = le ? 8 : 0; + const rightOffset = le ? 0 : 8; + const rightMask = 0xffffffffffffffffn; + view.setBigInt64(leftOffset, BigInt(value) >> 64n, le); + view.setBigUint64(rightOffset, BigInt(value) & rightMask, le); + }, + size: 16 +}); +var getI128Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => { + const leftOffset = le ? 8 : 0; + const rightOffset = le ? 0 : 8; + const left = view.getBigInt64(leftOffset, le); + const right = view.getBigUint64(rightOffset, le); + return (left << 64n) + right; + }, + name: "i128", + size: 16 +}); +var getI128Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getI128Encoder(config), getI128Decoder(config)); +var getI16Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "i16", + range: [-Number("0x7fff") - 1, Number("0x7fff")], + set: (view, value, le) => view.setInt16(0, Number(value), le), + size: 2 +}); +var getI16Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getInt16(0, le), + name: "i16", + size: 2 +}); +var getI16Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getI16Encoder(config), getI16Decoder(config)); +var getI32Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "i32", + range: [-Number("0x7fffffff") - 1, Number("0x7fffffff")], + set: (view, value, le) => view.setInt32(0, Number(value), le), + size: 4 +}); +var getI32Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getInt32(0, le), + name: "i32", + size: 4 +}); +var getI32Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getI32Encoder(config), getI32Decoder(config)); +var getI64Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "i64", + range: [-BigInt("0x7fffffffffffffff") - 1n, BigInt("0x7fffffffffffffff")], + set: (view, value, le) => view.setBigInt64(0, BigInt(value), le), + size: 8 +}); +var getI64Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getBigInt64(0, le), + name: "i64", + size: 8 +}); +var getI64Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getI64Encoder(config), getI64Decoder(config)); +var getI8Encoder = () => numberEncoderFactory({ + name: "i8", + range: [-Number("0x7f") - 1, Number("0x7f")], + set: (view, value) => view.setInt8(0, Number(value)), + size: 1 +}); +var getI8Decoder = () => numberDecoderFactory({ + get: (view) => view.getInt8(0), + name: "i8", + size: 1 +}); +var getI8Codec = () => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getI8Encoder(), getI8Decoder()); +var getShortU16Encoder = () => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.createEncoder)({ + getSizeFromValue: (value) => { + if (value <= 127) return 1; + if (value <= 16383) return 2; + return 3; + }, + maxSize: 3, + write: (value, bytes, offset) => { + assertNumberIsBetweenForCodec("shortU16", 0, 65535, value); + const shortU16Bytes = [0]; + for (let ii = 0; ; ii += 1) { + const alignedValue = Number(value) >> ii * 7; + if (alignedValue === 0) { + break; + } + const nextSevenBits = 127 & alignedValue; + shortU16Bytes[ii] = nextSevenBits; + if (ii > 0) { + shortU16Bytes[ii - 1] |= 128; + } + } + bytes.set(shortU16Bytes, offset); + return offset + shortU16Bytes.length; + } +}); +var getShortU16Decoder = () => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.createDecoder)({ + maxSize: 3, + read: (bytes, offset) => { + let value = 0; + let byteCount = 0; + while (++byteCount) { + const byteIndex = byteCount - 1; + const currentByte = bytes[offset + byteIndex]; + const nextSevenBits = 127 & currentByte; + value |= nextSevenBits << byteIndex * 7; + if ((currentByte & 128) === 0) { + break; + } + } + return [value, offset + byteCount]; + } +}); +var getShortU16Codec = () => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getShortU16Encoder(), getShortU16Decoder()); +var getU128Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "u128", + range: [0n, BigInt("0xffffffffffffffffffffffffffffffff")], + set: (view, value, le) => { + const leftOffset = le ? 8 : 0; + const rightOffset = le ? 0 : 8; + const rightMask = 0xffffffffffffffffn; + view.setBigUint64(leftOffset, BigInt(value) >> 64n, le); + view.setBigUint64(rightOffset, BigInt(value) & rightMask, le); + }, + size: 16 +}); +var getU128Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => { + const leftOffset = le ? 8 : 0; + const rightOffset = le ? 0 : 8; + const left = view.getBigUint64(leftOffset, le); + const right = view.getBigUint64(rightOffset, le); + return (left << 64n) + right; + }, + name: "u128", + size: 16 +}); +var getU128Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getU128Encoder(config), getU128Decoder(config)); +var getU16Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "u16", + range: [0, Number("0xffff")], + set: (view, value, le) => view.setUint16(0, Number(value), le), + size: 2 +}); +var getU16Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getUint16(0, le), + name: "u16", + size: 2 +}); +var getU16Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getU16Encoder(config), getU16Decoder(config)); +var getU32Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "u32", + range: [0, Number("0xffffffff")], + set: (view, value, le) => view.setUint32(0, Number(value), le), + size: 4 +}); +var getU32Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getUint32(0, le), + name: "u32", + size: 4 +}); +var getU32Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getU32Encoder(config), getU32Decoder(config)); +var getU64Encoder = (config = {}) => numberEncoderFactory({ + config, + name: "u64", + range: [0n, BigInt("0xffffffffffffffff")], + set: (view, value, le) => view.setBigUint64(0, BigInt(value), le), + size: 8 +}); +var getU64Decoder = (config = {}) => numberDecoderFactory({ + config, + get: (view, le) => view.getBigUint64(0, le), + name: "u64", + size: 8 +}); +var getU64Codec = (config = {}) => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getU64Encoder(config), getU64Decoder(config)); +var getU8Encoder = () => numberEncoderFactory({ + name: "u8", + range: [0, Number("0xff")], + set: (view, value) => view.setUint8(0, Number(value)), + size: 1 +}); +var getU8Decoder = () => numberDecoderFactory({ + get: (view) => view.getUint8(0), + name: "u8", + size: 1 +}); +var getU8Codec = () => (0,_solana_codecs_core__WEBPACK_IMPORTED_MODULE_1__.combineCodec)(getU8Encoder(), getU8Decoder()); + + +//# sourceMappingURL=index.browser.mjs.map +//# sourceMappingURL=index.browser.mjs.map + +/***/ }), + +/***/ 10659: +/*!**************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/v2_form.js ***! + \**************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ V2Form: () => (/* binding */ V2Form) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./issuer_serial.js */ 83996); +/* harmony import */ var _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./object_digest_info.js */ 80835); + + + + + +class V2Form { + issuerName; + baseCertificateID; + objectDigestInfo; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralNames, optional: true, + }) +], V2Form.prototype, "issuerName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__.IssuerSerial, context: 0, implicit: true, optional: true, + }) +], V2Form.prototype, "baseCertificateID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__.ObjectDigestInfo, context: 1, implicit: true, optional: true, + }) +], V2Form.prototype, "objectDigestInfo", void 0); + + +/***/ }), + +/***/ 10703: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/safe-buffer@5.1.2/node_modules/safe-buffer/index.js ***! + \*********************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(/*! buffer */ 62266) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 10765: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-sign@4.2.6/node_modules/browserify-sign/browser/verify.js ***! + \**************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var BN = __webpack_require__(/*! bn.js */ 40113); +var EC = (__webpack_require__(/*! elliptic */ 63174).ec); +var parseKeys = __webpack_require__(/*! parse-asn1 */ 15210); +var curves = __webpack_require__(/*! ./curves.json */ 39503); + +function verify(sig, hash, key, signType, tag) { + var pub = parseKeys(key); + if (pub.type === 'ec') { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); } + return ecVerify(sig, hash, pub); + } else if (pub.type === 'dsa') { + if (signType !== 'dsa') { throw new Error('wrong public key type'); } + return dsaVerify(sig, hash, pub); + } + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong public key type'); } + + hash = Buffer.concat([tag, hash]); + var len = pub.modulus.byteLength(); + var pad = [1]; + var padNum = 0; + while (hash.length + pad.length + 2 < len) { + pad.push(0xff); + padNum += 1; + } + pad.push(0x00); + var i = -1; + while (++i < hash.length) { + pad.push(hash[i]); + } + pad = Buffer.from(pad); + var red = BN.mont(pub.modulus); + sig = new BN(sig).toRed(red); + + sig = sig.redPow(new BN(pub.publicExponent)); + sig = Buffer.from(sig.fromRed().toArray()); + var out = padNum < 8 ? 1 : 0; + len = Math.min(sig.length, pad.length); + if (sig.length !== pad.length) { out = 1; } + + i = -1; + while (++i < len) { out |= sig[i] ^ pad[i]; } + return out === 0; +} + +function ecVerify(sig, hash, pub) { + var curveId = curves[pub.data.algorithm.curve.join('.')]; + if (!curveId) { throw new Error('unknown curve ' + pub.data.algorithm.curve.join('.')); } + + var curve = new EC(curveId); + var pubkey = pub.data.subjectPrivateKey.data; + + return curve.verify(hash, sig, pubkey); +} + +function dsaVerify(sig, hash, pub) { + var p = pub.data.p; + var q = pub.data.q; + var g = pub.data.g; + var y = pub.data.pub_key; + var unpacked = parseKeys.signature.decode(sig, 'der'); + var s = unpacked.s; + var r = unpacked.r; + checkValue(s, q); + checkValue(r, q); + var montp = BN.mont(p); + var w = s.invm(q); + var v = g.toRed(montp) + .redPow(new BN(hash).mul(w).mod(q)) + .fromRed() + .mul(y.toRed(montp).redPow(r.mul(w).mod(q)).fromRed()) + .mod(p) + .mod(q); + return v.cmp(r) === 0; +} + +function checkValue(b, q) { + if (b.cmpn(0) <= 0) { throw new Error('invalid sig'); } + if (b.cmp(q) >= 0) { throw new Error('invalid sig'); } +} + +module.exports = verify; + + +/***/ }), + +/***/ 11256: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/set-function-length@1.2.2/node_modules/set-function-length/index.js ***! + \*************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ 39619); +var define = __webpack_require__(/*! define-data-property */ 7001); +var hasDescriptors = __webpack_require__(/*! has-property-descriptors */ 73560)(); +var gOPD = __webpack_require__(/*! gopd */ 67768); + +var $TypeError = __webpack_require__(/*! es-errors/type */ 41623); +var $floor = GetIntrinsic('%Math.floor%'); + +/** @type {import('.')} */ +module.exports = function setFunctionLength(fn, length) { + if (typeof fn !== 'function') { + throw new $TypeError('`fn` is not a function'); + } + if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) { + throw new $TypeError('`length` must be a positive 32-bit integer'); + } + + var loose = arguments.length > 2 && !!arguments[2]; + + var functionLengthIsConfigurable = true; + var functionLengthIsWritable = true; + if ('length' in fn && gOPD) { + var desc = gOPD(fn, 'length'); + if (desc && !desc.configurable) { + functionLengthIsConfigurable = false; + } + if (desc && !desc.writable) { + functionLengthIsWritable = false; + } + } + + if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) { + if (hasDescriptors) { + define(/** @type {Parameters[0]} */ (fn), 'length', length, true, true); + } else { + define(/** @type {Parameters[0]} */ (fn), 'length', length); + } + } + return fn; +}; + + +/***/ }), + +/***/ 11288: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/diffie-hellman@5.0.3/node_modules/diffie-hellman/lib/primes.json ***! + \**********************************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"modp1":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},"modp2":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},"modp5":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},"modp14":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},"modp15":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},"modp16":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},"modp17":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},"modp18":{"gen":"02","prime":"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"}}'); + +/***/ }), + +/***/ 11326: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/recipientContext.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ RecipientContextImpl: () => (/* binding */ RecipientContextImpl) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _encryptionContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./encryptionContext.js */ 98622); +/* harmony import */ var _mutex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./mutex.js */ 56253); +var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _RecipientContextImpl_mutex; + + + +class RecipientContextImpl extends _encryptionContext_js__WEBPACK_IMPORTED_MODULE_1__.EncryptionContextImpl { + constructor() { + super(...arguments); + _RecipientContextImpl_mutex.set(this, void 0); + } + async open(data, aad = _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer) { + __classPrivateFieldSet(this, _RecipientContextImpl_mutex, __classPrivateFieldGet(this, _RecipientContextImpl_mutex, "f") ?? new _mutex_js__WEBPACK_IMPORTED_MODULE_2__.Mutex(), "f"); + const release = await __classPrivateFieldGet(this, _RecipientContextImpl_mutex, "f").lock(); + let pt; + try { + pt = await this._ctx.key.open(this.computeNonce(this._ctx), data, aad); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.OpenError(e); + } + finally { + release(); + } + this.incrementSeq(this._ctx); + return pt; + } +} +_RecipientContextImpl_mutex = new WeakMap(); + + +/***/ }), + +/***/ 11809: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/reflect-metadata@0.2.2/node_modules/reflect-metadata/Reflect.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +/*! ***************************************************************************** +Copyright (C) Microsoft. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +var Reflect; +(function (Reflect) { + // Metadata Proposal + // https://rbuckton.github.io/reflect-metadata/ + (function (factory) { + var root = typeof globalThis === "object" ? globalThis : + typeof __webpack_require__.g === "object" ? __webpack_require__.g : + typeof self === "object" ? self : + typeof this === "object" ? this : + sloppyModeThis(); + var exporter = makeExporter(Reflect); + if (typeof root.Reflect !== "undefined") { + exporter = makeExporter(root.Reflect, exporter); + } + factory(exporter, root); + if (typeof root.Reflect === "undefined") { + root.Reflect = Reflect; + } + function makeExporter(target, previous) { + return function (key, value) { + Object.defineProperty(target, key, { configurable: true, writable: true, value: value }); + if (previous) + previous(key, value); + }; + } + function functionThis() { + try { + return Function("return this;")(); + } + catch (_) { } + } + function indirectEvalThis() { + try { + return (void 0, eval)("(function() { return this; })()"); + } + catch (_) { } + } + function sloppyModeThis() { + return functionThis() || indirectEvalThis(); + } + })(function (exporter, root) { + var hasOwn = Object.prototype.hasOwnProperty; + // feature test for Symbol support + var supportsSymbol = typeof Symbol === "function"; + var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== "undefined" ? Symbol.toPrimitive : "@@toPrimitive"; + var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== "undefined" ? Symbol.iterator : "@@iterator"; + var supportsCreate = typeof Object.create === "function"; // feature test for Object.create support + var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support + var downLevel = !supportsCreate && !supportsProto; + var HashMap = { + // create an object in dictionary mode (a.k.a. "slow" mode in v8) + create: supportsCreate + ? function () { return MakeDictionary(Object.create(null)); } + : supportsProto + ? function () { return MakeDictionary({ __proto__: null }); } + : function () { return MakeDictionary({}); }, + has: downLevel + ? function (map, key) { return hasOwn.call(map, key); } + : function (map, key) { return key in map; }, + get: downLevel + ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; } + : function (map, key) { return map[key]; }, + }; + // Load global or shim versions of Map, Set, and WeakMap + var functionPrototype = Object.getPrototypeOf(Function); + var _Map = typeof Map === "function" && typeof Map.prototype.entries === "function" ? Map : CreateMapPolyfill(); + var _Set = typeof Set === "function" && typeof Set.prototype.entries === "function" ? Set : CreateSetPolyfill(); + var _WeakMap = typeof WeakMap === "function" ? WeakMap : CreateWeakMapPolyfill(); + var registrySymbol = supportsSymbol ? Symbol.for("@reflect-metadata:registry") : undefined; + var metadataRegistry = GetOrCreateMetadataRegistry(); + var metadataProvider = CreateMetadataProvider(metadataRegistry); + /** + * Applies a set of decorators to a property of a target object. + * @param decorators An array of decorators. + * @param target The target object. + * @param propertyKey (Optional) The property key to decorate. + * @param attributes (Optional) The property descriptor for the target key. + * @remarks Decorators are applied in reverse order. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Example = Reflect.decorate(decoratorsArray, Example); + * + * // property (on constructor) + * Reflect.decorate(decoratorsArray, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.decorate(decoratorsArray, Example.prototype, "property"); + * + * // method (on constructor) + * Object.defineProperty(Example, "staticMethod", + * Reflect.decorate(decoratorsArray, Example, "staticMethod", + * Object.getOwnPropertyDescriptor(Example, "staticMethod"))); + * + * // method (on prototype) + * Object.defineProperty(Example.prototype, "method", + * Reflect.decorate(decoratorsArray, Example.prototype, "method", + * Object.getOwnPropertyDescriptor(Example.prototype, "method"))); + * + */ + function decorate(decorators, target, propertyKey, attributes) { + if (!IsUndefined(propertyKey)) { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsObject(target)) + throw new TypeError(); + if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes)) + throw new TypeError(); + if (IsNull(attributes)) + attributes = undefined; + propertyKey = ToPropertyKey(propertyKey); + return DecorateProperty(decorators, target, propertyKey, attributes); + } + else { + if (!IsArray(decorators)) + throw new TypeError(); + if (!IsConstructor(target)) + throw new TypeError(); + return DecorateConstructor(decorators, target); + } + } + exporter("decorate", decorate); + // 4.1.2 Reflect.metadata(metadataKey, metadataValue) + // https://rbuckton.github.io/reflect-metadata/#reflect.metadata + /** + * A default metadata decorator factory that can be used on a class, class member, or parameter. + * @param metadataKey The key for the metadata entry. + * @param metadataValue The value for the metadata entry. + * @returns A decorator function. + * @remarks + * If `metadataKey` is already defined for the target and target key, the + * metadataValue for that key will be overwritten. + * @example + * + * // constructor + * @Reflect.metadata(key, value) + * class Example { + * } + * + * // property (on constructor, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * static staticProperty; + * } + * + * // property (on prototype, TypeScript only) + * class Example { + * @Reflect.metadata(key, value) + * property; + * } + * + * // method (on constructor) + * class Example { + * @Reflect.metadata(key, value) + * static staticMethod() { } + * } + * + * // method (on prototype) + * class Example { + * @Reflect.metadata(key, value) + * method() { } + * } + * + */ + function metadata(metadataKey, metadataValue) { + function decorator(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey)) + throw new TypeError(); + OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + return decorator; + } + exporter("metadata", metadata); + /** + * Define a unique metadata entry on the target. + * @param metadataKey A key used to store and retrieve metadata. + * @param metadataValue A value that contains attached metadata. + * @param target The target object on which to define metadata. + * @param propertyKey (Optional) The property key for the target. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * Reflect.defineMetadata("custom:annotation", options, Example); + * + * // property (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticProperty"); + * + * // property (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "property"); + * + * // method (on constructor) + * Reflect.defineMetadata("custom:annotation", options, Example, "staticMethod"); + * + * // method (on prototype) + * Reflect.defineMetadata("custom:annotation", options, Example.prototype, "method"); + * + * // decorator factory as metadata-producing annotation. + * function MyAnnotation(options): Decorator { + * return (target, key?) => Reflect.defineMetadata("custom:annotation", options, target, key); + * } + * + */ + function defineMetadata(metadataKey, metadataValue, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey); + } + exporter("defineMetadata", defineMetadata); + /** + * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasMetadata(metadataKey, target, propertyKey); + } + exporter("hasMetadata", hasMetadata); + /** + * Gets a value indicating whether the target object has the provided metadata key defined. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata key was defined on the target object; otherwise, `false`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.hasOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.hasOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.hasOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function hasOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey); + } + exporter("hasOwnMetadata", hasOwnMetadata); + /** + * Gets the metadata value for the provided metadata key on the target object or its prototype chain. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetMetadata(metadataKey, target, propertyKey); + } + exporter("getMetadata", getMetadata); + /** + * Gets the metadata value for the provided metadata key on the target object. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns The metadata value for the metadata key if found; otherwise, `undefined`. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function getOwnMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey); + } + exporter("getOwnMetadata", getOwnMetadata); + /** + * Gets the metadata keys defined on the target object or its prototype chain. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getMetadataKeys(Example.prototype, "method"); + * + */ + function getMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryMetadataKeys(target, propertyKey); + } + exporter("getMetadataKeys", getMetadataKeys); + /** + * Gets the unique metadata keys defined on the target object. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns An array of unique metadata keys. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.getOwnMetadataKeys(Example); + * + * // property (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.getOwnMetadataKeys(Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.getOwnMetadataKeys(Example.prototype, "method"); + * + */ + function getOwnMetadataKeys(target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + return OrdinaryOwnMetadataKeys(target, propertyKey); + } + exporter("getOwnMetadataKeys", getOwnMetadataKeys); + /** + * Deletes the metadata entry from the target object with the provided key. + * @param metadataKey A key used to store and retrieve metadata. + * @param target The target object on which the metadata is defined. + * @param propertyKey (Optional) The property key for the target. + * @returns `true` if the metadata entry was found and deleted; otherwise, false. + * @example + * + * class Example { + * // property declarations are not part of ES6, though they are valid in TypeScript: + * // static staticProperty; + * // property; + * + * constructor(p) { } + * static staticMethod(p) { } + * method(p) { } + * } + * + * // constructor + * result = Reflect.deleteMetadata("custom:annotation", Example); + * + * // property (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticProperty"); + * + * // property (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "property"); + * + * // method (on constructor) + * result = Reflect.deleteMetadata("custom:annotation", Example, "staticMethod"); + * + * // method (on prototype) + * result = Reflect.deleteMetadata("custom:annotation", Example.prototype, "method"); + * + */ + function deleteMetadata(metadataKey, target, propertyKey) { + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + if (!IsObject(target)) + throw new TypeError(); + if (!IsUndefined(propertyKey)) + propertyKey = ToPropertyKey(propertyKey); + var provider = GetMetadataProvider(target, propertyKey, /*Create*/ false); + if (IsUndefined(provider)) + return false; + return provider.OrdinaryDeleteMetadata(metadataKey, target, propertyKey); + } + exporter("deleteMetadata", deleteMetadata); + function DecorateConstructor(decorators, target) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsConstructor(decorated)) + throw new TypeError(); + target = decorated; + } + } + return target; + } + function DecorateProperty(decorators, target, propertyKey, descriptor) { + for (var i = decorators.length - 1; i >= 0; --i) { + var decorator = decorators[i]; + var decorated = decorator(target, propertyKey, descriptor); + if (!IsUndefined(decorated) && !IsNull(decorated)) { + if (!IsObject(decorated)) + throw new TypeError(); + descriptor = decorated; + } + } + return descriptor; + } + // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata + function OrdinaryHasMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return true; + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryHasMetadata(MetadataKey, parent, P); + return false; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var provider = GetMetadataProvider(O, P, /*Create*/ false); + if (IsUndefined(provider)) + return false; + return ToBoolean(provider.OrdinaryHasOwnMetadata(MetadataKey, O, P)); + } + // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata + function OrdinaryGetMetadata(MetadataKey, O, P) { + var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P); + if (hasOwn) + return OrdinaryGetOwnMetadata(MetadataKey, O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (!IsNull(parent)) + return OrdinaryGetMetadata(MetadataKey, parent, P); + return undefined; + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var provider = GetMetadataProvider(O, P, /*Create*/ false); + if (IsUndefined(provider)) + return; + return provider.OrdinaryGetOwnMetadata(MetadataKey, O, P); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var provider = GetMetadataProvider(O, P, /*Create*/ true); + provider.OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P); + } + // 3.1.6.1 OrdinaryMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys + function OrdinaryMetadataKeys(O, P) { + var ownKeys = OrdinaryOwnMetadataKeys(O, P); + var parent = OrdinaryGetPrototypeOf(O); + if (parent === null) + return ownKeys; + var parentKeys = OrdinaryMetadataKeys(parent, P); + if (parentKeys.length <= 0) + return ownKeys; + if (ownKeys.length <= 0) + return parentKeys; + var set = new _Set(); + var keys = []; + for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) { + var key = ownKeys_1[_i]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) { + var key = parentKeys_1[_a]; + var hasKey = set.has(key); + if (!hasKey) { + set.add(key); + keys.push(key); + } + } + return keys; + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var provider = GetMetadataProvider(O, P, /*create*/ false); + if (!provider) { + return []; + } + return provider.OrdinaryOwnMetadataKeys(O, P); + } + // 6 ECMAScript Data Types and Values + // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values + function Type(x) { + if (x === null) + return 1 /* Null */; + switch (typeof x) { + case "undefined": return 0 /* Undefined */; + case "boolean": return 2 /* Boolean */; + case "string": return 3 /* String */; + case "symbol": return 4 /* Symbol */; + case "number": return 5 /* Number */; + case "object": return x === null ? 1 /* Null */ : 6 /* Object */; + default: return 6 /* Object */; + } + } + // 6.1.1 The Undefined Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type + function IsUndefined(x) { + return x === undefined; + } + // 6.1.2 The Null Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type + function IsNull(x) { + return x === null; + } + // 6.1.5 The Symbol Type + // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type + function IsSymbol(x) { + return typeof x === "symbol"; + } + // 6.1.7 The Object Type + // https://tc39.github.io/ecma262/#sec-object-type + function IsObject(x) { + return typeof x === "object" ? x !== null : typeof x === "function"; + } + // 7.1 Type Conversion + // https://tc39.github.io/ecma262/#sec-type-conversion + // 7.1.1 ToPrimitive(input [, PreferredType]) + // https://tc39.github.io/ecma262/#sec-toprimitive + function ToPrimitive(input, PreferredType) { + switch (Type(input)) { + case 0 /* Undefined */: return input; + case 1 /* Null */: return input; + case 2 /* Boolean */: return input; + case 3 /* String */: return input; + case 4 /* Symbol */: return input; + case 5 /* Number */: return input; + } + var hint = PreferredType === 3 /* String */ ? "string" : PreferredType === 5 /* Number */ ? "number" : "default"; + var exoticToPrim = GetMethod(input, toPrimitiveSymbol); + if (exoticToPrim !== undefined) { + var result = exoticToPrim.call(input, hint); + if (IsObject(result)) + throw new TypeError(); + return result; + } + return OrdinaryToPrimitive(input, hint === "default" ? "number" : hint); + } + // 7.1.1.1 OrdinaryToPrimitive(O, hint) + // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive + function OrdinaryToPrimitive(O, hint) { + if (hint === "string") { + var toString_1 = O.toString; + if (IsCallable(toString_1)) { + var result = toString_1.call(O); + if (!IsObject(result)) + return result; + } + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + } + else { + var valueOf = O.valueOf; + if (IsCallable(valueOf)) { + var result = valueOf.call(O); + if (!IsObject(result)) + return result; + } + var toString_2 = O.toString; + if (IsCallable(toString_2)) { + var result = toString_2.call(O); + if (!IsObject(result)) + return result; + } + } + throw new TypeError(); + } + // 7.1.2 ToBoolean(argument) + // https://tc39.github.io/ecma262/2016/#sec-toboolean + function ToBoolean(argument) { + return !!argument; + } + // 7.1.12 ToString(argument) + // https://tc39.github.io/ecma262/#sec-tostring + function ToString(argument) { + return "" + argument; + } + // 7.1.14 ToPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-topropertykey + function ToPropertyKey(argument) { + var key = ToPrimitive(argument, 3 /* String */); + if (IsSymbol(key)) + return key; + return ToString(key); + } + // 7.2 Testing and Comparison Operations + // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations + // 7.2.2 IsArray(argument) + // https://tc39.github.io/ecma262/#sec-isarray + function IsArray(argument) { + return Array.isArray + ? Array.isArray(argument) + : argument instanceof Object + ? argument instanceof Array + : Object.prototype.toString.call(argument) === "[object Array]"; + } + // 7.2.3 IsCallable(argument) + // https://tc39.github.io/ecma262/#sec-iscallable + function IsCallable(argument) { + // NOTE: This is an approximation as we cannot check for [[Call]] internal method. + return typeof argument === "function"; + } + // 7.2.4 IsConstructor(argument) + // https://tc39.github.io/ecma262/#sec-isconstructor + function IsConstructor(argument) { + // NOTE: This is an approximation as we cannot check for [[Construct]] internal method. + return typeof argument === "function"; + } + // 7.2.7 IsPropertyKey(argument) + // https://tc39.github.io/ecma262/#sec-ispropertykey + function IsPropertyKey(argument) { + switch (Type(argument)) { + case 3 /* String */: return true; + case 4 /* Symbol */: return true; + default: return false; + } + } + function SameValueZero(x, y) { + return x === y || x !== x && y !== y; + } + // 7.3 Operations on Objects + // https://tc39.github.io/ecma262/#sec-operations-on-objects + // 7.3.9 GetMethod(V, P) + // https://tc39.github.io/ecma262/#sec-getmethod + function GetMethod(V, P) { + var func = V[P]; + if (func === undefined || func === null) + return undefined; + if (!IsCallable(func)) + throw new TypeError(); + return func; + } + // 7.4 Operations on Iterator Objects + // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects + function GetIterator(obj) { + var method = GetMethod(obj, iteratorSymbol); + if (!IsCallable(method)) + throw new TypeError(); // from Call + var iterator = method.call(obj); + if (!IsObject(iterator)) + throw new TypeError(); + return iterator; + } + // 7.4.4 IteratorValue(iterResult) + // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue + function IteratorValue(iterResult) { + return iterResult.value; + } + // 7.4.5 IteratorStep(iterator) + // https://tc39.github.io/ecma262/#sec-iteratorstep + function IteratorStep(iterator) { + var result = iterator.next(); + return result.done ? false : result; + } + // 7.4.6 IteratorClose(iterator, completion) + // https://tc39.github.io/ecma262/#sec-iteratorclose + function IteratorClose(iterator) { + var f = iterator["return"]; + if (f) + f.call(iterator); + } + // 9.1 Ordinary Object Internal Methods and Internal Slots + // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots + // 9.1.1.1 OrdinaryGetPrototypeOf(O) + // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof + function OrdinaryGetPrototypeOf(O) { + var proto = Object.getPrototypeOf(O); + if (typeof O !== "function" || O === functionPrototype) + return proto; + // TypeScript doesn't set __proto__ in ES5, as it's non-standard. + // Try to determine the superclass constructor. Compatible implementations + // must either set __proto__ on a subclass constructor to the superclass constructor, + // or ensure each class has a valid `constructor` property on its prototype that + // points back to the constructor. + // If this is not the same as Function.[[Prototype]], then this is definately inherited. + // This is the case when in ES6 or when using __proto__ in a compatible browser. + if (proto !== functionPrototype) + return proto; + // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage. + var prototype = O.prototype; + var prototypeProto = prototype && Object.getPrototypeOf(prototype); + if (prototypeProto == null || prototypeProto === Object.prototype) + return proto; + // If the constructor was not a function, then we cannot determine the heritage. + var constructor = prototypeProto.constructor; + if (typeof constructor !== "function") + return proto; + // If we have some kind of self-reference, then we cannot determine the heritage. + if (constructor === O) + return proto; + // we have a pretty good guess at the heritage. + return constructor; + } + // Global metadata registry + // - Allows `import "reflect-metadata"` and `import "reflect-metadata/no-conflict"` to interoperate. + // - Uses isolated metadata if `Reflect` is frozen before the registry can be installed. + /** + * Creates a registry used to allow multiple `reflect-metadata` providers. + */ + function CreateMetadataRegistry() { + var fallback; + if (!IsUndefined(registrySymbol) && + typeof root.Reflect !== "undefined" && + !(registrySymbol in root.Reflect) && + typeof root.Reflect.defineMetadata === "function") { + // interoperate with older version of `reflect-metadata` that did not support a registry. + fallback = CreateFallbackProvider(root.Reflect); + } + var first; + var second; + var rest; + var targetProviderMap = new _WeakMap(); + var registry = { + registerProvider: registerProvider, + getProvider: getProvider, + setProvider: setProvider, + }; + return registry; + function registerProvider(provider) { + if (!Object.isExtensible(registry)) { + throw new Error("Cannot add provider to a frozen registry."); + } + switch (true) { + case fallback === provider: break; + case IsUndefined(first): + first = provider; + break; + case first === provider: break; + case IsUndefined(second): + second = provider; + break; + case second === provider: break; + default: + if (rest === undefined) + rest = new _Set(); + rest.add(provider); + break; + } + } + function getProviderNoCache(O, P) { + if (!IsUndefined(first)) { + if (first.isProviderFor(O, P)) + return first; + if (!IsUndefined(second)) { + if (second.isProviderFor(O, P)) + return first; + if (!IsUndefined(rest)) { + var iterator = GetIterator(rest); + while (true) { + var next = IteratorStep(iterator); + if (!next) { + return undefined; + } + var provider = IteratorValue(next); + if (provider.isProviderFor(O, P)) { + IteratorClose(iterator); + return provider; + } + } + } + } + } + if (!IsUndefined(fallback) && fallback.isProviderFor(O, P)) { + return fallback; + } + return undefined; + } + function getProvider(O, P) { + var providerMap = targetProviderMap.get(O); + var provider; + if (!IsUndefined(providerMap)) { + provider = providerMap.get(P); + } + if (!IsUndefined(provider)) { + return provider; + } + provider = getProviderNoCache(O, P); + if (!IsUndefined(provider)) { + if (IsUndefined(providerMap)) { + providerMap = new _Map(); + targetProviderMap.set(O, providerMap); + } + providerMap.set(P, provider); + } + return provider; + } + function hasProvider(provider) { + if (IsUndefined(provider)) + throw new TypeError(); + return first === provider || second === provider || !IsUndefined(rest) && rest.has(provider); + } + function setProvider(O, P, provider) { + if (!hasProvider(provider)) { + throw new Error("Metadata provider not registered."); + } + var existingProvider = getProvider(O, P); + if (existingProvider !== provider) { + if (!IsUndefined(existingProvider)) { + return false; + } + var providerMap = targetProviderMap.get(O); + if (IsUndefined(providerMap)) { + providerMap = new _Map(); + targetProviderMap.set(O, providerMap); + } + providerMap.set(P, provider); + } + return true; + } + } + /** + * Gets or creates the shared registry of metadata providers. + */ + function GetOrCreateMetadataRegistry() { + var metadataRegistry; + if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) { + metadataRegistry = root.Reflect[registrySymbol]; + } + if (IsUndefined(metadataRegistry)) { + metadataRegistry = CreateMetadataRegistry(); + } + if (!IsUndefined(registrySymbol) && IsObject(root.Reflect) && Object.isExtensible(root.Reflect)) { + Object.defineProperty(root.Reflect, registrySymbol, { + enumerable: false, + configurable: false, + writable: false, + value: metadataRegistry + }); + } + return metadataRegistry; + } + function CreateMetadataProvider(registry) { + // [[Metadata]] internal slot + // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots + var metadata = new _WeakMap(); + var provider = { + isProviderFor: function (O, P) { + var targetMetadata = metadata.get(O); + if (IsUndefined(targetMetadata)) + return false; + return targetMetadata.has(P); + }, + OrdinaryDefineOwnMetadata: OrdinaryDefineOwnMetadata, + OrdinaryHasOwnMetadata: OrdinaryHasOwnMetadata, + OrdinaryGetOwnMetadata: OrdinaryGetOwnMetadata, + OrdinaryOwnMetadataKeys: OrdinaryOwnMetadataKeys, + OrdinaryDeleteMetadata: OrdinaryDeleteMetadata, + }; + metadataRegistry.registerProvider(provider); + return provider; + function GetOrCreateMetadataMap(O, P, Create) { + var targetMetadata = metadata.get(O); + var createdTargetMetadata = false; + if (IsUndefined(targetMetadata)) { + if (!Create) + return undefined; + targetMetadata = new _Map(); + metadata.set(O, targetMetadata); + createdTargetMetadata = true; + } + var metadataMap = targetMetadata.get(P); + if (IsUndefined(metadataMap)) { + if (!Create) + return undefined; + metadataMap = new _Map(); + targetMetadata.set(P, metadataMap); + if (!registry.setProvider(O, P, provider)) { + targetMetadata.delete(P); + if (createdTargetMetadata) { + metadata.delete(O); + } + throw new Error("Wrong provider for target."); + } + } + return metadataMap; + } + // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata + function OrdinaryHasOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + return ToBoolean(metadataMap.has(MetadataKey)); + } + // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata + function OrdinaryGetOwnMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return undefined; + return metadataMap.get(MetadataKey); + } + // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata + function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true); + metadataMap.set(MetadataKey, MetadataValue); + } + // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P) + // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys + function OrdinaryOwnMetadataKeys(O, P) { + var keys = []; + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return keys; + var keysObj = metadataMap.keys(); + var iterator = GetIterator(keysObj); + var k = 0; + while (true) { + var next = IteratorStep(iterator); + if (!next) { + keys.length = k; + return keys; + } + var nextValue = IteratorValue(next); + try { + keys[k] = nextValue; + } + catch (e) { + try { + IteratorClose(iterator); + } + finally { + throw e; + } + } + k++; + } + } + function OrdinaryDeleteMetadata(MetadataKey, O, P) { + var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false); + if (IsUndefined(metadataMap)) + return false; + if (!metadataMap.delete(MetadataKey)) + return false; + if (metadataMap.size === 0) { + var targetMetadata = metadata.get(O); + if (!IsUndefined(targetMetadata)) { + targetMetadata.delete(P); + if (targetMetadata.size === 0) { + metadata.delete(targetMetadata); + } + } + } + return true; + } + } + function CreateFallbackProvider(reflect) { + var defineMetadata = reflect.defineMetadata, hasOwnMetadata = reflect.hasOwnMetadata, getOwnMetadata = reflect.getOwnMetadata, getOwnMetadataKeys = reflect.getOwnMetadataKeys, deleteMetadata = reflect.deleteMetadata; + var metadataOwner = new _WeakMap(); + var provider = { + isProviderFor: function (O, P) { + var metadataPropertySet = metadataOwner.get(O); + if (!IsUndefined(metadataPropertySet) && metadataPropertySet.has(P)) { + return true; + } + if (getOwnMetadataKeys(O, P).length) { + if (IsUndefined(metadataPropertySet)) { + metadataPropertySet = new _Set(); + metadataOwner.set(O, metadataPropertySet); + } + metadataPropertySet.add(P); + return true; + } + return false; + }, + OrdinaryDefineOwnMetadata: defineMetadata, + OrdinaryHasOwnMetadata: hasOwnMetadata, + OrdinaryGetOwnMetadata: getOwnMetadata, + OrdinaryOwnMetadataKeys: getOwnMetadataKeys, + OrdinaryDeleteMetadata: deleteMetadata, + }; + return provider; + } + /** + * Gets the metadata provider for an object. If the object has no metadata provider and this is for a create operation, + * then this module's metadata provider is assigned to the object. + */ + function GetMetadataProvider(O, P, Create) { + var registeredProvider = metadataRegistry.getProvider(O, P); + if (!IsUndefined(registeredProvider)) { + return registeredProvider; + } + if (Create) { + if (metadataRegistry.setProvider(O, P, metadataProvider)) { + return metadataProvider; + } + throw new Error("Illegal state."); + } + return undefined; + } + // naive Map shim + function CreateMapPolyfill() { + var cacheSentinel = {}; + var arraySentinel = []; + var MapIterator = /** @class */ (function () { + function MapIterator(keys, values, selector) { + this._index = 0; + this._keys = keys; + this._values = values; + this._selector = selector; + } + MapIterator.prototype["@@iterator"] = function () { return this; }; + MapIterator.prototype[iteratorSymbol] = function () { return this; }; + MapIterator.prototype.next = function () { + var index = this._index; + if (index >= 0 && index < this._keys.length) { + var result = this._selector(this._keys[index], this._values[index]); + if (index + 1 >= this._keys.length) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + else { + this._index++; + } + return { value: result, done: false }; + } + return { value: undefined, done: true }; + }; + MapIterator.prototype.throw = function (error) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + throw error; + }; + MapIterator.prototype.return = function (value) { + if (this._index >= 0) { + this._index = -1; + this._keys = arraySentinel; + this._values = arraySentinel; + } + return { value: value, done: true }; + }; + return MapIterator; + }()); + var Map = /** @class */ (function () { + function Map() { + this._keys = []; + this._values = []; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + Object.defineProperty(Map.prototype, "size", { + get: function () { return this._keys.length; }, + enumerable: true, + configurable: true + }); + Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; }; + Map.prototype.get = function (key) { + var index = this._find(key, /*insert*/ false); + return index >= 0 ? this._values[index] : undefined; + }; + Map.prototype.set = function (key, value) { + var index = this._find(key, /*insert*/ true); + this._values[index] = value; + return this; + }; + Map.prototype.delete = function (key) { + var index = this._find(key, /*insert*/ false); + if (index >= 0) { + var size = this._keys.length; + for (var i = index + 1; i < size; i++) { + this._keys[i - 1] = this._keys[i]; + this._values[i - 1] = this._values[i]; + } + this._keys.length--; + this._values.length--; + if (SameValueZero(key, this._cacheKey)) { + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + } + return true; + } + return false; + }; + Map.prototype.clear = function () { + this._keys.length = 0; + this._values.length = 0; + this._cacheKey = cacheSentinel; + this._cacheIndex = -2; + }; + Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); }; + Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); }; + Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); }; + Map.prototype["@@iterator"] = function () { return this.entries(); }; + Map.prototype[iteratorSymbol] = function () { return this.entries(); }; + Map.prototype._find = function (key, insert) { + if (!SameValueZero(this._cacheKey, key)) { + this._cacheIndex = -1; + for (var i = 0; i < this._keys.length; i++) { + if (SameValueZero(this._keys[i], key)) { + this._cacheIndex = i; + break; + } + } + } + if (this._cacheIndex < 0 && insert) { + this._cacheIndex = this._keys.length; + this._keys.push(key); + this._values.push(undefined); + } + return this._cacheIndex; + }; + return Map; + }()); + return Map; + function getKey(key, _) { + return key; + } + function getValue(_, value) { + return value; + } + function getEntry(key, value) { + return [key, value]; + } + } + // naive Set shim + function CreateSetPolyfill() { + var Set = /** @class */ (function () { + function Set() { + this._map = new _Map(); + } + Object.defineProperty(Set.prototype, "size", { + get: function () { return this._map.size; }, + enumerable: true, + configurable: true + }); + Set.prototype.has = function (value) { return this._map.has(value); }; + Set.prototype.add = function (value) { return this._map.set(value, value), this; }; + Set.prototype.delete = function (value) { return this._map.delete(value); }; + Set.prototype.clear = function () { this._map.clear(); }; + Set.prototype.keys = function () { return this._map.keys(); }; + Set.prototype.values = function () { return this._map.keys(); }; + Set.prototype.entries = function () { return this._map.entries(); }; + Set.prototype["@@iterator"] = function () { return this.keys(); }; + Set.prototype[iteratorSymbol] = function () { return this.keys(); }; + return Set; + }()); + return Set; + } + // naive WeakMap shim + function CreateWeakMapPolyfill() { + var UUID_SIZE = 16; + var keys = HashMap.create(); + var rootKey = CreateUniqueKey(); + return /** @class */ (function () { + function WeakMap() { + this._key = CreateUniqueKey(); + } + WeakMap.prototype.has = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.has(table, this._key) : false; + }; + WeakMap.prototype.get = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? HashMap.get(table, this._key) : undefined; + }; + WeakMap.prototype.set = function (target, value) { + var table = GetOrCreateWeakMapTable(target, /*create*/ true); + table[this._key] = value; + return this; + }; + WeakMap.prototype.delete = function (target) { + var table = GetOrCreateWeakMapTable(target, /*create*/ false); + return table !== undefined ? delete table[this._key] : false; + }; + WeakMap.prototype.clear = function () { + // NOTE: not a real clear, just makes the previous data unreachable + this._key = CreateUniqueKey(); + }; + return WeakMap; + }()); + function CreateUniqueKey() { + var key; + do + key = "@@WeakMap@@" + CreateUUID(); + while (HashMap.has(keys, key)); + keys[key] = true; + return key; + } + function GetOrCreateWeakMapTable(target, create) { + if (!hasOwn.call(target, rootKey)) { + if (!create) + return undefined; + Object.defineProperty(target, rootKey, { value: HashMap.create() }); + } + return target[rootKey]; + } + function FillRandomBytes(buffer, size) { + for (var i = 0; i < size; ++i) + buffer[i] = Math.random() * 0xff | 0; + return buffer; + } + function GenRandomBytes(size) { + if (typeof Uint8Array === "function") { + var array = new Uint8Array(size); + if (typeof crypto !== "undefined") { + crypto.getRandomValues(array); + } + else if (typeof msCrypto !== "undefined") { + msCrypto.getRandomValues(array); + } + else { + FillRandomBytes(array, size); + } + return array; + } + return FillRandomBytes(new Array(size), size); + } + function CreateUUID() { + var data = GenRandomBytes(UUID_SIZE); + // mark as random - RFC 4122 § 4.4 + data[6] = data[6] & 0x4f | 0x40; + data[8] = data[8] & 0xbf | 0x80; + var result = ""; + for (var offset = 0; offset < UUID_SIZE; ++offset) { + var byte = data[offset]; + if (offset === 4 || offset === 6 || offset === 8) + result += "-"; + if (byte < 16) + result += "0"; + result += byte.toString(16).toLowerCase(); + } + return result; + } + } + // uses a heuristic used by v8 and chakra to force an object into dictionary mode. + function MakeDictionary(obj) { + obj.__ = undefined; + delete obj.__; + return obj; + } + }); +})(Reflect || (Reflect = {})); + + +/***/ }), + +/***/ 11997: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/cbc.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var xor = __webpack_require__(/*! buffer-xor */ 67023) + +exports.encrypt = function (self, block) { + var data = xor(block, self._prev) + + self._prev = self._cipher.encryptBlock(data) + return self._prev +} + +exports.decrypt = function (self, block) { + var pad = self._prev + + self._prev = block + var out = self._cipher.decryptBlock(block) + + return xor(out, pad) +} + + +/***/ }), + +/***/ 12026: +/*!********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/attributes/message_digest.js ***! + \********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ MessageDigest: () => (/* binding */ MessageDigest), +/* harmony export */ id_messageDigest: () => (/* binding */ id_messageDigest) +/* harmony export */ }); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + +const id_messageDigest = "1.2.840.113549.1.9.4"; +class MessageDigest extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.OctetString { +} + + +/***/ }), + +/***/ 12128: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/sha.js@2.4.12/node_modules/sha.js/sha224.js ***! + \*************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/** + * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined + * in FIPS 180-2 + * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * + */ + +var inherits = __webpack_require__(/*! inherits */ 18628); +var Sha256 = __webpack_require__(/*! ./sha256 */ 96549); +var Hash = __webpack_require__(/*! ./hash */ 76626); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +var W = new Array(64); + +function Sha224() { + this.init(); + + this._w = W; // new Array(64) + + Hash.call(this, 64, 56); +} + +inherits(Sha224, Sha256); + +Sha224.prototype.init = function () { + this._a = 0xc1059ed8; + this._b = 0x367cd507; + this._c = 0x3070dd17; + this._d = 0xf70e5939; + this._e = 0xffc00b31; + this._f = 0x68581511; + this._g = 0x64f98fa7; + this._h = 0xbefa4fa4; + + return this; +}; + +Sha224.prototype._hash = function () { + var H = Buffer.allocUnsafe(28); + + H.writeInt32BE(this._a, 0); + H.writeInt32BE(this._b, 4); + H.writeInt32BE(this._c, 8); + H.writeInt32BE(this._d, 12); + H.writeInt32BE(this._e, 16); + H.writeInt32BE(this._f, 20); + H.writeInt32BE(this._g, 24); + + return H; +}; + +module.exports = Sha224; + + +/***/ }), + +/***/ 12647: +/*!************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_directory_attributes.js ***! + \************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SubjectDirectoryAttributes: () => (/* binding */ SubjectDirectoryAttributes), +/* harmony export */ id_ce_subjectDirectoryAttributes: () => (/* binding */ id_ce_subjectDirectoryAttributes) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _attribute_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../attribute.js */ 820); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var SubjectDirectoryAttributes_1; + + + + +const id_ce_subjectDirectoryAttributes = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_ce}.9`; +let SubjectDirectoryAttributes = SubjectDirectoryAttributes_1 = class SubjectDirectoryAttributes extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, SubjectDirectoryAttributes_1.prototype); + } +}; +SubjectDirectoryAttributes = SubjectDirectoryAttributes_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _attribute_js__WEBPACK_IMPORTED_MODULE_2__.Attribute, + }) +], SubjectDirectoryAttributes); + + + +/***/ }), + +/***/ 12776: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-ecc@2.8.0/node_modules/@peculiar/asn1-ecc/build/es2015/algorithms.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ecdsaWithSHA1: () => (/* binding */ ecdsaWithSHA1), +/* harmony export */ ecdsaWithSHA224: () => (/* binding */ ecdsaWithSHA224), +/* harmony export */ ecdsaWithSHA256: () => (/* binding */ ecdsaWithSHA256), +/* harmony export */ ecdsaWithSHA384: () => (/* binding */ ecdsaWithSHA384), +/* harmony export */ ecdsaWithSHA512: () => (/* binding */ ecdsaWithSHA512) +/* harmony export */ }); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./object_identifiers.js */ 75958); + + +function create(algorithm) { + return new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_0__.AlgorithmIdentifier({ algorithm }); +} +const ecdsaWithSHA1 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ecdsaWithSHA1); +const ecdsaWithSHA224 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ecdsaWithSHA224); +const ecdsaWithSHA256 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ecdsaWithSHA256); +const ecdsaWithSHA384 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ecdsaWithSHA384); +const ecdsaWithSHA512 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ecdsaWithSHA512); + + +/***/ }), + +/***/ 12824: +/*!**************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/index.js ***! + \**************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AccessDescription: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.AccessDescription), +/* harmony export */ AlgorithmIdentifier: () => (/* reexport safe */ _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier), +/* harmony export */ AsnIpConverter: () => (/* reexport safe */ _general_name_js__WEBPACK_IMPORTED_MODULE_6__.AsnIpConverter), +/* harmony export */ Attribute: () => (/* reexport safe */ _attribute_js__WEBPACK_IMPORTED_MODULE_2__.Attribute), +/* harmony export */ AttributeTypeAndValue: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.AttributeTypeAndValue), +/* harmony export */ AttributeValue: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.AttributeValue), +/* harmony export */ AuthorityInfoAccessSyntax: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.AuthorityInfoAccessSyntax), +/* harmony export */ AuthorityKeyIdentifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.AuthorityKeyIdentifier), +/* harmony export */ BaseCRLNumber: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.BaseCRLNumber), +/* harmony export */ BasicConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.BasicConstraints), +/* harmony export */ CRLDistributionPoints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CRLDistributionPoints), +/* harmony export */ CRLNumber: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CRLNumber), +/* harmony export */ CRLReason: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CRLReason), +/* harmony export */ CRLReasons: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CRLReasons), +/* harmony export */ Certificate: () => (/* reexport safe */ _certificate_js__WEBPACK_IMPORTED_MODULE_3__.Certificate), +/* harmony export */ CertificateIssuer: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CertificateIssuer), +/* harmony export */ CertificateList: () => (/* reexport safe */ _certificate_list_js__WEBPACK_IMPORTED_MODULE_4__.CertificateList), +/* harmony export */ CertificatePolicies: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.CertificatePolicies), +/* harmony export */ DirectoryString: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.DirectoryString), +/* harmony export */ DisplayText: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.DisplayText), +/* harmony export */ DistributionPoint: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.DistributionPoint), +/* harmony export */ DistributionPointName: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.DistributionPointName), +/* harmony export */ EDIPartyName: () => (/* reexport safe */ _general_name_js__WEBPACK_IMPORTED_MODULE_6__.EDIPartyName), +/* harmony export */ EntrustInfo: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.EntrustInfo), +/* harmony export */ EntrustInfoFlags: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.EntrustInfoFlags), +/* harmony export */ EntrustVersionInfo: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.EntrustVersionInfo), +/* harmony export */ ExtendedKeyUsage: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.ExtendedKeyUsage), +/* harmony export */ Extension: () => (/* reexport safe */ _extension_js__WEBPACK_IMPORTED_MODULE_5__.Extension), +/* harmony export */ Extensions: () => (/* reexport safe */ _extension_js__WEBPACK_IMPORTED_MODULE_5__.Extensions), +/* harmony export */ FreshestCRL: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.FreshestCRL), +/* harmony export */ GeneralName: () => (/* reexport safe */ _general_name_js__WEBPACK_IMPORTED_MODULE_6__.GeneralName), +/* harmony export */ GeneralNames: () => (/* reexport safe */ _general_names_js__WEBPACK_IMPORTED_MODULE_7__.GeneralNames), +/* harmony export */ GeneralSubtree: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.GeneralSubtree), +/* harmony export */ GeneralSubtrees: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.GeneralSubtrees), +/* harmony export */ InhibitAnyPolicy: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.InhibitAnyPolicy), +/* harmony export */ InvalidityDate: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.InvalidityDate), +/* harmony export */ IssueAlternativeName: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.IssueAlternativeName), +/* harmony export */ IssuingDistributionPoint: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.IssuingDistributionPoint), +/* harmony export */ KeyIdentifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.KeyIdentifier), +/* harmony export */ KeyUsage: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.KeyUsage), +/* harmony export */ KeyUsageFlags: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.KeyUsageFlags), +/* harmony export */ Name: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.Name), +/* harmony export */ NameConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.NameConstraints), +/* harmony export */ NoticeReference: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.NoticeReference), +/* harmony export */ OtherName: () => (/* reexport safe */ _general_name_js__WEBPACK_IMPORTED_MODULE_6__.OtherName), +/* harmony export */ PolicyConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PolicyConstraints), +/* harmony export */ PolicyInformation: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PolicyInformation), +/* harmony export */ PolicyMapping: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PolicyMapping), +/* harmony export */ PolicyMappings: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PolicyMappings), +/* harmony export */ PolicyQualifierInfo: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PolicyQualifierInfo), +/* harmony export */ PrivateKeyUsagePeriod: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.PrivateKeyUsagePeriod), +/* harmony export */ Qualifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.Qualifier), +/* harmony export */ RDNSequence: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.RDNSequence), +/* harmony export */ Reason: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.Reason), +/* harmony export */ ReasonFlags: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.ReasonFlags), +/* harmony export */ RelativeDistinguishedName: () => (/* reexport safe */ _name_js__WEBPACK_IMPORTED_MODULE_8__.RelativeDistinguishedName), +/* harmony export */ RevokedCertificate: () => (/* reexport safe */ _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_11__.RevokedCertificate), +/* harmony export */ SubjectAlternativeName: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.SubjectAlternativeName), +/* harmony export */ SubjectDirectoryAttributes: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.SubjectDirectoryAttributes), +/* harmony export */ SubjectInfoAccessSyntax: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.SubjectInfoAccessSyntax), +/* harmony export */ SubjectKeyIdentifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.SubjectKeyIdentifier), +/* harmony export */ SubjectPublicKeyInfo: () => (/* reexport safe */ _subject_public_key_info_js__WEBPACK_IMPORTED_MODULE_10__.SubjectPublicKeyInfo), +/* harmony export */ TBSCertList: () => (/* reexport safe */ _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_11__.TBSCertList), +/* harmony export */ TBSCertificate: () => (/* reexport safe */ _tbs_certificate_js__WEBPACK_IMPORTED_MODULE_12__.TBSCertificate), +/* harmony export */ Time: () => (/* reexport safe */ _time_js__WEBPACK_IMPORTED_MODULE_13__.Time), +/* harmony export */ UserNotice: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.UserNotice), +/* harmony export */ Validity: () => (/* reexport safe */ _validity_js__WEBPACK_IMPORTED_MODULE_15__.Validity), +/* harmony export */ Version: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_14__.Version), +/* harmony export */ anyExtendedKeyUsage: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.anyExtendedKeyUsage), +/* harmony export */ id_ad: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ad), +/* harmony export */ id_ad_caIssuers: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ad_caIssuers), +/* harmony export */ id_ad_caRepository: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ad_caRepository), +/* harmony export */ id_ad_ocsp: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ad_ocsp), +/* harmony export */ id_ad_timeStamping: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ad_timeStamping), +/* harmony export */ id_ce: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_ce), +/* harmony export */ id_ce_authorityKeyIdentifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_authorityKeyIdentifier), +/* harmony export */ id_ce_basicConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_basicConstraints), +/* harmony export */ id_ce_cRLDistributionPoints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_cRLDistributionPoints), +/* harmony export */ id_ce_cRLNumber: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_cRLNumber), +/* harmony export */ id_ce_cRLReasons: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_cRLReasons), +/* harmony export */ id_ce_certificateIssuer: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_certificateIssuer), +/* harmony export */ id_ce_certificatePolicies: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_certificatePolicies), +/* harmony export */ id_ce_certificatePolicies_anyPolicy: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_certificatePolicies_anyPolicy), +/* harmony export */ id_ce_deltaCRLIndicator: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_deltaCRLIndicator), +/* harmony export */ id_ce_extKeyUsage: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_extKeyUsage), +/* harmony export */ id_ce_freshestCRL: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_freshestCRL), +/* harmony export */ id_ce_inhibitAnyPolicy: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_inhibitAnyPolicy), +/* harmony export */ id_ce_invalidityDate: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_invalidityDate), +/* harmony export */ id_ce_issuerAltName: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_issuerAltName), +/* harmony export */ id_ce_issuingDistributionPoint: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_issuingDistributionPoint), +/* harmony export */ id_ce_keyUsage: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_keyUsage), +/* harmony export */ id_ce_nameConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_nameConstraints), +/* harmony export */ id_ce_policyConstraints: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_policyConstraints), +/* harmony export */ id_ce_policyMappings: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_policyMappings), +/* harmony export */ id_ce_privateKeyUsagePeriod: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_privateKeyUsagePeriod), +/* harmony export */ id_ce_subjectAltName: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_subjectAltName), +/* harmony export */ id_ce_subjectDirectoryAttributes: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_subjectDirectoryAttributes), +/* harmony export */ id_ce_subjectKeyIdentifier: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_ce_subjectKeyIdentifier), +/* harmony export */ id_entrust_entrustVersInfo: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_entrust_entrustVersInfo), +/* harmony export */ id_kp: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_kp), +/* harmony export */ id_kp_OCSPSigning: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_OCSPSigning), +/* harmony export */ id_kp_clientAuth: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_clientAuth), +/* harmony export */ id_kp_codeSigning: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_codeSigning), +/* harmony export */ id_kp_emailProtection: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_emailProtection), +/* harmony export */ id_kp_serverAuth: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_serverAuth), +/* harmony export */ id_kp_timeStamping: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_kp_timeStamping), +/* harmony export */ id_pe: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_pe), +/* harmony export */ id_pe_authorityInfoAccess: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_pe_authorityInfoAccess), +/* harmony export */ id_pe_subjectInfoAccess: () => (/* reexport safe */ _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__.id_pe_subjectInfoAccess), +/* harmony export */ id_pkix: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_pkix), +/* harmony export */ id_qt: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_qt), +/* harmony export */ id_qt_csp: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_qt_csp), +/* harmony export */ id_qt_unotice: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__.id_qt_unotice) +/* harmony export */ }); +/* harmony import */ var _extensions_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./extensions/index.js */ 43663); +/* harmony import */ var _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./algorithm_identifier.js */ 99875); +/* harmony import */ var _attribute_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attribute.js */ 820); +/* harmony import */ var _certificate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./certificate.js */ 56807); +/* harmony import */ var _certificate_list_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./certificate_list.js */ 47850); +/* harmony import */ var _extension_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./extension.js */ 85725); +/* harmony import */ var _general_name_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./general_name.js */ 56804); +/* harmony import */ var _general_names_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./general_names.js */ 68427); +/* harmony import */ var _name_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./name.js */ 8481); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./object_identifiers.js */ 70542); +/* harmony import */ var _subject_public_key_info_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./subject_public_key_info.js */ 22837); +/* harmony import */ var _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./tbs_cert_list.js */ 99187); +/* harmony import */ var _tbs_certificate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./tbs_certificate.js */ 37519); +/* harmony import */ var _time_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./time.js */ 71371); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./types.js */ 73725); +/* harmony import */ var _validity_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./validity.js */ 64572); + + + + + + + + + + + + + + + + + + +/***/ }), + +/***/ 12877: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/index.js ***! + \*********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var origSymbol = typeof Symbol !== 'undefined' && Symbol; +var hasSymbolSham = __webpack_require__(/*! ./shams */ 40847); + +/** @type {import('.')} */ +module.exports = function hasNativeSymbols() { + if (typeof origSymbol !== 'function') { return false; } + if (typeof Symbol !== 'function') { return false; } + if (typeof origSymbol('foo') !== 'symbol') { return false; } + if (typeof Symbol('bar') !== 'symbol') { return false; } + + return hasSymbolSham(); +}; + + +/***/ }), + +/***/ 13037: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/nil.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ('00000000-0000-0000-0000-000000000000'); + +/***/ }), + +/***/ 13319: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/abstract/weierstrass.js ***! + \********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DER: () => (/* binding */ DER), +/* harmony export */ DERErr: () => (/* binding */ DERErr), +/* harmony export */ SWUFpSqrtRatio: () => (/* binding */ SWUFpSqrtRatio), +/* harmony export */ mapToCurveSimpleSWU: () => (/* binding */ mapToCurveSimpleSWU), +/* harmony export */ weierstrass: () => (/* binding */ weierstrass), +/* harmony export */ weierstrassPoints: () => (/* binding */ weierstrassPoints) +/* harmony export */ }); +/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./curve.js */ 29072); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ 51733); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ 96926); +/** + * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b. + * + * ### Parameters + * + * To initialize a weierstrass curve, one needs to pass following params: + * + * * a: formula param + * * b: formula param + * * Fp: finite Field over which we'll do calculations. Can be complex (Fp2, Fp12) + * * n: Curve prime subgroup order, total count of valid points in the field + * * Gx: Base point (x, y) aka generator point x coordinate + * * Gy: ...y coordinate + * * h: cofactor, usually 1. h*n = curve group order (n is only subgroup order) + * * lowS: whether to enable (default) or disable "low-s" non-malleable signatures + * + * ### Design rationale for types + * + * * Interaction between classes from different curves should fail: + * `k256.Point.BASE.add(p256.Point.BASE)` + * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime + * * Different calls of `curve()` would return different classes - + * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, + * it won't affect others + * + * TypeScript can't infer types for classes created inside a function. Classes is one instance + * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create + * unique type for every function call. + * + * We can use generic types via some param, like curve opts, but that would: + * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) + * which is hard to debug. + * 2. Params can be generic and we can't enforce them to be constant value: + * if somebody creates curve from non-constant params, + * it would be allowed to interact with other curves with non-constant params + * + * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// prettier-ignore + +// prettier-ignore + +// prettier-ignore + +function validateSigVerOpts(opts) { + if (opts.lowS !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('lowS', opts.lowS); + if (opts.prehash !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('prehash', opts.prehash); +} +function validatePointOpts(curve) { + const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.validateObject)(opts, { + a: 'field', + b: 'field', + }, { + allowedPrivateKeyLengths: 'array', + wrapPrivateKey: 'boolean', + isTorsionFree: 'function', + clearCofactor: 'function', + allowInfinityPoint: 'boolean', + fromBytes: 'function', + toBytes: 'function', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('invalid endomorphism, can only be defined for Koblitz curves that have a=0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('invalid endomorphism, expected beta: bigint and splitScalar: function'); + } + } + return Object.freeze({ ...opts }); +} +class DERErr extends Error { + constructor(m = '') { + super(m); + } +} +/** + * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format: + * + * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S] + * + * Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html + */ +const DER = { + // asn.1 DER encoding utils + Err: DERErr, + // Basic building block is TLV (Tag-Length-Value) + _tlv: { + encode: (tag, data) => { + const { Err: E } = DER; + if (tag < 0 || tag > 256) + throw new E('tlv.encode: wrong tag'); + if (data.length & 1) + throw new E('tlv.encode: unpadded data'); + const dataLen = data.length / 2; + const len = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(dataLen); + if ((len.length / 2) & 128) + throw new E('tlv.encode: long form length too big'); + // length of length with long form flag + const lenLen = dataLen > 127 ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)((len.length / 2) | 128) : ''; + const t = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(tag); + return t + lenLen + len + data; + }, + // v - value, l - left bytes (unparsed) + decode(tag, data) { + const { Err: E } = DER; + let pos = 0; + if (tag < 0 || tag > 256) + throw new E('tlv.encode: wrong tag'); + if (data.length < 2 || data[pos++] !== tag) + throw new E('tlv.decode: wrong tlv'); + const first = data[pos++]; + const isLong = !!(first & 128); // First bit of first length byte is flag for short/long form + let length = 0; + if (!isLong) + length = first; + else { + // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)] + const lenLen = first & 127; + if (!lenLen) + throw new E('tlv.decode(long): indefinite length not supported'); + if (lenLen > 4) + throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js + const lengthBytes = data.subarray(pos, pos + lenLen); + if (lengthBytes.length !== lenLen) + throw new E('tlv.decode: length bytes not complete'); + if (lengthBytes[0] === 0) + throw new E('tlv.decode(long): zero leftmost byte'); + for (const b of lengthBytes) + length = (length << 8) | b; + pos += lenLen; + if (length < 128) + throw new E('tlv.decode(long): not minimal encoding'); + } + const v = data.subarray(pos, pos + length); + if (v.length !== length) + throw new E('tlv.decode: wrong value length'); + return { v, l: data.subarray(pos + length) }; + }, + }, + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + _int: { + encode(num) { + const { Err: E } = DER; + if (num < _0n) + throw new E('integer: negative integers are not allowed'); + let hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(num); + // Pad with zero byte if negative flag is present + if (Number.parseInt(hex[0], 16) & 0b1000) + hex = '00' + hex; + if (hex.length & 1) + throw new E('unexpected DER parsing assertion: unpadded hex'); + return hex; + }, + decode(data) { + const { Err: E } = DER; + if (data[0] & 128) + throw new E('invalid signature integer: negative'); + if (data[0] === 0x00 && !(data[1] & 128)) + throw new E('invalid signature integer: unnecessary leading zero'); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(data); + }, + }, + toSig(hex) { + // parse DER signature + const { Err: E, _int: int, _tlv: tlv } = DER; + const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('signature', hex); + const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data); + if (seqLeftBytes.length) + throw new E('invalid signature: left bytes after parsing'); + const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes); + const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes); + if (sLeftBytes.length) + throw new E('invalid signature: left bytes after parsing'); + return { r: int.decode(rBytes), s: int.decode(sBytes) }; + }, + hexFromSig(sig) { + const { _tlv: tlv, _int: int } = DER; + const rs = tlv.encode(0x02, int.encode(sig.r)); + const ss = tlv.encode(0x02, int.encode(sig.s)); + const seq = rs + ss; + return tlv.encode(0x30, seq); + }, +}; +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const Fn = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.Field)(CURVE.n, CURVE.nBitLength); + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y². + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x2 * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x3 + a * x + b + } + // Validate whether the passed curve params are valid. + // We check if curve equation works for generator point. + // `assertValidity()` won't work: `isTorsionFree()` is not available at this point in bls12-381. + // ProjectivePoint class has not been initialized yet. + if (!Fp.eql(Fp.sqr(CURVE.Gy), weierstrassEquation(CURVE.Gx))) + throw new Error('bad generator point: equation left != right'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.inRange)(num, _1n, CURVE.n); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE; + if (lengths && typeof key !== 'bigint') { + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isBytes)(key)) + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('invalid private key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('private key', key, nByteLength)); + } + catch (error) { + throw new Error('invalid private key, expected hex or ' + nByteLength + ' bytes, got ' + typeof key); + } + if (wrapPrivateKey) + num = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(num, N); // disabled by default, enabled for BLS + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('private key', num, _1n, N); // num in range [1..N-1] + return num; + } + function aprjpoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + // Memoized toAffine / validity check. They are heavy. Points are immutable. + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + const toAffineMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p, iz) => { + const { px: x, py: y, pz: z } = p; + // Fast-path for normalized points + if (Fp.eql(z, Fp.ONE)) + return { x, y }; + const is0 = p.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + }); + // NOTE: on exception this will crash 'cached' and no value will be set. + // Otherwise true will be return + const assertValidMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p) => { + if (p.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is invalid representation of ZERO. + if (CURVE.allowInfinityPoint && !Fp.is0(p.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = p.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + if (!Fp.eql(left, right)) + throw new Error('bad point: equation left != right'); + if (!p.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + return true; + }); + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (x, y, z) ∋ (x=x/z, y=y/z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py) || Fp.is0(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + this.px = px; + this.py = py; + this.pz = pz; + Object.freeze(this); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(Fp, points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // Multiscalar Multiplication + static msm(points, scalars) { + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.pippenger)(Point, Fn, points, scalars); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + wnaf.setWindowSize(this, windowSize); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + assertValidMemo(this); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + aprjpoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + aprjpoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, n, Point.normalizeZ); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(sc) { + const { endo, n: N } = CURVE; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', sc, _0n, N); + const I = Point.ZERO; + if (sc === _0n) + return I; + if (this.is0() || sc === _1n) + return this; + // Case a: no endomorphism. Case b: has precomputes. + if (!endo || wnaf.hasPrecomputes(this)) + return wnaf.wNAFCachedUnsafe(this, sc, Point.normalizeZ); + // Case c: endomorphism + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + k1p = k1p.add(d); + if (k2 & _1n) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + const { endo, n: N } = CURVE; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', scalar, _1n, N); + let point, fake; // Fake point is used to const-time mult + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(scalar); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + return toAffineMemo(this, iz); + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)(this.toRawBytes(isCompressed)); + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0 + const _bits = CURVE.nBitLength; + const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.wNAF)(Point, CURVE.endo ? Math.ceil(_bits / 2) : _bits); + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +function validateOpts(curve) { + const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.validateObject)(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +/** + * Creates short weierstrass curve and ECDSA signature methods for it. + * @example + * import { Field } from '@noble/curves/abstract/modular'; + * // Before that, define BigInt-s: a, b, p, n, Gx, Gy + * const curve = weierstrass({ a, b, Fp: Field(p), n, Gx, Gy, h: 1n }) + */ +function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function modN(a) { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(a, CURVE_ORDER); + } + function invN(a) { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.invert)(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = _utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(tail); + if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.inRange)(x, _1n, Fp.ORDER)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y; + try { + y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + } + catch (sqrtError) { + const suffix = sqrtError instanceof Error ? ': ' + sqrtError.message : ''; + throw new Error('Point is not on curve' + suffix); + } + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + const cl = compressedLen; + const ul = uncompressedLen; + throw new Error('invalid Point, expected length of ' + cl + ', or uncompressed ' + ul + ', got ' + len); + } + }, + }); + const numToNByteHex = (num) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesBE)(num, CURVE.nByteLength)); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('r', r, _1n, CURVE_ORDER); // r in [1..N] + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('s', s, _1n, CURVE_ORDER); // s in [1..N] + this.r = r; + this.s = s; + if (recovery != null) + this.recovery = recovery; + Object.freeze(this); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = CURVE.nByteLength; + hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = DER.toSig((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('DER', hex)); + return new Signature(r, s); + } + /** + * @todo remove + * @deprecated + */ + assertValidity() { } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToNByteHex(radj)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hexToBytes)(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig(this); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hexToBytes)(this.toCompactHex()); + } + toCompactHex() { + return numToNByteHex(this.r) + numToNByteHex(this.s); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.getMinHashLength)(CURVE.n); + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mapHashToField)(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + const arr = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isBytes)(item); + const str = typeof item === 'string'; + const len = (arr || str) && item.length; + if (arr) + return len === compressedLen || len === uncompressedLen; + if (str) + return len === 2 * compressedLen || len === 2 * uncompressedLen; + if (item instanceof Point) + return true; + return false; + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA)) + throw new Error('first arg must be private key'); + if (!isProbPub(publicB)) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // Our custom check "just in case" + if (bytes.length > 8192) + throw new Error('input is too large'); + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(bytes); // check for == u8 done here + const delta = bytes.length * 8 - CURVE.nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bitMask)(CURVE.nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('num < 2^' + CURVE.nBitLength, num, _0n, ORDER_MASK); + // works with order, can have different size than numToField! + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesBE)(num, CURVE.nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, + // this will be invalid at least for P521. Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash); + validateSigVerOpts(opts); + if (prehash) + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null && ent !== false) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('extraEntropy', e)); // check for being bytes + } + const seed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHmacDrbg)(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash); + publicKey = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('publicKey', publicKey); + const { lowS, prehash, format } = opts; + // Verify opts, deduce signature format + validateSigVerOpts(opts); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + if (format !== undefined && format !== 'compact' && format !== 'der') + throw new Error('format must be compact or der'); + const isHex = typeof sg === 'string' || (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isBytes)(sg); + const isObj = !isHex && + !format && + typeof sg === 'object' && + sg !== null && + typeof sg.r === 'bigint' && + typeof sg.s === 'bigint'; + if (!isHex && !isObj) + throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance'); + let _sig = undefined; + let P; + try { + if (isObj) + _sig = new Signature(sg.r, sg.s); + if (isHex) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + if (format !== 'compact') + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof DER.Err)) + throw derError; + } + if (!_sig && format !== 'der') + _sig = Signature.fromCompact(sg); + } + P = Point.fromHex(publicKey); + } + catch (error) { + return false; + } + if (!_sig) + return false; + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +function SWUFpSqrtRatio(Fp, Z) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) + l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. + // 2n ** c1 == 2n << (c1-1) + const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n; + const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u, v) => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = i - _2n; // 18. tv5 = i - 2 + tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u, v) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +function mapToCurveSimpleSWU(Fp, opts) { + (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.validateField)(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) + throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u) => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + const tv4_inv = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(Fp, [tv4], true)[0]; + x = Fp.mul(x, tv4_inv); // 25. x = x / tv4 + return { x, y }; + }; +} +//# sourceMappingURL=weierstrass.js.map + +/***/ }), + +/***/ 13349: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/pbkdf2@3.1.6/node_modules/pbkdf2/browser.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +exports.pbkdf2 = __webpack_require__(/*! ./lib/async */ 81485); +exports.pbkdf2Sync = __webpack_require__(/*! ./lib/sync */ 43991); + + +/***/ }), + +/***/ 13382: +/*!***********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+crypto@2.8.6/node_modules/@turnkey/crypto/dist/index.mjs ***! + \***********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Enclave: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.Enclave), +/* harmony export */ buildAdditionalAssociatedData: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.buildAdditionalAssociatedData), +/* harmony export */ compressRawPublicKey: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.compressRawPublicKey), +/* harmony export */ decryptCredentialBundle: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.decryptCredentialBundle), +/* harmony export */ decryptExportBundle: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.decryptExportBundle), +/* harmony export */ encryptOauth2ClientSecret: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.encryptOauth2ClientSecret), +/* harmony export */ encryptOnRampSecret: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.encryptOnRampSecret), +/* harmony export */ encryptPrivateKeyToBundle: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.encryptPrivateKeyToBundle), +/* harmony export */ encryptToEnclave: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.encryptToEnclave), +/* harmony export */ encryptWalletToBundle: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.encryptWalletToBundle), +/* harmony export */ extractPrivateKeyFromPKCS8Bytes: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.extractPrivateKeyFromPKCS8Bytes), +/* harmony export */ formatHpkeBuf: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.formatHpkeBuf), +/* harmony export */ fromDerSignature: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.fromDerSignature), +/* harmony export */ generateP256KeyPair: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.generateP256KeyPair), +/* harmony export */ getCryptoInstance: () => (/* reexport safe */ _proof_mjs__WEBPACK_IMPORTED_MODULE_2__.getCryptoInstance), +/* harmony export */ getPublicKey: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.getPublicKey), +/* harmony export */ hpkeAuthEncrypt: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.hpkeAuthEncrypt), +/* harmony export */ hpkeDecrypt: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.hpkeDecrypt), +/* harmony export */ hpkeEncrypt: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.hpkeEncrypt), +/* harmony export */ quorumKeyEncrypt: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.quorumKeyEncrypt), +/* harmony export */ toDerSignature: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.toDerSignature), +/* harmony export */ uncompressRawPublicKey: () => (/* reexport safe */ _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__.uncompressRawPublicKey), +/* harmony export */ verify: () => (/* reexport safe */ _proof_mjs__WEBPACK_IMPORTED_MODULE_2__.verify), +/* harmony export */ verifyAppProofSignature: () => (/* reexport safe */ _proof_mjs__WEBPACK_IMPORTED_MODULE_2__.verifyAppProofSignature), +/* harmony export */ verifyCertificateChain: () => (/* reexport safe */ _proof_mjs__WEBPACK_IMPORTED_MODULE_2__.verifyCertificateChain), +/* harmony export */ verifyCoseSign1Sig: () => (/* reexport safe */ _proof_mjs__WEBPACK_IMPORTED_MODULE_2__.verifyCoseSign1Sig), +/* harmony export */ verifySessionJwtSignature: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.verifySessionJwtSignature), +/* harmony export */ verifyStampSignature: () => (/* reexport safe */ _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__.verifyStampSignature) +/* harmony export */ }); +/* harmony import */ var _crypto_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./crypto.mjs */ 82473); +/* harmony import */ var _turnkey_mjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./turnkey.mjs */ 88936); +/* harmony import */ var _proof_mjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./proof.mjs */ 44856); + + + +//# sourceMappingURL=index.mjs.map + + +/***/ }), + +/***/ 13480: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+crypto@2.8.6/node_modules/@turnkey/crypto/dist/math.mjs ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ modSqrt: () => (/* binding */ modSqrt), +/* harmony export */ testBit: () => (/* binding */ testBit) +/* harmony export */ }); +/** + * Compute the modular square root using the Tonelli-Shanks algorithm. + */ +const modSqrt = (x, p) => { + if (p <= BigInt(0)) { + throw new Error("p must be positive"); + } + const base = x % p; + // Check if p % 4 == 3 (applies to NIST curves P-256, P-384, and P-521) + if (testBit(p, 0) && testBit(p, 1)) { + const q = (p + BigInt(1)) >> BigInt(2); + const squareRoot = modPow(base, q, p); + if ((squareRoot * squareRoot) % p !== base) { + throw new Error("could not find a modular square root"); + } + return squareRoot; + } + // Other elliptic curve types not supported + throw new Error("unsupported modulus value"); +}; +/** + * Test if a specific bit is set. + */ +const testBit = (n, i) => { + const m = BigInt(1) << BigInt(i); + return (n & m) !== BigInt(0); +}; +/** + * Compute the modular exponentiation. + */ +const modPow = (b, exp, p) => { + if (exp === BigInt(0)) { + return BigInt(1); + } + let result = b % p; + const exponentBitString = exp.toString(2); + for (let i = 1; i < exponentBitString.length; ++i) { + result = (result * result) % p; + if (exponentBitString[i] === "1") { + result = (result * b) % p; + } + } + return result; +}; + + +//# sourceMappingURL=math.mjs.map + + +/***/ }), + +/***/ 13789: +/*!***************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/uri.js ***! + \***************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./uri')} */ +module.exports = URIError; + + +/***/ }), + +/***/ 14105: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/sha1.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +// Adapted from Chris Veness' SHA1 code at +// http://www.movable-type.co.uk/scripts/sha1.html +function f(s, x, y, z) { + switch (s) { + case 0: + return x & y ^ ~x & z; + + case 1: + return x ^ y ^ z; + + case 2: + return x & y ^ x & z ^ y & z; + + case 3: + return x ^ y ^ z; + } +} + +function ROTL(x, n) { + return x << n | x >>> 32 - n; +} + +function sha1(bytes) { + var K = [0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6]; + var H = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]; + + if (typeof bytes === 'string') { + var msg = unescape(encodeURIComponent(bytes)); // UTF8 escape + + bytes = []; + + for (var i = 0; i < msg.length; ++i) { + bytes.push(msg.charCodeAt(i)); + } + } else if (!Array.isArray(bytes)) { + // Convert Array-like to Array + bytes = Array.prototype.slice.call(bytes); + } + + bytes.push(0x80); + var l = bytes.length / 4 + 2; + var N = Math.ceil(l / 16); + var M = new Array(N); + + for (var _i = 0; _i < N; ++_i) { + var arr = new Uint32Array(16); + + for (var j = 0; j < 16; ++j) { + arr[j] = bytes[_i * 64 + j * 4] << 24 | bytes[_i * 64 + j * 4 + 1] << 16 | bytes[_i * 64 + j * 4 + 2] << 8 | bytes[_i * 64 + j * 4 + 3]; + } + + M[_i] = arr; + } + + M[N - 1][14] = (bytes.length - 1) * 8 / Math.pow(2, 32); + M[N - 1][14] = Math.floor(M[N - 1][14]); + M[N - 1][15] = (bytes.length - 1) * 8 & 0xffffffff; + + for (var _i2 = 0; _i2 < N; ++_i2) { + var W = new Uint32Array(80); + + for (var t = 0; t < 16; ++t) { + W[t] = M[_i2][t]; + } + + for (var _t = 16; _t < 80; ++_t) { + W[_t] = ROTL(W[_t - 3] ^ W[_t - 8] ^ W[_t - 14] ^ W[_t - 16], 1); + } + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + for (var _t2 = 0; _t2 < 80; ++_t2) { + var s = Math.floor(_t2 / 20); + var T = ROTL(a, 5) + f(s, b, c, d) + e + K[s] + W[_t2] >>> 0; + e = d; + d = c; + c = ROTL(b, 30) >>> 0; + b = a; + a = T; + } + + H[0] = H[0] + a >>> 0; + H[1] = H[1] + b >>> 0; + H[2] = H[2] + c >>> 0; + H[3] = H[3] + d >>> 0; + H[4] = H[4] + e >>> 0; + } + + return [H[0] >> 24 & 0xff, H[0] >> 16 & 0xff, H[0] >> 8 & 0xff, H[0] & 0xff, H[1] >> 24 & 0xff, H[1] >> 16 & 0xff, H[1] >> 8 & 0xff, H[1] & 0xff, H[2] >> 24 & 0xff, H[2] >> 16 & 0xff, H[2] >> 8 & 0xff, H[2] & 0xff, H[3] >> 24 & 0xff, H[3] >> 16 & 0xff, H[3] >> 8 & 0xff, H[3] & 0xff, H[4] >> 24 & 0xff, H[4] >> 16 & 0xff, H[4] >> 8 & 0xff, H[4] & 0xff]; +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sha1); + +/***/ }), + +/***/ 14164: +/*!*******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/issuer_and_serial_number.js ***! + \*******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IssuerAndSerialNumber: () => (/* binding */ IssuerAndSerialNumber) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class IssuerAndSerialNumber { + issuer = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Name(); + serialNumber = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Name }) +], IssuerAndSerialNumber.prototype, "issuer", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], IssuerAndSerialNumber.prototype, "serialNumber", void 0); + + +/***/ }), + +/***/ 14512: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/attributes/index.js ***! + \***********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CounterSignature: () => (/* reexport safe */ _counter_signature_js__WEBPACK_IMPORTED_MODULE_0__.CounterSignature), +/* harmony export */ MessageDigest: () => (/* reexport safe */ _message_digest_js__WEBPACK_IMPORTED_MODULE_1__.MessageDigest), +/* harmony export */ SigningTime: () => (/* reexport safe */ _signing_time_js__WEBPACK_IMPORTED_MODULE_2__.SigningTime), +/* harmony export */ id_contentType: () => (/* binding */ id_contentType), +/* harmony export */ id_counterSignature: () => (/* reexport safe */ _counter_signature_js__WEBPACK_IMPORTED_MODULE_0__.id_counterSignature), +/* harmony export */ id_messageDigest: () => (/* reexport safe */ _message_digest_js__WEBPACK_IMPORTED_MODULE_1__.id_messageDigest), +/* harmony export */ id_signingTime: () => (/* reexport safe */ _signing_time_js__WEBPACK_IMPORTED_MODULE_2__.id_signingTime) +/* harmony export */ }); +/* harmony import */ var _counter_signature_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./counter_signature.js */ 17657); +/* harmony import */ var _message_digest_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message_digest.js */ 12026); +/* harmony import */ var _signing_time_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./signing_time.js */ 74727); + + + +const id_contentType = "1.2.840.113549.1.9.3"; + + +/***/ }), + +/***/ 14828: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/index.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DigestInfo: () => (/* reexport safe */ _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__.DigestInfo), +/* harmony export */ OtherPrimeInfo: () => (/* reexport safe */ _other_prime_info_js__WEBPACK_IMPORTED_MODULE_3__.OtherPrimeInfo), +/* harmony export */ OtherPrimeInfos: () => (/* reexport safe */ _other_prime_info_js__WEBPACK_IMPORTED_MODULE_3__.OtherPrimeInfos), +/* harmony export */ RSAES_OAEP: () => (/* reexport safe */ _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__.RSAES_OAEP), +/* harmony export */ RSAPrivateKey: () => (/* reexport safe */ _rsa_private_key_js__WEBPACK_IMPORTED_MODULE_4__.RSAPrivateKey), +/* harmony export */ RSAPublicKey: () => (/* reexport safe */ _rsa_public_key_js__WEBPACK_IMPORTED_MODULE_5__.RSAPublicKey), +/* harmony export */ RSASSA_PSS: () => (/* reexport safe */ _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__.RSASSA_PSS), +/* harmony export */ RsaEsOaepParams: () => (/* reexport safe */ _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__.RsaEsOaepParams), +/* harmony export */ RsaSaPssParams: () => (/* reexport safe */ _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__.RsaSaPssParams), +/* harmony export */ id_RSAES_OAEP: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_RSAES_OAEP), +/* harmony export */ id_RSASSA_PSS: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_RSASSA_PSS), +/* harmony export */ id_md2: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md2), +/* harmony export */ id_md2WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md2WithRSAEncryption), +/* harmony export */ id_md5: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md5), +/* harmony export */ id_md5WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md5WithRSAEncryption), +/* harmony export */ id_mgf1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_mgf1), +/* harmony export */ id_pSpecified: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_pSpecified), +/* harmony export */ id_pkcs_1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_pkcs_1), +/* harmony export */ id_rsaEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_rsaEncryption), +/* harmony export */ id_sha1: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha1), +/* harmony export */ id_sha1WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha1WithRSAEncryption), +/* harmony export */ id_sha224: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha224), +/* harmony export */ id_sha224WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha224WithRSAEncryption), +/* harmony export */ id_sha256: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha256), +/* harmony export */ id_sha256WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha256WithRSAEncryption), +/* harmony export */ id_sha384: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha384), +/* harmony export */ id_sha384WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha384WithRSAEncryption), +/* harmony export */ id_sha512: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512), +/* harmony export */ id_sha512WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512WithRSAEncryption), +/* harmony export */ id_sha512_224: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_224), +/* harmony export */ id_sha512_224WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_224WithRSAEncryption), +/* harmony export */ id_sha512_256: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_256), +/* harmony export */ id_sha512_256WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_256WithRSAEncryption), +/* harmony export */ id_ssha224WithRSAEncryption: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ssha224WithRSAEncryption), +/* harmony export */ md2: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.md2), +/* harmony export */ md2WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.md2WithRSAEncryption), +/* harmony export */ md4: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.md4), +/* harmony export */ md5WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.md5WithRSAEncryption), +/* harmony export */ mgf1SHA1: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.mgf1SHA1), +/* harmony export */ pSpecifiedEmpty: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.pSpecifiedEmpty), +/* harmony export */ rsaEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.rsaEncryption), +/* harmony export */ sha1: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha1), +/* harmony export */ sha1WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha1WithRSAEncryption), +/* harmony export */ sha224: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha224), +/* harmony export */ sha224WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha224WithRSAEncryption), +/* harmony export */ sha256: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha256), +/* harmony export */ sha256WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha256WithRSAEncryption), +/* harmony export */ sha384: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha384), +/* harmony export */ sha384WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha384WithRSAEncryption), +/* harmony export */ sha512: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512), +/* harmony export */ sha512WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512WithRSAEncryption), +/* harmony export */ sha512_224: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512_224), +/* harmony export */ sha512_224WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512_224WithRSAEncryption), +/* harmony export */ sha512_256: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512_256), +/* harmony export */ sha512_256WithRSAEncryption: () => (/* reexport safe */ _algorithms_js__WEBPACK_IMPORTED_MODULE_1__.sha512_256WithRSAEncryption) +/* harmony export */ }); +/* harmony import */ var _parameters_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./parameters/index.js */ 17389); +/* harmony import */ var _algorithms_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./algorithms.js */ 17852); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./object_identifiers.js */ 47618); +/* harmony import */ var _other_prime_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./other_prime_info.js */ 17725); +/* harmony import */ var _rsa_private_key_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./rsa_private_key.js */ 68022); +/* harmony import */ var _rsa_public_key_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./rsa_public_key.js */ 6972); + + + + + + + + +/***/ }), + +/***/ 14858: +/*!********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/authority_key_identifier.js ***! + \********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AuthorityKeyIdentifier: () => (/* binding */ AuthorityKeyIdentifier), +/* harmony export */ KeyIdentifier: () => (/* binding */ KeyIdentifier), +/* harmony export */ id_ce_authorityKeyIdentifier: () => (/* binding */ id_ce_authorityKeyIdentifier) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_name_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../general_name.js */ 56804); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + + +const id_ce_authorityKeyIdentifier = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_ce}.35`; +class KeyIdentifier extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString { +} +class AuthorityKeyIdentifier { + keyIdentifier; + authorityCertIssuer; + authorityCertSerialNumber; + constructor(params = {}) { + if (params) { + Object.assign(this, params); + } + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: KeyIdentifier, context: 0, optional: true, implicit: true, + }) +], AuthorityKeyIdentifier.prototype, "keyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _general_name_js__WEBPACK_IMPORTED_MODULE_2__.GeneralName, context: 1, optional: true, implicit: true, repeated: "sequence", + }) +], AuthorityKeyIdentifier.prototype, "authorityCertIssuer", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, + context: 2, + optional: true, + implicit: true, + converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], AuthorityKeyIdentifier.prototype, "authorityCertSerialNumber", void 0); + + +/***/ }), + +/***/ 14880: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/public-encrypt@4.0.3/node_modules/public-encrypt/browser.js ***! + \*****************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +exports.publicEncrypt = __webpack_require__(/*! ./publicEncrypt */ 88086) +exports.privateDecrypt = __webpack_require__(/*! ./privateDecrypt */ 6850) + +exports.privateEncrypt = function privateEncrypt (key, buf) { + return exports.publicEncrypt(key, buf, true) +} + +exports.publicDecrypt = function publicDecrypt (key, buf) { + return exports.privateDecrypt(key, buf, true) +} + + +/***/ }), + +/***/ 14962: +/*!*************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/unit/formatEther.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ formatEther: () => (/* binding */ formatEther) +/* harmony export */ }); +/* harmony import */ var _constants_unit_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../constants/unit.js */ 49244); +/* harmony import */ var _formatUnits_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./formatUnits.js */ 33977); + + +/** + * Converts numerical wei to a string representation of ether. + * + * - Docs: https://viem.sh/docs/utilities/formatEther + * + * @example + * import { formatEther } from 'viem' + * + * formatEther(1000000000000000000n) + * // '1' + */ +function formatEther(wei, unit = 'wei') { + return (0,_formatUnits_js__WEBPACK_IMPORTED_MODULE_1__.formatUnits)(wei, _constants_unit_js__WEBPACK_IMPORTED_MODULE_0__.etherUnits[unit]); +} +//# sourceMappingURL=formatEther.js.map + +/***/ }), + +/***/ 15080: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/BufferList.js ***! + \*******************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +var Buffer = (__webpack_require__(/*! safe-buffer */ 10703).Buffer); +var util = __webpack_require__(/*! util */ 30834); + +function copyBuffer(src, target, offset) { + src.copy(target, offset); +} + +module.exports = function () { + function BufferList() { + _classCallCheck(this, BufferList); + + this.head = null; + this.tail = null; + this.length = 0; + } + + BufferList.prototype.push = function push(v) { + var entry = { data: v, next: null }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + }; + + BufferList.prototype.unshift = function unshift(v) { + var entry = { data: v, next: this.head }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + }; + + BufferList.prototype.shift = function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + }; + + BufferList.prototype.clear = function clear() { + this.head = this.tail = null; + this.length = 0; + }; + + BufferList.prototype.join = function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) { + ret += s + p.data; + }return ret; + }; + + BufferList.prototype.concat = function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + }; + + return BufferList; +}(); + +if (util && util.inspect && util.inspect.custom) { + module.exports.prototype[util.inspect.custom] = function () { + var obj = util.inspect({ length: this.length }); + return this.constructor.name + ' ' + obj; + }; +} + +/***/ }), + +/***/ 15210: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/parse-asn1@5.1.9/node_modules/parse-asn1/index.js ***! + \*******************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var asn1 = __webpack_require__(/*! ./asn1 */ 28993); +var aesid = __webpack_require__(/*! ./aesid.json */ 97467); +var fixProc = __webpack_require__(/*! ./fixProc */ 79861); +var ciphers = __webpack_require__(/*! browserify-aes */ 48164); +var pbkdf2Sync = (__webpack_require__(/*! pbkdf2 */ 13349).pbkdf2Sync); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +function decrypt(data, password) { + var salt = data.algorithm.decrypt.kde.kdeparams.salt; + var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10); + var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]; + var iv = data.algorithm.decrypt.cipher.iv; + var cipherText = data.subjectPrivateKey; + var keylen = parseInt(algo.split('-')[1], 10) / 8; + var key = pbkdf2Sync(password, salt, iters, keylen, 'sha1'); + var cipher = ciphers.createDecipheriv(algo, key, iv); + var out = []; + out.push(cipher.update(cipherText)); + out.push(cipher['final']()); + return Buffer.concat(out); +} + +function parseKeys(buffer) { + var password; + if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) { + password = buffer.passphrase; + buffer = buffer.key; + } + if (typeof buffer === 'string') { + buffer = Buffer.from(buffer); + } + + var stripped = fixProc(buffer, password); + + var type = stripped.tag; + var data = stripped.data; + var subtype, ndata; + switch (type) { + case 'CERTIFICATE': + ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo; + // falls through + case 'PUBLIC KEY': + if (!ndata) { + ndata = asn1.PublicKey.decode(data, 'der'); + } + subtype = ndata.algorithm.algorithm.join('.'); + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der'); + case '1.2.840.10045.2.1': + ndata.subjectPrivateKey = ndata.subjectPublicKey; + return { + type: 'ec', + data: ndata + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der'); + return { + type: 'dsa', + data: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + // throw new Error('unknown key type ' + type) + case 'ENCRYPTED PRIVATE KEY': + data = asn1.EncryptedPrivateKey.decode(data, 'der'); + data = decrypt(data, password); + // falls through + case 'PRIVATE KEY': + ndata = asn1.PrivateKey.decode(data, 'der'); + subtype = ndata.algorithm.algorithm.join('.'); + switch (subtype) { + case '1.2.840.113549.1.1.1': + return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der'); + case '1.2.840.10045.2.1': + return { + curve: ndata.algorithm.curve, + privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey + }; + case '1.2.840.10040.4.1': + ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der'); + return { + type: 'dsa', + params: ndata.algorithm.params + }; + default: throw new Error('unknown key id ' + subtype); + } + // throw new Error('unknown key type ' + type) + case 'RSA PUBLIC KEY': + return asn1.RSAPublicKey.decode(data, 'der'); + case 'RSA PRIVATE KEY': + return asn1.RSAPrivateKey.decode(data, 'der'); + case 'DSA PRIVATE KEY': + return { + type: 'dsa', + params: asn1.DSAPrivateKey.decode(data, 'der') + }; + case 'EC PRIVATE KEY': + data = asn1.ECPrivateKey.decode(data, 'der'); + return { + curve: data.parameters.value, + privateKey: data.privateKey + }; + default: throw new Error('unknown key type ' + type); + } +} +parseKeys.signature = asn1.signature; + +module.exports = parseKeys; + + +/***/ }), + +/***/ 15246: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/bytes/index.js ***! + \*********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ assertBufferSource: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.assertBufferSource), +/* harmony export */ compare: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.compare), +/* harmony export */ concat: () => (/* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_1__.concat), +/* harmony export */ concatToUint8Array: () => (/* reexport safe */ _concat_js__WEBPACK_IMPORTED_MODULE_1__.concatToUint8Array), +/* harmony export */ copy: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.copy), +/* harmony export */ endsWith: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.endsWith), +/* harmony export */ equal: () => (/* reexport safe */ _equal_js__WEBPACK_IMPORTED_MODULE_2__.equal), +/* harmony export */ includes: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.includes), +/* harmony export */ indexOf: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.indexOf), +/* harmony export */ isArrayBuffer: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isArrayBuffer), +/* harmony export */ isArrayBufferLike: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isArrayBufferLike), +/* harmony export */ isArrayBufferView: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isArrayBufferView), +/* harmony export */ isBufferSource: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isBufferSource), +/* harmony export */ isSharedArrayBuffer: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.isSharedArrayBuffer), +/* harmony export */ lastIndexOf: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.lastIndexOf), +/* harmony export */ slice: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.slice), +/* harmony export */ startsWith: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.startsWith), +/* harmony export */ tail: () => (/* reexport safe */ _sequence_js__WEBPACK_IMPORTED_MODULE_3__.tail), +/* harmony export */ toArrayBuffer: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toArrayBuffer), +/* harmony export */ toArrayBufferLike: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toArrayBufferLike), +/* harmony export */ toUint8Array: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array), +/* harmony export */ toUint8ArrayCopy: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8ArrayCopy), +/* harmony export */ toView: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toView), +/* harmony export */ toViewCopy: () => (/* reexport safe */ _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toViewCopy) +/* harmony export */ }); +/* harmony import */ var _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./buffer-source.js */ 93342); +/* harmony import */ var _concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./concat.js */ 428); +/* harmony import */ var _equal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./equal.js */ 15998); +/* harmony import */ var _sequence_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./sequence.js */ 49745); + + + + + + +/***/ }), + +/***/ 15247: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/stringify.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ 83494); + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ + +var byteToHex = []; + +for (var i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr) { + var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (stringify); + +/***/ }), + +/***/ 15837: +/*!********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/subject_alternative_name.js ***! + \********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SubjectAlternativeName: () => (/* binding */ SubjectAlternativeName), +/* harmony export */ id_ce_subjectAltName: () => (/* binding */ id_ce_subjectAltName) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_names_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../general_names.js */ 68427); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var SubjectAlternativeName_1; + + + + +const id_ce_subjectAltName = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_ce}.17`; +let SubjectAlternativeName = SubjectAlternativeName_1 = class SubjectAlternativeName extends _general_names_js__WEBPACK_IMPORTED_MODULE_2__.GeneralNames { + constructor(items) { + super(items); + Object.setPrototypeOf(this, SubjectAlternativeName_1.prototype); + } +}; +SubjectAlternativeName = SubjectAlternativeName_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], SubjectAlternativeName); + + + +/***/ }), + +/***/ 15862: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/encrypter.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var MODES = __webpack_require__(/*! ./modes */ 95855) +var AuthCipher = __webpack_require__(/*! ./authCipher */ 20515) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var StreamCipher = __webpack_require__(/*! ./streamCipher */ 5125) +var Transform = __webpack_require__(/*! cipher-base */ 51141) +var aes = __webpack_require__(/*! ./aes */ 75279) +var ebtk = __webpack_require__(/*! evp_bytestokey */ 91415) +var inherits = __webpack_require__(/*! inherits */ 18628) + +function Cipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Cipher, Transform) + +Cipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + + while ((chunk = this._cache.get())) { + thing = this._mode.encrypt(this, chunk) + out.push(thing) + } + + return Buffer.concat(out) +} + +var PADDING = Buffer.alloc(16, 0x10) + +Cipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + chunk = this._mode.encrypt(this, chunk) + this._cipher.scrub() + return chunk + } + + if (!chunk.equals(PADDING)) { + this._cipher.scrub() + throw new Error('data not multiple of block length') + } +} + +Cipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function () { + if (this.cache.length > 15) { + var out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + return null +} + +Splitter.prototype.flush = function () { + var len = 16 - this.cache.length + var padBuff = Buffer.allocUnsafe(len) + + var i = -1 + while (++i < len) { + padBuff.writeUInt8(len, i) + } + + return Buffer.concat([this.cache, padBuff]) +} + +function createCipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv) + } + + return new Cipher(config.module, password, iv) +} + +function createCipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + var keys = ebtk(password, false, config.key, config.iv) + return createCipheriv(suite, keys.key, keys.iv) +} + +exports.createCipheriv = createCipheriv +exports.createCipher = createCipher + + +/***/ }), + +/***/ 15866: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/data.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ InvalidBytesLengthError: () => (/* binding */ InvalidBytesLengthError), +/* harmony export */ SizeExceedsPaddingSizeError: () => (/* binding */ SizeExceedsPaddingSizeError), +/* harmony export */ SliceOffsetOutOfBoundsError: () => (/* binding */ SliceOffsetOutOfBoundsError) +/* harmony export */ }); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ 87035); + +class SliceOffsetOutOfBoundsError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ offset, position, size, }) { + super(`Slice ${position === 'start' ? 'starting' : 'ending'} at offset "${offset}" is out-of-bounds (size: ${size}).`, { name: 'SliceOffsetOutOfBoundsError' }); + } +} +class SizeExceedsPaddingSizeError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ size, targetSize, type, }) { + super(`${type.charAt(0).toUpperCase()}${type + .slice(1) + .toLowerCase()} size (${size}) exceeds padding size (${targetSize}).`, { name: 'SizeExceedsPaddingSizeError' }); + } +} +class InvalidBytesLengthError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ size, targetSize, type, }) { + super(`${type.charAt(0).toUpperCase()}${type + .slice(1) + .toLowerCase()} is expected to be ${targetSize} ${type} long, but is ${size} ${type} long.`, { name: 'InvalidBytesLengthError' }); + } +} +//# sourceMappingURL=data.js.map + +/***/ }), + +/***/ 15874: +/*!******************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/signature/hashMessage.js ***! + \******************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ hashMessage: () => (/* binding */ hashMessage) +/* harmony export */ }); +/* harmony import */ var _hash_keccak256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../hash/keccak256.js */ 25878); +/* harmony import */ var _toPrefixedMessage_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrefixedMessage.js */ 30358); + + +function hashMessage(message, to_) { + return (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_0__.keccak256)((0,_toPrefixedMessage_js__WEBPACK_IMPORTED_MODULE_1__.toPrefixedMessage)(message), to_); +} +//# sourceMappingURL=hashMessage.js.map + +/***/ }), + +/***/ 15905: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/mod.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AEAD_USAGES: () => (/* reexport safe */ _src_interfaces_aeadEncryptionContext_js__WEBPACK_IMPORTED_MODULE_9__.AEAD_USAGES), +/* harmony export */ AeadId: () => (/* reexport safe */ _src_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.AeadId), +/* harmony export */ DecapError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.DecapError), +/* harmony export */ DeriveKeyPairError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.DeriveKeyPairError), +/* harmony export */ DeserializeError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.DeserializeError), +/* harmony export */ Dhkem: () => (/* reexport safe */ _src_kems_dhkem_js__WEBPACK_IMPORTED_MODULE_3__.Dhkem), +/* harmony export */ EMPTY: () => (/* reexport safe */ _src_consts_js__WEBPACK_IMPORTED_MODULE_12__.EMPTY), +/* harmony export */ Ec: () => (/* reexport safe */ _src_kems_dhkemPrimitives_ec_js__WEBPACK_IMPORTED_MODULE_4__.Ec), +/* harmony export */ EncapError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.EncapError), +/* harmony export */ ExportError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.ExportError), +/* harmony export */ HkdfSha256Native: () => (/* reexport safe */ _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__.HkdfSha256Native), +/* harmony export */ HkdfSha384Native: () => (/* reexport safe */ _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__.HkdfSha384Native), +/* harmony export */ HkdfSha512Native: () => (/* reexport safe */ _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__.HkdfSha512Native), +/* harmony export */ HpkeError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.HpkeError), +/* harmony export */ Hybridkem: () => (/* reexport safe */ _src_kems_hybridkem_js__WEBPACK_IMPORTED_MODULE_6__.Hybridkem), +/* harmony export */ INFO_LENGTH_LIMIT: () => (/* reexport safe */ _src_consts_js__WEBPACK_IMPORTED_MODULE_12__.INFO_LENGTH_LIMIT), +/* harmony export */ INPUT_LENGTH_LIMIT: () => (/* reexport safe */ _src_consts_js__WEBPACK_IMPORTED_MODULE_12__.INPUT_LENGTH_LIMIT), +/* harmony export */ InvalidParamError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError), +/* harmony export */ KEM_USAGES: () => (/* reexport safe */ _src_interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_10__.KEM_USAGES), +/* harmony export */ KdfId: () => (/* reexport safe */ _src_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KdfId), +/* harmony export */ KemId: () => (/* reexport safe */ _src_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KemId), +/* harmony export */ LABEL_DKP_PRK: () => (/* reexport safe */ _src_interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_10__.LABEL_DKP_PRK), +/* harmony export */ LABEL_SK: () => (/* reexport safe */ _src_interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_10__.LABEL_SK), +/* harmony export */ MINIMUM_PSK_LENGTH: () => (/* reexport safe */ _src_consts_js__WEBPACK_IMPORTED_MODULE_12__.MINIMUM_PSK_LENGTH), +/* harmony export */ MessageLimitReachedError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.MessageLimitReachedError), +/* harmony export */ Mode: () => (/* reexport safe */ _src_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.Mode), +/* harmony export */ NativeAlgorithm: () => (/* reexport safe */ _src_algorithm_js__WEBPACK_IMPORTED_MODULE_1__.NativeAlgorithm), +/* harmony export */ NotSupportedError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError), +/* harmony export */ OpenError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.OpenError), +/* harmony export */ SUITE_ID_HEADER_KEM: () => (/* reexport safe */ _src_interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_11__.SUITE_ID_HEADER_KEM), +/* harmony export */ SealError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.SealError), +/* harmony export */ SerializeError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.SerializeError), +/* harmony export */ ValidationError: () => (/* reexport safe */ _src_errors_js__WEBPACK_IMPORTED_MODULE_0__.ValidationError), +/* harmony export */ XCryptoKey: () => (/* reexport safe */ _src_xCryptoKey_js__WEBPACK_IMPORTED_MODULE_7__.XCryptoKey), +/* harmony export */ XCurveDhkemPrimitives: () => (/* reexport safe */ _src_kems_dhkemPrimitives_xCurve_js__WEBPACK_IMPORTED_MODULE_5__.XCurveDhkemPrimitives), +/* harmony export */ abytes: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.abytes), +/* harmony export */ aexists: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.aexists), +/* harmony export */ anumber: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.anumber), +/* harmony export */ aoutput: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.aoutput), +/* harmony export */ base64UrlToBytes: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.base64UrlToBytes), +/* harmony export */ clean: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.clean), +/* harmony export */ concat: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.concat), +/* harmony export */ copyBytes: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.copyBytes), +/* harmony export */ createView: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.createView), +/* harmony export */ hexToBytes: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.hexToBytes), +/* harmony export */ hexToNumber: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.hexToNumber), +/* harmony export */ hmac: () => (/* reexport safe */ _src_hash_hmac_js__WEBPACK_IMPORTED_MODULE_15__.hmac), +/* harmony export */ i2Osp: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.i2Osp), +/* harmony export */ isCryptoKeyPair: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.isCryptoKeyPair), +/* harmony export */ isDeno: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.isDeno), +/* harmony export */ isDenoV1: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.isDenoV1), +/* harmony export */ isLE: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.isLE), +/* harmony export */ kemToKeyGenAlgorithm: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.kemToKeyGenAlgorithm), +/* harmony export */ loadCrypto: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.loadCrypto), +/* harmony export */ loadSubtleCrypto: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.loadSubtleCrypto), +/* harmony export */ mod: () => (/* reexport safe */ _src_curve_modular_js__WEBPACK_IMPORTED_MODULE_18__.mod), +/* harmony export */ montgomery: () => (/* reexport safe */ _src_curve_montgomery_js__WEBPACK_IMPORTED_MODULE_19__.montgomery), +/* harmony export */ numberToBigint: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.numberToBigint), +/* harmony export */ pow2: () => (/* reexport safe */ _src_curve_modular_js__WEBPACK_IMPORTED_MODULE_18__.pow2), +/* harmony export */ sha256: () => (/* reexport safe */ _src_hash_sha2_js__WEBPACK_IMPORTED_MODULE_16__.sha256), +/* harmony export */ sha384: () => (/* reexport safe */ _src_hash_sha2_js__WEBPACK_IMPORTED_MODULE_16__.sha384), +/* harmony export */ sha3_256: () => (/* reexport safe */ _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__.sha3_256), +/* harmony export */ sha3_384: () => (/* reexport safe */ _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__.sha3_384), +/* harmony export */ sha3_512: () => (/* reexport safe */ _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__.sha3_512), +/* harmony export */ sha512: () => (/* reexport safe */ _src_hash_sha2_js__WEBPACK_IMPORTED_MODULE_16__.sha512), +/* harmony export */ shake128: () => (/* reexport safe */ _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__.shake128), +/* harmony export */ shake256: () => (/* reexport safe */ _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__.shake256), +/* harmony export */ toArrayBuffer: () => (/* reexport safe */ _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__.toArrayBuffer), +/* harmony export */ toUint8Array: () => (/* reexport safe */ _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__.toUint8Array), +/* harmony export */ u32: () => (/* reexport safe */ _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__.u32), +/* harmony export */ xor: () => (/* reexport safe */ _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__.xor) +/* harmony export */ }); +/* harmony import */ var _src_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./src/errors.js */ 48385); +/* harmony import */ var _src_algorithm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/algorithm.js */ 19437); +/* harmony import */ var _src_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/identifiers.js */ 16780); +/* harmony import */ var _src_kems_dhkem_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/kems/dhkem.js */ 17218); +/* harmony import */ var _src_kems_dhkemPrimitives_ec_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./src/kems/dhkemPrimitives/ec.js */ 59431); +/* harmony import */ var _src_kems_dhkemPrimitives_xCurve_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/kems/dhkemPrimitives/xCurve.js */ 51924); +/* harmony import */ var _src_kems_hybridkem_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./src/kems/hybridkem.js */ 68968); +/* harmony import */ var _src_xCryptoKey_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./src/xCryptoKey.js */ 56550); +/* harmony import */ var _src_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./src/kdfs/hkdf.js */ 40138); +/* harmony import */ var _src_interfaces_aeadEncryptionContext_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./src/interfaces/aeadEncryptionContext.js */ 20168); +/* harmony import */ var _src_interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./src/interfaces/dhkemPrimitives.js */ 41744); +/* harmony import */ var _src_interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./src/interfaces/kemInterface.js */ 68815); +/* harmony import */ var _src_consts_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./src/consts.js */ 53838); +/* harmony import */ var _src_utils_misc_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./src/utils/misc.js */ 30988); +/* harmony import */ var _src_utils_noble_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./src/utils/noble.js */ 63594); +/* harmony import */ var _src_hash_hmac_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./src/hash/hmac.js */ 48986); +/* harmony import */ var _src_hash_sha2_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./src/hash/sha2.js */ 31193); +/* harmony import */ var _src_hash_sha3_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./src/hash/sha3.js */ 34762); +/* harmony import */ var _src_curve_modular_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./src/curve/modular.js */ 55766); +/* harmony import */ var _src_curve_montgomery_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./src/curve/montgomery.js */ 75609); + + + + + + + + + + + + + + + + + + + + + + + +/***/ }), + +/***/ 15923: +/*!******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/encoding.js ***! + \******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IntegerOutOfRangeError: () => (/* binding */ IntegerOutOfRangeError), +/* harmony export */ InvalidBytesBooleanError: () => (/* binding */ InvalidBytesBooleanError), +/* harmony export */ InvalidHexBooleanError: () => (/* binding */ InvalidHexBooleanError), +/* harmony export */ InvalidHexValueError: () => (/* binding */ InvalidHexValueError), +/* harmony export */ SizeOverflowError: () => (/* binding */ SizeOverflowError) +/* harmony export */ }); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ 87035); + +class IntegerOutOfRangeError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ max, min, signed, size, value, }) { + super(`Number "${value}" is not in safe ${size ? `${size * 8}-bit ${signed ? 'signed' : 'unsigned'} ` : ''}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: 'IntegerOutOfRangeError' }); + } +} +class InvalidBytesBooleanError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor(bytes) { + super(`Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`, { + name: 'InvalidBytesBooleanError', + }); + } +} +class InvalidHexBooleanError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor(hex) { + super(`Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`, { name: 'InvalidHexBooleanError' }); + } +} +class InvalidHexValueError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor(value) { + super(`Hex value "${value}" is an odd length (${value.length}). It must be an even length.`, { name: 'InvalidHexValueError' }); + } +} +class SizeOverflowError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ givenSize, maxSize }) { + super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: 'SizeOverflowError' }); + } +} +//# sourceMappingURL=encoding.js.map + +/***/ }), + +/***/ 15998: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/bytes/equal.js ***! + \*********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ equal: () => (/* binding */ equal) +/* harmony export */ }); +/* harmony import */ var _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./buffer-source.js */ 93342); + +function equal(a, b, options = {}) { + const left = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(a); + const right = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(b); + if (!options.constantTime && left.byteLength !== right.byteLength) { + return false; + } + const length = Math.max(left.byteLength, right.byteLength); + let diff = left.byteLength ^ right.byteLength; + for (let i = 0; i < length; i++) { + diff |= (left[i] ?? 0) ^ (right[i] ?? 0); + } + return diff === 0; +} + + +/***/ }), + +/***/ 16170: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/exporterContext.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ExporterContextImpl: () => (/* binding */ ExporterContextImpl), +/* harmony export */ RecipientExporterContextImpl: () => (/* binding */ RecipientExporterContextImpl), +/* harmony export */ SenderExporterContextImpl: () => (/* binding */ SenderExporterContextImpl) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _utils_emitNotSupported_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/emitNotSupported.js */ 42104); + + +// b"sec" +const LABEL_SEC = new Uint8Array([115, 101, 99]); +class ExporterContextImpl { + constructor(api, kdf, exporterSecret) { + Object.defineProperty(this, "_api", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "exporterSecret", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_kdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._api = api; + this._kdf = kdf; + this.exporterSecret = exporterSecret; + } + async seal(_data, _aad) { + return await (0,_utils_emitNotSupported_js__WEBPACK_IMPORTED_MODULE_1__.emitNotSupported)(); + } + async open(_data, _aad) { + return await (0,_utils_emitNotSupported_js__WEBPACK_IMPORTED_MODULE_1__.emitNotSupported)(); + } + async export(exporterContext, len) { + if (exporterContext.byteLength > _hpke_common__WEBPACK_IMPORTED_MODULE_0__.INPUT_LENGTH_LIMIT) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("Too long exporter context"); + } + try { + return await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(exporterContext), len); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.ExportError(e); + } + } +} +class RecipientExporterContextImpl extends ExporterContextImpl { +} +class SenderExporterContextImpl extends ExporterContextImpl { + constructor(api, kdf, exporterSecret, enc) { + super(api, kdf, exporterSecret); + Object.defineProperty(this, "enc", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.enc = enc; + return; + } +} + + +/***/ }), + +/***/ 16233: +/*!****************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/eval.js ***! + \****************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./eval')} */ +module.exports = EvalError; + + +/***/ }), + +/***/ 16577: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/curve/edwards.js ***! + \************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 28432); +var BN = __webpack_require__(/*! bn.js */ 27019); +var inherits = __webpack_require__(/*! inherits */ 18628); +var Base = __webpack_require__(/*! ./base */ 3164); + +var assert = utils.assert; + +function EdwardsCurve(conf) { + // NOTE: Important as we are creating point in Base.call() + this.twisted = (conf.a | 0) !== 1; + this.mOneA = this.twisted && (conf.a | 0) === -1; + this.extended = this.mOneA; + + Base.call(this, 'edwards', conf); + + this.a = new BN(conf.a, 16).umod(this.red.m); + this.a = this.a.toRed(this.red); + this.c = new BN(conf.c, 16).toRed(this.red); + this.c2 = this.c.redSqr(); + this.d = new BN(conf.d, 16).toRed(this.red); + this.dd = this.d.redAdd(this.d); + + assert(!this.twisted || this.c.fromRed().cmpn(1) === 0); + this.oneC = (conf.c | 0) === 1; +} +inherits(EdwardsCurve, Base); +module.exports = EdwardsCurve; + +EdwardsCurve.prototype._mulA = function _mulA(num) { + if (this.mOneA) + return num.redNeg(); + else + return this.a.redMul(num); +}; + +EdwardsCurve.prototype._mulC = function _mulC(num) { + if (this.oneC) + return num; + else + return this.c.redMul(num); +}; + +// Just for compatibility with Short curve +EdwardsCurve.prototype.jpoint = function jpoint(x, y, z, t) { + return this.point(x, y, z, t); +}; + +EdwardsCurve.prototype.pointFromX = function pointFromX(x, odd) { + x = new BN(x, 16); + if (!x.red) + x = x.toRed(this.red); + + var x2 = x.redSqr(); + var rhs = this.c2.redSub(this.a.redMul(x2)); + var lhs = this.one.redSub(this.c2.redMul(this.d).redMul(x2)); + + var y2 = rhs.redMul(lhs.redInvm()); + var y = y2.redSqrt(); + if (y.redSqr().redSub(y2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + var isOdd = y.fromRed().isOdd(); + if (odd && !isOdd || !odd && isOdd) + y = y.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.pointFromY = function pointFromY(y, odd) { + y = new BN(y, 16); + if (!y.red) + y = y.toRed(this.red); + + // x^2 = (y^2 - c^2) / (c^2 d y^2 - a) + var y2 = y.redSqr(); + var lhs = y2.redSub(this.c2); + var rhs = y2.redMul(this.d).redMul(this.c2).redSub(this.a); + var x2 = lhs.redMul(rhs.redInvm()); + + if (x2.cmp(this.zero) === 0) { + if (odd) + throw new Error('invalid point'); + else + return this.point(this.zero, y); + } + + var x = x2.redSqrt(); + if (x.redSqr().redSub(x2).cmp(this.zero) !== 0) + throw new Error('invalid point'); + + if (x.fromRed().isOdd() !== odd) + x = x.redNeg(); + + return this.point(x, y); +}; + +EdwardsCurve.prototype.validate = function validate(point) { + if (point.isInfinity()) + return true; + + // Curve: A * X^2 + Y^2 = C^2 * (1 + D * X^2 * Y^2) + point.normalize(); + + var x2 = point.x.redSqr(); + var y2 = point.y.redSqr(); + var lhs = x2.redMul(this.a).redAdd(y2); + var rhs = this.c2.redMul(this.one.redAdd(this.d.redMul(x2).redMul(y2))); + + return lhs.cmp(rhs) === 0; +}; + +function Point(curve, x, y, z, t) { + Base.BasePoint.call(this, curve, 'projective'); + if (x === null && y === null && z === null) { + this.x = this.curve.zero; + this.y = this.curve.one; + this.z = this.curve.one; + this.t = this.curve.zero; + this.zOne = true; + } else { + this.x = new BN(x, 16); + this.y = new BN(y, 16); + this.z = z ? new BN(z, 16) : this.curve.one; + this.t = t && new BN(t, 16); + if (!this.x.red) + this.x = this.x.toRed(this.curve.red); + if (!this.y.red) + this.y = this.y.toRed(this.curve.red); + if (!this.z.red) + this.z = this.z.toRed(this.curve.red); + if (this.t && !this.t.red) + this.t = this.t.toRed(this.curve.red); + this.zOne = this.z === this.curve.one; + + // Use extended coordinates + if (this.curve.extended && !this.t) { + this.t = this.x.redMul(this.y); + if (!this.zOne) + this.t = this.t.redMul(this.z.redInvm()); + } + } +} +inherits(Point, Base.BasePoint); + +EdwardsCurve.prototype.pointFromJSON = function pointFromJSON(obj) { + return Point.fromJSON(this, obj); +}; + +EdwardsCurve.prototype.point = function point(x, y, z, t) { + return new Point(this, x, y, z, t); +}; + +Point.fromJSON = function fromJSON(curve, obj) { + return new Point(curve, obj[0], obj[1], obj[2]); +}; + +Point.prototype.inspect = function inspect() { + if (this.isInfinity()) + return ''; + return ''; +}; + +Point.prototype.isInfinity = function isInfinity() { + // XXX This code assumes that zero is always zero in red + return this.x.cmpn(0) === 0 && + (this.y.cmp(this.z) === 0 || + (this.zOne && this.y.cmp(this.curve.c) === 0)); +}; + +Point.prototype._extDbl = function _extDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #doubling-dbl-2008-hwcd + // 4M + 4S + + // A = X1^2 + var a = this.x.redSqr(); + // B = Y1^2 + var b = this.y.redSqr(); + // C = 2 * Z1^2 + var c = this.z.redSqr(); + c = c.redIAdd(c); + // D = a * A + var d = this.curve._mulA(a); + // E = (X1 + Y1)^2 - A - B + var e = this.x.redAdd(this.y).redSqr().redISub(a).redISub(b); + // G = D + B + var g = d.redAdd(b); + // F = G - C + var f = g.redSub(c); + // H = D - B + var h = d.redSub(b); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projDbl = function _projDbl() { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #doubling-dbl-2008-bbjlp + // #doubling-dbl-2007-bl + // and others + // Generally 3M + 4S or 2M + 4S + + // B = (X1 + Y1)^2 + var b = this.x.redAdd(this.y).redSqr(); + // C = X1^2 + var c = this.x.redSqr(); + // D = Y1^2 + var d = this.y.redSqr(); + + var nx; + var ny; + var nz; + var e; + var h; + var j; + if (this.curve.twisted) { + // E = a * C + e = this.curve._mulA(c); + // F = E + D + var f = e.redAdd(d); + if (this.zOne) { + // X3 = (B - C - D) * (F - 2) + nx = b.redSub(c).redSub(d).redMul(f.redSub(this.curve.two)); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F^2 - 2 * F + nz = f.redSqr().redSub(f).redSub(f); + } else { + // H = Z1^2 + h = this.z.redSqr(); + // J = F - 2 * H + j = f.redSub(h).redISub(h); + // X3 = (B-C-D)*J + nx = b.redSub(c).redISub(d).redMul(j); + // Y3 = F * (E - D) + ny = f.redMul(e.redSub(d)); + // Z3 = F * J + nz = f.redMul(j); + } + } else { + // E = C + D + e = c.redAdd(d); + // H = (c * Z1)^2 + h = this.curve._mulC(this.z).redSqr(); + // J = E - 2 * H + j = e.redSub(h).redSub(h); + // X3 = c * (B - E) * J + nx = this.curve._mulC(b.redISub(e)).redMul(j); + // Y3 = c * E * (C - D) + ny = this.curve._mulC(e).redMul(c.redISub(d)); + // Z3 = E * J + nz = e.redMul(j); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.dbl = function dbl() { + if (this.isInfinity()) + return this; + + // Double in extended coordinates + if (this.curve.extended) + return this._extDbl(); + else + return this._projDbl(); +}; + +Point.prototype._extAdd = function _extAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html + // #addition-add-2008-hwcd-3 + // 8M + + // A = (Y1 - X1) * (Y2 - X2) + var a = this.y.redSub(this.x).redMul(p.y.redSub(p.x)); + // B = (Y1 + X1) * (Y2 + X2) + var b = this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)); + // C = T1 * k * T2 + var c = this.t.redMul(this.curve.dd).redMul(p.t); + // D = Z1 * 2 * Z2 + var d = this.z.redMul(p.z.redAdd(p.z)); + // E = B - A + var e = b.redSub(a); + // F = D - C + var f = d.redSub(c); + // G = D + C + var g = d.redAdd(c); + // H = B + A + var h = b.redAdd(a); + // X3 = E * F + var nx = e.redMul(f); + // Y3 = G * H + var ny = g.redMul(h); + // T3 = E * H + var nt = e.redMul(h); + // Z3 = F * G + var nz = f.redMul(g); + return this.curve.point(nx, ny, nz, nt); +}; + +Point.prototype._projAdd = function _projAdd(p) { + // hyperelliptic.org/EFD/g1p/auto-twisted-projective.html + // #addition-add-2008-bbjlp + // #addition-add-2007-bl + // 10M + 1S + + // A = Z1 * Z2 + var a = this.z.redMul(p.z); + // B = A^2 + var b = a.redSqr(); + // C = X1 * X2 + var c = this.x.redMul(p.x); + // D = Y1 * Y2 + var d = this.y.redMul(p.y); + // E = d * C * D + var e = this.curve.d.redMul(c).redMul(d); + // F = B - E + var f = b.redSub(e); + // G = B + E + var g = b.redAdd(e); + // X3 = A * F * ((X1 + Y1) * (X2 + Y2) - C - D) + var tmp = this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(c).redISub(d); + var nx = a.redMul(f).redMul(tmp); + var ny; + var nz; + if (this.curve.twisted) { + // Y3 = A * G * (D - a * C) + ny = a.redMul(g).redMul(d.redSub(this.curve._mulA(c))); + // Z3 = F * G + nz = f.redMul(g); + } else { + // Y3 = A * G * (D - C) + ny = a.redMul(g).redMul(d.redSub(c)); + // Z3 = c * F * G + nz = this.curve._mulC(f).redMul(g); + } + return this.curve.point(nx, ny, nz); +}; + +Point.prototype.add = function add(p) { + if (this.isInfinity()) + return p; + if (p.isInfinity()) + return this; + + if (this.curve.extended) + return this._extAdd(p); + else + return this._projAdd(p); +}; + +Point.prototype.mul = function mul(k) { + if (this._hasDoubles(k)) + return this.curve._fixedNafMul(this, k); + else + return this.curve._wnafMul(this, k); +}; + +Point.prototype.mulAdd = function mulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, false); +}; + +Point.prototype.jmulAdd = function jmulAdd(k1, p, k2) { + return this.curve._wnafMulAdd(1, [ this, p ], [ k1, k2 ], 2, true); +}; + +Point.prototype.normalize = function normalize() { + if (this.zOne) + return this; + + // Normalize coordinates + var zi = this.z.redInvm(); + this.x = this.x.redMul(zi); + this.y = this.y.redMul(zi); + if (this.t) + this.t = this.t.redMul(zi); + this.z = this.curve.one; + this.zOne = true; + return this; +}; + +Point.prototype.neg = function neg() { + return this.curve.point(this.x.redNeg(), + this.y, + this.z, + this.t && this.t.redNeg()); +}; + +Point.prototype.getX = function getX() { + this.normalize(); + return this.x.fromRed(); +}; + +Point.prototype.getY = function getY() { + this.normalize(); + return this.y.fromRed(); +}; + +Point.prototype.eq = function eq(other) { + return this === other || + this.getX().cmp(other.getX()) === 0 && + this.getY().cmp(other.getY()) === 0; +}; + +Point.prototype.eqXToP = function eqXToP(x) { + var rx = x.toRed(this.curve.red).redMul(this.z); + if (this.x.cmp(rx) === 0) + return true; + + var xc = x.clone(); + var t = this.curve.redN.redMul(this.z); + for (;;) { + xc.iadd(this.curve.n); + if (xc.cmp(this.curve.p) >= 0) + return false; + + rx.redIAdd(t); + if (this.x.cmp(rx) === 0) + return true; + } +}; + +// Compatibility with BaseCurve +Point.prototype.toP = Point.prototype.normalize; +Point.prototype.mixedAdd = Point.prototype.add; + + +/***/ }), + +/***/ 16780: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/identifiers.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AeadId: () => (/* binding */ AeadId), +/* harmony export */ KdfId: () => (/* binding */ KdfId), +/* harmony export */ KemId: () => (/* binding */ KemId), +/* harmony export */ Mode: () => (/* binding */ Mode) +/* harmony export */ }); +/** + * The supported HPKE modes. + */ +const Mode = { + Base: 0x00, + Psk: 0x01, + Auth: 0x02, + AuthPsk: 0x03, +}; +/** + * The supported Key Encapsulation Mechanism (KEM) identifiers. + */ +const KemId = { + NotAssigned: 0x0000, + DhkemP256HkdfSha256: 0x0010, + DhkemP384HkdfSha384: 0x0011, + DhkemP521HkdfSha512: 0x0012, + DhkemSecp256k1HkdfSha256: 0x0013, + DhkemX25519HkdfSha256: 0x0020, + DhkemX448HkdfSha512: 0x0021, + HybridkemX25519Kyber768: 0x0030, + MlKem512: 0x0040, + MlKem768: 0x0041, + MlKem1024: 0x0042, + XWing: 0x647a, +}; +/** + * The supported Key Derivation Function (KDF) identifiers. + */ +const KdfId = { + HkdfSha256: 0x0001, + HkdfSha384: 0x0002, + HkdfSha512: 0x0003, + Sha3256: 0x0004, + Sha3384: 0x0005, + Sha3512: 0x0006, + Shake128: 0x0010, + Shake256: 0x0011, + TurboShake128: 0x0012, + TurboShake256: 0x0013, +}; +/** + * The supported Authenticated Encryption with Associated Data (AEAD) identifiers. + */ +const AeadId = { + Aes128Gcm: 0x0001, + Aes256Gcm: 0x0002, + Chacha20Poly1305: 0x0003, + ExportOnly: 0xFFFF, +}; + + +/***/ }), + +/***/ 16980: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/serializer.js ***! + \***********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnSerializer: () => (/* binding */ AsnSerializer) +/* harmony export */ }); +/* harmony import */ var asn1js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! asn1js */ 55966); +/* harmony import */ var _peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/utils/bytes */ 15246); +/* harmony import */ var _converters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./converters.js */ 97057); +/* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enums.js */ 55904); +/* harmony import */ var _helper_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./helper.js */ 66676); +/* harmony import */ var _storage_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./storage.js */ 99775); + + + + + + +class AsnSerializer { + static serialize(obj) { + if (obj instanceof asn1js__WEBPACK_IMPORTED_MODULE_0__.BaseBlock) { + return obj.toBER(false); + } + return this.toASN(obj).toBER(false); + } + static toASN(obj) { + if (obj && typeof obj === "object" && (0,_helper_js__WEBPACK_IMPORTED_MODULE_4__.isConvertible)(obj)) { + return obj.toASN(); + } + if (!(obj && typeof obj === "object")) { + throw new TypeError("Parameter 1 should be type of Object."); + } + const target = obj.constructor; + const schema = _storage_js__WEBPACK_IMPORTED_MODULE_5__.schemaStorage.get(target); + _storage_js__WEBPACK_IMPORTED_MODULE_5__.schemaStorage.cache(target); + let asn1Value = []; + if (schema.itemType) { + if (!Array.isArray(obj)) { + throw new TypeError("Parameter 1 should be type of Array."); + } + if (typeof schema.itemType === "number") { + const converter = _converters_js__WEBPACK_IMPORTED_MODULE_2__.defaultConverter(schema.itemType); + if (!converter) { + throw new Error(`Cannot get default converter for array item of ${target.name} ASN1 schema`); + } + asn1Value = obj.map((o) => converter.toASN(o)); + } + else { + asn1Value = obj.map((o) => this.toAsnItem({ type: schema.itemType }, "[]", target, o)); + } + } + else { + for (const key in schema.items) { + const schemaItem = schema.items[key]; + const objProp = obj[key]; + if (objProp === undefined + || schemaItem.defaultValue === objProp + || (typeof schemaItem.defaultValue === "object" + && typeof objProp === "object" + && (0,_helper_js__WEBPACK_IMPORTED_MODULE_4__.isArrayEqual)(this.serialize(schemaItem.defaultValue), this.serialize(objProp)))) { + continue; + } + const asn1Item = AsnSerializer.toAsnItem(schemaItem, key, target, objProp); + if (typeof schemaItem.context === "number") { + if (schemaItem.implicit) { + if (!schemaItem.repeated + && (typeof schemaItem.type === "number" || (0,_helper_js__WEBPACK_IMPORTED_MODULE_4__.isConvertible)(schemaItem.type))) { + const value = {}; + value.valueHex + = asn1Item instanceof asn1js__WEBPACK_IMPORTED_MODULE_0__.Null + ? (0,_peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.toArrayBuffer)(asn1Item.valueBeforeDecodeView) + : asn1Item.valueBlock.toBER(); + asn1Value.push(new asn1js__WEBPACK_IMPORTED_MODULE_0__.Primitive({ + optional: schemaItem.optional, + idBlock: { + tagClass: 3, + tagNumber: schemaItem.context, + }, + ...value, + })); + } + else { + asn1Value.push(new asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed({ + optional: schemaItem.optional, + idBlock: { + tagClass: 3, + tagNumber: schemaItem.context, + }, + value: asn1Item.valueBlock.value, + })); + } + } + else { + asn1Value.push(new asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed({ + optional: schemaItem.optional, + idBlock: { + tagClass: 3, + tagNumber: schemaItem.context, + }, + value: [asn1Item], + })); + } + } + else if (schemaItem.repeated) { + asn1Value = asn1Value.concat(asn1Item); + } + else { + asn1Value.push(asn1Item); + } + } + } + let asnSchema; + switch (schema.type) { + case _enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnTypeTypes.Sequence: + asnSchema = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({ value: asn1Value }); + break; + case _enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnTypeTypes.Set: + asnSchema = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Set({ value: asn1Value }); + break; + case _enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnTypeTypes.Choice: + if (!asn1Value[0]) { + throw new Error(`Schema '${target.name}' has wrong data. Choice cannot be empty.`); + } + asnSchema = asn1Value[0]; + break; + } + return asnSchema; + } + static toAsnItem(schemaItem, key, target, objProp) { + let asn1Item; + if (typeof schemaItem.type === "number") { + const converter = schemaItem.converter; + if (!converter) { + throw new Error(`Property '${key}' doesn't have converter for type ${_enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnPropTypes[schemaItem.type]} in schema '${target.name}'`); + } + if (schemaItem.repeated) { + if (!Array.isArray(objProp)) { + throw new TypeError("Parameter 'objProp' should be type of Array."); + } + const items = Array.from(objProp, (element) => converter.toASN(element)); + const Container = schemaItem.repeated === "sequence" ? asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence : asn1js__WEBPACK_IMPORTED_MODULE_0__.Set; + asn1Item = new Container({ value: items }); + } + else { + asn1Item = converter.toASN(objProp); + } + } + else { + if (schemaItem.repeated) { + if (!Array.isArray(objProp)) { + throw new TypeError("Parameter 'objProp' should be type of Array."); + } + const items = Array.from(objProp, (element) => this.toASN(element)); + const Container = schemaItem.repeated === "sequence" ? asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence : asn1js__WEBPACK_IMPORTED_MODULE_0__.Set; + asn1Item = new Container({ value: items }); + } + else { + asn1Item = this.toASN(objProp); + } + } + return asn1Item; + } +} + + +/***/ }), + +/***/ 17116: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/providers/token-provider.js ***! + \*********************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isTokenProvider: () => (/* binding */ isTokenProvider) +/* harmony export */ }); +function isTokenProvider(provider) { + return !!provider.useToken; +} + + +/***/ }), + +/***/ 17218: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkem.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Dhkem: () => (/* binding */ Dhkem) +/* harmony export */ }); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../consts.js */ 53838); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../errors.js */ 48385); +/* harmony import */ var _interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../interfaces/kemInterface.js */ 68815); +/* harmony import */ var _kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../kdfs/hkdf.js */ 40138); +/* harmony import */ var _utils_misc_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/misc.js */ 30988); + + + + + +// b"eae_prk" +const LABEL_EAE_PRK = /* @__PURE__ */ new Uint8Array([ + 101, + 97, + 101, + 95, + 112, + 114, + 107, +]); +// b"shared_secret" +// deno-fmt-ignore +const LABEL_SHARED_SECRET = /* @__PURE__ */ new Uint8Array([ + 115, 104, 97, 114, 101, 100, 95, 115, 101, 99, + 114, 101, 116, +]); +function concat3(a, b, c) { + const ret = new Uint8Array(a.length + b.length + c.length); + ret.set(a, 0); + ret.set(b, a.length); + ret.set(c, a.length + b.length); + return ret; +} +class Dhkem { + constructor(id, prim, kdf) { + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "_prim", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_kdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.id = id; + this._prim = prim; + this._kdf = kdf; + const suiteId = new Uint8Array(_interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_2__.SUITE_ID_HEADER_KEM); + suiteId.set((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.i2Osp)(this.id, 2), 3); + this._kdf.init(suiteId); + } + async serializePublicKey(key) { + return await this._prim.serializePublicKey(key); + } + async deserializePublicKey(key) { + return await this._prim.deserializePublicKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_3__.toArrayBuffer)(key)); + } + async serializePrivateKey(key) { + return await this._prim.serializePrivateKey(key); + } + async deserializePrivateKey(key) { + return await this._prim.deserializePrivateKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_3__.toArrayBuffer)(key)); + } + async importKey(format, key, isPublic = true) { + return await this._prim.importKey(format, key, isPublic); + } + async generateKeyPair() { + return await this._prim.generateKeyPair(); + } + async deriveKeyPair(ikm) { + const rawIkm = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_3__.toArrayBuffer)(ikm); + if (rawIkm.byteLength > _consts_js__WEBPACK_IMPORTED_MODULE_0__.INPUT_LENGTH_LIMIT) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidParamError("Too long ikm"); + } + return await this._prim.deriveKeyPair(rawIkm); + } + async encap(params) { + let ke; + if (params.ekm === undefined) { + ke = await this.generateKeyPair(); + } + else if ((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.isCryptoKeyPair)(params.ekm)) { + // params.ekm is only used for testing. + ke = params.ekm; + } + else { + // params.ekm is only used for testing. + ke = await this.deriveKeyPair(params.ekm); + } + const enc = await this._prim.serializePublicKey(ke.publicKey); + const pkrm = await this._prim.serializePublicKey(params.recipientPublicKey); + try { + let dh; + if (params.senderKey === undefined) { + dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey)); + } + else { + const sks = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.isCryptoKeyPair)(params.senderKey) + ? params.senderKey.privateKey + : params.senderKey; + const dh1 = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey)); + const dh2 = new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey)); + dh = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.concat)(dh1, dh2); + } + let kemContext; + if (params.senderKey === undefined) { + kemContext = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.concat)(new Uint8Array(enc), new Uint8Array(pkrm)); + } + else { + const pks = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.isCryptoKeyPair)(params.senderKey) + ? params.senderKey.publicKey + : await this._prim.derivePublicKey(params.senderKey); + const pksm = await this._prim.serializePublicKey(pks); + kemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm)); + } + const sharedSecret = await this._generateSharedSecret(dh, kemContext); + return { + enc: enc, + sharedSecret: sharedSecret, + }; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.EncapError(e); + } + } + async decap(params) { + const enc = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_3__.toArrayBuffer)(params.enc); + const pke = await this._prim.deserializePublicKey(enc); + const skr = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.isCryptoKeyPair)(params.recipientKey) + ? params.recipientKey.privateKey + : params.recipientKey; + const pkr = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.isCryptoKeyPair)(params.recipientKey) + ? params.recipientKey.publicKey + : await this._prim.derivePublicKey(params.recipientKey); + const pkrm = await this._prim.serializePublicKey(pkr); + try { + let dh; + if (params.senderPublicKey === undefined) { + dh = new Uint8Array(await this._prim.dh(skr, pke)); + } + else { + const dh1 = new Uint8Array(await this._prim.dh(skr, pke)); + const dh2 = new Uint8Array(await this._prim.dh(skr, params.senderPublicKey)); + dh = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.concat)(dh1, dh2); + } + let kemContext; + if (params.senderPublicKey === undefined) { + kemContext = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.concat)(new Uint8Array(enc), new Uint8Array(pkrm)); + } + else { + const pksm = await this._prim.serializePublicKey(params.senderPublicKey); + kemContext = new Uint8Array(enc.byteLength + pkrm.byteLength + pksm.byteLength); + kemContext.set(new Uint8Array(enc), 0); + kemContext.set(new Uint8Array(pkrm), enc.byteLength); + kemContext.set(new Uint8Array(pksm), enc.byteLength + pkrm.byteLength); + } + return await this._generateSharedSecret(dh, kemContext); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DecapError(e); + } + } + async _generateSharedSecret(dh, kemContext) { + const labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh); + const labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize); + return await this._kdf.extractAndExpand(_consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY, labeledIkm, labeledInfo, this.secretSize); + } +} + + +/***/ }), + +/***/ 17247: +/*!********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@solana+codecs-core@2.3.0_typescript@5.4.3/node_modules/@solana/codecs-core/dist/index.browser.mjs ***! + \********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ addCodecSentinel: () => (/* binding */ addCodecSentinel), +/* harmony export */ addCodecSizePrefix: () => (/* binding */ addCodecSizePrefix), +/* harmony export */ addDecoderSentinel: () => (/* binding */ addDecoderSentinel), +/* harmony export */ addDecoderSizePrefix: () => (/* binding */ addDecoderSizePrefix), +/* harmony export */ addEncoderSentinel: () => (/* binding */ addEncoderSentinel), +/* harmony export */ addEncoderSizePrefix: () => (/* binding */ addEncoderSizePrefix), +/* harmony export */ assertByteArrayHasEnoughBytesForCodec: () => (/* binding */ assertByteArrayHasEnoughBytesForCodec), +/* harmony export */ assertByteArrayIsNotEmptyForCodec: () => (/* binding */ assertByteArrayIsNotEmptyForCodec), +/* harmony export */ assertByteArrayOffsetIsNotOutOfRange: () => (/* binding */ assertByteArrayOffsetIsNotOutOfRange), +/* harmony export */ assertIsFixedSize: () => (/* binding */ assertIsFixedSize), +/* harmony export */ assertIsVariableSize: () => (/* binding */ assertIsVariableSize), +/* harmony export */ combineCodec: () => (/* binding */ combineCodec), +/* harmony export */ containsBytes: () => (/* binding */ containsBytes), +/* harmony export */ createCodec: () => (/* binding */ createCodec), +/* harmony export */ createDecoder: () => (/* binding */ createDecoder), +/* harmony export */ createEncoder: () => (/* binding */ createEncoder), +/* harmony export */ fixBytes: () => (/* binding */ fixBytes), +/* harmony export */ fixCodecSize: () => (/* binding */ fixCodecSize), +/* harmony export */ fixDecoderSize: () => (/* binding */ fixDecoderSize), +/* harmony export */ fixEncoderSize: () => (/* binding */ fixEncoderSize), +/* harmony export */ getEncodedSize: () => (/* binding */ getEncodedSize), +/* harmony export */ isFixedSize: () => (/* binding */ isFixedSize), +/* harmony export */ isVariableSize: () => (/* binding */ isVariableSize), +/* harmony export */ mergeBytes: () => (/* binding */ mergeBytes), +/* harmony export */ offsetCodec: () => (/* binding */ offsetCodec), +/* harmony export */ offsetDecoder: () => (/* binding */ offsetDecoder), +/* harmony export */ offsetEncoder: () => (/* binding */ offsetEncoder), +/* harmony export */ padBytes: () => (/* binding */ padBytes), +/* harmony export */ padLeftCodec: () => (/* binding */ padLeftCodec), +/* harmony export */ padLeftDecoder: () => (/* binding */ padLeftDecoder), +/* harmony export */ padLeftEncoder: () => (/* binding */ padLeftEncoder), +/* harmony export */ padRightCodec: () => (/* binding */ padRightCodec), +/* harmony export */ padRightDecoder: () => (/* binding */ padRightDecoder), +/* harmony export */ padRightEncoder: () => (/* binding */ padRightEncoder), +/* harmony export */ resizeCodec: () => (/* binding */ resizeCodec), +/* harmony export */ resizeDecoder: () => (/* binding */ resizeDecoder), +/* harmony export */ resizeEncoder: () => (/* binding */ resizeEncoder), +/* harmony export */ reverseCodec: () => (/* binding */ reverseCodec), +/* harmony export */ reverseDecoder: () => (/* binding */ reverseDecoder), +/* harmony export */ reverseEncoder: () => (/* binding */ reverseEncoder), +/* harmony export */ transformCodec: () => (/* binding */ transformCodec), +/* harmony export */ transformDecoder: () => (/* binding */ transformDecoder), +/* harmony export */ transformEncoder: () => (/* binding */ transformEncoder) +/* harmony export */ }); +/* harmony import */ var _solana_errors__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @solana/errors */ 65061); + + +// src/add-codec-sentinel.ts + +// src/bytes.ts +var mergeBytes = (byteArrays) => { + const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length); + if (nonEmptyByteArrays.length === 0) { + return byteArrays.length ? byteArrays[0] : new Uint8Array(); + } + if (nonEmptyByteArrays.length === 1) { + return nonEmptyByteArrays[0]; + } + const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0); + const result = new Uint8Array(totalLength); + let offset = 0; + nonEmptyByteArrays.forEach((arr) => { + result.set(arr, offset); + offset += arr.length; + }); + return result; +}; +var padBytes = (bytes, length) => { + if (bytes.length >= length) return bytes; + const paddedBytes = new Uint8Array(length).fill(0); + paddedBytes.set(bytes); + return paddedBytes; +}; +var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length); +function containsBytes(data, bytes, offset) { + const slice = offset === 0 && data.length === bytes.length ? data : data.slice(offset, offset + bytes.length); + if (slice.length !== bytes.length) return false; + return bytes.every((b, i) => b === slice[i]); +} +function getEncodedSize(value, encoder) { + return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value); +} +function createEncoder(encoder) { + return Object.freeze({ + ...encoder, + encode: (value) => { + const bytes = new Uint8Array(getEncodedSize(value, encoder)); + encoder.write(value, bytes, 0); + return bytes; + } + }); +} +function createDecoder(decoder) { + return Object.freeze({ + ...decoder, + decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0] + }); +} +function createCodec(codec) { + return Object.freeze({ + ...codec, + decode: (bytes, offset = 0) => codec.read(bytes, offset)[0], + encode: (value) => { + const bytes = new Uint8Array(getEncodedSize(value, codec)); + codec.write(value, bytes, 0); + return bytes; + } + }); +} +function isFixedSize(codec) { + return "fixedSize" in codec && typeof codec.fixedSize === "number"; +} +function assertIsFixedSize(codec) { + if (!isFixedSize(codec)) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH); + } +} +function isVariableSize(codec) { + return !isFixedSize(codec); +} +function assertIsVariableSize(codec) { + if (!isVariableSize(codec)) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH); + } +} +function combineCodec(encoder, decoder) { + if (isFixedSize(encoder) !== isFixedSize(decoder)) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH); + } + if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH, { + decoderFixedSize: decoder.fixedSize, + encoderFixedSize: encoder.fixedSize + }); + } + if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH, { + decoderMaxSize: decoder.maxSize, + encoderMaxSize: encoder.maxSize + }); + } + return { + ...decoder, + ...encoder, + decode: decoder.decode, + encode: encoder.encode, + read: decoder.read, + write: encoder.write + }; +} + +// src/add-codec-sentinel.ts +function addEncoderSentinel(encoder, sentinel) { + const write = (value, bytes, offset) => { + const encoderBytes = encoder.encode(value); + if (findSentinelIndex(encoderBytes, sentinel) >= 0) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL, { + encodedBytes: encoderBytes, + hexEncodedBytes: hexBytes(encoderBytes), + hexSentinel: hexBytes(sentinel), + sentinel + }); + } + bytes.set(encoderBytes, offset); + offset += encoderBytes.length; + bytes.set(sentinel, offset); + offset += sentinel.length; + return offset; + }; + if (isFixedSize(encoder)) { + return createEncoder({ ...encoder, fixedSize: encoder.fixedSize + sentinel.length, write }); + } + return createEncoder({ + ...encoder, + ...encoder.maxSize != null ? { maxSize: encoder.maxSize + sentinel.length } : {}, + getSizeFromValue: (value) => encoder.getSizeFromValue(value) + sentinel.length, + write + }); +} +function addDecoderSentinel(decoder, sentinel) { + const read = (bytes, offset) => { + const candidateBytes = offset === 0 ? bytes : bytes.slice(offset); + const sentinelIndex = findSentinelIndex(candidateBytes, sentinel); + if (sentinelIndex === -1) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES, { + decodedBytes: candidateBytes, + hexDecodedBytes: hexBytes(candidateBytes), + hexSentinel: hexBytes(sentinel), + sentinel + }); + } + const preSentinelBytes = candidateBytes.slice(0, sentinelIndex); + return [decoder.decode(preSentinelBytes), offset + preSentinelBytes.length + sentinel.length]; + }; + if (isFixedSize(decoder)) { + return createDecoder({ ...decoder, fixedSize: decoder.fixedSize + sentinel.length, read }); + } + return createDecoder({ + ...decoder, + ...decoder.maxSize != null ? { maxSize: decoder.maxSize + sentinel.length } : {}, + read + }); +} +function addCodecSentinel(codec, sentinel) { + return combineCodec(addEncoderSentinel(codec, sentinel), addDecoderSentinel(codec, sentinel)); +} +function findSentinelIndex(bytes, sentinel) { + return bytes.findIndex((byte, index, arr) => { + if (sentinel.length === 1) return byte === sentinel[0]; + return containsBytes(arr, sentinel, index); + }); +} +function hexBytes(bytes) { + return bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), ""); +} +function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) { + if (bytes.length - offset <= 0) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY, { + codecDescription + }); + } +} +function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) { + const bytesLength = bytes.length - offset; + if (bytesLength < expected) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH, { + bytesLength, + codecDescription, + expected + }); + } +} +function assertByteArrayOffsetIsNotOutOfRange(codecDescription, offset, bytesLength) { + if (offset < 0 || offset > bytesLength) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE, { + bytesLength, + codecDescription, + offset + }); + } +} + +// src/add-codec-size-prefix.ts +function addEncoderSizePrefix(encoder, prefix) { + const write = (value, bytes, offset) => { + const encoderBytes = encoder.encode(value); + offset = prefix.write(encoderBytes.length, bytes, offset); + bytes.set(encoderBytes, offset); + return offset + encoderBytes.length; + }; + if (isFixedSize(prefix) && isFixedSize(encoder)) { + return createEncoder({ ...encoder, fixedSize: prefix.fixedSize + encoder.fixedSize, write }); + } + const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null; + const encoderMaxSize = isFixedSize(encoder) ? encoder.fixedSize : encoder.maxSize ?? null; + const maxSize = prefixMaxSize !== null && encoderMaxSize !== null ? prefixMaxSize + encoderMaxSize : null; + return createEncoder({ + ...encoder, + ...maxSize !== null ? { maxSize } : {}, + getSizeFromValue: (value) => { + const encoderSize = getEncodedSize(value, encoder); + return getEncodedSize(encoderSize, prefix) + encoderSize; + }, + write + }); +} +function addDecoderSizePrefix(decoder, prefix) { + const read = (bytes, offset) => { + const [bigintSize, decoderOffset] = prefix.read(bytes, offset); + const size = Number(bigintSize); + offset = decoderOffset; + if (offset > 0 || bytes.length > size) { + bytes = bytes.slice(offset, offset + size); + } + assertByteArrayHasEnoughBytesForCodec("addDecoderSizePrefix", size, bytes); + return [decoder.decode(bytes), offset + size]; + }; + if (isFixedSize(prefix) && isFixedSize(decoder)) { + return createDecoder({ ...decoder, fixedSize: prefix.fixedSize + decoder.fixedSize, read }); + } + const prefixMaxSize = isFixedSize(prefix) ? prefix.fixedSize : prefix.maxSize ?? null; + const decoderMaxSize = isFixedSize(decoder) ? decoder.fixedSize : decoder.maxSize ?? null; + const maxSize = prefixMaxSize !== null && decoderMaxSize !== null ? prefixMaxSize + decoderMaxSize : null; + return createDecoder({ ...decoder, ...maxSize !== null ? { maxSize } : {}, read }); +} +function addCodecSizePrefix(codec, prefix) { + return combineCodec(addEncoderSizePrefix(codec, prefix), addDecoderSizePrefix(codec, prefix)); +} + +// src/fix-codec-size.ts +function fixEncoderSize(encoder, fixedBytes) { + return createEncoder({ + fixedSize: fixedBytes, + write: (value, bytes, offset) => { + const variableByteArray = encoder.encode(value); + const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray; + bytes.set(fixedByteArray, offset); + return offset + fixedBytes; + } + }); +} +function fixDecoderSize(decoder, fixedBytes) { + return createDecoder({ + fixedSize: fixedBytes, + read: (bytes, offset) => { + assertByteArrayHasEnoughBytesForCodec("fixCodecSize", fixedBytes, bytes, offset); + if (offset > 0 || bytes.length > fixedBytes) { + bytes = bytes.slice(offset, offset + fixedBytes); + } + if (isFixedSize(decoder)) { + bytes = fixBytes(bytes, decoder.fixedSize); + } + const [value] = decoder.read(bytes, 0); + return [value, offset + fixedBytes]; + } + }); +} +function fixCodecSize(codec, fixedBytes) { + return combineCodec(fixEncoderSize(codec, fixedBytes), fixDecoderSize(codec, fixedBytes)); +} + +// src/offset-codec.ts +function offsetEncoder(encoder, config) { + return createEncoder({ + ...encoder, + write: (value, bytes, preOffset) => { + const wrapBytes = (offset) => modulo(offset, bytes.length); + const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset; + assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPreOffset, bytes.length); + const postOffset = encoder.write(value, bytes, newPreOffset); + const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset; + assertByteArrayOffsetIsNotOutOfRange("offsetEncoder", newPostOffset, bytes.length); + return newPostOffset; + } + }); +} +function offsetDecoder(decoder, config) { + return createDecoder({ + ...decoder, + read: (bytes, preOffset) => { + const wrapBytes = (offset) => modulo(offset, bytes.length); + const newPreOffset = config.preOffset ? config.preOffset({ bytes, preOffset, wrapBytes }) : preOffset; + assertByteArrayOffsetIsNotOutOfRange("offsetDecoder", newPreOffset, bytes.length); + const [value, postOffset] = decoder.read(bytes, newPreOffset); + const newPostOffset = config.postOffset ? config.postOffset({ bytes, newPreOffset, postOffset, preOffset, wrapBytes }) : postOffset; + assertByteArrayOffsetIsNotOutOfRange("offsetDecoder", newPostOffset, bytes.length); + return [value, newPostOffset]; + } + }); +} +function offsetCodec(codec, config) { + return combineCodec(offsetEncoder(codec, config), offsetDecoder(codec, config)); +} +function modulo(dividend, divisor) { + if (divisor === 0) return 0; + return (dividend % divisor + divisor) % divisor; +} +function resizeEncoder(encoder, resize) { + if (isFixedSize(encoder)) { + const fixedSize = resize(encoder.fixedSize); + if (fixedSize < 0) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, { + bytesLength: fixedSize, + codecDescription: "resizeEncoder" + }); + } + return createEncoder({ ...encoder, fixedSize }); + } + return createEncoder({ + ...encoder, + getSizeFromValue: (value) => { + const newSize = resize(encoder.getSizeFromValue(value)); + if (newSize < 0) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, { + bytesLength: newSize, + codecDescription: "resizeEncoder" + }); + } + return newSize; + } + }); +} +function resizeDecoder(decoder, resize) { + if (isFixedSize(decoder)) { + const fixedSize = resize(decoder.fixedSize); + if (fixedSize < 0) { + throw new _solana_errors__WEBPACK_IMPORTED_MODULE_0__.SolanaError(_solana_errors__WEBPACK_IMPORTED_MODULE_0__.SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH, { + bytesLength: fixedSize, + codecDescription: "resizeDecoder" + }); + } + return createDecoder({ ...decoder, fixedSize }); + } + return decoder; +} +function resizeCodec(codec, resize) { + return combineCodec(resizeEncoder(codec, resize), resizeDecoder(codec, resize)); +} + +// src/pad-codec.ts +function padLeftEncoder(encoder, offset) { + return offsetEncoder( + resizeEncoder(encoder, (size) => size + offset), + { preOffset: ({ preOffset }) => preOffset + offset } + ); +} +function padRightEncoder(encoder, offset) { + return offsetEncoder( + resizeEncoder(encoder, (size) => size + offset), + { postOffset: ({ postOffset }) => postOffset + offset } + ); +} +function padLeftDecoder(decoder, offset) { + return offsetDecoder( + resizeDecoder(decoder, (size) => size + offset), + { preOffset: ({ preOffset }) => preOffset + offset } + ); +} +function padRightDecoder(decoder, offset) { + return offsetDecoder( + resizeDecoder(decoder, (size) => size + offset), + { postOffset: ({ postOffset }) => postOffset + offset } + ); +} +function padLeftCodec(codec, offset) { + return combineCodec(padLeftEncoder(codec, offset), padLeftDecoder(codec, offset)); +} +function padRightCodec(codec, offset) { + return combineCodec(padRightEncoder(codec, offset), padRightDecoder(codec, offset)); +} + +// src/reverse-codec.ts +function copySourceToTargetInReverse(source, target_WILL_MUTATE, sourceOffset, sourceLength, targetOffset = 0) { + while (sourceOffset < --sourceLength) { + const leftValue = source[sourceOffset]; + target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceLength]; + target_WILL_MUTATE[sourceLength + targetOffset] = leftValue; + sourceOffset++; + } + if (sourceOffset === sourceLength) { + target_WILL_MUTATE[sourceOffset + targetOffset] = source[sourceOffset]; + } +} +function reverseEncoder(encoder) { + assertIsFixedSize(encoder); + return createEncoder({ + ...encoder, + write: (value, bytes, offset) => { + const newOffset = encoder.write(value, bytes, offset); + copySourceToTargetInReverse( + bytes, + bytes, + offset, + offset + encoder.fixedSize + ); + return newOffset; + } + }); +} +function reverseDecoder(decoder) { + assertIsFixedSize(decoder); + return createDecoder({ + ...decoder, + read: (bytes, offset) => { + const reversedBytes = bytes.slice(); + copySourceToTargetInReverse( + bytes, + reversedBytes, + offset, + offset + decoder.fixedSize + ); + return decoder.read(reversedBytes, offset); + } + }); +} +function reverseCodec(codec) { + return combineCodec(reverseEncoder(codec), reverseDecoder(codec)); +} + +// src/transform-codec.ts +function transformEncoder(encoder, unmap) { + return createEncoder({ + ...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder, + write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset) + }); +} +function transformDecoder(decoder, map) { + return createDecoder({ + ...decoder, + read: (bytes, offset) => { + const [value, newOffset] = decoder.read(bytes, offset); + return [map(value, bytes, offset), newOffset]; + } + }); +} +function transformCodec(codec, unmap, map) { + return createCodec({ + ...transformEncoder(codec, unmap), + read: map ? transformDecoder(codec, map).read : codec.read + }); +} + + +//# sourceMappingURL=index.browser.mjs.map +//# sourceMappingURL=index.browser.mjs.map + +/***/ }), + +/***/ 17317: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/stream-browser.js ***! + \***********************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = __webpack_require__(/*! events */ 43236).EventEmitter; + + +/***/ }), + +/***/ 17389: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/index.js ***! + \***********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DigestInfo: () => (/* reexport safe */ _rsassa_pkcs1_v1_5_js__WEBPACK_IMPORTED_MODULE_2__.DigestInfo), +/* harmony export */ RSAES_OAEP: () => (/* reexport safe */ _rsaes_oaep_js__WEBPACK_IMPORTED_MODULE_0__.RSAES_OAEP), +/* harmony export */ RSASSA_PSS: () => (/* reexport safe */ _rsassa_pss_js__WEBPACK_IMPORTED_MODULE_1__.RSASSA_PSS), +/* harmony export */ RsaEsOaepParams: () => (/* reexport safe */ _rsaes_oaep_js__WEBPACK_IMPORTED_MODULE_0__.RsaEsOaepParams), +/* harmony export */ RsaSaPssParams: () => (/* reexport safe */ _rsassa_pss_js__WEBPACK_IMPORTED_MODULE_1__.RsaSaPssParams) +/* harmony export */ }); +/* harmony import */ var _rsaes_oaep_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rsaes_oaep.js */ 65615); +/* harmony import */ var _rsassa_pss_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./rsassa_pss.js */ 73459); +/* harmony import */ var _rsassa_pkcs1_v1_5_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./rsassa_pkcs1_v1_5.js */ 66139); + + + + + +/***/ }), + +/***/ 17516: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/weierstrass.js ***! + \********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DER: () => (/* binding */ DER), +/* harmony export */ DERErr: () => (/* binding */ DERErr), +/* harmony export */ SWUFpSqrtRatio: () => (/* binding */ SWUFpSqrtRatio), +/* harmony export */ mapToCurveSimpleSWU: () => (/* binding */ mapToCurveSimpleSWU), +/* harmony export */ weierstrass: () => (/* binding */ weierstrass), +/* harmony export */ weierstrassPoints: () => (/* binding */ weierstrassPoints) +/* harmony export */ }); +/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./curve.js */ 48119); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ 85070); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ 35797); +/** + * Short Weierstrass curve methods. The formula is: y² = x³ + ax + b. + * + * ### Parameters + * + * To initialize a weierstrass curve, one needs to pass following params: + * + * * a: formula param + * * b: formula param + * * Fp: finite field of prime characteristic P; may be complex (Fp2). Arithmetics is done in field + * * n: order of prime subgroup a.k.a total amount of valid curve points + * * Gx: Base point (x, y) aka generator point. Gx = x coordinate + * * Gy: ...y coordinate + * * h: cofactor, usually 1. h*n = curve group order (n is only subgroup order) + * * lowS: whether to enable (default) or disable "low-s" non-malleable signatures + * + * ### Design rationale for types + * + * * Interaction between classes from different curves should fail: + * `k256.Point.BASE.add(p256.Point.BASE)` + * * For this purpose we want to use `instanceof` operator, which is fast and works during runtime + * * Different calls of `curve()` would return different classes - + * `curve(params) !== curve(params)`: if somebody decided to monkey-patch their curve, + * it won't affect others + * + * TypeScript can't infer types for classes created inside a function. Classes is one instance + * of nominative types in TypeScript and interfaces only check for shape, so it's hard to create + * unique type for every function call. + * + * We can use generic types via some param, like curve opts, but that would: + * 1. Enable interaction between `curve(params)` and `curve(params)` (curves of same params) + * which is hard to debug. + * 2. Params can be generic and we can't enforce them to be constant value: + * if somebody creates curve from non-constant params, + * it would be allowed to interact with other curves with non-constant params + * + * @todo https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// prettier-ignore + +// prettier-ignore + +// prettier-ignore + +function validateSigVerOpts(opts) { + if (opts.lowS !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('lowS', opts.lowS); + if (opts.prehash !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('prehash', opts.prehash); +} +function validatePointOpts(curve) { + const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.validateObject)(opts, { + a: 'field', + b: 'field', + }, { + allowInfinityPoint: 'boolean', + allowedPrivateKeyLengths: 'array', + clearCofactor: 'function', + fromBytes: 'function', + isTorsionFree: 'function', + toBytes: 'function', + wrapPrivateKey: 'boolean', + }); + const { endo, Fp, a } = opts; + if (endo) { + if (!Fp.eql(a, Fp.ZERO)) { + throw new Error('invalid endo: CURVE.a must be 0'); + } + if (typeof endo !== 'object' || + typeof endo.beta !== 'bigint' || + typeof endo.splitScalar !== 'function') { + throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function'); + } + } + return Object.freeze({ ...opts }); +} +class DERErr extends Error { + constructor(m = '') { + super(m); + } +} +/** + * ASN.1 DER encoding utilities. ASN is very complex & fragile. Format: + * + * [0x30 (SEQUENCE), bytelength, 0x02 (INTEGER), intLength, R, 0x02 (INTEGER), intLength, S] + * + * Docs: https://letsencrypt.org/docs/a-warm-welcome-to-asn1-and-der/, https://luca.ntop.org/Teaching/Appunti/asn1.html + */ +const DER = { + // asn.1 DER encoding utils + Err: DERErr, + // Basic building block is TLV (Tag-Length-Value) + _tlv: { + encode: (tag, data) => { + const { Err: E } = DER; + if (tag < 0 || tag > 256) + throw new E('tlv.encode: wrong tag'); + if (data.length & 1) + throw new E('tlv.encode: unpadded data'); + const dataLen = data.length / 2; + const len = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(dataLen); + if ((len.length / 2) & 128) + throw new E('tlv.encode: long form length too big'); + // length of length with long form flag + const lenLen = dataLen > 127 ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)((len.length / 2) | 128) : ''; + const t = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(tag); + return t + lenLen + len + data; + }, + // v - value, l - left bytes (unparsed) + decode(tag, data) { + const { Err: E } = DER; + let pos = 0; + if (tag < 0 || tag > 256) + throw new E('tlv.encode: wrong tag'); + if (data.length < 2 || data[pos++] !== tag) + throw new E('tlv.decode: wrong tlv'); + const first = data[pos++]; + const isLong = !!(first & 128); // First bit of first length byte is flag for short/long form + let length = 0; + if (!isLong) + length = first; + else { + // Long form: [longFlag(1bit), lengthLength(7bit), length (BE)] + const lenLen = first & 127; + if (!lenLen) + throw new E('tlv.decode(long): indefinite length not supported'); + if (lenLen > 4) + throw new E('tlv.decode(long): byte length is too big'); // this will overflow u32 in js + const lengthBytes = data.subarray(pos, pos + lenLen); + if (lengthBytes.length !== lenLen) + throw new E('tlv.decode: length bytes not complete'); + if (lengthBytes[0] === 0) + throw new E('tlv.decode(long): zero leftmost byte'); + for (const b of lengthBytes) + length = (length << 8) | b; + pos += lenLen; + if (length < 128) + throw new E('tlv.decode(long): not minimal encoding'); + } + const v = data.subarray(pos, pos + length); + if (v.length !== length) + throw new E('tlv.decode: wrong value length'); + return { v, l: data.subarray(pos + length) }; + }, + }, + // https://crypto.stackexchange.com/a/57734 Leftmost bit of first byte is 'negative' flag, + // since we always use positive integers here. It must always be empty: + // - add zero byte if exists + // - if next byte doesn't have a flag, leading zero is not allowed (minimal encoding) + _int: { + encode(num) { + const { Err: E } = DER; + if (num < _0n) + throw new E('integer: negative integers are not allowed'); + let hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToHexUnpadded)(num); + // Pad with zero byte if negative flag is present + if (Number.parseInt(hex[0], 16) & 0b1000) + hex = '00' + hex; + if (hex.length & 1) + throw new E('unexpected DER parsing assertion: unpadded hex'); + return hex; + }, + decode(data) { + const { Err: E } = DER; + if (data[0] & 128) + throw new E('invalid signature integer: negative'); + if (data[0] === 0x00 && !(data[1] & 128)) + throw new E('invalid signature integer: unnecessary leading zero'); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(data); + }, + }, + toSig(hex) { + // parse DER signature + const { Err: E, _int: int, _tlv: tlv } = DER; + const data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('signature', hex); + const { v: seqBytes, l: seqLeftBytes } = tlv.decode(0x30, data); + if (seqLeftBytes.length) + throw new E('invalid signature: left bytes after parsing'); + const { v: rBytes, l: rLeftBytes } = tlv.decode(0x02, seqBytes); + const { v: sBytes, l: sLeftBytes } = tlv.decode(0x02, rLeftBytes); + if (sLeftBytes.length) + throw new E('invalid signature: left bytes after parsing'); + return { r: int.decode(rBytes), s: int.decode(sBytes) }; + }, + hexFromSig(sig) { + const { _tlv: tlv, _int: int } = DER; + const rs = tlv.encode(0x02, int.encode(sig.r)); + const ss = tlv.encode(0x02, int.encode(sig.s)); + const seq = rs + ss; + return tlv.encode(0x30, seq); + }, +}; +function numToSizedHex(num, size) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesBE)(num, size)); +} +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _3n = BigInt(3), _4n = BigInt(4); +function weierstrassPoints(opts) { + const CURVE = validatePointOpts(opts); + const { Fp } = CURVE; // All curves has same field / group length as for now, but they can differ + const Fn = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.Field)(CURVE.n, CURVE.nBitLength); + const toBytes = CURVE.toBytes || + ((_c, point, _isCompressed) => { + const a = point.toAffine(); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(Uint8Array.from([0x04]), Fp.toBytes(a.x), Fp.toBytes(a.y)); + }); + const fromBytes = CURVE.fromBytes || + ((bytes) => { + // const head = bytes[0]; + const tail = bytes.subarray(1); + // if (head !== 0x04) throw new Error('Only non-compressed encoding is supported'); + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + }); + /** + * y² = x³ + ax + b: Short weierstrass curve formula. Takes x, returns y². + * @returns y² + */ + function weierstrassEquation(x) { + const { a, b } = CURVE; + const x2 = Fp.sqr(x); // x * x + const x3 = Fp.mul(x2, x); // x² * x + return Fp.add(Fp.add(x3, Fp.mul(x, a)), b); // x³ + a * x + b + } + function isValidXY(x, y) { + const left = Fp.sqr(y); // y² + const right = weierstrassEquation(x); // x³ + ax + b + return Fp.eql(left, right); + } + // Validate whether the passed curve params are valid. + // Test 1: equation y² = x³ + ax + b should work for generator point. + if (!isValidXY(CURVE.Gx, CURVE.Gy)) + throw new Error('bad curve params: generator point'); + // Test 2: discriminant Δ part should be non-zero: 4a³ + 27b² != 0. + // Guarantees curve is genus-1, smooth (non-singular). + const _4a3 = Fp.mul(Fp.pow(CURVE.a, _3n), _4n); + const _27b2 = Fp.mul(Fp.sqr(CURVE.b), BigInt(27)); + if (Fp.is0(Fp.add(_4a3, _27b2))) + throw new Error('bad curve params: a or b'); + // Valid group elements reside in range 1..n-1 + function isWithinCurveOrder(num) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.inRange)(num, _1n, CURVE.n); + } + // Validates if priv key is valid and converts it to bigint. + // Supports options allowedPrivateKeyLengths and wrapPrivateKey. + function normPrivateKeyToScalar(key) { + const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n: N } = CURVE; + if (lengths && typeof key !== 'bigint') { + if ((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isBytes)(key)) + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)(key); + // Normalize to hex string, pad. E.g. P521 would norm 130-132 char hex to 132-char bytes + if (typeof key !== 'string' || !lengths.includes(key.length)) + throw new Error('invalid private key'); + key = key.padStart(nByteLength * 2, '0'); + } + let num; + try { + num = + typeof key === 'bigint' + ? key + : (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('private key', key, nByteLength)); + } + catch (error) { + throw new Error('invalid private key, expected hex or ' + nByteLength + ' bytes, got ' + typeof key); + } + if (wrapPrivateKey) + num = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(num, N); // disabled by default, enabled for BLS + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('private key', num, _1n, N); // num in range [1..N-1] + return num; + } + function aprjpoint(other) { + if (!(other instanceof Point)) + throw new Error('ProjectivePoint expected'); + } + // Memoized toAffine / validity check. They are heavy. Points are immutable. + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (X, Y, Z) ∋ (x=X/Z, y=Y/Z) + const toAffineMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p, iz) => { + const { px: x, py: y, pz: z } = p; + // Fast-path for normalized points + if (Fp.eql(z, Fp.ONE)) + return { x, y }; + const is0 = p.is0(); + // If invZ was 0, we return zero point. However we still want to execute + // all operations, so we replace invZ with a random number, 1. + if (iz == null) + iz = is0 ? Fp.ONE : Fp.inv(z); + const ax = Fp.mul(x, iz); + const ay = Fp.mul(y, iz); + const zz = Fp.mul(z, iz); + if (is0) + return { x: Fp.ZERO, y: Fp.ZERO }; + if (!Fp.eql(zz, Fp.ONE)) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + }); + // NOTE: on exception this will crash 'cached' and no value will be set. + // Otherwise true will be return + const assertValidMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p) => { + if (p.is0()) { + // (0, 1, 0) aka ZERO is invalid in most contexts. + // In BLS, ZERO can be serialized, so we allow it. + // (0, 0, 0) is invalid representation of ZERO. + if (CURVE.allowInfinityPoint && !Fp.is0(p.py)) + return; + throw new Error('bad point: ZERO'); + } + // Some 3rd-party test vectors require different wording between here & `fromCompressedHex` + const { x, y } = p.toAffine(); + // Check if x, y are valid field elements + if (!Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('bad point: x or y not FE'); + if (!isValidXY(x, y)) + throw new Error('bad point: equation left != right'); + if (!p.isTorsionFree()) + throw new Error('bad point: not in prime-order subgroup'); + return true; + }); + /** + * Projective Point works in 3d / projective (homogeneous) coordinates: (X, Y, Z) ∋ (x=X/Z, y=Y/Z) + * Default Point works in 2d / affine coordinates: (x, y) + * We're doing calculations in projective, because its operations don't require costly inversion. + */ + class Point { + constructor(px, py, pz) { + if (px == null || !Fp.isValid(px)) + throw new Error('x required'); + if (py == null || !Fp.isValid(py) || Fp.is0(py)) + throw new Error('y required'); + if (pz == null || !Fp.isValid(pz)) + throw new Error('z required'); + this.px = px; + this.py = py; + this.pz = pz; + Object.freeze(this); + } + // Does not validate if the point is on-curve. + // Use fromHex instead, or call assertValidity() later. + static fromAffine(p) { + const { x, y } = p || {}; + if (!p || !Fp.isValid(x) || !Fp.isValid(y)) + throw new Error('invalid affine point'); + if (p instanceof Point) + throw new Error('projective point not allowed'); + const is0 = (i) => Fp.eql(i, Fp.ZERO); + // fromAffine(x:0, y:0) would produce (x:0, y:0, z:1), but we need (x:0, y:1, z:0) + if (is0(x) && is0(y)) + return Point.ZERO; + return new Point(x, y, Fp.ONE); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + /** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ + static normalizeZ(points) { + const toInv = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(Fp, points.map((p) => p.pz)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + /** + * Converts hash string or Uint8Array to Point. + * @param hex short/long ECDSA hex + */ + static fromHex(hex) { + const P = Point.fromAffine(fromBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('pointHex', hex))); + P.assertValidity(); + return P; + } + // Multiplies generator point by privateKey. + static fromPrivateKey(privateKey) { + return Point.BASE.multiply(normPrivateKeyToScalar(privateKey)); + } + // Multiscalar Multiplication + static msm(points, scalars) { + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.pippenger)(Point, Fn, points, scalars); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + wnaf.setWindowSize(this, windowSize); + } + // A point on curve is valid if it conforms to equation. + assertValidity() { + assertValidMemo(this); + } + hasEvenY() { + const { y } = this.toAffine(); + if (Fp.isOdd) + return !Fp.isOdd(y); + throw new Error("Field doesn't support isOdd"); + } + /** + * Compare one point to another. + */ + equals(other) { + aprjpoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + const U1 = Fp.eql(Fp.mul(X1, Z2), Fp.mul(X2, Z1)); + const U2 = Fp.eql(Fp.mul(Y1, Z2), Fp.mul(Y2, Z1)); + return U1 && U2; + } + /** + * Flips point to one corresponding to (x, -y) in Affine coordinates. + */ + negate() { + return new Point(this.px, Fp.neg(this.py), this.pz); + } + // Renes-Costello-Batina exception-free doubling formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 3 + // Cost: 8M + 3S + 3*a + 2*b3 + 15add. + double() { + const { a, b } = CURVE; + const b3 = Fp.mul(b, _3n); + const { px: X1, py: Y1, pz: Z1 } = this; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + let t0 = Fp.mul(X1, X1); // step 1 + let t1 = Fp.mul(Y1, Y1); + let t2 = Fp.mul(Z1, Z1); + let t3 = Fp.mul(X1, Y1); + t3 = Fp.add(t3, t3); // step 5 + Z3 = Fp.mul(X1, Z1); + Z3 = Fp.add(Z3, Z3); + X3 = Fp.mul(a, Z3); + Y3 = Fp.mul(b3, t2); + Y3 = Fp.add(X3, Y3); // step 10 + X3 = Fp.sub(t1, Y3); + Y3 = Fp.add(t1, Y3); + Y3 = Fp.mul(X3, Y3); + X3 = Fp.mul(t3, X3); + Z3 = Fp.mul(b3, Z3); // step 15 + t2 = Fp.mul(a, t2); + t3 = Fp.sub(t0, t2); + t3 = Fp.mul(a, t3); + t3 = Fp.add(t3, Z3); + Z3 = Fp.add(t0, t0); // step 20 + t0 = Fp.add(Z3, t0); + t0 = Fp.add(t0, t2); + t0 = Fp.mul(t0, t3); + Y3 = Fp.add(Y3, t0); + t2 = Fp.mul(Y1, Z1); // step 25 + t2 = Fp.add(t2, t2); + t0 = Fp.mul(t2, t3); + X3 = Fp.sub(X3, t0); + Z3 = Fp.mul(t2, t1); + Z3 = Fp.add(Z3, Z3); // step 30 + Z3 = Fp.add(Z3, Z3); + return new Point(X3, Y3, Z3); + } + // Renes-Costello-Batina exception-free addition formula. + // There is 30% faster Jacobian formula, but it is not complete. + // https://eprint.iacr.org/2015/1060, algorithm 1 + // Cost: 12M + 0S + 3*a + 3*b3 + 23add. + add(other) { + aprjpoint(other); + const { px: X1, py: Y1, pz: Z1 } = this; + const { px: X2, py: Y2, pz: Z2 } = other; + let X3 = Fp.ZERO, Y3 = Fp.ZERO, Z3 = Fp.ZERO; // prettier-ignore + const a = CURVE.a; + const b3 = Fp.mul(CURVE.b, _3n); + let t0 = Fp.mul(X1, X2); // step 1 + let t1 = Fp.mul(Y1, Y2); + let t2 = Fp.mul(Z1, Z2); + let t3 = Fp.add(X1, Y1); + let t4 = Fp.add(X2, Y2); // step 5 + t3 = Fp.mul(t3, t4); + t4 = Fp.add(t0, t1); + t3 = Fp.sub(t3, t4); + t4 = Fp.add(X1, Z1); + let t5 = Fp.add(X2, Z2); // step 10 + t4 = Fp.mul(t4, t5); + t5 = Fp.add(t0, t2); + t4 = Fp.sub(t4, t5); + t5 = Fp.add(Y1, Z1); + X3 = Fp.add(Y2, Z2); // step 15 + t5 = Fp.mul(t5, X3); + X3 = Fp.add(t1, t2); + t5 = Fp.sub(t5, X3); + Z3 = Fp.mul(a, t4); + X3 = Fp.mul(b3, t2); // step 20 + Z3 = Fp.add(X3, Z3); + X3 = Fp.sub(t1, Z3); + Z3 = Fp.add(t1, Z3); + Y3 = Fp.mul(X3, Z3); + t1 = Fp.add(t0, t0); // step 25 + t1 = Fp.add(t1, t0); + t2 = Fp.mul(a, t2); + t4 = Fp.mul(b3, t4); + t1 = Fp.add(t1, t2); + t2 = Fp.sub(t0, t2); // step 30 + t2 = Fp.mul(a, t2); + t4 = Fp.add(t4, t2); + t0 = Fp.mul(t1, t4); + Y3 = Fp.add(Y3, t0); + t0 = Fp.mul(t5, t4); // step 35 + X3 = Fp.mul(t3, X3); + X3 = Fp.sub(X3, t0); + t0 = Fp.mul(t3, t1); + Z3 = Fp.mul(t5, Z3); + Z3 = Fp.add(Z3, t0); // step 40 + return new Point(X3, Y3, Z3); + } + subtract(other) { + return this.add(other.negate()); + } + is0() { + return this.equals(Point.ZERO); + } + wNAF(n) { + return wnaf.wNAFCached(this, n, Point.normalizeZ); + } + /** + * Non-constant-time multiplication. Uses double-and-add algorithm. + * It's faster, but should only be used when you don't care about + * an exposed private key e.g. sig verification, which works over *public* keys. + */ + multiplyUnsafe(sc) { + const { endo, n: N } = CURVE; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', sc, _0n, N); + const I = Point.ZERO; + if (sc === _0n) + return I; + if (this.is0() || sc === _1n) + return this; + // Case a: no endomorphism. Case b: has precomputes. + if (!endo || wnaf.hasPrecomputes(this)) + return wnaf.wNAFCachedUnsafe(this, sc, Point.normalizeZ); + // Case c: endomorphism + /** See docs for {@link EndomorphismOpts} */ + let { k1neg, k1, k2neg, k2 } = endo.splitScalar(sc); + let k1p = I; + let k2p = I; + let d = this; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + k1p = k1p.add(d); + if (k2 & _1n) + k2p = k2p.add(d); + d = d.double(); + k1 >>= _1n; + k2 >>= _1n; + } + if (k1neg) + k1p = k1p.negate(); + if (k2neg) + k2p = k2p.negate(); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + return k1p.add(k2p); + } + /** + * Constant time multiplication. + * Uses wNAF method. Windowed method may be 10% faster, + * but takes 2x longer to generate and consumes 2x memory. + * Uses precomputes when available. + * Uses endomorphism for Koblitz curves. + * @param scalar by which the point would be multiplied + * @returns New point + */ + multiply(scalar) { + const { endo, n: N } = CURVE; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', scalar, _1n, N); + let point, fake; // Fake point is used to const-time mult + /** See docs for {@link EndomorphismOpts} */ + if (endo) { + const { k1neg, k1, k2neg, k2 } = endo.splitScalar(scalar); + let { p: k1p, f: f1p } = this.wNAF(k1); + let { p: k2p, f: f2p } = this.wNAF(k2); + k1p = wnaf.constTimeNegate(k1neg, k1p); + k2p = wnaf.constTimeNegate(k2neg, k2p); + k2p = new Point(Fp.mul(k2p.px, endo.beta), k2p.py, k2p.pz); + point = k1p.add(k2p); + fake = f1p.add(f2p); + } + else { + const { p, f } = this.wNAF(scalar); + point = p; + fake = f; + } + // Normalize `z` for both points, but return only real one + return Point.normalizeZ([point, fake])[0]; + } + /** + * Efficiently calculate `aP + bQ`. Unsafe, can expose private key, if used incorrectly. + * Not using Strauss-Shamir trick: precomputation tables are faster. + * The trick could be useful if both P and Q are not G (not in our case). + * @returns non-zero affine point + */ + multiplyAndAddUnsafe(Q, a, b) { + const G = Point.BASE; // No Strauss-Shamir trick: we have 10% faster G precomputes + const mul = (P, a // Select faster multiply() method + ) => (a === _0n || a === _1n || !P.equals(G) ? P.multiplyUnsafe(a) : P.multiply(a)); + const sum = mul(this, a).add(mul(Q, b)); + return sum.is0() ? undefined : sum; + } + // Converts Projective point to affine (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + // (x, y, z) ∋ (x=x/z, y=y/z) + toAffine(iz) { + return toAffineMemo(this, iz); + } + isTorsionFree() { + const { h: cofactor, isTorsionFree } = CURVE; + if (cofactor === _1n) + return true; // No subgroups, always torsion-free + if (isTorsionFree) + return isTorsionFree(Point, this); + throw new Error('isTorsionFree() has not been declared for the elliptic curve'); + } + clearCofactor() { + const { h: cofactor, clearCofactor } = CURVE; + if (cofactor === _1n) + return this; // Fast-path + if (clearCofactor) + return clearCofactor(Point, this); + return this.multiplyUnsafe(CURVE.h); + } + toRawBytes(isCompressed = true) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + this.assertValidity(); + return toBytes(Point, this, isCompressed); + } + toHex(isCompressed = true) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)(this.toRawBytes(isCompressed)); + } + } + // base / generator point + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, Fp.ONE); + // zero / infinity / identity point + Point.ZERO = new Point(Fp.ZERO, Fp.ONE, Fp.ZERO); // 0, 1, 0 + const { endo, nBitLength } = CURVE; + const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.wNAF)(Point, endo ? Math.ceil(nBitLength / 2) : nBitLength); + return { + CURVE, + ProjectivePoint: Point, + normPrivateKeyToScalar, + weierstrassEquation, + isWithinCurveOrder, + }; +} +function validateOpts(curve) { + const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.validateObject)(opts, { + hash: 'hash', + hmac: 'function', + randomBytes: 'function', + }, { + bits2int: 'function', + bits2int_modN: 'function', + lowS: 'boolean', + }); + return Object.freeze({ lowS: true, ...opts }); +} +/** + * Creates short weierstrass curve and ECDSA signature methods for it. + * @example + * import { Field } from '@noble/curves/abstract/modular'; + * // Before that, define BigInt-s: a, b, p, n, Gx, Gy + * const curve = weierstrass({ a, b, Fp: Field(p), n, Gx, Gy, h: 1n }) + */ +function weierstrass(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER, nByteLength, nBitLength } = CURVE; + const compressedLen = Fp.BYTES + 1; // e.g. 33 for 32 + const uncompressedLen = 2 * Fp.BYTES + 1; // e.g. 65 for 32 + function modN(a) { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(a, CURVE_ORDER); + } + function invN(a) { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.invert)(a, CURVE_ORDER); + } + const { ProjectivePoint: Point, normPrivateKeyToScalar, weierstrassEquation, isWithinCurveOrder, } = weierstrassPoints({ + ...CURVE, + toBytes(_c, point, isCompressed) { + const a = point.toAffine(); + const x = Fp.toBytes(a.x); + const cat = _utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('isCompressed', isCompressed); + if (isCompressed) { + return cat(Uint8Array.from([point.hasEvenY() ? 0x02 : 0x03]), x); + } + else { + return cat(Uint8Array.from([0x04]), x, Fp.toBytes(a.y)); + } + }, + fromBytes(bytes) { + const len = bytes.length; + const head = bytes[0]; + const tail = bytes.subarray(1); + // this.assertValidity() is done inside of fromHex + if (len === compressedLen && (head === 0x02 || head === 0x03)) { + const x = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(tail); + if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.inRange)(x, _1n, Fp.ORDER)) + throw new Error('Point is not on curve'); + const y2 = weierstrassEquation(x); // y² = x³ + ax + b + let y; + try { + y = Fp.sqrt(y2); // y = y² ^ (p+1)/4 + } + catch (sqrtError) { + const suffix = sqrtError instanceof Error ? ': ' + sqrtError.message : ''; + throw new Error('Point is not on curve' + suffix); + } + const isYOdd = (y & _1n) === _1n; + // ECDSA + const isHeadOdd = (head & 1) === 1; + if (isHeadOdd !== isYOdd) + y = Fp.neg(y); + return { x, y }; + } + else if (len === uncompressedLen && head === 0x04) { + const x = Fp.fromBytes(tail.subarray(0, Fp.BYTES)); + const y = Fp.fromBytes(tail.subarray(Fp.BYTES, 2 * Fp.BYTES)); + return { x, y }; + } + else { + const cl = compressedLen; + const ul = uncompressedLen; + throw new Error('invalid Point, expected length of ' + cl + ', or uncompressed ' + ul + ', got ' + len); + } + }, + }); + function isBiggerThanHalfOrder(number) { + const HALF = CURVE_ORDER >> _1n; + return number > HALF; + } + function normalizeS(s) { + return isBiggerThanHalfOrder(s) ? modN(-s) : s; + } + // slice bytes num + const slcNum = (b, from, to) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(b.slice(from, to)); + /** + * ECDSA signature with its (r, s) properties. Supports DER & compact representations. + */ + class Signature { + constructor(r, s, recovery) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('r', r, _1n, CURVE_ORDER); // r in [1..N] + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('s', s, _1n, CURVE_ORDER); // s in [1..N] + this.r = r; + this.s = s; + if (recovery != null) + this.recovery = recovery; + Object.freeze(this); + } + // pair (bytes of r, bytes of s) + static fromCompact(hex) { + const l = nByteLength; + hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('compactSignature', hex, l * 2); + return new Signature(slcNum(hex, 0, l), slcNum(hex, l, 2 * l)); + } + // DER encoded ECDSA signature + // https://bitcoin.stackexchange.com/questions/57644/what-are-the-parts-of-a-bitcoin-transaction-input-script + static fromDER(hex) { + const { r, s } = DER.toSig((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('DER', hex)); + return new Signature(r, s); + } + /** + * @todo remove + * @deprecated + */ + assertValidity() { } + addRecoveryBit(recovery) { + return new Signature(this.r, this.s, recovery); + } + recoverPublicKey(msgHash) { + const { r, s, recovery: rec } = this; + const h = bits2int_modN((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash)); // Truncate hash + if (rec == null || ![0, 1, 2, 3].includes(rec)) + throw new Error('recovery id invalid'); + const radj = rec === 2 || rec === 3 ? r + CURVE.n : r; + if (radj >= Fp.ORDER) + throw new Error('recovery id 2 or 3 invalid'); + const prefix = (rec & 1) === 0 ? '02' : '03'; + const R = Point.fromHex(prefix + numToSizedHex(radj, Fp.BYTES)); + const ir = invN(radj); // r^-1 + const u1 = modN(-h * ir); // -hr^-1 + const u2 = modN(s * ir); // sr^-1 + const Q = Point.BASE.multiplyAndAddUnsafe(R, u1, u2); // (sr^-1)R-(hr^-1)G = -(hr^-1)G + (sr^-1) + if (!Q) + throw new Error('point at infinify'); // unsafe is fine: no priv data leaked + Q.assertValidity(); + return Q; + } + // Signatures should be low-s, to prevent malleability. + hasHighS() { + return isBiggerThanHalfOrder(this.s); + } + normalizeS() { + return this.hasHighS() ? new Signature(this.r, modN(-this.s), this.recovery) : this; + } + // DER-encoded + toDERRawBytes() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hexToBytes)(this.toDERHex()); + } + toDERHex() { + return DER.hexFromSig(this); + } + // padded bytes of r, then padded bytes of s + toCompactRawBytes() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.hexToBytes)(this.toCompactHex()); + } + toCompactHex() { + const l = nByteLength; + return numToSizedHex(this.r, l) + numToSizedHex(this.s, l); + } + } + const utils = { + isValidPrivateKey(privateKey) { + try { + normPrivateKeyToScalar(privateKey); + return true; + } + catch (error) { + return false; + } + }, + normPrivateKeyToScalar: normPrivateKeyToScalar, + /** + * Produces cryptographically secure private key from random of size + * (groupLen + ceil(groupLen / 2)) with modulo bias being negligible. + */ + randomPrivateKey: () => { + const length = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.getMinHashLength)(CURVE.n); + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mapHashToField)(CURVE.randomBytes(length), CURVE.n); + }, + /** + * Creates precompute table for an arbitrary EC point. Makes point "cached". + * Allows to massively speed-up `point.multiply(scalar)`. + * @returns cached point + * @example + * const fast = utils.precompute(8, ProjectivePoint.fromHex(someonesPubKey)); + * fast.multiply(privKey); // much faster ECDH now + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); // 3 is arbitrary, just need any number here + return point; + }, + }; + /** + * Computes public key for a private key. Checks for validity of the private key. + * @param privateKey private key + * @param isCompressed whether to return compact (default), or full key + * @returns Public key, full when isCompressed=false; short when isCompressed=true + */ + function getPublicKey(privateKey, isCompressed = true) { + return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed); + } + /** + * Quick and dirty check for item being public key. Does not validate hex, or being on-curve. + */ + function isProbPub(item) { + if (typeof item === 'bigint') + return false; + if (item instanceof Point) + return true; + const arr = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('key', item); + const len = arr.length; + const fpl = Fp.BYTES; + const compLen = fpl + 1; // e.g. 33 for 32 + const uncompLen = 2 * fpl + 1; // e.g. 65 for 32 + if (CURVE.allowedPrivateKeyLengths || nByteLength === compLen) { + return undefined; + } + else { + return len === compLen || len === uncompLen; + } + } + /** + * ECDH (Elliptic Curve Diffie Hellman). + * Computes shared public key from private key and public key. + * Checks: 1) private key validity 2) shared key is on-curve. + * Does NOT hash the result. + * @param privateA private key + * @param publicB different public key + * @param isCompressed whether to return compact (default), or full key + * @returns shared public key + */ + function getSharedSecret(privateA, publicB, isCompressed = true) { + if (isProbPub(privateA) === true) + throw new Error('first arg must be private key'); + if (isProbPub(publicB) === false) + throw new Error('second arg must be public key'); + const b = Point.fromHex(publicB); // check for being on-curve + return b.multiply(normPrivateKeyToScalar(privateA)).toRawBytes(isCompressed); + } + // RFC6979: ensure ECDSA msg is X bytes and < N. RFC suggests optional truncating via bits2octets. + // FIPS 186-4 4.6 suggests the leftmost min(nBitLen, outLen) bits, which matches bits2int. + // bits2int can produce res>N, we can do mod(res, N) since the bitLen is the same. + // int2octets can't be used; pads small msgs with 0: unacceptatble for trunc as per RFC vectors + const bits2int = CURVE.bits2int || + function (bytes) { + // Our custom check "just in case", for protection against DoS + if (bytes.length > 8192) + throw new Error('input is too large'); + // For curves with nBitLength % 8 !== 0: bits2octets(bits2octets(m)) !== bits2octets(m) + // for some cases, since bytes.length * 8 is not actual bitLength. + const num = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberBE)(bytes); // check for == u8 done here + const delta = bytes.length * 8 - nBitLength; // truncate to nBitLength leftmost bits + return delta > 0 ? num >> BigInt(delta) : num; + }; + const bits2int_modN = CURVE.bits2int_modN || + function (bytes) { + return modN(bits2int(bytes)); // can't use bytesToNumberBE here + }; + // NOTE: pads output with zero as per spec + const ORDER_MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bitMask)(nBitLength); + /** + * Converts to bytes. Checks if num in `[0..ORDER_MASK-1]` e.g.: `[0..2^256-1]`. + */ + function int2octets(num) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('num < 2^' + nBitLength, num, _0n, ORDER_MASK); + // works with order, can have different size than numToField! + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesBE)(num, nByteLength); + } + // Steps A, D of RFC6979 3.2 + // Creates RFC6979 seed; converts msg/privKey to numbers. + // Used only in sign, not in verify. + // NOTE: we cannot assume here that msgHash has same amount of bytes as curve order, + // this will be invalid at least for P521. Also it can be bigger for P224 + SHA256 + function prepSig(msgHash, privateKey, opts = defaultSigOpts) { + if (['recovered', 'canonical'].some((k) => k in opts)) + throw new Error('sign() legacy options not supported'); + const { hash, randomBytes } = CURVE; + let { lowS, prehash, extraEntropy: ent } = opts; // generates low-s sigs by default + if (lowS == null) + lowS = true; // RFC6979 3.2: we skip step A, because we already provide hash + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash); + validateSigVerOpts(opts); + if (prehash) + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('prehashed msgHash', hash(msgHash)); + // We can't later call bits2octets, since nested bits2int is broken for curves + // with nBitLength % 8 !== 0. Because of that, we unwrap it here as int2octets call. + // const bits2octets = (bits) => int2octets(bits2int_modN(bits)) + const h1int = bits2int_modN(msgHash); + const d = normPrivateKeyToScalar(privateKey); // validate private key, convert to bigint + const seedArgs = [int2octets(d), int2octets(h1int)]; + // extraEntropy. RFC6979 3.6: additional k' (optional). + if (ent != null && ent !== false) { + // K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1) || k') + const e = ent === true ? randomBytes(Fp.BYTES) : ent; // generate random bytes OR pass as-is + seedArgs.push((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('extraEntropy', e)); // check for being bytes + } + const seed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(...seedArgs); // Step D of RFC6979 3.2 + const m = h1int; // NOTE: no need to call bits2int second time here, it is inside truncateHash! + // Converts signature params into point w r/s, checks result for validity. + function k2sig(kBytes) { + // RFC 6979 Section 3.2, step 3: k = bits2int(T) + const k = bits2int(kBytes); // Cannot use fields methods, since it is group element + if (!isWithinCurveOrder(k)) + return; // Important: all mod() calls here must be done over N + const ik = invN(k); // k^-1 mod n + const q = Point.BASE.multiply(k).toAffine(); // q = Gk + const r = modN(q.x); // r = q.x mod n + if (r === _0n) + return; + // Can use scalar blinding b^-1(bm + bdr) where b ∈ [1,q−1] according to + // https://tches.iacr.org/index.php/TCHES/article/view/7337/6509. We've decided against it: + // a) dependency on CSPRNG b) 15% slowdown c) doesn't really help since bigints are not CT + const s = modN(ik * modN(m + r * d)); // Not using blinding here + if (s === _0n) + return; + let recovery = (q.x === r ? 0 : 2) | Number(q.y & _1n); // recovery bit (2 or 3, when q.x > n) + let normS = s; + if (lowS && isBiggerThanHalfOrder(s)) { + normS = normalizeS(s); // if lowS was passed, ensure s is always + recovery ^= 1; // // in the bottom half of N + } + return new Signature(r, normS, recovery); // use normS, not s + } + return { seed, k2sig }; + } + const defaultSigOpts = { lowS: CURVE.lowS, prehash: false }; + const defaultVerOpts = { lowS: CURVE.lowS, prehash: false }; + /** + * Signs message hash with a private key. + * ``` + * sign(m, d, k) where + * (x, y) = G × k + * r = x mod n + * s = (m + dr)/k mod n + * ``` + * @param msgHash NOT message. msg needs to be hashed to `msgHash`, or use `prehash`. + * @param privKey private key + * @param opts lowS for non-malleable sigs. extraEntropy for mixing randomness into k. prehash will hash first arg. + * @returns signature with recovery param + */ + function sign(msgHash, privKey, opts = defaultSigOpts) { + const { seed, k2sig } = prepSig(msgHash, privKey, opts); // Steps A, D of RFC6979 3.2. + const C = CURVE; + const drbg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHmacDrbg)(C.hash.outputLen, C.nByteLength, C.hmac); + return drbg(seed, k2sig); // Steps B, C, D, E, F, G + } + // Enable precomputes. Slows down first publicKey computation by 20ms. + Point.BASE._setWindowSize(8); + // utils.precompute(8, ProjectivePoint.BASE) + /** + * Verifies a signature against message hash and public key. + * Rejects lowS signatures by default: to override, + * specify option `{lowS: false}`. Implements section 4.1.4 from https://www.secg.org/sec1-v2.pdf: + * + * ``` + * verify(r, s, h, P) where + * U1 = hs^-1 mod n + * U2 = rs^-1 mod n + * R = U1⋅G - U2⋅P + * mod(R.x, n) == r + * ``` + */ + function verify(signature, msgHash, publicKey, opts = defaultVerOpts) { + const sg = signature; + msgHash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('msgHash', msgHash); + publicKey = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('publicKey', publicKey); + const { lowS, prehash, format } = opts; + // Verify opts, deduce signature format + validateSigVerOpts(opts); + if ('strict' in opts) + throw new Error('options.strict was renamed to lowS'); + if (format !== undefined && format !== 'compact' && format !== 'der') + throw new Error('format must be compact or der'); + const isHex = typeof sg === 'string' || (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.isBytes)(sg); + const isObj = !isHex && + !format && + typeof sg === 'object' && + sg !== null && + typeof sg.r === 'bigint' && + typeof sg.s === 'bigint'; + if (!isHex && !isObj) + throw new Error('invalid signature, expected Uint8Array, hex string or Signature instance'); + let _sig = undefined; + let P; + try { + if (isObj) + _sig = new Signature(sg.r, sg.s); + if (isHex) { + // Signature can be represented in 2 ways: compact (2*nByteLength) & DER (variable-length). + // Since DER can also be 2*nByteLength bytes, we check for it first. + try { + if (format !== 'compact') + _sig = Signature.fromDER(sg); + } + catch (derError) { + if (!(derError instanceof DER.Err)) + throw derError; + } + if (!_sig && format !== 'der') + _sig = Signature.fromCompact(sg); + } + P = Point.fromHex(publicKey); + } + catch (error) { + return false; + } + if (!_sig) + return false; + if (lowS && _sig.hasHighS()) + return false; + if (prehash) + msgHash = CURVE.hash(msgHash); + const { r, s } = _sig; + const h = bits2int_modN(msgHash); // Cannot use fields methods, since it is group element + const is = invN(s); // s^-1 + const u1 = modN(h * is); // u1 = hs^-1 mod n + const u2 = modN(r * is); // u2 = rs^-1 mod n + const R = Point.BASE.multiplyAndAddUnsafe(P, u1, u2)?.toAffine(); // R = u1⋅G + u2⋅P + if (!R) + return false; + const v = modN(R.x); + return v === r; + } + return { + CURVE, + getPublicKey, + getSharedSecret, + sign, + verify, + ProjectivePoint: Point, + Signature, + utils, + }; +} +/** + * Implementation of the Shallue and van de Woestijne method for any weierstrass curve. + * TODO: check if there is a way to merge this with uvRatio in Edwards; move to modular. + * b = True and y = sqrt(u / v) if (u / v) is square in F, and + * b = False and y = sqrt(Z * (u / v)) otherwise. + * @param Fp + * @param Z + * @returns + */ +function SWUFpSqrtRatio(Fp, Z) { + // Generic implementation + const q = Fp.ORDER; + let l = _0n; + for (let o = q - _1n; o % _2n === _0n; o /= _2n) + l += _1n; + const c1 = l; // 1. c1, the largest integer such that 2^c1 divides q - 1. + // We need 2n ** c1 and 2n ** (c1-1). We can't use **; but we can use <<. + // 2n ** c1 == 2n << (c1-1) + const _2n_pow_c1_1 = _2n << (c1 - _1n - _1n); + const _2n_pow_c1 = _2n_pow_c1_1 * _2n; + const c2 = (q - _1n) / _2n_pow_c1; // 2. c2 = (q - 1) / (2^c1) # Integer arithmetic + const c3 = (c2 - _1n) / _2n; // 3. c3 = (c2 - 1) / 2 # Integer arithmetic + const c4 = _2n_pow_c1 - _1n; // 4. c4 = 2^c1 - 1 # Integer arithmetic + const c5 = _2n_pow_c1_1; // 5. c5 = 2^(c1 - 1) # Integer arithmetic + const c6 = Fp.pow(Z, c2); // 6. c6 = Z^c2 + const c7 = Fp.pow(Z, (c2 + _1n) / _2n); // 7. c7 = Z^((c2 + 1) / 2) + let sqrtRatio = (u, v) => { + let tv1 = c6; // 1. tv1 = c6 + let tv2 = Fp.pow(v, c4); // 2. tv2 = v^c4 + let tv3 = Fp.sqr(tv2); // 3. tv3 = tv2^2 + tv3 = Fp.mul(tv3, v); // 4. tv3 = tv3 * v + let tv5 = Fp.mul(u, tv3); // 5. tv5 = u * tv3 + tv5 = Fp.pow(tv5, c3); // 6. tv5 = tv5^c3 + tv5 = Fp.mul(tv5, tv2); // 7. tv5 = tv5 * tv2 + tv2 = Fp.mul(tv5, v); // 8. tv2 = tv5 * v + tv3 = Fp.mul(tv5, u); // 9. tv3 = tv5 * u + let tv4 = Fp.mul(tv3, tv2); // 10. tv4 = tv3 * tv2 + tv5 = Fp.pow(tv4, c5); // 11. tv5 = tv4^c5 + let isQR = Fp.eql(tv5, Fp.ONE); // 12. isQR = tv5 == 1 + tv2 = Fp.mul(tv3, c7); // 13. tv2 = tv3 * c7 + tv5 = Fp.mul(tv4, tv1); // 14. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, isQR); // 15. tv3 = CMOV(tv2, tv3, isQR) + tv4 = Fp.cmov(tv5, tv4, isQR); // 16. tv4 = CMOV(tv5, tv4, isQR) + // 17. for i in (c1, c1 - 1, ..., 2): + for (let i = c1; i > _1n; i--) { + let tv5 = i - _2n; // 18. tv5 = i - 2 + tv5 = _2n << (tv5 - _1n); // 19. tv5 = 2^tv5 + let tvv5 = Fp.pow(tv4, tv5); // 20. tv5 = tv4^tv5 + const e1 = Fp.eql(tvv5, Fp.ONE); // 21. e1 = tv5 == 1 + tv2 = Fp.mul(tv3, tv1); // 22. tv2 = tv3 * tv1 + tv1 = Fp.mul(tv1, tv1); // 23. tv1 = tv1 * tv1 + tvv5 = Fp.mul(tv4, tv1); // 24. tv5 = tv4 * tv1 + tv3 = Fp.cmov(tv2, tv3, e1); // 25. tv3 = CMOV(tv2, tv3, e1) + tv4 = Fp.cmov(tvv5, tv4, e1); // 26. tv4 = CMOV(tv5, tv4, e1) + } + return { isValid: isQR, value: tv3 }; + }; + if (Fp.ORDER % _4n === _3n) { + // sqrt_ratio_3mod4(u, v) + const c1 = (Fp.ORDER - _3n) / _4n; // 1. c1 = (q - 3) / 4 # Integer arithmetic + const c2 = Fp.sqrt(Fp.neg(Z)); // 2. c2 = sqrt(-Z) + sqrtRatio = (u, v) => { + let tv1 = Fp.sqr(v); // 1. tv1 = v^2 + const tv2 = Fp.mul(u, v); // 2. tv2 = u * v + tv1 = Fp.mul(tv1, tv2); // 3. tv1 = tv1 * tv2 + let y1 = Fp.pow(tv1, c1); // 4. y1 = tv1^c1 + y1 = Fp.mul(y1, tv2); // 5. y1 = y1 * tv2 + const y2 = Fp.mul(y1, c2); // 6. y2 = y1 * c2 + const tv3 = Fp.mul(Fp.sqr(y1), v); // 7. tv3 = y1^2; 8. tv3 = tv3 * v + const isQR = Fp.eql(tv3, u); // 9. isQR = tv3 == u + let y = Fp.cmov(y2, y1, isQR); // 10. y = CMOV(y2, y1, isQR) + return { isValid: isQR, value: y }; // 11. return (isQR, y) isQR ? y : y*c2 + }; + } + // No curves uses that + // if (Fp.ORDER % _8n === _5n) // sqrt_ratio_5mod8 + return sqrtRatio; +} +/** + * Simplified Shallue-van de Woestijne-Ulas Method + * https://www.rfc-editor.org/rfc/rfc9380#section-6.6.2 + */ +function mapToCurveSimpleSWU(Fp, opts) { + (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.validateField)(Fp); + if (!Fp.isValid(opts.A) || !Fp.isValid(opts.B) || !Fp.isValid(opts.Z)) + throw new Error('mapToCurveSimpleSWU: invalid opts'); + const sqrtRatio = SWUFpSqrtRatio(Fp, opts.Z); + if (!Fp.isOdd) + throw new Error('Fp.isOdd is not implemented!'); + // Input: u, an element of F. + // Output: (x, y), a point on E. + return (u) => { + // prettier-ignore + let tv1, tv2, tv3, tv4, tv5, tv6, x, y; + tv1 = Fp.sqr(u); // 1. tv1 = u^2 + tv1 = Fp.mul(tv1, opts.Z); // 2. tv1 = Z * tv1 + tv2 = Fp.sqr(tv1); // 3. tv2 = tv1^2 + tv2 = Fp.add(tv2, tv1); // 4. tv2 = tv2 + tv1 + tv3 = Fp.add(tv2, Fp.ONE); // 5. tv3 = tv2 + 1 + tv3 = Fp.mul(tv3, opts.B); // 6. tv3 = B * tv3 + tv4 = Fp.cmov(opts.Z, Fp.neg(tv2), !Fp.eql(tv2, Fp.ZERO)); // 7. tv4 = CMOV(Z, -tv2, tv2 != 0) + tv4 = Fp.mul(tv4, opts.A); // 8. tv4 = A * tv4 + tv2 = Fp.sqr(tv3); // 9. tv2 = tv3^2 + tv6 = Fp.sqr(tv4); // 10. tv6 = tv4^2 + tv5 = Fp.mul(tv6, opts.A); // 11. tv5 = A * tv6 + tv2 = Fp.add(tv2, tv5); // 12. tv2 = tv2 + tv5 + tv2 = Fp.mul(tv2, tv3); // 13. tv2 = tv2 * tv3 + tv6 = Fp.mul(tv6, tv4); // 14. tv6 = tv6 * tv4 + tv5 = Fp.mul(tv6, opts.B); // 15. tv5 = B * tv6 + tv2 = Fp.add(tv2, tv5); // 16. tv2 = tv2 + tv5 + x = Fp.mul(tv1, tv3); // 17. x = tv1 * tv3 + const { isValid, value } = sqrtRatio(tv2, tv6); // 18. (is_gx1_square, y1) = sqrt_ratio(tv2, tv6) + y = Fp.mul(tv1, u); // 19. y = tv1 * u -> Z * u^3 * y1 + y = Fp.mul(y, value); // 20. y = y * y1 + x = Fp.cmov(x, tv3, isValid); // 21. x = CMOV(x, tv3, is_gx1_square) + y = Fp.cmov(y, value, isValid); // 22. y = CMOV(y, y1, is_gx1_square) + const e1 = Fp.isOdd(u) === Fp.isOdd(y); // 23. e1 = sgn0(u) == sgn0(y) + y = Fp.cmov(Fp.neg(y), y, e1); // 24. y = CMOV(-y, y, e1) + const tv4_inv = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(Fp, [tv4], true)[0]; + x = Fp.mul(x, tv4_inv); // 25. x = x / tv4 + return { x, y }; + }; +} +//# sourceMappingURL=weierstrass.js.map + +/***/ }), + +/***/ 17527: +/*!*******************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/socket.js ***! + \*******************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ client: () => (/* binding */ client), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _clients_WebSocketClient_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./clients/WebSocketClient.js */ 82227); +/* harmony import */ var _utils_log_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/log.js */ 49708); +/* provided dependency */ var __webpack_dev_server_client__ = __webpack_require__(/*! ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/clients/WebSocketClient.js */ 82227); +/* global __webpack_dev_server_client__ */ + + + + +// this WebsocketClient is here as a default fallback, in case the client is not injected +/* eslint-disable camelcase */ +var Client = +// eslint-disable-next-line no-nested-ternary +typeof __webpack_dev_server_client__ !== "undefined" ? typeof __webpack_dev_server_client__.default !== "undefined" ? __webpack_dev_server_client__.default : __webpack_dev_server_client__ : _clients_WebSocketClient_js__WEBPACK_IMPORTED_MODULE_0__["default"]; +/* eslint-enable camelcase */ + +var retries = 0; +var maxRetries = 10; + +// Initialized client is exported so external consumers can utilize the same instance +// It is mutable to enforce singleton +// eslint-disable-next-line import/no-mutable-exports +var client = null; +var timeout; + +/** + * @param {string} url + * @param {{ [handler: string]: (data?: any, params?: any) => any }} handlers + * @param {number} [reconnect] + */ +var socket = function initSocket(url, handlers, reconnect) { + client = new Client(url); + client.onOpen(function () { + retries = 0; + if (timeout) { + clearTimeout(timeout); + } + if (typeof reconnect !== "undefined") { + maxRetries = reconnect; + } + }); + client.onClose(function () { + if (retries === 0) { + handlers.close(); + } + + // Try to reconnect. + client = null; + + // After 10 retries stop trying, to prevent logspam. + if (retries < maxRetries) { + // Exponentially increase timeout to reconnect. + // Respectfully copied from the package `got`. + // eslint-disable-next-line no-restricted-properties + var retryInMs = 1000 * Math.pow(2, retries) + Math.random() * 100; + retries += 1; + _utils_log_js__WEBPACK_IMPORTED_MODULE_1__.log.info("Trying to reconnect..."); + timeout = setTimeout(function () { + socket(url, handlers, reconnect); + }, retryInMs); + } + }); + client.onMessage( + /** + * @param {any} data + */ + function (data) { + var message = JSON.parse(data); + if (handlers[message.type]) { + handlers[message.type](message.data, message.params); + } + }); +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (socket); + +/***/ }), + +/***/ 17600: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/ripemd160@2.0.3/node_modules/ripemd160/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! buffer */ 62266).Buffer); +var inherits = __webpack_require__(/*! inherits */ 18628); +var HashBase = __webpack_require__(/*! hash-base */ 6613); + +var ARRAY16 = new Array(16); + +var zl = [ + 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 +]; + +var zr = [ + 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 +]; + +var sl = [ + 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 +]; + +var sr = [ + 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 +]; + +var hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]; +var hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]; + +function rotl(x, n) { + return (x << n) | (x >>> (32 - n)); +} + +function fn1(a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0; +} + +function fn2(a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & c) | (~b & d)) + m + k) | 0, s) + e) | 0; +} + +function fn3(a, b, c, d, e, m, k, s) { + return (rotl((a + ((b | ~c) ^ d) + m + k) | 0, s) + e) | 0; +} + +function fn4(a, b, c, d, e, m, k, s) { + return (rotl((a + ((b & d) | (c & ~d)) + m + k) | 0, s) + e) | 0; +} + +function fn5(a, b, c, d, e, m, k, s) { + return (rotl((a + (b ^ (c | ~d)) + m + k) | 0, s) + e) | 0; +} + +function RIPEMD160() { + HashBase.call(this, 64); + + // state + this._a = 0x67452301; + this._b = 0xefcdab89; + this._c = 0x98badcfe; + this._d = 0x10325476; + this._e = 0xc3d2e1f0; +} + +inherits(RIPEMD160, HashBase); + +RIPEMD160.prototype._update = function () { + var words = ARRAY16; + for (var j = 0; j < 16; ++j) { + words[j] = this._block.readInt32LE(j * 4); + } + + var al = this._a | 0; + var bl = this._b | 0; + var cl = this._c | 0; + var dl = this._d | 0; + var el = this._e | 0; + + var ar = this._a | 0; + var br = this._b | 0; + var cr = this._c | 0; + var dr = this._d | 0; + var er = this._e | 0; + + // computation + for (var i = 0; i < 80; i += 1) { + var tl; + var tr; + if (i < 16) { + tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i]); + tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i]); + } else if (i < 32) { + tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i]); + tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i]); + } else if (i < 48) { + tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i]); + tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i]); + } else if (i < 64) { + tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i]); + tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i]); + } else { // if (i<80) { + tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i]); + tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i]); + } + + al = el; + el = dl; + dl = rotl(cl, 10); + cl = bl; + bl = tl; + + ar = er; + er = dr; + dr = rotl(cr, 10); + cr = br; + br = tr; + } + + // update state + var t = (this._b + cl + dr) | 0; + this._b = (this._c + dl + er) | 0; + this._c = (this._d + el + ar) | 0; + this._d = (this._e + al + br) | 0; + this._e = (this._a + bl + cr) | 0; + this._a = t; +}; + +RIPEMD160.prototype._digest = function () { + // create padding and handle blocks + this._block[this._blockOffset] = 0x80; + this._blockOffset += 1; + if (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(); + + // produce result + var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20); // eslint-disable-line no-buffer-constructor + buffer.writeInt32LE(this._a, 0); + buffer.writeInt32LE(this._b, 4); + buffer.writeInt32LE(this._c, 8); + buffer.writeInt32LE(this._d, 12); + buffer.writeInt32LE(this._e, 16); + return buffer; +}; + +module.exports = RIPEMD160; + + +/***/ }), + +/***/ 17634: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/recipient_info.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ OtherRecipientInfo: () => (/* binding */ OtherRecipientInfo), +/* harmony export */ RecipientInfo: () => (/* binding */ RecipientInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _key_agree_recipient_info_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./key_agree_recipient_info.js */ 4695); +/* harmony import */ var _key_trans_recipient_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./key_trans_recipient_info.js */ 53445); +/* harmony import */ var _kek_recipient_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./kek_recipient_info.js */ 57084); +/* harmony import */ var _password_recipient_info_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./password_recipient_info.js */ 92930); + + + + + + +class OtherRecipientInfo { + oriType = ""; + oriValue = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], OtherRecipientInfo.prototype, "oriType", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], OtherRecipientInfo.prototype, "oriValue", void 0); +let RecipientInfo = class RecipientInfo { + ktri; + kari; + kekri; + pwri; + ori; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _key_trans_recipient_info_js__WEBPACK_IMPORTED_MODULE_3__.KeyTransRecipientInfo, optional: true, + }) +], RecipientInfo.prototype, "ktri", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _key_agree_recipient_info_js__WEBPACK_IMPORTED_MODULE_2__.KeyAgreeRecipientInfo, context: 1, implicit: true, optional: true, + }) +], RecipientInfo.prototype, "kari", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _kek_recipient_info_js__WEBPACK_IMPORTED_MODULE_4__.KEKRecipientInfo, context: 2, implicit: true, optional: true, + }) +], RecipientInfo.prototype, "kekri", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _password_recipient_info_js__WEBPACK_IMPORTED_MODULE_5__.PasswordRecipientInfo, context: 3, implicit: true, optional: true, + }) +], RecipientInfo.prototype, "pwri", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: OtherRecipientInfo, context: 4, implicit: true, optional: true, + }) +], RecipientInfo.prototype, "ori", void 0); +RecipientInfo = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], RecipientInfo); + + + +/***/ }), + +/***/ 17657: +/*!***********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/attributes/counter_signature.js ***! + \***********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CounterSignature: () => (/* binding */ CounterSignature), +/* harmony export */ id_counterSignature: () => (/* binding */ id_counterSignature) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _signer_info_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../signer_info.js */ 50275); + + + +const id_counterSignature = "1.2.840.113549.1.9.6"; +let CounterSignature = class CounterSignature extends _signer_info_js__WEBPACK_IMPORTED_MODULE_2__.SignerInfo { +}; +CounterSignature = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], CounterSignature); + + + +/***/ }), + +/***/ 17725: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/other_prime_info.js ***! + \***********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ OtherPrimeInfo: () => (/* binding */ OtherPrimeInfo), +/* harmony export */ OtherPrimeInfos: () => (/* binding */ OtherPrimeInfos) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +var OtherPrimeInfos_1; + + +class OtherPrimeInfo { + prime = new ArrayBuffer(0); + exponent = new ArrayBuffer(0); + coefficient = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], OtherPrimeInfo.prototype, "prime", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], OtherPrimeInfo.prototype, "exponent", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], OtherPrimeInfo.prototype, "coefficient", void 0); +let OtherPrimeInfos = OtherPrimeInfos_1 = class OtherPrimeInfos extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, OtherPrimeInfos_1.prototype); + } +}; +OtherPrimeInfos = OtherPrimeInfos_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: OtherPrimeInfo, + }) +], OtherPrimeInfos); + + + +/***/ }), + +/***/ 17767: +/*!****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/attr_spec.js ***! + \****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AttrSpec: () => (/* binding */ AttrSpec) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +var AttrSpec_1; + + +let AttrSpec = AttrSpec_1 = class AttrSpec extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, AttrSpec_1.prototype); + } +}; +AttrSpec = AttrSpec_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier, + }) +], AttrSpec); + + + +/***/ }), + +/***/ 17852: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/algorithms.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ md2: () => (/* binding */ md2), +/* harmony export */ md2WithRSAEncryption: () => (/* binding */ md2WithRSAEncryption), +/* harmony export */ md4: () => (/* binding */ md4), +/* harmony export */ md5WithRSAEncryption: () => (/* binding */ md5WithRSAEncryption), +/* harmony export */ mgf1SHA1: () => (/* binding */ mgf1SHA1), +/* harmony export */ pSpecifiedEmpty: () => (/* binding */ pSpecifiedEmpty), +/* harmony export */ rsaEncryption: () => (/* binding */ rsaEncryption), +/* harmony export */ sha1: () => (/* binding */ sha1), +/* harmony export */ sha1WithRSAEncryption: () => (/* binding */ sha1WithRSAEncryption), +/* harmony export */ sha224: () => (/* binding */ sha224), +/* harmony export */ sha224WithRSAEncryption: () => (/* binding */ sha224WithRSAEncryption), +/* harmony export */ sha256: () => (/* binding */ sha256), +/* harmony export */ sha256WithRSAEncryption: () => (/* binding */ sha256WithRSAEncryption), +/* harmony export */ sha384: () => (/* binding */ sha384), +/* harmony export */ sha384WithRSAEncryption: () => (/* binding */ sha384WithRSAEncryption), +/* harmony export */ sha512: () => (/* binding */ sha512), +/* harmony export */ sha512WithRSAEncryption: () => (/* binding */ sha512WithRSAEncryption), +/* harmony export */ sha512_224: () => (/* binding */ sha512_224), +/* harmony export */ sha512_224WithRSAEncryption: () => (/* binding */ sha512_224WithRSAEncryption), +/* harmony export */ sha512_256: () => (/* binding */ sha512_256), +/* harmony export */ sha512_256WithRSAEncryption: () => (/* binding */ sha512_256WithRSAEncryption) +/* harmony export */ }); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./object_identifiers.js */ 47618); + + + +function create(algorithm) { + return new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier({ + algorithm, parameters: null, + }); +} +const md2 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md2); +const md4 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md5); +const sha1 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha1); +const sha224 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha224); +const sha256 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha256); +const sha384 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha384); +const sha512 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512); +const sha512_224 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_224); +const sha512_256 = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_256); +const mgf1SHA1 = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier({ + algorithm: _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_mgf1, + parameters: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.AsnConvert.serialize(sha1), +}); +const pSpecifiedEmpty = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier({ + algorithm: _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_pSpecified, + parameters: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.AsnConvert.serialize(_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.AsnOctetStringConverter.toASN(new Uint8Array([ + 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, + 0x90, 0xaf, 0xd8, 0x07, 0x09, + ]).buffer)), +}); +const rsaEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_rsaEncryption); +const md2WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md2WithRSAEncryption); +const md5WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_md5WithRSAEncryption); +const sha1WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha1WithRSAEncryption); +const sha224WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_224WithRSAEncryption); +const sha256WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_256WithRSAEncryption); +const sha384WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha384WithRSAEncryption); +const sha512WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512WithRSAEncryption); +const sha512_224WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_224WithRSAEncryption); +const sha512_256WithRSAEncryption = create(_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_sha512_256WithRSAEncryption); + + +/***/ }), + +/***/ 17925: +/*!******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/aa_controls.js ***! + \******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AAControls: () => (/* binding */ AAControls) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _attr_spec_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./attr_spec.js */ 17767); + + + +class AAControls { + pathLenConstraint; + permittedAttrs; + excludedAttrs; + permitUnSpecified = true; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, optional: true, + }) +], AAControls.prototype, "pathLenConstraint", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _attr_spec_js__WEBPACK_IMPORTED_MODULE_2__.AttrSpec, implicit: true, context: 0, optional: true, + }) +], AAControls.prototype, "permittedAttrs", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _attr_spec_js__WEBPACK_IMPORTED_MODULE_2__.AttrSpec, implicit: true, context: 1, optional: true, + }) +], AAControls.prototype, "excludedAttrs", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Boolean, defaultValue: true, + }) +], AAControls.prototype, "permitUnSpecified", void 0); + + +/***/ }), + +/***/ 18086: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/version.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./validate.js */ 83494); + + +function version(uuid) { + if (!(0,_validate_js__WEBPACK_IMPORTED_MODULE_0__["default"])(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.substr(14, 1), 16); +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (version); + +/***/ }), + +/***/ 18148: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/512.js ***! + \************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); +var common = __webpack_require__(/*! ../common */ 92660); +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); + +var rotr64_hi = utils.rotr64_hi; +var rotr64_lo = utils.rotr64_lo; +var shr64_hi = utils.shr64_hi; +var shr64_lo = utils.shr64_lo; +var sum64 = utils.sum64; +var sum64_hi = utils.sum64_hi; +var sum64_lo = utils.sum64_lo; +var sum64_4_hi = utils.sum64_4_hi; +var sum64_4_lo = utils.sum64_4_lo; +var sum64_5_hi = utils.sum64_5_hi; +var sum64_5_lo = utils.sum64_5_lo; + +var BlockHash = common.BlockHash; + +var sha512_K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; + +function SHA512() { + if (!(this instanceof SHA512)) + return new SHA512(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xf3bcc908, + 0xbb67ae85, 0x84caa73b, + 0x3c6ef372, 0xfe94f82b, + 0xa54ff53a, 0x5f1d36f1, + 0x510e527f, 0xade682d1, + 0x9b05688c, 0x2b3e6c1f, + 0x1f83d9ab, 0xfb41bd6b, + 0x5be0cd19, 0x137e2179 ]; + this.k = sha512_K; + this.W = new Array(160); +} +utils.inherits(SHA512, BlockHash); +module.exports = SHA512; + +SHA512.blockSize = 1024; +SHA512.outSize = 512; +SHA512.hmacStrength = 192; +SHA512.padLength = 128; + +SHA512.prototype._prepareBlock = function _prepareBlock(msg, start) { + var W = this.W; + + // 32 x 32bit words + for (var i = 0; i < 32; i++) + W[i] = msg[start + i]; + for (; i < W.length; i += 2) { + var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2 + var c0_lo = g1_512_lo(W[i - 4], W[i - 3]); + var c1_hi = W[i - 14]; // i - 7 + var c1_lo = W[i - 13]; + var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15 + var c2_lo = g0_512_lo(W[i - 30], W[i - 29]); + var c3_hi = W[i - 32]; // i - 16 + var c3_lo = W[i - 31]; + + W[i] = sum64_4_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + W[i + 1] = sum64_4_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo); + } +}; + +SHA512.prototype._update = function _update(msg, start) { + this._prepareBlock(msg, start); + + var W = this.W; + + var ah = this.h[0]; + var al = this.h[1]; + var bh = this.h[2]; + var bl = this.h[3]; + var ch = this.h[4]; + var cl = this.h[5]; + var dh = this.h[6]; + var dl = this.h[7]; + var eh = this.h[8]; + var el = this.h[9]; + var fh = this.h[10]; + var fl = this.h[11]; + var gh = this.h[12]; + var gl = this.h[13]; + var hh = this.h[14]; + var hl = this.h[15]; + + assert(this.k.length === W.length); + for (var i = 0; i < W.length; i += 2) { + var c0_hi = hh; + var c0_lo = hl; + var c1_hi = s1_512_hi(eh, el); + var c1_lo = s1_512_lo(eh, el); + var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl); + var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl); + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W[i]; + var c4_lo = W[i + 1]; + + var T1_hi = sum64_5_hi( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + var T1_lo = sum64_5_lo( + c0_hi, c0_lo, + c1_hi, c1_lo, + c2_hi, c2_lo, + c3_hi, c3_lo, + c4_hi, c4_lo); + + c0_hi = s0_512_hi(ah, al); + c0_lo = s0_512_lo(ah, al); + c1_hi = maj64_hi(ah, al, bh, bl, ch, cl); + c1_lo = maj64_lo(ah, al, bh, bl, ch, cl); + + var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo); + var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo); + + hh = gh; + hl = gl; + + gh = fh; + gl = fl; + + fh = eh; + fl = el; + + eh = sum64_hi(dh, dl, T1_hi, T1_lo); + el = sum64_lo(dl, dl, T1_hi, T1_lo); + + dh = ch; + dl = cl; + + ch = bh; + cl = bl; + + bh = ah; + bl = al; + + ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo); + al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo); + } + + sum64(this.h, 0, ah, al); + sum64(this.h, 2, bh, bl); + sum64(this.h, 4, ch, cl); + sum64(this.h, 6, dh, dl); + sum64(this.h, 8, eh, el); + sum64(this.h, 10, fh, fl); + sum64(this.h, 12, gh, gl); + sum64(this.h, 14, hh, hl); +}; + +SHA512.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + +function ch64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ ((~xh) & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function ch64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ ((~xl) & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_hi(xh, xl, yh, yl, zh) { + var r = (xh & yh) ^ (xh & zh) ^ (yh & zh); + if (r < 0) + r += 0x100000000; + return r; +} + +function maj64_lo(xh, xl, yh, yl, zh, zl) { + var r = (xl & yl) ^ (xl & zl) ^ (yl & zl); + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 28); + var c1_hi = rotr64_hi(xl, xh, 2); // 34 + var c2_hi = rotr64_hi(xl, xh, 7); // 39 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 28); + var c1_lo = rotr64_lo(xl, xh, 2); // 34 + var c2_lo = rotr64_lo(xl, xh, 7); // 39 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 14); + var c1_hi = rotr64_hi(xh, xl, 18); + var c2_hi = rotr64_hi(xl, xh, 9); // 41 + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function s1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 14); + var c1_lo = rotr64_lo(xh, xl, 18); + var c2_lo = rotr64_lo(xl, xh, 9); // 41 + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 1); + var c1_hi = rotr64_hi(xh, xl, 8); + var c2_hi = shr64_hi(xh, xl, 7); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g0_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 1); + var c1_lo = rotr64_lo(xh, xl, 8); + var c2_lo = shr64_lo(xh, xl, 7); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_hi(xh, xl) { + var c0_hi = rotr64_hi(xh, xl, 19); + var c1_hi = rotr64_hi(xl, xh, 29); // 61 + var c2_hi = shr64_hi(xh, xl, 6); + + var r = c0_hi ^ c1_hi ^ c2_hi; + if (r < 0) + r += 0x100000000; + return r; +} + +function g1_512_lo(xh, xl) { + var c0_lo = rotr64_lo(xh, xl, 19); + var c1_lo = rotr64_lo(xl, xh, 29); // 61 + var c2_lo = shr64_lo(xh, xl, 6); + + var r = c0_lo ^ c1_lo ^ c2_lo; + if (r < 0) + r += 0x100000000; + return r; +} + + +/***/ }), + +/***/ 18421: +/*!********************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/encoders/index.js ***! + \********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var encoders = exports; + +encoders.der = __webpack_require__(/*! ./der */ 21354); +encoders.pem = __webpack_require__(/*! ./pem */ 45927); + + +/***/ }), + +/***/ 18628: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js ***! + \**************************************************************************************/ +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 18664: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/precomputed/secp256k1.js ***! + \********************************************************************************************************/ +/***/ ((module) => { + +module.exports = { + doubles: { + step: 4, + points: [ + [ + 'e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a', + 'f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821', + ], + [ + '8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508', + '11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf', + ], + [ + '175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739', + 'd3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695', + ], + [ + '363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640', + '4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9', + ], + [ + '8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c', + '4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36', + ], + [ + '723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda', + '96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f', + ], + [ + 'eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa', + '5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999', + ], + [ + '100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0', + 'cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09', + ], + [ + 'e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d', + '9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d', + ], + [ + 'feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d', + 'e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088', + ], + [ + 'da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1', + '9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d', + ], + [ + '53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0', + '5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8', + ], + [ + '8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047', + '10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a', + ], + [ + '385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862', + '283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453', + ], + [ + '6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7', + '7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160', + ], + [ + '3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd', + '56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0', + ], + [ + '85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83', + '7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6', + ], + [ + '948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a', + '53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589', + ], + [ + '6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8', + 'bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17', + ], + [ + 'e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d', + '4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda', + ], + [ + 'e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725', + '7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd', + ], + [ + '213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754', + '4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2', + ], + [ + '4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c', + '17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6', + ], + [ + 'fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6', + '6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f', + ], + [ + '76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39', + 'c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01', + ], + [ + 'c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891', + '893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3', + ], + [ + 'd895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b', + 'febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f', + ], + [ + 'b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03', + '2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7', + ], + [ + 'e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d', + 'eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78', + ], + [ + 'a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070', + '7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1', + ], + [ + '90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4', + 'e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150', + ], + [ + '8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da', + '662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82', + ], + [ + 'e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11', + '1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc', + ], + [ + '8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e', + 'efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b', + ], + [ + 'e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41', + '2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51', + ], + [ + 'b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef', + '67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45', + ], + [ + 'd68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8', + 'db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120', + ], + [ + '324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d', + '648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84', + ], + [ + '4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96', + '35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d', + ], + [ + '9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd', + 'ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d', + ], + [ + '6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5', + '9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8', + ], + [ + 'a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266', + '40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8', + ], + [ + '7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71', + '34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac', + ], + [ + '928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac', + 'c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f', + ], + [ + '85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751', + '1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962', + ], + [ + 'ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e', + '493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907', + ], + [ + '827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241', + 'c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec', + ], + [ + 'eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3', + 'be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d', + ], + [ + 'e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f', + '4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414', + ], + [ + '1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19', + 'aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd', + ], + [ + '146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be', + 'b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0', + ], + [ + 'fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9', + '6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811', + ], + [ + 'da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2', + '8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1', + ], + [ + 'a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13', + '7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c', + ], + [ + '174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c', + 'ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73', + ], + [ + '959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba', + '2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd', + ], + [ + 'd2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151', + 'e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405', + ], + [ + '64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073', + 'd99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589', + ], + [ + '8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458', + '38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e', + ], + [ + '13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b', + '69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27', + ], + [ + 'bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366', + 'd3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1', + ], + [ + '8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa', + '40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482', + ], + [ + '8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0', + '620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945', + ], + [ + 'dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787', + '7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573', + ], + [ + 'f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e', + 'ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82', + ], + ], + }, + naf: { + wnd: 7, + points: [ + [ + 'f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9', + '388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672', + ], + [ + '2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4', + 'd8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6', + ], + [ + '5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc', + '6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da', + ], + [ + 'acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe', + 'cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37', + ], + [ + '774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb', + 'd984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b', + ], + [ + 'f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8', + 'ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81', + ], + [ + 'd7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e', + '581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58', + ], + [ + 'defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34', + '4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77', + ], + [ + '2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c', + '85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a', + ], + [ + '352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5', + '321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c', + ], + [ + '2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f', + '2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67', + ], + [ + '9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714', + '73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402', + ], + [ + 'daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729', + 'a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55', + ], + [ + 'c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db', + '2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482', + ], + [ + '6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4', + 'e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82', + ], + [ + '1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5', + 'b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396', + ], + [ + '605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479', + '2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49', + ], + [ + '62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d', + '80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf', + ], + [ + '80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f', + '1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a', + ], + [ + '7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb', + 'd0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7', + ], + [ + 'd528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9', + 'eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933', + ], + [ + '49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963', + '758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a', + ], + [ + '77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74', + '958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6', + ], + [ + 'f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530', + 'e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37', + ], + [ + '463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b', + '5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e', + ], + [ + 'f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247', + 'cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6', + ], + [ + 'caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1', + 'cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476', + ], + [ + '2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120', + '4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40', + ], + [ + '7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435', + '91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61', + ], + [ + '754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18', + '673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683', + ], + [ + 'e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8', + '59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5', + ], + [ + '186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb', + '3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b', + ], + [ + 'df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f', + '55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417', + ], + [ + '5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143', + 'efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868', + ], + [ + '290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba', + 'e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a', + ], + [ + 'af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45', + 'f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6', + ], + [ + '766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a', + '744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996', + ], + [ + '59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e', + 'c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e', + ], + [ + 'f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8', + 'e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d', + ], + [ + '7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c', + '30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2', + ], + [ + '948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519', + 'e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e', + ], + [ + '7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab', + '100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437', + ], + [ + '3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca', + 'ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311', + ], + [ + 'd3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf', + '8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4', + ], + [ + '1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610', + '68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575', + ], + [ + '733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4', + 'f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d', + ], + [ + '15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c', + 'd56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d', + ], + [ + 'a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940', + 'edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629', + ], + [ + 'e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980', + 'a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06', + ], + [ + '311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3', + '66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374', + ], + [ + '34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf', + '9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee', + ], + [ + 'f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63', + '4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1', + ], + [ + 'd7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448', + 'fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b', + ], + [ + '32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf', + '5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661', + ], + [ + '7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5', + '8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6', + ], + [ + 'ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6', + '8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e', + ], + [ + '16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5', + '5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d', + ], + [ + 'eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99', + 'f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc', + ], + [ + '78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51', + 'f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4', + ], + [ + '494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5', + '42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c', + ], + [ + 'a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5', + '204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b', + ], + [ + 'c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997', + '4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913', + ], + [ + '841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881', + '73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154', + ], + [ + '5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5', + '39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865', + ], + [ + '36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66', + 'd2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc', + ], + [ + '336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726', + 'ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224', + ], + [ + '8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede', + '6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e', + ], + [ + '1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94', + '60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6', + ], + [ + '85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31', + '3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511', + ], + [ + '29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51', + 'b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b', + ], + [ + 'a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252', + 'ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2', + ], + [ + '4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5', + 'cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c', + ], + [ + 'd24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b', + '6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3', + ], + [ + 'ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4', + '322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d', + ], + [ + 'af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f', + '6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700', + ], + [ + 'e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889', + '2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4', + ], + [ + '591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246', + 'b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196', + ], + [ + '11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984', + '998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4', + ], + [ + '3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a', + 'b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257', + ], + [ + 'cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030', + 'bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13', + ], + [ + 'c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197', + '6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096', + ], + [ + 'c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593', + 'c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38', + ], + [ + 'a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef', + '21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f', + ], + [ + '347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38', + '60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448', + ], + [ + 'da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a', + '49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a', + ], + [ + 'c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111', + '5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4', + ], + [ + '4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502', + '7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437', + ], + [ + '3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea', + 'be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7', + ], + [ + 'cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26', + '8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d', + ], + [ + 'b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986', + '39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a', + ], + [ + 'd4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e', + '62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54', + ], + [ + '48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4', + '25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77', + ], + [ + 'dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda', + 'ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517', + ], + [ + '6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859', + 'cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10', + ], + [ + 'e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f', + 'f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125', + ], + [ + 'eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c', + '6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e', + ], + [ + '13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942', + 'fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1', + ], + [ + 'ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a', + '1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2', + ], + [ + 'b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80', + '5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423', + ], + [ + 'ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d', + '438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8', + ], + [ + '8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1', + 'cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758', + ], + [ + '52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63', + 'c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375', + ], + [ + 'e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352', + '6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d', + ], + [ + '7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193', + 'ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec', + ], + [ + '5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00', + '9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0', + ], + [ + '32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58', + 'ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c', + ], + [ + 'e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7', + 'd3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4', + ], + [ + '8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8', + 'c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f', + ], + [ + '4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e', + '67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649', + ], + [ + '3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d', + 'cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826', + ], + [ + '674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b', + '299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5', + ], + [ + 'd32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f', + 'f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87', + ], + [ + '30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6', + '462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b', + ], + [ + 'be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297', + '62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc', + ], + [ + '93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a', + '7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c', + ], + [ + 'b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c', + 'ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f', + ], + [ + 'd5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52', + '4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a', + ], + [ + 'd3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb', + 'bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46', + ], + [ + '463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065', + 'bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f', + ], + [ + '7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917', + '603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03', + ], + [ + '74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9', + 'cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08', + ], + [ + '30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3', + '553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8', + ], + [ + '9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57', + '712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373', + ], + [ + '176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66', + 'ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3', + ], + [ + '75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8', + '9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8', + ], + [ + '809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721', + '9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1', + ], + [ + '1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180', + '4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9', + ], + ], + }, +}; + + +/***/ }), + +/***/ 19057: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/ecb.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +exports.encrypt = function (self, block) { + return self._cipher.encryptBlock(block) +} + +exports.decrypt = function (self, block) { + return self._cipher.decryptBlock(block) +} + + +/***/ }), + +/***/ 19132: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/hash-to-curve.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createHasher: () => (/* binding */ createHasher), +/* harmony export */ expand_message_xmd: () => (/* binding */ expand_message_xmd), +/* harmony export */ expand_message_xof: () => (/* binding */ expand_message_xof), +/* harmony export */ hash_to_field: () => (/* binding */ hash_to_field), +/* harmony export */ isogenyMap: () => (/* binding */ isogenyMap) +/* harmony export */ }); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ 85070); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 35797); + + +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE; +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value, length) { + anum(value); + anum(length); + if (value < 0 || value >= 1 << (8 * length)) + throw new Error('invalid I2OSP input: ' + value); + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} +function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function anum(item) { + if (!Number.isSafeInteger(item)) + throw new Error('number expected'); +} +/** + * Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits. + * [RFC 9380 5.3.1](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1). + */ +function expand_message_xmd(msg, DST, lenInBytes, H) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(DST); + anum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + if (DST.length > 255) + DST = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (lenInBytes > 65535 || ell > 255) + throw new Error('expand_message_xmd: invalid lenInBytes'); + const DST_prime = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...args)); + } + const pseudo_random_bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} +/** + * Produces a uniformly random byte string using an extendable-output function (XOF) H. + * 1. The collision resistance of H MUST be at least k bits. + * 2. H MUST be an XOF that has been proved indifferentiable from + * a random oracle under a reasonable cryptographic assumption. + * [RFC 9380 5.3.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2). + */ +function expand_message_xof(msg, DST, lenInBytes, k, H) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(DST); + anum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return (H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest()); +} +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. + * [RFC 9380 5.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.2). + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +function hash_to_field(msg, count, options) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + anum(count); + const DST = typeof _DST === 'string' ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(_DST) : _DST; + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } + else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } + else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } + else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(os2ip(tv), p); + } + u[i] = e; + } + return u; +} +function isogenyMap(field, map) { + // Make same order as in spec + const coeff = map.map((i) => Array.from(i).reverse()); + return (x, y) => { + const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); + // 6.6.3 + // Exceptional cases of iso_map are inputs that cause the denominator of + // either rational function to evaluate to zero; such cases MUST return + // the identity point on E. + const [xd_inv, yd_inv] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.FpInvertBatch)(field, [xd, yd], true); + x = field.mul(xn, xd_inv); // xNum / xDen + y = field.mul(y, field.mul(yn, yd_inv)); // y * (yNum / yDev) + return { x, y }; + }; +} +/** Creates hash-to-curve methods from EC Point and mapToCurve function. */ +function createHasher(Point, mapToCurve, defaults) { + if (typeof mapToCurve !== 'function') + throw new Error('mapToCurve() must be defined'); + function map(num) { + return Point.fromAffine(mapToCurve(num)); + } + function clear(initial) { + const P = initial.clearCofactor(); + if (P.equals(Point.ZERO)) + return Point.ZERO; // zero will throw in assert + P.assertValidity(); + return P; + } + return { + defaults, + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...defaults, DST: defaults.DST, ...options }); + const u0 = map(u[0]); + const u1 = map(u[1]); + return clear(u0.add(u1)); + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...defaults, DST: defaults.encodeDST, ...options }); + return clear(map(u[0])); + }, + // Same as encodeToCurve, but without hash + mapToCurve(scalars) { + if (!Array.isArray(scalars)) + throw new Error('expected array of bigints'); + for (const i of scalars) + if (typeof i !== 'bigint') + throw new Error('expected array of bigints'); + return clear(map(scalars)); + }, + }; +} +//# sourceMappingURL=hash-to-curve.js.map + +/***/ }), + +/***/ 19135: +/*!***************************************************************************!*\ + !*** ../node_modules/.pnpm/for-each@0.3.5/node_modules/for-each/index.js ***! + \***************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var isCallable = __webpack_require__(/*! is-callable */ 96219); + +var toStr = Object.prototype.toString; +var hasOwnProperty = Object.prototype.hasOwnProperty; + +/** @type {(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */ +var forEachArray = function forEachArray(array, iterator, receiver) { + for (var i = 0, len = array.length; i < len; i++) { + if (hasOwnProperty.call(array, i)) { + if (receiver == null) { + iterator(array[i], i, array); + } else { + iterator.call(receiver, array[i], i, array); + } + } + } +}; + +/** @type {(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */ +var forEachString = function forEachString(string, iterator, receiver) { + for (var i = 0, len = string.length; i < len; i++) { + // no such thing as a sparse string. + if (receiver == null) { + iterator(string.charAt(i), i, string); + } else { + iterator.call(receiver, string.charAt(i), i, string); + } + } +}; + +/** @type {(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */ +var forEachObject = function forEachObject(object, iterator, receiver) { + for (var k in object) { + if (hasOwnProperty.call(object, k)) { + if (receiver == null) { + iterator(object[k], k, object); + } else { + iterator.call(receiver, object[k], k, object); + } + } + } +}; + +/** @type {(x: unknown) => x is readonly unknown[]} */ +function isArray(x) { + return toStr.call(x) === '[object Array]'; +} + +/** @type {import('.')._internal} */ +module.exports = function forEach(list, iterator, thisArg) { + if (!isCallable(iterator)) { + throw new TypeError('iterator must be a function'); + } + + var receiver; + if (arguments.length >= 3) { + receiver = thisArg; + } + + if (isArray(list)) { + forEachArray(list, iterator, receiver); + } else if (typeof list === 'string') { + forEachString(list, iterator, receiver); + } else { + forEachObject(list, iterator, receiver); + } +}; + + +/***/ }), + +/***/ 19284: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-des@1.0.2/node_modules/browserify-des/index.js ***! + \***************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var CipherBase = __webpack_require__(/*! cipher-base */ 51141) +var des = __webpack_require__(/*! des.js */ 86773) +var inherits = __webpack_require__(/*! inherits */ 18628) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) + +var modes = { + 'des-ede3-cbc': des.CBC.instantiate(des.EDE), + 'des-ede3': des.EDE, + 'des-ede-cbc': des.CBC.instantiate(des.EDE), + 'des-ede': des.EDE, + 'des-cbc': des.CBC.instantiate(des.DES), + 'des-ecb': des.DES +} +modes.des = modes['des-cbc'] +modes.des3 = modes['des-ede3-cbc'] +module.exports = DES +inherits(DES, CipherBase) +function DES (opts) { + CipherBase.call(this) + var modeName = opts.mode.toLowerCase() + var mode = modes[modeName] + var type + if (opts.decrypt) { + type = 'decrypt' + } else { + type = 'encrypt' + } + var key = opts.key + if (!Buffer.isBuffer(key)) { + key = Buffer.from(key) + } + if (modeName === 'des-ede' || modeName === 'des-ede-cbc') { + key = Buffer.concat([key, key.slice(0, 8)]) + } + var iv = opts.iv + if (!Buffer.isBuffer(iv)) { + iv = Buffer.from(iv) + } + this._des = mode.create({ + key: key, + iv: iv, + type: type + }) +} +DES.prototype._update = function (data) { + return Buffer.from(this._des.update(data)) +} +DES.prototype._final = function () { + return Buffer.from(this._des.final()) +} + + +/***/ }), + +/***/ 19437: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/algorithm.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NativeAlgorithm: () => (/* binding */ NativeAlgorithm) +/* harmony export */ }); +/* harmony import */ var _dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../_dnt.shims.js */ 57004); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./errors.js */ 48385); + + +async function loadSubtleCrypto() { + if (_dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis !== undefined && globalThis.crypto !== undefined) { + // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc. + return globalThis.crypto.subtle; + } + // Node.js <= v18 + try { + // @ts-ignore: to ignore "crypto" + const { webcrypto } = await Promise.all(/*! import() */[__webpack_require__.e(96), __webpack_require__.e(431)]).then(__webpack_require__.t.bind(__webpack_require__, /*! crypto */ 42378, 19)); // node:crypto + return webcrypto.subtle; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupportedError(e); + } +} +class NativeAlgorithm { + constructor() { + Object.defineProperty(this, "_api", { + enumerable: true, + configurable: true, + writable: true, + value: undefined + }); + } + async _setup() { + if (this._api !== undefined) { + return; + } + this._api = await loadSubtleCrypto(); + } +} + + +/***/ }), + +/***/ 19603: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/hex.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ format: () => (/* binding */ format), +/* harmony export */ formats: () => (/* binding */ formats), +/* harmony export */ hex: () => (/* binding */ hex), +/* harmony export */ is: () => (/* binding */ is), +/* harmony export */ normalize: () => (/* binding */ normalize), +/* harmony export */ parse: () => (/* binding */ parse) +/* harmony export */ }); +/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ 15246); + +const HEX_CHARACTER_REGEX = /^[0-9a-f]$/i; +const COMMON_SEPARATORS = [" ", "\t", "\n", "\r", ":", "-", "."]; +function resolveSeparators(options) { + if (options.separators === "none") { + return []; + } + if (!options.separators || options.separators === "common") { + return COMMON_SEPARATORS; + } + return options.separators; +} +function validateSeparator(separator) { + if (!separator) { + throw new TypeError("Hex separators must be non-empty strings"); + } +} +function matchSeparator(text, index, separators) { + for (const separator of separators) { + if (text.startsWith(separator, index)) { + return separator; + } + } + return undefined; +} +function detectCase(text) { + const hasUpper = /[A-F]/.test(text); + const hasLower = /[a-f]/.test(text); + return hasUpper && !hasLower ? "upper" : "lower"; +} +function detectLineSeparator(text) { + const match = /\r\n|\n/.exec(text); + if (!match) { + return undefined; + } + return match[0] === "\r\n" ? "\r\n" : "\n"; +} +function compactForDetection(text) { + return text.replace(/[^0-9a-f]/gi, ""); +} +function detectGroup(text) { + const segments = text.match(/[0-9A-Fa-f]+|[^0-9A-Fa-f]+/g) ?? []; + if (segments.length < 3) { + return undefined; + } + const hexSegments = segments.filter((_, index) => index % 2 === 0); + const separators = segments.filter((_, index) => index % 2 === 1); + const separator = separators[0]; + if (!separator || separators.some((item) => item !== separator)) { + return undefined; + } + if (hexSegments.some((segment) => segment.length === 0 || segment.length % 2 !== 0)) { + return undefined; + } + const firstLength = hexSegments[0]?.length ?? 0; + if (!firstLength) { + return undefined; + } + if (hexSegments.slice(0, -1).some((segment) => segment.length !== firstLength)) { + return undefined; + } + if ((hexSegments[hexSegments.length - 1]?.length ?? 0) > firstLength) { + return undefined; + } + return { + size: firstLength / 2, + separator, + }; +} +function detectFormat(text) { + const trimmed = text.trim(); + const prefix = /^0x/i.test(trimmed) ? "0x" : ""; + const body = prefix ? trimmed.slice(2) : trimmed; + const lineSeparator = detectLineSeparator(body); + const lines = body.split(/\r\n|\n/).filter((line) => line.length > 0); + const sampleLine = lines[0]?.trim() ?? ""; + const group = detectGroup(sampleLine); + const format = { + case: detectCase(trimmed), + prefix, + }; + if (group) { + format.group = group; + } + if (lineSeparator && lines.length > 1) { + const firstLineBytes = compactForDetection(lines[0] ?? "").length / 2; + if (firstLineBytes > 0 && lines.slice(0, -1).every((line) => compactForDetection(line).length / 2 === firstLineBytes)) { + format.line = { + bytesPerLine: firstLineBytes, + separator: lineSeparator, + }; + } + } + return format; +} +function normalizeText(text, options) { + const allowPrefix = options.allowPrefix ?? true; + const separators = [...resolveSeparators(options)].sort((left, right) => right.length - left.length); + for (const separator of separators) { + validateSeparator(separator); + } + let working = text.trim(); + if (/^0x/i.test(working)) { + if (!allowPrefix) { + throw new TypeError("Hexadecimal text must not include a 0x prefix"); + } + working = working.slice(2); + } + let normalized = ""; + let lastTokenWasSeparator = false; + for (let index = 0; index < working.length;) { + const character = working[index] ?? ""; + if (HEX_CHARACTER_REGEX.test(character)) { + normalized += character; + lastTokenWasSeparator = false; + index += 1; + continue; + } + const separator = matchSeparator(working, index, separators); + if (!separator) { + throw new TypeError("Input is not valid hexadecimal text"); + } + if (options.strict && (lastTokenWasSeparator || normalized.length === 0)) { + throw new TypeError("Hexadecimal text contains misplaced separators"); + } + lastTokenWasSeparator = true; + index += separator.length; + } + if (options.strict && lastTokenWasSeparator && normalized.length > 0) { + throw new TypeError("Hexadecimal text must not end with a separator"); + } + if (normalized.length % 2 !== 0) { + if (!options.allowOddLength) { + throw new TypeError("Hexadecimal text must contain an even number of characters"); + } + normalized = `0${normalized}`; + } + return normalized.toLowerCase(); +} +function groupPairs(pairs, group) { + if (!group) { + return pairs.join(""); + } + if (!Number.isInteger(group.size) || group.size < 1) { + throw new RangeError("Hex group size must be a positive integer"); + } + const chunks = []; + for (let index = 0; index < pairs.length; index += group.size) { + chunks.push(pairs.slice(index, index + group.size).join("")); + } + return chunks.join(group.separator); +} +function normalize(text, options = {}) { + return normalizeText(text, options); +} +function is(text, options = {}) { + if (typeof text !== "string") { + return false; + } + try { + normalize(text, options); + return true; + } + catch { + return false; + } +} +function encode(data, options = {}) { + const bytes = (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const casing = options.case ?? "lower"; + const pairs = Array.from(bytes, (byte) => { + const text = byte.toString(16).padStart(2, "0"); + return casing === "upper" ? text.toUpperCase() : text; + }); + let body = ""; + if (options.line) { + const bytesPerLine = options.line.bytesPerLine; + if (!Number.isInteger(bytesPerLine) || bytesPerLine < 1) { + throw new RangeError("Hex bytesPerLine must be a positive integer"); + } + const separator = options.line.separator ?? "\n"; + const lines = []; + for (let index = 0; index < pairs.length; index += bytesPerLine) { + lines.push(groupPairs(pairs.slice(index, index + bytesPerLine), options.group)); + } + body = lines.join(separator); + } + else { + body = groupPairs(pairs, options.group); + } + return `${options.prefix ?? ""}${body}`; +} +function decode(text, options = {}) { + const normalized = normalize(text, options); + const result = new Uint8Array(normalized.length / 2); + for (let i = 0; i < normalized.length; i += 2) { + result[i / 2] = Number.parseInt(normalized.slice(i, i + 2), 16); + } + return result; +} +function parse(text, options = {}) { + const normalized = normalize(text, options); + return { + bytes: decode(normalized), + format: detectFormat(text), + normalized, + }; +} +function format(data, value) { + return encode(data, value); +} +const formats = { + compact: Object.freeze({}), + upper: Object.freeze({ case: "upper" }), + colon: Object.freeze({ group: { size: 1, separator: ":" } }), + colonUpper: Object.freeze({ case: "upper", group: { size: 1, separator: ":" } }), + groupsOf4: Object.freeze({ group: { size: 4, separator: " " } }), + prefixed: Object.freeze({ prefix: "0x" }), +}; +const hex = { encode, decode, format, formats, is, normalize, parse }; + + +/***/ }), + +/***/ 19745: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SHA224: () => (/* binding */ SHA224), +/* harmony export */ SHA256: () => (/* binding */ SHA256), +/* harmony export */ SHA384: () => (/* binding */ SHA384), +/* harmony export */ SHA512: () => (/* binding */ SHA512), +/* harmony export */ SHA512_224: () => (/* binding */ SHA512_224), +/* harmony export */ SHA512_256: () => (/* binding */ SHA512_256), +/* harmony export */ sha224: () => (/* binding */ sha224), +/* harmony export */ sha256: () => (/* binding */ sha256), +/* harmony export */ sha384: () => (/* binding */ sha384), +/* harmony export */ sha512: () => (/* binding */ sha512), +/* harmony export */ sha512_224: () => (/* binding */ sha512_224), +/* harmony export */ sha512_256: () => (/* binding */ sha512_256) +/* harmony export */ }); +/* harmony import */ var _md_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_md.js */ 88633); +/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_u64.js */ 46387); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ 29964); +/** + * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256. + * SHA256 is the fastest hash implementable in JS, even faster than Blake3. + * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and + * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf). + * @module + */ + + + +/** + * Round constants: + * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311) + */ +// prettier-ignore +const SHA256_K = /* @__PURE__ */ Uint32Array.from([ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]); +/** Reusable temporary buffer. "W" comes straight from spec. */ +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +class SHA256 extends _md_js__WEBPACK_IMPORTED_MODULE_0__.HashMD { + constructor(outputLen = 32) { + super(64, outputLen, 8, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + this.A = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[0] | 0; + this.B = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[1] | 0; + this.C = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[2] | 0; + this.D = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[3] | 0; + this.E = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[4] | 0; + this.F = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[5] | 0; + this.G = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[6] | 0; + this.H = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[7] | 0; + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + // prettier-ignore + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) + SHA256_W[i] = view.getUint32(offset, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W15, 7) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W15, 18) ^ (W15 >>> 3); + const s1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W2, 17) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 6) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 11) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 25); + const T1 = (H + sigma1 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 2) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 13) ^ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 22); + const T2 = (sigma0 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Maj)(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.clean)(SHA256_W); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.clean)(this.buffer); + } +} +class SHA224 extends SHA256 { + constructor() { + super(28); + this.A = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[0] | 0; + this.B = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[1] | 0; + this.C = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[2] | 0; + this.D = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[3] | 0; + this.E = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[4] | 0; + this.F = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[5] | 0; + this.G = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[6] | 0; + this.H = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA224_IV[7] | 0; + } +} +// SHA2-512 is slower than sha256 in js because u64 operations are slow. +// Round contants +// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409 +// prettier-ignore +const K512 = /* @__PURE__ */ (() => _u64_js__WEBPACK_IMPORTED_MODULE_1__.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(n => BigInt(n))))(); +const SHA512_Kh = /* @__PURE__ */ (() => K512[0])(); +const SHA512_Kl = /* @__PURE__ */ (() => K512[1])(); +// Reusable temporary buffers +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +class SHA512 extends _md_js__WEBPACK_IMPORTED_MODULE_0__.HashMD { + constructor(outputLen = 64) { + super(128, outputLen, 16, false); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + // h -- high 32 bits, l -- low 32 bits + this.Ah = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[0] | 0; + this.Al = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[1] | 0; + this.Bh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[2] | 0; + this.Bl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[3] | 0; + this.Ch = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[4] | 0; + this.Cl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[5] | 0; + this.Dh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[6] | 0; + this.Dl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[7] | 0; + this.Eh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[8] | 0; + this.El = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[9] | 0; + this.Fh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[10] | 0; + this.Fl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[11] | 0; + this.Gh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[12] | 0; + this.Gl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[13] | 0; + this.Hh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[14] | 0; + this.Hl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[15] | 0; + } + // prettier-ignore + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + // prettier-ignore + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32((offset += 4)); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSH(W15h, W15l, 7); + const s0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W15h, W15l, 8) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSH(W2h, W2l, 6); + const s1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(W2h, W2l, 61) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Eh, El, 41); + const sigma1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Eh, El, 18) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + // prettier-ignore + const T1ll = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Ah, Al, 39); + const sigma0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Ah, Al, 34) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add3L(T1l, sigma0l, MAJl); + Ah = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.clean)(SHA512_W_H, SHA512_W_L); + } + destroy() { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.clean)(this.buffer); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +class SHA384 extends SHA512 { + constructor() { + super(48); + this.Ah = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[0] | 0; + this.Al = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[1] | 0; + this.Bh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[2] | 0; + this.Bl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[3] | 0; + this.Ch = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[4] | 0; + this.Cl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[5] | 0; + this.Dh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[6] | 0; + this.Dl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[7] | 0; + this.Eh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[8] | 0; + this.El = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[9] | 0; + this.Fh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[10] | 0; + this.Fl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[11] | 0; + this.Gh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[12] | 0; + this.Gl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[13] | 0; + this.Hh = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[14] | 0; + this.Hl = _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[15] | 0; + } +} +/** + * Truncated SHA512/256 and SHA512/224. + * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as "intermediary" IV of SHA512/t. + * Then t hashes string to produce result IV. + * See `test/misc/sha2-gen-iv.js`. + */ +/** SHA512/224 IV */ +const T224_IV = /* @__PURE__ */ Uint32Array.from([ + 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf, + 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1, +]); +/** SHA512/256 IV */ +const T256_IV = /* @__PURE__ */ Uint32Array.from([ + 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd, + 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2, +]); +class SHA512_224 extends SHA512 { + constructor() { + super(28); + this.Ah = T224_IV[0] | 0; + this.Al = T224_IV[1] | 0; + this.Bh = T224_IV[2] | 0; + this.Bl = T224_IV[3] | 0; + this.Ch = T224_IV[4] | 0; + this.Cl = T224_IV[5] | 0; + this.Dh = T224_IV[6] | 0; + this.Dl = T224_IV[7] | 0; + this.Eh = T224_IV[8] | 0; + this.El = T224_IV[9] | 0; + this.Fh = T224_IV[10] | 0; + this.Fl = T224_IV[11] | 0; + this.Gh = T224_IV[12] | 0; + this.Gl = T224_IV[13] | 0; + this.Hh = T224_IV[14] | 0; + this.Hl = T224_IV[15] | 0; + } +} +class SHA512_256 extends SHA512 { + constructor() { + super(32); + this.Ah = T256_IV[0] | 0; + this.Al = T256_IV[1] | 0; + this.Bh = T256_IV[2] | 0; + this.Bl = T256_IV[3] | 0; + this.Ch = T256_IV[4] | 0; + this.Cl = T256_IV[5] | 0; + this.Dh = T256_IV[6] | 0; + this.Dl = T256_IV[7] | 0; + this.Eh = T256_IV[8] | 0; + this.El = T256_IV[9] | 0; + this.Fh = T256_IV[10] | 0; + this.Fl = T256_IV[11] | 0; + this.Gh = T256_IV[12] | 0; + this.Gl = T256_IV[13] | 0; + this.Hh = T256_IV[14] | 0; + this.Hl = T256_IV[15] | 0; + } +} +/** + * SHA2-256 hash function from RFC 4634. + * + * It is the fastest JS hash, even faster than Blake3. + * To break sha256 using birthday attack, attackers need to try 2^128 hashes. + * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. + */ +const sha256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA256()); +/** SHA2-224 hash function from RFC 4634 */ +const sha224 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA224()); +/** SHA2-512 hash function from RFC 4634. */ +const sha512 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA512()); +/** SHA2-384 hash function from RFC 4634. */ +const sha384 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA384()); +/** + * SHA2-512/256 "truncated" hash function, with improved resistance to length extension attacks. + * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf). + */ +const sha512_256 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA512_256()); +/** + * SHA2-512/224 "truncated" hash function, with improved resistance to length extension attacks. + * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf). + */ +const sha512_224 = /* @__PURE__ */ (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new SHA512_224()); +//# sourceMappingURL=sha2.js.map + +/***/ }), + +/***/ 20168: +/*!***********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js ***! + \***********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AEAD_USAGES: () => (/* binding */ AEAD_USAGES) +/* harmony export */ }); +// The key usages for AEAD. +const AEAD_USAGES = ["encrypt", "decrypt"]; + + +/***/ }), + +/***/ 20475: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/native.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CipherSuite: () => (/* binding */ CipherSuite), +/* harmony export */ DhkemP256HkdfSha256: () => (/* binding */ DhkemP256HkdfSha256), +/* harmony export */ DhkemP384HkdfSha384: () => (/* binding */ DhkemP384HkdfSha384), +/* harmony export */ DhkemP521HkdfSha512: () => (/* binding */ DhkemP521HkdfSha512), +/* harmony export */ HkdfSha256: () => (/* binding */ HkdfSha256), +/* harmony export */ HkdfSha384: () => (/* binding */ HkdfSha384), +/* harmony export */ HkdfSha512: () => (/* binding */ HkdfSha512) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _cipherSuiteNative_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./cipherSuiteNative.js */ 47152); +/* harmony import */ var _kems_dhkemNative_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./kems/dhkemNative.js */ 50079); + + + +/** + * The Hybrid Public Key Encryption (HPKE) ciphersuite, + * which is implemented using only + * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}. + * + * This class is the same as + * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows: + * which supports only the ciphersuites that can be implemented on the native + * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}. + * Therefore, the following cryptographic algorithms are not supported for now: + * - `DHKEM(X25519, HKDF-SHA256)` + * - `DHKEM(X448, HKDF-SHA512)` + * - `ChaCha20Poly1305` + * + * In addtion, the HKDF functions contained in this `CipherSuiteNative` + * class can only derive keys of the same length as the `hashSize`. + * + * If you want to use the unsupported cryptographic algorithms + * above or derive keys longer than the `hashSize`, + * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}. + * + * This class provides following functions: + * + * - Creates encryption contexts both for senders and recipients. + * - {@link createSenderContext} + * - {@link createRecipientContext} + * - Provides single-shot encryption API. + * - {@link seal} + * - {@link open} + * + * The calling of the constructor of this class is the starting + * point for HPKE operations for both senders and recipients. + * + * @example Use only ciphersuites supported by Web Cryptography API. + * + * ```ts + * import { + * Aes128Gcm, + * DhkemP256HkdfSha256, + * HkdfSha256, + * CipherSuite, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP256HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + * + * @example Use a ciphersuite which is currently not supported by Web Cryptography API. + * + * ```ts + * import { Aes128Gcm, HkdfSha256, CipherSuite } from "@hpke/core"; + * import { DhkemX25519HkdfSha256 } from "@hpke/dhkem-x25519"; + * const suite = new CipherSuite({ + * kem: new DhkemX25519HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class CipherSuite extends _cipherSuiteNative_js__WEBPACK_IMPORTED_MODULE_1__.CipherSuiteNative { +} +/** + * The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP256HkdfSha256` + * as follows: + * + * @example + * + * ```ts + * import { + * Aes128Gcm, + * CipherSuite, + * DhkemP256HkdfSha256, + * HkdfSha256, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP256HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class DhkemP256HkdfSha256 extends _kems_dhkemNative_js__WEBPACK_IMPORTED_MODULE_2__.DhkemP256HkdfSha256Native { +} +/** + * The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing {@link KemInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP384HkdfSha384` + * as follows: + * + * @example + * + * ```ts + * import { + * Aes128Gcm, + * CipherSuite, + * DhkemP384HkdfSha384, + * HkdfSha384, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP384HkdfSha384(), + * kdf: new HkdfSha384(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class DhkemP384HkdfSha384 extends _kems_dhkemNative_js__WEBPACK_IMPORTED_MODULE_2__.DhkemP384HkdfSha384Native { +} +/** + * The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing {@link KemInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP521HkdfSha512` + * as follows: + * + * @example + * + * ```ts + * import { + * Aes256Gcm, + * CipherSuite, + * DhkemP521HkdfSha512, + * HkdfSha512, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP521HkdfSha512(), + * kdf: new HkdfSha512(), + * aead: new Aes256Gcm(), + * }); + * ``` + */ +class DhkemP521HkdfSha512 extends _kems_dhkemNative_js__WEBPACK_IMPORTED_MODULE_2__.DhkemP521HkdfSha512Native { +} +/** + * The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`. + * + * The KDF class can only derive keys of the same length as the `hashSize`. + * If you want to derive keys longer than the `hashSize`, + * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}. + * + * @example + * + * ```ts + * import { + * Aes128Gcm, + * CipherSuite, + * DhkemP256HkdfSha256, + * HkdfSha256, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP256HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class HkdfSha256 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha256Native { +} +/** + * The HKDF-SHA384 for HPKE KDF implementing {@link KdfInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha384`. + * + * The KDF class can only derive keys of the same length as the `hashSize`. + * If you want to derive keys longer than the `hashSize`, + * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}. + * + * @example + * + * ```ts + * import { + * Aes128Gcm, + * CipherSuite, + * DhkemP384HkdfSha384, + * HkdfSha384, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP384HkdfSha384(), + * kdf: new HkdfSha384(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class HkdfSha384 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha384Native { +} +/** + * The HKDF-SHA512 for HPKE KDF implementing {@link KdfInterface}. + * + * When using `@hpke/core`, the instance of this class must be specified + * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha512`. + * + * The KDF class can only derive keys of the same length as the `hashSize`. + * If you want to derive keys longer than the `hashSize`, + * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}. + * + * @example + * + * ```ts + * import { + * Aes256Gcm, + * CipherSuite, + * DhkemP521HkdfSha512, + * HkdfSha512, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP521HkdfSha512(), + * kdf: new HkdfSha512(), + * aead: new Aes256Gcm(), + * }); + * ``` + */ +class HkdfSha512 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha512Native { +} + + +/***/ }), + +/***/ 20515: +/*!********************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/authCipher.js ***! + \********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var aes = __webpack_require__(/*! ./aes */ 75279) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var Transform = __webpack_require__(/*! cipher-base */ 51141) +var inherits = __webpack_require__(/*! inherits */ 18628) +var GHASH = __webpack_require__(/*! ./ghash */ 92309) +var xor = __webpack_require__(/*! buffer-xor */ 67023) +var incr32 = __webpack_require__(/*! ./incr32 */ 7093) + +function xorTest (a, b) { + var out = 0 + if (a.length !== b.length) out++ + + var len = Math.min(a.length, b.length) + for (var i = 0; i < len; ++i) { + out += (a[i] ^ b[i]) + } + + return out +} + +function calcIv (self, iv, ck) { + if (iv.length === 12) { + self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])]) + return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])]) + } + var ghash = new GHASH(ck) + var len = iv.length + var toPad = len % 16 + ghash.update(iv) + if (toPad) { + toPad = 16 - toPad + ghash.update(Buffer.alloc(toPad, 0)) + } + ghash.update(Buffer.alloc(8, 0)) + var ivBits = len * 8 + var tail = Buffer.alloc(8) + tail.writeUIntBE(ivBits, 0, 8) + ghash.update(tail) + self._finID = ghash.state + var out = Buffer.from(self._finID) + incr32(out) + return out +} +function StreamCipher (mode, key, iv, decrypt) { + Transform.call(this) + + var h = Buffer.alloc(4, 0) + + this._cipher = new aes.AES(key) + var ck = this._cipher.encryptBlock(h) + this._ghash = new GHASH(ck) + iv = calcIv(this, iv, ck) + + this._prev = Buffer.from(iv) + this._cache = Buffer.allocUnsafe(0) + this._secCache = Buffer.allocUnsafe(0) + this._decrypt = decrypt + this._alen = 0 + this._len = 0 + this._mode = mode + + this._authTag = null + this._called = false +} + +inherits(StreamCipher, Transform) + +StreamCipher.prototype._update = function (chunk) { + if (!this._called && this._alen) { + var rump = 16 - (this._alen % 16) + if (rump < 16) { + rump = Buffer.alloc(rump, 0) + this._ghash.update(rump) + } + } + + this._called = true + var out = this._mode.encrypt(this, chunk) + if (this._decrypt) { + this._ghash.update(chunk) + } else { + this._ghash.update(out) + } + this._len += chunk.length + return out +} + +StreamCipher.prototype._final = function () { + if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data') + + var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID)) + if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data') + + this._authTag = tag + this._cipher.scrub() +} + +StreamCipher.prototype.getAuthTag = function getAuthTag () { + if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state') + + return this._authTag +} + +StreamCipher.prototype.setAuthTag = function setAuthTag (tag) { + if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state') + + this._authTag = tag +} + +StreamCipher.prototype.setAAD = function setAAD (buf) { + if (this._called) throw new Error('Attempting to set AAD in unsupported state') + + this._ghash.update(buf) + this._alen += buf.length +} + +module.exports = StreamCipher + + +/***/ }), + +/***/ 20710: +/*!*************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/basic_constraints.js ***! + \*************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BasicConstraints: () => (/* binding */ BasicConstraints), +/* harmony export */ id_ce_basicConstraints: () => (/* binding */ id_ce_basicConstraints) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + +const id_ce_basicConstraints = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.19`; +class BasicConstraints { + cA = false; + pathLenConstraint; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Boolean, defaultValue: false, + }) +], BasicConstraints.prototype, "cA", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, optional: true, + }) +], BasicConstraints.prototype, "pathLenConstraint", void 0); + + +/***/ }), + +/***/ 20804: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+ciphers@1.3.0/node_modules/@noble/ciphers/esm/_polyval.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ _toGHASHKey: () => (/* binding */ _toGHASHKey), +/* harmony export */ ghash: () => (/* binding */ ghash), +/* harmony export */ polyval: () => (/* binding */ polyval) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ 73049); +/** + * GHash from AES-GCM and its little-endian "mirror image" Polyval from AES-SIV. + * + * Implemented in terms of GHash with conversion function for keys + * GCM GHASH from + * [NIST SP800-38d](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38d.pdf), + * SIV from + * [RFC 8452](https://datatracker.ietf.org/doc/html/rfc8452). + * + * GHASH modulo: x^128 + x^7 + x^2 + x + 1 + * POLYVAL modulo: x^128 + x^127 + x^126 + x^121 + 1 + * + * @module + */ +// prettier-ignore + +const BLOCK_SIZE = 16; +// TODO: rewrite +// temporary padding buffer +const ZEROS16 = /* @__PURE__ */ new Uint8Array(16); +const ZEROS32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(ZEROS16); +const POLY = 0xe1; // v = 2*v % POLY +// v = 2*v % POLY +// NOTE: because x + x = 0 (add/sub is same), mul2(x) != x+x +// We can multiply any number using montgomery ladder and this function (works as double, add is simple xor) +const mul2 = (s0, s1, s2, s3) => { + const hiBit = s3 & 1; + return { + s3: (s2 << 31) | (s3 >>> 1), + s2: (s1 << 31) | (s2 >>> 1), + s1: (s0 << 31) | (s1 >>> 1), + s0: (s0 >>> 1) ^ ((POLY << 24) & -(hiBit & 1)), // reduce % poly + }; +}; +const swapLE = (n) => (((n >>> 0) & 0xff) << 24) | + (((n >>> 8) & 0xff) << 16) | + (((n >>> 16) & 0xff) << 8) | + ((n >>> 24) & 0xff) | + 0; +/** + * `mulX_POLYVAL(ByteReverse(H))` from spec + * @param k mutated in place + */ +function _toGHASHKey(k) { + k.reverse(); + const hiBit = k[15] & 1; + // k >>= 1 + let carry = 0; + for (let i = 0; i < k.length; i++) { + const t = k[i]; + k[i] = (t >>> 1) | carry; + carry = (t & 1) << 7; + } + k[0] ^= -hiBit & 0xe1; // if (hiBit) n ^= 0xe1000000000000000000000000000000; + return k; +} +const estimateWindow = (bytes) => { + if (bytes > 64 * 1024) + return 8; + if (bytes > 1024) + return 4; + return 2; +}; +class GHASH { + // We select bits per window adaptively based on expectedLength + constructor(key, expectedLength) { + this.blockLen = BLOCK_SIZE; + this.outputLen = BLOCK_SIZE; + this.s0 = 0; + this.s1 = 0; + this.s2 = 0; + this.s3 = 0; + this.finished = false; + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(key); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(key, 16); + const kView = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.createView)(key); + let k0 = kView.getUint32(0, false); + let k1 = kView.getUint32(4, false); + let k2 = kView.getUint32(8, false); + let k3 = kView.getUint32(12, false); + // generate table of doubled keys (half of montgomery ladder) + const doubles = []; + for (let i = 0; i < 128; i++) { + doubles.push({ s0: swapLE(k0), s1: swapLE(k1), s2: swapLE(k2), s3: swapLE(k3) }); + ({ s0: k0, s1: k1, s2: k2, s3: k3 } = mul2(k0, k1, k2, k3)); + } + const W = estimateWindow(expectedLength || 1024); + if (![1, 2, 4, 8].includes(W)) + throw new Error('ghash: invalid window size, expected 2, 4 or 8'); + this.W = W; + const bits = 128; // always 128 bits; + const windows = bits / W; + const windowSize = (this.windowSize = 2 ** W); + const items = []; + // Create precompute table for window of W bits + for (let w = 0; w < windows; w++) { + // truth table: 00, 01, 10, 11 + for (let byte = 0; byte < windowSize; byte++) { + // prettier-ignore + let s0 = 0, s1 = 0, s2 = 0, s3 = 0; + for (let j = 0; j < W; j++) { + const bit = (byte >>> (W - j - 1)) & 1; + if (!bit) + continue; + const { s0: d0, s1: d1, s2: d2, s3: d3 } = doubles[W * w + j]; + (s0 ^= d0), (s1 ^= d1), (s2 ^= d2), (s3 ^= d3); + } + items.push({ s0, s1, s2, s3 }); + } + } + this.t = items; + } + _updateBlock(s0, s1, s2, s3) { + (s0 ^= this.s0), (s1 ^= this.s1), (s2 ^= this.s2), (s3 ^= this.s3); + const { W, t, windowSize } = this; + // prettier-ignore + let o0 = 0, o1 = 0, o2 = 0, o3 = 0; + const mask = (1 << W) - 1; // 2**W will kill performance. + let w = 0; + for (const num of [s0, s1, s2, s3]) { + for (let bytePos = 0; bytePos < 4; bytePos++) { + const byte = (num >>> (8 * bytePos)) & 0xff; + for (let bitPos = 8 / W - 1; bitPos >= 0; bitPos--) { + const bit = (byte >>> (W * bitPos)) & mask; + const { s0: e0, s1: e1, s2: e2, s3: e3 } = t[w * windowSize + bit]; + (o0 ^= e0), (o1 ^= e1), (o2 ^= e2), (o3 ^= e3); + w += 1; + } + } + } + this.s0 = o0; + this.s1 = o1; + this.s2 = o2; + this.s3 = o3; + } + update(data) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(data); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(data); + const b32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(data); + const blocks = Math.floor(data.length / BLOCK_SIZE); + const left = data.length % BLOCK_SIZE; + for (let i = 0; i < blocks; i++) { + this._updateBlock(b32[i * 4 + 0], b32[i * 4 + 1], b32[i * 4 + 2], b32[i * 4 + 3]); + } + if (left) { + ZEROS16.set(data.subarray(blocks * BLOCK_SIZE)); + this._updateBlock(ZEROS32[0], ZEROS32[1], ZEROS32[2], ZEROS32[3]); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.clean)(ZEROS32); // clean tmp buffer + } + return this; + } + destroy() { + const { t } = this; + // clean precompute table + for (const elm of t) { + (elm.s0 = 0), (elm.s1 = 0), (elm.s2 = 0), (elm.s3 = 0); + } + } + digestInto(out) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aoutput)(out, this); + this.finished = true; + const { s0, s1, s2, s3 } = this; + const o32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(out); + o32[0] = s0; + o32[1] = s1; + o32[2] = s2; + o32[3] = s3; + return out; + } + digest() { + const res = new Uint8Array(BLOCK_SIZE); + this.digestInto(res); + this.destroy(); + return res; + } +} +class Polyval extends GHASH { + constructor(key, expectedLength) { + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(key); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(key); + const ghKey = _toGHASHKey((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.copyBytes)(key)); + super(ghKey, expectedLength); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.clean)(ghKey); + } + update(data) { + data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(data); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + const b32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(data); + const left = data.length % BLOCK_SIZE; + const blocks = Math.floor(data.length / BLOCK_SIZE); + for (let i = 0; i < blocks; i++) { + this._updateBlock(swapLE(b32[i * 4 + 3]), swapLE(b32[i * 4 + 2]), swapLE(b32[i * 4 + 1]), swapLE(b32[i * 4 + 0])); + } + if (left) { + ZEROS16.set(data.subarray(blocks * BLOCK_SIZE)); + this._updateBlock(swapLE(ZEROS32[3]), swapLE(ZEROS32[2]), swapLE(ZEROS32[1]), swapLE(ZEROS32[0])); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.clean)(ZEROS32); + } + return this; + } + digestInto(out) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aoutput)(out, this); + this.finished = true; + // tmp ugly hack + const { s0, s1, s2, s3 } = this; + const o32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.u32)(out); + o32[0] = s0; + o32[1] = s1; + o32[2] = s2; + o32[3] = s3; + return out.reverse(); + } +} +function wrapConstructorWithKey(hashCons) { + const hashC = (msg, key) => hashCons(key, msg.length).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(msg)).digest(); + const tmp = hashCons(new Uint8Array(16), 0); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (key, expectedLength) => hashCons(key, expectedLength); + return hashC; +} +/** GHash MAC for AES-GCM. */ +const ghash = wrapConstructorWithKey((key, expectedLength) => new GHASH(key, expectedLength)); +/** Polyval MAC for AES-SIV. */ +const polyval = wrapConstructorWithKey((key, expectedLength) => new Polyval(key, expectedLength)); +//# sourceMappingURL=_polyval.js.map + +/***/ }), + +/***/ 21033: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Reflect.getPrototypeOf.js ***! + \**********************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./Reflect.getPrototypeOf')} */ +module.exports = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null; + + +/***/ }), + +/***/ 21162: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/cfb.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var xor = __webpack_require__(/*! buffer-xor */ 67023) + +function encryptStart (self, data, decrypt) { + var len = data.length + var out = xor(data, self._cache) + self._cache = self._cache.slice(len) + self._prev = Buffer.concat([self._prev, decrypt ? data : out]) + return out +} + +exports.encrypt = function (self, data, decrypt) { + var out = Buffer.allocUnsafe(0) + var len + + while (data.length) { + if (self._cache.length === 0) { + self._cache = self._cipher.encryptBlock(self._prev) + self._prev = Buffer.allocUnsafe(0) + } + + if (self._cache.length <= data.length) { + len = self._cache.length + out = Buffer.concat([out, encryptStart(self, data.slice(0, len), decrypt)]) + data = data.slice(len) + } else { + out = Buffer.concat([out, encryptStart(self, data, decrypt)]) + break + } + } + + return out +} + + +/***/ }), + +/***/ 21354: +/*!******************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/encoders/der.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var inherits = __webpack_require__(/*! inherits */ 18628); +var Buffer = (__webpack_require__(/*! buffer */ 62266).Buffer); + +var asn1 = __webpack_require__(/*! ../../asn1 */ 41032); +var base = asn1.base; + +// Import DER constants +var der = asn1.constants.der; + +function DEREncoder(entity) { + this.enc = 'der'; + this.name = entity.name; + this.entity = entity; + + // Construct base tree + this.tree = new DERNode(); + this.tree._init(entity.body); +}; +module.exports = DEREncoder; + +DEREncoder.prototype.encode = function encode(data, reporter) { + return this.tree._encode(data, reporter).join(); +}; + +// Tree methods + +function DERNode(parent) { + base.Node.call(this, 'der', parent); +} +inherits(DERNode, base.Node); + +DERNode.prototype._encodeComposite = function encodeComposite(tag, + primitive, + cls, + content) { + var encodedTag = encodeTag(tag, primitive, cls, this.reporter); + + // Short form + if (content.length < 0x80) { + var header = new Buffer(2); + header[0] = encodedTag; + header[1] = content.length; + return this._createEncoderBuffer([ header, content ]); + } + + // Long form + // Count octets required to store length + var lenOctets = 1; + for (var i = content.length; i >= 0x100; i >>= 8) + lenOctets++; + + var header = new Buffer(1 + 1 + lenOctets); + header[0] = encodedTag; + header[1] = 0x80 | lenOctets; + + for (var i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8) + header[i] = j & 0xff; + + return this._createEncoderBuffer([ header, content ]); +}; + +DERNode.prototype._encodeStr = function encodeStr(str, tag) { + if (tag === 'bitstr') { + return this._createEncoderBuffer([ str.unused | 0, str.data ]); + } else if (tag === 'bmpstr') { + var buf = new Buffer(str.length * 2); + for (var i = 0; i < str.length; i++) { + buf.writeUInt16BE(str.charCodeAt(i), i * 2); + } + return this._createEncoderBuffer(buf); + } else if (tag === 'numstr') { + if (!this._isNumstr(str)) { + return this.reporter.error('Encoding of string type: numstr supports ' + + 'only digits and space'); + } + return this._createEncoderBuffer(str); + } else if (tag === 'printstr') { + if (!this._isPrintstr(str)) { + return this.reporter.error('Encoding of string type: printstr supports ' + + 'only latin upper and lower case letters, ' + + 'digits, space, apostrophe, left and rigth ' + + 'parenthesis, plus sign, comma, hyphen, ' + + 'dot, slash, colon, equal sign, ' + + 'question mark'); + } + return this._createEncoderBuffer(str); + } else if (/str$/.test(tag)) { + return this._createEncoderBuffer(str); + } else if (tag === 'objDesc') { + return this._createEncoderBuffer(str); + } else { + return this.reporter.error('Encoding of string type: ' + tag + + ' unsupported'); + } +}; + +DERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) { + if (typeof id === 'string') { + if (!values) + return this.reporter.error('string objid given, but no values map found'); + if (!values.hasOwnProperty(id)) + return this.reporter.error('objid not found in values map'); + id = values[id].split(/[\s\.]+/g); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } else if (Array.isArray(id)) { + id = id.slice(); + for (var i = 0; i < id.length; i++) + id[i] |= 0; + } + + if (!Array.isArray(id)) { + return this.reporter.error('objid() should be either array or string, ' + + 'got: ' + JSON.stringify(id)); + } + + if (!relative) { + if (id[1] >= 40) + return this.reporter.error('Second objid identifier OOB'); + id.splice(0, 2, id[0] * 40 + id[1]); + } + + // Count number of octets + var size = 0; + for (var i = 0; i < id.length; i++) { + var ident = id[i]; + for (size++; ident >= 0x80; ident >>= 7) + size++; + } + + var objid = new Buffer(size); + var offset = objid.length - 1; + for (var i = id.length - 1; i >= 0; i--) { + var ident = id[i]; + objid[offset--] = ident & 0x7f; + while ((ident >>= 7) > 0) + objid[offset--] = 0x80 | (ident & 0x7f); + } + + return this._createEncoderBuffer(objid); +}; + +function two(num) { + if (num < 10) + return '0' + num; + else + return num; +} + +DERNode.prototype._encodeTime = function encodeTime(time, tag) { + var str; + var date = new Date(time); + + if (tag === 'gentime') { + str = [ + two(date.getFullYear()), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else if (tag === 'utctime') { + str = [ + two(date.getFullYear() % 100), + two(date.getUTCMonth() + 1), + two(date.getUTCDate()), + two(date.getUTCHours()), + two(date.getUTCMinutes()), + two(date.getUTCSeconds()), + 'Z' + ].join(''); + } else { + this.reporter.error('Encoding ' + tag + ' time is not supported yet'); + } + + return this._encodeStr(str, 'octstr'); +}; + +DERNode.prototype._encodeNull = function encodeNull() { + return this._createEncoderBuffer(''); +}; + +DERNode.prototype._encodeInt = function encodeInt(num, values) { + if (typeof num === 'string') { + if (!values) + return this.reporter.error('String int or enum given, but no values map'); + if (!values.hasOwnProperty(num)) { + return this.reporter.error('Values map doesn\'t contain: ' + + JSON.stringify(num)); + } + num = values[num]; + } + + // Bignum, assume big endian + if (typeof num !== 'number' && !Buffer.isBuffer(num)) { + var numArray = num.toArray(); + if (!num.sign && numArray[0] & 0x80) { + numArray.unshift(0); + } + num = new Buffer(numArray); + } + + if (Buffer.isBuffer(num)) { + var size = num.length; + if (num.length === 0) + size++; + + var out = new Buffer(size); + num.copy(out); + if (num.length === 0) + out[0] = 0 + return this._createEncoderBuffer(out); + } + + if (num < 0x80) + return this._createEncoderBuffer(num); + + if (num < 0x100) + return this._createEncoderBuffer([0, num]); + + var size = 1; + for (var i = num; i >= 0x100; i >>= 8) + size++; + + var out = new Array(size); + for (var i = out.length - 1; i >= 0; i--) { + out[i] = num & 0xff; + num >>= 8; + } + if(out[0] & 0x80) { + out.unshift(0); + } + + return this._createEncoderBuffer(new Buffer(out)); +}; + +DERNode.prototype._encodeBool = function encodeBool(value) { + return this._createEncoderBuffer(value ? 0xff : 0); +}; + +DERNode.prototype._use = function use(entity, obj) { + if (typeof entity === 'function') + entity = entity(obj); + return entity._getEncoder('der').tree; +}; + +DERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) { + var state = this._baseState; + var i; + if (state['default'] === null) + return false; + + var data = dataBuffer.join(); + if (state.defaultBuffer === undefined) + state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join(); + + if (data.length !== state.defaultBuffer.length) + return false; + + for (i=0; i < data.length; i++) + if (data[i] !== state.defaultBuffer[i]) + return false; + + return true; +}; + +// Utility methods + +function encodeTag(tag, primitive, cls, reporter) { + var res; + + if (tag === 'seqof') + tag = 'seq'; + else if (tag === 'setof') + tag = 'set'; + + if (der.tagByName.hasOwnProperty(tag)) + res = der.tagByName[tag]; + else if (typeof tag === 'number' && (tag | 0) === tag) + res = tag; + else + return reporter.error('Unknown tag: ' + tag); + + if (res >= 0x1f) + return reporter.error('Multi-octet tag encoding unsupported'); + + if (!primitive) + res |= 0x20; + + res |= (der.tagClassByName[cls || 'universal'] << 6); + + return res; +} + + +/***/ }), + +/***/ 21599: +/*!******************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack@5.102.1_@swc+core@1.15.43_@swc+helpers@0.5.23__postcss@8.5.16_webpack-cli@5.1.4/node_modules/webpack/hot/log-apply-result.js ***! + \******************************************************************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + +/** + * @param {(string | number)[]} updatedModules updated modules + * @param {(string | number)[] | null} renewedModules renewed modules + */ +module.exports = function (updatedModules, renewedModules) { + var unacceptedModules = updatedModules.filter(function (moduleId) { + return renewedModules && renewedModules.indexOf(moduleId) < 0; + }); + var log = __webpack_require__(/*! ./log */ 84132); + + if (unacceptedModules.length > 0) { + log( + "warning", + "[HMR] The following modules couldn't be hot updated: (They would need a full reload!)" + ); + unacceptedModules.forEach(function (moduleId) { + log("warning", "[HMR] - " + moduleId); + }); + } + + if (!renewedModules || renewedModules.length === 0) { + log("info", "[HMR] Nothing hot updated."); + } else { + log("info", "[HMR] Updated modules:"); + renewedModules.forEach(function (moduleId) { + if (typeof moduleId === "string" && moduleId.indexOf("!") !== -1) { + var parts = moduleId.split("!"); + log.groupCollapsed("info", "[HMR] - " + parts.pop()); + log("info", "[HMR] - " + moduleId); + log.groupEnd("info"); + } else { + log("info", "[HMR] - " + moduleId); + } + }); + var numberIds = renewedModules.every(function (moduleId) { + return typeof moduleId === "number"; + }); + if (numberIds) + log( + "info", + '[HMR] Consider using the optimization.moduleIds: "named" for module names.' + ); + } +}; + + +/***/ }), + +/***/ 21970: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/index.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NIL: () => (/* reexport safe */ _nil_js__WEBPACK_IMPORTED_MODULE_4__["default"]), +/* harmony export */ parse: () => (/* reexport safe */ _parse_js__WEBPACK_IMPORTED_MODULE_8__["default"]), +/* harmony export */ stringify: () => (/* reexport safe */ _stringify_js__WEBPACK_IMPORTED_MODULE_7__["default"]), +/* harmony export */ v1: () => (/* reexport safe */ _v1_js__WEBPACK_IMPORTED_MODULE_0__["default"]), +/* harmony export */ v3: () => (/* reexport safe */ _v3_js__WEBPACK_IMPORTED_MODULE_1__["default"]), +/* harmony export */ v4: () => (/* reexport safe */ _v4_js__WEBPACK_IMPORTED_MODULE_2__["default"]), +/* harmony export */ v5: () => (/* reexport safe */ _v5_js__WEBPACK_IMPORTED_MODULE_3__["default"]), +/* harmony export */ validate: () => (/* reexport safe */ _validate_js__WEBPACK_IMPORTED_MODULE_6__["default"]), +/* harmony export */ version: () => (/* reexport safe */ _version_js__WEBPACK_IMPORTED_MODULE_5__["default"]) +/* harmony export */ }); +/* harmony import */ var _v1_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v1.js */ 68869); +/* harmony import */ var _v3_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./v3.js */ 43555); +/* harmony import */ var _v4_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./v4.js */ 82394); +/* harmony import */ var _v5_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./v5.js */ 36553); +/* harmony import */ var _nil_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./nil.js */ 13037); +/* harmony import */ var _version_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./version.js */ 18086); +/* harmony import */ var _validate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./validate.js */ 83494); +/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stringify.js */ 15247); +/* harmony import */ var _parse_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./parse.js */ 96369); + + + + + + + + + + +/***/ }), + +/***/ 21999: +/*!******************************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/utils/sendMessage.js ***! + \******************************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* global __resourceQuery WorkerGlobalScope */ + +// Send messages to the outside, so plugins can consume it. +/** + * @param {string} type + * @param {any} [data] + */ +function sendMsg(type, data) { + if (typeof self !== "undefined" && (typeof WorkerGlobalScope === "undefined" || !(self instanceof WorkerGlobalScope))) { + self.postMessage({ + type: "webpack".concat(type), + data: data + }, "*"); + } +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (sendMsg); + +/***/ }), + +/***/ 22094: +/*!****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/clearance.js ***! + \****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Clearance: () => (/* binding */ Clearance) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _class_list_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./class_list.js */ 54823); +/* harmony import */ var _security_category_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./security_category.js */ 80051); + + + + +class Clearance { + policyId = ""; + classList = new _class_list_js__WEBPACK_IMPORTED_MODULE_2__.ClassList(_class_list_js__WEBPACK_IMPORTED_MODULE_2__.ClassListFlags.unclassified); + securityCategories; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], Clearance.prototype, "policyId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _class_list_js__WEBPACK_IMPORTED_MODULE_2__.ClassList, defaultValue: new _class_list_js__WEBPACK_IMPORTED_MODULE_2__.ClassList(_class_list_js__WEBPACK_IMPORTED_MODULE_2__.ClassListFlags.unclassified), + }) +], Clearance.prototype, "classList", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _security_category_js__WEBPACK_IMPORTED_MODULE_3__.SecurityCategory, repeated: "set", + }) +], Clearance.prototype, "securityCategories", void 0); + + +/***/ }), + +/***/ 22126: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/base64url.js ***! + \****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ base64url: () => (/* binding */ base64url), +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ is: () => (/* binding */ is), +/* harmony export */ normalize: () => (/* binding */ normalize) +/* harmony export */ }); +/* harmony import */ var _base64_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base64.js */ 56051); + +const BASE64URL_REGEX = /^[A-Za-z0-9_-]*$/; +function normalize(text) { + return text.replace(/[\n\r\t ]/g, ""); +} +function is(text) { + return typeof text === "string" && BASE64URL_REGEX.test(normalize(text)); +} +function encode(data, _options) { + return _base64_js__WEBPACK_IMPORTED_MODULE_0__.base64.encode(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, ""); +} +function decode(text, _options) { + const normalized = normalize(text); + if (!is(normalized)) { + throw new TypeError("Input is not valid Base64Url text"); + } + return _base64_js__WEBPACK_IMPORTED_MODULE_0__.base64.decode(_base64_js__WEBPACK_IMPORTED_MODULE_0__.base64.pad(normalized.replace(/-/g, "+").replace(/_/g, "/"))); +} +const base64url = { encode, decode, is, normalize }; + + +/***/ }), + +/***/ 22215: +/*!*****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/proxy_info.js ***! + \*****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ProxyInfo: () => (/* binding */ ProxyInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _target_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./target.js */ 58167); +var ProxyInfo_1; + + + +let ProxyInfo = ProxyInfo_1 = class ProxyInfo extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, ProxyInfo_1.prototype); + } +}; +ProxyInfo = ProxyInfo_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _target_js__WEBPACK_IMPORTED_MODULE_2__.Targets, + }) +], ProxyInfo); + + + +/***/ }), + +/***/ 22745: +/*!********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/data/concat.js ***! + \********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ concat: () => (/* binding */ concat), +/* harmony export */ concatBytes: () => (/* binding */ concatBytes), +/* harmony export */ concatHex: () => (/* binding */ concatHex) +/* harmony export */ }); +function concat(values) { + if (typeof values[0] === 'string') + return concatHex(values); + return concatBytes(values); +} +function concatBytes(values) { + let length = 0; + for (const arr of values) { + length += arr.length; + } + const result = new Uint8Array(length); + let offset = 0; + for (const arr of values) { + result.set(arr, offset); + offset += arr.length; + } + return result; +} +function concatHex(values) { + return `0x${values.reduce((acc, x) => acc + x.replace('0x', ''), '')}`; +} +//# sourceMappingURL=concat.js.map + +/***/ }), + +/***/ 22837: +/*!********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/subject_public_key_info.js ***! + \********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SubjectPublicKeyInfo: () => (/* binding */ SubjectPublicKeyInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./algorithm_identifier.js */ 99875); + + + +class SubjectPublicKeyInfo { + algorithm = new _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + subjectPublicKey = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], SubjectPublicKeyInfo.prototype, "algorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString }) +], SubjectPublicKeyInfo.prototype, "subjectPublicKey", void 0); + + +/***/ }), + +/***/ 22982: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+encoding@0.6.0/node_modules/@turnkey/encoding/dist/encode.mjs ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ pointEncode: () => (/* binding */ pointEncode) +/* harmony export */ }); +/** + * Compresses an uncompressed P-256 public key into its 33-byte compressed form. + * + * @param {Uint8Array} raw - The uncompressed public key (65 bytes, starting with 0x04). + * @returns {Uint8Array} - The compressed public key (33 bytes, starting with 0x02 or 0x03). + * @throws {Error} - If the input key is not a valid uncompressed P-256 key. + */ +function pointEncode(raw) { + if (raw.length !== 65 || raw[0] !== 0x04) { + throw new Error("Invalid uncompressed P-256 key"); + } + const x = raw.slice(1, 33); + const y = raw.slice(33, 65); + if (x.length !== 32 || y.length !== 32) { + throw new Error("Invalid x or y length"); + } + const prefix = (y[31] & 1) === 0 ? 0x02 : 0x03; + const compressed = new Uint8Array(33); + compressed[0] = prefix; + compressed.set(x, 1); + return compressed; +} + + +//# sourceMappingURL=encode.mjs.map + + +/***/ }), + +/***/ 23400: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/attribute.js ***! + \****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PKCS12AttrSet: () => (/* binding */ PKCS12AttrSet), +/* harmony export */ PKCS12Attribute: () => (/* binding */ PKCS12Attribute) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +var PKCS12AttrSet_1; + + +class PKCS12Attribute { + attrId = ""; + attrValues = []; + constructor(params = {}) { + Object.assign(params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], PKCS12Attribute.prototype, "attrId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, repeated: "set", + }) +], PKCS12Attribute.prototype, "attrValues", void 0); +let PKCS12AttrSet = PKCS12AttrSet_1 = class PKCS12AttrSet extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, PKCS12AttrSet_1.prototype); + } +}; +PKCS12AttrSet = PKCS12AttrSet_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: PKCS12Attribute, + }) +], PKCS12AttrSet); + + + +/***/ }), + +/***/ 23455: +/*!***************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/address/getAddress.js ***! + \***************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ checksumAddress: () => (/* binding */ checksumAddress), +/* harmony export */ getAddress: () => (/* binding */ getAddress) +/* harmony export */ }); +/* harmony import */ var _errors_address_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/address.js */ 44876); +/* harmony import */ var _encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/toBytes.js */ 58548); +/* harmony import */ var _hash_keccak256_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../hash/keccak256.js */ 25878); +/* harmony import */ var _lru_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lru.js */ 24069); +/* harmony import */ var _isAddress_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./isAddress.js */ 90355); + + + + + +const checksumAddressCache = /*#__PURE__*/ new _lru_js__WEBPACK_IMPORTED_MODULE_3__.LruMap(8192); +function checksumAddress(address_, +/** + * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the + * wider Ethereum ecosystem, meaning it will break when validated against an application/tool + * that relies on EIP-55 checksum encoding (checksum without chainId). + * + * It is highly recommended to not use this feature unless you + * know what you are doing. + * + * See more: https://github.com/ethereum/EIPs/issues/1121 + */ +chainId) { + if (checksumAddressCache.has(`${address_}.${chainId}`)) + return checksumAddressCache.get(`${address_}.${chainId}`); + const hexAddress = chainId + ? `${chainId}${address_.toLowerCase()}` + : address_.substring(2).toLowerCase(); + const hash = (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_2__.keccak256)((0,_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_1__.stringToBytes)(hexAddress), 'bytes'); + const address = (chainId ? hexAddress.substring(`${chainId}0x`.length) : hexAddress).split(''); + for (let i = 0; i < 40; i += 2) { + if (hash[i >> 1] >> 4 >= 8 && address[i]) { + address[i] = address[i].toUpperCase(); + } + if ((hash[i >> 1] & 0x0f) >= 8 && address[i + 1]) { + address[i + 1] = address[i + 1].toUpperCase(); + } + } + const result = `0x${address.join('')}`; + checksumAddressCache.set(`${address_}.${chainId}`, result); + return result; +} +function getAddress(address, +/** + * Warning: EIP-1191 checksum addresses are generally not backwards compatible with the + * wider Ethereum ecosystem, meaning it will break when validated against an application/tool + * that relies on EIP-55 checksum encoding (checksum without chainId). + * + * It is highly recommended to not use this feature unless you + * know what you are doing. + * + * See more: https://github.com/ethereum/EIPs/issues/1121 + */ +chainId) { + if (!(0,_isAddress_js__WEBPACK_IMPORTED_MODULE_4__.isAddress)(address, { strict: false })) + throw new _errors_address_js__WEBPACK_IMPORTED_MODULE_0__.InvalidAddressError({ address }); + return checksumAddress(address, chainId); +} +//# sourceMappingURL=getAddress.js.map + +/***/ }), + +/***/ 23604: +/*!****************************************************************************!*\ + !*** ../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js ***! + \****************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bech32m = exports.bech32 = void 0; +const ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l'; +const ALPHABET_MAP = {}; +for (let z = 0; z < ALPHABET.length; z++) { + const x = ALPHABET.charAt(z); + ALPHABET_MAP[x] = z; +} +function polymodStep(pre) { + const b = pre >> 25; + return (((pre & 0x1ffffff) << 5) ^ + (-((b >> 0) & 1) & 0x3b6a57b2) ^ + (-((b >> 1) & 1) & 0x26508e6d) ^ + (-((b >> 2) & 1) & 0x1ea119fa) ^ + (-((b >> 3) & 1) & 0x3d4233dd) ^ + (-((b >> 4) & 1) & 0x2a1462b3)); +} +function prefixChk(prefix) { + let chk = 1; + for (let i = 0; i < prefix.length; ++i) { + const c = prefix.charCodeAt(i); + if (c < 33 || c > 126) + return 'Invalid prefix (' + prefix + ')'; + chk = polymodStep(chk) ^ (c >> 5); + } + chk = polymodStep(chk); + for (let i = 0; i < prefix.length; ++i) { + const v = prefix.charCodeAt(i); + chk = polymodStep(chk) ^ (v & 0x1f); + } + return chk; +} +function convert(data, inBits, outBits, pad) { + let value = 0; + let bits = 0; + const maxV = (1 << outBits) - 1; + const result = []; + for (let i = 0; i < data.length; ++i) { + value = (value << inBits) | data[i]; + bits += inBits; + while (bits >= outBits) { + bits -= outBits; + result.push((value >> bits) & maxV); + } + } + if (pad) { + if (bits > 0) { + result.push((value << (outBits - bits)) & maxV); + } + } + else { + if (bits >= inBits) + return 'Excess padding'; + if ((value << (outBits - bits)) & maxV) + return 'Non-zero padding'; + } + return result; +} +function toWords(bytes) { + return convert(bytes, 8, 5, true); +} +function fromWordsUnsafe(words) { + const res = convert(words, 5, 8, false); + if (Array.isArray(res)) + return res; +} +function fromWords(words) { + const res = convert(words, 5, 8, false); + if (Array.isArray(res)) + return res; + throw new Error(res); +} +function getLibraryFromEncoding(encoding) { + let ENCODING_CONST; + if (encoding === 'bech32') { + ENCODING_CONST = 1; + } + else { + ENCODING_CONST = 0x2bc830a3; + } + function encode(prefix, words, LIMIT) { + LIMIT = LIMIT || 90; + if (prefix.length + 7 + words.length > LIMIT) + throw new TypeError('Exceeds length limit'); + prefix = prefix.toLowerCase(); + // determine chk mod + let chk = prefixChk(prefix); + if (typeof chk === 'string') + throw new Error(chk); + let result = prefix + '1'; + for (let i = 0; i < words.length; ++i) { + const x = words[i]; + if (x >> 5 !== 0) + throw new Error('Non 5-bit word'); + chk = polymodStep(chk) ^ x; + result += ALPHABET.charAt(x); + } + for (let i = 0; i < 6; ++i) { + chk = polymodStep(chk); + } + chk ^= ENCODING_CONST; + for (let i = 0; i < 6; ++i) { + const v = (chk >> ((5 - i) * 5)) & 0x1f; + result += ALPHABET.charAt(v); + } + return result; + } + function __decode(str, LIMIT) { + LIMIT = LIMIT || 90; + if (str.length < 8) + return str + ' too short'; + if (str.length > LIMIT) + return 'Exceeds length limit'; + // don't allow mixed case + const lowered = str.toLowerCase(); + const uppered = str.toUpperCase(); + if (str !== lowered && str !== uppered) + return 'Mixed-case string ' + str; + str = lowered; + const split = str.lastIndexOf('1'); + if (split === -1) + return 'No separator character for ' + str; + if (split === 0) + return 'Missing prefix for ' + str; + const prefix = str.slice(0, split); + const wordChars = str.slice(split + 1); + if (wordChars.length < 6) + return 'Data too short'; + let chk = prefixChk(prefix); + if (typeof chk === 'string') + return chk; + const words = []; + for (let i = 0; i < wordChars.length; ++i) { + const c = wordChars.charAt(i); + const v = ALPHABET_MAP[c]; + if (v === undefined) + return 'Unknown character ' + c; + chk = polymodStep(chk) ^ v; + // not in the checksum? + if (i + 6 >= wordChars.length) + continue; + words.push(v); + } + if (chk !== ENCODING_CONST) + return 'Invalid checksum for ' + str; + return { prefix, words }; + } + function decodeUnsafe(str, LIMIT) { + const res = __decode(str, LIMIT); + if (typeof res === 'object') + return res; + } + function decode(str, LIMIT) { + const res = __decode(str, LIMIT); + if (typeof res === 'object') + return res; + throw new Error(res); + } + return { + decodeUnsafe, + decode, + encode, + toWords, + fromWordsUnsafe, + fromWords, + }; +} +exports.bech32 = getLibraryFromEncoding('bech32'); +exports.bech32m = getLibraryFromEncoding('bech32m'); + + +/***/ }), + +/***/ 23707: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/index.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ autoInjectable: () => (/* reexport safe */ _auto_injectable__WEBPACK_IMPORTED_MODULE_0__["default"]), +/* harmony export */ inject: () => (/* reexport safe */ _inject__WEBPACK_IMPORTED_MODULE_1__["default"]), +/* harmony export */ injectAll: () => (/* reexport safe */ _inject_all__WEBPACK_IMPORTED_MODULE_5__["default"]), +/* harmony export */ injectAllWithTransform: () => (/* reexport safe */ _inject_all_with_transform__WEBPACK_IMPORTED_MODULE_6__["default"]), +/* harmony export */ injectWithTransform: () => (/* reexport safe */ _inject_with_transform__WEBPACK_IMPORTED_MODULE_7__["default"]), +/* harmony export */ injectable: () => (/* reexport safe */ _injectable__WEBPACK_IMPORTED_MODULE_2__["default"]), +/* harmony export */ registry: () => (/* reexport safe */ _registry__WEBPACK_IMPORTED_MODULE_3__["default"]), +/* harmony export */ scoped: () => (/* reexport safe */ _scoped__WEBPACK_IMPORTED_MODULE_8__["default"]), +/* harmony export */ singleton: () => (/* reexport safe */ _singleton__WEBPACK_IMPORTED_MODULE_4__["default"]) +/* harmony export */ }); +/* harmony import */ var _auto_injectable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./auto-injectable */ 87132); +/* harmony import */ var _inject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./inject */ 26850); +/* harmony import */ var _injectable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./injectable */ 58930); +/* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./registry */ 63124); +/* harmony import */ var _singleton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./singleton */ 6981); +/* harmony import */ var _inject_all__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./inject-all */ 99084); +/* harmony import */ var _inject_all_with_transform__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./inject-all-with-transform */ 824); +/* harmony import */ var _inject_with_transform__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./inject-with-transform */ 59902); +/* harmony import */ var _scoped__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./scoped */ 63807); + + + + + + + + + + + +/***/ }), + +/***/ 23781: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+crypto@2.8.6/node_modules/@turnkey/crypto/dist/constants.mjs ***! + \***************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AES_KEY_INFO: () => (/* binding */ AES_KEY_INFO), +/* harmony export */ AWS_ROOT_CERT_PEM: () => (/* binding */ AWS_ROOT_CERT_PEM), +/* harmony export */ AWS_ROOT_CERT_SHA256: () => (/* binding */ AWS_ROOT_CERT_SHA256), +/* harmony export */ HPKE_VERSION: () => (/* binding */ HPKE_VERSION), +/* harmony export */ IV_INFO: () => (/* binding */ IV_INFO), +/* harmony export */ LABEL_EAE_PRK: () => (/* binding */ LABEL_EAE_PRK), +/* harmony export */ LABEL_SECRET: () => (/* binding */ LABEL_SECRET), +/* harmony export */ LABEL_SHARED_SECRET: () => (/* binding */ LABEL_SHARED_SECRET), +/* harmony export */ PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY: () => (/* binding */ PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY), +/* harmony export */ PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY: () => (/* binding */ PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY), +/* harmony export */ PRODUCTION_SIGNER_SIGN_PUBLIC_KEY: () => (/* binding */ PRODUCTION_SIGNER_SIGN_PUBLIC_KEY), +/* harmony export */ PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY: () => (/* binding */ PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY), +/* harmony export */ QOS_ENCRYPTION_HMAC_MESSAGE: () => (/* binding */ QOS_ENCRYPTION_HMAC_MESSAGE), +/* harmony export */ QUORUM_ENCRYPT_NONCE_LENGTH_BYTES: () => (/* binding */ QUORUM_ENCRYPT_NONCE_LENGTH_BYTES), +/* harmony export */ SUITE_ID_1: () => (/* binding */ SUITE_ID_1), +/* harmony export */ SUITE_ID_2: () => (/* binding */ SUITE_ID_2), +/* harmony export */ UNCOMPRESSED_PUB_KEY_LENGTH_BYTES: () => (/* binding */ UNCOMPRESSED_PUB_KEY_LENGTH_BYTES) +/* harmony export */ }); +const SUITE_ID_1 = new Uint8Array([75, 69, 77, 0, 16]); //KEM suite ID +const SUITE_ID_2 = new Uint8Array([72, 80, 75, 69, 0, 16, 0, 1, 0, 2]); //HPKE suite ID +const HPKE_VERSION = new Uint8Array([72, 80, 75, 69, 45, 118, 49]); //HPKE-v1 +const LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]); //secret +const LABEL_EAE_PRK = new Uint8Array([101, 97, 101, 95, 112, 114, 107]); //eae_prk +const LABEL_SHARED_SECRET = new Uint8Array([ + 115, 104, 97, 114, 101, 100, 95, 115, 101, 99, 114, 101, 116, +]); //shared_secret +const AES_KEY_INFO = new Uint8Array([ + 0, 32, 72, 80, 75, 69, 45, 118, 49, 72, 80, 75, 69, 0, 16, 0, 1, 0, 2, 107, + 101, 121, 0, 143, 195, 174, 184, 50, 73, 10, 75, 90, 179, 228, 32, 35, 40, + 125, 178, 154, 31, 75, 199, 194, 34, 192, 223, 34, 135, 39, 183, 10, 64, 33, + 18, 47, 63, 4, 233, 32, 108, 209, 36, 19, 80, 53, 41, 180, 122, 198, 166, 48, + 185, 46, 196, 207, 125, 35, 69, 8, 208, 175, 151, 113, 201, 158, 80, +]); //key +const IV_INFO = new Uint8Array([ + 0, 12, 72, 80, 75, 69, 45, 118, 49, 72, 80, 75, 69, 0, 16, 0, 1, 0, 2, 98, 97, + 115, 101, 95, 110, 111, 110, 99, 101, 0, 143, 195, 174, 184, 50, 73, 10, 75, + 90, 179, 228, 32, 35, 40, 125, 178, 154, 31, 75, 199, 194, 34, 192, 223, 34, + 135, 39, 183, 10, 64, 33, 18, 47, 63, 4, 233, 32, 108, 209, 36, 19, 80, 53, + 41, 180, 122, 198, 166, 48, 185, 46, 196, 207, 125, 35, 69, 8, 208, 175, 151, + 113, 201, 158, 80, +]); //base_nonce +const QUORUM_ENCRYPT_NONCE_LENGTH_BYTES = 12; +const UNCOMPRESSED_PUB_KEY_LENGTH_BYTES = 65; +const QOS_ENCRYPTION_HMAC_MESSAGE = new TextEncoder().encode("qos_encryption_hmac_message"); // used for encrypting messages to quorum keys matched whats found here: https://github.com/tkhq/qos/blob/ae01904c756107f850aea42000137ef124df3fe4/src/qos_p256/src/encrypt.rs#L22 +const PRODUCTION_SIGNER_SIGN_PUBLIC_KEY = "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569"; +const PRODUCTION_NOTARIZER_SIGN_PUBLIC_KEY = "04d498aa87ac3bf982ac2b5dd9604d0074905cfbda5d62727c5a237b895e6749205e9f7cd566909c4387f6ca25c308445c60884b788560b785f4a96ac33702a469"; +const PRODUCTION_TLS_FETCHER_ENCRYPT_PUBLIC_KEY = "045e899f1fcf7d12b3c8fd997a7a43bb853dd4e8d63419a8f867c70aacc1c4cf9d04848baca41f0c85ffbbd23cbf78967501cd8eca9e4a6369370a9a38f70d13c0"; +const PRODUCTION_ON_RAMP_CREDENTIALS_ENCRYPTION_PUBLIC_KEY = "02336ebd7e929ef64b87c776b72540255b4c7b41579a24b1e68fb060daa873f9f6"; +// Pinned AWS Nitro Enclaves Root +const AWS_ROOT_CERT_PEM = `-----BEGIN CERTIFICATE----- +MIICETCCAZagAwIBAgIRAPkxdWgbkK/hHUbMtOTn+FYwCgYIKoZIzj0EAwMwSTEL +MAkGA1UEBhMCVVMxDzANBgNVBAoMBkFtYXpvbjEMMAoGA1UECwwDQVdTMRswGQYD +VQQDDBJhd3Mubml0cm8tZW5jbGF2ZXMwHhcNMTkxMDI4MTMyODA1WhcNNDkxMDI4 +MTQyODA1WjBJMQswCQYDVQQGEwJVUzEPMA0GA1UECgwGQW1hem9uMQwwCgYDVQQL +DANBV1MxGzAZBgNVBAMMEmF3cy5uaXRyby1lbmNsYXZlczB2MBAGByqGSM49AgEG +BSuBBAAiA2IABPwCVOumCMHzaHDimtqQvkY4MpJzbolL//Zy2YlES1BR5TSksfbb +48C8WBoyt7F2Bw7eEtaaP+ohG2bnUs990d0JX28TcPQXCEPZ3BABIeTPYwEoCWZE +h8l5YoQwTcU/9KNCMEAwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUkCW1DdkF +R+eWw5b6cp3PmanfS5YwDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMDA2kAMGYC +MQCjfy+Rocm9Xue4YnwWmNJVA44fA0P5W2OpYow9OYCVRaEevL8uO1XYru5xtMPW +rfMCMQCi85sWBbJwKKXdS6BptQFuZbT73o/gBh1qUxl/nNr12UO8Yfwr6wPLb+6N +IwLz3/Y= +-----END CERTIFICATE-----`; +// Official SHA-256 fingerprint +const AWS_ROOT_CERT_SHA256 = "641A0321A3E244EFE456463195D606317ED7CDCC3C1756E09893F3C68F79BB5B"; + + +//# sourceMappingURL=constants.mjs.map + + +/***/ }), + +/***/ 23798: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/superstruct@2.0.2/node_modules/superstruct/dist/index.mjs ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Struct: () => (/* binding */ Struct), +/* harmony export */ StructError: () => (/* binding */ StructError), +/* harmony export */ any: () => (/* binding */ any), +/* harmony export */ array: () => (/* binding */ array), +/* harmony export */ assert: () => (/* binding */ assert), +/* harmony export */ assign: () => (/* binding */ assign), +/* harmony export */ bigint: () => (/* binding */ bigint), +/* harmony export */ boolean: () => (/* binding */ boolean), +/* harmony export */ coerce: () => (/* binding */ coerce), +/* harmony export */ create: () => (/* binding */ create), +/* harmony export */ date: () => (/* binding */ date), +/* harmony export */ defaulted: () => (/* binding */ defaulted), +/* harmony export */ define: () => (/* binding */ define), +/* harmony export */ deprecated: () => (/* binding */ deprecated), +/* harmony export */ dynamic: () => (/* binding */ dynamic), +/* harmony export */ empty: () => (/* binding */ empty), +/* harmony export */ enums: () => (/* binding */ enums), +/* harmony export */ func: () => (/* binding */ func), +/* harmony export */ instance: () => (/* binding */ instance), +/* harmony export */ integer: () => (/* binding */ integer), +/* harmony export */ intersection: () => (/* binding */ intersection), +/* harmony export */ is: () => (/* binding */ is), +/* harmony export */ lazy: () => (/* binding */ lazy), +/* harmony export */ literal: () => (/* binding */ literal), +/* harmony export */ map: () => (/* binding */ map), +/* harmony export */ mask: () => (/* binding */ mask), +/* harmony export */ max: () => (/* binding */ max), +/* harmony export */ min: () => (/* binding */ min), +/* harmony export */ never: () => (/* binding */ never), +/* harmony export */ nonempty: () => (/* binding */ nonempty), +/* harmony export */ nullable: () => (/* binding */ nullable), +/* harmony export */ number: () => (/* binding */ number), +/* harmony export */ object: () => (/* binding */ object), +/* harmony export */ omit: () => (/* binding */ omit), +/* harmony export */ optional: () => (/* binding */ optional), +/* harmony export */ partial: () => (/* binding */ partial), +/* harmony export */ pattern: () => (/* binding */ pattern), +/* harmony export */ pick: () => (/* binding */ pick), +/* harmony export */ record: () => (/* binding */ record), +/* harmony export */ refine: () => (/* binding */ refine), +/* harmony export */ regexp: () => (/* binding */ regexp), +/* harmony export */ set: () => (/* binding */ set), +/* harmony export */ size: () => (/* binding */ size), +/* harmony export */ string: () => (/* binding */ string), +/* harmony export */ struct: () => (/* binding */ struct), +/* harmony export */ trimmed: () => (/* binding */ trimmed), +/* harmony export */ tuple: () => (/* binding */ tuple), +/* harmony export */ type: () => (/* binding */ type), +/* harmony export */ union: () => (/* binding */ union), +/* harmony export */ unknown: () => (/* binding */ unknown), +/* harmony export */ validate: () => (/* binding */ validate) +/* harmony export */ }); +/** + * A `StructFailure` represents a single specific failure in validation. + */ +/** + * `StructError` objects are thrown (or returned) when validation fails. + * + * Validation logic is design to exit early for maximum performance. The error + * represents the first error encountered during validation. For more detail, + * the `error.failures` property is a generator function that can be run to + * continue validation and receive all the failures in the data. + */ +class StructError extends TypeError { + constructor(failure, failures) { + let cached; + const { message, explanation, ...rest } = failure; + const { path } = failure; + const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; + super(explanation ?? msg); + if (explanation != null) + this.cause = msg; + Object.assign(this, rest); + this.name = this.constructor.name; + this.failures = () => { + return (cached ?? (cached = [failure, ...failures()])); + }; + } +} + +/** + * Check if a value is an iterator. + */ +function isIterable(x) { + return isObject(x) && typeof x[Symbol.iterator] === 'function'; +} +/** + * Check if a value is a plain object. + */ +function isObject(x) { + return typeof x === 'object' && x != null; +} +/** + * Check if a value is a non-array object. + */ +function isNonArrayObject(x) { + return isObject(x) && !Array.isArray(x); +} +/** + * Check if a value is a plain object. + */ +function isPlainObject(x) { + if (Object.prototype.toString.call(x) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(x); + return prototype === null || prototype === Object.prototype; +} +/** + * Return a value as a printable string. + */ +function print(value) { + if (typeof value === 'symbol') { + return value.toString(); + } + return typeof value === 'string' ? JSON.stringify(value) : `${value}`; +} +/** + * Shifts (removes and returns) the first value from the `input` iterator. + * Like `Array.prototype.shift()` but for an `Iterator`. + */ +function shiftIterator(input) { + const { done, value } = input.next(); + return done ? undefined : value; +} +/** + * Convert a single validation result to a failure. + */ +function toFailure(result, context, struct, value) { + if (result === true) { + return; + } + else if (result === false) { + result = {}; + } + else if (typeof result === 'string') { + result = { message: result }; + } + const { path, branch } = context; + const { type } = struct; + const { refinement, message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\``, } = result; + return { + value, + type, + refinement, + key: path[path.length - 1], + path, + branch, + ...result, + message, + }; +} +/** + * Convert a validation result to an iterable of failures. + */ +function* toFailures(result, context, struct, value) { + if (!isIterable(result)) { + result = [result]; + } + for (const r of result) { + const failure = toFailure(r, context, struct, value); + if (failure) { + yield failure; + } + } +} +/** + * Check a value against a struct, traversing deeply into nested values, and + * returning an iterator of failures or success. + */ +function* run(value, struct, options = {}) { + const { path = [], branch = [value], coerce = false, mask = false } = options; + const ctx = { path, branch, mask }; + if (coerce) { + value = struct.coercer(value, ctx); + } + let status = 'valid'; + for (const failure of struct.validator(value, ctx)) { + failure.explanation = options.message; + status = 'not_valid'; + yield [failure, undefined]; + } + for (let [k, v, s] of struct.entries(value, ctx)) { + const ts = run(v, s, { + path: k === undefined ? path : [...path, k], + branch: k === undefined ? branch : [...branch, v], + coerce, + mask, + message: options.message, + }); + for (const t of ts) { + if (t[0]) { + status = t[0].refinement != null ? 'not_refined' : 'not_valid'; + yield [t[0], undefined]; + } + else if (coerce) { + v = t[1]; + if (k === undefined) { + value = v; + } + else if (value instanceof Map) { + value.set(k, v); + } + else if (value instanceof Set) { + value.add(v); + } + else if (isObject(value)) { + if (v !== undefined || k in value) + value[k] = v; + } + } + } + } + if (status !== 'not_valid') { + for (const failure of struct.refiner(value, ctx)) { + failure.explanation = options.message; + status = 'not_refined'; + yield [failure, undefined]; + } + } + if (status === 'valid') { + yield [undefined, value]; + } +} + +/** + * `Struct` objects encapsulate the validation logic for a specific type of + * values. Once constructed, you use the `assert`, `is` or `validate` helpers to + * validate unknown input data against the struct. + */ +class Struct { + constructor(props) { + const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props; + this.type = type; + this.schema = schema; + this.entries = entries; + this.coercer = coercer; + if (validator) { + this.validator = (value, context) => { + const result = validator(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.validator = () => []; + } + if (refiner) { + this.refiner = (value, context) => { + const result = refiner(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.refiner = () => []; + } + } + /** + * Assert that a value passes the struct's validation, throwing if it doesn't. + */ + assert(value, message) { + return assert(value, this, message); + } + /** + * Create a value with the struct's coercion logic, then validate it. + */ + create(value, message) { + return create(value, this, message); + } + /** + * Check if a value passes the struct's validation. + */ + is(value) { + return is(value, this); + } + /** + * Mask a value, coercing and validating it, but returning only the subset of + * properties defined by the struct's schema. Masking applies recursively to + * props of `object` structs only. + */ + mask(value, message) { + return mask(value, this, message); + } + /** + * Validate a value with the struct's validation logic, returning a tuple + * representing the result. + * + * You may optionally pass `true` for the `coerce` argument to coerce + * the value before attempting to validate it. If you do, the result will + * contain the coerced result when successful. Also, `mask` will turn on + * masking of the unknown `object` props recursively if passed. + */ + validate(value, options = {}) { + return validate(value, this, options); + } +} +/** + * Assert that a value passes a struct, throwing if it doesn't. + */ +function assert(value, struct, message) { + const result = validate(value, struct, { message }); + if (result[0]) { + throw result[0]; + } +} +/** + * Create a value with the coercion logic of struct and validate it. + */ +function create(value, struct, message) { + const result = validate(value, struct, { coerce: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +/** + * Mask a value, returning only the subset of properties defined by a struct. + */ +function mask(value, struct, message) { + const result = validate(value, struct, { coerce: true, mask: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +/** + * Check if a value passes a struct. + */ +function is(value, struct) { + const result = validate(value, struct); + return !result[0]; +} +/** + * Validate a value against a struct, returning an error if invalid, or the + * value (with potential coercion) if valid. + */ +function validate(value, struct, options = {}) { + const tuples = run(value, struct, options); + const tuple = shiftIterator(tuples); + if (tuple[0]) { + const error = new StructError(tuple[0], function* () { + for (const t of tuples) { + if (t[0]) { + yield t[0]; + } + } + }); + return [error, undefined]; + } + else { + const v = tuple[1]; + return [undefined, v]; + } +} + +function assign(...Structs) { + const isType = Structs[0].type === 'type'; + const schemas = Structs.map((s) => s.schema); + const schema = Object.assign({}, ...schemas); + return isType ? type(schema) : object(schema); +} +/** + * Define a new struct type with a custom validation function. + */ +function define(name, validator) { + return new Struct({ type: name, schema: null, validator }); +} +/** + * Create a new struct based on an existing struct, but the value is allowed to + * be `undefined`. `log` will be called if the value is not `undefined`. + */ +function deprecated(struct, log) { + return new Struct({ + ...struct, + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + validator(value, ctx) { + if (value === undefined) { + return true; + } + else { + log(value, ctx); + return struct.validator(value, ctx); + } + }, + }); +} +/** + * Create a struct with dynamic validation logic. + * + * The callback will receive the value currently being validated, and must + * return a struct object to validate it with. This can be useful to model + * validation logic that changes based on its input. + */ +function dynamic(fn) { + return new Struct({ + type: 'dynamic', + schema: null, + *entries(value, ctx) { + const struct = fn(value, ctx); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + const struct = fn(value, ctx); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + const struct = fn(value, ctx); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + const struct = fn(value, ctx); + return struct.refiner(value, ctx); + }, + }); +} +/** + * Create a struct with lazily evaluated validation logic. + * + * The first time validation is run with the struct, the callback will be called + * and must return a struct object to use. This is useful for cases where you + * want to have self-referential structs for nested data structures to avoid a + * circular definition problem. + */ +function lazy(fn) { + let struct; + return new Struct({ + type: 'lazy', + schema: null, + *entries(value, ctx) { + struct ?? (struct = fn()); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + struct ?? (struct = fn()); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + struct ?? (struct = fn()); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + struct ?? (struct = fn()); + return struct.refiner(value, ctx); + }, + }); +} +/** + * Create a new struct based on an existing object struct, but excluding + * specific properties. + * + * Like TypeScript's `Omit` utility. + */ +function omit(struct, keys) { + const { schema } = struct; + const subschema = { ...schema }; + for (const key of keys) { + delete subschema[key]; + } + switch (struct.type) { + case 'type': + return type(subschema); + default: + return object(subschema); + } +} +/** + * Create a new struct based on an existing object struct, but with all of its + * properties allowed to be `undefined`. + * + * Like TypeScript's `Partial` utility. + */ +function partial(struct) { + const isStruct = struct instanceof Struct; + const schema = isStruct ? { ...struct.schema } : { ...struct }; + for (const key in schema) { + schema[key] = optional(schema[key]); + } + if (isStruct && struct.type === 'type') { + return type(schema); + } + return object(schema); +} +/** + * Create a new struct based on an existing object struct, but only including + * specific properties. + * + * Like TypeScript's `Pick` utility. + */ +function pick(struct, keys) { + const { schema } = struct; + const subschema = {}; + for (const key of keys) { + subschema[key] = schema[key]; + } + switch (struct.type) { + case 'type': + return type(subschema); + default: + return object(subschema); + } +} +/** + * Define a new struct type with a custom validation function. + * + * @deprecated This function has been renamed to `define`. + */ +function struct(name, validator) { + console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); + return define(name, validator); +} + +/** + * Ensure that any value passes validation. + */ +function any() { + return define('any', () => true); +} +function array(Element) { + return new Struct({ + type: 'array', + schema: Element, + *entries(value) { + if (Element && Array.isArray(value)) { + for (const [i, v] of value.entries()) { + yield [i, v, Element]; + } + } + }, + coercer(value) { + return Array.isArray(value) ? value.slice() : value; + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array value, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a bigint. + */ +function bigint() { + return define('bigint', (value) => { + return typeof value === 'bigint'; + }); +} +/** + * Ensure that a value is a boolean. + */ +function boolean() { + return define('boolean', (value) => { + return typeof value === 'boolean'; + }); +} +/** + * Ensure that a value is a valid `Date`. + * + * Note: this also ensures that the value is *not* an invalid `Date` object, + * which can occur when parsing a date fails but still returns a `Date`. + */ +function date() { + return define('date', (value) => { + return ((value instanceof Date && !isNaN(value.getTime())) || + `Expected a valid \`Date\` object, but received: ${print(value)}`); + }); +} +function enums(values) { + const schema = {}; + const description = values.map((v) => print(v)).join(); + for (const key of values) { + schema[key] = key; + } + return new Struct({ + type: 'enums', + schema, + validator(value) { + return (values.includes(value) || + `Expected one of \`${description}\`, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a function. + */ +function func() { + return define('func', (value) => { + return (typeof value === 'function' || + `Expected a function, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is an instance of a specific class. + */ +function instance(Class) { + return define('instance', (value) => { + return (value instanceof Class || + `Expected a \`${Class.name}\` instance, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is an integer. + */ +function integer() { + return define('integer', (value) => { + return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) || + `Expected an integer, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value matches all of a set of types. + */ +function intersection(Structs) { + return new Struct({ + type: 'intersection', + schema: null, + *entries(value, ctx) { + for (const S of Structs) { + yield* S.entries(value, ctx); + } + }, + *validator(value, ctx) { + for (const S of Structs) { + yield* S.validator(value, ctx); + } + }, + *refiner(value, ctx) { + for (const S of Structs) { + yield* S.refiner(value, ctx); + } + }, + }); +} +function literal(constant) { + const description = print(constant); + const t = typeof constant; + return new Struct({ + type: 'literal', + schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, + validator(value) { + return (value === constant || + `Expected the literal \`${description}\`, but received: ${print(value)}`); + }, + }); +} +function map(Key, Value) { + return new Struct({ + type: 'map', + schema: null, + *entries(value) { + if (Key && Value && value instanceof Map) { + for (const [k, v] of value.entries()) { + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + coercer(value) { + return value instanceof Map ? new Map(value) : value; + }, + validator(value) { + return (value instanceof Map || + `Expected a \`Map\` object, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that no value ever passes validation. + */ +function never() { + return define('never', () => false); +} +/** + * Augment an existing struct to allow `null` values. + */ +function nullable(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === null || struct.validator(value, ctx), + refiner: (value, ctx) => value === null || struct.refiner(value, ctx), + }); +} +/** + * Ensure that a value is a number. + */ +function number() { + return define('number', (value) => { + return ((typeof value === 'number' && !isNaN(value)) || + `Expected a number, but received: ${print(value)}`); + }); +} +function object(schema) { + const knowns = schema ? Object.keys(schema) : []; + const Never = never(); + return new Struct({ + type: 'object', + schema: schema ? schema : null, + *entries(value) { + if (schema && isObject(value)) { + const unknowns = new Set(Object.keys(value)); + for (const key of knowns) { + unknowns.delete(key); + yield [key, value[key], schema[key]]; + } + for (const key of unknowns) { + yield [key, value[key], Never]; + } + } + }, + validator(value) { + return (isNonArrayObject(value) || + `Expected an object, but received: ${print(value)}`); + }, + coercer(value, ctx) { + if (!isNonArrayObject(value)) { + return value; + } + const coerced = { ...value }; + // The `object` struct has special behaviour enabled by the mask flag. + // When masking, properties that are not in the schema are deleted from + // the coerced object instead of eventually failing validaiton. + if (ctx.mask && schema) { + for (const key in coerced) { + if (schema[key] === undefined) { + delete coerced[key]; + } + } + } + return coerced; + }, + }); +} +/** + * Augment a struct to allow `undefined` values. + */ +function optional(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === undefined || struct.validator(value, ctx), + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + }); +} +/** + * Ensure that a value is an object with keys and values of specific types, but + * without ensuring any specific shape of properties. + * + * Like TypeScript's `Record` utility. + */ +function record(Key, Value) { + return new Struct({ + type: 'record', + schema: null, + *entries(value) { + if (isObject(value)) { + for (const k in value) { + const v = value[k]; + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + validator(value) { + return (isNonArrayObject(value) || + `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isNonArrayObject(value) ? { ...value } : value; + }, + }); +} +/** + * Ensure that a value is a `RegExp`. + * + * Note: this does not test the value against the regular expression! For that + * you need to use the `pattern()` refinement. + */ +function regexp() { + return define('regexp', (value) => { + return value instanceof RegExp; + }); +} +function set(Element) { + return new Struct({ + type: 'set', + schema: null, + *entries(value) { + if (Element && value instanceof Set) { + for (const v of value) { + yield [v, v, Element]; + } + } + }, + coercer(value) { + return value instanceof Set ? new Set(value) : value; + }, + validator(value) { + return (value instanceof Set || + `Expected a \`Set\` object, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a string. + */ +function string() { + return define('string', (value) => { + return (typeof value === 'string' || + `Expected a string, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is a tuple of a specific length, and that each of its + * elements is of a specific type. + */ +function tuple(Structs) { + const Never = never(); + return new Struct({ + type: 'tuple', + schema: null, + *entries(value) { + if (Array.isArray(value)) { + const length = Math.max(Structs.length, value.length); + for (let i = 0; i < length; i++) { + yield [i, value[i], Structs[i] || Never]; + } + } + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array, but received: ${print(value)}`); + }, + coercer(value) { + return Array.isArray(value) ? value.slice() : value; + }, + }); +} +/** + * Ensure that a value has a set of known properties of specific types. + * + * Note: Unrecognized properties are allowed and untouched. This is similar to + * how TypeScript's structural typing works. + */ +function type(schema) { + const keys = Object.keys(schema); + return new Struct({ + type: 'type', + schema, + *entries(value) { + if (isObject(value)) { + for (const k of keys) { + yield [k, value[k], schema[k]]; + } + } + }, + validator(value) { + return (isNonArrayObject(value) || + `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isNonArrayObject(value) ? { ...value } : value; + }, + }); +} +/** + * Ensure that a value matches one of a set of types. + */ +function union(Structs) { + const description = Structs.map((s) => s.type).join(' | '); + return new Struct({ + type: 'union', + schema: null, + coercer(value, ctx) { + for (const S of Structs) { + const [error, coerced] = S.validate(value, { + coerce: true, + mask: ctx.mask, + }); + if (!error) { + return coerced; + } + } + return value; + }, + validator(value, ctx) { + const failures = []; + for (const S of Structs) { + const [...tuples] = run(value, S, ctx); + const [first] = tuples; + if (!first[0]) { + return []; + } + else { + for (const [failure] of tuples) { + if (failure) { + failures.push(failure); + } + } + } + } + return [ + `Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, + ...failures, + ]; + }, + }); +} +/** + * Ensure that any value passes validation, without widening its type to `any`. + */ +function unknown() { + return define('unknown', () => true); +} + +/** + * Augment a `Struct` to add an additional coercion step to its input. + * + * This allows you to transform input data before validating it, to increase the + * likelihood that it passes validation—for example for default values, parsing + * different formats, etc. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function coerce(struct, condition, coercer) { + return new Struct({ + ...struct, + coercer: (value, ctx) => { + return is(value, condition) + ? struct.coercer(coercer(value, ctx), ctx) + : struct.coercer(value, ctx); + }, + }); +} +/** + * Augment a struct to replace `undefined` values with a default. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function defaulted(struct, fallback, options = {}) { + return coerce(struct, unknown(), (x) => { + const f = typeof fallback === 'function' ? fallback() : fallback; + if (x === undefined) { + return f; + } + if (!options.strict && isPlainObject(x) && isPlainObject(f)) { + const ret = { ...x }; + let changed = false; + for (const key in f) { + if (ret[key] === undefined) { + ret[key] = f[key]; + changed = true; + } + } + if (changed) { + return ret; + } + } + return x; + }); +} +/** + * Augment a struct to trim string inputs. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function trimmed(struct) { + return coerce(struct, string(), (x) => x.trim()); +} + +/** + * Ensure that a string, array, map, or set is empty. + */ +function empty(struct) { + return refine(struct, 'empty', (value) => { + const size = getSize(value); + return (size === 0 || + `Expected an empty ${struct.type} but received one with a size of \`${size}\``); + }); +} +function getSize(value) { + if (value instanceof Map || value instanceof Set) { + return value.size; + } + else { + return value.length; + } +} +/** + * Ensure that a number or date is below a threshold. + */ +function max(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'max', (value) => { + return exclusive + ? value < threshold + : value <= threshold || + `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); +} +/** + * Ensure that a number or date is above a threshold. + */ +function min(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'min', (value) => { + return exclusive + ? value > threshold + : value >= threshold || + `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); +} +/** + * Ensure that a string, array, map or set is not empty. + */ +function nonempty(struct) { + return refine(struct, 'nonempty', (value) => { + const size = getSize(value); + return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`); + }); +} +/** + * Ensure that a string matches a regular expression. + */ +function pattern(struct, regexp) { + return refine(struct, 'pattern', (value) => { + return (regexp.test(value) || + `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`); + }); +} +/** + * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. + */ +function size(struct, min, max = min) { + const expected = `Expected a ${struct.type}`; + const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; + return refine(struct, 'size', (value) => { + if (typeof value === 'number' || value instanceof Date) { + return ((min <= value && value <= max) || + `${expected} ${of} but received \`${value}\``); + } + else if (value instanceof Map || value instanceof Set) { + const { size } = value; + return ((min <= size && size <= max) || + `${expected} with a size ${of} but received one with a size of \`${size}\``); + } + else { + const { length } = value; + return ((min <= length && length <= max) || + `${expected} with a length ${of} but received one with a length of \`${length}\``); + } + }); +} +/** + * Augment a `Struct` to add an additional refinement to the validation. + * + * The refiner function is guaranteed to receive a value of the struct's type, + * because the struct's existing validation will already have passed. This + * allows you to layer additional validation on top of existing structs. + */ +function refine(struct, name, refiner) { + return new Struct({ + ...struct, + *refiner(value, ctx) { + yield* struct.refiner(value, ctx); + const result = refiner(value, ctx); + const failures = toFailures(result, ctx, struct, value); + for (const failure of failures) { + yield { ...failure, refinement: name }; + } + }, + }); +} + + +//# sourceMappingURL=index.mjs.map + + +/***/ }), + +/***/ 24069: +/*!************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/lru.js ***! + \************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ LruMap: () => (/* binding */ LruMap) +/* harmony export */ }); +/** + * Map with a LRU (Least recently used) policy. + * + * @link https://en.wikipedia.org/wiki/Cache_replacement_policies#LRU + */ +class LruMap extends Map { + constructor(size) { + super(); + Object.defineProperty(this, "maxSize", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.maxSize = size; + } + get(key) { + const value = super.get(key); + if (super.has(key) && value !== undefined) { + this.delete(key); + super.set(key, value); + } + return value; + } + set(key, value) { + super.set(key, value); + if (this.maxSize && this.size > this.maxSize) { + const firstKey = this.keys().next().value; + if (firstKey) + this.delete(firstKey); + } + return this; + } +} +//# sourceMappingURL=lru.js.map + +/***/ }), + +/***/ 24092: +/*!*********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/transaction.js ***! + \*********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ FeeConflictError: () => (/* binding */ FeeConflictError), +/* harmony export */ InvalidLegacyVError: () => (/* binding */ InvalidLegacyVError), +/* harmony export */ InvalidSerializableTransactionError: () => (/* binding */ InvalidSerializableTransactionError), +/* harmony export */ InvalidSerializedTransactionError: () => (/* binding */ InvalidSerializedTransactionError), +/* harmony export */ InvalidSerializedTransactionTypeError: () => (/* binding */ InvalidSerializedTransactionTypeError), +/* harmony export */ InvalidStorageKeySizeError: () => (/* binding */ InvalidStorageKeySizeError), +/* harmony export */ TransactionExecutionError: () => (/* binding */ TransactionExecutionError), +/* harmony export */ TransactionNotFoundError: () => (/* binding */ TransactionNotFoundError), +/* harmony export */ TransactionReceiptNotFoundError: () => (/* binding */ TransactionReceiptNotFoundError), +/* harmony export */ TransactionReceiptRevertedError: () => (/* binding */ TransactionReceiptRevertedError), +/* harmony export */ WaitForTransactionReceiptTimeoutError: () => (/* binding */ WaitForTransactionReceiptTimeoutError), +/* harmony export */ prettyPrint: () => (/* binding */ prettyPrint) +/* harmony export */ }); +/* harmony import */ var _utils_unit_formatEther_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/unit/formatEther.js */ 14962); +/* harmony import */ var _utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/unit/formatGwei.js */ 81764); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base.js */ 87035); + + + +function prettyPrint(args) { + const entries = Object.entries(args) + .map(([key, value]) => { + if (value === undefined || value === false) + return null; + return [key, value]; + }) + .filter(Boolean); + const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0); + return entries + .map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`) + .join('\n'); +} +class FeeConflictError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor() { + super([ + 'Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.', + 'Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others.', + ].join('\n'), { name: 'FeeConflictError' }); + } +} +class InvalidLegacyVError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ v }) { + super(`Invalid \`v\` value "${v}". Expected 27 or 28.`, { + name: 'InvalidLegacyVError', + }); + } +} +class InvalidSerializableTransactionError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ transaction }) { + super('Cannot infer a transaction type from provided transaction.', { + metaMessages: [ + 'Provided Transaction:', + '{', + prettyPrint(transaction), + '}', + '', + 'To infer the type, either provide:', + '- a `type` to the Transaction, or', + '- an EIP-1559 Transaction with `maxFeePerGas`, or', + '- an EIP-2930 Transaction with `gasPrice` & `accessList`, or', + '- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or', + '- an EIP-7702 Transaction with `authorizationList`, or', + '- a Legacy Transaction with `gasPrice`', + ], + name: 'InvalidSerializableTransactionError', + }); + } +} +class InvalidSerializedTransactionTypeError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ serializedType }) { + super(`Serialized transaction type "${serializedType}" is invalid.`, { + name: 'InvalidSerializedTransactionType', + }); + Object.defineProperty(this, "serializedType", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.serializedType = serializedType; + } +} +class InvalidSerializedTransactionError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ attributes, serializedTransaction, type, }) { + const missing = Object.entries(attributes) + .map(([key, value]) => (typeof value === 'undefined' ? key : undefined)) + .filter(Boolean); + super(`Invalid serialized transaction of type "${type}" was provided.`, { + metaMessages: [ + `Serialized Transaction: "${serializedTransaction}"`, + missing.length > 0 ? `Missing Attributes: ${missing.join(', ')}` : '', + ].filter(Boolean), + name: 'InvalidSerializedTransactionError', + }); + Object.defineProperty(this, "serializedTransaction", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "type", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.serializedTransaction = serializedTransaction; + this.type = type; + } +} +class InvalidStorageKeySizeError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ storageKey }) { + super(`Size for storage key "${storageKey}" is invalid. Expected 32 bytes. Got ${Math.floor((storageKey.length - 2) / 2)} bytes.`, { name: 'InvalidStorageKeySizeError' }); + } +} +class TransactionExecutionError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(cause, { account, docsPath, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, }) { + const prettyArgs = prettyPrint({ + chain: chain && `${chain?.name} (id: ${chain?.id})`, + from: account?.address, + to, + value: typeof value !== 'undefined' && + `${(0,_utils_unit_formatEther_js__WEBPACK_IMPORTED_MODULE_0__.formatEther)(value)} ${chain?.nativeCurrency?.symbol || 'ETH'}`, + data, + gas, + gasPrice: typeof gasPrice !== 'undefined' && `${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_1__.formatGwei)(gasPrice)} gwei`, + maxFeePerGas: typeof maxFeePerGas !== 'undefined' && + `${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_1__.formatGwei)(maxFeePerGas)} gwei`, + maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== 'undefined' && + `${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_1__.formatGwei)(maxPriorityFeePerGas)} gwei`, + nonce, + }); + super(cause.shortMessage, { + cause, + docsPath, + metaMessages: [ + ...(cause.metaMessages ? [...cause.metaMessages, ' '] : []), + 'Request Arguments:', + prettyArgs, + ].filter(Boolean), + name: 'TransactionExecutionError', + }); + Object.defineProperty(this, "cause", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.cause = cause; + } +} +class TransactionNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ blockHash, blockNumber, blockTag, hash, index, }) { + let identifier = 'Transaction'; + if (blockTag && index !== undefined) + identifier = `Transaction at block time "${blockTag}" at index "${index}"`; + if (blockHash && index !== undefined) + identifier = `Transaction at block hash "${blockHash}" at index "${index}"`; + if (blockNumber && index !== undefined) + identifier = `Transaction at block number "${blockNumber}" at index "${index}"`; + if (hash) + identifier = `Transaction with hash "${hash}"`; + super(`${identifier} could not be found.`, { + name: 'TransactionNotFoundError', + }); + } +} +class TransactionReceiptNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ hash }) { + super(`Transaction receipt with hash "${hash}" could not be found. The Transaction may not be processed on a block yet.`, { + name: 'TransactionReceiptNotFoundError', + }); + } +} +class TransactionReceiptRevertedError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ receipt }) { + super(`Transaction with hash "${receipt.transactionHash}" reverted.`, { + metaMessages: [ + 'The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.', + ' ', + 'You can attempt to extract the revert reason by:', + '- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract', + '- using the `call` Action with raw `data`', + ], + name: 'TransactionReceiptRevertedError', + }); + Object.defineProperty(this, "receipt", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.receipt = receipt; + } +} +class WaitForTransactionReceiptTimeoutError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ hash }) { + super(`Timed out while waiting for transaction with hash "${hash}" to be confirmed.`, { name: 'WaitForTransactionReceiptTimeoutError' }); + } +} +//# sourceMappingURL=transaction.js.map + +/***/ }), + +/***/ 24568: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/lazy-helpers.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DelayedConstructor: () => (/* binding */ DelayedConstructor), +/* harmony export */ delay: () => (/* binding */ delay) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 55334); + +var DelayedConstructor = (function () { + function DelayedConstructor(wrap) { + this.wrap = wrap; + this.reflectMethods = [ + "get", + "getPrototypeOf", + "setPrototypeOf", + "getOwnPropertyDescriptor", + "defineProperty", + "has", + "set", + "deleteProperty", + "apply", + "construct", + "ownKeys" + ]; + } + DelayedConstructor.prototype.createProxy = function (createObject) { + var _this = this; + var target = {}; + var init = false; + var value; + var delayedObject = function () { + if (!init) { + value = createObject(_this.wrap()); + init = true; + } + return value; + }; + return new Proxy(target, this.createHandler(delayedObject)); + }; + DelayedConstructor.prototype.createHandler = function (delayedObject) { + var handler = {}; + var install = function (name) { + handler[name] = function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + args[0] = delayedObject(); + var method = Reflect[name]; + return method.apply(void 0, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)(args)); + }; + }; + this.reflectMethods.forEach(install); + return handler; + }; + return DelayedConstructor; +}()); + +function delay(wrappedConstructor) { + if (typeof wrappedConstructor === "undefined") { + throw new Error("Attempt to `delay` undefined. Constructor must be wrapped in a callback"); + } + return new DelayedConstructor(wrappedConstructor); +} + + +/***/ }), + +/***/ 25344: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/isarray@2.0.5/node_modules/isarray/index.js ***! + \*************************************************************************/ +/***/ ((module) => { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ 25471: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/enveloped_data.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ EnvelopedData: () => (/* binding */ EnvelopedData), +/* harmony export */ UnprotectedAttributes: () => (/* binding */ UnprotectedAttributes) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types.js */ 96729); +/* harmony import */ var _attribute_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./attribute.js */ 51496); +/* harmony import */ var _recipient_infos_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./recipient_infos.js */ 71457); +/* harmony import */ var _originator_info_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./originator_info.js */ 43735); +/* harmony import */ var _encrypted_content_info_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./encrypted_content_info.js */ 76113); +var UnprotectedAttributes_1; + + + + + + + +let UnprotectedAttributes = UnprotectedAttributes_1 = class UnprotectedAttributes extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, UnprotectedAttributes_1.prototype); + } +}; +UnprotectedAttributes = UnprotectedAttributes_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set, itemType: _attribute_js__WEBPACK_IMPORTED_MODULE_3__.Attribute, + }) +], UnprotectedAttributes); + +class EnvelopedData { + version = _types_js__WEBPACK_IMPORTED_MODULE_2__.CMSVersion.v0; + originatorInfo; + recipientInfos = new _recipient_infos_js__WEBPACK_IMPORTED_MODULE_4__.RecipientInfos(); + encryptedContentInfo = new _encrypted_content_info_js__WEBPACK_IMPORTED_MODULE_6__.EncryptedContentInfo(); + unprotectedAttrs; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], EnvelopedData.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _originator_info_js__WEBPACK_IMPORTED_MODULE_5__.OriginatorInfo, context: 0, implicit: true, optional: true, + }) +], EnvelopedData.prototype, "originatorInfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _recipient_infos_js__WEBPACK_IMPORTED_MODULE_4__.RecipientInfos }) +], EnvelopedData.prototype, "recipientInfos", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _encrypted_content_info_js__WEBPACK_IMPORTED_MODULE_6__.EncryptedContentInfo }) +], EnvelopedData.prototype, "encryptedContentInfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: UnprotectedAttributes, context: 1, implicit: true, optional: true, + }) +], EnvelopedData.prototype, "unprotectedAttrs", void 0); + + +/***/ }), + +/***/ 25878: +/*!***********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/hash/keccak256.js ***! + \***********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ keccak256: () => (/* binding */ keccak256) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha3 */ 52114); +/* harmony import */ var _data_isHex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/isHex.js */ 76816); +/* harmony import */ var _encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/toBytes.js */ 58548); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); + + + + +function keccak256(value, to_) { + const to = to_ || 'hex'; + const bytes = (0,_noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_0__.keccak_256)((0,_data_isHex_js__WEBPACK_IMPORTED_MODULE_1__.isHex)(value, { strict: false }) ? (0,_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_2__.toBytes)(value) : value); + if (to === 'bytes') + return bytes; + return (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.toHex)(bytes); +} +//# sourceMappingURL=keccak256.js.map + +/***/ }), + +/***/ 25894: +/*!******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/role_syntax.js ***! + \******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ RoleSyntax: () => (/* binding */ RoleSyntax) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class RoleSyntax { + roleAuthority; + roleName; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralNames, implicit: true, context: 0, optional: true, + }) +], RoleSyntax.prototype, "roleAuthority", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName, implicit: true, context: 1, + }) +], RoleSyntax.prototype, "roleName", void 0); + + +/***/ }), + +/***/ 26275: +/*!*********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/attribute_certificate_info.js ***! + \*********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AttCertVersion: () => (/* binding */ AttCertVersion), +/* harmony export */ AttributeCertificateInfo: () => (/* binding */ AttributeCertificateInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _holder_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./holder.js */ 2572); +/* harmony import */ var _attr_cert_issuer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./attr_cert_issuer.js */ 90158); +/* harmony import */ var _attr_cert_validity_period_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./attr_cert_validity_period.js */ 84431); + + + + + + +var AttCertVersion; +(function (AttCertVersion) { + AttCertVersion[AttCertVersion["v2"] = 1] = "v2"; +})(AttCertVersion || (AttCertVersion = {})); +class AttributeCertificateInfo { + version = AttCertVersion.v2; + holder = new _holder_js__WEBPACK_IMPORTED_MODULE_3__.Holder(); + issuer = new _attr_cert_issuer_js__WEBPACK_IMPORTED_MODULE_4__.AttCertIssuer(); + signature = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + serialNumber = new ArrayBuffer(0); + attrCertValidityPeriod = new _attr_cert_validity_period_js__WEBPACK_IMPORTED_MODULE_5__.AttCertValidityPeriod(); + attributes = []; + issuerUniqueID; + extensions; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], AttributeCertificateInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _holder_js__WEBPACK_IMPORTED_MODULE_3__.Holder }) +], AttributeCertificateInfo.prototype, "holder", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _attr_cert_issuer_js__WEBPACK_IMPORTED_MODULE_4__.AttCertIssuer }) +], AttributeCertificateInfo.prototype, "issuer", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], AttributeCertificateInfo.prototype, "signature", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], AttributeCertificateInfo.prototype, "serialNumber", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _attr_cert_validity_period_js__WEBPACK_IMPORTED_MODULE_5__.AttCertValidityPeriod }) +], AttributeCertificateInfo.prototype, "attrCertValidityPeriod", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Attribute, repeated: "sequence", + }) +], AttributeCertificateInfo.prototype, "attributes", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString, optional: true, + }) +], AttributeCertificateInfo.prototype, "issuerUniqueID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Extensions, optional: true, + }) +], AttributeCertificateInfo.prototype, "extensions", void 0); + + +/***/ }), + +/***/ 26320: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/ip_converter.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IpConverter: () => (/* binding */ IpConverter) +/* harmony export */ }); +/* harmony import */ var _peculiar_utils_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/utils/encoding */ 45906); + +class IpConverter { + static isIPv4(ip) { + return /^(\d{1,3}\.){3}\d{1,3}$/.test(ip); + } + static parseIPv4(ip) { + const parts = ip.split("."); + if (parts.length !== 4) { + throw new Error("Invalid IPv4 address"); + } + return parts.map((part) => { + const num = parseInt(part, 10); + if (isNaN(num) || num < 0 || num > 255) { + throw new Error("Invalid IPv4 address part"); + } + return num; + }); + } + static parseIPv6(ip) { + const expandedIP = this.expandIPv6(ip); + const parts = expandedIP.split(":"); + if (parts.length !== 8) { + throw new Error("Invalid IPv6 address"); + } + return parts.reduce((bytes, part) => { + const num = parseInt(part, 16); + if (isNaN(num) || num < 0 || num > 0xffff) { + throw new Error("Invalid IPv6 address part"); + } + bytes.push((num >> 8) & 0xff); + bytes.push(num & 0xff); + return bytes; + }, []); + } + static expandIPv6(ip) { + if (!ip.includes("::")) { + return ip; + } + const parts = ip.split("::"); + if (parts.length > 2) { + throw new Error("Invalid IPv6 address"); + } + const left = parts[0] ? parts[0].split(":") : []; + const right = parts[1] ? parts[1].split(":") : []; + const missing = 8 - (left.length + right.length); + if (missing < 0) { + throw new Error("Invalid IPv6 address"); + } + return [...left, ...Array(missing).fill("0"), ...right].join(":"); + } + static formatIPv6(bytes) { + const parts = []; + for (let i = 0; i < 16; i += 2) { + parts.push(((bytes[i] << 8) | bytes[i + 1]).toString(16)); + } + return this.compressIPv6(parts.join(":")); + } + static compressIPv6(ip) { + const parts = ip.split(":"); + let longestZeroStart = -1; + let longestZeroLength = 0; + let currentZeroStart = -1; + let currentZeroLength = 0; + for (let i = 0; i < parts.length; i++) { + if (parts[i] === "0") { + if (currentZeroStart === -1) { + currentZeroStart = i; + } + currentZeroLength++; + } + else { + if (currentZeroLength > longestZeroLength) { + longestZeroStart = currentZeroStart; + longestZeroLength = currentZeroLength; + } + currentZeroStart = -1; + currentZeroLength = 0; + } + } + if (currentZeroLength > longestZeroLength) { + longestZeroStart = currentZeroStart; + longestZeroLength = currentZeroLength; + } + if (longestZeroLength > 1) { + const before = parts.slice(0, longestZeroStart).join(":"); + const after = parts.slice(longestZeroStart + longestZeroLength).join(":"); + return `${before}::${after}`; + } + return ip; + } + static parseCIDR(text) { + const [addr, prefixStr] = text.split("/"); + const prefix = parseInt(prefixStr, 10); + if (this.isIPv4(addr)) { + if (prefix < 0 || prefix > 32) { + throw new Error("Invalid IPv4 prefix length"); + } + return [this.parseIPv4(addr), prefix]; + } + else { + if (prefix < 0 || prefix > 128) { + throw new Error("Invalid IPv6 prefix length"); + } + return [this.parseIPv6(addr), prefix]; + } + } + static decodeIP(value) { + if (value.length === 64 && parseInt(value, 16) === 0) { + return "::/0"; + } + if (value.length !== 16) { + return value; + } + const mask = parseInt(value.slice(8), 16) + .toString(2) + .split("") + .reduce((a, k) => a + +k, 0); + let ip = value.slice(0, 8).replace(/(.{2})/g, (match) => `${parseInt(match, 16)}.`); + ip = ip.slice(0, -1); + return `${ip}/${mask}`; + } + static toString(buf) { + const uint8 = new Uint8Array(buf); + if (uint8.length === 4) { + return Array.from(uint8).join("."); + } + if (uint8.length === 16) { + return this.formatIPv6(uint8); + } + if (uint8.length === 8 || uint8.length === 32) { + const half = uint8.length / 2; + const addrBytes = uint8.slice(0, half); + const maskBytes = uint8.slice(half); + const isAllZeros = uint8.every((byte) => byte === 0); + if (isAllZeros) { + return uint8.length === 8 ? "0.0.0.0/0" : "::/0"; + } + const prefixLen = maskBytes.reduce((a, b) => a + (b.toString(2).match(/1/g) || []).length, 0); + if (uint8.length === 8) { + const addrStr = Array.from(addrBytes).join("."); + return `${addrStr}/${prefixLen}`; + } + else { + const addrStr = this.formatIPv6(addrBytes); + return `${addrStr}/${prefixLen}`; + } + } + return this.decodeIP(_peculiar_utils_encoding__WEBPACK_IMPORTED_MODULE_0__.hex.encode(buf)); + } + static fromString(text) { + if (text.includes("/")) { + const [addr, prefix] = this.parseCIDR(text); + const maskBytes = new Uint8Array(addr.length); + let bitsLeft = prefix; + for (let i = 0; i < maskBytes.length; i++) { + if (bitsLeft >= 8) { + maskBytes[i] = 0xff; + bitsLeft -= 8; + } + else if (bitsLeft > 0) { + maskBytes[i] = 0xff << (8 - bitsLeft); + bitsLeft = 0; + } + } + const out = new Uint8Array(addr.length * 2); + out.set(addr, 0); + out.set(maskBytes, addr.length); + return out.buffer; + } + const bytes = this.isIPv4(text) ? this.parseIPv4(text) : this.parseIPv6(text); + return new Uint8Array(bytes).buffer; + } +} + + +/***/ }), + +/***/ 26850: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/inject.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _reflection_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reflection-helpers */ 90635); + +function inject(token, options) { + var data = { + token: token, + multiple: false, + isOptional: options && options.isOptional + }; + return (0,_reflection_helpers__WEBPACK_IMPORTED_MODULE_0__.defineInjectionTokenMetadata)(data); +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (inject); + + +/***/ }), + +/***/ 26859: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/safe-buffer@5.2.1/node_modules/safe-buffer/index.js ***! + \*********************************************************************************/ +/***/ ((module, exports, __webpack_require__) => { + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(/*! buffer */ 62266) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 26948: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/index.js ***! + \*********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var bind = __webpack_require__(/*! function-bind */ 94867); +var $TypeError = __webpack_require__(/*! es-errors/type */ 41623); + +var $call = __webpack_require__(/*! ./functionCall */ 57522); +var $actualApply = __webpack_require__(/*! ./actualApply */ 57846); + +/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ +module.exports = function callBindBasic(args) { + if (args.length < 1 || typeof args[0] !== 'function') { + throw new $TypeError('a function is required'); + } + return $actualApply(bind, $call, args); +}; + + +/***/ }), + +/***/ 27019: +/*!***********************************************************************!*\ + !*** ../node_modules/.pnpm/bn.js@4.12.5/node_modules/bn.js/lib/bn.js ***! + \***********************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ 28703).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [ number & 0x3ffffff ]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [ 0 ]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this.strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // 'A' - 'F' + if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + // '0' - '9' + } else { + return (c - 48) & 0xf; + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this.strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + r += c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + r += c - 17 + 0xa; + + // '0' - '9' + } else { + r += c; + } + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [ 0 ]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this.strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype.strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + BN.prototype.inspect = function inspect () { + return (this.red ? ''; + }; + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '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' + ]; + + var groupSizes = [ + 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 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16); + }; + + BN.prototype.toBuffer = function toBuffer (endian, length) { + assert(typeof Buffer !== 'undefined'); + return this.toArrayLike(Buffer, endian, length); + }; + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + this.strip(); + var littleEndian = endian === 'le'; + var res = new ArrayType(reqLength); + + var b, i; + var q = this.clone(); + if (!littleEndian) { + // Assume big-endian + for (i = 0; i < reqLength - byteLength; i++) { + res[i] = 0; + } + + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[reqLength - i - 1] = b; + } + } else { + for (i = 0; !q.isZero(); i++) { + b = q.andln(0xff); + q.iushrn(8); + + res[i] = b; + } + + for (; i < reqLength; i++) { + res[i] = 0; + } + } + + return res; + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] & (1 << wbit)) >>> wbit; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this.strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this.strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this.strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + i++; + } + + // Clear words above the requested width so the result stays below 2 ** width + for (; i < this.length; i++) { + this.words[i] = 0; + } + + // And remove leading zeroes + return this.strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this.strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this.strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out.strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out.strip(); + } + + function jumboMulTo (self, num, out) { + var fftm = new FFTM(); + return fftm.mulp(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out.strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + if (num === 0) { + this.length = 1; + this._normSign(); + } + + return this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this.strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this.strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) < num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this.strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this.strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this.strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q.strip(); + } + a.strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.mod.abs(); + + var half = num.abs().iushrn(1); + var r2 = num.words[0] & 1; + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div; + + // Round up, away from zero + var up = new BN(1); + up.negative = this.negative ^ num.negative; + return dm.div.iadd(up); + }; + + BN.prototype.modn = function modn (num) { + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return acc; + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + return this.strip(); + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this.strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is BN v4 instance + r.strip(); + } else { + // r is BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + return a.umod(this.m)._forceRed(this); + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(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); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 27028: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/content_info.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ContentInfo: () => (/* binding */ ContentInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +class ContentInfo { + contentType = ""; + content = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], ContentInfo.prototype, "contentType", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, context: 0, + }) +], ContentInfo.prototype, "content", void 0); + + +/***/ }), + +/***/ 27152: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/utils.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); +var inherits = __webpack_require__(/*! inherits */ 18628); + +exports.inherits = inherits; + +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) { + return false; + } + if (i < 0 || i + 1 >= msg.length) { + return false; + } + return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00; +} + +function toArray(msg, enc) { + if (Array.isArray(msg)) + return msg.slice(); + if (!msg) + return []; + var res = []; + if (typeof msg === 'string') { + if (!enc) { + // Inspired by stringToUtf8ByteArray() in closure-library by Google + // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143 + // Apache License 2.0 + // https://github.com/google/closure-library/blob/master/LICENSE + var p = 0; + for (var i = 0; i < msg.length; i++) { + var c = msg.charCodeAt(i); + if (c < 128) { + res[p++] = c; + } else if (c < 2048) { + res[p++] = (c >> 6) | 192; + res[p++] = (c & 63) | 128; + } else if (isSurrogatePair(msg, i)) { + c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF); + res[p++] = (c >> 18) | 240; + res[p++] = ((c >> 12) & 63) | 128; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } else { + res[p++] = (c >> 12) | 224; + res[p++] = ((c >> 6) & 63) | 128; + res[p++] = (c & 63) | 128; + } + } + } else if (enc === 'hex') { + msg = msg.replace(/[^a-z0-9]+/ig, ''); + if (msg.length % 2 !== 0) + msg = '0' + msg; + for (i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); + } + } else { + for (i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; + } + return res; +} +exports.toArray = toArray; + +function toHex(msg) { + var res = ''; + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); + return res; +} +exports.toHex = toHex; + +function htonl(w) { + var res = (w >>> 24) | + ((w >>> 8) & 0xff00) | + ((w << 8) & 0xff0000) | + ((w & 0xff) << 24); + return res >>> 0; +} +exports.htonl = htonl; + +function toHex32(msg, endian) { + var res = ''; + for (var i = 0; i < msg.length; i++) { + var w = msg[i]; + if (endian === 'little') + w = htonl(w); + res += zero8(w.toString(16)); + } + return res; +} +exports.toHex32 = toHex32; + +function zero2(word) { + if (word.length === 1) + return '0' + word; + else + return word; +} +exports.zero2 = zero2; + +function zero8(word) { + if (word.length === 7) + return '0' + word; + else if (word.length === 6) + return '00' + word; + else if (word.length === 5) + return '000' + word; + else if (word.length === 4) + return '0000' + word; + else if (word.length === 3) + return '00000' + word; + else if (word.length === 2) + return '000000' + word; + else if (word.length === 1) + return '0000000' + word; + else + return word; +} +exports.zero8 = zero8; + +function join32(msg, start, end, endian) { + var len = end - start; + assert(len % 4 === 0); + var res = new Array(len / 4); + for (var i = 0, k = start; i < res.length; i++, k += 4) { + var w; + if (endian === 'big') + w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3]; + else + w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k]; + res[i] = w >>> 0; + } + return res; +} +exports.join32 = join32; + +function split32(msg, endian) { + var res = new Array(msg.length * 4); + for (var i = 0, k = 0; i < msg.length; i++, k += 4) { + var m = msg[i]; + if (endian === 'big') { + res[k] = m >>> 24; + res[k + 1] = (m >>> 16) & 0xff; + res[k + 2] = (m >>> 8) & 0xff; + res[k + 3] = m & 0xff; + } else { + res[k + 3] = m >>> 24; + res[k + 2] = (m >>> 16) & 0xff; + res[k + 1] = (m >>> 8) & 0xff; + res[k] = m & 0xff; + } + } + return res; +} +exports.split32 = split32; + +function rotr32(w, b) { + return (w >>> b) | (w << (32 - b)); +} +exports.rotr32 = rotr32; + +function rotl32(w, b) { + return (w << b) | (w >>> (32 - b)); +} +exports.rotl32 = rotl32; + +function sum32(a, b) { + return (a + b) >>> 0; +} +exports.sum32 = sum32; + +function sum32_3(a, b, c) { + return (a + b + c) >>> 0; +} +exports.sum32_3 = sum32_3; + +function sum32_4(a, b, c, d) { + return (a + b + c + d) >>> 0; +} +exports.sum32_4 = sum32_4; + +function sum32_5(a, b, c, d, e) { + return (a + b + c + d + e) >>> 0; +} +exports.sum32_5 = sum32_5; + +function sum64(buf, pos, ah, al) { + var bh = buf[pos]; + var bl = buf[pos + 1]; + + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + buf[pos] = hi >>> 0; + buf[pos + 1] = lo; +} +exports.sum64 = sum64; + +function sum64_hi(ah, al, bh, bl) { + var lo = (al + bl) >>> 0; + var hi = (lo < al ? 1 : 0) + ah + bh; + return hi >>> 0; +} +exports.sum64_hi = sum64_hi; + +function sum64_lo(ah, al, bh, bl) { + var lo = al + bl; + return lo >>> 0; +} +exports.sum64_lo = sum64_lo; + +function sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + + var hi = ah + bh + ch + dh + carry; + return hi >>> 0; +} +exports.sum64_4_hi = sum64_4_hi; + +function sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) { + var lo = al + bl + cl + dl; + return lo >>> 0; +} +exports.sum64_4_lo = sum64_4_lo; + +function sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var carry = 0; + var lo = al; + lo = (lo + bl) >>> 0; + carry += lo < al ? 1 : 0; + lo = (lo + cl) >>> 0; + carry += lo < cl ? 1 : 0; + lo = (lo + dl) >>> 0; + carry += lo < dl ? 1 : 0; + lo = (lo + el) >>> 0; + carry += lo < el ? 1 : 0; + + var hi = ah + bh + ch + dh + eh + carry; + return hi >>> 0; +} +exports.sum64_5_hi = sum64_5_hi; + +function sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) { + var lo = al + bl + cl + dl + el; + + return lo >>> 0; +} +exports.sum64_5_lo = sum64_5_lo; + +function rotr64_hi(ah, al, num) { + var r = (al << (32 - num)) | (ah >>> num); + return r >>> 0; +} +exports.rotr64_hi = rotr64_hi; + +function rotr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.rotr64_lo = rotr64_lo; + +function shr64_hi(ah, al, num) { + return ah >>> num; +} +exports.shr64_hi = shr64_hi; + +function shr64_lo(ah, al, num) { + var r = (ah << (32 - num)) | (al >>> num); + return r >>> 0; +} +exports.shr64_lo = shr64_lo; + + +/***/ }), + +/***/ 27410: +/*!********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/objects.js ***! + \********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnArray: () => (/* binding */ AsnArray) +/* harmony export */ }); +class AsnArray extends Array { + constructor(items = []) { + if (typeof items === "number") { + super(items); + } + else { + super(); + for (const item of items) { + this.push(item); + } + } + } +} + + +/***/ }), + +/***/ 27458: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/node.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ExecutionRevertedError: () => (/* binding */ ExecutionRevertedError), +/* harmony export */ FeeCapTooHighError: () => (/* binding */ FeeCapTooHighError), +/* harmony export */ FeeCapTooLowError: () => (/* binding */ FeeCapTooLowError), +/* harmony export */ InsufficientFundsError: () => (/* binding */ InsufficientFundsError), +/* harmony export */ IntrinsicGasTooHighError: () => (/* binding */ IntrinsicGasTooHighError), +/* harmony export */ IntrinsicGasTooLowError: () => (/* binding */ IntrinsicGasTooLowError), +/* harmony export */ NonceMaxValueError: () => (/* binding */ NonceMaxValueError), +/* harmony export */ NonceTooHighError: () => (/* binding */ NonceTooHighError), +/* harmony export */ NonceTooLowError: () => (/* binding */ NonceTooLowError), +/* harmony export */ TipAboveFeeCapError: () => (/* binding */ TipAboveFeeCapError), +/* harmony export */ TransactionTypeNotSupportedError: () => (/* binding */ TransactionTypeNotSupportedError), +/* harmony export */ UnknownNodeError: () => (/* binding */ UnknownNodeError) +/* harmony export */ }); +/* harmony import */ var _utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/unit/formatGwei.js */ 81764); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ 87035); + + +class ExecutionRevertedError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, message, } = {}) { + const reason = message + ?.replace('execution reverted: ', '') + ?.replace('execution reverted', ''); + super(`Execution reverted ${reason ? `with reason: ${reason}` : 'for an unknown reason'}.`, { + cause, + name: 'ExecutionRevertedError', + }); + } +} +Object.defineProperty(ExecutionRevertedError, "code", { + enumerable: true, + configurable: true, + writable: true, + value: 3 +}); +Object.defineProperty(ExecutionRevertedError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /execution reverted|gas required exceeds allowance/ +}); +class FeeCapTooHighError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, maxFeePerGas, } = {}) { + super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_0__.formatGwei)(maxFeePerGas)} gwei` : ''}) cannot be higher than the maximum allowed value (2^256-1).`, { + cause, + name: 'FeeCapTooHighError', + }); + } +} +Object.defineProperty(FeeCapTooHighError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/ +}); +class FeeCapTooLowError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, maxFeePerGas, } = {}) { + super(`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_0__.formatGwei)(maxFeePerGas)}` : ''} gwei) cannot be lower than the block base fee.`, { + cause, + name: 'FeeCapTooLowError', + }); + } +} +Object.defineProperty(FeeCapTooLowError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/ +}); +class NonceTooHighError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, nonce, } = {}) { + super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is higher than the next one expected.`, { cause, name: 'NonceTooHighError' }); + } +} +Object.defineProperty(NonceTooHighError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /nonce too high/ +}); +class NonceTooLowError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, nonce, } = {}) { + super([ + `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}is lower than the current nonce of the account.`, + 'Try increasing the nonce or find the latest nonce with `getTransactionCount`.', + ].join('\n'), { cause, name: 'NonceTooLowError' }); + } +} +Object.defineProperty(NonceTooLowError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /nonce too low|transaction already imported|already known/ +}); +class NonceMaxValueError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, nonce, } = {}) { + super(`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ''}exceeds the maximum allowed nonce.`, { cause, name: 'NonceMaxValueError' }); + } +} +Object.defineProperty(NonceMaxValueError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /nonce has max value/ +}); +class InsufficientFundsError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause } = {}) { + super([ + 'The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.', + ].join('\n'), { + cause, + metaMessages: [ + 'This error could arise when the account does not have enough funds to:', + ' - pay for the total gas fee,', + ' - pay for the value to send.', + ' ', + 'The cost of the transaction is calculated as `gas * gas fee + value`, where:', + ' - `gas` is the amount of gas needed for transaction to execute,', + ' - `gas fee` is the gas fee,', + ' - `value` is the amount of ether to send to the recipient.', + ], + name: 'InsufficientFundsError', + }); + } +} +Object.defineProperty(InsufficientFundsError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /insufficient funds|exceeds transaction sender account balance/ +}); +class IntrinsicGasTooHighError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, gas, } = {}) { + super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction exceeds the limit allowed for the block.`, { + cause, + name: 'IntrinsicGasTooHighError', + }); + } +} +Object.defineProperty(IntrinsicGasTooHighError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /intrinsic gas too high|gas limit reached/ +}); +class IntrinsicGasTooLowError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, gas, } = {}) { + super(`The amount of gas ${gas ? `(${gas}) ` : ''}provided for the transaction is too low.`, { + cause, + name: 'IntrinsicGasTooLowError', + }); + } +} +Object.defineProperty(IntrinsicGasTooLowError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /intrinsic gas too low/ +}); +class TransactionTypeNotSupportedError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause }) { + super('The transaction type is not supported for this chain.', { + cause, + name: 'TransactionTypeNotSupportedError', + }); + } +} +Object.defineProperty(TransactionTypeNotSupportedError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /transaction type not valid/ +}); +class TipAboveFeeCapError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause, maxPriorityFeePerGas, maxFeePerGas, } = {}) { + super([ + `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas + ? ` = ${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_0__.formatGwei)(maxPriorityFeePerGas)} gwei` + : ''}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${(0,_utils_unit_formatGwei_js__WEBPACK_IMPORTED_MODULE_0__.formatGwei)(maxFeePerGas)} gwei` : ''}).`, + ].join('\n'), { + cause, + name: 'TipAboveFeeCapError', + }); + } +} +Object.defineProperty(TipAboveFeeCapError, "nodeMessage", { + enumerable: true, + configurable: true, + writable: true, + value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/ +}); +class UnknownNodeError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ cause }) { + super(`An error occurred while executing: ${cause?.shortMessage}`, { + cause, + name: 'UnknownNodeError', + }); + } +} +//# sourceMappingURL=node.js.map + +/***/ }), + +/***/ 27548: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/borsh@2.0.0/node_modules/borsh/lib/esm/index.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ deserialize: () => (/* binding */ deserialize), +/* harmony export */ serialize: () => (/* binding */ serialize) +/* harmony export */ }); +/* harmony import */ var _serialize_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./serialize.js */ 98838); +/* harmony import */ var _deserialize_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./deserialize.js */ 52443); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ 95637); + + + +function serialize(schema, value, validate) { + if (validate === void 0) { validate = true; } + if (validate) + _utils_js__WEBPACK_IMPORTED_MODULE_2__.validate_schema(schema); + var serializer = new _serialize_js__WEBPACK_IMPORTED_MODULE_0__.BorshSerializer(validate); + return serializer.encode(value, schema); +} +function deserialize(schema, buffer, validate) { + if (validate === void 0) { validate = true; } + if (validate) + _utils_js__WEBPACK_IMPORTED_MODULE_2__.validate_schema(schema); + var deserializer = new _deserialize_js__WEBPACK_IMPORTED_MODULE_1__.BorshDeserializer(buffer); + return deserializer.decode(schema); +} + + +/***/ }), + +/***/ 27709: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/pow.js ***! + \***************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./pow')} */ +module.exports = Math.pow; + + +/***/ }), + +/***/ 27727: +/*!*************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js ***! + \*************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ X25519: () => (/* binding */ X25519) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); + +const ALG_NAME = "X25519"; +// deno-fmt-ignore +const PKCS8_ALG_ID_X25519 = new Uint8Array([ + 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, + 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20, +]); +class X25519 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NativeAlgorithm { + constructor(hkdf) { + super(); + Object.defineProperty(this, "_hkdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_alg", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nPk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nSk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nDh", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_pkcs8AlgId", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._alg = { name: ALG_NAME }; + this._hkdf = hkdf; + this._nPk = 32; + this._nSk = 32; + this._nDh = 32; + this._pkcs8AlgId = PKCS8_ALG_ID_X25519; + } + async serializePublicKey(key) { + await this._setup(); + try { + return await this._api.exportKey("raw", key); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async deserializePublicKey(key) { + await this._setup(); + try { + return await this._importRawKey(key, true); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async serializePrivateKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + if (!("d" in jwk)) { + throw new Error("Not private key"); + } + return (0,_hpke_common__WEBPACK_IMPORTED_MODULE_0__.base64UrlToBytes)(jwk["d"]).buffer; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async deserializePrivateKey(key) { + await this._setup(); + try { + return await this._importRawKey(key, false); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async importKey(format, key, isPublic) { + await this._setup(); + try { + if (format === "raw") { + return await this._importRawKey(key, isPublic); + } + // jwk + if (key instanceof ArrayBuffer) { + throw new Error("Invalid jwk key format"); + } + return await this._importJWK(key, isPublic); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async generateKeyPair() { + await this._setup(); + try { + return await this._api.generateKey(ALG_NAME, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError(e); + } + } + async deriveKeyPair(ikm) { + await this._setup(); + try { + const dkpPrk = await this._hkdf.labeledExtract(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.LABEL_DKP_PRK, new Uint8Array(ikm)); + const rawSk = await this._hkdf.labeledExpand(dkpPrk, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.LABEL_SK, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY, this._nSk); + const rawSkBytes = new Uint8Array(rawSk); + const sk = await this._deserializePkcs8Key(rawSkBytes); + rawSkBytes.fill(0); + return { + privateKey: sk, + publicKey: await this.derivePublicKey(sk), + }; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeriveKeyPairError(e); + } + } + async derivePublicKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + delete jwk["d"]; + delete jwk["key_ops"]; + return await this._api.importKey("jwk", jwk, this._alg, true, []); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async dh(sk, pk) { + await this._setup(); + try { + const bits = await this._api.deriveBits({ + name: ALG_NAME, + public: pk, + }, sk, this._nDh * 8); + return bits; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async _importRawKey(key, isPublic) { + if (isPublic && key.byteLength !== this._nPk) { + throw new Error("Invalid public key for the ciphersuite"); + } + if (!isPublic && key.byteLength !== this._nSk) { + throw new Error("Invalid private key for the ciphersuite"); + } + if (isPublic) { + return await this._api.importKey("raw", key, this._alg, true, []); + } + return await this._deserializePkcs8Key(new Uint8Array(key)); + } + async _importJWK(key, isPublic) { + if (typeof key.kty === "undefined" || key.kty !== "OKP") { + throw new Error(`Invalid kty: ${key.crv}`); + } + if (typeof key.crv === "undefined" || key.crv !== ALG_NAME) { + throw new Error(`Invalid crv: ${key.crv}`); + } + if (isPublic) { + if (typeof key.d !== "undefined") { + throw new Error("Invalid key: `d` should not be set"); + } + return await this._api.importKey("jwk", key, this._alg, true, []); + } + if (typeof key.d === "undefined") { + throw new Error("Invalid key: `d` not found"); + } + return await this._api.importKey("jwk", key, this._alg, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } + async _deserializePkcs8Key(k) { + const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length); + pkcs8Key.set(this._pkcs8AlgId, 0); + pkcs8Key.set(k, this._pkcs8AlgId.length); + return await this._api.importKey("pkcs8", pkcs8Key, this._alg, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } +} + + +/***/ }), + +/***/ 27762: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/base64-js@1.5.1/node_modules/base64-js/index.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +exports.byteLength = byteLength +exports.toByteArray = toByteArray +exports.fromByteArray = fromByteArray + +var lookup = [] +var revLookup = [] +var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array + +var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' +for (var i = 0, len = code.length; i < len; ++i) { + lookup[i] = code[i] + revLookup[code.charCodeAt(i)] = i +} + +// Support decoding URL-safe base64 strings, as Node.js does. +// See: https://en.wikipedia.org/wiki/Base64#URL_applications +revLookup['-'.charCodeAt(0)] = 62 +revLookup['_'.charCodeAt(0)] = 63 + +function getLens (b64) { + var len = b64.length + + if (len % 4 > 0) { + throw new Error('Invalid string. Length must be a multiple of 4') + } + + // Trim off extra bytes after placeholder bytes are found + // See: https://github.com/beatgammit/base64-js/issues/42 + var validLen = b64.indexOf('=') + if (validLen === -1) validLen = len + + var placeHoldersLen = validLen === len + ? 0 + : 4 - (validLen % 4) + + return [validLen, placeHoldersLen] +} + +// base64 is 4/3 + up to two characters of the original data +function byteLength (b64) { + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function _byteLength (b64, validLen, placeHoldersLen) { + return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen +} + +function toByteArray (b64) { + var tmp + var lens = getLens(b64) + var validLen = lens[0] + var placeHoldersLen = lens[1] + + var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)) + + var curByte = 0 + + // if there are placeholders, only get up to the last complete 4 chars + var len = placeHoldersLen > 0 + ? validLen - 4 + : validLen + + var i + for (i = 0; i < len; i += 4) { + tmp = + (revLookup[b64.charCodeAt(i)] << 18) | + (revLookup[b64.charCodeAt(i + 1)] << 12) | + (revLookup[b64.charCodeAt(i + 2)] << 6) | + revLookup[b64.charCodeAt(i + 3)] + arr[curByte++] = (tmp >> 16) & 0xFF + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 2) { + tmp = + (revLookup[b64.charCodeAt(i)] << 2) | + (revLookup[b64.charCodeAt(i + 1)] >> 4) + arr[curByte++] = tmp & 0xFF + } + + if (placeHoldersLen === 1) { + tmp = + (revLookup[b64.charCodeAt(i)] << 10) | + (revLookup[b64.charCodeAt(i + 1)] << 4) | + (revLookup[b64.charCodeAt(i + 2)] >> 2) + arr[curByte++] = (tmp >> 8) & 0xFF + arr[curByte++] = tmp & 0xFF + } + + return arr +} + +function tripletToBase64 (num) { + return lookup[num >> 18 & 0x3F] + + lookup[num >> 12 & 0x3F] + + lookup[num >> 6 & 0x3F] + + lookup[num & 0x3F] +} + +function encodeChunk (uint8, start, end) { + var tmp + var output = [] + for (var i = start; i < end; i += 3) { + tmp = + ((uint8[i] << 16) & 0xFF0000) + + ((uint8[i + 1] << 8) & 0xFF00) + + (uint8[i + 2] & 0xFF) + output.push(tripletToBase64(tmp)) + } + return output.join('') +} + +function fromByteArray (uint8) { + var tmp + var len = uint8.length + var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes + var parts = [] + var maxChunkLength = 16383 // must be multiple of 3 + + // go through the array every three bytes, we'll deal with trailing stuff later + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength))) + } + + // pad the end with zeros, but make sure to not forget the extra bytes + if (extraBytes === 1) { + tmp = uint8[len - 1] + parts.push( + lookup[tmp >> 2] + + lookup[(tmp << 4) & 0x3F] + + '==' + ) + } else if (extraBytes === 2) { + tmp = (uint8[len - 2] << 8) + uint8[len - 1] + parts.push( + lookup[tmp >> 10] + + lookup[(tmp >> 4) & 0x3F] + + lookup[(tmp << 2) & 0x3F] + + '=' + ) + } + + return parts.join('') +} + + +/***/ }), + +/***/ 28432: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/utils.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var utils = exports; +var BN = __webpack_require__(/*! bn.js */ 27019); +var minAssert = __webpack_require__(/*! minimalistic-assert */ 45185); +var minUtils = __webpack_require__(/*! minimalistic-crypto-utils */ 75814); + +utils.assert = minAssert; +utils.toArray = minUtils.toArray; +utils.zero2 = minUtils.zero2; +utils.toHex = minUtils.toHex; +utils.encode = minUtils.encode; + +// Represent num in a w-NAF form +function getNAF(num, w, bits) { + var naf = new Array(Math.max(num.bitLength(), bits) + 1); + var i; + for (i = 0; i < naf.length; i += 1) { + naf[i] = 0; + } + + var ws = 1 << (w + 1); + var k = num.clone(); + + for (i = 0; i < naf.length; i++) { + var z; + var mod = k.andln(ws - 1); + if (k.isOdd()) { + if (mod > (ws >> 1) - 1) + z = (ws >> 1) - mod; + else + z = mod; + k.isubn(z); + } else { + z = 0; + } + + naf[i] = z; + k.iushrn(1); + } + + return naf; +} +utils.getNAF = getNAF; + +// Represent k1, k2 in a Joint Sparse Form +function getJSF(k1, k2) { + var jsf = [ + [], + [], + ]; + + k1 = k1.clone(); + k2 = k2.clone(); + var d1 = 0; + var d2 = 0; + var m8; + while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) { + // First phase + var m14 = (k1.andln(3) + d1) & 3; + var m24 = (k2.andln(3) + d2) & 3; + if (m14 === 3) + m14 = -1; + if (m24 === 3) + m24 = -1; + var u1; + if ((m14 & 1) === 0) { + u1 = 0; + } else { + m8 = (k1.andln(7) + d1) & 7; + if ((m8 === 3 || m8 === 5) && m24 === 2) + u1 = -m14; + else + u1 = m14; + } + jsf[0].push(u1); + + var u2; + if ((m24 & 1) === 0) { + u2 = 0; + } else { + m8 = (k2.andln(7) + d2) & 7; + if ((m8 === 3 || m8 === 5) && m14 === 2) + u2 = -m24; + else + u2 = m24; + } + jsf[1].push(u2); + + // Second phase + if (2 * d1 === u1 + 1) + d1 = 1 - d1; + if (2 * d2 === u2 + 1) + d2 = 1 - d2; + k1.iushrn(1); + k2.iushrn(1); + } + + return jsf; +} +utils.getJSF = getJSF; + +function cachedProperty(obj, name, computer) { + var key = '_' + name; + obj.prototype[name] = function cachedProperty() { + return this[key] !== undefined ? this[key] : + this[key] = computer.call(this); + }; +} +utils.cachedProperty = cachedProperty; + +function parseBytes(bytes) { + return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') : + bytes; +} +utils.parseBytes = parseBytes; + +function intFromLE(bytes) { + return new BN(bytes, 'hex', 'le'); +} +utils.intFromLE = intFromLE; + + + +/***/ }), + +/***/ 28495: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var reflectGetProto = __webpack_require__(/*! ./Reflect.getPrototypeOf */ 21033); +var originalGetProto = __webpack_require__(/*! ./Object.getPrototypeOf */ 55311); + +var getDunderProto = __webpack_require__(/*! dunder-proto/get */ 83773); + +/** @type {import('.')} */ +module.exports = reflectGetProto + ? function getProto(O) { + // @ts-expect-error TS can't narrow inside a closure, for some reason + return reflectGetProto(O); + } + : originalGetProto + ? function getProto(O) { + if (!O || (typeof O !== 'object' && typeof O !== 'function')) { + throw new TypeError('getProto: not an object'); + } + // @ts-expect-error TS can't narrow inside a closure, for some reason + return originalGetProto(O); + } + : getDunderProto + ? function getProto(O) { + // @ts-expect-error TS can't narrow inside a closure, for some reason + return getDunderProto(O); + } + : null; + + +/***/ }), + +/***/ 28993: +/*!******************************************************************************!*\ + !*** ../node_modules/.pnpm/parse-asn1@5.1.9/node_modules/parse-asn1/asn1.js ***! + \******************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// from https://github.com/indutny/self-signed/blob/gh-pages/lib/asn1.js +// Fedor, you are amazing. + + + +var asn1 = __webpack_require__(/*! asn1.js */ 41032); + +exports.certificate = __webpack_require__(/*! ./certificate */ 51277); + +var RSAPrivateKey = asn1.define('RSAPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('modulus')['int'](), + this.key('publicExponent')['int'](), + this.key('privateExponent')['int'](), + this.key('prime1')['int'](), + this.key('prime2')['int'](), + this.key('exponent1')['int'](), + this.key('exponent2')['int'](), + this.key('coefficient')['int']() + ); +}); +exports.RSAPrivateKey = RSAPrivateKey; + +var RSAPublicKey = asn1.define('RSAPublicKey', function () { + this.seq().obj( + this.key('modulus')['int'](), + this.key('publicExponent')['int']() + ); +}); +exports.RSAPublicKey = RSAPublicKey; + +var AlgorithmIdentifier = asn1.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('none').null_().optional(), + this.key('curve').objid().optional(), + this.key('params').seq().obj( + this.key('p')['int'](), + this.key('q')['int'](), + this.key('g')['int']() + ).optional() + ); +}); + +var PublicKey = asn1.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); +exports.PublicKey = PublicKey; + +var PrivateKeyInfo = asn1.define('PrivateKeyInfo', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPrivateKey').octstr() + ); +}); +exports.PrivateKey = PrivateKeyInfo; +var EncryptedPrivateKeyInfo = asn1.define('EncryptedPrivateKeyInfo', function () { + this.seq().obj( + this.key('algorithm').seq().obj( + this.key('id').objid(), + this.key('decrypt').seq().obj( + this.key('kde').seq().obj( + this.key('id').objid(), + this.key('kdeparams').seq().obj( + this.key('salt').octstr(), + this.key('iters')['int']() + ) + ), + this.key('cipher').seq().obj( + this.key('algo').objid(), + this.key('iv').octstr() + ) + ) + ), + this.key('subjectPrivateKey').octstr() + ); +}); + +exports.EncryptedPrivateKey = EncryptedPrivateKeyInfo; + +var DSAPrivateKey = asn1.define('DSAPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('p')['int'](), + this.key('q')['int'](), + this.key('g')['int'](), + this.key('pub_key')['int'](), + this.key('priv_key')['int']() + ); +}); +exports.DSAPrivateKey = DSAPrivateKey; + +exports.DSAparam = asn1.define('DSAparam', function () { + this['int'](); +}); + +var ECParameters = asn1.define('ECParameters', function () { + this.choice({ + namedCurve: this.objid() + }); +}); + +var ECPrivateKey = asn1.define('ECPrivateKey', function () { + this.seq().obj( + this.key('version')['int'](), + this.key('privateKey').octstr(), + this.key('parameters').optional().explicit(0).use(ECParameters), + this.key('publicKey').optional().explicit(1).bitstr() + ); +}); +exports.ECPrivateKey = ECPrivateKey; + +exports.signature = asn1.define('signature', function () { + this.seq().obj( + this.key('r')['int'](), + this.key('s')['int']() + ); +}); + + +/***/ }), + +/***/ 29072: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/abstract/curve.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ pippenger: () => (/* binding */ pippenger), +/* harmony export */ precomputeMSMUnsafe: () => (/* binding */ precomputeMSMUnsafe), +/* harmony export */ validateBasic: () => (/* binding */ validateBasic), +/* harmony export */ wNAF: () => (/* binding */ wNAF) +/* harmony export */ }); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ 51733); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 96926); +/** + * Methods for elliptic curve multiplication by scalars. + * Contains wNAF, pippenger + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +const _0n = BigInt(0); +const _1n = BigInt(1); +function constTimeNegate(condition, item) { + const neg = item.negate(); + return condition ? neg : item; +} +function validateW(W, bits) { + if (!Number.isSafeInteger(W) || W <= 0 || W > bits) + throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W); +} +function calcWOpts(W, scalarBits) { + validateW(W, scalarBits); + const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero + const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero + const maxNumber = 2 ** W; // W=8 256 + const mask = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(W); // W=8 255 == mask 0b11111111 + const shiftBy = BigInt(W); // W=8 8 + return { windows, windowSize, mask, maxNumber, shiftBy }; +} +function calcOffsets(n, window, wOpts) { + const { windowSize, mask, maxNumber, shiftBy } = wOpts; + let wbits = Number(n & mask); // extract W bits. + let nextN = n >> shiftBy; // shift number by W bits. + // What actually happens here: + // const highestBit = Number(mask ^ (mask >> 1n)); + // let wbits2 = wbits - 1; // skip zero + // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~); + // split if bits > max: +224 => 256-32 + if (wbits > windowSize) { + // we skip zero, which means instead of `>= size-1`, we do `> size` + wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here. + nextN += _1n; // +256 (carry) + } + const offsetStart = window * windowSize; + const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero + const isZero = wbits === 0; // is current window slice a 0? + const isNeg = wbits < 0; // is current window slice negative? + const isNegF = window % 2 !== 0; // fake random statement for noise + const offsetF = offsetStart; // fake offset for noise + return { nextN, offset, isZero, isNeg, isNegF, offsetF }; +} +function validateMSMPoints(points, c) { + if (!Array.isArray(points)) + throw new Error('array expected'); + points.forEach((p, i) => { + if (!(p instanceof c)) + throw new Error('invalid point at index ' + i); + }); +} +function validateMSMScalars(scalars, field) { + if (!Array.isArray(scalars)) + throw new Error('array of scalars expected'); + scalars.forEach((s, i) => { + if (!field.isValid(s)) + throw new Error('invalid scalar at index ' + i); + }); +} +// Since points in different groups cannot be equal (different object constructor), +// we can have single place to store precomputes. +// Allows to make points frozen / immutable. +const pointPrecomputes = new WeakMap(); +const pointWindowSizes = new WeakMap(); +function getW(P) { + return pointWindowSizes.get(P) || 1; +} +/** + * Elliptic curve multiplication of Point by scalar. Fragile. + * Scalars should always be less than curve order: this should be checked inside of a curve itself. + * Creates precomputation tables for fast multiplication: + * - private scalar is split by fixed size windows of W bits + * - every window point is collected from window's table & added to accumulator + * - since windows are different, same point inside tables won't be accessed more than once per calc + * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) + * - +1 window is neccessary for wNAF + * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication + * + * @todo Research returning 2d JS array of windows, instead of a single window. + * This would allow windows to be in different memory locations + */ +function wNAF(c, bits) { + return { + constTimeNegate, + hasPrecomputes(elm) { + return getW(elm) !== 1; + }, + // non-const time multiplication ladder + unsafeLadder(elm, n, p = c.ZERO) { + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @param elm Point instance + * @param W window size + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = calcWOpts(W, bits); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // i=1, bc we skip 0 + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // Smaller version: + // https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 + // TODO: check the scalar is less than group order? + // wNAF behavior is undefined otherwise. But have to carefully remove + // other checks before wNAF. ORDER == bits here. + // Accumulators + let p = c.ZERO; + let f = c.BASE; + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + const wo = calcWOpts(W, bits); + for (let window = 0; window < wo.windows; window++) { + // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise + const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // bits are 0: add garbage to fake point + // Important part for const-time getPublicKey: add random "noise" point to f. + f = f.add(constTimeNegate(isNegF, precomputes[offsetF])); + } + else { + // bits are 1: add to result point + p = p.add(constTimeNegate(isNeg, precomputes[offset])); + } + } + // Return both real and fake points: JIT won't eliminate f. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + /** + * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @param acc accumulator point to add result of multiplication + * @returns point + */ + wNAFUnsafe(W, precomputes, n, acc = c.ZERO) { + const wo = calcWOpts(W, bits); + for (let window = 0; window < wo.windows; window++) { + if (n === _0n) + break; // Early-exit, skip 0 value + const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // Window bits are 0: skip processing. + // Move to next window. + continue; + } + else { + const item = precomputes[offset]; + acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM + } + } + return acc; + }, + getPrecomputes(W, P, transform) { + // Calculate precomputes on a first run, reuse them after + let comp = pointPrecomputes.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) + pointPrecomputes.set(P, transform(comp)); + } + return comp; + }, + wNAFCached(P, n, transform) { + const W = getW(P); + return this.wNAF(W, this.getPrecomputes(W, P, transform), n); + }, + wNAFCachedUnsafe(P, n, transform, prev) { + const W = getW(P); + if (W === 1) + return this.unsafeLadder(P, n, prev); // For W=1 ladder is ~x2 faster + return this.wNAFUnsafe(W, this.getPrecomputes(W, P, transform), n, prev); + }, + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + setWindowSize(P, W) { + validateW(W, bits); + pointWindowSizes.set(P, W); + pointPrecomputes.delete(P); + }, + }; +} +/** + * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * 30x faster vs naive addition on L=4096, 10x faster than precomputes. + * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. + * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @param scalars array of L scalars (aka private keys / bigints) + */ +function pippenger(c, fieldN, points, scalars) { + // If we split scalars by some window (let's say 8 bits), every chunk will only + // take 256 buckets even if there are 4096 scalars, also re-uses double. + // TODO: + // - https://eprint.iacr.org/2024/750.pdf + // - https://tches.iacr.org/index.php/TCHES/article/view/10287 + // 0 is accepted in scalars + validateMSMPoints(points, c); + validateMSMScalars(scalars, fieldN); + if (points.length !== scalars.length) + throw new Error('arrays of points and scalars must have equal length'); + const zero = c.ZERO; + const wbits = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitLen)(BigInt(points.length)); + const windowSize = wbits > 12 ? wbits - 3 : wbits > 4 ? wbits - 2 : wbits ? 2 : 1; // in bits + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(windowSize); + const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array + const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize; + let sum = zero; + for (let i = lastBits; i >= 0; i -= windowSize) { + buckets.fill(zero); + for (let j = 0; j < scalars.length; j++) { + const scalar = scalars[j]; + const wbits = Number((scalar >> BigInt(i)) & MASK); + buckets[wbits] = buckets[wbits].add(points[j]); + } + let resI = zero; // not using this will do small speed-up, but will lose ct + // Skip first bucket, because it is zero + for (let j = buckets.length - 1, sumI = zero; j > 0; j--) { + sumI = sumI.add(buckets[j]); + resI = resI.add(sumI); + } + sum = sum.add(resI); + if (i !== 0) + for (let j = 0; j < windowSize; j++) + sum = sum.double(); + } + return sum; +} +/** + * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @returns function which multiplies points with scaars + */ +function precomputeMSMUnsafe(c, fieldN, points, windowSize) { + /** + * Performance Analysis of Window-based Precomputation + * + * Base Case (256-bit scalar, 8-bit window): + * - Standard precomputation requires: + * - 31 additions per scalar × 256 scalars = 7,936 ops + * - Plus 255 summary additions = 8,191 total ops + * Note: Summary additions can be optimized via accumulator + * + * Chunked Precomputation Analysis: + * - Using 32 chunks requires: + * - 255 additions per chunk + * - 256 doublings + * - Total: (255 × 32) + 256 = 8,416 ops + * + * Memory Usage Comparison: + * Window Size | Standard Points | Chunked Points + * ------------|-----------------|--------------- + * 4-bit | 520 | 15 + * 8-bit | 4,224 | 255 + * 10-bit | 13,824 | 1,023 + * 16-bit | 557,056 | 65,535 + * + * Key Advantages: + * 1. Enables larger window sizes due to reduced memory overhead + * 2. More efficient for smaller scalar counts: + * - 16 chunks: (16 × 255) + 256 = 4,336 ops + * - ~2x faster than standard 8,191 ops + * + * Limitations: + * - Not suitable for plain precomputes (requires 256 constant doublings) + * - Performance degrades with larger scalar counts: + * - Optimal for ~256 scalars + * - Less efficient for 4096+ scalars (Pippenger preferred) + */ + validateW(windowSize, fieldN.BITS); + validateMSMPoints(points, c); + const zero = c.ZERO; + const tableSize = 2 ** windowSize - 1; // table size (without zero) + const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(windowSize); + const tables = points.map((p) => { + const res = []; + for (let i = 0, acc = p; i < tableSize; i++) { + res.push(acc); + acc = acc.add(p); + } + return res; + }); + return (scalars) => { + validateMSMScalars(scalars, fieldN); + if (scalars.length > points.length) + throw new Error('array of scalars must be smaller than array of points'); + let res = zero; + for (let i = 0; i < chunks; i++) { + // No need to double if accumulator is still zero. + if (res !== zero) + for (let j = 0; j < windowSize; j++) + res = res.double(); + const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize); + for (let j = 0; j < scalars.length; j++) { + const n = scalars[j]; + const curr = Number((n >> shiftBy) & MASK); + if (!curr) + continue; // skip zero scalars chunks + res = res.add(tables[j][curr - 1]); + } + } + return res; + }; +} +function validateBasic(curve) { + (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.validateField)(curve.Fp); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...(0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.nLength)(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +//# sourceMappingURL=curve.js.map + +/***/ }), + +/***/ 29362: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hmac.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HMAC: () => (/* binding */ HMAC), +/* harmony export */ hmac: () => (/* binding */ hmac) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils.js */ 29964); +/** + * HMAC: RFC2104 message authentication code. + * @module + */ + +class HMAC extends _utils_js__WEBPACK_IMPORTED_MODULE_0__.Hash { + constructor(hash, _key) { + super(); + this.finished = false; + this.destroyed = false; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ahash)(hash); + const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.toBytes)(_key); + this.iHash = hash.create(); + if (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 blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.clean)(pad); + } + update(buf) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(out, this.outputLen); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to || (to = Object.create(Object.getPrototypeOf(this), {})); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + clone() { + return this._cloneInto(); + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + * @example + * import { hmac } from '@noble/hashes/hmac'; + * import { sha256 } from '@noble/hashes/sha2'; + * const mac1 = hmac(sha256, 'key', 'message'); + */ +const hmac = (hash, key, message) => new HMAC(hash, key).update(message).digest(); +hmac.create = (hash, key) => new HMAC(hash, key); +//# sourceMappingURL=hmac.js.map + +/***/ }), + +/***/ 29388: +/*!***********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_passthrough.js ***! + \***********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __webpack_require__(/*! ./_stream_transform */ 93558); +__webpack_require__(/*! inherits */ 18628)(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ 29784: +/*!************************************************************************!*\ + !*** ../node_modules/.pnpm/sha.js@2.4.12/node_modules/sha.js/index.js ***! + \************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = function SHA(algorithm) { + var alg = algorithm.toLowerCase(); + + var Algorithm = module.exports[alg]; + if (!Algorithm) { + throw new Error(alg + ' is not supported (we accept pull requests)'); + } + + return new Algorithm(); +}; + +module.exports.sha = __webpack_require__(/*! ./sha */ 86238); +module.exports.sha1 = __webpack_require__(/*! ./sha1 */ 40627); +module.exports.sha224 = __webpack_require__(/*! ./sha224 */ 12128); +module.exports.sha256 = __webpack_require__(/*! ./sha256 */ 96549); +module.exports.sha384 = __webpack_require__(/*! ./sha384 */ 95329); +module.exports.sha512 = __webpack_require__(/*! ./sha512 */ 42032); + + +/***/ }), + +/***/ 29821: +/*!*********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/aa_clear_attrs.js ***! + \*********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ACClearAttrs: () => (/* binding */ ACClearAttrs) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class ACClearAttrs { + acIssuer = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName(); + acSerial = 0; + attrs = []; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName }) +], ACClearAttrs.prototype, "acIssuer", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], ACClearAttrs.prototype, "acSerial", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Attribute, repeated: "sequence", + }) +], ACClearAttrs.prototype, "attrs", void 0); + + +/***/ }), + +/***/ 29964: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js ***! + \*****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Hash: () => (/* binding */ Hash), +/* harmony export */ abytes: () => (/* binding */ abytes), +/* harmony export */ aexists: () => (/* binding */ aexists), +/* harmony export */ ahash: () => (/* binding */ ahash), +/* harmony export */ anumber: () => (/* binding */ anumber), +/* harmony export */ aoutput: () => (/* binding */ aoutput), +/* harmony export */ asyncLoop: () => (/* binding */ asyncLoop), +/* harmony export */ byteSwap: () => (/* binding */ byteSwap), +/* harmony export */ byteSwap32: () => (/* binding */ byteSwap32), +/* harmony export */ byteSwapIfBE: () => (/* binding */ byteSwapIfBE), +/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex), +/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8), +/* harmony export */ checkOpts: () => (/* binding */ checkOpts), +/* harmony export */ clean: () => (/* binding */ clean), +/* harmony export */ concatBytes: () => (/* binding */ concatBytes), +/* harmony export */ createHasher: () => (/* binding */ createHasher), +/* harmony export */ createOptHasher: () => (/* binding */ createOptHasher), +/* harmony export */ createView: () => (/* binding */ createView), +/* harmony export */ createXOFer: () => (/* binding */ createXOFer), +/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes), +/* harmony export */ isBytes: () => (/* binding */ isBytes), +/* harmony export */ isLE: () => (/* binding */ isLE), +/* harmony export */ kdfInputToBytes: () => (/* binding */ kdfInputToBytes), +/* harmony export */ nextTick: () => (/* binding */ nextTick), +/* harmony export */ randomBytes: () => (/* binding */ randomBytes), +/* harmony export */ rotl: () => (/* binding */ rotl), +/* harmony export */ rotr: () => (/* binding */ rotr), +/* harmony export */ swap32IfBE: () => (/* binding */ swap32IfBE), +/* harmony export */ swap8IfBE: () => (/* binding */ swap8IfBE), +/* harmony export */ toBytes: () => (/* binding */ toBytes), +/* harmony export */ u32: () => (/* binding */ u32), +/* harmony export */ u8: () => (/* binding */ u8), +/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes), +/* harmony export */ wrapConstructor: () => (/* binding */ wrapConstructor), +/* harmony export */ wrapConstructorWithOpts: () => (/* binding */ wrapConstructorWithOpts), +/* harmony export */ wrapXOFConstructorWithOpts: () => (/* binding */ wrapXOFConstructorWithOpts) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/crypto */ 76572); +/** + * Utilities for hex, bytes, CSPRNG. + * @module + */ +/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+. +// node.js versions earlier than v19 don't declare it in global scope. +// For node.js, package.json#exports field mapping rewrites import +// from `crypto` to `cryptoNode`, which imports native module. +// Makes the utils un-importable in browsers without a bundler. +// Once node.js 18 is deprecated (2025-04-30), we can just drop the import. + +/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */ +function isBytes(a) { + return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array'); +} +/** Asserts something is positive integer. */ +function anumber(n) { + if (!Number.isSafeInteger(n) || n < 0) + throw new Error('positive integer expected, got ' + n); +} +/** Asserts something is Uint8Array. */ +function abytes(b, ...lengths) { + if (!isBytes(b)) + throw new Error('Uint8Array expected'); + if (lengths.length > 0 && !lengths.includes(b.length)) + throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length); +} +/** Asserts something is hash */ +function ahash(h) { + if (typeof h !== 'function' || typeof h.create !== 'function') + throw new Error('Hash should be wrapped by utils.createHasher'); + anumber(h.outputLen); + anumber(h.blockLen); +} +/** Asserts a hash instance has not been destroyed / finished */ +function aexists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error('Hash instance has been destroyed'); + if (checkFinished && instance.finished) + throw new Error('Hash#digest() has already been called'); +} +/** Asserts output is properly-sized byte array */ +function aoutput(out, instance) { + abytes(out); + const min = instance.outputLen; + if (out.length < min) { + throw new Error('digestInto() expects output buffer of length at least ' + min); + } +} +/** Cast u8 / u16 / u32 to u8. */ +function u8(arr) { + return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); +} +/** Cast u8 / u16 / u32 to u32. */ +function u32(arr) { + return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +} +/** Zeroize a byte array. Warning: JS provides no guarantees. */ +function clean(...arrays) { + for (let i = 0; i < arrays.length; i++) { + arrays[i].fill(0); + } +} +/** Create DataView of an array for easy byte-level manipulation. */ +function createView(arr) { + return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +} +/** The rotate right (circular right shift) operation for uint32 */ +function rotr(word, shift) { + return (word << (32 - shift)) | (word >>> shift); +} +/** The rotate left (circular left shift) operation for uint32 */ +function rotl(word, shift) { + return (word << shift) | ((word >>> (32 - shift)) >>> 0); +} +/** Is current platform little-endian? Most are. Big-Endian platform: IBM */ +const isLE = /* @__PURE__ */ (() => new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)(); +/** The byte swap operation for uint32 */ +function byteSwap(word) { + return (((word << 24) & 0xff000000) | + ((word << 8) & 0xff0000) | + ((word >>> 8) & 0xff00) | + ((word >>> 24) & 0xff)); +} +/** Conditionally byte swap if on a big-endian platform */ +const swap8IfBE = isLE + ? (n) => n + : (n) => byteSwap(n); +/** @deprecated */ +const byteSwapIfBE = swap8IfBE; +/** In place byte swap for Uint32Array */ +function byteSwap32(arr) { + for (let i = 0; i < arr.length; i++) { + arr[i] = byteSwap(arr[i]); + } + return arr; +} +const swap32IfBE = isLE + ? (u) => u + : byteSwap32; +// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex +const hasHexBuiltin = /* @__PURE__ */ (() => +// @ts-ignore +typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')(); +// Array where index 0xf0 (240) is mapped to string 'f0' +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * Convert byte array to hex string. Uses built-in function, when available. + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + abytes(bytes); + // @ts-ignore + if (hasHexBuiltin) + return bytes.toHex(); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +// We use optimized technique to convert hex string to byte array +const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; +function asciiToBase16(ch) { + if (ch >= asciis._0 && ch <= asciis._9) + return ch - asciis._0; // '2' => 50-48 + if (ch >= asciis.A && ch <= asciis.F) + return ch - (asciis.A - 10); // 'B' => 66-(65-10) + if (ch >= asciis.a && ch <= asciis.f) + return ch - (asciis.a - 10); // 'b' => 98-(97-10) + return; +} +/** + * Convert hex string to byte array. Uses built-in function, when available. + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // @ts-ignore + if (hasHexBuiltin) + return Uint8Array.fromHex(hex); + const hl = hex.length; + const al = hl / 2; + if (hl % 2) + throw new Error('hex string expected, got unpadded hex of length ' + hl); + const array = new Uint8Array(al); + for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { + const n1 = asciiToBase16(hex.charCodeAt(hi)); + const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); + if (n1 === undefined || n2 === undefined) { + const char = hex[hi] + hex[hi + 1]; + throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); + } + array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163 + } + return array; +} +/** + * There is no setImmediate in browser and setTimeout is slow. + * Call of async fn will return Promise, which will be fullfiled only on + * next scheduler queue processing step and this is exactly what we need. + */ +const nextTick = async () => { }; +/** Returns control to thread each 'tick' ms to avoid blocking. */ +async function asyncLoop(iters, tick, cb) { + let ts = Date.now(); + for (let i = 0; i < iters; i++) { + cb(i); + // Date.now() is not monotonic, so in case if clock goes backwards we return return control too + const diff = Date.now() - ts; + if (diff >= 0 && diff < tick) + continue; + await nextTick(); + ts += diff; + } +} +/** + * Converts string to bytes using UTF8 encoding. + * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error('string expected'); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Converts bytes to string using UTF8 encoding. + * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc' + */ +function bytesToUtf8(bytes) { + return new TextDecoder().decode(bytes); +} +/** + * Normalizes (non-hex) string or Uint8Array to Uint8Array. + * Warning: when Uint8Array is passed, it would NOT get copied. + * Keep in mind for future mutable operations. + */ +function toBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + abytes(data); + return data; +} +/** + * Helper for KDFs: consumes uint8array or string. + * When string is passed, does utf8 decoding, using TextDecoder. + */ +function kdfInputToBytes(data) { + if (typeof data === 'string') + data = utf8ToBytes(data); + abytes(data); + return data; +} +/** Copies several Uint8Arrays into one. */ +function concatBytes(...arrays) { + let sum = 0; + for (let i = 0; i < arrays.length; i++) { + const a = arrays[i]; + abytes(a); + sum += a.length; + } + const res = new Uint8Array(sum); + for (let i = 0, pad = 0; i < arrays.length; i++) { + const a = arrays[i]; + res.set(a, pad); + pad += a.length; + } + return res; +} +function checkOpts(defaults, opts) { + if (opts !== undefined && {}.toString.call(opts) !== '[object Object]') + throw new Error('options should be object or undefined'); + const merged = Object.assign(defaults, opts); + return merged; +} +/** For runtime check if class implements interface */ +class Hash { +} +/** Wraps hash function, creating an interface on top of it */ +function createHasher(hashCons) { + const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); + const tmp = hashCons(); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = () => hashCons(); + return hashC; +} +function createOptHasher(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +function createXOFer(hashCons) { + const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); + const tmp = hashCons({}); + hashC.outputLen = tmp.outputLen; + hashC.blockLen = tmp.blockLen; + hashC.create = (opts) => hashCons(opts); + return hashC; +} +const wrapConstructor = createHasher; +const wrapConstructorWithOpts = createOptHasher; +const wrapXOFConstructorWithOpts = createXOFer; +/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */ +function randomBytes(bytesLength = 32) { + if (_noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto && typeof _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.getRandomValues === 'function') { + return _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.getRandomValues(new Uint8Array(bytesLength)); + } + // Legacy Node.js compatibility + if (_noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto && typeof _noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.randomBytes === 'function') { + return Uint8Array.from(_noble_hashes_crypto__WEBPACK_IMPORTED_MODULE_0__.crypto.randomBytes(bytesLength)); + } + throw new Error('crypto.getRandomValues must be defined'); +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 30230: +/*!************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/accounts/utils/publicKeyToAddress.js ***! + \************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ publicKeyToAddress: () => (/* binding */ publicKeyToAddress) +/* harmony export */ }); +/* harmony import */ var _utils_address_getAddress_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/address/getAddress.js */ 23455); +/* harmony import */ var _utils_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/hash/keccak256.js */ 25878); + + +/** + * @description Converts an ECDSA public key to an address. + * + * @param publicKey The public key to convert. + * + * @returns The address. + */ +function publicKeyToAddress(publicKey) { + const address = (0,_utils_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_1__.keccak256)(`0x${publicKey.substring(4)}`).substring(26); + return (0,_utils_address_getAddress_js__WEBPACK_IMPORTED_MODULE_0__.checksumAddress)(`0x${address}`); +} +//# sourceMappingURL=publicKeyToAddress.js.map + +/***/ }), + +/***/ 30318: +/*!******************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js ***! + \******************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SHA224: () => (/* binding */ SHA224), +/* harmony export */ SHA256: () => (/* binding */ SHA256), +/* harmony export */ sha224: () => (/* binding */ sha224), +/* harmony export */ sha256: () => (/* binding */ sha256) +/* harmony export */ }); +/* harmony import */ var _sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./sha2.js */ 19745); +/** + * SHA2-256 a.k.a. sha256. In JS, it is the fastest hash, even faster than Blake3. + * + * To break sha256 using birthday attack, attackers need to try 2^128 hashes. + * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. + * + * Check out [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf). + * @module + * @deprecated + */ + +/** @deprecated Use import from `noble/hashes/sha2` module */ +const SHA256 = _sha2_js__WEBPACK_IMPORTED_MODULE_0__.SHA256; +/** @deprecated Use import from `noble/hashes/sha2` module */ +const sha256 = _sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha256; +/** @deprecated Use import from `noble/hashes/sha2` module */ +const SHA224 = _sha2_js__WEBPACK_IMPORTED_MODULE_0__.SHA224; +/** @deprecated Use import from `noble/hashes/sha2` module */ +const sha224 = _sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha224; +//# sourceMappingURL=sha256.js.map + +/***/ }), + +/***/ 30358: +/*!************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/signature/toPrefixedMessage.js ***! + \************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ toPrefixedMessage: () => (/* binding */ toPrefixedMessage) +/* harmony export */ }); +/* harmony import */ var _constants_strings_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../constants/strings.js */ 71050); +/* harmony import */ var _data_concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/concat.js */ 22745); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../data/size.js */ 58036); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); + + + + +function toPrefixedMessage(message_) { + const message = (() => { + if (typeof message_ === 'string') + return (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.stringToHex)(message_); + if (typeof message_.raw === 'string') + return message_.raw; + return (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.bytesToHex)(message_.raw); + })(); + const prefix = (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.stringToHex)(`${_constants_strings_js__WEBPACK_IMPORTED_MODULE_0__.presignMessagePrefix}${(0,_data_size_js__WEBPACK_IMPORTED_MODULE_2__.size)(message)}`); + return (0,_data_concat_js__WEBPACK_IMPORTED_MODULE_1__.concat)([prefix, message]); +} +//# sourceMappingURL=toPrefixedMessage.js.map + +/***/ }), + +/***/ 30499: +/*!********************************************************************************!*\ + !*** ../node_modules/.pnpm/des.js@1.1.0/node_modules/des.js/lib/des/cipher.js ***! + \********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); + +function Cipher(options) { + this.options = options; + + this.type = this.options.type; + this.blockSize = 8; + this._init(); + + this.buffer = new Array(this.blockSize); + this.bufferOff = 0; + this.padding = options.padding !== false +} +module.exports = Cipher; + +Cipher.prototype._init = function _init() { + // Might be overrided +}; + +Cipher.prototype.update = function update(data) { + if (data.length === 0) + return []; + + if (this.type === 'decrypt') + return this._updateDecrypt(data); + else + return this._updateEncrypt(data); +}; + +Cipher.prototype._buffer = function _buffer(data, off) { + // Append data to buffer + var min = Math.min(this.buffer.length - this.bufferOff, data.length - off); + for (var i = 0; i < min; i++) + this.buffer[this.bufferOff + i] = data[off + i]; + this.bufferOff += min; + + // Shift next + return min; +}; + +Cipher.prototype._flushBuffer = function _flushBuffer(out, off) { + this._update(this.buffer, 0, out, off); + this.bufferOff = 0; + return this.blockSize; +}; + +Cipher.prototype._updateEncrypt = function _updateEncrypt(data) { + var inputOff = 0; + var outputOff = 0; + + var count = ((this.bufferOff + data.length) / this.blockSize) | 0; + var out = new Array(count * this.blockSize); + + if (this.bufferOff !== 0) { + inputOff += this._buffer(data, inputOff); + + if (this.bufferOff === this.buffer.length) + outputOff += this._flushBuffer(out, outputOff); + } + + // Write blocks + var max = data.length - ((data.length - inputOff) % this.blockSize); + for (; inputOff < max; inputOff += this.blockSize) { + this._update(data, inputOff, out, outputOff); + outputOff += this.blockSize; + } + + // Queue rest + for (; inputOff < data.length; inputOff++, this.bufferOff++) + this.buffer[this.bufferOff] = data[inputOff]; + + return out; +}; + +Cipher.prototype._updateDecrypt = function _updateDecrypt(data) { + var inputOff = 0; + var outputOff = 0; + + var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1; + var out = new Array(count * this.blockSize); + + // TODO(indutny): optimize it, this is far from optimal + for (; count > 0; count--) { + inputOff += this._buffer(data, inputOff); + outputOff += this._flushBuffer(out, outputOff); + } + + // Buffer rest of the input + inputOff += this._buffer(data, inputOff); + + return out; +}; + +Cipher.prototype.final = function final(buffer) { + var first; + if (buffer) + first = this.update(buffer); + + var last; + if (this.type === 'encrypt') + last = this._finalEncrypt(); + else + last = this._finalDecrypt(); + + if (first) + return first.concat(last); + else + return last; +}; + +Cipher.prototype._pad = function _pad(buffer, off) { + if (off === 0) + return false; + + while (off < buffer.length) + buffer[off++] = 0; + + return true; +}; + +Cipher.prototype._finalEncrypt = function _finalEncrypt() { + if (!this._pad(this.buffer, this.bufferOff)) + return []; + + var out = new Array(this.blockSize); + this._update(this.buffer, 0, out, 0); + return out; +}; + +Cipher.prototype._unpad = function _unpad(buffer) { + return buffer; +}; + +Cipher.prototype._finalDecrypt = function _finalDecrypt() { + assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt'); + var out = new Array(this.blockSize); + this._flushBuffer(out, 0); + + return this._unpad(out); +}; + + +/***/ }), + +/***/ 30964: +/*!*******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/issuer_alternative_name.js ***! + \*******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IssueAlternativeName: () => (/* binding */ IssueAlternativeName), +/* harmony export */ id_ce_issuerAltName: () => (/* binding */ id_ce_issuerAltName) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_names_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../general_names.js */ 68427); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var IssueAlternativeName_1; + + + + +const id_ce_issuerAltName = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_ce}.18`; +let IssueAlternativeName = IssueAlternativeName_1 = class IssueAlternativeName extends _general_names_js__WEBPACK_IMPORTED_MODULE_2__.GeneralNames { + constructor(items) { + super(items); + Object.setPrototypeOf(this, IssueAlternativeName_1.prototype); + } +}; +IssueAlternativeName = IssueAlternativeName_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], IssueAlternativeName); + + + +/***/ }), + +/***/ 30982: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/string_decoder@1.1.1/node_modules/string_decoder/lib/string_decoder.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = (__webpack_require__(/*! safe-buffer */ 10703).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 30988: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/misc.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ base64UrlToBytes: () => (/* binding */ base64UrlToBytes), +/* harmony export */ bytesToBase64Url: () => (/* binding */ bytesToBase64Url), +/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex), +/* harmony export */ concat: () => (/* binding */ concat), +/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes), +/* harmony export */ i2Osp: () => (/* binding */ i2Osp), +/* harmony export */ isCryptoKeyPair: () => (/* binding */ isCryptoKeyPair), +/* harmony export */ isDeno: () => (/* binding */ isDeno), +/* harmony export */ isDenoV1: () => (/* binding */ isDenoV1), +/* harmony export */ kemToKeyGenAlgorithm: () => (/* binding */ kemToKeyGenAlgorithm), +/* harmony export */ loadCrypto: () => (/* binding */ loadCrypto), +/* harmony export */ loadSubtleCrypto: () => (/* binding */ loadSubtleCrypto), +/* harmony export */ xor: () => (/* binding */ xor) +/* harmony export */ }); +/* harmony import */ var _dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../_dnt.shims.js */ 57004); +/* harmony import */ var _identifiers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../identifiers.js */ 16780); + + +const isDenoV1 = () => +// deno-lint-ignore no-explicit-any +_dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis.process === undefined; +/** + * Checks whether the runtime is Deno or not (Node.js). + * @returns boolean - true if the runtime is Deno, false Node.js. + */ +function isDeno() { + // deno-lint-ignore no-explicit-any + if (_dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis.process === undefined) { + return true; + } + // deno-lint-ignore no-explicit-any + return _dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis.process?.versions?.deno !== undefined; +} +/** + * Checks whetehr the type of input is CryptoKeyPair or not. + */ +const isCryptoKeyPair = (x) => typeof x === "object" && + x !== null && + typeof x.privateKey === "object" && + typeof x.publicKey === "object"; +/** + * Converts integer to octet string. I2OSP implementation. + */ +function i2Osp(n, w) { + if (w <= 0) { + throw new Error("i2Osp: too small size"); + } + if (n >= 256 ** w) { + throw new Error("i2Osp: too large integer"); + } + const ret = new Uint8Array(w); + for (let i = 0; i < w && n; i++) { + ret[w - (i + 1)] = n % 256; + n = Math.floor(n / 256); + } + return ret; +} +/** + * Concatenates two Uint8Arrays. + * @param a Uint8Array + * @param b Uint8Array + * @returns Concatenated Uint8Array + */ +function concat(a, b) { + const ret = new Uint8Array(a.length + b.length); + ret.set(a, 0); + ret.set(b, a.length); + return ret; +} +/** + * Decodes Base64Url-encoded data. + * @param v Base64Url-encoded string + * @returns Uint8Array + */ +function base64UrlToBytes(v) { + const base64 = v.replace(/-/g, "+").replace(/_/g, "/"); + const byteString = atob(base64); + const ret = new Uint8Array(byteString.length); + for (let i = 0; i < byteString.length; i++) { + ret[i] = byteString.charCodeAt(i); + } + return ret; +} +/** + * Encodes Uint8Array to Base64Url. + * @param v Uint8Array + * @returns Base64Url-encoded string + */ +function bytesToBase64Url(v) { + return btoa(String.fromCharCode(...v)) + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=*$/g, ""); +} +/** + * Decodes hex string to Uint8Array. + * @param v Hex string + * @returns Uint8Array + * @throws Error if the input is not a hex string. + */ +function hexToBytes(v) { + if (v.length === 0) { + return new Uint8Array([]); + } + const res = v.match(/[\da-f]{2}/gi); + if (res == null) { + throw new Error("Not hex string."); + } + return new Uint8Array(res.map(function (h) { + return parseInt(h, 16); + })); +} +/** + * Encodes Uint8Array to hex string. + * @param v Uint8Array + * @returns Hex string + */ +function bytesToHex(v) { + return [...v].map((x) => x.toString(16).padStart(2, "0")).join(""); +} +/** + * Converts KemId to KeyAlgorithm. + * @param kem KemId + * @returns KeyAlgorithm + */ +function kemToKeyGenAlgorithm(kem) { + switch (kem) { + case _identifiers_js__WEBPACK_IMPORTED_MODULE_1__.KemId.DhkemP256HkdfSha256: + return { + name: "ECDH", + namedCurve: "P-256", + }; + case _identifiers_js__WEBPACK_IMPORTED_MODULE_1__.KemId.DhkemP384HkdfSha384: + return { + name: "ECDH", + namedCurve: "P-384", + }; + case _identifiers_js__WEBPACK_IMPORTED_MODULE_1__.KemId.DhkemP521HkdfSha512: + return { + name: "ECDH", + namedCurve: "P-521", + }; + default: + // case KemId.DhkemX25519HkdfSha256 + return { + name: "X25519", + }; + } +} +async function loadSubtleCrypto() { + if (_dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis !== undefined && globalThis.crypto !== undefined) { + // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc. + return globalThis.crypto.subtle; + } + // Node.js <= v18 + try { + // @ts-ignore: to ignore "crypto" + const { webcrypto } = await Promise.all(/*! import() */[__webpack_require__.e(96), __webpack_require__.e(431)]).then(__webpack_require__.t.bind(__webpack_require__, /*! crypto */ 42378, 19)); // node:crypto + return webcrypto.subtle; + } + catch (_e) { + throw new Error("Failed to load SubtleCrypto"); + } +} +async function loadCrypto() { + if (typeof _dnt_shims_js__WEBPACK_IMPORTED_MODULE_0__.dntGlobalThis !== "undefined" && globalThis.crypto !== undefined) { + // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc. + return globalThis.crypto; + } + // Node.js <= v18 + try { + // @ts-ignore: to ignore "crypto" + const { webcrypto } = await Promise.all(/*! import() */[__webpack_require__.e(96), __webpack_require__.e(431)]).then(__webpack_require__.t.bind(__webpack_require__, /*! crypto */ 42378, 19)); // node:crypto + return webcrypto; + } + catch (_e) { + throw new Error("failed to load Crypto"); + } +} +/** + * XOR for Uint8Array. + */ +function xor(a, b) { + if (a.byteLength !== b.byteLength) { + throw new Error("xor: different length inputs"); + } + const buf = new Uint8Array(a.byteLength); + for (let i = 0; i < a.byteLength; i++) { + buf[i] = a[i] ^ b[i]; + } + return buf; +} + + +/***/ }), + +/***/ 31177: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/hash.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ahash: () => (/* binding */ ahash), +/* harmony export */ createHasher: () => (/* binding */ createHasher) +/* harmony export */ }); +/* harmony import */ var _utils_noble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/noble.js */ 63594); +/** + * This file is based on noble-curves (https://github.com/paulmillr/noble-curves). + * + * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/utils.ts + */ +/** + * Hash utilities and type definitions extracted from noble.ts + * @module + */ + +/** Asserts something is hash */ +function ahash(h) { + if (typeof h !== "function" || typeof h.create !== "function") { + throw new Error("Hash must wrapped by utils.createHasher"); + } + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.anumber)(h.outputLen); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.anumber)(h.blockLen); +} +function createHasher(hashCons, info = {}) { + const hashFn = (msg, opts) => hashCons(opts).update(msg).digest(); + const tmp = hashCons(undefined); + const hashC = Object.assign(hashFn, { + outputLen: tmp.outputLen, + blockLen: tmp.blockLen, + create: (opts) => hashCons(opts), + ...info, + }); + return Object.freeze(hashC); +} + + +/***/ }), + +/***/ 31179: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/_shortw_utils.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createCurve: () => (/* binding */ createCurve), +/* harmony export */ getHash: () => (/* binding */ getHash) +/* harmony export */ }); +/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./abstract/weierstrass.js */ 94510); +/** + * Utilities for short weierstrass curves, combined with noble-hashes. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +/** connects noble-curves to noble-hashes */ +function getHash(hash) { + return { hash }; +} +/** @deprecated use new `weierstrass()` and `ecdsa()` methods */ +function createCurve(curveDef, defHash) { + const create = (hash) => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_0__.weierstrass)({ ...curveDef, hash: hash }); + return { ...create(defHash), create }; +} +//# sourceMappingURL=_shortw_utils.js.map + +/***/ }), + +/***/ 31193: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/sha2.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ _SHA256: () => (/* binding */ _SHA256), +/* harmony export */ _SHA384: () => (/* binding */ _SHA384), +/* harmony export */ _SHA512: () => (/* binding */ _SHA512), +/* harmony export */ sha256: () => (/* binding */ sha256), +/* harmony export */ sha384: () => (/* binding */ sha384), +/* harmony export */ sha512: () => (/* binding */ sha512) +/* harmony export */ }); +/* harmony import */ var _md_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./md.js */ 57576); +/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./u64.js */ 82572); +/* harmony import */ var _utils_noble_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/noble.js */ 63594); +/* harmony import */ var _hash_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hash.js */ 31177); +/** + * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes). + * + * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-hashes/blob/2e0c00e1aa134082ba1380bf3afb8b1641f60fed/src/sha2.ts + */ +/** + * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256. + * SHA256 is the fastest hash implementable in JS, even faster than Blake3. + * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and + * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf). + * @module + */ + + + + +/** + * Round constants: + * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311) + */ +const SHA256_K = /* @__PURE__ */ Uint32Array.from([ + 0x428a2f98, + 0x71374491, + 0xb5c0fbcf, + 0xe9b5dba5, + 0x3956c25b, + 0x59f111f1, + 0x923f82a4, + 0xab1c5ed5, + 0xd807aa98, + 0x12835b01, + 0x243185be, + 0x550c7dc3, + 0x72be5d74, + 0x80deb1fe, + 0x9bdc06a7, + 0xc19bf174, + 0xe49b69c1, + 0xefbe4786, + 0x0fc19dc6, + 0x240ca1cc, + 0x2de92c6f, + 0x4a7484aa, + 0x5cb0a9dc, + 0x76f988da, + 0x983e5152, + 0xa831c66d, + 0xb00327c8, + 0xbf597fc7, + 0xc6e00bf3, + 0xd5a79147, + 0x06ca6351, + 0x14292967, + 0x27b70a85, + 0x2e1b2138, + 0x4d2c6dfc, + 0x53380d13, + 0x650a7354, + 0x766a0abb, + 0x81c2c92e, + 0x92722c85, + 0xa2bfe8a1, + 0xa81a664b, + 0xc24b8b70, + 0xc76c51a3, + 0xd192e819, + 0xd6990624, + 0xf40e3585, + 0x106aa070, + 0x19a4c116, + 0x1e376c08, + 0x2748774c, + 0x34b0bcb5, + 0x391c0cb3, + 0x4ed8aa4a, + 0x5b9cca4f, + 0x682e6ff3, + 0x748f82ee, + 0x78a5636f, + 0x84c87814, + 0x8cc70208, + 0x90befffa, + 0xa4506ceb, + 0xbef9a3f7, + 0xc67178f2, +]); +/** Reusable temporary buffer. "W" comes straight from spec. */ +const SHA256_W = /* @__PURE__ */ new Uint32Array(64); +/** Internal 32-byte base SHA2 hash class. */ +class SHA2_32B extends _md_js__WEBPACK_IMPORTED_MODULE_0__.HashMD { + constructor(outputLen) { + super(64, outputLen, 8, false); + } + get() { + const { A, B, C, D, E, F, G, H } = this; + return [A, B, C, D, E, F, G, H]; + } + set(A, B, C, D, E, F, G, H) { + this.A = A | 0; + this.B = B | 0; + this.C = C | 0; + this.D = D | 0; + this.E = E | 0; + this.F = F | 0; + this.G = G | 0; + this.H = H | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA256_W[i] = view.getUint32(offset, false); + } + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; + const s0 = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W15, 7) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W15, 18) ^ (W15 >>> 3); + const s1 = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W2, 17) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(W2, 19) ^ (W2 >>> 10); + SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0; + } + // Compression function main loop, 64 rounds + let { A, B, C, D, E, F, G, H } = this; + for (let i = 0; i < 64; i++) { + const sigma1 = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 6) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 11) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(E, 25); + const T1 = (H + sigma1 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Chi)(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const sigma0 = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 2) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 13) ^ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.rotr)(A, 22); + const T2 = (sigma0 + (0,_md_js__WEBPACK_IMPORTED_MODULE_0__.Maj)(A, B, C)) | 0; + H = G; + G = F; + F = E; + E = (D + T1) | 0; + D = C; + C = B; + B = A; + A = (T1 + T2) | 0; + } + // Add the compressed chunk to the current hash value + A = (A + this.A) | 0; + B = (B + this.B) | 0; + C = (C + this.C) | 0; + D = (D + this.D) | 0; + E = (E + this.E) | 0; + F = (F + this.F) | 0; + G = (G + this.G) | 0; + H = (H + this.H) | 0; + this.set(A, B, C, D, E, F, G, H); + } + roundClean() { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.clean)(SHA256_W); + } + destroy() { + this.set(0, 0, 0, 0, 0, 0, 0, 0); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.clean)(this.buffer); + } +} +/** Internal SHA2-256 hash class. */ +class _SHA256 extends SHA2_32B { + constructor() { + super(32); + // We cannot use array here since array allows indexing by variable + // which means optimizer/compiler cannot use registers. + Object.defineProperty(this, "A", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[0] | 0 + }); + Object.defineProperty(this, "B", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[1] | 0 + }); + Object.defineProperty(this, "C", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[2] | 0 + }); + Object.defineProperty(this, "D", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[3] | 0 + }); + Object.defineProperty(this, "E", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[4] | 0 + }); + Object.defineProperty(this, "F", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[5] | 0 + }); + Object.defineProperty(this, "G", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[6] | 0 + }); + Object.defineProperty(this, "H", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA256_IV[7] | 0 + }); + } +} +// SHA2-512 is slower than sha256 in js because u64 operations are slow. +// Round contants +// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409 +const K512 = /* @__PURE__ */ (() => _u64_js__WEBPACK_IMPORTED_MODULE_1__.split([ + 0x428a2f98d728ae22n, + 0x7137449123ef65cdn, + 0xb5c0fbcfec4d3b2fn, + 0xe9b5dba58189dbbcn, + 0x3956c25bf348b538n, + 0x59f111f1b605d019n, + 0x923f82a4af194f9bn, + 0xab1c5ed5da6d8118n, + 0xd807aa98a3030242n, + 0x12835b0145706fben, + 0x243185be4ee4b28cn, + 0x550c7dc3d5ffb4e2n, + 0x72be5d74f27b896fn, + 0x80deb1fe3b1696b1n, + 0x9bdc06a725c71235n, + 0xc19bf174cf692694n, + 0xe49b69c19ef14ad2n, + 0xefbe4786384f25e3n, + 0x0fc19dc68b8cd5b5n, + 0x240ca1cc77ac9c65n, + 0x2de92c6f592b0275n, + 0x4a7484aa6ea6e483n, + 0x5cb0a9dcbd41fbd4n, + 0x76f988da831153b5n, + 0x983e5152ee66dfabn, + 0xa831c66d2db43210n, + 0xb00327c898fb213fn, + 0xbf597fc7beef0ee4n, + 0xc6e00bf33da88fc2n, + 0xd5a79147930aa725n, + 0x06ca6351e003826fn, + 0x142929670a0e6e70n, + 0x27b70a8546d22ffcn, + 0x2e1b21385c26c926n, + 0x4d2c6dfc5ac42aedn, + 0x53380d139d95b3dfn, + 0x650a73548baf63den, + 0x766a0abb3c77b2a8n, + 0x81c2c92e47edaee6n, + 0x92722c851482353bn, + 0xa2bfe8a14cf10364n, + 0xa81a664bbc423001n, + 0xc24b8b70d0f89791n, + 0xc76c51a30654be30n, + 0xd192e819d6ef5218n, + 0xd69906245565a910n, + 0xf40e35855771202an, + 0x106aa07032bbd1b8n, + 0x19a4c116b8d2d0c8n, + 0x1e376c085141ab53n, + 0x2748774cdf8eeb99n, + 0x34b0bcb5e19b48a8n, + 0x391c0cb3c5c95a63n, + 0x4ed8aa4ae3418acbn, + 0x5b9cca4f7763e373n, + 0x682e6ff3d6b2b8a3n, + 0x748f82ee5defb2fcn, + 0x78a5636f43172f60n, + 0x84c87814a1f0ab72n, + 0x8cc702081a6439ecn, + 0x90befffa23631e28n, + 0xa4506cebde82bde9n, + 0xbef9a3f7b2c67915n, + 0xc67178f2e372532bn, + 0xca273eceea26619cn, + 0xd186b8c721c0c207n, + 0xeada7dd6cde0eb1en, + 0xf57d4f7fee6ed178n, + 0x06f067aa72176fban, + 0x0a637dc5a2c898a6n, + 0x113f9804bef90daen, + 0x1b710b35131c471bn, + 0x28db77f523047d84n, + 0x32caab7b40c72493n, + 0x3c9ebe0a15c9bebcn, + 0x431d67c49c100d4cn, + 0x4cc5d4becb3e42b6n, + 0x597f299cfc657e2an, + 0x5fcb6fab3ad6faecn, + 0x6c44198c4a475817n, +]))(); +const SHA512_Kh = /* @__PURE__ */ (() => K512[0])(); +const SHA512_Kl = /* @__PURE__ */ (() => K512[1])(); +// Reusable temporary buffers +const SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); +const SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); +/** Internal 64-byte base SHA2 hash class. */ +class SHA2_64B extends _md_js__WEBPACK_IMPORTED_MODULE_0__.HashMD { + constructor(outputLen) { + super(128, outputLen, 16, false); + } + get() { + const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; + } + set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { + this.Ah = Ah | 0; + this.Al = Al | 0; + this.Bh = Bh | 0; + this.Bl = Bl | 0; + this.Ch = Ch | 0; + this.Cl = Cl | 0; + this.Dh = Dh | 0; + this.Dl = Dl | 0; + this.Eh = Eh | 0; + this.El = El | 0; + this.Fh = Fh | 0; + this.Fl = Fl | 0; + this.Gh = Gh | 0; + this.Gl = Gl | 0; + this.Hh = Hh | 0; + this.Hl = Hl | 0; + } + process(view, offset) { + // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array + for (let i = 0; i < 16; i++, offset += 4) { + SHA512_W_H[i] = view.getUint32(offset); + SHA512_W_L[i] = view.getUint32(offset += 4); + } + for (let i = 16; i < 80; i++) { + // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7) + const W15h = SHA512_W_H[i - 15] | 0; + const W15l = SHA512_W_L[i - 15] | 0; + const s0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W15h, W15l, 8) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSH(W15h, W15l, 7); + const s0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W15h, W15l, 1) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W15h, W15l, 8) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSL(W15h, W15l, 7); + // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6) + const W2h = SHA512_W_H[i - 2] | 0; + const W2l = SHA512_W_L[i - 2] | 0; + const s1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(W2h, W2l, 61) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSH(W2h, W2l, 6); + const s1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(W2h, W2l, 19) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(W2h, W2l, 61) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.shrSL(W2h, W2l, 6); + // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16]; + const SUMl = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); + const SUMh = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); + SHA512_W_H[i] = SUMh | 0; + SHA512_W_L[i] = SUMl | 0; + } + let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; + // Compression function main loop, 80 rounds + for (let i = 0; i < 80; i++) { + // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41) + const sigma1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Eh, El, 18) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Eh, El, 41); + const sigma1l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Eh, El, 14) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Eh, El, 18) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Eh, El, 41); + //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0; + const CHIh = (Eh & Fh) ^ (~Eh & Gh); + const CHIl = (El & Fl) ^ (~El & Gl); + // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i] + const T1ll = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); + const T1h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); + const T1l = T1ll | 0; + // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39) + const sigma0h = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSH(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Ah, Al, 34) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBH(Ah, Al, 39); + const sigma0l = _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrSL(Ah, Al, 28) ^ _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Ah, Al, 34) ^ + _u64_js__WEBPACK_IMPORTED_MODULE_1__.rotrBL(Ah, Al, 39); + const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch); + const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl); + Hh = Gh | 0; + Hl = Gl | 0; + Gh = Fh | 0; + Gl = Fl | 0; + Fh = Eh | 0; + Fl = El | 0; + ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); + Dh = Ch | 0; + Dl = Cl | 0; + Ch = Bh | 0; + Cl = Bl | 0; + Bh = Ah | 0; + Bl = Al | 0; + const All = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add3L(T1l, sigma0l, MAJl); + Ah = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add3H(All, T1h, sigma0h, MAJh); + Al = All | 0; + } + // Add the compressed chunk to the current hash value + ({ h: Ah, l: Al } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); + ({ h: Bh, l: Bl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); + ({ h: Ch, l: Cl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); + ({ h: Dh, l: Dl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); + ({ h: Eh, l: El } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); + ({ h: Fh, l: Fl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); + ({ h: Gh, l: Gl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); + ({ h: Hh, l: Hl } = _u64_js__WEBPACK_IMPORTED_MODULE_1__.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); + this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); + } + roundClean() { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.clean)(SHA512_W_H, SHA512_W_L); + } + destroy() { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.clean)(this.buffer); + this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + } +} +/** Internal SHA2-512 hash class. */ +class _SHA512 extends SHA2_64B { + constructor() { + super(64); + Object.defineProperty(this, "Ah", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[0] | 0 + }); + Object.defineProperty(this, "Al", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[1] | 0 + }); + Object.defineProperty(this, "Bh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[2] | 0 + }); + Object.defineProperty(this, "Bl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[3] | 0 + }); + Object.defineProperty(this, "Ch", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[4] | 0 + }); + Object.defineProperty(this, "Cl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[5] | 0 + }); + Object.defineProperty(this, "Dh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[6] | 0 + }); + Object.defineProperty(this, "Dl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[7] | 0 + }); + Object.defineProperty(this, "Eh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[8] | 0 + }); + Object.defineProperty(this, "El", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[9] | 0 + }); + Object.defineProperty(this, "Fh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[10] | 0 + }); + Object.defineProperty(this, "Fl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[11] | 0 + }); + Object.defineProperty(this, "Gh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[12] | 0 + }); + Object.defineProperty(this, "Gl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[13] | 0 + }); + Object.defineProperty(this, "Hh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[14] | 0 + }); + Object.defineProperty(this, "Hl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA512_IV[15] | 0 + }); + } +} +class _SHA384 extends SHA2_64B { + constructor() { + super(48); + Object.defineProperty(this, "Ah", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[0] | 0 + }); + Object.defineProperty(this, "Al", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[1] | 0 + }); + Object.defineProperty(this, "Bh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[2] | 0 + }); + Object.defineProperty(this, "Bl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[3] | 0 + }); + Object.defineProperty(this, "Ch", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[4] | 0 + }); + Object.defineProperty(this, "Cl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[5] | 0 + }); + Object.defineProperty(this, "Dh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[6] | 0 + }); + Object.defineProperty(this, "Dl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[7] | 0 + }); + Object.defineProperty(this, "Eh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[8] | 0 + }); + Object.defineProperty(this, "El", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[9] | 0 + }); + Object.defineProperty(this, "Fh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[10] | 0 + }); + Object.defineProperty(this, "Fl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[11] | 0 + }); + Object.defineProperty(this, "Gh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[12] | 0 + }); + Object.defineProperty(this, "Gl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[13] | 0 + }); + Object.defineProperty(this, "Hh", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[14] | 0 + }); + Object.defineProperty(this, "Hl", { + enumerable: true, + configurable: true, + writable: true, + value: _md_js__WEBPACK_IMPORTED_MODULE_0__.SHA384_IV[15] | 0 + }); + } +} +/** + * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info: + * + * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack. + * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025. + * - Each sha256 hash is executing 2^18 bit operations. + * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule. + */ +const sha256 = /* @__PURE__ */ (0,_hash_js__WEBPACK_IMPORTED_MODULE_3__.createHasher)(() => new _SHA256(), +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.oidNist)(0x01)); +/** SHA2-512 hash function from RFC 4634. */ +const sha512 = /* @__PURE__ */ (0,_hash_js__WEBPACK_IMPORTED_MODULE_3__.createHasher)(() => new _SHA512(), +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.oidNist)(0x03)); +/** SHA2-384 hash function from RFC 4634. */ +const sha384 = /* @__PURE__ */ (0,_hash_js__WEBPACK_IMPORTED_MODULE_3__.createHasher)(() => new _SHA384(), +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_2__.oidNist)(0x02)); + + +/***/ }), + +/***/ 31555: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/abstract/hash-to-curve.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createHasher: () => (/* binding */ createHasher), +/* harmony export */ expand_message_xmd: () => (/* binding */ expand_message_xmd), +/* harmony export */ expand_message_xof: () => (/* binding */ expand_message_xof), +/* harmony export */ hash_to_field: () => (/* binding */ hash_to_field), +/* harmony export */ isogenyMap: () => (/* binding */ isogenyMap) +/* harmony export */ }); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ 51733); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 96926); + + +// Octet Stream to Integer. "spec" implementation of os2ip is 2.5x slower vs bytesToNumberBE. +const os2ip = _utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE; +// Integer to Octet Stream (numberToBytesBE) +function i2osp(value, length) { + anum(value); + anum(length); + if (value < 0 || value >= 1 << (8 * length)) + throw new Error('invalid I2OSP input: ' + value); + const res = Array.from({ length }).fill(0); + for (let i = length - 1; i >= 0; i--) { + res[i] = value & 0xff; + value >>>= 8; + } + return new Uint8Array(res); +} +function strxor(a, b) { + const arr = new Uint8Array(a.length); + for (let i = 0; i < a.length; i++) { + arr[i] = a[i] ^ b[i]; + } + return arr; +} +function anum(item) { + if (!Number.isSafeInteger(item)) + throw new Error('number expected'); +} +/** + * Produces a uniformly random byte string using a cryptographic hash function H that outputs b bits. + * [RFC 9380 5.3.1](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.1). + */ +function expand_message_xmd(msg, DST, lenInBytes, H) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(DST); + anum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + if (DST.length > 255) + DST = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-'), DST)); + const { outputLen: b_in_bytes, blockLen: r_in_bytes } = H; + const ell = Math.ceil(lenInBytes / b_in_bytes); + if (lenInBytes > 65535 || ell > 255) + throw new Error('expand_message_xmd: invalid lenInBytes'); + const DST_prime = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(DST, i2osp(DST.length, 1)); + const Z_pad = i2osp(0, r_in_bytes); + const l_i_b_str = i2osp(lenInBytes, 2); // len_in_bytes_str + const b = new Array(ell); + const b_0 = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(Z_pad, msg, l_i_b_str, i2osp(0, 1), DST_prime)); + b[0] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(b_0, i2osp(1, 1), DST_prime)); + for (let i = 1; i <= ell; i++) { + const args = [strxor(b_0, b[i - 1]), i2osp(i + 1, 1), DST_prime]; + b[i] = H((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...args)); + } + const pseudo_random_bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...b); + return pseudo_random_bytes.slice(0, lenInBytes); +} +/** + * Produces a uniformly random byte string using an extendable-output function (XOF) H. + * 1. The collision resistance of H MUST be at least k bits. + * 2. H MUST be an XOF that has been proved indifferentiable from + * a random oracle under a reasonable cryptographic assumption. + * [RFC 9380 5.3.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.3.2). + */ +function expand_message_xof(msg, DST, lenInBytes, k, H) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(DST); + anum(lenInBytes); + // https://www.rfc-editor.org/rfc/rfc9380#section-5.3.3 + // DST = H('H2C-OVERSIZE-DST-' || a_very_long_DST, Math.ceil((lenInBytes * k) / 8)); + if (DST.length > 255) { + const dkLen = Math.ceil((2 * k) / 8); + DST = H.create({ dkLen }).update((0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)('H2C-OVERSIZE-DST-')).update(DST).digest(); + } + if (lenInBytes > 65535 || DST.length > 255) + throw new Error('expand_message_xof: invalid lenInBytes'); + return (H.create({ dkLen: lenInBytes }) + .update(msg) + .update(i2osp(lenInBytes, 2)) + // 2. DST_prime = DST || I2OSP(len(DST), 1) + .update(DST) + .update(i2osp(DST.length, 1)) + .digest()); +} +/** + * Hashes arbitrary-length byte strings to a list of one or more elements of a finite field F. + * [RFC 9380 5.2](https://www.rfc-editor.org/rfc/rfc9380#section-5.2). + * @param msg a byte string containing the message to hash + * @param count the number of elements of F to output + * @param options `{DST: string, p: bigint, m: number, k: number, expand: 'xmd' | 'xof', hash: H}`, see above + * @returns [u_0, ..., u_(count - 1)], a list of field elements. + */ +function hash_to_field(msg, count, options) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(options, { + DST: 'stringOrUint8Array', + p: 'bigint', + m: 'isSafeInteger', + k: 'isSafeInteger', + hash: 'hash', + }); + const { p, k, m, hash, expand, DST: _DST } = options; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(msg); + anum(count); + const DST = typeof _DST === 'string' ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(_DST) : _DST; + const log2p = p.toString(2).length; + const L = Math.ceil((log2p + k) / 8); // section 5.1 of ietf draft link above + const len_in_bytes = count * m * L; + let prb; // pseudo_random_bytes + if (expand === 'xmd') { + prb = expand_message_xmd(msg, DST, len_in_bytes, hash); + } + else if (expand === 'xof') { + prb = expand_message_xof(msg, DST, len_in_bytes, k, hash); + } + else if (expand === '_internal_pass') { + // for internal tests only + prb = msg; + } + else { + throw new Error('expand must be "xmd" or "xof"'); + } + const u = new Array(count); + for (let i = 0; i < count; i++) { + const e = new Array(m); + for (let j = 0; j < m; j++) { + const elm_offset = L * (j + i * m); + const tv = prb.subarray(elm_offset, elm_offset + L); + e[j] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.mod)(os2ip(tv), p); + } + u[i] = e; + } + return u; +} +function isogenyMap(field, map) { + // Make same order as in spec + const coeff = map.map((i) => Array.from(i).reverse()); + return (x, y) => { + const [xn, xd, yn, yd] = coeff.map((val) => val.reduce((acc, i) => field.add(field.mul(acc, x), i))); + // 6.6.3 + // Exceptional cases of iso_map are inputs that cause the denominator of + // either rational function to evaluate to zero; such cases MUST return + // the identity point on E. + const [xd_inv, yd_inv] = (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.FpInvertBatch)(field, [xd, yd], true); + x = field.mul(xn, xd_inv); // xNum / xDen + y = field.mul(y, field.mul(yn, yd_inv)); // y * (yNum / yDev) + return { x, y }; + }; +} +/** Creates hash-to-curve methods from EC Point and mapToCurve function. */ +function createHasher(Point, mapToCurve, defaults) { + if (typeof mapToCurve !== 'function') + throw new Error('mapToCurve() must be defined'); + function map(num) { + return Point.fromAffine(mapToCurve(num)); + } + function clear(initial) { + const P = initial.clearCofactor(); + if (P.equals(Point.ZERO)) + return Point.ZERO; // zero will throw in assert + P.assertValidity(); + return P; + } + return { + defaults, + // Encodes byte string to elliptic curve. + // hash_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + hashToCurve(msg, options) { + const u = hash_to_field(msg, 2, { ...defaults, DST: defaults.DST, ...options }); + const u0 = map(u[0]); + const u1 = map(u[1]); + return clear(u0.add(u1)); + }, + // Encodes byte string to elliptic curve. + // encode_to_curve from https://www.rfc-editor.org/rfc/rfc9380#section-3 + encodeToCurve(msg, options) { + const u = hash_to_field(msg, 1, { ...defaults, DST: defaults.encodeDST, ...options }); + return clear(map(u[0])); + }, + // Same as encodeToCurve, but without hash + mapToCurve(scalars) { + if (!Array.isArray(scalars)) + throw new Error('expected array of bigints'); + for (const i of scalars) + if (typeof i !== 'bigint') + throw new Error('expected array of bigints'); + return clear(map(scalars)); + }, + }; +} +//# sourceMappingURL=hash-to-curve.js.map + +/***/ }), + +/***/ 31643: +/*!***********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/policy_mappings.js ***! + \***********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PolicyMapping: () => (/* binding */ PolicyMapping), +/* harmony export */ PolicyMappings: () => (/* binding */ PolicyMappings), +/* harmony export */ id_ce_policyMappings: () => (/* binding */ id_ce_policyMappings) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var PolicyMappings_1; + + + +const id_ce_policyMappings = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.33`; +class PolicyMapping { + issuerDomainPolicy = ""; + subjectDomainPolicy = ""; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], PolicyMapping.prototype, "issuerDomainPolicy", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], PolicyMapping.prototype, "subjectDomainPolicy", void 0); +let PolicyMappings = PolicyMappings_1 = class PolicyMappings extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, PolicyMappings_1.prototype); + } +}; +PolicyMappings = PolicyMappings_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: PolicyMapping, + }) +], PolicyMappings); + + + +/***/ }), + +/***/ 31644: +/*!*****************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@solana+web3.js@1.98.4_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/@solana/web3.js/lib/index.browser.esm.js ***! + \*****************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Account: () => (/* binding */ Account), +/* harmony export */ AddressLookupTableAccount: () => (/* binding */ AddressLookupTableAccount), +/* harmony export */ AddressLookupTableInstruction: () => (/* binding */ AddressLookupTableInstruction), +/* harmony export */ AddressLookupTableProgram: () => (/* binding */ AddressLookupTableProgram), +/* harmony export */ Authorized: () => (/* binding */ Authorized), +/* harmony export */ BLOCKHASH_CACHE_TIMEOUT_MS: () => (/* binding */ BLOCKHASH_CACHE_TIMEOUT_MS), +/* harmony export */ BPF_LOADER_DEPRECATED_PROGRAM_ID: () => (/* binding */ BPF_LOADER_DEPRECATED_PROGRAM_ID), +/* harmony export */ BPF_LOADER_PROGRAM_ID: () => (/* binding */ BPF_LOADER_PROGRAM_ID), +/* harmony export */ BpfLoader: () => (/* binding */ BpfLoader), +/* harmony export */ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS: () => (/* binding */ COMPUTE_BUDGET_INSTRUCTION_LAYOUTS), +/* harmony export */ ComputeBudgetInstruction: () => (/* binding */ ComputeBudgetInstruction), +/* harmony export */ ComputeBudgetProgram: () => (/* binding */ ComputeBudgetProgram), +/* harmony export */ Connection: () => (/* binding */ Connection), +/* harmony export */ Ed25519Program: () => (/* binding */ Ed25519Program), +/* harmony export */ Enum: () => (/* binding */ Enum), +/* harmony export */ EpochSchedule: () => (/* binding */ EpochSchedule), +/* harmony export */ FeeCalculatorLayout: () => (/* binding */ FeeCalculatorLayout), +/* harmony export */ Keypair: () => (/* binding */ Keypair), +/* harmony export */ LAMPORTS_PER_SOL: () => (/* binding */ LAMPORTS_PER_SOL), +/* harmony export */ LOOKUP_TABLE_INSTRUCTION_LAYOUTS: () => (/* binding */ LOOKUP_TABLE_INSTRUCTION_LAYOUTS), +/* harmony export */ Loader: () => (/* binding */ Loader), +/* harmony export */ Lockup: () => (/* binding */ Lockup), +/* harmony export */ MAX_SEED_LENGTH: () => (/* binding */ MAX_SEED_LENGTH), +/* harmony export */ Message: () => (/* binding */ Message), +/* harmony export */ MessageAccountKeys: () => (/* binding */ MessageAccountKeys), +/* harmony export */ MessageV0: () => (/* binding */ MessageV0), +/* harmony export */ NONCE_ACCOUNT_LENGTH: () => (/* binding */ NONCE_ACCOUNT_LENGTH), +/* harmony export */ NonceAccount: () => (/* binding */ NonceAccount), +/* harmony export */ PACKET_DATA_SIZE: () => (/* binding */ PACKET_DATA_SIZE), +/* harmony export */ PUBLIC_KEY_LENGTH: () => (/* binding */ PUBLIC_KEY_LENGTH), +/* harmony export */ PublicKey: () => (/* binding */ PublicKey), +/* harmony export */ SIGNATURE_LENGTH_IN_BYTES: () => (/* binding */ SIGNATURE_LENGTH_IN_BYTES), +/* harmony export */ SOLANA_SCHEMA: () => (/* binding */ SOLANA_SCHEMA), +/* harmony export */ STAKE_CONFIG_ID: () => (/* binding */ STAKE_CONFIG_ID), +/* harmony export */ STAKE_INSTRUCTION_LAYOUTS: () => (/* binding */ STAKE_INSTRUCTION_LAYOUTS), +/* harmony export */ SYSTEM_INSTRUCTION_LAYOUTS: () => (/* binding */ SYSTEM_INSTRUCTION_LAYOUTS), +/* harmony export */ SYSVAR_CLOCK_PUBKEY: () => (/* binding */ SYSVAR_CLOCK_PUBKEY), +/* harmony export */ SYSVAR_EPOCH_SCHEDULE_PUBKEY: () => (/* binding */ SYSVAR_EPOCH_SCHEDULE_PUBKEY), +/* harmony export */ SYSVAR_INSTRUCTIONS_PUBKEY: () => (/* binding */ SYSVAR_INSTRUCTIONS_PUBKEY), +/* harmony export */ SYSVAR_RECENT_BLOCKHASHES_PUBKEY: () => (/* binding */ SYSVAR_RECENT_BLOCKHASHES_PUBKEY), +/* harmony export */ SYSVAR_RENT_PUBKEY: () => (/* binding */ SYSVAR_RENT_PUBKEY), +/* harmony export */ SYSVAR_REWARDS_PUBKEY: () => (/* binding */ SYSVAR_REWARDS_PUBKEY), +/* harmony export */ SYSVAR_SLOT_HASHES_PUBKEY: () => (/* binding */ SYSVAR_SLOT_HASHES_PUBKEY), +/* harmony export */ SYSVAR_SLOT_HISTORY_PUBKEY: () => (/* binding */ SYSVAR_SLOT_HISTORY_PUBKEY), +/* harmony export */ SYSVAR_STAKE_HISTORY_PUBKEY: () => (/* binding */ SYSVAR_STAKE_HISTORY_PUBKEY), +/* harmony export */ Secp256k1Program: () => (/* binding */ Secp256k1Program), +/* harmony export */ SendTransactionError: () => (/* binding */ SendTransactionError), +/* harmony export */ SolanaJSONRPCError: () => (/* binding */ SolanaJSONRPCError), +/* harmony export */ SolanaJSONRPCErrorCode: () => (/* binding */ SolanaJSONRPCErrorCode), +/* harmony export */ StakeAuthorizationLayout: () => (/* binding */ StakeAuthorizationLayout), +/* harmony export */ StakeInstruction: () => (/* binding */ StakeInstruction), +/* harmony export */ StakeProgram: () => (/* binding */ StakeProgram), +/* harmony export */ Struct: () => (/* binding */ Struct), +/* harmony export */ SystemInstruction: () => (/* binding */ SystemInstruction), +/* harmony export */ SystemProgram: () => (/* binding */ SystemProgram), +/* harmony export */ Transaction: () => (/* binding */ Transaction), +/* harmony export */ TransactionExpiredBlockheightExceededError: () => (/* binding */ TransactionExpiredBlockheightExceededError), +/* harmony export */ TransactionExpiredNonceInvalidError: () => (/* binding */ TransactionExpiredNonceInvalidError), +/* harmony export */ TransactionExpiredTimeoutError: () => (/* binding */ TransactionExpiredTimeoutError), +/* harmony export */ TransactionInstruction: () => (/* binding */ TransactionInstruction), +/* harmony export */ TransactionMessage: () => (/* binding */ TransactionMessage), +/* harmony export */ TransactionStatus: () => (/* binding */ TransactionStatus), +/* harmony export */ VALIDATOR_INFO_KEY: () => (/* binding */ VALIDATOR_INFO_KEY), +/* harmony export */ VERSION_PREFIX_MASK: () => (/* binding */ VERSION_PREFIX_MASK), +/* harmony export */ VOTE_PROGRAM_ID: () => (/* binding */ VOTE_PROGRAM_ID), +/* harmony export */ ValidatorInfo: () => (/* binding */ ValidatorInfo), +/* harmony export */ VersionedMessage: () => (/* binding */ VersionedMessage), +/* harmony export */ VersionedTransaction: () => (/* binding */ VersionedTransaction), +/* harmony export */ VoteAccount: () => (/* binding */ VoteAccount), +/* harmony export */ VoteAuthorizationLayout: () => (/* binding */ VoteAuthorizationLayout), +/* harmony export */ VoteInit: () => (/* binding */ VoteInit), +/* harmony export */ VoteInstruction: () => (/* binding */ VoteInstruction), +/* harmony export */ VoteProgram: () => (/* binding */ VoteProgram), +/* harmony export */ clusterApiUrl: () => (/* binding */ clusterApiUrl), +/* harmony export */ sendAndConfirmRawTransaction: () => (/* binding */ sendAndConfirmRawTransaction), +/* harmony export */ sendAndConfirmTransaction: () => (/* binding */ sendAndConfirmTransaction) +/* harmony export */ }); +/* harmony import */ var buffer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! buffer */ 62266); +/* harmony import */ var _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/curves/ed25519 */ 2998); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! bn.js */ 40113); +/* harmony import */ var bn_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(bn_js__WEBPACK_IMPORTED_MODULE_2__); +/* harmony import */ var bs58__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! bs58 */ 34318); +/* harmony import */ var bs58__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(bs58__WEBPACK_IMPORTED_MODULE_3__); +/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @noble/hashes/sha256 */ 30318); +/* harmony import */ var borsh__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! borsh */ 4610); +/* harmony import */ var borsh__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(borsh__WEBPACK_IMPORTED_MODULE_5__); +/* harmony import */ var _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @solana/buffer-layout */ 33852); +/* harmony import */ var _solana_codecs_numbers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @solana/codecs-numbers */ 10463); +/* harmony import */ var superstruct__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! superstruct */ 23798); +/* harmony import */ var jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! jayson/lib/client/browser */ 96209); +/* harmony import */ var jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_9__); +/* harmony import */ var rpc_websockets__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! rpc-websockets */ 8057); +/* harmony import */ var _noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! @noble/hashes/sha3 */ 52114); +/* harmony import */ var _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! @noble/curves/secp256k1 */ 48319); + + + + + + + + + + + + + + + +/** + * A 64 byte secret key, the first 32 bytes of which is the + * private scalar and the last 32 bytes is the public key. + * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ + */ + +/** + * Ed25519 Keypair + */ + +const generatePrivateKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.utils.randomPrivateKey; +const generateKeypair = () => { + const privateScalar = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.utils.randomPrivateKey(); + const publicKey = getPublicKey(privateScalar); + const secretKey = new Uint8Array(64); + secretKey.set(privateScalar); + secretKey.set(publicKey, 32); + return { + publicKey, + secretKey + }; +}; +const getPublicKey = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.getPublicKey; +function isOnCurve(publicKey) { + try { + _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.ExtendedPoint.fromHex(publicKey); + return true; + } catch { + return false; + } +} +const sign = (message, secretKey) => _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.sign(message, secretKey.slice(0, 32)); +const verify = _noble_curves_ed25519__WEBPACK_IMPORTED_MODULE_1__.ed25519.verify; + +const toBuffer = arr => { + if (buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.isBuffer(arr)) { + return arr; + } else if (arr instanceof Uint8Array) { + return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(arr.buffer, arr.byteOffset, arr.byteLength); + } else { + return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(arr); + } +}; + +// Class wrapping a plain object +class Struct { + constructor(properties) { + Object.assign(this, properties); + } + encode() { + return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,borsh__WEBPACK_IMPORTED_MODULE_5__.serialize)(SOLANA_SCHEMA, this)); + } + static decode(data) { + return (0,borsh__WEBPACK_IMPORTED_MODULE_5__.deserialize)(SOLANA_SCHEMA, this, data); + } + static decodeUnchecked(data) { + return (0,borsh__WEBPACK_IMPORTED_MODULE_5__.deserializeUnchecked)(SOLANA_SCHEMA, this, data); + } +} + +// Class representing a Rust-compatible enum, since enums are only strings or +// numbers in pure JS +class Enum extends Struct { + constructor(properties) { + super(properties); + this.enum = ''; + if (Object.keys(properties).length !== 1) { + throw new Error('Enum can only take single value'); + } + Object.keys(properties).map(key => { + this.enum = key; + }); + } +} +const SOLANA_SCHEMA = new Map(); + +var _PublicKey; + +/** + * Maximum length of derived pubkey seed + */ +const MAX_SEED_LENGTH = 32; + +/** + * Size of public key in bytes + */ +const PUBLIC_KEY_LENGTH = 32; + +/** + * Value to be converted into public key + */ + +/** + * JSON object representation of PublicKey class + */ + +function isPublicKeyData(value) { + return value._bn !== undefined; +} + +// local counter used by PublicKey.unique() +let uniquePublicKeyCounter = 1; + +/** + * A public key + */ +class PublicKey extends Struct { + /** + * Create a new PublicKey object + * @param value ed25519 public key as buffer or base-58 encoded string + */ + constructor(value) { + super({}); + /** @internal */ + this._bn = void 0; + if (isPublicKeyData(value)) { + this._bn = value._bn; + } else { + if (typeof value === 'string') { + // assume base 58 encoding by default + const decoded = bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(value); + if (decoded.length != PUBLIC_KEY_LENGTH) { + throw new Error(`Invalid public key input`); + } + this._bn = new (bn_js__WEBPACK_IMPORTED_MODULE_2___default())(decoded); + } else { + this._bn = new (bn_js__WEBPACK_IMPORTED_MODULE_2___default())(value); + } + if (this._bn.byteLength() > PUBLIC_KEY_LENGTH) { + throw new Error(`Invalid public key input`); + } + } + } + + /** + * Returns a unique PublicKey for tests and benchmarks using a counter + */ + static unique() { + const key = new PublicKey(uniquePublicKeyCounter); + uniquePublicKeyCounter += 1; + return new PublicKey(key.toBuffer()); + } + + /** + * Default public key value. The base58-encoded string representation is all ones (as seen below) + * The underlying BN number is 32 bytes that are all zeros + */ + + /** + * Checks if two publicKeys are equal + */ + equals(publicKey) { + return this._bn.eq(publicKey._bn); + } + + /** + * Return the base-58 representation of the public key + */ + toBase58() { + return bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(this.toBytes()); + } + toJSON() { + return this.toBase58(); + } + + /** + * Return the byte array representation of the public key in big endian + */ + toBytes() { + const buf = this.toBuffer(); + return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); + } + + /** + * Return the Buffer representation of the public key in big endian + */ + toBuffer() { + const b = this._bn.toArrayLike(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer); + if (b.length === PUBLIC_KEY_LENGTH) { + return b; + } + const zeroPad = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(32); + b.copy(zeroPad, 32 - b.length); + return zeroPad; + } + get [Symbol.toStringTag]() { + return `PublicKey(${this.toString()})`; + } + + /** + * Return the base-58 representation of the public key + */ + toString() { + return this.toBase58(); + } + + /** + * Derive a public key from another key, a seed, and a program ID. + * The program ID will also serve as the owner of the public key, giving + * it permission to write data to the account. + */ + /* eslint-disable require-await */ + static async createWithSeed(fromPublicKey, seed, programId) { + const buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([fromPublicKey.toBuffer(), buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(seed), programId.toBuffer()]); + const publicKeyBytes = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_4__.sha256)(buffer); + return new PublicKey(publicKeyBytes); + } + + /** + * Derive a program address from seeds and a program ID. + */ + /* eslint-disable require-await */ + static createProgramAddressSync(seeds, programId) { + let buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(0); + seeds.forEach(function (seed) { + if (seed.length > MAX_SEED_LENGTH) { + throw new TypeError(`Max seed length exceeded`); + } + buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([buffer, toBuffer(seed)]); + }); + buffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([buffer, programId.toBuffer(), buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from('ProgramDerivedAddress')]); + const publicKeyBytes = (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_4__.sha256)(buffer); + if (isOnCurve(publicKeyBytes)) { + throw new Error(`Invalid seeds, address must fall off the curve`); + } + return new PublicKey(publicKeyBytes); + } + + /** + * Async version of createProgramAddressSync + * For backwards compatibility + * + * @deprecated Use {@link createProgramAddressSync} instead + */ + /* eslint-disable require-await */ + static async createProgramAddress(seeds, programId) { + return this.createProgramAddressSync(seeds, programId); + } + + /** + * Find a valid program address + * + * Valid program addresses must fall off the ed25519 curve. This function + * iterates a nonce until it finds one that when combined with the seeds + * results in a valid program address. + */ + static findProgramAddressSync(seeds, programId) { + let nonce = 255; + let address; + while (nonce != 0) { + try { + const seedsWithNonce = seeds.concat(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([nonce])); + address = this.createProgramAddressSync(seedsWithNonce, programId); + } catch (err) { + if (err instanceof TypeError) { + throw err; + } + nonce--; + continue; + } + return [address, nonce]; + } + throw new Error(`Unable to find a viable program address nonce`); + } + + /** + * Async version of findProgramAddressSync + * For backwards compatibility + * + * @deprecated Use {@link findProgramAddressSync} instead + */ + static async findProgramAddress(seeds, programId) { + return this.findProgramAddressSync(seeds, programId); + } + + /** + * Check that a pubkey is on the ed25519 curve. + */ + static isOnCurve(pubkeyData) { + const pubkey = new PublicKey(pubkeyData); + return isOnCurve(pubkey.toBytes()); + } +} +_PublicKey = PublicKey; +PublicKey.default = new _PublicKey('11111111111111111111111111111111'); +SOLANA_SCHEMA.set(PublicKey, { + kind: 'struct', + fields: [['_bn', 'u256']] +}); + +/** + * An account key pair (public and secret keys). + * + * @deprecated since v1.10.0, please use {@link Keypair} instead. + */ +class Account { + /** + * Create a new Account object + * + * If the secretKey parameter is not provided a new key pair is randomly + * created for the account + * + * @param secretKey Secret key for the account + */ + constructor(secretKey) { + /** @internal */ + this._publicKey = void 0; + /** @internal */ + this._secretKey = void 0; + if (secretKey) { + const secretKeyBuffer = toBuffer(secretKey); + if (secretKey.length !== 64) { + throw new Error('bad secret key size'); + } + this._publicKey = secretKeyBuffer.slice(32, 64); + this._secretKey = secretKeyBuffer.slice(0, 32); + } else { + this._secretKey = toBuffer(generatePrivateKey()); + this._publicKey = toBuffer(getPublicKey(this._secretKey)); + } + } + + /** + * The public key for this account + */ + get publicKey() { + return new PublicKey(this._publicKey); + } + + /** + * The **unencrypted** secret key for this account. The first 32 bytes + * is the private scalar and the last 32 bytes is the public key. + * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/ + */ + get secretKey() { + return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.concat([this._secretKey, this._publicKey], 64); + } +} + +const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey('BPFLoader1111111111111111111111111111111111'); + +/** + * Maximum over-the-wire size of a Transaction + * + * 1280 is IPv6 minimum MTU + * 40 bytes is the size of the IPv6 header + * 8 bytes is the size of the fragment header + */ +const PACKET_DATA_SIZE = 1280 - 40 - 8; +const VERSION_PREFIX_MASK = 0x7f; +const SIGNATURE_LENGTH_IN_BYTES = 64; + +class TransactionExpiredBlockheightExceededError extends Error { + constructor(signature) { + super(`Signature ${signature} has expired: block height exceeded.`); + this.signature = void 0; + this.signature = signature; + } +} +Object.defineProperty(TransactionExpiredBlockheightExceededError.prototype, 'name', { + value: 'TransactionExpiredBlockheightExceededError' +}); +class TransactionExpiredTimeoutError extends Error { + constructor(signature, timeoutSeconds) { + super(`Transaction was not confirmed in ${timeoutSeconds.toFixed(2)} seconds. It is ` + 'unknown if it succeeded or failed. Check signature ' + `${signature} using the Solana Explorer or CLI tools.`); + this.signature = void 0; + this.signature = signature; + } +} +Object.defineProperty(TransactionExpiredTimeoutError.prototype, 'name', { + value: 'TransactionExpiredTimeoutError' +}); +class TransactionExpiredNonceInvalidError extends Error { + constructor(signature) { + super(`Signature ${signature} has expired: the nonce is no longer valid.`); + this.signature = void 0; + this.signature = signature; + } +} +Object.defineProperty(TransactionExpiredNonceInvalidError.prototype, 'name', { + value: 'TransactionExpiredNonceInvalidError' +}); + +class MessageAccountKeys { + constructor(staticAccountKeys, accountKeysFromLookups) { + this.staticAccountKeys = void 0; + this.accountKeysFromLookups = void 0; + this.staticAccountKeys = staticAccountKeys; + this.accountKeysFromLookups = accountKeysFromLookups; + } + keySegments() { + const keySegments = [this.staticAccountKeys]; + if (this.accountKeysFromLookups) { + keySegments.push(this.accountKeysFromLookups.writable); + keySegments.push(this.accountKeysFromLookups.readonly); + } + return keySegments; + } + get(index) { + for (const keySegment of this.keySegments()) { + if (index < keySegment.length) { + return keySegment[index]; + } else { + index -= keySegment.length; + } + } + return; + } + get length() { + return this.keySegments().flat().length; + } + compileInstructions(instructions) { + // Bail early if any account indexes would overflow a u8 + const U8_MAX = 255; + if (this.length > U8_MAX + 1) { + throw new Error('Account index overflow encountered during compilation'); + } + const keyIndexMap = new Map(); + this.keySegments().flat().forEach((key, index) => { + keyIndexMap.set(key.toBase58(), index); + }); + const findKeyIndex = key => { + const keyIndex = keyIndexMap.get(key.toBase58()); + if (keyIndex === undefined) throw new Error('Encountered an unknown instruction account key during compilation'); + return keyIndex; + }; + return instructions.map(instruction => { + return { + programIdIndex: findKeyIndex(instruction.programId), + accountKeyIndexes: instruction.keys.map(meta => findKeyIndex(meta.pubkey)), + data: instruction.data + }; + }); + } +} + +/** + * Layout for a public key + */ +const publicKey = (property = 'publicKey') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(32, property); +}; + +/** + * Layout for a signature + */ +const signature = (property = 'signature') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(64, property); +}; +/** + * Layout for a Rust String type + */ +const rustString = (property = 'string') => { + const rsl = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('length'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('lengthPadding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'chars')], property); + const _decode = rsl.decode.bind(rsl); + const _encode = rsl.encode.bind(rsl); + const rslShim = rsl; + rslShim.decode = (b, offset) => { + const data = _decode(b, offset); + return data['chars'].toString(); + }; + rslShim.encode = (str, b, offset) => { + const data = { + chars: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(str, 'utf8') + }; + return _encode(data, b, offset); + }; + rslShim.alloc = str => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32().span + _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32().span + buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(str, 'utf8').length; + }; + return rslShim; +}; + +/** + * Layout for an Authorized object + */ +const authorized = (property = 'authorized') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([publicKey('staker'), publicKey('withdrawer')], property); +}; + +/** + * Layout for a Lockup object + */ +const lockup = (property = 'lockup') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('unixTimestamp'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('epoch'), publicKey('custodian')], property); +}; + +/** + * Layout for a VoteInit object + */ +const voteInit = (property = 'voteInit') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([publicKey('nodePubkey'), publicKey('authorizedVoter'), publicKey('authorizedWithdrawer'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('commission')], property); +}; + +/** + * Layout for a VoteAuthorizeWithSeedArgs object + */ +const voteAuthorizeWithSeedArgs = (property = 'voteAuthorizeWithSeedArgs') => { + return _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('voteAuthorizationType'), publicKey('currentAuthorityDerivedKeyOwnerPubkey'), rustString('currentAuthorityDerivedKeySeed'), publicKey('newAuthorized')], property); +}; +function getAlloc(type, fields) { + const getItemAlloc = item => { + if (item.span >= 0) { + return item.span; + } else if (typeof item.alloc === 'function') { + return item.alloc(fields[item.property]); + } else if ('count' in item && 'elementLayout' in item) { + const field = fields[item.property]; + if (Array.isArray(field)) { + return field.length * getItemAlloc(item.elementLayout); + } + } else if ('fields' in item) { + // This is a `Structure` whose size needs to be recursively measured. + return getAlloc({ + layout: item + }, fields[item.property]); + } + // Couldn't determine allocated size of layout + return 0; + }; + let alloc = 0; + type.layout.fields.forEach(item => { + alloc += getItemAlloc(item); + }); + return alloc; +} + +function decodeLength(bytes) { + let len = 0; + let size = 0; + for (;;) { + let elem = bytes.shift(); + len |= (elem & 0x7f) << size * 7; + size += 1; + if ((elem & 0x80) === 0) { + break; + } + } + return len; +} +function encodeLength(bytes, len) { + let rem_len = len; + for (;;) { + let elem = rem_len & 0x7f; + rem_len >>= 7; + if (rem_len == 0) { + bytes.push(elem); + break; + } else { + elem |= 0x80; + bytes.push(elem); + } + } +} + +function assert (condition, message) { + if (!condition) { + throw new Error(message || 'Assertion failed'); + } +} + +class CompiledKeys { + constructor(payer, keyMetaMap) { + this.payer = void 0; + this.keyMetaMap = void 0; + this.payer = payer; + this.keyMetaMap = keyMetaMap; + } + static compile(instructions, payer) { + const keyMetaMap = new Map(); + const getOrInsertDefault = pubkey => { + const address = pubkey.toBase58(); + let keyMeta = keyMetaMap.get(address); + if (keyMeta === undefined) { + keyMeta = { + isSigner: false, + isWritable: false, + isInvoked: false + }; + keyMetaMap.set(address, keyMeta); + } + return keyMeta; + }; + const payerKeyMeta = getOrInsertDefault(payer); + payerKeyMeta.isSigner = true; + payerKeyMeta.isWritable = true; + for (const ix of instructions) { + getOrInsertDefault(ix.programId).isInvoked = true; + for (const accountMeta of ix.keys) { + const keyMeta = getOrInsertDefault(accountMeta.pubkey); + keyMeta.isSigner ||= accountMeta.isSigner; + keyMeta.isWritable ||= accountMeta.isWritable; + } + } + return new CompiledKeys(payer, keyMetaMap); + } + getMessageComponents() { + const mapEntries = [...this.keyMetaMap.entries()]; + assert(mapEntries.length <= 256, 'Max static account keys length exceeded'); + const writableSigners = mapEntries.filter(([, meta]) => meta.isSigner && meta.isWritable); + const readonlySigners = mapEntries.filter(([, meta]) => meta.isSigner && !meta.isWritable); + const writableNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && meta.isWritable); + const readonlyNonSigners = mapEntries.filter(([, meta]) => !meta.isSigner && !meta.isWritable); + const header = { + numRequiredSignatures: writableSigners.length + readonlySigners.length, + numReadonlySignedAccounts: readonlySigners.length, + numReadonlyUnsignedAccounts: readonlyNonSigners.length + }; + + // sanity checks + { + assert(writableSigners.length > 0, 'Expected at least one writable signer key'); + const [payerAddress] = writableSigners[0]; + assert(payerAddress === this.payer.toBase58(), 'Expected first writable signer key to be the fee payer'); + } + const staticAccountKeys = [...writableSigners.map(([address]) => new PublicKey(address)), ...readonlySigners.map(([address]) => new PublicKey(address)), ...writableNonSigners.map(([address]) => new PublicKey(address)), ...readonlyNonSigners.map(([address]) => new PublicKey(address))]; + return [header, staticAccountKeys]; + } + extractTableLookup(lookupTable) { + const [writableIndexes, drainedWritableKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && keyMeta.isWritable); + const [readonlyIndexes, drainedReadonlyKeys] = this.drainKeysFoundInLookupTable(lookupTable.state.addresses, keyMeta => !keyMeta.isSigner && !keyMeta.isInvoked && !keyMeta.isWritable); + + // Don't extract lookup if no keys were found + if (writableIndexes.length === 0 && readonlyIndexes.length === 0) { + return; + } + return [{ + accountKey: lookupTable.key, + writableIndexes, + readonlyIndexes + }, { + writable: drainedWritableKeys, + readonly: drainedReadonlyKeys + }]; + } + + /** @internal */ + drainKeysFoundInLookupTable(lookupTableEntries, keyMetaFilter) { + const lookupTableIndexes = new Array(); + const drainedKeys = new Array(); + for (const [address, keyMeta] of this.keyMetaMap.entries()) { + if (keyMetaFilter(keyMeta)) { + const key = new PublicKey(address); + const lookupTableIndex = lookupTableEntries.findIndex(entry => entry.equals(key)); + if (lookupTableIndex >= 0) { + assert(lookupTableIndex < 256, 'Max lookup table index exceeded'); + lookupTableIndexes.push(lookupTableIndex); + drainedKeys.push(key); + this.keyMetaMap.delete(address); + } + } + } + return [lookupTableIndexes, drainedKeys]; + } +} + +const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly'; + +/** + * Delegates to `Array#shift`, but throws if the array is zero-length. + */ +function guardedShift(byteArray) { + if (byteArray.length === 0) { + throw new Error(END_OF_BUFFER_ERROR_MESSAGE); + } + return byteArray.shift(); +} + +/** + * Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of + * the array. + */ +function guardedSplice(byteArray, ...args) { + const [start] = args; + if (args.length === 2 // Implies that `deleteCount` was supplied + ? start + (args[1] ?? 0) > byteArray.length : start >= byteArray.length) { + throw new Error(END_OF_BUFFER_ERROR_MESSAGE); + } + return byteArray.splice(...args); +} + +/** + * An instruction to execute by a program + * + * @property {number} programIdIndex + * @property {number[]} accounts + * @property {string} data + */ + +/** + * Message constructor arguments + */ + +/** + * List of instructions to be processed atomically + */ +class Message { + constructor(args) { + this.header = void 0; + this.accountKeys = void 0; + this.recentBlockhash = void 0; + this.instructions = void 0; + this.indexToProgramIds = new Map(); + this.header = args.header; + this.accountKeys = args.accountKeys.map(account => new PublicKey(account)); + this.recentBlockhash = args.recentBlockhash; + this.instructions = args.instructions; + this.instructions.forEach(ix => this.indexToProgramIds.set(ix.programIdIndex, this.accountKeys[ix.programIdIndex])); + } + get version() { + return 'legacy'; + } + get staticAccountKeys() { + return this.accountKeys; + } + get compiledInstructions() { + return this.instructions.map(ix => ({ + programIdIndex: ix.programIdIndex, + accountKeyIndexes: ix.accounts, + data: bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(ix.data) + })); + } + get addressTableLookups() { + return []; + } + getAccountKeys() { + return new MessageAccountKeys(this.staticAccountKeys); + } + static compile(args) { + const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey); + const [header, staticAccountKeys] = compiledKeys.getMessageComponents(); + const accountKeys = new MessageAccountKeys(staticAccountKeys); + const instructions = accountKeys.compileInstructions(args.instructions).map(ix => ({ + programIdIndex: ix.programIdIndex, + accounts: ix.accountKeyIndexes, + data: bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(ix.data) + })); + return new Message({ + header, + accountKeys: staticAccountKeys, + recentBlockhash: args.recentBlockhash, + instructions + }); + } + isAccountSigner(index) { + return index < this.header.numRequiredSignatures; + } + isAccountWritable(index) { + const numSignedAccounts = this.header.numRequiredSignatures; + if (index >= this.header.numRequiredSignatures) { + const unsignedAccountIndex = index - numSignedAccounts; + const numUnsignedAccounts = this.accountKeys.length - numSignedAccounts; + const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts; + return unsignedAccountIndex < numWritableUnsignedAccounts; + } else { + const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts; + return index < numWritableSignedAccounts; + } + } + isProgramId(index) { + return this.indexToProgramIds.has(index); + } + programIds() { + return [...this.indexToProgramIds.values()]; + } + nonProgramIds() { + return this.accountKeys.filter((_, index) => !this.isProgramId(index)); + } + serialize() { + const numKeys = this.accountKeys.length; + let keyCount = []; + encodeLength(keyCount, numKeys); + const instructions = this.instructions.map(instruction => { + const { + accounts, + programIdIndex + } = instruction; + const data = Array.from(bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(instruction.data)); + let keyIndicesCount = []; + encodeLength(keyIndicesCount, accounts.length); + let dataCount = []; + encodeLength(dataCount, data.length); + return { + programIdIndex, + keyIndicesCount: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(keyIndicesCount), + keyIndices: accounts, + dataLength: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(dataCount), + data + }; + }); + let instructionCount = []; + encodeLength(instructionCount, instructions.length); + let instructionBuffer = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(PACKET_DATA_SIZE); + buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(instructionCount).copy(instructionBuffer); + let instructionBufferLength = instructionCount.length; + instructions.forEach(instruction => { + const instructionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('programIdIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(instruction.keyIndicesCount.length, 'keyIndicesCount'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('keyIndex'), instruction.keyIndices.length, 'keyIndices'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(instruction.dataLength.length, 'dataLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('userdatum'), instruction.data.length, 'data')]); + const length = instructionLayout.encode(instruction, instructionBuffer, instructionBufferLength); + instructionBufferLength += length; + }); + instructionBuffer = instructionBuffer.slice(0, instructionBufferLength); + const signDataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(1, 'numRequiredSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(1, 'numReadonlySignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(1, 'numReadonlyUnsignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(keyCount.length, 'keyCount'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(publicKey('key'), numKeys, 'keys'), publicKey('recentBlockhash')]); + const transaction = { + numRequiredSignatures: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numRequiredSignatures]), + numReadonlySignedAccounts: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numReadonlySignedAccounts]), + numReadonlyUnsignedAccounts: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from([this.header.numReadonlyUnsignedAccounts]), + keyCount: buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(keyCount), + keys: this.accountKeys.map(key => toBuffer(key.toBytes())), + recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(this.recentBlockhash) + }; + let signData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(2048); + const length = signDataLayout.encode(transaction, signData); + instructionBuffer.copy(signData, length); + return signData.slice(0, length + instructionBuffer.length); + } + + /** + * Decode a compiled message into a Message object. + */ + static from(buffer) { + // Slice up wire data + let byteArray = [...buffer]; + const numRequiredSignatures = guardedShift(byteArray); + if (numRequiredSignatures !== (numRequiredSignatures & VERSION_PREFIX_MASK)) { + throw new Error('Versioned messages must be deserialized with VersionedMessage.deserialize()'); + } + const numReadonlySignedAccounts = guardedShift(byteArray); + const numReadonlyUnsignedAccounts = guardedShift(byteArray); + const accountCount = decodeLength(byteArray); + let accountKeys = []; + for (let i = 0; i < accountCount; i++) { + const account = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH); + accountKeys.push(new PublicKey(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(account))); + } + const recentBlockhash = guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH); + const instructionCount = decodeLength(byteArray); + let instructions = []; + for (let i = 0; i < instructionCount; i++) { + const programIdIndex = guardedShift(byteArray); + const accountCount = decodeLength(byteArray); + const accounts = guardedSplice(byteArray, 0, accountCount); + const dataLength = decodeLength(byteArray); + const dataSlice = guardedSplice(byteArray, 0, dataLength); + const data = bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(dataSlice)); + instructions.push({ + programIdIndex, + accounts, + data + }); + } + const messageArgs = { + header: { + numRequiredSignatures, + numReadonlySignedAccounts, + numReadonlyUnsignedAccounts + }, + recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(recentBlockhash)), + accountKeys, + instructions + }; + return new Message(messageArgs); + } +} + +/** + * Message constructor arguments + */ + +class MessageV0 { + constructor(args) { + this.header = void 0; + this.staticAccountKeys = void 0; + this.recentBlockhash = void 0; + this.compiledInstructions = void 0; + this.addressTableLookups = void 0; + this.header = args.header; + this.staticAccountKeys = args.staticAccountKeys; + this.recentBlockhash = args.recentBlockhash; + this.compiledInstructions = args.compiledInstructions; + this.addressTableLookups = args.addressTableLookups; + } + get version() { + return 0; + } + get numAccountKeysFromLookups() { + let count = 0; + for (const lookup of this.addressTableLookups) { + count += lookup.readonlyIndexes.length + lookup.writableIndexes.length; + } + return count; + } + getAccountKeys(args) { + let accountKeysFromLookups; + if (args && 'accountKeysFromLookups' in args && args.accountKeysFromLookups) { + if (this.numAccountKeysFromLookups != args.accountKeysFromLookups.writable.length + args.accountKeysFromLookups.readonly.length) { + throw new Error('Failed to get account keys because of a mismatch in the number of account keys from lookups'); + } + accountKeysFromLookups = args.accountKeysFromLookups; + } else if (args && 'addressLookupTableAccounts' in args && args.addressLookupTableAccounts) { + accountKeysFromLookups = this.resolveAddressTableLookups(args.addressLookupTableAccounts); + } else if (this.addressTableLookups.length > 0) { + throw new Error('Failed to get account keys because address table lookups were not resolved'); + } + return new MessageAccountKeys(this.staticAccountKeys, accountKeysFromLookups); + } + isAccountSigner(index) { + return index < this.header.numRequiredSignatures; + } + isAccountWritable(index) { + const numSignedAccounts = this.header.numRequiredSignatures; + const numStaticAccountKeys = this.staticAccountKeys.length; + if (index >= numStaticAccountKeys) { + const lookupAccountKeysIndex = index - numStaticAccountKeys; + const numWritableLookupAccountKeys = this.addressTableLookups.reduce((count, lookup) => count + lookup.writableIndexes.length, 0); + return lookupAccountKeysIndex < numWritableLookupAccountKeys; + } else if (index >= this.header.numRequiredSignatures) { + const unsignedAccountIndex = index - numSignedAccounts; + const numUnsignedAccounts = numStaticAccountKeys - numSignedAccounts; + const numWritableUnsignedAccounts = numUnsignedAccounts - this.header.numReadonlyUnsignedAccounts; + return unsignedAccountIndex < numWritableUnsignedAccounts; + } else { + const numWritableSignedAccounts = numSignedAccounts - this.header.numReadonlySignedAccounts; + return index < numWritableSignedAccounts; + } + } + resolveAddressTableLookups(addressLookupTableAccounts) { + const accountKeysFromLookups = { + writable: [], + readonly: [] + }; + for (const tableLookup of this.addressTableLookups) { + const tableAccount = addressLookupTableAccounts.find(account => account.key.equals(tableLookup.accountKey)); + if (!tableAccount) { + throw new Error(`Failed to find address lookup table account for table key ${tableLookup.accountKey.toBase58()}`); + } + for (const index of tableLookup.writableIndexes) { + if (index < tableAccount.state.addresses.length) { + accountKeysFromLookups.writable.push(tableAccount.state.addresses[index]); + } else { + throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`); + } + } + for (const index of tableLookup.readonlyIndexes) { + if (index < tableAccount.state.addresses.length) { + accountKeysFromLookups.readonly.push(tableAccount.state.addresses[index]); + } else { + throw new Error(`Failed to find address for index ${index} in address lookup table ${tableLookup.accountKey.toBase58()}`); + } + } + } + return accountKeysFromLookups; + } + static compile(args) { + const compiledKeys = CompiledKeys.compile(args.instructions, args.payerKey); + const addressTableLookups = new Array(); + const accountKeysFromLookups = { + writable: new Array(), + readonly: new Array() + }; + const lookupTableAccounts = args.addressLookupTableAccounts || []; + for (const lookupTable of lookupTableAccounts) { + const extractResult = compiledKeys.extractTableLookup(lookupTable); + if (extractResult !== undefined) { + const [addressTableLookup, { + writable, + readonly + }] = extractResult; + addressTableLookups.push(addressTableLookup); + accountKeysFromLookups.writable.push(...writable); + accountKeysFromLookups.readonly.push(...readonly); + } + } + const [header, staticAccountKeys] = compiledKeys.getMessageComponents(); + const accountKeys = new MessageAccountKeys(staticAccountKeys, accountKeysFromLookups); + const compiledInstructions = accountKeys.compileInstructions(args.instructions); + return new MessageV0({ + header, + staticAccountKeys, + recentBlockhash: args.recentBlockhash, + compiledInstructions, + addressTableLookups + }); + } + serialize() { + const encodedStaticAccountKeysLength = Array(); + encodeLength(encodedStaticAccountKeysLength, this.staticAccountKeys.length); + const serializedInstructions = this.serializeInstructions(); + const encodedInstructionsLength = Array(); + encodeLength(encodedInstructionsLength, this.compiledInstructions.length); + const serializedAddressTableLookups = this.serializeAddressTableLookups(); + const encodedAddressTableLookupsLength = Array(); + encodeLength(encodedAddressTableLookupsLength, this.addressTableLookups.length); + const messageLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('prefix'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('numRequiredSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('numReadonlySignedAccounts'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('numReadonlyUnsignedAccounts')], 'header'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedStaticAccountKeysLength.length, 'staticAccountKeysLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(publicKey(), this.staticAccountKeys.length, 'staticAccountKeys'), publicKey('recentBlockhash'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedInstructionsLength.length, 'instructionsLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(serializedInstructions.length, 'serializedInstructions'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedAddressTableLookupsLength.length, 'addressTableLookupsLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(serializedAddressTableLookups.length, 'serializedAddressTableLookups')]); + const serializedMessage = new Uint8Array(PACKET_DATA_SIZE); + const MESSAGE_VERSION_0_PREFIX = 1 << 7; + const serializedMessageLength = messageLayout.encode({ + prefix: MESSAGE_VERSION_0_PREFIX, + header: this.header, + staticAccountKeysLength: new Uint8Array(encodedStaticAccountKeysLength), + staticAccountKeys: this.staticAccountKeys.map(key => key.toBytes()), + recentBlockhash: bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(this.recentBlockhash), + instructionsLength: new Uint8Array(encodedInstructionsLength), + serializedInstructions, + addressTableLookupsLength: new Uint8Array(encodedAddressTableLookupsLength), + serializedAddressTableLookups + }, serializedMessage); + return serializedMessage.slice(0, serializedMessageLength); + } + serializeInstructions() { + let serializedLength = 0; + const serializedInstructions = new Uint8Array(PACKET_DATA_SIZE); + for (const instruction of this.compiledInstructions) { + const encodedAccountKeyIndexesLength = Array(); + encodeLength(encodedAccountKeyIndexesLength, instruction.accountKeyIndexes.length); + const encodedDataLength = Array(); + encodeLength(encodedDataLength, instruction.data.length); + const instructionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('programIdIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedAccountKeyIndexesLength.length, 'encodedAccountKeyIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8(), instruction.accountKeyIndexes.length, 'accountKeyIndexes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedDataLength.length, 'encodedDataLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(instruction.data.length, 'data')]); + serializedLength += instructionLayout.encode({ + programIdIndex: instruction.programIdIndex, + encodedAccountKeyIndexesLength: new Uint8Array(encodedAccountKeyIndexesLength), + accountKeyIndexes: instruction.accountKeyIndexes, + encodedDataLength: new Uint8Array(encodedDataLength), + data: instruction.data + }, serializedInstructions, serializedLength); + } + return serializedInstructions.slice(0, serializedLength); + } + serializeAddressTableLookups() { + let serializedLength = 0; + const serializedAddressTableLookups = new Uint8Array(PACKET_DATA_SIZE); + for (const lookup of this.addressTableLookups) { + const encodedWritableIndexesLength = Array(); + encodeLength(encodedWritableIndexesLength, lookup.writableIndexes.length); + const encodedReadonlyIndexesLength = Array(); + encodeLength(encodedReadonlyIndexesLength, lookup.readonlyIndexes.length); + const addressTableLookupLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([publicKey('accountKey'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedWritableIndexesLength.length, 'encodedWritableIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8(), lookup.writableIndexes.length, 'writableIndexes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedReadonlyIndexesLength.length, 'encodedReadonlyIndexesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8(), lookup.readonlyIndexes.length, 'readonlyIndexes')]); + serializedLength += addressTableLookupLayout.encode({ + accountKey: lookup.accountKey.toBytes(), + encodedWritableIndexesLength: new Uint8Array(encodedWritableIndexesLength), + writableIndexes: lookup.writableIndexes, + encodedReadonlyIndexesLength: new Uint8Array(encodedReadonlyIndexesLength), + readonlyIndexes: lookup.readonlyIndexes + }, serializedAddressTableLookups, serializedLength); + } + return serializedAddressTableLookups.slice(0, serializedLength); + } + static deserialize(serializedMessage) { + let byteArray = [...serializedMessage]; + const prefix = guardedShift(byteArray); + const maskedPrefix = prefix & VERSION_PREFIX_MASK; + assert(prefix !== maskedPrefix, `Expected versioned message but received legacy message`); + const version = maskedPrefix; + assert(version === 0, `Expected versioned message with version 0 but found version ${version}`); + const header = { + numRequiredSignatures: guardedShift(byteArray), + numReadonlySignedAccounts: guardedShift(byteArray), + numReadonlyUnsignedAccounts: guardedShift(byteArray) + }; + const staticAccountKeys = []; + const staticAccountKeysLength = decodeLength(byteArray); + for (let i = 0; i < staticAccountKeysLength; i++) { + staticAccountKeys.push(new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH))); + } + const recentBlockhash = bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)); + const instructionCount = decodeLength(byteArray); + const compiledInstructions = []; + for (let i = 0; i < instructionCount; i++) { + const programIdIndex = guardedShift(byteArray); + const accountKeyIndexesLength = decodeLength(byteArray); + const accountKeyIndexes = guardedSplice(byteArray, 0, accountKeyIndexesLength); + const dataLength = decodeLength(byteArray); + const data = new Uint8Array(guardedSplice(byteArray, 0, dataLength)); + compiledInstructions.push({ + programIdIndex, + accountKeyIndexes, + data + }); + } + const addressTableLookupsCount = decodeLength(byteArray); + const addressTableLookups = []; + for (let i = 0; i < addressTableLookupsCount; i++) { + const accountKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)); + const writableIndexesLength = decodeLength(byteArray); + const writableIndexes = guardedSplice(byteArray, 0, writableIndexesLength); + const readonlyIndexesLength = decodeLength(byteArray); + const readonlyIndexes = guardedSplice(byteArray, 0, readonlyIndexesLength); + addressTableLookups.push({ + accountKey, + writableIndexes, + readonlyIndexes + }); + } + return new MessageV0({ + header, + staticAccountKeys, + recentBlockhash, + compiledInstructions, + addressTableLookups + }); + } +} + +// eslint-disable-next-line no-redeclare +const VersionedMessage = { + deserializeMessageVersion(serializedMessage) { + const prefix = serializedMessage[0]; + const maskedPrefix = prefix & VERSION_PREFIX_MASK; + + // if the highest bit of the prefix is not set, the message is not versioned + if (maskedPrefix === prefix) { + return 'legacy'; + } + + // the lower 7 bits of the prefix indicate the message version + return maskedPrefix; + }, + deserialize: serializedMessage => { + const version = VersionedMessage.deserializeMessageVersion(serializedMessage); + if (version === 'legacy') { + return Message.from(serializedMessage); + } + if (version === 0) { + return MessageV0.deserialize(serializedMessage); + } else { + throw new Error(`Transaction message version ${version} deserialization is not supported`); + } + } +}; + +/** @internal */ + +/** + * Transaction signature as base-58 encoded string + */ + +let TransactionStatus = /*#__PURE__*/function (TransactionStatus) { + TransactionStatus[TransactionStatus["BLOCKHEIGHT_EXCEEDED"] = 0] = "BLOCKHEIGHT_EXCEEDED"; + TransactionStatus[TransactionStatus["PROCESSED"] = 1] = "PROCESSED"; + TransactionStatus[TransactionStatus["TIMED_OUT"] = 2] = "TIMED_OUT"; + TransactionStatus[TransactionStatus["NONCE_INVALID"] = 3] = "NONCE_INVALID"; + return TransactionStatus; +}({}); + +/** + * Default (empty) signature + */ +const DEFAULT_SIGNATURE = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(SIGNATURE_LENGTH_IN_BYTES).fill(0); + +/** + * Account metadata used to define instructions + */ + +/** + * List of TransactionInstruction object fields that may be initialized at construction + */ + +/** + * Configuration object for Transaction.serialize() + */ + +/** + * @internal + */ + +/** + * Transaction Instruction class + */ +class TransactionInstruction { + constructor(opts) { + /** + * Public keys to include in this transaction + * Boolean represents whether this pubkey needs to sign the transaction + */ + this.keys = void 0; + /** + * Program Id to execute + */ + this.programId = void 0; + /** + * Program input + */ + this.data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(0); + this.programId = opts.programId; + this.keys = opts.keys; + if (opts.data) { + this.data = opts.data; + } + } + + /** + * @internal + */ + toJSON() { + return { + keys: this.keys.map(({ + pubkey, + isSigner, + isWritable + }) => ({ + pubkey: pubkey.toJSON(), + isSigner, + isWritable + })), + programId: this.programId.toJSON(), + data: [...this.data] + }; + } +} + +/** + * Pair of signature and corresponding public key + */ + +/** + * List of Transaction object fields that may be initialized at construction + */ + +// For backward compatibility; an unfortunate consequence of being +// forced to over-export types by the documentation generator. +// See https://github.com/solana-labs/solana/pull/25820 + +/** + * Blockhash-based transactions have a lifetime that are defined by + * the blockhash they include. Any transaction whose blockhash is + * too old will be rejected. + */ + +/** + * Use these options to construct a durable nonce transaction. + */ + +/** + * Nonce information to be used to build an offline Transaction. + */ + +/** + * @internal + */ + +/** + * Transaction class + */ +class Transaction { + /** + * The first (payer) Transaction signature + * + * @returns {Buffer | null} Buffer of payer's signature + */ + get signature() { + if (this.signatures.length > 0) { + return this.signatures[0].signature; + } + return null; + } + + /** + * The transaction fee payer + */ + + // Construct a transaction with a blockhash and lastValidBlockHeight + + // Construct a transaction using a durable nonce + + /** + * @deprecated `TransactionCtorFields` has been deprecated and will be removed in a future version. + * Please supply a `TransactionBlockhashCtor` instead. + */ + + /** + * Construct an empty Transaction + */ + constructor(opts) { + /** + * Signatures for the transaction. Typically created by invoking the + * `sign()` method + */ + this.signatures = []; + this.feePayer = void 0; + /** + * The instructions to atomically execute + */ + this.instructions = []; + /** + * A recent transaction id. Must be populated by the caller + */ + this.recentBlockhash = void 0; + /** + * the last block chain can advance to before tx is declared expired + * */ + this.lastValidBlockHeight = void 0; + /** + * Optional Nonce information. If populated, transaction will use a durable + * Nonce hash instead of a recentBlockhash. Must be populated by the caller + */ + this.nonceInfo = void 0; + /** + * If this is a nonce transaction this represents the minimum slot from which + * to evaluate if the nonce has advanced when attempting to confirm the + * transaction. This protects against a case where the transaction confirmation + * logic loads the nonce account from an old slot and assumes the mismatch in + * nonce value implies that the nonce has been advanced. + */ + this.minNonceContextSlot = void 0; + /** + * @internal + */ + this._message = void 0; + /** + * @internal + */ + this._json = void 0; + if (!opts) { + return; + } + if (opts.feePayer) { + this.feePayer = opts.feePayer; + } + if (opts.signatures) { + this.signatures = opts.signatures; + } + if (Object.prototype.hasOwnProperty.call(opts, 'nonceInfo')) { + const { + minContextSlot, + nonceInfo + } = opts; + this.minNonceContextSlot = minContextSlot; + this.nonceInfo = nonceInfo; + } else if (Object.prototype.hasOwnProperty.call(opts, 'lastValidBlockHeight')) { + const { + blockhash, + lastValidBlockHeight + } = opts; + this.recentBlockhash = blockhash; + this.lastValidBlockHeight = lastValidBlockHeight; + } else { + const { + recentBlockhash, + nonceInfo + } = opts; + if (nonceInfo) { + this.nonceInfo = nonceInfo; + } + this.recentBlockhash = recentBlockhash; + } + } + + /** + * @internal + */ + 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(instruction => instruction.toJSON()), + signers: this.signatures.map(({ + publicKey + }) => { + return publicKey.toJSON(); + }) + }; + } + + /** + * Add one or more instructions to this Transaction + * + * @param {Array< Transaction | TransactionInstruction | TransactionInstructionCtorFields >} items - Instructions to add to the Transaction + */ + add(...items) { + if (items.length === 0) { + throw new Error('No instructions'); + } + items.forEach(item => { + if ('instructions' in item) { + this.instructions = this.instructions.concat(item.instructions); + } else if ('data' in item && 'programId' in item && 'keys' in item) { + this.instructions.push(item); + } else { + this.instructions.push(new TransactionInstruction(item)); + } + }); + return this; + } + + /** + * Compile transaction data + */ + compileMessage() { + if (this._message && JSON.stringify(this.toJSON()) === JSON.stringify(this._json)) { + return this._message; + } + let recentBlockhash; + let instructions; + if (this.nonceInfo) { + recentBlockhash = this.nonceInfo.nonce; + if (this.instructions[0] != this.nonceInfo.nonceInstruction) { + instructions = [this.nonceInfo.nonceInstruction, ...this.instructions]; + } else { + instructions = this.instructions; + } + } else { + recentBlockhash = this.recentBlockhash; + instructions = this.instructions; + } + if (!recentBlockhash) { + throw new Error('Transaction recentBlockhash required'); + } + if (instructions.length < 1) { + console.warn('No instructions provided'); + } + let feePayer; + if (this.feePayer) { + feePayer = this.feePayer; + } else if (this.signatures.length > 0 && this.signatures[0].publicKey) { + // Use implicit fee payer + feePayer = this.signatures[0].publicKey; + } else { + throw new Error('Transaction fee payer required'); + } + for (let i = 0; i < instructions.length; i++) { + if (instructions[i].programId === undefined) { + throw new Error(`Transaction instruction index ${i} has undefined program id`); + } + } + const programIds = []; + const accountMetas = []; + instructions.forEach(instruction => { + instruction.keys.forEach(accountMeta => { + accountMetas.push({ + ...accountMeta + }); + }); + const programId = instruction.programId.toString(); + if (!programIds.includes(programId)) { + programIds.push(programId); + } + }); + + // Append programID account metas + programIds.forEach(programId => { + accountMetas.push({ + pubkey: new PublicKey(programId), + isSigner: false, + isWritable: false + }); + }); + + // Cull duplicate account metas + const uniqueMetas = []; + accountMetas.forEach(accountMeta => { + const pubkeyString = accountMeta.pubkey.toString(); + const uniqueIndex = uniqueMetas.findIndex(x => { + return x.pubkey.toString() === pubkeyString; + }); + if (uniqueIndex > -1) { + uniqueMetas[uniqueIndex].isWritable = uniqueMetas[uniqueIndex].isWritable || accountMeta.isWritable; + uniqueMetas[uniqueIndex].isSigner = uniqueMetas[uniqueIndex].isSigner || accountMeta.isSigner; + } else { + uniqueMetas.push(accountMeta); + } + }); + + // Sort. Prioritizing first by signer, then by writable + uniqueMetas.sort(function (x, y) { + if (x.isSigner !== y.isSigner) { + // Signers always come before non-signers + return x.isSigner ? -1 : 1; + } + if (x.isWritable !== y.isWritable) { + // Writable accounts always come before read-only accounts + return x.isWritable ? -1 : 1; + } + // Otherwise, sort by pubkey, stringwise. + const options = { + localeMatcher: 'best fit', + usage: 'sort', + sensitivity: 'variant', + ignorePunctuation: false, + numeric: false, + caseFirst: 'lower' + }; + return x.pubkey.toBase58().localeCompare(y.pubkey.toBase58(), 'en', options); + }); + + // Move fee payer to the front + const feePayerIndex = uniqueMetas.findIndex(x => { + return x.pubkey.equals(feePayer); + }); + if (feePayerIndex > -1) { + const [payerMeta] = uniqueMetas.splice(feePayerIndex, 1); + payerMeta.isSigner = true; + payerMeta.isWritable = true; + uniqueMetas.unshift(payerMeta); + } else { + uniqueMetas.unshift({ + pubkey: feePayer, + isSigner: true, + isWritable: true + }); + } + + // Disallow unknown signers + for (const signature of this.signatures) { + const uniqueIndex = uniqueMetas.findIndex(x => { + return x.pubkey.equals(signature.publicKey); + }); + if (uniqueIndex > -1) { + if (!uniqueMetas[uniqueIndex].isSigner) { + uniqueMetas[uniqueIndex].isSigner = true; + console.warn('Transaction references a signature that is unnecessary, ' + 'only the fee payer and instruction signer accounts should sign a transaction. ' + 'This behavior is deprecated and will throw an error in the next major version release.'); + } + } else { + throw new Error(`unknown signer: ${signature.publicKey.toString()}`); + } + } + let numRequiredSignatures = 0; + let numReadonlySignedAccounts = 0; + let numReadonlyUnsignedAccounts = 0; + + // Split out signing from non-signing keys and count header values + const signedKeys = []; + const unsignedKeys = []; + uniqueMetas.forEach(({ + pubkey, + isSigner, + isWritable + }) => { + if (isSigner) { + signedKeys.push(pubkey.toString()); + numRequiredSignatures += 1; + if (!isWritable) { + numReadonlySignedAccounts += 1; + } + } else { + unsignedKeys.push(pubkey.toString()); + if (!isWritable) { + numReadonlyUnsignedAccounts += 1; + } + } + }); + const accountKeys = signedKeys.concat(unsignedKeys); + const compiledInstructions = instructions.map(instruction => { + const { + data, + programId + } = instruction; + return { + programIdIndex: accountKeys.indexOf(programId.toString()), + accounts: instruction.keys.map(meta => accountKeys.indexOf(meta.pubkey.toString())), + data: bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(data) + }; + }); + compiledInstructions.forEach(instruction => { + assert(instruction.programIdIndex >= 0); + instruction.accounts.forEach(keyIndex => assert(keyIndex >= 0)); + }); + return new Message({ + header: { + numRequiredSignatures, + numReadonlySignedAccounts, + numReadonlyUnsignedAccounts + }, + accountKeys, + recentBlockhash, + instructions: compiledInstructions + }); + } + + /** + * @internal + */ + _compile() { + const message = this.compileMessage(); + const signedKeys = message.accountKeys.slice(0, message.header.numRequiredSignatures); + if (this.signatures.length === signedKeys.length) { + const valid = this.signatures.every((pair, index) => { + return signedKeys[index].equals(pair.publicKey); + }); + if (valid) return message; + } + this.signatures = signedKeys.map(publicKey => ({ + signature: null, + publicKey + })); + return message; + } + + /** + * Get a buffer of the Transaction data that need to be covered by signatures + */ + serializeMessage() { + return this._compile().serialize(); + } + + /** + * Get the estimated fee associated with a transaction + * + * @param {Connection} connection Connection to RPC Endpoint. + * + * @returns {Promise} The estimated fee for the transaction + */ + async getEstimatedFee(connection) { + return (await connection.getFeeForMessage(this.compileMessage())).value; + } + + /** + * Specify the public keys which will be used to sign the Transaction. + * The first signer will be used as the transaction fee payer account. + * + * Signatures can be added with either `partialSign` or `addSignature` + * + * @deprecated Deprecated since v0.84.0. Only the fee payer needs to be + * specified and it can be set in the Transaction constructor or with the + * `feePayer` property. + */ + setSigners(...signers) { + if (signers.length === 0) { + throw new Error('No signers'); + } + const seen = new Set(); + this.signatures = signers.filter(publicKey => { + const key = publicKey.toString(); + if (seen.has(key)) { + return false; + } else { + seen.add(key); + return true; + } + }).map(publicKey => ({ + signature: null, + publicKey + })); + } + + /** + * Sign the Transaction with the specified signers. Multiple signatures may + * be applied to a Transaction. The first signature is considered "primary" + * and is used identify and confirm transactions. + * + * If the Transaction `feePayer` is not set, the first signer will be used + * as the transaction fee payer account. + * + * Transaction fields should not be modified after the first call to `sign`, + * as doing so may invalidate the signature and cause the Transaction to be + * rejected. + * + * The Transaction must be assigned a valid `recentBlockhash` before invoking this method + * + * @param {Array} signers Array of signers that will sign the transaction + */ + sign(...signers) { + if (signers.length === 0) { + throw new Error('No signers'); + } + + // Dedupe signers + const seen = new Set(); + const uniqueSigners = []; + for (const signer of signers) { + const key = signer.publicKey.toString(); + if (seen.has(key)) { + continue; + } else { + seen.add(key); + uniqueSigners.push(signer); + } + } + this.signatures = uniqueSigners.map(signer => ({ + signature: null, + publicKey: signer.publicKey + })); + const message = this._compile(); + this._partialSign(message, ...uniqueSigners); + } + + /** + * Partially sign a transaction with the specified accounts. All accounts must + * correspond to either the fee payer or a signer account in the transaction + * instructions. + * + * All the caveats from the `sign` method apply to `partialSign` + * + * @param {Array} signers Array of signers that will sign the transaction + */ + partialSign(...signers) { + if (signers.length === 0) { + throw new Error('No signers'); + } + + // Dedupe signers + const seen = new Set(); + const uniqueSigners = []; + for (const signer of signers) { + const key = signer.publicKey.toString(); + if (seen.has(key)) { + continue; + } else { + seen.add(key); + uniqueSigners.push(signer); + } + } + const message = this._compile(); + this._partialSign(message, ...uniqueSigners); + } + + /** + * @internal + */ + _partialSign(message, ...signers) { + const signData = message.serialize(); + signers.forEach(signer => { + const signature = sign(signData, signer.secretKey); + this._addSignature(signer.publicKey, toBuffer(signature)); + }); + } + + /** + * Add an externally created signature to a transaction. The public key + * must correspond to either the fee payer or a signer account in the transaction + * instructions. + * + * @param {PublicKey} pubkey Public key that will be added to the transaction. + * @param {Buffer} signature An externally created signature to add to the transaction. + */ + addSignature(pubkey, signature) { + this._compile(); // Ensure signatures array is populated + this._addSignature(pubkey, signature); + } + + /** + * @internal + */ + _addSignature(pubkey, signature) { + assert(signature.length === 64); + const index = this.signatures.findIndex(sigpair => pubkey.equals(sigpair.publicKey)); + if (index < 0) { + throw new Error(`unknown signer: ${pubkey.toString()}`); + } + this.signatures[index].signature = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature); + } + + /** + * Verify signatures of a Transaction + * Optional parameter specifies if we're expecting a fully signed Transaction or a partially signed one. + * If no boolean is provided, we expect a fully signed Transaction by default. + * + * @param {boolean} [requireAllSignatures=true] Require a fully signed Transaction + */ + verifySignatures(requireAllSignatures = true) { + const signatureErrors = this._getMessageSignednessErrors(this.serializeMessage(), requireAllSignatures); + return !signatureErrors; + } + + /** + * @internal + */ + _getMessageSignednessErrors(message, requireAllSignatures) { + const errors = {}; + for (const { + signature, + publicKey + } of this.signatures) { + if (signature === null) { + if (requireAllSignatures) { + (errors.missing ||= []).push(publicKey); + } + } else { + if (!verify(signature, message, publicKey.toBytes())) { + (errors.invalid ||= []).push(publicKey); + } + } + } + return errors.invalid || errors.missing ? errors : undefined; + } + + /** + * Serialize the Transaction in the wire format. + * + * @param {Buffer} [config] Config of transaction. + * + * @returns {Buffer} Signature of transaction in wire format. + */ + serialize(config) { + const { + requireAllSignatures, + verifySignatures + } = Object.assign({ + requireAllSignatures: true, + verifySignatures: true + }, config); + const signData = this.serializeMessage(); + if (verifySignatures) { + const sigErrors = this._getMessageSignednessErrors(signData, requireAllSignatures); + if (sigErrors) { + let errorMessage = 'Signature verification failed.'; + if (sigErrors.invalid) { + errorMessage += `\nInvalid signature for public key${sigErrors.invalid.length === 1 ? '' : '(s)'} [\`${sigErrors.invalid.map(p => p.toBase58()).join('`, `')}\`].`; + } + if (sigErrors.missing) { + errorMessage += `\nMissing signature for public key${sigErrors.missing.length === 1 ? '' : '(s)'} [\`${sigErrors.missing.map(p => p.toBase58()).join('`, `')}\`].`; + } + throw new Error(errorMessage); + } + } + return this._serialize(signData); + } + + /** + * @internal + */ + _serialize(signData) { + const { + signatures + } = this; + const signatureCount = []; + encodeLength(signatureCount, signatures.length); + const transactionLength = signatureCount.length + signatures.length * 64 + signData.length; + const wireTransaction = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(transactionLength); + assert(signatures.length < 256); + buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signatureCount).copy(wireTransaction, 0); + signatures.forEach(({ + signature + }, index) => { + if (signature !== null) { + assert(signature.length === 64, `signature has invalid length`); + buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature).copy(wireTransaction, signatureCount.length + index * 64); + } + }); + signData.copy(wireTransaction, signatureCount.length + signatures.length * 64); + assert(wireTransaction.length <= PACKET_DATA_SIZE, `Transaction too large: ${wireTransaction.length} > ${PACKET_DATA_SIZE}`); + return wireTransaction; + } + + /** + * Deprecated method + * @internal + */ + get keys() { + assert(this.instructions.length === 1); + return this.instructions[0].keys.map(keyObj => keyObj.pubkey); + } + + /** + * Deprecated method + * @internal + */ + get programId() { + assert(this.instructions.length === 1); + return this.instructions[0].programId; + } + + /** + * Deprecated method + * @internal + */ + get data() { + assert(this.instructions.length === 1); + return this.instructions[0].data; + } + + /** + * Parse a wire transaction into a Transaction object. + * + * @param {Buffer | Uint8Array | Array} buffer Signature of wire Transaction + * + * @returns {Transaction} Transaction associated with the signature + */ + static from(buffer) { + // Slice up wire data + let byteArray = [...buffer]; + const signatureCount = decodeLength(byteArray); + let signatures = []; + for (let i = 0; i < signatureCount; i++) { + const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES); + signatures.push(bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(signature))); + } + return Transaction.populate(Message.from(byteArray), signatures); + } + + /** + * Populate Transaction object from message and signatures + * + * @param {Message} message Message of transaction + * @param {Array} signatures List of signatures to assign to the transaction + * + * @returns {Transaction} The populated Transaction + */ + static populate(message, signatures = []) { + const transaction = new Transaction(); + transaction.recentBlockhash = message.recentBlockhash; + if (message.header.numRequiredSignatures > 0) { + transaction.feePayer = message.accountKeys[0]; + } + signatures.forEach((signature, index) => { + const sigPubkeyPair = { + signature: signature == bs58__WEBPACK_IMPORTED_MODULE_3___default().encode(DEFAULT_SIGNATURE) ? null : bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(signature), + publicKey: message.accountKeys[index] + }; + transaction.signatures.push(sigPubkeyPair); + }); + message.instructions.forEach(instruction => { + const keys = instruction.accounts.map(account => { + const pubkey = message.accountKeys[account]; + return { + pubkey, + isSigner: transaction.signatures.some(keyObj => keyObj.publicKey.toString() === pubkey.toString()) || message.isAccountSigner(account), + isWritable: message.isAccountWritable(account) + }; + }); + transaction.instructions.push(new TransactionInstruction({ + keys, + programId: message.accountKeys[instruction.programIdIndex], + data: bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(instruction.data) + })); + }); + transaction._message = message; + transaction._json = transaction.toJSON(); + return transaction; + } +} + +class TransactionMessage { + constructor(args) { + this.payerKey = void 0; + this.instructions = void 0; + this.recentBlockhash = void 0; + this.payerKey = args.payerKey; + this.instructions = args.instructions; + this.recentBlockhash = args.recentBlockhash; + } + static decompile(message, args) { + const { + header, + compiledInstructions, + recentBlockhash + } = message; + const { + numRequiredSignatures, + numReadonlySignedAccounts, + numReadonlyUnsignedAccounts + } = header; + const numWritableSignedAccounts = numRequiredSignatures - numReadonlySignedAccounts; + assert(numWritableSignedAccounts > 0, 'Message header is invalid'); + const numWritableUnsignedAccounts = message.staticAccountKeys.length - numRequiredSignatures - numReadonlyUnsignedAccounts; + assert(numWritableUnsignedAccounts >= 0, 'Message header is invalid'); + const accountKeys = message.getAccountKeys(args); + const payerKey = accountKeys.get(0); + if (payerKey === undefined) { + throw new Error('Failed to decompile message because no account keys were found'); + } + const instructions = []; + for (const compiledIx of compiledInstructions) { + const keys = []; + for (const keyIndex of compiledIx.accountKeyIndexes) { + const pubkey = accountKeys.get(keyIndex); + if (pubkey === undefined) { + throw new Error(`Failed to find key for account key index ${keyIndex}`); + } + const isSigner = keyIndex < numRequiredSignatures; + let isWritable; + if (isSigner) { + isWritable = keyIndex < numWritableSignedAccounts; + } else if (keyIndex < accountKeys.staticAccountKeys.length) { + isWritable = keyIndex - numRequiredSignatures < numWritableUnsignedAccounts; + } else { + isWritable = keyIndex - accountKeys.staticAccountKeys.length < + // accountKeysFromLookups cannot be undefined because we already found a pubkey for this index above + accountKeys.accountKeysFromLookups.writable.length; + } + keys.push({ + pubkey, + isSigner: keyIndex < header.numRequiredSignatures, + isWritable + }); + } + const programId = accountKeys.get(compiledIx.programIdIndex); + if (programId === undefined) { + throw new Error(`Failed to find program id for program id index ${compiledIx.programIdIndex}`); + } + instructions.push(new TransactionInstruction({ + programId, + data: toBuffer(compiledIx.data), + keys + })); + } + return new TransactionMessage({ + payerKey, + instructions, + recentBlockhash + }); + } + compileToLegacyMessage() { + return Message.compile({ + payerKey: this.payerKey, + recentBlockhash: this.recentBlockhash, + instructions: this.instructions + }); + } + compileToV0Message(addressLookupTableAccounts) { + return MessageV0.compile({ + payerKey: this.payerKey, + recentBlockhash: this.recentBlockhash, + instructions: this.instructions, + addressLookupTableAccounts + }); + } +} + +/** + * Versioned transaction class + */ +class VersionedTransaction { + get version() { + return this.message.version; + } + constructor(message, signatures) { + this.signatures = void 0; + this.message = void 0; + if (signatures !== undefined) { + assert(signatures.length === message.header.numRequiredSignatures, 'Expected signatures length to be equal to the number of required signatures'); + this.signatures = signatures; + } else { + const defaultSignatures = []; + for (let i = 0; i < message.header.numRequiredSignatures; i++) { + defaultSignatures.push(new Uint8Array(SIGNATURE_LENGTH_IN_BYTES)); + } + this.signatures = defaultSignatures; + } + this.message = message; + } + serialize() { + const serializedMessage = this.message.serialize(); + const encodedSignaturesLength = Array(); + encodeLength(encodedSignaturesLength, this.signatures.length); + const transactionLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(encodedSignaturesLength.length, 'encodedSignaturesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(signature(), this.signatures.length, 'signatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(serializedMessage.length, 'serializedMessage')]); + const serializedTransaction = new Uint8Array(2048); + const serializedTransactionLength = transactionLayout.encode({ + encodedSignaturesLength: new Uint8Array(encodedSignaturesLength), + signatures: this.signatures, + serializedMessage + }, serializedTransaction); + return serializedTransaction.slice(0, serializedTransactionLength); + } + static deserialize(serializedTransaction) { + let byteArray = [...serializedTransaction]; + const signatures = []; + const signaturesLength = decodeLength(byteArray); + for (let i = 0; i < signaturesLength; i++) { + signatures.push(new Uint8Array(guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES))); + } + const message = VersionedMessage.deserialize(new Uint8Array(byteArray)); + return new VersionedTransaction(message, signatures); + } + sign(signers) { + const messageData = this.message.serialize(); + const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures); + for (const signer of signers) { + const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(signer.publicKey)); + assert(signerIndex >= 0, `Cannot sign with non signer key ${signer.publicKey.toBase58()}`); + this.signatures[signerIndex] = sign(messageData, signer.secretKey); + } + } + addSignature(publicKey, signature) { + assert(signature.byteLength === 64, 'Signature must be 64 bytes long'); + const signerPubkeys = this.message.staticAccountKeys.slice(0, this.message.header.numRequiredSignatures); + const signerIndex = signerPubkeys.findIndex(pubkey => pubkey.equals(publicKey)); + assert(signerIndex >= 0, `Can not add signature; \`${publicKey.toBase58()}\` is not required to sign this transaction`); + this.signatures[signerIndex] = signature; + } +} + +// TODO: These constants should be removed in favor of reading them out of a +// Syscall account + +/** + * @internal + */ +const NUM_TICKS_PER_SECOND = 160; + +/** + * @internal + */ +const DEFAULT_TICKS_PER_SLOT = 64; + +/** + * @internal + */ +const NUM_SLOTS_PER_SECOND = NUM_TICKS_PER_SECOND / DEFAULT_TICKS_PER_SLOT; + +/** + * @internal + */ +const MS_PER_SLOT = 1000 / NUM_SLOTS_PER_SECOND; + +const SYSVAR_CLOCK_PUBKEY = new PublicKey('SysvarC1ock11111111111111111111111111111111'); +const SYSVAR_EPOCH_SCHEDULE_PUBKEY = new PublicKey('SysvarEpochSchedu1e111111111111111111111111'); +const SYSVAR_INSTRUCTIONS_PUBKEY = new PublicKey('Sysvar1nstructions1111111111111111111111111'); +const SYSVAR_RECENT_BLOCKHASHES_PUBKEY = new PublicKey('SysvarRecentB1ockHashes11111111111111111111'); +const SYSVAR_RENT_PUBKEY = new PublicKey('SysvarRent111111111111111111111111111111111'); +const SYSVAR_REWARDS_PUBKEY = new PublicKey('SysvarRewards111111111111111111111111111111'); +const SYSVAR_SLOT_HASHES_PUBKEY = new PublicKey('SysvarS1otHashes111111111111111111111111111'); +const SYSVAR_SLOT_HISTORY_PUBKEY = new PublicKey('SysvarS1otHistory11111111111111111111111111'); +const SYSVAR_STAKE_HISTORY_PUBKEY = new PublicKey('SysvarStakeHistory1111111111111111111111111'); + +class SendTransactionError extends Error { + constructor({ + action, + signature, + transactionMessage, + logs + }) { + const maybeLogsOutput = logs ? `Logs: \n${JSON.stringify(logs.slice(-10), null, 2)}. ` : ''; + const guideText = '\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.'; + let message; + switch (action) { + case 'send': + message = `Transaction ${signature} resulted in an error. \n` + `${transactionMessage}. ` + maybeLogsOutput + guideText; + break; + case 'simulate': + message = `Simulation failed. \nMessage: ${transactionMessage}. \n` + maybeLogsOutput + guideText; + break; + default: + { + message = `Unknown action '${(a => a)(action)}'`; + } + } + super(message); + this.signature = void 0; + this.transactionMessage = void 0; + this.transactionLogs = void 0; + this.signature = signature; + this.transactionMessage = transactionMessage; + this.transactionLogs = logs ? logs : undefined; + } + get transactionError() { + return { + message: this.transactionMessage, + logs: Array.isArray(this.transactionLogs) ? this.transactionLogs : undefined + }; + } + + /* @deprecated Use `await getLogs()` instead */ + get logs() { + const cachedLogs = this.transactionLogs; + if (cachedLogs != null && typeof cachedLogs === 'object' && 'then' in cachedLogs) { + return undefined; + } + return cachedLogs; + } + async getLogs(connection) { + if (!Array.isArray(this.transactionLogs)) { + this.transactionLogs = new Promise((resolve, reject) => { + connection.getTransaction(this.signature).then(tx => { + if (tx && tx.meta && tx.meta.logMessages) { + const logs = tx.meta.logMessages; + this.transactionLogs = logs; + resolve(logs); + } else { + reject(new Error('Log messages not found')); + } + }).catch(reject); + }); + } + return await this.transactionLogs; + } +} + +// Keep in sync with client/src/rpc_custom_errors.rs +// Typescript `enums` thwart tree-shaking. See https://bargsten.org/jsts/enums/ +const 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 +}; +class SolanaJSONRPCError extends Error { + constructor({ + code, + message, + data + }, customMessage) { + super(customMessage != null ? `${customMessage}: ${message}` : message); + this.code = void 0; + this.data = void 0; + this.code = code; + this.data = data; + this.name = 'SolanaJSONRPCError'; + } +} + +/** + * Sign, send and confirm a transaction. + * + * If `commitment` option is not specified, defaults to 'max' commitment. + * + * @param {Connection} connection + * @param {Transaction} transaction + * @param {Array} signers + * @param {ConfirmOptions} [options] + * @returns {Promise} + */ +async function sendAndConfirmTransaction(connection, transaction, signers, options) { + const sendOptions = options && { + skipPreflight: options.skipPreflight, + preflightCommitment: options.preflightCommitment || options.commitment, + maxRetries: options.maxRetries, + minContextSlot: options.minContextSlot + }; + const signature = await connection.sendTransaction(transaction, signers, sendOptions); + let status; + if (transaction.recentBlockhash != null && transaction.lastValidBlockHeight != null) { + status = (await connection.confirmTransaction({ + abortSignal: options?.abortSignal, + signature: signature, + blockhash: transaction.recentBlockhash, + lastValidBlockHeight: transaction.lastValidBlockHeight + }, options && options.commitment)).value; + } else if (transaction.minNonceContextSlot != null && transaction.nonceInfo != null) { + const { + nonceInstruction + } = transaction.nonceInfo; + const nonceAccountPubkey = nonceInstruction.keys[0].pubkey; + status = (await connection.confirmTransaction({ + abortSignal: options?.abortSignal, + minContextSlot: transaction.minNonceContextSlot, + nonceAccountPubkey, + nonceValue: transaction.nonceInfo.nonce, + signature + }, options && options.commitment)).value; + } else { + if (options?.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.'); + } + status = (await connection.confirmTransaction(signature, options && options.commitment)).value; + } + if (status.err) { + if (signature != null) { + throw new SendTransactionError({ + action: 'send', + signature: signature, + transactionMessage: `Status: (${JSON.stringify(status)})` + }); + } + throw new Error(`Transaction ${signature} failed (${JSON.stringify(status)})`); + } + return signature; +} + +// zzz +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +/** + * @internal + */ + +/** + * Populate a buffer of instruction data using an InstructionType + * @internal + */ +function encodeData(type, fields) { + const allocLength = type.layout.span >= 0 ? type.layout.span : getAlloc(type, fields); + const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(allocLength); + const layoutFields = Object.assign({ + instruction: type.index + }, fields); + type.layout.encode(layoutFields, data); + return data; +} + +/** + * Decode instruction data buffer using an InstructionType + * @internal + */ +function decodeData$1(type, buffer) { + let data; + try { + data = type.layout.decode(buffer); + } catch (err) { + throw new Error('invalid instruction; ' + err); + } + if (data.instruction !== type.index) { + throw new Error(`invalid instruction; instruction index mismatch ${data.instruction} != ${type.index}`); + } + return data; +} + +/** + * https://github.com/solana-labs/solana/blob/90bedd7e067b5b8f3ddbb45da00a4e9cabb22c62/sdk/src/fee_calculator.rs#L7-L11 + * + * @internal + */ +const FeeCalculatorLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('lamportsPerSignature'); + +/** + * Calculator for transaction fees. + * + * @deprecated Deprecated since Solana v1.8.0. + */ + +/** + * See https://github.com/solana-labs/solana/blob/0ea2843ec9cdc517572b8e62c959f41b55cf4453/sdk/src/nonce_state.rs#L29-L32 + * + * @internal + */ +const NonceAccountLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('version'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('state'), publicKey('authorizedPubkey'), publicKey('nonce'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([FeeCalculatorLayout], 'feeCalculator')]); +const NONCE_ACCOUNT_LENGTH = NonceAccountLayout.span; + +/** + * A durable nonce is a 32 byte value encoded as a base58 string. + */ + +/** + * NonceAccount class + */ +class NonceAccount { + /** + * @internal + */ + constructor(args) { + this.authorizedPubkey = void 0; + this.nonce = void 0; + this.feeCalculator = void 0; + this.authorizedPubkey = args.authorizedPubkey; + this.nonce = args.nonce; + this.feeCalculator = args.feeCalculator; + } + + /** + * Deserialize NonceAccount from the account data. + * + * @param buffer account data + * @return NonceAccount + */ + static fromAccountData(buffer) { + const nonceAccount = NonceAccountLayout.decode(toBuffer(buffer), 0); + return new NonceAccount({ + authorizedPubkey: new PublicKey(nonceAccount.authorizedPubkey), + nonce: new PublicKey(nonceAccount.nonce).toString(), + feeCalculator: nonceAccount.feeCalculator + }); + } +} + +function u64(property) { + const layout = (0,_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob)(8 /* bytes */, property); + const decode = layout.decode.bind(layout); + const encode = layout.encode.bind(layout); + const bigIntLayout = layout; + const codec = (0,_solana_codecs_numbers__WEBPACK_IMPORTED_MODULE_7__.getU64Codec)(); + bigIntLayout.decode = (buffer, offset) => { + const src = decode(buffer, offset); + return codec.decode(src); + }; + bigIntLayout.encode = (bigInt, buffer, offset) => { + const src = codec.encode(bigInt); + return encode(src, buffer, offset); + }; + return bigIntLayout; +} + +/** + * Create account system transaction params + */ + +/** + * Transfer system transaction params + */ + +/** + * Assign system transaction params + */ + +/** + * Create account with seed system transaction params + */ + +/** + * Create nonce account system transaction params + */ + +/** + * Create nonce account with seed system transaction params + */ + +/** + * Initialize nonce account system instruction params + */ + +/** + * Advance nonce account system instruction params + */ + +/** + * Withdraw nonce account system transaction params + */ + +/** + * Authorize nonce account system transaction params + */ + +/** + * Allocate account system transaction params + */ + +/** + * Allocate account with seed system transaction params + */ + +/** + * Assign account with seed system transaction params + */ + +/** + * Transfer with seed system transaction params + */ + +/** Decoded transfer system transaction instruction */ + +/** Decoded transferWithSeed system transaction instruction */ + +/** + * System Instruction class + */ +class SystemInstruction { + /** + * @internal + */ + constructor() {} + + /** + * Decode a system instruction and retrieve the instruction type. + */ + static decodeInstructionType(instruction) { + this.checkProgramId(instruction.programId); + const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'); + const typeIndex = instructionTypeLayout.decode(instruction.data); + let type; + for (const [ixType, layout] of Object.entries(SYSTEM_INSTRUCTION_LAYOUTS)) { + if (layout.index == typeIndex) { + type = ixType; + break; + } + } + if (!type) { + throw new Error('Instruction type incorrect; not a SystemInstruction'); + } + return type; + } + + /** + * Decode a create account system instruction and retrieve the instruction params. + */ + static decodeCreateAccount(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + lamports, + space, + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Create, instruction.data); + return { + fromPubkey: instruction.keys[0].pubkey, + newAccountPubkey: instruction.keys[1].pubkey, + lamports, + space, + programId: new PublicKey(programId) + }; + } + + /** + * Decode a transfer system instruction and retrieve the instruction params. + */ + static decodeTransfer(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + lamports + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Transfer, instruction.data); + return { + fromPubkey: instruction.keys[0].pubkey, + toPubkey: instruction.keys[1].pubkey, + lamports + }; + } + + /** + * Decode a transfer with seed system instruction and retrieve the instruction params. + */ + static decodeTransferWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + lamports, + seed, + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed, instruction.data); + return { + fromPubkey: instruction.keys[0].pubkey, + basePubkey: instruction.keys[1].pubkey, + toPubkey: instruction.keys[2].pubkey, + lamports, + seed, + programId: new PublicKey(programId) + }; + } + + /** + * Decode an allocate system instruction and retrieve the instruction params. + */ + static decodeAllocate(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 1); + const { + space + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Allocate, instruction.data); + return { + accountPubkey: instruction.keys[0].pubkey, + space + }; + } + + /** + * Decode an allocate with seed system instruction and retrieve the instruction params. + */ + static decodeAllocateWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 1); + const { + base, + seed, + space, + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed, instruction.data); + return { + accountPubkey: instruction.keys[0].pubkey, + basePubkey: new PublicKey(base), + seed, + space, + programId: new PublicKey(programId) + }; + } + + /** + * Decode an assign system instruction and retrieve the instruction params. + */ + static decodeAssign(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 1); + const { + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.Assign, instruction.data); + return { + accountPubkey: instruction.keys[0].pubkey, + programId: new PublicKey(programId) + }; + } + + /** + * Decode an assign with seed system instruction and retrieve the instruction params. + */ + static decodeAssignWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 1); + const { + base, + seed, + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed, instruction.data); + return { + accountPubkey: instruction.keys[0].pubkey, + basePubkey: new PublicKey(base), + seed, + programId: new PublicKey(programId) + }; + } + + /** + * Decode a create account with seed system instruction and retrieve the instruction params. + */ + static decodeCreateWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + base, + seed, + lamports, + space, + programId + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed, instruction.data); + return { + fromPubkey: instruction.keys[0].pubkey, + newAccountPubkey: instruction.keys[1].pubkey, + basePubkey: new PublicKey(base), + seed, + lamports, + space, + programId: new PublicKey(programId) + }; + } + + /** + * Decode a nonce initialize system instruction and retrieve the instruction params. + */ + static decodeNonceInitialize(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + authorized + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount, instruction.data); + return { + noncePubkey: instruction.keys[0].pubkey, + authorizedPubkey: new PublicKey(authorized) + }; + } + + /** + * Decode a nonce advance system instruction and retrieve the instruction params. + */ + static decodeNonceAdvance(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount, instruction.data); + return { + noncePubkey: instruction.keys[0].pubkey, + authorizedPubkey: instruction.keys[2].pubkey + }; + } + + /** + * Decode a nonce withdraw system instruction and retrieve the instruction params. + */ + static decodeNonceWithdraw(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 5); + const { + lamports + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount, instruction.data); + return { + noncePubkey: instruction.keys[0].pubkey, + toPubkey: instruction.keys[1].pubkey, + authorizedPubkey: instruction.keys[4].pubkey, + lamports + }; + } + + /** + * Decode a nonce authorize system instruction and retrieve the instruction params. + */ + static decodeNonceAuthorize(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + authorized + } = decodeData$1(SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount, instruction.data); + return { + noncePubkey: instruction.keys[0].pubkey, + authorizedPubkey: instruction.keys[1].pubkey, + newAuthorizedPubkey: new PublicKey(authorized) + }; + } + + /** + * @internal + */ + static checkProgramId(programId) { + if (!programId.equals(SystemProgram.programId)) { + throw new Error('invalid instruction; programId is not SystemProgram'); + } + } + + /** + * @internal + */ + static checkKeyLength(keys, expectedLength) { + if (keys.length < expectedLength) { + throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`); + } + } +} + +/** + * An enumeration of valid SystemInstructionType's + */ + +/** + * An enumeration of valid system InstructionType's + * @internal + */ +const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({ + Create: { + index: 0, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('space'), publicKey('programId')]) + }, + Assign: { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('programId')]) + }, + Transfer: { + index: 2, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), u64('lamports')]) + }, + CreateWithSeed: { + index: 3, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('base'), rustString('seed'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('space'), publicKey('programId')]) + }, + AdvanceNonceAccount: { + index: 4, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + WithdrawNonceAccount: { + index: 5, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports')]) + }, + InitializeNonceAccount: { + index: 6, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('authorized')]) + }, + AuthorizeNonceAccount: { + index: 7, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('authorized')]) + }, + Allocate: { + index: 8, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('space')]) + }, + AllocateWithSeed: { + index: 9, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('base'), rustString('seed'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('space'), publicKey('programId')]) + }, + AssignWithSeed: { + index: 10, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('base'), rustString('seed'), publicKey('programId')]) + }, + TransferWithSeed: { + index: 11, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')]) + }, + UpgradeNonceAccount: { + index: 12, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + } +}); + +/** + * Factory class for transactions to interact with the System program + */ +class SystemProgram { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the System program + */ + + /** + * Generate a transaction instruction that creates a new account + */ + static createAccount(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.Create; + const data = encodeData(type, { + lamports: params.lamports, + space: params.space, + programId: toBuffer(params.programId.toBuffer()) + }); + return new TransactionInstruction({ + keys: [{ + pubkey: params.fromPubkey, + isSigner: true, + isWritable: true + }, { + pubkey: params.newAccountPubkey, + isSigner: true, + isWritable: true + }], + programId: this.programId, + data + }); + } + + /** + * Generate a transaction instruction that transfers lamports from one account to another + */ + static transfer(params) { + let data; + let keys; + if ('basePubkey' in params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.TransferWithSeed; + data = encodeData(type, { + lamports: BigInt(params.lamports), + seed: params.seed, + programId: toBuffer(params.programId.toBuffer()) + }); + keys = [{ + pubkey: params.fromPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: params.basePubkey, + isSigner: true, + isWritable: false + }, { + pubkey: params.toPubkey, + isSigner: false, + isWritable: true + }]; + } else { + const type = SYSTEM_INSTRUCTION_LAYOUTS.Transfer; + data = encodeData(type, { + lamports: BigInt(params.lamports) + }); + keys = [{ + pubkey: params.fromPubkey, + isSigner: true, + isWritable: true + }, { + pubkey: params.toPubkey, + isSigner: false, + isWritable: true + }]; + } + return new TransactionInstruction({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction instruction that assigns an account to a program + */ + static assign(params) { + let data; + let keys; + if ('basePubkey' in params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.AssignWithSeed; + data = encodeData(type, { + base: toBuffer(params.basePubkey.toBuffer()), + seed: params.seed, + programId: toBuffer(params.programId.toBuffer()) + }); + keys = [{ + pubkey: params.accountPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: params.basePubkey, + isSigner: true, + isWritable: false + }]; + } else { + const type = SYSTEM_INSTRUCTION_LAYOUTS.Assign; + data = encodeData(type, { + programId: toBuffer(params.programId.toBuffer()) + }); + keys = [{ + pubkey: params.accountPubkey, + isSigner: true, + isWritable: true + }]; + } + return new TransactionInstruction({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction instruction that creates a new account at + * an address generated with `from`, a seed, and programId + */ + static createAccountWithSeed(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.CreateWithSeed; + const data = encodeData(type, { + base: toBuffer(params.basePubkey.toBuffer()), + seed: params.seed, + lamports: params.lamports, + space: params.space, + programId: toBuffer(params.programId.toBuffer()) + }); + let keys = [{ + pubkey: params.fromPubkey, + isSigner: true, + isWritable: true + }, { + pubkey: params.newAccountPubkey, + isSigner: false, + isWritable: true + }]; + if (!params.basePubkey.equals(params.fromPubkey)) { + keys.push({ + pubkey: params.basePubkey, + isSigner: true, + isWritable: false + }); + } + return new TransactionInstruction({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction that creates a new Nonce account + */ + static createNonceAccount(params) { + const transaction = new Transaction(); + if ('basePubkey' in params && 'seed' in params) { + transaction.add(SystemProgram.createAccountWithSeed({ + fromPubkey: params.fromPubkey, + newAccountPubkey: params.noncePubkey, + basePubkey: params.basePubkey, + seed: params.seed, + lamports: params.lamports, + space: NONCE_ACCOUNT_LENGTH, + programId: this.programId + })); + } else { + transaction.add(SystemProgram.createAccount({ + fromPubkey: params.fromPubkey, + newAccountPubkey: params.noncePubkey, + lamports: params.lamports, + space: NONCE_ACCOUNT_LENGTH, + programId: this.programId + })); + } + const initParams = { + noncePubkey: params.noncePubkey, + authorizedPubkey: params.authorizedPubkey + }; + transaction.add(this.nonceInitialize(initParams)); + return transaction; + } + + /** + * Generate an instruction to initialize a Nonce account + */ + static nonceInitialize(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.InitializeNonceAccount; + const data = encodeData(type, { + authorized: toBuffer(params.authorizedPubkey.toBuffer()) + }); + const instructionData = { + keys: [{ + pubkey: params.noncePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_RENT_PUBKEY, + isSigner: false, + isWritable: false + }], + programId: this.programId, + data + }; + return new TransactionInstruction(instructionData); + } + + /** + * Generate an instruction to advance the nonce in a Nonce account + */ + static nonceAdvance(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.AdvanceNonceAccount; + const data = encodeData(type); + const instructionData = { + keys: [{ + pubkey: params.noncePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: params.authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }; + return new TransactionInstruction(instructionData); + } + + /** + * Generate a transaction instruction that withdraws lamports from a Nonce account + */ + static nonceWithdraw(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.WithdrawNonceAccount; + const data = encodeData(type, { + lamports: params.lamports + }); + return new TransactionInstruction({ + keys: [{ + pubkey: params.noncePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: params.toPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_RECENT_BLOCKHASHES_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_RENT_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: params.authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } + + /** + * Generate a transaction instruction that authorizes a new PublicKey as the authority + * on a Nonce account. + */ + static nonceAuthorize(params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.AuthorizeNonceAccount; + const data = encodeData(type, { + authorized: toBuffer(params.newAuthorizedPubkey.toBuffer()) + }); + return new TransactionInstruction({ + keys: [{ + pubkey: params.noncePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: params.authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } + + /** + * Generate a transaction instruction that allocates space in an account without funding + */ + static allocate(params) { + let data; + let keys; + if ('basePubkey' in params) { + const type = SYSTEM_INSTRUCTION_LAYOUTS.AllocateWithSeed; + data = encodeData(type, { + base: toBuffer(params.basePubkey.toBuffer()), + seed: params.seed, + space: params.space, + programId: toBuffer(params.programId.toBuffer()) + }); + keys = [{ + pubkey: params.accountPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: params.basePubkey, + isSigner: true, + isWritable: false + }]; + } else { + const type = SYSTEM_INSTRUCTION_LAYOUTS.Allocate; + data = encodeData(type, { + space: params.space + }); + keys = [{ + pubkey: params.accountPubkey, + isSigner: true, + isWritable: true + }]; + } + return new TransactionInstruction({ + keys, + programId: this.programId, + data + }); + } +} +SystemProgram.programId = new PublicKey('11111111111111111111111111111111'); + +// Keep program chunks under PACKET_DATA_SIZE, leaving enough room for the +// rest of the Transaction fields +// +// TODO: replace 300 with a proper constant for the size of the other +// Transaction fields +const CHUNK_SIZE = PACKET_DATA_SIZE - 300; + +/** + * Program loader interface + */ +class Loader { + /** + * @internal + */ + constructor() {} + + /** + * Amount of program data placed in each load Transaction + */ + + /** + * Minimum number of signatures required to load a program not including + * retries + * + * Can be used to calculate transaction fees + */ + static getMinNumSignatures(dataLength) { + return 2 * ( + // Every transaction requires two signatures (payer + program) + Math.ceil(dataLength / Loader.chunkSize) + 1 + + // Add one for Create transaction + 1) // Add one for Finalize transaction + ; + } + + /** + * Loads a generic program + * + * @param connection The connection to use + * @param payer System account that pays to load the program + * @param program Account to load the program into + * @param programId Public key that identifies the loader + * @param data Program octets + * @return true if program was loaded successfully, false if program was already loaded + */ + static async load(connection, payer, program, programId, data) { + { + const balanceNeeded = await connection.getMinimumBalanceForRentExemption(data.length); + + // Fetch program account info to check if it has already been created + const programInfo = await connection.getAccountInfo(program.publicKey, 'confirmed'); + let transaction = null; + if (programInfo !== null) { + if (programInfo.executable) { + console.error('Program load failed, account is already executable'); + return false; + } + if (programInfo.data.length !== data.length) { + transaction = transaction || new Transaction(); + transaction.add(SystemProgram.allocate({ + accountPubkey: program.publicKey, + space: data.length + })); + } + if (!programInfo.owner.equals(programId)) { + transaction = transaction || new Transaction(); + transaction.add(SystemProgram.assign({ + accountPubkey: program.publicKey, + programId + })); + } + if (programInfo.lamports < balanceNeeded) { + transaction = transaction || new Transaction(); + transaction.add(SystemProgram.transfer({ + fromPubkey: payer.publicKey, + toPubkey: program.publicKey, + lamports: balanceNeeded - programInfo.lamports + })); + } + } else { + transaction = new Transaction().add(SystemProgram.createAccount({ + fromPubkey: payer.publicKey, + newAccountPubkey: program.publicKey, + lamports: balanceNeeded > 0 ? balanceNeeded : 1, + space: data.length, + programId + })); + } + + // If the account is already created correctly, skip this step + // and proceed directly to loading instructions + if (transaction !== null) { + await sendAndConfirmTransaction(connection, transaction, [payer, program], { + commitment: 'confirmed' + }); + } + } + const dataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('offset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('bytesLength'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('bytesLengthPadding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('byte'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'bytes')]); + const chunkSize = Loader.chunkSize; + let offset = 0; + let array = data; + let transactions = []; + while (array.length > 0) { + const bytes = array.slice(0, chunkSize); + const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(chunkSize + 16); + dataLayout.encode({ + instruction: 0, + // Load instruction + offset, + bytes: bytes, + bytesLength: 0, + bytesLengthPadding: 0 + }, data); + const transaction = new Transaction().add({ + keys: [{ + pubkey: program.publicKey, + isSigner: true, + isWritable: true + }], + programId, + data + }); + transactions.push(sendAndConfirmTransaction(connection, transaction, [payer, program], { + commitment: 'confirmed' + })); + + // Delay between sends in an attempt to reduce rate limit errors + if (connection._rpcEndpoint.includes('solana.com')) { + const REQUESTS_PER_SECOND = 4; + await sleep(1000 / REQUESTS_PER_SECOND); + } + offset += chunkSize; + array = array.slice(chunkSize); + } + await Promise.all(transactions); + + // Finalize the account loaded with program data for execution + { + const dataLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]); + const data = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(dataLayout.span); + dataLayout.encode({ + instruction: 1 // Finalize instruction + }, data); + const transaction = new Transaction().add({ + keys: [{ + pubkey: program.publicKey, + isSigner: true, + isWritable: true + }, { + pubkey: SYSVAR_RENT_PUBKEY, + isSigner: false, + isWritable: false + }], + programId, + data + }); + const deployCommitment = 'processed'; + const finalizeSignature = await connection.sendTransaction(transaction, [payer, program], { + preflightCommitment: deployCommitment + }); + const { + context, + value + } = await connection.confirmTransaction({ + signature: finalizeSignature, + lastValidBlockHeight: transaction.lastValidBlockHeight, + blockhash: transaction.recentBlockhash + }, deployCommitment); + if (value.err) { + throw new Error(`Transaction ${finalizeSignature} failed (${JSON.stringify(value)})`); + } + // We prevent programs from being usable until the slot after their deployment. + // See https://github.com/solana-labs/solana/pull/29654 + while (true // eslint-disable-line no-constant-condition + ) { + try { + const currentSlot = await connection.getSlot({ + commitment: deployCommitment + }); + if (currentSlot > context.slot) { + break; + } + } catch { + /* empty */ + } + await new Promise(resolve => setTimeout(resolve, Math.round(MS_PER_SLOT / 2))); + } + } + + // success + return true; + } +} +Loader.chunkSize = CHUNK_SIZE; + +/** + * @deprecated Deprecated since Solana v1.17.20. + */ +const BPF_LOADER_PROGRAM_ID = new PublicKey('BPFLoader2111111111111111111111111111111111'); + +/** + * Factory class for transactions to interact with a program loader + * + * @deprecated Deprecated since Solana v1.17.20. + */ +class BpfLoader { + /** + * Minimum number of signatures required to load a program not including + * retries + * + * Can be used to calculate transaction fees + */ + static getMinNumSignatures(dataLength) { + return Loader.getMinNumSignatures(dataLength); + } + + /** + * Load a SBF program + * + * @param connection The connection to use + * @param payer Account that will pay program loading fees + * @param program Account to load the program into + * @param elf The entire ELF containing the SBF program + * @param loaderProgramId The program id of the BPF loader to use + * @return true if program was loaded successfully, false if program was already loaded + */ + static load(connection, payer, program, elf, loaderProgramId) { + return Loader.load(connection, payer, program, loaderProgramId, elf); + } +} + +function getDefaultExportFromCjs (x) { + return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; +} + +var fastStableStringify$1; +var hasRequiredFastStableStringify; + +function requireFastStableStringify () { + if (hasRequiredFastStableStringify) return fastStableStringify$1; + hasRequiredFastStableStringify = 1; + var objToString = Object.prototype.toString; + var objKeys = Object.keys || function(obj) { + var keys = []; + for (var name in obj) { + keys.push(name); + } + return keys; + }; + + function stringify(val, isArrayProp) { + var i, max, str, keys, key, propVal, toStr; + if (val === true) { + return "true"; + } + if (val === false) { + return "false"; + } + switch (typeof val) { + case "object": + if (val === null) { + return null; + } else if (val.toJSON && typeof val.toJSON === "function") { + return stringify(val.toJSON(), isArrayProp); + } else { + toStr = objToString.call(val); + if (toStr === "[object Array]") { + str = '['; + max = val.length - 1; + for(i = 0; i < max; i++) { + str += stringify(val[i], true) + ','; + } + if (max > -1) { + str += stringify(val[i], true); + } + return str + ']'; + } else if (toStr === "[object Object]") { + // only object is left + keys = objKeys(val).sort(); + max = keys.length; + str = ""; + i = 0; + while (i < max) { + key = keys[i]; + propVal = stringify(val[key], false); + if (propVal !== undefined) { + if (str) { + str += ','; + } + str += JSON.stringify(key) + ':' + propVal; + } + i++; + } + return '{' + str + '}'; + } else { + return JSON.stringify(val); + } + } + case "function": + case "undefined": + return isArrayProp ? null : undefined; + case "string": + return JSON.stringify(val); + default: + return isFinite(val) ? val : null; + } + } + + fastStableStringify$1 = function(val) { + var returnVal = stringify(val, false); + if (returnVal !== undefined) { + return ''+ returnVal; + } + }; + return fastStableStringify$1; +} + +var fastStableStringifyExports = /*@__PURE__*/ requireFastStableStringify(); +var fastStableStringify = /*@__PURE__*/getDefaultExportFromCjs(fastStableStringifyExports); + +const MINIMUM_SLOT_PER_EPOCH = 32; + +// Returns the number of trailing zeros in the binary representation of self. +function trailingZeros(n) { + let trailingZeros = 0; + while (n > 1) { + n /= 2; + trailingZeros++; + } + return trailingZeros; +} + +// Returns the smallest power of two greater than or equal to n +function nextPowerOfTwo(n) { + if (n === 0) return 1; + n--; + n |= n >> 1; + n |= n >> 2; + n |= n >> 4; + n |= n >> 8; + n |= n >> 16; + n |= n >> 32; + return n + 1; +} + +/** + * Epoch schedule + * (see https://docs.solana.com/terminology#epoch) + * Can be retrieved with the {@link Connection.getEpochSchedule} method + */ +class EpochSchedule { + constructor(slotsPerEpoch, leaderScheduleSlotOffset, warmup, firstNormalEpoch, firstNormalSlot) { + /** The maximum number of slots in each epoch */ + this.slotsPerEpoch = void 0; + /** The number of slots before beginning of an epoch to calculate a leader schedule for that epoch */ + this.leaderScheduleSlotOffset = void 0; + /** Indicates whether epochs start short and grow */ + this.warmup = void 0; + /** The first epoch with `slotsPerEpoch` slots */ + this.firstNormalEpoch = void 0; + /** The first slot of `firstNormalEpoch` */ + this.firstNormalSlot = void 0; + this.slotsPerEpoch = slotsPerEpoch; + this.leaderScheduleSlotOffset = leaderScheduleSlotOffset; + this.warmup = warmup; + this.firstNormalEpoch = firstNormalEpoch; + this.firstNormalSlot = firstNormalSlot; + } + getEpoch(slot) { + return this.getEpochAndSlotIndex(slot)[0]; + } + getEpochAndSlotIndex(slot) { + if (slot < this.firstNormalSlot) { + const epoch = trailingZeros(nextPowerOfTwo(slot + MINIMUM_SLOT_PER_EPOCH + 1)) - trailingZeros(MINIMUM_SLOT_PER_EPOCH) - 1; + const epochLen = this.getSlotsInEpoch(epoch); + const slotIndex = slot - (epochLen - MINIMUM_SLOT_PER_EPOCH); + return [epoch, slotIndex]; + } else { + const normalSlotIndex = slot - this.firstNormalSlot; + const normalEpochIndex = Math.floor(normalSlotIndex / this.slotsPerEpoch); + const epoch = this.firstNormalEpoch + normalEpochIndex; + const slotIndex = normalSlotIndex % this.slotsPerEpoch; + return [epoch, slotIndex]; + } + } + getFirstSlotInEpoch(epoch) { + if (epoch <= this.firstNormalEpoch) { + return (Math.pow(2, epoch) - 1) * MINIMUM_SLOT_PER_EPOCH; + } else { + return (epoch - this.firstNormalEpoch) * this.slotsPerEpoch + this.firstNormalSlot; + } + } + getLastSlotInEpoch(epoch) { + return this.getFirstSlotInEpoch(epoch) + this.getSlotsInEpoch(epoch) - 1; + } + getSlotsInEpoch(epoch) { + if (epoch < this.firstNormalEpoch) { + return Math.pow(2, epoch + trailingZeros(MINIMUM_SLOT_PER_EPOCH)); + } else { + return this.slotsPerEpoch; + } + } +} + +var fetchImpl = globalThis.fetch; + +class RpcWebSocketClient extends rpc_websockets__WEBPACK_IMPORTED_MODULE_10__.CommonClient { + constructor(address, options, generate_request_id) { + const webSocketFactory = url => { + const rpc = (0,rpc_websockets__WEBPACK_IMPORTED_MODULE_10__.WebSocket)(url, { + autoconnect: true, + max_reconnects: 5, + reconnect: true, + reconnect_interval: 1000, + ...options + }); + if ('socket' in rpc) { + this.underlyingSocket = rpc.socket; + } else { + this.underlyingSocket = rpc; + } + return rpc; + }; + super(webSocketFactory, address, options, generate_request_id); + this.underlyingSocket = void 0; + } + call(...args) { + const readyState = this.underlyingSocket?.readyState; + if (readyState === 1 /* WebSocket.OPEN */) { + return super.call(...args); + } + return Promise.reject(new Error('Tried to call a JSON-RPC method `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')')); + } + notify(...args) { + const readyState = this.underlyingSocket?.readyState; + if (readyState === 1 /* WebSocket.OPEN */) { + return super.notify(...args); + } + return Promise.reject(new Error('Tried to send a JSON-RPC notification `' + args[0] + '` but the socket was not `CONNECTING` or `OPEN` (`readyState` was ' + readyState + ')')); + } +} + +/** + * @internal + */ + +/** + * Decode account data buffer using an AccountType + * @internal + */ +function decodeData(type, data) { + let decoded; + try { + decoded = type.layout.decode(data); + } catch (err) { + throw new Error('invalid instruction; ' + err); + } + if (decoded.typeIndex !== type.index) { + throw new Error(`invalid account data; account type mismatch ${decoded.typeIndex} != ${type.index}`); + } + return decoded; +} + +/// The serialized size of lookup table metadata +const LOOKUP_TABLE_META_SIZE = 56; +class AddressLookupTableAccount { + constructor(args) { + this.key = void 0; + this.state = void 0; + this.key = args.key; + this.state = args.state; + } + isActive() { + const U64_MAX = BigInt('0xffffffffffffffff'); + return this.state.deactivationSlot === U64_MAX; + } + static deserialize(accountData) { + const meta = decodeData(LookupTableMetaLayout, accountData); + const serializedAddressesLen = accountData.length - LOOKUP_TABLE_META_SIZE; + assert(serializedAddressesLen >= 0, 'lookup table is invalid'); + assert(serializedAddressesLen % 32 === 0, 'lookup table is invalid'); + const numSerializedAddresses = serializedAddressesLen / 32; + const { + addresses + } = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(publicKey(), numSerializedAddresses, 'addresses')]).decode(accountData.slice(LOOKUP_TABLE_META_SIZE)); + return { + deactivationSlot: meta.deactivationSlot, + lastExtendedSlot: meta.lastExtendedSlot, + lastExtendedSlotStartIndex: meta.lastExtendedStartIndex, + authority: meta.authority.length !== 0 ? new PublicKey(meta.authority[0]) : undefined, + addresses: addresses.map(address => new PublicKey(address)) + }; + } +} +const LookupTableMetaLayout = { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('typeIndex'), u64('deactivationSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('lastExtendedSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('lastExtendedStartIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8(), + // option + _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(publicKey(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8(), -1), 'authority')]) +}; + +const URL_RE = /^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i; +function makeWebsocketUrl(endpoint) { + const matches = endpoint.match(URL_RE); + if (matches == null) { + throw TypeError(`Failed to validate endpoint URL \`${endpoint}\``); + } + const [_, + // eslint-disable-line @typescript-eslint/no-unused-vars + hostish, portWithColon, rest] = matches; + const protocol = endpoint.startsWith('https:') ? 'wss:' : 'ws:'; + const startPort = portWithColon == null ? null : parseInt(portWithColon.slice(1), 10); + const websocketPort = + // Only shift the port by +1 as a convention for ws(s) only if given endpoint + // is explicitly specifying the endpoint port (HTTP-based RPC), assuming + // we're directly trying to connect to agave-validator's ws listening port. + // When the endpoint omits the port, we're connecting to the protocol + // default ports: http(80) or https(443) and it's assumed we're behind a reverse + // proxy which manages WebSocket upgrade and backend port redirection. + startPort == null ? '' : `:${startPort + 1}`; + return `${protocol}//${hostish}${websocketPort}${rest}`; +} + +const PublicKeyFromString = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.instance)(PublicKey), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), value => new PublicKey(value)); +const RawAccountDataResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('base64')]); +const BufferFromRawAccountData = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.instance)(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer), RawAccountDataResult, value => buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(value[0], 'base64')); + +/** + * Attempt to use a recent blockhash for up to 30 seconds + * @internal + */ +const BLOCKHASH_CACHE_TIMEOUT_MS = 30 * 1000; + +/** + * HACK. + * Copied from rpc-websockets/dist/lib/client. + * Otherwise, `yarn build` fails with: + * https://gist.github.com/steveluscher/c057eca81d479ef705cdb53162f9971d + */ + +/** @internal */ +/** @internal */ +/** @internal */ +/** @internal */ + +/** @internal */ +/** + * @internal + * Every subscription contains the args used to open the subscription with + * the server, and a list of callers interested in notifications. + */ + +/** + * @internal + * A subscription may be in various states of connectedness. Only when it is + * fully connected will it have a server subscription id associated with it. + * This id can be returned to the server to unsubscribe the client entirely. + */ + +/** + * A type that encapsulates a subscription's RPC method + * names and notification (callback) signature. + */ + +/** + * @internal + * Utility type that keeps tagged unions intact while omitting properties. + */ + +/** + * @internal + * This type represents a single subscribable 'topic.' It's made up of: + * + * - The args used to open the subscription with the server, + * - The state of the subscription, in terms of its connectedness, and + * - The set of callbacks to call when the server publishes notifications + * + * This record gets indexed by `SubscriptionConfigHash` and is used to + * set up subscriptions, fan out notifications, and track subscription state. + */ + +/** + * @internal + */ + +/** + * Extra contextual information for RPC responses + */ + +/** + * Options for sending transactions + */ + +/** + * Options for confirming transactions + */ + +/** + * Options for getConfirmedSignaturesForAddress2 + */ + +/** + * Options for getSignaturesForAddress + */ + +/** + * RPC Response with extra contextual information + */ + +/** + * A strategy for confirming transactions that uses the last valid + * block height for a given blockhash to check for transaction expiration. + */ + +/** + * A strategy for confirming durable nonce transactions. + */ + +/** + * Properties shared by all transaction confirmation strategies + */ + +/** + * This type represents all transaction confirmation strategies + */ + +/* @internal */ +function assertEndpointUrl(putativeUrl) { + if (/^https?:/.test(putativeUrl) === false) { + throw new TypeError('Endpoint URL must start with `http:` or `https:`.'); + } + return putativeUrl; +} + +/** @internal */ +function extractCommitmentFromConfig(commitmentOrConfig) { + let commitment; + let config; + if (typeof commitmentOrConfig === 'string') { + commitment = commitmentOrConfig; + } else if (commitmentOrConfig) { + const { + commitment: specifiedCommitment, + ...specifiedConfig + } = commitmentOrConfig; + commitment = specifiedCommitment; + config = specifiedConfig; + } + return { + commitment, + config + }; +} + +/** + * @internal + */ +function applyDefaultMemcmpEncodingToFilters(filters) { + return filters.map(filter => 'memcmp' in filter ? { + ...filter, + memcmp: { + ...filter.memcmp, + encoding: filter.memcmp.encoding ?? 'base58' + } + } : filter); +} + +/** + * @internal + */ +function createRpcResult(result) { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + jsonrpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('2.0'), + id: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + result + }), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + jsonrpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('2.0'), + id: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + error: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + code: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)(), + message: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.any)()) + }) + })]); +} +const UnknownRpcResult = createRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)()); + +/** + * @internal + */ +function jsonRpcResult(schema) { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.coerce)(createRpcResult(schema), UnknownRpcResult, value => { + if ('error' in value) { + return value; + } else { + return { + ...value, + result: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(value.result, schema) + }; + } + }); +} + +/** + * @internal + */ +function jsonRpcResultAndContext(value) { + return jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + context: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }), + value + })); +} + +/** + * @internal + */ +function notificationResultAndContext(value) { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + context: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }), + value + }); +} + +/** + * @internal + */ +function versionedMessageFromResponse(version, response) { + if (version === 0) { + return new MessageV0({ + header: response.header, + staticAccountKeys: response.accountKeys.map(accountKey => new PublicKey(accountKey)), + recentBlockhash: response.recentBlockhash, + compiledInstructions: response.instructions.map(ix => ({ + programIdIndex: ix.programIdIndex, + accountKeyIndexes: ix.accounts, + data: bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(ix.data) + })), + addressTableLookups: response.addressTableLookups + }); + } else { + return new Message(response); + } +} + +/** + * The level of commitment desired when querying state + *
+ *   'processed': Query the most recent block which has reached 1 confirmation by the connected node
+ *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
+ *   'finalized': Query the most recent block which has been finalized by the cluster
+ * 
+ */ + +// Deprecated as of v1.5.5 + +/** + * A subset of Commitment levels, which are at least optimistically confirmed + *
+ *   'confirmed': Query the most recent block which has reached 1 confirmation by the cluster
+ *   'finalized': Query the most recent block which has been finalized by the cluster
+ * 
+ */ + +/** + * Filter for largest accounts query + *
+ *   'circulating':    Return the largest accounts that are part of the circulating supply
+ *   'nonCirculating': Return the largest accounts that are not part of the circulating supply
+ * 
+ */ + +/** + * Configuration object for changing `getAccountInfo` query behavior + */ + +/** + * Configuration object for changing `getBalance` query behavior + */ + +/** + * Configuration object for changing `getBlock` query behavior + */ + +/** + * Configuration object for changing `getBlock` query behavior + */ + +/** + * Configuration object for changing `getStakeMinimumDelegation` query behavior + */ + +/** + * Configuration object for changing `getBlockHeight` query behavior + */ + +/** + * Configuration object for changing `getEpochInfo` query behavior + */ + +/** + * Configuration object for changing `getInflationReward` query behavior + */ + +/** + * Configuration object for changing `getLatestBlockhash` query behavior + */ + +/** + * Configuration object for changing `isBlockhashValid` query behavior + */ + +/** + * Configuration object for changing `getSlot` query behavior + */ + +/** + * Configuration object for changing `getSlotLeader` query behavior + */ + +/** + * Configuration object for changing `getTransaction` query behavior + */ + +/** + * Configuration object for changing `getTransaction` query behavior + */ + +/** + * Configuration object for changing `getLargestAccounts` query behavior + */ + +/** + * Configuration object for changing `getSupply` request behavior + */ + +/** + * Configuration object for changing query behavior + */ + +/** + * Information describing a cluster node + */ + +/** + * Information describing a vote account + */ + +/** + * A collection of cluster vote accounts + */ + +/** + * Network Inflation + * (see https://docs.solana.com/implemented-proposals/ed_overview) + */ + +const GetInflationGovernorResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + foundation: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + foundationTerm: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + initial: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + taper: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + terminal: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * The inflation reward for an epoch + */ + +/** + * Expected JSON RPC response for the "getInflationReward" message + */ +const GetInflationRewardResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + effectiveSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + postBalance: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())) +})))); + +/** + * Configuration object for changing `getRecentPrioritizationFees` query behavior + */ + +/** + * Expected JSON RPC response for the "getRecentPrioritizationFees" message + */ +const GetRecentPrioritizationFeesResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + prioritizationFee: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +})); +/** + * Expected JSON RPC response for the "getInflationRate" message + */ +const GetInflationRateResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + total: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + validator: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + foundation: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Information about the current epoch + */ + +const GetEpochInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + epoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + slotIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + slotsInEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + absoluteSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + transactionCount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); +const GetEpochScheduleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slotsPerEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + leaderScheduleSlotOffset: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + warmup: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + firstNormalEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + firstNormalSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Leader schedule + * (see https://docs.solana.com/terminology#leader-schedule) + */ + +const GetLeaderScheduleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.record)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + +/** + * Transaction error or null + */ +const TransactionErrorResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()])); + +/** + * Signature status for a transaction + */ +const SignatureStatusResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + err: TransactionErrorResult +}); + +/** + * Transaction signature received notification + */ +const SignatureReceivedResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('receivedSignature'); + +/** + * Version info for a node + */ + +const VersionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + 'solana-core': (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + 'feature-set': (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); +const ParsedInstructionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + program: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programId: PublicKeyFromString, + parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)() +}); +const PartiallyDecodedInstructionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + programId: PublicKeyFromString, + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)() +}); +const SimulatedTransactionResponseStruct = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + err: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()])), + logs: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)())), + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + owner: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) + }))))), + unitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + returnData: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('base64')]) + }))), + innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + index: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([ParsedInstructionStruct, PartiallyDecodedInstructionStruct])) + })))) +})); + +/** + * Metadata for a parsed confirmed transaction on the ledger + * + * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionMeta} instead. + */ + +/** + * Collection of addresses loaded by a transaction using address table lookups + */ + +/** + * Metadata for a parsed transaction on the ledger + */ + +/** + * Metadata for a confirmed transaction on the ledger + */ + +/** + * A processed transaction from the RPC API + */ + +/** + * A processed transaction from the RPC API + */ + +/** + * A processed transaction message from the RPC API + */ + +/** + * A confirmed transaction on the ledger + * + * @deprecated Deprecated since RPC v1.8.0. + */ + +/** + * A partially decoded transaction instruction + */ + +/** + * A parsed transaction message account + */ + +/** + * A parsed transaction instruction + */ + +/** + * A parsed address table lookup + */ + +/** + * A parsed transaction message + */ + +/** + * A parsed transaction + */ + +/** + * A parsed and confirmed transaction on the ledger + * + * @deprecated Deprecated since RPC v1.8.0. Please use {@link ParsedTransactionWithMeta} instead. + */ + +/** + * A parsed transaction on the ledger with meta + */ + +/** + * A processed block fetched from the RPC API + */ + +/** + * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts` + */ + +/** + * A processed block fetched from the RPC API where the `transactionDetails` mode is `none` + */ + +/** + * A block with parsed transactions + */ + +/** + * A block with parsed transactions where the `transactionDetails` mode is `accounts` + */ + +/** + * A block with parsed transactions where the `transactionDetails` mode is `none` + */ + +/** + * A processed block fetched from the RPC API + */ + +/** + * A processed block fetched from the RPC API where the `transactionDetails` mode is `accounts` + */ + +/** + * A processed block fetched from the RPC API where the `transactionDetails` mode is `none` + */ + +/** + * A confirmed block on the ledger + * + * @deprecated Deprecated since RPC v1.8.0. + */ + +/** + * A Block on the ledger with signatures only + */ + +/** + * recent block production information + */ + +/** + * Expected JSON RPC response for the "getBlockProduction" message + */ +const BlockProductionResponseStruct = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + byIdentity: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.record)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())), + range: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + firstSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + lastSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }) +})); + +/** + * A performance sample + */ + +function createRpcClient(url, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent) { + const fetch = customFetch ? customFetch : fetchImpl; + let agent; + { + if (httpAgent != 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.'); + } + } + let fetchWithMiddleware; + if (fetchMiddleware) { + fetchWithMiddleware = async (info, init) => { + const modifiedFetchArgs = await new Promise((resolve, reject) => { + try { + fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit])); + } catch (error) { + reject(error); + } + }); + return await fetch(...modifiedFetchArgs); + }; + } + const clientBrowser = new (jayson_lib_client_browser__WEBPACK_IMPORTED_MODULE_9___default())(async (request, callback) => { + const options = { + method: 'POST', + body: request, + agent, + headers: Object.assign({ + 'Content-Type': 'application/json' + }, httpHeaders || {}, COMMON_HTTP_HEADERS) + }; + try { + let too_many_requests_retries = 5; + let res; + let waitTime = 500; + for (;;) { + if (fetchWithMiddleware) { + res = await fetchWithMiddleware(url, options); + } else { + res = await fetch(url, options); + } + if (res.status !== 429 /* Too many requests */) { + break; + } + if (disableRetryOnRateLimit === true) { + break; + } + too_many_requests_retries -= 1; + if (too_many_requests_retries === 0) { + break; + } + console.error(`Server responded with ${res.status} ${res.statusText}. Retrying after ${waitTime}ms delay...`); + await sleep(waitTime); + waitTime *= 2; + } + const text = await res.text(); + if (res.ok) { + callback(null, text); + } else { + callback(new Error(`${res.status} ${res.statusText}: ${text}`)); + } + } catch (err) { + if (err instanceof Error) callback(err); + } + }, {}); + return clientBrowser; +} +function createRpcRequest(client) { + return (method, args) => { + return new Promise((resolve, reject) => { + client.request(method, args, (err, response) => { + if (err) { + reject(err); + return; + } + resolve(response); + }); + }); + }; +} +function createRpcBatchRequest(client) { + return requests => { + return new Promise((resolve, reject) => { + // Do nothing if requests is empty + if (requests.length === 0) resolve([]); + const batch = requests.map(params => { + return client.request(params.methodName, params.args); + }); + client.request(batch, (err, response) => { + if (err) { + reject(err); + return; + } + resolve(response); + }); + }); + }; +} + +/** + * Expected JSON RPC response for the "getInflationGovernor" message + */ +const GetInflationGovernorRpcResult = jsonRpcResult(GetInflationGovernorResult); + +/** + * Expected JSON RPC response for the "getInflationRate" message + */ +const GetInflationRateRpcResult = jsonRpcResult(GetInflationRateResult); + +/** + * Expected JSON RPC response for the "getRecentPrioritizationFees" message + */ +const GetRecentPrioritizationFeesRpcResult = jsonRpcResult(GetRecentPrioritizationFeesResult); + +/** + * Expected JSON RPC response for the "getEpochInfo" message + */ +const GetEpochInfoRpcResult = jsonRpcResult(GetEpochInfoResult); + +/** + * Expected JSON RPC response for the "getEpochSchedule" message + */ +const GetEpochScheduleRpcResult = jsonRpcResult(GetEpochScheduleResult); + +/** + * Expected JSON RPC response for the "getLeaderSchedule" message + */ +const GetLeaderScheduleRpcResult = jsonRpcResult(GetLeaderScheduleResult); + +/** + * Expected JSON RPC response for the "minimumLedgerSlot" and "getFirstAvailableBlock" messages + */ +const SlotRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()); + +/** + * Supply + */ + +/** + * Expected JSON RPC response for the "getSupply" message + */ +const GetSupplyRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + total: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + circulating: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + nonCirculating: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + nonCirculatingAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString) +})); + +/** + * Token amount object which returns a token amount in different formats + * for various client use cases. + */ + +/** + * Expected JSON RPC structure for token amounts + */ +const TokenAmountResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + uiAmount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + decimals: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + uiAmountString: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()) +}); + +/** + * Token address and balance. + */ + +/** + * Expected JSON RPC response for the "getTokenLargestAccounts" message + */ +const GetTokenLargestAccountsResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + address: PublicKeyFromString, + amount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + uiAmount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + decimals: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + uiAmountString: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()) +}))); + +/** + * Expected JSON RPC response for the "getTokenAccountsByOwner" message + */ +const GetTokenAccountsByOwner = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + account: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + owner: PublicKeyFromString, + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + data: BufferFromRawAccountData, + rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }) +}))); +const ParsedAccountDataResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + program: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)(), + space: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Expected JSON RPC response for the "getTokenAccountsByOwner" message with parsed data + */ +const GetParsedTokenAccountsByOwner = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + account: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + owner: PublicKeyFromString, + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + data: ParsedAccountDataResult, + rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }) +}))); + +/** + * Pair of an account address and its balance + */ + +/** + * Expected JSON RPC response for the "getLargestAccounts" message + */ +const GetLargestAccountsRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + address: PublicKeyFromString +}))); + +/** + * @internal + */ +const AccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + owner: PublicKeyFromString, + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + data: BufferFromRawAccountData, + rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * @internal + */ +const KeyedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + account: AccountInfoResult +}); +const ParsedOrRawAccountData = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.coerce)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.instance)(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer), ParsedAccountDataResult]), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([RawAccountDataResult, ParsedAccountDataResult]), value => { + if (Array.isArray(value)) { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(value, BufferFromRawAccountData); + } else { + return value; + } +}); + +/** + * @internal + */ +const ParsedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + executable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + owner: PublicKeyFromString, + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + data: ParsedOrRawAccountData, + rentEpoch: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); +const KeyedParsedAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + account: ParsedAccountInfoResult +}); + +/** + * @internal + */ +const StakeActivationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + state: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('active'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('inactive'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('activating'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('deactivating')]), + active: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + inactive: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Expected JSON RPC response for the "getConfirmedSignaturesForAddress2" message + */ + +const GetConfirmedSignaturesForAddress2RpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + err: TransactionErrorResult, + memo: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())) +}))); + +/** + * Expected JSON RPC response for the "getSignaturesForAddress" message + */ +const GetSignaturesForAddressRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + err: TransactionErrorResult, + memo: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())) +}))); + +/*** + * Expected JSON RPC response for the "accountNotification" message + */ +const AccountNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: notificationResultAndContext(AccountInfoResult) +}); + +/** + * @internal + */ +const ProgramAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + account: AccountInfoResult +}); + +/*** + * Expected JSON RPC response for the "programNotification" message + */ +const ProgramAccountNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: notificationResultAndContext(ProgramAccountInfoResult) +}); + +/** + * @internal + */ +const SlotInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + parent: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + root: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Expected JSON RPC response for the "slotNotification" message + */ +const SlotNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: SlotInfoResult +}); + +/** + * Slot updates which can be used for tracking the live progress of a cluster. + * - `"firstShredReceived"`: connected node received the first shred of a block. + * Indicates that a new block that is being produced. + * - `"completed"`: connected node has received all shreds of a block. Indicates + * a block was recently produced. + * - `"optimisticConfirmation"`: block was optimistically confirmed by the + * cluster. It is not guaranteed that an optimistic confirmation notification + * will be sent for every finalized blocks. + * - `"root"`: the connected node rooted this block. + * - `"createdBank"`: the connected node has started validating this block. + * - `"frozen"`: the connected node has validated this block. + * - `"dead"`: the connected node failed to validate this block. + */ + +/** + * @internal + */ +const SlotUpdateResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + type: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('firstShredReceived'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('completed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('optimisticConfirmation'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('root')]), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + type: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('createdBank'), + parent: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + type: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('frozen'), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + stats: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + numTransactionEntries: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numSuccessfulTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numFailedTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + maxTransactionsPerEntry: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }) +}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + type: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('dead'), + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + timestamp: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + err: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)() +})]); + +/** + * Expected JSON RPC response for the "slotsUpdatesNotification" message + */ +const SlotUpdateNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: SlotUpdateResult +}); + +/** + * Expected JSON RPC response for the "signatureNotification" message + */ +const SignatureNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: notificationResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([SignatureStatusResult, SignatureReceivedResult])) +}); + +/** + * Expected JSON RPC response for the "rootNotification" message + */ +const RootNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + result: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); +const ContactInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + gossip: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + tpu: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + rpc: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()) +}); +const VoteAccountInfoResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + votePubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + nodePubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + activatedStake: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + epochVoteAccount: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + epochCredits: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.tuple)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()])), + commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + lastVote: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + rootSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); + +/** + * Expected JSON RPC response for the "getVoteAccounts" message + */ +const GetVoteAccounts = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + current: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(VoteAccountInfoResult), + delinquent: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(VoteAccountInfoResult) +})); +const ConfirmationStatus = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('processed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('confirmed'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('finalized')]); +const SignatureStatusResponse = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + confirmations: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + err: TransactionErrorResult, + confirmationStatus: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(ConfirmationStatus) +}); + +/** + * Expected JSON RPC response for the "getSignatureStatuses" message + */ +const GetSignatureStatusesRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(SignatureStatusResponse))); + +/** + * Expected JSON RPC response for the "getMinimumBalanceForRentExemption" message + */ +const GetMinimumBalanceForRentExemptionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()); +const AddressTableLookupStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accountKey: PublicKeyFromString, + writableIndexes: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + readonlyIndexes: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); +const ConfirmedTransactionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + message: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + header: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + numRequiredSignatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numReadonlySignedAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numReadonlyUnsignedAccounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }), + instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programIdIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + })), + recentBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + addressTableLookups: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(AddressTableLookupStruct)) + }) +}); +const AnnotatedAccountKey = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: PublicKeyFromString, + signer: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + writable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)(), + source: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('transaction'), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('lookupTable')])) +}); +const ConfirmedTransactionAccountsModeResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(AnnotatedAccountKey), + signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()) +}); +const ParsedInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)(), + program: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programId: PublicKeyFromString +}); +const RawInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programId: PublicKeyFromString +}); +const InstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([RawInstructionResult, ParsedInstructionResult]); +const UnknownInstructionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + parsed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.unknown)(), + program: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)() +}), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)() +})]); +const ParsedOrRawInstruction = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.coerce)(InstructionResult, UnknownInstructionResult, value => { + if ('accounts' in value) { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(value, RawInstructionResult); + } else { + return (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(value, ParsedInstructionResult); + } +}); + +/** + * @internal + */ +const ParsedConfirmedTransactionResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + message: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accountKeys: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(AnnotatedAccountKey), + instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(ParsedOrRawInstruction), + recentBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + addressTableLookups: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(AddressTableLookupStruct))) + }) +}); +const TokenBalanceResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accountIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + mint: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + owner: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + programId: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + uiTokenAmount: TokenAmountResult +}); +const LoadedAddressesResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + writable: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString), + readonly: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString) +}); + +/** + * @internal + */ +const ConfirmedTransactionMetaResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + err: TransactionErrorResult, + fee: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + index: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + accounts: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + data: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + programIdIndex: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + })) + })))), + preBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + postBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + logMessages: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()))), + preTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(TokenBalanceResult))), + postTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(TokenBalanceResult))), + loadedAddresses: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(LoadedAddressesResult), + computeUnitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + costUnits: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); + +/** + * @internal + */ +const ParsedConfirmedTransactionMetaResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + err: TransactionErrorResult, + fee: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + innerInstructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + index: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + instructions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(ParsedOrRawInstruction) + })))), + preBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + postBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + logMessages: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()))), + preTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(TokenBalanceResult))), + postTokenBalances: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(TokenBalanceResult))), + loadedAddresses: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(LoadedAddressesResult), + computeUnitsConsumed: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + costUnits: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}); +const TransactionVersionStruct = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.union)([(0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)(0), (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.literal)('legacy')]); + +/** @internal */ +const RewardsResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + pubkey: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + lamports: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + postBalance: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + rewardType: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + commission: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())) +}); + +/** + * Expected JSON RPC response for the "getBlock" message + */ +const GetBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + transaction: ConfirmedTransactionResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ConfirmedTransactionMetaResult), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) + })), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected JSON RPC response for the "getBlock" message when `transactionDetails` is `none` + */ +const GetNoneModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected JSON RPC response for the "getBlock" message when `transactionDetails` is `accounts` + */ +const GetAccountsModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + transaction: ConfirmedTransactionAccountsModeResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ConfirmedTransactionMetaResult), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) + })), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected parsed JSON RPC response for the "getBlock" message + */ +const GetParsedBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + transaction: ParsedConfirmedTransactionResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ParsedConfirmedTransactionMetaResult), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) + })), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected parsed JSON RPC response for the "getBlock" message when `transactionDetails` is `accounts` + */ +const GetParsedAccountsModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + transaction: ConfirmedTransactionAccountsModeResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ParsedConfirmedTransactionMetaResult), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) + })), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected parsed JSON RPC response for the "getBlock" message when `transactionDetails` is `none` + */ +const GetParsedNoneModeBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()), + blockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected JSON RPC response for the "getConfirmedBlock" message + * + * @deprecated Deprecated since RPC v1.8.0. Please use {@link GetBlockRpcResult} instead. + */ +const GetConfirmedBlockRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + transaction: ConfirmedTransactionResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ConfirmedTransactionMetaResult) + })), + rewards: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(RewardsResult)), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected JSON RPC response for the "getBlock" message + */ +const GetBlockSignaturesRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + previousBlockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + parentSlot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + signatures: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()) +}))); + +/** + * Expected JSON RPC response for the "getTransaction" message + */ +const GetTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ConfirmedTransactionMetaResult), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())), + transaction: ConfirmedTransactionResult, + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) +}))); + +/** + * Expected parsed JSON RPC response for the "getTransaction" message + */ +const GetParsedTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + transaction: ParsedConfirmedTransactionResult, + meta: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ParsedConfirmedTransactionMetaResult), + blockTime: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())), + version: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)(TransactionVersionStruct) +}))); + +/** + * Expected JSON RPC response for the "getLatestBlockhash" message + */ +const GetLatestBlockhashRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + blockhash: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + lastValidBlockHeight: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +})); + +/** + * Expected JSON RPC response for the "isBlockhashValid" message + */ +const IsBlockhashValidRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.boolean)()); +const PerfSampleResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + slot: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numTransactions: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + numSlots: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)(), + samplePeriodSecs: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/* + * Expected JSON RPC response for "getRecentPerformanceSamples" message + */ +const GetRecentPerformanceSamplesRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PerfSampleResult)); + +/** + * Expected JSON RPC response for the "getFeeCalculatorForBlockhash" message + */ +const GetFeeCalculatorRpcResult = jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + feeCalculator: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + lamportsPerSignature: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() + }) +}))); + +/** + * Expected JSON RPC response for the "requestAirdrop" message + */ +const RequestAirdropRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()); + +/** + * Expected JSON RPC response for the "sendTransaction" message + */ +const SendTransactionRpcResult = jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()); + +/** + * Information about the latest slot being processed by a node + */ + +/** + * Parsed account data + */ + +/** + * Stake Activation data + */ + +/** + * Data slice argument for getProgramAccounts + */ + +/** + * Memory comparison filter for getProgramAccounts + */ + +/** + * Data size comparison filter for getProgramAccounts + */ + +/** + * A filter object for getProgramAccounts + */ + +/** + * Configuration object for getProgramAccounts requests + */ + +/** + * Configuration object for getParsedProgramAccounts + */ + +/** + * Configuration object for getMultipleAccounts + */ + +/** + * Configuration object for `getStakeActivation` + */ + +/** + * Configuration object for `getStakeActivation` + */ + +/** + * Configuration object for `getStakeActivation` + */ + +/** + * Configuration object for `getNonce` + */ + +/** + * Configuration object for `getNonceAndContext` + */ + +/** + * Information describing an account + */ + +/** + * Account information identified by pubkey + */ + +/** + * Callback function for account change notifications + */ + +/** + * Callback function for program account change notifications + */ + +/** + * Callback function for slot change notifications + */ + +/** + * Callback function for slot update notifications + */ + +/** + * Callback function for signature status notifications + */ + +/** + * Signature status notification with transaction result + */ + +/** + * Signature received notification + */ + +/** + * Callback function for signature notifications + */ + +/** + * Signature subscription options + */ + +/** + * Callback function for root change notifications + */ + +/** + * @internal + */ +const LogsResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + err: TransactionErrorResult, + logs: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + signature: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)() +}); + +/** + * Logs result. + */ + +/** + * Expected JSON RPC response for the "logsNotification" message. + */ +const LogsNotificationResult = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + result: notificationResultAndContext(LogsResult), + subscription: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)() +}); + +/** + * Filter for log subscriptions. + */ + +/** + * Callback function for log notifications. + */ + +/** + * Signature result + */ + +/** + * Transaction error + */ + +/** + * Transaction confirmation status + *
+ *   'processed': Transaction landed in a block which has reached 1 confirmation by the connected node
+ *   'confirmed': Transaction landed in a block which has reached 1 confirmation by the cluster
+ *   'finalized': Transaction landed in a block which has been finalized by the cluster
+ * 
+ */ + +/** + * Signature status + */ + +/** + * A confirmed signature with its status + */ + +/** + * An object defining headers to be passed to the RPC server + */ + +/** + * The type of the JavaScript `fetch()` API + */ + +/** + * A callback used to augment the outgoing HTTP request + */ + +/** + * Configuration for instantiating a Connection + */ + +/** @internal */ +const COMMON_HTTP_HEADERS = { + 'solana-client': `js/${"1.0.0-maintenance"}` +}; + +/** + * A connection to a fullnode JSON RPC endpoint + */ +class Connection { + /** + * Establish a JSON RPC connection + * + * @param endpoint URL to the fullnode JSON RPC endpoint + * @param commitmentOrConfig optional default commitment level or optional ConnectionConfig configuration object + */ + constructor(endpoint, _commitmentOrConfig) { + /** @internal */ + this._commitment = void 0; + /** @internal */ + this._confirmTransactionInitialTimeout = void 0; + /** @internal */ + this._rpcEndpoint = void 0; + /** @internal */ + this._rpcWsEndpoint = void 0; + /** @internal */ + this._rpcClient = void 0; + /** @internal */ + this._rpcRequest = void 0; + /** @internal */ + this._rpcBatchRequest = void 0; + /** @internal */ + this._rpcWebSocket = void 0; + /** @internal */ + this._rpcWebSocketConnected = false; + /** @internal */ + this._rpcWebSocketHeartbeat = null; + /** @internal */ + this._rpcWebSocketIdleTimeout = null; + /** @internal + * A number that we increment every time an active connection closes. + * Used to determine whether the same socket connection that was open + * when an async operation started is the same one that's active when + * its continuation fires. + * + */ + this._rpcWebSocketGeneration = 0; + /** @internal */ + this._disableBlockhashCaching = false; + /** @internal */ + this._pollingBlockhash = false; + /** @internal */ + this._blockhashInfo = { + latestBlockhash: null, + lastFetch: 0, + transactionSignatures: [], + simulatedSignatures: [] + }; + /** @internal */ + this._nextClientSubscriptionId = 0; + /** @internal */ + this._subscriptionDisposeFunctionsByClientSubscriptionId = {}; + /** @internal */ + this._subscriptionHashByClientSubscriptionId = {}; + /** @internal */ + this._subscriptionStateChangeCallbacksByHash = {}; + /** @internal */ + this._subscriptionCallbacksByServerSubscriptionId = {}; + /** @internal */ + this._subscriptionsByHash = {}; + /** + * Special case. + * After a signature is processed, RPCs automatically dispose of the + * subscription on the server side. We need to track which of these + * subscriptions have been disposed in such a way, so that we know + * whether the client is dealing with a not-yet-processed signature + * (in which case we must tear down the server subscription) or an + * already-processed signature (in which case the client can simply + * clear out the subscription locally without telling the server). + * + * NOTE: There is a proposal to eliminate this special case, here: + * https://github.com/solana-labs/solana/issues/18892 + */ + /** @internal */ + this._subscriptionsAutoDisposedByRpc = new Set(); + /* + * Returns the current block height of the node + */ + this.getBlockHeight = (() => { + const requestPromises = {}; + return async commitmentOrConfig => { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const requestHash = fastStableStringify(args); + requestPromises[requestHash] = requestPromises[requestHash] ?? (async () => { + try { + const unsafeRes = await this._rpcRequest('getBlockHeight', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get block height information'); + } + return res.result; + } finally { + delete requestPromises[requestHash]; + } + })(); + return await requestPromises[requestHash]; + }; + })(); + let wsEndpoint; + let httpHeaders; + let fetch; + let fetchMiddleware; + let disableRetryOnRateLimit; + let httpAgent; + if (_commitmentOrConfig && typeof _commitmentOrConfig === 'string') { + this._commitment = _commitmentOrConfig; + } else if (_commitmentOrConfig) { + this._commitment = _commitmentOrConfig.commitment; + this._confirmTransactionInitialTimeout = _commitmentOrConfig.confirmTransactionInitialTimeout; + wsEndpoint = _commitmentOrConfig.wsEndpoint; + httpHeaders = _commitmentOrConfig.httpHeaders; + fetch = _commitmentOrConfig.fetch; + fetchMiddleware = _commitmentOrConfig.fetchMiddleware; + disableRetryOnRateLimit = _commitmentOrConfig.disableRetryOnRateLimit; + httpAgent = _commitmentOrConfig.httpAgent; + } + this._rpcEndpoint = assertEndpointUrl(endpoint); + this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint); + this._rpcClient = createRpcClient(endpoint, httpHeaders, fetch, fetchMiddleware, disableRetryOnRateLimit, httpAgent); + this._rpcRequest = createRpcRequest(this._rpcClient); + this._rpcBatchRequest = createRpcBatchRequest(this._rpcClient); + this._rpcWebSocket = new RpcWebSocketClient(this._rpcWsEndpoint, { + autoconnect: false, + max_reconnects: Infinity + }); + 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)); + } + + /** + * The default commitment used for requests + */ + get commitment() { + return this._commitment; + } + + /** + * The RPC endpoint + */ + get rpcEndpoint() { + return this._rpcEndpoint; + } + + /** + * Fetch the balance for the specified public key, return with context + */ + async getBalanceAndContext(publicKey, commitmentOrConfig) { + /** @internal */ + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getBalance', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get balance for ${publicKey.toBase58()}`); + } + return res.result; + } + + /** + * Fetch the balance for the specified public key + */ + async getBalance(publicKey, commitmentOrConfig) { + return await this.getBalanceAndContext(publicKey, commitmentOrConfig).then(x => x.value).catch(e => { + throw new Error('failed to get balance of account ' + publicKey.toBase58() + ': ' + e); + }); + } + + /** + * Fetch the estimated production time of a block + */ + async getBlockTime(slot) { + const unsafeRes = await this._rpcRequest('getBlockTime', [slot]); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get block time for slot ${slot}`); + } + return res.result; + } + + /** + * Fetch the lowest slot that the node has information about in its ledger. + * This value may increase over time if the node is configured to purge older ledger data + */ + async getMinimumLedgerSlot() { + const unsafeRes = await this._rpcRequest('minimumLedgerSlot', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get minimum ledger slot'); + } + return res.result; + } + + /** + * Fetch the slot of the lowest confirmed block that has not been purged from the ledger + */ + async getFirstAvailableBlock() { + const unsafeRes = await this._rpcRequest('getFirstAvailableBlock', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, SlotRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get first available block'); + } + return res.result; + } + + /** + * Fetch information about the current supply + */ + async getSupply(config) { + let configArg = {}; + if (typeof config === 'string') { + configArg = { + commitment: config + }; + } else if (config) { + configArg = { + ...config, + commitment: config && config.commitment || this.commitment + }; + } else { + configArg = { + commitment: this.commitment + }; + } + const unsafeRes = await this._rpcRequest('getSupply', [configArg]); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetSupplyRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get supply'); + } + return res.result; + } + + /** + * Fetch the current supply of a token mint + */ + async getTokenSupply(tokenMintAddress, commitment) { + const args = this._buildArgs([tokenMintAddress.toBase58()], commitment); + const unsafeRes = await this._rpcRequest('getTokenSupply', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext(TokenAmountResult)); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get token supply'); + } + return res.result; + } + + /** + * Fetch the current balance of a token account + */ + async getTokenAccountBalance(tokenAddress, commitment) { + const args = this._buildArgs([tokenAddress.toBase58()], commitment); + const unsafeRes = await this._rpcRequest('getTokenAccountBalance', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext(TokenAmountResult)); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get token account balance'); + } + return res.result; + } + + /** + * Fetch all the token accounts owned by the specified account + * + * @return {Promise} + */ + async getTokenAccountsByOwner(ownerAddress, filter, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + let _args = [ownerAddress.toBase58()]; + if ('mint' in filter) { + _args.push({ + mint: filter.mint.toBase58() + }); + } else { + _args.push({ + programId: filter.programId.toBase58() + }); + } + const args = this._buildArgs(_args, commitment, 'base64', config); + const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetTokenAccountsByOwner); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`); + } + return res.result; + } + + /** + * Fetch parsed token accounts owned by the specified account + * + * @return {Promise}>>>} + */ + async getParsedTokenAccountsByOwner(ownerAddress, filter, commitment) { + let _args = [ownerAddress.toBase58()]; + if ('mint' in filter) { + _args.push({ + mint: filter.mint.toBase58() + }); + } else { + _args.push({ + programId: filter.programId.toBase58() + }); + } + const args = this._buildArgs(_args, commitment, 'jsonParsed'); + const unsafeRes = await this._rpcRequest('getTokenAccountsByOwner', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedTokenAccountsByOwner); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get token accounts owned by account ${ownerAddress.toBase58()}`); + } + return res.result; + } + + /** + * Fetch the 20 largest accounts with their current balances + */ + async getLargestAccounts(config) { + const arg = { + ...config, + commitment: config && config.commitment || this.commitment + }; + const args = arg.filter || arg.commitment ? [arg] : []; + const unsafeRes = await this._rpcRequest('getLargestAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetLargestAccountsRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get largest accounts'); + } + return res.result; + } + + /** + * Fetch the 20 largest token accounts with their current balances + * for a given mint. + */ + async getTokenLargestAccounts(mintAddress, commitment) { + const args = this._buildArgs([mintAddress.toBase58()], commitment); + const unsafeRes = await this._rpcRequest('getTokenLargestAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetTokenLargestAccountsResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get token largest accounts'); + } + return res.result; + } + + /** + * Fetch all the account info for the specified public key, return with context + */ + async getAccountInfoAndContext(publicKey, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([publicKey.toBase58()], commitment, 'base64', config); + const unsafeRes = await this._rpcRequest('getAccountInfo', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(AccountInfoResult))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`); + } + return res.result; + } + + /** + * Fetch parsed account info for the specified public key + */ + async getParsedAccountInfo(publicKey, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([publicKey.toBase58()], commitment, 'jsonParsed', config); + const unsafeRes = await this._rpcRequest('getAccountInfo', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ParsedAccountInfoResult))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get info about account ${publicKey.toBase58()}`); + } + return res.result; + } + + /** + * Fetch all the account info for the specified public key + */ + async getAccountInfo(publicKey, commitmentOrConfig) { + try { + const res = await this.getAccountInfoAndContext(publicKey, commitmentOrConfig); + return res.value; + } catch (e) { + throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e); + } + } + + /** + * Fetch all the account info for multiple accounts specified by an array of public keys, return with context + */ + async getMultipleParsedAccounts(publicKeys, rawConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(rawConfig); + const keys = publicKeys.map(key => key.toBase58()); + const args = this._buildArgs([keys], commitment, 'jsonParsed', config); + const unsafeRes = await this._rpcRequest('getMultipleAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(ParsedAccountInfoResult)))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`); + } + return res.result; + } + + /** + * Fetch all the account info for multiple accounts specified by an array of public keys, return with context + */ + async getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const keys = publicKeys.map(key => key.toBase58()); + const args = this._buildArgs([keys], commitment, 'base64', config); + const unsafeRes = await this._rpcRequest('getMultipleAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)(AccountInfoResult)))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get info for accounts ${keys}`); + } + return res.result; + } + + /** + * Fetch all the account info for multiple accounts specified by an array of public keys + */ + async getMultipleAccountsInfo(publicKeys, commitmentOrConfig) { + const res = await this.getMultipleAccountsInfoAndContext(publicKeys, commitmentOrConfig); + return res.value; + } + + /** + * Returns epoch activation information for a stake account that has been delegated + * + * @deprecated Deprecated since RPC v1.18; will be removed in a future version. + */ + async getStakeActivation(publicKey, commitmentOrConfig, epoch) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([publicKey.toBase58()], commitment, undefined /* encoding */, { + ...config, + epoch: epoch != null ? epoch : config?.epoch + }); + const unsafeRes = await this._rpcRequest('getStakeActivation', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult(StakeActivationResult)); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get Stake Activation ${publicKey.toBase58()}`); + } + return res.result; + } + + /** + * Fetch all the accounts owned by the specified program id + * + * @return {Promise}>>} + */ + + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + async getProgramAccounts(programId, configOrCommitment) { + const { + commitment, + config + } = extractCommitmentFromConfig(configOrCommitment); + const { + encoding, + ...configWithoutEncoding + } = config || {}; + const args = this._buildArgs([programId.toBase58()], commitment, encoding || 'base64', { + ...configWithoutEncoding, + ...(configWithoutEncoding.filters ? { + filters: applyDefaultMemcmpEncodingToFilters(configWithoutEncoding.filters) + } : null) + }); + const unsafeRes = await this._rpcRequest('getProgramAccounts', args); + const baseSchema = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(KeyedAccountInfoResult); + const res = configWithoutEncoding.withContext === true ? (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext(baseSchema)) : (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult(baseSchema)); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`); + } + return res.result; + } + + /** + * Fetch and parse all the accounts owned by the specified program id + * + * @return {Promise}>>} + */ + async getParsedProgramAccounts(programId, configOrCommitment) { + const { + commitment, + config + } = extractCommitmentFromConfig(configOrCommitment); + const args = this._buildArgs([programId.toBase58()], commitment, 'jsonParsed', config); + const unsafeRes = await this._rpcRequest('getProgramAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(KeyedParsedAccountInfoResult))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get accounts owned by program ${programId.toBase58()}`); + } + return res.result; + } + + /** @deprecated Instead, call `confirmTransaction` and pass in {@link TransactionConfirmationStrategy} */ + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + async confirmTransaction(strategy, commitment) { + let rawSignature; + if (typeof strategy == 'string') { + rawSignature = strategy; + } else { + const config = strategy; + if (config.abortSignal?.aborted) { + return Promise.reject(config.abortSignal.reason); + } + rawSignature = config.signature; + } + let decodedSignature; + try { + decodedSignature = bs58__WEBPACK_IMPORTED_MODULE_3___default().decode(rawSignature); + } catch (err) { + throw new Error('signature must be base58 encoded: ' + rawSignature); + } + assert(decodedSignature.length === 64, 'signature has invalid length'); + if (typeof strategy === 'string') { + return await this.confirmTransactionUsingLegacyTimeoutStrategy({ + commitment: commitment || this.commitment, + signature: rawSignature + }); + } else if ('lastValidBlockHeight' in strategy) { + return await this.confirmTransactionUsingBlockHeightExceedanceStrategy({ + commitment: commitment || this.commitment, + strategy + }); + } else { + return await this.confirmTransactionUsingDurableNonceStrategy({ + commitment: commitment || this.commitment, + strategy + }); + } + } + getCancellationPromise(signal) { + return new Promise((_, reject) => { + if (signal == null) { + return; + } + if (signal.aborted) { + reject(signal.reason); + } else { + signal.addEventListener('abort', () => { + reject(signal.reason); + }); + } + }); + } + getTransactionConfirmationPromise({ + commitment, + signature + }) { + let signatureSubscriptionId; + let disposeSignatureSubscriptionStateChangeObserver; + let done = false; + const confirmationPromise = new Promise((resolve, reject) => { + try { + signatureSubscriptionId = this.onSignature(signature, (result, context) => { + signatureSubscriptionId = undefined; + const response = { + context, + value: result + }; + resolve({ + __type: TransactionStatus.PROCESSED, + response + }); + }, commitment); + const subscriptionSetupPromise = new Promise(resolveSubscriptionSetup => { + if (signatureSubscriptionId == null) { + resolveSubscriptionSetup(); + } else { + disposeSignatureSubscriptionStateChangeObserver = this._onSubscriptionStateChange(signatureSubscriptionId, nextState => { + if (nextState === 'subscribed') { + resolveSubscriptionSetup(); + } + }); + } + }); + (async () => { + await subscriptionSetupPromise; + if (done) return; + const response = await this.getSignatureStatus(signature); + if (done) return; + if (response == null) { + return; + } + const { + context, + value + } = response; + if (value == null) { + return; + } + if (value?.err) { + reject(value.err); + } else { + switch (commitment) { + case 'confirmed': + case 'single': + case 'singleGossip': + { + if (value.confirmationStatus === 'processed') { + return; + } + break; + } + case 'finalized': + case 'max': + case 'root': + { + if (value.confirmationStatus === 'processed' || value.confirmationStatus === 'confirmed') { + return; + } + break; + } + // exhaust enums to ensure full coverage + case 'processed': + case 'recent': + } + done = true; + resolve({ + __type: TransactionStatus.PROCESSED, + response: { + context, + value + } + }); + } + })(); + } catch (err) { + reject(err); + } + }); + const abortConfirmation = () => { + if (disposeSignatureSubscriptionStateChangeObserver) { + disposeSignatureSubscriptionStateChangeObserver(); + disposeSignatureSubscriptionStateChangeObserver = undefined; + } + if (signatureSubscriptionId != null) { + this.removeSignatureListener(signatureSubscriptionId); + signatureSubscriptionId = undefined; + } + }; + return { + abortConfirmation, + confirmationPromise + }; + } + async confirmTransactionUsingBlockHeightExceedanceStrategy({ + commitment, + strategy: { + abortSignal, + lastValidBlockHeight, + signature + } + }) { + let done = false; + const expiryPromise = new Promise(resolve => { + const checkBlockHeight = async () => { + try { + const blockHeight = await this.getBlockHeight(commitment); + return blockHeight; + } catch (_e) { + return -1; + } + }; + (async () => { + let currentBlockHeight = await checkBlockHeight(); + if (done) return; + while (currentBlockHeight <= lastValidBlockHeight) { + await sleep(1000); + if (done) return; + currentBlockHeight = await checkBlockHeight(); + if (done) return; + } + resolve({ + __type: TransactionStatus.BLOCKHEIGHT_EXCEEDED + }); + })(); + }); + const { + abortConfirmation, + confirmationPromise + } = this.getTransactionConfirmationPromise({ + commitment, + signature + }); + const cancellationPromise = this.getCancellationPromise(abortSignal); + let result; + try { + const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]); + if (outcome.__type === TransactionStatus.PROCESSED) { + result = outcome.response; + } else { + throw new TransactionExpiredBlockheightExceededError(signature); + } + } finally { + done = true; + abortConfirmation(); + } + return result; + } + async confirmTransactionUsingDurableNonceStrategy({ + commitment, + strategy: { + abortSignal, + minContextSlot, + nonceAccountPubkey, + nonceValue, + signature + } + }) { + let done = false; + const expiryPromise = new Promise(resolve => { + let currentNonceValue = nonceValue; + let lastCheckedSlot = null; + const getCurrentNonceValue = async () => { + try { + const { + context, + value: nonceAccount + } = await this.getNonceAndContext(nonceAccountPubkey, { + commitment, + minContextSlot + }); + lastCheckedSlot = context.slot; + return nonceAccount?.nonce; + } catch (e) { + // If for whatever reason we can't reach/read the nonce + // account, just keep using the last-known value. + return currentNonceValue; + } + }; + (async () => { + currentNonceValue = await getCurrentNonceValue(); + if (done) return; + while (true // eslint-disable-line no-constant-condition + ) { + if (nonceValue !== currentNonceValue) { + resolve({ + __type: TransactionStatus.NONCE_INVALID, + slotInWhichNonceDidAdvance: lastCheckedSlot + }); + return; + } + await sleep(2000); + if (done) return; + currentNonceValue = await getCurrentNonceValue(); + if (done) return; + } + })(); + }); + const { + abortConfirmation, + confirmationPromise + } = this.getTransactionConfirmationPromise({ + commitment, + signature + }); + const cancellationPromise = this.getCancellationPromise(abortSignal); + let result; + try { + const outcome = await Promise.race([cancellationPromise, confirmationPromise, expiryPromise]); + if (outcome.__type === TransactionStatus.PROCESSED) { + result = outcome.response; + } else { + // Double check that the transaction is indeed unconfirmed. + let signatureStatus; + while (true // eslint-disable-line no-constant-condition + ) { + const status = await this.getSignatureStatus(signature); + if (status == null) { + break; + } + if (status.context.slot < (outcome.slotInWhichNonceDidAdvance ?? minContextSlot)) { + await sleep(400); + continue; + } + signatureStatus = status; + break; + } + if (signatureStatus?.value) { + const commitmentForStatus = commitment || 'finalized'; + const { + confirmationStatus + } = signatureStatus.value; + switch (commitmentForStatus) { + case 'processed': + case 'recent': + if (confirmationStatus !== 'processed' && confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') { + throw new TransactionExpiredNonceInvalidError(signature); + } + break; + case 'confirmed': + case 'single': + case 'singleGossip': + if (confirmationStatus !== 'confirmed' && confirmationStatus !== 'finalized') { + throw new TransactionExpiredNonceInvalidError(signature); + } + break; + case 'finalized': + case 'max': + case 'root': + if (confirmationStatus !== 'finalized') { + throw new TransactionExpiredNonceInvalidError(signature); + } + break; + default: + // Exhaustive switch. + // eslint-disable-next-line @typescript-eslint/no-unused-vars + (_ => {})(commitmentForStatus); + } + result = { + context: signatureStatus.context, + value: { + err: signatureStatus.value.err + } + }; + } else { + throw new TransactionExpiredNonceInvalidError(signature); + } + } + } finally { + done = true; + abortConfirmation(); + } + return result; + } + async confirmTransactionUsingLegacyTimeoutStrategy({ + commitment, + signature + }) { + let timeoutId; + const expiryPromise = new Promise(resolve => { + let timeoutMs = this._confirmTransactionInitialTimeout || 60 * 1000; + switch (commitment) { + case 'processed': + case 'recent': + case 'single': + case 'confirmed': + case 'singleGossip': + { + timeoutMs = this._confirmTransactionInitialTimeout || 30 * 1000; + break; + } + } + timeoutId = setTimeout(() => resolve({ + __type: TransactionStatus.TIMED_OUT, + timeoutMs + }), timeoutMs); + }); + const { + abortConfirmation, + confirmationPromise + } = this.getTransactionConfirmationPromise({ + commitment, + signature + }); + let result; + try { + const outcome = await Promise.race([confirmationPromise, expiryPromise]); + if (outcome.__type === TransactionStatus.PROCESSED) { + result = outcome.response; + } else { + throw new TransactionExpiredTimeoutError(signature, outcome.timeoutMs / 1000); + } + } finally { + clearTimeout(timeoutId); + abortConfirmation(); + } + return result; + } + + /** + * Return the list of nodes that are currently participating in the cluster + */ + async getClusterNodes() { + const unsafeRes = await this._rpcRequest('getClusterNodes', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(ContactInfoResult))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get cluster nodes'); + } + return res.result; + } + + /** + * Return the list of nodes that are currently participating in the cluster + */ + async getVoteAccounts(commitment) { + const args = this._buildArgs([], commitment); + const unsafeRes = await this._rpcRequest('getVoteAccounts', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetVoteAccounts); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get vote accounts'); + } + return res.result; + } + + /** + * Fetch the current slot that the node is processing + */ + async getSlot(commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getSlot', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get slot'); + } + return res.result; + } + + /** + * Fetch the current slot leader of the cluster + */ + async getSlotLeader(commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getSlotLeader', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get slot leader'); + } + return res.result; + } + + /** + * Fetch `limit` number of slot leaders starting from `startSlot` + * + * @param startSlot fetch slot leaders starting from this slot + * @param limit number of slot leaders to return + */ + async getSlotLeaders(startSlot, limit) { + const args = [startSlot, limit]; + const unsafeRes = await this._rpcRequest('getSlotLeaders', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)(PublicKeyFromString))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get slot leaders'); + } + return res.result; + } + + /** + * Fetch the current status of a signature + */ + async getSignatureStatus(signature, config) { + const { + context, + value: values + } = await this.getSignatureStatuses([signature], config); + assert(values.length === 1); + const value = values[0]; + return { + context, + value + }; + } + + /** + * Fetch the current statuses of a batch of signatures + */ + async getSignatureStatuses(signatures, config) { + const params = [signatures]; + if (config) { + params.push(config); + } + const unsafeRes = await this._rpcRequest('getSignatureStatuses', params); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetSignatureStatusesRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get signature status'); + } + return res.result; + } + + /** + * Fetch the current transaction count of the cluster + */ + async getTransactionCount(commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getTransactionCount', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transaction count'); + } + return res.result; + } + + /** + * Fetch the current total currency supply of the cluster in lamports + * + * @deprecated Deprecated since RPC v1.2.8. Please use {@link getSupply} instead. + */ + async getTotalSupply(commitment) { + const result = await this.getSupply({ + commitment, + excludeNonCirculatingAccountsList: true + }); + return result.value.total; + } + + /** + * Fetch the cluster InflationGovernor parameters + */ + async getInflationGovernor(commitment) { + const args = this._buildArgs([], commitment); + const unsafeRes = await this._rpcRequest('getInflationGovernor', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetInflationGovernorRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get inflation'); + } + return res.result; + } + + /** + * Fetch the inflation reward for a list of addresses for an epoch + */ + async getInflationReward(addresses, epoch, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([addresses.map(pubkey => pubkey.toBase58())], commitment, undefined /* encoding */, { + ...config, + epoch: epoch != null ? epoch : config?.epoch + }); + const unsafeRes = await this._rpcRequest('getInflationReward', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetInflationRewardResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get inflation reward'); + } + return res.result; + } + + /** + * Fetch the specific inflation values for the current epoch + */ + async getInflationRate() { + const unsafeRes = await this._rpcRequest('getInflationRate', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetInflationRateRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get inflation rate'); + } + return res.result; + } + + /** + * Fetch the Epoch Info parameters + */ + async getEpochInfo(commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getEpochInfo', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetEpochInfoRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get epoch info'); + } + return res.result; + } + + /** + * Fetch the Epoch Schedule parameters + */ + async getEpochSchedule() { + const unsafeRes = await this._rpcRequest('getEpochSchedule', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetEpochScheduleRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get epoch schedule'); + } + const epochSchedule = res.result; + return new EpochSchedule(epochSchedule.slotsPerEpoch, epochSchedule.leaderScheduleSlotOffset, epochSchedule.warmup, epochSchedule.firstNormalEpoch, epochSchedule.firstNormalSlot); + } + + /** + * Fetch the leader schedule for the current epoch + * @return {Promise>} + */ + async getLeaderSchedule() { + const unsafeRes = await this._rpcRequest('getLeaderSchedule', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetLeaderScheduleRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get leader schedule'); + } + return res.result; + } + + /** + * Fetch the minimum balance needed to exempt an account of `dataLength` + * size from rent + */ + async getMinimumBalanceForRentExemption(dataLength, commitment) { + const args = this._buildArgs([dataLength], commitment); + const unsafeRes = await this._rpcRequest('getMinimumBalanceForRentExemption', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetMinimumBalanceForRentExemptionRpcResult); + if ('error' in res) { + console.warn('Unable to fetch minimum balance for rent exemption'); + return 0; + } + return res.result; + } + + /** + * Fetch a recent blockhash from the cluster, return with context + * @return {Promise>} + * + * @deprecated Deprecated since RPC v1.9.0. Please use {@link getLatestBlockhash} instead. + */ + async getRecentBlockhashAndContext(commitment) { + const { + context, + value: { + blockhash + } + } = await this.getLatestBlockhashAndContext(commitment); + const feeCalculator = { + get lamportsPerSignature() { + throw new Error('The capability to fetch `lamportsPerSignature` using the `getRecentBlockhash` API is ' + 'no longer offered by the network. Use the `getFeeForMessage` API to obtain the fee ' + 'for a given message.'); + }, + toJSON() { + return {}; + } + }; + return { + context, + value: { + blockhash, + feeCalculator + } + }; + } + + /** + * Fetch recent performance samples + * @return {Promise>} + */ + async getRecentPerformanceSamples(limit) { + const unsafeRes = await this._rpcRequest('getRecentPerformanceSamples', limit ? [limit] : []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetRecentPerformanceSamplesRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get recent performance samples'); + } + return res.result; + } + + /** + * Fetch the fee calculator for a recent blockhash from the cluster, return with context + * + * @deprecated Deprecated since RPC v1.9.0. Please use {@link getFeeForMessage} instead. + */ + async getFeeCalculatorForBlockhash(blockhash, commitment) { + const args = this._buildArgs([blockhash], commitment); + const unsafeRes = await this._rpcRequest('getFeeCalculatorForBlockhash', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetFeeCalculatorRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get fee calculator'); + } + const { + context, + value + } = res.result; + return { + context, + value: value !== null ? value.feeCalculator : null + }; + } + + /** + * Fetch the fee for a message from the cluster, return with context + */ + async getFeeForMessage(message, commitment) { + const wireMessage = toBuffer(message.serialize()).toString('base64'); + const args = this._buildArgs([wireMessage], commitment); + const unsafeRes = await this._rpcRequest('getFeeForMessage', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.nullable)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get fee for message'); + } + if (res.result === null) { + throw new Error('invalid blockhash'); + } + return res.result; + } + + /** + * Fetch a list of prioritization fees from recent blocks. + */ + async getRecentPrioritizationFees(config) { + const accounts = config?.lockedWritableAccounts?.map(key => key.toBase58()); + const args = accounts?.length ? [accounts] : []; + const unsafeRes = await this._rpcRequest('getRecentPrioritizationFees', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetRecentPrioritizationFeesRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get recent prioritization fees'); + } + return res.result; + } + /** + * Fetch a recent blockhash from the cluster + * @return {Promise<{blockhash: Blockhash, feeCalculator: FeeCalculator}>} + * + * @deprecated Deprecated since RPC v1.8.0. Please use {@link getLatestBlockhash} instead. + */ + async getRecentBlockhash(commitment) { + try { + const res = await this.getRecentBlockhashAndContext(commitment); + return res.value; + } catch (e) { + throw new Error('failed to get recent blockhash: ' + e); + } + } + + /** + * Fetch the latest blockhash from the cluster + * @return {Promise} + */ + async getLatestBlockhash(commitmentOrConfig) { + try { + const res = await this.getLatestBlockhashAndContext(commitmentOrConfig); + return res.value; + } catch (e) { + throw new Error('failed to get recent blockhash: ' + e); + } + } + + /** + * Fetch the latest blockhash from the cluster + * @return {Promise} + */ + async getLatestBlockhashAndContext(commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getLatestBlockhash', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetLatestBlockhashRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get latest blockhash'); + } + return res.result; + } + + /** + * Returns whether a blockhash is still valid or not + */ + async isBlockhashValid(blockhash, rawConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(rawConfig); + const args = this._buildArgs([blockhash], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('isBlockhashValid', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, IsBlockhashValidRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to determine if the blockhash `' + blockhash + '`is valid'); + } + return res.result; + } + + /** + * Fetch the node version + */ + async getVersion() { + const unsafeRes = await this._rpcRequest('getVersion', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult(VersionResult)); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get version'); + } + return res.result; + } + + /** + * Fetch the genesis hash + */ + async getGenesisHash() { + const unsafeRes = await this._rpcRequest('getGenesisHash', []); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get genesis hash'); + } + return res.result; + } + + /** + * Fetch a processed block from the cluster. + * + * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by + * setting the `maxSupportedTransactionVersion` property. + */ + + /** + * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by + * setting the `maxSupportedTransactionVersion` property. + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * @deprecated Instead, call `getBlock` using a `GetVersionedBlockConfig` by + * setting the `maxSupportedTransactionVersion` property. + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * Fetch a processed block from the cluster. + */ + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + + /** + * Fetch a processed block from the cluster. + */ + // eslint-disable-next-line no-dupe-class-members + async getBlock(slot, rawConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(rawConfig); + const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getBlock', args); + try { + switch (config?.transactionDetails) { + case 'accounts': + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetAccountsModeBlockRpcResult); + if ('error' in res) { + throw res.error; + } + return res.result; + } + case 'none': + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetNoneModeBlockRpcResult); + if ('error' in res) { + throw res.error; + } + return res.result; + } + default: + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetBlockRpcResult); + if ('error' in res) { + throw res.error; + } + const { + result + } = res; + return result ? { + ...result, + transactions: result.transactions.map(({ + transaction, + meta, + version + }) => ({ + meta, + transaction: { + ...transaction, + message: versionedMessageFromResponse(version, transaction.message) + }, + version + })) + } : null; + } + } + } catch (e) { + throw new SolanaJSONRPCError(e, 'failed to get confirmed block'); + } + } + + /** + * Fetch parsed transaction details for a confirmed or finalized block + */ + + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + async getParsedBlock(slot, rawConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(rawConfig); + const args = this._buildArgsAtLeastConfirmed([slot], commitment, 'jsonParsed', config); + const unsafeRes = await this._rpcRequest('getBlock', args); + try { + switch (config?.transactionDetails) { + case 'accounts': + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedAccountsModeBlockRpcResult); + if ('error' in res) { + throw res.error; + } + return res.result; + } + case 'none': + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedNoneModeBlockRpcResult); + if ('error' in res) { + throw res.error; + } + return res.result; + } + default: + { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedBlockRpcResult); + if ('error' in res) { + throw res.error; + } + return res.result; + } + } + } catch (e) { + throw new SolanaJSONRPCError(e, 'failed to get block'); + } + } + /* + * Returns recent block production information from the current or previous epoch + */ + async getBlockProduction(configOrCommitment) { + let extra; + let commitment; + if (typeof configOrCommitment === 'string') { + commitment = configOrCommitment; + } else if (configOrCommitment) { + const { + commitment: c, + ...rest + } = configOrCommitment; + commitment = c; + extra = rest; + } + const args = this._buildArgs([], commitment, 'base64', extra); + const unsafeRes = await this._rpcRequest('getBlockProduction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, BlockProductionResponseStruct); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get block production information'); + } + return res.result; + } + + /** + * Fetch a confirmed or finalized transaction from the cluster. + * + * @deprecated Instead, call `getTransaction` using a + * `GetVersionedTransactionConfig` by setting the + * `maxSupportedTransactionVersion` property. + */ + + /** + * Fetch a confirmed or finalized transaction from the cluster. + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * Fetch a confirmed or finalized transaction from the cluster. + */ + // eslint-disable-next-line no-dupe-class-members + async getTransaction(signature, rawConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(rawConfig); + const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config); + const unsafeRes = await this._rpcRequest('getTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transaction'); + } + const result = res.result; + if (!result) return result; + return { + ...result, + transaction: { + ...result.transaction, + message: versionedMessageFromResponse(result.version, result.transaction.message) + } + }; + } + + /** + * Fetch parsed transaction details for a confirmed or finalized transaction + */ + async getParsedTransaction(signature, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config); + const unsafeRes = await this._rpcRequest('getTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transaction'); + } + return res.result; + } + + /** + * Fetch parsed transaction details for a batch of confirmed transactions + */ + async getParsedTransactions(signatures, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const batch = signatures.map(signature => { + const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed', config); + return { + methodName: 'getTransaction', + args + }; + }); + const unsafeRes = await this._rpcBatchRequest(batch); + const res = unsafeRes.map(unsafeRes => { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transactions'); + } + return res.result; + }); + return res; + } + + /** + * Fetch transaction details for a batch of confirmed transactions. + * Similar to {@link getParsedTransactions} but returns a {@link TransactionResponse}. + * + * @deprecated Instead, call `getTransactions` using a + * `GetVersionedTransactionConfig` by setting the + * `maxSupportedTransactionVersion` property. + */ + + /** + * Fetch transaction details for a batch of confirmed transactions. + * Similar to {@link getParsedTransactions} but returns a {@link + * VersionedTransactionResponse}. + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * Fetch transaction details for a batch of confirmed transactions. + * Similar to {@link getParsedTransactions} but returns a {@link + * VersionedTransactionResponse}. + */ + // eslint-disable-next-line no-dupe-class-members + async getTransactions(signatures, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const batch = signatures.map(signature => { + const args = this._buildArgsAtLeastConfirmed([signature], commitment, undefined /* encoding */, config); + return { + methodName: 'getTransaction', + args + }; + }); + const unsafeRes = await this._rpcBatchRequest(batch); + const res = unsafeRes.map(unsafeRes => { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transactions'); + } + const result = res.result; + if (!result) return result; + return { + ...result, + transaction: { + ...result.transaction, + message: versionedMessageFromResponse(result.version, result.transaction.message) + } + }; + }); + return res; + } + + /** + * Fetch a list of Transactions and transaction statuses from the cluster + * for a confirmed block. + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlock} instead. + */ + async getConfirmedBlock(slot, commitment) { + const args = this._buildArgsAtLeastConfirmed([slot], commitment); + const unsafeRes = await this._rpcRequest('getBlock', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetConfirmedBlockRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block'); + } + const result = res.result; + if (!result) { + throw new Error('Confirmed block ' + slot + ' not found'); + } + const block = { + ...result, + transactions: result.transactions.map(({ + transaction, + meta + }) => { + const message = new Message(transaction.message); + return { + meta, + transaction: { + ...transaction, + message + } + }; + }) + }; + return { + ...block, + transactions: block.transactions.map(({ + transaction, + meta + }) => { + return { + meta, + transaction: Transaction.populate(transaction.message, transaction.signatures) + }; + }) + }; + } + + /** + * Fetch confirmed blocks between two slots + */ + async getBlocks(startSlot, endSlot, commitment) { + const args = this._buildArgsAtLeastConfirmed(endSlot !== undefined ? [startSlot, endSlot] : [startSlot], commitment); + const unsafeRes = await this._rpcRequest('getBlocks', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResult((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.array)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)()))); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get blocks'); + } + return res.result; + } + + /** + * Fetch a list of Signatures from the cluster for a block, excluding rewards + */ + async getBlockSignatures(slot, commitment) { + const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, { + transactionDetails: 'signatures', + rewards: false + }); + const unsafeRes = await this._rpcRequest('getBlock', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetBlockSignaturesRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get block'); + } + const result = res.result; + if (!result) { + throw new Error('Block ' + slot + ' not found'); + } + return result; + } + + /** + * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getBlockSignatures} instead. + */ + async getConfirmedBlockSignatures(slot, commitment) { + const args = this._buildArgsAtLeastConfirmed([slot], commitment, undefined, { + transactionDetails: 'signatures', + rewards: false + }); + const unsafeRes = await this._rpcRequest('getBlock', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetBlockSignaturesRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get confirmed block'); + } + const result = res.result; + if (!result) { + throw new Error('Confirmed block ' + slot + ' not found'); + } + return result; + } + + /** + * Fetch a transaction details for a confirmed transaction + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getTransaction} instead. + */ + async getConfirmedTransaction(signature, commitment) { + const args = this._buildArgsAtLeastConfirmed([signature], commitment); + const unsafeRes = await this._rpcRequest('getTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get transaction'); + } + const result = res.result; + if (!result) return result; + const message = new Message(result.transaction.message); + const signatures = result.transaction.signatures; + return { + ...result, + transaction: Transaction.populate(message, signatures) + }; + } + + /** + * Fetch parsed transaction details for a confirmed transaction + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransaction} instead. + */ + async getParsedConfirmedTransaction(signature, commitment) { + const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed'); + const unsafeRes = await this._rpcRequest('getTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transaction'); + } + return res.result; + } + + /** + * Fetch parsed transaction details for a batch of confirmed transactions + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getParsedTransactions} instead. + */ + async getParsedConfirmedTransactions(signatures, commitment) { + const batch = signatures.map(signature => { + const args = this._buildArgsAtLeastConfirmed([signature], commitment, 'jsonParsed'); + return { + methodName: 'getTransaction', + args + }; + }); + const unsafeRes = await this._rpcBatchRequest(batch); + const res = unsafeRes.map(unsafeRes => { + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetParsedTransactionRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get confirmed transactions'); + } + return res.result; + }); + return res; + } + + /** + * Fetch a list of all the confirmed signatures for transactions involving an address + * within a specified slot range. Max range allowed is 10,000 slots. + * + * @deprecated Deprecated since RPC v1.3. Please use {@link getConfirmedSignaturesForAddress2} instead. + * + * @param address queried address + * @param startSlot start slot, inclusive + * @param endSlot end slot, inclusive + */ + async getConfirmedSignaturesForAddress(address, startSlot, endSlot) { + let options = {}; + let firstAvailableBlock = await this.getFirstAvailableBlock(); + while (!('until' in options)) { + startSlot--; + if (startSlot <= 0 || startSlot < firstAvailableBlock) { + break; + } + try { + const block = await this.getConfirmedBlockSignatures(startSlot, 'finalized'); + if (block.signatures.length > 0) { + options.until = block.signatures[block.signatures.length - 1].toString(); + } + } catch (err) { + if (err instanceof Error && err.message.includes('skipped')) { + continue; + } else { + throw err; + } + } + } + let highestConfirmedRoot = await this.getSlot('finalized'); + while (!('before' in options)) { + endSlot++; + if (endSlot > highestConfirmedRoot) { + break; + } + try { + const block = await this.getConfirmedBlockSignatures(endSlot); + if (block.signatures.length > 0) { + options.before = block.signatures[block.signatures.length - 1].toString(); + } + } catch (err) { + if (err instanceof Error && err.message.includes('skipped')) { + continue; + } else { + throw err; + } + } + } + const confirmedSignatureInfo = await this.getConfirmedSignaturesForAddress2(address, options); + return confirmedSignatureInfo.map(info => info.signature); + } + + /** + * Returns confirmed signatures for transactions involving an + * address backwards in time from the provided signature or most recent confirmed block + * + * @deprecated Deprecated since RPC v1.7.0. Please use {@link getSignaturesForAddress} instead. + */ + async getConfirmedSignaturesForAddress2(address, options, commitment) { + const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options); + const unsafeRes = await this._rpcRequest('getConfirmedSignaturesForAddress2', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetConfirmedSignaturesForAddress2RpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get confirmed signatures for address'); + } + return res.result; + } + + /** + * Returns confirmed signatures for transactions involving an + * address backwards in time from the provided signature or most recent confirmed block + * + * + * @param address queried address + * @param options + */ + async getSignaturesForAddress(address, options, commitment) { + const args = this._buildArgsAtLeastConfirmed([address.toBase58()], commitment, undefined, options); + const unsafeRes = await this._rpcRequest('getSignaturesForAddress', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, GetSignaturesForAddressRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, 'failed to get signatures for address'); + } + return res.result; + } + async getAddressLookupTable(accountKey, config) { + const { + context, + value: accountInfo + } = await this.getAccountInfoAndContext(accountKey, config); + let value = null; + if (accountInfo !== null) { + value = new AddressLookupTableAccount({ + key: accountKey, + state: AddressLookupTableAccount.deserialize(accountInfo.data) + }); + } + return { + context, + value + }; + } + + /** + * Fetch the contents of a Nonce account from the cluster, return with context + */ + async getNonceAndContext(nonceAccount, commitmentOrConfig) { + const { + context, + value: accountInfo + } = await this.getAccountInfoAndContext(nonceAccount, commitmentOrConfig); + let value = null; + if (accountInfo !== null) { + value = NonceAccount.fromAccountData(accountInfo.data); + } + return { + context, + value + }; + } + + /** + * Fetch the contents of a Nonce account from the cluster + */ + async getNonce(nonceAccount, commitmentOrConfig) { + return await this.getNonceAndContext(nonceAccount, commitmentOrConfig).then(x => x.value).catch(e => { + throw new Error('failed to get nonce for account ' + nonceAccount.toBase58() + ': ' + e); + }); + } + + /** + * Request an allocation of lamports to the specified address + * + * ```typescript + * import { Connection, PublicKey, LAMPORTS_PER_SOL } from "@solana/web3.js"; + * + * (async () => { + * const connection = new Connection("https://api.testnet.solana.com", "confirmed"); + * const myAddress = new PublicKey("2nr1bHFT86W9tGnyvmYW4vcHKsQB3sVQfnddasz4kExM"); + * const signature = await connection.requestAirdrop(myAddress, LAMPORTS_PER_SOL); + * await connection.confirmTransaction(signature); + * })(); + * ``` + */ + async requestAirdrop(to, lamports) { + const unsafeRes = await this._rpcRequest('requestAirdrop', [to.toBase58(), lamports]); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, RequestAirdropRpcResult); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `airdrop to ${to.toBase58()} failed`); + } + return res.result; + } + + /** + * @internal + */ + async _blockhashWithExpiryBlockHeight(disableCache) { + if (!disableCache) { + // Wait for polling to finish + while (this._pollingBlockhash) { + await sleep(100); + } + const timeSinceFetch = Date.now() - this._blockhashInfo.lastFetch; + const expired = timeSinceFetch >= BLOCKHASH_CACHE_TIMEOUT_MS; + if (this._blockhashInfo.latestBlockhash !== null && !expired) { + return this._blockhashInfo.latestBlockhash; + } + } + return await this._pollNewBlockhash(); + } + + /** + * @internal + */ + async _pollNewBlockhash() { + this._pollingBlockhash = true; + try { + const startTime = Date.now(); + const cachedLatestBlockhash = this._blockhashInfo.latestBlockhash; + const cachedBlockhash = cachedLatestBlockhash ? cachedLatestBlockhash.blockhash : null; + for (let i = 0; i < 50; i++) { + const latestBlockhash = await this.getLatestBlockhash('finalized'); + if (cachedBlockhash !== latestBlockhash.blockhash) { + this._blockhashInfo = { + latestBlockhash, + lastFetch: Date.now(), + transactionSignatures: [], + simulatedSignatures: [] + }; + return latestBlockhash; + } + + // Sleep for approximately half a slot + await sleep(MS_PER_SLOT / 2); + } + throw new Error(`Unable to obtain a new blockhash after ${Date.now() - startTime}ms`); + } finally { + this._pollingBlockhash = false; + } + } + + /** + * get the stake minimum delegation + */ + async getStakeMinimumDelegation(config) { + const { + commitment, + config: configArg + } = extractCommitmentFromConfig(config); + const args = this._buildArgs([], commitment, 'base64', configArg); + const unsafeRes = await this._rpcRequest('getStakeMinimumDelegation', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, jsonRpcResultAndContext((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.number)())); + if ('error' in res) { + throw new SolanaJSONRPCError(res.error, `failed to get stake minimum delegation`); + } + return res.result; + } + + /** + * Simulate a transaction + * + * @deprecated Instead, call {@link simulateTransaction} with {@link + * VersionedTransaction} and {@link SimulateTransactionConfig} parameters + */ + + /** + * Simulate a transaction + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * Simulate a transaction + */ + // eslint-disable-next-line no-dupe-class-members + async simulateTransaction(transactionOrMessage, configOrSigners, includeAccounts) { + if ('message' in transactionOrMessage) { + const versionedTx = transactionOrMessage; + const wireTransaction = versionedTx.serialize(); + const encodedTransaction = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(wireTransaction).toString('base64'); + if (Array.isArray(configOrSigners) || includeAccounts !== undefined) { + throw new Error('Invalid arguments'); + } + const config = configOrSigners || {}; + config.encoding = 'base64'; + if (!('commitment' in config)) { + config.commitment = this.commitment; + } + if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) { + config.innerInstructions = configOrSigners.innerInstructions; + } + const args = [encodedTransaction, config]; + const unsafeRes = await this._rpcRequest('simulateTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, SimulatedTransactionResponseStruct); + if ('error' in res) { + throw new Error('failed to simulate transaction: ' + res.error.message); + } + return res.result; + } + let transaction; + if (transactionOrMessage instanceof Transaction) { + let originalTx = transactionOrMessage; + transaction = new Transaction(); + transaction.feePayer = originalTx.feePayer; + transaction.instructions = transactionOrMessage.instructions; + transaction.nonceInfo = originalTx.nonceInfo; + transaction.signatures = originalTx.signatures; + } else { + transaction = Transaction.populate(transactionOrMessage); + // HACK: this function relies on mutating the populated transaction + transaction._message = transaction._json = undefined; + } + if (configOrSigners !== undefined && !Array.isArray(configOrSigners)) { + throw new Error('Invalid arguments'); + } + const signers = configOrSigners; + if (transaction.nonceInfo && signers) { + transaction.sign(...signers); + } else { + let disableCache = this._disableBlockhashCaching; + for (;;) { + const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache); + transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight; + transaction.recentBlockhash = latestBlockhash.blockhash; + if (!signers) break; + transaction.sign(...signers); + if (!transaction.signature) { + throw new Error('!signature'); // should never happen + } + const signature = transaction.signature.toString('base64'); + if (!this._blockhashInfo.simulatedSignatures.includes(signature) && !this._blockhashInfo.transactionSignatures.includes(signature)) { + // The signature of this transaction has not been seen before with the + // current recentBlockhash, all done. Let's break + this._blockhashInfo.simulatedSignatures.push(signature); + break; + } else { + // This transaction would be treated as duplicate (its derived signature + // matched to one of already recorded signatures). + // So, we must fetch a new blockhash for a different signature by disabling + // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS). + disableCache = true; + } + } + } + const message = transaction._compile(); + const signData = message.serialize(); + const wireTransaction = transaction._serialize(signData); + const encodedTransaction = wireTransaction.toString('base64'); + const config = { + encoding: 'base64', + commitment: this.commitment + }; + if (includeAccounts) { + const addresses = (Array.isArray(includeAccounts) ? includeAccounts : message.nonProgramIds()).map(key => key.toBase58()); + config['accounts'] = { + encoding: 'base64', + addresses + }; + } + if (signers) { + config.sigVerify = true; + } + if (configOrSigners && typeof configOrSigners === 'object' && 'innerInstructions' in configOrSigners) { + config.innerInstructions = configOrSigners.innerInstructions; + } + const args = [encodedTransaction, config]; + const unsafeRes = await this._rpcRequest('simulateTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, SimulatedTransactionResponseStruct); + if ('error' in res) { + let logs; + if ('data' in res.error) { + logs = res.error.data.logs; + if (logs && Array.isArray(logs)) { + const traceIndent = '\n '; + const logTrace = traceIndent + logs.join(traceIndent); + console.error(res.error.message, logTrace); + } + } + throw new SendTransactionError({ + action: 'simulate', + signature: '', + transactionMessage: res.error.message, + logs: logs + }); + } + return res.result; + } + + /** + * Sign and send a transaction + * + * @deprecated Instead, call {@link sendTransaction} with a {@link + * VersionedTransaction} + */ + + /** + * Send a signed transaction + */ + // eslint-disable-next-line no-dupe-class-members + + /** + * Sign and send a transaction + */ + // eslint-disable-next-line no-dupe-class-members + async sendTransaction(transaction, signersOrOptions, options) { + if ('version' in transaction) { + if (signersOrOptions && Array.isArray(signersOrOptions)) { + throw new Error('Invalid arguments'); + } + const wireTransaction = transaction.serialize(); + return await this.sendRawTransaction(wireTransaction, signersOrOptions); + } + if (signersOrOptions === undefined || !Array.isArray(signersOrOptions)) { + throw new Error('Invalid arguments'); + } + const signers = signersOrOptions; + if (transaction.nonceInfo) { + transaction.sign(...signers); + } else { + let disableCache = this._disableBlockhashCaching; + for (;;) { + const latestBlockhash = await this._blockhashWithExpiryBlockHeight(disableCache); + transaction.lastValidBlockHeight = latestBlockhash.lastValidBlockHeight; + transaction.recentBlockhash = latestBlockhash.blockhash; + transaction.sign(...signers); + if (!transaction.signature) { + throw new Error('!signature'); // should never happen + } + const signature = transaction.signature.toString('base64'); + if (!this._blockhashInfo.transactionSignatures.includes(signature)) { + // The signature of this transaction has not been seen before with the + // current recentBlockhash, all done. Let's break + this._blockhashInfo.transactionSignatures.push(signature); + break; + } else { + // This transaction would be treated as duplicate (its derived signature + // matched to one of already recorded signatures). + // So, we must fetch a new blockhash for a different signature by disabling + // our cache not to wait for the cache expiration (BLOCKHASH_CACHE_TIMEOUT_MS). + disableCache = true; + } + } + } + const wireTransaction = transaction.serialize(); + return await this.sendRawTransaction(wireTransaction, options); + } + + /** + * Send a transaction that has already been signed and serialized into the + * wire format + */ + async sendRawTransaction(rawTransaction, options) { + const encodedTransaction = toBuffer(rawTransaction).toString('base64'); + const result = await this.sendEncodedTransaction(encodedTransaction, options); + return result; + } + + /** + * Send a transaction that has already been signed, serialized into the + * wire format, and encoded as a base64 string + */ + async sendEncodedTransaction(encodedTransaction, options) { + const config = { + encoding: 'base64' + }; + const skipPreflight = options && options.skipPreflight; + const preflightCommitment = skipPreflight === true ? 'processed' // FIXME Remove when https://github.com/anza-xyz/agave/pull/483 is deployed. + : options && options.preflightCommitment || this.commitment; + if (options && options.maxRetries != null) { + config.maxRetries = options.maxRetries; + } + if (options && options.minContextSlot != null) { + config.minContextSlot = options.minContextSlot; + } + if (skipPreflight) { + config.skipPreflight = skipPreflight; + } + if (preflightCommitment) { + config.preflightCommitment = preflightCommitment; + } + const args = [encodedTransaction, config]; + const unsafeRes = await this._rpcRequest('sendTransaction', args); + const res = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(unsafeRes, SendTransactionRpcResult); + if ('error' in res) { + let logs = undefined; + if ('data' in res.error) { + logs = res.error.data.logs; + } + throw new SendTransactionError({ + action: skipPreflight ? 'send' : 'simulate', + signature: '', + transactionMessage: res.error.message, + logs: logs + }); + } + return res.result; + } + + /** + * @internal + */ + _wsOnOpen() { + this._rpcWebSocketConnected = true; + this._rpcWebSocketHeartbeat = setInterval(() => { + // Ping server every 5s to prevent idle timeouts + (async () => { + try { + await this._rpcWebSocket.notify('ping'); + // eslint-disable-next-line no-empty + } catch {} + })(); + }, 5000); + this._updateSubscriptions(); + } + + /** + * @internal + */ + _wsOnError(err) { + this._rpcWebSocketConnected = false; + console.error('ws error:', err.message); + } + + /** + * @internal + */ + _wsOnClose(code) { + this._rpcWebSocketConnected = false; + this._rpcWebSocketGeneration = (this._rpcWebSocketGeneration + 1) % Number.MAX_SAFE_INTEGER; + if (this._rpcWebSocketIdleTimeout) { + clearTimeout(this._rpcWebSocketIdleTimeout); + this._rpcWebSocketIdleTimeout = null; + } + if (this._rpcWebSocketHeartbeat) { + clearInterval(this._rpcWebSocketHeartbeat); + this._rpcWebSocketHeartbeat = null; + } + if (code === 1000) { + // explicit close, check if any subscriptions have been made since close + this._updateSubscriptions(); + return; + } + + // implicit close, prepare subscriptions for auto-reconnect + this._subscriptionCallbacksByServerSubscriptionId = {}; + Object.entries(this._subscriptionsByHash).forEach(([hash, subscription]) => { + this._setSubscription(hash, { + ...subscription, + state: 'pending' + }); + }); + } + + /** + * @internal + */ + _setSubscription(hash, nextSubscription) { + const prevState = this._subscriptionsByHash[hash]?.state; + this._subscriptionsByHash[hash] = nextSubscription; + if (prevState !== nextSubscription.state) { + const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash]; + if (stateChangeCallbacks) { + stateChangeCallbacks.forEach(cb => { + try { + cb(nextSubscription.state); + // eslint-disable-next-line no-empty + } catch {} + }); + } + } + } + + /** + * @internal + */ + _onSubscriptionStateChange(clientSubscriptionId, callback) { + const hash = this._subscriptionHashByClientSubscriptionId[clientSubscriptionId]; + if (hash == null) { + return () => {}; + } + const stateChangeCallbacks = this._subscriptionStateChangeCallbacksByHash[hash] ||= new Set(); + stateChangeCallbacks.add(callback); + return () => { + stateChangeCallbacks.delete(callback); + if (stateChangeCallbacks.size === 0) { + delete this._subscriptionStateChangeCallbacksByHash[hash]; + } + }; + } + + /** + * @internal + */ + async _updateSubscriptions() { + if (Object.keys(this._subscriptionsByHash).length === 0) { + if (this._rpcWebSocketConnected) { + this._rpcWebSocketConnected = false; + this._rpcWebSocketIdleTimeout = setTimeout(() => { + this._rpcWebSocketIdleTimeout = null; + try { + this._rpcWebSocket.close(); + } catch (err) { + // swallow error if socket has already been closed. + if (err instanceof Error) { + console.log(`Error when closing socket connection: ${err.message}`); + } + } + }, 500); + } + return; + } + if (this._rpcWebSocketIdleTimeout !== null) { + clearTimeout(this._rpcWebSocketIdleTimeout); + this._rpcWebSocketIdleTimeout = null; + this._rpcWebSocketConnected = true; + } + if (!this._rpcWebSocketConnected) { + this._rpcWebSocket.connect(); + return; + } + const activeWebSocketGeneration = this._rpcWebSocketGeneration; + const isCurrentConnectionStillActive = () => { + return activeWebSocketGeneration === this._rpcWebSocketGeneration; + }; + await Promise.all( + // Don't be tempted to change this to `Object.entries`. We call + // `_updateSubscriptions` recursively when processing the state, + // so it's important that we look up the *current* version of + // each subscription, every time we process a hash. + Object.keys(this._subscriptionsByHash).map(async hash => { + const subscription = this._subscriptionsByHash[hash]; + if (subscription === undefined) { + // This entry has since been deleted. Skip. + return; + } + switch (subscription.state) { + case 'pending': + case 'unsubscribed': + if (subscription.callbacks.size === 0) { + /** + * You can end up here when: + * + * - a subscription has recently unsubscribed + * without having new callbacks added to it + * while the unsubscribe was in flight, or + * - when a pending subscription has its + * listeners removed before a request was + * sent to the server. + * + * Being that nobody is interested in this + * subscription any longer, delete it. + */ + delete this._subscriptionsByHash[hash]; + if (subscription.state === 'unsubscribed') { + delete this._subscriptionCallbacksByServerSubscriptionId[subscription.serverSubscriptionId]; + } + await this._updateSubscriptions(); + return; + } + await (async () => { + const { + args, + method + } = subscription; + try { + this._setSubscription(hash, { + ...subscription, + state: 'subscribing' + }); + const serverSubscriptionId = await this._rpcWebSocket.call(method, args); + this._setSubscription(hash, { + ...subscription, + serverSubscriptionId, + state: 'subscribed' + }); + this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId] = subscription.callbacks; + await this._updateSubscriptions(); + } catch (e) { + console.error(`Received ${e instanceof Error ? '' : 'JSON-RPC '}error calling \`${method}\``, { + args, + error: e + }); + if (!isCurrentConnectionStillActive()) { + return; + } + // TODO: Maybe add an 'errored' state or a retry limit? + this._setSubscription(hash, { + ...subscription, + state: 'pending' + }); + await this._updateSubscriptions(); + } + })(); + break; + case 'subscribed': + if (subscription.callbacks.size === 0) { + // By the time we successfully set up a subscription + // with the server, the client stopped caring about it. + // Tear it down now. + await (async () => { + const { + serverSubscriptionId, + unsubscribeMethod + } = subscription; + if (this._subscriptionsAutoDisposedByRpc.has(serverSubscriptionId)) { + /** + * Special case. + * If we're dealing with a subscription that has been auto- + * disposed by the RPC, then we can skip the RPC call to + * tear down the subscription here. + * + * NOTE: There is a proposal to eliminate this special case, here: + * https://github.com/solana-labs/solana/issues/18892 + */ + this._subscriptionsAutoDisposedByRpc.delete(serverSubscriptionId); + } else { + this._setSubscription(hash, { + ...subscription, + state: 'unsubscribing' + }); + this._setSubscription(hash, { + ...subscription, + state: 'unsubscribing' + }); + try { + await this._rpcWebSocket.call(unsubscribeMethod, [serverSubscriptionId]); + } catch (e) { + if (e instanceof Error) { + console.error(`${unsubscribeMethod} error:`, e.message); + } + if (!isCurrentConnectionStillActive()) { + return; + } + // TODO: Maybe add an 'errored' state or a retry limit? + this._setSubscription(hash, { + ...subscription, + state: 'subscribed' + }); + await this._updateSubscriptions(); + return; + } + } + this._setSubscription(hash, { + ...subscription, + state: 'unsubscribed' + }); + await this._updateSubscriptions(); + })(); + } + break; + } + })); + } + + /** + * @internal + */ + _handleServerNotification(serverSubscriptionId, callbackArgs) { + const callbacks = this._subscriptionCallbacksByServerSubscriptionId[serverSubscriptionId]; + if (callbacks === undefined) { + return; + } + callbacks.forEach(cb => { + try { + cb( + // I failed to find a way to convince TypeScript that `cb` is of type + // `TCallback` which is certainly compatible with `Parameters`. + // See https://github.com/microsoft/TypeScript/issues/47615 + // @ts-ignore + ...callbackArgs); + } catch (e) { + console.error(e); + } + }); + } + + /** + * @internal + */ + _wsOnAccountNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, AccountNotificationResult); + this._handleServerNotification(subscription, [result.value, result.context]); + } + + /** + * @internal + */ + _makeSubscription(subscriptionConfig, + /** + * When preparing `args` for a call to `_makeSubscription`, be sure + * to carefully apply a default `commitment` property, if necessary. + * + * - If the user supplied a `commitment` use that. + * - Otherwise, if the `Connection::commitment` is set, use that. + * - Otherwise, set it to the RPC server default: `finalized`. + * + * This is extremely important to ensure that these two fundamentally + * identical subscriptions produce the same identifying hash: + * + * - A subscription made without specifying a commitment. + * - A subscription made where the commitment specified is the same + * as the default applied to the subscription above. + * + * Example; these two subscriptions must produce the same hash: + * + * - An `accountSubscribe` subscription for `'PUBKEY'` + * - An `accountSubscribe` subscription for `'PUBKEY'` with commitment + * `'finalized'`. + * + * See the 'making a subscription with defaulted params omitted' test + * in `connection-subscriptions.ts` for more. + */ + args) { + const clientSubscriptionId = this._nextClientSubscriptionId++; + const hash = fastStableStringify([subscriptionConfig.method, args]); + const existingSubscription = this._subscriptionsByHash[hash]; + if (existingSubscription === undefined) { + this._subscriptionsByHash[hash] = { + ...subscriptionConfig, + args, + callbacks: new Set([subscriptionConfig.callback]), + state: 'pending' + }; + } else { + existingSubscription.callbacks.add(subscriptionConfig.callback); + } + this._subscriptionHashByClientSubscriptionId[clientSubscriptionId] = hash; + this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId] = async () => { + delete this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId]; + delete this._subscriptionHashByClientSubscriptionId[clientSubscriptionId]; + const subscription = this._subscriptionsByHash[hash]; + assert(subscription !== undefined, `Could not find a \`Subscription\` when tearing down client subscription #${clientSubscriptionId}`); + subscription.callbacks.delete(subscriptionConfig.callback); + await this._updateSubscriptions(); + }; + this._updateSubscriptions(); + return clientSubscriptionId; + } + + /** + * Register a callback to be invoked whenever the specified account changes + * + * @param publicKey Public key of the account to monitor + * @param callback Function to invoke whenever the account is changed + * @param config + * @return subscription id + */ + + /** @deprecated Instead, pass in an {@link AccountSubscriptionConfig} */ + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + onAccountChange(publicKey, callback, commitmentOrConfig) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([publicKey.toBase58()], commitment || this._commitment || 'finalized', + // Apply connection/server default. + 'base64', config); + return this._makeSubscription({ + callback, + method: 'accountSubscribe', + unsubscribeMethod: 'accountUnsubscribe' + }, args); + } + + /** + * Deregister an account notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeAccountChangeListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'account change'); + } + + /** + * @internal + */ + _wsOnProgramAccountNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, ProgramAccountNotificationResult); + this._handleServerNotification(subscription, [{ + accountId: result.value.pubkey, + accountInfo: result.value.account + }, result.context]); + } + + /** + * Register a callback to be invoked whenever accounts owned by the + * specified program change + * + * @param programId Public key of the program to monitor + * @param callback Function to invoke whenever the account is changed + * @param config + * @return subscription id + */ + + /** @deprecated Instead, pass in a {@link ProgramAccountSubscriptionConfig} */ + // eslint-disable-next-line no-dupe-class-members + + // eslint-disable-next-line no-dupe-class-members + onProgramAccountChange(programId, callback, commitmentOrConfig, maybeFilters) { + const { + commitment, + config + } = extractCommitmentFromConfig(commitmentOrConfig); + const args = this._buildArgs([programId.toBase58()], commitment || this._commitment || 'finalized', + // Apply connection/server default. + 'base64' /* encoding */, config ? config : maybeFilters ? { + filters: applyDefaultMemcmpEncodingToFilters(maybeFilters) + } : undefined /* extra */); + return this._makeSubscription({ + callback, + method: 'programSubscribe', + unsubscribeMethod: 'programUnsubscribe' + }, args); + } + + /** + * Deregister an account notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeProgramAccountChangeListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'program account change'); + } + + /** + * Registers a callback to be invoked whenever logs are emitted. + */ + onLogs(filter, callback, commitment) { + const args = this._buildArgs([typeof filter === 'object' ? { + mentions: [filter.toString()] + } : filter], commitment || this._commitment || 'finalized' // Apply connection/server default. + ); + return this._makeSubscription({ + callback, + method: 'logsSubscribe', + unsubscribeMethod: 'logsUnsubscribe' + }, args); + } + + /** + * Deregister a logs callback. + * + * @param clientSubscriptionId client subscription id to deregister. + */ + async removeOnLogsListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'logs'); + } + + /** + * @internal + */ + _wsOnLogsNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, LogsNotificationResult); + this._handleServerNotification(subscription, [result.value, result.context]); + } + + /** + * @internal + */ + _wsOnSlotNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, SlotNotificationResult); + this._handleServerNotification(subscription, [result]); + } + + /** + * Register a callback to be invoked upon slot changes + * + * @param callback Function to invoke whenever the slot changes + * @return subscription id + */ + onSlotChange(callback) { + return this._makeSubscription({ + callback, + method: 'slotSubscribe', + unsubscribeMethod: 'slotUnsubscribe' + }, [] /* args */); + } + + /** + * Deregister a slot notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeSlotChangeListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot change'); + } + + /** + * @internal + */ + _wsOnSlotUpdatesNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, SlotUpdateNotificationResult); + this._handleServerNotification(subscription, [result]); + } + + /** + * Register a callback to be invoked upon slot updates. {@link SlotUpdate}'s + * may be useful to track live progress of a cluster. + * + * @param callback Function to invoke whenever the slot updates + * @return subscription id + */ + onSlotUpdate(callback) { + return this._makeSubscription({ + callback, + method: 'slotsUpdatesSubscribe', + unsubscribeMethod: 'slotsUpdatesUnsubscribe' + }, [] /* args */); + } + + /** + * Deregister a slot update notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeSlotUpdateListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'slot update'); + } + + /** + * @internal + */ + + async _unsubscribeClientSubscription(clientSubscriptionId, subscriptionName) { + const dispose = this._subscriptionDisposeFunctionsByClientSubscriptionId[clientSubscriptionId]; + if (dispose) { + await dispose(); + } else { + console.warn('Ignored unsubscribe request because an active subscription with id ' + `\`${clientSubscriptionId}\` for '${subscriptionName}' events ` + 'could not be found.'); + } + } + _buildArgs(args, override, encoding, extra) { + const commitment = override || this._commitment; + if (commitment || encoding || extra) { + let options = {}; + if (encoding) { + options.encoding = encoding; + } + if (commitment) { + options.commitment = commitment; + } + if (extra) { + options = Object.assign(options, extra); + } + args.push(options); + } + return args; + } + + /** + * @internal + */ + _buildArgsAtLeastConfirmed(args, override, encoding, extra) { + const commitment = override || this._commitment; + if (commitment && !['confirmed', 'finalized'].includes(commitment)) { + throw new Error('Using Connection with default commitment: `' + this._commitment + '`, but method requires at least `confirmed`'); + } + return this._buildArgs(args, override, encoding, extra); + } + + /** + * @internal + */ + _wsOnSignatureNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, SignatureNotificationResult); + if (result.value !== 'receivedSignature') { + /** + * Special case. + * After a signature is processed, RPCs automatically dispose of the + * subscription on the server side. We need to track which of these + * subscriptions have been disposed in such a way, so that we know + * whether the client is dealing with a not-yet-processed signature + * (in which case we must tear down the server subscription) or an + * already-processed signature (in which case the client can simply + * clear out the subscription locally without telling the server). + * + * NOTE: There is a proposal to eliminate this special case, here: + * https://github.com/solana-labs/solana/issues/18892 + */ + this._subscriptionsAutoDisposedByRpc.add(subscription); + } + this._handleServerNotification(subscription, result.value === 'receivedSignature' ? [{ + type: 'received' + }, result.context] : [{ + type: 'status', + result: result.value + }, result.context]); + } + + /** + * Register a callback to be invoked upon signature updates + * + * @param signature Transaction signature string in base 58 + * @param callback Function to invoke on signature notifications + * @param commitment Specify the commitment level signature must reach before notification + * @return subscription id + */ + onSignature(signature, callback, commitment) { + const args = this._buildArgs([signature], commitment || this._commitment || 'finalized' // Apply connection/server default. + ); + const clientSubscriptionId = this._makeSubscription({ + callback: (notification, context) => { + if (notification.type === 'status') { + callback(notification.result, context); + // Signatures subscriptions are auto-removed by the RPC service + // so no need to explicitly send an unsubscribe message. + try { + this.removeSignatureListener(clientSubscriptionId); + // eslint-disable-next-line no-empty + } catch (_err) { + // Already removed. + } + } + }, + method: 'signatureSubscribe', + unsubscribeMethod: 'signatureUnsubscribe' + }, args); + return clientSubscriptionId; + } + + /** + * Register a callback to be invoked when a transaction is + * received and/or processed. + * + * @param signature Transaction signature string in base 58 + * @param callback Function to invoke on signature notifications + * @param options Enable received notifications and set the commitment + * level that signature must reach before notification + * @return subscription id + */ + onSignatureWithOptions(signature, callback, options) { + const { + commitment, + ...extra + } = { + ...options, + commitment: options && options.commitment || this._commitment || 'finalized' // Apply connection/server default. + }; + const args = this._buildArgs([signature], commitment, undefined /* encoding */, extra); + const clientSubscriptionId = this._makeSubscription({ + callback: (notification, context) => { + callback(notification, context); + // Signatures subscriptions are auto-removed by the RPC service + // so no need to explicitly send an unsubscribe message. + try { + this.removeSignatureListener(clientSubscriptionId); + // eslint-disable-next-line no-empty + } catch (_err) { + // Already removed. + } + }, + method: 'signatureSubscribe', + unsubscribeMethod: 'signatureUnsubscribe' + }, args); + return clientSubscriptionId; + } + + /** + * Deregister a signature notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeSignatureListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'signature result'); + } + + /** + * @internal + */ + _wsOnRootNotification(notification) { + const { + result, + subscription + } = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.create)(notification, RootNotificationResult); + this._handleServerNotification(subscription, [result]); + } + + /** + * Register a callback to be invoked upon root changes + * + * @param callback Function to invoke whenever the root changes + * @return subscription id + */ + onRootChange(callback) { + return this._makeSubscription({ + callback, + method: 'rootSubscribe', + unsubscribeMethod: 'rootUnsubscribe' + }, [] /* args */); + } + + /** + * Deregister a root notification callback + * + * @param clientSubscriptionId client subscription id to deregister + */ + async removeRootChangeListener(clientSubscriptionId) { + await this._unsubscribeClientSubscription(clientSubscriptionId, 'root change'); + } +} + +/** + * Keypair signer interface + */ + +/** + * An account keypair used for signing transactions. + */ +class Keypair { + /** + * Create a new keypair instance. + * Generate random keypair if no {@link Ed25519Keypair} is provided. + * + * @param {Ed25519Keypair} keypair ed25519 keypair + */ + constructor(keypair) { + this._keypair = void 0; + this._keypair = keypair ?? generateKeypair(); + } + + /** + * Generate a new random keypair + * + * @returns {Keypair} Keypair + */ + static generate() { + return new Keypair(generateKeypair()); + } + + /** + * Create a keypair from a raw secret key byte array. + * + * This method should only be used to recreate a keypair from a previously + * generated secret key. Generating keypairs from a random seed should be done + * with the {@link Keypair.fromSeed} method. + * + * @throws error if the provided secret key is invalid and validation is not skipped. + * + * @param secretKey secret key byte array + * @param options skip secret key validation + * + * @returns {Keypair} Keypair + */ + static fromSecretKey(secretKey, options) { + if (secretKey.byteLength !== 64) { + throw new Error('bad secret key size'); + } + const publicKey = secretKey.slice(32, 64); + if (!options || !options.skipValidation) { + const privateScalar = secretKey.slice(0, 32); + const computedPublicKey = getPublicKey(privateScalar); + for (let ii = 0; ii < 32; ii++) { + if (publicKey[ii] !== computedPublicKey[ii]) { + throw new Error('provided secretKey is invalid'); + } + } + } + return new Keypair({ + publicKey, + secretKey + }); + } + + /** + * Generate a keypair from a 32 byte seed. + * + * @param seed seed byte array + * + * @returns {Keypair} Keypair + */ + static fromSeed(seed) { + const publicKey = getPublicKey(seed); + const secretKey = new Uint8Array(64); + secretKey.set(seed); + secretKey.set(publicKey, 32); + return new Keypair({ + publicKey, + secretKey + }); + } + + /** + * The public key for this keypair + * + * @returns {PublicKey} PublicKey + */ + get publicKey() { + return new PublicKey(this._keypair.publicKey); + } + + /** + * The raw secret key for this keypair + * @returns {Uint8Array} Secret key in an array of Uint8 bytes + */ + get secretKey() { + return new Uint8Array(this._keypair.secretKey); + } +} + +/** + * An enumeration of valid LookupTableInstructionType's + */ + +/** + * An enumeration of valid address lookup table InstructionType's + * @internal + */ +const LOOKUP_TABLE_INSTRUCTION_LAYOUTS = Object.freeze({ + CreateLookupTable: { + index: 0, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), u64('recentSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('bumpSeed')]) + }, + FreezeLookupTable: { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + ExtendLookupTable: { + index: 2, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), u64(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(publicKey(), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'addresses')]) + }, + DeactivateLookupTable: { + index: 3, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + CloseLookupTable: { + index: 4, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + } +}); +class AddressLookupTableInstruction { + /** + * @internal + */ + constructor() {} + static decodeInstructionType(instruction) { + this.checkProgramId(instruction.programId); + const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'); + const index = instructionTypeLayout.decode(instruction.data); + let type; + for (const [layoutType, layout] of Object.entries(LOOKUP_TABLE_INSTRUCTION_LAYOUTS)) { + if (layout.index == index) { + type = layoutType; + break; + } + } + if (!type) { + throw new Error('Invalid Instruction. Should be a LookupTable Instruction'); + } + return type; + } + static decodeCreateLookupTable(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeysLength(instruction.keys, 4); + const { + recentSlot + } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable, instruction.data); + return { + authority: instruction.keys[1].pubkey, + payer: instruction.keys[2].pubkey, + recentSlot: Number(recentSlot) + }; + } + static decodeExtendLookupTable(instruction) { + this.checkProgramId(instruction.programId); + if (instruction.keys.length < 2) { + throw new Error(`invalid instruction; found ${instruction.keys.length} keys, expected at least 2`); + } + const { + addresses + } = decodeData$1(LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable, instruction.data); + return { + lookupTable: instruction.keys[0].pubkey, + authority: instruction.keys[1].pubkey, + payer: instruction.keys.length > 2 ? instruction.keys[2].pubkey : undefined, + addresses: addresses.map(buffer => new PublicKey(buffer)) + }; + } + static decodeCloseLookupTable(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeysLength(instruction.keys, 3); + return { + lookupTable: instruction.keys[0].pubkey, + authority: instruction.keys[1].pubkey, + recipient: instruction.keys[2].pubkey + }; + } + static decodeFreezeLookupTable(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeysLength(instruction.keys, 2); + return { + lookupTable: instruction.keys[0].pubkey, + authority: instruction.keys[1].pubkey + }; + } + static decodeDeactivateLookupTable(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeysLength(instruction.keys, 2); + return { + lookupTable: instruction.keys[0].pubkey, + authority: instruction.keys[1].pubkey + }; + } + + /** + * @internal + */ + static checkProgramId(programId) { + if (!programId.equals(AddressLookupTableProgram.programId)) { + throw new Error('invalid instruction; programId is not AddressLookupTable Program'); + } + } + /** + * @internal + */ + static checkKeysLength(keys, expectedLength) { + if (keys.length < expectedLength) { + throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`); + } + } +} +class AddressLookupTableProgram { + /** + * @internal + */ + constructor() {} + static createLookupTable(params) { + const [lookupTableAddress, bumpSeed] = PublicKey.findProgramAddressSync([params.authority.toBuffer(), (0,_solana_codecs_numbers__WEBPACK_IMPORTED_MODULE_7__.getU64Encoder)().encode(params.recentSlot)], this.programId); + const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CreateLookupTable; + const data = encodeData(type, { + recentSlot: BigInt(params.recentSlot), + bumpSeed: bumpSeed + }); + const keys = [{ + pubkey: lookupTableAddress, + isSigner: false, + isWritable: true + }, { + pubkey: params.authority, + isSigner: true, + isWritable: false + }, { + pubkey: params.payer, + isSigner: true, + isWritable: true + }, { + pubkey: SystemProgram.programId, + isSigner: false, + isWritable: false + }]; + return [new TransactionInstruction({ + programId: this.programId, + keys: keys, + data: data + }), lookupTableAddress]; + } + static freezeLookupTable(params) { + const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.FreezeLookupTable; + const data = encodeData(type); + const keys = [{ + pubkey: params.lookupTable, + isSigner: false, + isWritable: true + }, { + pubkey: params.authority, + isSigner: true, + isWritable: false + }]; + return new TransactionInstruction({ + programId: this.programId, + keys: keys, + data: data + }); + } + static extendLookupTable(params) { + const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.ExtendLookupTable; + const data = encodeData(type, { + addresses: params.addresses.map(addr => addr.toBytes()) + }); + const keys = [{ + pubkey: params.lookupTable, + isSigner: false, + isWritable: true + }, { + pubkey: params.authority, + isSigner: true, + isWritable: false + }]; + if (params.payer) { + keys.push({ + pubkey: params.payer, + isSigner: true, + isWritable: true + }, { + pubkey: SystemProgram.programId, + isSigner: false, + isWritable: false + }); + } + return new TransactionInstruction({ + programId: this.programId, + keys: keys, + data: data + }); + } + static deactivateLookupTable(params) { + const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.DeactivateLookupTable; + const data = encodeData(type); + const keys = [{ + pubkey: params.lookupTable, + isSigner: false, + isWritable: true + }, { + pubkey: params.authority, + isSigner: true, + isWritable: false + }]; + return new TransactionInstruction({ + programId: this.programId, + keys: keys, + data: data + }); + } + static closeLookupTable(params) { + const type = LOOKUP_TABLE_INSTRUCTION_LAYOUTS.CloseLookupTable; + const data = encodeData(type); + const keys = [{ + pubkey: params.lookupTable, + isSigner: false, + isWritable: true + }, { + pubkey: params.authority, + isSigner: true, + isWritable: false + }, { + pubkey: params.recipient, + isSigner: false, + isWritable: true + }]; + return new TransactionInstruction({ + programId: this.programId, + keys: keys, + data: data + }); + } +} +AddressLookupTableProgram.programId = new PublicKey('AddressLookupTab1e1111111111111111111111111'); + +/** + * Compute Budget Instruction class + */ +class ComputeBudgetInstruction { + /** + * @internal + */ + constructor() {} + + /** + * Decode a compute budget instruction and retrieve the instruction type. + */ + static decodeInstructionType(instruction) { + this.checkProgramId(instruction.programId); + const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('instruction'); + const typeIndex = instructionTypeLayout.decode(instruction.data); + let type; + for (const [ixType, layout] of Object.entries(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS)) { + if (layout.index == typeIndex) { + type = ixType; + break; + } + } + if (!type) { + throw new Error('Instruction type incorrect; not a ComputeBudgetInstruction'); + } + return type; + } + + /** + * Decode request units compute budget instruction and retrieve the instruction params. + */ + static decodeRequestUnits(instruction) { + this.checkProgramId(instruction.programId); + const { + units, + additionalFee + } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits, instruction.data); + return { + units, + additionalFee + }; + } + + /** + * Decode request heap frame compute budget instruction and retrieve the instruction params. + */ + static decodeRequestHeapFrame(instruction) { + this.checkProgramId(instruction.programId); + const { + bytes + } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame, instruction.data); + return { + bytes + }; + } + + /** + * Decode set compute unit limit compute budget instruction and retrieve the instruction params. + */ + static decodeSetComputeUnitLimit(instruction) { + this.checkProgramId(instruction.programId); + const { + units + } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data); + return { + units + }; + } + + /** + * Decode set compute unit price compute budget instruction and retrieve the instruction params. + */ + static decodeSetComputeUnitPrice(instruction) { + this.checkProgramId(instruction.programId); + const { + microLamports + } = decodeData$1(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data); + return { + microLamports + }; + } + + /** + * @internal + */ + static checkProgramId(programId) { + if (!programId.equals(ComputeBudgetProgram.programId)) { + throw new Error('invalid instruction; programId is not ComputeBudgetProgram'); + } + } +} + +/** + * An enumeration of valid ComputeBudgetInstructionType's + */ + +/** + * Request units instruction params + */ + +/** + * Request heap frame instruction params + */ + +/** + * Set compute unit limit instruction params + */ + +/** + * Set compute unit price instruction params + */ + +/** + * An enumeration of valid ComputeBudget InstructionType's + * @internal + */ +const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({ + RequestUnits: { + index: 0, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('units'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('additionalFee')]) + }, + RequestHeapFrame: { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('bytes')]) + }, + SetComputeUnitLimit: { + index: 2, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('units')]) + }, + SetComputeUnitPrice: { + index: 3, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('instruction'), u64('microLamports')]) + } +}); + +/** + * Factory class for transaction instructions to interact with the Compute Budget program + */ +class ComputeBudgetProgram { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the Compute Budget program + */ + + /** + * @deprecated Instead, call {@link setComputeUnitLimit} and/or {@link setComputeUnitPrice} + */ + static requestUnits(params) { + const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestUnits; + const data = encodeData(type, params); + return new TransactionInstruction({ + keys: [], + programId: this.programId, + data + }); + } + static requestHeapFrame(params) { + const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.RequestHeapFrame; + const data = encodeData(type, params); + return new TransactionInstruction({ + keys: [], + programId: this.programId, + data + }); + } + static setComputeUnitLimit(params) { + const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit; + const data = encodeData(type, params); + return new TransactionInstruction({ + keys: [], + programId: this.programId, + data + }); + } + static setComputeUnitPrice(params) { + const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice; + const data = encodeData(type, { + microLamports: BigInt(params.microLamports) + }); + return new TransactionInstruction({ + keys: [], + programId: this.programId, + data + }); + } +} +ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111'); + +const PRIVATE_KEY_BYTES$1 = 64; +const PUBLIC_KEY_BYTES$1 = 32; +const SIGNATURE_BYTES = 64; + +/** + * Params for creating an ed25519 instruction using a public key + */ + +/** + * Params for creating an ed25519 instruction using a private key + */ + +const ED25519_INSTRUCTION_LAYOUT = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('numSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('padding'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('signatureOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('signatureInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('publicKeyOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('publicKeyInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('messageDataOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('messageDataSize'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('messageInstructionIndex')]); +class Ed25519Program { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the ed25519 program + */ + + /** + * Create an ed25519 instruction with a public key and signature. The + * public key must be a buffer that is 32 bytes long, and the signature + * must be a buffer of 64 bytes. + */ + static createInstructionWithPublicKey(params) { + const { + publicKey, + message, + signature, + instructionIndex + } = params; + assert(publicKey.length === PUBLIC_KEY_BYTES$1, `Public Key must be ${PUBLIC_KEY_BYTES$1} bytes but received ${publicKey.length} bytes`); + assert(signature.length === SIGNATURE_BYTES, `Signature must be ${SIGNATURE_BYTES} bytes but received ${signature.length} bytes`); + const publicKeyOffset = ED25519_INSTRUCTION_LAYOUT.span; + const signatureOffset = publicKeyOffset + publicKey.length; + const messageDataOffset = signatureOffset + signature.length; + const numSignatures = 1; + const instructionData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(messageDataOffset + message.length); + const index = instructionIndex == null ? 0xffff // An index of `u16::MAX` makes it default to the current instruction. + : instructionIndex; + ED25519_INSTRUCTION_LAYOUT.encode({ + numSignatures, + padding: 0, + signatureOffset, + signatureInstructionIndex: index, + publicKeyOffset, + publicKeyInstructionIndex: index, + messageDataOffset, + messageDataSize: message.length, + messageInstructionIndex: index + }, instructionData); + instructionData.fill(publicKey, publicKeyOffset); + instructionData.fill(signature, signatureOffset); + instructionData.fill(message, messageDataOffset); + return new TransactionInstruction({ + keys: [], + programId: Ed25519Program.programId, + data: instructionData + }); + } + + /** + * Create an ed25519 instruction with a private key. The private key + * must be a buffer that is 64 bytes long. + */ + static createInstructionWithPrivateKey(params) { + const { + privateKey, + message, + instructionIndex + } = params; + assert(privateKey.length === PRIVATE_KEY_BYTES$1, `Private key must be ${PRIVATE_KEY_BYTES$1} bytes but received ${privateKey.length} bytes`); + try { + const keypair = Keypair.fromSecretKey(privateKey); + const publicKey = keypair.publicKey.toBytes(); + const signature = sign(message, keypair.secretKey); + return this.createInstructionWithPublicKey({ + publicKey, + message, + signature, + instructionIndex + }); + } catch (error) { + throw new Error(`Error creating instruction; ${error}`); + } + } +} +Ed25519Program.programId = new PublicKey('Ed25519SigVerify111111111111111111111111111'); + +const ecdsaSign = (msgHash, privKey) => { + const signature = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_12__.secp256k1.sign(msgHash, privKey); + return [signature.toCompactRawBytes(), signature.recovery]; +}; +_noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_12__.secp256k1.utils.isValidPrivateKey; +const publicKeyCreate = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_12__.secp256k1.getPublicKey; + +const PRIVATE_KEY_BYTES = 32; +const ETHEREUM_ADDRESS_BYTES = 20; +const PUBLIC_KEY_BYTES = 64; +const SIGNATURE_OFFSETS_SERIALIZED_SIZE = 11; + +/** + * Params for creating an secp256k1 instruction using a public key + */ + +/** + * Params for creating an secp256k1 instruction using an Ethereum address + */ + +/** + * Params for creating an secp256k1 instruction using a private key + */ + +const SECP256K1_INSTRUCTION_LAYOUT = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('numSignatures'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('signatureOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('signatureInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('ethAddressOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('ethAddressInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('messageDataOffset'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u16('messageDataSize'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('messageInstructionIndex'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(20, 'ethAddress'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.blob(64, 'signature'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('recoveryId')]); +class Secp256k1Program { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the secp256k1 program + */ + + /** + * Construct an Ethereum address from a secp256k1 public key buffer. + * @param {Buffer} publicKey a 64 byte secp256k1 public key buffer + */ + static publicKeyToEthAddress(publicKey) { + assert(publicKey.length === PUBLIC_KEY_BYTES, `Public key must be ${PUBLIC_KEY_BYTES} bytes but received ${publicKey.length} bytes`); + try { + return buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,_noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_11__.keccak_256)(toBuffer(publicKey))).slice(-ETHEREUM_ADDRESS_BYTES); + } catch (error) { + throw new Error(`Error constructing Ethereum address: ${error}`); + } + } + + /** + * Create an secp256k1 instruction with a public key. The public key + * must be a buffer that is 64 bytes long. + */ + static createInstructionWithPublicKey(params) { + const { + publicKey, + message, + signature, + recoveryId, + instructionIndex + } = params; + return Secp256k1Program.createInstructionWithEthAddress({ + ethAddress: Secp256k1Program.publicKeyToEthAddress(publicKey), + message, + signature, + recoveryId, + instructionIndex + }); + } + + /** + * Create an secp256k1 instruction with an Ethereum address. The address + * must be a hex string or a buffer that is 20 bytes long. + */ + static createInstructionWithEthAddress(params) { + const { + ethAddress: rawAddress, + message, + signature, + recoveryId, + instructionIndex = 0 + } = params; + let ethAddress; + if (typeof rawAddress === 'string') { + if (rawAddress.startsWith('0x')) { + ethAddress = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(rawAddress.substr(2), 'hex'); + } else { + ethAddress = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(rawAddress, 'hex'); + } + } else { + ethAddress = rawAddress; + } + assert(ethAddress.length === ETHEREUM_ADDRESS_BYTES, `Address must be ${ETHEREUM_ADDRESS_BYTES} bytes but received ${ethAddress.length} bytes`); + const dataStart = 1 + SIGNATURE_OFFSETS_SERIALIZED_SIZE; + const ethAddressOffset = dataStart; + const signatureOffset = dataStart + ethAddress.length; + const messageDataOffset = signatureOffset + signature.length + 1; + const numSignatures = 1; + const instructionData = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.alloc(SECP256K1_INSTRUCTION_LAYOUT.span + message.length); + SECP256K1_INSTRUCTION_LAYOUT.encode({ + numSignatures, + signatureOffset, + signatureInstructionIndex: instructionIndex, + ethAddressOffset, + ethAddressInstructionIndex: instructionIndex, + messageDataOffset, + messageDataSize: message.length, + messageInstructionIndex: instructionIndex, + signature: toBuffer(signature), + ethAddress: toBuffer(ethAddress), + recoveryId + }, instructionData); + instructionData.fill(toBuffer(message), SECP256K1_INSTRUCTION_LAYOUT.span); + return new TransactionInstruction({ + keys: [], + programId: Secp256k1Program.programId, + data: instructionData + }); + } + + /** + * Create an secp256k1 instruction with a private key. The private key + * must be a buffer that is 32 bytes long. + */ + static createInstructionWithPrivateKey(params) { + const { + privateKey: pkey, + message, + instructionIndex + } = params; + assert(pkey.length === PRIVATE_KEY_BYTES, `Private key must be ${PRIVATE_KEY_BYTES} bytes but received ${pkey.length} bytes`); + try { + const privateKey = toBuffer(pkey); + const publicKey = publicKeyCreate(privateKey, false /* isCompressed */).slice(1); // throw away leading byte + const messageHash = buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from((0,_noble_hashes_sha3__WEBPACK_IMPORTED_MODULE_11__.keccak_256)(toBuffer(message))); + const [signature, recoveryId] = ecdsaSign(messageHash, privateKey); + return this.createInstructionWithPublicKey({ + publicKey, + message, + signature, + recoveryId, + instructionIndex + }); + } catch (error) { + throw new Error(`Error creating instruction; ${error}`); + } + } +} +Secp256k1Program.programId = new PublicKey('KeccakSecp256k11111111111111111111111111111'); + +var _Lockup; + +/** + * Address of the stake config account which configures the rate + * of stake warmup and cooldown as well as the slashing penalty. + */ +const STAKE_CONFIG_ID = new PublicKey('StakeConfig11111111111111111111111111111111'); + +/** + * Stake account authority info + */ +class Authorized { + /** + * Create a new Authorized object + * @param staker the stake authority + * @param withdrawer the withdraw authority + */ + constructor(staker, withdrawer) { + /** stake authority */ + this.staker = void 0; + /** withdraw authority */ + this.withdrawer = void 0; + this.staker = staker; + this.withdrawer = withdrawer; + } +} +/** + * Stake account lockup info + */ +class Lockup { + /** + * Create a new Lockup object + */ + constructor(unixTimestamp, epoch, custodian) { + /** Unix timestamp of lockup expiration */ + this.unixTimestamp = void 0; + /** Epoch of lockup expiration */ + this.epoch = void 0; + /** Lockup custodian authority */ + this.custodian = void 0; + this.unixTimestamp = unixTimestamp; + this.epoch = epoch; + this.custodian = custodian; + } + + /** + * Default, inactive Lockup value + */ +} +_Lockup = Lockup; +Lockup.default = new _Lockup(0, 0, PublicKey.default); +/** + * Create stake account transaction params + */ +/** + * Create stake account with seed transaction params + */ +/** + * Initialize stake instruction params + */ +/** + * Delegate stake instruction params + */ +/** + * Authorize stake instruction params + */ +/** + * Authorize stake instruction params using a derived key + */ +/** + * Split stake instruction params + */ +/** + * Split with seed transaction params + */ +/** + * Withdraw stake instruction params + */ +/** + * Deactivate stake instruction params + */ +/** + * Merge stake instruction params + */ +/** + * Stake Instruction class + */ +class StakeInstruction { + /** + * @internal + */ + constructor() {} + + /** + * Decode a stake instruction and retrieve the instruction type. + */ + static decodeInstructionType(instruction) { + this.checkProgramId(instruction.programId); + const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'); + const typeIndex = instructionTypeLayout.decode(instruction.data); + let type; + for (const [ixType, layout] of Object.entries(STAKE_INSTRUCTION_LAYOUTS)) { + if (layout.index == typeIndex) { + type = ixType; + break; + } + } + if (!type) { + throw new Error('Instruction type incorrect; not a StakeInstruction'); + } + return type; + } + + /** + * Decode a initialize stake instruction and retrieve the instruction params. + */ + static decodeInitialize(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + authorized, + lockup + } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Initialize, instruction.data); + return { + stakePubkey: instruction.keys[0].pubkey, + authorized: new Authorized(new PublicKey(authorized.staker), new PublicKey(authorized.withdrawer)), + lockup: new Lockup(lockup.unixTimestamp, lockup.epoch, new PublicKey(lockup.custodian)) + }; + } + + /** + * Decode a delegate stake instruction and retrieve the instruction params. + */ + static decodeDelegate(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 6); + decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Delegate, instruction.data); + return { + stakePubkey: instruction.keys[0].pubkey, + votePubkey: instruction.keys[1].pubkey, + authorizedPubkey: instruction.keys[5].pubkey + }; + } + + /** + * Decode an authorize stake instruction and retrieve the instruction params. + */ + static decodeAuthorize(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + newAuthorized, + stakeAuthorizationType + } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Authorize, instruction.data); + const o = { + stakePubkey: instruction.keys[0].pubkey, + authorizedPubkey: instruction.keys[2].pubkey, + newAuthorizedPubkey: new PublicKey(newAuthorized), + stakeAuthorizationType: { + index: stakeAuthorizationType + } + }; + if (instruction.keys.length > 3) { + o.custodianPubkey = instruction.keys[3].pubkey; + } + return o; + } + + /** + * Decode an authorize-with-seed stake instruction and retrieve the instruction params. + */ + static decodeAuthorizeWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 2); + const { + newAuthorized, + stakeAuthorizationType, + authoritySeed, + authorityOwner + } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data); + const o = { + stakePubkey: instruction.keys[0].pubkey, + authorityBase: instruction.keys[1].pubkey, + authoritySeed: authoritySeed, + authorityOwner: new PublicKey(authorityOwner), + newAuthorizedPubkey: new PublicKey(newAuthorized), + stakeAuthorizationType: { + index: stakeAuthorizationType + } + }; + if (instruction.keys.length > 3) { + o.custodianPubkey = instruction.keys[3].pubkey; + } + return o; + } + + /** + * Decode a split stake instruction and retrieve the instruction params. + */ + static decodeSplit(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + lamports + } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Split, instruction.data); + return { + stakePubkey: instruction.keys[0].pubkey, + splitStakePubkey: instruction.keys[1].pubkey, + authorizedPubkey: instruction.keys[2].pubkey, + lamports + }; + } + + /** + * Decode a merge stake instruction and retrieve the instruction params. + */ + static decodeMerge(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Merge, instruction.data); + return { + stakePubkey: instruction.keys[0].pubkey, + sourceStakePubKey: instruction.keys[1].pubkey, + authorizedPubkey: instruction.keys[4].pubkey + }; + } + + /** + * Decode a withdraw stake instruction and retrieve the instruction params. + */ + static decodeWithdraw(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 5); + const { + lamports + } = decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data); + const o = { + stakePubkey: instruction.keys[0].pubkey, + toPubkey: instruction.keys[1].pubkey, + authorizedPubkey: instruction.keys[4].pubkey, + lamports + }; + if (instruction.keys.length > 5) { + o.custodianPubkey = instruction.keys[5].pubkey; + } + return o; + } + + /** + * Decode a deactivate stake instruction and retrieve the instruction params. + */ + static decodeDeactivate(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + decodeData$1(STAKE_INSTRUCTION_LAYOUTS.Deactivate, instruction.data); + return { + stakePubkey: instruction.keys[0].pubkey, + authorizedPubkey: instruction.keys[2].pubkey + }; + } + + /** + * @internal + */ + static checkProgramId(programId) { + if (!programId.equals(StakeProgram.programId)) { + throw new Error('invalid instruction; programId is not StakeProgram'); + } + } + + /** + * @internal + */ + static checkKeyLength(keys, expectedLength) { + if (keys.length < expectedLength) { + throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`); + } + } +} + +/** + * An enumeration of valid StakeInstructionType's + */ + +/** + * An enumeration of valid stake InstructionType's + * @internal + */ +const STAKE_INSTRUCTION_LAYOUTS = Object.freeze({ + Initialize: { + index: 0, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), authorized(), lockup()]) + }, + Authorize: { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('stakeAuthorizationType')]) + }, + Delegate: { + index: 2, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + Split: { + index: 3, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports')]) + }, + Withdraw: { + index: 4, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports')]) + }, + Deactivate: { + index: 5, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + Merge: { + index: 7, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + AuthorizeWithSeed: { + index: 8, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('stakeAuthorizationType'), rustString('authoritySeed'), publicKey('authorityOwner')]) + } +}); + +/** + * Stake authorization type + */ + +/** + * An enumeration of valid StakeAuthorizationLayout's + */ +const StakeAuthorizationLayout = Object.freeze({ + Staker: { + index: 0 + }, + Withdrawer: { + index: 1 + } +}); + +/** + * Factory class for transactions to interact with the Stake program + */ +class StakeProgram { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the Stake program + */ + + /** + * Generate an Initialize instruction to add to a Stake Create transaction + */ + static initialize(params) { + const { + stakePubkey, + authorized, + lockup: maybeLockup + } = params; + const lockup = maybeLockup || Lockup.default; + const type = STAKE_INSTRUCTION_LAYOUTS.Initialize; + const data = encodeData(type, { + authorized: { + staker: toBuffer(authorized.staker.toBuffer()), + withdrawer: toBuffer(authorized.withdrawer.toBuffer()) + }, + lockup: { + unixTimestamp: lockup.unixTimestamp, + epoch: lockup.epoch, + custodian: toBuffer(lockup.custodian.toBuffer()) + } + }); + const instructionData = { + keys: [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_RENT_PUBKEY, + isSigner: false, + isWritable: false + }], + programId: this.programId, + data + }; + return new TransactionInstruction(instructionData); + } + + /** + * Generate a Transaction that creates a new Stake account at + * an address generated with `from`, a seed, and the Stake programId + */ + static createAccountWithSeed(params) { + const transaction = new Transaction(); + transaction.add(SystemProgram.createAccountWithSeed({ + fromPubkey: params.fromPubkey, + newAccountPubkey: params.stakePubkey, + basePubkey: params.basePubkey, + seed: params.seed, + lamports: params.lamports, + space: this.space, + programId: this.programId + })); + const { + stakePubkey, + authorized, + lockup + } = params; + return transaction.add(this.initialize({ + stakePubkey, + authorized, + lockup + })); + } + + /** + * Generate a Transaction that creates a new Stake account + */ + static createAccount(params) { + const transaction = new Transaction(); + transaction.add(SystemProgram.createAccount({ + fromPubkey: params.fromPubkey, + newAccountPubkey: params.stakePubkey, + lamports: params.lamports, + space: this.space, + programId: this.programId + })); + const { + stakePubkey, + authorized, + lockup + } = params; + return transaction.add(this.initialize({ + stakePubkey, + authorized, + lockup + })); + } + + /** + * Generate a Transaction that delegates Stake tokens to a validator + * Vote PublicKey. This transaction can also be used to redelegate Stake + * to a new validator Vote PublicKey. + */ + static delegate(params) { + const { + stakePubkey, + authorizedPubkey, + votePubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Delegate; + const data = encodeData(type); + return new Transaction().add({ + keys: [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: votePubkey, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: STAKE_CONFIG_ID, + isSigner: false, + isWritable: false + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } + + /** + * Generate a Transaction that authorizes a new PublicKey as Staker + * or Withdrawer on the Stake account. + */ + static authorize(params) { + const { + stakePubkey, + authorizedPubkey, + newAuthorizedPubkey, + stakeAuthorizationType, + custodianPubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Authorize; + const data = encodeData(type, { + newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()), + stakeAuthorizationType: stakeAuthorizationType.index + }); + const keys = [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: true + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }]; + if (custodianPubkey) { + keys.push({ + pubkey: custodianPubkey, + isSigner: true, + isWritable: false + }); + } + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a Transaction that authorizes a new PublicKey as Staker + * or Withdrawer on the Stake account. + */ + static authorizeWithSeed(params) { + const { + stakePubkey, + authorityBase, + authoritySeed, + authorityOwner, + newAuthorizedPubkey, + stakeAuthorizationType, + custodianPubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed; + const data = encodeData(type, { + newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()), + stakeAuthorizationType: stakeAuthorizationType.index, + authoritySeed: authoritySeed, + authorityOwner: toBuffer(authorityOwner.toBuffer()) + }); + const keys = [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: authorityBase, + isSigner: true, + isWritable: false + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }]; + if (custodianPubkey) { + keys.push({ + pubkey: custodianPubkey, + isSigner: true, + isWritable: false + }); + } + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * @internal + */ + static splitInstruction(params) { + const { + stakePubkey, + authorizedPubkey, + splitStakePubkey, + lamports + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Split; + const data = encodeData(type, { + lamports + }); + return new TransactionInstruction({ + keys: [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: splitStakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } + + /** + * Generate a Transaction that splits Stake tokens into another stake account + */ + static split(params, + // Compute the cost of allocating the new stake account in lamports + rentExemptReserve) { + const transaction = new Transaction(); + transaction.add(SystemProgram.createAccount({ + fromPubkey: params.authorizedPubkey, + newAccountPubkey: params.splitStakePubkey, + lamports: rentExemptReserve, + space: this.space, + programId: this.programId + })); + return transaction.add(this.splitInstruction(params)); + } + + /** + * Generate a Transaction that splits Stake tokens into another account + * derived from a base public key and seed + */ + static splitWithSeed(params, + // If this stake account is new, compute the cost of allocating it in lamports + rentExemptReserve) { + const { + stakePubkey, + authorizedPubkey, + splitStakePubkey, + basePubkey, + seed, + lamports + } = params; + const transaction = new Transaction(); + transaction.add(SystemProgram.allocate({ + accountPubkey: splitStakePubkey, + basePubkey, + seed, + space: this.space, + programId: this.programId + })); + if (rentExemptReserve && rentExemptReserve > 0) { + transaction.add(SystemProgram.transfer({ + fromPubkey: params.authorizedPubkey, + toPubkey: splitStakePubkey, + lamports: rentExemptReserve + })); + } + return transaction.add(this.splitInstruction({ + stakePubkey, + authorizedPubkey, + splitStakePubkey, + lamports + })); + } + + /** + * Generate a Transaction that merges Stake accounts. + */ + static merge(params) { + const { + stakePubkey, + sourceStakePubKey, + authorizedPubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Merge; + const data = encodeData(type); + return new Transaction().add({ + keys: [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: sourceStakePubKey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } + + /** + * Generate a Transaction that withdraws deactivated Stake tokens. + */ + static withdraw(params) { + const { + stakePubkey, + authorizedPubkey, + toPubkey, + lamports, + custodianPubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Withdraw; + const data = encodeData(type, { + lamports + }); + const keys = [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: toPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_STAKE_HISTORY_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }]; + if (custodianPubkey) { + keys.push({ + pubkey: custodianPubkey, + isSigner: true, + isWritable: false + }); + } + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a Transaction that deactivates Stake tokens. + */ + static deactivate(params) { + const { + stakePubkey, + authorizedPubkey + } = params; + const type = STAKE_INSTRUCTION_LAYOUTS.Deactivate; + const data = encodeData(type); + return new Transaction().add({ + keys: [{ + pubkey: stakePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }); + } +} +StakeProgram.programId = new PublicKey('Stake11111111111111111111111111111111111111'); +/** + * Max space of a Stake account + * + * This is generated from the solana-stake-program StakeState struct as + * `StakeStateV2::size_of()`: + * https://docs.rs/solana-stake-program/latest/solana_stake_program/stake_state/enum.StakeStateV2.html + */ +StakeProgram.space = 200; + +/** + * Vote account info + */ +class VoteInit { + /** [0, 100] */ + + constructor(nodePubkey, authorizedVoter, authorizedWithdrawer, commission) { + this.nodePubkey = void 0; + this.authorizedVoter = void 0; + this.authorizedWithdrawer = void 0; + this.commission = void 0; + this.nodePubkey = nodePubkey; + this.authorizedVoter = authorizedVoter; + this.authorizedWithdrawer = authorizedWithdrawer; + this.commission = commission; + } +} + +/** + * Create vote account transaction params + */ + +/** + * InitializeAccount instruction params + */ + +/** + * Authorize instruction params + */ + +/** + * AuthorizeWithSeed instruction params + */ + +/** + * Withdraw from vote account transaction params + */ + +/** + * Update validator identity (node pubkey) vote account instruction params. + */ + +/** + * Vote Instruction class + */ +class VoteInstruction { + /** + * @internal + */ + constructor() {} + + /** + * Decode a vote instruction and retrieve the instruction type. + */ + static decodeInstructionType(instruction) { + this.checkProgramId(instruction.programId); + const instructionTypeLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'); + const typeIndex = instructionTypeLayout.decode(instruction.data); + let type; + for (const [ixType, layout] of Object.entries(VOTE_INSTRUCTION_LAYOUTS)) { + if (layout.index == typeIndex) { + type = ixType; + break; + } + } + if (!type) { + throw new Error('Instruction type incorrect; not a VoteInstruction'); + } + return type; + } + + /** + * Decode an initialize vote instruction and retrieve the instruction params. + */ + static decodeInitializeAccount(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 4); + const { + voteInit + } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.InitializeAccount, instruction.data); + return { + votePubkey: instruction.keys[0].pubkey, + nodePubkey: instruction.keys[3].pubkey, + voteInit: new VoteInit(new PublicKey(voteInit.nodePubkey), new PublicKey(voteInit.authorizedVoter), new PublicKey(voteInit.authorizedWithdrawer), voteInit.commission) + }; + } + + /** + * Decode an authorize instruction and retrieve the instruction params. + */ + static decodeAuthorize(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + newAuthorized, + voteAuthorizationType + } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Authorize, instruction.data); + return { + votePubkey: instruction.keys[0].pubkey, + authorizedPubkey: instruction.keys[2].pubkey, + newAuthorizedPubkey: new PublicKey(newAuthorized), + voteAuthorizationType: { + index: voteAuthorizationType + } + }; + } + + /** + * Decode an authorize instruction and retrieve the instruction params. + */ + static decodeAuthorizeWithSeed(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + voteAuthorizeWithSeedArgs: { + currentAuthorityDerivedKeyOwnerPubkey, + currentAuthorityDerivedKeySeed, + newAuthorized, + voteAuthorizationType + } + } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed, instruction.data); + return { + currentAuthorityDerivedKeyBasePubkey: instruction.keys[2].pubkey, + currentAuthorityDerivedKeyOwnerPubkey: new PublicKey(currentAuthorityDerivedKeyOwnerPubkey), + currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed, + newAuthorizedPubkey: new PublicKey(newAuthorized), + voteAuthorizationType: { + index: voteAuthorizationType + }, + votePubkey: instruction.keys[0].pubkey + }; + } + + /** + * Decode a withdraw instruction and retrieve the instruction params. + */ + static decodeWithdraw(instruction) { + this.checkProgramId(instruction.programId); + this.checkKeyLength(instruction.keys, 3); + const { + lamports + } = decodeData$1(VOTE_INSTRUCTION_LAYOUTS.Withdraw, instruction.data); + return { + votePubkey: instruction.keys[0].pubkey, + authorizedWithdrawerPubkey: instruction.keys[2].pubkey, + lamports, + toPubkey: instruction.keys[1].pubkey + }; + } + + /** + * @internal + */ + static checkProgramId(programId) { + if (!programId.equals(VoteProgram.programId)) { + throw new Error('invalid instruction; programId is not VoteProgram'); + } + } + + /** + * @internal + */ + static checkKeyLength(keys, expectedLength) { + if (keys.length < expectedLength) { + throw new Error(`invalid instruction; found ${keys.length} keys, expected at least ${expectedLength}`); + } + } +} + +/** + * An enumeration of valid VoteInstructionType's + */ + +/** @internal */ + +const VOTE_INSTRUCTION_LAYOUTS = Object.freeze({ + InitializeAccount: { + index: 0, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), voteInit()]) + }, + Authorize: { + index: 1, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), publicKey('newAuthorized'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('voteAuthorizationType')]) + }, + Withdraw: { + index: 3, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.ns64('lamports')]) + }, + UpdateValidatorIdentity: { + index: 4, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction')]) + }, + AuthorizeWithSeed: { + index: 10, + layout: _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('instruction'), voteAuthorizeWithSeedArgs()]) + } +}); + +/** + * VoteAuthorize type + */ + +/** + * An enumeration of valid VoteAuthorization layouts. + */ +const VoteAuthorizationLayout = Object.freeze({ + Voter: { + index: 0 + }, + Withdrawer: { + index: 1 + } +}); + +/** + * Factory class for transactions to interact with the Vote program + */ +class VoteProgram { + /** + * @internal + */ + constructor() {} + + /** + * Public key that identifies the Vote program + */ + + /** + * Generate an Initialize instruction. + */ + static initializeAccount(params) { + const { + votePubkey, + nodePubkey, + voteInit + } = params; + const type = VOTE_INSTRUCTION_LAYOUTS.InitializeAccount; + const data = encodeData(type, { + voteInit: { + nodePubkey: toBuffer(voteInit.nodePubkey.toBuffer()), + authorizedVoter: toBuffer(voteInit.authorizedVoter.toBuffer()), + authorizedWithdrawer: toBuffer(voteInit.authorizedWithdrawer.toBuffer()), + commission: voteInit.commission + } + }); + const instructionData = { + keys: [{ + pubkey: votePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_RENT_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: nodePubkey, + isSigner: true, + isWritable: false + }], + programId: this.programId, + data + }; + return new TransactionInstruction(instructionData); + } + + /** + * Generate a transaction that creates a new Vote account. + */ + static createAccount(params) { + const transaction = new Transaction(); + transaction.add(SystemProgram.createAccount({ + fromPubkey: params.fromPubkey, + newAccountPubkey: params.votePubkey, + lamports: params.lamports, + space: this.space, + programId: this.programId + })); + return transaction.add(this.initializeAccount({ + votePubkey: params.votePubkey, + nodePubkey: params.voteInit.nodePubkey, + voteInit: params.voteInit + })); + } + + /** + * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account. + */ + static authorize(params) { + const { + votePubkey, + authorizedPubkey, + newAuthorizedPubkey, + voteAuthorizationType + } = params; + const type = VOTE_INSTRUCTION_LAYOUTS.Authorize; + const data = encodeData(type, { + newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()), + voteAuthorizationType: voteAuthorizationType.index + }); + const keys = [{ + pubkey: votePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: authorizedPubkey, + isSigner: true, + isWritable: false + }]; + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction that authorizes a new Voter or Withdrawer on the Vote account + * where the current Voter or Withdrawer authority is a derived key. + */ + static authorizeWithSeed(params) { + const { + currentAuthorityDerivedKeyBasePubkey, + currentAuthorityDerivedKeyOwnerPubkey, + currentAuthorityDerivedKeySeed, + newAuthorizedPubkey, + voteAuthorizationType, + votePubkey + } = params; + const type = VOTE_INSTRUCTION_LAYOUTS.AuthorizeWithSeed; + const data = encodeData(type, { + voteAuthorizeWithSeedArgs: { + currentAuthorityDerivedKeyOwnerPubkey: toBuffer(currentAuthorityDerivedKeyOwnerPubkey.toBuffer()), + currentAuthorityDerivedKeySeed: currentAuthorityDerivedKeySeed, + newAuthorized: toBuffer(newAuthorizedPubkey.toBuffer()), + voteAuthorizationType: voteAuthorizationType.index + } + }); + const keys = [{ + pubkey: votePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: SYSVAR_CLOCK_PUBKEY, + isSigner: false, + isWritable: false + }, { + pubkey: currentAuthorityDerivedKeyBasePubkey, + isSigner: true, + isWritable: false + }]; + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction to withdraw from a Vote account. + */ + static withdraw(params) { + const { + votePubkey, + authorizedWithdrawerPubkey, + lamports, + toPubkey + } = params; + const type = VOTE_INSTRUCTION_LAYOUTS.Withdraw; + const data = encodeData(type, { + lamports + }); + const keys = [{ + pubkey: votePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: toPubkey, + isSigner: false, + isWritable: true + }, { + pubkey: authorizedWithdrawerPubkey, + isSigner: true, + isWritable: false + }]; + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } + + /** + * Generate a transaction to withdraw safely from a Vote account. + * + * This function was created as a safeguard for vote accounts running validators, `safeWithdraw` + * checks that the withdraw amount will not exceed the specified balance while leaving enough left + * to cover rent. If you wish to close the vote account by withdrawing the full amount, call the + * `withdraw` method directly. + */ + static safeWithdraw(params, currentVoteAccountBalance, rentExemptMinimum) { + if (params.lamports > currentVoteAccountBalance - rentExemptMinimum) { + throw new Error('Withdraw will leave vote account with insufficient funds.'); + } + return VoteProgram.withdraw(params); + } + + /** + * Generate a transaction to update the validator identity (node pubkey) of a Vote account. + */ + static updateValidatorIdentity(params) { + const { + votePubkey, + authorizedWithdrawerPubkey, + nodePubkey + } = params; + const type = VOTE_INSTRUCTION_LAYOUTS.UpdateValidatorIdentity; + const data = encodeData(type); + const keys = [{ + pubkey: votePubkey, + isSigner: false, + isWritable: true + }, { + pubkey: nodePubkey, + isSigner: true, + isWritable: false + }, { + pubkey: authorizedWithdrawerPubkey, + isSigner: true, + isWritable: false + }]; + return new Transaction().add({ + keys, + programId: this.programId, + data + }); + } +} +VoteProgram.programId = new PublicKey('Vote111111111111111111111111111111111111111'); +/** + * Max space of a Vote account + * + * This is generated from the solana-vote-program VoteState struct as + * `VoteState::size_of()`: + * https://docs.rs/solana-vote-program/1.9.5/solana_vote_program/vote_state/struct.VoteState.html#method.size_of + * + * KEEP IN SYNC WITH `VoteState::size_of()` in https://github.com/solana-labs/solana/blob/a474cb24b9238f5edcc982f65c0b37d4a1046f7e/sdk/program/src/vote/state/mod.rs#L340-L342 + */ +VoteProgram.space = 3762; + +const VALIDATOR_INFO_KEY = new PublicKey('Va1idator1nfo111111111111111111111111111111'); + +/** + * @internal + */ + +/** + * Info used to identity validators. + */ + +const InfoString = (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.type)({ + name: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)(), + website: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + details: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + iconUrl: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()), + keybaseUsername: (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.optional)((0,superstruct__WEBPACK_IMPORTED_MODULE_8__.string)()) +}); + +/** + * ValidatorInfo class + */ +class ValidatorInfo { + /** + * Construct a valid ValidatorInfo + * + * @param key validator public key + * @param info validator information + */ + constructor(key, info) { + /** + * validator public key + */ + this.key = void 0; + /** + * validator information + */ + this.info = void 0; + this.key = key; + this.info = info; + } + + /** + * Deserialize ValidatorInfo from the config account data. Exactly two config + * keys are required in the data. + * + * @param buffer config account data + * @return null if info was not found + */ + static fromConfigData(buffer) { + let byteArray = [...buffer]; + const configKeyCount = decodeLength(byteArray); + if (configKeyCount !== 2) return null; + const configKeys = []; + for (let i = 0; i < 2; i++) { + const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBLIC_KEY_LENGTH)); + const isSigner = guardedShift(byteArray) === 1; + configKeys.push({ + publicKey, + isSigner + }); + } + if (configKeys[0].publicKey.equals(VALIDATOR_INFO_KEY)) { + if (configKeys[1].isSigner) { + const rawInfo = rustString().decode(buffer__WEBPACK_IMPORTED_MODULE_0__.Buffer.from(byteArray)); + const info = JSON.parse(rawInfo); + (0,superstruct__WEBPACK_IMPORTED_MODULE_8__.assert)(info, InfoString); + return new ValidatorInfo(configKeys[1].publicKey, info); + } + } + return null; + } +} + +const VOTE_PROGRAM_ID = new PublicKey('Vote111111111111111111111111111111111111111'); + +/** + * History of how many credits earned by the end of each epoch + */ + +/** + * See https://github.com/solana-labs/solana/blob/8a12ed029cfa38d4a45400916c2463fb82bbec8c/programs/vote_api/src/vote_state.rs#L68-L88 + * + * @internal + */ +const VoteAccountLayout = _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([publicKey('nodePubkey'), publicKey('authorizedWithdrawer'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('commission'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64(), +// votes.length +_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('slot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32('confirmationCount')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'votes'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('rootSlotValid'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('rootSlot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64(), +// authorizedVoters.length +_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('epoch'), publicKey('authorizedVoter')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'authorizedVoters'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([publicKey('authorizedPubkey'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('epochOfLastAuthorizedSwitch'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('targetEpoch')]), 32, 'buf'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('idx'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u8('isEmpty')], 'priorVoters'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64(), +// epochCredits.length +_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.seq(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('epoch'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('credits'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('prevCredits')]), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.offset(_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.u32(), -8), 'epochCredits'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.struct([_solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('slot'), _solana_buffer_layout__WEBPACK_IMPORTED_MODULE_6__.nu64('timestamp')], 'lastTimestamp')]); +/** + * VoteAccount class + */ +class VoteAccount { + /** + * @internal + */ + constructor(args) { + 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 = args.nodePubkey; + this.authorizedWithdrawer = args.authorizedWithdrawer; + this.commission = args.commission; + this.rootSlot = args.rootSlot; + this.votes = args.votes; + this.authorizedVoters = args.authorizedVoters; + this.priorVoters = args.priorVoters; + this.epochCredits = args.epochCredits; + this.lastTimestamp = args.lastTimestamp; + } + + /** + * Deserialize VoteAccount from the account data. + * + * @param buffer account data + * @return VoteAccount + */ + static fromAccountData(buffer) { + const versionOffset = 4; + const va = VoteAccountLayout.decode(toBuffer(buffer), versionOffset); + let rootSlot = va.rootSlot; + if (!va.rootSlotValid) { + rootSlot = null; + } + return new VoteAccount({ + nodePubkey: new PublicKey(va.nodePubkey), + authorizedWithdrawer: new PublicKey(va.authorizedWithdrawer), + commission: va.commission, + votes: va.votes, + rootSlot, + authorizedVoters: va.authorizedVoters.map(parseAuthorizedVoter), + priorVoters: getPriorVoters(va.priorVoters), + epochCredits: va.epochCredits, + lastTimestamp: va.lastTimestamp + }); + } +} +function parseAuthorizedVoter({ + authorizedVoter, + epoch +}) { + return { + epoch, + authorizedVoter: new PublicKey(authorizedVoter) + }; +} +function parsePriorVoters({ + authorizedPubkey, + epochOfLastAuthorizedSwitch, + targetEpoch +}) { + return { + authorizedPubkey: new PublicKey(authorizedPubkey), + epochOfLastAuthorizedSwitch, + targetEpoch + }; +} +function getPriorVoters({ + buf, + idx, + isEmpty +}) { + if (isEmpty) { + return []; + } + return [...buf.slice(idx + 1).map(parsePriorVoters), ...buf.slice(0, idx).map(parsePriorVoters)]; +} + +const endpoint = { + 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/' + } +}; +/** + * Retrieves the RPC API URL for the specified cluster + * @param {Cluster} [cluster="devnet"] - The cluster name of the RPC API URL to use. Possible options: 'devnet' | 'testnet' | 'mainnet-beta' + * @param {boolean} [tls="http"] - Use TLS when connecting to cluster. + * + * @returns {string} URL string of the RPC endpoint + */ +function clusterApiUrl(cluster, tls) { + const key = tls === false ? 'http' : 'https'; + if (!cluster) { + return endpoint[key]['devnet']; + } + const url = endpoint[key][cluster]; + if (!url) { + throw new Error(`Unknown ${key} cluster: ${cluster}`); + } + return url; +} + +/** + * Send and confirm a raw transaction + * + * If `commitment` option is not specified, defaults to 'max' commitment. + * + * @param {Connection} connection + * @param {Buffer} rawTransaction + * @param {TransactionConfirmationStrategy} confirmationStrategy + * @param {ConfirmOptions} [options] + * @returns {Promise} + */ + +/** + * @deprecated Calling `sendAndConfirmRawTransaction()` without a `confirmationStrategy` + * is no longer supported and will be removed in a future version. + */ +// eslint-disable-next-line no-redeclare + +// eslint-disable-next-line no-redeclare +async function sendAndConfirmRawTransaction(connection, rawTransaction, confirmationStrategyOrConfirmOptions, maybeConfirmOptions) { + let confirmationStrategy; + let options; + if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'lastValidBlockHeight')) { + confirmationStrategy = confirmationStrategyOrConfirmOptions; + options = maybeConfirmOptions; + } else if (confirmationStrategyOrConfirmOptions && Object.prototype.hasOwnProperty.call(confirmationStrategyOrConfirmOptions, 'nonceValue')) { + confirmationStrategy = confirmationStrategyOrConfirmOptions; + options = maybeConfirmOptions; + } else { + options = confirmationStrategyOrConfirmOptions; + } + const sendOptions = options && { + skipPreflight: options.skipPreflight, + preflightCommitment: options.preflightCommitment || options.commitment, + minContextSlot: options.minContextSlot + }; + const signature = await connection.sendRawTransaction(rawTransaction, sendOptions); + const commitment = options && options.commitment; + const confirmationPromise = confirmationStrategy ? connection.confirmTransaction(confirmationStrategy, commitment) : connection.confirmTransaction(signature, commitment); + const status = (await confirmationPromise).value; + if (status.err) { + if (signature != null) { + throw new SendTransactionError({ + action: sendOptions?.skipPreflight ? 'send' : 'simulate', + signature: signature, + transactionMessage: `Status: (${JSON.stringify(status)})` + }); + } + throw new Error(`Raw transaction ${signature} failed (${JSON.stringify(status)})`); + } + return signature; +} + +/** + * There are 1-billion lamports in one SOL + */ +const LAMPORTS_PER_SOL = 1000000000; + + +//# sourceMappingURL=index.browser.esm.js.map + + +/***/ }), + +/***/ 31788: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/errors-browser.js ***! + \**************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; + + +/***/ }), + +/***/ 31840: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/process-nextick-args@2.0.1/node_modules/process-nextick-args/index.js ***! + \***************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} + +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } +} + + + +/***/ }), + +/***/ 32275: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/miller-rabin@4.0.1/node_modules/miller-rabin/lib/mr.js ***! + \************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var bn = __webpack_require__(/*! bn.js */ 27019); +var brorand = __webpack_require__(/*! brorand */ 1781); + +function MillerRabin(rand) { + this.rand = rand || new brorand.Rand(); +} +module.exports = MillerRabin; + +MillerRabin.create = function create(rand) { + return new MillerRabin(rand); +}; + +MillerRabin.prototype._randbelow = function _randbelow(n) { + var len = n.bitLength(); + var min_bytes = Math.ceil(len / 8); + + // Generage random bytes until a number less than n is found. + // This ensures that 0..n-1 have an equal probability of being selected. + do + var a = new bn(this.rand.generate(min_bytes)); + while (a.cmp(n) >= 0); + + return a; +}; + +MillerRabin.prototype._randrange = function _randrange(start, stop) { + // Generate a random number greater than or equal to start and less than stop. + var size = stop.sub(start); + return start.add(this._randbelow(size)); +}; + +MillerRabin.prototype.test = function test(n, k, cb) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + var prime = true; + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); + if (cb) + cb(a); + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return false; + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) + return false; + } + + return prime; +}; + +MillerRabin.prototype.getDivisor = function getDivisor(n, k) { + var len = n.bitLength(); + var red = bn.mont(n); + var rone = new bn(1).toRed(red); + + if (!k) + k = Math.max(1, (len / 48) | 0); + + // Find d and s, (n - 1) = (2 ^ s) * d; + var n1 = n.subn(1); + for (var s = 0; !n1.testn(s); s++) {} + var d = n.shrn(s); + + var rn1 = n1.toRed(red); + + for (; k > 0; k--) { + var a = this._randrange(new bn(2), n1); + + var g = n.gcd(a); + if (g.cmpn(1) !== 0) + return g; + + var x = a.toRed(red).redPow(d); + if (x.cmp(rone) === 0 || x.cmp(rn1) === 0) + continue; + + for (var i = 1; i < s; i++) { + x = x.redSqr(); + + if (x.cmp(rone) === 0) + return x.fromRed().subn(1).gcd(n); + if (x.cmp(rn1) === 0) + break; + } + + if (i === s) { + x = x.redSqr(); + return x.fromRed().subn(1).gcd(n); + } + } + + return false; +}; + + +/***/ }), + +/***/ 32511: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/1.js ***! + \**********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); +var common = __webpack_require__(/*! ../common */ 92660); +var shaCommon = __webpack_require__(/*! ./common */ 55479); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_5 = utils.sum32_5; +var ft_1 = shaCommon.ft_1; +var BlockHash = common.BlockHash; + +var sha1_K = [ + 0x5A827999, 0x6ED9EBA1, + 0x8F1BBCDC, 0xCA62C1D6 +]; + +function SHA1() { + if (!(this instanceof SHA1)) + return new SHA1(); + + BlockHash.call(this); + this.h = [ + 0x67452301, 0xefcdab89, 0x98badcfe, + 0x10325476, 0xc3d2e1f0 ]; + this.W = new Array(80); +} + +utils.inherits(SHA1, BlockHash); +module.exports = SHA1; + +SHA1.blockSize = 512; +SHA1.outSize = 160; +SHA1.hmacStrength = 80; +SHA1.padLength = 64; + +SHA1.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + + for(; i < W.length; i++) + W[i] = rotl32(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + + for (i = 0; i < W.length; i++) { + var s = ~~(i / 20); + var t = sum32_5(rotl32(a, 5), ft_1(s, b, c, d), e, W[i], sha1_K[s]); + e = d; + d = c; + c = rotl32(b, 30); + b = a; + a = t; + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); +}; + +SHA1.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + + +/***/ }), + +/***/ 32516: +/*!*********************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack@5.102.1_@swc+core@1.15.43_@swc+helpers@0.5.23__postcss@8.5.16_webpack-cli@5.1.4/node_modules/webpack/hot/emitter.js ***! + \*********************************************************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var EventEmitter = __webpack_require__(/*! events */ 43236); +module.exports = new EventEmitter(); + + +/***/ }), + +/***/ 32534: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/pvtsutils@1.3.6/node_modules/pvtsutils/build/index.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/*! + * MIT License + * + * Copyright (c) 2017-2024 Peculiar Ventures, LLC + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + */ + + + +const ARRAY_BUFFER_NAME = "[object ArrayBuffer]"; +class BufferSourceConverter { + static isArrayBuffer(data) { + return Object.prototype.toString.call(data) === ARRAY_BUFFER_NAME; + } + static toArrayBuffer(data) { + if (this.isArrayBuffer(data)) { + return data; + } + if (data.byteLength === data.buffer.byteLength) { + return data.buffer; + } + if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) { + return data.buffer; + } + return this.toUint8Array(data.buffer) + .slice(data.byteOffset, data.byteOffset + data.byteLength) + .buffer; + } + static toUint8Array(data) { + return this.toView(data, Uint8Array); + } + static toView(data, type) { + if (data.constructor === type) { + return data; + } + if (this.isArrayBuffer(data)) { + return new type(data); + } + if (this.isArrayBufferView(data)) { + return new type(data.buffer, data.byteOffset, data.byteLength); + } + throw new TypeError("The provided value is not of type '(ArrayBuffer or ArrayBufferView)'"); + } + static isBufferSource(data) { + return this.isArrayBufferView(data) + || this.isArrayBuffer(data); + } + static isArrayBufferView(data) { + return ArrayBuffer.isView(data) + || (data && this.isArrayBuffer(data.buffer)); + } + static isEqual(a, b) { + const aView = BufferSourceConverter.toUint8Array(a); + const bView = BufferSourceConverter.toUint8Array(b); + if (aView.length !== bView.byteLength) { + return false; + } + for (let i = 0; i < aView.length; i++) { + if (aView[i] !== bView[i]) { + return false; + } + } + return true; + } + static concat(...args) { + let buffers; + if (Array.isArray(args[0]) && !(args[1] instanceof Function)) { + buffers = args[0]; + } + else if (Array.isArray(args[0]) && args[1] instanceof Function) { + buffers = args[0]; + } + else { + if (args[args.length - 1] instanceof Function) { + buffers = args.slice(0, args.length - 1); + } + else { + buffers = args; + } + } + let size = 0; + for (const buffer of buffers) { + size += buffer.byteLength; + } + const res = new Uint8Array(size); + let offset = 0; + for (const buffer of buffers) { + const view = this.toUint8Array(buffer); + res.set(view, offset); + offset += view.length; + } + if (args[args.length - 1] instanceof Function) { + return this.toView(res, args[args.length - 1]); + } + return res.buffer; + } +} + +const STRING_TYPE = "string"; +const HEX_REGEX = /^[0-9a-f\s]+$/i; +const BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; +const BASE64URL_REGEX = /^[a-zA-Z0-9-_]+$/; +class Utf8Converter { + static fromString(text) { + const s = unescape(encodeURIComponent(text)); + const uintArray = new Uint8Array(s.length); + for (let i = 0; i < s.length; i++) { + uintArray[i] = s.charCodeAt(i); + } + return uintArray.buffer; + } + static toString(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let encodedString = ""; + for (let i = 0; i < buf.length; i++) { + encodedString += String.fromCharCode(buf[i]); + } + const decodedString = decodeURIComponent(escape(encodedString)); + return decodedString; + } +} +class Utf16Converter { + static toString(buffer, littleEndian = false) { + const arrayBuffer = BufferSourceConverter.toArrayBuffer(buffer); + const dataView = new DataView(arrayBuffer); + let res = ""; + for (let i = 0; i < arrayBuffer.byteLength; i += 2) { + const code = dataView.getUint16(i, littleEndian); + res += String.fromCharCode(code); + } + return res; + } + static fromString(text, littleEndian = false) { + const res = new ArrayBuffer(text.length * 2); + const dataView = new DataView(res); + for (let i = 0; i < text.length; i++) { + dataView.setUint16(i * 2, text.charCodeAt(i), littleEndian); + } + return res; + } +} +class Convert { + static isHex(data) { + return typeof data === STRING_TYPE + && HEX_REGEX.test(data); + } + static isBase64(data) { + return typeof data === STRING_TYPE + && BASE64_REGEX.test(data); + } + static isBase64Url(data) { + return typeof data === STRING_TYPE + && BASE64URL_REGEX.test(data); + } + static ToString(buffer, enc = "utf8") { + const buf = BufferSourceConverter.toUint8Array(buffer); + switch (enc.toLowerCase()) { + case "utf8": + return this.ToUtf8String(buf); + case "binary": + return this.ToBinary(buf); + case "hex": + return this.ToHex(buf); + case "base64": + return this.ToBase64(buf); + case "base64url": + return this.ToBase64Url(buf); + case "utf16le": + return Utf16Converter.toString(buf, true); + case "utf16": + case "utf16be": + return Utf16Converter.toString(buf); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static FromString(str, enc = "utf8") { + if (!str) { + return new ArrayBuffer(0); + } + switch (enc.toLowerCase()) { + case "utf8": + return this.FromUtf8String(str); + case "binary": + return this.FromBinary(str); + case "hex": + return this.FromHex(str); + case "base64": + return this.FromBase64(str); + case "base64url": + return this.FromBase64Url(str); + case "utf16le": + return Utf16Converter.fromString(str, true); + case "utf16": + case "utf16be": + return Utf16Converter.fromString(str); + default: + throw new Error(`Unknown type of encoding '${enc}'`); + } + } + static ToBase64(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + if (typeof btoa !== "undefined") { + const binary = this.ToString(buf, "binary"); + return btoa(binary); + } + else { + return Buffer.from(buf).toString("base64"); + } + } + static FromBase64(base64) { + const formatted = this.formatString(base64); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64(formatted)) { + throw new TypeError("Argument 'base64Text' is not Base64 encoded"); + } + if (typeof atob !== "undefined") { + return this.FromBinary(atob(formatted)); + } + else { + return new Uint8Array(Buffer.from(formatted, "base64")).buffer; + } + } + static FromBase64Url(base64url) { + const formatted = this.formatString(base64url); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isBase64Url(formatted)) { + throw new TypeError("Argument 'base64url' is not Base64Url encoded"); + } + return this.FromBase64(this.Base64Padding(formatted.replace(/\-/g, "+").replace(/\_/g, "/"))); + } + static ToBase64Url(data) { + return this.ToBase64(data).replace(/\+/g, "-").replace(/\//g, "_").replace(/\=/g, ""); + } + static FromUtf8String(text, encoding = Convert.DEFAULT_UTF8_ENCODING) { + switch (encoding) { + case "ascii": + return this.FromBinary(text); + case "utf8": + return Utf8Converter.fromString(text); + case "utf16": + case "utf16be": + return Utf16Converter.fromString(text); + case "utf16le": + case "usc2": + return Utf16Converter.fromString(text, true); + default: + throw new Error(`Unknown type of encoding '${encoding}'`); + } + } + static ToUtf8String(buffer, encoding = Convert.DEFAULT_UTF8_ENCODING) { + switch (encoding) { + case "ascii": + return this.ToBinary(buffer); + case "utf8": + return Utf8Converter.toString(buffer); + case "utf16": + case "utf16be": + return Utf16Converter.toString(buffer); + case "utf16le": + case "usc2": + return Utf16Converter.toString(buffer, true); + default: + throw new Error(`Unknown type of encoding '${encoding}'`); + } + } + static FromBinary(text) { + const stringLength = text.length; + const resultView = new Uint8Array(stringLength); + for (let i = 0; i < stringLength; i++) { + resultView[i] = text.charCodeAt(i); + } + return resultView.buffer; + } + static ToBinary(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let res = ""; + for (let i = 0; i < buf.length; i++) { + res += String.fromCharCode(buf[i]); + } + return res; + } + static ToHex(buffer) { + const buf = BufferSourceConverter.toUint8Array(buffer); + let result = ""; + const len = buf.length; + for (let i = 0; i < len; i++) { + const byte = buf[i]; + if (byte < 16) { + result += "0"; + } + result += byte.toString(16); + } + return result; + } + static FromHex(hexString) { + let formatted = this.formatString(hexString); + if (!formatted) { + return new ArrayBuffer(0); + } + if (!Convert.isHex(formatted)) { + throw new TypeError("Argument 'hexString' is not HEX encoded"); + } + if (formatted.length % 2) { + formatted = `0${formatted}`; + } + const res = new Uint8Array(formatted.length / 2); + for (let i = 0; i < formatted.length; i = i + 2) { + const c = formatted.slice(i, i + 2); + res[i / 2] = parseInt(c, 16); + } + return res.buffer; + } + static ToUtf16String(buffer, littleEndian = false) { + return Utf16Converter.toString(buffer, littleEndian); + } + static FromUtf16String(text, littleEndian = false) { + return Utf16Converter.fromString(text, littleEndian); + } + static Base64Padding(base64) { + const padCount = 4 - (base64.length % 4); + if (padCount < 4) { + for (let i = 0; i < padCount; i++) { + base64 += "="; + } + } + return base64; + } + static formatString(data) { + return (data === null || data === void 0 ? void 0 : data.replace(/[\n\r\t ]/g, "")) || ""; + } +} +Convert.DEFAULT_UTF8_ENCODING = "utf8"; + +function assign(target, ...sources) { + const res = arguments[0]; + for (let i = 1; i < arguments.length; i++) { + const obj = arguments[i]; + for (const prop in obj) { + res[prop] = obj[prop]; + } + } + return res; +} +function combine(...buf) { + const totalByteLength = buf.map((item) => item.byteLength).reduce((prev, cur) => prev + cur); + const res = new Uint8Array(totalByteLength); + let currentPos = 0; + buf.map((item) => new Uint8Array(item)).forEach((arr) => { + for (const item2 of arr) { + res[currentPos++] = item2; + } + }); + return res.buffer; +} +function isEqual(bytes1, bytes2) { + if (!(bytes1 && bytes2)) { + return false; + } + if (bytes1.byteLength !== bytes2.byteLength) { + return false; + } + const b1 = new Uint8Array(bytes1); + const b2 = new Uint8Array(bytes2); + for (let i = 0; i < bytes1.byteLength; i++) { + if (b1[i] !== b2[i]) { + return false; + } + } + return true; +} + +exports.BufferSourceConverter = BufferSourceConverter; +exports.Convert = Convert; +exports.assign = assign; +exports.combine = combine; +exports.isEqual = isEqual; + + +/***/ }), + +/***/ 32594: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/des.js@1.1.0/node_modules/des.js/lib/des/ede.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); +var inherits = __webpack_require__(/*! inherits */ 18628); + +var Cipher = __webpack_require__(/*! ./cipher */ 30499); +var DES = __webpack_require__(/*! ./des */ 3598); + +function EDEState(type, key) { + assert.equal(key.length, 24, 'Invalid key length'); + + var k1 = key.slice(0, 8); + var k2 = key.slice(8, 16); + var k3 = key.slice(16, 24); + + if (type === 'encrypt') { + this.ciphers = [ + DES.create({ type: 'encrypt', key: k1 }), + DES.create({ type: 'decrypt', key: k2 }), + DES.create({ type: 'encrypt', key: k3 }) + ]; + } else { + this.ciphers = [ + DES.create({ type: 'decrypt', key: k3 }), + DES.create({ type: 'encrypt', key: k2 }), + DES.create({ type: 'decrypt', key: k1 }) + ]; + } +} + +function EDE(options) { + Cipher.call(this, options); + + var state = new EDEState(this.type, this.options.key); + this._edeState = state; +} +inherits(EDE, Cipher); + +module.exports = EDE; + +EDE.create = function create(options) { + return new EDE(options); +}; + +EDE.prototype._update = function _update(inp, inOff, out, outOff) { + var state = this._edeState; + + state.ciphers[0]._update(inp, inOff, out, outOff); + state.ciphers[1]._update(out, outOff, out, outOff); + state.ciphers[2]._update(out, outOff, out, outOff); +}; + +EDE.prototype._pad = DES.prototype._pad; +EDE.prototype._unpad = DES.prototype._unpad; + + +/***/ }), + +/***/ 32659: +/*!********************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha.js ***! + \********************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +exports.sha1 = __webpack_require__(/*! ./sha/1 */ 32511); +exports.sha224 = __webpack_require__(/*! ./sha/224 */ 49780); +exports.sha256 = __webpack_require__(/*! ./sha/256 */ 33953); +exports.sha384 = __webpack_require__(/*! ./sha/384 */ 3029); +exports.sha512 = __webpack_require__(/*! ./sha/512 */ 18148); + + +/***/ }), + +/***/ 32786: +/*!***********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/encoding/toHex.js ***! + \***********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ boolToHex: () => (/* binding */ boolToHex), +/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex), +/* harmony export */ numberToHex: () => (/* binding */ numberToHex), +/* harmony export */ stringToHex: () => (/* binding */ stringToHex), +/* harmony export */ toHex: () => (/* binding */ toHex) +/* harmony export */ }); +/* harmony import */ var _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/encoding.js */ 15923); +/* harmony import */ var _data_pad_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/pad.js */ 89244); +/* harmony import */ var _fromHex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fromHex.js */ 58269); + + + +const hexes = /*#__PURE__*/ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, '0')); +/** + * Encodes a string, number, bigint, or ByteArray into a hex string + * + * - Docs: https://viem.sh/docs/utilities/toHex + * - Example: https://viem.sh/docs/utilities/toHex#usage + * + * @param value Value to encode. + * @param opts Options. + * @returns Hex value. + * + * @example + * import { toHex } from 'viem' + * const data = toHex('Hello world') + * // '0x48656c6c6f20776f726c6421' + * + * @example + * import { toHex } from 'viem' + * const data = toHex(420) + * // '0x1a4' + * + * @example + * import { toHex } from 'viem' + * const data = toHex('Hello world', { size: 32 }) + * // '0x48656c6c6f20776f726c64210000000000000000000000000000000000000000' + */ +function toHex(value, opts = {}) { + if (typeof value === 'number' || typeof value === 'bigint') + return numberToHex(value, opts); + if (typeof value === 'string') { + return stringToHex(value, opts); + } + if (typeof value === 'boolean') + return boolToHex(value, opts); + return bytesToHex(value, opts); +} +/** + * Encodes a boolean into a hex string + * + * - Docs: https://viem.sh/docs/utilities/toHex#booltohex + * + * @param value Value to encode. + * @param opts Options. + * @returns Hex value. + * + * @example + * import { boolToHex } from 'viem' + * const data = boolToHex(true) + * // '0x1' + * + * @example + * import { boolToHex } from 'viem' + * const data = boolToHex(false) + * // '0x0' + * + * @example + * import { boolToHex } from 'viem' + * const data = boolToHex(true, { size: 32 }) + * // '0x0000000000000000000000000000000000000000000000000000000000000001' + */ +function boolToHex(value, opts = {}) { + const hex = `0x${Number(value)}`; + if (typeof opts.size === 'number') { + (0,_fromHex_js__WEBPACK_IMPORTED_MODULE_2__.assertSize)(hex, { size: opts.size }); + return (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_1__.pad)(hex, { size: opts.size }); + } + return hex; +} +/** + * Encodes a bytes array into a hex string + * + * - Docs: https://viem.sh/docs/utilities/toHex#bytestohex + * + * @param value Value to encode. + * @param opts Options. + * @returns Hex value. + * + * @example + * import { bytesToHex } from 'viem' + * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]) + * // '0x48656c6c6f20576f726c6421' + * + * @example + * import { bytesToHex } from 'viem' + * const data = bytesToHex(Uint8Array.from([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]), { size: 32 }) + * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000' + */ +function bytesToHex(value, opts = {}) { + let string = ''; + for (let i = 0; i < value.length; i++) { + string += hexes[value[i]]; + } + const hex = `0x${string}`; + if (typeof opts.size === 'number') { + (0,_fromHex_js__WEBPACK_IMPORTED_MODULE_2__.assertSize)(hex, { size: opts.size }); + return (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_1__.pad)(hex, { dir: 'right', size: opts.size }); + } + return hex; +} +/** + * Encodes a number or bigint into a hex string + * + * - Docs: https://viem.sh/docs/utilities/toHex#numbertohex + * + * @param value Value to encode. + * @param opts Options. + * @returns Hex value. + * + * @example + * import { numberToHex } from 'viem' + * const data = numberToHex(420) + * // '0x1a4' + * + * @example + * import { numberToHex } from 'viem' + * const data = numberToHex(420, { size: 32 }) + * // '0x00000000000000000000000000000000000000000000000000000000000001a4' + */ +function numberToHex(value_, opts = {}) { + const { signed, size } = opts; + const value = BigInt(value_); + let maxValue; + if (size) { + if (signed) + maxValue = (1n << (BigInt(size) * 8n - 1n)) - 1n; + else + maxValue = 2n ** (BigInt(size) * 8n) - 1n; + } + else if (typeof value_ === 'number') { + maxValue = BigInt(Number.MAX_SAFE_INTEGER); + } + const minValue = typeof maxValue === 'bigint' && signed ? -maxValue - 1n : 0; + if ((maxValue && value > maxValue) || value < minValue) { + const suffix = typeof value_ === 'bigint' ? 'n' : ''; + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__.IntegerOutOfRangeError({ + max: maxValue ? `${maxValue}${suffix}` : undefined, + min: `${minValue}${suffix}`, + signed, + size, + value: `${value_}${suffix}`, + }); + } + const hex = `0x${(signed && value < 0 ? (1n << BigInt(size * 8)) + BigInt(value) : value).toString(16)}`; + if (size) + return (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_1__.pad)(hex, { size }); + return hex; +} +const encoder = /*#__PURE__*/ new TextEncoder(); +/** + * Encodes a UTF-8 string into a hex string + * + * - Docs: https://viem.sh/docs/utilities/toHex#stringtohex + * + * @param value Value to encode. + * @param opts Options. + * @returns Hex value. + * + * @example + * import { stringToHex } from 'viem' + * const data = stringToHex('Hello World!') + * // '0x48656c6c6f20576f726c6421' + * + * @example + * import { stringToHex } from 'viem' + * const data = stringToHex('Hello World!', { size: 32 }) + * // '0x48656c6c6f20576f726c64210000000000000000000000000000000000000000' + */ +function stringToHex(value_, opts = {}) { + const value = encoder.encode(value_); + return bytesToHex(value, opts); +} +//# sourceMappingURL=toHex.js.map + +/***/ }), + +/***/ 32788: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/certificate_issuer.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CertificateIssuer: () => (/* binding */ CertificateIssuer), +/* harmony export */ id_ce_certificateIssuer: () => (/* binding */ id_ce_certificateIssuer) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_names_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../general_names.js */ 68427); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var CertificateIssuer_1; + + + + +const id_ce_certificateIssuer = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_ce}.29`; +let CertificateIssuer = CertificateIssuer_1 = class CertificateIssuer extends _general_names_js__WEBPACK_IMPORTED_MODULE_2__.GeneralNames { + constructor(items) { + super(items); + Object.setPrototypeOf(this, CertificateIssuer_1.prototype); + } +}; +CertificateIssuer = CertificateIssuer_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], CertificateIssuer); + + + +/***/ }), + +/***/ 32794: +/*!*********************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/accounts/utils/signTransaction.js ***! + \*********************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ signTransaction: () => (/* binding */ signTransaction) +/* harmony export */ }); +/* harmony import */ var _utils_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/hash/keccak256.js */ 25878); +/* harmony import */ var _utils_transaction_serializeTransaction_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/transaction/serializeTransaction.js */ 99857); +/* harmony import */ var _sign_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./sign.js */ 63564); + + + +async function signTransaction(parameters) { + const { privateKey, transaction, serializer = _utils_transaction_serializeTransaction_js__WEBPACK_IMPORTED_MODULE_1__.serializeTransaction, } = parameters; + const signableTransaction = (() => { + // For EIP-4844 Transactions, we want to sign the transaction payload body (tx_payload_body) without the sidecars (ie. without the network wrapper). + // See: https://github.com/ethereum/EIPs/blob/e00f4daa66bd56e2dbd5f1d36d09fd613811a48b/EIPS/eip-4844.md#networking + if (transaction.type === 'eip4844') + return { + ...transaction, + sidecars: false, + }; + return transaction; + })(); + const signature = await (0,_sign_js__WEBPACK_IMPORTED_MODULE_2__.sign)({ + hash: (0,_utils_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_0__.keccak256)(await serializer(signableTransaction)), + privateKey, + }); + return (await serializer(transaction, signature)); +} +//# sourceMappingURL=signTransaction.js.map + +/***/ }), + +/***/ 33384: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/to-buffer@1.2.2/node_modules/to-buffer/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var isArray = __webpack_require__(/*! isarray */ 25344); +var typedArrayBuffer = __webpack_require__(/*! typed-array-buffer */ 41695); + +var isView = ArrayBuffer.isView || function isView(obj) { + try { + typedArrayBuffer(obj); + return true; + } catch (e) { + return false; + } +}; + +var useUint8Array = typeof Uint8Array !== 'undefined'; +var useArrayBuffer = typeof ArrayBuffer !== 'undefined' + && typeof Uint8Array !== 'undefined'; +var useFromArrayBuffer = useArrayBuffer && (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT); + +module.exports = function toBuffer(data, encoding) { + if (Buffer.isBuffer(data)) { + if (data.constructor && !('isBuffer' in data)) { + // probably a SlowBuffer + return Buffer.from(data); + } + return data; + } + + if (typeof data === 'string') { + return Buffer.from(data, encoding); + } + + /* + * Wrap any TypedArray instances and DataViews + * Makes sense only on engines with full TypedArray support -- let Buffer detect that + */ + if (useArrayBuffer && isView(data)) { + // Bug in Node.js <6.3.1, which treats this as out-of-bounds + if (data.byteLength === 0) { + return Buffer.alloc(0); + } + + // When Buffer is based on Uint8Array, we can just construct it from ArrayBuffer + if (useFromArrayBuffer) { + var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength); + /* + * Recheck result size, as offset/length doesn't work on Node.js <5.10 + * We just go to Uint8Array case if this fails + */ + if (res.byteLength === data.byteLength) { + return res; + } + } + + // Convert to Uint8Array bytes and then to Buffer + var uint8 = data instanceof Uint8Array ? data : new Uint8Array(data.buffer, data.byteOffset, data.byteLength); + var result = Buffer.from(uint8); + + /* + * Let's recheck that conversion succeeded + * We have .length but not .byteLength when useFromArrayBuffer is false + */ + if (result.length === data.byteLength) { + return result; + } + } + + /* + * Uint8Array in engines where Buffer.from might not work with ArrayBuffer, just copy over + * Doesn't make sense with other TypedArray instances + */ + if (useUint8Array && data instanceof Uint8Array) { + return Buffer.from(data); + } + + var isArr = isArray(data); + if (isArr) { + for (var i = 0; i < data.length; i += 1) { + var x = data[i]; + if ( + typeof x !== 'number' + || x < 0 + || x > 255 + || ~~x !== x // NaN and integer check + ) { + throw new RangeError('Array items must be numbers in the range 0-255.'); + } + } + } + + /* + * Old Buffer polyfill on an engine that doesn't have TypedArray support + * Also, this is from a different Buffer polyfill implementation then we have, as instanceof check failed + * Convert to our current Buffer implementation + */ + if ( + isArr || ( + Buffer.isBuffer(data) + && data.constructor + && typeof data.constructor.isBuffer === 'function' + && data.constructor.isBuffer(data) + ) + ) { + return Buffer.from(data); + } + + throw new TypeError('The "data" argument must be a string, an Array, a Buffer, a Uint8Array, or a DataView.'); +}; + + +/***/ }), + +/***/ 33654: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/range.js ***! + \*****************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./range')} */ +module.exports = RangeError; + + +/***/ }), + +/***/ 33852: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@solana+buffer-layout@4.0.1/node_modules/@solana/buffer-layout/lib/Layout.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/* The MIT License (MIT) + * + * Copyright 2015-2018 Peter A. Bigot + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ +/** + * Support for translating between Uint8Array instances and JavaScript + * native types. + * + * {@link module:Layout~Layout|Layout} is the basis of a class + * hierarchy that associates property names with sequences of encoded + * bytes. + * + * Layouts are supported for these scalar (numeric) types: + * * {@link module:Layout~UInt|Unsigned integers in little-endian + * format} with {@link module:Layout.u8|8-bit}, {@link + * module:Layout.u16|16-bit}, {@link module:Layout.u24|24-bit}, + * {@link module:Layout.u32|32-bit}, {@link + * module:Layout.u40|40-bit}, and {@link module:Layout.u48|48-bit} + * representation ranges; + * * {@link module:Layout~UIntBE|Unsigned integers in big-endian + * format} with {@link module:Layout.u16be|16-bit}, {@link + * module:Layout.u24be|24-bit}, {@link module:Layout.u32be|32-bit}, + * {@link module:Layout.u40be|40-bit}, and {@link + * module:Layout.u48be|48-bit} representation ranges; + * * {@link module:Layout~Int|Signed integers in little-endian + * format} with {@link module:Layout.s8|8-bit}, {@link + * module:Layout.s16|16-bit}, {@link module:Layout.s24|24-bit}, + * {@link module:Layout.s32|32-bit}, {@link + * module:Layout.s40|40-bit}, and {@link module:Layout.s48|48-bit} + * representation ranges; + * * {@link module:Layout~IntBE|Signed integers in big-endian format} + * with {@link module:Layout.s16be|16-bit}, {@link + * module:Layout.s24be|24-bit}, {@link module:Layout.s32be|32-bit}, + * {@link module:Layout.s40be|40-bit}, and {@link + * module:Layout.s48be|48-bit} representation ranges; + * * 64-bit integral values that decode to an exact (if magnitude is + * less than 2^53) or nearby integral Number in {@link + * module:Layout.nu64|unsigned little-endian}, {@link + * module:Layout.nu64be|unsigned big-endian}, {@link + * module:Layout.ns64|signed little-endian}, and {@link + * module:Layout.ns64be|unsigned big-endian} encodings; + * * 32-bit floating point values with {@link + * module:Layout.f32|little-endian} and {@link + * module:Layout.f32be|big-endian} representations; + * * 64-bit floating point values with {@link + * module:Layout.f64|little-endian} and {@link + * module:Layout.f64be|big-endian} representations; + * * {@link module:Layout.const|Constants} that take no space in the + * encoded expression. + * + * and for these aggregate types: + * * {@link module:Layout.seq|Sequence}s of instances of a {@link + * module:Layout~Layout|Layout}, with JavaScript representation as + * an Array and constant or data-dependent {@link + * module:Layout~Sequence#count|length}; + * * {@link module:Layout.struct|Structure}s that aggregate a + * heterogeneous sequence of {@link module:Layout~Layout|Layout} + * instances, with JavaScript representation as an Object; + * * {@link module:Layout.union|Union}s that support multiple {@link + * module:Layout~VariantLayout|variant layouts} over a fixed + * (padded) or variable (not padded) span of bytes, using an + * unsigned integer at the start of the data or a separate {@link + * module:Layout.unionLayoutDiscriminator|layout element} to + * determine which layout to use when interpreting the buffer + * contents; + * * {@link module:Layout.bits|BitStructure}s that contain a sequence + * of individual {@link + * module:Layout~BitStructure#addField|BitField}s packed into an 8, + * 16, 24, or 32-bit unsigned integer starting at the least- or + * most-significant bit; + * * {@link module:Layout.cstr|C strings} of varying length; + * * {@link module:Layout.blob|Blobs} of fixed- or variable-{@link + * module:Layout~Blob#length|length} raw data. + * + * All {@link module:Layout~Layout|Layout} instances are immutable + * after construction, to prevent internal state from becoming + * inconsistent. + * + * @local Layout + * @local ExternalLayout + * @local GreedyCount + * @local OffsetLayout + * @local UInt + * @local UIntBE + * @local Int + * @local IntBE + * @local NearUInt64 + * @local NearUInt64BE + * @local NearInt64 + * @local NearInt64BE + * @local Float + * @local FloatBE + * @local Double + * @local DoubleBE + * @local Sequence + * @local Structure + * @local UnionDiscriminator + * @local UnionLayoutDiscriminator + * @local Union + * @local VariantLayout + * @local BitStructure + * @local BitField + * @local Boolean + * @local Blob + * @local CString + * @local Constant + * @local bindConstructorLayout + * @module Layout + * @license MIT + * @author Peter A. Bigot + * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub} + */ + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.s16 = exports.s8 = exports.nu64be = exports.u48be = exports.u40be = exports.u32be = exports.u24be = exports.u16be = exports.nu64 = exports.u48 = exports.u40 = exports.u32 = exports.u24 = exports.u16 = exports.u8 = exports.offset = exports.greedy = exports.Constant = exports.UTF8 = exports.CString = exports.Blob = exports.Boolean = exports.BitField = exports.BitStructure = exports.VariantLayout = exports.Union = exports.UnionLayoutDiscriminator = exports.UnionDiscriminator = exports.Structure = exports.Sequence = exports.DoubleBE = exports.Double = exports.FloatBE = exports.Float = exports.NearInt64BE = exports.NearInt64 = exports.NearUInt64BE = exports.NearUInt64 = exports.IntBE = exports.Int = exports.UIntBE = exports.UInt = exports.OffsetLayout = exports.GreedyCount = exports.ExternalLayout = exports.bindConstructorLayout = exports.nameWithProperty = exports.Layout = exports.uint8ArrayToBuffer = exports.checkUint8Array = void 0; +exports.constant = exports.utf8 = exports.cstr = exports.blob = exports.unionLayoutDiscriminator = exports.union = exports.seq = exports.bits = exports.struct = exports.f64be = exports.f64 = exports.f32be = exports.f32 = exports.ns64be = exports.s48be = exports.s40be = exports.s32be = exports.s24be = exports.s16be = exports.ns64 = exports.s48 = exports.s40 = exports.s32 = exports.s24 = void 0; +const buffer_1 = __webpack_require__(/*! buffer */ 62266); +/* Check if a value is a Uint8Array. + * + * @ignore */ +function checkUint8Array(b) { + if (!(b instanceof Uint8Array)) { + throw new TypeError('b must be a Uint8Array'); + } +} +exports.checkUint8Array = checkUint8Array; +/* Create a Buffer instance from a Uint8Array. + * + * @ignore */ +function uint8ArrayToBuffer(b) { + checkUint8Array(b); + return buffer_1.Buffer.from(b.buffer, b.byteOffset, b.length); +} +exports.uint8ArrayToBuffer = uint8ArrayToBuffer; +/** + * Base class for layout objects. + * + * **NOTE** This is an abstract base class; you can create instances + * if it amuses you, but they won't support the {@link + * Layout#encode|encode} or {@link Layout#decode|decode} functions. + * + * @param {Number} span - Initializer for {@link Layout#span|span}. The + * parameter must be an integer; a negative value signifies that the + * span is {@link Layout#getSpan|value-specific}. + * + * @param {string} [property] - Initializer for {@link + * Layout#property|property}. + * + * @abstract + */ +class Layout { + constructor(span, property) { + if (!Number.isInteger(span)) { + throw new TypeError('span must be an integer'); + } + /** The span of the layout in bytes. + * + * Positive values are generally expected. + * + * Zero will only appear in {@link Constant}s and in {@link + * Sequence}s where the {@link Sequence#count|count} is zero. + * + * A negative value indicates that the span is value-specific, and + * must be obtained using {@link Layout#getSpan|getSpan}. */ + this.span = span; + /** The property name used when this layout is represented in an + * Object. + * + * Used only for layouts that {@link Layout#decode|decode} to Object + * instances. If left undefined the span of the unnamed layout will + * be treated as padding: it will not be mutated by {@link + * Layout#encode|encode} nor represented as a property in the + * decoded Object. */ + this.property = property; + } + /** Function to create an Object into which decoded properties will + * be written. + * + * Used only for layouts that {@link Layout#decode|decode} to Object + * instances, which means: + * * {@link Structure} + * * {@link Union} + * * {@link VariantLayout} + * * {@link BitStructure} + * + * If left undefined the JavaScript representation of these layouts + * will be Object instances. + * + * See {@link bindConstructorLayout}. + */ + makeDestinationObject() { + return {}; + } + /** + * Calculate the span of a specific instance of a layout. + * + * @param {Uint8Array} b - the buffer that contains an encoded instance. + * + * @param {Number} [offset] - the offset at which the encoded instance + * starts. If absent a zero offset is inferred. + * + * @return {Number} - the number of bytes covered by the layout + * instance. If this method is not overridden in a subclass the + * definition-time constant {@link Layout#span|span} will be + * returned. + * + * @throws {RangeError} - if the length of the value cannot be + * determined. + */ + getSpan(b, offset) { + if (0 > this.span) { + throw new RangeError('indeterminate span'); + } + return this.span; + } + /** + * Replicate the layout using a new property. + * + * This function must be used to get a structurally-equivalent layout + * with a different name since all {@link Layout} instances are + * immutable. + * + * **NOTE** This is a shallow copy. All fields except {@link + * Layout#property|property} are strictly equal to the origin layout. + * + * @param {String} property - the value for {@link + * Layout#property|property} in the replica. + * + * @returns {Layout} - the copy with {@link Layout#property|property} + * set to `property`. + */ + replicate(property) { + const rv = Object.create(this.constructor.prototype); + Object.assign(rv, this); + rv.property = property; + return rv; + } + /** + * Create an object from layout properties and an array of values. + * + * **NOTE** This function returns `undefined` if invoked on a layout + * that does not return its value as an Object. Objects are + * returned for things that are a {@link Structure}, which includes + * {@link VariantLayout|variant layouts} if they are structures, and + * excludes {@link Union}s. If you want this feature for a union + * you must use {@link Union.getVariant|getVariant} to select the + * desired layout. + * + * @param {Array} values - an array of values that correspond to the + * default order for properties. As with {@link Layout#decode|decode} + * layout elements that have no property name are skipped when + * iterating over the array values. Only the top-level properties are + * assigned; arguments are not assigned to properties of contained + * layouts. Any unused values are ignored. + * + * @return {(Object|undefined)} + */ + fromArray(values) { + return undefined; + } +} +exports.Layout = Layout; +/* Provide text that carries a name (such as for a function that will + * be throwing an error) annotated with the property of a given layout + * (such as one for which the value was unacceptable). + * + * @ignore */ +function nameWithProperty(name, lo) { + if (lo.property) { + return name + '[' + lo.property + ']'; + } + return name; +} +exports.nameWithProperty = nameWithProperty; +/** + * Augment a class so that instances can be encoded/decoded using a + * given layout. + * + * Calling this function couples `Class` with `layout` in several ways: + * + * * `Class.layout_` becomes a static member property equal to `layout`; + * * `layout.boundConstructor_` becomes a static member property equal + * to `Class`; + * * The {@link Layout#makeDestinationObject|makeDestinationObject()} + * property of `layout` is set to a function that returns a `new + * Class()`; + * * `Class.decode(b, offset)` becomes a static member function that + * delegates to {@link Layout#decode|layout.decode}. The + * synthesized function may be captured and extended. + * * `Class.prototype.encode(b, offset)` provides an instance member + * function that delegates to {@link Layout#encode|layout.encode} + * with `src` set to `this`. The synthesized function may be + * captured and extended, but when the extension is invoked `this` + * must be explicitly bound to the instance. + * + * @param {class} Class - a JavaScript class with a nullary + * constructor. + * + * @param {Layout} layout - the {@link Layout} instance used to encode + * instances of `Class`. + */ +// `Class` must be a constructor Function, but the assignment of a `layout_` property to it makes it difficult to type +// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types +function bindConstructorLayout(Class, layout) { + if ('function' !== typeof Class) { + throw new TypeError('Class must be constructor'); + } + if (Object.prototype.hasOwnProperty.call(Class, 'layout_')) { + throw new Error('Class is already bound to a layout'); + } + if (!(layout && (layout instanceof Layout))) { + throw new TypeError('layout must be a Layout'); + } + if (Object.prototype.hasOwnProperty.call(layout, 'boundConstructor_')) { + throw new Error('layout is already bound to a constructor'); + } + Class.layout_ = layout; + layout.boundConstructor_ = Class; + layout.makeDestinationObject = (() => new Class()); + Object.defineProperty(Class.prototype, 'encode', { + value(b, offset) { + return layout.encode(this, b, offset); + }, + writable: true, + }); + Object.defineProperty(Class, 'decode', { + value(b, offset) { + return layout.decode(b, offset); + }, + writable: true, + }); +} +exports.bindConstructorLayout = bindConstructorLayout; +/** + * An object that behaves like a layout but does not consume space + * within its containing layout. + * + * This is primarily used to obtain metadata about a member, such as a + * {@link OffsetLayout} that can provide data about a {@link + * Layout#getSpan|value-specific span}. + * + * **NOTE** This is an abstract base class; you can create instances + * if it amuses you, but they won't support {@link + * ExternalLayout#isCount|isCount} or other {@link Layout} functions. + * + * @param {Number} span - initializer for {@link Layout#span|span}. + * The parameter can range from 1 through 6. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @abstract + * @augments {Layout} + */ +class ExternalLayout extends Layout { + /** + * Return `true` iff the external layout decodes to an unsigned + * integer layout. + * + * In that case it can be used as the source of {@link + * Sequence#count|Sequence counts}, {@link Blob#length|Blob lengths}, + * or as {@link UnionLayoutDiscriminator#layout|external union + * discriminators}. + * + * @abstract + */ + isCount() { + throw new Error('ExternalLayout is abstract'); + } +} +exports.ExternalLayout = ExternalLayout; +/** + * An {@link ExternalLayout} that determines its {@link + * Layout#decode|value} based on offset into and length of the buffer + * on which it is invoked. + * + * *Factory*: {@link module:Layout.greedy|greedy} + * + * @param {Number} [elementSpan] - initializer for {@link + * GreedyCount#elementSpan|elementSpan}. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {ExternalLayout} + */ +class GreedyCount extends ExternalLayout { + constructor(elementSpan = 1, property) { + if ((!Number.isInteger(elementSpan)) || (0 >= elementSpan)) { + throw new TypeError('elementSpan must be a (positive) integer'); + } + super(-1, property); + /** The layout for individual elements of the sequence. The value + * must be a positive integer. If not provided, the value will be + * 1. */ + this.elementSpan = elementSpan; + } + /** @override */ + isCount() { + return true; + } + /** @override */ + decode(b, offset = 0) { + checkUint8Array(b); + const rem = b.length - offset; + return Math.floor(rem / this.elementSpan); + } + /** @override */ + encode(src, b, offset) { + return 0; + } +} +exports.GreedyCount = GreedyCount; +/** + * An {@link ExternalLayout} that supports accessing a {@link Layout} + * at a fixed offset from the start of another Layout. The offset may + * be before, within, or after the base layout. + * + * *Factory*: {@link module:Layout.offset|offset} + * + * @param {Layout} layout - initializer for {@link + * OffsetLayout#layout|layout}, modulo `property`. + * + * @param {Number} [offset] - Initializes {@link + * OffsetLayout#offset|offset}. Defaults to zero. + * + * @param {string} [property] - Optional new property name for a + * {@link Layout#replicate| replica} of `layout` to be used as {@link + * OffsetLayout#layout|layout}. If not provided the `layout` is used + * unchanged. + * + * @augments {Layout} + */ +class OffsetLayout extends ExternalLayout { + constructor(layout, offset = 0, property) { + if (!(layout instanceof Layout)) { + throw new TypeError('layout must be a Layout'); + } + if (!Number.isInteger(offset)) { + throw new TypeError('offset must be integer or undefined'); + } + super(layout.span, property || layout.property); + /** The subordinated layout. */ + this.layout = layout; + /** The location of {@link OffsetLayout#layout} relative to the + * start of another layout. + * + * The value may be positive or negative, but an error will thrown + * if at the point of use it goes outside the span of the Uint8Array + * being accessed. */ + this.offset = offset; + } + /** @override */ + isCount() { + return ((this.layout instanceof UInt) + || (this.layout instanceof UIntBE)); + } + /** @override */ + decode(b, offset = 0) { + return this.layout.decode(b, offset + this.offset); + } + /** @override */ + encode(src, b, offset = 0) { + return this.layout.encode(src, b, offset + this.offset); + } +} +exports.OffsetLayout = OffsetLayout; +/** + * Represent an unsigned integer in little-endian format. + * + * *Factory*: {@link module:Layout.u8|u8}, {@link + * module:Layout.u16|u16}, {@link module:Layout.u24|u24}, {@link + * module:Layout.u32|u32}, {@link module:Layout.u40|u40}, {@link + * module:Layout.u48|u48} + * + * @param {Number} span - initializer for {@link Layout#span|span}. + * The parameter can range from 1 through 6. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class UInt extends Layout { + constructor(span, property) { + super(span, property); + if (6 < this.span) { + throw new RangeError('span must not exceed 6 bytes'); + } + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readUIntLE(offset, this.span); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeUIntLE(src, offset, this.span); + return this.span; + } +} +exports.UInt = UInt; +/** + * Represent an unsigned integer in big-endian format. + * + * *Factory*: {@link module:Layout.u8be|u8be}, {@link + * module:Layout.u16be|u16be}, {@link module:Layout.u24be|u24be}, + * {@link module:Layout.u32be|u32be}, {@link + * module:Layout.u40be|u40be}, {@link module:Layout.u48be|u48be} + * + * @param {Number} span - initializer for {@link Layout#span|span}. + * The parameter can range from 1 through 6. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class UIntBE extends Layout { + constructor(span, property) { + super(span, property); + if (6 < this.span) { + throw new RangeError('span must not exceed 6 bytes'); + } + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readUIntBE(offset, this.span); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeUIntBE(src, offset, this.span); + return this.span; + } +} +exports.UIntBE = UIntBE; +/** + * Represent a signed integer in little-endian format. + * + * *Factory*: {@link module:Layout.s8|s8}, {@link + * module:Layout.s16|s16}, {@link module:Layout.s24|s24}, {@link + * module:Layout.s32|s32}, {@link module:Layout.s40|s40}, {@link + * module:Layout.s48|s48} + * + * @param {Number} span - initializer for {@link Layout#span|span}. + * The parameter can range from 1 through 6. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Int extends Layout { + constructor(span, property) { + super(span, property); + if (6 < this.span) { + throw new RangeError('span must not exceed 6 bytes'); + } + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readIntLE(offset, this.span); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeIntLE(src, offset, this.span); + return this.span; + } +} +exports.Int = Int; +/** + * Represent a signed integer in big-endian format. + * + * *Factory*: {@link module:Layout.s8be|s8be}, {@link + * module:Layout.s16be|s16be}, {@link module:Layout.s24be|s24be}, + * {@link module:Layout.s32be|s32be}, {@link + * module:Layout.s40be|s40be}, {@link module:Layout.s48be|s48be} + * + * @param {Number} span - initializer for {@link Layout#span|span}. + * The parameter can range from 1 through 6. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class IntBE extends Layout { + constructor(span, property) { + super(span, property); + if (6 < this.span) { + throw new RangeError('span must not exceed 6 bytes'); + } + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readIntBE(offset, this.span); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeIntBE(src, offset, this.span); + return this.span; + } +} +exports.IntBE = IntBE; +const V2E32 = Math.pow(2, 32); +/* True modulus high and low 32-bit words, where low word is always + * non-negative. */ +function divmodInt64(src) { + const hi32 = Math.floor(src / V2E32); + const lo32 = src - (hi32 * V2E32); + return { hi32, lo32 }; +} +/* Reconstruct Number from quotient and non-negative remainder */ +function roundedInt64(hi32, lo32) { + return hi32 * V2E32 + lo32; +} +/** + * Represent an unsigned 64-bit integer in little-endian format when + * encoded and as a near integral JavaScript Number when decoded. + * + * *Factory*: {@link module:Layout.nu64|nu64} + * + * **NOTE** Values with magnitude greater than 2^52 may not decode to + * the exact value of the encoded representation. + * + * @augments {Layout} + */ +class NearUInt64 extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + const buffer = uint8ArrayToBuffer(b); + const lo32 = buffer.readUInt32LE(offset); + const hi32 = buffer.readUInt32LE(offset + 4); + return roundedInt64(hi32, lo32); + } + /** @override */ + encode(src, b, offset = 0) { + const split = divmodInt64(src); + const buffer = uint8ArrayToBuffer(b); + buffer.writeUInt32LE(split.lo32, offset); + buffer.writeUInt32LE(split.hi32, offset + 4); + return 8; + } +} +exports.NearUInt64 = NearUInt64; +/** + * Represent an unsigned 64-bit integer in big-endian format when + * encoded and as a near integral JavaScript Number when decoded. + * + * *Factory*: {@link module:Layout.nu64be|nu64be} + * + * **NOTE** Values with magnitude greater than 2^52 may not decode to + * the exact value of the encoded representation. + * + * @augments {Layout} + */ +class NearUInt64BE extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + const buffer = uint8ArrayToBuffer(b); + const hi32 = buffer.readUInt32BE(offset); + const lo32 = buffer.readUInt32BE(offset + 4); + return roundedInt64(hi32, lo32); + } + /** @override */ + encode(src, b, offset = 0) { + const split = divmodInt64(src); + const buffer = uint8ArrayToBuffer(b); + buffer.writeUInt32BE(split.hi32, offset); + buffer.writeUInt32BE(split.lo32, offset + 4); + return 8; + } +} +exports.NearUInt64BE = NearUInt64BE; +/** + * Represent a signed 64-bit integer in little-endian format when + * encoded and as a near integral JavaScript Number when decoded. + * + * *Factory*: {@link module:Layout.ns64|ns64} + * + * **NOTE** Values with magnitude greater than 2^52 may not decode to + * the exact value of the encoded representation. + * + * @augments {Layout} + */ +class NearInt64 extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + const buffer = uint8ArrayToBuffer(b); + const lo32 = buffer.readUInt32LE(offset); + const hi32 = buffer.readInt32LE(offset + 4); + return roundedInt64(hi32, lo32); + } + /** @override */ + encode(src, b, offset = 0) { + const split = divmodInt64(src); + const buffer = uint8ArrayToBuffer(b); + buffer.writeUInt32LE(split.lo32, offset); + buffer.writeInt32LE(split.hi32, offset + 4); + return 8; + } +} +exports.NearInt64 = NearInt64; +/** + * Represent a signed 64-bit integer in big-endian format when + * encoded and as a near integral JavaScript Number when decoded. + * + * *Factory*: {@link module:Layout.ns64be|ns64be} + * + * **NOTE** Values with magnitude greater than 2^52 may not decode to + * the exact value of the encoded representation. + * + * @augments {Layout} + */ +class NearInt64BE extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + const buffer = uint8ArrayToBuffer(b); + const hi32 = buffer.readInt32BE(offset); + const lo32 = buffer.readUInt32BE(offset + 4); + return roundedInt64(hi32, lo32); + } + /** @override */ + encode(src, b, offset = 0) { + const split = divmodInt64(src); + const buffer = uint8ArrayToBuffer(b); + buffer.writeInt32BE(split.hi32, offset); + buffer.writeUInt32BE(split.lo32, offset + 4); + return 8; + } +} +exports.NearInt64BE = NearInt64BE; +/** + * Represent a 32-bit floating point number in little-endian format. + * + * *Factory*: {@link module:Layout.f32|f32} + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Float extends Layout { + constructor(property) { + super(4, property); + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readFloatLE(offset); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeFloatLE(src, offset); + return 4; + } +} +exports.Float = Float; +/** + * Represent a 32-bit floating point number in big-endian format. + * + * *Factory*: {@link module:Layout.f32be|f32be} + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class FloatBE extends Layout { + constructor(property) { + super(4, property); + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readFloatBE(offset); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeFloatBE(src, offset); + return 4; + } +} +exports.FloatBE = FloatBE; +/** + * Represent a 64-bit floating point number in little-endian format. + * + * *Factory*: {@link module:Layout.f64|f64} + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Double extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readDoubleLE(offset); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeDoubleLE(src, offset); + return 8; + } +} +exports.Double = Double; +/** + * Represent a 64-bit floating point number in big-endian format. + * + * *Factory*: {@link module:Layout.f64be|f64be} + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class DoubleBE extends Layout { + constructor(property) { + super(8, property); + } + /** @override */ + decode(b, offset = 0) { + return uint8ArrayToBuffer(b).readDoubleBE(offset); + } + /** @override */ + encode(src, b, offset = 0) { + uint8ArrayToBuffer(b).writeDoubleBE(src, offset); + return 8; + } +} +exports.DoubleBE = DoubleBE; +/** + * Represent a contiguous sequence of a specific layout as an Array. + * + * *Factory*: {@link module:Layout.seq|seq} + * + * @param {Layout} elementLayout - initializer for {@link + * Sequence#elementLayout|elementLayout}. + * + * @param {(Number|ExternalLayout)} count - initializer for {@link + * Sequence#count|count}. The parameter must be either a positive + * integer or an instance of {@link ExternalLayout}. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Sequence extends Layout { + constructor(elementLayout, count, property) { + if (!(elementLayout instanceof Layout)) { + throw new TypeError('elementLayout must be a Layout'); + } + if (!(((count instanceof ExternalLayout) && count.isCount()) + || (Number.isInteger(count) && (0 <= count)))) { + throw new TypeError('count must be non-negative integer ' + + 'or an unsigned integer ExternalLayout'); + } + let span = -1; + if ((!(count instanceof ExternalLayout)) + && (0 < elementLayout.span)) { + span = count * elementLayout.span; + } + super(span, property); + /** The layout for individual elements of the sequence. */ + this.elementLayout = elementLayout; + /** The number of elements in the sequence. + * + * This will be either a non-negative integer or an instance of + * {@link ExternalLayout} for which {@link + * ExternalLayout#isCount|isCount()} is `true`. */ + this.count = count; + } + /** @override */ + getSpan(b, offset = 0) { + if (0 <= this.span) { + return this.span; + } + let span = 0; + let count = this.count; + if (count instanceof ExternalLayout) { + count = count.decode(b, offset); + } + if (0 < this.elementLayout.span) { + span = count * this.elementLayout.span; + } + else { + let idx = 0; + while (idx < count) { + span += this.elementLayout.getSpan(b, offset + span); + ++idx; + } + } + return span; + } + /** @override */ + decode(b, offset = 0) { + const rv = []; + let i = 0; + let count = this.count; + if (count instanceof ExternalLayout) { + count = count.decode(b, offset); + } + while (i < count) { + rv.push(this.elementLayout.decode(b, offset)); + offset += this.elementLayout.getSpan(b, offset); + i += 1; + } + return rv; + } + /** Implement {@link Layout#encode|encode} for {@link Sequence}. + * + * **NOTE** If `src` is shorter than {@link Sequence#count|count} then + * the unused space in the buffer is left unchanged. If `src` is + * longer than {@link Sequence#count|count} the unneeded elements are + * ignored. + * + * **NOTE** If {@link Layout#count|count} is an instance of {@link + * ExternalLayout} then the length of `src` will be encoded as the + * count after `src` is encoded. */ + encode(src, b, offset = 0) { + const elo = this.elementLayout; + const span = src.reduce((span, v) => { + return span + elo.encode(v, b, offset + span); + }, 0); + if (this.count instanceof ExternalLayout) { + this.count.encode(src.length, b, offset); + } + return span; + } +} +exports.Sequence = Sequence; +/** + * Represent a contiguous sequence of arbitrary layout elements as an + * Object. + * + * *Factory*: {@link module:Layout.struct|struct} + * + * **NOTE** The {@link Layout#span|span} of the structure is variable + * if any layout in {@link Structure#fields|fields} has a variable + * span. When {@link Layout#encode|encoding} we must have a value for + * all variable-length fields, or we wouldn't be able to figure out + * how much space to use for storage. We can only identify the value + * for a field when it has a {@link Layout#property|property}. As + * such, although a structure may contain both unnamed fields and + * variable-length fields, it cannot contain an unnamed + * variable-length field. + * + * @param {Layout[]} fields - initializer for {@link + * Structure#fields|fields}. An error is raised if this contains a + * variable-length field for which a {@link Layout#property|property} + * is not defined. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @param {Boolean} [decodePrefixes] - initializer for {@link + * Structure#decodePrefixes|property}. + * + * @throws {Error} - if `fields` contains an unnamed variable-length + * layout. + * + * @augments {Layout} + */ +class Structure extends Layout { + constructor(fields, property, decodePrefixes) { + if (!(Array.isArray(fields) + && fields.reduce((acc, v) => acc && (v instanceof Layout), true))) { + throw new TypeError('fields must be array of Layout instances'); + } + if (('boolean' === typeof property) + && (undefined === decodePrefixes)) { + decodePrefixes = property; + property = undefined; + } + /* Verify absence of unnamed variable-length fields. */ + for (const fd of fields) { + if ((0 > fd.span) + && (undefined === fd.property)) { + throw new Error('fields cannot contain unnamed variable-length layout'); + } + } + let span = -1; + try { + span = fields.reduce((span, fd) => span + fd.getSpan(), 0); + } + catch (e) { + // ignore error + } + super(span, property); + /** The sequence of {@link Layout} values that comprise the + * structure. + * + * The individual elements need not be the same type, and may be + * either scalar or aggregate layouts. If a member layout leaves + * its {@link Layout#property|property} undefined the + * corresponding region of the buffer associated with the element + * will not be mutated. + * + * @type {Layout[]} */ + this.fields = fields; + /** Control behavior of {@link Layout#decode|decode()} given short + * buffers. + * + * In some situations a structure many be extended with additional + * fields over time, with older installations providing only a + * prefix of the full structure. If this property is `true` + * decoding will accept those buffers and leave subsequent fields + * undefined, as long as the buffer ends at a field boundary. + * Defaults to `false`. */ + this.decodePrefixes = !!decodePrefixes; + } + /** @override */ + getSpan(b, offset = 0) { + if (0 <= this.span) { + return this.span; + } + let span = 0; + try { + span = this.fields.reduce((span, fd) => { + const fsp = fd.getSpan(b, offset); + offset += fsp; + return span + fsp; + }, 0); + } + catch (e) { + throw new RangeError('indeterminate span'); + } + return span; + } + /** @override */ + decode(b, offset = 0) { + checkUint8Array(b); + const dest = this.makeDestinationObject(); + for (const fd of this.fields) { + if (undefined !== fd.property) { + dest[fd.property] = fd.decode(b, offset); + } + offset += fd.getSpan(b, offset); + if (this.decodePrefixes + && (b.length === offset)) { + break; + } + } + return dest; + } + /** Implement {@link Layout#encode|encode} for {@link Structure}. + * + * If `src` is missing a property for a member with a defined {@link + * Layout#property|property} the corresponding region of the buffer is + * left unmodified. */ + encode(src, b, offset = 0) { + const firstOffset = offset; + let lastOffset = 0; + let lastWrote = 0; + for (const fd of this.fields) { + let span = fd.span; + lastWrote = (0 < span) ? span : 0; + if (undefined !== fd.property) { + const fv = src[fd.property]; + if (undefined !== fv) { + lastWrote = fd.encode(fv, b, offset); + if (0 > span) { + /* Read the as-encoded span, which is not necessarily the + * same as what we wrote. */ + span = fd.getSpan(b, offset); + } + } + } + lastOffset = offset; + offset += span; + } + /* Use (lastOffset + lastWrote) instead of offset because the last + * item may have had a dynamic length and we don't want to include + * the padding between it and the end of the space reserved for + * it. */ + return (lastOffset + lastWrote) - firstOffset; + } + /** @override */ + fromArray(values) { + const dest = this.makeDestinationObject(); + for (const fd of this.fields) { + if ((undefined !== fd.property) + && (0 < values.length)) { + dest[fd.property] = values.shift(); + } + } + return dest; + } + /** + * Get access to the layout of a given property. + * + * @param {String} property - the structure member of interest. + * + * @return {Layout} - the layout associated with `property`, or + * undefined if there is no such property. + */ + layoutFor(property) { + if ('string' !== typeof property) { + throw new TypeError('property must be string'); + } + for (const fd of this.fields) { + if (fd.property === property) { + return fd; + } + } + return undefined; + } + /** + * Get the offset of a structure member. + * + * @param {String} property - the structure member of interest. + * + * @return {Number} - the offset in bytes to the start of `property` + * within the structure, or undefined if `property` is not a field + * within the structure. If the property is a member but follows a + * variable-length structure member a negative number will be + * returned. + */ + offsetOf(property) { + if ('string' !== typeof property) { + throw new TypeError('property must be string'); + } + let offset = 0; + for (const fd of this.fields) { + if (fd.property === property) { + return offset; + } + if (0 > fd.span) { + offset = -1; + } + else if (0 <= offset) { + offset += fd.span; + } + } + return undefined; + } +} +exports.Structure = Structure; +/** + * An object that can provide a {@link + * Union#discriminator|discriminator} API for {@link Union}. + * + * **NOTE** This is an abstract base class; you can create instances + * if it amuses you, but they won't support the {@link + * UnionDiscriminator#encode|encode} or {@link + * UnionDiscriminator#decode|decode} functions. + * + * @param {string} [property] - Default for {@link + * UnionDiscriminator#property|property}. + * + * @abstract + */ +class UnionDiscriminator { + constructor(property) { + /** The {@link Layout#property|property} to be used when the + * discriminator is referenced in isolation (generally when {@link + * Union#decode|Union decode} cannot delegate to a specific + * variant). */ + this.property = property; + } + /** Analog to {@link Layout#decode|Layout decode} for union discriminators. + * + * The implementation of this method need not reference the buffer if + * variant information is available through other means. */ + decode(b, offset) { + throw new Error('UnionDiscriminator is abstract'); + } + /** Analog to {@link Layout#decode|Layout encode} for union discriminators. + * + * The implementation of this method need not store the value if + * variant information is maintained through other means. */ + encode(src, b, offset) { + throw new Error('UnionDiscriminator is abstract'); + } +} +exports.UnionDiscriminator = UnionDiscriminator; +/** + * An object that can provide a {@link + * UnionDiscriminator|discriminator API} for {@link Union} using an + * unsigned integral {@link Layout} instance located either inside or + * outside the union. + * + * @param {ExternalLayout} layout - initializes {@link + * UnionLayoutDiscriminator#layout|layout}. Must satisfy {@link + * ExternalLayout#isCount|isCount()}. + * + * @param {string} [property] - Default for {@link + * UnionDiscriminator#property|property}, superseding the property + * from `layout`, but defaulting to `variant` if neither `property` + * nor layout provide a property name. + * + * @augments {UnionDiscriminator} + */ +class UnionLayoutDiscriminator extends UnionDiscriminator { + constructor(layout, property) { + if (!((layout instanceof ExternalLayout) + && layout.isCount())) { + throw new TypeError('layout must be an unsigned integer ExternalLayout'); + } + super(property || layout.property || 'variant'); + /** The {@link ExternalLayout} used to access the discriminator + * value. */ + this.layout = layout; + } + /** Delegate decoding to {@link UnionLayoutDiscriminator#layout|layout}. */ + decode(b, offset) { + return this.layout.decode(b, offset); + } + /** Delegate encoding to {@link UnionLayoutDiscriminator#layout|layout}. */ + encode(src, b, offset) { + return this.layout.encode(src, b, offset); + } +} +exports.UnionLayoutDiscriminator = UnionLayoutDiscriminator; +/** + * Represent any number of span-compatible layouts. + * + * *Factory*: {@link module:Layout.union|union} + * + * If the union has a {@link Union#defaultLayout|default layout} that + * layout must have a non-negative {@link Layout#span|span}. The span + * of a fixed-span union includes its {@link + * Union#discriminator|discriminator} if the variant is a {@link + * Union#usesPrefixDiscriminator|prefix of the union}, plus the span + * of its {@link Union#defaultLayout|default layout}. + * + * If the union does not have a default layout then the encoded span + * of the union depends on the encoded span of its variant (which may + * be fixed or variable). + * + * {@link VariantLayout#layout|Variant layout}s are added through + * {@link Union#addVariant|addVariant}. If the union has a default + * layout, the span of the {@link VariantLayout#layout|layout + * contained by the variant} must not exceed the span of the {@link + * Union#defaultLayout|default layout} (minus the span of a {@link + * Union#usesPrefixDiscriminator|prefix disriminator}, if used). The + * span of the variant will equal the span of the union itself. + * + * The variant for a buffer can only be identified from the {@link + * Union#discriminator|discriminator} {@link + * UnionDiscriminator#property|property} (in the case of the {@link + * Union#defaultLayout|default layout}), or by using {@link + * Union#getVariant|getVariant} and examining the resulting {@link + * VariantLayout} instance. + * + * A variant compatible with a JavaScript object can be identified + * using {@link Union#getSourceVariant|getSourceVariant}. + * + * @param {(UnionDiscriminator|ExternalLayout|Layout)} discr - How to + * identify the layout used to interpret the union contents. The + * parameter must be an instance of {@link UnionDiscriminator}, an + * {@link ExternalLayout} that satisfies {@link + * ExternalLayout#isCount|isCount()}, or {@link UInt} (or {@link + * UIntBE}). When a non-external layout element is passed the layout + * appears at the start of the union. In all cases the (synthesized) + * {@link UnionDiscriminator} instance is recorded as {@link + * Union#discriminator|discriminator}. + * + * @param {(Layout|null)} defaultLayout - initializer for {@link + * Union#defaultLayout|defaultLayout}. If absent defaults to `null`. + * If `null` there is no default layout: the union has data-dependent + * length and attempts to decode or encode unrecognized variants will + * throw an exception. A {@link Layout} instance must have a + * non-negative {@link Layout#span|span}, and if it lacks a {@link + * Layout#property|property} the {@link + * Union#defaultLayout|defaultLayout} will be a {@link + * Layout#replicate|replica} with property `content`. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Union extends Layout { + constructor(discr, defaultLayout, property) { + let discriminator; + if ((discr instanceof UInt) + || (discr instanceof UIntBE)) { + discriminator = new UnionLayoutDiscriminator(new OffsetLayout(discr)); + } + else if ((discr instanceof ExternalLayout) + && discr.isCount()) { + discriminator = new UnionLayoutDiscriminator(discr); + } + else if (!(discr instanceof UnionDiscriminator)) { + throw new TypeError('discr must be a UnionDiscriminator ' + + 'or an unsigned integer layout'); + } + else { + discriminator = discr; + } + if (undefined === defaultLayout) { + defaultLayout = null; + } + if (!((null === defaultLayout) + || (defaultLayout instanceof Layout))) { + throw new TypeError('defaultLayout must be null or a Layout'); + } + if (null !== defaultLayout) { + if (0 > defaultLayout.span) { + throw new Error('defaultLayout must have constant span'); + } + if (undefined === defaultLayout.property) { + defaultLayout = defaultLayout.replicate('content'); + } + } + /* The union span can be estimated only if there's a default + * layout. The union spans its default layout, plus any prefix + * variant layout. By construction both layouts, if present, have + * non-negative span. */ + let span = -1; + if (defaultLayout) { + span = defaultLayout.span; + if ((0 <= span) && ((discr instanceof UInt) + || (discr instanceof UIntBE))) { + span += discriminator.layout.span; + } + } + super(span, property); + /** The interface for the discriminator value in isolation. + * + * This a {@link UnionDiscriminator} either passed to the + * constructor or synthesized from the `discr` constructor + * argument. {@link + * Union#usesPrefixDiscriminator|usesPrefixDiscriminator} will be + * `true` iff the `discr` parameter was a non-offset {@link + * Layout} instance. */ + this.discriminator = discriminator; + /** `true` if the {@link Union#discriminator|discriminator} is the + * first field in the union. + * + * If `false` the discriminator is obtained from somewhere + * else. */ + this.usesPrefixDiscriminator = (discr instanceof UInt) + || (discr instanceof UIntBE); + /** The layout for non-discriminator content when the value of the + * discriminator is not recognized. + * + * This is the value passed to the constructor. It is + * structurally equivalent to the second component of {@link + * Union#layout|layout} but may have a different property + * name. */ + this.defaultLayout = defaultLayout; + /** A registry of allowed variants. + * + * The keys are unsigned integers which should be compatible with + * {@link Union.discriminator|discriminator}. The property value + * is the corresponding {@link VariantLayout} instances assigned + * to this union by {@link Union#addVariant|addVariant}. + * + * **NOTE** The registry remains mutable so that variants can be + * {@link Union#addVariant|added} at any time. Users should not + * manipulate the content of this property. */ + this.registry = {}; + /* Private variable used when invoking getSourceVariant */ + let boundGetSourceVariant = this.defaultGetSourceVariant.bind(this); + /** Function to infer the variant selected by a source object. + * + * Defaults to {@link + * Union#defaultGetSourceVariant|defaultGetSourceVariant} but may + * be overridden using {@link + * Union#configGetSourceVariant|configGetSourceVariant}. + * + * @param {Object} src - as with {@link + * Union#defaultGetSourceVariant|defaultGetSourceVariant}. + * + * @returns {(undefined|VariantLayout)} The default variant + * (`undefined`) or first registered variant that uses a property + * available in `src`. */ + this.getSourceVariant = function (src) { + return boundGetSourceVariant(src); + }; + /** Function to override the implementation of {@link + * Union#getSourceVariant|getSourceVariant}. + * + * Use this if the desired variant cannot be identified using the + * algorithm of {@link + * Union#defaultGetSourceVariant|defaultGetSourceVariant}. + * + * **NOTE** The provided function will be invoked bound to this + * Union instance, providing local access to {@link + * Union#registry|registry}. + * + * @param {Function} gsv - a function that follows the API of + * {@link Union#defaultGetSourceVariant|defaultGetSourceVariant}. */ + this.configGetSourceVariant = function (gsv) { + boundGetSourceVariant = gsv.bind(this); + }; + } + /** @override */ + getSpan(b, offset = 0) { + if (0 <= this.span) { + return this.span; + } + /* Default layouts always have non-negative span, so we don't have + * one and we have to recognize the variant which will in turn + * determine the span. */ + const vlo = this.getVariant(b, offset); + if (!vlo) { + throw new Error('unable to determine span for unrecognized variant'); + } + return vlo.getSpan(b, offset); + } + /** + * Method to infer a registered Union variant compatible with `src`. + * + * The first satisfied rule in the following sequence defines the + * return value: + * * If `src` has properties matching the Union discriminator and + * the default layout, `undefined` is returned regardless of the + * value of the discriminator property (this ensures the default + * layout will be used); + * * If `src` has a property matching the Union discriminator, the + * value of the discriminator identifies a registered variant, and + * either (a) the variant has no layout, or (b) `src` has the + * variant's property, then the variant is returned (because the + * source satisfies the constraints of the variant it identifies); + * * If `src` does not have a property matching the Union + * discriminator, but does have a property matching a registered + * variant, then the variant is returned (because the source + * matches a variant without an explicit conflict); + * * An error is thrown (because we either can't identify a variant, + * or we were explicitly told the variant but can't satisfy it). + * + * @param {Object} src - an object presumed to be compatible with + * the content of the Union. + * + * @return {(undefined|VariantLayout)} - as described above. + * + * @throws {Error} - if `src` cannot be associated with a default or + * registered variant. + */ + defaultGetSourceVariant(src) { + if (Object.prototype.hasOwnProperty.call(src, this.discriminator.property)) { + if (this.defaultLayout && this.defaultLayout.property + && Object.prototype.hasOwnProperty.call(src, this.defaultLayout.property)) { + return undefined; + } + const vlo = this.registry[src[this.discriminator.property]]; + if (vlo + && ((!vlo.layout) + || (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)))) { + return vlo; + } + } + else { + for (const tag in this.registry) { + const vlo = this.registry[tag]; + if (vlo.property && Object.prototype.hasOwnProperty.call(src, vlo.property)) { + return vlo; + } + } + } + throw new Error('unable to infer src variant'); + } + /** Implement {@link Layout#decode|decode} for {@link Union}. + * + * If the variant is {@link Union#addVariant|registered} the return + * value is an instance of that variant, with no explicit + * discriminator. Otherwise the {@link Union#defaultLayout|default + * layout} is used to decode the content. */ + decode(b, offset = 0) { + let dest; + const dlo = this.discriminator; + const discr = dlo.decode(b, offset); + const clo = this.registry[discr]; + if (undefined === clo) { + const defaultLayout = this.defaultLayout; + let contentOffset = 0; + if (this.usesPrefixDiscriminator) { + contentOffset = dlo.layout.span; + } + dest = this.makeDestinationObject(); + dest[dlo.property] = discr; + // defaultLayout.property can be undefined, but this is allowed by buffer-layout + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + dest[defaultLayout.property] = defaultLayout.decode(b, offset + contentOffset); + } + else { + dest = clo.decode(b, offset); + } + return dest; + } + /** Implement {@link Layout#encode|encode} for {@link Union}. + * + * This API assumes the `src` object is consistent with the union's + * {@link Union#defaultLayout|default layout}. To encode variants + * use the appropriate variant-specific {@link VariantLayout#encode} + * method. */ + encode(src, b, offset = 0) { + const vlo = this.getSourceVariant(src); + if (undefined === vlo) { + const dlo = this.discriminator; + // this.defaultLayout is not undefined when vlo is undefined + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const clo = this.defaultLayout; + let contentOffset = 0; + if (this.usesPrefixDiscriminator) { + contentOffset = dlo.layout.span; + } + dlo.encode(src[dlo.property], b, offset); + // clo.property is not undefined when vlo is undefined + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return contentOffset + clo.encode(src[clo.property], b, offset + contentOffset); + } + return vlo.encode(src, b, offset); + } + /** Register a new variant structure within a union. The newly + * created variant is returned. + * + * @param {Number} variant - initializer for {@link + * VariantLayout#variant|variant}. + * + * @param {Layout} layout - initializer for {@link + * VariantLayout#layout|layout}. + * + * @param {String} property - initializer for {@link + * Layout#property|property}. + * + * @return {VariantLayout} */ + addVariant(variant, layout, property) { + const rv = new VariantLayout(this, variant, layout, property); + this.registry[variant] = rv; + return rv; + } + /** + * Get the layout associated with a registered variant. + * + * If `vb` does not produce a registered variant the function returns + * `undefined`. + * + * @param {(Number|Uint8Array)} vb - either the variant number, or a + * buffer from which the discriminator is to be read. + * + * @param {Number} offset - offset into `vb` for the start of the + * union. Used only when `vb` is an instance of {Uint8Array}. + * + * @return {({VariantLayout}|undefined)} + */ + getVariant(vb, offset = 0) { + let variant; + if (vb instanceof Uint8Array) { + variant = this.discriminator.decode(vb, offset); + } + else { + variant = vb; + } + return this.registry[variant]; + } +} +exports.Union = Union; +/** + * Represent a specific variant within a containing union. + * + * **NOTE** The {@link Layout#span|span} of the variant may include + * the span of the {@link Union#discriminator|discriminator} used to + * identify it, but values read and written using the variant strictly + * conform to the content of {@link VariantLayout#layout|layout}. + * + * **NOTE** User code should not invoke this constructor directly. Use + * the union {@link Union#addVariant|addVariant} helper method. + * + * @param {Union} union - initializer for {@link + * VariantLayout#union|union}. + * + * @param {Number} variant - initializer for {@link + * VariantLayout#variant|variant}. + * + * @param {Layout} [layout] - initializer for {@link + * VariantLayout#layout|layout}. If absent the variant carries no + * data. + * + * @param {String} [property] - initializer for {@link + * Layout#property|property}. Unlike many other layouts, variant + * layouts normally include a property name so they can be identified + * within their containing {@link Union}. The property identifier may + * be absent only if `layout` is is absent. + * + * @augments {Layout} + */ +class VariantLayout extends Layout { + constructor(union, variant, layout, property) { + if (!(union instanceof Union)) { + throw new TypeError('union must be a Union'); + } + if ((!Number.isInteger(variant)) || (0 > variant)) { + throw new TypeError('variant must be a (non-negative) integer'); + } + if (('string' === typeof layout) + && (undefined === property)) { + property = layout; + layout = null; + } + if (layout) { + if (!(layout instanceof Layout)) { + throw new TypeError('layout must be a Layout'); + } + if ((null !== union.defaultLayout) + && (0 <= layout.span) + && (layout.span > union.defaultLayout.span)) { + throw new Error('variant span exceeds span of containing union'); + } + if ('string' !== typeof property) { + throw new TypeError('variant must have a String property'); + } + } + let span = union.span; + if (0 > union.span) { + span = layout ? layout.span : 0; + if ((0 <= span) && union.usesPrefixDiscriminator) { + span += union.discriminator.layout.span; + } + } + super(span, property); + /** The {@link Union} to which this variant belongs. */ + this.union = union; + /** The unsigned integral value identifying this variant within + * the {@link Union#discriminator|discriminator} of the containing + * union. */ + this.variant = variant; + /** The {@link Layout} to be used when reading/writing the + * non-discriminator part of the {@link + * VariantLayout#union|union}. If `null` the variant carries no + * data. */ + this.layout = layout || null; + } + /** @override */ + getSpan(b, offset = 0) { + if (0 <= this.span) { + /* Will be equal to the containing union span if that is not + * variable. */ + return this.span; + } + let contentOffset = 0; + if (this.union.usesPrefixDiscriminator) { + contentOffset = this.union.discriminator.layout.span; + } + /* Span is defined solely by the variant (and prefix discriminator) */ + let span = 0; + if (this.layout) { + span = this.layout.getSpan(b, offset + contentOffset); + } + return contentOffset + span; + } + /** @override */ + decode(b, offset = 0) { + const dest = this.makeDestinationObject(); + if (this !== this.union.getVariant(b, offset)) { + throw new Error('variant mismatch'); + } + let contentOffset = 0; + if (this.union.usesPrefixDiscriminator) { + contentOffset = this.union.discriminator.layout.span; + } + if (this.layout) { + dest[this.property] = this.layout.decode(b, offset + contentOffset); + } + else if (this.property) { + dest[this.property] = true; + } + else if (this.union.usesPrefixDiscriminator) { + dest[this.union.discriminator.property] = this.variant; + } + return dest; + } + /** @override */ + encode(src, b, offset = 0) { + let contentOffset = 0; + if (this.union.usesPrefixDiscriminator) { + contentOffset = this.union.discriminator.layout.span; + } + if (this.layout + && (!Object.prototype.hasOwnProperty.call(src, this.property))) { + throw new TypeError('variant lacks property ' + this.property); + } + this.union.discriminator.encode(this.variant, b, offset); + let span = contentOffset; + if (this.layout) { + this.layout.encode(src[this.property], b, offset + contentOffset); + span += this.layout.getSpan(b, offset + contentOffset); + if ((0 <= this.union.span) + && (span > this.union.span)) { + throw new Error('encoded variant overruns containing union'); + } + } + return span; + } + /** Delegate {@link Layout#fromArray|fromArray} to {@link + * VariantLayout#layout|layout}. */ + fromArray(values) { + if (this.layout) { + return this.layout.fromArray(values); + } + return undefined; + } +} +exports.VariantLayout = VariantLayout; +/** JavaScript chose to define bitwise operations as operating on + * signed 32-bit values in 2's complement form, meaning any integer + * with bit 31 set is going to look negative. For right shifts that's + * not a problem, because `>>>` is a logical shift, but for every + * other bitwise operator we have to compensate for possible negative + * results. */ +function fixBitwiseResult(v) { + if (0 > v) { + v += 0x100000000; + } + return v; +} +/** + * Contain a sequence of bit fields as an unsigned integer. + * + * *Factory*: {@link module:Layout.bits|bits} + * + * This is a container element; within it there are {@link BitField} + * instances that provide the extracted properties. The container + * simply defines the aggregate representation and its bit ordering. + * The representation is an object containing properties with numeric + * or {@link Boolean} values. + * + * {@link BitField}s are added with the {@link + * BitStructure#addField|addField} and {@link + * BitStructure#addBoolean|addBoolean} methods. + + * @param {Layout} word - initializer for {@link + * BitStructure#word|word}. The parameter must be an instance of + * {@link UInt} (or {@link UIntBE}) that is no more than 4 bytes wide. + * + * @param {bool} [msb] - `true` if the bit numbering starts at the + * most significant bit of the containing word; `false` (default) if + * it starts at the least significant bit of the containing word. If + * the parameter at this position is a string and `property` is + * `undefined` the value of this argument will instead be used as the + * value of `property`. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class BitStructure extends Layout { + constructor(word, msb, property) { + if (!((word instanceof UInt) + || (word instanceof UIntBE))) { + throw new TypeError('word must be a UInt or UIntBE layout'); + } + if (('string' === typeof msb) + && (undefined === property)) { + property = msb; + msb = false; + } + if (4 < word.span) { + throw new RangeError('word cannot exceed 32 bits'); + } + super(word.span, property); + /** The layout used for the packed value. {@link BitField} + * instances are packed sequentially depending on {@link + * BitStructure#msb|msb}. */ + this.word = word; + /** Whether the bit sequences are packed starting at the most + * significant bit growing down (`true`), or the least significant + * bit growing up (`false`). + * + * **NOTE** Regardless of this value, the least significant bit of + * any {@link BitField} value is the least significant bit of the + * corresponding section of the packed value. */ + this.msb = !!msb; + /** The sequence of {@link BitField} layouts that comprise the + * packed structure. + * + * **NOTE** The array remains mutable to allow fields to be {@link + * BitStructure#addField|added} after construction. Users should + * not manipulate the content of this property.*/ + this.fields = []; + /* Storage for the value. Capture a variable instead of using an + * instance property because we don't want anything to change the + * value without going through the mutator. */ + let value = 0; + this._packedSetValue = function (v) { + value = fixBitwiseResult(v); + return this; + }; + this._packedGetValue = function () { + return value; + }; + } + /** @override */ + decode(b, offset = 0) { + const dest = this.makeDestinationObject(); + const value = this.word.decode(b, offset); + this._packedSetValue(value); + for (const fd of this.fields) { + if (undefined !== fd.property) { + dest[fd.property] = fd.decode(b); + } + } + return dest; + } + /** Implement {@link Layout#encode|encode} for {@link BitStructure}. + * + * If `src` is missing a property for a member with a defined {@link + * Layout#property|property} the corresponding region of the packed + * value is left unmodified. Unused bits are also left unmodified. */ + encode(src, b, offset = 0) { + const value = this.word.decode(b, offset); + this._packedSetValue(value); + for (const fd of this.fields) { + if (undefined !== fd.property) { + const fv = src[fd.property]; + if (undefined !== fv) { + fd.encode(fv); + } + } + } + return this.word.encode(this._packedGetValue(), b, offset); + } + /** Register a new bitfield with a containing bit structure. The + * resulting bitfield is returned. + * + * @param {Number} bits - initializer for {@link BitField#bits|bits}. + * + * @param {string} property - initializer for {@link + * Layout#property|property}. + * + * @return {BitField} */ + addField(bits, property) { + const bf = new BitField(this, bits, property); + this.fields.push(bf); + return bf; + } + /** As with {@link BitStructure#addField|addField} for single-bit + * fields with `boolean` value representation. + * + * @param {string} property - initializer for {@link + * Layout#property|property}. + * + * @return {Boolean} */ + // `Boolean` conflicts with the native primitive type + // eslint-disable-next-line @typescript-eslint/ban-types + addBoolean(property) { + // This is my Boolean, not the Javascript one. + const bf = new Boolean(this, property); + this.fields.push(bf); + return bf; + } + /** + * Get access to the bit field for a given property. + * + * @param {String} property - the bit field of interest. + * + * @return {BitField} - the field associated with `property`, or + * undefined if there is no such property. + */ + fieldFor(property) { + if ('string' !== typeof property) { + throw new TypeError('property must be string'); + } + for (const fd of this.fields) { + if (fd.property === property) { + return fd; + } + } + return undefined; + } +} +exports.BitStructure = BitStructure; +/** + * Represent a sequence of bits within a {@link BitStructure}. + * + * All bit field values are represented as unsigned integers. + * + * **NOTE** User code should not invoke this constructor directly. + * Use the container {@link BitStructure#addField|addField} helper + * method. + * + * **NOTE** BitField instances are not instances of {@link Layout} + * since {@link Layout#span|span} measures 8-bit units. + * + * @param {BitStructure} container - initializer for {@link + * BitField#container|container}. + * + * @param {Number} bits - initializer for {@link BitField#bits|bits}. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + */ +class BitField { + constructor(container, bits, property) { + if (!(container instanceof BitStructure)) { + throw new TypeError('container must be a BitStructure'); + } + if ((!Number.isInteger(bits)) || (0 >= bits)) { + throw new TypeError('bits must be positive integer'); + } + const totalBits = 8 * container.span; + const usedBits = container.fields.reduce((sum, fd) => sum + fd.bits, 0); + if ((bits + usedBits) > totalBits) { + throw new Error('bits too long for span remainder (' + + (totalBits - usedBits) + ' of ' + + totalBits + ' remain)'); + } + /** The {@link BitStructure} instance to which this bit field + * belongs. */ + this.container = container; + /** The span of this value in bits. */ + this.bits = bits; + /** A mask of {@link BitField#bits|bits} bits isolating value bits + * that fit within the field. + * + * That is, it masks a value that has not yet been shifted into + * position within its containing packed integer. */ + this.valueMask = (1 << bits) - 1; + if (32 === bits) { // shifted value out of range + this.valueMask = 0xFFFFFFFF; + } + /** The offset of the value within the containing packed unsigned + * integer. The least significant bit of the packed value is at + * offset zero, regardless of bit ordering used. */ + this.start = usedBits; + if (this.container.msb) { + this.start = totalBits - usedBits - bits; + } + /** A mask of {@link BitField#bits|bits} isolating the field value + * within the containing packed unsigned integer. */ + this.wordMask = fixBitwiseResult(this.valueMask << this.start); + /** The property name used when this bitfield is represented in an + * Object. + * + * Intended to be functionally equivalent to {@link + * Layout#property}. + * + * If left undefined the corresponding span of bits will be + * treated as padding: it will not be mutated by {@link + * Layout#encode|encode} nor represented as a property in the + * decoded Object. */ + this.property = property; + } + /** Store a value into the corresponding subsequence of the containing + * bit field. */ + decode(b, offset) { + const word = this.container._packedGetValue(); + const wordValue = fixBitwiseResult(word & this.wordMask); + const value = wordValue >>> this.start; + return value; + } + /** Store a value into the corresponding subsequence of the containing + * bit field. + * + * **NOTE** This is not a specialization of {@link + * Layout#encode|Layout.encode} and there is no return value. */ + encode(value) { + if ('number' !== typeof value + || !Number.isInteger(value) + || (value !== fixBitwiseResult(value & this.valueMask))) { + throw new TypeError(nameWithProperty('BitField.encode', this) + + ' value must be integer not exceeding ' + this.valueMask); + } + const word = this.container._packedGetValue(); + const wordValue = fixBitwiseResult(value << this.start); + this.container._packedSetValue(fixBitwiseResult(word & ~this.wordMask) + | wordValue); + } +} +exports.BitField = BitField; +/** + * Represent a single bit within a {@link BitStructure} as a + * JavaScript boolean. + * + * **NOTE** User code should not invoke this constructor directly. + * Use the container {@link BitStructure#addBoolean|addBoolean} helper + * method. + * + * @param {BitStructure} container - initializer for {@link + * BitField#container|container}. + * + * @param {string} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {BitField} + */ +/* eslint-disable no-extend-native */ +class Boolean extends BitField { + constructor(container, property) { + super(container, 1, property); + } + /** Override {@link BitField#decode|decode} for {@link Boolean|Boolean}. + * + * @returns {boolean} */ + decode(b, offset) { + return !!super.decode(b, offset); + } + /** @override */ + encode(value) { + if ('boolean' === typeof value) { + // BitField requires integer values + value = +value; + } + super.encode(value); + } +} +exports.Boolean = Boolean; +/* eslint-enable no-extend-native */ +/** + * Contain a fixed-length block of arbitrary data, represented as a + * Uint8Array. + * + * *Factory*: {@link module:Layout.blob|blob} + * + * @param {(Number|ExternalLayout)} length - initializes {@link + * Blob#length|length}. + * + * @param {String} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Blob extends Layout { + constructor(length, property) { + if (!(((length instanceof ExternalLayout) && length.isCount()) + || (Number.isInteger(length) && (0 <= length)))) { + throw new TypeError('length must be positive integer ' + + 'or an unsigned integer ExternalLayout'); + } + let span = -1; + if (!(length instanceof ExternalLayout)) { + span = length; + } + super(span, property); + /** The number of bytes in the blob. + * + * This may be a non-negative integer, or an instance of {@link + * ExternalLayout} that satisfies {@link + * ExternalLayout#isCount|isCount()}. */ + this.length = length; + } + /** @override */ + getSpan(b, offset) { + let span = this.span; + if (0 > span) { + span = this.length.decode(b, offset); + } + return span; + } + /** @override */ + decode(b, offset = 0) { + let span = this.span; + if (0 > span) { + span = this.length.decode(b, offset); + } + return uint8ArrayToBuffer(b).slice(offset, offset + span); + } + /** Implement {@link Layout#encode|encode} for {@link Blob}. + * + * **NOTE** If {@link Layout#count|count} is an instance of {@link + * ExternalLayout} then the length of `src` will be encoded as the + * count after `src` is encoded. */ + encode(src, b, offset) { + let span = this.length; + if (this.length instanceof ExternalLayout) { + span = src.length; + } + if (!(src instanceof Uint8Array && span === src.length)) { + throw new TypeError(nameWithProperty('Blob.encode', this) + + ' requires (length ' + span + ') Uint8Array as src'); + } + if ((offset + span) > b.length) { + throw new RangeError('encoding overruns Uint8Array'); + } + const srcBuffer = uint8ArrayToBuffer(src); + uint8ArrayToBuffer(b).write(srcBuffer.toString('hex'), offset, span, 'hex'); + if (this.length instanceof ExternalLayout) { + this.length.encode(span, b, offset); + } + return span; + } +} +exports.Blob = Blob; +/** + * Contain a `NUL`-terminated UTF8 string. + * + * *Factory*: {@link module:Layout.cstr|cstr} + * + * **NOTE** Any UTF8 string that incorporates a zero-valued byte will + * not be correctly decoded by this layout. + * + * @param {String} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class CString extends Layout { + constructor(property) { + super(-1, property); + } + /** @override */ + getSpan(b, offset = 0) { + checkUint8Array(b); + let idx = offset; + while ((idx < b.length) && (0 !== b[idx])) { + idx += 1; + } + return 1 + idx - offset; + } + /** @override */ + decode(b, offset = 0) { + const span = this.getSpan(b, offset); + return uint8ArrayToBuffer(b).slice(offset, offset + span - 1).toString('utf-8'); + } + /** @override */ + encode(src, b, offset = 0) { + /* Must force this to a string, lest it be a number and the + * "utf8-encoding" below actually allocate a buffer of length + * src */ + if ('string' !== typeof src) { + src = String(src); + } + const srcb = buffer_1.Buffer.from(src, 'utf8'); + const span = srcb.length; + if ((offset + span) > b.length) { + throw new RangeError('encoding overruns Buffer'); + } + const buffer = uint8ArrayToBuffer(b); + srcb.copy(buffer, offset); + buffer[offset + span] = 0; + return span + 1; + } +} +exports.CString = CString; +/** + * Contain a UTF8 string with implicit length. + * + * *Factory*: {@link module:Layout.utf8|utf8} + * + * **NOTE** Because the length is implicit in the size of the buffer + * this layout should be used only in isolation, or in a situation + * where the length can be expressed by operating on a slice of the + * containing buffer. + * + * @param {Number} [maxSpan] - the maximum length allowed for encoded + * string content. If not provided there is no bound on the allowed + * content. + * + * @param {String} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class UTF8 extends Layout { + constructor(maxSpan, property) { + if (('string' === typeof maxSpan) && (undefined === property)) { + property = maxSpan; + maxSpan = undefined; + } + if (undefined === maxSpan) { + maxSpan = -1; + } + else if (!Number.isInteger(maxSpan)) { + throw new TypeError('maxSpan must be an integer'); + } + super(-1, property); + /** The maximum span of the layout in bytes. + * + * Positive values are generally expected. Zero is abnormal. + * Attempts to encode or decode a value that exceeds this length + * will throw a `RangeError`. + * + * A negative value indicates that there is no bound on the length + * of the content. */ + this.maxSpan = maxSpan; + } + /** @override */ + getSpan(b, offset = 0) { + checkUint8Array(b); + return b.length - offset; + } + /** @override */ + decode(b, offset = 0) { + const span = this.getSpan(b, offset); + if ((0 <= this.maxSpan) + && (this.maxSpan < span)) { + throw new RangeError('text length exceeds maxSpan'); + } + return uint8ArrayToBuffer(b).slice(offset, offset + span).toString('utf-8'); + } + /** @override */ + encode(src, b, offset = 0) { + /* Must force this to a string, lest it be a number and the + * "utf8-encoding" below actually allocate a buffer of length + * src */ + if ('string' !== typeof src) { + src = String(src); + } + const srcb = buffer_1.Buffer.from(src, 'utf8'); + const span = srcb.length; + if ((0 <= this.maxSpan) + && (this.maxSpan < span)) { + throw new RangeError('text length exceeds maxSpan'); + } + if ((offset + span) > b.length) { + throw new RangeError('encoding overruns Buffer'); + } + srcb.copy(uint8ArrayToBuffer(b), offset); + return span; + } +} +exports.UTF8 = UTF8; +/** + * Contain a constant value. + * + * This layout may be used in cases where a JavaScript value can be + * inferred without an expression in the binary encoding. An example + * would be a {@link VariantLayout|variant layout} where the content + * is implied by the union {@link Union#discriminator|discriminator}. + * + * @param {Object|Number|String} value - initializer for {@link + * Constant#value|value}. If the value is an object (or array) and + * the application intends the object to remain unchanged regardless + * of what is done to values decoded by this layout, the value should + * be frozen prior passing it to this constructor. + * + * @param {String} [property] - initializer for {@link + * Layout#property|property}. + * + * @augments {Layout} + */ +class Constant extends Layout { + constructor(value, property) { + super(0, property); + /** The value produced by this constant when the layout is {@link + * Constant#decode|decoded}. + * + * Any JavaScript value including `null` and `undefined` is + * permitted. + * + * **WARNING** If `value` passed in the constructor was not + * frozen, it is possible for users of decoded values to change + * the content of the value. */ + this.value = value; + } + /** @override */ + decode(b, offset) { + return this.value; + } + /** @override */ + encode(src, b, offset) { + /* Constants take no space */ + return 0; + } +} +exports.Constant = Constant; +/** Factory for {@link GreedyCount}. */ +exports.greedy = ((elementSpan, property) => new GreedyCount(elementSpan, property)); +/** Factory for {@link OffsetLayout}. */ +exports.offset = ((layout, offset, property) => new OffsetLayout(layout, offset, property)); +/** Factory for {@link UInt|unsigned int layouts} spanning one + * byte. */ +exports.u8 = ((property) => new UInt(1, property)); +/** Factory for {@link UInt|little-endian unsigned int layouts} + * spanning two bytes. */ +exports.u16 = ((property) => new UInt(2, property)); +/** Factory for {@link UInt|little-endian unsigned int layouts} + * spanning three bytes. */ +exports.u24 = ((property) => new UInt(3, property)); +/** Factory for {@link UInt|little-endian unsigned int layouts} + * spanning four bytes. */ +exports.u32 = ((property) => new UInt(4, property)); +/** Factory for {@link UInt|little-endian unsigned int layouts} + * spanning five bytes. */ +exports.u40 = ((property) => new UInt(5, property)); +/** Factory for {@link UInt|little-endian unsigned int layouts} + * spanning six bytes. */ +exports.u48 = ((property) => new UInt(6, property)); +/** Factory for {@link NearUInt64|little-endian unsigned int + * layouts} interpreted as Numbers. */ +exports.nu64 = ((property) => new NearUInt64(property)); +/** Factory for {@link UInt|big-endian unsigned int layouts} + * spanning two bytes. */ +exports.u16be = ((property) => new UIntBE(2, property)); +/** Factory for {@link UInt|big-endian unsigned int layouts} + * spanning three bytes. */ +exports.u24be = ((property) => new UIntBE(3, property)); +/** Factory for {@link UInt|big-endian unsigned int layouts} + * spanning four bytes. */ +exports.u32be = ((property) => new UIntBE(4, property)); +/** Factory for {@link UInt|big-endian unsigned int layouts} + * spanning five bytes. */ +exports.u40be = ((property) => new UIntBE(5, property)); +/** Factory for {@link UInt|big-endian unsigned int layouts} + * spanning six bytes. */ +exports.u48be = ((property) => new UIntBE(6, property)); +/** Factory for {@link NearUInt64BE|big-endian unsigned int + * layouts} interpreted as Numbers. */ +exports.nu64be = ((property) => new NearUInt64BE(property)); +/** Factory for {@link Int|signed int layouts} spanning one + * byte. */ +exports.s8 = ((property) => new Int(1, property)); +/** Factory for {@link Int|little-endian signed int layouts} + * spanning two bytes. */ +exports.s16 = ((property) => new Int(2, property)); +/** Factory for {@link Int|little-endian signed int layouts} + * spanning three bytes. */ +exports.s24 = ((property) => new Int(3, property)); +/** Factory for {@link Int|little-endian signed int layouts} + * spanning four bytes. */ +exports.s32 = ((property) => new Int(4, property)); +/** Factory for {@link Int|little-endian signed int layouts} + * spanning five bytes. */ +exports.s40 = ((property) => new Int(5, property)); +/** Factory for {@link Int|little-endian signed int layouts} + * spanning six bytes. */ +exports.s48 = ((property) => new Int(6, property)); +/** Factory for {@link NearInt64|little-endian signed int layouts} + * interpreted as Numbers. */ +exports.ns64 = ((property) => new NearInt64(property)); +/** Factory for {@link Int|big-endian signed int layouts} + * spanning two bytes. */ +exports.s16be = ((property) => new IntBE(2, property)); +/** Factory for {@link Int|big-endian signed int layouts} + * spanning three bytes. */ +exports.s24be = ((property) => new IntBE(3, property)); +/** Factory for {@link Int|big-endian signed int layouts} + * spanning four bytes. */ +exports.s32be = ((property) => new IntBE(4, property)); +/** Factory for {@link Int|big-endian signed int layouts} + * spanning five bytes. */ +exports.s40be = ((property) => new IntBE(5, property)); +/** Factory for {@link Int|big-endian signed int layouts} + * spanning six bytes. */ +exports.s48be = ((property) => new IntBE(6, property)); +/** Factory for {@link NearInt64BE|big-endian signed int layouts} + * interpreted as Numbers. */ +exports.ns64be = ((property) => new NearInt64BE(property)); +/** Factory for {@link Float|little-endian 32-bit floating point} values. */ +exports.f32 = ((property) => new Float(property)); +/** Factory for {@link FloatBE|big-endian 32-bit floating point} values. */ +exports.f32be = ((property) => new FloatBE(property)); +/** Factory for {@link Double|little-endian 64-bit floating point} values. */ +exports.f64 = ((property) => new Double(property)); +/** Factory for {@link DoubleBE|big-endian 64-bit floating point} values. */ +exports.f64be = ((property) => new DoubleBE(property)); +/** Factory for {@link Structure} values. */ +exports.struct = ((fields, property, decodePrefixes) => new Structure(fields, property, decodePrefixes)); +/** Factory for {@link BitStructure} values. */ +exports.bits = ((word, msb, property) => new BitStructure(word, msb, property)); +/** Factory for {@link Sequence} values. */ +exports.seq = ((elementLayout, count, property) => new Sequence(elementLayout, count, property)); +/** Factory for {@link Union} values. */ +exports.union = ((discr, defaultLayout, property) => new Union(discr, defaultLayout, property)); +/** Factory for {@link UnionLayoutDiscriminator} values. */ +exports.unionLayoutDiscriminator = ((layout, property) => new UnionLayoutDiscriminator(layout, property)); +/** Factory for {@link Blob} values. */ +exports.blob = ((length, property) => new Blob(length, property)); +/** Factory for {@link CString} values. */ +exports.cstr = ((property) => new CString(property)); +/** Factory for {@link UTF8} values. */ +exports.utf8 = ((maxSpan, property) => new UTF8(maxSpan, property)); +/** Factory for {@link Constant} values. */ +exports.constant = ((value, property) => new Constant(value, property)); +//# sourceMappingURL=Layout.js.map + +/***/ }), + +/***/ 33936: +/*!*****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/key_usage.js ***! + \*****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KeyUsage: () => (/* binding */ KeyUsage), +/* harmony export */ KeyUsageFlags: () => (/* binding */ KeyUsageFlags), +/* harmony export */ id_ce_keyUsage: () => (/* binding */ id_ce_keyUsage) +/* harmony export */ }); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + +const id_ce_keyUsage = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_1__.id_ce}.15`; +var KeyUsageFlags; +(function (KeyUsageFlags) { + KeyUsageFlags[KeyUsageFlags["digitalSignature"] = 1] = "digitalSignature"; + KeyUsageFlags[KeyUsageFlags["nonRepudiation"] = 2] = "nonRepudiation"; + KeyUsageFlags[KeyUsageFlags["keyEncipherment"] = 4] = "keyEncipherment"; + KeyUsageFlags[KeyUsageFlags["dataEncipherment"] = 8] = "dataEncipherment"; + KeyUsageFlags[KeyUsageFlags["keyAgreement"] = 16] = "keyAgreement"; + KeyUsageFlags[KeyUsageFlags["keyCertSign"] = 32] = "keyCertSign"; + KeyUsageFlags[KeyUsageFlags["cRLSign"] = 64] = "cRLSign"; + KeyUsageFlags[KeyUsageFlags["encipherOnly"] = 128] = "encipherOnly"; + KeyUsageFlags[KeyUsageFlags["decipherOnly"] = 256] = "decipherOnly"; +})(KeyUsageFlags || (KeyUsageFlags = {})); +class KeyUsage extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.BitString { + toJSON() { + const flag = this.toNumber(); + const res = []; + if (flag & KeyUsageFlags.cRLSign) { + res.push("crlSign"); + } + if (flag & KeyUsageFlags.dataEncipherment) { + res.push("dataEncipherment"); + } + if (flag & KeyUsageFlags.decipherOnly) { + res.push("decipherOnly"); + } + if (flag & KeyUsageFlags.digitalSignature) { + res.push("digitalSignature"); + } + if (flag & KeyUsageFlags.encipherOnly) { + res.push("encipherOnly"); + } + if (flag & KeyUsageFlags.keyAgreement) { + res.push("keyAgreement"); + } + if (flag & KeyUsageFlags.keyCertSign) { + res.push("keyCertSign"); + } + if (flag & KeyUsageFlags.keyEncipherment) { + res.push("keyEncipherment"); + } + if (flag & KeyUsageFlags.nonRepudiation) { + res.push("nonRepudiation"); + } + return res; + } + toString() { + return `[${this.toJSON().join(", ")}]`; + } +} + + +/***/ }), + +/***/ 33953: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/256.js ***! + \************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); +var common = __webpack_require__(/*! ../common */ 92660); +var shaCommon = __webpack_require__(/*! ./common */ 55479); +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); + +var sum32 = utils.sum32; +var sum32_4 = utils.sum32_4; +var sum32_5 = utils.sum32_5; +var ch32 = shaCommon.ch32; +var maj32 = shaCommon.maj32; +var s0_256 = shaCommon.s0_256; +var s1_256 = shaCommon.s1_256; +var g0_256 = shaCommon.g0_256; +var g1_256 = shaCommon.g1_256; + +var BlockHash = common.BlockHash; + +var sha256_K = [ + 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, + 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, + 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, + 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, + 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, + 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, + 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, + 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, + 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, + 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, + 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, + 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, + 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, + 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, + 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, + 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 +]; + +function SHA256() { + if (!(this instanceof SHA256)) + return new SHA256(); + + BlockHash.call(this); + this.h = [ + 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, + 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19 + ]; + this.k = sha256_K; + this.W = new Array(64); +} +utils.inherits(SHA256, BlockHash); +module.exports = SHA256; + +SHA256.blockSize = 512; +SHA256.outSize = 256; +SHA256.hmacStrength = 192; +SHA256.padLength = 64; + +SHA256.prototype._update = function _update(msg, start) { + var W = this.W; + + for (var i = 0; i < 16; i++) + W[i] = msg[start + i]; + for (; i < W.length; i++) + W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]); + + var a = this.h[0]; + var b = this.h[1]; + var c = this.h[2]; + var d = this.h[3]; + var e = this.h[4]; + var f = this.h[5]; + var g = this.h[6]; + var h = this.h[7]; + + assert(this.k.length === W.length); + for (i = 0; i < W.length; i++) { + var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]); + var T2 = sum32(s0_256(a), maj32(a, b, c)); + h = g; + g = f; + f = e; + e = sum32(d, T1); + d = c; + c = b; + b = a; + a = sum32(T1, T2); + } + + this.h[0] = sum32(this.h[0], a); + this.h[1] = sum32(this.h[1], b); + this.h[2] = sum32(this.h[2], c); + this.h[3] = sum32(this.h[3], d); + this.h[4] = sum32(this.h[4], e); + this.h[5] = sum32(this.h[5], f); + this.h[6] = sum32(this.h[6], g); + this.h[7] = sum32(this.h[7], h); +}; + +SHA256.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'big'); + else + return utils.split32(this.h, 'big'); +}; + + +/***/ }), + +/***/ 33977: +/*!*************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/unit/formatUnits.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ formatUnits: () => (/* binding */ formatUnits) +/* harmony export */ }); +/** + * Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number.. + * + * - Docs: https://viem.sh/docs/utilities/formatUnits + * + * @example + * import { formatUnits } from 'viem' + * + * formatUnits(420000000000n, 9) + * // '420' + */ +function formatUnits(value, decimals) { + let display = value.toString(); + const negative = display.startsWith('-'); + if (negative) + display = display.slice(1); + display = display.padStart(decimals, '0'); + let [integer, fraction] = [ + display.slice(0, display.length - decimals), + display.slice(display.length - decimals), + ]; + fraction = fraction.replace(/(0+)$/, ''); + return `${negative ? '-' : ''}${integer || '0'}${fraction ? `.${fraction}` : ''}`; +} +//# sourceMappingURL=formatUnits.js.map + +/***/ }), + +/***/ 34318: +/*!*******************************************************************!*\ + !*** ../node_modules/.pnpm/bs58@4.0.1/node_modules/bs58/index.js ***! + \*******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var basex = __webpack_require__(/*! base-x */ 8467) +var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' + +module.exports = basex(ALPHABET) + + +/***/ }), + +/***/ 34587: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/is-typed-array@1.1.15/node_modules/is-typed-array/index.js ***! + \****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var whichTypedArray = __webpack_require__(/*! which-typed-array */ 42803); + +/** @type {import('.')} */ +module.exports = function isTypedArray(value) { + return !!whichTypedArray(value); +}; + + +/***/ }), + +/***/ 34762: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/sha3.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Keccak: () => (/* binding */ Keccak), +/* harmony export */ keccakP: () => (/* binding */ keccakP), +/* harmony export */ keccak_224: () => (/* binding */ keccak_224), +/* harmony export */ keccak_256: () => (/* binding */ keccak_256), +/* harmony export */ keccak_384: () => (/* binding */ keccak_384), +/* harmony export */ keccak_512: () => (/* binding */ keccak_512), +/* harmony export */ sha3_256: () => (/* binding */ sha3_256), +/* harmony export */ sha3_384: () => (/* binding */ sha3_384), +/* harmony export */ sha3_512: () => (/* binding */ sha3_512), +/* harmony export */ shake128: () => (/* binding */ shake128), +/* harmony export */ shake256: () => (/* binding */ shake256) +/* harmony export */ }); +/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./u64.js */ 82572); +/* harmony import */ var _utils_noble_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/noble.js */ 63594); +/* harmony import */ var _hash_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./hash.js */ 31177); +/** + * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes). + * + * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-hashes/blob/4e358a46d682adfb005ae6314ec999f2513086b9/src/sha3.ts + */ +/** + * SHA3 (keccak) hash function, based on a new "Sponge function" design. + * Different from older hashes, the internal state is bigger than output size. + * + * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf), + * [Website](https://keccak.team/keccak.html), + * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub). + * + * Check out `sha3-addons` module for cSHAKE, k12, and others. + * @module + */ + + + +// No __PURE__ annotations in sha3 header: +// EVERYTHING is in fact used on every export. +// Various per round constants calculations +const _0n = 0n; +const _1n = 1n; +const _2n = 2n; +const _7n = 7n; +const _256n = 256n; +const _0x71n = 0x71n; +const SHA3_PI = []; +const SHA3_ROTL = []; +const _SHA3_IOTA = []; // no pure annotation: var is always used +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const IOTAS = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.split)(_SHA3_IOTA, true); +const SHA3_IOTA_H = IOTAS[0]; +const SHA3_IOTA_L = IOTAS[1]; +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(h, l, s) : (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(h, l, s) : (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(h, l, s)); +/** `keccakf1600` internal function, additionally allows to adjust round count. */ +function keccakP(s, rounds = 24, B) { + if (!B) + B = new Uint32Array(10); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) { + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + } + // for (let x = 0; x < 10; x += 2) { + // const idx1 = (x + 8) % 10; + // const idx0 = (x + 2) % 10; + // const B0 = B[idx0]; + // const B1 = B[idx0 + 1]; + // const Th = rotlH(B0, B1, 1) ^ B[idx1]; + // const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + // for (let y = 0; y < 50; y += 10) { + // s[x + y] ^= Th; + // s[x + y + 1] ^= Tl; + // } + // } + { // x=0: idx0=2, idx1=8 + const Th = rotlH(B[2], B[3], 1) ^ B[8]; + const Tl = rotlL(B[2], B[3], 1) ^ B[9]; + s[0] ^= Th; + s[1] ^= Tl; + s[10] ^= Th; + s[11] ^= Tl; + s[20] ^= Th; + s[21] ^= Tl; + s[30] ^= Th; + s[31] ^= Tl; + s[40] ^= Th; + s[41] ^= Tl; + } + { // x=2: idx0=4, idx1=0 + const Th = rotlH(B[4], B[5], 1) ^ B[0]; + const Tl = rotlL(B[4], B[5], 1) ^ B[1]; + s[2] ^= Th; + s[3] ^= Tl; + s[12] ^= Th; + s[13] ^= Tl; + s[22] ^= Th; + s[23] ^= Tl; + s[32] ^= Th; + s[33] ^= Tl; + s[42] ^= Th; + s[43] ^= Tl; + } + { // x=4: idx0=6, idx1=2 + const Th = rotlH(B[6], B[7], 1) ^ B[2]; + const Tl = rotlL(B[6], B[7], 1) ^ B[3]; + s[4] ^= Th; + s[5] ^= Tl; + s[14] ^= Th; + s[15] ^= Tl; + s[24] ^= Th; + s[25] ^= Tl; + s[34] ^= Th; + s[35] ^= Tl; + s[44] ^= Th; + s[45] ^= Tl; + } + { // x=6: idx0=8, idx1=4 + const Th = rotlH(B[8], B[9], 1) ^ B[4]; + const Tl = rotlL(B[8], B[9], 1) ^ B[5]; + s[6] ^= Th; + s[7] ^= Tl; + s[16] ^= Th; + s[17] ^= Tl; + s[26] ^= Th; + s[27] ^= Tl; + s[36] ^= Th; + s[37] ^= Tl; + s[46] ^= Th; + s[47] ^= Tl; + } + { // x=8: idx0=0, idx1=6 + const Th = rotlH(B[0], B[1], 1) ^ B[6]; + const Tl = rotlL(B[0], B[1], 1) ^ B[7]; + s[8] ^= Th; + s[9] ^= Tl; + s[18] ^= Th; + s[19] ^= Tl; + s[28] ^= Th; + s[29] ^= Tl; + s[38] ^= Th; + s[39] ^= Tl; + s[48] ^= Th; + s[49] ^= Tl; + } + // Rho (ρ) and Pi (π) — fully unrolled + let curH = s[2]; + let curL = s[3]; + // for (let t = 0; t < 24; t++) { + // const shift = SHA3_ROTL[t]; + // const Th = rotlH(curH, curL, shift); + // const Tl = rotlL(curH, curL, shift); + // const PI = SHA3_PI[t]; + // curH = s[PI]; + // curL = s[PI + 1]; + // s[PI] = Th; + // s[PI + 1] = Tl; + // } + let Th, Tl; + // t=0: shift=1(S), PI=20 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 1); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 1); + curH = s[20]; + curL = s[21]; + s[20] = Th; + s[21] = Tl; + // t=1: shift=3(S), PI=14 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 3); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 3); + curH = s[14]; + curL = s[15]; + s[14] = Th; + s[15] = Tl; + // t=2: shift=6(S), PI=22 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 6); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 6); + curH = s[22]; + curL = s[23]; + s[22] = Th; + s[23] = Tl; + // t=3: shift=10(S), PI=34 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 10); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 10); + curH = s[34]; + curL = s[35]; + s[34] = Th; + s[35] = Tl; + // t=4: shift=15(S), PI=36 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 15); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 15); + curH = s[36]; + curL = s[37]; + s[36] = Th; + s[37] = Tl; + // t=5: shift=21(S), PI=6 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 21); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 21); + curH = s[6]; + curL = s[7]; + s[6] = Th; + s[7] = Tl; + // t=6: shift=28(S), PI=10 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 28); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 28); + curH = s[10]; + curL = s[11]; + s[10] = Th; + s[11] = Tl; + // t=7: shift=36(B), PI=32 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 36); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 36); + curH = s[32]; + curL = s[33]; + s[32] = Th; + s[33] = Tl; + // t=8: shift=45(B), PI=16 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 45); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 45); + curH = s[16]; + curL = s[17]; + s[16] = Th; + s[17] = Tl; + // t=9: shift=55(B), PI=42 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 55); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 55); + curH = s[42]; + curL = s[43]; + s[42] = Th; + s[43] = Tl; + // t=10: shift=2(S), PI=48 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 2); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 2); + curH = s[48]; + curL = s[49]; + s[48] = Th; + s[49] = Tl; + // t=11: shift=14(S), PI=8 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 14); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 14); + curH = s[8]; + curL = s[9]; + s[8] = Th; + s[9] = Tl; + // t=12: shift=27(S), PI=30 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 27); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 27); + curH = s[30]; + curL = s[31]; + s[30] = Th; + s[31] = Tl; + // t=13: shift=41(B), PI=46 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 41); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 41); + curH = s[46]; + curL = s[47]; + s[46] = Th; + s[47] = Tl; + // t=14: shift=56(B), PI=38 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 56); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 56); + curH = s[38]; + curL = s[39]; + s[38] = Th; + s[39] = Tl; + // t=15: shift=8(S), PI=26 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 8); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 8); + curH = s[26]; + curL = s[27]; + s[26] = Th; + s[27] = Tl; + // t=16: shift=25(S), PI=24 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 25); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 25); + curH = s[24]; + curL = s[25]; + s[24] = Th; + s[25] = Tl; + // t=17: shift=43(B), PI=4 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 43); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 43); + curH = s[4]; + curL = s[5]; + s[4] = Th; + s[5] = Tl; + // t=18: shift=62(B), PI=40 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 62); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 62); + curH = s[40]; + curL = s[41]; + s[40] = Th; + s[41] = Tl; + // t=19: shift=18(S), PI=28 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 18); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 18); + curH = s[28]; + curL = s[29]; + s[28] = Th; + s[29] = Tl; + // t=20: shift=39(B), PI=44 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 39); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 39); + curH = s[44]; + curL = s[45]; + s[44] = Th; + s[45] = Tl; + // t=21: shift=61(B), PI=18 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 61); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 61); + curH = s[18]; + curL = s[19]; + s[18] = Th; + s[19] = Tl; + // t=22: shift=20(S), PI=12 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(curH, curL, 20); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(curH, curL, 20); + curH = s[12]; + curL = s[13]; + s[12] = Th; + s[13] = Tl; + // t=23: shift=44(B), PI=2 + Th = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(curH, curL, 44); + Tl = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(curH, curL, 44); + s[2] = Th; + s[3] = Tl; + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + B[0] = s[y]; + B[1] = s[y + 1]; + B[2] = s[y + 2]; + B[3] = s[y + 3]; + B[4] = s[y + 4]; + B[5] = s[y + 5]; + B[6] = s[y + 6]; + B[7] = s[y + 7]; + B[8] = s[y + 8]; + B[9] = s[y + 9]; + s[y + 0] ^= ~B[2] & B[4]; + s[y + 1] ^= ~B[3] & B[5]; + s[y + 2] ^= ~B[4] & B[6]; + s[y + 3] ^= ~B[5] & B[7]; + s[y + 4] ^= ~B[6] & B[8]; + s[y + 5] ^= ~B[7] & B[9]; + s[y + 6] ^= ~B[8] & B[0]; + s[y + 7] ^= ~B[9] & B[1]; + s[y + 8] ^= ~B[0] & B[2]; + s[y + 9] ^= ~B[1] & B[3]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } +} +/** Keccak sponge function. */ +class Keccak { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + Object.defineProperty(this, "state", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "pos", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "posOut", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "finished", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + Object.defineProperty(this, "state32", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "destroyed", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + Object.defineProperty(this, "_B", { + enumerable: true, + configurable: true, + writable: true, + value: new Uint32Array(10) + }); + Object.defineProperty(this, "blockLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "suffix", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "outputLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "enableXOF", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + Object.defineProperty(this, "rounds", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + // Can be passed from user as dkLen + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(outputLen, "outputLen"); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + // 0 < blockLen < 200 + if (!(0 < blockLen && blockLen < 200)) { + throw new Error("only keccak-f1600 function is supported"); + } + this.state = new Uint8Array(200); + this.state32 = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.u32)(this.state); + } + clone() { + return this._cloneInto(); + } + /** Resets instance to initial (empty) state for reuse. */ + reset() { + this.state.fill(0); + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + } + keccak() { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.swap32IfBE)(this.state32); + keccakP(this.state32, this.rounds, this._B); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.swap32IfBE)(this.state32); + this.posOut = 0; + this.pos = 0; + } + update(data) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.aexists)(this); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(data); + return this.updateUnsafe(data); + } + /** Like update(), but skips validation. Caller must ensure valid state and input. */ + updateUnsafe(data) { + const { blockLen, state } = this; + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.aexists)(this, false); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(out); + return this.writeIntoUnsafe(out); + } + /** Like writeInto(), but skips validation. Caller must ensure valid state and output. */ + writeIntoUnsafe(out) { + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) { + throw new Error("XOF is not possible for this instance"); + } + return this.writeInto(out); + } + xof(bytes) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.aoutput)(out, this); + if (this.finished) + throw new Error("digest() was already called"); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.clean)(this.state); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +const genKeccak = (suffix, blockLen, outputLen, info = {}) => (0,_hash_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(() => new Keccak(blockLen, suffix, outputLen), info); +// /** SHA3-224 hash function. */ +// export const sha3_224: CHash = /* @__PURE__ */ genKeccak( +// 0x06, +// 144, +// 28, +// /* @__PURE__ */ oidNist(0x07), +// ); +/** SHA3-256 hash function. Different from keccak-256. */ +const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.oidNist)(0x08)); +/** SHA3-384 hash function. */ +const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.oidNist)(0x09)); +/** SHA3-512 hash function. */ +const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, +/* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.oidNist)(0x0a)); +/** keccak-224 hash function. */ +const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28); +/** keccak-256 hash function. Different from SHA3-256. */ +const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32); +/** keccak-384 hash function. */ +const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48); +/** keccak-512 hash function. */ +const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64); +const genShake = (suffix, blockLen, outputLen, info = {}) => (0,_hash_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), info); +/** SHAKE128 XOF with 128-bit security. */ +const shake128 = +/* @__PURE__ */ +genShake(0x1f, 168, 16, /* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.oidNist)(0x0b)); +/** SHAKE256 XOF with 256-bit security. */ +const shake256 = +/* @__PURE__ */ +genShake(0x1f, 136, 32, /* @__PURE__ */ (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_1__.oidNist)(0x0c)); +// /** SHAKE128 XOF with 256-bit output (NIST version). */ +// export const shake128_32: CHashXOF = +// /* @__PURE__ */ +// genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b)); +// /** SHAKE256 XOF with 512-bit output (NIST version). */ +// export const shake256_64: CHashXOF = +// /* @__PURE__ */ +// genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c)); + + +/***/ }), + +/***/ 34873: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/reflectApply.js ***! + \****************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./reflectApply')} */ +module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; + + +/***/ }), + +/***/ 35072: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/modular.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Field: () => (/* binding */ Field), +/* harmony export */ FpDiv: () => (/* binding */ FpDiv), +/* harmony export */ FpInvertBatch: () => (/* binding */ FpInvertBatch), +/* harmony export */ FpIsSquare: () => (/* binding */ FpIsSquare), +/* harmony export */ FpLegendre: () => (/* binding */ FpLegendre), +/* harmony export */ FpPow: () => (/* binding */ FpPow), +/* harmony export */ FpSqrt: () => (/* binding */ FpSqrt), +/* harmony export */ FpSqrtEven: () => (/* binding */ FpSqrtEven), +/* harmony export */ FpSqrtOdd: () => (/* binding */ FpSqrtOdd), +/* harmony export */ getFieldBytesLength: () => (/* binding */ getFieldBytesLength), +/* harmony export */ getMinHashLength: () => (/* binding */ getMinHashLength), +/* harmony export */ hashToPrivateScalar: () => (/* binding */ hashToPrivateScalar), +/* harmony export */ invert: () => (/* binding */ invert), +/* harmony export */ isNegativeLE: () => (/* binding */ isNegativeLE), +/* harmony export */ mapHashToField: () => (/* binding */ mapHashToField), +/* harmony export */ mod: () => (/* binding */ mod), +/* harmony export */ nLength: () => (/* binding */ nLength), +/* harmony export */ pow: () => (/* binding */ pow), +/* harmony export */ pow2: () => (/* binding */ pow2), +/* harmony export */ tonelliShanks: () => (/* binding */ tonelliShanks), +/* harmony export */ validateField: () => (/* binding */ validateField) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ 74430); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ 29964); +/** + * Utils for modular division and fields. + * Field over 11 is a finite (Galois) field is integer number operations `mod 11`. + * There is no division: it is replaced by modular multiplicative inverse. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); +// prettier-ignore +const _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _7n = /* @__PURE__ */ BigInt(7); +// prettier-ignore +const _8n = /* @__PURE__ */ BigInt(8), _9n = /* @__PURE__ */ BigInt(9), _16n = /* @__PURE__ */ BigInt(16); +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _0n ? result : b + result; +} +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +function pow(num, power, modulo) { + return FpPow(Field(modulo), num, power); +} +/** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */ +function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} +/** + * Inverses number over modulo. + * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/). + */ +function invert(number, modulo) { + if (number === _0n) + throw new Error('invert: expected non-zero number'); + if (modulo <= _0n) + throw new Error('invert: expected positive modulus, got ' + modulo); + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +function assertIsSquare(Fp, root, n) { + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); +} +// Not all roots are possible! Example which will throw: +// const NUM = +// n = 72057594037927816n; +// Fp = Field(BigInt('0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab')); +function sqrt3mod4(Fp, n) { + const p1div4 = (Fp.ORDER + _1n) / _4n; + const root = Fp.pow(n, p1div4); + assertIsSquare(Fp, root, n); + return root; +} +function sqrt5mod8(Fp, n) { + const p5div8 = (Fp.ORDER - _5n) / _8n; + const n2 = Fp.mul(n, _2n); + const v = Fp.pow(n2, p5div8); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + assertIsSquare(Fp, root, n); + return root; +} +// Based on RFC9380, Kong algorithm +// prettier-ignore +function sqrt9mod16(P) { + const Fp_ = Field(P); + const tn = tonelliShanks(P); + const c1 = tn(Fp_, Fp_.neg(Fp_.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + const c2 = tn(Fp_, c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + const c3 = tn(Fp_, Fp_.neg(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + return (Fp, n) => { + let tv1 = Fp.pow(n, c4); // 1. tv1 = x^c4 + let tv2 = Fp.mul(tv1, c1); // 2. tv2 = c1 * tv1 + const tv3 = Fp.mul(tv1, c2); // 3. tv3 = c2 * tv1 + const tv4 = Fp.mul(tv1, c3); // 4. tv4 = c3 * tv1 + const e1 = Fp.eql(Fp.sqr(tv2), n); // 5. e1 = (tv2^2) == x + const e2 = Fp.eql(Fp.sqr(tv3), n); // 6. e2 = (tv3^2) == x + tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + const e3 = Fp.eql(Fp.sqr(tv2), n); // 9. e3 = (tv2^2) == x + const root = Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select sqrt from tv1 & tv2 + assertIsSquare(Fp, root, n); + return root; + }; +} +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +function tonelliShanks(P) { + // Initialization (precomputation). + // Caching initialization could boost perf by 7%. + if (P < _3n) + throw new Error('sqrt is not defined for small field'); + // Factor P - 1 = Q * 2^S, where Q is odd + let Q = P - _1n; + let S = 0; + while (Q % _2n === _0n) { + Q /= _2n; + S++; + } + // Find the first quadratic non-residue Z >= 2 + let Z = _2n; + const _Fp = Field(P); + while (FpLegendre(_Fp, Z) === 1) { + // Basic primality test for P. After x iterations, chance of + // not finding quadratic non-residue is 2^x, so 2^1000. + if (Z++ > 1000) + throw new Error('Cannot find square root: probably non-prime P'); + } + // Fast-path; usually done before Z, but we do "primality test". + if (S === 1) + return sqrt3mod4; + // Slow-path + // TODO: test on Fp2 and others + let cc = _Fp.pow(Z, Q); // c = z^Q + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp, n) { + if (Fp.is0(n)) + return n; + // Check if n is a quadratic residue using Legendre symbol + if (FpLegendre(Fp, n) !== 1) + throw new Error('Cannot find square root'); + // Initialize variables for the main loop + let M = S; + let c = Fp.mul(Fp.ONE, cc); // c = z^Q, move cc from field _Fp into field Fp + let t = Fp.pow(n, Q); // t = n^Q, first guess at the fudge factor + let R = Fp.pow(n, Q1div2); // R = n^((Q+1)/2), first guess at the square root + // Main loop + // while t != 1 + while (!Fp.eql(t, Fp.ONE)) { + if (Fp.is0(t)) + return Fp.ZERO; // if t=0 return R=0 + let i = 1; + // Find the smallest i >= 1 such that t^(2^i) ≡ 1 (mod P) + let t_tmp = Fp.sqr(t); // t^(2^1) + while (!Fp.eql(t_tmp, Fp.ONE)) { + i++; + t_tmp = Fp.sqr(t_tmp); // t^(2^2)... + if (i === M) + throw new Error('Cannot find square root'); + } + // Calculate the exponent for b: 2^(M - i - 1) + const exponent = _1n << BigInt(M - i - 1); // bigint is important + const b = Fp.pow(c, exponent); // b = 2^(M - i - 1) + // Update variables + M = i; + c = Fp.sqr(b); // c = b^2 + t = Fp.mul(t, c); // t = (t * b^2) + R = Fp.mul(R, b); // R = R*b + } + return R; + }; +} +/** + * Square root for a finite field. Will try optimized versions first: + * + * 1. P ≡ 3 (mod 4) + * 2. P ≡ 5 (mod 8) + * 3. P ≡ 9 (mod 16) + * 4. Tonelli-Shanks algorithm + * + * Different algorithms can give different roots, it is up to user to decide which one they want. + * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + */ +function FpSqrt(P) { + // P ≡ 3 (mod 4) => √n = n^((P+1)/4) + if (P % _4n === _3n) + return sqrt3mod4; + // P ≡ 5 (mod 8) => Atkin algorithm, page 10 of https://eprint.iacr.org/2012/685.pdf + if (P % _8n === _5n) + return sqrt5mod8; + // P ≡ 9 (mod 16) => Kong algorithm, page 11 of https://eprint.iacr.org/2012/685.pdf (algorithm 4) + if (P % _16n === _9n) + return sqrt9mod16(P); + // Tonelli-Shanks algorithm + return tonelliShanks(P); +} +// Little-endian check for first LE bit (last BE bit); +const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'number', + BITS: 'number', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._validateObject)(field, opts); + // const max = 16384; + // if (field.BYTES < 1 || field.BYTES > max) throw new Error('invalid field'); + // if (field.BITS < 1 || field.BITS > 8 * max) throw new Error('invalid field'); + return field; +} +// Generic field functions +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +function FpPow(Fp, num, power) { + if (power < _0n) + throw new Error('invalid exponent, negatives unsupported'); + if (power === _0n) + return Fp.ONE; + if (power === _1n) + return num; + let p = Fp.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) + p = Fp.mul(p, d); + d = Fp.sqr(d); + power >>= _1n; + } + return p; +} +/** + * Efficiently invert an array of Field elements. + * Exception-free. Will return `undefined` for 0 elements. + * @param passZero map 0 to 0 (instead of undefined) + */ +function FpInvertBatch(Fp, nums, passZero = false) { + const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined); + // Walk from first to last, multiply them by each other MOD p + const multipliedAcc = nums.reduce((acc, num, i) => { + if (Fp.is0(num)) + return acc; + inverted[i] = acc; + return Fp.mul(acc, num); + }, Fp.ONE); + // Invert last element + const invertedAcc = Fp.inv(multipliedAcc); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (Fp.is0(num)) + return acc; + inverted[i] = Fp.mul(acc, inverted[i]); + return Fp.mul(acc, num); + }, invertedAcc); + return inverted; +} +// TODO: remove +function FpDiv(Fp, lhs, rhs) { + return Fp.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, Fp.ORDER) : Fp.inv(rhs)); +} +/** + * Legendre symbol. + * Legendre constant is used to calculate Legendre symbol (a | p) + * which denotes the value of a^((p-1)/2) (mod p). + * + * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue + * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue + * * (a | p) ≡ 0 if a ≡ 0 (mod p) + */ +function FpLegendre(Fp, n) { + // We can use 3rd argument as optional cache of this value + // but seems unneeded for now. The operation is very fast. + const p1mod2 = (Fp.ORDER - _1n) / _2n; + const powered = Fp.pow(n, p1mod2); + const yes = Fp.eql(powered, Fp.ONE); + const zero = Fp.eql(powered, Fp.ZERO); + const no = Fp.eql(powered, Fp.neg(Fp.ONE)); + if (!yes && !zero && !no) + throw new Error('invalid Legendre symbol result'); + return yes ? 1 : zero ? 0 : -1; +} +// This function returns True whenever the value x is a square in the field F. +function FpIsSquare(Fp, n) { + const l = FpLegendre(Fp, n); + return l === 1; +} +// CURVE.n lengths +function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + if (nBitLength !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(nBitLength); + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +/** + * Creates a finite field. Major performance optimizations: + * * 1. Denormalized operations like mulN instead of mul. + * * 2. Identical object shape: never add or remove keys. + * * 3. `Object.freeze`. + * Fragile: always run a benchmark on a change. + * Security note: operations don't check 'isValid' for all elements for performance reasons, + * it is caller responsibility to check this. + * This is low-level code, please make sure you know what you're doing. + * + * Note about field properties: + * * CHARACTERISTIC p = prime number, number of elements in main subgroup. + * * ORDER q = similar to cofactor in curves, may be composite `q = p^m`. + * + * @param ORDER field order, probably prime, or could be composite + * @param bitLen how many bits the field consumes + * @param isLE (default: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +function Field(ORDER, bitLenOrOpts, // TODO: use opts only in v2? +isLE = false, opts = {}) { + if (ORDER <= _0n) + throw new Error('invalid field: expected ORDER > 0, got ' + ORDER); + let _nbitLength = undefined; + let _sqrt = undefined; + let modFromBytes = false; + let allowedLengths = undefined; + if (typeof bitLenOrOpts === 'object' && bitLenOrOpts != null) { + if (opts.sqrt || isLE) + throw new Error('cannot specify opts in two arguments'); + const _opts = bitLenOrOpts; + if (_opts.BITS) + _nbitLength = _opts.BITS; + if (_opts.sqrt) + _sqrt = _opts.sqrt; + if (typeof _opts.isLE === 'boolean') + isLE = _opts.isLE; + if (typeof _opts.modFromBytes === 'boolean') + modFromBytes = _opts.modFromBytes; + allowedLengths = _opts.allowedLengths; + } + else { + if (typeof bitLenOrOpts === 'number') + _nbitLength = bitLenOrOpts; + if (opts.sqrt) + _sqrt = opts.sqrt; + } + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, _nbitLength); + if (BYTES > 2048) + throw new Error('invalid field: expected ORDER of <= 2048 bytes'); + let sqrtP; // cached sqrtP + const f = Object.freeze({ + ORDER, + isLE, + BITS, + BYTES, + MASK: (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(BITS), + ZERO: _0n, + ONE: _1n, + allowedLengths: allowedLengths, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error('invalid field element: expected bigint, got ' + typeof num); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + // is valid and invertible + isValidNot0: (num) => !f.is0(num) && f.isValid(num), + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: _sqrt || + ((n) => { + if (!sqrtP) + sqrtP = FpSqrt(ORDER); + return sqrtP(f, n); + }), + toBytes: (num) => (isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(num, BYTES) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesBE)(num, BYTES)), + fromBytes: (bytes, skipValidation = true) => { + if (allowedLengths) { + if (!allowedLengths.includes(bytes.length) || bytes.length > BYTES) { + throw new Error('Field.fromBytes: expected ' + allowedLengths + ' bytes, got ' + bytes.length); + } + const padded = new Uint8Array(BYTES); + // isLE add 0 to right, !isLE to the left. + padded.set(bytes, isLE ? 0 : padded.length - bytes.length); + bytes = padded; + } + if (bytes.length !== BYTES) + throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length); + let scalar = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(bytes) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(bytes); + if (modFromBytes) + scalar = mod(scalar, ORDER); + if (!skipValidation) + if (!f.isValid(scalar)) + throw new Error('invalid field element: outside of range 0..ORDER'); + // NOTE: we don't validate scalar here, please use isValid. This done such way because some + // protocol may allow non-reduced scalar that reduced later or changed some other way. + return scalar; + }, + // TODO: we don't need it here, move out to separate fn + invertBatch: (lst) => FpInvertBatch(f, lst), + // We can't move this out because Fp6, Fp12 implement it + // and it's unclear what to return in there. + cmov: (a, b, c) => (c ? b : a), + }); + return Object.freeze(f); +} +// Generic random scalar, we can do same for other fields if via Fp2.mul(Fp2.ONE, Fp2.random)? +// This allows unsafe methods like ignore bias or zero. These unsafe, but often used in different protocols (if deterministic RNG). +// which mean we cannot force this via opts. +// Not sure what to do with randomBytes, we can accept it inside opts if wanted. +// Probably need to export getMinHashLength somewhere? +// random(bytes?: Uint8Array, unsafeAllowZero = false, unsafeAllowBias = false) { +// const LEN = !unsafeAllowBias ? getMinHashLength(ORDER) : BYTES; +// if (bytes === undefined) bytes = randomBytes(LEN); // _opts.randomBytes? +// const num = isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes); +// // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 +// const reduced = unsafeAllowZero ? mod(num, ORDER) : mod(num, ORDER - _1n) + _1n; +// return reduced; +// }, +function FpSqrtOdd(Fp, elm) { + if (!Fp.isOdd) + throw new Error("Field doesn't have isOdd"); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} +function FpSqrtEven(Fp, elm) { + if (!Fp.isOdd) + throw new Error("Field doesn't have isOdd"); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use `mapKeyToField` instead + */ +function hashToPrivateScalar(hash, groupOrder, isLE = false) { + hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error('hashToPrivateScalar: expected ' + minLen + '-1024 bytes of input, got ' + hashLen); + const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(hash) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(hash); + return mod(num, groupOrder - _1n) + _1n; +} +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len); + const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(key) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberBE)(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n) + _1n; + return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(reduced, fieldLen) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesBE)(reduced, fieldLen); +} +//# sourceMappingURL=modular.js.map + +/***/ }), + +/***/ 35376: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/nist.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ p256: () => (/* binding */ p256), +/* harmony export */ p256_hasher: () => (/* binding */ p256_hasher), +/* harmony export */ p384: () => (/* binding */ p384), +/* harmony export */ p384_hasher: () => (/* binding */ p384_hasher), +/* harmony export */ p521: () => (/* binding */ p521), +/* harmony export */ p521_hasher: () => (/* binding */ p521_hasher), +/* harmony export */ secp256r1: () => (/* binding */ secp256r1), +/* harmony export */ secp384r1: () => (/* binding */ secp384r1), +/* harmony export */ secp521r1: () => (/* binding */ secp521r1) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha2 */ 19745); +/* harmony import */ var _shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_shortw_utils.js */ 38284); +/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ 31555); +/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/modular.js */ 51733); +/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/weierstrass.js */ 13319); +/** + * Internal module for NIST P256, P384, P521 curves. + * Do not use for now. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + + + + +const Fp256 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_3__.Field)(BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff')); +const p256_a = Fp256.create(BigInt('-3')); +const p256_b = BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'); +/** + * secp256r1 curve, ECDSA and ECDH methods. + * Field: `2n**224n * (2n**32n-1n) + 2n**192n + 2n**96n-1n` + */ +// prettier-ignore +const p256 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__.createCurve)({ + a: p256_a, + b: p256_b, + Fp: Fp256, + n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'), + Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'), + Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'), + h: BigInt(1), + lowS: false +}, _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256); +/** Alias to p256. */ +const secp256r1 = p256; +const p256_mapSWU = /* @__PURE__ */ (() => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_4__.mapToCurveSimpleSWU)(Fp256, { + A: p256_a, + B: p256_b, + Z: Fp256.create(BigInt('-10')), +}))(); +/** Hashing / encoding to p256 points / field. RFC 9380 methods. */ +const p256_hasher = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(secp256r1.ProjectivePoint, (scalars) => p256_mapSWU(scalars[0]), { + DST: 'P256_XMD:SHA-256_SSWU_RO_', + encodeDST: 'P256_XMD:SHA-256_SSWU_NU_', + p: Fp256.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha256, +}))(); +// Field over which we'll do calculations. +const Fp384 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_3__.Field)(BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff')); +const p384_a = Fp384.create(BigInt('-3')); +// prettier-ignore +const p384_b = BigInt('0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef'); +/** + * secp384r1 curve, ECDSA and ECDH methods. + * Field: `2n**384n - 2n**128n - 2n**96n + 2n**32n - 1n`. + * */ +// prettier-ignore +const p384 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__.createCurve)({ + a: p384_a, + b: p384_b, + Fp: Fp384, + n: BigInt('0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973'), + Gx: BigInt('0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7'), + Gy: BigInt('0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f'), + h: BigInt(1), + lowS: false +}, _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha384); +/** Alias to p384. */ +const secp384r1 = p384; +const p384_mapSWU = /* @__PURE__ */ (() => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_4__.mapToCurveSimpleSWU)(Fp384, { + A: p384_a, + B: p384_b, + Z: Fp384.create(BigInt('-12')), +}))(); +/** Hashing / encoding to p384 points / field. RFC 9380 methods. */ +const p384_hasher = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(secp384r1.ProjectivePoint, (scalars) => p384_mapSWU(scalars[0]), { + DST: 'P384_XMD:SHA-384_SSWU_RO_', + encodeDST: 'P384_XMD:SHA-384_SSWU_NU_', + p: Fp384.ORDER, + m: 1, + k: 192, + expand: 'xmd', + hash: _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha384, +}))(); +// Field over which we'll do calculations. +const Fp521 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_3__.Field)(BigInt('0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')); +const p521_a = Fp521.create(BigInt('-3')); +const p521_b = BigInt('0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00'); +/** + * NIST secp521r1 aka p521 curve, ECDSA and ECDH methods. + * Field: `2n**521n - 1n`. + */ +// prettier-ignore +const p521 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_1__.createCurve)({ + a: p521_a, + b: p521_b, + Fp: Fp521, + n: BigInt('0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409'), + Gx: BigInt('0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66'), + Gy: BigInt('0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650'), + h: BigInt(1), + lowS: false, + allowedPrivateKeyLengths: [130, 131, 132] // P521 keys are variable-length. Normalize to 132b +}, _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha512); +const secp521r1 = p521; +const p521_mapSWU = /* @__PURE__ */ (() => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_4__.mapToCurveSimpleSWU)(Fp521, { + A: p521_a, + B: p521_b, + Z: Fp521.create(BigInt('-4')), +}))(); +/** Hashing / encoding to p521 points / field. RFC 9380 methods. */ +const p521_hasher = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_2__.createHasher)(secp521r1.ProjectivePoint, (scalars) => p521_mapSWU(scalars[0]), { + DST: 'P521_XMD:SHA-512_SSWU_RO_', + encodeDST: 'P521_XMD:SHA-512_SSWU_NU_', + p: Fp521.ORDER, + m: 1, + k: 256, + expand: 'xmd', + hash: _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_0__.sha512, +}))(); +//# sourceMappingURL=nist.js.map + +/***/ }), + +/***/ 35797: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/utils.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ aInRange: () => (/* binding */ aInRange), +/* harmony export */ abool: () => (/* binding */ abool), +/* harmony export */ abytes: () => (/* binding */ abytes), +/* harmony export */ bitGet: () => (/* binding */ bitGet), +/* harmony export */ bitLen: () => (/* binding */ bitLen), +/* harmony export */ bitMask: () => (/* binding */ bitMask), +/* harmony export */ bitSet: () => (/* binding */ bitSet), +/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex), +/* harmony export */ bytesToNumberBE: () => (/* binding */ bytesToNumberBE), +/* harmony export */ bytesToNumberLE: () => (/* binding */ bytesToNumberLE), +/* harmony export */ concatBytes: () => (/* binding */ concatBytes), +/* harmony export */ createHmacDrbg: () => (/* binding */ createHmacDrbg), +/* harmony export */ ensureBytes: () => (/* binding */ ensureBytes), +/* harmony export */ equalBytes: () => (/* binding */ equalBytes), +/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes), +/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber), +/* harmony export */ inRange: () => (/* binding */ inRange), +/* harmony export */ isBytes: () => (/* binding */ isBytes), +/* harmony export */ memoized: () => (/* binding */ memoized), +/* harmony export */ notImplemented: () => (/* binding */ notImplemented), +/* harmony export */ numberToBytesBE: () => (/* binding */ numberToBytesBE), +/* harmony export */ numberToBytesLE: () => (/* binding */ numberToBytesLE), +/* harmony export */ numberToHexUnpadded: () => (/* binding */ numberToHexUnpadded), +/* harmony export */ numberToVarBytesBE: () => (/* binding */ numberToVarBytesBE), +/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes), +/* harmony export */ validateObject: () => (/* binding */ validateObject) +/* harmony export */ }); +/** + * Hex, bytes and number utilities. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// 100 lines of code in the file are duplicated from noble-hashes (utils). +// This is OK: `abstract` directory does not use noble-hashes. +// User may opt-in into using different hashing library. This way, noble-hashes +// won't be included into their bundle. +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +function isBytes(a) { + return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array'); +} +function abytes(item) { + if (!isBytes(item)) + throw new Error('Uint8Array expected'); +} +function abool(title, value) { + if (typeof value !== 'boolean') + throw new Error(title + ' boolean expected, got ' + value); +} +// Used in weierstrass, der +function numberToHexUnpadded(num) { + const hex = num.toString(16); + return hex.length & 1 ? '0' + hex : hex; +} +function hexToNumber(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + return hex === '' ? _0n : BigInt('0x' + hex); // Big Endian +} +// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex +const hasHexBuiltin = +// @ts-ignore +typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function'; +// Array where index 0xf0 (240) is mapped to string 'f0' +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0')); +/** + * Convert byte array to hex string. Uses built-in function, when available. + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + abytes(bytes); + // @ts-ignore + if (hasHexBuiltin) + return bytes.toHex(); + // pre-caching improves the speed 6x + let hex = ''; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +// We use optimized technique to convert hex string to byte array +const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; +function asciiToBase16(ch) { + if (ch >= asciis._0 && ch <= asciis._9) + return ch - asciis._0; // '2' => 50-48 + if (ch >= asciis.A && ch <= asciis.F) + return ch - (asciis.A - 10); // 'B' => 66-(65-10) + if (ch >= asciis.a && ch <= asciis.f) + return ch - (asciis.a - 10); // 'b' => 98-(97-10) + return; +} +/** + * Convert hex string to byte array. Uses built-in function, when available. + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== 'string') + throw new Error('hex string expected, got ' + typeof hex); + // @ts-ignore + if (hasHexBuiltin) + return Uint8Array.fromHex(hex); + const hl = hex.length; + const al = hl / 2; + if (hl % 2) + throw new Error('hex string expected, got unpadded hex of length ' + hl); + const array = new Uint8Array(al); + for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { + const n1 = asciiToBase16(hex.charCodeAt(hi)); + const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); + if (n1 === undefined || n2 === undefined) { + const char = hex[hi] + hex[hi + 1]; + throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); + } + array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163 + } + return array; +} +// BE: Big Endian, LE: Little Endian +function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +function bytesToNumberLE(bytes) { + abytes(bytes); + return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse())); +} +function numberToBytesBE(n, len) { + return hexToBytes(n.toString(16).padStart(len * 2, '0')); +} +function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); +} +// Unpadded, rarely used +function numberToVarBytesBE(n) { + return hexToBytes(numberToHexUnpadded(n)); +} +/** + * Takes hex string or Uint8Array, converts to Uint8Array. + * Validates output length. + * Will throw error for other types. + * @param title descriptive title for an error e.g. 'private key' + * @param hex hex string or Uint8Array + * @param expectedLength optional, will compare to result array's length + * @returns + */ +function ensureBytes(title, hex, expectedLength) { + let res; + if (typeof hex === 'string') { + try { + res = hexToBytes(hex); + } + catch (e) { + throw new Error(title + ' must be hex string or Uint8Array, cause: ' + e); + } + } + else if (isBytes(hex)) { + // Uint8Array.from() instead of hash.slice() because node.js Buffer + // is instance of Uint8Array, and its slice() creates **mutable** copy + res = Uint8Array.from(hex); + } + else { + throw new Error(title + ' must be hex string or Uint8Array'); + } + const len = res.length; + if (typeof expectedLength === 'number' && len !== expectedLength) + throw new Error(title + ' of length ' + expectedLength + ' expected, got ' + len); + return res; +} +/** + * Copies several Uint8Arrays into one. + */ +function concatBytes(...arrays) { + let sum = 0; + for (let i = 0; i < arrays.length; i++) { + const a = arrays[i]; + abytes(a); + sum += a.length; + } + const res = new Uint8Array(sum); + for (let i = 0, pad = 0; i < arrays.length; i++) { + const a = arrays[i]; + res.set(a, pad); + pad += a.length; + } + return res; +} +// Compares 2 u8a-s in kinda constant time +function equalBytes(a, b) { + if (a.length !== b.length) + return false; + let diff = 0; + for (let i = 0; i < a.length; i++) + diff |= a[i] ^ b[i]; + return diff === 0; +} +/** + * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== 'string') + throw new Error('string expected'); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +// Is positive bigint +const isPosBig = (n) => typeof n === 'bigint' && _0n <= n; +function inRange(n, min, max) { + return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max; +} +/** + * Asserts min <= n < max. NOTE: It's < max and not <= max. + * @example + * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n) + */ +function aInRange(title, n, min, max) { + // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)? + // consider P=256n, min=0n, max=P + // - a for min=0 would require -1: `inRange('x', x, -1n, P)` + // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)` + // - our way is the cleanest: `inRange('x', x, 0n, P) + if (!inRange(n, min, max)) + throw new Error('expected valid ' + title + ': ' + min + ' <= n < ' + max + ', got ' + n); +} +// Bit operations +/** + * Calculates amount of bits in a bigint. + * Same as `n.toString(2).length` + * TODO: merge with nLength in modular + */ +function bitLen(n) { + let len; + for (len = 0; n > _0n; n >>= _1n, len += 1) + ; + return len; +} +/** + * Gets single bit at position. + * NOTE: first bit position is 0 (same as arrays) + * Same as `!!+Array.from(n.toString(2)).reverse()[pos]` + */ +function bitGet(n, pos) { + return (n >> BigInt(pos)) & _1n; +} +/** + * Sets single bit at position. + */ +function bitSet(n, pos, value) { + return n | ((value ? _1n : _0n) << BigInt(pos)); +} +/** + * Calculate mask for N bits. Not using ** operator with bigints because of old engines. + * Same as BigInt(`0b${Array(i).fill('1').join('')}`) + */ +const bitMask = (n) => (_1n << BigInt(n)) - _1n; +// DRBG +const u8n = (len) => new Uint8Array(len); // creates Uint8Array +const u8fr = (arr) => Uint8Array.from(arr); // another shortcut +/** + * Minimal HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + * @returns function that will call DRBG until 2nd arg returns something meaningful + * @example + * const drbg = createHmacDRBG(32, 32, hmac); + * drbg(seed, bytesToKey); // bytesToKey must return Key or undefined + */ +function createHmacDrbg(hashLen, qByteLen, hmacFn) { + if (typeof hashLen !== 'number' || hashLen < 2) + throw new Error('hashLen must be a number'); + if (typeof qByteLen !== 'number' || qByteLen < 2) + throw new Error('qByteLen must be a number'); + if (typeof hmacFn !== 'function') + throw new Error('hmacFn must be a function'); + // Step B, Step C: set hashLen to 8*ceil(hlen/8) + let v = u8n(hashLen); // Minimal non-full-spec HMAC-DRBG from NIST 800-90 for RFC6979 sigs. + let k = u8n(hashLen); // Steps B and C of RFC6979 3.2: set hashLen, in our case always same + let i = 0; // Iterations counter, will throw when over 1000 + const reset = () => { + v.fill(1); + k.fill(0); + i = 0; + }; + const h = (...b) => hmacFn(k, v, ...b); // hmac(k)(v, ...values) + const reseed = (seed = u8n(0)) => { + // HMAC-DRBG reseed() function. Steps D-G + k = h(u8fr([0x00]), seed); // k = hmac(k || v || 0x00 || seed) + v = h(); // v = hmac(k || v) + if (seed.length === 0) + return; + k = h(u8fr([0x01]), seed); // k = hmac(k || v || 0x01 || seed) + v = h(); // v = hmac(k || v) + }; + const gen = () => { + // HMAC-DRBG generate() function + if (i++ >= 1000) + throw new Error('drbg: tried 1000 values'); + let len = 0; + const out = []; + while (len < qByteLen) { + v = h(); + const sl = v.slice(); + out.push(sl); + len += v.length; + } + return concatBytes(...out); + }; + const genUntil = (seed, pred) => { + reset(); + reseed(seed); // Steps D-G + let res = undefined; // Step H: grind until k is in [1..n-1] + while (!(res = pred(gen()))) + reseed(); + reset(); + return res; + }; + return genUntil; +} +// Validating curves and fields +const validatorFns = { + bigint: (val) => typeof val === 'bigint', + function: (val) => typeof val === 'function', + boolean: (val) => typeof val === 'boolean', + string: (val) => typeof val === 'string', + stringOrUint8Array: (val) => typeof val === 'string' || isBytes(val), + isSafeInteger: (val) => Number.isSafeInteger(val), + array: (val) => Array.isArray(val), + field: (val, object) => object.Fp.isValid(val), + hash: (val) => typeof val === 'function' && Number.isSafeInteger(val.outputLen), +}; +// type Record = { [P in K]: T; } +function validateObject(object, validators, optValidators = {}) { + const checkField = (fieldName, type, isOptional) => { + const checkVal = validatorFns[type]; + if (typeof checkVal !== 'function') + throw new Error('invalid validator function'); + const val = object[fieldName]; + if (isOptional && val === undefined) + return; + if (!checkVal(val, object)) { + throw new Error('param ' + String(fieldName) + ' is invalid. Expected ' + type + ', got ' + val); + } + }; + for (const [fieldName, type] of Object.entries(validators)) + checkField(fieldName, type, false); + for (const [fieldName, type] of Object.entries(optValidators)) + checkField(fieldName, type, true); + return object; +} +// validate type tests +// const o: { a: number; b: number; c: number } = { a: 1, b: 5, c: 6 }; +// const z0 = validateObject(o, { a: 'isSafeInteger' }, { c: 'bigint' }); // Ok! +// // Should fail type-check +// const z1 = validateObject(o, { a: 'tmp' }, { c: 'zz' }); +// const z2 = validateObject(o, { a: 'isSafeInteger' }, { c: 'zz' }); +// const z3 = validateObject(o, { test: 'boolean', z: 'bug' }); +// const z4 = validateObject(o, { a: 'boolean', z: 'bug' }); +/** + * throws not implemented error + */ +const notImplemented = () => { + throw new Error('not implemented'); +}; +/** + * Memoizes (caches) computation result. + * Uses WeakMap: the value is going auto-cleaned by GC after last reference is removed. + */ +function memoized(fn) { + const map = new WeakMap(); + return (arg, ...args) => { + const val = map.get(arg); + if (val !== undefined) + return val; + const computed = fn(arg, ...args); + map.set(arg, computed); + return computed; + }; +} +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 36287: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/ieee754@1.2.1/node_modules/ieee754/index.js ***! + \*************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ +exports.read = function (buffer, offset, isLE, mLen, nBytes) { + var e, m + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var nBits = -7 + var i = isLE ? (nBytes - 1) : 0 + var d = isLE ? -1 : 1 + var s = buffer[offset + i] + + i += d + + e = s & ((1 << (-nBits)) - 1) + s >>= (-nBits) + nBits += eLen + for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + m = e & ((1 << (-nBits)) - 1) + e >>= (-nBits) + nBits += mLen + for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {} + + if (e === 0) { + e = 1 - eBias + } else if (e === eMax) { + return m ? NaN : ((s ? -1 : 1) * Infinity) + } else { + m = m + Math.pow(2, mLen) + e = e - eBias + } + return (s ? -1 : 1) * m * Math.pow(2, e - mLen) +} + +exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { + var e, m, c + var eLen = (nBytes * 8) - mLen - 1 + var eMax = (1 << eLen) - 1 + var eBias = eMax >> 1 + var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0) + var i = isLE ? 0 : (nBytes - 1) + var d = isLE ? 1 : -1 + var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0 + + value = Math.abs(value) + + if (isNaN(value) || value === Infinity) { + m = isNaN(value) ? 1 : 0 + e = eMax + } else { + e = Math.floor(Math.log(value) / Math.LN2) + if (value * (c = Math.pow(2, -e)) < 1) { + e-- + c *= 2 + } + if (e + eBias >= 1) { + value += rt / c + } else { + value += rt * Math.pow(2, 1 - eBias) + } + if (value * c >= 2) { + e++ + c /= 2 + } + + if (e + eBias >= eMax) { + m = 0 + e = eMax + } else if (e + eBias >= 1) { + m = ((value * c) - 1) * Math.pow(2, mLen) + e = e + eBias + } else { + m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen) + e = 0 + } + } + + for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {} + + e = (e << mLen) | m + eLen += mLen + for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {} + + buffer[offset + i - d] |= s * 128 +} + + +/***/ }), + +/***/ 36480: +/*!**************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-ecc@2.8.0/node_modules/@peculiar/asn1-ecc/build/es2015/rfc3279.js ***! + \**************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Curve: () => (/* binding */ Curve), +/* harmony export */ ECPVer: () => (/* binding */ ECPVer), +/* harmony export */ ECPoint: () => (/* binding */ ECPoint), +/* harmony export */ FieldElement: () => (/* binding */ FieldElement), +/* harmony export */ FieldID: () => (/* binding */ FieldID), +/* harmony export */ SpecifiedECDomain: () => (/* binding */ SpecifiedECDomain) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +let FieldID = class FieldID { + fieldType; + parameters; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], FieldID.prototype, "fieldType", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], FieldID.prototype, "parameters", void 0); +FieldID = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], FieldID); + +class ECPoint extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString { +} +class FieldElement extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString { +} +let Curve = class Curve { + a; + b; + seed; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.OctetString }) +], Curve.prototype, "a", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.OctetString }) +], Curve.prototype, "b", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString, optional: true, + }) +], Curve.prototype, "seed", void 0); +Curve = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], Curve); + +var ECPVer; +(function (ECPVer) { + ECPVer[ECPVer["ecpVer1"] = 1] = "ecpVer1"; +})(ECPVer || (ECPVer = {})); +let SpecifiedECDomain = class SpecifiedECDomain { + version = ECPVer.ecpVer1; + fieldID; + curve; + base; + order; + cofactor; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], SpecifiedECDomain.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: FieldID }) +], SpecifiedECDomain.prototype, "fieldID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: Curve }) +], SpecifiedECDomain.prototype, "curve", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: ECPoint }) +], SpecifiedECDomain.prototype, "base", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], SpecifiedECDomain.prototype, "order", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, optional: true, + }) +], SpecifiedECDomain.prototype, "cofactor", void 0); +SpecifiedECDomain = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence }) +], SpecifiedECDomain); + + + +/***/ }), + +/***/ 36553: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/v5.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ 80208); +/* harmony import */ var _sha1_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sha1.js */ 14105); + + +var v5 = (0,_v35_js__WEBPACK_IMPORTED_MODULE_0__["default"])('v5', 0x50, _sha1_js__WEBPACK_IMPORTED_MODULE_1__["default"]); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v5); + +/***/ }), + +/***/ 37136: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-csr@2.8.0/node_modules/@peculiar/asn1-csr/build/es2015/index.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Attributes: () => (/* reexport safe */ _attributes_js__WEBPACK_IMPORTED_MODULE_0__.Attributes), +/* harmony export */ CertificationRequest: () => (/* reexport safe */ _certification_request_js__WEBPACK_IMPORTED_MODULE_1__.CertificationRequest), +/* harmony export */ CertificationRequestInfo: () => (/* reexport safe */ _certification_request_info_js__WEBPACK_IMPORTED_MODULE_2__.CertificationRequestInfo) +/* harmony export */ }); +/* harmony import */ var _attributes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./attributes.js */ 91939); +/* harmony import */ var _certification_request_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./certification_request.js */ 83632); +/* harmony import */ var _certification_request_info_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./certification_request_info.js */ 37927); + + + + + +/***/ }), + +/***/ 37177: +/*!*********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/blob/toBlobs.js ***! + \*********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ toBlobs: () => (/* binding */ toBlobs) +/* harmony export */ }); +/* harmony import */ var _constants_blob_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../constants/blob.js */ 48413); +/* harmony import */ var _errors_blob_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../errors/blob.js */ 43201); +/* harmony import */ var _cursor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cursor.js */ 77820); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../data/size.js */ 58036); +/* harmony import */ var _encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../encoding/toBytes.js */ 58548); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); + + + + + + +/** + * Transforms arbitrary data to blobs. + * + * @example + * ```ts + * import { toBlobs, stringToHex } from 'viem' + * + * const blobs = toBlobs({ data: stringToHex('hello world') }) + * ``` + */ +function toBlobs(parameters) { + const to = parameters.to ?? (typeof parameters.data === 'string' ? 'hex' : 'bytes'); + const data = (typeof parameters.data === 'string' + ? (0,_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_4__.hexToBytes)(parameters.data) + : parameters.data); + const size_ = (0,_data_size_js__WEBPACK_IMPORTED_MODULE_3__.size)(data); + if (!size_) + throw new _errors_blob_js__WEBPACK_IMPORTED_MODULE_1__.EmptyBlobError(); + if (size_ > _constants_blob_js__WEBPACK_IMPORTED_MODULE_0__.maxBytesPerTransaction) + throw new _errors_blob_js__WEBPACK_IMPORTED_MODULE_1__.BlobSizeTooLargeError({ + maxSize: _constants_blob_js__WEBPACK_IMPORTED_MODULE_0__.maxBytesPerTransaction, + size: size_, + }); + const blobs = []; + let active = true; + let position = 0; + while (active) { + const blob = (0,_cursor_js__WEBPACK_IMPORTED_MODULE_2__.createCursor)(new Uint8Array(_constants_blob_js__WEBPACK_IMPORTED_MODULE_0__.bytesPerBlob)); + let size = 0; + while (size < _constants_blob_js__WEBPACK_IMPORTED_MODULE_0__.fieldElementsPerBlob) { + const bytes = data.slice(position, position + (_constants_blob_js__WEBPACK_IMPORTED_MODULE_0__.bytesPerFieldElement - 1)); + // Push a zero byte so the field element doesn't overflow the BLS modulus. + blob.pushByte(0x00); + // Push the current segment of data bytes. + blob.pushBytes(bytes); + // If we detect that the current segment of data bytes is less than 31 bytes, + // we can stop processing and push a terminator byte to indicate the end of the blob. + if (bytes.length < 31) { + blob.pushByte(0x80); + active = false; + break; + } + size++; + position += 31; + } + blobs.push(blob); + } + return (to === 'bytes' + ? blobs.map((x) => x.bytes) + : blobs.map((x) => (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_5__.bytesToHex)(x.bytes))); +} +//# sourceMappingURL=toBlobs.js.map + +/***/ }), + +/***/ 37181: +/*!********************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/signature/hashTypedData.js ***! + \********************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ encodeType: () => (/* binding */ encodeType), +/* harmony export */ hashDomain: () => (/* binding */ hashDomain), +/* harmony export */ hashStruct: () => (/* binding */ hashStruct), +/* harmony export */ hashTypedData: () => (/* binding */ hashTypedData) +/* harmony export */ }); +/* harmony import */ var _abi_encodeAbiParameters_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../abi/encodeAbiParameters.js */ 1689); +/* harmony import */ var _data_concat_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/concat.js */ 22745); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); +/* harmony import */ var _hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../hash/keccak256.js */ 25878); +/* harmony import */ var _typedData_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../typedData.js */ 98712); +// Implementation forked and adapted from https://github.com/MetaMask/eth-sig-util/blob/main/src/sign-typed-data.ts + + + + + +function hashTypedData(parameters) { + const { domain = {}, message, primaryType, } = parameters; + const types = { + EIP712Domain: (0,_typedData_js__WEBPACK_IMPORTED_MODULE_4__.getTypesForEIP712Domain)({ domain }), + ...parameters.types, + }; + // Need to do a runtime validation check on addresses, byte ranges, integer ranges, etc + // as we can't statically check this with TypeScript. + (0,_typedData_js__WEBPACK_IMPORTED_MODULE_4__.validateTypedData)({ + domain, + message, + primaryType, + types, + }); + const parts = ['0x1901']; + if (domain) + parts.push(hashDomain({ + domain, + types: types, + })); + if (primaryType !== 'EIP712Domain') + parts.push(hashStruct({ + data: message, + primaryType, + types: types, + })); + return (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_data_concat_js__WEBPACK_IMPORTED_MODULE_1__.concat)(parts)); +} +function hashDomain({ domain, types, }) { + return hashStruct({ + data: domain, + primaryType: 'EIP712Domain', + types: types, + }); +} +function hashStruct({ data, primaryType, types, }) { + const encoded = encodeData({ + data: data, + primaryType, + types: types, + }); + return (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)(encoded); +} +function encodeData({ data, primaryType, types, }) { + const encodedTypes = [{ type: 'bytes32' }]; + const encodedValues = [hashType({ primaryType, types })]; + for (const field of types[primaryType]) { + const [type, value] = encodeField({ + types, + name: field.name, + type: field.type, + value: data[field.name], + }); + encodedTypes.push(type); + encodedValues.push(value); + } + return (0,_abi_encodeAbiParameters_js__WEBPACK_IMPORTED_MODULE_0__.encodeAbiParameters)(encodedTypes, encodedValues); +} +function hashType({ primaryType, types, }) { + const encodedHashType = (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_2__.toHex)(encodeType({ primaryType, types })); + return (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)(encodedHashType); +} +function encodeType({ primaryType, types, }) { + let result = ''; + const unsortedDeps = findTypeDependencies({ primaryType, types }); + unsortedDeps.delete(primaryType); + const deps = [primaryType, ...Array.from(unsortedDeps).sort()]; + for (const type of deps) { + result += `${type}(${types[type] + .map(({ name, type: t }) => `${t} ${name}`) + .join(',')})`; + } + return result; +} +function findTypeDependencies({ primaryType: primaryType_, types, }, results = new Set()) { + const match = primaryType_.match(/^\w*/u); + const primaryType = match?.[0]; + if (results.has(primaryType) || types[primaryType] === undefined) { + return results; + } + results.add(primaryType); + for (const field of types[primaryType]) { + findTypeDependencies({ primaryType: field.type, types }, results); + } + return results; +} +function encodeField({ types, name, type, value, }) { + if (types[type] !== undefined) { + return [ + { type: 'bytes32' }, + (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)(encodeData({ data: value, primaryType: type, types })), + ]; + } + if (type === 'bytes') + return [{ type: 'bytes32' }, (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)(value)]; + if (type === 'string') + return [{ type: 'bytes32' }, (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_2__.toHex)(value))]; + if (type.lastIndexOf(']') === type.length - 1) { + const parsedType = type.slice(0, type.lastIndexOf('[')); + const typeValuePairs = value.map((item) => encodeField({ + name, + type: parsedType, + types, + value: item, + })); + return [ + { type: 'bytes32' }, + (0,_hash_keccak256_js__WEBPACK_IMPORTED_MODULE_3__.keccak256)((0,_abi_encodeAbiParameters_js__WEBPACK_IMPORTED_MODULE_0__.encodeAbiParameters)(typeValuePairs.map(([t]) => t), typeValuePairs.map(([, v]) => v))), + ]; + } + return [{ type }, value]; +} +//# sourceMappingURL=hashTypedData.js.map + +/***/ }), + +/***/ 37350: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-sign@4.2.6/node_modules/browserify-sign/browser/index.js ***! + \*************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var createHash = __webpack_require__(/*! create-hash */ 88852); +var stream = __webpack_require__(/*! readable-stream */ 2393); +var inherits = __webpack_require__(/*! inherits */ 18628); +var sign = __webpack_require__(/*! ./sign */ 61677); +var verify = __webpack_require__(/*! ./verify */ 10765); + +var algorithms = __webpack_require__(/*! ./algorithms.json */ 91801); +Object.keys(algorithms).forEach(function (key) { + algorithms[key].id = Buffer.from(algorithms[key].id, 'hex'); + algorithms[key.toLowerCase()] = algorithms[key]; +}); + +function Sign(algorithm) { + stream.Writable.call(this); + + var data = algorithms[algorithm]; + if (!data) { throw new Error('Unknown message digest'); } + + this._hashType = data.hash; + this._hash = createHash(data.hash); + this._tag = data.id; + this._signType = data.sign; +} +inherits(Sign, stream.Writable); + +Sign.prototype._write = function _write(data, _, done) { + this._hash.update(data); + done(); +}; + +Sign.prototype.update = function update(data, enc) { + this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data); + + return this; +}; + +Sign.prototype.sign = function signMethod(key, enc) { + this.end(); + var hash = this._hash.digest(); + var sig = sign(hash, key, this._hashType, this._signType, this._tag); + + return enc ? sig.toString(enc) : sig; +}; + +function Verify(algorithm) { + stream.Writable.call(this); + + var data = algorithms[algorithm]; + if (!data) { throw new Error('Unknown message digest'); } + + this._hash = createHash(data.hash); + this._tag = data.id; + this._signType = data.sign; +} +inherits(Verify, stream.Writable); + +Verify.prototype._write = function _write(data, _, done) { + this._hash.update(data); + done(); +}; + +Verify.prototype.update = function update(data, enc) { + this._hash.update(typeof data === 'string' ? Buffer.from(data, enc) : data); + + return this; +}; + +Verify.prototype.verify = function verifyMethod(key, sig, enc) { + var sigBuffer = typeof sig === 'string' ? Buffer.from(sig, enc) : sig; + + this.end(); + var hash = this._hash.digest(); + return verify(sigBuffer, hash, key, this._signType, this._tag); +}; + +function createSign(algorithm) { + return new Sign(algorithm); +} + +function createVerify(algorithm) { + return new Verify(algorithm); +} + +module.exports = { + Sign: createSign, + Verify: createVerify, + createSign: createSign, + createVerify: createVerify +}; + + +/***/ }), + +/***/ 37454: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/interceptors.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PostResolutionInterceptors: () => (/* binding */ PostResolutionInterceptors), +/* harmony export */ PreResolutionInterceptors: () => (/* binding */ PreResolutionInterceptors), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 55334); +/* harmony import */ var _registry_base__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./registry-base */ 53395); + + +var PreResolutionInterceptors = (function (_super) { + (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PreResolutionInterceptors, _super); + function PreResolutionInterceptors() { + return _super !== null && _super.apply(this, arguments) || this; + } + return PreResolutionInterceptors; +}(_registry_base__WEBPACK_IMPORTED_MODULE_1__["default"])); + +var PostResolutionInterceptors = (function (_super) { + (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(PostResolutionInterceptors, _super); + function PostResolutionInterceptors() { + return _super !== null && _super.apply(this, arguments) || this; + } + return PostResolutionInterceptors; +}(_registry_base__WEBPACK_IMPORTED_MODULE_1__["default"])); + +var Interceptors = (function () { + function Interceptors() { + this.preResolution = new PreResolutionInterceptors(); + this.postResolution = new PostResolutionInterceptors(); + } + return Interceptors; +}()); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Interceptors); + + +/***/ }), + +/***/ 37519: +/*!************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/tbs_certificate.js ***! + \************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ TBSCertificate: () => (/* binding */ TBSCertificate) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./algorithm_identifier.js */ 99875); +/* harmony import */ var _name_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./name.js */ 8481); +/* harmony import */ var _subject_public_key_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./subject_public_key_info.js */ 22837); +/* harmony import */ var _validity_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./validity.js */ 64572); +/* harmony import */ var _extension_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./extension.js */ 85725); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types.js */ 73725); + + + + + + + + +class TBSCertificate { + version = _types_js__WEBPACK_IMPORTED_MODULE_7__.Version.v1; + serialNumber = new ArrayBuffer(0); + signature = new _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + issuer = new _name_js__WEBPACK_IMPORTED_MODULE_3__.Name(); + validity = new _validity_js__WEBPACK_IMPORTED_MODULE_5__.Validity(); + subject = new _name_js__WEBPACK_IMPORTED_MODULE_3__.Name(); + subjectPublicKeyInfo = new _subject_public_key_info_js__WEBPACK_IMPORTED_MODULE_4__.SubjectPublicKeyInfo(); + issuerUniqueID; + subjectUniqueID; + extensions; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, + context: 0, + defaultValue: _types_js__WEBPACK_IMPORTED_MODULE_7__.Version.v1, + }) +], TBSCertificate.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, + converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], TBSCertificate.prototype, "serialNumber", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], TBSCertificate.prototype, "signature", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _name_js__WEBPACK_IMPORTED_MODULE_3__.Name }) +], TBSCertificate.prototype, "issuer", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _validity_js__WEBPACK_IMPORTED_MODULE_5__.Validity }) +], TBSCertificate.prototype, "validity", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _name_js__WEBPACK_IMPORTED_MODULE_3__.Name }) +], TBSCertificate.prototype, "subject", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _subject_public_key_info_js__WEBPACK_IMPORTED_MODULE_4__.SubjectPublicKeyInfo }) +], TBSCertificate.prototype, "subjectPublicKeyInfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString, + context: 1, + implicit: true, + optional: true, + }) +], TBSCertificate.prototype, "issuerUniqueID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString, context: 2, implicit: true, optional: true, + }) +], TBSCertificate.prototype, "subjectUniqueID", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _extension_js__WEBPACK_IMPORTED_MODULE_6__.Extensions, context: 3, optional: true, + }) +], TBSCertificate.prototype, "extensions", void 0); + + +/***/ }), + +/***/ 37927: +/*!*********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-csr@2.8.0/node_modules/@peculiar/asn1-csr/build/es2015/certification_request_info.js ***! + \*********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CertificationRequestInfo: () => (/* binding */ CertificationRequestInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _attributes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./attributes.js */ 91939); + + + + +class CertificationRequestInfo { + version = 0; + subject = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Name(); + subjectPKInfo = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectPublicKeyInfo(); + attributes = new _attributes_js__WEBPACK_IMPORTED_MODULE_3__.Attributes(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], CertificationRequestInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.Name }) +], CertificationRequestInfo.prototype, "subject", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectPublicKeyInfo }) +], CertificationRequestInfo.prototype, "subjectPKInfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _attributes_js__WEBPACK_IMPORTED_MODULE_3__.Attributes, implicit: true, context: 0, optional: true, + }) +], CertificationRequestInfo.prototype, "attributes", void 0); + + +/***/ }), + +/***/ 38284: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/_shortw_utils.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createCurve: () => (/* binding */ createCurve), +/* harmony export */ getHash: () => (/* binding */ getHash) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_hmac__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/hmac */ 29362); +/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/hashes/utils */ 29964); +/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./abstract/weierstrass.js */ 13319); +/** + * Utilities for short weierstrass curves, combined with noble-hashes. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + + +/** connects noble-curves to noble-hashes */ +function getHash(hash) { + return { + hash, + hmac: (key, ...msgs) => (0,_noble_hashes_hmac__WEBPACK_IMPORTED_MODULE_0__.hmac)(hash, key, (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...msgs)), + randomBytes: _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_1__.randomBytes, + }; +} +function createCurve(curveDef, defHash) { + const create = (hash) => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_2__.weierstrass)({ ...curveDef, ...getHash(hash) }); + return { ...create(defHash), create }; +} +//# sourceMappingURL=_shortw_utils.js.map + +/***/ }), + +/***/ 38478: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/sign.js ***! + \****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $isNaN = __webpack_require__(/*! ./isNaN */ 91082); + +/** @type {import('./sign')} */ +module.exports = function sign(number) { + if ($isNaN(number) || number === 0) { + return number; + } + return number < 0 ? -1 : +1; +}; + + +/***/ }), + +/***/ 38720: +/*!******************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_duplex.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ 31840); +/**/ + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ 60379)); +util.inherits = __webpack_require__(/*! inherits */ 18628); +/**/ + +var Readable = __webpack_require__(/*! ./_stream_readable */ 90150); +var Writable = __webpack_require__(/*! ./_stream_writable */ 40778); + +util.inherits(Duplex, Readable); + +{ + // avoid scope creep, the keys array can then be collected + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + pna.nextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +Object.defineProperty(Duplex.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +Duplex.prototype._destroy = function (err, cb) { + this.push(null); + this.end(); + + pna.nextTick(cb, err); +}; + +/***/ }), + +/***/ 38776: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/providers/provider.js ***! + \***************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isProvider: () => (/* binding */ isProvider) +/* harmony export */ }); +/* harmony import */ var _class_provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./class-provider */ 44711); +/* harmony import */ var _value_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./value-provider */ 45000); +/* harmony import */ var _token_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./token-provider */ 17116); +/* harmony import */ var _factory_provider__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./factory-provider */ 54697); + + + + +function isProvider(provider) { + return ((0,_class_provider__WEBPACK_IMPORTED_MODULE_0__.isClassProvider)(provider) || + (0,_value_provider__WEBPACK_IMPORTED_MODULE_1__.isValueProvider)(provider) || + (0,_token_provider__WEBPACK_IMPORTED_MODULE_2__.isTokenProvider)(provider) || + (0,_factory_provider__WEBPACK_IMPORTED_MODULE_3__.isFactoryProvider)(provider)); +} + + +/***/ }), + +/***/ 39503: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-sign@4.2.6/node_modules/browserify-sign/browser/curves.json ***! + \****************************************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"1.3.132.0.10":"secp256k1","1.3.132.0.33":"p224","1.2.840.10045.3.1.1":"p192","1.2.840.10045.3.1.7":"p256","1.3.132.0.34":"p384","1.3.132.0.35":"p521"}'); + +/***/ }), + +/***/ 39619: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/get-intrinsic@1.3.0/node_modules/get-intrinsic/index.js ***! + \*************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var undefined; + +var $Object = __webpack_require__(/*! es-object-atoms */ 56009); + +var $Error = __webpack_require__(/*! es-errors */ 66307); +var $EvalError = __webpack_require__(/*! es-errors/eval */ 16233); +var $RangeError = __webpack_require__(/*! es-errors/range */ 33654); +var $ReferenceError = __webpack_require__(/*! es-errors/ref */ 96758); +var $SyntaxError = __webpack_require__(/*! es-errors/syntax */ 70064); +var $TypeError = __webpack_require__(/*! es-errors/type */ 41623); +var $URIError = __webpack_require__(/*! es-errors/uri */ 13789); + +var abs = __webpack_require__(/*! math-intrinsics/abs */ 3763); +var floor = __webpack_require__(/*! math-intrinsics/floor */ 49893); +var max = __webpack_require__(/*! math-intrinsics/max */ 83277); +var min = __webpack_require__(/*! math-intrinsics/min */ 58471); +var pow = __webpack_require__(/*! math-intrinsics/pow */ 27709); +var round = __webpack_require__(/*! math-intrinsics/round */ 82587); +var sign = __webpack_require__(/*! math-intrinsics/sign */ 38478); + +var $Function = Function; + +// eslint-disable-next-line consistent-return +var getEvalledConstructor = function (expressionSyntax) { + try { + return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')(); + } catch (e) {} +}; + +var $gOPD = __webpack_require__(/*! gopd */ 67768); +var $defineProperty = __webpack_require__(/*! es-define-property */ 69001); + +var throwTypeError = function () { + throw new $TypeError(); +}; +var ThrowTypeError = $gOPD + ? (function () { + try { + // eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties + arguments.callee; // IE 8 does not throw here + return throwTypeError; + } catch (calleeThrows) { + try { + // IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '') + return $gOPD(arguments, 'callee').get; + } catch (gOPDthrows) { + return throwTypeError; + } + } + }()) + : throwTypeError; + +var hasSymbols = __webpack_require__(/*! has-symbols */ 12877)(); + +var getProto = __webpack_require__(/*! get-proto */ 28495); +var $ObjectGPO = __webpack_require__(/*! get-proto/Object.getPrototypeOf */ 55311); +var $ReflectGPO = __webpack_require__(/*! get-proto/Reflect.getPrototypeOf */ 21033); + +var $apply = __webpack_require__(/*! call-bind-apply-helpers/functionApply */ 43920); +var $call = __webpack_require__(/*! call-bind-apply-helpers/functionCall */ 57522); + +var needsEval = {}; + +var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array); + +var INTRINSICS = { + __proto__: null, + '%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError, + '%Array%': Array, + '%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer, + '%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined, + '%AsyncFromSyncIteratorPrototype%': undefined, + '%AsyncFunction%': needsEval, + '%AsyncGenerator%': needsEval, + '%AsyncGeneratorFunction%': needsEval, + '%AsyncIteratorPrototype%': needsEval, + '%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics, + '%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt, + '%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array, + '%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array, + '%Boolean%': Boolean, + '%DataView%': typeof DataView === 'undefined' ? undefined : DataView, + '%Date%': Date, + '%decodeURI%': decodeURI, + '%decodeURIComponent%': decodeURIComponent, + '%encodeURI%': encodeURI, + '%encodeURIComponent%': encodeURIComponent, + '%Error%': $Error, + '%eval%': eval, // eslint-disable-line no-eval + '%EvalError%': $EvalError, + '%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array, + '%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array, + '%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array, + '%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry, + '%Function%': $Function, + '%GeneratorFunction%': needsEval, + '%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array, + '%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array, + '%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array, + '%isFinite%': isFinite, + '%isNaN%': isNaN, + '%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined, + '%JSON%': typeof JSON === 'object' ? JSON : undefined, + '%Map%': typeof Map === 'undefined' ? undefined : Map, + '%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()), + '%Math%': Math, + '%Number%': Number, + '%Object%': $Object, + '%Object.getOwnPropertyDescriptor%': $gOPD, + '%parseFloat%': parseFloat, + '%parseInt%': parseInt, + '%Promise%': typeof Promise === 'undefined' ? undefined : Promise, + '%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy, + '%RangeError%': $RangeError, + '%ReferenceError%': $ReferenceError, + '%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect, + '%RegExp%': RegExp, + '%Set%': typeof Set === 'undefined' ? undefined : Set, + '%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()), + '%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer, + '%String%': String, + '%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined, + '%Symbol%': hasSymbols ? Symbol : undefined, + '%SyntaxError%': $SyntaxError, + '%ThrowTypeError%': ThrowTypeError, + '%TypedArray%': TypedArray, + '%TypeError%': $TypeError, + '%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array, + '%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray, + '%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array, + '%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array, + '%URIError%': $URIError, + '%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap, + '%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef, + '%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet, + + '%Function.prototype.call%': $call, + '%Function.prototype.apply%': $apply, + '%Object.defineProperty%': $defineProperty, + '%Object.getPrototypeOf%': $ObjectGPO, + '%Math.abs%': abs, + '%Math.floor%': floor, + '%Math.max%': max, + '%Math.min%': min, + '%Math.pow%': pow, + '%Math.round%': round, + '%Math.sign%': sign, + '%Reflect.getPrototypeOf%': $ReflectGPO +}; + +if (getProto) { + try { + null.error; // eslint-disable-line no-unused-expressions + } catch (e) { + // https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229 + var errorProto = getProto(getProto(e)); + INTRINSICS['%Error.prototype%'] = errorProto; + } +} + +var doEval = function doEval(name) { + var value; + if (name === '%AsyncFunction%') { + value = getEvalledConstructor('async function () {}'); + } else if (name === '%GeneratorFunction%') { + value = getEvalledConstructor('function* () {}'); + } else if (name === '%AsyncGeneratorFunction%') { + value = getEvalledConstructor('async function* () {}'); + } else if (name === '%AsyncGenerator%') { + var fn = doEval('%AsyncGeneratorFunction%'); + if (fn) { + value = fn.prototype; + } + } else if (name === '%AsyncIteratorPrototype%') { + var gen = doEval('%AsyncGenerator%'); + if (gen && getProto) { + value = getProto(gen.prototype); + } + } + + INTRINSICS[name] = value; + + return value; +}; + +var LEGACY_ALIASES = { + __proto__: null, + '%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'] +}; + +var bind = __webpack_require__(/*! function-bind */ 94867); +var hasOwn = __webpack_require__(/*! hasown */ 2399); +var $concat = bind.call($call, Array.prototype.concat); +var $spliceApply = bind.call($apply, Array.prototype.splice); +var $replace = bind.call($call, String.prototype.replace); +var $strSlice = bind.call($call, String.prototype.slice); +var $exec = bind.call($call, RegExp.prototype.exec); + +/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */ +var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g; +var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */ +var stringToPath = function stringToPath(string) { + var first = $strSlice(string, 0, 1); + var last = $strSlice(string, -1); + if (first === '%' && last !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`'); + } else if (last === '%' && first !== '%') { + throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`'); + } + var result = []; + $replace(string, rePropName, function (match, number, quote, subString) { + result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match; + }); + return result; +}; +/* end adaptation */ + +var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) { + var intrinsicName = name; + var alias; + if (hasOwn(LEGACY_ALIASES, intrinsicName)) { + alias = LEGACY_ALIASES[intrinsicName]; + intrinsicName = '%' + alias[0] + '%'; + } + + if (hasOwn(INTRINSICS, intrinsicName)) { + var value = INTRINSICS[intrinsicName]; + if (value === needsEval) { + value = doEval(intrinsicName); + } + if (typeof value === 'undefined' && !allowMissing) { + throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!'); + } + + return { + alias: alias, + name: intrinsicName, + value: value + }; + } + + throw new $SyntaxError('intrinsic ' + name + ' does not exist!'); +}; + +module.exports = function GetIntrinsic(name, allowMissing) { + if (typeof name !== 'string' || name.length === 0) { + throw new $TypeError('intrinsic name must be a non-empty string'); + } + if (arguments.length > 1 && typeof allowMissing !== 'boolean') { + throw new $TypeError('"allowMissing" argument must be a boolean'); + } + + if ($exec(/^%?[^%]*%?$/, name) === null) { + throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name'); + } + var parts = stringToPath(name); + var intrinsicBaseName = parts.length > 0 ? parts[0] : ''; + + var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing); + var intrinsicRealName = intrinsic.name; + var value = intrinsic.value; + var skipFurtherCaching = false; + + var alias = intrinsic.alias; + if (alias) { + intrinsicBaseName = alias[0]; + $spliceApply(parts, $concat([0, 1], alias)); + } + + for (var i = 1, isOwn = true; i < parts.length; i += 1) { + var part = parts[i]; + var first = $strSlice(part, 0, 1); + var last = $strSlice(part, -1); + if ( + ( + (first === '"' || first === "'" || first === '`') + || (last === '"' || last === "'" || last === '`') + ) + && first !== last + ) { + throw new $SyntaxError('property names with quotes must have matching quotes'); + } + if (part === 'constructor' || !isOwn) { + skipFurtherCaching = true; + } + + intrinsicBaseName += '.' + part; + intrinsicRealName = '%' + intrinsicBaseName + '%'; + + if (hasOwn(INTRINSICS, intrinsicRealName)) { + value = INTRINSICS[intrinsicRealName]; + } else if (value != null) { + if (!(part in value)) { + if (!allowMissing) { + throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.'); + } + return void undefined; + } + if ($gOPD && (i + 1) >= parts.length) { + var desc = $gOPD(value, part); + isOwn = !!desc; + + // By convention, when a data property is converted to an accessor + // property to emulate a data property that does not suffer from + // the override mistake, that accessor's getter is marked with + // an `originalValue` property. Here, when we detect this, we + // uphold the illusion by pretending to see that original data + // property, i.e., returning the value rather than the getter + // itself. + if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { + value = desc.get; + } else { + value = value[part]; + } + } else { + isOwn = hasOwn(value, part); + value = value[part]; + } + + if (isOwn && !skipFurtherCaching) { + INTRINSICS[intrinsicRealName] = value; + } + } + } + return value; +}; + + +/***/ }), + +/***/ 40113: +/*!**********************************************************************!*\ + !*** ../node_modules/.pnpm/bn.js@5.2.5/node_modules/bn.js/lib/bn.js ***! + \**********************************************************************/ +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +/* module decorator */ module = __webpack_require__.nmd(module); +(function (module, exports) { + 'use strict'; + + // Utils + function assert (val, msg) { + if (!val) throw new Error(msg || 'Assertion failed'); + } + + // Could use `inherits` module, but don't want to move from single file + // architecture yet. + function inherits (ctor, superCtor) { + ctor.super_ = superCtor; + var TempCtor = function () {}; + TempCtor.prototype = superCtor.prototype; + ctor.prototype = new TempCtor(); + ctor.prototype.constructor = ctor; + } + + // BN + + function BN (number, base, endian) { + if (BN.isBN(number)) { + return number; + } + + this.negative = 0; + this.words = null; + this.length = 0; + + // Reduction context + this.red = null; + + if (number !== null) { + if (base === 'le' || base === 'be') { + endian = base; + base = 10; + } + + this._init(number || 0, base || 10, endian || 'be'); + } + } + if (typeof module === 'object') { + module.exports = BN; + } else { + exports.BN = BN; + } + + BN.BN = BN; + BN.wordSize = 26; + + var Buffer; + try { + if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') { + Buffer = window.Buffer; + } else { + Buffer = (__webpack_require__(/*! buffer */ 48677).Buffer); + } + } catch (e) { + } + + BN.isBN = function isBN (num) { + if (num instanceof BN) { + return true; + } + + return num !== null && typeof num === 'object' && + num.constructor.wordSize === BN.wordSize && Array.isArray(num.words); + }; + + BN.max = function max (left, right) { + if (left.cmp(right) > 0) return left; + return right; + }; + + BN.min = function min (left, right) { + if (left.cmp(right) < 0) return left; + return right; + }; + + BN.prototype._init = function init (number, base, endian) { + if (typeof number === 'number') { + return this._initNumber(number, base, endian); + } + + if (typeof number === 'object') { + return this._initArray(number, base, endian); + } + + if (base === 'hex') { + base = 16; + } + assert(base === (base | 0) && base >= 2 && base <= 36); + + number = number.toString().replace(/\s+/g, ''); + var start = 0; + if (number[0] === '-') { + start++; + this.negative = 1; + } + + if (start < number.length) { + if (base === 16) { + this._parseHex(number, start, endian); + } else { + this._parseBase(number, base, start); + if (endian === 'le') { + this._initArray(this.toArray(), base, endian); + } + } + } + }; + + BN.prototype._initNumber = function _initNumber (number, base, endian) { + if (number < 0) { + this.negative = 1; + number = -number; + } + if (number < 0x4000000) { + this.words = [number & 0x3ffffff]; + this.length = 1; + } else if (number < 0x10000000000000) { + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff + ]; + this.length = 2; + } else { + assert(number < 0x20000000000000); // 2 ^ 53 (unsafe) + this.words = [ + number & 0x3ffffff, + (number / 0x4000000) & 0x3ffffff, + 1 + ]; + this.length = 3; + } + + if (endian !== 'le') return; + + // Reverse the bytes + this._initArray(this.toArray(), base, endian); + }; + + BN.prototype._initArray = function _initArray (number, base, endian) { + // Perhaps a Uint8Array + assert(typeof number.length === 'number'); + if (number.length <= 0) { + this.words = [0]; + this.length = 1; + return this; + } + + this.length = Math.ceil(number.length / 3); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + var j, w; + var off = 0; + if (endian === 'be') { + for (i = number.length - 1, j = 0; i >= 0; i -= 3) { + w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } else if (endian === 'le') { + for (i = 0, j = 0; i < number.length; i += 3) { + w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16); + this.words[j] |= (w << off) & 0x3ffffff; + this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff; + off += 24; + if (off >= 26) { + off -= 26; + j++; + } + } + } + return this._strip(); + }; + + function parseHex4Bits (string, index) { + var c = string.charCodeAt(index); + // '0' - '9' + if (c >= 48 && c <= 57) { + return c - 48; + // 'A' - 'F' + } else if (c >= 65 && c <= 70) { + return c - 55; + // 'a' - 'f' + } else if (c >= 97 && c <= 102) { + return c - 87; + } else { + assert(false, 'Invalid character in ' + string); + } + } + + function parseHexByte (string, lowerBound, index) { + var r = parseHex4Bits(string, index); + if (index - 1 >= lowerBound) { + r |= parseHex4Bits(string, index - 1) << 4; + } + return r; + } + + BN.prototype._parseHex = function _parseHex (number, start, endian) { + // Create possibly bigger array to ensure that it fits the number + this.length = Math.ceil((number.length - start) / 6); + this.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; + } + + // 24-bits chunks + var off = 0; + var j = 0; + + var w; + if (endian === 'be') { + for (i = number.length - 1; i >= start; i -= 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } else { + var parseLength = number.length - start; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) { + w = parseHexByte(number, start, i) << off; + this.words[j] |= w & 0x3ffffff; + if (off >= 18) { + off -= 18; + j += 1; + this.words[j] |= w >>> 26; + } else { + off += 8; + } + } + } + + this._strip(); + }; + + function parseBase (str, start, end, mul) { + var r = 0; + var b = 0; + var len = Math.min(str.length, end); + for (var i = start; i < len; i++) { + var c = str.charCodeAt(i) - 48; + + r *= mul; + + // 'a' + if (c >= 49) { + b = c - 49 + 0xa; + + // 'A' + } else if (c >= 17) { + b = c - 17 + 0xa; + + // '0' - '9' + } else { + b = c; + } + assert(c >= 0 && b < mul, 'Invalid character'); + r += b; + } + return r; + } + + BN.prototype._parseBase = function _parseBase (number, base, start) { + // Initialize as zero + this.words = [0]; + this.length = 1; + + // Find length of limb in base + for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) { + limbLen++; + } + limbLen--; + limbPow = (limbPow / base) | 0; + + var total = number.length - start; + var mod = total % limbLen; + var end = Math.min(total, total - mod) + start; + + var word = 0; + for (var i = start; i < end; i += limbLen) { + word = parseBase(number, i, i + limbLen, base); + + this.imuln(limbPow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + if (mod !== 0) { + var pow = 1; + word = parseBase(number, i, number.length, base); + + for (i = 0; i < mod; i++) { + pow *= base; + } + + this.imuln(pow); + if (this.words[0] + word < 0x4000000) { + this.words[0] += word; + } else { + this._iaddn(word); + } + } + + this._strip(); + }; + + BN.prototype.copy = function copy (dest) { + dest.words = new Array(this.length); + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; + } + dest.length = this.length; + dest.negative = this.negative; + dest.red = this.red; + }; + + function move (dest, src) { + dest.words = src.words; + dest.length = src.length; + dest.negative = src.negative; + dest.red = src.red; + } + + BN.prototype._move = function _move (dest) { + move(dest, this); + }; + + BN.prototype.clone = function clone () { + var r = new BN(null); + this.copy(r); + return r; + }; + + BN.prototype._expand = function _expand (size) { + while (this.length < size) { + this.words[this.length++] = 0; + } + return this; + }; + + // Remove leading `0` from `this` + BN.prototype._strip = function strip () { + while (this.length > 1 && this.words[this.length - 1] === 0) { + this.length--; + } + return this._normSign(); + }; + + BN.prototype._normSign = function _normSign () { + // -0 = 0 + if (this.length === 1 && this.words[0] === 0) { + this.negative = 0; + } + return this; + }; + + // Check Symbol.for because not everywhere where Symbol defined + // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility + if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') { + try { + BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect; + } catch (e) { + BN.prototype.inspect = inspect; + } + } else { + BN.prototype.inspect = inspect; + } + + function inspect () { + return (this.red ? ''; + } + + /* + + var zeros = []; + var groupSizes = []; + var groupBases = []; + + var s = ''; + var i = -1; + while (++i < BN.wordSize) { + zeros[i] = s; + s += '0'; + } + groupSizes[0] = 0; + groupSizes[1] = 0; + groupBases[0] = 0; + groupBases[1] = 0; + var base = 2 - 1; + while (++base < 36 + 1) { + var groupSize = 0; + var groupBase = 1; + while (groupBase < (1 << BN.wordSize) / base) { + groupBase *= base; + groupSize += 1; + } + groupSizes[base] = groupSize; + groupBases[base] = groupBase; + } + + */ + + var zeros = [ + '', + '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' + ]; + + var groupSizes = [ + 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 + ]; + + var groupBases = [ + 0, 0, + 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216, + 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625, + 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632, + 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149, + 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176 + ]; + + BN.prototype.toString = function toString (base, padding) { + base = base || 10; + padding = padding | 0 || 1; + + var out; + if (base === 16 || base === 'hex') { + out = ''; + var off = 0; + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = this.words[i]; + var word = (((w << off) | carry) & 0xffffff).toString(16); + carry = (w >>> (24 - off)) & 0xffffff; + off += 2; + if (off >= 26) { + off -= 26; + i--; + } + if (carry !== 0 || i !== this.length - 1) { + out = zeros[6 - word.length] + word + out; + } else { + out = word + out; + } + } + if (carry !== 0) { + out = carry.toString(16) + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + if (base === (base | 0) && base >= 2 && base <= 36) { + // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base)); + var groupSize = groupSizes[base]; + // var groupBase = Math.pow(base, groupSize); + var groupBase = groupBases[base]; + out = ''; + var c = this.clone(); + c.negative = 0; + while (!c.isZero()) { + var r = c.modrn(groupBase).toString(base); + c = c.idivn(groupBase); + + if (!c.isZero()) { + out = zeros[groupSize - r.length] + r + out; + } else { + out = r + out; + } + } + if (this.isZero()) { + out = '0' + out; + } + while (out.length % padding !== 0) { + out = '0' + out; + } + if (this.negative !== 0) { + out = '-' + out; + } + return out; + } + + assert(false, 'Base should be between 2 and 36'); + }; + + BN.prototype.toNumber = function toNumber () { + var ret = this.words[0]; + if (this.length === 2) { + ret += this.words[1] * 0x4000000; + } else if (this.length === 3 && this.words[2] === 0x01) { + // NOTE: at this stage it is known that the top bit is set + ret += 0x10000000000000 + (this.words[1] * 0x4000000); + } else if (this.length > 2) { + assert(false, 'Number can only safely store up to 53 bits'); + } + return (this.negative !== 0) ? -ret : ret; + }; + + BN.prototype.toJSON = function toJSON () { + return this.toString(16, 2); + }; + + if (Buffer) { + BN.prototype.toBuffer = function toBuffer (endian, length) { + return this.toArrayLike(Buffer, endian, length); + }; + } + + BN.prototype.toArray = function toArray (endian, length) { + return this.toArrayLike(Array, endian, length); + }; + + var allocate = function allocate (ArrayType, size) { + if (ArrayType.allocUnsafe) { + return ArrayType.allocUnsafe(size); + } + return new ArrayType(size); + }; + + BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) { + this._strip(); + + var byteLength = this.byteLength(); + var reqLength = length || Math.max(1, byteLength); + assert(byteLength <= reqLength, 'byte array longer than desired length'); + assert(reqLength > 0, 'Requested array length <= 0'); + + var res = allocate(ArrayType, reqLength); + var postfix = endian === 'le' ? 'LE' : 'BE'; + this['_toArrayLike' + postfix](res, byteLength); + return res; + }; + + BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) { + var position = 0; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position++] = word & 0xff; + if (position < res.length) { + res[position++] = (word >> 8) & 0xff; + } + if (position < res.length) { + res[position++] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position < res.length) { + res[position++] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position < res.length) { + res[position++] = carry; + + while (position < res.length) { + res[position++] = 0; + } + } + }; + + BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) { + var position = res.length - 1; + var carry = 0; + + for (var i = 0, shift = 0; i < this.length; i++) { + var word = (this.words[i] << shift) | carry; + + res[position--] = word & 0xff; + if (position >= 0) { + res[position--] = (word >> 8) & 0xff; + } + if (position >= 0) { + res[position--] = (word >> 16) & 0xff; + } + + if (shift === 6) { + if (position >= 0) { + res[position--] = (word >> 24) & 0xff; + } + carry = 0; + shift = 0; + } else { + carry = word >>> 24; + shift += 2; + } + } + + if (position >= 0) { + res[position--] = carry; + + while (position >= 0) { + res[position--] = 0; + } + } + }; + + if (Math.clz32) { + BN.prototype._countBits = function _countBits (w) { + return 32 - Math.clz32(w); + }; + } else { + BN.prototype._countBits = function _countBits (w) { + var t = w; + var r = 0; + if (t >= 0x1000) { + r += 13; + t >>>= 13; + } + if (t >= 0x40) { + r += 7; + t >>>= 7; + } + if (t >= 0x8) { + r += 4; + t >>>= 4; + } + if (t >= 0x02) { + r += 2; + t >>>= 2; + } + return r + t; + }; + } + + BN.prototype._zeroBits = function _zeroBits (w) { + // Short-cut + if (w === 0) return 26; + + var t = w; + var r = 0; + if ((t & 0x1fff) === 0) { + r += 13; + t >>>= 13; + } + if ((t & 0x7f) === 0) { + r += 7; + t >>>= 7; + } + if ((t & 0xf) === 0) { + r += 4; + t >>>= 4; + } + if ((t & 0x3) === 0) { + r += 2; + t >>>= 2; + } + if ((t & 0x1) === 0) { + r++; + } + return r; + }; + + // Return number of used bits in a BN + BN.prototype.bitLength = function bitLength () { + var w = this.words[this.length - 1]; + var hi = this._countBits(w); + return (this.length - 1) * 26 + hi; + }; + + function toBitArray (num) { + var w = new Array(num.bitLength()); + + for (var bit = 0; bit < w.length; bit++) { + var off = (bit / 26) | 0; + var wbit = bit % 26; + + w[bit] = (num.words[off] >>> wbit) & 0x01; + } + + return w; + } + + // Number of trailing zero bits + BN.prototype.zeroBits = function zeroBits () { + if (this.isZero()) return 0; + + var r = 0; + for (var i = 0; i < this.length; i++) { + var b = this._zeroBits(this.words[i]); + r += b; + if (b !== 26) break; + } + return r; + }; + + BN.prototype.byteLength = function byteLength () { + return Math.ceil(this.bitLength() / 8); + }; + + BN.prototype.toTwos = function toTwos (width) { + if (this.negative !== 0) { + return this.abs().inotn(width).iaddn(1); + } + return this.clone(); + }; + + BN.prototype.fromTwos = function fromTwos (width) { + if (this.testn(width - 1)) { + return this.notn(width).iaddn(1).ineg(); + } + return this.clone(); + }; + + BN.prototype.isNeg = function isNeg () { + return this.negative !== 0; + }; + + // Return negative clone of `this` + BN.prototype.neg = function neg () { + return this.clone().ineg(); + }; + + BN.prototype.ineg = function ineg () { + if (!this.isZero()) { + this.negative ^= 1; + } + + return this; + }; + + // Or `num` with `this` in-place + BN.prototype.iuor = function iuor (num) { + while (this.length < num.length) { + this.words[this.length++] = 0; + } + + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; + } + + return this._strip(); + }; + + BN.prototype.ior = function ior (num) { + assert((this.negative | num.negative) === 0); + return this.iuor(num); + }; + + // Or `num` with `this` + BN.prototype.or = function or (num) { + if (this.length > num.length) return this.clone().ior(num); + return num.clone().ior(this); + }; + + BN.prototype.uor = function uor (num) { + if (this.length > num.length) return this.clone().iuor(num); + return num.clone().iuor(this); + }; + + // And `num` with `this` in-place + BN.prototype.iuand = function iuand (num) { + // b = min-length(num, this) + var b; + if (this.length > num.length) { + b = num; + } else { + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = this.words[i] & num.words[i]; + } + + this.length = b.length; + + return this._strip(); + }; + + BN.prototype.iand = function iand (num) { + assert((this.negative | num.negative) === 0); + return this.iuand(num); + }; + + // And `num` with `this` + BN.prototype.and = function and (num) { + if (this.length > num.length) return this.clone().iand(num); + return num.clone().iand(this); + }; + + BN.prototype.uand = function uand (num) { + if (this.length > num.length) return this.clone().iuand(num); + return num.clone().iuand(this); + }; + + // Xor `num` with `this` in-place + BN.prototype.iuxor = function iuxor (num) { + // a.length > b.length + var a; + var b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + for (var i = 0; i < b.length; i++) { + this.words[i] = a.words[i] ^ b.words[i]; + } + + if (this !== a) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = a.length; + + return this._strip(); + }; + + BN.prototype.ixor = function ixor (num) { + assert((this.negative | num.negative) === 0); + return this.iuxor(num); + }; + + // Xor `num` with `this` + BN.prototype.xor = function xor (num) { + if (this.length > num.length) return this.clone().ixor(num); + return num.clone().ixor(this); + }; + + BN.prototype.uxor = function uxor (num) { + if (this.length > num.length) return this.clone().iuxor(num); + return num.clone().iuxor(this); + }; + + // Not ``this`` with ``width`` bitwidth + BN.prototype.inotn = function inotn (width) { + assert(typeof width === 'number' && width >= 0); + + var bytesNeeded = Math.ceil(width / 26) | 0; + var bitsLeft = width % 26; + + // Extend the buffer with leading zeroes + this._expand(bytesNeeded); + + if (bitsLeft > 0) { + bytesNeeded--; + } + + // Handle complete words + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 0x3ffffff; + } + + // Handle the residue + if (bitsLeft > 0) { + this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft)); + i++; + } + + // Clear words above the requested width so the result stays below 2 ** width + for (; i < this.length; i++) { + this.words[i] = 0; + } + + // And remove leading zeroes + return this._strip(); + }; + + BN.prototype.notn = function notn (width) { + return this.clone().inotn(width); + }; + + // Set `bit` of `this` + BN.prototype.setn = function setn (bit, val) { + assert(typeof bit === 'number' && bit >= 0); + + var off = (bit / 26) | 0; + var wbit = bit % 26; + + this._expand(off + 1); + + if (val) { + this.words[off] = this.words[off] | (1 << wbit); + } else { + this.words[off] = this.words[off] & ~(1 << wbit); + } + + return this._strip(); + }; + + // Add `num` to `this` in-place + BN.prototype.iadd = function iadd (num) { + var r; + + // negative + positive + if (this.negative !== 0 && num.negative === 0) { + this.negative = 0; + r = this.isub(num); + this.negative ^= 1; + return this._normSign(); + + // positive + negative + } else if (this.negative === 0 && num.negative !== 0) { + num.negative = 0; + r = this.isub(num); + num.negative = 1; + return r._normSign(); + } + + // a.length > b.length + var a, b; + if (this.length > num.length) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) + (b.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + this.words[i] = r & 0x3ffffff; + carry = r >>> 26; + } + + this.length = a.length; + if (carry !== 0) { + this.words[this.length] = carry; + this.length++; + // Copy the rest of the words + } else if (a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + return this; + }; + + // Add `num` to `this` + BN.prototype.add = function add (num) { + var res; + if (num.negative !== 0 && this.negative === 0) { + num.negative = 0; + res = this.sub(num); + num.negative ^= 1; + return res; + } else if (num.negative === 0 && this.negative !== 0) { + this.negative = 0; + res = num.sub(this); + this.negative = 1; + return res; + } + + if (this.length > num.length) return this.clone().iadd(num); + + return num.clone().iadd(this); + }; + + // Subtract `num` from `this` in-place + BN.prototype.isub = function isub (num) { + // this - (-num) = this + num + if (num.negative !== 0) { + num.negative = 0; + var r = this.iadd(num); + num.negative = 1; + return r._normSign(); + + // -this - num = -(this + num) + } else if (this.negative !== 0) { + this.negative = 0; + this.iadd(num); + this.negative = 1; + return this._normSign(); + } + + // At this point both numbers are positive + var cmp = this.cmp(num); + + // Optimization - zeroify + if (cmp === 0) { + this.negative = 0; + this.length = 1; + this.words[0] = 0; + return this; + } + + // a > b + var a, b; + if (cmp > 0) { + a = this; + b = num; + } else { + a = num; + b = this; + } + + var carry = 0; + for (var i = 0; i < b.length; i++) { + r = (a.words[i] | 0) - (b.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + for (; carry !== 0 && i < a.length; i++) { + r = (a.words[i] | 0) + carry; + carry = r >> 26; + this.words[i] = r & 0x3ffffff; + } + + // Copy rest of the words + if (carry === 0 && i < a.length && a !== this) { + for (; i < a.length; i++) { + this.words[i] = a.words[i]; + } + } + + this.length = Math.max(this.length, i); + + if (a !== this) { + this.negative = 1; + } + + return this._strip(); + }; + + // Subtract `num` from `this` + BN.prototype.sub = function sub (num) { + return this.clone().isub(num); + }; + + function smallMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + var len = (self.length + num.length) | 0; + out.length = len; + len = (len - 1) | 0; + + // Peel one iteration (compiler can't do it, because of code complexity) + var a = self.words[0] | 0; + var b = num.words[0] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + var carry = (r / 0x4000000) | 0; + out.words[0] = lo; + + for (var k = 1; k < len; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = carry >>> 26; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = (k - j) | 0; + a = self.words[i] | 0; + b = num.words[j] | 0; + r = a * b + rword; + ncarry += (r / 0x4000000) | 0; + rword = r & 0x3ffffff; + } + out.words[k] = rword | 0; + carry = ncarry | 0; + } + if (carry !== 0) { + out.words[k] = carry | 0; + } else { + out.length--; + } + + return out._strip(); + } + + // TODO(indutny): it may be reasonable to omit it for users who don't need + // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit + // multiplication (like elliptic secp256k1). + var comb10MulTo = function comb10MulTo (self, num, out) { + var a = self.words; + var b = num.words; + var o = out.words; + var c = 0; + var lo; + var mid; + var hi; + var a0 = a[0] | 0; + var al0 = a0 & 0x1fff; + var ah0 = a0 >>> 13; + var a1 = a[1] | 0; + var al1 = a1 & 0x1fff; + var ah1 = a1 >>> 13; + var a2 = a[2] | 0; + var al2 = a2 & 0x1fff; + var ah2 = a2 >>> 13; + var a3 = a[3] | 0; + var al3 = a3 & 0x1fff; + var ah3 = a3 >>> 13; + var a4 = a[4] | 0; + var al4 = a4 & 0x1fff; + var ah4 = a4 >>> 13; + var a5 = a[5] | 0; + var al5 = a5 & 0x1fff; + var ah5 = a5 >>> 13; + var a6 = a[6] | 0; + var al6 = a6 & 0x1fff; + var ah6 = a6 >>> 13; + var a7 = a[7] | 0; + var al7 = a7 & 0x1fff; + var ah7 = a7 >>> 13; + var a8 = a[8] | 0; + var al8 = a8 & 0x1fff; + var ah8 = a8 >>> 13; + var a9 = a[9] | 0; + var al9 = a9 & 0x1fff; + var ah9 = a9 >>> 13; + var b0 = b[0] | 0; + var bl0 = b0 & 0x1fff; + var bh0 = b0 >>> 13; + var b1 = b[1] | 0; + var bl1 = b1 & 0x1fff; + var bh1 = b1 >>> 13; + var b2 = b[2] | 0; + var bl2 = b2 & 0x1fff; + var bh2 = b2 >>> 13; + var b3 = b[3] | 0; + var bl3 = b3 & 0x1fff; + var bh3 = b3 >>> 13; + var b4 = b[4] | 0; + var bl4 = b4 & 0x1fff; + var bh4 = b4 >>> 13; + var b5 = b[5] | 0; + var bl5 = b5 & 0x1fff; + var bh5 = b5 >>> 13; + var b6 = b[6] | 0; + var bl6 = b6 & 0x1fff; + var bh6 = b6 >>> 13; + var b7 = b[7] | 0; + var bl7 = b7 & 0x1fff; + var bh7 = b7 >>> 13; + var b8 = b[8] | 0; + var bl8 = b8 & 0x1fff; + var bh8 = b8 >>> 13; + var b9 = b[9] | 0; + var bl9 = b9 & 0x1fff; + var bh9 = b9 >>> 13; + + out.negative = self.negative ^ num.negative; + out.length = 19; + /* k = 0 */ + lo = Math.imul(al0, bl0); + mid = Math.imul(al0, bh0); + mid = (mid + Math.imul(ah0, bl0)) | 0; + hi = Math.imul(ah0, bh0); + var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0; + w0 &= 0x3ffffff; + /* k = 1 */ + lo = Math.imul(al1, bl0); + mid = Math.imul(al1, bh0); + mid = (mid + Math.imul(ah1, bl0)) | 0; + hi = Math.imul(ah1, bh0); + lo = (lo + Math.imul(al0, bl1)) | 0; + mid = (mid + Math.imul(al0, bh1)) | 0; + mid = (mid + Math.imul(ah0, bl1)) | 0; + hi = (hi + Math.imul(ah0, bh1)) | 0; + var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0; + w1 &= 0x3ffffff; + /* k = 2 */ + lo = Math.imul(al2, bl0); + mid = Math.imul(al2, bh0); + mid = (mid + Math.imul(ah2, bl0)) | 0; + hi = Math.imul(ah2, bh0); + lo = (lo + Math.imul(al1, bl1)) | 0; + mid = (mid + Math.imul(al1, bh1)) | 0; + mid = (mid + Math.imul(ah1, bl1)) | 0; + hi = (hi + Math.imul(ah1, bh1)) | 0; + lo = (lo + Math.imul(al0, bl2)) | 0; + mid = (mid + Math.imul(al0, bh2)) | 0; + mid = (mid + Math.imul(ah0, bl2)) | 0; + hi = (hi + Math.imul(ah0, bh2)) | 0; + var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0; + w2 &= 0x3ffffff; + /* k = 3 */ + lo = Math.imul(al3, bl0); + mid = Math.imul(al3, bh0); + mid = (mid + Math.imul(ah3, bl0)) | 0; + hi = Math.imul(ah3, bh0); + lo = (lo + Math.imul(al2, bl1)) | 0; + mid = (mid + Math.imul(al2, bh1)) | 0; + mid = (mid + Math.imul(ah2, bl1)) | 0; + hi = (hi + Math.imul(ah2, bh1)) | 0; + lo = (lo + Math.imul(al1, bl2)) | 0; + mid = (mid + Math.imul(al1, bh2)) | 0; + mid = (mid + Math.imul(ah1, bl2)) | 0; + hi = (hi + Math.imul(ah1, bh2)) | 0; + lo = (lo + Math.imul(al0, bl3)) | 0; + mid = (mid + Math.imul(al0, bh3)) | 0; + mid = (mid + Math.imul(ah0, bl3)) | 0; + hi = (hi + Math.imul(ah0, bh3)) | 0; + var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0; + w3 &= 0x3ffffff; + /* k = 4 */ + lo = Math.imul(al4, bl0); + mid = Math.imul(al4, bh0); + mid = (mid + Math.imul(ah4, bl0)) | 0; + hi = Math.imul(ah4, bh0); + lo = (lo + Math.imul(al3, bl1)) | 0; + mid = (mid + Math.imul(al3, bh1)) | 0; + mid = (mid + Math.imul(ah3, bl1)) | 0; + hi = (hi + Math.imul(ah3, bh1)) | 0; + lo = (lo + Math.imul(al2, bl2)) | 0; + mid = (mid + Math.imul(al2, bh2)) | 0; + mid = (mid + Math.imul(ah2, bl2)) | 0; + hi = (hi + Math.imul(ah2, bh2)) | 0; + lo = (lo + Math.imul(al1, bl3)) | 0; + mid = (mid + Math.imul(al1, bh3)) | 0; + mid = (mid + Math.imul(ah1, bl3)) | 0; + hi = (hi + Math.imul(ah1, bh3)) | 0; + lo = (lo + Math.imul(al0, bl4)) | 0; + mid = (mid + Math.imul(al0, bh4)) | 0; + mid = (mid + Math.imul(ah0, bl4)) | 0; + hi = (hi + Math.imul(ah0, bh4)) | 0; + var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0; + w4 &= 0x3ffffff; + /* k = 5 */ + lo = Math.imul(al5, bl0); + mid = Math.imul(al5, bh0); + mid = (mid + Math.imul(ah5, bl0)) | 0; + hi = Math.imul(ah5, bh0); + lo = (lo + Math.imul(al4, bl1)) | 0; + mid = (mid + Math.imul(al4, bh1)) | 0; + mid = (mid + Math.imul(ah4, bl1)) | 0; + hi = (hi + Math.imul(ah4, bh1)) | 0; + lo = (lo + Math.imul(al3, bl2)) | 0; + mid = (mid + Math.imul(al3, bh2)) | 0; + mid = (mid + Math.imul(ah3, bl2)) | 0; + hi = (hi + Math.imul(ah3, bh2)) | 0; + lo = (lo + Math.imul(al2, bl3)) | 0; + mid = (mid + Math.imul(al2, bh3)) | 0; + mid = (mid + Math.imul(ah2, bl3)) | 0; + hi = (hi + Math.imul(ah2, bh3)) | 0; + lo = (lo + Math.imul(al1, bl4)) | 0; + mid = (mid + Math.imul(al1, bh4)) | 0; + mid = (mid + Math.imul(ah1, bl4)) | 0; + hi = (hi + Math.imul(ah1, bh4)) | 0; + lo = (lo + Math.imul(al0, bl5)) | 0; + mid = (mid + Math.imul(al0, bh5)) | 0; + mid = (mid + Math.imul(ah0, bl5)) | 0; + hi = (hi + Math.imul(ah0, bh5)) | 0; + var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0; + w5 &= 0x3ffffff; + /* k = 6 */ + lo = Math.imul(al6, bl0); + mid = Math.imul(al6, bh0); + mid = (mid + Math.imul(ah6, bl0)) | 0; + hi = Math.imul(ah6, bh0); + lo = (lo + Math.imul(al5, bl1)) | 0; + mid = (mid + Math.imul(al5, bh1)) | 0; + mid = (mid + Math.imul(ah5, bl1)) | 0; + hi = (hi + Math.imul(ah5, bh1)) | 0; + lo = (lo + Math.imul(al4, bl2)) | 0; + mid = (mid + Math.imul(al4, bh2)) | 0; + mid = (mid + Math.imul(ah4, bl2)) | 0; + hi = (hi + Math.imul(ah4, bh2)) | 0; + lo = (lo + Math.imul(al3, bl3)) | 0; + mid = (mid + Math.imul(al3, bh3)) | 0; + mid = (mid + Math.imul(ah3, bl3)) | 0; + hi = (hi + Math.imul(ah3, bh3)) | 0; + lo = (lo + Math.imul(al2, bl4)) | 0; + mid = (mid + Math.imul(al2, bh4)) | 0; + mid = (mid + Math.imul(ah2, bl4)) | 0; + hi = (hi + Math.imul(ah2, bh4)) | 0; + lo = (lo + Math.imul(al1, bl5)) | 0; + mid = (mid + Math.imul(al1, bh5)) | 0; + mid = (mid + Math.imul(ah1, bl5)) | 0; + hi = (hi + Math.imul(ah1, bh5)) | 0; + lo = (lo + Math.imul(al0, bl6)) | 0; + mid = (mid + Math.imul(al0, bh6)) | 0; + mid = (mid + Math.imul(ah0, bl6)) | 0; + hi = (hi + Math.imul(ah0, bh6)) | 0; + var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0; + w6 &= 0x3ffffff; + /* k = 7 */ + lo = Math.imul(al7, bl0); + mid = Math.imul(al7, bh0); + mid = (mid + Math.imul(ah7, bl0)) | 0; + hi = Math.imul(ah7, bh0); + lo = (lo + Math.imul(al6, bl1)) | 0; + mid = (mid + Math.imul(al6, bh1)) | 0; + mid = (mid + Math.imul(ah6, bl1)) | 0; + hi = (hi + Math.imul(ah6, bh1)) | 0; + lo = (lo + Math.imul(al5, bl2)) | 0; + mid = (mid + Math.imul(al5, bh2)) | 0; + mid = (mid + Math.imul(ah5, bl2)) | 0; + hi = (hi + Math.imul(ah5, bh2)) | 0; + lo = (lo + Math.imul(al4, bl3)) | 0; + mid = (mid + Math.imul(al4, bh3)) | 0; + mid = (mid + Math.imul(ah4, bl3)) | 0; + hi = (hi + Math.imul(ah4, bh3)) | 0; + lo = (lo + Math.imul(al3, bl4)) | 0; + mid = (mid + Math.imul(al3, bh4)) | 0; + mid = (mid + Math.imul(ah3, bl4)) | 0; + hi = (hi + Math.imul(ah3, bh4)) | 0; + lo = (lo + Math.imul(al2, bl5)) | 0; + mid = (mid + Math.imul(al2, bh5)) | 0; + mid = (mid + Math.imul(ah2, bl5)) | 0; + hi = (hi + Math.imul(ah2, bh5)) | 0; + lo = (lo + Math.imul(al1, bl6)) | 0; + mid = (mid + Math.imul(al1, bh6)) | 0; + mid = (mid + Math.imul(ah1, bl6)) | 0; + hi = (hi + Math.imul(ah1, bh6)) | 0; + lo = (lo + Math.imul(al0, bl7)) | 0; + mid = (mid + Math.imul(al0, bh7)) | 0; + mid = (mid + Math.imul(ah0, bl7)) | 0; + hi = (hi + Math.imul(ah0, bh7)) | 0; + var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0; + w7 &= 0x3ffffff; + /* k = 8 */ + lo = Math.imul(al8, bl0); + mid = Math.imul(al8, bh0); + mid = (mid + Math.imul(ah8, bl0)) | 0; + hi = Math.imul(ah8, bh0); + lo = (lo + Math.imul(al7, bl1)) | 0; + mid = (mid + Math.imul(al7, bh1)) | 0; + mid = (mid + Math.imul(ah7, bl1)) | 0; + hi = (hi + Math.imul(ah7, bh1)) | 0; + lo = (lo + Math.imul(al6, bl2)) | 0; + mid = (mid + Math.imul(al6, bh2)) | 0; + mid = (mid + Math.imul(ah6, bl2)) | 0; + hi = (hi + Math.imul(ah6, bh2)) | 0; + lo = (lo + Math.imul(al5, bl3)) | 0; + mid = (mid + Math.imul(al5, bh3)) | 0; + mid = (mid + Math.imul(ah5, bl3)) | 0; + hi = (hi + Math.imul(ah5, bh3)) | 0; + lo = (lo + Math.imul(al4, bl4)) | 0; + mid = (mid + Math.imul(al4, bh4)) | 0; + mid = (mid + Math.imul(ah4, bl4)) | 0; + hi = (hi + Math.imul(ah4, bh4)) | 0; + lo = (lo + Math.imul(al3, bl5)) | 0; + mid = (mid + Math.imul(al3, bh5)) | 0; + mid = (mid + Math.imul(ah3, bl5)) | 0; + hi = (hi + Math.imul(ah3, bh5)) | 0; + lo = (lo + Math.imul(al2, bl6)) | 0; + mid = (mid + Math.imul(al2, bh6)) | 0; + mid = (mid + Math.imul(ah2, bl6)) | 0; + hi = (hi + Math.imul(ah2, bh6)) | 0; + lo = (lo + Math.imul(al1, bl7)) | 0; + mid = (mid + Math.imul(al1, bh7)) | 0; + mid = (mid + Math.imul(ah1, bl7)) | 0; + hi = (hi + Math.imul(ah1, bh7)) | 0; + lo = (lo + Math.imul(al0, bl8)) | 0; + mid = (mid + Math.imul(al0, bh8)) | 0; + mid = (mid + Math.imul(ah0, bl8)) | 0; + hi = (hi + Math.imul(ah0, bh8)) | 0; + var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0; + w8 &= 0x3ffffff; + /* k = 9 */ + lo = Math.imul(al9, bl0); + mid = Math.imul(al9, bh0); + mid = (mid + Math.imul(ah9, bl0)) | 0; + hi = Math.imul(ah9, bh0); + lo = (lo + Math.imul(al8, bl1)) | 0; + mid = (mid + Math.imul(al8, bh1)) | 0; + mid = (mid + Math.imul(ah8, bl1)) | 0; + hi = (hi + Math.imul(ah8, bh1)) | 0; + lo = (lo + Math.imul(al7, bl2)) | 0; + mid = (mid + Math.imul(al7, bh2)) | 0; + mid = (mid + Math.imul(ah7, bl2)) | 0; + hi = (hi + Math.imul(ah7, bh2)) | 0; + lo = (lo + Math.imul(al6, bl3)) | 0; + mid = (mid + Math.imul(al6, bh3)) | 0; + mid = (mid + Math.imul(ah6, bl3)) | 0; + hi = (hi + Math.imul(ah6, bh3)) | 0; + lo = (lo + Math.imul(al5, bl4)) | 0; + mid = (mid + Math.imul(al5, bh4)) | 0; + mid = (mid + Math.imul(ah5, bl4)) | 0; + hi = (hi + Math.imul(ah5, bh4)) | 0; + lo = (lo + Math.imul(al4, bl5)) | 0; + mid = (mid + Math.imul(al4, bh5)) | 0; + mid = (mid + Math.imul(ah4, bl5)) | 0; + hi = (hi + Math.imul(ah4, bh5)) | 0; + lo = (lo + Math.imul(al3, bl6)) | 0; + mid = (mid + Math.imul(al3, bh6)) | 0; + mid = (mid + Math.imul(ah3, bl6)) | 0; + hi = (hi + Math.imul(ah3, bh6)) | 0; + lo = (lo + Math.imul(al2, bl7)) | 0; + mid = (mid + Math.imul(al2, bh7)) | 0; + mid = (mid + Math.imul(ah2, bl7)) | 0; + hi = (hi + Math.imul(ah2, bh7)) | 0; + lo = (lo + Math.imul(al1, bl8)) | 0; + mid = (mid + Math.imul(al1, bh8)) | 0; + mid = (mid + Math.imul(ah1, bl8)) | 0; + hi = (hi + Math.imul(ah1, bh8)) | 0; + lo = (lo + Math.imul(al0, bl9)) | 0; + mid = (mid + Math.imul(al0, bh9)) | 0; + mid = (mid + Math.imul(ah0, bl9)) | 0; + hi = (hi + Math.imul(ah0, bh9)) | 0; + var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0; + w9 &= 0x3ffffff; + /* k = 10 */ + lo = Math.imul(al9, bl1); + mid = Math.imul(al9, bh1); + mid = (mid + Math.imul(ah9, bl1)) | 0; + hi = Math.imul(ah9, bh1); + lo = (lo + Math.imul(al8, bl2)) | 0; + mid = (mid + Math.imul(al8, bh2)) | 0; + mid = (mid + Math.imul(ah8, bl2)) | 0; + hi = (hi + Math.imul(ah8, bh2)) | 0; + lo = (lo + Math.imul(al7, bl3)) | 0; + mid = (mid + Math.imul(al7, bh3)) | 0; + mid = (mid + Math.imul(ah7, bl3)) | 0; + hi = (hi + Math.imul(ah7, bh3)) | 0; + lo = (lo + Math.imul(al6, bl4)) | 0; + mid = (mid + Math.imul(al6, bh4)) | 0; + mid = (mid + Math.imul(ah6, bl4)) | 0; + hi = (hi + Math.imul(ah6, bh4)) | 0; + lo = (lo + Math.imul(al5, bl5)) | 0; + mid = (mid + Math.imul(al5, bh5)) | 0; + mid = (mid + Math.imul(ah5, bl5)) | 0; + hi = (hi + Math.imul(ah5, bh5)) | 0; + lo = (lo + Math.imul(al4, bl6)) | 0; + mid = (mid + Math.imul(al4, bh6)) | 0; + mid = (mid + Math.imul(ah4, bl6)) | 0; + hi = (hi + Math.imul(ah4, bh6)) | 0; + lo = (lo + Math.imul(al3, bl7)) | 0; + mid = (mid + Math.imul(al3, bh7)) | 0; + mid = (mid + Math.imul(ah3, bl7)) | 0; + hi = (hi + Math.imul(ah3, bh7)) | 0; + lo = (lo + Math.imul(al2, bl8)) | 0; + mid = (mid + Math.imul(al2, bh8)) | 0; + mid = (mid + Math.imul(ah2, bl8)) | 0; + hi = (hi + Math.imul(ah2, bh8)) | 0; + lo = (lo + Math.imul(al1, bl9)) | 0; + mid = (mid + Math.imul(al1, bh9)) | 0; + mid = (mid + Math.imul(ah1, bl9)) | 0; + hi = (hi + Math.imul(ah1, bh9)) | 0; + var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0; + w10 &= 0x3ffffff; + /* k = 11 */ + lo = Math.imul(al9, bl2); + mid = Math.imul(al9, bh2); + mid = (mid + Math.imul(ah9, bl2)) | 0; + hi = Math.imul(ah9, bh2); + lo = (lo + Math.imul(al8, bl3)) | 0; + mid = (mid + Math.imul(al8, bh3)) | 0; + mid = (mid + Math.imul(ah8, bl3)) | 0; + hi = (hi + Math.imul(ah8, bh3)) | 0; + lo = (lo + Math.imul(al7, bl4)) | 0; + mid = (mid + Math.imul(al7, bh4)) | 0; + mid = (mid + Math.imul(ah7, bl4)) | 0; + hi = (hi + Math.imul(ah7, bh4)) | 0; + lo = (lo + Math.imul(al6, bl5)) | 0; + mid = (mid + Math.imul(al6, bh5)) | 0; + mid = (mid + Math.imul(ah6, bl5)) | 0; + hi = (hi + Math.imul(ah6, bh5)) | 0; + lo = (lo + Math.imul(al5, bl6)) | 0; + mid = (mid + Math.imul(al5, bh6)) | 0; + mid = (mid + Math.imul(ah5, bl6)) | 0; + hi = (hi + Math.imul(ah5, bh6)) | 0; + lo = (lo + Math.imul(al4, bl7)) | 0; + mid = (mid + Math.imul(al4, bh7)) | 0; + mid = (mid + Math.imul(ah4, bl7)) | 0; + hi = (hi + Math.imul(ah4, bh7)) | 0; + lo = (lo + Math.imul(al3, bl8)) | 0; + mid = (mid + Math.imul(al3, bh8)) | 0; + mid = (mid + Math.imul(ah3, bl8)) | 0; + hi = (hi + Math.imul(ah3, bh8)) | 0; + lo = (lo + Math.imul(al2, bl9)) | 0; + mid = (mid + Math.imul(al2, bh9)) | 0; + mid = (mid + Math.imul(ah2, bl9)) | 0; + hi = (hi + Math.imul(ah2, bh9)) | 0; + var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0; + w11 &= 0x3ffffff; + /* k = 12 */ + lo = Math.imul(al9, bl3); + mid = Math.imul(al9, bh3); + mid = (mid + Math.imul(ah9, bl3)) | 0; + hi = Math.imul(ah9, bh3); + lo = (lo + Math.imul(al8, bl4)) | 0; + mid = (mid + Math.imul(al8, bh4)) | 0; + mid = (mid + Math.imul(ah8, bl4)) | 0; + hi = (hi + Math.imul(ah8, bh4)) | 0; + lo = (lo + Math.imul(al7, bl5)) | 0; + mid = (mid + Math.imul(al7, bh5)) | 0; + mid = (mid + Math.imul(ah7, bl5)) | 0; + hi = (hi + Math.imul(ah7, bh5)) | 0; + lo = (lo + Math.imul(al6, bl6)) | 0; + mid = (mid + Math.imul(al6, bh6)) | 0; + mid = (mid + Math.imul(ah6, bl6)) | 0; + hi = (hi + Math.imul(ah6, bh6)) | 0; + lo = (lo + Math.imul(al5, bl7)) | 0; + mid = (mid + Math.imul(al5, bh7)) | 0; + mid = (mid + Math.imul(ah5, bl7)) | 0; + hi = (hi + Math.imul(ah5, bh7)) | 0; + lo = (lo + Math.imul(al4, bl8)) | 0; + mid = (mid + Math.imul(al4, bh8)) | 0; + mid = (mid + Math.imul(ah4, bl8)) | 0; + hi = (hi + Math.imul(ah4, bh8)) | 0; + lo = (lo + Math.imul(al3, bl9)) | 0; + mid = (mid + Math.imul(al3, bh9)) | 0; + mid = (mid + Math.imul(ah3, bl9)) | 0; + hi = (hi + Math.imul(ah3, bh9)) | 0; + var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0; + w12 &= 0x3ffffff; + /* k = 13 */ + lo = Math.imul(al9, bl4); + mid = Math.imul(al9, bh4); + mid = (mid + Math.imul(ah9, bl4)) | 0; + hi = Math.imul(ah9, bh4); + lo = (lo + Math.imul(al8, bl5)) | 0; + mid = (mid + Math.imul(al8, bh5)) | 0; + mid = (mid + Math.imul(ah8, bl5)) | 0; + hi = (hi + Math.imul(ah8, bh5)) | 0; + lo = (lo + Math.imul(al7, bl6)) | 0; + mid = (mid + Math.imul(al7, bh6)) | 0; + mid = (mid + Math.imul(ah7, bl6)) | 0; + hi = (hi + Math.imul(ah7, bh6)) | 0; + lo = (lo + Math.imul(al6, bl7)) | 0; + mid = (mid + Math.imul(al6, bh7)) | 0; + mid = (mid + Math.imul(ah6, bl7)) | 0; + hi = (hi + Math.imul(ah6, bh7)) | 0; + lo = (lo + Math.imul(al5, bl8)) | 0; + mid = (mid + Math.imul(al5, bh8)) | 0; + mid = (mid + Math.imul(ah5, bl8)) | 0; + hi = (hi + Math.imul(ah5, bh8)) | 0; + lo = (lo + Math.imul(al4, bl9)) | 0; + mid = (mid + Math.imul(al4, bh9)) | 0; + mid = (mid + Math.imul(ah4, bl9)) | 0; + hi = (hi + Math.imul(ah4, bh9)) | 0; + var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0; + w13 &= 0x3ffffff; + /* k = 14 */ + lo = Math.imul(al9, bl5); + mid = Math.imul(al9, bh5); + mid = (mid + Math.imul(ah9, bl5)) | 0; + hi = Math.imul(ah9, bh5); + lo = (lo + Math.imul(al8, bl6)) | 0; + mid = (mid + Math.imul(al8, bh6)) | 0; + mid = (mid + Math.imul(ah8, bl6)) | 0; + hi = (hi + Math.imul(ah8, bh6)) | 0; + lo = (lo + Math.imul(al7, bl7)) | 0; + mid = (mid + Math.imul(al7, bh7)) | 0; + mid = (mid + Math.imul(ah7, bl7)) | 0; + hi = (hi + Math.imul(ah7, bh7)) | 0; + lo = (lo + Math.imul(al6, bl8)) | 0; + mid = (mid + Math.imul(al6, bh8)) | 0; + mid = (mid + Math.imul(ah6, bl8)) | 0; + hi = (hi + Math.imul(ah6, bh8)) | 0; + lo = (lo + Math.imul(al5, bl9)) | 0; + mid = (mid + Math.imul(al5, bh9)) | 0; + mid = (mid + Math.imul(ah5, bl9)) | 0; + hi = (hi + Math.imul(ah5, bh9)) | 0; + var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0; + w14 &= 0x3ffffff; + /* k = 15 */ + lo = Math.imul(al9, bl6); + mid = Math.imul(al9, bh6); + mid = (mid + Math.imul(ah9, bl6)) | 0; + hi = Math.imul(ah9, bh6); + lo = (lo + Math.imul(al8, bl7)) | 0; + mid = (mid + Math.imul(al8, bh7)) | 0; + mid = (mid + Math.imul(ah8, bl7)) | 0; + hi = (hi + Math.imul(ah8, bh7)) | 0; + lo = (lo + Math.imul(al7, bl8)) | 0; + mid = (mid + Math.imul(al7, bh8)) | 0; + mid = (mid + Math.imul(ah7, bl8)) | 0; + hi = (hi + Math.imul(ah7, bh8)) | 0; + lo = (lo + Math.imul(al6, bl9)) | 0; + mid = (mid + Math.imul(al6, bh9)) | 0; + mid = (mid + Math.imul(ah6, bl9)) | 0; + hi = (hi + Math.imul(ah6, bh9)) | 0; + var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0; + w15 &= 0x3ffffff; + /* k = 16 */ + lo = Math.imul(al9, bl7); + mid = Math.imul(al9, bh7); + mid = (mid + Math.imul(ah9, bl7)) | 0; + hi = Math.imul(ah9, bh7); + lo = (lo + Math.imul(al8, bl8)) | 0; + mid = (mid + Math.imul(al8, bh8)) | 0; + mid = (mid + Math.imul(ah8, bl8)) | 0; + hi = (hi + Math.imul(ah8, bh8)) | 0; + lo = (lo + Math.imul(al7, bl9)) | 0; + mid = (mid + Math.imul(al7, bh9)) | 0; + mid = (mid + Math.imul(ah7, bl9)) | 0; + hi = (hi + Math.imul(ah7, bh9)) | 0; + var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0; + w16 &= 0x3ffffff; + /* k = 17 */ + lo = Math.imul(al9, bl8); + mid = Math.imul(al9, bh8); + mid = (mid + Math.imul(ah9, bl8)) | 0; + hi = Math.imul(ah9, bh8); + lo = (lo + Math.imul(al8, bl9)) | 0; + mid = (mid + Math.imul(al8, bh9)) | 0; + mid = (mid + Math.imul(ah8, bl9)) | 0; + hi = (hi + Math.imul(ah8, bh9)) | 0; + var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0; + w17 &= 0x3ffffff; + /* k = 18 */ + lo = Math.imul(al9, bl9); + mid = Math.imul(al9, bh9); + mid = (mid + Math.imul(ah9, bl9)) | 0; + hi = Math.imul(ah9, bh9); + var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0; + c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0; + w18 &= 0x3ffffff; + o[0] = w0; + o[1] = w1; + o[2] = w2; + o[3] = w3; + o[4] = w4; + o[5] = w5; + o[6] = w6; + o[7] = w7; + o[8] = w8; + o[9] = w9; + o[10] = w10; + o[11] = w11; + o[12] = w12; + o[13] = w13; + o[14] = w14; + o[15] = w15; + o[16] = w16; + o[17] = w17; + o[18] = w18; + if (c !== 0) { + o[19] = c; + out.length++; + } + return out; + }; + + // Polyfill comb + if (!Math.imul) { + comb10MulTo = smallMulTo; + } + + function bigMulTo (self, num, out) { + out.negative = num.negative ^ self.negative; + out.length = self.length + num.length; + + var carry = 0; + var hncarry = 0; + for (var k = 0; k < out.length - 1; k++) { + // Sum all words with the same `i + j = k` and accumulate `ncarry`, + // note that ncarry could be >= 0x3ffffff + var ncarry = hncarry; + hncarry = 0; + var rword = carry & 0x3ffffff; + var maxJ = Math.min(k, num.length - 1); + for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) { + var i = k - j; + var a = self.words[i] | 0; + var b = num.words[j] | 0; + var r = a * b; + + var lo = r & 0x3ffffff; + ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0; + lo = (lo + rword) | 0; + rword = lo & 0x3ffffff; + ncarry = (ncarry + (lo >>> 26)) | 0; + + hncarry += ncarry >>> 26; + ncarry &= 0x3ffffff; + } + out.words[k] = rword; + carry = ncarry; + ncarry = hncarry; + } + if (carry !== 0) { + out.words[k] = carry; + } else { + out.length--; + } + + return out._strip(); + } + + function jumboMulTo (self, num, out) { + // Temporary disable, see https://github.com/indutny/bn.js/issues/211 + // var fftm = new FFTM(); + // return fftm.mulp(self, num, out); + return bigMulTo(self, num, out); + } + + BN.prototype.mulTo = function mulTo (num, out) { + var res; + var len = this.length + num.length; + if (this.length === 10 && num.length === 10) { + res = comb10MulTo(this, num, out); + } else if (len < 63) { + res = smallMulTo(this, num, out); + } else if (len < 1024) { + res = bigMulTo(this, num, out); + } else { + res = jumboMulTo(this, num, out); + } + + return res; + }; + + // Cooley-Tukey algorithm for FFT + // slightly revisited to rely on looping instead of recursion + + function FFTM (x, y) { + this.x = x; + this.y = y; + } + + FFTM.prototype.makeRBT = function makeRBT (N) { + var t = new Array(N); + var l = BN.prototype._countBits(N) - 1; + for (var i = 0; i < N; i++) { + t[i] = this.revBin(i, l, N); + } + + return t; + }; + + // Returns binary-reversed representation of `x` + FFTM.prototype.revBin = function revBin (x, l, N) { + if (x === 0 || x === N - 1) return x; + + var rb = 0; + for (var i = 0; i < l; i++) { + rb |= (x & 1) << (l - i - 1); + x >>= 1; + } + + return rb; + }; + + // Performs "tweedling" phase, therefore 'emulating' + // behaviour of the recursive algorithm + FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) { + for (var i = 0; i < N; i++) { + rtws[i] = rws[rbt[i]]; + itws[i] = iws[rbt[i]]; + } + }; + + FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) { + this.permute(rbt, rws, iws, rtws, itws, N); + + for (var s = 1; s < N; s <<= 1) { + var l = s << 1; + + var rtwdf = Math.cos(2 * Math.PI / l); + var itwdf = Math.sin(2 * Math.PI / l); + + for (var p = 0; p < N; p += l) { + var rtwdf_ = rtwdf; + var itwdf_ = itwdf; + + for (var j = 0; j < s; j++) { + var re = rtws[p + j]; + var ie = itws[p + j]; + + var ro = rtws[p + j + s]; + var io = itws[p + j + s]; + + var rx = rtwdf_ * ro - itwdf_ * io; + + io = rtwdf_ * io + itwdf_ * ro; + ro = rx; + + rtws[p + j] = re + ro; + itws[p + j] = ie + io; + + rtws[p + j + s] = re - ro; + itws[p + j + s] = ie - io; + + /* jshint maxdepth : false */ + if (j !== l) { + rx = rtwdf * rtwdf_ - itwdf * itwdf_; + + itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_; + rtwdf_ = rx; + } + } + } + } + }; + + FFTM.prototype.guessLen13b = function guessLen13b (n, m) { + var N = Math.max(m, n) | 1; + var odd = N & 1; + var i = 0; + for (N = N / 2 | 0; N; N = N >>> 1) { + i++; + } + + return 1 << i + 1 + odd; + }; + + FFTM.prototype.conjugate = function conjugate (rws, iws, N) { + if (N <= 1) return; + + for (var i = 0; i < N / 2; i++) { + var t = rws[i]; + + rws[i] = rws[N - i - 1]; + rws[N - i - 1] = t; + + t = iws[i]; + + iws[i] = -iws[N - i - 1]; + iws[N - i - 1] = -t; + } + }; + + FFTM.prototype.normalize13b = function normalize13b (ws, N) { + var carry = 0; + for (var i = 0; i < N / 2; i++) { + var w = Math.round(ws[2 * i + 1] / N) * 0x2000 + + Math.round(ws[2 * i] / N) + + carry; + + ws[i] = w & 0x3ffffff; + + if (w < 0x4000000) { + carry = 0; + } else { + carry = w / 0x4000000 | 0; + } + } + + return ws; + }; + + FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) { + var carry = 0; + for (var i = 0; i < len; i++) { + carry = carry + (ws[i] | 0); + + rws[2 * i] = carry & 0x1fff; carry = carry >>> 13; + rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13; + } + + // Pad with zeroes + for (i = 2 * len; i < N; ++i) { + rws[i] = 0; + } + + assert(carry === 0); + assert((carry & ~0x1fff) === 0); + }; + + FFTM.prototype.stub = function stub (N) { + var ph = new Array(N); + for (var i = 0; i < N; i++) { + ph[i] = 0; + } + + return ph; + }; + + FFTM.prototype.mulp = function mulp (x, y, out) { + var N = 2 * this.guessLen13b(x.length, y.length); + + var rbt = this.makeRBT(N); + + var _ = this.stub(N); + + var rws = new Array(N); + var rwst = new Array(N); + var iwst = new Array(N); + + var nrws = new Array(N); + var nrwst = new Array(N); + var niwst = new Array(N); + + var rmws = out.words; + rmws.length = N; + + this.convert13b(x.words, x.length, rws, N); + this.convert13b(y.words, y.length, nrws, N); + + this.transform(rws, _, rwst, iwst, N, rbt); + this.transform(nrws, _, nrwst, niwst, N, rbt); + + for (var i = 0; i < N; i++) { + var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i]; + iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i]; + rwst[i] = rx; + } + + this.conjugate(rwst, iwst, N); + this.transform(rwst, iwst, rmws, _, N, rbt); + this.conjugate(rmws, _, N); + this.normalize13b(rmws, N); + + out.negative = x.negative ^ y.negative; + out.length = x.length + y.length; + return out._strip(); + }; + + // Multiply `this` by `num` + BN.prototype.mul = function mul (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return this.mulTo(num, out); + }; + + // Multiply employing FFT + BN.prototype.mulf = function mulf (num) { + var out = new BN(null); + out.words = new Array(this.length + num.length); + return jumboMulTo(this, num, out); + }; + + // In-place Multiplication + BN.prototype.imul = function imul (num) { + return this.clone().mulTo(num, this); + }; + + BN.prototype.imuln = function imuln (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(typeof num === 'number'); + assert(num < 0x4000000); + + // Carry + var carry = 0; + for (var i = 0; i < this.length; i++) { + var w = (this.words[i] | 0) * num; + var lo = (w & 0x3ffffff) + (carry & 0x3ffffff); + carry >>= 26; + carry += (w / 0x4000000) | 0; + // NOTE: lo is 27bit maximum + carry += lo >>> 26; + this.words[i] = lo & 0x3ffffff; + } + + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + if (num === 0) { + this.length = 1; + this._normSign(); + } + + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.muln = function muln (num) { + return this.clone().imuln(num); + }; + + // `this` * `this` + BN.prototype.sqr = function sqr () { + return this.mul(this); + }; + + // `this` * `this` in-place + BN.prototype.isqr = function isqr () { + return this.imul(this.clone()); + }; + + // Math.pow(`this`, `num`) + BN.prototype.pow = function pow (num) { + var w = toBitArray(num); + if (w.length === 0) return new BN(1); + + // Skip leading zeroes + var res = this; + for (var i = 0; i < w.length; i++, res = res.sqr()) { + if (w[i] !== 0) break; + } + + if (++i < w.length) { + for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) { + if (w[i] === 0) continue; + + res = res.mul(q); + } + } + + return res; + }; + + // Shift-left in-place + BN.prototype.iushln = function iushln (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r); + var i; + + if (r !== 0) { + var carry = 0; + + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c = ((this.words[i] | 0) - newCarry) << r; + this.words[i] = c | carry; + carry = newCarry >>> (26 - r); + } + + if (carry) { + this.words[i] = carry; + this.length++; + } + } + + if (s !== 0) { + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s] = this.words[i]; + } + + for (i = 0; i < s; i++) { + this.words[i] = 0; + } + + this.length += s; + } + + return this._strip(); + }; + + BN.prototype.ishln = function ishln (bits) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushln(bits); + }; + + // Shift-right in-place + // NOTE: `hint` is a lowest bit before trailing zeroes + // NOTE: if `extended` is present - it will be filled with destroyed bits + BN.prototype.iushrn = function iushrn (bits, hint, extended) { + assert(typeof bits === 'number' && bits >= 0); + var h; + if (hint) { + h = (hint - (hint % 26)) / 26; + } else { + h = 0; + } + + var r = bits % 26; + var s = Math.min((bits - r) / 26, this.length); + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + var maskedWords = extended; + + h -= s; + h = Math.max(0, h); + + // Extended mode, copy masked part + if (maskedWords) { + for (var i = 0; i < s; i++) { + maskedWords.words[i] = this.words[i]; + } + maskedWords.length = s; + } + + if (s === 0) { + // No-op, we should not move anything at all + } else if (this.length > s) { + this.length -= s; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s]; + } + } else { + this.words[0] = 0; + this.length = 1; + } + + var carry = 0; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) { + var word = this.words[i] | 0; + this.words[i] = (carry << (26 - r)) | (word >>> r); + carry = word & mask; + } + + // Push carried bits as a mask + if (maskedWords && carry !== 0) { + maskedWords.words[maskedWords.length++] = carry; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + BN.prototype.ishrn = function ishrn (bits, hint, extended) { + // TODO(indutny): implement me + assert(this.negative === 0); + return this.iushrn(bits, hint, extended); + }; + + // Shift-left + BN.prototype.shln = function shln (bits) { + return this.clone().ishln(bits); + }; + + BN.prototype.ushln = function ushln (bits) { + return this.clone().iushln(bits); + }; + + // Shift-right + BN.prototype.shrn = function shrn (bits) { + return this.clone().ishrn(bits); + }; + + BN.prototype.ushrn = function ushrn (bits) { + return this.clone().iushrn(bits); + }; + + // Test if n bit is set + BN.prototype.testn = function testn (bit) { + assert(typeof bit === 'number' && bit >= 0); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) return false; + + // Check bit and return + var w = this.words[s]; + + return !!(w & q); + }; + + // Return only lowers bits of number (in-place) + BN.prototype.imaskn = function imaskn (bits) { + assert(typeof bits === 'number' && bits >= 0); + var r = bits % 26; + var s = (bits - r) / 26; + + assert(this.negative === 0, 'imaskn works only with positive numbers'); + + if (this.length <= s) { + return this; + } + + if (r !== 0) { + s++; + } + this.length = Math.min(s, this.length); + + if (r !== 0) { + var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r); + this.words[this.length - 1] &= mask; + } + + if (this.length === 0) { + this.words[0] = 0; + this.length = 1; + } + + return this._strip(); + }; + + // Return only lowers bits of number + BN.prototype.maskn = function maskn (bits) { + return this.clone().imaskn(bits); + }; + + // Add plain number `num` to `this` + BN.prototype.iaddn = function iaddn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.isubn(-num); + + // Possible sign change + if (this.negative !== 0) { + if (this.length === 1 && (this.words[0] | 0) <= num) { + this.words[0] = num - (this.words[0] | 0); + this.negative = 0; + return this; + } + + this.negative = 0; + this.isubn(num); + this.negative = 1; + return this; + } + + // Add without checks + return this._iaddn(num); + }; + + BN.prototype._iaddn = function _iaddn (num) { + this.words[0] += num; + + // Carry + for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) { + this.words[i] -= 0x4000000; + if (i === this.length - 1) { + this.words[i + 1] = 1; + } else { + this.words[i + 1]++; + } + } + this.length = Math.max(this.length, i + 1); + + return this; + }; + + // Subtract plain number `num` from `this` + BN.prototype.isubn = function isubn (num) { + assert(typeof num === 'number'); + assert(num < 0x4000000); + if (num < 0) return this.iaddn(-num); + + if (this.negative !== 0) { + this.negative = 0; + this.iaddn(num); + this.negative = 1; + return this; + } + + this.words[0] -= num; + + if (this.length === 1 && this.words[0] < 0) { + this.words[0] = -this.words[0]; + this.negative = 1; + } else { + // Carry + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 0x4000000; + this.words[i + 1] -= 1; + } + } + + return this._strip(); + }; + + BN.prototype.addn = function addn (num) { + return this.clone().iaddn(num); + }; + + BN.prototype.subn = function subn (num) { + return this.clone().isubn(num); + }; + + BN.prototype.iabs = function iabs () { + this.negative = 0; + + return this; + }; + + BN.prototype.abs = function abs () { + return this.clone().iabs(); + }; + + BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) { + var len = num.length + shift; + var i; + + this._expand(len); + + var w; + var carry = 0; + for (i = 0; i < num.length; i++) { + w = (this.words[i + shift] | 0) + carry; + var right = (num.words[i] | 0) * mul; + w -= right & 0x3ffffff; + carry = (w >> 26) - ((right / 0x4000000) | 0); + this.words[i + shift] = w & 0x3ffffff; + } + for (; i < this.length - shift; i++) { + w = (this.words[i + shift] | 0) + carry; + carry = w >> 26; + this.words[i + shift] = w & 0x3ffffff; + } + + if (carry === 0) return this._strip(); + + // Subtraction overflow + assert(carry === -1); + carry = 0; + for (i = 0; i < this.length; i++) { + w = -(this.words[i] | 0) + carry; + carry = w >> 26; + this.words[i] = w & 0x3ffffff; + } + this.negative = 1; + + return this._strip(); + }; + + BN.prototype._wordDiv = function _wordDiv (num, mode) { + var shift = this.length - num.length; + + var a = this.clone(); + var b = num; + + // Normalize + var bhi = b.words[b.length - 1] | 0; + var bhiBits = this._countBits(bhi); + shift = 26 - bhiBits; + if (shift !== 0) { + b = b.ushln(shift); + a.iushln(shift); + bhi = b.words[b.length - 1] | 0; + } + + // Initialize quotient + var m = a.length - b.length; + var q; + + if (mode !== 'mod') { + q = new BN(null); + q.length = m + 1; + q.words = new Array(q.length); + for (var i = 0; i < q.length; i++) { + q.words[i] = 0; + } + } + + var diff = a.clone()._ishlnsubmul(b, 1, m); + if (diff.negative === 0) { + a = diff; + if (q) { + q.words[m] = 1; + } + } + + for (var j = m - 1; j >= 0; j--) { + var qj = (a.words[b.length + j] | 0) * 0x4000000 + + (a.words[b.length + j - 1] | 0); + + // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max + // (0x7ffffff) + qj = Math.min((qj / bhi) | 0, 0x3ffffff); + + a._ishlnsubmul(b, qj, j); + while (a.negative !== 0) { + qj--; + a.negative = 0; + a._ishlnsubmul(b, 1, j); + if (!a.isZero()) { + a.negative ^= 1; + } + } + if (q) { + q.words[j] = qj; + } + } + if (q) { + q._strip(); + } + a._strip(); + + // Denormalize + if (mode !== 'div' && shift !== 0) { + a.iushrn(shift); + } + + return { + div: q || null, + mod: a + }; + }; + + // NOTE: 1) `mode` can be set to `mod` to request mod only, + // to `div` to request div only, or be absent to + // request both div & mod + // 2) `positive` is true if unsigned mod is requested + BN.prototype.divmod = function divmod (num, mode, positive) { + assert(!num.isZero()); + + if (this.isZero()) { + return { + div: new BN(0), + mod: new BN(0) + }; + } + + var div, mod, res; + if (this.negative !== 0 && num.negative === 0) { + res = this.neg().divmod(num, mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.iadd(num); + } + } + + return { + div: div, + mod: mod + }; + } + + if (this.negative === 0 && num.negative !== 0) { + res = this.divmod(num.neg(), mode); + + if (mode !== 'mod') { + div = res.div.neg(); + } + + return { + div: div, + mod: res.mod + }; + } + + if ((this.negative & num.negative) !== 0) { + res = this.neg().divmod(num.neg(), mode); + + if (mode !== 'div') { + mod = res.mod.neg(); + if (positive && mod.negative !== 0) { + mod.isub(num); + } + } + + return { + div: res.div, + mod: mod + }; + } + + // Both numbers are positive at this point + + // Strip both numbers to approximate shift value + if (num.length > this.length || this.cmp(num) < 0) { + return { + div: new BN(0), + mod: this + }; + } + + // Very short reduction + if (num.length === 1) { + if (mode === 'div') { + return { + div: this.divn(num.words[0]), + mod: null + }; + } + + if (mode === 'mod') { + return { + div: null, + mod: new BN(this.modrn(num.words[0])) + }; + } + + return { + div: this.divn(num.words[0]), + mod: new BN(this.modrn(num.words[0])) + }; + } + + return this._wordDiv(num, mode); + }; + + // Find `this` / `num` + BN.prototype.div = function div (num) { + return this.divmod(num, 'div', false).div; + }; + + // Find `this` % `num` + BN.prototype.mod = function mod (num) { + return this.divmod(num, 'mod', false).mod; + }; + + BN.prototype.umod = function umod (num) { + return this.divmod(num, 'mod', true).mod; + }; + + // Find Round(`this` / `num`) + BN.prototype.divRound = function divRound (num) { + var dm = this.divmod(num); + + // Fast case - exact division + if (dm.mod.isZero()) return dm.div; + + var mod = dm.mod.abs(); + + var half = num.abs().iushrn(1); + var r2 = num.words[0] & 1; + var cmp = mod.cmp(half); + + // Round down + if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div; + + // Round up, away from zero + var up = new BN(1); + up.negative = this.negative ^ num.negative; + return dm.div.iadd(up); + }; + + BN.prototype.modrn = function modrn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + var p = (1 << 26) % num; + + var acc = 0; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p * acc + (this.words[i] | 0)) % num; + } + + return isNegNum ? -acc : acc; + }; + + // WARNING: DEPRECATED + BN.prototype.modn = function modn (num) { + return this.modrn(num); + }; + + // In-place division by number + BN.prototype.idivn = function idivn (num) { + var isNegNum = num < 0; + if (isNegNum) num = -num; + + assert(num <= 0x3ffffff); + + var carry = 0; + for (var i = this.length - 1; i >= 0; i--) { + var w = (this.words[i] | 0) + carry * 0x4000000; + this.words[i] = (w / num) | 0; + carry = w % num; + } + + this._strip(); + return isNegNum ? this.ineg() : this; + }; + + BN.prototype.divn = function divn (num) { + return this.clone().idivn(num); + }; + + BN.prototype.egcd = function egcd (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var x = this; + var y = p.clone(); + + if (x.negative !== 0) { + x = x.umod(p); + } else { + x = x.clone(); + } + + // A * x + B * y = x + var A = new BN(1); + var B = new BN(0); + + // C * x + D * y = y + var C = new BN(0); + var D = new BN(1); + + var g = 0; + + while (x.isEven() && y.isEven()) { + x.iushrn(1); + y.iushrn(1); + ++g; + } + + var yp = y.clone(); + var xp = x.clone(); + + while (!x.isZero()) { + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { + if (A.isOdd() || B.isOdd()) { + A.iadd(yp); + B.isub(xp); + } + + A.iushrn(1); + B.iushrn(1); + } + } + + for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + y.iushrn(j); + while (j-- > 0) { + if (C.isOdd() || D.isOdd()) { + C.iadd(yp); + D.isub(xp); + } + + C.iushrn(1); + D.iushrn(1); + } + } + + if (x.cmp(y) >= 0) { + x.isub(y); + A.isub(C); + B.isub(D); + } else { + y.isub(x); + C.isub(A); + D.isub(B); + } + } + + return { + a: C, + b: D, + gcd: y.iushln(g) + }; + }; + + // This is reduced incarnation of the binary EEA + // above, designated to invert members of the + // _prime_ fields F(p) at a maximal speed + BN.prototype._invmp = function _invmp (p) { + assert(p.negative === 0); + assert(!p.isZero()); + + var a = this; + var b = p.clone(); + + if (a.negative !== 0) { + a = a.umod(p); + } else { + a = a.clone(); + } + + var x1 = new BN(1); + var x2 = new BN(0); + + var delta = b.clone(); + + while (a.cmpn(1) > 0 && b.cmpn(1) > 0) { + for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1); + if (i > 0) { + a.iushrn(i); + while (i-- > 0) { + if (x1.isOdd()) { + x1.iadd(delta); + } + + x1.iushrn(1); + } + } + + for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1); + if (j > 0) { + b.iushrn(j); + while (j-- > 0) { + if (x2.isOdd()) { + x2.iadd(delta); + } + + x2.iushrn(1); + } + } + + if (a.cmp(b) >= 0) { + a.isub(b); + x1.isub(x2); + } else { + b.isub(a); + x2.isub(x1); + } + } + + var res; + if (a.cmpn(1) === 0) { + res = x1; + } else { + res = x2; + } + + if (res.cmpn(0) < 0) { + res.iadd(p); + } + + return res; + }; + + BN.prototype.gcd = function gcd (num) { + if (this.isZero()) return num.abs(); + if (num.isZero()) return this.abs(); + + var a = this.clone(); + var b = num.clone(); + a.negative = 0; + b.negative = 0; + + // Remove common factor of two + for (var shift = 0; a.isEven() && b.isEven(); shift++) { + a.iushrn(1); + b.iushrn(1); + } + + do { + while (a.isEven()) { + a.iushrn(1); + } + while (b.isEven()) { + b.iushrn(1); + } + + var r = a.cmp(b); + if (r < 0) { + // Swap `a` and `b` to make `a` always bigger than `b` + var t = a; + a = b; + b = t; + } else if (r === 0 || b.cmpn(1) === 0) { + break; + } + + a.isub(b); + } while (true); + + return b.iushln(shift); + }; + + // Invert number in the field F(num) + BN.prototype.invm = function invm (num) { + return this.egcd(num).a.umod(num); + }; + + BN.prototype.isEven = function isEven () { + return (this.words[0] & 1) === 0; + }; + + BN.prototype.isOdd = function isOdd () { + return (this.words[0] & 1) === 1; + }; + + // And first word and num + BN.prototype.andln = function andln (num) { + return this.words[0] & num; + }; + + // Increment at the bit position in-line + BN.prototype.bincn = function bincn (bit) { + assert(typeof bit === 'number'); + var r = bit % 26; + var s = (bit - r) / 26; + var q = 1 << r; + + // Fast case: bit is much higher than all existing words + if (this.length <= s) { + this._expand(s + 1); + this.words[s] |= q; + return this; + } + + // Add bit and propagate, if needed + var carry = q; + for (var i = s; carry !== 0 && i < this.length; i++) { + var w = this.words[i] | 0; + w += carry; + carry = w >>> 26; + w &= 0x3ffffff; + this.words[i] = w; + } + if (carry !== 0) { + this.words[i] = carry; + this.length++; + } + return this; + }; + + BN.prototype.isZero = function isZero () { + return this.length === 1 && this.words[0] === 0; + }; + + BN.prototype.cmpn = function cmpn (num) { + var negative = num < 0; + + if (this.negative !== 0 && !negative) return -1; + if (this.negative === 0 && negative) return 1; + + this._strip(); + + var res; + if (this.length > 1) { + res = 1; + } else { + if (negative) { + num = -num; + } + + assert(num <= 0x3ffffff, 'Number is too big'); + + var w = this.words[0] | 0; + res = w === num ? 0 : w < num ? -1 : 1; + } + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Compare two numbers and return: + // 1 - if `this` > `num` + // 0 - if `this` == `num` + // -1 - if `this` < `num` + BN.prototype.cmp = function cmp (num) { + if (this.negative !== 0 && num.negative === 0) return -1; + if (this.negative === 0 && num.negative !== 0) return 1; + + var res = this.ucmp(num); + if (this.negative !== 0) return -res | 0; + return res; + }; + + // Unsigned comparison + BN.prototype.ucmp = function ucmp (num) { + // At this point both numbers have the same sign + if (this.length > num.length) return 1; + if (this.length < num.length) return -1; + + var res = 0; + for (var i = this.length - 1; i >= 0; i--) { + var a = this.words[i] | 0; + var b = num.words[i] | 0; + + if (a === b) continue; + if (a < b) { + res = -1; + } else if (a > b) { + res = 1; + } + break; + } + return res; + }; + + BN.prototype.gtn = function gtn (num) { + return this.cmpn(num) === 1; + }; + + BN.prototype.gt = function gt (num) { + return this.cmp(num) === 1; + }; + + BN.prototype.gten = function gten (num) { + return this.cmpn(num) >= 0; + }; + + BN.prototype.gte = function gte (num) { + return this.cmp(num) >= 0; + }; + + BN.prototype.ltn = function ltn (num) { + return this.cmpn(num) === -1; + }; + + BN.prototype.lt = function lt (num) { + return this.cmp(num) === -1; + }; + + BN.prototype.lten = function lten (num) { + return this.cmpn(num) <= 0; + }; + + BN.prototype.lte = function lte (num) { + return this.cmp(num) <= 0; + }; + + BN.prototype.eqn = function eqn (num) { + return this.cmpn(num) === 0; + }; + + BN.prototype.eq = function eq (num) { + return this.cmp(num) === 0; + }; + + // + // A reduce context, could be using montgomery or something better, depending + // on the `m` itself. + // + BN.red = function red (num) { + return new Red(num); + }; + + BN.prototype.toRed = function toRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + assert(this.negative === 0, 'red works only with positives'); + return ctx.convertTo(this)._forceRed(ctx); + }; + + BN.prototype.fromRed = function fromRed () { + assert(this.red, 'fromRed works only with numbers in reduction context'); + return this.red.convertFrom(this); + }; + + BN.prototype._forceRed = function _forceRed (ctx) { + this.red = ctx; + return this; + }; + + BN.prototype.forceRed = function forceRed (ctx) { + assert(!this.red, 'Already a number in reduction context'); + return this._forceRed(ctx); + }; + + BN.prototype.redAdd = function redAdd (num) { + assert(this.red, 'redAdd works only with red numbers'); + return this.red.add(this, num); + }; + + BN.prototype.redIAdd = function redIAdd (num) { + assert(this.red, 'redIAdd works only with red numbers'); + return this.red.iadd(this, num); + }; + + BN.prototype.redSub = function redSub (num) { + assert(this.red, 'redSub works only with red numbers'); + return this.red.sub(this, num); + }; + + BN.prototype.redISub = function redISub (num) { + assert(this.red, 'redISub works only with red numbers'); + return this.red.isub(this, num); + }; + + BN.prototype.redShl = function redShl (num) { + assert(this.red, 'redShl works only with red numbers'); + return this.red.shl(this, num); + }; + + BN.prototype.redMul = function redMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.mul(this, num); + }; + + BN.prototype.redIMul = function redIMul (num) { + assert(this.red, 'redMul works only with red numbers'); + this.red._verify2(this, num); + return this.red.imul(this, num); + }; + + BN.prototype.redSqr = function redSqr () { + assert(this.red, 'redSqr works only with red numbers'); + this.red._verify1(this); + return this.red.sqr(this); + }; + + BN.prototype.redISqr = function redISqr () { + assert(this.red, 'redISqr works only with red numbers'); + this.red._verify1(this); + return this.red.isqr(this); + }; + + // Square root over p + BN.prototype.redSqrt = function redSqrt () { + assert(this.red, 'redSqrt works only with red numbers'); + this.red._verify1(this); + return this.red.sqrt(this); + }; + + BN.prototype.redInvm = function redInvm () { + assert(this.red, 'redInvm works only with red numbers'); + this.red._verify1(this); + return this.red.invm(this); + }; + + // Return negative clone of `this` % `red modulo` + BN.prototype.redNeg = function redNeg () { + assert(this.red, 'redNeg works only with red numbers'); + this.red._verify1(this); + return this.red.neg(this); + }; + + BN.prototype.redPow = function redPow (num) { + assert(this.red && !num.red, 'redPow(normalNum)'); + this.red._verify1(this); + return this.red.pow(this, num); + }; + + // Prime numbers with efficient reduction + var primes = { + k256: null, + p224: null, + p192: null, + p25519: null + }; + + // Pseudo-Mersenne prime + function MPrime (name, p) { + // P = 2 ^ N - K + this.name = name; + this.p = new BN(p, 16); + this.n = this.p.bitLength(); + this.k = new BN(1).iushln(this.n).isub(this.p); + + this.tmp = this._tmp(); + } + + MPrime.prototype._tmp = function _tmp () { + var tmp = new BN(null); + tmp.words = new Array(Math.ceil(this.n / 13)); + return tmp; + }; + + MPrime.prototype.ireduce = function ireduce (num) { + // Assumes that `num` is less than `P^2` + // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P) + var r = num; + var rlen; + + do { + this.split(r, this.tmp); + r = this.imulK(r); + r = r.iadd(this.tmp); + rlen = r.bitLength(); + } while (rlen > this.n); + + var cmp = rlen < this.n ? -1 : r.ucmp(this.p); + if (cmp === 0) { + r.words[0] = 0; + r.length = 1; + } else if (cmp > 0) { + r.isub(this.p); + } else { + if (r.strip !== undefined) { + // r is a BN v4 instance + r.strip(); + } else { + // r is a BN v5 instance + r._strip(); + } + } + + return r; + }; + + MPrime.prototype.split = function split (input, out) { + input.iushrn(this.n, 0, out); + }; + + MPrime.prototype.imulK = function imulK (num) { + return num.imul(this.k); + }; + + function K256 () { + MPrime.call( + this, + 'k256', + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f'); + } + inherits(K256, MPrime); + + K256.prototype.split = function split (input, output) { + // 256 = 9 * 26 + 22 + var mask = 0x3fffff; + + var outLen = Math.min(input.length, 9); + for (var i = 0; i < outLen; i++) { + output.words[i] = input.words[i]; + } + output.length = outLen; + + if (input.length <= 9) { + input.words[0] = 0; + input.length = 1; + return; + } + + // Shift by 9 limbs + var prev = input.words[9]; + output.words[output.length++] = prev & mask; + + for (i = 10; i < input.length; i++) { + var next = input.words[i] | 0; + input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22); + prev = next; + } + prev >>>= 22; + input.words[i - 10] = prev; + if (prev === 0 && input.length > 10) { + input.length -= 10; + } else { + input.length -= 9; + } + }; + + K256.prototype.imulK = function imulK (num) { + // K = 0x1000003d1 = [ 0x40, 0x3d1 ] + num.words[num.length] = 0; + num.words[num.length + 1] = 0; + num.length += 2; + + // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390 + var lo = 0; + for (var i = 0; i < num.length; i++) { + var w = num.words[i] | 0; + lo += w * 0x3d1; + num.words[i] = lo & 0x3ffffff; + lo = w * 0x40 + ((lo / 0x4000000) | 0); + } + + // Fast length reduction + if (num.words[num.length - 1] === 0) { + num.length--; + if (num.words[num.length - 1] === 0) { + num.length--; + } + } + return num; + }; + + function P224 () { + MPrime.call( + this, + 'p224', + 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001'); + } + inherits(P224, MPrime); + + function P192 () { + MPrime.call( + this, + 'p192', + 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff'); + } + inherits(P192, MPrime); + + function P25519 () { + // 2 ^ 255 - 19 + MPrime.call( + this, + '25519', + '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed'); + } + inherits(P25519, MPrime); + + P25519.prototype.imulK = function imulK (num) { + // K = 0x13 + var carry = 0; + for (var i = 0; i < num.length; i++) { + var hi = (num.words[i] | 0) * 0x13 + carry; + var lo = hi & 0x3ffffff; + hi >>>= 26; + + num.words[i] = lo; + carry = hi; + } + if (carry !== 0) { + num.words[num.length++] = carry; + } + return num; + }; + + // Exported mostly for testing purposes, use plain name instead + BN._prime = function prime (name) { + // Cached version of prime + if (primes[name]) return primes[name]; + + var prime; + if (name === 'k256') { + prime = new K256(); + } else if (name === 'p224') { + prime = new P224(); + } else if (name === 'p192') { + prime = new P192(); + } else if (name === 'p25519') { + prime = new P25519(); + } else { + throw new Error('Unknown prime ' + name); + } + primes[name] = prime; + + return prime; + }; + + // + // Base reduction engine + // + function Red (m) { + if (typeof m === 'string') { + var prime = BN._prime(m); + this.m = prime.p; + this.prime = prime; + } else { + assert(m.gtn(1), 'modulus must be greater than 1'); + this.m = m; + this.prime = null; + } + } + + Red.prototype._verify1 = function _verify1 (a) { + assert(a.negative === 0, 'red works only with positives'); + assert(a.red, 'red works only with red numbers'); + }; + + Red.prototype._verify2 = function _verify2 (a, b) { + assert((a.negative | b.negative) === 0, 'red works only with positives'); + assert(a.red && a.red === b.red, + 'red works only with red numbers'); + }; + + Red.prototype.imod = function imod (a) { + if (this.prime) return this.prime.ireduce(a)._forceRed(this); + + move(a, a.umod(this.m)._forceRed(this)); + return a; + }; + + Red.prototype.neg = function neg (a) { + if (a.isZero()) { + return a.clone(); + } + + return this.m.sub(a)._forceRed(this); + }; + + Red.prototype.add = function add (a, b) { + this._verify2(a, b); + + var res = a.add(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.iadd = function iadd (a, b) { + this._verify2(a, b); + + var res = a.iadd(b); + if (res.cmp(this.m) >= 0) { + res.isub(this.m); + } + return res; + }; + + Red.prototype.sub = function sub (a, b) { + this._verify2(a, b); + + var res = a.sub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res._forceRed(this); + }; + + Red.prototype.isub = function isub (a, b) { + this._verify2(a, b); + + var res = a.isub(b); + if (res.cmpn(0) < 0) { + res.iadd(this.m); + } + return res; + }; + + Red.prototype.shl = function shl (a, num) { + this._verify1(a); + return this.imod(a.ushln(num)); + }; + + Red.prototype.imul = function imul (a, b) { + this._verify2(a, b); + return this.imod(a.imul(b)); + }; + + Red.prototype.mul = function mul (a, b) { + this._verify2(a, b); + return this.imod(a.mul(b)); + }; + + Red.prototype.isqr = function isqr (a) { + return this.imul(a, a.clone()); + }; + + Red.prototype.sqr = function sqr (a) { + return this.mul(a, a); + }; + + Red.prototype.sqrt = function sqrt (a) { + if (a.isZero()) return a.clone(); + + var mod3 = this.m.andln(3); + assert(mod3 % 2 === 1); + + // Fast case + if (mod3 === 3) { + var pow = this.m.add(new BN(1)).iushrn(2); + return this.pow(a, pow); + } + + // Tonelli-Shanks algorithm (Totally unoptimized and slow) + // + // Find Q and S, that Q * 2 ^ S = (P - 1) + var q = this.m.subn(1); + var s = 0; + while (!q.isZero() && q.andln(1) === 0) { + s++; + q.iushrn(1); + } + assert(!q.isZero()); + + var one = new BN(1).toRed(this); + var nOne = one.redNeg(); + + // Find quadratic non-residue + // NOTE: Max is such because of generalized Riemann hypothesis. + var lpow = this.m.subn(1).iushrn(1); + var z = this.m.bitLength(); + z = new BN(2 * z * z).toRed(this); + + while (this.pow(z, lpow).cmp(nOne) !== 0) { + z.redIAdd(nOne); + } + + var c = this.pow(z, q); + var r = this.pow(a, q.addn(1).iushrn(1)); + var t = this.pow(a, q); + var m = s; + while (t.cmp(one) !== 0) { + var tmp = t; + for (var i = 0; tmp.cmp(one) !== 0; i++) { + tmp = tmp.redSqr(); + } + assert(i < m); + var b = this.pow(c, new BN(1).iushln(m - i - 1)); + + r = r.redMul(b); + c = b.redSqr(); + t = t.redMul(c); + m = i; + } + + return r; + }; + + Red.prototype.invm = function invm (a) { + var inv = a._invmp(this.m); + if (inv.negative !== 0) { + inv.negative = 0; + return this.imod(inv).redNeg(); + } else { + return this.imod(inv); + } + }; + + Red.prototype.pow = function pow (a, num) { + if (num.isZero()) return new BN(1).toRed(this); + if (num.cmpn(1) === 0) return a.clone(); + + var windowSize = 4; + var wnd = new Array(1 << windowSize); + wnd[0] = new BN(1).toRed(this); + wnd[1] = a; + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a); + } + + var res = wnd[0]; + var current = 0; + var currentLen = 0; + var start = num.bitLength() % 26; + if (start === 0) { + start = 26; + } + + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; + for (var j = start - 1; j >= 0; j--) { + var bit = (word >> j) & 1; + if (res !== wnd[0]) { + res = this.sqr(res); + } + + if (bit === 0 && current === 0) { + currentLen = 0; + continue; + } + + current <<= 1; + current |= bit; + currentLen++; + if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue; + + res = this.mul(res, wnd[current]); + currentLen = 0; + current = 0; + } + start = 26; + } + + return res; + }; + + Red.prototype.convertTo = function convertTo (num) { + var r = num.umod(this.m); + + return r === num ? r.clone() : r; + }; + + Red.prototype.convertFrom = function convertFrom (num) { + var res = num.clone(); + res.red = null; + return res; + }; + + // + // Montgomery method engine + // + + BN.mont = function mont (num) { + return new Mont(num); + }; + + function Mont (m) { + Red.call(this, m); + + this.shift = this.m.bitLength(); + if (this.shift % 26 !== 0) { + this.shift += 26 - (this.shift % 26); + } + + this.r = new BN(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); + } + inherits(Mont, Red); + + Mont.prototype.convertTo = function convertTo (num) { + return this.imod(num.ushln(this.shift)); + }; + + Mont.prototype.convertFrom = function convertFrom (num) { + var r = this.imod(num.mul(this.rinv)); + r.red = null; + return r; + }; + + Mont.prototype.imul = function imul (a, b) { + if (a.isZero() || b.isZero()) { + a.words[0] = 0; + a.length = 1; + return a; + } + + var t = a.imul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.mul = function mul (a, b) { + if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this); + + var t = a.mul(b); + var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m); + var u = t.isub(c).iushrn(this.shift); + var res = u; + if (u.cmp(this.m) >= 0) { + res = u.isub(this.m); + } else if (u.cmpn(0) < 0) { + res = u.iadd(this.m); + } + + return res._forceRed(this); + }; + + Mont.prototype.invm = function invm (a) { + // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R + var res = this.imod(a._invmp(this.m).mul(this.r2)); + return res._forceRed(this); + }; +})( false || module, this); + + +/***/ }), + +/***/ 40138: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kdfs/hkdf.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ HkdfNative: () => (/* binding */ HkdfNative), +/* harmony export */ HkdfSha256Native: () => (/* binding */ HkdfSha256Native), +/* harmony export */ HkdfSha384Native: () => (/* binding */ HkdfSha384Native), +/* harmony export */ HkdfSha512Native: () => (/* binding */ HkdfSha512Native), +/* harmony export */ toArrayBuffer: () => (/* binding */ toArrayBuffer), +/* harmony export */ toUint8Array: () => (/* binding */ toUint8Array) +/* harmony export */ }); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../consts.js */ 53838); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../errors.js */ 48385); +/* harmony import */ var _identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../identifiers.js */ 16780); +/* harmony import */ var _algorithm_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../algorithm.js */ 19437); + + + + +// b"HPKE-v1" +const HPKE_VERSION = /* @__PURE__ */ new Uint8Array([ + 72, + 80, + 75, + 69, + 45, + 118, + 49, +]); +function toUint8Array(input) { + return new Uint8Array(toArrayBuffer(input)); +} +function toArrayBuffer(input) { + if (input instanceof ArrayBuffer) { + return input; + } + if (ArrayBuffer.isView(input)) { + return new Uint8Array(input.buffer, input.byteOffset, input.byteLength) + .slice().buffer; + } + return new Uint8Array(input).slice().buffer; +} +class HkdfNative extends _algorithm_js__WEBPACK_IMPORTED_MODULE_3__.NativeAlgorithm { + constructor() { + super(); + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KdfId.HkdfSha256 + }); + Object.defineProperty(this, "hashSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "_suiteId", { + enumerable: true, + configurable: true, + writable: true, + value: _consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY + }); + Object.defineProperty(this, "algHash", { + enumerable: true, + configurable: true, + writable: true, + value: { + name: "HMAC", + hash: "SHA-256", + length: 256, + } + }); + } + init(suiteId) { + this._suiteId = suiteId; + } + buildLabeledIkm(label, ikm) { + this._checkInit(); + const ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength); + ret.set(HPKE_VERSION, 0); + ret.set(this._suiteId, 7); + ret.set(label, 7 + this._suiteId.byteLength); + ret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength); + return ret; + } + buildLabeledInfo(label, info, len) { + this._checkInit(); + const ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength); + ret.set(new Uint8Array([0, len]), 0); + ret.set(HPKE_VERSION, 2); + ret.set(this._suiteId, 9); + ret.set(label, 9 + this._suiteId.byteLength); + ret.set(info, 9 + this._suiteId.byteLength + label.byteLength); + return ret; + } + async extract(salt, ikm) { + await this._setup(); + const saltBuf = salt.byteLength === 0 + ? new ArrayBuffer(this.hashSize) + : toArrayBuffer(salt); + if (saltBuf.byteLength !== this.hashSize) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidParamError("The salt length must be the same as the hashSize"); + } + const ikmBuf = toArrayBuffer(ikm); + const key = await this._api.importKey("raw", saltBuf, this.algHash, false, [ + "sign", + ]); + return await this._api.sign("HMAC", key, ikmBuf); + } + async expand(prk, info, len) { + await this._setup(); + const prkBuf = toArrayBuffer(prk); + const key = await this._api.importKey("raw", prkBuf, this.algHash, false, [ + "sign", + ]); + const okm = new ArrayBuffer(len); + const okmBytes = new Uint8Array(okm); + let prev = _consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY; + const mid = toUint8Array(info); + const tail = new Uint8Array(1); + if (len > 255 * this.hashSize) { + throw new Error("Entropy limit reached"); + } + const tmp = new Uint8Array(this.hashSize + mid.length + 1); + for (let i = 1, cur = 0; cur < okmBytes.length; i++) { + tail[0] = i; + tmp.set(prev, 0); + tmp.set(mid, prev.length); + tmp.set(tail, prev.length + mid.length); + prev = new Uint8Array(await this._api.sign("HMAC", key, tmp.slice(0, prev.length + mid.length + 1))); + if (okmBytes.length - cur >= prev.length) { + okmBytes.set(prev, cur); + cur += prev.length; + } + else { + okmBytes.set(prev.slice(0, okmBytes.length - cur), cur); + cur += okmBytes.length - cur; + } + } + return okm; + } + async extractAndExpand(salt, ikm, info, len) { + await this._setup(); + const ikmBuf = toArrayBuffer(ikm); + const baseKey = await this._api.importKey("raw", ikmBuf, "HKDF", false, ["deriveBits"]); + return await this._api.deriveBits({ + name: "HKDF", + hash: this.algHash.hash, + salt: toArrayBuffer(salt), + info: toArrayBuffer(info), + }, baseKey, len * 8); + } + async labeledExtract(salt, label, ikm) { + return await this.extract(salt, this.buildLabeledIkm(label, ikm)); + } + async labeledExpand(prk, label, info, len) { + return await this.expand(prk, this.buildLabeledInfo(label, info, len), len); + } + _checkInit() { + if (this._suiteId === _consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY) { + throw new Error("Not initialized. Call init()"); + } + } +} +class HkdfSha256Native extends HkdfNative { + constructor() { + super(...arguments); + /** KdfId.HkdfSha256 (0x0001) */ + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KdfId.HkdfSha256 + }); + /** 32 */ + Object.defineProperty(this, "hashSize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + /** The parameters for Web Cryptography API */ + Object.defineProperty(this, "algHash", { + enumerable: true, + configurable: true, + writable: true, + value: { + name: "HMAC", + hash: "SHA-256", + length: 256, + } + }); + } +} +class HkdfSha384Native extends HkdfNative { + constructor() { + super(...arguments); + /** KdfId.HkdfSha384 (0x0002) */ + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KdfId.HkdfSha384 + }); + /** 48 */ + Object.defineProperty(this, "hashSize", { + enumerable: true, + configurable: true, + writable: true, + value: 48 + }); + /** The parameters for Web Cryptography API */ + Object.defineProperty(this, "algHash", { + enumerable: true, + configurable: true, + writable: true, + value: { + name: "HMAC", + hash: "SHA-384", + length: 384, + } + }); + } +} +class HkdfSha512Native extends HkdfNative { + constructor() { + super(...arguments); + /** KdfId.HkdfSha512 (0x0003) */ + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _identifiers_js__WEBPACK_IMPORTED_MODULE_2__.KdfId.HkdfSha512 + }); + /** 64 */ + Object.defineProperty(this, "hashSize", { + enumerable: true, + configurable: true, + writable: true, + value: 64 + }); + /** The parameters for Web Cryptography API */ + Object.defineProperty(this, "algHash", { + enumerable: true, + configurable: true, + writable: true, + value: { + name: "HMAC", + hash: "SHA-512", + length: 512, + } + }); + } +} + + +/***/ }), + +/***/ 40627: +/*!***********************************************************************!*\ + !*** ../node_modules/.pnpm/sha.js@2.4.12/node_modules/sha.js/sha1.js ***! + \***********************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* + * A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined + * in FIPS PUB 180-1 + * Version 2.1a Copyright Paul Johnston 2000 - 2002. + * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + * Distributed under the BSD License + * See http://pajhome.org.uk/crypt/md5 for details. + */ + +var inherits = __webpack_require__(/*! inherits */ 18628); +var Hash = __webpack_require__(/*! ./hash */ 76626); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +var K = [ + 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc | 0, 0xca62c1d6 | 0 +]; + +var W = new Array(80); + +function Sha1() { + this.init(); + this._w = W; + + Hash.call(this, 64, 56); +} + +inherits(Sha1, Hash); + +Sha1.prototype.init = function () { + this._a = 0x67452301; + this._b = 0xefcdab89; + this._c = 0x98badcfe; + this._d = 0x10325476; + this._e = 0xc3d2e1f0; + + return this; +}; + +function rotl1(num) { + return (num << 1) | (num >>> 31); +} + +function rotl5(num) { + return (num << 5) | (num >>> 27); +} + +function rotl30(num) { + return (num << 30) | (num >>> 2); +} + +function ft(s, b, c, d) { + if (s === 0) { + return (b & c) | (~b & d); + } + if (s === 2) { + return (b & c) | (b & d) | (c & d); + } + return b ^ c ^ d; +} + +Sha1.prototype._update = function (M) { + var w = this._w; + + var a = this._a | 0; + var b = this._b | 0; + var c = this._c | 0; + var d = this._d | 0; + var e = this._e | 0; + + for (var i = 0; i < 16; ++i) { + w[i] = M.readInt32BE(i * 4); + } + for (; i < 80; ++i) { + w[i] = rotl1(w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); + } + + for (var j = 0; j < 80; ++j) { + var s = ~~(j / 20); + var t = (rotl5(a) + ft(s, b, c, d) + e + w[j] + K[s]) | 0; + + e = d; + d = c; + c = rotl30(b); + b = a; + a = t; + } + + this._a = (a + this._a) | 0; + this._b = (b + this._b) | 0; + this._c = (c + this._c) | 0; + this._d = (d + this._d) | 0; + this._e = (e + this._e) | 0; +}; + +Sha1.prototype._hash = function () { + var H = Buffer.allocUnsafe(20); + + H.writeInt32BE(this._a | 0, 0); + H.writeInt32BE(this._b | 0, 4); + H.writeInt32BE(this._c | 0, 8); + H.writeInt32BE(this._d | 0, 12); + H.writeInt32BE(this._e | 0, 16); + + return H; +}; + +module.exports = Sha1; + + +/***/ }), + +/***/ 40711: +/*!*********************************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/modules/logger/index.js ***! + \*********************************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +/******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ + +/***/ "./client-src/modules/logger/tapable.js": +/*!**********************************************!*\ + !*** ./client-src/modules/logger/tapable.js ***! + \**********************************************/ +/***/ (function(__unused_webpack_module, __nested_webpack_exports__, __nested_webpack_require_372__) { + +__nested_webpack_require_372__.r(__nested_webpack_exports__); +/* harmony export */ __nested_webpack_require_372__.d(__nested_webpack_exports__, { +/* harmony export */ SyncBailHook: function() { return /* binding */ SyncBailHook; } +/* harmony export */ }); +function SyncBailHook() { + return { + call: function call() {} + }; +} + +/** + * Client stub for tapable SyncBailHook + */ +// eslint-disable-next-line import/prefer-default-export + + +/***/ }), + +/***/ "./node_modules/webpack/lib/logging/Logger.js": +/*!****************************************************!*\ + !*** ./node_modules/webpack/lib/logging/Logger.js ***! + \****************************************************/ +/***/ (function(module) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && "symbol" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o.constructor === (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o !== (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).prototype ? "symbol" : typeof o; + }, _typeof(o); +} +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; + } +} +function _iterableToArray(r) { + if ("undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && null != r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || null != r["@@iterator"]) return Array.from(r); +} +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +function _classCallCheck(a, n) { + if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); +} +function _defineProperties(e, r) { + for (var t = 0; t < r.length; t++) { + var o = r[t]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); + } +} +function _createClass(e, r, t) { + return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { + writable: !1 + }), e; +} +function _toPropertyKey(t) { + var i = _toPrimitive(t, "string"); + return "symbol" == _typeof(i) ? i : i + ""; +} +function _toPrimitive(t, r) { + if ("object" != _typeof(t) || !t) return t; + var e = t[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).toPrimitive]; + if (void 0 !== e) { + var i = e.call(t, r || "default"); + if ("object" != _typeof(i)) return i; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return ("string" === r ? String : Number)(t); +} +var LogType = Object.freeze({ + error: (/** @type {"error"} */"error"), + // message, c style arguments + warn: (/** @type {"warn"} */"warn"), + // message, c style arguments + info: (/** @type {"info"} */"info"), + // message, c style arguments + log: (/** @type {"log"} */"log"), + // message, c style arguments + debug: (/** @type {"debug"} */"debug"), + // message, c style arguments + + trace: (/** @type {"trace"} */"trace"), + // no arguments + + group: (/** @type {"group"} */"group"), + // [label] + groupCollapsed: (/** @type {"groupCollapsed"} */"groupCollapsed"), + // [label] + groupEnd: (/** @type {"groupEnd"} */"groupEnd"), + // [label] + + profile: (/** @type {"profile"} */"profile"), + // [profileName] + profileEnd: (/** @type {"profileEnd"} */"profileEnd"), + // [profileName] + + time: (/** @type {"time"} */"time"), + // name, time as [seconds, nanoseconds] + + clear: (/** @type {"clear"} */"clear"), + // no arguments + status: (/** @type {"status"} */"status") // message, arguments +}); +module.exports.LogType = LogType; + +/** @typedef {typeof LogType[keyof typeof LogType]} LogTypeEnum */ + +var LOG_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger raw log method"); +var TIMERS_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger times"); +var TIMERS_AGGREGATES_SYMBOL = (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; })("webpack logger aggregated times"); +var WebpackLogger = /*#__PURE__*/function () { + /** + * @param {(type: LogTypeEnum, args?: EXPECTED_ANY[]) => void} log log function + * @param {(name: string | (() => string)) => WebpackLogger} getChildLogger function to create child logger + */ + function WebpackLogger(log, getChildLogger) { + _classCallCheck(this, WebpackLogger); + this[LOG_SYMBOL] = log; + this.getChildLogger = getChildLogger; + } + + /** + * @param {...EXPECTED_ANY} args args + */ + return _createClass(WebpackLogger, [{ + key: "error", + value: function error() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + this[LOG_SYMBOL](LogType.error, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "warn", + value: function warn() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + this[LOG_SYMBOL](LogType.warn, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "info", + value: function info() { + for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { + args[_key3] = arguments[_key3]; + } + this[LOG_SYMBOL](LogType.info, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "log", + value: function log() { + for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + args[_key4] = arguments[_key4]; + } + this[LOG_SYMBOL](LogType.log, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "debug", + value: function debug() { + for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) { + args[_key5] = arguments[_key5]; + } + this[LOG_SYMBOL](LogType.debug, args); + } + + /** + * @param {EXPECTED_ANY} assertion assertion + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "assert", + value: function assert(assertion) { + if (!assertion) { + for (var _len6 = arguments.length, args = new Array(_len6 > 1 ? _len6 - 1 : 0), _key6 = 1; _key6 < _len6; _key6++) { + args[_key6 - 1] = arguments[_key6]; + } + this[LOG_SYMBOL](LogType.error, args); + } + } + }, { + key: "trace", + value: function trace() { + this[LOG_SYMBOL](LogType.trace, ["Trace"]); + } + }, { + key: "clear", + value: function clear() { + this[LOG_SYMBOL](LogType.clear); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "status", + value: function status() { + for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) { + args[_key7] = arguments[_key7]; + } + this[LOG_SYMBOL](LogType.status, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "group", + value: function group() { + for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) { + args[_key8] = arguments[_key8]; + } + this[LOG_SYMBOL](LogType.group, args); + } + + /** + * @param {...EXPECTED_ANY} args args + */ + }, { + key: "groupCollapsed", + value: function groupCollapsed() { + for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) { + args[_key9] = arguments[_key9]; + } + this[LOG_SYMBOL](LogType.groupCollapsed, args); + } + }, { + key: "groupEnd", + value: function groupEnd() { + this[LOG_SYMBOL](LogType.groupEnd); + } + + /** + * @param {string=} label label + */ + }, { + key: "profile", + value: function profile(label) { + this[LOG_SYMBOL](LogType.profile, [label]); + } + + /** + * @param {string=} label label + */ + }, { + key: "profileEnd", + value: function profileEnd(label) { + this[LOG_SYMBOL](LogType.profileEnd, [label]); + } + + /** + * @param {string} label label + */ + }, { + key: "time", + value: function time(label) { + /** @type {Map} */ + this[TIMERS_SYMBOL] = this[TIMERS_SYMBOL] || new Map(); + this[TIMERS_SYMBOL].set(label, process.hrtime()); + } + + /** + * @param {string=} label label + */ + }, { + key: "timeLog", + value: function timeLog(label) { + var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error("No such label '".concat(label, "' for WebpackLogger.timeLog()")); + } + var time = process.hrtime(prev); + this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time))); + } + + /** + * @param {string=} label label + */ + }, { + key: "timeEnd", + value: function timeEnd(label) { + var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error("No such label '".concat(label, "' for WebpackLogger.timeEnd()")); + } + var time = process.hrtime(prev); + /** @type {Map} */ + this[TIMERS_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time))); + } + + /** + * @param {string=} label label + */ + }, { + key: "timeAggregate", + value: function timeAggregate(label) { + var prev = this[TIMERS_SYMBOL] && this[TIMERS_SYMBOL].get(label); + if (!prev) { + throw new Error("No such label '".concat(label, "' for WebpackLogger.timeAggregate()")); + } + var time = process.hrtime(prev); + /** @type {Map} */ + this[TIMERS_SYMBOL].delete(label); + /** @type {Map} */ + this[TIMERS_AGGREGATES_SYMBOL] = this[TIMERS_AGGREGATES_SYMBOL] || new Map(); + var current = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (current !== undefined) { + if (time[1] + current[1] > 1e9) { + time[0] += current[0] + 1; + time[1] = time[1] - 1e9 + current[1]; + } else { + time[0] += current[0]; + time[1] += current[1]; + } + } + this[TIMERS_AGGREGATES_SYMBOL].set(label, time); + } + + /** + * @param {string=} label label + */ + }, { + key: "timeAggregateEnd", + value: function timeAggregateEnd(label) { + if (this[TIMERS_AGGREGATES_SYMBOL] === undefined) return; + var time = this[TIMERS_AGGREGATES_SYMBOL].get(label); + if (time === undefined) return; + this[TIMERS_AGGREGATES_SYMBOL].delete(label); + this[LOG_SYMBOL](LogType.time, [label].concat(_toConsumableArray(time))); + } + }]); +}(); +module.exports.Logger = WebpackLogger; + +/***/ }), + +/***/ "./node_modules/webpack/lib/logging/createConsoleLogger.js": +/*!*****************************************************************!*\ + !*** ./node_modules/webpack/lib/logging/createConsoleLogger.js ***! + \*****************************************************************/ +/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_12803__) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +function _slicedToArray(r, e) { + return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); +} +function _nonIterableRest() { + throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _iterableToArrayLimit(r, l) { + var t = null == r ? null : "undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || r["@@iterator"]; + if (null != t) { + var e, + n, + i, + u, + a = [], + f = !0, + o = !1; + try { + if (i = (t = t.call(r)).next, 0 === l) { + if (Object(t) !== t) return; + f = !1; + } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); + } catch (r) { + o = !0, n = r; + } finally { + try { + if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; + } finally { + if (o) throw n; + } + } + return a; + } +} +function _arrayWithHoles(r) { + if (Array.isArray(r)) return r; +} +function _toConsumableArray(r) { + return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); +} +function _nonIterableSpread() { + throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); +} +function _unsupportedIterableToArray(r, a) { + if (r) { + if ("string" == typeof r) return _arrayLikeToArray(r, a); + var t = {}.toString.call(r).slice(8, -1); + return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; + } +} +function _iterableToArray(r) { + if ("undefined" != typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && null != r[(typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator] || null != r["@@iterator"]) return Array.from(r); +} +function _arrayWithoutHoles(r) { + if (Array.isArray(r)) return _arrayLikeToArray(r); +} +function _arrayLikeToArray(r, a) { + (null == a || a > r.length) && (a = r.length); + for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; + return n; +} +function _typeof(o) { + "@babel/helpers - typeof"; + + return _typeof = "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && "symbol" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).iterator ? function (o) { + return typeof o; + } : function (o) { + return o && "function" == typeof (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o.constructor === (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }) && o !== (typeof Symbol !== "undefined" ? Symbol : function (i) { return i; }).prototype ? "symbol" : typeof o; + }, _typeof(o); +} +var _require = __nested_webpack_require_12803__(/*! ./Logger */ "./node_modules/webpack/lib/logging/Logger.js"), + LogType = _require.LogType; + +/** @typedef {import("../../declarations/WebpackOptions").FilterItemTypes} FilterItemTypes */ +/** @typedef {import("../../declarations/WebpackOptions").FilterTypes} FilterTypes */ +/** @typedef {import("./Logger").LogTypeEnum} LogTypeEnum */ + +/** @typedef {(item: string) => boolean} FilterFunction */ +/** @typedef {(value: string, type: LogTypeEnum, args?: EXPECTED_ANY[]) => void} LoggingFunction */ + +/** + * @typedef {object} LoggerConsole + * @property {() => void} clear + * @property {() => void} trace + * @property {(...args: EXPECTED_ANY[]) => void} info + * @property {(...args: EXPECTED_ANY[]) => void} log + * @property {(...args: EXPECTED_ANY[]) => void} warn + * @property {(...args: EXPECTED_ANY[]) => void} error + * @property {(...args: EXPECTED_ANY[]) => void=} debug + * @property {(...args: EXPECTED_ANY[]) => void=} group + * @property {(...args: EXPECTED_ANY[]) => void=} groupCollapsed + * @property {(...args: EXPECTED_ANY[]) => void=} groupEnd + * @property {(...args: EXPECTED_ANY[]) => void=} status + * @property {(...args: EXPECTED_ANY[]) => void=} profile + * @property {(...args: EXPECTED_ANY[]) => void=} profileEnd + * @property {(...args: EXPECTED_ANY[]) => void=} logTime + */ + +/** + * @typedef {object} LoggerOptions + * @property {false|true|"none"|"error"|"warn"|"info"|"log"|"verbose"} level loglevel + * @property {FilterTypes|boolean} debug filter for debug logging + * @property {LoggerConsole} console the console to log to + */ + +/** + * @param {FilterItemTypes} item an input item + * @returns {FilterFunction | undefined} filter function + */ +var filterToFunction = function filterToFunction(item) { + if (typeof item === "string") { + var regExp = new RegExp("[\\\\/]".concat(item.replace(/[-[\]{}()*+?.\\^$|]/g, "\\$&"), "([\\\\/]|$|!|\\?)")); + return function (ident) { + return regExp.test(ident); + }; + } + if (item && _typeof(item) === "object" && typeof item.test === "function") { + return function (ident) { + return item.test(ident); + }; + } + if (typeof item === "function") { + return item; + } + if (typeof item === "boolean") { + return function () { + return item; + }; + } +}; + +/** + * @enum {number} + */ +var LogLevel = { + none: 6, + false: 6, + error: 5, + warn: 4, + info: 3, + log: 2, + true: 2, + verbose: 1 +}; + +/** + * @param {LoggerOptions} options options object + * @returns {LoggingFunction} logging function + */ +module.exports = function (_ref) { + var _ref$level = _ref.level, + level = _ref$level === void 0 ? "info" : _ref$level, + _ref$debug = _ref.debug, + debug = _ref$debug === void 0 ? false : _ref$debug, + console = _ref.console; + var debugFilters = /** @type {FilterFunction[]} */ + + typeof debug === "boolean" ? [function () { + return debug; + }] : /** @type {FilterItemTypes[]} */[].concat(debug).map(filterToFunction); + var loglevel = LogLevel["".concat(level)] || 0; + + /** + * @param {string} name name of the logger + * @param {LogTypeEnum} type type of the log entry + * @param {EXPECTED_ANY[]=} args arguments of the log entry + * @returns {void} + */ + var logger = function logger(name, type, args) { + var labeledArgs = function labeledArgs() { + if (Array.isArray(args)) { + if (args.length > 0 && typeof args[0] === "string") { + return ["[".concat(name, "] ").concat(args[0])].concat(_toConsumableArray(args.slice(1))); + } + return ["[".concat(name, "]")].concat(_toConsumableArray(args)); + } + return []; + }; + var debug = debugFilters.some(function (f) { + return f(name); + }); + switch (type) { + case LogType.debug: + if (!debug) return; + if (typeof console.debug === "function") { + console.debug.apply(console, _toConsumableArray(labeledArgs())); + } else { + console.log.apply(console, _toConsumableArray(labeledArgs())); + } + break; + case LogType.log: + if (!debug && loglevel > LogLevel.log) return; + console.log.apply(console, _toConsumableArray(labeledArgs())); + break; + case LogType.info: + if (!debug && loglevel > LogLevel.info) return; + console.info.apply(console, _toConsumableArray(labeledArgs())); + break; + case LogType.warn: + if (!debug && loglevel > LogLevel.warn) return; + console.warn.apply(console, _toConsumableArray(labeledArgs())); + break; + case LogType.error: + if (!debug && loglevel > LogLevel.error) return; + console.error.apply(console, _toConsumableArray(labeledArgs())); + break; + case LogType.trace: + if (!debug) return; + console.trace(); + break; + case LogType.groupCollapsed: + if (!debug && loglevel > LogLevel.log) return; + if (!debug && loglevel > LogLevel.verbose) { + if (typeof console.groupCollapsed === "function") { + console.groupCollapsed.apply(console, _toConsumableArray(labeledArgs())); + } else { + console.log.apply(console, _toConsumableArray(labeledArgs())); + } + break; + } + // falls through + case LogType.group: + if (!debug && loglevel > LogLevel.log) return; + if (typeof console.group === "function") { + console.group.apply(console, _toConsumableArray(labeledArgs())); + } else { + console.log.apply(console, _toConsumableArray(labeledArgs())); + } + break; + case LogType.groupEnd: + if (!debug && loglevel > LogLevel.log) return; + if (typeof console.groupEnd === "function") { + console.groupEnd(); + } + break; + case LogType.time: + { + if (!debug && loglevel > LogLevel.log) return; + var _args = _slicedToArray(/** @type {[string, number, number]} */ + args, 3), + label = _args[0], + start = _args[1], + end = _args[2]; + var ms = start * 1000 + end / 1000000; + var msg = "[".concat(name, "] ").concat(label, ": ").concat(ms, " ms"); + if (typeof console.logTime === "function") { + console.logTime(msg); + } else { + console.log(msg); + } + break; + } + case LogType.profile: + if (typeof console.profile === "function") { + console.profile.apply(console, _toConsumableArray(labeledArgs())); + } + break; + case LogType.profileEnd: + if (typeof console.profileEnd === "function") { + console.profileEnd.apply(console, _toConsumableArray(labeledArgs())); + } + break; + case LogType.clear: + if (!debug && loglevel > LogLevel.log) return; + if (typeof console.clear === "function") { + console.clear(); + } + break; + case LogType.status: + if (!debug && loglevel > LogLevel.info) return; + if (typeof console.status === "function") { + if (!args || args.length === 0) { + console.status(); + } else { + console.status.apply(console, _toConsumableArray(labeledArgs())); + } + } else if (args && args.length !== 0) { + console.info.apply(console, _toConsumableArray(labeledArgs())); + } + break; + default: + throw new Error("Unexpected LogType ".concat(type)); + } + }; + return logger; +}; + +/***/ }), + +/***/ "./node_modules/webpack/lib/logging/runtime.js": +/*!*****************************************************!*\ + !*** ./node_modules/webpack/lib/logging/runtime.js ***! + \*****************************************************/ +/***/ (function(module, __unused_webpack_exports, __nested_webpack_require_23778__) { + +/* + MIT License http://www.opensource.org/licenses/mit-license.php + Author Tobias Koppers @sokra +*/ + + + +function _extends() { + return _extends = Object.assign ? Object.assign.bind() : function (n) { + for (var e = 1; e < arguments.length; e++) { + var t = arguments[e]; + for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); + } + return n; + }, _extends.apply(null, arguments); +} +var _require = __nested_webpack_require_23778__(/*! tapable */ "./client-src/modules/logger/tapable.js"), + SyncBailHook = _require.SyncBailHook; +var _require2 = __nested_webpack_require_23778__(/*! ./Logger */ "./node_modules/webpack/lib/logging/Logger.js"), + Logger = _require2.Logger; +var createConsoleLogger = __nested_webpack_require_23778__(/*! ./createConsoleLogger */ "./node_modules/webpack/lib/logging/createConsoleLogger.js"); + +/** @type {createConsoleLogger.LoggerOptions} */ +var currentDefaultLoggerOptions = { + level: "info", + debug: false, + console: console +}; +var currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); + +/** + * @param {string} name name of the logger + * @returns {Logger} a logger + */ +module.exports.getLogger = function (name) { + return new Logger(function (type, args) { + if (module.exports.hooks.log.call(name, type, args) === undefined) { + currentDefaultLogger(name, type, args); + } + }, function (childName) { + return module.exports.getLogger("".concat(name, "/").concat(childName)); + }); +}; + +/** + * @param {createConsoleLogger.LoggerOptions} options new options, merge with old options + * @returns {void} + */ +module.exports.configureDefaultLogger = function (options) { + _extends(currentDefaultLoggerOptions, options); + currentDefaultLogger = createConsoleLogger(currentDefaultLoggerOptions); +}; +module.exports.hooks = { + log: new SyncBailHook(["origin", "type", "args"]) +}; + +/***/ }) + +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __nested_webpack_require_25855__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_25855__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __nested_webpack_require_25855__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__nested_webpack_require_25855__.o(definition, key) && !__nested_webpack_require_25855__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __nested_webpack_require_25855__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __nested_webpack_require_25855__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __nested_webpack_exports__ = {}; +// This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk. +!function() { +/*!********************************************!*\ + !*** ./client-src/modules/logger/index.js ***! + \********************************************/ +__nested_webpack_require_25855__.r(__nested_webpack_exports__); +/* harmony export */ __nested_webpack_require_25855__.d(__nested_webpack_exports__, { +/* harmony export */ "default": function() { return /* reexport default export from named module */ webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__; } +/* harmony export */ }); +/* harmony import */ var webpack_lib_logging_runtime_js__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_25855__(/*! webpack/lib/logging/runtime.js */ "./node_modules/webpack/lib/logging/runtime.js"); + +}(); +var __webpack_export_target__ = exports; +for(var __webpack_i__ in __nested_webpack_exports__) __webpack_export_target__[__webpack_i__] = __nested_webpack_exports__[__webpack_i__]; +if(__nested_webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); +/******/ })() +; + +/***/ }), + +/***/ 40778: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/_stream_writable.js ***! + \********************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ 31840); +/**/ + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick; +/**/ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var util = Object.create(__webpack_require__(/*! core-util-is */ 60379)); +util.inherits = __webpack_require__(/*! inherits */ 18628); +/**/ + +/**/ +var internalUtil = { + deprecate: __webpack_require__(/*! util-deprecate */ 44568) +}; +/**/ + +/**/ +var Stream = __webpack_require__(/*! ./internal/streams/stream */ 76439); +/**/ + +/**/ + +var Buffer = (__webpack_require__(/*! safe-buffer */ 10703).Buffer); +var OurUint8Array = (typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +var destroyImpl = __webpack_require__(/*! ./internal/streams/destroy */ 47886); + +util.inherits(Writable, Stream); + +function nop() {} + +function WritableState(options, stream) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 38720); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var writableHwm = options.writableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} + +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; + +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function () { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function (object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function (object) { + return object instanceof this; + }; +} + +function Writable(options) { + Duplex = Duplex || __webpack_require__(/*! ./_stream_duplex */ 38720); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) { + return new Writable(options); + } + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + if (options) { + if (typeof options.write === 'function') this._write = options.write; + + if (typeof options.writev === 'function') this._writev = options.writev; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + + if (typeof options.final === 'function') this._final = options.final; + } + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + this.emit('error', new Error('Cannot pipe, not readable')); +}; + +function writeAfterEnd(stream, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + pna.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var valid = true; + var er = false; + + if (chunk === null) { + er = new TypeError('May not write null values to stream'); + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + if (er) { + stream.emit('error', er); + pna.nextTick(cb, er); + valid = false; + } + return valid; +} + +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + + if (typeof cb !== 'function') cb = nop; + + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function () { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function () { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; + +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} + +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + pna.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + pna.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + stream.emit('error', er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state); + + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + + if (sync) { + /**/ + asyncWrite(afterWrite, stream, state, finished, cb); + /**/ + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + + if (entry === null) state.lastBufferedRequest = null; + } + + state.bufferedRequest = entry; + state.bufferProcessing = false; +} + +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new Error('_write() is not implemented')); +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); +}; + +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + stream.emit('error', err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function') { + state.pendingcb++; + state.finalCalled = true; + pna.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} + +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + } + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) pna.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} + +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} + +Object.defineProperty(Writable.prototype, 'destroyed', { + get: function () { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); + +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + this.end(); + cb(err); +}; + +/***/ }), + +/***/ 40790: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.js ***! + \*************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +var has = Object.prototype.hasOwnProperty + , prefix = '~'; + +/** + * Constructor to create a storage for our `EE` objects. + * An `Events` instance is a plain object whose properties are event names. + * + * @constructor + * @private + */ +function Events() {} + +// +// We try to not inherit from `Object.prototype`. In some engines creating an +// instance in this way is faster than calling `Object.create(null)` directly. +// If `Object.create(null)` is not supported we prefix the event names with a +// character to make sure that the built-in object properties are not +// overridden or used as an attack vector. +// +if (Object.create) { + Events.prototype = Object.create(null); + + // + // This hack is needed because the `__proto__` property is still inherited in + // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. + // + if (!new Events().__proto__) prefix = false; +} + +/** + * Representation of a single event listener. + * + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} [once=false] Specify if the listener is a one-time listener. + * @constructor + * @private + */ +function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; +} + +/** + * Add a listener for a given event. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} context The context to invoke the listener with. + * @param {Boolean} once Specify if the listener is a one-time listener. + * @returns {EventEmitter} + * @private + */ +function addListener(emitter, event, fn, context, once) { + if (typeof fn !== 'function') { + throw new TypeError('The listener must be a function'); + } + + var listener = new EE(fn, context || emitter, once) + , evt = prefix ? prefix + event : event; + + if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; + else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); + else emitter._events[evt] = [emitter._events[evt], listener]; + + return emitter; +} + +/** + * Clear event by name. + * + * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. + * @param {(String|Symbol)} evt The Event name. + * @private + */ +function clearEvent(emitter, evt) { + if (--emitter._eventsCount === 0) emitter._events = new Events(); + else delete emitter._events[evt]; +} + +/** + * Minimal `EventEmitter` interface that is molded against the Node.js + * `EventEmitter` interface. + * + * @constructor + * @public + */ +function EventEmitter() { + this._events = new Events(); + this._eventsCount = 0; +} + +/** + * Return an array listing the events for which the emitter has registered + * listeners. + * + * @returns {Array} + * @public + */ +EventEmitter.prototype.eventNames = function eventNames() { + var names = [] + , events + , name; + + if (this._eventsCount === 0) return names; + + for (name in (events = this._events)) { + if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); + } + + if (Object.getOwnPropertySymbols) { + return names.concat(Object.getOwnPropertySymbols(events)); + } + + return names; +}; + +/** + * Return the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Array} The registered listeners. + * @public + */ +EventEmitter.prototype.listeners = function listeners(event) { + var evt = prefix ? prefix + event : event + , handlers = this._events[evt]; + + if (!handlers) return []; + if (handlers.fn) return [handlers.fn]; + + for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { + ee[i] = handlers[i].fn; + } + + return ee; +}; + +/** + * Return the number of listeners listening to a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Number} The number of listeners. + * @public + */ +EventEmitter.prototype.listenerCount = function listenerCount(event) { + var evt = prefix ? prefix + event : event + , listeners = this._events[evt]; + + if (!listeners) return 0; + if (listeners.fn) return 1; + return listeners.length; +}; + +/** + * Calls each of the listeners registered for a given event. + * + * @param {(String|Symbol)} event The event name. + * @returns {Boolean} `true` if the event had listeners, else `false`. + * @public + */ +EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if (listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; +}; + +/** + * Add a listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.on = function on(event, fn, context) { + return addListener(this, event, fn, context, false); +}; + +/** + * Add a one-time listener for a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn The listener function. + * @param {*} [context=this] The context to invoke the listener with. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.once = function once(event, fn, context) { + return addListener(this, event, fn, context, true); +}; + +/** + * Remove the listeners of a given event. + * + * @param {(String|Symbol)} event The event name. + * @param {Function} fn Only remove the listeners that match this function. + * @param {*} context Only remove the listeners that have this context. + * @param {Boolean} once Only remove one-time listeners. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events[evt]) return this; + if (!fn) { + clearEvent(this, evt); + return this; + } + + var listeners = this._events[evt]; + + if (listeners.fn) { + if ( + listeners.fn === fn && + (!once || listeners.once) && + (!context || listeners.context === context) + ) { + clearEvent(this, evt); + } + } else { + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn || + (once && !listeners[i].once) || + (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; + else clearEvent(this, evt); + } + + return this; +}; + +/** + * Remove all listeners, or those of the specified event. + * + * @param {(String|Symbol)} [event] The event name. + * @returns {EventEmitter} `this`. + * @public + */ +EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + var evt; + + if (event) { + evt = prefix ? prefix + event : event; + if (this._events[evt]) clearEvent(this, evt); + } else { + this._events = new Events(); + this._eventsCount = 0; + } + + return this; +}; + +// +// Alias methods names because people roll like that. +// +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; +EventEmitter.prototype.addListener = EventEmitter.prototype.on; + +// +// Expose the prefix. +// +EventEmitter.prefixed = prefix; + +// +// Allow `EventEmitter` to be imported as module namespace. +// +EventEmitter.EventEmitter = EventEmitter; + +// +// Expose the module. +// +if (true) { + module.exports = EventEmitter; +} + + +/***/ }), + +/***/ 40847: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/has-symbols@1.1.0/node_modules/has-symbols/shams.js ***! + \*********************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./shams')} */ +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } + + /** @type {{ [k in symbol]?: unknown }} */ + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } + + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } + + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } + + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } + + var symVal = 42; + obj[sym] = symVal; + for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } + + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } + + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } + + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } + + if (typeof Object.getOwnPropertyDescriptor === 'function') { + // eslint-disable-next-line no-extra-parens + var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym)); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } + + return true; +}; + + +/***/ }), + +/***/ 40874: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/end-of-stream.js ***! + \**********************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(/*! ../../../errors */ 31788).codes).ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ 41032: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1.js ***! + \*****************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var asn1 = exports; + +asn1.bignum = __webpack_require__(/*! bn.js */ 27019); + +asn1.define = (__webpack_require__(/*! ./asn1/api */ 82939).define); +asn1.base = __webpack_require__(/*! ./asn1/base */ 57409); +asn1.constants = __webpack_require__(/*! ./asn1/constants */ 53953); +asn1.decoders = __webpack_require__(/*! ./asn1/decoders */ 93498); +asn1.encoders = __webpack_require__(/*! ./asn1/encoders */ 18421); + + +/***/ }), + +/***/ 41139: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/css-loader@6.8.1_webpack@5.102.1/node_modules/css-loader/dist/runtime/sourceMaps.js ***! + \*****************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +module.exports = function (item) { + var content = item[1]; + var cssMapping = item[3]; + if (!cssMapping) { + return content; + } + if (typeof btoa === "function") { + var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); + var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); + var sourceMapping = "/*# ".concat(data, " */"); + return [content].concat([sourceMapping]).join("\n"); + } + return [content].join("\n"); +}; + +/***/ }), + +/***/ 41182: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/public-encrypt@4.0.3/node_modules/public-encrypt/mgf.js ***! + \*************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var createHash = __webpack_require__(/*! create-hash */ 88852) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) + +module.exports = function (seed, len) { + var t = Buffer.alloc(0) + var i = 0 + var c + while (t.length < len) { + c = i2ops(i++) + t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()]) + } + return t.slice(0, len) +} + +function i2ops (c) { + var out = Buffer.allocUnsafe(4) + out.writeUInt32BE(c, 0) + return out +} + + +/***/ }), + +/***/ 41196: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/bags/crl_bag.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CRLBag: () => (/* binding */ CRLBag), +/* harmony export */ id_crlTypes: () => (/* binding */ id_crlTypes), +/* harmony export */ id_x509CRL: () => (/* binding */ id_x509CRL) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./types.js */ 61771); + + + +class CRLBag { + crlId = ""; + crltValue = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], CRLBag.prototype, "crlId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, context: 0, + }) +], CRLBag.prototype, "crltValue", void 0); +const id_crlTypes = `${_types_js__WEBPACK_IMPORTED_MODULE_2__.id_pkcs_9}.23`; +const id_x509CRL = `${id_crlTypes}.1`; + + +/***/ }), + +/***/ 41623: +/*!****************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/type.js ***! + \****************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./type')} */ +module.exports = TypeError; + + +/***/ }), + +/***/ 41695: +/*!***********************************************************************************************!*\ + !*** ../node_modules/.pnpm/typed-array-buffer@1.0.3/node_modules/typed-array-buffer/index.js ***! + \***********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $TypeError = __webpack_require__(/*! es-errors/type */ 41623); + +var callBound = __webpack_require__(/*! call-bound */ 6046); + +/** @type {undefined | ((thisArg: import('.').TypedArray) => Buffer)} */ +var $typedArrayBuffer = callBound('TypedArray.prototype.buffer', true); + +var isTypedArray = __webpack_require__(/*! is-typed-array */ 34587); + +/** @type {import('.')} */ +// node <= 0.10, < 0.11.4 has a nonconfigurable own property instead of a prototype getter +module.exports = $typedArrayBuffer || function typedArrayBuffer(x) { + if (!isTypedArray(x)) { + throw new $TypeError('Not a Typed Array'); + } + return x.buffer; +}; + + +/***/ }), + +/***/ 41744: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KEM_USAGES: () => (/* binding */ KEM_USAGES), +/* harmony export */ LABEL_DKP_PRK: () => (/* binding */ LABEL_DKP_PRK), +/* harmony export */ LABEL_SK: () => (/* binding */ LABEL_SK) +/* harmony export */ }); +// The key usages for KEM. +const KEM_USAGES = ["deriveBits"]; +// b"dkp_prk" +const LABEL_DKP_PRK = /* @__PURE__ */ new Uint8Array([ + 100, + 107, + 112, + 95, + 112, + 114, + 107, +]); +// b"sk" +const LABEL_SK = /* @__PURE__ */ new Uint8Array([115, 107]); + + +/***/ }), + +/***/ 42032: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/sha.js@2.4.12/node_modules/sha.js/sha512.js ***! + \*************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var inherits = __webpack_require__(/*! inherits */ 18628); +var Hash = __webpack_require__(/*! ./hash */ 76626); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +var K = [ + 0x428a2f98, + 0xd728ae22, + 0x71374491, + 0x23ef65cd, + 0xb5c0fbcf, + 0xec4d3b2f, + 0xe9b5dba5, + 0x8189dbbc, + 0x3956c25b, + 0xf348b538, + 0x59f111f1, + 0xb605d019, + 0x923f82a4, + 0xaf194f9b, + 0xab1c5ed5, + 0xda6d8118, + 0xd807aa98, + 0xa3030242, + 0x12835b01, + 0x45706fbe, + 0x243185be, + 0x4ee4b28c, + 0x550c7dc3, + 0xd5ffb4e2, + 0x72be5d74, + 0xf27b896f, + 0x80deb1fe, + 0x3b1696b1, + 0x9bdc06a7, + 0x25c71235, + 0xc19bf174, + 0xcf692694, + 0xe49b69c1, + 0x9ef14ad2, + 0xefbe4786, + 0x384f25e3, + 0x0fc19dc6, + 0x8b8cd5b5, + 0x240ca1cc, + 0x77ac9c65, + 0x2de92c6f, + 0x592b0275, + 0x4a7484aa, + 0x6ea6e483, + 0x5cb0a9dc, + 0xbd41fbd4, + 0x76f988da, + 0x831153b5, + 0x983e5152, + 0xee66dfab, + 0xa831c66d, + 0x2db43210, + 0xb00327c8, + 0x98fb213f, + 0xbf597fc7, + 0xbeef0ee4, + 0xc6e00bf3, + 0x3da88fc2, + 0xd5a79147, + 0x930aa725, + 0x06ca6351, + 0xe003826f, + 0x14292967, + 0x0a0e6e70, + 0x27b70a85, + 0x46d22ffc, + 0x2e1b2138, + 0x5c26c926, + 0x4d2c6dfc, + 0x5ac42aed, + 0x53380d13, + 0x9d95b3df, + 0x650a7354, + 0x8baf63de, + 0x766a0abb, + 0x3c77b2a8, + 0x81c2c92e, + 0x47edaee6, + 0x92722c85, + 0x1482353b, + 0xa2bfe8a1, + 0x4cf10364, + 0xa81a664b, + 0xbc423001, + 0xc24b8b70, + 0xd0f89791, + 0xc76c51a3, + 0x0654be30, + 0xd192e819, + 0xd6ef5218, + 0xd6990624, + 0x5565a910, + 0xf40e3585, + 0x5771202a, + 0x106aa070, + 0x32bbd1b8, + 0x19a4c116, + 0xb8d2d0c8, + 0x1e376c08, + 0x5141ab53, + 0x2748774c, + 0xdf8eeb99, + 0x34b0bcb5, + 0xe19b48a8, + 0x391c0cb3, + 0xc5c95a63, + 0x4ed8aa4a, + 0xe3418acb, + 0x5b9cca4f, + 0x7763e373, + 0x682e6ff3, + 0xd6b2b8a3, + 0x748f82ee, + 0x5defb2fc, + 0x78a5636f, + 0x43172f60, + 0x84c87814, + 0xa1f0ab72, + 0x8cc70208, + 0x1a6439ec, + 0x90befffa, + 0x23631e28, + 0xa4506ceb, + 0xde82bde9, + 0xbef9a3f7, + 0xb2c67915, + 0xc67178f2, + 0xe372532b, + 0xca273ece, + 0xea26619c, + 0xd186b8c7, + 0x21c0c207, + 0xeada7dd6, + 0xcde0eb1e, + 0xf57d4f7f, + 0xee6ed178, + 0x06f067aa, + 0x72176fba, + 0x0a637dc5, + 0xa2c898a6, + 0x113f9804, + 0xbef90dae, + 0x1b710b35, + 0x131c471b, + 0x28db77f5, + 0x23047d84, + 0x32caab7b, + 0x40c72493, + 0x3c9ebe0a, + 0x15c9bebc, + 0x431d67c4, + 0x9c100d4c, + 0x4cc5d4be, + 0xcb3e42b6, + 0x597f299c, + 0xfc657e2a, + 0x5fcb6fab, + 0x3ad6faec, + 0x6c44198c, + 0x4a475817 +]; + +var W = new Array(160); + +function Sha512() { + this.init(); + this._w = W; + + Hash.call(this, 128, 112); +} + +inherits(Sha512, Hash); + +Sha512.prototype.init = function () { + this._ah = 0x6a09e667; + this._bh = 0xbb67ae85; + this._ch = 0x3c6ef372; + this._dh = 0xa54ff53a; + this._eh = 0x510e527f; + this._fh = 0x9b05688c; + this._gh = 0x1f83d9ab; + this._hh = 0x5be0cd19; + + this._al = 0xf3bcc908; + this._bl = 0x84caa73b; + this._cl = 0xfe94f82b; + this._dl = 0x5f1d36f1; + this._el = 0xade682d1; + this._fl = 0x2b3e6c1f; + this._gl = 0xfb41bd6b; + this._hl = 0x137e2179; + + return this; +}; + +function Ch(x, y, z) { + return z ^ (x & (y ^ z)); +} + +function maj(x, y, z) { + return (x & y) | (z & (x | y)); +} + +function sigma0(x, xl) { + return ((x >>> 28) | (xl << 4)) ^ ((xl >>> 2) | (x << 30)) ^ ((xl >>> 7) | (x << 25)); +} + +function sigma1(x, xl) { + return ((x >>> 14) | (xl << 18)) ^ ((x >>> 18) | (xl << 14)) ^ ((xl >>> 9) | (x << 23)); +} + +function Gamma0(x, xl) { + return ((x >>> 1) | (xl << 31)) ^ ((x >>> 8) | (xl << 24)) ^ (x >>> 7); +} + +function Gamma0l(x, xl) { + return ((x >>> 1) | (xl << 31)) ^ ((x >>> 8) | (xl << 24)) ^ ((x >>> 7) | (xl << 25)); +} + +function Gamma1(x, xl) { + return ((x >>> 19) | (xl << 13)) ^ ((xl >>> 29) | (x << 3)) ^ (x >>> 6); +} + +function Gamma1l(x, xl) { + return ((x >>> 19) | (xl << 13)) ^ ((xl >>> 29) | (x << 3)) ^ ((x >>> 6) | (xl << 26)); +} + +function getCarry(a, b) { + return (a >>> 0) < (b >>> 0) ? 1 : 0; +} + +Sha512.prototype._update = function (M) { + var w = this._w; + + var ah = this._ah | 0; + var bh = this._bh | 0; + var ch = this._ch | 0; + var dh = this._dh | 0; + var eh = this._eh | 0; + var fh = this._fh | 0; + var gh = this._gh | 0; + var hh = this._hh | 0; + + var al = this._al | 0; + var bl = this._bl | 0; + var cl = this._cl | 0; + var dl = this._dl | 0; + var el = this._el | 0; + var fl = this._fl | 0; + var gl = this._gl | 0; + var hl = this._hl | 0; + + for (var i = 0; i < 32; i += 2) { + w[i] = M.readInt32BE(i * 4); + w[i + 1] = M.readInt32BE((i * 4) + 4); + } + for (; i < 160; i += 2) { + var xh = w[i - (15 * 2)]; + var xl = w[i - (15 * 2) + 1]; + var gamma0 = Gamma0(xh, xl); + var gamma0l = Gamma0l(xl, xh); + + xh = w[i - (2 * 2)]; + xl = w[i - (2 * 2) + 1]; + var gamma1 = Gamma1(xh, xl); + var gamma1l = Gamma1l(xl, xh); + + // w[i] = gamma0 + w[i - 7] + gamma1 + w[i - 16] + var Wi7h = w[i - (7 * 2)]; + var Wi7l = w[i - (7 * 2) + 1]; + + var Wi16h = w[i - (16 * 2)]; + var Wi16l = w[i - (16 * 2) + 1]; + + var Wil = (gamma0l + Wi7l) | 0; + var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0; + Wil = (Wil + gamma1l) | 0; + Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0; + Wil = (Wil + Wi16l) | 0; + Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0; + + w[i] = Wih; + w[i + 1] = Wil; + } + + for (var j = 0; j < 160; j += 2) { + Wih = w[j]; + Wil = w[j + 1]; + + var majh = maj(ah, bh, ch); + var majl = maj(al, bl, cl); + + var sigma0h = sigma0(ah, al); + var sigma0l = sigma0(al, ah); + var sigma1h = sigma1(eh, el); + var sigma1l = sigma1(el, eh); + + // t1 = h + sigma1 + ch + K[j] + w[j] + var Kih = K[j]; + var Kil = K[j + 1]; + + var chh = Ch(eh, fh, gh); + var chl = Ch(el, fl, gl); + + var t1l = (hl + sigma1l) | 0; + var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0; + t1l = (t1l + chl) | 0; + t1h = (t1h + chh + getCarry(t1l, chl)) | 0; + t1l = (t1l + Kil) | 0; + t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0; + t1l = (t1l + Wil) | 0; + t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0; + + // t2 = sigma0 + maj + var t2l = (sigma0l + majl) | 0; + var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0; + + hh = gh; + hl = gl; + gh = fh; + gl = fl; + fh = eh; + fl = el; + el = (dl + t1l) | 0; + eh = (dh + t1h + getCarry(el, dl)) | 0; + dh = ch; + dl = cl; + ch = bh; + cl = bl; + bh = ah; + bl = al; + al = (t1l + t2l) | 0; + ah = (t1h + t2h + getCarry(al, t1l)) | 0; + } + + this._al = (this._al + al) | 0; + this._bl = (this._bl + bl) | 0; + this._cl = (this._cl + cl) | 0; + this._dl = (this._dl + dl) | 0; + this._el = (this._el + el) | 0; + this._fl = (this._fl + fl) | 0; + this._gl = (this._gl + gl) | 0; + this._hl = (this._hl + hl) | 0; + + this._ah = (this._ah + ah + getCarry(this._al, al)) | 0; + this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0; + this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0; + this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0; + this._eh = (this._eh + eh + getCarry(this._el, el)) | 0; + this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0; + this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0; + this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0; +}; + +Sha512.prototype._hash = function () { + var H = Buffer.allocUnsafe(64); + + function writeInt64BE(h, l, offset) { + H.writeInt32BE(h, offset); + H.writeInt32BE(l, offset + 4); + } + + writeInt64BE(this._ah, this._al, 0); + writeInt64BE(this._bh, this._bl, 8); + writeInt64BE(this._ch, this._cl, 16); + writeInt64BE(this._dh, this._dl, 24); + writeInt64BE(this._eh, this._el, 32); + writeInt64BE(this._fh, this._fl, 40); + writeInt64BE(this._gh, this._gl, 48); + writeInt64BE(this._hh, this._hl, 56); + + return H; +}; + +module.exports = Sha512; + + +/***/ }), + +/***/ 42104: +/*!********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js ***! + \********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ emitNotSupported: () => (/* binding */ emitNotSupported) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); + +function emitNotSupported() { + return new Promise((_resolve, reject) => { + reject(new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError("Not supported")); + }); +} + + +/***/ }), + +/***/ 42165: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/eddsa/index.js ***! + \**********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var hash = __webpack_require__(/*! hash.js */ 5222); +var curves = __webpack_require__(/*! ../curves */ 55897); +var utils = __webpack_require__(/*! ../utils */ 28432); +var assert = utils.assert; +var parseBytes = utils.parseBytes; +var KeyPair = __webpack_require__(/*! ./key */ 89126); +var Signature = __webpack_require__(/*! ./signature */ 87579); + +function EDDSA(curve) { + assert(curve === 'ed25519', 'only tested with ed25519 so far'); + + if (!(this instanceof EDDSA)) + return new EDDSA(curve); + + curve = curves[curve].curve; + this.curve = curve; + this.g = curve.g; + this.g.precompute(curve.n.bitLength() + 1); + + this.pointClass = curve.point().constructor; + this.encodingLength = Math.ceil(curve.n.bitLength() / 8); + this.hash = hash.sha512; +} + +module.exports = EDDSA; + +/** +* @param {Array|String} message - message bytes +* @param {Array|String|KeyPair} secret - secret bytes or a keypair +* @returns {Signature} - signature +*/ +EDDSA.prototype.sign = function sign(message, secret) { + message = parseBytes(message); + var key = this.keyFromSecret(secret); + var r = this.hashInt(key.messagePrefix(), message); + var R = this.g.mul(r); + var Rencoded = this.encodePoint(R); + var s_ = this.hashInt(Rencoded, key.pubBytes(), message) + .mul(key.priv()); + var S = r.add(s_).umod(this.curve.n); + return this.makeSignature({ R: R, S: S, Rencoded: Rencoded }); +}; + +/** +* @param {Array} message - message bytes +* @param {Array|String|Signature} sig - sig bytes +* @param {Array|String|Point|KeyPair} pub - public key +* @returns {Boolean} - true if public key matches sig of message +*/ +EDDSA.prototype.verify = function verify(message, sig, pub) { + message = parseBytes(message); + sig = this.makeSignature(sig); + if (sig.S().gte(sig.eddsa.curve.n) || sig.S().isNeg()) { + return false; + } + var key = this.keyFromPublic(pub); + var h = this.hashInt(sig.Rencoded(), key.pubBytes(), message); + var SG = this.g.mul(sig.S()); + var RplusAh = sig.R().add(key.pub().mul(h)); + return RplusAh.eq(SG); +}; + +EDDSA.prototype.hashInt = function hashInt() { + var hash = this.hash(); + for (var i = 0; i < arguments.length; i++) + hash.update(arguments[i]); + return utils.intFromLE(hash.digest()).umod(this.curve.n); +}; + +EDDSA.prototype.keyFromPublic = function keyFromPublic(pub) { + return KeyPair.fromPublic(this, pub); +}; + +EDDSA.prototype.keyFromSecret = function keyFromSecret(secret) { + return KeyPair.fromSecret(this, secret); +}; + +EDDSA.prototype.makeSignature = function makeSignature(sig) { + if (sig instanceof Signature) + return sig; + return new Signature(this, sig); +}; + +/** +* * https://tools.ietf.org/html/draft-josefsson-eddsa-ed25519-03#section-5.2 +* +* EDDSA defines methods for encoding and decoding points and integers. These are +* helper convenience methods, that pass along to utility functions implied +* parameters. +* +*/ +EDDSA.prototype.encodePoint = function encodePoint(point) { + var enc = point.getY().toArray('le', this.encodingLength); + enc[this.encodingLength - 1] |= point.getX().isOdd() ? 0x80 : 0; + return enc; +}; + +EDDSA.prototype.decodePoint = function decodePoint(bytes) { + bytes = utils.parseBytes(bytes); + + var lastIx = bytes.length - 1; + var normed = bytes.slice(0, lastIx).concat(bytes[lastIx] & ~0x80); + var xIsOdd = (bytes[lastIx] & 0x80) !== 0; + + var y = utils.intFromLE(normed); + return this.curve.pointFromY(y, xIsOdd); +}; + +EDDSA.prototype.encodeInt = function encodeInt(num) { + return num.toArray('le', this.encodingLength); +}; + +EDDSA.prototype.decodeInt = function decodeInt(bytes) { + return utils.intFromLE(bytes); +}; + +EDDSA.prototype.isPoint = function isPoint(val) { + return val instanceof this.pointClass; +}; + + +/***/ }), + +/***/ 42378: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/crypto-browserify@3.12.1/node_modules/crypto-browserify/index.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +// eslint-disable-next-line no-multi-assign +exports.randomBytes = exports.rng = exports.pseudoRandomBytes = exports.prng = __webpack_require__(/*! randombytes */ 8546); + +// eslint-disable-next-line no-multi-assign +exports.createHash = exports.Hash = __webpack_require__(/*! create-hash */ 88852); + +// eslint-disable-next-line no-multi-assign +exports.createHmac = exports.Hmac = __webpack_require__(/*! create-hmac */ 44226); + +var algos = __webpack_require__(/*! browserify-sign/algos */ 62817); +var algoKeys = Object.keys(algos); +var hashes = [ + 'sha1', + 'sha224', + 'sha256', + 'sha384', + 'sha512', + 'md5', + 'rmd160' +].concat(algoKeys); + +exports.getHashes = function () { + return hashes; +}; + +var p = __webpack_require__(/*! pbkdf2 */ 13349); +exports.pbkdf2 = p.pbkdf2; +exports.pbkdf2Sync = p.pbkdf2Sync; + +var aes = __webpack_require__(/*! browserify-cipher */ 75169); + +exports.Cipher = aes.Cipher; +exports.createCipher = aes.createCipher; +exports.Cipheriv = aes.Cipheriv; +exports.createCipheriv = aes.createCipheriv; +exports.Decipher = aes.Decipher; +exports.createDecipher = aes.createDecipher; +exports.Decipheriv = aes.Decipheriv; +exports.createDecipheriv = aes.createDecipheriv; +exports.getCiphers = aes.getCiphers; +exports.listCiphers = aes.listCiphers; + +var dh = __webpack_require__(/*! diffie-hellman */ 75515); + +exports.DiffieHellmanGroup = dh.DiffieHellmanGroup; +exports.createDiffieHellmanGroup = dh.createDiffieHellmanGroup; +exports.getDiffieHellman = dh.getDiffieHellman; +exports.createDiffieHellman = dh.createDiffieHellman; +exports.DiffieHellman = dh.DiffieHellman; + +var sign = __webpack_require__(/*! browserify-sign */ 37350); + +exports.createSign = sign.createSign; +exports.Sign = sign.Sign; +exports.createVerify = sign.createVerify; +exports.Verify = sign.Verify; + +exports.createECDH = __webpack_require__(/*! create-ecdh */ 71503); + +var publicEncrypt = __webpack_require__(/*! public-encrypt */ 14880); + +exports.publicEncrypt = publicEncrypt.publicEncrypt; +exports.privateEncrypt = publicEncrypt.privateEncrypt; +exports.publicDecrypt = publicEncrypt.publicDecrypt; +exports.privateDecrypt = publicEncrypt.privateDecrypt; + +// the least I can do is make error messages for the rest of the node.js/crypto api. +// [ +// 'createCredentials' +// ].forEach(function (name) { +// exports[name] = function () { +// throw new Error('sorry, ' + name + ' is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify'); +// }; +// }); + +var rf = __webpack_require__(/*! randomfill */ 50970); + +exports.randomFill = rf.randomFill; +exports.randomFillSync = rf.randomFillSync; + +exports.createCredentials = function () { + throw new Error('sorry, createCredentials is not implemented yet\nwe accept pull requests\nhttps://github.com/browserify/crypto-browserify'); +}; + +exports.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 +}; + + +/***/ }), + +/***/ 42574: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/decrypter.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var AuthCipher = __webpack_require__(/*! ./authCipher */ 20515) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var MODES = __webpack_require__(/*! ./modes */ 95855) +var StreamCipher = __webpack_require__(/*! ./streamCipher */ 5125) +var Transform = __webpack_require__(/*! cipher-base */ 51141) +var aes = __webpack_require__(/*! ./aes */ 75279) +var ebtk = __webpack_require__(/*! evp_bytestokey */ 91415) +var inherits = __webpack_require__(/*! inherits */ 18628) + +function Decipher (mode, key, iv) { + Transform.call(this) + + this._cache = new Splitter() + this._last = void 0 + this._cipher = new aes.AES(key) + this._prev = Buffer.from(iv) + this._mode = mode + this._autopadding = true +} + +inherits(Decipher, Transform) + +Decipher.prototype._update = function (data) { + this._cache.add(data) + var chunk + var thing + var out = [] + while ((chunk = this._cache.get(this._autopadding))) { + thing = this._mode.decrypt(this, chunk) + out.push(thing) + } + return Buffer.concat(out) +} + +Decipher.prototype._final = function () { + var chunk = this._cache.flush() + if (this._autopadding) { + return unpad(this._mode.decrypt(this, chunk)) + } else if (chunk) { + throw new Error('data not multiple of block length') + } +} + +Decipher.prototype.setAutoPadding = function (setTo) { + this._autopadding = !!setTo + return this +} + +function Splitter () { + this.cache = Buffer.allocUnsafe(0) +} + +Splitter.prototype.add = function (data) { + this.cache = Buffer.concat([this.cache, data]) +} + +Splitter.prototype.get = function (autoPadding) { + var out + if (autoPadding) { + if (this.cache.length > 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } else { + if (this.cache.length >= 16) { + out = this.cache.slice(0, 16) + this.cache = this.cache.slice(16) + return out + } + } + + return null +} + +Splitter.prototype.flush = function () { + if (this.cache.length) return this.cache +} + +function unpad (last) { + var padded = last[15] + if (padded < 1 || padded > 16) { + throw new Error('unable to decrypt data') + } + var i = -1 + while (++i < padded) { + if (last[(i + (16 - padded))] !== padded) { + throw new Error('unable to decrypt data') + } + } + if (padded === 16) return + + return last.slice(0, 16 - padded) +} + +function createDecipheriv (suite, password, iv) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + if (typeof iv === 'string') iv = Buffer.from(iv) + if (config.mode !== 'GCM' && iv.length !== config.iv) throw new TypeError('invalid iv length ' + iv.length) + + if (typeof password === 'string') password = Buffer.from(password) + if (password.length !== config.key / 8) throw new TypeError('invalid key length ' + password.length) + + if (config.type === 'stream') { + return new StreamCipher(config.module, password, iv, true) + } else if (config.type === 'auth') { + return new AuthCipher(config.module, password, iv, true) + } + + return new Decipher(config.module, password, iv) +} + +function createDecipher (suite, password) { + var config = MODES[suite.toLowerCase()] + if (!config) throw new TypeError('invalid suite type') + + var keys = ebtk(password, false, config.key, config.iv) + return createDecipheriv(suite, keys.key, keys.iv) +} + +exports.createDecipher = createDecipher +exports.createDecipheriv = createDecipheriv + + +/***/ }), + +/***/ 42803: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/which-typed-array@1.1.22/node_modules/which-typed-array/index.js ***! + \**********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var forEach = __webpack_require__(/*! for-each */ 19135); +var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ 79618); +var callBind = __webpack_require__(/*! call-bind */ 60001); +var callBound = __webpack_require__(/*! call-bound */ 6046); +var gOPD = __webpack_require__(/*! gopd */ 67768); +var getProto = __webpack_require__(/*! get-proto */ 28495); + +var $toString = callBound('Object.prototype.toString'); +var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ 81070)(); + +var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis; +var typedArrays = availableTypedArrays(); + +var $slice = callBound('String.prototype.slice'); + +/** @import { BoundSet, BoundSlice, Cache, Getter } from './types' */ +/** @import { TypedArrayName } from '.' */ + +/** @type {(array: readonly T[], value: unknown) => number} */ +var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) { + for (var i = 0; i < array.length; i += 1) { + if (array[i] === value) { + return i; + } + } + return -1; +}; + +/** @type {Cache} */ +var cache = { __proto__: null }; +if (hasToStringTag && gOPD && getProto) { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + if (Symbol.toStringTag in arr && getProto) { + var proto = getProto(arr); + // @ts-expect-error TS won't narrow inside a closure + var descriptor = gOPD(proto, Symbol.toStringTag); + if (!descriptor && proto) { + var superProto = getProto(proto); + // @ts-expect-error TS won't narrow inside a closure + descriptor = gOPD(superProto, Symbol.toStringTag); + } + if (descriptor && descriptor.get) { + var bound = callBind(descriptor.get); + cache[ + /** @type {`$${TypedArrayName}`} */ + ('$' + typedArray) + ] = bound; + } + } + }); +} else { + forEach(typedArrays, function (typedArray) { + var arr = new g[typedArray](); + var fn = arr.slice || arr.set; + if (fn) { + var bound = /** @type {BoundSlice | BoundSet} */ ( + // @ts-expect-error TODO FIXME + callBind(fn) + ); + cache[ + /** @type {`$${TypedArrayName}`} */ + ('$' + typedArray) + ] = bound; + } + }); +} + +/** @type {(value: object) => false | TypedArrayName} */ +function tryTypedArrays(value) { + /** @type {ReturnType} */ var found = false; + forEach( + /** @type {Record<`$${TypedArrayName}`, Getter>} */ (cache), + /** @param {Getter} getter @param {`$${TypedArrayName}`} typedArray */ + function (getter, typedArray) { + if (!found) { + try { + // @ts-expect-error a throw is fine here + if ('$' + getter(value) === typedArray) { + found = /** @type {TypedArrayName} */ ($slice(typedArray, 1)); + } + } catch (e) { /**/ } + } + } + ); + return found; +} + +/** @type {(value: object) => false | TypedArrayName} */ +function trySlices(value) { + /** @type {ReturnType} */ var found = false; + forEach( + /** @type {Record<`$${TypedArrayName}`, Getter>} */(cache), + /** @param {Getter} getter @param {`$${TypedArrayName}`} name */ function (getter, name) { + if (!found) { + try { + // @ts-expect-error a throw is fine here + getter(value); + found = /** @type {TypedArrayName} */ ($slice(name, 1)); + } catch (e) { /**/ } + } + } + ); + return found; +} + +/** @type {(tag: unknown) => tag is typeof typedArrays[number]} */ +function isTATag(tag) { + return $indexOf(typedArrays, tag) > -1; +} + +/** + * @type {import('.')} + * @param {unknown} value + */ +module.exports = function whichTypedArray(value) { + if (!value || typeof value !== 'object') { + return false; + } + if (!hasToStringTag) { + var tag = $slice($toString(value), 8, -1); + if (isTATag(tag)) { + return tag; + } + if (tag !== 'Object') { + return false; + } + // node < 0.6 hits here on real Typed Arrays + return trySlices(value); + } + if (!gOPD) { return null; } // unknown engine + return tryTypedArrays(value); +}; + + +/***/ }), + +/***/ 42839: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/diffie-hellman@5.0.3/node_modules/diffie-hellman/lib/dh.js ***! + \****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var BN = __webpack_require__(/*! bn.js */ 27019); +var MillerRabin = __webpack_require__(/*! miller-rabin */ 32275); +var millerRabin = new MillerRabin(); +var TWENTYFOUR = new BN(24); +var ELEVEN = new BN(11); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var primes = __webpack_require__(/*! ./generatePrime */ 48201); +var randomBytes = __webpack_require__(/*! randombytes */ 8546); +module.exports = DH; + +function setPublicKey(pub, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(pub)) { + pub = new Buffer(pub, enc); + } + this._pub = new BN(pub); + return this; +} + +function setPrivateKey(priv, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(priv)) { + priv = new Buffer(priv, enc); + } + this._priv = new BN(priv); + return this; +} + +var primeCache = {}; +function checkPrime(prime, generator) { + var gen = generator.toString('hex'); + var hex = [gen, prime.toString(16)].join('_'); + if (hex in primeCache) { + return primeCache[hex]; + } + var error = 0; + + if (prime.isEven() || + !primes.simpleSieve || + !primes.fermatTest(prime) || + !millerRabin.test(prime)) { + //not a prime so +1 + error += 1; + + if (gen === '02' || gen === '05') { + // we'd be able to check the generator + // it would fail so +8 + error += 8; + } else { + //we wouldn't be able to test the generator + // so +4 + error += 4; + } + primeCache[hex] = error; + return error; + } + if (!millerRabin.test(prime.shrn(1))) { + //not a safe prime + error += 2; + } + var rem; + switch (gen) { + case '02': + if (prime.mod(TWENTYFOUR).cmp(ELEVEN)) { + // unsuidable generator + error += 8; + } + break; + case '05': + rem = prime.mod(TEN); + if (rem.cmp(THREE) && rem.cmp(SEVEN)) { + // prime mod 10 needs to equal 3 or 7 + error += 8; + } + break; + default: + error += 4; + } + primeCache[hex] = error; + return error; +} + +function DH(prime, generator, malleable) { + this.setGenerator(generator); + this.__prime = new BN(prime); + this._prime = BN.mont(this.__prime); + this._primeLen = prime.length; + this._pub = undefined; + this._priv = undefined; + this._primeCode = undefined; + if (malleable) { + this.setPublicKey = setPublicKey; + this.setPrivateKey = setPrivateKey; + } else { + this._primeCode = 8; + } +} +Object.defineProperty(DH.prototype, 'verifyError', { + enumerable: true, + get: function () { + if (typeof this._primeCode !== 'number') { + this._primeCode = checkPrime(this.__prime, this.__gen); + } + return this._primeCode; + } +}); +DH.prototype.generateKeys = function () { + if (!this._priv) { + this._priv = new BN(randomBytes(this._primeLen)); + } + this._pub = this._gen.toRed(this._prime).redPow(this._priv).fromRed(); + return this.getPublicKey(); +}; + +DH.prototype.computeSecret = function (other) { + other = new BN(other); + other = other.toRed(this._prime); + var secret = other.redPow(this._priv).fromRed(); + var out = new Buffer(secret.toArray()); + var prime = this.getPrime(); + if (out.length < prime.length) { + var front = new Buffer(prime.length - out.length); + front.fill(0); + out = Buffer.concat([front, out]); + } + return out; +}; + +DH.prototype.getPublicKey = function getPublicKey(enc) { + return formatReturnValue(this._pub, enc); +}; + +DH.prototype.getPrivateKey = function getPrivateKey(enc) { + return formatReturnValue(this._priv, enc); +}; + +DH.prototype.getPrime = function (enc) { + return formatReturnValue(this.__prime, enc); +}; + +DH.prototype.getGenerator = function (enc) { + return formatReturnValue(this._gen, enc); +}; + +DH.prototype.setGenerator = function (gen, enc) { + enc = enc || 'utf8'; + if (!Buffer.isBuffer(gen)) { + gen = new Buffer(gen, enc); + } + this.__gen = gen; + this._gen = new BN(gen); + return this; +}; + +function formatReturnValue(bn, enc) { + var buf = new Buffer(bn.toArray()); + if (!enc) { + return buf; + } else { + return buf.toString(enc); + } +} + + +/***/ }), + +/***/ 43201: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/blob.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BlobSizeTooLargeError: () => (/* binding */ BlobSizeTooLargeError), +/* harmony export */ EmptyBlobError: () => (/* binding */ EmptyBlobError), +/* harmony export */ InvalidVersionedHashSizeError: () => (/* binding */ InvalidVersionedHashSizeError), +/* harmony export */ InvalidVersionedHashVersionError: () => (/* binding */ InvalidVersionedHashVersionError) +/* harmony export */ }); +/* harmony import */ var _constants_kzg_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../constants/kzg.js */ 63926); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ 87035); + + +class BlobSizeTooLargeError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ maxSize, size }) { + super('Blob size is too large.', { + metaMessages: [`Max: ${maxSize} bytes`, `Given: ${size} bytes`], + name: 'BlobSizeTooLargeError', + }); + } +} +class EmptyBlobError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor() { + super('Blob data must not be empty.', { name: 'EmptyBlobError' }); + } +} +class InvalidVersionedHashSizeError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ hash, size, }) { + super(`Versioned hash "${hash}" size is invalid.`, { + metaMessages: ['Expected: 32', `Received: ${size}`], + name: 'InvalidVersionedHashSizeError', + }); + } +} +class InvalidVersionedHashVersionError extends _base_js__WEBPACK_IMPORTED_MODULE_1__.BaseError { + constructor({ hash, version, }) { + super(`Versioned hash "${hash}" version is invalid.`, { + metaMessages: [ + `Expected: ${_constants_kzg_js__WEBPACK_IMPORTED_MODULE_0__.versionedHashVersionKzg}`, + `Received: ${version}`, + ], + name: 'InvalidVersionedHashVersionError', + }); + } +} +//# sourceMappingURL=blob.js.map + +/***/ }), + +/***/ 43236: +/*!************************************************************************!*\ + !*** ../node_modules/.pnpm/events@3.3.0/node_modules/events/events.js ***! + \************************************************************************/ +/***/ ((module) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +var R = typeof Reflect === 'object' ? Reflect : null +var ReflectApply = R && typeof R.apply === 'function' + ? R.apply + : function ReflectApply(target, receiver, args) { + return Function.prototype.apply.call(target, receiver, args); + } + +var ReflectOwnKeys +if (R && typeof R.ownKeys === 'function') { + ReflectOwnKeys = R.ownKeys +} else if (Object.getOwnPropertySymbols) { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target) + .concat(Object.getOwnPropertySymbols(target)); + }; +} else { + ReflectOwnKeys = function ReflectOwnKeys(target) { + return Object.getOwnPropertyNames(target); + }; +} + +function ProcessEmitWarning(warning) { + if (console && console.warn) console.warn(warning); +} + +var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) { + return value !== value; +} + +function EventEmitter() { + EventEmitter.init.call(this); +} +module.exports = EventEmitter; +module.exports.once = once; + +// Backwards-compat with node 0.10.x +EventEmitter.EventEmitter = EventEmitter; + +EventEmitter.prototype._events = undefined; +EventEmitter.prototype._eventsCount = 0; +EventEmitter.prototype._maxListeners = undefined; + +// By default EventEmitters will print a warning if more than 10 listeners are +// added to it. This is a useful default which helps finding memory leaks. +var defaultMaxListeners = 10; + +function checkListener(listener) { + if (typeof listener !== 'function') { + throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener); + } +} + +Object.defineProperty(EventEmitter, 'defaultMaxListeners', { + enumerable: true, + get: function() { + return defaultMaxListeners; + }, + set: function(arg) { + if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) { + throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.'); + } + defaultMaxListeners = arg; + } +}); + +EventEmitter.init = function() { + + if (this._events === undefined || + this._events === Object.getPrototypeOf(this)._events) { + this._events = Object.create(null); + this._eventsCount = 0; + } + + this._maxListeners = this._maxListeners || undefined; +}; + +// Obviously not all Emitters should be limited to 10. This function allows +// that to be increased. Set to zero for unlimited. +EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) { + if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) { + throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.'); + } + this._maxListeners = n; + return this; +}; + +function _getMaxListeners(that) { + if (that._maxListeners === undefined) + return EventEmitter.defaultMaxListeners; + return that._maxListeners; +} + +EventEmitter.prototype.getMaxListeners = function getMaxListeners() { + return _getMaxListeners(this); +}; + +EventEmitter.prototype.emit = function emit(type) { + var args = []; + for (var i = 1; i < arguments.length; i++) args.push(arguments[i]); + var doError = (type === 'error'); + + var events = this._events; + if (events !== undefined) + doError = (doError && events.error === undefined); + else if (!doError) + return false; + + // If there is no 'error' event listener then throw. + if (doError) { + var er; + if (args.length > 0) + er = args[0]; + if (er instanceof Error) { + // Note: The comments on the `throw` lines are intentional, they show + // up in Node's output if this results in an unhandled exception. + throw er; // Unhandled 'error' event + } + // At least give some kind of context to the user + var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : '')); + err.context = er; + throw err; // Unhandled 'error' event + } + + var handler = events[type]; + + if (handler === undefined) + return false; + + if (typeof handler === 'function') { + ReflectApply(handler, this, args); + } else { + var len = handler.length; + var listeners = arrayClone(handler, len); + for (var i = 0; i < len; ++i) + ReflectApply(listeners[i], this, args); + } + + return true; +}; + +function _addListener(target, type, listener, prepend) { + var m; + var events; + var existing; + + checkListener(listener); + + events = target._events; + if (events === undefined) { + events = target._events = Object.create(null); + target._eventsCount = 0; + } else { + // To avoid recursion in the case that type === "newListener"! Before + // adding it to the listeners, first emit "newListener". + if (events.newListener !== undefined) { + target.emit('newListener', type, + listener.listener ? listener.listener : listener); + + // Re-assign `events` because a newListener handler could have caused the + // this._events to be assigned to a new object + events = target._events; + } + existing = events[type]; + } + + if (existing === undefined) { + // Optimize the case of one listener. Don't need the extra array object. + existing = events[type] = listener; + ++target._eventsCount; + } else { + if (typeof existing === 'function') { + // Adding the second element, need to change to array. + existing = events[type] = + prepend ? [listener, existing] : [existing, listener]; + // If we've already got an array, just append. + } else if (prepend) { + existing.unshift(listener); + } else { + existing.push(listener); + } + + // Check for listener leak + m = _getMaxListeners(target); + if (m > 0 && existing.length > m && !existing.warned) { + existing.warned = true; + // No error code for this since it is a Warning + // eslint-disable-next-line no-restricted-syntax + var w = new Error('Possible EventEmitter memory leak detected. ' + + existing.length + ' ' + String(type) + ' listeners ' + + 'added. Use emitter.setMaxListeners() to ' + + 'increase limit'); + w.name = 'MaxListenersExceededWarning'; + w.emitter = target; + w.type = type; + w.count = existing.length; + ProcessEmitWarning(w); + } + } + + return target; +} + +EventEmitter.prototype.addListener = function addListener(type, listener) { + return _addListener(this, type, listener, false); +}; + +EventEmitter.prototype.on = EventEmitter.prototype.addListener; + +EventEmitter.prototype.prependListener = + function prependListener(type, listener) { + return _addListener(this, type, listener, true); + }; + +function onceWrapper() { + if (!this.fired) { + this.target.removeListener(this.type, this.wrapFn); + this.fired = true; + if (arguments.length === 0) + return this.listener.call(this.target); + return this.listener.apply(this.target, arguments); + } +} + +function _onceWrap(target, type, listener) { + var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener }; + var wrapped = onceWrapper.bind(state); + wrapped.listener = listener; + state.wrapFn = wrapped; + return wrapped; +} + +EventEmitter.prototype.once = function once(type, listener) { + checkListener(listener); + this.on(type, _onceWrap(this, type, listener)); + return this; +}; + +EventEmitter.prototype.prependOnceListener = + function prependOnceListener(type, listener) { + checkListener(listener); + this.prependListener(type, _onceWrap(this, type, listener)); + return this; + }; + +// Emits a 'removeListener' event if and only if the listener was removed. +EventEmitter.prototype.removeListener = + function removeListener(type, listener) { + var list, events, position, i, originalListener; + + checkListener(listener); + + events = this._events; + if (events === undefined) + return this; + + list = events[type]; + if (list === undefined) + return this; + + if (list === listener || list.listener === listener) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else { + delete events[type]; + if (events.removeListener) + this.emit('removeListener', type, list.listener || listener); + } + } else if (typeof list !== 'function') { + position = -1; + + for (i = list.length - 1; i >= 0; i--) { + if (list[i] === listener || list[i].listener === listener) { + originalListener = list[i].listener; + position = i; + break; + } + } + + if (position < 0) + return this; + + if (position === 0) + list.shift(); + else { + spliceOne(list, position); + } + + if (list.length === 1) + events[type] = list[0]; + + if (events.removeListener !== undefined) + this.emit('removeListener', type, originalListener || listener); + } + + return this; + }; + +EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + +EventEmitter.prototype.removeAllListeners = + function removeAllListeners(type) { + var listeners, events, i; + + events = this._events; + if (events === undefined) + return this; + + // not listening for removeListener, no need to emit + if (events.removeListener === undefined) { + if (arguments.length === 0) { + this._events = Object.create(null); + this._eventsCount = 0; + } else if (events[type] !== undefined) { + if (--this._eventsCount === 0) + this._events = Object.create(null); + else + delete events[type]; + } + return this; + } + + // emit removeListener for all listeners on all events + if (arguments.length === 0) { + var keys = Object.keys(events); + var key; + for (i = 0; i < keys.length; ++i) { + key = keys[i]; + if (key === 'removeListener') continue; + this.removeAllListeners(key); + } + this.removeAllListeners('removeListener'); + this._events = Object.create(null); + this._eventsCount = 0; + return this; + } + + listeners = events[type]; + + if (typeof listeners === 'function') { + this.removeListener(type, listeners); + } else if (listeners !== undefined) { + // LIFO order + for (i = listeners.length - 1; i >= 0; i--) { + this.removeListener(type, listeners[i]); + } + } + + return this; + }; + +function _listeners(target, type, unwrap) { + var events = target._events; + + if (events === undefined) + return []; + + var evlistener = events[type]; + if (evlistener === undefined) + return []; + + if (typeof evlistener === 'function') + return unwrap ? [evlistener.listener || evlistener] : [evlistener]; + + return unwrap ? + unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length); +} + +EventEmitter.prototype.listeners = function listeners(type) { + return _listeners(this, type, true); +}; + +EventEmitter.prototype.rawListeners = function rawListeners(type) { + return _listeners(this, type, false); +}; + +EventEmitter.listenerCount = function(emitter, type) { + if (typeof emitter.listenerCount === 'function') { + return emitter.listenerCount(type); + } else { + return listenerCount.call(emitter, type); + } +}; + +EventEmitter.prototype.listenerCount = listenerCount; +function listenerCount(type) { + var events = this._events; + + if (events !== undefined) { + var evlistener = events[type]; + + if (typeof evlistener === 'function') { + return 1; + } else if (evlistener !== undefined) { + return evlistener.length; + } + } + + return 0; +} + +EventEmitter.prototype.eventNames = function eventNames() { + return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : []; +}; + +function arrayClone(arr, n) { + var copy = new Array(n); + for (var i = 0; i < n; ++i) + copy[i] = arr[i]; + return copy; +} + +function spliceOne(list, index) { + for (; index + 1 < list.length; index++) + list[index] = list[index + 1]; + list.pop(); +} + +function unwrapListeners(arr) { + var ret = new Array(arr.length); + for (var i = 0; i < ret.length; ++i) { + ret[i] = arr[i].listener || arr[i]; + } + return ret; +} + +function once(emitter, name) { + return new Promise(function (resolve, reject) { + function errorListener(err) { + emitter.removeListener(name, resolver); + reject(err); + } + + function resolver() { + if (typeof emitter.removeListener === 'function') { + emitter.removeListener('error', errorListener); + } + resolve([].slice.call(arguments)); + }; + + eventTargetAgnosticAddListener(emitter, name, resolver, { once: true }); + if (name !== 'error') { + addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true }); + } + }); +} + +function addErrorHandlerIfEventEmitter(emitter, handler, flags) { + if (typeof emitter.on === 'function') { + eventTargetAgnosticAddListener(emitter, 'error', handler, flags); + } +} + +function eventTargetAgnosticAddListener(emitter, name, listener, flags) { + if (typeof emitter.on === 'function') { + if (flags.once) { + emitter.once(name, listener); + } else { + emitter.on(name, listener); + } + } else if (typeof emitter.addEventListener === 'function') { + // EventTarget does not have `error` event semantics like Node + // EventEmitters, we do not listen for `error` events here. + emitter.addEventListener(name, function wrapListener(arg) { + // IE does not have builtin `{ once: true }` support so we + // have to do it manually. + if (flags.once) { + emitter.removeEventListener(name, wrapListener); + } + listener(arg); + }); + } else { + throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter); + } +} + + +/***/ }), + +/***/ 43368: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/ctr.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var xor = __webpack_require__(/*! buffer-xor */ 67023) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var incr32 = __webpack_require__(/*! ../incr32 */ 7093) + +function getBlock (self) { + var out = self._cipher.encryptBlockRaw(self._prev) + incr32(self._prev) + return out +} + +var blockSize = 16 +exports.encrypt = function (self, chunk) { + var chunkNum = Math.ceil(chunk.length / blockSize) + var start = self._cache.length + self._cache = Buffer.concat([ + self._cache, + Buffer.allocUnsafe(chunkNum * blockSize) + ]) + for (var i = 0; i < chunkNum; i++) { + var out = getBlock(self) + var offset = start + i * blockSize + self._cache.writeUInt32BE(out[0], offset + 0) + self._cache.writeUInt32BE(out[1], offset + 4) + self._cache.writeUInt32BE(out[2], offset + 8) + self._cache.writeUInt32BE(out[3], offset + 12) + } + var pad = self._cache.slice(0, chunk.length) + self._cache = self._cache.slice(chunk.length) + return xor(chunk, pad) +} + + +/***/ }), + +/***/ 43555: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/v3.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _v35_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./v35.js */ 80208); +/* harmony import */ var _md5_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./md5.js */ 77054); + + +var v3 = (0,_v35_js__WEBPACK_IMPORTED_MODULE_0__["default"])('v3', 0x30, _md5_js__WEBPACK_IMPORTED_MODULE_1__["default"]); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v3); + +/***/ }), + +/***/ 43561: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/package.json ***! + \*******************************************************************************/ +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"name":"elliptic","version":"6.6.1","description":"EC cryptography","main":"lib/elliptic.js","files":["lib"],"scripts":{"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/"},"repository":{"type":"git","url":"git@github.com:indutny/elliptic"},"keywords":["EC","Elliptic","curve","Cryptography"],"author":"Fedor Indutny ","license":"MIT","bugs":{"url":"https://github.com/indutny/elliptic/issues"},"homepage":"https://github.com/indutny/elliptic","devDependencies":{"brfs":"^2.0.2","coveralls":"^3.1.0","eslint":"^7.6.0","grunt":"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1","istanbul":"^0.4.5","mocha":"^8.0.1"},"dependencies":{"bn.js":"^4.11.9","brorand":"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1","inherits":"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"}}'); + +/***/ }), + +/***/ 43663: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/index.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AccessDescription: () => (/* reexport safe */ _authority_information_access_js__WEBPACK_IMPORTED_MODULE_0__.AccessDescription), +/* harmony export */ AuthorityInfoAccessSyntax: () => (/* reexport safe */ _authority_information_access_js__WEBPACK_IMPORTED_MODULE_0__.AuthorityInfoAccessSyntax), +/* harmony export */ AuthorityKeyIdentifier: () => (/* reexport safe */ _authority_key_identifier_js__WEBPACK_IMPORTED_MODULE_1__.AuthorityKeyIdentifier), +/* harmony export */ BaseCRLNumber: () => (/* reexport safe */ _crl_delta_indicator_js__WEBPACK_IMPORTED_MODULE_5__.BaseCRLNumber), +/* harmony export */ BasicConstraints: () => (/* reexport safe */ _basic_constraints_js__WEBPACK_IMPORTED_MODULE_2__.BasicConstraints), +/* harmony export */ CRLDistributionPoints: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.CRLDistributionPoints), +/* harmony export */ CRLNumber: () => (/* reexport safe */ _crl_number_js__WEBPACK_IMPORTED_MODULE_9__.CRLNumber), +/* harmony export */ CRLReason: () => (/* reexport safe */ _crl_reason_js__WEBPACK_IMPORTED_MODULE_10__.CRLReason), +/* harmony export */ CRLReasons: () => (/* reexport safe */ _crl_reason_js__WEBPACK_IMPORTED_MODULE_10__.CRLReasons), +/* harmony export */ CertificateIssuer: () => (/* reexport safe */ _certificate_issuer_js__WEBPACK_IMPORTED_MODULE_3__.CertificateIssuer), +/* harmony export */ CertificatePolicies: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.CertificatePolicies), +/* harmony export */ DisplayText: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.DisplayText), +/* harmony export */ DistributionPoint: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.DistributionPoint), +/* harmony export */ DistributionPointName: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.DistributionPointName), +/* harmony export */ EntrustInfo: () => (/* reexport safe */ _entrust_version_info_js__WEBPACK_IMPORTED_MODULE_23__.EntrustInfo), +/* harmony export */ EntrustInfoFlags: () => (/* reexport safe */ _entrust_version_info_js__WEBPACK_IMPORTED_MODULE_23__.EntrustInfoFlags), +/* harmony export */ EntrustVersionInfo: () => (/* reexport safe */ _entrust_version_info_js__WEBPACK_IMPORTED_MODULE_23__.EntrustVersionInfo), +/* harmony export */ ExtendedKeyUsage: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.ExtendedKeyUsage), +/* harmony export */ FreshestCRL: () => (/* reexport safe */ _crl_freshest_js__WEBPACK_IMPORTED_MODULE_7__.FreshestCRL), +/* harmony export */ GeneralSubtree: () => (/* reexport safe */ _name_constraints_js__WEBPACK_IMPORTED_MODULE_16__.GeneralSubtree), +/* harmony export */ GeneralSubtrees: () => (/* reexport safe */ _name_constraints_js__WEBPACK_IMPORTED_MODULE_16__.GeneralSubtrees), +/* harmony export */ InhibitAnyPolicy: () => (/* reexport safe */ _inhibit_any_policy_js__WEBPACK_IMPORTED_MODULE_12__.InhibitAnyPolicy), +/* harmony export */ InvalidityDate: () => (/* reexport safe */ _invalidity_date_js__WEBPACK_IMPORTED_MODULE_13__.InvalidityDate), +/* harmony export */ IssueAlternativeName: () => (/* reexport safe */ _issuer_alternative_name_js__WEBPACK_IMPORTED_MODULE_14__.IssueAlternativeName), +/* harmony export */ IssuingDistributionPoint: () => (/* reexport safe */ _crl_issuing_distribution_point_js__WEBPACK_IMPORTED_MODULE_8__.IssuingDistributionPoint), +/* harmony export */ KeyIdentifier: () => (/* reexport safe */ _authority_key_identifier_js__WEBPACK_IMPORTED_MODULE_1__.KeyIdentifier), +/* harmony export */ KeyUsage: () => (/* reexport safe */ _key_usage_js__WEBPACK_IMPORTED_MODULE_15__.KeyUsage), +/* harmony export */ KeyUsageFlags: () => (/* reexport safe */ _key_usage_js__WEBPACK_IMPORTED_MODULE_15__.KeyUsageFlags), +/* harmony export */ NameConstraints: () => (/* reexport safe */ _name_constraints_js__WEBPACK_IMPORTED_MODULE_16__.NameConstraints), +/* harmony export */ NoticeReference: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.NoticeReference), +/* harmony export */ PolicyConstraints: () => (/* reexport safe */ _policy_constraints_js__WEBPACK_IMPORTED_MODULE_17__.PolicyConstraints), +/* harmony export */ PolicyInformation: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.PolicyInformation), +/* harmony export */ PolicyMapping: () => (/* reexport safe */ _policy_mappings_js__WEBPACK_IMPORTED_MODULE_18__.PolicyMapping), +/* harmony export */ PolicyMappings: () => (/* reexport safe */ _policy_mappings_js__WEBPACK_IMPORTED_MODULE_18__.PolicyMappings), +/* harmony export */ PolicyQualifierInfo: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.PolicyQualifierInfo), +/* harmony export */ PrivateKeyUsagePeriod: () => (/* reexport safe */ _private_key_usage_period_js__WEBPACK_IMPORTED_MODULE_22__.PrivateKeyUsagePeriod), +/* harmony export */ Qualifier: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.Qualifier), +/* harmony export */ Reason: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.Reason), +/* harmony export */ ReasonFlags: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.ReasonFlags), +/* harmony export */ SubjectAlternativeName: () => (/* reexport safe */ _subject_alternative_name_js__WEBPACK_IMPORTED_MODULE_19__.SubjectAlternativeName), +/* harmony export */ SubjectDirectoryAttributes: () => (/* reexport safe */ _subject_directory_attributes_js__WEBPACK_IMPORTED_MODULE_20__.SubjectDirectoryAttributes), +/* harmony export */ SubjectInfoAccessSyntax: () => (/* reexport safe */ _subject_info_access_js__WEBPACK_IMPORTED_MODULE_24__.SubjectInfoAccessSyntax), +/* harmony export */ SubjectKeyIdentifier: () => (/* reexport safe */ _subject_key_identifier_js__WEBPACK_IMPORTED_MODULE_21__.SubjectKeyIdentifier), +/* harmony export */ UserNotice: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.UserNotice), +/* harmony export */ anyExtendedKeyUsage: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.anyExtendedKeyUsage), +/* harmony export */ id_ce_authorityKeyIdentifier: () => (/* reexport safe */ _authority_key_identifier_js__WEBPACK_IMPORTED_MODULE_1__.id_ce_authorityKeyIdentifier), +/* harmony export */ id_ce_basicConstraints: () => (/* reexport safe */ _basic_constraints_js__WEBPACK_IMPORTED_MODULE_2__.id_ce_basicConstraints), +/* harmony export */ id_ce_cRLDistributionPoints: () => (/* reexport safe */ _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__.id_ce_cRLDistributionPoints), +/* harmony export */ id_ce_cRLNumber: () => (/* reexport safe */ _crl_number_js__WEBPACK_IMPORTED_MODULE_9__.id_ce_cRLNumber), +/* harmony export */ id_ce_cRLReasons: () => (/* reexport safe */ _crl_reason_js__WEBPACK_IMPORTED_MODULE_10__.id_ce_cRLReasons), +/* harmony export */ id_ce_certificateIssuer: () => (/* reexport safe */ _certificate_issuer_js__WEBPACK_IMPORTED_MODULE_3__.id_ce_certificateIssuer), +/* harmony export */ id_ce_certificatePolicies: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.id_ce_certificatePolicies), +/* harmony export */ id_ce_certificatePolicies_anyPolicy: () => (/* reexport safe */ _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__.id_ce_certificatePolicies_anyPolicy), +/* harmony export */ id_ce_deltaCRLIndicator: () => (/* reexport safe */ _crl_delta_indicator_js__WEBPACK_IMPORTED_MODULE_5__.id_ce_deltaCRLIndicator), +/* harmony export */ id_ce_extKeyUsage: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_ce_extKeyUsage), +/* harmony export */ id_ce_freshestCRL: () => (/* reexport safe */ _crl_freshest_js__WEBPACK_IMPORTED_MODULE_7__.id_ce_freshestCRL), +/* harmony export */ id_ce_inhibitAnyPolicy: () => (/* reexport safe */ _inhibit_any_policy_js__WEBPACK_IMPORTED_MODULE_12__.id_ce_inhibitAnyPolicy), +/* harmony export */ id_ce_invalidityDate: () => (/* reexport safe */ _invalidity_date_js__WEBPACK_IMPORTED_MODULE_13__.id_ce_invalidityDate), +/* harmony export */ id_ce_issuerAltName: () => (/* reexport safe */ _issuer_alternative_name_js__WEBPACK_IMPORTED_MODULE_14__.id_ce_issuerAltName), +/* harmony export */ id_ce_issuingDistributionPoint: () => (/* reexport safe */ _crl_issuing_distribution_point_js__WEBPACK_IMPORTED_MODULE_8__.id_ce_issuingDistributionPoint), +/* harmony export */ id_ce_keyUsage: () => (/* reexport safe */ _key_usage_js__WEBPACK_IMPORTED_MODULE_15__.id_ce_keyUsage), +/* harmony export */ id_ce_nameConstraints: () => (/* reexport safe */ _name_constraints_js__WEBPACK_IMPORTED_MODULE_16__.id_ce_nameConstraints), +/* harmony export */ id_ce_policyConstraints: () => (/* reexport safe */ _policy_constraints_js__WEBPACK_IMPORTED_MODULE_17__.id_ce_policyConstraints), +/* harmony export */ id_ce_policyMappings: () => (/* reexport safe */ _policy_mappings_js__WEBPACK_IMPORTED_MODULE_18__.id_ce_policyMappings), +/* harmony export */ id_ce_privateKeyUsagePeriod: () => (/* reexport safe */ _private_key_usage_period_js__WEBPACK_IMPORTED_MODULE_22__.id_ce_privateKeyUsagePeriod), +/* harmony export */ id_ce_subjectAltName: () => (/* reexport safe */ _subject_alternative_name_js__WEBPACK_IMPORTED_MODULE_19__.id_ce_subjectAltName), +/* harmony export */ id_ce_subjectDirectoryAttributes: () => (/* reexport safe */ _subject_directory_attributes_js__WEBPACK_IMPORTED_MODULE_20__.id_ce_subjectDirectoryAttributes), +/* harmony export */ id_ce_subjectKeyIdentifier: () => (/* reexport safe */ _subject_key_identifier_js__WEBPACK_IMPORTED_MODULE_21__.id_ce_subjectKeyIdentifier), +/* harmony export */ id_entrust_entrustVersInfo: () => (/* reexport safe */ _entrust_version_info_js__WEBPACK_IMPORTED_MODULE_23__.id_entrust_entrustVersInfo), +/* harmony export */ id_kp_OCSPSigning: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_OCSPSigning), +/* harmony export */ id_kp_clientAuth: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_clientAuth), +/* harmony export */ id_kp_codeSigning: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_codeSigning), +/* harmony export */ id_kp_emailProtection: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_emailProtection), +/* harmony export */ id_kp_serverAuth: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_serverAuth), +/* harmony export */ id_kp_timeStamping: () => (/* reexport safe */ _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__.id_kp_timeStamping), +/* harmony export */ id_pe_authorityInfoAccess: () => (/* reexport safe */ _authority_information_access_js__WEBPACK_IMPORTED_MODULE_0__.id_pe_authorityInfoAccess), +/* harmony export */ id_pe_subjectInfoAccess: () => (/* reexport safe */ _subject_info_access_js__WEBPACK_IMPORTED_MODULE_24__.id_pe_subjectInfoAccess) +/* harmony export */ }); +/* harmony import */ var _authority_information_access_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./authority_information_access.js */ 8756); +/* harmony import */ var _authority_key_identifier_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./authority_key_identifier.js */ 14858); +/* harmony import */ var _basic_constraints_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./basic_constraints.js */ 20710); +/* harmony import */ var _certificate_issuer_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./certificate_issuer.js */ 32788); +/* harmony import */ var _certificate_policies_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./certificate_policies.js */ 1985); +/* harmony import */ var _crl_delta_indicator_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./crl_delta_indicator.js */ 83059); +/* harmony import */ var _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./crl_distribution_points.js */ 68671); +/* harmony import */ var _crl_freshest_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./crl_freshest.js */ 64519); +/* harmony import */ var _crl_issuing_distribution_point_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./crl_issuing_distribution_point.js */ 99717); +/* harmony import */ var _crl_number_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./crl_number.js */ 414); +/* harmony import */ var _crl_reason_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./crl_reason.js */ 88791); +/* harmony import */ var _extended_key_usage_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./extended_key_usage.js */ 4754); +/* harmony import */ var _inhibit_any_policy_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./inhibit_any_policy.js */ 57430); +/* harmony import */ var _invalidity_date_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./invalidity_date.js */ 67265); +/* harmony import */ var _issuer_alternative_name_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./issuer_alternative_name.js */ 30964); +/* harmony import */ var _key_usage_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./key_usage.js */ 33936); +/* harmony import */ var _name_constraints_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./name_constraints.js */ 81083); +/* harmony import */ var _policy_constraints_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./policy_constraints.js */ 95746); +/* harmony import */ var _policy_mappings_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./policy_mappings.js */ 31643); +/* harmony import */ var _subject_alternative_name_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./subject_alternative_name.js */ 15837); +/* harmony import */ var _subject_directory_attributes_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./subject_directory_attributes.js */ 12647); +/* harmony import */ var _subject_key_identifier_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./subject_key_identifier.js */ 86321); +/* harmony import */ var _private_key_usage_period_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./private_key_usage_period.js */ 5930); +/* harmony import */ var _entrust_version_info_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./entrust_version_info.js */ 6238); +/* harmony import */ var _subject_info_access_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./subject_info_access.js */ 71059); + + + + + + + + + + + + + + + + + + + + + + + + + + + +/***/ }), + +/***/ 43723: +/*!*************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/errors/schema_validation.js ***! + \*************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnSchemaValidationError: () => (/* binding */ AsnSchemaValidationError) +/* harmony export */ }); +class AsnSchemaValidationError extends Error { + schemas = []; +} + + +/***/ }), + +/***/ 43735: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/originator_info.js ***! + \**********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ OriginatorInfo: () => (/* binding */ OriginatorInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _certificate_choices_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./certificate_choices.js */ 73968); +/* harmony import */ var _revocation_info_choice_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./revocation_info_choice.js */ 61695); + + + + +class OriginatorInfo { + certs; + crls; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _certificate_choices_js__WEBPACK_IMPORTED_MODULE_2__.CertificateSet, context: 0, implicit: true, optional: true, + }) +], OriginatorInfo.prototype, "certs", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _revocation_info_choice_js__WEBPACK_IMPORTED_MODULE_3__.RevocationInfoChoices, context: 1, implicit: true, optional: true, + }) +], OriginatorInfo.prototype, "crls", void 0); + + +/***/ }), + +/***/ 43750: +/*!*************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/abi.js ***! + \*************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AbiConstructorNotFoundError: () => (/* binding */ AbiConstructorNotFoundError), +/* harmony export */ AbiConstructorParamsNotFoundError: () => (/* binding */ AbiConstructorParamsNotFoundError), +/* harmony export */ AbiDecodingDataSizeInvalidError: () => (/* binding */ AbiDecodingDataSizeInvalidError), +/* harmony export */ AbiDecodingDataSizeTooSmallError: () => (/* binding */ AbiDecodingDataSizeTooSmallError), +/* harmony export */ AbiDecodingZeroDataError: () => (/* binding */ AbiDecodingZeroDataError), +/* harmony export */ AbiEncodingArrayLengthMismatchError: () => (/* binding */ AbiEncodingArrayLengthMismatchError), +/* harmony export */ AbiEncodingBytesSizeMismatchError: () => (/* binding */ AbiEncodingBytesSizeMismatchError), +/* harmony export */ AbiEncodingLengthMismatchError: () => (/* binding */ AbiEncodingLengthMismatchError), +/* harmony export */ AbiErrorInputsNotFoundError: () => (/* binding */ AbiErrorInputsNotFoundError), +/* harmony export */ AbiErrorNotFoundError: () => (/* binding */ AbiErrorNotFoundError), +/* harmony export */ AbiErrorSignatureNotFoundError: () => (/* binding */ AbiErrorSignatureNotFoundError), +/* harmony export */ AbiEventNotFoundError: () => (/* binding */ AbiEventNotFoundError), +/* harmony export */ AbiEventSignatureEmptyTopicsError: () => (/* binding */ AbiEventSignatureEmptyTopicsError), +/* harmony export */ AbiEventSignatureNotFoundError: () => (/* binding */ AbiEventSignatureNotFoundError), +/* harmony export */ AbiFunctionNotFoundError: () => (/* binding */ AbiFunctionNotFoundError), +/* harmony export */ AbiFunctionOutputsNotFoundError: () => (/* binding */ AbiFunctionOutputsNotFoundError), +/* harmony export */ AbiFunctionSignatureNotFoundError: () => (/* binding */ AbiFunctionSignatureNotFoundError), +/* harmony export */ AbiItemAmbiguityError: () => (/* binding */ AbiItemAmbiguityError), +/* harmony export */ BytesSizeMismatchError: () => (/* binding */ BytesSizeMismatchError), +/* harmony export */ DecodeLogDataMismatch: () => (/* binding */ DecodeLogDataMismatch), +/* harmony export */ DecodeLogTopicsMismatch: () => (/* binding */ DecodeLogTopicsMismatch), +/* harmony export */ InvalidAbiDecodingTypeError: () => (/* binding */ InvalidAbiDecodingTypeError), +/* harmony export */ InvalidAbiEncodingTypeError: () => (/* binding */ InvalidAbiEncodingTypeError), +/* harmony export */ InvalidArrayError: () => (/* binding */ InvalidArrayError), +/* harmony export */ InvalidDefinitionTypeError: () => (/* binding */ InvalidDefinitionTypeError), +/* harmony export */ UnsupportedPackedAbiType: () => (/* binding */ UnsupportedPackedAbiType) +/* harmony export */ }); +/* harmony import */ var _utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/abi/formatAbiItem.js */ 77265); +/* harmony import */ var _utils_data_size_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/data/size.js */ 58036); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base.js */ 87035); + + + +class AbiConstructorNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ docsPath }) { + super([ + 'A constructor was not found on the ABI.', + 'Make sure you are using the correct ABI and that the constructor exists on it.', + ].join('\n'), { + docsPath, + name: 'AbiConstructorNotFoundError', + }); + } +} +class AbiConstructorParamsNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ docsPath }) { + super([ + 'Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.', + 'Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists.', + ].join('\n'), { + docsPath, + name: 'AbiConstructorParamsNotFoundError', + }); + } +} +class AbiDecodingDataSizeInvalidError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ data, size }) { + super([ + `Data size of ${size} bytes is invalid.`, + 'Size must be in increments of 32 bytes (size % 32 === 0).', + ].join('\n'), { + metaMessages: [`Data: ${data} (${size} bytes)`], + name: 'AbiDecodingDataSizeInvalidError', + }); + } +} +class AbiDecodingDataSizeTooSmallError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ data, params, size, }) { + super([`Data size of ${size} bytes is too small for given parameters.`].join('\n'), { + metaMessages: [ + `Params: (${(0,_utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__.formatAbiParams)(params, { includeName: true })})`, + `Data: ${data} (${size} bytes)`, + ], + name: 'AbiDecodingDataSizeTooSmallError', + }); + Object.defineProperty(this, "data", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "params", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "size", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.data = data; + this.params = params; + this.size = size; + } +} +class AbiDecodingZeroDataError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor() { + super('Cannot decode zero data ("0x") with ABI parameters.', { + name: 'AbiDecodingZeroDataError', + }); + } +} +class AbiEncodingArrayLengthMismatchError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ expectedLength, givenLength, type, }) { + super([ + `ABI encoding array length mismatch for type ${type}.`, + `Expected length: ${expectedLength}`, + `Given length: ${givenLength}`, + ].join('\n'), { name: 'AbiEncodingArrayLengthMismatchError' }); + } +} +class AbiEncodingBytesSizeMismatchError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ expectedSize, value }) { + super(`Size of bytes "${value}" (bytes${(0,_utils_data_size_js__WEBPACK_IMPORTED_MODULE_1__.size)(value)}) does not match expected size (bytes${expectedSize}).`, { name: 'AbiEncodingBytesSizeMismatchError' }); + } +} +class AbiEncodingLengthMismatchError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ expectedLength, givenLength, }) { + super([ + 'ABI encoding params/values length mismatch.', + `Expected length (params): ${expectedLength}`, + `Given length (values): ${givenLength}`, + ].join('\n'), { name: 'AbiEncodingLengthMismatchError' }); + } +} +class AbiErrorInputsNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(errorName, { docsPath }) { + super([ + `Arguments (\`args\`) were provided to "${errorName}", but "${errorName}" on the ABI does not contain any parameters (\`inputs\`).`, + 'Cannot encode error result without knowing what the parameter types are.', + 'Make sure you are using the correct ABI and that the inputs exist on it.', + ].join('\n'), { + docsPath, + name: 'AbiErrorInputsNotFoundError', + }); + } +} +class AbiErrorNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(errorName, { docsPath } = {}) { + super([ + `Error ${errorName ? `"${errorName}" ` : ''}not found on ABI.`, + 'Make sure you are using the correct ABI and that the error exists on it.', + ].join('\n'), { + docsPath, + name: 'AbiErrorNotFoundError', + }); + } +} +class AbiErrorSignatureNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(signature, { docsPath }) { + super([ + `Encoded error signature "${signature}" not found on ABI.`, + 'Make sure you are using the correct ABI and that the error exists on it.', + `You can look up the decoded signature here: https://openchain.xyz/signatures?query=${signature}.`, + ].join('\n'), { + docsPath, + name: 'AbiErrorSignatureNotFoundError', + }); + Object.defineProperty(this, "signature", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.signature = signature; + } +} +class AbiEventSignatureEmptyTopicsError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ docsPath }) { + super('Cannot extract event signature from empty topics.', { + docsPath, + name: 'AbiEventSignatureEmptyTopicsError', + }); + } +} +class AbiEventSignatureNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(signature, { docsPath }) { + super([ + `Encoded event signature "${signature}" not found on ABI.`, + 'Make sure you are using the correct ABI and that the event exists on it.', + `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`, + ].join('\n'), { + docsPath, + name: 'AbiEventSignatureNotFoundError', + }); + } +} +class AbiEventNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(eventName, { docsPath } = {}) { + super([ + `Event ${eventName ? `"${eventName}" ` : ''}not found on ABI.`, + 'Make sure you are using the correct ABI and that the event exists on it.', + ].join('\n'), { + docsPath, + name: 'AbiEventNotFoundError', + }); + } +} +class AbiFunctionNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(functionName, { docsPath } = {}) { + super([ + `Function ${functionName ? `"${functionName}" ` : ''}not found on ABI.`, + 'Make sure you are using the correct ABI and that the function exists on it.', + ].join('\n'), { + docsPath, + name: 'AbiFunctionNotFoundError', + }); + } +} +class AbiFunctionOutputsNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(functionName, { docsPath }) { + super([ + `Function "${functionName}" does not contain any \`outputs\` on ABI.`, + 'Cannot decode function result without knowing what the parameter types are.', + 'Make sure you are using the correct ABI and that the function exists on it.', + ].join('\n'), { + docsPath, + name: 'AbiFunctionOutputsNotFoundError', + }); + } +} +class AbiFunctionSignatureNotFoundError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(signature, { docsPath }) { + super([ + `Encoded function signature "${signature}" not found on ABI.`, + 'Make sure you are using the correct ABI and that the function exists on it.', + `You can look up the signature here: https://openchain.xyz/signatures?query=${signature}.`, + ].join('\n'), { + docsPath, + name: 'AbiFunctionSignatureNotFoundError', + }); + } +} +class AbiItemAmbiguityError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(x, y) { + super('Found ambiguous types in overloaded ABI items.', { + metaMessages: [ + `\`${x.type}\` in \`${(0,_utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__.formatAbiItem)(x.abiItem)}\`, and`, + `\`${y.type}\` in \`${(0,_utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__.formatAbiItem)(y.abiItem)}\``, + '', + 'These types encode differently and cannot be distinguished at runtime.', + 'Remove one of the ambiguous items in the ABI.', + ], + name: 'AbiItemAmbiguityError', + }); + } +} +class BytesSizeMismatchError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ expectedSize, givenSize, }) { + super(`Expected bytes${expectedSize}, got bytes${givenSize}.`, { + name: 'BytesSizeMismatchError', + }); + } +} +class DecodeLogDataMismatch extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ abiItem, data, params, size, }) { + super([ + `Data size of ${size} bytes is too small for non-indexed event parameters.`, + ].join('\n'), { + metaMessages: [ + `Params: (${(0,_utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__.formatAbiParams)(params, { includeName: true })})`, + `Data: ${data} (${size} bytes)`, + ], + name: 'DecodeLogDataMismatch', + }); + Object.defineProperty(this, "abiItem", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "data", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "params", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "size", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.abiItem = abiItem; + this.data = data; + this.params = params; + this.size = size; + } +} +class DecodeLogTopicsMismatch extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor({ abiItem, param, }) { + super([ + `Expected a topic for indexed event parameter${param.name ? ` "${param.name}"` : ''} on event "${(0,_utils_abi_formatAbiItem_js__WEBPACK_IMPORTED_MODULE_0__.formatAbiItem)(abiItem, { includeName: true })}".`, + ].join('\n'), { name: 'DecodeLogTopicsMismatch' }); + Object.defineProperty(this, "abiItem", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.abiItem = abiItem; + } +} +class InvalidAbiEncodingTypeError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(type, { docsPath }) { + super([ + `Type "${type}" is not a valid encoding type.`, + 'Please provide a valid ABI type.', + ].join('\n'), { docsPath, name: 'InvalidAbiEncodingType' }); + } +} +class InvalidAbiDecodingTypeError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(type, { docsPath }) { + super([ + `Type "${type}" is not a valid decoding type.`, + 'Please provide a valid ABI type.', + ].join('\n'), { docsPath, name: 'InvalidAbiDecodingType' }); + } +} +class InvalidArrayError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(value) { + super([`Value "${value}" is not a valid array.`].join('\n'), { + name: 'InvalidArrayError', + }); + } +} +class InvalidDefinitionTypeError extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(type) { + super([ + `"${type}" is not a valid definition type.`, + 'Valid types: "function", "event", "error"', + ].join('\n'), { name: 'InvalidDefinitionTypeError' }); + } +} +class UnsupportedPackedAbiType extends _base_js__WEBPACK_IMPORTED_MODULE_2__.BaseError { + constructor(type) { + super(`Type "${type}" is not supported for packed encoding.`, { + name: 'UnsupportedPackedAbiType', + }); + } +} +//# sourceMappingURL=abi.js.map + +/***/ }), + +/***/ 43920: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionApply.js ***! + \*****************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./functionApply')} */ +module.exports = Function.prototype.apply; + + +/***/ }), + +/***/ 43991: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/pbkdf2@3.1.6/node_modules/pbkdf2/lib/sync-browser.js ***! + \**********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var md5 = __webpack_require__(/*! create-hash/md5 */ 83920); +var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 17600); +var sha = __webpack_require__(/*! sha.js */ 29784); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +var checkParameters = __webpack_require__(/*! ./precondition */ 7855); +var defaultEncoding = __webpack_require__(/*! ./default-encoding */ 77856); +var toBuffer = __webpack_require__(/*! ./to-buffer */ 65779); + +var ZEROS = Buffer.alloc(128); +var sizes = { + __proto__: null, + md5: 16, + sha1: 20, + sha224: 28, + sha256: 32, + sha384: 48, + sha512: 64, + 'sha512-256': 32, + ripemd160: 20, + rmd160: 20 +}; + +var mapping = { + __proto__: null, + 'sha-1': 'sha1', + 'sha-224': 'sha224', + 'sha-256': 'sha256', + 'sha-384': 'sha384', + 'sha-512': 'sha512', + 'ripemd-160': 'ripemd160' +}; + +function rmd160Func(data) { + return new RIPEMD160().update(data).digest(); +} + +function getDigest(alg) { + function shaFunc(data) { + return sha(alg).update(data).digest(); + } + + if (alg === 'rmd160' || alg === 'ripemd160') { + return rmd160Func; + } + if (alg === 'md5') { + return md5; + } + return shaFunc; +} + +function Hmac(alg, key, saltLen) { + var hash = getDigest(alg); + var blocksize = alg === 'sha512' || alg === 'sha384' ? 128 : 64; + + if (key.length > blocksize) { + key = hash(key); + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize); + } + + var ipad = Buffer.allocUnsafe(blocksize + sizes[alg]); + var opad = Buffer.allocUnsafe(blocksize + sizes[alg]); + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36; + opad[i] = key[i] ^ 0x5C; + } + + var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4); + ipad.copy(ipad1, 0, 0, blocksize); + this.ipad1 = ipad1; + this.ipad2 = ipad; + this.opad = opad; + this.alg = alg; + this.blocksize = blocksize; + this.hash = hash; + this.size = sizes[alg]; +} + +Hmac.prototype.run = function (data, ipad) { + data.copy(ipad, this.blocksize); + var h = this.hash(ipad); + h.copy(this.opad, this.blocksize); + return this.hash(this.opad); +}; + +function pbkdf2(password, salt, iterations, keylen, digest) { + keylen = checkParameters(iterations, keylen); + password = toBuffer(password, defaultEncoding, 'Password'); + salt = toBuffer(salt, defaultEncoding, 'Salt'); + + var lowerDigest = (digest || 'sha1').toLowerCase(); + var mappedDigest = mapping[lowerDigest] || lowerDigest; + var size = sizes[mappedDigest]; + if (typeof size !== 'number' || !size) { + throw new TypeError('Digest algorithm not supported: ' + digest); + } + + var hmac = new Hmac(mappedDigest, password, salt.length); + + var DK = Buffer.allocUnsafe(keylen); + var block1 = Buffer.allocUnsafe(salt.length + 4); + salt.copy(block1, 0, 0, salt.length); + + var destPos = 0; + var hLen = size; + var l = Math.ceil(keylen / hLen); + + for (var i = 1; i <= l; i++) { + block1.writeUInt32BE(i, salt.length); + + var T = hmac.run(block1, hmac.ipad1); + var U = T; + + for (var j = 1; j < iterations; j++) { + U = hmac.run(U, hmac.ipad2); + for (var k = 0; k < hLen; k++) { + T[k] ^= U[k]; + } + } + + T.copy(DK, destPos); + destPos += hLen; + } + + return DK; +} + +module.exports = pbkdf2; + + +/***/ }), + +/***/ 44226: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/create-hmac@1.1.7/node_modules/create-hmac/browser.js ***! + \***********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var inherits = __webpack_require__(/*! inherits */ 18628) +var Legacy = __webpack_require__(/*! ./legacy */ 74019) +var Base = __webpack_require__(/*! cipher-base */ 51141) +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var md5 = __webpack_require__(/*! create-hash/md5 */ 83920) +var RIPEMD160 = __webpack_require__(/*! ripemd160 */ 17600) + +var sha = __webpack_require__(/*! sha.js */ 29784) + +var ZEROS = Buffer.alloc(128) + +function Hmac (alg, key) { + Base.call(this, 'digest') + if (typeof key === 'string') { + key = Buffer.from(key) + } + + var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64 + + this._alg = alg + this._key = key + if (key.length > blocksize) { + var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + key = hash.update(key).digest() + } else if (key.length < blocksize) { + key = Buffer.concat([key, ZEROS], blocksize) + } + + var ipad = this._ipad = Buffer.allocUnsafe(blocksize) + var opad = this._opad = Buffer.allocUnsafe(blocksize) + + for (var i = 0; i < blocksize; i++) { + ipad[i] = key[i] ^ 0x36 + opad[i] = key[i] ^ 0x5C + } + this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg) + this._hash.update(ipad) +} + +inherits(Hmac, Base) + +Hmac.prototype._update = function (data) { + this._hash.update(data) +} + +Hmac.prototype._final = function () { + var h = this._hash.digest() + var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg) + return hash.update(this._opad).update(h).digest() +} + +module.exports = function createHmac (alg, key) { + alg = alg.toLowerCase() + if (alg === 'rmd160' || alg === 'ripemd160') { + return new Hmac('rmd160', key) + } + if (alg === 'md5') { + return new Legacy(md5, key) + } + return new Hmac(alg, key) +} + + +/***/ }), + +/***/ 44431: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/mod.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AeadId: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.AeadId), +/* harmony export */ Aes128Gcm: () => (/* reexport safe */ _src_aeads_aesGcm_js__WEBPACK_IMPORTED_MODULE_1__.Aes128Gcm), +/* harmony export */ Aes256Gcm: () => (/* reexport safe */ _src_aeads_aesGcm_js__WEBPACK_IMPORTED_MODULE_1__.Aes256Gcm), +/* harmony export */ CipherSuite: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.CipherSuite), +/* harmony export */ DecapError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DecapError), +/* harmony export */ DeriveKeyPairError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeriveKeyPairError), +/* harmony export */ DeserializeError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError), +/* harmony export */ DhkemP256HkdfSha256: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.DhkemP256HkdfSha256), +/* harmony export */ DhkemP384HkdfSha384: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.DhkemP384HkdfSha384), +/* harmony export */ DhkemP521HkdfSha512: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.DhkemP521HkdfSha512), +/* harmony export */ DhkemX25519HkdfSha256: () => (/* reexport safe */ _src_kems_dhkemX25519_js__WEBPACK_IMPORTED_MODULE_4__.DhkemX25519HkdfSha256), +/* harmony export */ DhkemX448HkdfSha512: () => (/* reexport safe */ _src_kems_dhkemX448_js__WEBPACK_IMPORTED_MODULE_5__.DhkemX448HkdfSha512), +/* harmony export */ EncapError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EncapError), +/* harmony export */ ExportError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.ExportError), +/* harmony export */ ExportOnly: () => (/* reexport safe */ _src_aeads_exportOnly_js__WEBPACK_IMPORTED_MODULE_2__.ExportOnly), +/* harmony export */ HkdfSha256: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.HkdfSha256), +/* harmony export */ HkdfSha384: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.HkdfSha384), +/* harmony export */ HkdfSha512: () => (/* reexport safe */ _src_native_js__WEBPACK_IMPORTED_MODULE_3__.HkdfSha512), +/* harmony export */ HpkeError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HpkeError), +/* harmony export */ InvalidParamError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError), +/* harmony export */ KdfId: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KdfId), +/* harmony export */ KemId: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId), +/* harmony export */ MessageLimitReachedError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.MessageLimitReachedError), +/* harmony export */ NotSupportedError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError), +/* harmony export */ OpenError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.OpenError), +/* harmony export */ SealError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SealError), +/* harmony export */ SerializeError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError), +/* harmony export */ ValidationError: () => (/* reexport safe */ _hpke_common__WEBPACK_IMPORTED_MODULE_0__.ValidationError) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _src_aeads_aesGcm_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./src/aeads/aesGcm.js */ 85017); +/* harmony import */ var _src_aeads_exportOnly_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./src/aeads/exportOnly.js */ 2629); +/* harmony import */ var _src_native_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./src/native.js */ 20475); +/* harmony import */ var _src_kems_dhkemX25519_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./src/kems/dhkemX25519.js */ 70206); +/* harmony import */ var _src_kems_dhkemX448_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./src/kems/dhkemX448.js */ 86464); + + + + + + + + +/***/ }), + +/***/ 44568: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/util-deprecate@1.0.2/node_modules/util-deprecate/browser.js ***! + \*****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +/** + * Module exports. + */ + +module.exports = deprecate; + +/** + * Mark that a method should not be used. + * Returns a modified function which warns once by default. + * + * If `localStorage.noDeprecation = true` is set, then it is a no-op. + * + * If `localStorage.throwDeprecation = true` is set, then deprecated functions + * will throw an Error when invoked. + * + * If `localStorage.traceDeprecation = true` is set, then deprecated functions + * will invoke `console.trace()` instead of `console.error()`. + * + * @param {Function} fn - the function to deprecate + * @param {String} msg - the string to print to the console when `fn` is invoked + * @returns {Function} a new "deprecated" version of `fn` + * @api public + */ + +function deprecate (fn, msg) { + if (config('noDeprecation')) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (config('throwDeprecation')) { + throw new Error(msg); + } else if (config('traceDeprecation')) { + console.trace(msg); + } else { + console.warn(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +} + +/** + * Checks `localStorage` for boolean values for the given `name`. + * + * @param {String} name + * @returns {Boolean} + * @api private + */ + +function config (name) { + // accessing global.localStorage can trigger a DOMException in sandboxed iframes + try { + if (!__webpack_require__.g.localStorage) return false; + } catch (_) { + return false; + } + var val = __webpack_require__.g.localStorage[name]; + if (null == val) return false; + return String(val).toLowerCase() === 'true'; +} + + +/***/ }), + +/***/ 44711: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/providers/class-provider.js ***! + \*********************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isClassProvider: () => (/* binding */ isClassProvider) +/* harmony export */ }); +function isClassProvider(provider) { + return !!provider.useClass; +} + + +/***/ }), + +/***/ 44856: +/*!***********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+crypto@2.8.6/node_modules/@turnkey/crypto/dist/proof.mjs ***! + \***********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getCryptoInstance: () => (/* binding */ getCryptoInstance), +/* harmony export */ verify: () => (/* binding */ verify), +/* harmony export */ verifyAppProofSignature: () => (/* binding */ verifyAppProofSignature), +/* harmony export */ verifyCertificateChain: () => (/* binding */ verifyCertificateChain), +/* harmony export */ verifyCoseSign1Sig: () => (/* binding */ verifyCoseSign1Sig) +/* harmony export */ }); +/* harmony import */ var _turnkey_encoding__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @turnkey/encoding */ 72812); +/* harmony import */ var _noble_curves_p256__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @noble/curves/p256 */ 56915); +/* harmony import */ var _noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @noble/hashes/sha2 */ 19745); +/* harmony import */ var cbor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! cbor-js */ 60426); +/* harmony import */ var _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @peculiar/x509 */ 89125); +/* harmony import */ var _constants_mjs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./constants.mjs */ 23781); + + + + + + + +const getCryptoInstance = async () => { + let cryptoInstance; + // Use globalThis.crypto.subtle if available + if (typeof globalThis !== "undefined" && globalThis.crypto?.subtle) { + cryptoInstance = globalThis.crypto; + _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.cryptoProvider.set(cryptoInstance); + return cryptoInstance; + } + else { + throw new Error("Web Crypto API is not available in this environment. You may need to polyfill it."); + } +}; +/** + * Utility: SHA-256 digest → hex (uppercase) + */ +async function sha256Hex(data) { + const cryptoInstance = await getCryptoInstance(); + const digest = await cryptoInstance.subtle.digest("SHA-256", data); + return (0,_turnkey_encoding__WEBPACK_IMPORTED_MODULE_0__.uint8ArrayToHexString)(new Uint8Array(digest)).toUpperCase(); +} +/** + * Utility: Import SPKI public key for ECDSA verify + */ +async function importEcdsaPublicKey(spki) { + const cryptoInstance = await getCryptoInstance(); + return cryptoInstance.subtle.importKey("spki", spki, { name: "ECDSA", namedCurve: "P-384" }, // AWS Nitro uses ES384 + false, ["verify"]); +} +/** + * verify goes through the following verification steps for an app proof & boot proof pair: + * - Verify app proof signature + * - Verify the boot proof + * - Attestation doc was signed by AWS + * - Attestation doc's `user_data` is the hash of the qos manifest + * - Verify the connection between the app proof & boot proof i.e. that the ephemeral keys match + * + * For more information, check out https://whitepaper.turnkey.com/foundations + */ +async function verify(appProof, bootProof) { + // 1. Verify App Proof + verifyAppProofSignature(appProof); + // 2. Verify Boot Proof + // Parse attestation + const coseSign1Der = Uint8Array.from(atob(bootProof.awsAttestationDocB64) + .split("") + .map((c) => c.charCodeAt(0))); + const coseSign1 = cbor_js__WEBPACK_IMPORTED_MODULE_3__.decode(coseSign1Der.buffer); + const [, , payload] = coseSign1; + const attestationDoc = cbor_js__WEBPACK_IMPORTED_MODULE_3__.decode(new Uint8Array(payload).buffer); + // Verify cose sign1 signature + await verifyCoseSign1Sig(coseSign1, attestationDoc.certificate); + // Verify certificate chain + const appProofTimestampMs = parseInt(JSON.parse(appProof.proofPayload).timestampMs); + await verifyCertificateChain(attestationDoc.cabundle, _constants_mjs__WEBPACK_IMPORTED_MODULE_5__.AWS_ROOT_CERT_PEM, attestationDoc.certificate, appProofTimestampMs); + // Verify manifest digest + const decodedBootProofManifest = Uint8Array.from(atob(bootProof.qosManifestB64) + .split("") + .map((c) => c.charCodeAt(0))); + const manifestDigest = (0,_noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256)(decodedBootProofManifest); + if (!bytesEq(manifestDigest, attestationDoc.user_data)) { + throw new Error(`attestationDoc's user_data doesn't match the hash of the manifest. attestationDoc.user_data: ${attestationDoc.user_data} , manifest digest: ${manifestDigest}`); + } + // 3. Verify that all the ephemeral public keys match: app proof, boot proof structure, actual attestation doc + const publicKeyBytes = new Uint8Array(attestationDoc.public_key); + const attestationPubKey = (0,_turnkey_encoding__WEBPACK_IMPORTED_MODULE_0__.uint8ArrayToHexString)(publicKeyBytes); + if (appProof.publicKey !== attestationPubKey || + attestationPubKey !== bootProof.ephemeralPublicKeyHex) { + throw new Error(`Ephemeral pub keys from app proof: ${appProof.publicKey}, boot proof structure ${bootProof.ephemeralPublicKeyHex}, and attestation doc ${attestationPubKey} should all match`); + } +} +/** + * Verify app proof signature with @noble/curves + */ +function verifyAppProofSignature(appProof) { + if (appProof.scheme !== "SIGNATURE_SCHEME_EPHEMERAL_KEY_P256") { + throw new Error("Unsupported signature scheme"); + } + // Decode public key + let publicKeyBytes; + try { + publicKeyBytes = (0,_turnkey_encoding__WEBPACK_IMPORTED_MODULE_0__.uint8ArrayFromHexString)(appProof.publicKey); + } + catch { + throw new Error("Failed to decode public key"); + } + if (publicKeyBytes.length !== 130) { + throw new Error(`Expected 130 bytes (encryption + signing pub keys), got ${publicKeyBytes.length} bytes`); + } + // Extract signing key (last 65 bytes, uncompressed P-256 point) + const signingKeyBytes = publicKeyBytes.slice(65); + if (signingKeyBytes.length !== 65 || signingKeyBytes[0] !== 0x04) { + throw new Error("Invalid signing key format: expected 65-byte uncompressed P-256 point (0x04||X||Y)"); + } + // Validate it's a valid P-256 public key by attempting to create a point + try { + _noble_curves_p256__WEBPACK_IMPORTED_MODULE_1__.p256.ProjectivePoint.fromHex(signingKeyBytes); + } + catch (error) { + throw new Error(`Invalid P-256 public key: ${error}`); + } + // Decode signature (64 bytes = 32 bytes r + 32 bytes s) + let signatureBytes; + try { + signatureBytes = (0,_turnkey_encoding__WEBPACK_IMPORTED_MODULE_0__.uint8ArrayFromHexString)(appProof.signature); + } + catch { + throw new Error("Failed to decode signature"); + } + if (signatureBytes.length !== 64) { + throw new Error(`Expected 64 bytes signature (r||s), got ${signatureBytes.length} bytes`); + } + // Hash the proof payload + const payloadBytes = new TextEncoder().encode(appProof.proofPayload); + const payloadDigest = (0,_noble_hashes_sha2__WEBPACK_IMPORTED_MODULE_2__.sha256)(payloadBytes); + // Verify ECDSA signature + const isValid = _noble_curves_p256__WEBPACK_IMPORTED_MODULE_1__.p256.verify(signatureBytes, payloadDigest, signingKeyBytes); + if (!isValid) { + throw new Error("Signature verification failed"); + } +} +async function verifyCertificateChain(cabundle, rootCertPem, leafCert, timestampMs) { + try { + // Check root and assert fingerprint + const rootX509 = new _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.X509Certificate(rootCertPem); + const rootDer = new Uint8Array(rootX509.rawData); + const rootSha = await sha256Hex(rootDer); + if (rootSha !== _constants_mjs__WEBPACK_IMPORTED_MODULE_5__.AWS_ROOT_CERT_SHA256) { + throw new Error(`Pinned AWS root fingerprint mismatch: expected=${_constants_mjs__WEBPACK_IMPORTED_MODULE_5__.AWS_ROOT_CERT_SHA256} actual=${rootSha}`); + } + // Bundle starts with root certificate. We're replacing the root with our hardcoded known certificate, so remove first element + const bundleWithoutRoot = cabundle.slice(1); + const intermediatesX509 = bundleWithoutRoot.map((c) => { + if (!c) + throw new Error("Invalid certificate data in cabundle"); + return new _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.X509Certificate(c); + }); + const leaf = new _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.X509Certificate(leafCert); + // Build path leaf → intermediates → root, with our hardcoded known root certificate + const builder = new _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.X509ChainBuilder({ + certificates: [rootX509, ...intermediatesX509], + }); + const chain = await builder.build(leaf); + if (chain.length !== intermediatesX509.length + 2) { + throw new Error(`Incorrect number of certs in X509 Chain. Expected ${intermediatesX509.length + 2}, got ${chain.length}`); + } + const appProofDate = new Date(timestampMs); + for (let i = 0; i < chain.length; i++) { + const cert = chain[i]; + if (!cert) + throw new Error("Invalid certificate in chain"); + if (i === chain.length - 1) { + // is root + // Self-signature verification for root certificate + const ok = await cert.verify({ + publicKey: cert.publicKey, + date: appProofDate, + }); + if (!ok) + throw new Error("Pinned root failed self-signature verification"); + } + else { + // Verify signature against issuer + const issuer = chain[i + 1]; + if (!issuer) + throw new Error("Issuer can't be null"); + // Attestation docs technically expire after 3 hours, so an app proof generated 3+ hours after an enclave + // boots up will fail verification due to certificate expiration. This is okay because enclaves are immutable; + // even if the cert is technically invalid, the code contained within it cannot change. To prevent the cert + // expiration failure, we set `signatureOnly: true`. + const ok = await cert.verify({ + publicKey: issuer.publicKey, + signatureOnly: true, + date: appProofDate, + }); + if (!ok) { + throw new Error(`Signature check failed: ${cert.subject} not signed by ${issuer?.subject}`); + } + } + } + } + catch (error) { + throw new Error(`Certificate chain verification failed: ${error instanceof Error ? error.message : String(error)}`); + } +} +async function verifyCoseSign1Sig(coseSign1, leaf) { + const [protectedHeaders, , payload, signature] = coseSign1; + const tbs = new Uint8Array(cbor_js__WEBPACK_IMPORTED_MODULE_3__.encode([ + "Signature1", + new Uint8Array(protectedHeaders), + new Uint8Array(0), + new Uint8Array(payload), + ])); + const leafCert = new _peculiar_x509__WEBPACK_IMPORTED_MODULE_4__.X509Certificate(leaf); + const pubKey = await importEcdsaPublicKey(leafCert.publicKey.rawData); + const cryptoInstance = await getCryptoInstance(); + const ok = await cryptoInstance.subtle.verify({ name: "ECDSA", hash: { name: "SHA-384" } }, pubKey, new Uint8Array(signature), tbs); + if (!ok) + throw new Error("COSE_Sign1 ES384 verification failed"); +} +function bytesEq(a, b) { + const A = new Uint8Array(a), B = new Uint8Array(b); + if (A.length !== B.length) + return false; + for (let i = 0; i < A.length; i++) + if (A[i] !== B[i]) + return false; + return true; +} + + +//# sourceMappingURL=proof.mjs.map + + +/***/ }), + +/***/ 44876: +/*!*****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/address.js ***! + \*****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ InvalidAddressError: () => (/* binding */ InvalidAddressError) +/* harmony export */ }); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ 87035); + +class InvalidAddressError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ address }) { + super(`Address "${address}" is invalid.`, { + metaMessages: [ + '- Address must be a hex value of 20 bytes (40 hex characters).', + '- Address must match its checksum counterpart.', + ], + name: 'InvalidAddressError', + }); + } +} +//# sourceMappingURL=address.js.map + +/***/ }), + +/***/ 45000: +/*!*********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/providers/value-provider.js ***! + \*********************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isValueProvider: () => (/* binding */ isValueProvider) +/* harmony export */ }); +function isValueProvider(provider) { + return provider.useValue != undefined; +} + + +/***/ }), + +/***/ 45185: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/minimalistic-assert@1.0.1/node_modules/minimalistic-assert/index.js ***! + \*************************************************************************************************/ +/***/ ((module) => { + +module.exports = assert; + +function assert(val, msg) { + if (!val) + throw new Error(msg || 'Assertion failed'); +} + +assert.equal = function assertEqual(l, r, msg) { + if (l != r) + throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r)); +}; + + +/***/ }), + +/***/ 45232: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/hmac-drbg@1.0.1/node_modules/hmac-drbg/lib/hmac-drbg.js ***! + \*************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var hash = __webpack_require__(/*! hash.js */ 5222); +var utils = __webpack_require__(/*! minimalistic-crypto-utils */ 75814); +var assert = __webpack_require__(/*! minimalistic-assert */ 45185); + +function HmacDRBG(options) { + if (!(this instanceof HmacDRBG)) + return new HmacDRBG(options); + this.hash = options.hash; + this.predResist = !!options.predResist; + + this.outLen = this.hash.outSize; + this.minEntropy = options.minEntropy || this.hash.hmacStrength; + + this._reseed = null; + this.reseedInterval = null; + this.K = null; + this.V = null; + + var entropy = utils.toArray(options.entropy, options.entropyEnc || 'hex'); + var nonce = utils.toArray(options.nonce, options.nonceEnc || 'hex'); + var pers = utils.toArray(options.pers, options.persEnc || 'hex'); + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + this._init(entropy, nonce, pers); +} +module.exports = HmacDRBG; + +HmacDRBG.prototype._init = function init(entropy, nonce, pers) { + var seed = entropy.concat(nonce).concat(pers); + + this.K = new Array(this.outLen / 8); + this.V = new Array(this.outLen / 8); + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0x00; + this.V[i] = 0x01; + } + + this._update(seed); + this._reseed = 1; + this.reseedInterval = 0x1000000000000; // 2^48 +}; + +HmacDRBG.prototype._hmac = function hmac() { + return new hash.hmac(this.hash, this.K); +}; + +HmacDRBG.prototype._update = function update(seed) { + var kmac = this._hmac() + .update(this.V) + .update([ 0x00 ]); + if (seed) + kmac = kmac.update(seed); + this.K = kmac.digest(); + this.V = this._hmac().update(this.V).digest(); + if (!seed) + return; + + this.K = this._hmac() + .update(this.V) + .update([ 0x01 ]) + .update(seed) + .digest(); + this.V = this._hmac().update(this.V).digest(); +}; + +HmacDRBG.prototype.reseed = function reseed(entropy, entropyEnc, add, addEnc) { + // Optional entropy enc + if (typeof entropyEnc !== 'string') { + addEnc = add; + add = entropyEnc; + entropyEnc = null; + } + + entropy = utils.toArray(entropy, entropyEnc); + add = utils.toArray(add, addEnc); + + assert(entropy.length >= (this.minEntropy / 8), + 'Not enough entropy. Minimum is: ' + this.minEntropy + ' bits'); + + this._update(entropy.concat(add || [])); + this._reseed = 1; +}; + +HmacDRBG.prototype.generate = function generate(len, enc, add, addEnc) { + if (this._reseed > this.reseedInterval) + throw new Error('Reseed is required'); + + // Optional encoding + if (typeof enc !== 'string') { + addEnc = add; + add = enc; + enc = null; + } + + // Optional additional data + if (add) { + add = utils.toArray(add, addEnc || 'hex'); + this._update(add); + } + + var temp = []; + while (temp.length < len) { + this.V = this._hmac().update(this.V).digest(); + temp = temp.concat(this.V); + } + + var res = temp.slice(0, len); + this._update(add); + this._reseed++; + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ 45383: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/hash-base@3.0.5/node_modules/hash-base/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) +var Transform = (__webpack_require__(/*! stream */ 67060).Transform) +var inherits = __webpack_require__(/*! inherits */ 18628) + +function HashBase (blockSize) { + Transform.call(this) + + this._block = Buffer.allocUnsafe(blockSize) + this._blockSize = blockSize + this._blockOffset = 0 + this._length = [0, 0, 0, 0] + + this._finalized = false +} + +inherits(HashBase, Transform) + +HashBase.prototype._transform = function (chunk, encoding, callback) { + var error = null + try { + this.update(chunk, encoding) + } catch (err) { + error = err + } + + callback(error) +} + +HashBase.prototype._flush = function (callback) { + var error = null + try { + this.push(this.digest()) + } catch (err) { + error = err + } + + callback(error) +} + +var useUint8Array = typeof Uint8Array !== 'undefined' +var useArrayBuffer = typeof ArrayBuffer !== 'undefined' && + typeof Uint8Array !== 'undefined' && + ArrayBuffer.isView && + (Buffer.prototype instanceof Uint8Array || Buffer.TYPED_ARRAY_SUPPORT) + +function toBuffer (data, encoding) { + // No need to do anything for exact instance + // This is only valid when safe-buffer.Buffer === buffer.Buffer, i.e. when Buffer.from/Buffer.alloc existed + if (data instanceof Buffer) return data + + // Convert strings to Buffer + if (typeof data === 'string') return Buffer.from(data, encoding) + + /* + * Wrap any TypedArray instances and DataViews + * Makes sense only on engines with full TypedArray support -- let Buffer detect that + */ + if (useArrayBuffer && ArrayBuffer.isView(data)) { + if (data.byteLength === 0) return Buffer.alloc(0) // Bug in Node.js <6.3.1, which treats this as out-of-bounds + var res = Buffer.from(data.buffer, data.byteOffset, data.byteLength) + // Recheck result size, as offset/length doesn't work on Node.js <5.10 + // We just go to Uint8Array case if this fails + if (res.byteLength === data.byteLength) return res + } + + /* + * Uint8Array in engines where Buffer.from might not work with ArrayBuffer, just copy over + * Doesn't make sense with other TypedArray instances + */ + if (useUint8Array && data instanceof Uint8Array) return Buffer.from(data) + + /* + * Old Buffer polyfill on an engine that doesn't have TypedArray support + * Also, this is from a different Buffer polyfill implementation then we have, as instanceof check failed + * Convert to our current Buffer implementation + */ + if ( + Buffer.isBuffer(data) && + data.constructor && + typeof data.constructor.isBuffer === 'function' && + data.constructor.isBuffer(data) + ) { + return Buffer.from(data) + } + + throw new TypeError('The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView.') +} + +HashBase.prototype.update = function (data, encoding) { + if (this._finalized) throw new Error('Digest already called') + + data = toBuffer(data, encoding) // asserts correct input type + + // consume data + var block = this._block + var offset = 0 + while (this._blockOffset + data.length - offset >= this._blockSize) { + for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++] + this._update() + this._blockOffset = 0 + } + while (offset < data.length) block[this._blockOffset++] = data[offset++] + + // update length + for (var j = 0, carry = data.length * 8; carry > 0; ++j) { + this._length[j] += carry + carry = (this._length[j] / 0x0100000000) | 0 + if (carry > 0) this._length[j] -= 0x0100000000 * carry + } + + return this +} + +HashBase.prototype._update = function () { + throw new Error('_update is not implemented') +} + +HashBase.prototype.digest = function (encoding) { + if (this._finalized) throw new Error('Digest already called') + this._finalized = true + + var digest = this._digest() + if (encoding !== undefined) digest = digest.toString(encoding) + + // reset state + this._block.fill(0) + this._blockOffset = 0 + for (var i = 0; i < 4; ++i) this._length[i] = 0 + + return digest +} + +HashBase.prototype._digest = function () { + throw new Error('_digest is not implemented') +} + +module.exports = HashBase + + +/***/ }), + +/***/ 45405: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-rsa@4.1.1/node_modules/browserify-rsa/index.js ***! + \***************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ 40113); +var randomBytes = __webpack_require__(/*! randombytes */ 8546); +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); + +function getr(priv) { + var len = priv.modulus.byteLength(); + var r; + do { + r = new BN(randomBytes(len)); + } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2)); + return r; +} + +function blind(priv) { + var r = getr(priv); + var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed(); + return { blinder: blinder, unblinder: r.invm(priv.modulus) }; +} + +function crt(msg, priv) { + var blinds = blind(priv); + var len = priv.modulus.byteLength(); + var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus); + var c1 = blinded.toRed(BN.mont(priv.prime1)); + var c2 = blinded.toRed(BN.mont(priv.prime2)); + var qinv = priv.coefficient; + var p = priv.prime1; + var q = priv.prime2; + var m1 = c1.redPow(priv.exponent1).fromRed(); + var m2 = c2.redPow(priv.exponent2).fromRed(); + var h = m1.isub(m2).imul(qinv).umod(p).imul(q); + return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len); +} +crt.getr = getr; + +module.exports = crt; + + +/***/ }), + +/***/ 45906: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/index.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ base64: () => (/* reexport module object */ _base64_js__WEBPACK_IMPORTED_MODULE_4__), +/* harmony export */ base64url: () => (/* reexport module object */ _base64url_js__WEBPACK_IMPORTED_MODULE_5__), +/* harmony export */ binary: () => (/* reexport module object */ _binary_js__WEBPACK_IMPORTED_MODULE_0__), +/* harmony export */ hex: () => (/* reexport module object */ _hex_js__WEBPACK_IMPORTED_MODULE_1__), +/* harmony export */ utf16: () => (/* reexport module object */ _utf16_js__WEBPACK_IMPORTED_MODULE_3__), +/* harmony export */ utf8: () => (/* reexport module object */ _utf8_js__WEBPACK_IMPORTED_MODULE_2__) +/* harmony export */ }); +/* harmony import */ var _binary_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./binary.js */ 47521); +/* harmony import */ var _hex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hex.js */ 19603); +/* harmony import */ var _utf8_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utf8.js */ 54955); +/* harmony import */ var _utf16_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utf16.js */ 51936); +/* harmony import */ var _base64_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./base64.js */ 56051); +/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./base64url.js */ 22126); + + + + + + + + +/***/ }), + +/***/ 45910: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/edwards.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PrimeEdwardsPoint: () => (/* binding */ PrimeEdwardsPoint), +/* harmony export */ eddsa: () => (/* binding */ eddsa), +/* harmony export */ edwards: () => (/* binding */ edwards), +/* harmony export */ twistedEdwards: () => (/* binding */ twistedEdwards) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ 74430); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ 29964); +/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./curve.js */ 47149); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modular.js */ 35072); +/** + * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y². + * For design rationale of types / exports, see weierstrass module documentation. + * Untwisted Edwards curves exist, but they aren't used in real-world protocols. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + + +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); +function isEdValidXY(Fp, CURVE, x, y) { + const x2 = Fp.sqr(x); + const y2 = Fp.sqr(y); + const left = Fp.add(Fp.mul(CURVE.a, x2), y2); + const right = Fp.add(Fp.ONE, Fp.mul(CURVE.d, Fp.mul(x2, y2))); + return Fp.eql(left, right); +} +function edwards(params, extraOpts = {}) { + const validated = (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__._createCurveFields)('edwards', params, extraOpts, extraOpts.FpFnLE); + const { Fp, Fn } = validated; + let CURVE = validated.CURVE; + const { h: cofactor } = CURVE; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._validateObject)(extraOpts, {}, { uvRatio: 'function' }); + // Important: + // There are some places where Fp.BYTES is used instead of nByteLength. + // So far, everything has been tested with curves of Fp.BYTES == nByteLength. + // TODO: test and find curves which behave otherwise. + const MASK = _2n << (BigInt(Fn.BYTES * 8) - _1n); + const modP = (n) => Fp.create(n); // Function overrides + // sqrt(u/v) + const uvRatio = extraOpts.uvRatio || + ((u, v) => { + try { + return { isValid: true, value: Fp.sqrt(Fp.div(u, v)) }; + } + catch (e) { + return { isValid: false, value: _0n }; + } + }); + // Validate whether the passed curve params are valid. + // equation ax² + y² = 1 + dx²y² should work for generator point. + if (!isEdValidXY(Fp, CURVE, CURVE.Gx, CURVE.Gy)) + throw new Error('bad curve params: generator point'); + /** + * Asserts coordinate is valid: 0 <= n < MASK. + * Coordinates >= Fp.ORDER are allowed for zip215. + */ + function acoord(title, n, banZero = false) { + const min = banZero ? _1n : _0n; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aInRange)('coordinate ' + title, n, min, MASK); + return n; + } + function aextpoint(other) { + if (!(other instanceof Point)) + throw new Error('ExtendedPoint expected'); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + const toAffineMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.memoized)((p, iz) => { + const { X, Y, Z } = p; + const is0 = p.is0(); + if (iz == null) + iz = is0 ? _8n : Fp.inv(Z); // 8 was chosen arbitrarily + const x = modP(X * iz); + const y = modP(Y * iz); + const zz = Fp.mul(Z, iz); + if (is0) + return { x: _0n, y: _1n }; + if (zz !== _1n) + throw new Error('invZ was invalid'); + return { x, y }; + }); + const assertValidMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.memoized)((p) => { + const { a, d } = CURVE; + if (p.is0()) + throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? + // Equation in affine coordinates: ax² + y² = 1 + dx²y² + // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² + const { X, Y, Z, T } = p; + const X2 = modP(X * X); // X² + const Y2 = modP(Y * Y); // Y² + const Z2 = modP(Z * Z); // Z² + const Z4 = modP(Z2 * Z2); // Z⁴ + const aX2 = modP(X2 * a); // aX² + const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² + const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² + if (left !== right) + throw new Error('bad point: equation left != right (1)'); + // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T + const XY = modP(X * Y); + const ZT = modP(Z * T); + if (XY !== ZT) + throw new Error('bad point: equation left != right (2)'); + return true; + }); + // Extended Point works in extended coordinates: (X, Y, Z, T) ∋ (x=X/Z, y=Y/Z, T=xy). + // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates + class Point { + constructor(X, Y, Z, T) { + this.X = acoord('x', X); + this.Y = acoord('y', Y); + this.Z = acoord('z', Z, true); + this.T = acoord('t', T); + Object.freeze(this); + } + static CURVE() { + return CURVE; + } + static fromAffine(p) { + if (p instanceof Point) + throw new Error('extended point not allowed'); + const { x, y } = p || {}; + acoord('x', x); + acoord('y', y); + return new Point(x, y, _1n, modP(x * y)); + } + // Uses algo from RFC8032 5.1.3. + static fromBytes(bytes, zip215 = false) { + const len = Fp.BYTES; + const { a, d } = CURVE; + bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.copyBytes)((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abytes2)(bytes, len, 'point')); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abool2)(zip215, 'zip215'); + const normed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.copyBytes)(bytes); // copy again, we'll manipulate it + const lastByte = bytes[len - 1]; // select last byte + normed[len - 1] = lastByte & ~0x80; // clear last bit + const y = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(normed); + // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. + // RFC8032 prohibits >= p, but ZIP215 doesn't + // zip215=true: 0 <= y < MASK (2^256 for ed25519) + // zip215=false: 0 <= y < P (2^255-19 for ed25519) + const max = zip215 ? MASK : Fp.ORDER; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aInRange)('point.y', y, _0n, max); + // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: + // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) + const y2 = modP(y * y); // denominator is always non-0 mod p. + const u = modP(y2 - _1n); // u = y² - 1 + const v = modP(d * y2 - a); // v = d y² + 1. + let { isValid, value: x } = uvRatio(u, v); // √(u/v) + if (!isValid) + throw new Error('bad point: invalid y coordinate'); + const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper + const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit + if (!zip215 && x === _0n && isLastByteOdd) + // if x=0 and x_0 = 1, fail + throw new Error('bad point: x=0 and x_0=1'); + if (isLastByteOdd !== isXOdd) + x = modP(-x); // if x_0 != x mod 2, set x = p-x + return Point.fromAffine({ x, y }); + } + static fromHex(bytes, zip215 = false) { + return Point.fromBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('point', bytes), zip215); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + precompute(windowSize = 8, isLazy = true) { + wnaf.createCache(this, windowSize); + if (!isLazy) + this.multiply(_2n); // random number + return this; + } + // Useful in fromAffine() - not for fromBytes(), which always created valid points. + assertValidity() { + assertValidMemo(this); + } + // Compare one point to another. + equals(other) { + aextpoint(other); + const { X: X1, Y: Y1, Z: Z1 } = this; + const { X: X2, Y: Y2, Z: Z2 } = other; + const X1Z2 = modP(X1 * Z2); + const X2Z1 = modP(X2 * Z1); + const Y1Z2 = modP(Y1 * Z2); + const Y2Z1 = modP(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + is0() { + return this.equals(Point.ZERO); + } + negate() { + // Flips point sign to a negative one (-x, y in affine coords) + return new Point(modP(-this.X), this.Y, this.Z, modP(-this.T)); + } + // Fast algo for doubling Extended Point. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + // Cost: 4M + 4S + 1*a + 6add + 1*2. + double() { + const { a } = CURVE; + const { X: X1, Y: Y1, Z: Z1 } = this; + const A = modP(X1 * X1); // A = X12 + const B = modP(Y1 * Y1); // B = Y12 + const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 + const D = modP(a * A); // D = a*A + const x1y1 = X1 + Y1; + const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B + const G = D + B; // G = D+B + const F = G - C; // F = G-C + const H = D - B; // H = D-B + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + // Fast algo for adding 2 Extended Points. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd + // Cost: 9M + 1*a + 1*d + 7add. + add(other) { + aextpoint(other); + const { a, d } = CURVE; + const { X: X1, Y: Y1, Z: Z1, T: T1 } = this; + const { X: X2, Y: Y2, Z: Z2, T: T2 } = other; + const A = modP(X1 * X2); // A = X1*X2 + const B = modP(Y1 * Y2); // B = Y1*Y2 + const C = modP(T1 * d * T2); // C = T1*d*T2 + const D = modP(Z1 * Z2); // D = Z1*Z2 + const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B + const F = D - C; // F = D-C + const G = D + C; // G = D+C + const H = modP(B - a * A); // H = B-a*A + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + subtract(other) { + return this.add(other.negate()); + } + // Constant-time multiplication. + multiply(scalar) { + // 1 <= scalar < L + if (!Fn.isValidNot0(scalar)) + throw new Error('invalid scalar: expected 1 <= sc < curve.n'); + const { p, f } = wnaf.cached(this, scalar, (p) => (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.normalizeZ)(Point, p)); + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.normalizeZ)(Point, [p, f])[0]; + } + // Non-constant-time multiplication. Uses double-and-add algorithm. + // It's faster, but should only be used when you don't care about + // an exposed private key e.g. sig verification. + // Does NOT allow scalars higher than CURVE.n. + // Accepts optional accumulator to merge with multiply (important for sparse scalars) + multiplyUnsafe(scalar, acc = Point.ZERO) { + // 0 <= scalar < L + if (!Fn.isValid(scalar)) + throw new Error('invalid scalar: expected 0 <= sc < curve.n'); + if (scalar === _0n) + return Point.ZERO; + if (this.is0() || scalar === _1n) + return this; + return wnaf.unsafe(this, scalar, (p) => (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.normalizeZ)(Point, p), acc); + } + // Checks if point is of small order. + // If you add something to small order point, you will have "dirty" + // point with torsion component. + // Multiplies point by cofactor and checks if the result is 0. + isSmallOrder() { + return this.multiplyUnsafe(cofactor).is0(); + } + // Multiplies point by curve order and checks if the result is 0. + // Returns `false` is the point is dirty. + isTorsionFree() { + return wnaf.unsafe(this, CURVE.n).is0(); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + toAffine(invertedZ) { + return toAffineMemo(this, invertedZ); + } + clearCofactor() { + if (cofactor === _1n) + return this; + return this.multiplyUnsafe(cofactor); + } + toBytes() { + const { x, y } = this.toAffine(); + // Fp.toBytes() allows non-canonical encoding of y (>= p). + const bytes = Fp.toBytes(y); + // Each y has 2 valid points: (x, y), (x,-y). + // When compressing, it's enough to store y and use the last byte to encode sign of x + bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; + return bytes; + } + toHex() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)(this.toBytes()); + } + toString() { + return ``; + } + // TODO: remove + get ex() { + return this.X; + } + get ey() { + return this.Y; + } + get ez() { + return this.Z; + } + get et() { + return this.T; + } + static normalizeZ(points) { + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.normalizeZ)(Point, points); + } + static msm(points, scalars) { + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_2__.pippenger)(Point, Fn, points, scalars); + } + _setWindowSize(windowSize) { + this.precompute(windowSize); + } + toRawBytes() { + return this.toBytes(); + } + } + // base / generator point + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); + // zero / infinity / identity point + Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 + // math field + Point.Fp = Fp; + // scalar field + Point.Fn = Fn; + const wnaf = new _curve_js__WEBPACK_IMPORTED_MODULE_2__.wNAF(Point, Fn.BITS); + Point.BASE.precompute(8); // Enable precomputes. Slows down first publicKey computation by 20ms. + return Point; +} +/** + * Base class for prime-order points like Ristretto255 and Decaf448. + * These points eliminate cofactor issues by representing equivalence classes + * of Edwards curve points. + */ +class PrimeEdwardsPoint { + constructor(ep) { + this.ep = ep; + } + // Static methods that must be implemented by subclasses + static fromBytes(_bytes) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.notImplemented)(); + } + static fromHex(_hex) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.notImplemented)(); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + // Common implementations + clearCofactor() { + // no-op for prime-order groups + return this; + } + assertValidity() { + this.ep.assertValidity(); + } + toAffine(invertedZ) { + return this.ep.toAffine(invertedZ); + } + toHex() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)(this.toBytes()); + } + toString() { + return this.toHex(); + } + isTorsionFree() { + return true; + } + isSmallOrder() { + return false; + } + add(other) { + this.assertSame(other); + return this.init(this.ep.add(other.ep)); + } + subtract(other) { + this.assertSame(other); + return this.init(this.ep.subtract(other.ep)); + } + multiply(scalar) { + return this.init(this.ep.multiply(scalar)); + } + multiplyUnsafe(scalar) { + return this.init(this.ep.multiplyUnsafe(scalar)); + } + double() { + return this.init(this.ep.double()); + } + negate() { + return this.init(this.ep.negate()); + } + precompute(windowSize, isLazy) { + return this.init(this.ep.precompute(windowSize, isLazy)); + } + /** @deprecated use `toBytes` */ + toRawBytes() { + return this.toBytes(); + } +} +/** + * Initializes EdDSA signatures over given Edwards curve. + */ +function eddsa(Point, cHash, eddsaOpts = {}) { + if (typeof cHash !== 'function') + throw new Error('"hash" function param is required'); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._validateObject)(eddsaOpts, {}, { + adjustScalarBytes: 'function', + randomBytes: 'function', + domain: 'function', + prehash: 'function', + mapToCurve: 'function', + }); + const { prehash } = eddsaOpts; + const { BASE, Fp, Fn } = Point; + const randomBytes = eddsaOpts.randomBytes || _utils_js__WEBPACK_IMPORTED_MODULE_1__.randomBytes; + const adjustScalarBytes = eddsaOpts.adjustScalarBytes || ((bytes) => bytes); + const domain = eddsaOpts.domain || + ((data, ctx, phflag) => { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abool2)(phflag, 'phflag'); + if (ctx.length || phflag) + throw new Error('Contexts/pre-hash are not supported'); + return data; + }); // NOOP + // Little-endian SHA512 with modulo n + function modN_LE(hash) { + return Fn.create((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(hash)); // Not Fn.fromBytes: it has length limit + } + // Get the hashed private scalar per RFC8032 5.1.5 + function getPrivateScalar(key) { + const len = lengths.secretKey; + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('private key', key, len); + // Hash private key with curve's hash function to produce uniformingly random input + // Check byte lengths: ensure(64, h(ensure(32, key))) + const hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('hashed private key', cHash(key), 2 * len); + const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE + const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) + const scalar = modN_LE(head); // The actual private scalar + return { head, prefix, scalar }; + } + /** Convenience method that creates public key from scalar. RFC8032 5.1.5 */ + function getExtendedPublicKey(secretKey) { + const { head, prefix, scalar } = getPrivateScalar(secretKey); + const point = BASE.multiply(scalar); // Point on Edwards curve aka public key + const pointBytes = point.toBytes(); + return { head, prefix, scalar, point, pointBytes }; + } + /** Calculates EdDSA pub key. RFC8032 5.1.5. */ + function getPublicKey(secretKey) { + return getExtendedPublicKey(secretKey).pointBytes; + } + // int('LE', SHA512(dom2(F, C) || msgs)) mod N + function hashDomainToScalar(context = Uint8Array.of(), ...msgs) { + const msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(...msgs); + return modN_LE(cHash(domain(msg, (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('context', context), !!prehash))); + } + /** Signs message with privateKey. RFC8032 5.1.6 */ + function sign(msg, secretKey, options = {}) { + msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph etc. + const { prefix, scalar, pointBytes } = getExtendedPublicKey(secretKey); + const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) + const R = BASE.multiply(r).toBytes(); // R = rG + const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) + const s = Fn.create(r + k * scalar); // S = (r + k * s) mod L + if (!Fn.isValid(s)) + throw new Error('sign failed: invalid s'); // 0 <= s < L + const rs = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(R, Fn.toBytes(s)); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abytes2)(rs, lengths.signature, 'result'); + } + // verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex: + const verifyOpts = { zip215: true }; + /** + * Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + * An extended group equation is checked. + */ + function verify(sig, msg, publicKey, options = verifyOpts) { + const { context, zip215 } = options; + const len = lengths.signature; + sig = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('signature', sig, len); + msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('message', msg); + publicKey = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('publicKey', publicKey, lengths.publicKey); + if (zip215 !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abool2)(zip215, 'zip215'); + if (prehash) + msg = prehash(msg); // for ed25519ph, etc + const mid = len / 2; + const r = sig.subarray(0, mid); + const s = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(sig.subarray(mid, len)); + let A, R, SB; + try { + // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. + // zip215=true: 0 <= y < MASK (2^256 for ed25519) + // zip215=false: 0 <= y < P (2^255-19 for ed25519) + A = Point.fromBytes(publicKey, zip215); + R = Point.fromBytes(r, zip215); + SB = BASE.multiplyUnsafe(s); // 0 <= s < l is done inside + } + catch (error) { + return false; + } + if (!zip215 && A.isSmallOrder()) + return false; // zip215 allows public keys of small order + const k = hashDomainToScalar(context, R.toBytes(), A.toBytes(), msg); + const RkA = R.add(A.multiplyUnsafe(k)); + // Extended group equation + // [8][S]B = [8]R + [8][k]A' + return RkA.subtract(SB).clearCofactor().is0(); + } + const _size = Fp.BYTES; // 32 for ed25519, 57 for ed448 + const lengths = { + secretKey: _size, + publicKey: _size, + signature: 2 * _size, + seed: _size, + }; + function randomSecretKey(seed = randomBytes(lengths.seed)) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abytes2)(seed, lengths.seed, 'seed'); + } + function keygen(seed) { + const secretKey = utils.randomSecretKey(seed); + return { secretKey, publicKey: getPublicKey(secretKey) }; + } + function isValidSecretKey(key) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.isBytes)(key) && key.length === Fn.BYTES; + } + function isValidPublicKey(key, zip215) { + try { + return !!Point.fromBytes(key, zip215); + } + catch (error) { + return false; + } + } + const utils = { + getExtendedPublicKey, + randomSecretKey, + isValidSecretKey, + isValidPublicKey, + /** + * Converts ed public key to x public key. Uses formula: + * - ed25519: + * - `(u, v) = ((1+y)/(1-y), sqrt(-486664)*u/x)` + * - `(x, y) = (sqrt(-486664)*u/v, (u-1)/(u+1))` + * - ed448: + * - `(u, v) = ((y-1)/(y+1), sqrt(156324)*u/x)` + * - `(x, y) = (sqrt(156324)*u/v, (1+u)/(1-u))` + */ + toMontgomery(publicKey) { + const { y } = Point.fromBytes(publicKey); + const size = lengths.publicKey; + const is25519 = size === 32; + if (!is25519 && size !== 57) + throw new Error('only defined for 25519 and 448'); + const u = is25519 ? Fp.div(_1n + y, _1n - y) : Fp.div(y - _1n, y + _1n); + return Fp.toBytes(u); + }, + toMontgomerySecret(secretKey) { + const size = lengths.secretKey; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._abytes2)(secretKey, size); + const hashed = cHash(secretKey.subarray(0, size)); + return adjustScalarBytes(hashed).subarray(0, size); + }, + /** @deprecated */ + randomPrivateKey: randomSecretKey, + /** @deprecated */ + precompute(windowSize = 8, point = Point.BASE) { + return point.precompute(windowSize, false); + }, + }; + return Object.freeze({ + keygen, + getPublicKey, + sign, + verify, + utils, + Point, + lengths, + }); +} +function _eddsa_legacy_opts_to_new(c) { + const CURVE = { + a: c.a, + d: c.d, + p: c.Fp.ORDER, + n: c.n, + h: c.h, + Gx: c.Gx, + Gy: c.Gy, + }; + const Fp = c.Fp; + const Fn = (0,_modular_js__WEBPACK_IMPORTED_MODULE_3__.Field)(CURVE.n, c.nBitLength, true); + const curveOpts = { Fp, Fn, uvRatio: c.uvRatio }; + const eddsaOpts = { + randomBytes: c.randomBytes, + adjustScalarBytes: c.adjustScalarBytes, + domain: c.domain, + prehash: c.prehash, + mapToCurve: c.mapToCurve, + }; + return { CURVE, curveOpts, hash: c.hash, eddsaOpts }; +} +function _eddsa_new_output_to_legacy(c, eddsa) { + const Point = eddsa.Point; + const legacy = Object.assign({}, eddsa, { + ExtendedPoint: Point, + CURVE: c, + nBitLength: Point.Fn.BITS, + nByteLength: Point.Fn.BYTES, + }); + return legacy; +} +// TODO: remove. Use eddsa +function twistedEdwards(c) { + const { CURVE, curveOpts, hash, eddsaOpts } = _eddsa_legacy_opts_to_new(c); + const Point = edwards(CURVE, curveOpts); + const EDDSA = eddsa(Point, hash, eddsaOpts); + return _eddsa_new_output_to_legacy(c, EDDSA); +} +//# sourceMappingURL=edwards.js.map + +/***/ }), + +/***/ 45927: +/*!******************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/encoders/pem.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var inherits = __webpack_require__(/*! inherits */ 18628); + +var DEREncoder = __webpack_require__(/*! ./der */ 21354); + +function PEMEncoder(entity) { + DEREncoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMEncoder, DEREncoder); +module.exports = PEMEncoder; + +PEMEncoder.prototype.encode = function encode(data, options) { + var buf = DEREncoder.prototype.encode.call(this, data); + + var p = buf.toString('base64'); + var out = [ '-----BEGIN ' + options.label + '-----' ]; + for (var i = 0; i < p.length; i += 64) + out.push(p.slice(i, i + 64)); + out.push('-----END ' + options.label + '-----'); + return out.join('\n'); +}; + + +/***/ }), + +/***/ 46387: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ add: () => (/* binding */ add), +/* harmony export */ add3H: () => (/* binding */ add3H), +/* harmony export */ add3L: () => (/* binding */ add3L), +/* harmony export */ add4H: () => (/* binding */ add4H), +/* harmony export */ add4L: () => (/* binding */ add4L), +/* harmony export */ add5H: () => (/* binding */ add5H), +/* harmony export */ add5L: () => (/* binding */ add5L), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ fromBig: () => (/* binding */ fromBig), +/* harmony export */ rotlBH: () => (/* binding */ rotlBH), +/* harmony export */ rotlBL: () => (/* binding */ rotlBL), +/* harmony export */ rotlSH: () => (/* binding */ rotlSH), +/* harmony export */ rotlSL: () => (/* binding */ rotlSL), +/* harmony export */ rotr32H: () => (/* binding */ rotr32H), +/* harmony export */ rotr32L: () => (/* binding */ rotr32L), +/* harmony export */ rotrBH: () => (/* binding */ rotrBH), +/* harmony export */ rotrBL: () => (/* binding */ rotrBL), +/* harmony export */ rotrSH: () => (/* binding */ rotrSH), +/* harmony export */ rotrSL: () => (/* binding */ rotrSL), +/* harmony export */ shrSH: () => (/* binding */ shrSH), +/* harmony export */ shrSL: () => (/* binding */ shrSL), +/* harmony export */ split: () => (/* binding */ split), +/* harmony export */ toBig: () => (/* binding */ toBig) +/* harmony export */ }); +/** + * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array. + * @todo re-check https://issues.chromium.org/issues/42212588 + * @module + */ +const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); +const _32n = /* @__PURE__ */ BigInt(32); +function fromBig(n, le = false) { + if (le) + return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) }; + return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; +} +function split(lst, le = false) { + const len = lst.length; + let Ah = new Uint32Array(len); + let Al = new Uint32Array(len); + for (let i = 0; i < len; i++) { + const { h, l } = fromBig(lst[i], le); + [Ah[i], Al[i]] = [h, l]; + } + return [Ah, Al]; +} +const toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0); +// for Shift in [0, 32) +const shrSH = (h, _l, s) => h >>> s; +const shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in [1, 32) +const rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s)); +const rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s); +// Right rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32)); +const rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s)); +// Right rotate for shift===32 (just swaps l&h) +const rotr32H = (_h, l) => l; +const rotr32L = (h, _l) => h; +// Left rotate for Shift in [1, 32) +const rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s)); +const rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s)); +// Left rotate for Shift in (32, 64), NOTE: 32 is special case. +const rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s)); +const rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s)); +// JS uses 32-bit signed integers for bitwise operations which means we cannot +// simple take carry out of low bit sum by shift, we need to use division. +function add(Ah, Al, Bh, Bl) { + const l = (Al >>> 0) + (Bl >>> 0); + return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 }; +} +// Addition with more than 2 elements +const add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); +const add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0; +const add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); +const add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0; +const add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); +const add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0; +// prettier-ignore + +// prettier-ignore +const u64 = { + fromBig, split, toBig, + shrSH, shrSL, + rotrSH, rotrSL, rotrBH, rotrBL, + rotr32H, rotr32L, + rotlSH, rotlSL, rotlBH, rotlBL, + add, add3L, add3H, add4L, add4H, add5H, add5L, +}; +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (u64); +//# sourceMappingURL=_u64.js.map + +/***/ }), + +/***/ 46390: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/bags/index.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CRLBag: () => (/* reexport safe */ _crl_bag_js__WEBPACK_IMPORTED_MODULE_1__.CRLBag), +/* harmony export */ CertBag: () => (/* reexport safe */ _cert_bag_js__WEBPACK_IMPORTED_MODULE_0__.CertBag), +/* harmony export */ KeyBag: () => (/* reexport safe */ _key_bag_js__WEBPACK_IMPORTED_MODULE_2__.KeyBag), +/* harmony export */ PKCS8ShroudedKeyBag: () => (/* reexport safe */ _pkcs8_shrouded_key_bag_js__WEBPACK_IMPORTED_MODULE_3__.PKCS8ShroudedKeyBag), +/* harmony export */ SecretBag: () => (/* reexport safe */ _secret_bag_js__WEBPACK_IMPORTED_MODULE_4__.SecretBag), +/* harmony export */ id_CRLBag: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_CRLBag), +/* harmony export */ id_SafeContents: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_SafeContents), +/* harmony export */ id_SecretBag: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_SecretBag), +/* harmony export */ id_certBag: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_certBag), +/* harmony export */ id_certTypes: () => (/* reexport safe */ _cert_bag_js__WEBPACK_IMPORTED_MODULE_0__.id_certTypes), +/* harmony export */ id_crlTypes: () => (/* reexport safe */ _crl_bag_js__WEBPACK_IMPORTED_MODULE_1__.id_crlTypes), +/* harmony export */ id_keyBag: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_keyBag), +/* harmony export */ id_pkcs8ShroudedKeyBag: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_pkcs8ShroudedKeyBag), +/* harmony export */ id_pkcs_9: () => (/* reexport safe */ _types_js__WEBPACK_IMPORTED_MODULE_5__.id_pkcs_9), +/* harmony export */ id_sdsiCertificate: () => (/* reexport safe */ _cert_bag_js__WEBPACK_IMPORTED_MODULE_0__.id_sdsiCertificate), +/* harmony export */ id_x509CRL: () => (/* reexport safe */ _crl_bag_js__WEBPACK_IMPORTED_MODULE_1__.id_x509CRL), +/* harmony export */ id_x509Certificate: () => (/* reexport safe */ _cert_bag_js__WEBPACK_IMPORTED_MODULE_0__.id_x509Certificate) +/* harmony export */ }); +/* harmony import */ var _cert_bag_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./cert_bag.js */ 7527); +/* harmony import */ var _crl_bag_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./crl_bag.js */ 41196); +/* harmony import */ var _key_bag_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./key_bag.js */ 3440); +/* harmony import */ var _pkcs8_shrouded_key_bag_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./pkcs8_shrouded_key_bag.js */ 96451); +/* harmony import */ var _secret_bag_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./secret_bag.js */ 92273); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types.js */ 61771); + + + + + + + + +/***/ }), + +/***/ 46453: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/regex.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (/^(?:[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); + +/***/ }), + +/***/ 46501: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/function-bind@1.1.2/node_modules/function-bind/implementation.js ***! + \**********************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var toStr = Object.prototype.toString; +var max = Math.max; +var funcType = '[object Function]'; + +var concatty = function concatty(a, b) { + var arr = []; + + for (var i = 0; i < a.length; i += 1) { + arr[i] = a[i]; + } + for (var j = 0; j < b.length; j += 1) { + arr[j + a.length] = b[j]; + } + + return arr; +}; + +var slicy = function slicy(arrLike, offset) { + var arr = []; + for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) { + arr[j] = arrLike[i]; + } + return arr; +}; + +var joiny = function (arr, joiner) { + var str = ''; + for (var i = 0; i < arr.length; i += 1) { + str += arr[i]; + if (i + 1 < arr.length) { + str += joiner; + } + } + return str; +}; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.apply(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slicy(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + concatty(args, arguments) + ); + if (Object(result) === result) { + return result; + } + return this; + } + return target.apply( + that, + concatty(args, arguments) + ); + + }; + + var boundLength = max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs[i] = '$' + i; + } + + bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; + + +/***/ }), + +/***/ 46827: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/hash-base@3.1.2/node_modules/hash-base/to-buffer.js ***! + \*********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var toBuffer = __webpack_require__(/*! to-buffer */ 33384); + +var useUint8Array = typeof Uint8Array !== 'undefined'; +var useArrayBuffer = useUint8Array && typeof ArrayBuffer !== 'undefined'; +var isView = useArrayBuffer && ArrayBuffer.isView; + +module.exports = function (thing, encoding) { + if ( + typeof thing === 'string' + || Buffer.isBuffer(thing) + || (useUint8Array && thing instanceof Uint8Array) + || (isView && isView(thing)) + ) { + return toBuffer(thing, encoding); + } + throw new TypeError('The "data" argument must be a string, a Buffer, a Uint8Array, or a DataView'); +}; + + +/***/ }), + +/***/ 46922: +/*!*************************************************************************!*\ + !*** ../node_modules/.pnpm/isarray@1.0.0/node_modules/isarray/index.js ***! + \*************************************************************************/ +/***/ ((module) => { + +var toString = {}.toString; + +module.exports = Array.isArray || function (arr) { + return toString.call(arr) == '[object Array]'; +}; + + +/***/ }), + +/***/ 47090: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-ecc@2.8.0/node_modules/@peculiar/asn1-ecc/build/es2015/ec_private_key.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ECPrivateKey: () => (/* binding */ ECPrivateKey) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _ec_parameters_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ec_parameters.js */ 91229); + + + +class ECPrivateKey { + version = 1; + privateKey = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + parameters; + publicKey; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], ECPrivateKey.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], ECPrivateKey.prototype, "privateKey", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _ec_parameters_js__WEBPACK_IMPORTED_MODULE_2__.ECParameters, context: 0, optional: true, + }) +], ECPrivateKey.prototype, "parameters", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString, context: 1, optional: true, + }) +], ECPrivateKey.prototype, "publicKey", void 0); + + +/***/ }), + +/***/ 47105: +/*!*****************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/accounts/utils/signMessage.js ***! + \*****************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ signMessage: () => (/* binding */ signMessage) +/* harmony export */ }); +/* harmony import */ var _utils_signature_hashMessage_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/signature/hashMessage.js */ 15874); +/* harmony import */ var _sign_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sign.js */ 63564); + + +/** + * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191): + * `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`. + * + * @returns The signature. + */ +async function signMessage({ message, privateKey, }) { + return await (0,_sign_js__WEBPACK_IMPORTED_MODULE_1__.sign)({ hash: (0,_utils_signature_hashMessage_js__WEBPACK_IMPORTED_MODULE_0__.hashMessage)(message), privateKey, to: 'hex' }); +} +//# sourceMappingURL=signMessage.js.map + +/***/ }), + +/***/ 47149: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/curve.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ _createCurveFields: () => (/* binding */ _createCurveFields), +/* harmony export */ mulEndoUnsafe: () => (/* binding */ mulEndoUnsafe), +/* harmony export */ negateCt: () => (/* binding */ negateCt), +/* harmony export */ normalizeZ: () => (/* binding */ normalizeZ), +/* harmony export */ pippenger: () => (/* binding */ pippenger), +/* harmony export */ precomputeMSMUnsafe: () => (/* binding */ precomputeMSMUnsafe), +/* harmony export */ validateBasic: () => (/* binding */ validateBasic), +/* harmony export */ wNAF: () => (/* binding */ wNAF) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ 74430); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ 35072); +/** + * Methods for elliptic curve multiplication by scalars. + * Contains wNAF, pippenger. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +const _0n = BigInt(0); +const _1n = BigInt(1); +function negateCt(condition, item) { + const neg = item.negate(); + return condition ? neg : item; +} +/** + * Takes a bunch of Projective Points but executes only one + * inversion on all of them. Inversion is very slow operation, + * so this improves performance massively. + * Optimization: converts a list of projective points to a list of identical points with Z=1. + */ +function normalizeZ(c, points) { + const invertedZs = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(c.Fp, points.map((p) => p.Z)); + return points.map((p, i) => c.fromAffine(p.toAffine(invertedZs[i]))); +} +function validateW(W, bits) { + if (!Number.isSafeInteger(W) || W <= 0 || W > bits) + throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W); +} +function calcWOpts(W, scalarBits) { + validateW(W, scalarBits); + const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero + const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero + const maxNumber = 2 ** W; // W=8 256 + const mask = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(W); // W=8 255 == mask 0b11111111 + const shiftBy = BigInt(W); // W=8 8 + return { windows, windowSize, mask, maxNumber, shiftBy }; +} +function calcOffsets(n, window, wOpts) { + const { windowSize, mask, maxNumber, shiftBy } = wOpts; + let wbits = Number(n & mask); // extract W bits. + let nextN = n >> shiftBy; // shift number by W bits. + // What actually happens here: + // const highestBit = Number(mask ^ (mask >> 1n)); + // let wbits2 = wbits - 1; // skip zero + // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~); + // split if bits > max: +224 => 256-32 + if (wbits > windowSize) { + // we skip zero, which means instead of `>= size-1`, we do `> size` + wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here. + nextN += _1n; // +256 (carry) + } + const offsetStart = window * windowSize; + const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero + const isZero = wbits === 0; // is current window slice a 0? + const isNeg = wbits < 0; // is current window slice negative? + const isNegF = window % 2 !== 0; // fake random statement for noise + const offsetF = offsetStart; // fake offset for noise + return { nextN, offset, isZero, isNeg, isNegF, offsetF }; +} +function validateMSMPoints(points, c) { + if (!Array.isArray(points)) + throw new Error('array expected'); + points.forEach((p, i) => { + if (!(p instanceof c)) + throw new Error('invalid point at index ' + i); + }); +} +function validateMSMScalars(scalars, field) { + if (!Array.isArray(scalars)) + throw new Error('array of scalars expected'); + scalars.forEach((s, i) => { + if (!field.isValid(s)) + throw new Error('invalid scalar at index ' + i); + }); +} +// Since points in different groups cannot be equal (different object constructor), +// we can have single place to store precomputes. +// Allows to make points frozen / immutable. +const pointPrecomputes = new WeakMap(); +const pointWindowSizes = new WeakMap(); +function getW(P) { + // To disable precomputes: + // return 1; + return pointWindowSizes.get(P) || 1; +} +function assert0(n) { + if (n !== _0n) + throw new Error('invalid wNAF'); +} +/** + * Elliptic curve multiplication of Point by scalar. Fragile. + * Table generation takes **30MB of ram and 10ms on high-end CPU**, + * but may take much longer on slow devices. Actual generation will happen on + * first call of `multiply()`. By default, `BASE` point is precomputed. + * + * Scalars should always be less than curve order: this should be checked inside of a curve itself. + * Creates precomputation tables for fast multiplication: + * - private scalar is split by fixed size windows of W bits + * - every window point is collected from window's table & added to accumulator + * - since windows are different, same point inside tables won't be accessed more than once per calc + * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) + * - +1 window is neccessary for wNAF + * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication + * + * @todo Research returning 2d JS array of windows, instead of a single window. + * This would allow windows to be in different memory locations + */ +class wNAF { + // Parametrized with a given Point class (not individual point) + constructor(Point, bits) { + this.BASE = Point.BASE; + this.ZERO = Point.ZERO; + this.Fn = Point.Fn; + this.bits = bits; + } + // non-const time multiplication ladder + _unsafeLadder(elm, n, p = this.ZERO) { + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + } + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @param point Point instance + * @param W window size + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(point, W) { + const { windows, windowSize } = calcWOpts(W, this.bits); + const points = []; + let p = point; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // i=1, bc we skip 0 + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + } + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * More compact implementation: + * https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // Scalar should be smaller than field order + if (!this.Fn.isValid(n)) + throw new Error('invalid scalar'); + // Accumulators + let p = this.ZERO; + let f = this.BASE; + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + const wo = calcWOpts(W, this.bits); + for (let window = 0; window < wo.windows; window++) { + // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise + const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // bits are 0: add garbage to fake point + // Important part for const-time getPublicKey: add random "noise" point to f. + f = f.add(negateCt(isNegF, precomputes[offsetF])); + } + else { + // bits are 1: add to result point + p = p.add(negateCt(isNeg, precomputes[offset])); + } + } + assert0(n); + // Return both real and fake points: JIT won't eliminate f. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + } + /** + * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form. + * @param acc accumulator point to add result of multiplication + * @returns point + */ + wNAFUnsafe(W, precomputes, n, acc = this.ZERO) { + const wo = calcWOpts(W, this.bits); + for (let window = 0; window < wo.windows; window++) { + if (n === _0n) + break; // Early-exit, skip 0 value + const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // Window bits are 0: skip processing. + // Move to next window. + continue; + } + else { + const item = precomputes[offset]; + acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM + } + } + assert0(n); + return acc; + } + getPrecomputes(W, point, transform) { + // Calculate precomputes on a first run, reuse them after + let comp = pointPrecomputes.get(point); + if (!comp) { + comp = this.precomputeWindow(point, W); + if (W !== 1) { + // Doing transform outside of if brings 15% perf hit + if (typeof transform === 'function') + comp = transform(comp); + pointPrecomputes.set(point, comp); + } + } + return comp; + } + cached(point, scalar, transform) { + const W = getW(point); + return this.wNAF(W, this.getPrecomputes(W, point, transform), scalar); + } + unsafe(point, scalar, transform, prev) { + const W = getW(point); + if (W === 1) + return this._unsafeLadder(point, scalar, prev); // For W=1 ladder is ~x2 faster + return this.wNAFUnsafe(W, this.getPrecomputes(W, point, transform), scalar, prev); + } + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + createCache(P, W) { + validateW(W, this.bits); + pointWindowSizes.set(P, W); + pointPrecomputes.delete(P); + } + hasCache(elm) { + return getW(elm) !== 1; + } +} +/** + * Endomorphism-specific multiplication for Koblitz curves. + * Cost: 128 dbl, 0-256 adds. + */ +function mulEndoUnsafe(Point, point, k1, k2) { + let acc = point; + let p1 = Point.ZERO; + let p2 = Point.ZERO; + while (k1 > _0n || k2 > _0n) { + if (k1 & _1n) + p1 = p1.add(acc); + if (k2 & _1n) + p2 = p2.add(acc); + acc = acc.double(); + k1 >>= _1n; + k2 >>= _1n; + } + return { p1, p2 }; +} +/** + * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * 30x faster vs naive addition on L=4096, 10x faster than precomputes. + * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. + * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @param scalars array of L scalars (aka secret keys / bigints) + */ +function pippenger(c, fieldN, points, scalars) { + // If we split scalars by some window (let's say 8 bits), every chunk will only + // take 256 buckets even if there are 4096 scalars, also re-uses double. + // TODO: + // - https://eprint.iacr.org/2024/750.pdf + // - https://tches.iacr.org/index.php/TCHES/article/view/10287 + // 0 is accepted in scalars + validateMSMPoints(points, c); + validateMSMScalars(scalars, fieldN); + const plength = points.length; + const slength = scalars.length; + if (plength !== slength) + throw new Error('arrays of points and scalars must have equal length'); + // if (plength === 0) throw new Error('array must be of length >= 2'); + const zero = c.ZERO; + const wbits = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitLen)(BigInt(plength)); + let windowSize = 1; // bits + if (wbits > 12) + windowSize = wbits - 3; + else if (wbits > 4) + windowSize = wbits - 2; + else if (wbits > 0) + windowSize = 2; + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(windowSize); + const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array + const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize; + let sum = zero; + for (let i = lastBits; i >= 0; i -= windowSize) { + buckets.fill(zero); + for (let j = 0; j < slength; j++) { + const scalar = scalars[j]; + const wbits = Number((scalar >> BigInt(i)) & MASK); + buckets[wbits] = buckets[wbits].add(points[j]); + } + let resI = zero; // not using this will do small speed-up, but will lose ct + // Skip first bucket, because it is zero + for (let j = buckets.length - 1, sumI = zero; j > 0; j--) { + sumI = sumI.add(buckets[j]); + resI = resI.add(sumI); + } + sum = sum.add(resI); + if (i !== 0) + for (let j = 0; j < windowSize; j++) + sum = sum.double(); + } + return sum; +} +/** + * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @returns function which multiplies points with scaars + */ +function precomputeMSMUnsafe(c, fieldN, points, windowSize) { + /** + * Performance Analysis of Window-based Precomputation + * + * Base Case (256-bit scalar, 8-bit window): + * - Standard precomputation requires: + * - 31 additions per scalar × 256 scalars = 7,936 ops + * - Plus 255 summary additions = 8,191 total ops + * Note: Summary additions can be optimized via accumulator + * + * Chunked Precomputation Analysis: + * - Using 32 chunks requires: + * - 255 additions per chunk + * - 256 doublings + * - Total: (255 × 32) + 256 = 8,416 ops + * + * Memory Usage Comparison: + * Window Size | Standard Points | Chunked Points + * ------------|-----------------|--------------- + * 4-bit | 520 | 15 + * 8-bit | 4,224 | 255 + * 10-bit | 13,824 | 1,023 + * 16-bit | 557,056 | 65,535 + * + * Key Advantages: + * 1. Enables larger window sizes due to reduced memory overhead + * 2. More efficient for smaller scalar counts: + * - 16 chunks: (16 × 255) + 256 = 4,336 ops + * - ~2x faster than standard 8,191 ops + * + * Limitations: + * - Not suitable for plain precomputes (requires 256 constant doublings) + * - Performance degrades with larger scalar counts: + * - Optimal for ~256 scalars + * - Less efficient for 4096+ scalars (Pippenger preferred) + */ + validateW(windowSize, fieldN.BITS); + validateMSMPoints(points, c); + const zero = c.ZERO; + const tableSize = 2 ** windowSize - 1; // table size (without zero) + const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bitMask)(windowSize); + const tables = points.map((p) => { + const res = []; + for (let i = 0, acc = p; i < tableSize; i++) { + res.push(acc); + acc = acc.add(p); + } + return res; + }); + return (scalars) => { + validateMSMScalars(scalars, fieldN); + if (scalars.length > points.length) + throw new Error('array of scalars must be smaller than array of points'); + let res = zero; + for (let i = 0; i < chunks; i++) { + // No need to double if accumulator is still zero. + if (res !== zero) + for (let j = 0; j < windowSize; j++) + res = res.double(); + const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize); + for (let j = 0; j < scalars.length; j++) { + const n = scalars[j]; + const curr = Number((n >> shiftBy) & MASK); + if (!curr) + continue; // skip zero scalars chunks + res = res.add(tables[j][curr - 1]); + } + } + return res; + }; +} +// TODO: remove +/** @deprecated */ +function validateBasic(curve) { + (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.validateField)(curve.Fp); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.validateObject)(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...(0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.nLength)(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +function createField(order, field, isLE) { + if (field) { + if (field.ORDER !== order) + throw new Error('Field.ORDER must match order: Fp == p, Fn == n'); + (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.validateField)(field); + return field; + } + else { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.Field)(order, { isLE }); + } +} +/** Validates CURVE opts and creates fields */ +function _createCurveFields(type, CURVE, curveOpts = {}, FpFnLE) { + if (FpFnLE === undefined) + FpFnLE = type === 'edwards'; + if (!CURVE || typeof CURVE !== 'object') + throw new Error(`expected valid ${type} CURVE object`); + for (const p of ['p', 'n', 'h']) { + const val = CURVE[p]; + if (!(typeof val === 'bigint' && val > _0n)) + throw new Error(`CURVE.${p} must be positive bigint`); + } + const Fp = createField(CURVE.p, curveOpts.Fp, FpFnLE); + const Fn = createField(CURVE.n, curveOpts.Fn, FpFnLE); + const _b = type === 'weierstrass' ? 'b' : 'd'; + const params = ['Gx', 'Gy', 'a', _b]; + for (const p of params) { + // @ts-ignore + if (!Fp.isValid(CURVE[p])) + throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`); + } + CURVE = Object.freeze(Object.assign({}, CURVE)); + return { CURVE, Fp, Fn }; +} +//# sourceMappingURL=curve.js.map + +/***/ }), + +/***/ 47152: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/cipherSuiteNative.js ***! + \***************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CipherSuiteNative: () => (/* binding */ CipherSuiteNative) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _exporterContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./exporterContext.js */ 16170); +/* harmony import */ var _recipientContext_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./recipientContext.js */ 11326); +/* harmony import */ var _senderContext_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./senderContext.js */ 85174); + + + + +// b"base_nonce" +// deno-fmt-ignore +const LABEL_BASE_NONCE = new Uint8Array([ + 98, 97, 115, 101, 95, 110, 111, 110, 99, 101, +]); +// b"exp" +const LABEL_EXP = new Uint8Array([101, 120, 112]); +// b"info_hash" +// deno-fmt-ignore +const LABEL_INFO_HASH = new Uint8Array([ + 105, 110, 102, 111, 95, 104, 97, 115, 104, +]); +// b"key" +const LABEL_KEY = new Uint8Array([107, 101, 121]); +// b"psk_id_hash" +// deno-fmt-ignore +const LABEL_PSK_ID_HASH = new Uint8Array([ + 112, 115, 107, 95, 105, 100, 95, 104, 97, 115, 104, +]); +// b"secret" +const LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]); +// b"HPKE" +// deno-fmt-ignore +const SUITE_ID_HEADER_HPKE = new Uint8Array([ + 72, 80, 75, 69, 0, 0, 0, 0, 0, 0, +]); +/** + * The Hybrid Public Key Encryption (HPKE) ciphersuite, + * which is implemented using only + * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}. + * + * This is the super class of {@link CipherSuite} and the same as + * {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows: + * which supports only the ciphersuites that can be implemented on the native + * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}. + * Therefore, the following cryptographic algorithms are not supported for now: + * - DHKEM(X25519, HKDF-SHA256) + * - DHKEM(X448, HKDF-SHA512) + * - ChaCha20Poly1305 + * + * In addtion, the HKDF functions contained in this class can only derive + * keys of the same length as the `hashSize`. + * + * If you want to use the unsupported cryptographic algorithms + * above or derive keys longer than the `hashSize`, + * please use {@link CipherSuite}. + * + * This class provides following functions: + * + * - Creates encryption contexts both for senders and recipients. + * - {@link createSenderContext} + * - {@link createRecipientContext} + * - Provides single-shot encryption API. + * - {@link seal} + * - {@link open} + * + * The calling of the constructor of this class is the starting + * point for HPKE operations for both senders and recipients. + * + * @example Use only ciphersuites supported by Web Cryptography API. + * + * ```ts + * import { + * Aes128Gcm, + * DhkemP256HkdfSha256, + * HkdfSha256, + * CipherSuite, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemP256HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + * + * @example Use a ciphersuite which is currently not supported by Web Cryptography API. + * + * ```ts + * import { Aes128Gcm, HkdfSha256, CipherSuite } from "@hpke/core"; + * // Use an extension module. + * import { DhkemX25519HkdfSha256 } from "@hpke/dhkem-x25519"; + * + * const suite = new CipherSuite({ + * kem: new DhkemX25519HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class CipherSuiteNative extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NativeAlgorithm { + /** + * @param params A set of parameters for building a cipher suite. + * + * If the error occurred, throws {@link InvalidParamError}. + * + * @throws {@link InvalidParamError} + */ + constructor(params) { + super(); + Object.defineProperty(this, "_kem", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_kdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_aead", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_suiteId", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + // KEM + if (typeof params.kem === "number") { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("KemId cannot be used"); + } + this._kem = params.kem; + // KDF + if (typeof params.kdf === "number") { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("KdfId cannot be used"); + } + this._kdf = params.kdf; + // AEAD + if (typeof params.aead === "number") { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("AeadId cannot be used"); + } + this._aead = params.aead; + this._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE); + this._suiteId.set((0,_hpke_common__WEBPACK_IMPORTED_MODULE_0__.i2Osp)(this._kem.id, 2), 4); + this._suiteId.set((0,_hpke_common__WEBPACK_IMPORTED_MODULE_0__.i2Osp)(this._kdf.id, 2), 6); + this._suiteId.set((0,_hpke_common__WEBPACK_IMPORTED_MODULE_0__.i2Osp)(this._aead.id, 2), 8); + this._kdf.init(this._suiteId); + } + /** + * Gets the KEM context of the ciphersuite. + */ + get kem() { + return this._kem; + } + /** + * Gets the KDF context of the ciphersuite. + */ + get kdf() { + return this._kdf; + } + /** + * Gets the AEAD context of the ciphersuite. + */ + get aead() { + return this._aead; + } + /** + * Creates an encryption context for a sender. + * + * If the error occurred, throws {@link DecapError} | {@link ValidationError}. + * + * @param params A set of parameters for the sender encryption context. + * @returns A sender encryption context. + * @throws {@link EncapError}, {@link ValidationError} + */ + async createSenderContext(params) { + this._validateInputLength(params); + await this._setup(); + const dh = await this._kem.encap(params); + let mode; + if (params.psk !== undefined) { + mode = params.senderKey !== undefined ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.AuthPsk : _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Psk; + } + else { + mode = params.senderKey !== undefined ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Auth : _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Base; + } + return await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params); + } + /** + * Creates an encryption context for a recipient. + * + * If the error occurred, throws {@link DecapError} + * | {@link DeserializeError} | {@link ValidationError}. + * + * @param params A set of parameters for the recipient encryption context. + * @returns A recipient encryption context. + * @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError} + */ + async createRecipientContext(params) { + this._validateInputLength(params); + await this._setup(); + const sharedSecret = await this._kem.decap(params); + let mode; + if (params.psk !== undefined) { + mode = params.senderPublicKey !== undefined ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.AuthPsk : _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Psk; + } + else { + mode = params.senderPublicKey !== undefined ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Auth : _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Mode.Base; + } + return await this._keyScheduleR(mode, sharedSecret, params); + } + /** + * Encrypts a message to a recipient. + * + * If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`. + * + * @param params A set of parameters for building a sender encryption context. + * @param pt A plain text as bytes to be encrypted. + * @param aad Additional authenticated data as bytes fed by an application. + * @returns A cipher text and an encapsulated key as bytes. + * @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError} + */ + async seal(params, pt, aad = _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer) { + const ctx = await this.createSenderContext(params); + return { + ct: await ctx.seal(pt, aad), + enc: ctx.enc, + }; + } + /** + * Decrypts a message from a sender. + * + * If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`. + * + * @param params A set of parameters for building a recipient encryption context. + * @param ct An encrypted text as bytes to be decrypted. + * @param aad Additional authenticated data as bytes fed by an application. + * @returns A decrypted plain text as bytes. + * @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError} + */ + async open(params, ct, aad = _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer) { + const ctx = await this.createRecipientContext(params); + return await ctx.open(ct, aad); + } + // private verifyPskInputs(mode: Mode, params: KeyScheduleParams) { + // const gotPsk = (params.psk !== undefined); + // const gotPskId = (params.psk !== undefined && params.psk.id.byteLength > 0); + // if (gotPsk !== gotPskId) { + // throw new Error('Inconsistent PSK inputs'); + // } + // if (gotPsk && (mode === Mode.Base || mode === Mode.Auth)) { + // throw new Error('PSK input provided when not needed'); + // } + // if (!gotPsk && (mode === Mode.Psk || mode === Mode.AuthPsk)) { + // throw new Error('Missing required PSK input'); + // } + // return; + // } + async _keySchedule(mode, sharedSecret, params) { + // Currently, there is no point in executing this function + // because this hpke library does not allow users to explicitly specify the mode. + // + // this.verifyPskInputs(mode, params); + const pskId = params.psk === undefined + ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY + : new Uint8Array(params.psk.id); + const pskIdHash = await this._kdf.labeledExtract(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, LABEL_PSK_ID_HASH, pskId); + const info = params.info === undefined + ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY + : new Uint8Array(params.info); + const infoHash = await this._kdf.labeledExtract(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, LABEL_INFO_HASH, info); + const keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength); + keyScheduleContext.set(new Uint8Array([mode]), 0); + keyScheduleContext.set(new Uint8Array(pskIdHash), 1); + keyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength); + const psk = params.psk === undefined + ? _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY + : new Uint8Array(params.psk.key); + const ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk) + .buffer; + const exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize).buffer; + const exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize); + if (this._aead.id === _hpke_common__WEBPACK_IMPORTED_MODULE_0__.AeadId.ExportOnly) { + return { aead: this._aead, exporterSecret: exporterSecret }; + } + const keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize).buffer; + const key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize); + const baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize).buffer; + const baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize); + return { + aead: this._aead, + exporterSecret: exporterSecret, + key: key, + baseNonce: new Uint8Array(baseNonce), + seq: 0, + }; + } + async _keyScheduleS(mode, sharedSecret, enc, params) { + const res = await this._keySchedule(mode, sharedSecret, params); + if (res.key === undefined) { + return new _exporterContext_js__WEBPACK_IMPORTED_MODULE_1__.SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc); + } + return new _senderContext_js__WEBPACK_IMPORTED_MODULE_3__.SenderContextImpl(this._api, this._kdf, res, enc); + } + async _keyScheduleR(mode, sharedSecret, params) { + const res = await this._keySchedule(mode, sharedSecret, params); + if (res.key === undefined) { + return new _exporterContext_js__WEBPACK_IMPORTED_MODULE_1__.RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret); + } + return new _recipientContext_js__WEBPACK_IMPORTED_MODULE_2__.RecipientContextImpl(this._api, this._kdf, res); + } + _validateInputLength(params) { + if (params.info !== undefined && + params.info.byteLength > _hpke_common__WEBPACK_IMPORTED_MODULE_0__.INFO_LENGTH_LIMIT) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("Too long info"); + } + if (params.psk !== undefined) { + if (params.psk.key.byteLength < _hpke_common__WEBPACK_IMPORTED_MODULE_0__.MINIMUM_PSK_LENGTH) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError(`PSK must have at least ${_hpke_common__WEBPACK_IMPORTED_MODULE_0__.MINIMUM_PSK_LENGTH} bytes`); + } + if (params.psk.key.byteLength > _hpke_common__WEBPACK_IMPORTED_MODULE_0__.INPUT_LENGTH_LIMIT) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("Too long psk.key"); + } + if (params.psk.id.byteLength > _hpke_common__WEBPACK_IMPORTED_MODULE_0__.INPUT_LENGTH_LIMIT) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.InvalidParamError("Too long psk.id"); + } + } + return; + } +} + + +/***/ }), + +/***/ 47194: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/ripemd.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ./utils */ 27152); +var common = __webpack_require__(/*! ./common */ 92660); + +var rotl32 = utils.rotl32; +var sum32 = utils.sum32; +var sum32_3 = utils.sum32_3; +var sum32_4 = utils.sum32_4; +var BlockHash = common.BlockHash; + +function RIPEMD160() { + if (!(this instanceof RIPEMD160)) + return new RIPEMD160(); + + BlockHash.call(this); + + this.h = [ 0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0 ]; + this.endian = 'little'; +} +utils.inherits(RIPEMD160, BlockHash); +exports.ripemd160 = RIPEMD160; + +RIPEMD160.blockSize = 512; +RIPEMD160.outSize = 160; +RIPEMD160.hmacStrength = 192; +RIPEMD160.padLength = 64; + +RIPEMD160.prototype._update = function update(msg, start) { + var A = this.h[0]; + var B = this.h[1]; + var C = this.h[2]; + var D = this.h[3]; + var E = this.h[4]; + var Ah = A; + var Bh = B; + var Ch = C; + var Dh = D; + var Eh = E; + for (var j = 0; j < 80; j++) { + var T = sum32( + rotl32( + sum32_4(A, f(j, B, C, D), msg[r[j] + start], K(j)), + s[j]), + E); + A = E; + E = D; + D = rotl32(C, 10); + C = B; + B = T; + T = sum32( + rotl32( + sum32_4(Ah, f(79 - j, Bh, Ch, Dh), msg[rh[j] + start], Kh(j)), + sh[j]), + Eh); + Ah = Eh; + Eh = Dh; + Dh = rotl32(Ch, 10); + Ch = Bh; + Bh = T; + } + T = sum32_3(this.h[1], C, Dh); + this.h[1] = sum32_3(this.h[2], D, Eh); + this.h[2] = sum32_3(this.h[3], E, Ah); + this.h[3] = sum32_3(this.h[4], A, Bh); + this.h[4] = sum32_3(this.h[0], B, Ch); + this.h[0] = T; +}; + +RIPEMD160.prototype._digest = function digest(enc) { + if (enc === 'hex') + return utils.toHex32(this.h, 'little'); + else + return utils.split32(this.h, 'little'); +}; + +function f(j, x, y, z) { + if (j <= 15) + return x ^ y ^ z; + else if (j <= 31) + return (x & y) | ((~x) & z); + else if (j <= 47) + return (x | (~y)) ^ z; + else if (j <= 63) + return (x & z) | (y & (~z)); + else + return x ^ (y | (~z)); +} + +function K(j) { + if (j <= 15) + return 0x00000000; + else if (j <= 31) + return 0x5a827999; + else if (j <= 47) + return 0x6ed9eba1; + else if (j <= 63) + return 0x8f1bbcdc; + else + return 0xa953fd4e; +} + +function Kh(j) { + if (j <= 15) + return 0x50a28be6; + else if (j <= 31) + return 0x5c4dd124; + else if (j <= 47) + return 0x6d703ef3; + else if (j <= 63) + return 0x7a6d76e9; + else + return 0x00000000; +} + +var r = [ + 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 +]; + +var rh = [ + 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 +]; + +var s = [ + 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 +]; + +var sh = [ + 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 +]; + + +/***/ }), + +/***/ 47205: +/*!***************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/possible-typed-array-names@1.1.0/node_modules/possible-typed-array-names/index.js ***! + \***************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('.')} */ +module.exports = [ + 'Float16Array', + 'Float32Array', + 'Float64Array', + 'Int8Array', + 'Int16Array', + 'Int32Array', + 'Uint8Array', + 'Uint8ClampedArray', + 'Uint16Array', + 'Uint32Array', + 'BigInt64Array', + 'BigUint64Array' +]; + + +/***/ }), + +/***/ 47341: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/public-encrypt@4.0.3/node_modules/public-encrypt/xor.js ***! + \*************************************************************************************/ +/***/ ((module) => { + +module.exports = function xor (a, b) { + var len = a.length + var i = -1 + while (++i < len) { + a[i] ^= b[i] + } + return a +} + + +/***/ }), + +/***/ 47521: +/*!*************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/binary.js ***! + \*************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ binary: () => (/* binding */ binary), +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ is: () => (/* binding */ is) +/* harmony export */ }); +/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ 15246); + +function encode(data) { + const bytes = (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + let result = ""; + for (const byte of bytes) { + result += String.fromCharCode(byte); + } + return result; +} +function decode(text) { + const result = new Uint8Array(text.length); + for (let i = 0; i < text.length; i++) { + result[i] = text.charCodeAt(i) & 0xff; + } + return result; +} +function is(text) { + return typeof text === "string"; +} +const binary = { encode, decode, is }; + + +/***/ }), + +/***/ 47564: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-des@1.0.2/node_modules/browserify-des/modes.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +exports["des-ecb"] = { + key: 8, + iv: 0 +} +exports["des-cbc"] = exports.des = { + key: 8, + iv: 8 +} +exports["des-ede3-cbc"] = exports.des3 = { + key: 24, + iv: 8 +} +exports["des-ede3"] = { + key: 24, + iv: 0 +} +exports["des-ede-cbc"] = { + key: 16, + iv: 8 +} +exports["des-ede"] = { + key: 16, + iv: 0 +} + + +/***/ }), + +/***/ 47618: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/object_identifiers.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ id_RSAES_OAEP: () => (/* binding */ id_RSAES_OAEP), +/* harmony export */ id_RSASSA_PSS: () => (/* binding */ id_RSASSA_PSS), +/* harmony export */ id_md2: () => (/* binding */ id_md2), +/* harmony export */ id_md2WithRSAEncryption: () => (/* binding */ id_md2WithRSAEncryption), +/* harmony export */ id_md5: () => (/* binding */ id_md5), +/* harmony export */ id_md5WithRSAEncryption: () => (/* binding */ id_md5WithRSAEncryption), +/* harmony export */ id_mgf1: () => (/* binding */ id_mgf1), +/* harmony export */ id_pSpecified: () => (/* binding */ id_pSpecified), +/* harmony export */ id_pkcs_1: () => (/* binding */ id_pkcs_1), +/* harmony export */ id_rsaEncryption: () => (/* binding */ id_rsaEncryption), +/* harmony export */ id_sha1: () => (/* binding */ id_sha1), +/* harmony export */ id_sha1WithRSAEncryption: () => (/* binding */ id_sha1WithRSAEncryption), +/* harmony export */ id_sha224: () => (/* binding */ id_sha224), +/* harmony export */ id_sha224WithRSAEncryption: () => (/* binding */ id_sha224WithRSAEncryption), +/* harmony export */ id_sha256: () => (/* binding */ id_sha256), +/* harmony export */ id_sha256WithRSAEncryption: () => (/* binding */ id_sha256WithRSAEncryption), +/* harmony export */ id_sha384: () => (/* binding */ id_sha384), +/* harmony export */ id_sha384WithRSAEncryption: () => (/* binding */ id_sha384WithRSAEncryption), +/* harmony export */ id_sha512: () => (/* binding */ id_sha512), +/* harmony export */ id_sha512WithRSAEncryption: () => (/* binding */ id_sha512WithRSAEncryption), +/* harmony export */ id_sha512_224: () => (/* binding */ id_sha512_224), +/* harmony export */ id_sha512_224WithRSAEncryption: () => (/* binding */ id_sha512_224WithRSAEncryption), +/* harmony export */ id_sha512_256: () => (/* binding */ id_sha512_256), +/* harmony export */ id_sha512_256WithRSAEncryption: () => (/* binding */ id_sha512_256WithRSAEncryption), +/* harmony export */ id_ssha224WithRSAEncryption: () => (/* binding */ id_ssha224WithRSAEncryption) +/* harmony export */ }); +const id_pkcs_1 = "1.2.840.113549.1.1"; +const id_rsaEncryption = `${id_pkcs_1}.1`; +const id_RSAES_OAEP = `${id_pkcs_1}.7`; +const id_pSpecified = `${id_pkcs_1}.9`; +const id_RSASSA_PSS = `${id_pkcs_1}.10`; +const id_md2WithRSAEncryption = `${id_pkcs_1}.2`; +const id_md5WithRSAEncryption = `${id_pkcs_1}.4`; +const id_sha1WithRSAEncryption = `${id_pkcs_1}.5`; +const id_sha224WithRSAEncryption = `${id_pkcs_1}.14`; +const id_ssha224WithRSAEncryption = id_sha224WithRSAEncryption; +const id_sha256WithRSAEncryption = `${id_pkcs_1}.11`; +const id_sha384WithRSAEncryption = `${id_pkcs_1}.12`; +const id_sha512WithRSAEncryption = `${id_pkcs_1}.13`; +const id_sha512_224WithRSAEncryption = `${id_pkcs_1}.15`; +const id_sha512_256WithRSAEncryption = `${id_pkcs_1}.16`; +const id_sha1 = "1.3.14.3.2.26"; +const id_sha224 = "2.16.840.1.101.3.4.2.4"; +const id_sha256 = "2.16.840.1.101.3.4.2.1"; +const id_sha384 = "2.16.840.1.101.3.4.2.2"; +const id_sha512 = "2.16.840.1.101.3.4.2.3"; +const id_sha512_224 = "2.16.840.1.101.3.4.2.5"; +const id_sha512_256 = "2.16.840.1.101.3.4.2.6"; +const id_md2 = "1.2.840.113549.2.2"; +const id_md5 = "1.2.840.113549.2.5"; +const id_mgf1 = `${id_pkcs_1}.8`; + + +/***/ }), + +/***/ 47850: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/certificate_list.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CertificateList: () => (/* binding */ CertificateList) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./algorithm_identifier.js */ 99875); +/* harmony import */ var _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tbs_cert_list.js */ 99187); + + + + +class CertificateList { + tbsCertList = new _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_3__.TBSCertList(); + tbsCertListRaw; + signatureAlgorithm = new _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + signature = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _tbs_cert_list_js__WEBPACK_IMPORTED_MODULE_3__.TBSCertList, raw: true, + }) +], CertificateList.prototype, "tbsCertList", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], CertificateList.prototype, "signatureAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString }) +], CertificateList.prototype, "signature", void 0); + + +/***/ }), + +/***/ 47886: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@2.3.8/node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \****************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/**/ + +var pna = __webpack_require__(/*! process-nextick-args */ 31840); +/**/ + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + pna.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + pna.nextTick(emitErrorNT, this, err); + } + } + + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + pna.nextTick(emitErrorNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + pna.nextTick(emitErrorNT, _this, err); + } + } else if (cb) { + cb(err); + } + }); + + return this; +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + +/***/ }), + +/***/ 48119: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.1/node_modules/@noble/curves/esm/abstract/curve.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ pippenger: () => (/* binding */ pippenger), +/* harmony export */ precomputeMSMUnsafe: () => (/* binding */ precomputeMSMUnsafe), +/* harmony export */ validateBasic: () => (/* binding */ validateBasic), +/* harmony export */ wNAF: () => (/* binding */ wNAF) +/* harmony export */ }); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modular.js */ 85070); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 35797); +/** + * Methods for elliptic curve multiplication by scalars. + * Contains wNAF, pippenger + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +const _0n = BigInt(0); +const _1n = BigInt(1); +function constTimeNegate(condition, item) { + const neg = item.negate(); + return condition ? neg : item; +} +function validateW(W, bits) { + if (!Number.isSafeInteger(W) || W <= 0 || W > bits) + throw new Error('invalid window size, expected [1..' + bits + '], got W=' + W); +} +function calcWOpts(W, scalarBits) { + validateW(W, scalarBits); + const windows = Math.ceil(scalarBits / W) + 1; // W=8 33. Not 32, because we skip zero + const windowSize = 2 ** (W - 1); // W=8 128. Not 256, because we skip zero + const maxNumber = 2 ** W; // W=8 256 + const mask = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(W); // W=8 255 == mask 0b11111111 + const shiftBy = BigInt(W); // W=8 8 + return { windows, windowSize, mask, maxNumber, shiftBy }; +} +function calcOffsets(n, window, wOpts) { + const { windowSize, mask, maxNumber, shiftBy } = wOpts; + let wbits = Number(n & mask); // extract W bits. + let nextN = n >> shiftBy; // shift number by W bits. + // What actually happens here: + // const highestBit = Number(mask ^ (mask >> 1n)); + // let wbits2 = wbits - 1; // skip zero + // if (wbits2 & highestBit) { wbits2 ^= Number(mask); // (~); + // split if bits > max: +224 => 256-32 + if (wbits > windowSize) { + // we skip zero, which means instead of `>= size-1`, we do `> size` + wbits -= maxNumber; // -32, can be maxNumber - wbits, but then we need to set isNeg here. + nextN += _1n; // +256 (carry) + } + const offsetStart = window * windowSize; + const offset = offsetStart + Math.abs(wbits) - 1; // -1 because we skip zero + const isZero = wbits === 0; // is current window slice a 0? + const isNeg = wbits < 0; // is current window slice negative? + const isNegF = window % 2 !== 0; // fake random statement for noise + const offsetF = offsetStart; // fake offset for noise + return { nextN, offset, isZero, isNeg, isNegF, offsetF }; +} +function validateMSMPoints(points, c) { + if (!Array.isArray(points)) + throw new Error('array expected'); + points.forEach((p, i) => { + if (!(p instanceof c)) + throw new Error('invalid point at index ' + i); + }); +} +function validateMSMScalars(scalars, field) { + if (!Array.isArray(scalars)) + throw new Error('array of scalars expected'); + scalars.forEach((s, i) => { + if (!field.isValid(s)) + throw new Error('invalid scalar at index ' + i); + }); +} +// Since points in different groups cannot be equal (different object constructor), +// we can have single place to store precomputes. +// Allows to make points frozen / immutable. +const pointPrecomputes = new WeakMap(); +const pointWindowSizes = new WeakMap(); +function getW(P) { + return pointWindowSizes.get(P) || 1; +} +/** + * Elliptic curve multiplication of Point by scalar. Fragile. + * Scalars should always be less than curve order: this should be checked inside of a curve itself. + * Creates precomputation tables for fast multiplication: + * - private scalar is split by fixed size windows of W bits + * - every window point is collected from window's table & added to accumulator + * - since windows are different, same point inside tables won't be accessed more than once per calc + * - each multiplication is 'Math.ceil(CURVE_ORDER / 𝑊) + 1' point additions (fixed for any scalar) + * - +1 window is neccessary for wNAF + * - wNAF reduces table size: 2x less memory + 2x faster generation, but 10% slower multiplication + * + * @todo Research returning 2d JS array of windows, instead of a single window. + * This would allow windows to be in different memory locations + */ +function wNAF(c, bits) { + return { + constTimeNegate, + hasPrecomputes(elm) { + return getW(elm) !== 1; + }, + // non-const time multiplication ladder + unsafeLadder(elm, n, p = c.ZERO) { + let d = elm; + while (n > _0n) { + if (n & _1n) + p = p.add(d); + d = d.double(); + n >>= _1n; + } + return p; + }, + /** + * Creates a wNAF precomputation window. Used for caching. + * Default window size is set by `utils.precompute()` and is equal to 8. + * Number of precomputed points depends on the curve size: + * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where: + * - 𝑊 is the window size + * - 𝑛 is the bitlength of the curve order. + * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224. + * @param elm Point instance + * @param W window size + * @returns precomputed point tables flattened to a single array + */ + precomputeWindow(elm, W) { + const { windows, windowSize } = calcWOpts(W, bits); + const points = []; + let p = elm; + let base = p; + for (let window = 0; window < windows; window++) { + base = p; + points.push(base); + // i=1, bc we skip 0 + for (let i = 1; i < windowSize; i++) { + base = base.add(p); + points.push(base); + } + p = base.double(); + } + return points; + }, + /** + * Implements ec multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @returns real and fake (for const-time) points + */ + wNAF(W, precomputes, n) { + // Smaller version: + // https://github.com/paulmillr/noble-secp256k1/blob/47cb1669b6e506ad66b35fe7d76132ae97465da2/index.ts#L502-L541 + // TODO: check the scalar is less than group order? + // wNAF behavior is undefined otherwise. But have to carefully remove + // other checks before wNAF. ORDER == bits here. + // Accumulators + let p = c.ZERO; + let f = c.BASE; + // This code was first written with assumption that 'f' and 'p' will never be infinity point: + // since each addition is multiplied by 2 ** W, it cannot cancel each other. However, + // there is negate now: it is possible that negated element from low value + // would be the same as high element, which will create carry into next window. + // It's not obvious how this can fail, but still worth investigating later. + const wo = calcWOpts(W, bits); + for (let window = 0; window < wo.windows; window++) { + // (n === _0n) is handled and not early-exited. isEven and offsetF are used for noise + const { nextN, offset, isZero, isNeg, isNegF, offsetF } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // bits are 0: add garbage to fake point + // Important part for const-time getPublicKey: add random "noise" point to f. + f = f.add(constTimeNegate(isNegF, precomputes[offsetF])); + } + else { + // bits are 1: add to result point + p = p.add(constTimeNegate(isNeg, precomputes[offset])); + } + } + // Return both real and fake points: JIT won't eliminate f. + // At this point there is a way to F be infinity-point even if p is not, + // which makes it less const-time: around 1 bigint multiply. + return { p, f }; + }, + /** + * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form. + * @param W window size + * @param precomputes precomputed tables + * @param n scalar (we don't check here, but should be less than curve order) + * @param acc accumulator point to add result of multiplication + * @returns point + */ + wNAFUnsafe(W, precomputes, n, acc = c.ZERO) { + const wo = calcWOpts(W, bits); + for (let window = 0; window < wo.windows; window++) { + if (n === _0n) + break; // Early-exit, skip 0 value + const { nextN, offset, isZero, isNeg } = calcOffsets(n, window, wo); + n = nextN; + if (isZero) { + // Window bits are 0: skip processing. + // Move to next window. + continue; + } + else { + const item = precomputes[offset]; + acc = acc.add(isNeg ? item.negate() : item); // Re-using acc allows to save adds in MSM + } + } + return acc; + }, + getPrecomputes(W, P, transform) { + // Calculate precomputes on a first run, reuse them after + let comp = pointPrecomputes.get(P); + if (!comp) { + comp = this.precomputeWindow(P, W); + if (W !== 1) + pointPrecomputes.set(P, transform(comp)); + } + return comp; + }, + wNAFCached(P, n, transform) { + const W = getW(P); + return this.wNAF(W, this.getPrecomputes(W, P, transform), n); + }, + wNAFCachedUnsafe(P, n, transform, prev) { + const W = getW(P); + if (W === 1) + return this.unsafeLadder(P, n, prev); // For W=1 ladder is ~x2 faster + return this.wNAFUnsafe(W, this.getPrecomputes(W, P, transform), n, prev); + }, + // We calculate precomputes for elliptic curve point multiplication + // using windowed method. This specifies window size and + // stores precomputed values. Usually only base point would be precomputed. + setWindowSize(P, W) { + validateW(W, bits); + pointWindowSizes.set(P, W); + pointPrecomputes.delete(P); + }, + }; +} +/** + * Pippenger algorithm for multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * 30x faster vs naive addition on L=4096, 10x faster than precomputes. + * For N=254bit, L=1, it does: 1024 ADD + 254 DBL. For L=5: 1536 ADD + 254 DBL. + * Algorithmically constant-time (for same L), even when 1 point + scalar, or when scalar = 0. + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @param scalars array of L scalars (aka private keys / bigints) + */ +function pippenger(c, fieldN, points, scalars) { + // If we split scalars by some window (let's say 8 bits), every chunk will only + // take 256 buckets even if there are 4096 scalars, also re-uses double. + // TODO: + // - https://eprint.iacr.org/2024/750.pdf + // - https://tches.iacr.org/index.php/TCHES/article/view/10287 + // 0 is accepted in scalars + validateMSMPoints(points, c); + validateMSMScalars(scalars, fieldN); + const plength = points.length; + const slength = scalars.length; + if (plength !== slength) + throw new Error('arrays of points and scalars must have equal length'); + // if (plength === 0) throw new Error('array must be of length >= 2'); + const zero = c.ZERO; + const wbits = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitLen)(BigInt(plength)); + let windowSize = 1; // bits + if (wbits > 12) + windowSize = wbits - 3; + else if (wbits > 4) + windowSize = wbits - 2; + else if (wbits > 0) + windowSize = 2; + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(windowSize); + const buckets = new Array(Number(MASK) + 1).fill(zero); // +1 for zero array + const lastBits = Math.floor((fieldN.BITS - 1) / windowSize) * windowSize; + let sum = zero; + for (let i = lastBits; i >= 0; i -= windowSize) { + buckets.fill(zero); + for (let j = 0; j < slength; j++) { + const scalar = scalars[j]; + const wbits = Number((scalar >> BigInt(i)) & MASK); + buckets[wbits] = buckets[wbits].add(points[j]); + } + let resI = zero; // not using this will do small speed-up, but will lose ct + // Skip first bucket, because it is zero + for (let j = buckets.length - 1, sumI = zero; j > 0; j--) { + sumI = sumI.add(buckets[j]); + resI = resI.add(sumI); + } + sum = sum.add(resI); + if (i !== 0) + for (let j = 0; j < windowSize; j++) + sum = sum.double(); + } + return sum; +} +/** + * Precomputed multi-scalar multiplication (MSM, Pa + Qb + Rc + ...). + * @param c Curve Point constructor + * @param fieldN field over CURVE.N - important that it's not over CURVE.P + * @param points array of L curve points + * @returns function which multiplies points with scaars + */ +function precomputeMSMUnsafe(c, fieldN, points, windowSize) { + /** + * Performance Analysis of Window-based Precomputation + * + * Base Case (256-bit scalar, 8-bit window): + * - Standard precomputation requires: + * - 31 additions per scalar × 256 scalars = 7,936 ops + * - Plus 255 summary additions = 8,191 total ops + * Note: Summary additions can be optimized via accumulator + * + * Chunked Precomputation Analysis: + * - Using 32 chunks requires: + * - 255 additions per chunk + * - 256 doublings + * - Total: (255 × 32) + 256 = 8,416 ops + * + * Memory Usage Comparison: + * Window Size | Standard Points | Chunked Points + * ------------|-----------------|--------------- + * 4-bit | 520 | 15 + * 8-bit | 4,224 | 255 + * 10-bit | 13,824 | 1,023 + * 16-bit | 557,056 | 65,535 + * + * Key Advantages: + * 1. Enables larger window sizes due to reduced memory overhead + * 2. More efficient for smaller scalar counts: + * - 16 chunks: (16 × 255) + 256 = 4,336 ops + * - ~2x faster than standard 8,191 ops + * + * Limitations: + * - Not suitable for plain precomputes (requires 256 constant doublings) + * - Performance degrades with larger scalar counts: + * - Optimal for ~256 scalars + * - Less efficient for 4096+ scalars (Pippenger preferred) + */ + validateW(windowSize, fieldN.BITS); + validateMSMPoints(points, c); + const zero = c.ZERO; + const tableSize = 2 ** windowSize - 1; // table size (without zero) + const chunks = Math.ceil(fieldN.BITS / windowSize); // chunks of item + const MASK = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(windowSize); + const tables = points.map((p) => { + const res = []; + for (let i = 0, acc = p; i < tableSize; i++) { + res.push(acc); + acc = acc.add(p); + } + return res; + }); + return (scalars) => { + validateMSMScalars(scalars, fieldN); + if (scalars.length > points.length) + throw new Error('array of scalars must be smaller than array of points'); + let res = zero; + for (let i = 0; i < chunks; i++) { + // No need to double if accumulator is still zero. + if (res !== zero) + for (let j = 0; j < windowSize; j++) + res = res.double(); + const shiftBy = BigInt(chunks * windowSize - (i + 1) * windowSize); + for (let j = 0; j < scalars.length; j++) { + const n = scalars[j]; + const curr = Number((n >> shiftBy) & MASK); + if (!curr) + continue; // skip zero scalars chunks + res = res.add(tables[j][curr - 1]); + } + } + return res; + }; +} +function validateBasic(curve) { + (0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.validateField)(curve.Fp); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(curve, { + n: 'bigint', + h: 'bigint', + Gx: 'field', + Gy: 'field', + }, { + nBitLength: 'isSafeInteger', + nByteLength: 'isSafeInteger', + }); + // Set defaults + return Object.freeze({ + ...(0,_modular_js__WEBPACK_IMPORTED_MODULE_0__.nLength)(curve.n, curve.nBitLength), + ...curve, + ...{ p: curve.Fp.ORDER }, + }); +} +//# sourceMappingURL=curve.js.map + +/***/ }), + +/***/ 48164: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/browser.js ***! + \*****************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var ciphers = __webpack_require__(/*! ./encrypter */ 15862) +var deciphers = __webpack_require__(/*! ./decrypter */ 42574) +var modes = __webpack_require__(/*! ./modes/list.json */ 71724) + +function getCiphers () { + return Object.keys(modes) +} + +exports.createCipher = exports.Cipher = ciphers.createCipher +exports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv +exports.createDecipher = exports.Decipher = deciphers.createDecipher +exports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv +exports.listCiphers = exports.getCiphers = getCiphers + + +/***/ }), + +/***/ 48201: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/diffie-hellman@5.0.3/node_modules/diffie-hellman/lib/generatePrime.js ***! + \***************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var randomBytes = __webpack_require__(/*! randombytes */ 8546); +module.exports = findPrime; +findPrime.simpleSieve = simpleSieve; +findPrime.fermatTest = fermatTest; +var BN = __webpack_require__(/*! bn.js */ 27019); +var TWENTYFOUR = new BN(24); +var MillerRabin = __webpack_require__(/*! miller-rabin */ 32275); +var millerRabin = new MillerRabin(); +var ONE = new BN(1); +var TWO = new BN(2); +var FIVE = new BN(5); +var SIXTEEN = new BN(16); +var EIGHT = new BN(8); +var TEN = new BN(10); +var THREE = new BN(3); +var SEVEN = new BN(7); +var ELEVEN = new BN(11); +var FOUR = new BN(4); +var TWELVE = new BN(12); +var primes = null; + +function _getPrimes() { + if (primes !== null) + return primes; + + var limit = 0x100000; + var res = []; + res[0] = 2; + for (var i = 1, k = 3; k < limit; k += 2) { + var sqrt = Math.ceil(Math.sqrt(k)); + for (var j = 0; j < i && res[j] <= sqrt; j++) + if (k % res[j] === 0) + break; + + if (i !== j && res[j] <= sqrt) + continue; + + res[i++] = k; + } + primes = res; + return res; +} + +function simpleSieve(p) { + var primes = _getPrimes(); + + for (var i = 0; i < primes.length; i++) + if (p.modn(primes[i]) === 0) { + if (p.cmpn(primes[i]) === 0) { + return true; + } else { + return false; + } + } + + return true; +} + +function fermatTest(p) { + var red = BN.mont(p); + return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0; +} + +function findPrime(bits, gen) { + if (bits < 16) { + // this is what openssl does + if (gen === 2 || gen === 5) { + return new BN([0x8c, 0x7b]); + } else { + return new BN([0x8c, 0x27]); + } + } + gen = new BN(gen); + + var num, n2; + + while (true) { + num = new BN(randomBytes(Math.ceil(bits / 8))); + while (num.bitLength() > bits) { + num.ishrn(1); + } + if (num.isEven()) { + num.iadd(ONE); + } + if (!num.testn(1)) { + num.iadd(TWO); + } + if (!gen.cmp(TWO)) { + while (num.mod(TWENTYFOUR).cmp(ELEVEN)) { + num.iadd(FOUR); + } + } else if (!gen.cmp(FIVE)) { + while (num.mod(TEN).cmp(THREE)) { + num.iadd(FOUR); + } + } + n2 = num.shrn(1); + if (simpleSieve(n2) && simpleSieve(num) && + fermatTest(n2) && fermatTest(num) && + millerRabin.test(n2) && millerRabin.test(num)) { + return num; + } + } + +} + + +/***/ }), + +/***/ 48319: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/secp256k1.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve), +/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve), +/* harmony export */ schnorr: () => (/* binding */ schnorr), +/* harmony export */ secp256k1: () => (/* binding */ secp256k1), +/* harmony export */ secp256k1_hasher: () => (/* binding */ secp256k1_hasher) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha2.js */ 19745); +/* harmony import */ var _noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 29964); +/* harmony import */ var _shortw_utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./_shortw_utils.js */ 31179); +/* harmony import */ var _abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./abstract/hash-to-curve.js */ 89546); +/* harmony import */ var _abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./abstract/modular.js */ 35072); +/* harmony import */ var _abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./abstract/weierstrass.js */ 94510); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils.js */ 74430); +/** + * SECG secp256k1. See [pdf](https://www.secg.org/sec2-v2.pdf). + * + * Belongs to Koblitz curves: it has efficiently-computable GLV endomorphism ψ, + * check out {@link EndomorphismOpts}. Seems to be rigid (not backdoored). + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + + + + + + +// Seems like generator was produced from some seed: +// `Point.BASE.multiply(Point.Fn.inv(2n, N)).toAffine().x` +// // gives short x 0x3b78ce563f89a0ed9414f5aa28ad0d96d6795f9c63n +const secp256k1_CURVE = { + p: BigInt('0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f'), + n: BigInt('0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141'), + h: BigInt(1), + a: BigInt(0), + b: BigInt(7), + Gx: BigInt('0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798'), + Gy: BigInt('0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8'), +}; +const secp256k1_ENDO = { + beta: BigInt('0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee'), + basises: [ + [BigInt('0x3086d221a7d46bcde86c90e49284eb15'), -BigInt('0xe4437ed6010e88286f547fa90abfe4c3')], + [BigInt('0x114ca50f7a8e2f3f657c1108d9d44cfd8'), BigInt('0x3086d221a7d46bcde86c90e49284eb15')], + ], +}; +const _0n = /* @__PURE__ */ BigInt(0); +const _1n = /* @__PURE__ */ BigInt(1); +const _2n = /* @__PURE__ */ BigInt(2); +/** + * √n = n^((p+1)/4) for fields p = 3 mod 4. We unwrap the loop and multiply bit-by-bit. + * (P+1n/4n).toString(2) would produce bits [223x 1, 0, 22x 1, 4x 0, 11, 00] + */ +function sqrtMod(y) { + const P = secp256k1_CURVE.p; + // prettier-ignore + const _3n = BigInt(3), _6n = BigInt(6), _11n = BigInt(11), _22n = BigInt(22); + // prettier-ignore + const _23n = BigInt(23), _44n = BigInt(44), _88n = BigInt(88); + const b2 = (y * y * y) % P; // x^3, 11 + const b3 = (b2 * b2 * y) % P; // x^7 + const b6 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b3, _3n, P) * b3) % P; + const b9 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b6, _3n, P) * b3) % P; + const b11 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b9, _2n, P) * b2) % P; + const b22 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b11, _11n, P) * b11) % P; + const b44 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b22, _22n, P) * b22) % P; + const b88 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b44, _44n, P) * b44) % P; + const b176 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b88, _88n, P) * b88) % P; + const b220 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b176, _44n, P) * b44) % P; + const b223 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b220, _3n, P) * b3) % P; + const t1 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(b223, _23n, P) * b22) % P; + const t2 = ((0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(t1, _6n, P) * b2) % P; + const root = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.pow2)(t2, _2n, P); + if (!Fpk1.eql(Fpk1.sqr(root), y)) + throw new Error('Cannot find square root'); + return root; +} +const Fpk1 = (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.Field)(secp256k1_CURVE.p, { sqrt: sqrtMod }); +/** + * secp256k1 curve, ECDSA and ECDH methods. + * + * Field: `2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n` + * + * @example + * ```js + * import { secp256k1 } from '@noble/curves/secp256k1'; + * const { secretKey, publicKey } = secp256k1.keygen(); + * const msg = new TextEncoder().encode('hello'); + * const sig = secp256k1.sign(msg, secretKey); + * const isValid = secp256k1.verify(sig, msg, publicKey) === true; + * ``` + */ +const secp256k1 = (0,_shortw_utils_js__WEBPACK_IMPORTED_MODULE_2__.createCurve)({ ...secp256k1_CURVE, Fp: Fpk1, lowS: true, endo: secp256k1_ENDO }, _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha256); +// Schnorr signatures are superior to ECDSA from above. Below is Schnorr-specific BIP0340 code. +// https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki +/** An object mapping tags to their tagged hash prefix of [SHA256(tag) | SHA256(tag)] */ +const TAGGED_HASH_PREFIXES = {}; +function taggedHash(tag, ...messages) { + let tagP = TAGGED_HASH_PREFIXES[tag]; + if (tagP === undefined) { + const tagH = (0,_noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha256)((0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.utf8ToBytes)(tag)); + tagP = (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(tagH, tagH); + TAGGED_HASH_PREFIXES[tag] = tagP; + } + return (0,_noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha256)((0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.concatBytes)(tagP, ...messages)); +} +// ECDSA compact points are 33-byte. Schnorr is 32: we strip first byte 0x02 or 0x03 +const pointToBytes = (point) => point.toBytes(true).slice(1); +const Pointk1 = /* @__PURE__ */ (() => secp256k1.Point)(); +const hasEven = (y) => y % _2n === _0n; +// Calculate point, scalar and bytes +function schnorrGetExtPubKey(priv) { + const { Fn, BASE } = Pointk1; + const d_ = (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_5__._normFnElement)(Fn, priv); + const p = BASE.multiply(d_); // P = d'⋅G; 0 < d' < n check is done inside + const scalar = hasEven(p.y) ? d_ : Fn.neg(d_); + return { scalar, bytes: pointToBytes(p) }; +} +/** + * lift_x from BIP340. Convert 32-byte x coordinate to elliptic curve point. + * @returns valid point checked for being on-curve + */ +function lift_x(x) { + const Fp = Fpk1; + if (!Fp.isValidNot0(x)) + throw new Error('invalid x: Fail if x ≥ p'); + const xx = Fp.create(x * x); + const c = Fp.create(xx * x + BigInt(7)); // Let c = x³ + 7 mod p. + let y = Fp.sqrt(c); // Let y = c^(p+1)/4 mod p. Same as sqrt(). + // Return the unique point P such that x(P) = x and + // y(P) = y if y mod 2 = 0 or y(P) = p-y otherwise. + if (!hasEven(y)) + y = Fp.neg(y); + const p = Pointk1.fromAffine({ x, y }); + p.assertValidity(); + return p; +} +const num = _utils_js__WEBPACK_IMPORTED_MODULE_6__.bytesToNumberBE; +/** + * Create tagged hash, convert it to bigint, reduce modulo-n. + */ +function challenge(...args) { + return Pointk1.Fn.create(num(taggedHash('BIP0340/challenge', ...args))); +} +/** + * Schnorr public key is just `x` coordinate of Point as per BIP340. + */ +function schnorrGetPublicKey(secretKey) { + return schnorrGetExtPubKey(secretKey).bytes; // d'=int(sk). Fail if d'=0 or d'≥n. Ret bytes(d'⋅G) +} +/** + * Creates Schnorr signature as per BIP340. Verifies itself before returning anything. + * auxRand is optional and is not the sole source of k generation: bad CSPRNG won't be dangerous. + */ +function schnorrSign(message, secretKey, auxRand = (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(32)) { + const { Fn } = Pointk1; + const m = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('message', message); + const { bytes: px, scalar: d } = schnorrGetExtPubKey(secretKey); // checks for isWithinCurveOrder + const a = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('auxRand', auxRand, 32); // Auxiliary random data a: a 32-byte array + const t = Fn.toBytes(d ^ num(taggedHash('BIP0340/aux', a))); // Let t be the byte-wise xor of bytes(d) and hash/aux(a) + const rand = taggedHash('BIP0340/nonce', t, px, m); // Let rand = hash/nonce(t || bytes(P) || m) + // Let k' = int(rand) mod n. Fail if k' = 0. Let R = k'⋅G + const { bytes: rx, scalar: k } = schnorrGetExtPubKey(rand); + const e = challenge(rx, px, m); // Let e = int(hash/challenge(bytes(R) || bytes(P) || m)) mod n. + const sig = new Uint8Array(64); // Let sig = bytes(R) || bytes((k + ed) mod n). + sig.set(rx, 0); + sig.set(Fn.toBytes(Fn.create(k + e * d)), 32); + // If Verify(bytes(P), m, sig) (see below) returns failure, abort + if (!schnorrVerify(sig, m, px)) + throw new Error('sign: Invalid signature produced'); + return sig; +} +/** + * Verifies Schnorr signature. + * Will swallow errors & return false except for initial type validation of arguments. + */ +function schnorrVerify(signature, message, publicKey) { + const { Fn, BASE } = Pointk1; + const sig = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('signature', signature, 64); + const m = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('message', message); + const pub = (0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.ensureBytes)('publicKey', publicKey, 32); + try { + const P = lift_x(num(pub)); // P = lift_x(int(pk)); fail if that fails + const r = num(sig.subarray(0, 32)); // Let r = int(sig[0:32]); fail if r ≥ p. + if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.inRange)(r, _1n, secp256k1_CURVE.p)) + return false; + const s = num(sig.subarray(32, 64)); // Let s = int(sig[32:64]); fail if s ≥ n. + if (!(0,_utils_js__WEBPACK_IMPORTED_MODULE_6__.inRange)(s, _1n, secp256k1_CURVE.n)) + return false; + // int(challenge(bytes(r)||bytes(P)||m))%n + const e = challenge(Fn.toBytes(r), pointToBytes(P), m); + // R = s⋅G - e⋅P, where -eP == (n-e)P + const R = BASE.multiplyUnsafe(s).add(P.multiplyUnsafe(Fn.neg(e))); + const { x, y } = R.toAffine(); + // Fail if is_infinite(R) / not has_even_y(R) / x(R) ≠ r. + if (R.is0() || !hasEven(y) || x !== r) + return false; + return true; + } + catch (error) { + return false; + } +} +/** + * Schnorr signatures over secp256k1. + * https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki + * @example + * ```js + * import { schnorr } from '@noble/curves/secp256k1'; + * const { secretKey, publicKey } = schnorr.keygen(); + * // const publicKey = schnorr.getPublicKey(secretKey); + * const msg = new TextEncoder().encode('hello'); + * const sig = schnorr.sign(msg, secretKey); + * const isValid = schnorr.verify(sig, msg, publicKey); + * ``` + */ +const schnorr = /* @__PURE__ */ (() => { + const size = 32; + const seedLength = 48; + const randomSecretKey = (seed = (0,_noble_hashes_utils_js__WEBPACK_IMPORTED_MODULE_1__.randomBytes)(seedLength)) => { + return (0,_abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mapHashToField)(seed, secp256k1_CURVE.n); + }; + // TODO: remove + secp256k1.utils.randomSecretKey; + function keygen(seed) { + const secretKey = randomSecretKey(seed); + return { secretKey, publicKey: schnorrGetPublicKey(secretKey) }; + } + return { + keygen, + getPublicKey: schnorrGetPublicKey, + sign: schnorrSign, + verify: schnorrVerify, + Point: Pointk1, + utils: { + randomSecretKey: randomSecretKey, + randomPrivateKey: randomSecretKey, + taggedHash, + // TODO: remove + lift_x, + pointToBytes, + numberToBytesBE: _utils_js__WEBPACK_IMPORTED_MODULE_6__.numberToBytesBE, + bytesToNumberBE: _utils_js__WEBPACK_IMPORTED_MODULE_6__.bytesToNumberBE, + mod: _abstract_modular_js__WEBPACK_IMPORTED_MODULE_4__.mod, + }, + lengths: { + secretKey: size, + publicKey: size, + publicKeyHasPrefix: false, + signature: size * 2, + seed: seedLength, + }, + }; +})(); +const isoMap = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_3__.isogenyMap)(Fpk1, [ + // xNum + [ + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7', + '0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581', + '0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262', + '0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c', + ], + // xDen + [ + '0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b', + '0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], + // yNum + [ + '0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c', + '0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3', + '0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931', + '0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84', + ], + // yDen + [ + '0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b', + '0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573', + '0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f', + '0x0000000000000000000000000000000000000000000000000000000000000001', // LAST 1 + ], +].map((i) => i.map((j) => BigInt(j)))))(); +const mapSWU = /* @__PURE__ */ (() => (0,_abstract_weierstrass_js__WEBPACK_IMPORTED_MODULE_5__.mapToCurveSimpleSWU)(Fpk1, { + A: BigInt('0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533'), + B: BigInt('1771'), + Z: Fpk1.create(BigInt('-11')), +}))(); +/** Hashing / encoding to secp256k1 points / field. RFC 9380 methods. */ +const secp256k1_hasher = /* @__PURE__ */ (() => (0,_abstract_hash_to_curve_js__WEBPACK_IMPORTED_MODULE_3__.createHasher)(secp256k1.Point, (scalars) => { + const { x, y } = mapSWU(Fpk1.create(scalars[0])); + return isoMap(x, y); +}, { + DST: 'secp256k1_XMD:SHA-256_SSWU_RO_', + encodeDST: 'secp256k1_XMD:SHA-256_SSWU_NU_', + p: Fpk1.ORDER, + m: 1, + k: 128, + expand: 'xmd', + hash: _noble_hashes_sha2_js__WEBPACK_IMPORTED_MODULE_0__.sha256, +}))(); +/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */ +const hashToCurve = /* @__PURE__ */ (() => secp256k1_hasher.hashToCurve)(); +/** @deprecated use `import { secp256k1_hasher } from '@noble/curves/secp256k1.js';` */ +const encodeToCurve = /* @__PURE__ */ (() => secp256k1_hasher.encodeToCurve)(); +//# sourceMappingURL=secp256k1.js.map + +/***/ }), + +/***/ 48385: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/errors.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DecapError: () => (/* binding */ DecapError), +/* harmony export */ DeriveKeyPairError: () => (/* binding */ DeriveKeyPairError), +/* harmony export */ DeserializeError: () => (/* binding */ DeserializeError), +/* harmony export */ EncapError: () => (/* binding */ EncapError), +/* harmony export */ ExportError: () => (/* binding */ ExportError), +/* harmony export */ HpkeError: () => (/* binding */ HpkeError), +/* harmony export */ InvalidParamError: () => (/* binding */ InvalidParamError), +/* harmony export */ MessageLimitReachedError: () => (/* binding */ MessageLimitReachedError), +/* harmony export */ NotSupportedError: () => (/* binding */ NotSupportedError), +/* harmony export */ OpenError: () => (/* binding */ OpenError), +/* harmony export */ SealError: () => (/* binding */ SealError), +/* harmony export */ SerializeError: () => (/* binding */ SerializeError), +/* harmony export */ ValidationError: () => (/* binding */ ValidationError) +/* harmony export */ }); +/** + * The base error class of hpke-js. + * @group Errors + */ +class HpkeError extends Error { + constructor(e) { + let message; + if (e instanceof Error) { + message = e.message; + } + else if (typeof e === "string") { + message = e; + } + else { + message = ""; + } + super(message); + this.name = this.constructor.name; + } +} +/** + * Invalid parameter. + * @group Errors + */ +class InvalidParamError extends HpkeError { +} +/** + * KEM input or output validation failure. + * @group Errors + */ +class ValidationError extends HpkeError { +} +/** + * Public or private key serialization failure. + * @group Errors + */ +class SerializeError extends HpkeError { +} +/** + * Public or private key deserialization failure. + * @group Errors + */ +class DeserializeError extends HpkeError { +} +/** + * encap() failure. + * @group Errors + */ +class EncapError extends HpkeError { +} +/** + * decap() failure. + * @group Errors + */ +class DecapError extends HpkeError { +} +/** + * Secret export failure. + * @group Errors + */ +class ExportError extends HpkeError { +} +/** + * seal() failure. + * @group Errors + */ +class SealError extends HpkeError { +} +/** + * open() failure. + * @group Errors + */ +class OpenError extends HpkeError { +} +/** + * Sequence number overflow on the encryption context. + * @group Errors + */ +class MessageLimitReachedError extends HpkeError { +} +/** + * Key pair derivation failure. + * @group Errors + */ +class DeriveKeyPairError extends HpkeError { +} +/** + * Not supported failure. + * @group Errors + */ +class NotSupportedError extends HpkeError { +} + + +/***/ }), + +/***/ 48413: +/*!*****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/constants/blob.js ***! + \*****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ bytesPerBlob: () => (/* binding */ bytesPerBlob), +/* harmony export */ bytesPerFieldElement: () => (/* binding */ bytesPerFieldElement), +/* harmony export */ fieldElementsPerBlob: () => (/* binding */ fieldElementsPerBlob), +/* harmony export */ maxBytesPerTransaction: () => (/* binding */ maxBytesPerTransaction) +/* harmony export */ }); +// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md#parameters +/** Blob limit per transaction. */ +const blobsPerTransaction = 6; +/** The number of bytes in a BLS scalar field element. */ +const bytesPerFieldElement = 32; +/** The number of field elements in a blob. */ +const fieldElementsPerBlob = 4096; +/** The number of bytes in a blob. */ +const bytesPerBlob = bytesPerFieldElement * fieldElementsPerBlob; +/** Blob bytes limit per transaction. */ +const maxBytesPerTransaction = bytesPerBlob * blobsPerTransaction - + // terminator byte (0x80). + 1 - + // zero byte (0x00) appended to each field element. + 1 * fieldElementsPerBlob * blobsPerTransaction; +//# sourceMappingURL=blob.js.map + +/***/ }), + +/***/ 48610: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/pipeline.js ***! + \*****************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__webpack_require__(/*! ../../../errors */ 31788).codes), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __webpack_require__(/*! ./end-of-stream */ 40874); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ 48975: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/base-x@5.0.1/node_modules/base-x/src/esm/index.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +// base-x encoding / decoding +// Copyright (c) 2018 base-x contributors +// Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp) +// Distributed under the MIT software license, see the accompanying +// file LICENSE or http://www.opensource.org/licenses/mit-license.php. +function base (ALPHABET) { + if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') } + const BASE_MAP = new Uint8Array(256) + for (let j = 0; j < BASE_MAP.length; j++) { + BASE_MAP[j] = 255 + } + for (let i = 0; i < ALPHABET.length; i++) { + const x = ALPHABET.charAt(i) + const xc = x.charCodeAt(0) + if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') } + BASE_MAP[xc] = i + } + const BASE = ALPHABET.length + const LEADER = ALPHABET.charAt(0) + const FACTOR = Math.log(BASE) / Math.log(256) // log(BASE) / log(256), rounded up + const iFACTOR = Math.log(256) / Math.log(BASE) // log(256) / log(BASE), rounded up + function encode (source) { + // eslint-disable-next-line no-empty + if (source instanceof Uint8Array) { } else if (ArrayBuffer.isView(source)) { + source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength) + } else if (Array.isArray(source)) { + source = Uint8Array.from(source) + } + if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') } + if (source.length === 0) { return '' } + // Skip & count leading zeroes. + let zeroes = 0 + let length = 0 + let pbegin = 0 + const pend = source.length + while (pbegin !== pend && source[pbegin] === 0) { + pbegin++ + zeroes++ + } + // Allocate enough space in big-endian base58 representation. + const size = ((pend - pbegin) * iFACTOR + 1) >>> 0 + const b58 = new Uint8Array(size) + // Process the bytes. + while (pbegin !== pend) { + let carry = source[pbegin] + // Apply "b58 = b58 * 256 + ch". + let i = 0 + for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) { + carry += (256 * b58[it1]) >>> 0 + b58[it1] = (carry % BASE) >>> 0 + carry = (carry / BASE) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + pbegin++ + } + // Skip leading zeroes in base58 result. + let it2 = size - length + while (it2 !== size && b58[it2] === 0) { + it2++ + } + // Translate the result into a string. + let str = LEADER.repeat(zeroes) + for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]) } + return str + } + function decodeUnsafe (source) { + if (typeof source !== 'string') { throw new TypeError('Expected String') } + if (source.length === 0) { return new Uint8Array() } + let psz = 0 + // Skip and count leading '1's. + let zeroes = 0 + let length = 0 + while (source[psz] === LEADER) { + zeroes++ + psz++ + } + // Allocate enough space in big-endian base256 representation. + const size = (((source.length - psz) * FACTOR) + 1) >>> 0 // log(58) / log(256), rounded up. + const b256 = new Uint8Array(size) + // Process the characters. + while (psz < source.length) { + // Find code of next character + const charCode = source.charCodeAt(psz) + // Base map can not be indexed using char code + if (charCode > 255) { return } + // Decode character + let carry = BASE_MAP[charCode] + // Invalid character + if (carry === 255) { return } + let i = 0 + for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) { + carry += (BASE * b256[it3]) >>> 0 + b256[it3] = (carry % 256) >>> 0 + carry = (carry / 256) >>> 0 + } + if (carry !== 0) { throw new Error('Non-zero carry') } + length = i + psz++ + } + // Skip leading zeroes in b256. + let it4 = size - length + while (it4 !== size && b256[it4] === 0) { + it4++ + } + const vch = new Uint8Array(zeroes + (size - it4)) + let j = zeroes + while (it4 !== size) { + vch[j++] = b256[it4++] + } + return vch + } + function decode (string) { + const buffer = decodeUnsafe(string) + if (buffer) { return buffer } + throw new Error('Non-base' + BASE + ' character') + } + return { + encode, + decodeUnsafe, + decode + } +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (base); + + +/***/ }), + +/***/ 48986: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/hmac.js ***! + \************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ _HMAC: () => (/* binding */ _HMAC), +/* harmony export */ hmac: () => (/* binding */ hmac) +/* harmony export */ }); +/* harmony import */ var _utils_noble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/noble.js */ 63594); +/* harmony import */ var _hash_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./hash.js */ 31177); +// deno-lint-ignore-file no-explicit-any +/** + * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes). + * + * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-hashes/blob/2e0c00e1aa134082ba1380bf3afb8b1641f60fed/src/hmac.ts + */ +/** + * HMAC: RFC2104 message authentication code. + * @module + */ + + +class _HMAC { + constructor(hash, key) { + Object.defineProperty(this, "oHash", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "iHash", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "blockLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "outputLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "finished", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + Object.defineProperty(this, "destroyed", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + (0,_hash_js__WEBPACK_IMPORTED_MODULE_1__.ahash)(hash); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(key, undefined, "key"); + this.iHash = hash.create(); + if (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 blockLen = this.blockLen; + const pad = new Uint8Array(blockLen); + // blockLen can be bigger than outputLen + pad.set(key.length > blockLen ? hash.create().update(key).digest() : key); + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36; + this.iHash.update(pad); + // By doing update (processing of first block) of outer hash here we can re-use it between multiple calls via clone + this.oHash = hash.create(); + // Undo internal XOR && apply outer XOR + for (let i = 0; i < pad.length; i++) + pad[i] ^= 0x36 ^ 0x5c; + this.oHash.update(pad); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.clean)(pad); + } + update(buf) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + this.iHash.update(buf); + return this; + } + digestInto(out) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(out, this.outputLen, "output"); + this.finished = true; + this.iHash.digestInto(out); + this.oHash.update(out); + this.oHash.digestInto(out); + this.destroy(); + } + digest() { + const out = new Uint8Array(this.oHash.outputLen); + this.digestInto(out); + return out; + } + _cloneInto(to) { + // Create new instance without calling constructor since key already in state and we don't know it. + to ||= Object.create(Object.getPrototypeOf(this), {}); + const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; + to = to; + to.finished = finished; + to.destroyed = destroyed; + to.blockLen = blockLen; + to.outputLen = outputLen; + to.oHash = oHash._cloneInto(to.oHash); + to.iHash = iHash._cloneInto(to.iHash); + return to; + } + clone() { + return this._cloneInto(); + } + destroy() { + this.destroyed = true; + this.oHash.destroy(); + this.iHash.destroy(); + } +} +/** + * HMAC: RFC2104 message authentication code. + * @param hash - function that would be used e.g. sha256 + * @param key - message key + * @param message - message data + * @example + * import { hmac } from '@noble/hashes/hmac'; + * import { sha256 } from '@noble/hashes/sha2'; + * const mac1 = hmac(sha256, 'key', 'message'); + */ +const hmac = (hash, key, message) => new _HMAC(hash, key).update(message).digest(); +hmac.create = (hash, key) => new _HMAC(hash, key); + + +/***/ }), + +/***/ 49230: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/constants/der.js ***! + \*******************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var constants = __webpack_require__(/*! ../constants */ 53953); + +exports.tagClass = { + 0: 'universal', + 1: 'application', + 2: 'context', + 3: 'private' +}; +exports.tagClassByName = constants._reverse(exports.tagClass); + +exports.tag = { + 0x00: 'end', + 0x01: 'bool', + 0x02: 'int', + 0x03: 'bitstr', + 0x04: 'octstr', + 0x05: 'null_', + 0x06: 'objid', + 0x07: 'objDesc', + 0x08: 'external', + 0x09: 'real', + 0x0a: 'enum', + 0x0b: 'embed', + 0x0c: 'utf8str', + 0x0d: 'relativeOid', + 0x10: 'seq', + 0x11: 'set', + 0x12: 'numstr', + 0x13: 'printstr', + 0x14: 't61str', + 0x15: 'videostr', + 0x16: 'ia5str', + 0x17: 'utctime', + 0x18: 'gentime', + 0x19: 'graphstr', + 0x1a: 'iso646str', + 0x1b: 'genstr', + 0x1c: 'unistr', + 0x1d: 'charstr', + 0x1e: 'bmpstr' +}; +exports.tagByName = constants._reverse(exports.tag); + + +/***/ }), + +/***/ 49244: +/*!*****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/constants/unit.js ***! + \*****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ etherUnits: () => (/* binding */ etherUnits), +/* harmony export */ gweiUnits: () => (/* binding */ gweiUnits), +/* harmony export */ weiUnits: () => (/* binding */ weiUnits) +/* harmony export */ }); +const etherUnits = { + gwei: 9, + wei: 18, +}; +const gweiUnits = { + ether: -9, + wei: 9, +}; +const weiUnits = { + ether: -18, + gwei: -9, +}; +//# sourceMappingURL=unit.js.map + +/***/ }), + +/***/ 49451: +/*!*******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/data/slice.js ***! + \*******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ slice: () => (/* binding */ slice), +/* harmony export */ sliceBytes: () => (/* binding */ sliceBytes), +/* harmony export */ sliceHex: () => (/* binding */ sliceHex) +/* harmony export */ }); +/* harmony import */ var _errors_data_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/data.js */ 15866); +/* harmony import */ var _isHex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./isHex.js */ 76816); +/* harmony import */ var _size_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./size.js */ 58036); + + + +/** + * @description Returns a section of the hex or byte array given a start/end bytes offset. + * + * @param value The hex or byte array to slice. + * @param start The start offset (in bytes). + * @param end The end offset (in bytes). + */ +function slice(value, start, end, { strict } = {}) { + if ((0,_isHex_js__WEBPACK_IMPORTED_MODULE_1__.isHex)(value, { strict: false })) + return sliceHex(value, start, end, { + strict, + }); + return sliceBytes(value, start, end, { + strict, + }); +} +function assertStartOffset(value, start) { + if (typeof start === 'number' && start > 0 && start > (0,_size_js__WEBPACK_IMPORTED_MODULE_2__.size)(value) - 1) + throw new _errors_data_js__WEBPACK_IMPORTED_MODULE_0__.SliceOffsetOutOfBoundsError({ + offset: start, + position: 'start', + size: (0,_size_js__WEBPACK_IMPORTED_MODULE_2__.size)(value), + }); +} +function assertEndOffset(value, start, end) { + if (typeof start === 'number' && + typeof end === 'number' && + (0,_size_js__WEBPACK_IMPORTED_MODULE_2__.size)(value) !== end - start) { + throw new _errors_data_js__WEBPACK_IMPORTED_MODULE_0__.SliceOffsetOutOfBoundsError({ + offset: end, + position: 'end', + size: (0,_size_js__WEBPACK_IMPORTED_MODULE_2__.size)(value), + }); + } +} +/** + * @description Returns a section of the byte array given a start/end bytes offset. + * + * @param value The byte array to slice. + * @param start The start offset (in bytes). + * @param end The end offset (in bytes). + */ +function sliceBytes(value_, start, end, { strict } = {}) { + assertStartOffset(value_, start); + const value = value_.slice(start, end); + if (strict) + assertEndOffset(value, start, end); + return value; +} +/** + * @description Returns a section of the hex value given a start/end bytes offset. + * + * @param value The hex value to slice. + * @param start The start offset (in bytes). + * @param end The end offset (in bytes). + */ +function sliceHex(value_, start, end, { strict } = {}) { + assertStartOffset(value_, start); + const value = `0x${value_ + .replace('0x', '') + .slice((start ?? 0) * 2, (end ?? value_.length) * 2)}`; + if (strict) + assertEndOffset(value, start, end); + return value; +} +//# sourceMappingURL=slice.js.map + +/***/ }), + +/***/ 49475: +/*!*******************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.7/node_modules/@noble/curves/esm/abstract/montgomery.js ***! + \*******************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ montgomery: () => (/* binding */ montgomery) +/* harmony export */ }); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils.js */ 74430); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils.js */ 29964); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modular.js */ 35072); +/** + * Montgomery curve methods. It's not really whole montgomery curve, + * just bunch of very specific methods for X25519 / X448 from + * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748) + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +function validateOpts(curve) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__._validateObject)(curve, { + adjustScalarBytes: 'function', + powPminus2: 'function', + }); + return Object.freeze({ ...curve }); +} +function montgomery(curveDef) { + const CURVE = validateOpts(curveDef); + const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE; + const is25519 = type === 'x25519'; + if (!is25519 && type !== 'x448') + throw new Error('invalid type'); + const randomBytes_ = rand || _utils_js__WEBPACK_IMPORTED_MODULE_1__.randomBytes; + const montgomeryBits = is25519 ? 255 : 448; + const fieldLen = is25519 ? 32 : 56; + const Gu = is25519 ? BigInt(9) : BigInt(5); + // RFC 7748 #5: + // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and + // (156326 - 2) / 4 = 39081 for curve448/X448 + // const a = is25519 ? 156326n : 486662n; + const a24 = is25519 ? BigInt(121665) : BigInt(39081); + // RFC: x25519 "the resulting integer is of the form 2^254 plus + // eight times a value between 0 and 2^251 - 1 (inclusive)" + // x448: "2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)" + const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447); + const maxAdded = is25519 + ? BigInt(8) * _2n ** BigInt(251) - _1n + : BigInt(4) * _2n ** BigInt(445) - _1n; + const maxScalar = minScalar + maxAdded + _1n; // (inclusive) + const modP = (n) => (0,_modular_js__WEBPACK_IMPORTED_MODULE_2__.mod)(n, P); + const GuBytes = encodeU(Gu); + function encodeU(u) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.numberToBytesLE)(modP(u), fieldLen); + } + function decodeU(u) { + const _u = (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('u coordinate', u, fieldLen); + // RFC: When receiving such an array, implementations of X25519 + // (but not X448) MUST mask the most significant bit in the final byte. + if (is25519) + _u[31] &= 127; // 0b0111_1111 + // RFC: Implementations MUST accept non-canonical values and process them as + // if they had been reduced modulo the field prime. The non-canonical + // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224 + // - 1 through 2^448 - 1 for X448. + return modP((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(_u)); + } + function decodeScalar(scalar) { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.bytesToNumberLE)(adjustScalarBytes((0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.ensureBytes)('scalar', scalar, fieldLen))); + } + function scalarMult(scalar, u) { + const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar)); + // Some public keys are useless, of low-order. Curve author doesn't think + // it needs to be validated, but we do it nonetheless. + // https://cr.yp.to/ecdh.html#validate + if (pu === _0n) + throw new Error('invalid private or public key received'); + return encodeU(pu); + } + // Computes public key from private. By doing scalar multiplication of base point. + function scalarMultBase(scalar) { + return scalarMult(scalar, GuBytes); + } + // cswap from RFC7748 "example code" + function cswap(swap, x_2, x_3) { + // dummy = mask(swap) AND (x_2 XOR x_3) + // Where mask(swap) is the all-1 or all-0 word of the same length as x_2 + // and x_3, computed, e.g., as mask(swap) = 0 - swap. + const dummy = modP(swap * (x_2 - x_3)); + x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy + x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy + return { x_2, x_3 }; + } + /** + * Montgomery x-only multiplication ladder. + * @param pointU u coordinate (x) on Montgomery Curve 25519 + * @param scalar by which the point would be multiplied + * @returns new Point on Montgomery curve + */ + function montgomeryLadder(u, scalar) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aInRange)('u', u, _0n, P); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_0__.aInRange)('scalar', scalar, minScalar, maxScalar); + const k = scalar; + const x_1 = u; + let x_2 = _1n; + let z_2 = _0n; + let x_3 = u; + let z_3 = _1n; + let swap = _0n; + for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) { + const k_t = (k >> t) & _1n; + swap ^= k_t; + ({ x_2, x_3 } = cswap(swap, x_2, x_3)); + ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); + swap = k_t; + const A = x_2 + z_2; + const AA = modP(A * A); + const B = x_2 - z_2; + const BB = modP(B * B); + const E = AA - BB; + const C = x_3 + z_3; + const D = x_3 - z_3; + const DA = modP(D * A); + const CB = modP(C * B); + const dacb = DA + CB; + const da_cb = DA - CB; + x_3 = modP(dacb * dacb); + z_3 = modP(x_1 * modP(da_cb * da_cb)); + x_2 = modP(AA * BB); + z_2 = modP(E * (AA + modP(a24 * E))); + } + ({ x_2, x_3 } = cswap(swap, x_2, x_3)); + ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3)); + const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent + return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2)) + } + const lengths = { + secretKey: fieldLen, + publicKey: fieldLen, + seed: fieldLen, + }; + const randomSecretKey = (seed = randomBytes_(fieldLen)) => { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(seed, lengths.seed); + return seed; + }; + function keygen(seed) { + const secretKey = randomSecretKey(seed); + return { secretKey, publicKey: scalarMultBase(secretKey) }; + } + const utils = { + randomSecretKey, + randomPrivateKey: randomSecretKey, + }; + return { + keygen, + getSharedSecret: (secretKey, publicKey) => scalarMult(secretKey, publicKey), + getPublicKey: (secretKey) => scalarMultBase(secretKey), + scalarMult, + scalarMultBase, + utils, + GuBytes: GuBytes.slice(), + lengths, + }; +} +//# sourceMappingURL=montgomery.js.map + +/***/ }), + +/***/ 49570: +/*!*******************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/accounts/utils/signTypedData.js ***! + \*******************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ signTypedData: () => (/* binding */ signTypedData) +/* harmony export */ }); +/* harmony import */ var _utils_signature_hashTypedData_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/signature/hashTypedData.js */ 37181); +/* harmony import */ var _sign_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sign.js */ 63564); + + +/** + * @description Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712): + * `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`. + * + * @returns The signature. + */ +async function signTypedData(parameters) { + const { privateKey, ...typedData } = parameters; + return await (0,_sign_js__WEBPACK_IMPORTED_MODULE_1__.sign)({ + hash: (0,_utils_signature_hashTypedData_js__WEBPACK_IMPORTED_MODULE_0__.hashTypedData)(typedData), + privateKey, + to: 'hex', + }); +} +//# sourceMappingURL=signTypedData.js.map + +/***/ }), + +/***/ 49708: +/*!**********************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/utils/log.js ***! + \**********************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ log: () => (/* binding */ log), +/* harmony export */ setLogLevel: () => (/* binding */ setLogLevel) +/* harmony export */ }); +/* harmony import */ var _modules_logger_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/logger/index.js */ 40711); +/* harmony import */ var _modules_logger_index_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_modules_logger_index_js__WEBPACK_IMPORTED_MODULE_0__); + +var name = "webpack-dev-server"; +// default level is set on the client side, so it does not need +// to be set by the CLI or API +var defaultLevel = "info"; + +// options new options, merge with old options +/** + * @param {false | true | "none" | "error" | "warn" | "info" | "log" | "verbose"} level + * @returns {void} + */ +function setLogLevel(level) { + _modules_logger_index_js__WEBPACK_IMPORTED_MODULE_0___default().configureDefaultLogger({ + level: level + }); +} +setLogLevel(defaultLevel); +var log = _modules_logger_index_js__WEBPACK_IMPORTED_MODULE_0___default().getLogger(name); + + +/***/ }), + +/***/ 49745: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/bytes/sequence.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ compare: () => (/* binding */ compare), +/* harmony export */ copy: () => (/* binding */ copy), +/* harmony export */ endsWith: () => (/* binding */ endsWith), +/* harmony export */ includes: () => (/* binding */ includes), +/* harmony export */ indexOf: () => (/* binding */ indexOf), +/* harmony export */ lastIndexOf: () => (/* binding */ lastIndexOf), +/* harmony export */ slice: () => (/* binding */ slice), +/* harmony export */ startsWith: () => (/* binding */ startsWith), +/* harmony export */ tail: () => (/* binding */ tail) +/* harmony export */ }); +/* harmony import */ var _buffer_source_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./buffer-source.js */ 93342); + +function clampIndex(value, fallback, length) { + const normalized = Number.isFinite(value) ? Math.trunc(value) : fallback; + if (normalized <= 0) { + return 0; + } + if (normalized >= length) { + return length; + } + return normalized; +} +function normalizeForwardRange(length, options) { + const start = clampIndex(options?.start, 0, length); + const end = clampIndex(options?.end, length, length); + return end >= start ? [start, end] : [start, start]; +} +function normalizeReverseRange(length, options) { + const start = clampIndex(options?.start, length, length); + const end = clampIndex(options?.end, 0, length); + return start >= end ? [end, start] : [start, start]; +} +function normalizeSliceIndex(value, fallback, length) { + const normalized = Number.isFinite(value) ? Math.trunc(value) : fallback; + if (normalized < 0) { + return Math.max(length + normalized, 0); + } + if (normalized > length) { + return length; + } + return normalized; +} +function encodeAscii(text) { + const bytes = new Uint8Array(text.length); + for (let i = 0; i < text.length; i++) { + bytes[i] = text.charCodeAt(i) & 0xff; + } + return bytes; +} +function encodeUtf8(text) { + return new TextEncoder().encode(text); +} +function toPatternBytes(pattern, options) { + if (typeof pattern === "string") { + return options?.encoding === "utf8" ? encodeUtf8(pattern) : encodeAscii(pattern); + } + return (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(pattern); +} +function bytesEqualAt(data, pattern, offset) { + for (let index = 0; index < pattern.byteLength; index++) { + if (data[offset + index] !== pattern[index]) { + return false; + } + } + return true; +} +function indexOf(data, pattern, options) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const needle = toPatternBytes(pattern, options); + const [start, end] = normalizeForwardRange(bytes.byteLength, options); + if (needle.byteLength === 0) { + return start; + } + const lastOffset = end - needle.byteLength; + if (lastOffset < start) { + return -1; + } + for (let offset = start; offset <= lastOffset; offset++) { + if (bytesEqualAt(bytes, needle, offset)) { + return offset; + } + } + return -1; +} +function lastIndexOf(data, pattern, options) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const needle = toPatternBytes(pattern, options); + const [end, start] = normalizeReverseRange(bytes.byteLength, options); + if (needle.byteLength === 0) { + return start; + } + const firstOffset = start - needle.byteLength; + if (firstOffset < end) { + return -1; + } + for (let offset = firstOffset; offset >= end; offset--) { + if (bytesEqualAt(bytes, needle, offset)) { + return offset; + } + } + return -1; +} +function includes(data, pattern, options) { + return indexOf(data, pattern, options) !== -1; +} +function startsWith(data, pattern, options) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const needle = toPatternBytes(pattern, options); + if (needle.byteLength > bytes.byteLength) { + return false; + } + return bytesEqualAt(bytes, needle, 0); +} +function endsWith(data, pattern, options) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const needle = toPatternBytes(pattern, options); + if (needle.byteLength > bytes.byteLength) { + return false; + } + return bytesEqualAt(bytes, needle, bytes.byteLength - needle.byteLength); +} +function slice(data, start, end) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const normalizedStart = normalizeSliceIndex(start, 0, bytes.byteLength); + const normalizedEnd = normalizeSliceIndex(end, bytes.byteLength, bytes.byteLength); + if (normalizedEnd <= normalizedStart) { + return bytes.subarray(normalizedStart, normalizedStart); + } + return bytes.subarray(normalizedStart, normalizedEnd); +} +function tail(data, length) { + const bytes = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const normalizedLength = Number.isFinite(length) ? Math.max(0, Math.trunc(length)) : 0; + if (normalizedLength >= bytes.byteLength) { + return bytes; + } + return bytes.subarray(bytes.byteLength - normalizedLength); +} +function copy(data) { + return (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8ArrayCopy)(data); +} +function compare(a, b) { + const left = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(a); + const right = (0,_buffer_source_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(b); + const limit = Math.min(left.byteLength, right.byteLength); + for (let index = 0; index < limit; index++) { + if (left[index] < right[index]) { + return -1; + } + if (left[index] > right[index]) { + return 1; + } + } + if (left.byteLength < right.byteLength) { + return -1; + } + if (left.byteLength > right.byteLength) { + return 1; + } + return 0; +} + + +/***/ }), + +/***/ 49780: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/224.js ***! + \************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); +var SHA256 = __webpack_require__(/*! ./256 */ 33953); + +function SHA224() { + if (!(this instanceof SHA224)) + return new SHA224(); + + SHA256.call(this); + this.h = [ + 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, + 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4 ]; +} +utils.inherits(SHA224, SHA256); +module.exports = SHA224; + +SHA224.blockSize = 512; +SHA224.outSize = 224; +SHA224.hmacStrength = 192; +SHA224.padLength = 64; + +SHA224.prototype._digest = function digest(enc) { + // Just truncate output + if (enc === 'hex') + return utils.toHex32(this.h.slice(0, 7), 'big'); + else + return utils.split32(this.h.slice(0, 7), 'big'); +}; + + + +/***/ }), + +/***/ 49893: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/floor.js ***! + \*****************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./floor')} */ +module.exports = Math.floor; + + +/***/ }), + +/***/ 50042: +/*!*************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/encoding/fromRlp.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ fromRlp: () => (/* binding */ fromRlp) +/* harmony export */ }); +/* harmony import */ var _errors_base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/base.js */ 87035); +/* harmony import */ var _errors_encoding_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../errors/encoding.js */ 15923); +/* harmony import */ var _cursor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../cursor.js */ 77820); +/* harmony import */ var _toBytes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toBytes.js */ 58548); +/* harmony import */ var _toHex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toHex.js */ 32786); + + + + + +function fromRlp(value, to = 'hex') { + const bytes = (() => { + if (typeof value === 'string') { + if (value.length > 3 && value.length % 2 !== 0) + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_1__.InvalidHexValueError(value); + return (0,_toBytes_js__WEBPACK_IMPORTED_MODULE_3__.hexToBytes)(value); + } + return value; + })(); + const cursor = (0,_cursor_js__WEBPACK_IMPORTED_MODULE_2__.createCursor)(bytes, { + recursiveReadLimit: Number.POSITIVE_INFINITY, + }); + const result = fromRlpCursor(cursor, to); + return result; +} +function fromRlpCursor(cursor, to = 'hex') { + if (cursor.bytes.length === 0) + return (to === 'hex' ? (0,_toHex_js__WEBPACK_IMPORTED_MODULE_4__.bytesToHex)(cursor.bytes) : cursor.bytes); + const prefix = cursor.readByte(); + if (prefix < 0x80) + cursor.decrementPosition(1); + // bytes + if (prefix < 0xc0) { + const length = readLength(cursor, prefix, 0x80); + const bytes = cursor.readBytes(length); + return (to === 'hex' ? (0,_toHex_js__WEBPACK_IMPORTED_MODULE_4__.bytesToHex)(bytes) : bytes); + } + // list + const length = readLength(cursor, prefix, 0xc0); + return readList(cursor, length, to); +} +function readLength(cursor, prefix, offset) { + if (offset === 0x80 && prefix < 0x80) + return 1; + if (prefix <= offset + 55) + return prefix - offset; + if (prefix === offset + 55 + 1) + return cursor.readUint8(); + if (prefix === offset + 55 + 2) + return cursor.readUint16(); + if (prefix === offset + 55 + 3) + return cursor.readUint24(); + if (prefix === offset + 55 + 4) + return cursor.readUint32(); + throw new _errors_base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError('Invalid RLP prefix'); +} +function readList(cursor, length, to) { + const position = cursor.position; + const value = []; + while (cursor.position - position < length) + value.push(fromRlpCursor(cursor, to)); + return value; +} +//# sourceMappingURL=fromRlp.js.map + +/***/ }), + +/***/ 50079: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemNative.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DhkemP256HkdfSha256Native: () => (/* binding */ DhkemP256HkdfSha256Native), +/* harmony export */ DhkemP384HkdfSha384Native: () => (/* binding */ DhkemP384HkdfSha384Native), +/* harmony export */ DhkemP521HkdfSha512Native: () => (/* binding */ DhkemP521HkdfSha512Native) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); + +class DhkemP256HkdfSha256Native extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Dhkem { + constructor() { + const kdf = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha256Native(); + const prim = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Ec(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP256HkdfSha256, kdf); + super(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP256HkdfSha256, prim, kdf); + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP256HkdfSha256 + }); + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 65 + }); + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 65 + }); + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + } +} +class DhkemP384HkdfSha384Native extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Dhkem { + constructor() { + const kdf = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha384Native(); + const prim = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Ec(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP384HkdfSha384, kdf); + super(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP384HkdfSha384, prim, kdf); + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP384HkdfSha384 + }); + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 48 + }); + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 97 + }); + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 97 + }); + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 48 + }); + } +} +class DhkemP521HkdfSha512Native extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Dhkem { + constructor() { + const kdf = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha512Native(); + const prim = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Ec(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP521HkdfSha512, kdf); + super(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP521HkdfSha512, prim, kdf); + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemP521HkdfSha512 + }); + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 64 + }); + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 133 + }); + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 133 + }); + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 64 + }); + } +} + + +/***/ }), + +/***/ 50275: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/signer_info.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SignerInfo: () => (/* binding */ SignerInfo), +/* harmony export */ SignerInfos: () => (/* binding */ SignerInfos) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _signer_identifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./signer_identifier.js */ 5072); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ 96729); +/* harmony import */ var _attribute_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./attribute.js */ 51496); +var SignerInfos_1; + + + + + +class SignerInfo { + version = _types_js__WEBPACK_IMPORTED_MODULE_3__.CMSVersion.v0; + sid = new _signer_identifier_js__WEBPACK_IMPORTED_MODULE_2__.SignerIdentifier(); + digestAlgorithm = new _types_js__WEBPACK_IMPORTED_MODULE_3__.DigestAlgorithmIdentifier(); + signedAttrs; + signedAttrsRaw; + signatureAlgorithm = new _types_js__WEBPACK_IMPORTED_MODULE_3__.SignatureAlgorithmIdentifier(); + signature = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + unsignedAttrs; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], SignerInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _signer_identifier_js__WEBPACK_IMPORTED_MODULE_2__.SignerIdentifier }) +], SignerInfo.prototype, "sid", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _types_js__WEBPACK_IMPORTED_MODULE_3__.DigestAlgorithmIdentifier }) +], SignerInfo.prototype, "digestAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _attribute_js__WEBPACK_IMPORTED_MODULE_4__.Attribute, + repeated: "set", + context: 0, + implicit: true, + optional: true, + raw: true, + }) +], SignerInfo.prototype, "signedAttrs", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _types_js__WEBPACK_IMPORTED_MODULE_3__.SignatureAlgorithmIdentifier }) +], SignerInfo.prototype, "signatureAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], SignerInfo.prototype, "signature", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _attribute_js__WEBPACK_IMPORTED_MODULE_4__.Attribute, repeated: "set", context: 1, implicit: true, optional: true, + }) +], SignerInfo.prototype, "unsignedAttrs", void 0); +let SignerInfos = SignerInfos_1 = class SignerInfos extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, SignerInfos_1.prototype); + } +}; +SignerInfos = SignerInfos_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set, itemType: SignerInfo, + }) +], SignerInfos); + + + +/***/ }), + +/***/ 50469: +/*!********************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/blob/blobsToCommitments.js ***! + \********************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ blobsToCommitments: () => (/* binding */ blobsToCommitments) +/* harmony export */ }); +/* harmony import */ var _encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encoding/toBytes.js */ 58548); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); + + +/** + * Compute commitments from a list of blobs. + * + * @example + * ```ts + * import { blobsToCommitments, toBlobs } from 'viem' + * import { kzg } from './kzg' + * + * const blobs = toBlobs({ data: '0x1234' }) + * const commitments = blobsToCommitments({ blobs, kzg }) + * ``` + */ +function blobsToCommitments(parameters) { + const { kzg } = parameters; + const to = parameters.to ?? (typeof parameters.blobs[0] === 'string' ? 'hex' : 'bytes'); + const blobs = (typeof parameters.blobs[0] === 'string' + ? parameters.blobs.map((x) => (0,_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_0__.hexToBytes)(x)) + : parameters.blobs); + const commitments = []; + for (const blob of blobs) + commitments.push(Uint8Array.from(kzg.blobToKzgCommitment(blob))); + return (to === 'bytes' + ? commitments + : commitments.map((x) => (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_1__.bytesToHex)(x))); +} +//# sourceMappingURL=blobsToCommitments.js.map + +/***/ }), + +/***/ 50520: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/index.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Lifecycle: () => (/* reexport safe */ _types__WEBPACK_IMPORTED_MODULE_0__.Lifecycle), +/* harmony export */ autoInjectable: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.autoInjectable), +/* harmony export */ container: () => (/* reexport safe */ _dependency_container__WEBPACK_IMPORTED_MODULE_5__.instance), +/* harmony export */ delay: () => (/* reexport safe */ _lazy_helpers__WEBPACK_IMPORTED_MODULE_4__.delay), +/* harmony export */ inject: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.inject), +/* harmony export */ injectAll: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.injectAll), +/* harmony export */ injectAllWithTransform: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.injectAllWithTransform), +/* harmony export */ injectWithTransform: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.injectWithTransform), +/* harmony export */ injectable: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.injectable), +/* harmony export */ instanceCachingFactory: () => (/* reexport safe */ _factories__WEBPACK_IMPORTED_MODULE_2__.instanceCachingFactory), +/* harmony export */ instancePerContainerCachingFactory: () => (/* reexport safe */ _factories__WEBPACK_IMPORTED_MODULE_2__.instancePerContainerCachingFactory), +/* harmony export */ isClassProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_3__.isClassProvider), +/* harmony export */ isFactoryProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_3__.isFactoryProvider), +/* harmony export */ isNormalToken: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_3__.isNormalToken), +/* harmony export */ isTokenProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_3__.isTokenProvider), +/* harmony export */ isValueProvider: () => (/* reexport safe */ _providers__WEBPACK_IMPORTED_MODULE_3__.isValueProvider), +/* harmony export */ predicateAwareClassFactory: () => (/* reexport safe */ _factories__WEBPACK_IMPORTED_MODULE_2__.predicateAwareClassFactory), +/* harmony export */ registry: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.registry), +/* harmony export */ scoped: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.scoped), +/* harmony export */ singleton: () => (/* reexport safe */ _decorators__WEBPACK_IMPORTED_MODULE_1__.singleton) +/* harmony export */ }); +/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types */ 86086); +/* harmony import */ var _decorators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decorators */ 23707); +/* harmony import */ var _factories__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./factories */ 6729); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./providers */ 80893); +/* harmony import */ var _lazy_helpers__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lazy-helpers */ 24568); +/* harmony import */ var _dependency_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./dependency-container */ 62625); +if (typeof Reflect === "undefined" || !Reflect.getMetadata) { + throw new Error("tsyringe requires a reflect polyfill. Please add 'import \"reflect-metadata\"' to the top of your entry point."); +} + + + + + + + + +/***/ }), + +/***/ 50933: +/*!***********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js ***! + \***********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ X448: () => (/* binding */ X448) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); + +const ALG_NAME = "X448"; +// deno-fmt-ignore +const PKCS8_ALG_ID_X448 = new Uint8Array([ + 0x30, 0x46, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06, + 0x03, 0x2b, 0x65, 0x6f, 0x04, 0x3a, 0x04, 0x38, +]); +class X448 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NativeAlgorithm { + constructor(hkdf) { + super(); + Object.defineProperty(this, "_hkdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_alg", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nPk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nSk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nDh", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_pkcs8AlgId", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._alg = { name: ALG_NAME }; + this._hkdf = hkdf; + this._nPk = 56; + this._nSk = 56; + this._nDh = 56; + this._pkcs8AlgId = PKCS8_ALG_ID_X448; + } + async serializePublicKey(key) { + await this._setup(); + try { + return await this._api.exportKey("raw", key); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async deserializePublicKey(key) { + await this._setup(); + try { + return await this._importRawKey(key, true); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async serializePrivateKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + if (!("d" in jwk)) { + throw new Error("Not private key"); + } + return (0,_hpke_common__WEBPACK_IMPORTED_MODULE_0__.base64UrlToBytes)(jwk["d"]).buffer; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async deserializePrivateKey(key) { + await this._setup(); + try { + return await this._importRawKey(key, false); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async importKey(format, key, isPublic) { + await this._setup(); + try { + if (format === "raw") { + return await this._importRawKey(key, isPublic); + } + // jwk + if (key instanceof ArrayBuffer) { + throw new Error("Invalid jwk key format"); + } + return await this._importJWK(key, isPublic); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async generateKeyPair() { + await this._setup(); + try { + return await this._api.generateKey(ALG_NAME, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.NotSupportedError(e); + } + } + async deriveKeyPair(ikm) { + await this._setup(); + try { + const dkpPrk = await this._hkdf.labeledExtract(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.LABEL_DKP_PRK, new Uint8Array(ikm)); + const rawSk = await this._hkdf.labeledExpand(dkpPrk, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.LABEL_SK, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.EMPTY, this._nSk); + const rawSkBytes = new Uint8Array(rawSk); + const sk = await this._deserializePkcs8Key(rawSkBytes); + rawSkBytes.fill(0); + return { + privateKey: sk, + publicKey: await this.derivePublicKey(sk), + }; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeriveKeyPairError(e); + } + } + async derivePublicKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + delete jwk["d"]; + delete jwk["key_ops"]; + return await this._api.importKey("jwk", jwk, this._alg, true, []); + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.DeserializeError(e); + } + } + async dh(sk, pk) { + await this._setup(); + try { + const bits = await this._api.deriveBits({ + name: ALG_NAME, + public: pk, + }, sk, this._nDh * 8); + return bits; + } + catch (e) { + throw new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.SerializeError(e); + } + } + async _importRawKey(key, isPublic) { + if (isPublic && key.byteLength !== this._nPk) { + throw new Error("Invalid public key for the ciphersuite"); + } + if (!isPublic && key.byteLength !== this._nSk) { + throw new Error("Invalid private key for the ciphersuite"); + } + if (isPublic) { + return await this._api.importKey("raw", key, this._alg, true, []); + } + return await this._deserializePkcs8Key(new Uint8Array(key)); + } + async _importJWK(key, isPublic) { + if (typeof key.kty === "undefined" || key.kty !== "OKP") { + throw new Error(`Invalid kty: ${key.crv}`); + } + if (typeof key.crv === "undefined" || key.crv !== ALG_NAME) { + throw new Error(`Invalid crv: ${key.crv}`); + } + if (isPublic) { + if (typeof key.d !== "undefined") { + throw new Error("Invalid key: `d` should not be set"); + } + return await this._api.importKey("jwk", key, this._alg, true, []); + } + if (typeof key.d === "undefined") { + throw new Error("Invalid key: `d` not found"); + } + return await this._api.importKey("jwk", key, this._alg, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } + async _deserializePkcs8Key(k) { + const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length); + pkcs8Key.set(this._pkcs8AlgId, 0); + pkcs8Key.set(k, this._pkcs8AlgId.length); + return await this._api.importKey("pkcs8", pkcs8Key, this._alg, true, _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KEM_USAGES); + } +} + + +/***/ }), + +/***/ 50970: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/randomfill@1.0.4/node_modules/randomfill/browser.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +function oldBrowser () { + throw new Error('secure random number generation not supported by this browser\nuse chrome, FireFox or Internet Explorer 11') +} +var safeBuffer = __webpack_require__(/*! safe-buffer */ 26859) +var randombytes = __webpack_require__(/*! randombytes */ 8546) +var Buffer = safeBuffer.Buffer +var kBufferMaxLength = safeBuffer.kMaxLength +var crypto = __webpack_require__.g.crypto || __webpack_require__.g.msCrypto +var kMaxUint32 = Math.pow(2, 32) - 1 +function assertOffset (offset, length) { + if (typeof offset !== 'number' || offset !== offset) { // eslint-disable-line no-self-compare + throw new TypeError('offset must be a number') + } + + if (offset > kMaxUint32 || offset < 0) { + throw new TypeError('offset must be a uint32') + } + + if (offset > kBufferMaxLength || offset > length) { + throw new RangeError('offset out of range') + } +} + +function assertSize (size, offset, length) { + if (typeof size !== 'number' || size !== size) { // eslint-disable-line no-self-compare + throw new TypeError('size must be a number') + } + + if (size > kMaxUint32 || size < 0) { + throw new TypeError('size must be a uint32') + } + + if (size + offset > length || size > kBufferMaxLength) { + throw new RangeError('buffer too small') + } +} +if ((crypto && crypto.getRandomValues) || !process.browser) { + exports.randomFill = randomFill + exports.randomFillSync = randomFillSync +} else { + exports.randomFill = oldBrowser + exports.randomFillSync = oldBrowser +} +function randomFill (buf, offset, size, cb) { + if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') + } + + if (typeof offset === 'function') { + cb = offset + offset = 0 + size = buf.length + } else if (typeof size === 'function') { + cb = size + size = buf.length - offset + } else if (typeof cb !== 'function') { + throw new TypeError('"cb" argument must be a function') + } + assertOffset(offset, buf.length) + assertSize(size, offset, buf.length) + return actualFill(buf, offset, size, cb) +} + +function actualFill (buf, offset, size, cb) { + if (process.browser) { + var ourBuf = buf.buffer + var uint = new Uint8Array(ourBuf, offset, size) + crypto.getRandomValues(uint) + if (cb) { + process.nextTick(function () { + cb(null, buf) + }) + return + } + return buf + } + if (cb) { + randombytes(size, function (err, bytes) { + if (err) { + return cb(err) + } + bytes.copy(buf, offset) + cb(null, buf) + }) + return + } + var bytes = randombytes(size) + bytes.copy(buf, offset) + return buf +} +function randomFillSync (buf, offset, size) { + if (typeof offset === 'undefined') { + offset = 0 + } + if (!Buffer.isBuffer(buf) && !(buf instanceof __webpack_require__.g.Uint8Array)) { + throw new TypeError('"buf" argument must be a Buffer or Uint8Array') + } + + assertOffset(offset, buf.length) + + if (size === undefined) size = buf.length - offset + + assertSize(size, offset, buf.length) + + return actualFill(buf, offset, size) +} + + +/***/ }), + +/***/ 51141: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/cipher-base@1.0.7/node_modules/cipher-base/index.js ***! + \*********************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var Transform = (__webpack_require__(/*! stream */ 67060).Transform); +var StringDecoder = (__webpack_require__(/*! string_decoder */ 65493).StringDecoder); +var inherits = __webpack_require__(/*! inherits */ 18628); +var toBuffer = __webpack_require__(/*! to-buffer */ 33384); + +function CipherBase(hashMode) { + Transform.call(this); + this.hashMode = typeof hashMode === 'string'; + if (this.hashMode) { + this[hashMode] = this._finalOrDigest; + } else { + this['final'] = this._finalOrDigest; + } + if (this._final) { + this.__final = this._final; + this._final = null; + } + this._decoder = null; + this._encoding = null; +} +inherits(CipherBase, Transform); + +CipherBase.prototype.update = function (data, inputEnc, outputEnc) { + var bufferData = toBuffer(data, inputEnc); // asserts correct input type + var outData = this._update(bufferData); + if (this.hashMode) { + return this; + } + + if (outputEnc) { + outData = this._toString(outData, outputEnc); + } + + return outData; +}; + +CipherBase.prototype.setAutoPadding = function () {}; +CipherBase.prototype.getAuthTag = function () { + throw new Error('trying to get auth tag in unsupported state'); +}; + +CipherBase.prototype.setAuthTag = function () { + throw new Error('trying to set auth tag in unsupported state'); +}; + +CipherBase.prototype.setAAD = function () { + throw new Error('trying to set aad in unsupported state'); +}; + +CipherBase.prototype._transform = function (data, _, next) { + var err; + try { + if (this.hashMode) { + this._update(data); + } else { + this.push(this._update(data)); + } + } catch (e) { + err = e; + } finally { + next(err); + } +}; +CipherBase.prototype._flush = function (done) { + var err; + try { + this.push(this.__final()); + } catch (e) { + err = e; + } + + done(err); +}; +CipherBase.prototype._finalOrDigest = function (outputEnc) { + var outData = this.__final() || Buffer.alloc(0); + if (outputEnc) { + outData = this._toString(outData, outputEnc, true); + } + return outData; +}; + +CipherBase.prototype._toString = function (value, enc, fin) { + if (!this._decoder) { + this._decoder = new StringDecoder(enc); + this._encoding = enc; + } + + if (this._encoding !== enc) { + throw new Error('can’t switch encodings'); + } + + var out = this._decoder.write(value); + if (fin) { + out += this._decoder.end(); + } + + return out; +}; + +module.exports = CipherBase; + + +/***/ }), + +/***/ 51277: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/parse-asn1@5.1.9/node_modules/parse-asn1/certificate.js ***! + \*************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// from https://github.com/Rantanen/node-dtls/blob/25a7dc861bda38cfeac93a723500eea4f0ac2e86/Certificate.js +// thanks to @Rantanen + + + +var asn = __webpack_require__(/*! asn1.js */ 41032); + +var Time = asn.define('Time', function () { + this.choice({ + utcTime: this.utctime(), + generalTime: this.gentime() + }); +}); + +var AttributeTypeValue = asn.define('AttributeTypeValue', function () { + this.seq().obj( + this.key('type').objid(), + this.key('value').any() + ); +}); + +var AlgorithmIdentifier = asn.define('AlgorithmIdentifier', function () { + this.seq().obj( + this.key('algorithm').objid(), + this.key('parameters').optional(), + this.key('curve').objid().optional() + ); +}); + +var SubjectPublicKeyInfo = asn.define('SubjectPublicKeyInfo', function () { + this.seq().obj( + this.key('algorithm').use(AlgorithmIdentifier), + this.key('subjectPublicKey').bitstr() + ); +}); + +var RelativeDistinguishedName = asn.define('RelativeDistinguishedName', function () { + this.setof(AttributeTypeValue); +}); + +var RDNSequence = asn.define('RDNSequence', function () { + this.seqof(RelativeDistinguishedName); +}); + +var Name = asn.define('Name', function () { + this.choice({ + rdnSequence: this.use(RDNSequence) + }); +}); + +var Validity = asn.define('Validity', function () { + this.seq().obj( + this.key('notBefore').use(Time), + this.key('notAfter').use(Time) + ); +}); + +var Extension = asn.define('Extension', function () { + this.seq().obj( + this.key('extnID').objid(), + this.key('critical').bool().def(false), + this.key('extnValue').octstr() + ); +}); + +var TBSCertificate = asn.define('TBSCertificate', function () { + this.seq().obj( + this.key('version').explicit(0)['int']().optional(), + this.key('serialNumber')['int'](), + this.key('signature').use(AlgorithmIdentifier), + this.key('issuer').use(Name), + this.key('validity').use(Validity), + this.key('subject').use(Name), + this.key('subjectPublicKeyInfo').use(SubjectPublicKeyInfo), + this.key('issuerUniqueID').implicit(1).bitstr().optional(), + this.key('subjectUniqueID').implicit(2).bitstr().optional(), + this.key('extensions').explicit(3).seqof(Extension).optional() + ); +}); + +var X509Certificate = asn.define('X509Certificate', function () { + this.seq().obj( + this.key('tbsCertificate').use(TBSCertificate), + this.key('signatureAlgorithm').use(AlgorithmIdentifier), + this.key('signatureValue').bitstr() + ); +}); + +module.exports = X509Certificate; + + +/***/ }), + +/***/ 51496: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/attribute.js ***! + \****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Attribute: () => (/* binding */ Attribute) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + +class Attribute { + attrType = ""; + attrValues = []; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], Attribute.prototype, "attrType", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, repeated: "set", + }) +], Attribute.prototype, "attrValues", void 0); + + +/***/ }), + +/***/ 51527: +/*!*************************************************************************************!*\ + !*** ../node_modules/.pnpm/bs58check@4.0.0/node_modules/bs58check/src/esm/index.js ***! + \*************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/sha256 */ 30318); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./base.js */ 54570); + + + +// SHA256(SHA256(buffer)) +function sha256x2(buffer) { + return (0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_0__.sha256)((0,_noble_hashes_sha256__WEBPACK_IMPORTED_MODULE_0__.sha256)(buffer)); +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((0,_base_js__WEBPACK_IMPORTED_MODULE_1__["default"])(sha256x2)); + + +/***/ }), + +/***/ 51733: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/abstract/modular.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Field: () => (/* binding */ Field), +/* harmony export */ FpDiv: () => (/* binding */ FpDiv), +/* harmony export */ FpInvertBatch: () => (/* binding */ FpInvertBatch), +/* harmony export */ FpIsSquare: () => (/* binding */ FpIsSquare), +/* harmony export */ FpLegendre: () => (/* binding */ FpLegendre), +/* harmony export */ FpPow: () => (/* binding */ FpPow), +/* harmony export */ FpSqrt: () => (/* binding */ FpSqrt), +/* harmony export */ FpSqrtEven: () => (/* binding */ FpSqrtEven), +/* harmony export */ FpSqrtOdd: () => (/* binding */ FpSqrtOdd), +/* harmony export */ getFieldBytesLength: () => (/* binding */ getFieldBytesLength), +/* harmony export */ getMinHashLength: () => (/* binding */ getMinHashLength), +/* harmony export */ hashToPrivateScalar: () => (/* binding */ hashToPrivateScalar), +/* harmony export */ invert: () => (/* binding */ invert), +/* harmony export */ isNegativeLE: () => (/* binding */ isNegativeLE), +/* harmony export */ mapHashToField: () => (/* binding */ mapHashToField), +/* harmony export */ mod: () => (/* binding */ mod), +/* harmony export */ nLength: () => (/* binding */ nLength), +/* harmony export */ pow: () => (/* binding */ pow), +/* harmony export */ pow2: () => (/* binding */ pow2), +/* harmony export */ tonelliShanks: () => (/* binding */ tonelliShanks), +/* harmony export */ validateField: () => (/* binding */ validateField) +/* harmony export */ }); +/* harmony import */ var _noble_hashes_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/hashes/utils */ 29964); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 96926); +/** + * Utils for modular division and finite fields. + * A finite field over 11 is integer number operations `mod 11`. + * There is no division: it is replaced by modular multiplicative inverse. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = /* @__PURE__ */ BigInt(2), _3n = /* @__PURE__ */ BigInt(3); +// prettier-ignore +const _4n = /* @__PURE__ */ BigInt(4), _5n = /* @__PURE__ */ BigInt(5), _8n = /* @__PURE__ */ BigInt(8); +// prettier-ignore +const _9n = /* @__PURE__ */ BigInt(9), _16n = /* @__PURE__ */ BigInt(16); +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _0n ? result : b + result; +} +/** + * Efficiently raise num to power and do modular division. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + * TODO: remove. + * @example + * pow(2n, 6n, 11n) // 64n % 11n == 9n + */ +function pow(num, power, modulo) { + if (power < _0n) + throw new Error('invalid exponent, negatives unsupported'); + if (modulo <= _0n) + throw new Error('invalid modulus'); + if (modulo === _1n) + return _0n; + let res = _1n; + while (power > _0n) { + if (power & _1n) + res = (res * num) % modulo; + num = (num * num) % modulo; + power >>= _1n; + } + return res; +} +/** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */ +function pow2(x, power, modulo) { + let res = x; + while (power-- > _0n) { + res *= res; + res %= modulo; + } + return res; +} +/** + * Inverses number over modulo. + * Implemented using [Euclidean GCD](https://brilliant.org/wiki/extended-euclidean-algorithm/). + */ +function invert(number, modulo) { + if (number === _0n) + throw new Error('invert: expected non-zero number'); + if (modulo <= _0n) + throw new Error('invert: expected positive modulus, got ' + modulo); + // Fermat's little theorem "CT-like" version inv(n) = n^(m-2) mod m is 30x slower. + let a = mod(number, modulo); + let b = modulo; + // prettier-ignore + let x = _0n, y = _1n, u = _1n, v = _0n; + while (a !== _0n) { + // JIT applies optimization if those two lines follow each other + const q = b / a; + const r = b % a; + const m = x - u * q; + const n = y - v * q; + // prettier-ignore + b = a, a = r, x = u, y = v, u = m, v = n; + } + const gcd = b; + if (gcd !== _1n) + throw new Error('invert: does not exist'); + return mod(x, modulo); +} +/** + * Tonelli-Shanks square root search algorithm. + * 1. https://eprint.iacr.org/2012/685.pdf (page 12) + * 2. Square Roots from 1; 24, 51, 10 to Dan Shanks + * @param P field order + * @returns function that takes field Fp (created from P) and number n + */ +function tonelliShanks(P) { + // Do expensive precomputation step + // Step 1: By factoring out powers of 2 from p - 1, + // find q and s such that p-1 == q*(2^s) with q odd + let Q = P - _1n; + let S = 0; + while (Q % _2n === _0n) { + Q /= _2n; + S++; + } + // Step 2: Select a non-square z such that (z | p) ≡ -1 and set c ≡ zq + let Z = _2n; + const _Fp = Field(P); + while (Z < P && FpIsSquare(_Fp, Z)) { + if (Z++ > 1000) + throw new Error('Cannot find square root: probably non-prime P'); + } + // Fast-path + if (S === 1) { + const p1div4 = (P + _1n) / _4n; + return function tonelliFast(Fp, n) { + const root = Fp.pow(n, p1div4); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Slow-path + const Q1div2 = (Q + _1n) / _2n; + return function tonelliSlow(Fp, n) { + // Step 0: Check that n is indeed a square: (n | p) should not be ≡ -1 + if (!FpIsSquare(Fp, n)) + throw new Error('Cannot find square root'); + let r = S; + // TODO: test on Fp2 and others + let g = Fp.pow(Fp.mul(Fp.ONE, Z), Q); // will update both x and b + let x = Fp.pow(n, Q1div2); // first guess at the square root + let b = Fp.pow(n, Q); // first guess at the fudge factor + while (!Fp.eql(b, Fp.ONE)) { + // (4. If t = 0, return r = 0) + // https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm + if (Fp.eql(b, Fp.ZERO)) + return Fp.ZERO; + // Find m such b^(2^m)==1 + let m = 1; + for (let t2 = Fp.sqr(b); m < r; m++) { + if (Fp.eql(t2, Fp.ONE)) + break; + t2 = Fp.sqr(t2); // t2 *= t2 + } + // NOTE: r-m-1 can be bigger than 32, need to convert to bigint before shift, + // otherwise there will be overflow. + const ge = Fp.pow(g, _1n << BigInt(r - m - 1)); // ge = 2^(r-m-1) + g = Fp.sqr(ge); // g = ge * ge + x = Fp.mul(x, ge); // x *= ge + b = Fp.mul(b, g); // b *= g + r = m; + } + return x; + }; +} +/** + * Square root for a finite field. It will try to check if optimizations are applicable and fall back to 4: + * + * 1. P ≡ 3 (mod 4) + * 2. P ≡ 5 (mod 8) + * 3. P ≡ 9 (mod 16) + * 4. Tonelli-Shanks algorithm + * + * Different algorithms can give different roots, it is up to user to decide which one they want. + * For example there is FpSqrtOdd/FpSqrtEven to choice root based on oddness (used for hash-to-curve). + */ +function FpSqrt(P) { + // P ≡ 3 (mod 4) + // √n = n^((P+1)/4) + if (P % _4n === _3n) { + // Not all roots possible! + // const ORDER = + // 0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaabn; + // const NUM = 72057594037927816n; + return function sqrt3mod4(Fp, n) { + const p1div4 = (P + _1n) / _4n; + const root = Fp.pow(n, p1div4); + // Throw if root**2 != n + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // Atkin algorithm for q ≡ 5 (mod 8), https://eprint.iacr.org/2012/685.pdf (page 10) + if (P % _8n === _5n) { + return function sqrt5mod8(Fp, n) { + const n2 = Fp.mul(n, _2n); + const c1 = (P - _5n) / _8n; + const v = Fp.pow(n2, c1); + const nv = Fp.mul(n, v); + const i = Fp.mul(Fp.mul(nv, _2n), v); + const root = Fp.mul(nv, Fp.sub(i, Fp.ONE)); + if (!Fp.eql(Fp.sqr(root), n)) + throw new Error('Cannot find square root'); + return root; + }; + } + // P ≡ 9 (mod 16) + if (P % _16n === _9n) { + // NOTE: tonelli is too slow for bls-Fp2 calculations even on start + // Means we cannot use sqrt for constants at all! + // + // const c1 = Fp.sqrt(Fp.negate(Fp.ONE)); // 1. c1 = sqrt(-1) in F, i.e., (c1^2) == -1 in F + // const c2 = Fp.sqrt(c1); // 2. c2 = sqrt(c1) in F, i.e., (c2^2) == c1 in F + // const c3 = Fp.sqrt(Fp.negate(c1)); // 3. c3 = sqrt(-c1) in F, i.e., (c3^2) == -c1 in F + // const c4 = (P + _7n) / _16n; // 4. c4 = (q + 7) / 16 # Integer arithmetic + // sqrt = (x) => { + // let tv1 = Fp.pow(x, c4); // 1. tv1 = x^c4 + // let tv2 = Fp.mul(c1, tv1); // 2. tv2 = c1 * tv1 + // const tv3 = Fp.mul(c2, tv1); // 3. tv3 = c2 * tv1 + // let tv4 = Fp.mul(c3, tv1); // 4. tv4 = c3 * tv1 + // const e1 = Fp.equals(Fp.square(tv2), x); // 5. e1 = (tv2^2) == x + // const e2 = Fp.equals(Fp.square(tv3), x); // 6. e2 = (tv3^2) == x + // tv1 = Fp.cmov(tv1, tv2, e1); // 7. tv1 = CMOV(tv1, tv2, e1) # Select tv2 if (tv2^2) == x + // tv2 = Fp.cmov(tv4, tv3, e2); // 8. tv2 = CMOV(tv4, tv3, e2) # Select tv3 if (tv3^2) == x + // const e3 = Fp.equals(Fp.square(tv2), x); // 9. e3 = (tv2^2) == x + // return Fp.cmov(tv1, tv2, e3); // 10. z = CMOV(tv1, tv2, e3) # Select the sqrt from tv1 and tv2 + // } + } + // Other cases: Tonelli-Shanks algorithm + return tonelliShanks(P); +} +// Little-endian check for first LE bit (last BE bit); +const isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n) === _1n; +// prettier-ignore +const FIELD_FIELDS = [ + 'create', 'isValid', 'is0', 'neg', 'inv', 'sqrt', 'sqr', + 'eql', 'add', 'sub', 'mul', 'pow', 'div', + 'addN', 'subN', 'mulN', 'sqrN' +]; +function validateField(field) { + const initial = { + ORDER: 'bigint', + MASK: 'bigint', + BYTES: 'isSafeInteger', + BITS: 'isSafeInteger', + }; + const opts = FIELD_FIELDS.reduce((map, val) => { + map[val] = 'function'; + return map; + }, initial); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.validateObject)(field, opts); +} +// Generic field functions +/** + * Same as `pow` but for Fp: non-constant-time. + * Unsafe in some contexts: uses ladder, so can expose bigint bits. + */ +function FpPow(Fp, num, power) { + if (power < _0n) + throw new Error('invalid exponent, negatives unsupported'); + if (power === _0n) + return Fp.ONE; + if (power === _1n) + return num; + // @ts-ignore + let p = Fp.ONE; + let d = num; + while (power > _0n) { + if (power & _1n) + p = Fp.mul(p, d); + d = Fp.sqr(d); + power >>= _1n; + } + return p; +} +/** + * Efficiently invert an array of Field elements. + * Exception-free. Will return `undefined` for 0 elements. + * @param passZero map 0 to 0 (instead of undefined) + */ +function FpInvertBatch(Fp, nums, passZero = false) { + const inverted = new Array(nums.length).fill(passZero ? Fp.ZERO : undefined); + // Walk from first to last, multiply them by each other MOD p + const multipliedAcc = nums.reduce((acc, num, i) => { + if (Fp.is0(num)) + return acc; + inverted[i] = acc; + return Fp.mul(acc, num); + }, Fp.ONE); + // Invert last element + const invertedAcc = Fp.inv(multipliedAcc); + // Walk from last to first, multiply them by inverted each other MOD p + nums.reduceRight((acc, num, i) => { + if (Fp.is0(num)) + return acc; + inverted[i] = Fp.mul(acc, inverted[i]); + return Fp.mul(acc, num); + }, invertedAcc); + return inverted; +} +// TODO: remove +function FpDiv(Fp, lhs, rhs) { + return Fp.mul(lhs, typeof rhs === 'bigint' ? invert(rhs, Fp.ORDER) : Fp.inv(rhs)); +} +/** + * Legendre symbol. + * Legendre constant is used to calculate Legendre symbol (a | p) + * which denotes the value of a^((p-1)/2) (mod p).. + * + * * (a | p) ≡ 1 if a is a square (mod p), quadratic residue + * * (a | p) ≡ -1 if a is not a square (mod p), quadratic non residue + * * (a | p) ≡ 0 if a ≡ 0 (mod p) + */ +function FpLegendre(Fp, n) { + const legc = (Fp.ORDER - _1n) / _2n; + const powered = Fp.pow(n, legc); + const yes = Fp.eql(powered, Fp.ONE); + const zero = Fp.eql(powered, Fp.ZERO); + const no = Fp.eql(powered, Fp.neg(Fp.ONE)); + if (!yes && !zero && !no) + throw new Error('Cannot find square root: probably non-prime P'); + return yes ? 1 : zero ? 0 : -1; +} +// This function returns True whenever the value x is a square in the field F. +function FpIsSquare(Fp, n) { + const l = FpLegendre(Fp, n); + return l === 0 || l === 1; +} +// CURVE.n lengths +function nLength(n, nBitLength) { + // Bit size, byte size of CURVE.n + if (nBitLength !== undefined) + (0,_noble_hashes_utils__WEBPACK_IMPORTED_MODULE_0__.anumber)(nBitLength); + const _nBitLength = nBitLength !== undefined ? nBitLength : n.toString(2).length; + const nByteLength = Math.ceil(_nBitLength / 8); + return { nBitLength: _nBitLength, nByteLength }; +} +/** + * Initializes a finite field over prime. + * Major performance optimizations: + * * a) denormalized operations like mulN instead of mul + * * b) same object shape: never add or remove keys + * * c) Object.freeze + * Fragile: always run a benchmark on a change. + * Security note: operations don't check 'isValid' for all elements for performance reasons, + * it is caller responsibility to check this. + * This is low-level code, please make sure you know what you're doing. + * @param ORDER prime positive bigint + * @param bitLen how many bits the field consumes + * @param isLE (def: false) if encoding / decoding should be in little-endian + * @param redef optional faster redefinitions of sqrt and other methods + */ +function Field(ORDER, bitLen, isLE = false, redef = {}) { + if (ORDER <= _0n) + throw new Error('invalid field: expected ORDER > 0, got ' + ORDER); + const { nBitLength: BITS, nByteLength: BYTES } = nLength(ORDER, bitLen); + if (BYTES > 2048) + throw new Error('invalid field: expected ORDER of <= 2048 bytes'); + let sqrtP; // cached sqrtP + const f = Object.freeze({ + ORDER, + isLE, + BITS, + BYTES, + MASK: (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bitMask)(BITS), + ZERO: _0n, + ONE: _1n, + create: (num) => mod(num, ORDER), + isValid: (num) => { + if (typeof num !== 'bigint') + throw new Error('invalid field element: expected bigint, got ' + typeof num); + return _0n <= num && num < ORDER; // 0 is valid element, but it's not invertible + }, + is0: (num) => num === _0n, + isOdd: (num) => (num & _1n) === _1n, + neg: (num) => mod(-num, ORDER), + eql: (lhs, rhs) => lhs === rhs, + sqr: (num) => mod(num * num, ORDER), + add: (lhs, rhs) => mod(lhs + rhs, ORDER), + sub: (lhs, rhs) => mod(lhs - rhs, ORDER), + mul: (lhs, rhs) => mod(lhs * rhs, ORDER), + pow: (num, power) => FpPow(f, num, power), + div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), + // Same as above, but doesn't normalize + sqrN: (num) => num * num, + addN: (lhs, rhs) => lhs + rhs, + subN: (lhs, rhs) => lhs - rhs, + mulN: (lhs, rhs) => lhs * rhs, + inv: (num) => invert(num, ORDER), + sqrt: redef.sqrt || + ((n) => { + if (!sqrtP) + sqrtP = FpSqrt(ORDER); + return sqrtP(f, n); + }), + toBytes: (num) => (isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE)(num, BYTES) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesBE)(num, BYTES)), + fromBytes: (bytes) => { + if (bytes.length !== BYTES) + throw new Error('Field.fromBytes: expected ' + BYTES + ' bytes, got ' + bytes.length); + return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE)(bytes) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE)(bytes); + }, + // TODO: we don't need it here, move out to separate fn + invertBatch: (lst) => FpInvertBatch(f, lst), + // We can't move this out because Fp6, Fp12 implement it + // and it's unclear what to return in there. + cmov: (a, b, c) => (c ? b : a), + }); + return Object.freeze(f); +} +function FpSqrtOdd(Fp, elm) { + if (!Fp.isOdd) + throw new Error("Field doesn't have isOdd"); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? root : Fp.neg(root); +} +function FpSqrtEven(Fp, elm) { + if (!Fp.isOdd) + throw new Error("Field doesn't have isOdd"); + const root = Fp.sqrt(elm); + return Fp.isOdd(root) ? Fp.neg(root) : root; +} +/** + * "Constant-time" private key generation utility. + * Same as mapKeyToField, but accepts less bytes (40 instead of 48 for 32-byte field). + * Which makes it slightly more biased, less secure. + * @deprecated use `mapKeyToField` instead + */ +function hashToPrivateScalar(hash, groupOrder, isLE = false) { + hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ensureBytes)('privateHash', hash); + const hashLen = hash.length; + const minLen = nLength(groupOrder).nByteLength + 8; + if (minLen < 24 || hashLen < minLen || hashLen > 1024) + throw new Error('hashToPrivateScalar: expected ' + minLen + '-1024 bytes of input, got ' + hashLen); + const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE)(hash) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE)(hash); + return mod(num, groupOrder - _1n) + _1n; +} +/** + * Returns total number of bytes consumed by the field element. + * For example, 32 bytes for usual 256-bit weierstrass curve. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of field + */ +function getFieldBytesLength(fieldOrder) { + if (typeof fieldOrder !== 'bigint') + throw new Error('field order must be bigint'); + const bitLength = fieldOrder.toString(2).length; + return Math.ceil(bitLength / 8); +} +/** + * Returns minimal amount of bytes that can be safely reduced + * by field order. + * Should be 2^-128 for 128-bit curve such as P256. + * @param fieldOrder number of field elements, usually CURVE.n + * @returns byte length of target hash + */ +function getMinHashLength(fieldOrder) { + const length = getFieldBytesLength(fieldOrder); + return length + Math.ceil(length / 2); +} +/** + * "Constant-time" private key generation utility. + * Can take (n + n/2) or more bytes of uniform input e.g. from CSPRNG or KDF + * and convert them into private scalar, with the modulo bias being negligible. + * Needs at least 48 bytes of input for 32-byte private key. + * https://research.kudelskisecurity.com/2020/07/28/the-definitive-guide-to-modulo-bias-and-how-to-avoid-it/ + * FIPS 186-5, A.2 https://csrc.nist.gov/publications/detail/fips/186/5/final + * RFC 9380, https://www.rfc-editor.org/rfc/rfc9380#section-5 + * @param hash hash output from SHA3 or a similar function + * @param groupOrder size of subgroup - (e.g. secp256k1.CURVE.n) + * @param isLE interpret hash bytes as LE num + * @returns valid private scalar + */ +function mapHashToField(key, fieldOrder, isLE = false) { + const len = key.length; + const fieldLen = getFieldBytesLength(fieldOrder); + const minLen = getMinHashLength(fieldOrder); + // No small numbers: need to understand bias story. No huge numbers: easier to detect JS timings. + if (len < 16 || len < minLen || len > 1024) + throw new Error('expected ' + minLen + '-1024 bytes of input, got ' + len); + const num = isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberLE)(key) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.bytesToNumberBE)(key); + // `mod(x, 11)` can sometimes produce 0. `mod(x, 10) + 1` is the same, but no 0 + const reduced = mod(num, fieldOrder - _1n) + _1n; + return isLE ? (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesLE)(reduced, fieldLen) : (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.numberToBytesBE)(reduced, fieldLen); +} +//# sourceMappingURL=modular.js.map + +/***/ }), + +/***/ 51812: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/style-loader@3.3.3_webpack@5.102.1/node_modules/style-loader/dist/runtime/styleDomAPI.js ***! + \**********************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/* istanbul ignore next */ +function apply(styleElement, options, obj) { + var css = ""; + if (obj.supports) { + css += "@supports (".concat(obj.supports, ") {"); + } + if (obj.media) { + css += "@media ".concat(obj.media, " {"); + } + var needLayer = typeof obj.layer !== "undefined"; + if (needLayer) { + css += "@layer".concat(obj.layer.length > 0 ? " ".concat(obj.layer) : "", " {"); + } + css += obj.css; + if (needLayer) { + css += "}"; + } + if (obj.media) { + css += "}"; + } + if (obj.supports) { + css += "}"; + } + var sourceMap = obj.sourceMap; + if (sourceMap && typeof btoa !== "undefined") { + css += "\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))), " */"); + } + + // For old IE + /* istanbul ignore if */ + options.styleTagTransform(css, styleElement, options.options); +} +function removeStyleElement(styleElement) { + // istanbul ignore if + if (styleElement.parentNode === null) { + return false; + } + styleElement.parentNode.removeChild(styleElement); +} + +/* istanbul ignore next */ +function domAPI(options) { + if (typeof document === "undefined") { + return { + update: function update() {}, + remove: function remove() {} + }; + } + var styleElement = options.insertStyleElement(options); + return { + update: function update(obj) { + apply(styleElement, options, obj); + }, + remove: function remove() { + removeStyleElement(styleElement); + } + }; +} +module.exports = domAPI; + +/***/ }), + +/***/ 51924: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/xCurve.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ XCurveDhkemPrimitives: () => (/* binding */ XCurveDhkemPrimitives) +/* harmony export */ }); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../consts.js */ 53838); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../errors.js */ 48385); +/* harmony import */ var _kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../kdfs/hkdf.js */ 40138); +/* harmony import */ var _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../interfaces/dhkemPrimitives.js */ 41744); +/* harmony import */ var _utils_misc_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/misc.js */ 30988); +/* harmony import */ var _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../xCryptoKey.js */ 56550); + + + + + + +/** + * Base DhkemPrimitives implementation for Montgomery curves (X25519/X448). + * + * Subclasses pass curve-specific parameters (algorithm name, key size, curve) + * and optionally add extra methods (e.g., raw derive for X25519). + */ +class XCurveDhkemPrimitives { + constructor(algName, keySize, curve, hkdf) { + Object.defineProperty(this, "_algName", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_curve", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_hkdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nPk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nSk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._algName = algName; + this._nPk = keySize; + this._nSk = keySize; + this._curve = curve; + this._hkdf = hkdf; + } + serializePublicKey(key) { + try { + return Promise.resolve(key.key.buffer); + } + catch (e) { + return Promise.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.SerializeError(e)); + } + } + async deserializePublicKey(key) { + try { + return await this._importRawKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key), true); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e); + } + } + serializePrivateKey(key) { + try { + return Promise.resolve(key.key.buffer); + } + catch (e) { + return Promise.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.SerializeError(e)); + } + } + async deserializePrivateKey(key) { + try { + return await this._importRawKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key), false); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e); + } + } + async importKey(format, key, isPublic) { + try { + if (format === "raw") { + return await this._importRawKey(key, isPublic); + } + // jwk + if (key instanceof ArrayBuffer) { + throw new Error("Invalid jwk key format"); + } + return await this._importJWK(key, isPublic); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e); + } + } + async generateKeyPair() { + try { + const rawSk = await this._curve.utils.randomSecretKey(); + const sk = new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, rawSk, "private", _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.KEM_USAGES); + const pk = await this.derivePublicKey(sk); + return { publicKey: pk, privateKey: sk }; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupportedError(e); + } + } + async deriveKeyPair(ikm) { + try { + const rawIkm = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(ikm); + const dkpPrk = await this._hkdf.labeledExtract(_consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.LABEL_DKP_PRK, new Uint8Array(rawIkm)); + const rawSk = await this._hkdf.labeledExpand(dkpPrk, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.LABEL_SK, _consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY, this._nSk); + const sk = new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, new Uint8Array(rawSk), "private", _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.KEM_USAGES); + return { + privateKey: sk, + publicKey: await this.derivePublicKey(sk), + }; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeriveKeyPairError(e); + } + } + derivePublicKey(key) { + try { + const pk = this._curve.getPublicKey(key.key); + return Promise.resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, pk, "public")); + } + catch (e) { + return Promise.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e)); + } + } + dh(sk, pk) { + try { + return Promise.resolve(this._curve.getSharedSecret(sk.key, pk.key).buffer); + } + catch (e) { + return Promise.reject(new _errors_js__WEBPACK_IMPORTED_MODULE_1__.SerializeError(e)); + } + } + _importRawKey(key, isPublic) { + return new Promise((resolve, reject) => { + if (isPublic && key.byteLength !== this._nPk) { + reject(new Error("Invalid length of the key")); + } + if (!isPublic && key.byteLength !== this._nSk) { + reject(new Error("Invalid length of the key")); + } + resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, new Uint8Array(key), isPublic ? "public" : "private", isPublic ? [] : _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.KEM_USAGES)); + }); + } + _importJWK(key, isPublic) { + return new Promise((resolve, reject) => { + if (key.kty !== "OKP") { + reject(new Error(`Invalid kty: ${key.kty}`)); + } + if (key.crv !== this._algName) { + reject(new Error(`Invalid crv: ${key.crv}`)); + } + if (isPublic) { + if (typeof key.d !== "undefined") { + reject(new Error("Invalid key: `d` should not be set")); + } + if (typeof key.x !== "string") { + reject(new Error("Invalid key: `x` not found")); + } + resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.base64UrlToBytes)(key.x), "public")); + } + else { + if (typeof key.d !== "string") { + reject(new Error("Invalid key: `d` not found")); + } + resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_5__.XCryptoKey(this._algName, (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_4__.base64UrlToBytes)(key.d), "private", _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_3__.KEM_USAGES)); + } + }); + } +} + + +/***/ }), + +/***/ 51936: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/utf16.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ utf16: () => (/* binding */ utf16) +/* harmony export */ }); +/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ 15246); + +function encode(text, options = {}) { + const result = new ArrayBuffer(text.length * 2); + const view = new DataView(result); + for (let i = 0; i < text.length; i++) { + view.setUint16(i * 2, text.charCodeAt(i), options.littleEndian ?? false); + } + return new Uint8Array(result); +} +function decode(data, options = {}) { + const buffer = (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.toArrayBuffer)(data); + const view = new DataView(buffer); + let result = ""; + for (let i = 0; i < buffer.byteLength; i += 2) { + result += String.fromCharCode(view.getUint16(i, options.littleEndian ?? false)); + } + return result; +} +const utf16 = { encode, decode }; + + +/***/ }), + +/***/ 52114: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/sha3.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Keccak: () => (/* binding */ Keccak), +/* harmony export */ keccakP: () => (/* binding */ keccakP), +/* harmony export */ keccak_224: () => (/* binding */ keccak_224), +/* harmony export */ keccak_256: () => (/* binding */ keccak_256), +/* harmony export */ keccak_384: () => (/* binding */ keccak_384), +/* harmony export */ keccak_512: () => (/* binding */ keccak_512), +/* harmony export */ sha3_224: () => (/* binding */ sha3_224), +/* harmony export */ sha3_256: () => (/* binding */ sha3_256), +/* harmony export */ sha3_384: () => (/* binding */ sha3_384), +/* harmony export */ sha3_512: () => (/* binding */ sha3_512), +/* harmony export */ shake128: () => (/* binding */ shake128), +/* harmony export */ shake256: () => (/* binding */ shake256) +/* harmony export */ }); +/* harmony import */ var _u64_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_u64.js */ 46387); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 29964); +/** + * SHA3 (keccak) hash function, based on a new "Sponge function" design. + * Different from older hashes, the internal state is bigger than output size. + * + * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf), + * [Website](https://keccak.team/keccak.html), + * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub). + * + * Check out `sha3-addons` module for cSHAKE, k12, and others. + * @module + */ + +// prettier-ignore + +// No __PURE__ annotations in sha3 header: +// EVERYTHING is in fact used on every export. +// Various per round constants calculations +const _0n = BigInt(0); +const _1n = BigInt(1); +const _2n = BigInt(2); +const _7n = BigInt(7); +const _256n = BigInt(256); +const _0x71n = BigInt(0x71); +const SHA3_PI = []; +const SHA3_ROTL = []; +const _SHA3_IOTA = []; +for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { + // Pi + [x, y] = [y, (2 * x + 3 * y) % 5]; + SHA3_PI.push(2 * (5 * y + x)); + // Rotational + SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64); + // Iota + let t = _0n; + for (let j = 0; j < 7; j++) { + R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n; + if (R & _2n) + t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n); + } + _SHA3_IOTA.push(t); +} +const IOTAS = (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.split)(_SHA3_IOTA, true); +const SHA3_IOTA_H = IOTAS[0]; +const SHA3_IOTA_L = IOTAS[1]; +// Left rotation (without 0, 32, 64) +const rotlH = (h, l, s) => (s > 32 ? (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBH)(h, l, s) : (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSH)(h, l, s)); +const rotlL = (h, l, s) => (s > 32 ? (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlBL)(h, l, s) : (0,_u64_js__WEBPACK_IMPORTED_MODULE_0__.rotlSL)(h, l, s)); +/** `keccakf1600` internal function, additionally allows to adjust round count. */ +function keccakP(s, rounds = 24) { + const B = new Uint32Array(5 * 2); + // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js) + for (let round = 24 - rounds; round < 24; round++) { + // Theta θ + for (let x = 0; x < 10; x++) + B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; + for (let x = 0; x < 10; x += 2) { + const idx1 = (x + 8) % 10; + const idx0 = (x + 2) % 10; + const B0 = B[idx0]; + const B1 = B[idx0 + 1]; + const Th = rotlH(B0, B1, 1) ^ B[idx1]; + const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; + for (let y = 0; y < 50; y += 10) { + s[x + y] ^= Th; + s[x + y + 1] ^= Tl; + } + } + // Rho (ρ) and Pi (π) + let curH = s[2]; + let curL = s[3]; + for (let t = 0; t < 24; t++) { + const shift = SHA3_ROTL[t]; + const Th = rotlH(curH, curL, shift); + const Tl = rotlL(curH, curL, shift); + const PI = SHA3_PI[t]; + curH = s[PI]; + curL = s[PI + 1]; + s[PI] = Th; + s[PI + 1] = Tl; + } + // Chi (χ) + for (let y = 0; y < 50; y += 10) { + for (let x = 0; x < 10; x++) + B[x] = s[y + x]; + for (let x = 0; x < 10; x++) + s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; + } + // Iota (ι) + s[0] ^= SHA3_IOTA_H[round]; + s[1] ^= SHA3_IOTA_L[round]; + } + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.clean)(B); +} +/** Keccak sponge function. */ +class Keccak extends _utils_js__WEBPACK_IMPORTED_MODULE_1__.Hash { + // NOTE: we accept arguments in bytes instead of bits here. + constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { + super(); + this.pos = 0; + this.posOut = 0; + this.finished = false; + this.destroyed = false; + this.enableXOF = false; + this.blockLen = blockLen; + this.suffix = suffix; + this.outputLen = outputLen; + this.enableXOF = enableXOF; + this.rounds = rounds; + // Can be passed from user as dkLen + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(outputLen); + // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes + // 0 < blockLen < 200 + if (!(0 < blockLen && blockLen < 200)) + throw new Error('only keccak-f1600 function is supported'); + this.state = new Uint8Array(200); + this.state32 = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.u32)(this.state); + } + clone() { + return this._cloneInto(); + } + keccak() { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.swap32IfBE)(this.state32); + keccakP(this.state32, this.rounds); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.swap32IfBE)(this.state32); + this.posOut = 0; + this.pos = 0; + } + update(data) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.aexists)(this); + data = (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(data); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(data); + const { blockLen, state } = this; + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + for (let i = 0; i < take; i++) + state[this.pos++] ^= data[pos++]; + if (this.pos === blockLen) + this.keccak(); + } + return this; + } + finish() { + if (this.finished) + return; + this.finished = true; + const { state, suffix, pos, blockLen } = this; + // Do the padding + state[pos] ^= suffix; + if ((suffix & 0x80) !== 0 && pos === blockLen - 1) + this.keccak(); + state[blockLen - 1] ^= 0x80; + this.keccak(); + } + writeInto(out) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.aexists)(this, false); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.abytes)(out); + this.finish(); + const bufferOut = this.state; + const { blockLen } = this; + for (let pos = 0, len = out.length; pos < len;) { + if (this.posOut >= blockLen) + this.keccak(); + const take = Math.min(blockLen - this.posOut, len - pos); + out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); + this.posOut += take; + pos += take; + } + return out; + } + xofInto(out) { + // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF + if (!this.enableXOF) + throw new Error('XOF is not possible for this instance'); + return this.writeInto(out); + } + xof(bytes) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(bytes); + return this.xofInto(new Uint8Array(bytes)); + } + digestInto(out) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.aoutput)(out, this); + if (this.finished) + throw new Error('digest() was already called'); + this.writeInto(out); + this.destroy(); + return out; + } + digest() { + return this.digestInto(new Uint8Array(this.outputLen)); + } + destroy() { + this.destroyed = true; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.clean)(this.state); + } + _cloneInto(to) { + const { blockLen, suffix, outputLen, rounds, enableXOF } = this; + to || (to = new Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); + to.state32.set(this.state32); + to.pos = this.pos; + to.posOut = this.posOut; + to.finished = this.finished; + to.rounds = rounds; + // Suffix can change in cSHAKE + to.suffix = suffix; + to.outputLen = outputLen; + to.enableXOF = enableXOF; + to.destroyed = this.destroyed; + return to; + } +} +const gen = (suffix, blockLen, outputLen) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createHasher)(() => new Keccak(blockLen, suffix, outputLen)); +/** SHA3-224 hash function. */ +const sha3_224 = /* @__PURE__ */ (() => gen(0x06, 144, 224 / 8))(); +/** SHA3-256 hash function. Different from keccak-256. */ +const sha3_256 = /* @__PURE__ */ (() => gen(0x06, 136, 256 / 8))(); +/** SHA3-384 hash function. */ +const sha3_384 = /* @__PURE__ */ (() => gen(0x06, 104, 384 / 8))(); +/** SHA3-512 hash function. */ +const sha3_512 = /* @__PURE__ */ (() => gen(0x06, 72, 512 / 8))(); +/** keccak-224 hash function. */ +const keccak_224 = /* @__PURE__ */ (() => gen(0x01, 144, 224 / 8))(); +/** keccak-256 hash function. Different from SHA3-256. */ +const keccak_256 = /* @__PURE__ */ (() => gen(0x01, 136, 256 / 8))(); +/** keccak-384 hash function. */ +const keccak_384 = /* @__PURE__ */ (() => gen(0x01, 104, 384 / 8))(); +/** keccak-512 hash function. */ +const keccak_512 = /* @__PURE__ */ (() => gen(0x01, 72, 512 / 8))(); +const genShake = (suffix, blockLen, outputLen) => (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.createXOFer)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)); +/** SHAKE128 XOF with 128-bit security. */ +const shake128 = /* @__PURE__ */ (() => genShake(0x1f, 168, 128 / 8))(); +/** SHAKE256 XOF with 256-bit security. */ +const shake256 = /* @__PURE__ */ (() => genShake(0x1f, 136, 256 / 8))(); +//# sourceMappingURL=sha3.js.map + +/***/ }), + +/***/ 52332: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/pvutils@1.1.5/node_modules/pvutils/build/utils.es.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ arrayBufferToString: () => (/* binding */ arrayBufferToString), +/* harmony export */ bufferToHexCodes: () => (/* binding */ bufferToHexCodes), +/* harmony export */ checkBufferParams: () => (/* binding */ checkBufferParams), +/* harmony export */ clearProps: () => (/* binding */ clearProps), +/* harmony export */ fromBase64: () => (/* binding */ fromBase64), +/* harmony export */ getParametersValue: () => (/* binding */ getParametersValue), +/* harmony export */ getUTCDate: () => (/* binding */ getUTCDate), +/* harmony export */ isEqualBuffer: () => (/* binding */ isEqualBuffer), +/* harmony export */ nearestPowerOf2: () => (/* binding */ nearestPowerOf2), +/* harmony export */ padNumber: () => (/* binding */ padNumber), +/* harmony export */ stringToArrayBuffer: () => (/* binding */ stringToArrayBuffer), +/* harmony export */ toBase64: () => (/* binding */ toBase64), +/* harmony export */ utilConcatBuf: () => (/* binding */ utilConcatBuf), +/* harmony export */ utilConcatView: () => (/* binding */ utilConcatView), +/* harmony export */ utilDecodeTC: () => (/* binding */ utilDecodeTC), +/* harmony export */ utilEncodeTC: () => (/* binding */ utilEncodeTC), +/* harmony export */ utilFromBase: () => (/* binding */ utilFromBase), +/* harmony export */ utilToBase: () => (/* binding */ utilToBase) +/* harmony export */ }); +/*! + Copyright (c) Peculiar Ventures, LLC +*/ + +function getUTCDate(date) { + return new Date(date.getTime() + (date.getTimezoneOffset() * 60000)); +} +function getParametersValue(parameters, name, defaultValue) { + var _a; + if ((parameters instanceof Object) === false) { + return defaultValue; + } + return (_a = parameters[name]) !== null && _a !== void 0 ? _a : defaultValue; +} +function bufferToHexCodes(inputBuffer, inputOffset = 0, inputLength = (inputBuffer.byteLength - inputOffset), insertSpace = false) { + let result = ""; + for (const item of (new Uint8Array(inputBuffer, inputOffset, inputLength))) { + const str = item.toString(16).toUpperCase(); + if (str.length === 1) { + result += "0"; + } + result += str; + if (insertSpace) { + result += " "; + } + } + return result.trim(); +} +function checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { + if (!(inputBuffer instanceof ArrayBuffer)) { + baseBlock.error = "Wrong parameter: inputBuffer must be \"ArrayBuffer\""; + return false; + } + if (!inputBuffer.byteLength) { + baseBlock.error = "Wrong parameter: inputBuffer has zero length"; + return false; + } + if (inputOffset < 0) { + baseBlock.error = "Wrong parameter: inputOffset less than zero"; + return false; + } + if (inputLength < 0) { + baseBlock.error = "Wrong parameter: inputLength less than zero"; + return false; + } + if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) { + baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return false; + } + return true; +} +function utilFromBase(inputBuffer, inputBase) { + let result = 0; + if (inputBuffer.length === 1) { + return inputBuffer[0]; + } + for (let i = (inputBuffer.length - 1); i >= 0; i--) { + result += inputBuffer[(inputBuffer.length - 1) - i] * Math.pow(2, inputBase * i); + } + return result; +} +function utilToBase(value, base, reserved = (-1)) { + const internalReserved = reserved; + let internalValue = value; + let result = 0; + let biggest = Math.pow(2, base); + for (let i = 1; i < 8; i++) { + if (value < biggest) { + let retBuf; + if (internalReserved < 0) { + retBuf = new ArrayBuffer(i); + result = i; + } + else { + if (internalReserved < i) { + return (new ArrayBuffer(0)); + } + retBuf = new ArrayBuffer(internalReserved); + result = internalReserved; + } + const retView = new Uint8Array(retBuf); + for (let j = (i - 1); j >= 0; j--) { + const basis = Math.pow(2, j * base); + retView[result - j - 1] = Math.floor(internalValue / basis); + internalValue -= (retView[result - j - 1]) * basis; + } + return retBuf; + } + biggest *= Math.pow(2, base); + } + return new ArrayBuffer(0); +} +function utilConcatBuf(...buffers) { + let outputLength = 0; + let prevLength = 0; + for (const buffer of buffers) { + outputLength += buffer.byteLength; + } + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); + for (const buffer of buffers) { + retView.set(new Uint8Array(buffer), prevLength); + prevLength += buffer.byteLength; + } + return retBuf; +} +function utilConcatView(...views) { + let outputLength = 0; + let prevLength = 0; + for (const view of views) { + outputLength += view.length; + } + const retBuf = new ArrayBuffer(outputLength); + const retView = new Uint8Array(retBuf); + for (const view of views) { + retView.set(view, prevLength); + prevLength += view.length; + } + return retView; +} +function utilDecodeTC() { + const buf = new Uint8Array(this.valueHex); + if (this.valueHex.byteLength >= 2) { + const condition1 = (buf[0] === 0xFF) && (buf[1] & 0x80); + const condition2 = (buf[0] === 0x00) && ((buf[1] & 0x80) === 0x00); + if (condition1 || condition2) { + this.warnings.push("Needlessly long format"); + } + } + const bigIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const bigIntView = new Uint8Array(bigIntBuffer); + for (let i = 0; i < this.valueHex.byteLength; i++) { + bigIntView[i] = 0; + } + bigIntView[0] = (buf[0] & 0x80); + const bigInt = utilFromBase(bigIntView, 8); + const smallIntBuffer = new ArrayBuffer(this.valueHex.byteLength); + const smallIntView = new Uint8Array(smallIntBuffer); + for (let j = 0; j < this.valueHex.byteLength; j++) { + smallIntView[j] = buf[j]; + } + smallIntView[0] &= 0x7F; + const smallInt = utilFromBase(smallIntView, 8); + return (smallInt - bigInt); +} +function utilEncodeTC(value) { + const modValue = (value < 0) ? (value * (-1)) : value; + let bigInt = 128; + for (let i = 1; i < 8; i++) { + if (modValue <= bigInt) { + if (value < 0) { + const smallInt = bigInt - modValue; + const retBuf = utilToBase(smallInt, 8, i); + const retView = new Uint8Array(retBuf); + retView[0] |= 0x80; + return retBuf; + } + let retBuf = utilToBase(modValue, 8, i); + let retView = new Uint8Array(retBuf); + if (retView[0] & 0x80) { + const tempBuf = retBuf.slice(0); + const tempView = new Uint8Array(tempBuf); + retBuf = new ArrayBuffer(retBuf.byteLength + 1); + retView = new Uint8Array(retBuf); + for (let k = 0; k < tempBuf.byteLength; k++) { + retView[k + 1] = tempView[k]; + } + retView[0] = 0x00; + } + return retBuf; + } + bigInt *= Math.pow(2, 8); + } + return (new ArrayBuffer(0)); +} +function isEqualBuffer(inputBuffer1, inputBuffer2) { + if (inputBuffer1.byteLength !== inputBuffer2.byteLength) { + return false; + } + const view1 = new Uint8Array(inputBuffer1); + const view2 = new Uint8Array(inputBuffer2); + for (let i = 0; i < view1.length; i++) { + if (view1[i] !== view2[i]) { + return false; + } + } + return true; +} +function padNumber(inputNumber, fullLength) { + const str = inputNumber.toString(10); + if (fullLength < str.length) { + return ""; + } + const dif = fullLength - str.length; + const padding = new Array(dif); + for (let i = 0; i < dif; i++) { + padding[i] = "0"; + } + const paddingString = padding.join(""); + return paddingString.concat(str); +} +const base64Template = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; +const base64UrlTemplate = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_="; +function toBase64(input, useUrlTemplate = false, skipPadding = false, skipLeadingZeros = false) { + let i = 0; + let flag1 = 0; + let flag2 = 0; + let output = ""; + const template = (useUrlTemplate) ? base64UrlTemplate : base64Template; + if (skipLeadingZeros) { + let nonZeroPosition = 0; + for (let i = 0; i < input.length; i++) { + if (input.charCodeAt(i) !== 0) { + nonZeroPosition = i; + break; + } + } + input = input.slice(nonZeroPosition); + } + while (i < input.length) { + const chr1 = input.charCodeAt(i++); + if (i >= input.length) { + flag1 = 1; + } + const chr2 = input.charCodeAt(i++); + if (i >= input.length) { + flag2 = 1; + } + const chr3 = input.charCodeAt(i++); + const enc1 = chr1 >> 2; + const enc2 = ((chr1 & 0x03) << 4) | (chr2 >> 4); + let enc3 = ((chr2 & 0x0F) << 2) | (chr3 >> 6); + let enc4 = chr3 & 0x3F; + if (flag1 === 1) { + enc3 = enc4 = 64; + } + else { + if (flag2 === 1) { + enc4 = 64; + } + } + if (skipPadding) { + if (enc3 === 64) { + output += `${template.charAt(enc1)}${template.charAt(enc2)}`; + } + else { + if (enc4 === 64) { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}`; + } + else { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + } + } + else { + output += `${template.charAt(enc1)}${template.charAt(enc2)}${template.charAt(enc3)}${template.charAt(enc4)}`; + } + } + return output; +} +function fromBase64(input, useUrlTemplate = false, cutTailZeros = false) { + const template = (useUrlTemplate) ? base64UrlTemplate : base64Template; + function indexOf(toSearch) { + for (let i = 0; i < 64; i++) { + if (template.charAt(i) === toSearch) + return i; + } + return 64; + } + function test(incoming) { + return ((incoming === 64) ? 0x00 : incoming); + } + let i = 0; + let output = ""; + while (i < input.length) { + const enc1 = indexOf(input.charAt(i++)); + const enc2 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const enc3 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const enc4 = (i >= input.length) ? 0x00 : indexOf(input.charAt(i++)); + const chr1 = (test(enc1) << 2) | (test(enc2) >> 4); + const chr2 = ((test(enc2) & 0x0F) << 4) | (test(enc3) >> 2); + const chr3 = ((test(enc3) & 0x03) << 6) | test(enc4); + output += String.fromCharCode(chr1); + if (enc3 !== 64) { + output += String.fromCharCode(chr2); + } + if (enc4 !== 64) { + output += String.fromCharCode(chr3); + } + } + if (cutTailZeros) { + const outputLength = output.length; + let nonZeroStart = (-1); + for (let i = (outputLength - 1); i >= 0; i--) { + if (output.charCodeAt(i) !== 0) { + nonZeroStart = i; + break; + } + } + if (nonZeroStart !== (-1)) { + output = output.slice(0, nonZeroStart + 1); + } + else { + output = ""; + } + } + return output; +} +function arrayBufferToString(buffer) { + let resultString = ""; + const view = new Uint8Array(buffer); + for (const element of view) { + resultString += String.fromCharCode(element); + } + return resultString; +} +function stringToArrayBuffer(str) { + const stringLength = str.length; + const resultBuffer = new ArrayBuffer(stringLength); + const resultView = new Uint8Array(resultBuffer); + for (let i = 0; i < stringLength; i++) { + resultView[i] = str.charCodeAt(i); + } + return resultBuffer; +} +const log2 = Math.log(2); +function nearestPowerOf2(length) { + const base = (Math.log(length) / log2); + const floor = Math.floor(base); + const round = Math.round(base); + return ((floor === round) ? floor : round); +} +function clearProps(object, propsArray) { + for (const prop of propsArray) { + delete object[prop]; + } +} + + + + +/***/ }), + +/***/ 52443: +/*!***********************************************************************************!*\ + !*** ../node_modules/.pnpm/borsh@2.0.0/node_modules/borsh/lib/esm/deserialize.js ***! + \***********************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BorshDeserializer: () => (/* binding */ BorshDeserializer) +/* harmony export */ }); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./types.js */ 89401); +/* harmony import */ var _buffer_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./buffer.js */ 82476); + + +var BorshDeserializer = /** @class */ (function () { + function BorshDeserializer(bufferArray) { + this.buffer = new _buffer_js__WEBPACK_IMPORTED_MODULE_1__.DecodeBuffer(bufferArray); + } + BorshDeserializer.prototype.decode = function (schema) { + return this.decode_value(schema); + }; + BorshDeserializer.prototype.decode_value = function (schema) { + if (typeof schema === 'string') { + if (_types_js__WEBPACK_IMPORTED_MODULE_0__.integers.includes(schema)) + return this.decode_integer(schema); + if (schema === 'string') + return this.decode_string(); + if (schema === 'bool') + return this.decode_boolean(); + } + if (typeof schema === 'object') { + if ('option' in schema) + return this.decode_option(schema); + if ('enum' in schema) + return this.decode_enum(schema); + if ('array' in schema) + return this.decode_array(schema); + if ('set' in schema) + return this.decode_set(schema); + if ('map' in schema) + return this.decode_map(schema); + if ('struct' in schema) + return this.decode_struct(schema); + } + throw new Error("Unsupported type: ".concat(schema)); + }; + BorshDeserializer.prototype.decode_integer = function (schema) { + var size = parseInt(schema.substring(1)); + if (size <= 32 || schema == 'f64') { + return this.buffer.consume_value(schema); + } + return this.decode_bigint(size, schema.startsWith('i')); + }; + BorshDeserializer.prototype.decode_bigint = function (size, signed) { + if (signed === void 0) { signed = false; } + var buffer_len = size / 8; + var buffer = new Uint8Array(this.buffer.consume_bytes(buffer_len)); + var bits = buffer.reduceRight(function (r, x) { return r + x.toString(16).padStart(2, '0'); }, ''); + if (signed && buffer[buffer_len - 1]) { + return BigInt.asIntN(size, BigInt("0x".concat(bits))); + } + return BigInt("0x".concat(bits)); + }; + BorshDeserializer.prototype.decode_string = function () { + var len = this.decode_integer('u32'); + var buffer = new Uint8Array(this.buffer.consume_bytes(len)); + // decode utf-8 string without using TextDecoder + // first get all bytes to single byte code points + var codePoints = []; + for (var i = 0; i < len; ++i) { + var byte = buffer[i]; + if (byte < 0x80) { + codePoints.push(byte); + } + else if (byte < 0xE0) { + codePoints.push(((byte & 0x1F) << 6) | (buffer[++i] & 0x3F)); + } + else if (byte < 0xF0) { + codePoints.push(((byte & 0x0F) << 12) | ((buffer[++i] & 0x3F) << 6) | (buffer[++i] & 0x3F)); + } + else { + var codePoint = ((byte & 0x07) << 18) | ((buffer[++i] & 0x3F) << 12) | ((buffer[++i] & 0x3F) << 6) | (buffer[++i] & 0x3F); + codePoints.push(codePoint); + } + } + // then decode code points to utf-8 + return String.fromCodePoint.apply(String, codePoints); + }; + BorshDeserializer.prototype.decode_boolean = function () { + return this.buffer.consume_value('u8') > 0; + }; + BorshDeserializer.prototype.decode_option = function (schema) { + var option = this.buffer.consume_value('u8'); + if (option === 1) { + return this.decode_value(schema.option); + } + if (option !== 0) { + throw new Error("Invalid option ".concat(option)); + } + return null; + }; + BorshDeserializer.prototype.decode_enum = function (schema) { + var _a; + var valueIndex = this.buffer.consume_value('u8'); + if (valueIndex > schema["enum"].length) { + throw new Error("Enum option ".concat(valueIndex, " is not available")); + } + var struct = schema["enum"][valueIndex].struct; + var key = Object.keys(struct)[0]; + return _a = {}, _a[key] = this.decode_value(struct[key]), _a; + }; + BorshDeserializer.prototype.decode_array = function (schema) { + var result = []; + var len = schema.array.len ? schema.array.len : this.decode_integer('u32'); + for (var i = 0; i < len; ++i) { + result.push(this.decode_value(schema.array.type)); + } + return result; + }; + BorshDeserializer.prototype.decode_set = function (schema) { + var len = this.decode_integer('u32'); + var result = new Set(); + for (var i = 0; i < len; ++i) { + result.add(this.decode_value(schema.set)); + } + return result; + }; + BorshDeserializer.prototype.decode_map = function (schema) { + var len = this.decode_integer('u32'); + var result = new Map(); + for (var i = 0; i < len; ++i) { + var key = this.decode_value(schema.map.key); + var value = this.decode_value(schema.map.value); + result.set(key, value); + } + return result; + }; + BorshDeserializer.prototype.decode_struct = function (schema) { + var result = {}; + for (var key in schema.struct) { + result[key] = this.decode_value(schema.struct[key]); + } + return result; + }; + return BorshDeserializer; +}()); + + + +/***/ }), + +/***/ 52494: +/*!***********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/ietf_attr_syntax.js ***! + \***********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ IetfAttrSyntax: () => (/* binding */ IetfAttrSyntax), +/* harmony export */ IetfAttrSyntaxValueChoices: () => (/* binding */ IetfAttrSyntaxValueChoices) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class IetfAttrSyntaxValueChoices { + cotets; + oid; + string; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], IetfAttrSyntaxValueChoices.prototype, "cotets", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], IetfAttrSyntaxValueChoices.prototype, "oid", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Utf8String }) +], IetfAttrSyntaxValueChoices.prototype, "string", void 0); +class IetfAttrSyntax { + policyAuthority; + values = []; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralNames, implicit: true, context: 0, optional: true, + }) +], IetfAttrSyntax.prototype, "policyAuthority", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: IetfAttrSyntaxValueChoices, repeated: "sequence", + }) +], IetfAttrSyntax.prototype, "values", void 0); + + +/***/ }), + +/***/ 52580: +/*!****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/attribute_certificate.js ***! + \****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AttributeCertificate: () => (/* binding */ AttributeCertificate) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _attribute_certificate_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./attribute_certificate_info.js */ 26275); + + + + +class AttributeCertificate { + acinfo = new _attribute_certificate_info_js__WEBPACK_IMPORTED_MODULE_3__.AttributeCertificateInfo(); + signatureAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + signatureValue = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _attribute_certificate_info_js__WEBPACK_IMPORTED_MODULE_3__.AttributeCertificateInfo }) +], AttributeCertificate.prototype, "acinfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], AttributeCertificate.prototype, "signatureAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString }) +], AttributeCertificate.prototype, "signatureValue", void 0); + + +/***/ }), + +/***/ 52884: +/*!******************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/blob/commitmentsToVersionedHashes.js ***! + \******************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ commitmentsToVersionedHashes: () => (/* binding */ commitmentsToVersionedHashes) +/* harmony export */ }); +/* harmony import */ var _commitmentToVersionedHash_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commitmentToVersionedHash.js */ 59419); + +/** + * Transform a list of commitments to their versioned hashes. + * + * @example + * ```ts + * import { + * blobsToCommitments, + * commitmentsToVersionedHashes, + * toBlobs + * } from 'viem' + * import { kzg } from './kzg' + * + * const blobs = toBlobs({ data: '0x1234' }) + * const commitments = blobsToCommitments({ blobs, kzg }) + * const versionedHashes = commitmentsToVersionedHashes({ commitments }) + * ``` + */ +function commitmentsToVersionedHashes(parameters) { + const { commitments, version } = parameters; + const to = parameters.to ?? (typeof commitments[0] === 'string' ? 'hex' : 'bytes'); + const hashes = []; + for (const commitment of commitments) { + hashes.push((0,_commitmentToVersionedHash_js__WEBPACK_IMPORTED_MODULE_0__.commitmentToVersionedHash)({ + commitment, + to, + version, + })); + } + return hashes; +} +//# sourceMappingURL=commitmentsToVersionedHashes.js.map + +/***/ }), + +/***/ 53273: +/*!******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/data/trim.js ***! + \******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ trim: () => (/* binding */ trim) +/* harmony export */ }); +function trim(hexOrBytes, { dir = 'left' } = {}) { + let data = typeof hexOrBytes === 'string' ? hexOrBytes.replace('0x', '') : hexOrBytes; + let sliceLength = 0; + for (let i = 0; i < data.length - 1; i++) { + if (data[dir === 'left' ? i : data.length - i - 1].toString() === '0') + sliceLength++; + else + break; + } + data = + dir === 'left' + ? data.slice(sliceLength) + : data.slice(0, data.length - sliceLength); + if (typeof hexOrBytes === 'string') { + if (data.length === 1 && dir === 'right') + data = `${data}0`; + return `0x${data.length % 2 === 1 ? `0${data}` : data}`; + } + return data; +} +//# sourceMappingURL=trim.js.map + +/***/ }), + +/***/ 53395: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/registry-base.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +var RegistryBase = (function () { + function RegistryBase() { + this._registryMap = new Map(); + } + RegistryBase.prototype.entries = function () { + return this._registryMap.entries(); + }; + RegistryBase.prototype.getAll = function (key) { + this.ensure(key); + return this._registryMap.get(key); + }; + RegistryBase.prototype.get = function (key) { + this.ensure(key); + var value = this._registryMap.get(key); + return value[value.length - 1] || null; + }; + RegistryBase.prototype.set = function (key, value) { + this.ensure(key); + this._registryMap.get(key).push(value); + }; + RegistryBase.prototype.setAll = function (key, value) { + this._registryMap.set(key, value); + }; + RegistryBase.prototype.has = function (key) { + this.ensure(key); + return this._registryMap.get(key).length > 0; + }; + RegistryBase.prototype.clear = function () { + this._registryMap.clear(); + }; + RegistryBase.prototype.ensure = function (key) { + if (!this._registryMap.has(key)) { + this._registryMap.set(key, []); + } + }; + return RegistryBase; +}()); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (RegistryBase); + + +/***/ }), + +/***/ 53445: +/*!*******************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/key_trans_recipient_info.js ***! + \*******************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KeyTransRecipientInfo: () => (/* binding */ KeyTransRecipientInfo), +/* harmony export */ RecipientIdentifier: () => (/* binding */ RecipientIdentifier) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ 96729); +/* harmony import */ var _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./issuer_and_serial_number.js */ 14164); + + + + + +let RecipientIdentifier = class RecipientIdentifier { + subjectKeyIdentifier; + issuerAndSerialNumber; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.SubjectKeyIdentifier, context: 0, implicit: true, + }) +], RecipientIdentifier.prototype, "subjectKeyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _issuer_and_serial_number_js__WEBPACK_IMPORTED_MODULE_4__.IssuerAndSerialNumber }) +], RecipientIdentifier.prototype, "issuerAndSerialNumber", void 0); +RecipientIdentifier = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], RecipientIdentifier); + +class KeyTransRecipientInfo { + version = _types_js__WEBPACK_IMPORTED_MODULE_3__.CMSVersion.v0; + rid = new RecipientIdentifier(); + keyEncryptionAlgorithm = new _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier(); + encryptedKey = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], KeyTransRecipientInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: RecipientIdentifier }) +], KeyTransRecipientInfo.prototype, "rid", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier }) +], KeyTransRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], KeyTransRecipientInfo.prototype, "encryptedKey", void 0); + + +/***/ }), + +/***/ 53556: +/*!***********************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/ec/signature.js ***! + \***********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ 27019); + +var utils = __webpack_require__(/*! ../utils */ 28432); +var assert = utils.assert; + +function Signature(options, enc) { + if (options instanceof Signature) + return options; + + if (this._importDER(options, enc)) + return; + + assert(options.r && options.s, 'Signature without r or s'); + this.r = new BN(options.r, 16); + this.s = new BN(options.s, 16); + if (options.recoveryParam === undefined) + this.recoveryParam = null; + else + this.recoveryParam = options.recoveryParam; +} +module.exports = Signature; + +function Position() { + this.place = 0; +} + +function getLength(buf, p) { + var initial = buf[p.place++]; + if (!(initial & 0x80)) { + return initial; + } + var octetLen = initial & 0xf; + + // Indefinite length or overflow + if (octetLen === 0 || octetLen > 4) { + return false; + } + + if(buf[p.place] === 0x00) { + return false; + } + + var val = 0; + for (var i = 0, off = p.place; i < octetLen; i++, off++) { + val <<= 8; + val |= buf[off]; + val >>>= 0; + } + + // Leading zeroes + if (val <= 0x7f) { + return false; + } + + p.place = off; + return val; +} + +function rmPadding(buf) { + var i = 0; + var len = buf.length - 1; + while (!buf[i] && !(buf[i + 1] & 0x80) && i < len) { + i++; + } + if (i === 0) { + return buf; + } + return buf.slice(i); +} + +Signature.prototype._importDER = function _importDER(data, enc) { + data = utils.toArray(data, enc); + var p = new Position(); + if (data[p.place++] !== 0x30) { + return false; + } + var len = getLength(data, p); + if (len === false) { + return false; + } + if ((len + p.place) !== data.length) { + return false; + } + if (data[p.place++] !== 0x02) { + return false; + } + var rlen = getLength(data, p); + if (rlen === false) { + return false; + } + if ((data[p.place] & 128) !== 0) { + return false; + } + var r = data.slice(p.place, rlen + p.place); + p.place += rlen; + if (data[p.place++] !== 0x02) { + return false; + } + var slen = getLength(data, p); + if (slen === false) { + return false; + } + if (data.length !== slen + p.place) { + return false; + } + if ((data[p.place] & 128) !== 0) { + return false; + } + var s = data.slice(p.place, slen + p.place); + if (r[0] === 0) { + if (r[1] & 0x80) { + r = r.slice(1); + } else { + // Leading zeroes + return false; + } + } + if (s[0] === 0) { + if (s[1] & 0x80) { + s = s.slice(1); + } else { + // Leading zeroes + return false; + } + } + + this.r = new BN(r); + this.s = new BN(s); + this.recoveryParam = null; + + return true; +}; + +function constructLength(arr, len) { + if (len < 0x80) { + arr.push(len); + return; + } + var octets = 1 + (Math.log(len) / Math.LN2 >>> 3); + arr.push(octets | 0x80); + while (--octets) { + arr.push((len >>> (octets << 3)) & 0xff); + } + arr.push(len); +} + +Signature.prototype.toDER = function toDER(enc) { + var r = this.r.toArray(); + var s = this.s.toArray(); + + // Pad values + if (r[0] & 0x80) + r = [ 0 ].concat(r); + // Pad values + if (s[0] & 0x80) + s = [ 0 ].concat(s); + + r = rmPadding(r); + s = rmPadding(s); + + while (!s[0] && !(s[1] & 0x80)) { + s = s.slice(1); + } + var arr = [ 0x02 ]; + constructLength(arr, r.length); + arr = arr.concat(r); + arr.push(0x02); + constructLength(arr, s.length); + var backHalf = arr.concat(s); + var res = [ 0x30 ]; + constructLength(res, backHalf.length); + res = res.concat(backHalf); + return utils.encode(res, enc); +}; + + +/***/ }), + +/***/ 53628: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/eventemitter3@5.0.4/node_modules/eventemitter3/index.mjs ***! + \**************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ EventEmitter: () => (/* reexport default export from named module */ _index_js__WEBPACK_IMPORTED_MODULE_0__), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./index.js */ 40790); + + + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_index_js__WEBPACK_IMPORTED_MODULE_0__); + + +/***/ }), + +/***/ 53820: +/*!********************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/overlay.js ***! + \********************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createOverlay: () => (/* binding */ createOverlay), +/* harmony export */ formatProblem: () => (/* binding */ formatProblem) +/* harmony export */ }); +/* harmony import */ var ansi_html_community__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ansi-html-community */ 74075); +/* harmony import */ var ansi_html_community__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(ansi_html_community__WEBPACK_IMPORTED_MODULE_0__); +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +// The error overlay is inspired (and mostly copied) from Create React App (https://github.com/facebookincubator/create-react-app) +// They, in turn, got inspired by webpack-hot-middleware (https://github.com/glenjamin/webpack-hot-middleware). + + + +/** + * @type {(input: string, position: number) => string} + */ +var getCodePoint = String.prototype.codePointAt ? function (input, position) { + return input.codePointAt(position); +} : function (input, position) { + return (input.charCodeAt(position) - 0xd800) * 0x400 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000; +}; + +/** + * @param {string} macroText + * @param {RegExp} macroRegExp + * @param {(input: string) => string} macroReplacer + * @returns {string} + */ +var replaceUsingRegExp = function replaceUsingRegExp(macroText, macroRegExp, macroReplacer) { + macroRegExp.lastIndex = 0; + var replaceMatch = macroRegExp.exec(macroText); + var replaceResult; + if (replaceMatch) { + replaceResult = ""; + var replaceLastIndex = 0; + do { + if (replaceLastIndex !== replaceMatch.index) { + replaceResult += macroText.substring(replaceLastIndex, replaceMatch.index); + } + var replaceInput = replaceMatch[0]; + replaceResult += macroReplacer(replaceInput); + replaceLastIndex = replaceMatch.index + replaceInput.length; + // eslint-disable-next-line no-cond-assign + } while (replaceMatch = macroRegExp.exec(macroText)); + if (replaceLastIndex !== macroText.length) { + replaceResult += macroText.substring(replaceLastIndex); + } + } else { + replaceResult = macroText; + } + return replaceResult; +}; +var references = { + "<": "<", + ">": ">", + '"': """, + "'": "'", + "&": "&" +}; + +/** + * @param {string} text text + * @returns {string} + */ +function encode(text) { + if (!text) { + return ""; + } + return replaceUsingRegExp(text, /[<>'"&]/g, function (input) { + var result = references[input]; + if (!result) { + var code = input.length > 1 ? getCodePoint(input, 0) : input.charCodeAt(0); + result = "&#".concat(code, ";"); + } + return result; + }); +} + +/** + * @typedef {Object} StateDefinitions + * @property {{[event: string]: { target: string; actions?: Array }}} [on] + */ + +/** + * @typedef {Object} Options + * @property {{[state: string]: StateDefinitions}} states + * @property {object} context; + * @property {string} initial + */ + +/** + * @typedef {Object} Implementation + * @property {{[actionName: string]: (ctx: object, event: any) => object}} actions + */ + +/** + * A simplified `createMachine` from `@xstate/fsm` with the following differences: + * + * - the returned machine is technically a "service". No `interpret(machine).start()` is needed. + * - the state definition only support `on` and target must be declared with { target: 'nextState', actions: [] } explicitly. + * - event passed to `send` must be an object with `type` property. + * - actions implementation will be [assign action](https://xstate.js.org/docs/guides/context.html#assign-action) if you return any value. + * Do not return anything if you just want to invoke side effect. + * + * The goal of this custom function is to avoid installing the entire `'xstate/fsm'` package, while enabling modeling using + * state machine. You can copy the first parameter into the editor at https://stately.ai/viz to visualize the state machine. + * + * @param {Options} options + * @param {Implementation} implementation + */ +function createMachine(_ref, _ref2) { + var states = _ref.states, + context = _ref.context, + initial = _ref.initial; + var actions = _ref2.actions; + var currentState = initial; + var currentContext = context; + return { + send: function send(event) { + var currentStateOn = states[currentState].on; + var transitionConfig = currentStateOn && currentStateOn[event.type]; + if (transitionConfig) { + currentState = transitionConfig.target; + if (transitionConfig.actions) { + transitionConfig.actions.forEach(function (actName) { + var actionImpl = actions[actName]; + var nextContextValue = actionImpl && actionImpl(currentContext, event); + if (nextContextValue) { + currentContext = _objectSpread(_objectSpread({}, currentContext), nextContextValue); + } + }); + } + } + } + }; +} + +/** + * @typedef {Object} ShowOverlayData + * @property {'warning' | 'error'} level + * @property {Array} messages + * @property {'build' | 'runtime'} messageSource + */ + +/** + * @typedef {Object} CreateOverlayMachineOptions + * @property {(data: ShowOverlayData) => void} showOverlay + * @property {() => void} hideOverlay + */ + +/** + * @param {CreateOverlayMachineOptions} options + */ +var createOverlayMachine = function createOverlayMachine(options) { + var hideOverlay = options.hideOverlay, + showOverlay = options.showOverlay; + return createMachine({ + initial: "hidden", + context: { + level: "error", + messages: [], + messageSource: "build" + }, + states: { + hidden: { + on: { + BUILD_ERROR: { + target: "displayBuildError", + actions: ["setMessages", "showOverlay"] + }, + RUNTIME_ERROR: { + target: "displayRuntimeError", + actions: ["setMessages", "showOverlay"] + } + } + }, + displayBuildError: { + on: { + DISMISS: { + target: "hidden", + actions: ["dismissMessages", "hideOverlay"] + }, + BUILD_ERROR: { + target: "displayBuildError", + actions: ["appendMessages", "showOverlay"] + } + } + }, + displayRuntimeError: { + on: { + DISMISS: { + target: "hidden", + actions: ["dismissMessages", "hideOverlay"] + }, + RUNTIME_ERROR: { + target: "displayRuntimeError", + actions: ["appendMessages", "showOverlay"] + }, + BUILD_ERROR: { + target: "displayBuildError", + actions: ["setMessages", "showOverlay"] + } + } + } + } + }, { + actions: { + dismissMessages: function dismissMessages() { + return { + messages: [], + level: "error", + messageSource: "build" + }; + }, + appendMessages: function appendMessages(context, event) { + return { + messages: context.messages.concat(event.messages), + level: event.level || context.level, + messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build" + }; + }, + setMessages: function setMessages(context, event) { + return { + messages: event.messages, + level: event.level || context.level, + messageSource: event.type === "RUNTIME_ERROR" ? "runtime" : "build" + }; + }, + hideOverlay: hideOverlay, + showOverlay: showOverlay + } + }); +}; + +/** + * + * @param {Error} error + */ +var parseErrorToStacks = function parseErrorToStacks(error) { + if (!error || !(error instanceof Error)) { + throw new Error("parseErrorToStacks expects Error object"); + } + if (typeof error.stack === "string") { + return error.stack.split("\n").filter(function (stack) { + return stack !== "Error: ".concat(error.message); + }); + } +}; + +/** + * @callback ErrorCallback + * @param {ErrorEvent} error + * @returns {void} + */ + +/** + * @param {ErrorCallback} callback + */ +var listenToRuntimeError = function listenToRuntimeError(callback) { + window.addEventListener("error", callback); + return function cleanup() { + window.removeEventListener("error", callback); + }; +}; + +/** + * @callback UnhandledRejectionCallback + * @param {PromiseRejectionEvent} rejectionEvent + * @returns {void} + */ + +/** + * @param {UnhandledRejectionCallback} callback + */ +var listenToUnhandledRejection = function listenToUnhandledRejection(callback) { + window.addEventListener("unhandledrejection", callback); + return function cleanup() { + window.removeEventListener("unhandledrejection", callback); + }; +}; + +// Styles are inspired by `react-error-overlay` + +var msgStyles = { + error: { + backgroundColor: "rgba(206, 17, 38, 0.1)", + color: "#fccfcf" + }, + warning: { + backgroundColor: "rgba(251, 245, 180, 0.1)", + color: "#fbf5b4" + } +}; +var iframeStyle = { + position: "fixed", + top: 0, + left: 0, + right: 0, + bottom: 0, + width: "100vw", + height: "100vh", + border: "none", + "z-index": 9999999999 +}; +var containerStyle = { + position: "fixed", + boxSizing: "border-box", + left: 0, + top: 0, + right: 0, + bottom: 0, + width: "100vw", + height: "100vh", + fontSize: "large", + padding: "2rem 2rem 4rem 2rem", + lineHeight: "1.2", + whiteSpace: "pre-wrap", + overflow: "auto", + backgroundColor: "rgba(0, 0, 0, 0.9)", + color: "white" +}; +var headerStyle = { + color: "#e83b46", + fontSize: "2em", + whiteSpace: "pre-wrap", + fontFamily: "sans-serif", + margin: "0 2rem 2rem 0", + flex: "0 0 auto", + maxHeight: "50%", + overflow: "auto" +}; +var dismissButtonStyle = { + color: "#ffffff", + lineHeight: "1rem", + fontSize: "1.5rem", + padding: "1rem", + cursor: "pointer", + position: "absolute", + right: 0, + top: 0, + backgroundColor: "transparent", + border: "none" +}; +var msgTypeStyle = { + color: "#e83b46", + fontSize: "1.2em", + marginBottom: "1rem", + fontFamily: "sans-serif" +}; +var msgTextStyle = { + lineHeight: "1.5", + fontSize: "1rem", + fontFamily: "Menlo, Consolas, monospace" +}; + +// ANSI HTML + +var colors = { + reset: ["transparent", "transparent"], + black: "181818", + red: "E36049", + green: "B3CB74", + yellow: "FFD080", + blue: "7CAFC2", + magenta: "7FACCA", + cyan: "C3C2EF", + lightgrey: "EBE7E3", + darkgrey: "6D7891" +}; +ansi_html_community__WEBPACK_IMPORTED_MODULE_0___default().setColors(colors); + +/** + * @param {string} type + * @param {string | { file?: string, moduleName?: string, loc?: string, message?: string; stack?: string[] }} item + * @returns {{ header: string, body: string }} + */ +var formatProblem = function formatProblem(type, item) { + var header = type === "warning" ? "WARNING" : "ERROR"; + var body = ""; + if (typeof item === "string") { + body += item; + } else { + var file = item.file || ""; + // eslint-disable-next-line no-nested-ternary + var moduleName = item.moduleName ? item.moduleName.indexOf("!") !== -1 ? "".concat(item.moduleName.replace(/^(\s|\S)*!/, ""), " (").concat(item.moduleName, ")") : "".concat(item.moduleName) : ""; + var loc = item.loc; + header += "".concat(moduleName || file ? " in ".concat(moduleName ? "".concat(moduleName).concat(file ? " (".concat(file, ")") : "") : file).concat(loc ? " ".concat(loc) : "") : ""); + body += item.message || ""; + } + if (Array.isArray(item.stack)) { + item.stack.forEach(function (stack) { + if (typeof stack === "string") { + body += "\r\n".concat(stack); + } + }); + } + return { + header: header, + body: body + }; +}; + +/** + * @typedef {Object} CreateOverlayOptions + * @property {string | null} trustedTypesPolicyName + * @property {boolean | (error: Error) => void} [catchRuntimeError] + */ + +/** + * + * @param {CreateOverlayOptions} options + */ +var createOverlay = function createOverlay(options) { + /** @type {HTMLIFrameElement | null | undefined} */ + var iframeContainerElement; + /** @type {HTMLDivElement | null | undefined} */ + var containerElement; + /** @type {HTMLDivElement | null | undefined} */ + var headerElement; + /** @type {Array<(element: HTMLDivElement) => void>} */ + var onLoadQueue = []; + /** @type {TrustedTypePolicy | undefined} */ + var overlayTrustedTypesPolicy; + + /** + * + * @param {HTMLElement} element + * @param {CSSStyleDeclaration} style + */ + function applyStyle(element, style) { + Object.keys(style).forEach(function (prop) { + element.style[prop] = style[prop]; + }); + } + + /** + * @param {string | null} trustedTypesPolicyName + */ + function createContainer(trustedTypesPolicyName) { + // Enable Trusted Types if they are available in the current browser. + if (window.trustedTypes) { + overlayTrustedTypesPolicy = window.trustedTypes.createPolicy(trustedTypesPolicyName || "webpack-dev-server#overlay", { + createHTML: function createHTML(value) { + return value; + } + }); + } + iframeContainerElement = document.createElement("iframe"); + iframeContainerElement.id = "webpack-dev-server-client-overlay"; + iframeContainerElement.src = "about:blank"; + applyStyle(iframeContainerElement, iframeStyle); + iframeContainerElement.onload = function () { + var contentElement = /** @type {Document} */ + (/** @type {HTMLIFrameElement} */ + iframeContainerElement.contentDocument).createElement("div"); + containerElement = /** @type {Document} */ + (/** @type {HTMLIFrameElement} */ + iframeContainerElement.contentDocument).createElement("div"); + contentElement.id = "webpack-dev-server-client-overlay-div"; + applyStyle(contentElement, containerStyle); + headerElement = document.createElement("div"); + headerElement.innerText = "Compiled with problems:"; + applyStyle(headerElement, headerStyle); + var closeButtonElement = document.createElement("button"); + applyStyle(closeButtonElement, dismissButtonStyle); + closeButtonElement.innerText = "×"; + closeButtonElement.ariaLabel = "Dismiss"; + closeButtonElement.addEventListener("click", function () { + // eslint-disable-next-line no-use-before-define + overlayService.send({ + type: "DISMISS" + }); + }); + contentElement.appendChild(headerElement); + contentElement.appendChild(closeButtonElement); + contentElement.appendChild(containerElement); + + /** @type {Document} */ + (/** @type {HTMLIFrameElement} */ + iframeContainerElement.contentDocument).body.appendChild(contentElement); + onLoadQueue.forEach(function (onLoad) { + onLoad(/** @type {HTMLDivElement} */contentElement); + }); + onLoadQueue = []; + + /** @type {HTMLIFrameElement} */ + iframeContainerElement.onload = null; + }; + document.body.appendChild(iframeContainerElement); + } + + /** + * @param {(element: HTMLDivElement) => void} callback + * @param {string | null} trustedTypesPolicyName + */ + function ensureOverlayExists(callback, trustedTypesPolicyName) { + if (containerElement) { + containerElement.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML("") : ""; + // Everything is ready, call the callback right away. + callback(containerElement); + return; + } + onLoadQueue.push(callback); + if (iframeContainerElement) { + return; + } + createContainer(trustedTypesPolicyName); + } + + // Successful compilation. + function hide() { + if (!iframeContainerElement) { + return; + } + + // Clean up and reset internal state. + document.body.removeChild(iframeContainerElement); + iframeContainerElement = null; + containerElement = null; + } + + // Compilation with errors (e.g. syntax error or missing modules). + /** + * @param {string} type + * @param {Array} messages + * @param {string | null} trustedTypesPolicyName + * @param {'build' | 'runtime'} messageSource + */ + function show(type, messages, trustedTypesPolicyName, messageSource) { + ensureOverlayExists(function () { + headerElement.innerText = messageSource === "runtime" ? "Uncaught runtime errors:" : "Compiled with problems:"; + messages.forEach(function (message) { + var entryElement = document.createElement("div"); + var msgStyle = type === "warning" ? msgStyles.warning : msgStyles.error; + applyStyle(entryElement, _objectSpread(_objectSpread({}, msgStyle), {}, { + padding: "1rem 1rem 1.5rem 1rem" + })); + var typeElement = document.createElement("div"); + var _formatProblem = formatProblem(type, message), + header = _formatProblem.header, + body = _formatProblem.body; + typeElement.innerText = header; + applyStyle(typeElement, msgTypeStyle); + if (message.moduleIdentifier) { + applyStyle(typeElement, { + cursor: "pointer" + }); + // element.dataset not supported in IE + typeElement.setAttribute("data-can-open", true); + typeElement.addEventListener("click", function () { + fetch("/webpack-dev-server/open-editor?fileName=".concat(message.moduleIdentifier)); + }); + } + + // Make it look similar to our terminal. + var text = ansi_html_community__WEBPACK_IMPORTED_MODULE_0___default()(encode(body)); + var messageTextNode = document.createElement("div"); + applyStyle(messageTextNode, msgTextStyle); + messageTextNode.innerHTML = overlayTrustedTypesPolicy ? overlayTrustedTypesPolicy.createHTML(text) : text; + entryElement.appendChild(typeElement); + entryElement.appendChild(messageTextNode); + + /** @type {HTMLDivElement} */ + containerElement.appendChild(entryElement); + }); + }, trustedTypesPolicyName); + } + var overlayService = createOverlayMachine({ + showOverlay: function showOverlay(_ref3) { + var _ref3$level = _ref3.level, + level = _ref3$level === void 0 ? "error" : _ref3$level, + messages = _ref3.messages, + messageSource = _ref3.messageSource; + return show(level, messages, options.trustedTypesPolicyName, messageSource); + }, + hideOverlay: hide + }); + if (options.catchRuntimeError) { + /** + * @param {Error | undefined} error + * @param {string} fallbackMessage + */ + var handleError = function handleError(error, fallbackMessage) { + var errorObject = error instanceof Error ? error : new Error(error || fallbackMessage); + var shouldDisplay = typeof options.catchRuntimeError === "function" ? options.catchRuntimeError(errorObject) : true; + if (shouldDisplay) { + overlayService.send({ + type: "RUNTIME_ERROR", + messages: [{ + message: errorObject.message, + stack: parseErrorToStacks(errorObject) + }] + }); + } + }; + listenToRuntimeError(function (errorEvent) { + // error property may be empty in older browser like IE + var error = errorEvent.error, + message = errorEvent.message; + if (!error && !message) { + return; + } + + // if error stack indicates a React error boundary caught the error, do not show overlay. + if (error && error.stack && error.stack.includes("invokeGuardedCallbackDev")) { + return; + } + handleError(error, message); + }); + listenToUnhandledRejection(function (promiseRejectionEvent) { + var reason = promiseRejectionEvent.reason; + handleError(reason, "Unknown promise rejection reason"); + }); + } + return overlayService; +}; + + +/***/ }), + +/***/ 53838: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/consts.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BYTE_TO_BIGINT_256: () => (/* binding */ BYTE_TO_BIGINT_256), +/* harmony export */ EMPTY: () => (/* binding */ EMPTY), +/* harmony export */ INFO_LENGTH_LIMIT: () => (/* binding */ INFO_LENGTH_LIMIT), +/* harmony export */ INPUT_LENGTH_LIMIT: () => (/* binding */ INPUT_LENGTH_LIMIT), +/* harmony export */ MINIMUM_PSK_LENGTH: () => (/* binding */ MINIMUM_PSK_LENGTH), +/* harmony export */ N_0: () => (/* binding */ N_0), +/* harmony export */ N_0x71: () => (/* binding */ N_0x71), +/* harmony export */ N_1: () => (/* binding */ N_1), +/* harmony export */ N_2: () => (/* binding */ N_2), +/* harmony export */ N_256: () => (/* binding */ N_256), +/* harmony export */ N_32: () => (/* binding */ N_32), +/* harmony export */ N_7: () => (/* binding */ N_7) +/* harmony export */ }); +// The input length limit (psk, psk_id, info, exporter_context, ikm). +const INPUT_LENGTH_LIMIT = 8192; +const INFO_LENGTH_LIMIT = 268435456; +// The minimum length of a PSK. +const MINIMUM_PSK_LENGTH = 32; +// b"" +const EMPTY = /* @__PURE__ */ new Uint8Array(0); +// Common BigInt constants +const N_0 = 0n; +const N_1 = 1n; +const N_2 = 2n; +const N_7 = 7n; +const N_32 = 32n; +const N_256 = 256n; +const N_0x71 = 0x71n; +const BYTE_TO_BIGINT_256 = /* @__PURE__ */ (() => { + const out = new Array(256); + let i = 0; + let value = 0n; + while (i < 256) { + out[i] = value; + i++; + value += 1n; + } + return out; +})(); + + +/***/ }), + +/***/ 53953: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/constants/index.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var constants = exports; + +// Helper +constants._reverse = function reverse(map) { + var res = {}; + + Object.keys(map).forEach(function(key) { + // Convert key to integer if it is stringified + if ((key | 0) == key) + key = key | 0; + + var value = map[key]; + res[value] = key; + }); + + return res; +}; + +constants.der = __webpack_require__(/*! ./der */ 49230); + + +/***/ }), + +/***/ 54527: +/*!**************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/state.js ***! + \**************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__webpack_require__(/*! ../../../errors */ 31788).codes).ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ 54570: +/*!************************************************************************************!*\ + !*** ../node_modules/.pnpm/bs58check@4.0.0/node_modules/bs58check/src/esm/base.js ***! + \************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* export default binding */ __WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var bs58__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bs58 */ 2397); + + +/* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(checksumFn) { + // Encode a buffer as a base58-check encoded string + function encode(payload) { + var payloadU8 = Uint8Array.from(payload); + var checksum = checksumFn(payloadU8); + var length = payloadU8.length + 4; + var both = new Uint8Array(length); + both.set(payloadU8, 0); + both.set(checksum.subarray(0, 4), payloadU8.length); + return bs58__WEBPACK_IMPORTED_MODULE_0__["default"].encode(both); + } + function decodeRaw(buffer) { + var payload = buffer.slice(0, -4); + var checksum = buffer.slice(-4); + var newChecksum = checksumFn(payload); + // eslint-disable-next-line + if (checksum[0] ^ newChecksum[0] | + checksum[1] ^ newChecksum[1] | + checksum[2] ^ newChecksum[2] | + checksum[3] ^ newChecksum[3]) + return; + return payload; + } + // Decode a base58-check encoded string to a buffer, no result if checksum is wrong + function decodeUnsafe(str) { + var buffer = bs58__WEBPACK_IMPORTED_MODULE_0__["default"].decodeUnsafe(str); + if (buffer == null) + return; + return decodeRaw(buffer); + } + function decode(str) { + var buffer = bs58__WEBPACK_IMPORTED_MODULE_0__["default"].decode(str); + var payload = decodeRaw(buffer); + if (payload == null) + throw new Error('Invalid checksum'); + return payload; + } + return { + encode: encode, + decode: decode, + decodeUnsafe: decodeUnsafe + }; +} + + +/***/ }), + +/***/ 54697: +/*!***********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/providers/factory-provider.js ***! + \***********************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isFactoryProvider: () => (/* binding */ isFactoryProvider) +/* harmony export */ }); +function isFactoryProvider(provider) { + return !!provider.useFactory; +} + + +/***/ }), + +/***/ 54823: +/*!*****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/class_list.js ***! + \*****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ ClassList: () => (/* binding */ ClassList), +/* harmony export */ ClassListFlags: () => (/* binding */ ClassListFlags) +/* harmony export */ }); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + +var ClassListFlags; +(function (ClassListFlags) { + ClassListFlags[ClassListFlags["unmarked"] = 1] = "unmarked"; + ClassListFlags[ClassListFlags["unclassified"] = 2] = "unclassified"; + ClassListFlags[ClassListFlags["restricted"] = 4] = "restricted"; + ClassListFlags[ClassListFlags["confidential"] = 8] = "confidential"; + ClassListFlags[ClassListFlags["secret"] = 16] = "secret"; + ClassListFlags[ClassListFlags["topSecret"] = 32] = "topSecret"; +})(ClassListFlags || (ClassListFlags = {})); +class ClassList extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_0__.BitString { +} + + +/***/ }), + +/***/ 54866: +/*!*******************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+encoding@0.6.0/node_modules/@turnkey/encoding/dist/bs58check.mjs ***! + \*******************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ bs58check: () => (/* binding */ bs58check) +/* harmony export */ }); +/* harmony import */ var bs58check__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! bs58check */ 51527); + + +// This is a temporary shim for bs58check@4.0.0 +// +// See: https://github.com/bitcoinjs/bs58check/issues/47 +// +// bs58check v4.0.0 uses ESM with only a default export, which causes compatibility +// issues with Metro (React Native). When importing the package using +// `import bs58check from 'bs58check'`, Metro applies multiple levels of wrapping, +// resulting in a structure like `{ default: { default: { encode, decode, ... } } }`. +// +// This shim unwraps the exports until it reaches the object that contains `.decode`, +// `.encode`, and `.decodeUnsafe`, allowing consistent usage across platforms. +// +// We can remove this shim once bs58check publishes a version that properly re-exports +// named methods from its ESM build +function unwrap(obj) { + let cur = obj; + while (cur && + !(cur.encode && cur.decode && cur.decodeUnsafe) && + cur.default) { + cur = cur.default; + } + return cur; +} +const bs58check = unwrap(bs58check__WEBPACK_IMPORTED_MODULE_0__); + + +//# sourceMappingURL=bs58check.mjs.map + + +/***/ }), + +/***/ 54933: +/*!*************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/transaction/getSerializedTransactionType.js ***! + \*************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ getSerializedTransactionType: () => (/* binding */ getSerializedTransactionType) +/* harmony export */ }); +/* harmony import */ var _errors_transaction_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/transaction.js */ 24092); +/* harmony import */ var _data_slice_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/slice.js */ 49451); +/* harmony import */ var _encoding_fromHex_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../encoding/fromHex.js */ 58269); + + + +function getSerializedTransactionType(serializedTransaction) { + const serializedType = (0,_data_slice_js__WEBPACK_IMPORTED_MODULE_1__.sliceHex)(serializedTransaction, 0, 1); + if (serializedType === '0x04') + return 'eip7702'; + if (serializedType === '0x03') + return 'eip4844'; + if (serializedType === '0x02') + return 'eip1559'; + if (serializedType === '0x01') + return 'eip2930'; + if (serializedType !== '0x' && (0,_encoding_fromHex_js__WEBPACK_IMPORTED_MODULE_2__.hexToNumber)(serializedType) >= 0xc0) + return 'legacy'; + throw new _errors_transaction_js__WEBPACK_IMPORTED_MODULE_0__.InvalidSerializedTransactionTypeError({ serializedType }); +} +//# sourceMappingURL=getSerializedTransactionType.js.map + +/***/ }), + +/***/ 54955: +/*!***********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/utf8.js ***! + \***********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ utf8: () => (/* binding */ utf8) +/* harmony export */ }); +/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ 15246); + +function encode(text) { + return new TextEncoder().encode(text); +} +function decode(data) { + return new TextDecoder("utf-8", { fatal: false }).decode((0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data)); +} +const utf8 = { encode, decode }; + + +/***/ }), + +/***/ 55311: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/get-proto@1.0.1/node_modules/get-proto/Object.getPrototypeOf.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $Object = __webpack_require__(/*! es-object-atoms */ 56009); + +/** @type {import('./Object.getPrototypeOf')} */ +module.exports = $Object.getPrototypeOf || null; + + +/***/ }), + +/***/ 55334: +/*!**************************************************************************!*\ + !*** ../node_modules/.pnpm/tslib@1.14.1/node_modules/tslib/tslib.es6.js ***! + \**************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ __assign: () => (/* binding */ __assign), +/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator), +/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator), +/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues), +/* harmony export */ __await: () => (/* binding */ __await), +/* harmony export */ __awaiter: () => (/* binding */ __awaiter), +/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet), +/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet), +/* harmony export */ __createBinding: () => (/* binding */ __createBinding), +/* harmony export */ __decorate: () => (/* binding */ __decorate), +/* harmony export */ __exportStar: () => (/* binding */ __exportStar), +/* harmony export */ __extends: () => (/* binding */ __extends), +/* harmony export */ __generator: () => (/* binding */ __generator), +/* harmony export */ __importDefault: () => (/* binding */ __importDefault), +/* harmony export */ __importStar: () => (/* binding */ __importStar), +/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject), +/* harmony export */ __metadata: () => (/* binding */ __metadata), +/* harmony export */ __param: () => (/* binding */ __param), +/* harmony export */ __read: () => (/* binding */ __read), +/* harmony export */ __rest: () => (/* binding */ __rest), +/* harmony export */ __spread: () => (/* binding */ __spread), +/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays), +/* harmony export */ __values: () => (/* binding */ __values) +/* harmony export */ }); +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +function __createBinding(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +} + +function __exportStar(m, exports) { + for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p]; +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +}; + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; + result.default = mod; + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); +} + +function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; +} + + +/***/ }), + +/***/ 55363: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/authenticated_safe.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AuthenticatedSafe: () => (/* binding */ AuthenticatedSafe) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_cms__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-cms */ 73116); +var AuthenticatedSafe_1; + + + +let AuthenticatedSafe = AuthenticatedSafe_1 = class AuthenticatedSafe extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, AuthenticatedSafe_1.prototype); + } +}; +AuthenticatedSafe = AuthenticatedSafe_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _peculiar_asn1_cms__WEBPACK_IMPORTED_MODULE_2__.ContentInfo, + }) +], AuthenticatedSafe); + + + +/***/ }), + +/***/ 55479: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/hash.js@1.1.7/node_modules/hash.js/lib/hash/sha/common.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var utils = __webpack_require__(/*! ../utils */ 27152); +var rotr32 = utils.rotr32; + +function ft_1(s, x, y, z) { + if (s === 0) + return ch32(x, y, z); + if (s === 1 || s === 3) + return p32(x, y, z); + if (s === 2) + return maj32(x, y, z); +} +exports.ft_1 = ft_1; + +function ch32(x, y, z) { + return (x & y) ^ ((~x) & z); +} +exports.ch32 = ch32; + +function maj32(x, y, z) { + return (x & y) ^ (x & z) ^ (y & z); +} +exports.maj32 = maj32; + +function p32(x, y, z) { + return x ^ y ^ z; +} +exports.p32 = p32; + +function s0_256(x) { + return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22); +} +exports.s0_256 = s0_256; + +function s1_256(x) { + return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25); +} +exports.s1_256 = s1_256; + +function g0_256(x) { + return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3); +} +exports.g0_256 = g0_256; + +function g1_256(x) { + return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10); +} +exports.g1_256 = g1_256; + + +/***/ }), + +/***/ 55635: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/schema.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnSchemaStorage: () => (/* binding */ AsnSchemaStorage) +/* harmony export */ }); +/* harmony import */ var asn1js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! asn1js */ 55966); +/* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./enums.js */ 55904); +/* harmony import */ var _helper_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./helper.js */ 66676); + + + +class AsnSchemaStorage { + items = new WeakMap(); + has(target) { + return this.items.has(target); + } + get(target, checkSchema = false) { + const schema = this.items.get(target); + if (!schema) { + throw new Error(`Cannot get schema for '${target.prototype.constructor.name}' target`); + } + if (checkSchema && !schema.schema) { + throw new Error(`Schema '${target.prototype.constructor.name}' doesn't contain ASN.1 schema. Call 'AsnSchemaStorage.cache'.`); + } + return schema; + } + cache(target) { + const schema = this.get(target); + if (!schema.schema) { + schema.schema = this.create(target, true); + } + } + createDefault(target) { + const schema = { + type: _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, items: {}, + }; + const parentSchema = this.findParentSchema(target); + if (parentSchema) { + Object.assign(schema, parentSchema); + schema.items = Object.assign({}, schema.items, parentSchema.items); + } + return schema; + } + create(target, useNames) { + const schema = this.items.get(target) || this.createDefault(target); + const asn1Value = []; + for (const key in schema.items) { + const item = schema.items[key]; + const name = useNames ? key : ""; + let asn1Item; + if (typeof item.type === "number") { + const Asn1TypeName = _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes[item.type]; + const Asn1Type = asn1js__WEBPACK_IMPORTED_MODULE_0__[Asn1TypeName]; + if (!Asn1Type) { + throw new Error(`Cannot get ASN1 class by name '${Asn1TypeName}'`); + } + asn1Item = new Asn1Type({ name }); + } + else if ((0,_helper_js__WEBPACK_IMPORTED_MODULE_2__.isConvertible)(item.type)) { + const instance = new item.type(); + asn1Item = instance.toSchema(name); + } + else if (item.optional) { + const itemSchema = this.get(item.type); + if (itemSchema.type === _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice) { + asn1Item = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Any({ name }); + } + else { + asn1Item = this.create(item.type, false); + asn1Item.name = name; + } + } + else { + asn1Item = new asn1js__WEBPACK_IMPORTED_MODULE_0__.Any({ name }); + } + const optional = !!item.optional || item.defaultValue !== undefined; + if (item.repeated) { + asn1Item.name = ""; + const Container = item.repeated === "set" ? asn1js__WEBPACK_IMPORTED_MODULE_0__.Set : asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence; + asn1Item = new Container({ + name: "", + value: [new asn1js__WEBPACK_IMPORTED_MODULE_0__.Repeated({ + name, value: asn1Item, + })], + }); + } + if (item.context !== null && item.context !== undefined) { + if (item.implicit) { + if (typeof item.type === "number" || (0,_helper_js__WEBPACK_IMPORTED_MODULE_2__.isConvertible)(item.type)) { + const Container = item.repeated ? asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed : asn1js__WEBPACK_IMPORTED_MODULE_0__.Primitive; + asn1Value.push(new Container({ + name, optional, idBlock: { + tagClass: 3, tagNumber: item.context, + }, + })); + } + else { + this.cache(item.type); + const isRepeated = !!item.repeated; + let value = !isRepeated ? this.get(item.type, true).schema : asn1Item; + value + = "valueBlock" in value + ? value.valueBlock.value + : value.value; + asn1Value.push(new asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed({ + name: !isRepeated ? name : "", + optional, + idBlock: { + tagClass: 3, tagNumber: item.context, + }, + value: value, + })); + } + } + else { + asn1Value.push(new asn1js__WEBPACK_IMPORTED_MODULE_0__.Constructed({ + optional, + idBlock: { + tagClass: 3, tagNumber: item.context, + }, + value: [asn1Item], + })); + } + } + else { + asn1Item.optional = optional; + asn1Value.push(asn1Item); + } + } + switch (schema.type) { + case _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence: + return new asn1js__WEBPACK_IMPORTED_MODULE_0__.Sequence({ + value: asn1Value, name: "", + }); + case _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set: + return new asn1js__WEBPACK_IMPORTED_MODULE_0__.Set({ + value: asn1Value, name: "", + }); + case _enums_js__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice: + return new asn1js__WEBPACK_IMPORTED_MODULE_0__.Choice({ + value: asn1Value, name: "", + }); + default: + throw new Error("Unsupported ASN1 type in use"); + } + } + set(target, schema) { + this.items.set(target, schema); + return this; + } + findParentSchema(target) { + const parent = Object.getPrototypeOf(target); + if (parent) { + const schema = this.items.get(parent); + return schema || this.findParentSchema(parent); + } + return null; + } +} + + +/***/ }), + +/***/ 55766: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/curve/modular.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ mod: () => (/* binding */ mod), +/* harmony export */ pow2: () => (/* binding */ pow2) +/* harmony export */ }); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../consts.js */ 53838); +/** + * This file is based on noble-curves (https://github.com/paulmillr/noble-curves). + * + * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/abstract/modular.ts + */ +/** + * Utils for modular division and fields. + * Field over 11 is a finite (Galois) field is integer number operations `mod 11`. + * There is no division: it is replaced by modular multiplicative inverse. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + +// Numbers aren't used in x25519 / x448 builds +// Calculates a modulo b +function mod(a, b) { + const result = a % b; + return result >= _consts_js__WEBPACK_IMPORTED_MODULE_0__.N_0 ? result : b + result; +} +/** Does `x^(2^power)` mod p. `pow2(30, 4)` == `30^(2^4)` */ +function pow2(x, power, modulo) { + let res = x; + while (power-- > _consts_js__WEBPACK_IMPORTED_MODULE_0__.N_0) { + res *= res; + res %= modulo; + } + return res; +} + + +/***/ }), + +/***/ 55897: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/curves.js ***! + \*****************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var curves = exports; + +var hash = __webpack_require__(/*! hash.js */ 5222); +var curve = __webpack_require__(/*! ./curve */ 5353); +var utils = __webpack_require__(/*! ./utils */ 28432); + +var assert = utils.assert; + +function PresetCurve(options) { + if (options.type === 'short') + this.curve = new curve.short(options); + else if (options.type === 'edwards') + this.curve = new curve.edwards(options); + else + this.curve = new curve.mont(options); + this.g = this.curve.g; + this.n = this.curve.n; + this.hash = options.hash; + + assert(this.g.validate(), 'Invalid curve'); + assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O'); +} +curves.PresetCurve = PresetCurve; + +function defineCurve(name, options) { + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + get: function() { + var curve = new PresetCurve(options); + Object.defineProperty(curves, name, { + configurable: true, + enumerable: true, + value: curve, + }); + return curve; + }, + }); +} + +defineCurve('p192', { + type: 'short', + prime: 'p192', + p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc', + b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1', + n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831', + hash: hash.sha256, + gRed: false, + g: [ + '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012', + '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811', + ], +}); + +defineCurve('p224', { + type: 'short', + prime: 'p224', + p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001', + a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe', + b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4', + n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d', + hash: hash.sha256, + gRed: false, + g: [ + 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21', + 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34', + ], +}); + +defineCurve('p256', { + type: 'short', + prime: null, + p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff', + a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc', + b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b', + n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551', + hash: hash.sha256, + gRed: false, + g: [ + '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296', + '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5', + ], +}); + +defineCurve('p384', { + type: 'short', + prime: null, + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 ffffffff', + a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'fffffffe ffffffff 00000000 00000000 fffffffc', + b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' + + '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef', + n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' + + 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973', + hash: hash.sha384, + gRed: false, + g: [ + 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' + + '5502f25d bf55296c 3a545e38 72760ab7', + '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' + + '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f', + ], +}); + +defineCurve('p521', { + type: 'short', + prime: null, + p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff', + a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff ffffffff ffffffff fffffffc', + b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' + + '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' + + '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00', + n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' + + 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' + + 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409', + hash: hash.sha512, + gRed: false, + g: [ + '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' + + '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' + + 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66', + '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' + + '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' + + '3fad0761 353c7086 a272c240 88be9476 9fd16650', + ], +}); + +defineCurve('curve25519', { + type: 'mont', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '76d06', + b: '1', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '9', + ], +}); + +defineCurve('ed25519', { + type: 'edwards', + prime: 'p25519', + p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed', + a: '-1', + c: '1', + // -121665 * (121666^(-1)) (mod P) + d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3', + n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed', + hash: hash.sha256, + gRed: false, + g: [ + '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a', + + // 4/5 + '6666666666666666666666666666666666666666666666666666666666666658', + ], +}); + +var pre; +try { + pre = __webpack_require__(/*! ./precomputed/secp256k1 */ 18664); +} catch (e) { + pre = undefined; +} + +defineCurve('secp256k1', { + type: 'short', + prime: 'k256', + p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f', + a: '0', + b: '7', + n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141', + h: '1', + hash: hash.sha256, + + // Precomputed endomorphism + beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee', + lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72', + basis: [ + { + a: '3086d221a7d46bcde86c90e49284eb15', + b: '-e4437ed6010e88286f547fa90abfe4c3', + }, + { + a: '114ca50f7a8e2f3f657c1108d9d44cfd8', + b: '3086d221a7d46bcde86c90e49284eb15', + }, + ], + + gRed: false, + g: [ + '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798', + '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8', + pre, + ], +}); + + +/***/ }), + +/***/ 55904: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/enums.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnPropTypes: () => (/* binding */ AsnPropTypes), +/* harmony export */ AsnTypeTypes: () => (/* binding */ AsnTypeTypes) +/* harmony export */ }); +var AsnTypeTypes; +(function (AsnTypeTypes) { + AsnTypeTypes[AsnTypeTypes["Sequence"] = 0] = "Sequence"; + AsnTypeTypes[AsnTypeTypes["Set"] = 1] = "Set"; + AsnTypeTypes[AsnTypeTypes["Choice"] = 2] = "Choice"; +})(AsnTypeTypes || (AsnTypeTypes = {})); +var AsnPropTypes; +(function (AsnPropTypes) { + AsnPropTypes[AsnPropTypes["Any"] = 1] = "Any"; + AsnPropTypes[AsnPropTypes["Boolean"] = 2] = "Boolean"; + AsnPropTypes[AsnPropTypes["OctetString"] = 3] = "OctetString"; + AsnPropTypes[AsnPropTypes["BitString"] = 4] = "BitString"; + AsnPropTypes[AsnPropTypes["Integer"] = 5] = "Integer"; + AsnPropTypes[AsnPropTypes["Enumerated"] = 6] = "Enumerated"; + AsnPropTypes[AsnPropTypes["ObjectIdentifier"] = 7] = "ObjectIdentifier"; + AsnPropTypes[AsnPropTypes["Utf8String"] = 8] = "Utf8String"; + AsnPropTypes[AsnPropTypes["BmpString"] = 9] = "BmpString"; + AsnPropTypes[AsnPropTypes["UniversalString"] = 10] = "UniversalString"; + AsnPropTypes[AsnPropTypes["NumericString"] = 11] = "NumericString"; + AsnPropTypes[AsnPropTypes["PrintableString"] = 12] = "PrintableString"; + AsnPropTypes[AsnPropTypes["TeletexString"] = 13] = "TeletexString"; + AsnPropTypes[AsnPropTypes["VideotexString"] = 14] = "VideotexString"; + AsnPropTypes[AsnPropTypes["IA5String"] = 15] = "IA5String"; + AsnPropTypes[AsnPropTypes["GraphicString"] = 16] = "GraphicString"; + AsnPropTypes[AsnPropTypes["VisibleString"] = 17] = "VisibleString"; + AsnPropTypes[AsnPropTypes["GeneralString"] = 18] = "GeneralString"; + AsnPropTypes[AsnPropTypes["CharacterString"] = 19] = "CharacterString"; + AsnPropTypes[AsnPropTypes["UTCTime"] = 20] = "UTCTime"; + AsnPropTypes[AsnPropTypes["GeneralizedTime"] = 21] = "GeneralizedTime"; + AsnPropTypes[AsnPropTypes["DATE"] = 22] = "DATE"; + AsnPropTypes[AsnPropTypes["TimeOfDay"] = 23] = "TimeOfDay"; + AsnPropTypes[AsnPropTypes["DateTime"] = 24] = "DateTime"; + AsnPropTypes[AsnPropTypes["Duration"] = 25] = "Duration"; + AsnPropTypes[AsnPropTypes["TIME"] = 26] = "TIME"; + AsnPropTypes[AsnPropTypes["Null"] = 27] = "Null"; +})(AsnPropTypes || (AsnPropTypes = {})); + + +/***/ }), + +/***/ 55966: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1js@3.0.10/node_modules/asn1js/build/index.es.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Any: () => (/* binding */ Any), +/* harmony export */ BaseBlock: () => (/* binding */ BaseBlock), +/* harmony export */ BaseStringBlock: () => (/* binding */ BaseStringBlock), +/* harmony export */ BitString: () => (/* binding */ BitString), +/* harmony export */ BmpString: () => (/* binding */ BmpString), +/* harmony export */ Boolean: () => (/* binding */ Boolean), +/* harmony export */ CharacterString: () => (/* binding */ CharacterString), +/* harmony export */ Choice: () => (/* binding */ Choice), +/* harmony export */ Constructed: () => (/* binding */ Constructed), +/* harmony export */ DATE: () => (/* binding */ DATE), +/* harmony export */ DEFAULT_MAX_CONTENT_LENGTH: () => (/* binding */ DEFAULT_MAX_CONTENT_LENGTH), +/* harmony export */ DEFAULT_MAX_DEPTH: () => (/* binding */ DEFAULT_MAX_DEPTH), +/* harmony export */ DEFAULT_MAX_NODES: () => (/* binding */ DEFAULT_MAX_NODES), +/* harmony export */ DateTime: () => (/* binding */ DateTime), +/* harmony export */ Duration: () => (/* binding */ Duration), +/* harmony export */ EndOfContent: () => (/* binding */ EndOfContent), +/* harmony export */ Enumerated: () => (/* binding */ Enumerated), +/* harmony export */ GeneralString: () => (/* binding */ GeneralString), +/* harmony export */ GeneralizedTime: () => (/* binding */ GeneralizedTime), +/* harmony export */ GraphicString: () => (/* binding */ GraphicString), +/* harmony export */ HexBlock: () => (/* binding */ HexBlock), +/* harmony export */ IA5String: () => (/* binding */ IA5String), +/* harmony export */ Integer: () => (/* binding */ Integer), +/* harmony export */ Null: () => (/* binding */ Null), +/* harmony export */ NumericString: () => (/* binding */ NumericString), +/* harmony export */ ObjectIdentifier: () => (/* binding */ ObjectIdentifier), +/* harmony export */ OctetString: () => (/* binding */ OctetString), +/* harmony export */ Primitive: () => (/* binding */ Primitive), +/* harmony export */ PrintableString: () => (/* binding */ PrintableString), +/* harmony export */ RawData: () => (/* binding */ RawData), +/* harmony export */ RelativeObjectIdentifier: () => (/* binding */ RelativeObjectIdentifier), +/* harmony export */ Repeated: () => (/* binding */ Repeated), +/* harmony export */ Sequence: () => (/* binding */ Sequence), +/* harmony export */ Set: () => (/* binding */ Set), +/* harmony export */ TIME: () => (/* binding */ TIME), +/* harmony export */ TeletexString: () => (/* binding */ TeletexString), +/* harmony export */ TimeOfDay: () => (/* binding */ TimeOfDay), +/* harmony export */ UTCTime: () => (/* binding */ UTCTime), +/* harmony export */ UniversalString: () => (/* binding */ UniversalString), +/* harmony export */ Utf8String: () => (/* binding */ Utf8String), +/* harmony export */ ValueBlock: () => (/* binding */ ValueBlock), +/* harmony export */ VideotexString: () => (/* binding */ VideotexString), +/* harmony export */ ViewWriter: () => (/* binding */ ViewWriter), +/* harmony export */ VisibleString: () => (/* binding */ VisibleString), +/* harmony export */ compareSchema: () => (/* binding */ compareSchema), +/* harmony export */ fromBER: () => (/* binding */ fromBER), +/* harmony export */ verifySchema: () => (/* binding */ verifySchema) +/* harmony export */ }); +/* harmony import */ var pvtsutils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! pvtsutils */ 32534); +/* harmony import */ var pvutils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! pvutils */ 52332); +/*! + * Copyright (c) 2014, GMO GlobalSign + * Copyright (c) 2015-2022, Peculiar Ventures + * All rights reserved. + * + * Author 2014-2019, Yury Strozhevsky + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright notice, this + * list of conditions and the following disclaimer in the documentation and/or + * other materials provided with the distribution. + * + * * Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + + + + +function assertBigInt() { + if (typeof BigInt === "undefined") { + throw new Error("BigInt is not defined. Your environment doesn't implement BigInt."); + } +} +function concat(buffers) { + let outputLength = 0; + let prevLength = 0; + for (let i = 0; i < buffers.length; i++) { + const buffer = buffers[i]; + outputLength += buffer.byteLength; + } + const retView = new Uint8Array(outputLength); + for (let i = 0; i < buffers.length; i++) { + const buffer = buffers[i]; + retView.set(new Uint8Array(buffer), prevLength); + prevLength += buffer.byteLength; + } + return retView.buffer; +} +function checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength) { + if (!(inputBuffer instanceof Uint8Array)) { + baseBlock.error = "Wrong parameter: inputBuffer must be 'Uint8Array'"; + return false; + } + if (!inputBuffer.byteLength) { + baseBlock.error = "Wrong parameter: inputBuffer has zero length"; + return false; + } + if (inputOffset < 0) { + baseBlock.error = "Wrong parameter: inputOffset less than zero"; + return false; + } + if (inputLength < 0) { + baseBlock.error = "Wrong parameter: inputLength less than zero"; + return false; + } + if ((inputBuffer.byteLength - inputOffset - inputLength) < 0) { + baseBlock.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return false; + } + return true; +} + +class ViewWriter { + constructor() { + this.items = []; + } + write(buf) { + this.items.push(buf); + } + final() { + return concat(this.items); + } +} + +const powers2 = [new Uint8Array([1])]; +const digitsString = "0123456789"; +const NAME = "name"; +const VALUE_HEX_VIEW = "valueHexView"; +const IS_HEX_ONLY = "isHexOnly"; +const ID_BLOCK = "idBlock"; +const TAG_CLASS = "tagClass"; +const TAG_NUMBER = "tagNumber"; +const IS_CONSTRUCTED = "isConstructed"; +const FROM_BER = "fromBER"; +const TO_BER = "toBER"; +const LOCAL = "local"; +const EMPTY_STRING = ""; +const EMPTY_BUFFER = new ArrayBuffer(0); +const EMPTY_VIEW = new Uint8Array(0); +const END_OF_CONTENT_NAME = "EndOfContent"; +const OCTET_STRING_NAME = "OCTET STRING"; +const BIT_STRING_NAME = "BIT STRING"; + +function HexBlock(BaseClass) { + var _a; + return _a = class Some extends BaseClass { + get valueHex() { + return this.valueHexView.slice().buffer; + } + set valueHex(value) { + this.valueHexView = new Uint8Array(value); + } + constructor(...args) { + var _b; + super(...args); + const params = args[0] || {}; + this.isHexOnly = (_b = params.isHexOnly) !== null && _b !== void 0 ? _b : false; + this.valueHexView = params.valueHex ? pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(params.valueHex) : EMPTY_VIEW; + } + fromBER(inputBuffer, inputOffset, inputLength, _context) { + const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer; + if (!checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + const endLength = inputOffset + inputLength; + this.valueHexView = view.subarray(inputOffset, endLength); + if (!this.valueHexView.length) { + this.warnings.push("Zero buffer length"); + return inputOffset; + } + this.blockLength = inputLength; + return endLength; + } + toBER(sizeOnly = false) { + if (!this.isHexOnly) { + this.error = "Flag 'isHexOnly' is not set, abort"; + return EMPTY_BUFFER; + } + if (sizeOnly) { + return new ArrayBuffer(this.valueHexView.byteLength); + } + return (this.valueHexView.byteLength === this.valueHexView.buffer.byteLength) + ? this.valueHexView.buffer + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + isHexOnly: this.isHexOnly, + valueHex: pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView), + }; + } + }, + _a.NAME = "hexBlock", + _a; +} + +class LocalBaseBlock { + static blockName() { + return this.NAME; + } + get valueBeforeDecode() { + return this.valueBeforeDecodeView.slice().buffer; + } + set valueBeforeDecode(value) { + this.valueBeforeDecodeView = new Uint8Array(value); + } + constructor({ blockLength = 0, error = EMPTY_STRING, warnings = [], valueBeforeDecode = EMPTY_VIEW, } = {}) { + this.blockLength = blockLength; + this.error = error; + this.warnings = warnings; + this.valueBeforeDecodeView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(valueBeforeDecode); + } + toJSON() { + return { + blockName: this.constructor.NAME, + blockLength: this.blockLength, + error: this.error, + warnings: this.warnings, + valueBeforeDecode: pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBeforeDecodeView), + }; + } +} +LocalBaseBlock.NAME = "baseBlock"; + +class ValueBlock extends LocalBaseBlock { + fromBER(_inputBuffer, _inputOffset, _inputLength, _context) { + throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); + } + toBER(_sizeOnly, _writer) { + throw TypeError("User need to make a specific function in a class which extends 'ValueBlock'"); + } +} +ValueBlock.NAME = "valueBlock"; + +class LocalIdentificationBlock extends HexBlock(LocalBaseBlock) { + constructor({ idBlock = {} } = {}) { + var _a, _b, _c, _d; + super(); + if (idBlock) { + this.isHexOnly = (_a = idBlock.isHexOnly) !== null && _a !== void 0 ? _a : false; + this.valueHexView = idBlock.valueHex + ? pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(idBlock.valueHex) + : EMPTY_VIEW; + this.tagClass = (_b = idBlock.tagClass) !== null && _b !== void 0 ? _b : -1; + this.tagNumber = (_c = idBlock.tagNumber) !== null && _c !== void 0 ? _c : -1; + this.isConstructed = (_d = idBlock.isConstructed) !== null && _d !== void 0 ? _d : false; + } + else { + this.tagClass = -1; + this.tagNumber = -1; + this.isConstructed = false; + } + } + toBER(sizeOnly = false) { + let firstOctet = 0; + switch (this.tagClass) { + case 1: + firstOctet |= 0x00; + break; + case 2: + firstOctet |= 0x40; + break; + case 3: + firstOctet |= 0x80; + break; + case 4: + firstOctet |= 0xC0; + break; + default: + this.error = "Unknown tag class"; + return EMPTY_BUFFER; + } + if (this.isConstructed) + firstOctet |= 0x20; + if (this.tagNumber < 31 && !this.isHexOnly) { + const retView = new Uint8Array(1); + if (!sizeOnly) { + let number = this.tagNumber; + number &= 0x1F; + firstOctet |= number; + retView[0] = firstOctet; + } + return retView.buffer; + } + if (!this.isHexOnly) { + const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.tagNumber, 7); + const encodedView = new Uint8Array(encodedBuf); + const size = encodedBuf.byteLength; + const retView = new Uint8Array(size + 1); + retView[0] = (firstOctet | 0x1F); + if (!sizeOnly) { + for (let i = 0; i < (size - 1); i++) + retView[i + 1] = encodedView[i] | 0x80; + retView[size] = encodedView[size - 1]; + } + return retView.buffer; + } + const retView = new Uint8Array(this.valueHexView.byteLength + 1); + retView[0] = (firstOctet | 0x1F); + if (!sizeOnly) { + const curView = this.valueHexView; + for (let i = 0; i < (curView.length - 1); i++) + retView[i + 1] = curView[i] | 0x80; + retView[this.valueHexView.byteLength] = curView[curView.length - 1]; + } + return retView.buffer; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + if (intBuffer.length === 0) { + this.error = "Zero buffer length"; + return -1; + } + const tagClassMask = intBuffer[0] & 0xC0; + switch (tagClassMask) { + case 0x00: + this.tagClass = (1); + break; + case 0x40: + this.tagClass = (2); + break; + case 0x80: + this.tagClass = (3); + break; + case 0xC0: + this.tagClass = (4); + break; + default: + this.error = "Unknown tag class"; + return -1; + } + this.isConstructed = (intBuffer[0] & 0x20) === 0x20; + this.isHexOnly = false; + const tagNumberMask = intBuffer[0] & 0x1F; + if (tagNumberMask !== 0x1F) { + this.tagNumber = (tagNumberMask); + this.blockLength = 1; + } + else { + let count = 0; + while (true) { + const tagByteIndex = count + 1; + if (tagByteIndex >= intBuffer.length) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + count++; + if ((intBuffer[tagByteIndex] & 0x80) === 0x00) + break; + } + this.blockLength = (count + 1); + const intTagNumberBuffer = this.valueHexView = new Uint8Array(count); + for (let i = 0; i < count; i++) + intTagNumberBuffer[i] = intBuffer[i + 1] & 0x7F; + if (this.blockLength <= 9) + this.tagNumber = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(intTagNumberBuffer, 7); + else { + this.isHexOnly = true; + this.warnings.push("Tag too long, represented as hex-coded"); + } + } + if (((this.tagClass === 1)) + && (this.isConstructed)) { + switch (this.tagNumber) { + case 1: + case 2: + case 5: + case 6: + case 9: + case 13: + case 14: + case 23: + case 24: + case 31: + case 32: + case 33: + case 34: + this.error = "Constructed encoding used for primitive type"; + return -1; + } + } + return (inputOffset + this.blockLength); + } + toJSON() { + return { + ...super.toJSON(), + tagClass: this.tagClass, + tagNumber: this.tagNumber, + isConstructed: this.isConstructed, + }; + } +} +LocalIdentificationBlock.NAME = "identificationBlock"; + +class LocalLengthBlock extends LocalBaseBlock { + constructor({ lenBlock = {} } = {}) { + var _a, _b, _c; + super(); + this.isIndefiniteForm = (_a = lenBlock.isIndefiniteForm) !== null && _a !== void 0 ? _a : false; + this.longFormUsed = (_b = lenBlock.longFormUsed) !== null && _b !== void 0 ? _b : false; + this.length = (_c = lenBlock.length) !== null && _c !== void 0 ? _c : 0; + } + fromBER(inputBuffer, inputOffset, inputLength) { + const view = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + const intBuffer = view.subarray(inputOffset, inputOffset + inputLength); + if (intBuffer.length === 0) { + this.error = "Zero buffer length"; + return -1; + } + if (intBuffer[0] === 0xFF) { + this.error = "Length block 0xFF is reserved by standard"; + return -1; + } + this.isIndefiniteForm = intBuffer[0] === 0x80; + if (this.isIndefiniteForm) { + this.blockLength = 1; + return (inputOffset + this.blockLength); + } + this.longFormUsed = !!(intBuffer[0] & 0x80); + if (this.longFormUsed === false) { + this.length = (intBuffer[0]); + this.blockLength = 1; + return (inputOffset + this.blockLength); + } + const count = intBuffer[0] & 0x7F; + if (count > 8) { + this.error = "Too big integer"; + return -1; + } + if ((count + 1) > intBuffer.length) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + const lenOffset = inputOffset + 1; + const lengthBufferView = view.subarray(lenOffset, lenOffset + count); + if (lengthBufferView[count - 1] === 0x00) + this.warnings.push("Needlessly long encoded length"); + this.length = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(lengthBufferView, 8); + if (this.longFormUsed && (this.length <= 127)) + this.warnings.push("Unnecessary usage of long length form"); + this.blockLength = count + 1; + return (inputOffset + this.blockLength); + } + toBER(sizeOnly = false) { + let retBuf; + let retView; + if (this.length > 127) + this.longFormUsed = true; + if (this.isIndefiniteForm) { + retBuf = new ArrayBuffer(1); + if (sizeOnly === false) { + retView = new Uint8Array(retBuf); + retView[0] = 0x80; + } + return retBuf; + } + if (this.longFormUsed) { + const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.length, 8); + if (encodedBuf.byteLength > 127) { + this.error = "Too big length"; + return (EMPTY_BUFFER); + } + retBuf = new ArrayBuffer(encodedBuf.byteLength + 1); + if (sizeOnly) + return retBuf; + const encodedView = new Uint8Array(encodedBuf); + retView = new Uint8Array(retBuf); + retView[0] = encodedBuf.byteLength | 0x80; + for (let i = 0; i < encodedBuf.byteLength; i++) + retView[i + 1] = encodedView[i]; + return retBuf; + } + retBuf = new ArrayBuffer(1); + if (sizeOnly === false) { + retView = new Uint8Array(retBuf); + retView[0] = this.length; + } + return retBuf; + } + toJSON() { + return { + ...super.toJSON(), + isIndefiniteForm: this.isIndefiniteForm, + longFormUsed: this.longFormUsed, + length: this.length, + }; + } +} +LocalLengthBlock.NAME = "lengthBlock"; + +const typeStore = {}; + +class BaseBlock extends LocalBaseBlock { + constructor({ name = EMPTY_STRING, optional = false, primitiveSchema, ...parameters } = {}, valueBlockType) { + super(parameters); + this.name = name; + this.optional = optional; + if (primitiveSchema) { + this.primitiveSchema = primitiveSchema; + } + this.idBlock = new LocalIdentificationBlock(parameters); + this.lenBlock = new LocalLengthBlock(parameters); + this.valueBlock = valueBlockType ? new valueBlockType(parameters) : new ValueBlock(parameters); + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) + ? inputLength + : this.lenBlock.length, context); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + toBER(sizeOnly, writer) { + const _writer = writer || new ViewWriter(); + if (!writer) { + prepareIndefiniteForm(this); + } + const idBlockBuf = this.idBlock.toBER(sizeOnly); + _writer.write(idBlockBuf); + if (this.lenBlock.isIndefiniteForm) { + _writer.write(new Uint8Array([0x80]).buffer); + this.valueBlock.toBER(sizeOnly, _writer); + _writer.write(new ArrayBuffer(2)); + } + else { + const valueBlockBuf = this.valueBlock.toBER(sizeOnly); + this.lenBlock.length = valueBlockBuf.byteLength; + const lenBlockBuf = this.lenBlock.toBER(sizeOnly); + _writer.write(lenBlockBuf); + _writer.write(valueBlockBuf); + } + if (!writer) { + return _writer.final(); + } + return EMPTY_BUFFER; + } + toJSON() { + const object = { + ...super.toJSON(), + idBlock: this.idBlock.toJSON(), + lenBlock: this.lenBlock.toJSON(), + valueBlock: this.valueBlock.toJSON(), + name: this.name, + optional: this.optional, + }; + if (this.primitiveSchema) + object.primitiveSchema = this.primitiveSchema.toJSON(); + return object; + } + toString(encoding = "ascii") { + if (encoding === "ascii") { + return this.onAsciiEncoding(); + } + return pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.toBER()); + } + onAsciiEncoding() { + const name = this.constructor.NAME; + const value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBlock.valueBeforeDecodeView); + return `${name} : ${value}`; + } + isEqual(other) { + if (this === other) { + return true; + } + if (!(other instanceof this.constructor)) { + return false; + } + const thisRaw = this.toBER(); + const otherRaw = other.toBER(); + return pvutils__WEBPACK_IMPORTED_MODULE_1__.isEqualBuffer(thisRaw, otherRaw); + } +} +BaseBlock.NAME = "BaseBlock"; +function prepareIndefiniteForm(baseBlock) { + var _a; + if (baseBlock instanceof typeStore.Constructed) { + for (const value of baseBlock.valueBlock.value) { + if (prepareIndefiniteForm(value)) { + baseBlock.lenBlock.isIndefiniteForm = true; + } + } + } + return !!((_a = baseBlock.lenBlock) === null || _a === void 0 ? void 0 : _a.isIndefiniteForm); +} + +class BaseStringBlock extends BaseBlock { + getValue() { + return this.valueBlock.value; + } + setValue(value) { + this.valueBlock.value = value; + } + constructor({ value = EMPTY_STRING, ...parameters } = {}, stringValueBlockType) { + super(parameters, stringValueBlockType); + if (value) { + this.fromString(value); + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) + ? inputLength + : this.lenBlock.length); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + this.fromBuffer(this.valueBlock.valueHexView); + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : '${this.valueBlock.value}'`; + } +} +BaseStringBlock.NAME = "BaseStringBlock"; + +class LocalPrimitiveValueBlock extends HexBlock(ValueBlock) { + constructor({ isHexOnly = true, ...parameters } = {}) { + super(parameters); + this.isHexOnly = isHexOnly; + } +} +LocalPrimitiveValueBlock.NAME = "PrimitiveValueBlock"; + +var _a$w; +class Primitive extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalPrimitiveValueBlock); + this.idBlock.isConstructed = false; + } +} +_a$w = Primitive; +(() => { + typeStore.Primitive = _a$w; +})(); +Primitive.NAME = "PRIMITIVE"; + +const DEFAULT_MAX_DEPTH = 100; +const DEFAULT_MAX_NODES = 10000; +const DEFAULT_MAX_CONTENT_LENGTH = 16 * 1024 * 1024; +const MAX_DEPTH_EXCEEDED_ERROR = "Maximum ASN.1 nesting depth exceeded"; +const MAX_NODES_EXCEEDED_ERROR = "Maximum ASN.1 node count exceeded"; +const MAX_CONTENT_LENGTH_EXCEEDED_ERROR = "Maximum ASN.1 content length exceeded"; +function createFromBerContext(options = {}) { + var _a, _b, _c; + return { + depth: 0, + maxDepth: (_a = options.maxDepth) !== null && _a !== void 0 ? _a : DEFAULT_MAX_DEPTH, + nodesCount: 0, + maxNodes: (_b = options.maxNodes) !== null && _b !== void 0 ? _b : DEFAULT_MAX_NODES, + maxContentLength: (_c = options.maxContentLength) !== null && _c !== void 0 ? _c : DEFAULT_MAX_CONTENT_LENGTH, + }; +} +function createErrorResult(error) { + const result = new BaseBlock({}, ValueBlock); + result.error = error; + return { + offset: -1, + result, + }; +} +function checkNodesLimit(context) { + context.nodesCount += 1; + if (context.nodesCount > context.maxNodes) { + return MAX_NODES_EXCEEDED_ERROR; + } + return undefined; +} +function checkContentLengthLimit(inputLength, context) { + if (inputLength > context.maxContentLength) { + return MAX_CONTENT_LENGTH_EXCEEDED_ERROR; + } + return undefined; +} +function localFromBERWithChildContext(inputBuffer, inputOffset, inputLength, context) { + const childDepth = context.depth + 1; + if (childDepth > context.maxDepth) { + return createErrorResult(MAX_DEPTH_EXCEEDED_ERROR); + } + context.depth = childDepth; + try { + return localFromBER(inputBuffer, inputOffset, inputLength, context); + } + finally { + context.depth -= 1; + } +} +function localChangeType(inputObject, newType) { + if (inputObject instanceof newType) { + return inputObject; + } + const newObject = new newType(); + newObject.idBlock = inputObject.idBlock; + newObject.lenBlock = inputObject.lenBlock; + newObject.warnings = inputObject.warnings; + newObject.valueBeforeDecodeView = inputObject.valueBeforeDecodeView; + return newObject; +} +function localFromBER(inputBuffer, inputOffset = 0, inputLength = inputBuffer.length, context = createFromBerContext()) { + const incomingOffset = inputOffset; + let returnObject = new BaseBlock({}, ValueBlock); + const baseBlock = new LocalBaseBlock(); + if (!checkBufferParams(baseBlock, inputBuffer, inputOffset, inputLength)) { + returnObject.error = baseBlock.error; + return { + offset: -1, + result: returnObject, + }; + } + const intBuffer = inputBuffer.subarray(inputOffset, inputOffset + inputLength); + if (!intBuffer.length) { + returnObject.error = "Zero buffer length"; + return { + offset: -1, + result: returnObject, + }; + } + const nodesLimitError = checkNodesLimit(context); + if (nodesLimitError) { + returnObject.error = nodesLimitError; + return { + offset: -1, + result: returnObject, + }; + } + let resultOffset = returnObject.idBlock.fromBER(inputBuffer, inputOffset, inputLength); + if (returnObject.idBlock.warnings.length) { + returnObject.warnings.concat(returnObject.idBlock.warnings); + } + if (resultOffset === -1) { + returnObject.error = returnObject.idBlock.error; + return { + offset: -1, + result: returnObject, + }; + } + inputOffset = resultOffset; + inputLength -= returnObject.idBlock.blockLength; + resultOffset = returnObject.lenBlock.fromBER(inputBuffer, inputOffset, inputLength); + if (returnObject.lenBlock.warnings.length) { + returnObject.warnings.concat(returnObject.lenBlock.warnings); + } + if (resultOffset === -1) { + returnObject.error = returnObject.lenBlock.error; + return { + offset: -1, + result: returnObject, + }; + } + inputOffset = resultOffset; + inputLength -= returnObject.lenBlock.blockLength; + const valueLength = returnObject.lenBlock.isIndefiniteForm ? inputLength : returnObject.lenBlock.length; + const contentLengthError = checkContentLengthLimit(valueLength, context); + if (contentLengthError) { + returnObject.error = contentLengthError; + return { + offset: -1, + result: returnObject, + }; + } + if (!returnObject.idBlock.isConstructed + && returnObject.lenBlock.isIndefiniteForm) { + returnObject.error = "Indefinite length form used for primitive encoding form"; + return { + offset: -1, + result: returnObject, + }; + } + let newASN1Type = BaseBlock; + switch (returnObject.idBlock.tagClass) { + case 1: + if ((returnObject.idBlock.tagNumber >= 37) + && (returnObject.idBlock.isHexOnly === false)) { + returnObject.error = "UNIVERSAL 37 and upper tags are reserved by ASN.1 standard"; + return { + offset: -1, + result: returnObject, + }; + } + switch (returnObject.idBlock.tagNumber) { + case 0: + if ((returnObject.idBlock.isConstructed) + && (returnObject.lenBlock.length > 0)) { + returnObject.error = "Type [UNIVERSAL 0] is reserved"; + return { + offset: -1, + result: returnObject, + }; + } + newASN1Type = typeStore.EndOfContent; + break; + case 1: + newASN1Type = typeStore.Boolean; + break; + case 2: + newASN1Type = typeStore.Integer; + break; + case 3: + newASN1Type = typeStore.BitString; + break; + case 4: + newASN1Type = typeStore.OctetString; + break; + case 5: + newASN1Type = typeStore.Null; + break; + case 6: + newASN1Type = typeStore.ObjectIdentifier; + break; + case 10: + newASN1Type = typeStore.Enumerated; + break; + case 12: + newASN1Type = typeStore.Utf8String; + break; + case 13: + newASN1Type = typeStore.RelativeObjectIdentifier; + break; + case 14: + newASN1Type = typeStore.TIME; + break; + case 15: + returnObject.error = "[UNIVERSAL 15] is reserved by ASN.1 standard"; + return { + offset: -1, + result: returnObject, + }; + case 16: + newASN1Type = typeStore.Sequence; + break; + case 17: + newASN1Type = typeStore.Set; + break; + case 18: + newASN1Type = typeStore.NumericString; + break; + case 19: + newASN1Type = typeStore.PrintableString; + break; + case 20: + newASN1Type = typeStore.TeletexString; + break; + case 21: + newASN1Type = typeStore.VideotexString; + break; + case 22: + newASN1Type = typeStore.IA5String; + break; + case 23: + newASN1Type = typeStore.UTCTime; + break; + case 24: + newASN1Type = typeStore.GeneralizedTime; + break; + case 25: + newASN1Type = typeStore.GraphicString; + break; + case 26: + newASN1Type = typeStore.VisibleString; + break; + case 27: + newASN1Type = typeStore.GeneralString; + break; + case 28: + newASN1Type = typeStore.UniversalString; + break; + case 29: + newASN1Type = typeStore.CharacterString; + break; + case 30: + newASN1Type = typeStore.BmpString; + break; + case 31: + newASN1Type = typeStore.DATE; + break; + case 32: + newASN1Type = typeStore.TimeOfDay; + break; + case 33: + newASN1Type = typeStore.DateTime; + break; + case 34: + newASN1Type = typeStore.Duration; + break; + default: { + const newObject = returnObject.idBlock.isConstructed + ? new typeStore.Constructed() + : new typeStore.Primitive(); + newObject.idBlock = returnObject.idBlock; + newObject.lenBlock = returnObject.lenBlock; + newObject.warnings = returnObject.warnings; + returnObject = newObject; + } + } + break; + case 2: + case 3: + case 4: + default: { + newASN1Type = returnObject.idBlock.isConstructed + ? typeStore.Constructed + : typeStore.Primitive; + } + } + returnObject = localChangeType(returnObject, newASN1Type); + resultOffset = returnObject.fromBER(inputBuffer, inputOffset, valueLength, context); + returnObject.valueBeforeDecodeView = inputBuffer.subarray(incomingOffset, incomingOffset + returnObject.blockLength); + return { + offset: resultOffset, + result: returnObject, + }; +} +function fromBER(inputBuffer, options = {}) { + if (!inputBuffer.byteLength) { + const result = new BaseBlock({}, ValueBlock); + result.error = "Input buffer has zero length"; + return { + offset: -1, + result, + }; + } + return localFromBER(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer).slice(), 0, inputBuffer.byteLength, createFromBerContext(options)); +} + +function checkLen(indefiniteLength, length) { + if (indefiniteLength) { + return 1; + } + return length; +} +class LocalConstructedValueBlock extends ValueBlock { + constructor({ value = [], isIndefiniteForm = false, ...parameters } = {}) { + super(parameters); + this.value = value; + this.isIndefiniteForm = isIndefiniteForm; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + const view = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + const parseContext = context !== null && context !== void 0 ? context : createFromBerContext(); + if (!checkBufferParams(this, view, inputOffset, inputLength)) { + return -1; + } + this.valueBeforeDecodeView = view.subarray(inputOffset, inputOffset + inputLength); + if (this.valueBeforeDecodeView.length === 0) { + this.warnings.push("Zero buffer length"); + return inputOffset; + } + let currentOffset = inputOffset; + while (checkLen(this.isIndefiniteForm, inputLength) > 0) { + const returnObject = localFromBERWithChildContext(view, currentOffset, inputLength, parseContext); + if (returnObject.offset === -1) { + this.error = returnObject.result.error; + this.warnings.concat(returnObject.result.warnings); + return -1; + } + currentOffset = returnObject.offset; + this.blockLength += returnObject.result.blockLength; + inputLength -= returnObject.result.blockLength; + this.value.push(returnObject.result); + if (this.isIndefiniteForm && returnObject.result.constructor.NAME === END_OF_CONTENT_NAME) { + break; + } + } + if (this.isIndefiniteForm) { + if (this.value[this.value.length - 1].constructor.NAME === END_OF_CONTENT_NAME) { + this.value.pop(); + } + else { + this.warnings.push("No EndOfContent block encoded"); + } + } + return currentOffset; + } + toBER(sizeOnly, writer) { + const _writer = writer || new ViewWriter(); + for (let i = 0; i < this.value.length; i++) { + this.value[i].toBER(sizeOnly, _writer); + } + if (!writer) { + return _writer.final(); + } + return EMPTY_BUFFER; + } + toJSON() { + const object = { + ...super.toJSON(), + isIndefiniteForm: this.isIndefiniteForm, + value: [], + }; + for (const value of this.value) { + object.value.push(value.toJSON()); + } + return object; + } +} +LocalConstructedValueBlock.NAME = "ConstructedValueBlock"; + +var _a$v; +class Constructed extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalConstructedValueBlock); + this.idBlock.isConstructed = true; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + const resultOffset = this.valueBlock.fromBER(inputBuffer, inputOffset, (this.lenBlock.isIndefiniteForm) ? inputLength : this.lenBlock.length, context); + if (resultOffset === -1) { + this.error = this.valueBlock.error; + return resultOffset; + } + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + if (!this.valueBlock.error.length) + this.blockLength += this.valueBlock.blockLength; + return resultOffset; + } + onAsciiEncoding() { + const values = []; + for (const value of this.valueBlock.value) { + values.push(value.toString("ascii").split("\n").map((o) => ` ${o}`).join("\n")); + } + const blockName = this.idBlock.tagClass === 3 + ? `[${this.idBlock.tagNumber}]` + : this.constructor.NAME; + return values.length + ? `${blockName} :\n${values.join("\n")}` + : `${blockName} :`; + } +} +_a$v = Constructed; +(() => { + typeStore.Constructed = _a$v; +})(); +Constructed.NAME = "CONSTRUCTED"; + +class LocalEndOfContentValueBlock extends ValueBlock { + fromBER(inputBuffer, inputOffset, _inputLength) { + return inputOffset; + } + toBER(_sizeOnly) { + return EMPTY_BUFFER; + } +} +LocalEndOfContentValueBlock.override = "EndOfContentValueBlock"; + +var _a$u; +class EndOfContent extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalEndOfContentValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 0; + } +} +_a$u = EndOfContent; +(() => { + typeStore.EndOfContent = _a$u; +})(); +EndOfContent.NAME = END_OF_CONTENT_NAME; + +var _a$t; +class Null extends BaseBlock { + constructor(parameters = {}) { + super(parameters, ValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 5; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (this.lenBlock.length > 0) + this.warnings.push("Non-zero length of value block for Null type"); + if (!this.idBlock.error.length) + this.blockLength += this.idBlock.blockLength; + if (!this.lenBlock.error.length) + this.blockLength += this.lenBlock.blockLength; + this.blockLength += inputLength; + if ((inputOffset + inputLength) > inputBuffer.byteLength) { + this.error = "End of input reached before message was fully decoded (inconsistent offset and length values)"; + return -1; + } + return (inputOffset + inputLength); + } + toBER(sizeOnly, writer) { + const retBuf = new ArrayBuffer(2); + if (!sizeOnly) { + const retView = new Uint8Array(retBuf); + retView[0] = 0x05; + retView[1] = 0x00; + } + if (writer) { + writer.write(retBuf); + } + return retBuf; + } + onAsciiEncoding() { + return `${this.constructor.NAME}`; + } +} +_a$t = Null; +(() => { + typeStore.Null = _a$t; +})(); +Null.NAME = "NULL"; + +class LocalBooleanValueBlock extends HexBlock(ValueBlock) { + get value() { + for (const octet of this.valueHexView) { + if (octet > 0) { + return true; + } + } + return false; + } + set value(value) { + this.valueHexView[0] = value ? 0xFF : 0x00; + } + constructor({ value, ...parameters } = {}) { + super(parameters); + if (parameters.valueHex) { + this.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(parameters.valueHex); + } + else { + this.valueHexView = new Uint8Array(1); + } + if (value) { + this.value = value; + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + this.valueHexView = inputView.subarray(inputOffset, inputOffset + inputLength); + if (inputLength > 1) + this.warnings.push("Boolean value encoded in more then 1 octet"); + this.isHexOnly = true; + pvutils__WEBPACK_IMPORTED_MODULE_1__.utilDecodeTC.call(this); + this.blockLength = inputLength; + return (inputOffset + inputLength); + } + toBER() { + return this.valueHexView.slice(); + } + toJSON() { + return { + ...super.toJSON(), + value: this.value, + }; + } +} +LocalBooleanValueBlock.NAME = "BooleanValueBlock"; + +var _a$s; +class Boolean extends BaseBlock { + getValue() { + return this.valueBlock.value; + } + setValue(value) { + this.valueBlock.value = value; + } + constructor(parameters = {}) { + super(parameters, LocalBooleanValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 1; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.getValue}`; + } +} +_a$s = Boolean; +(() => { + typeStore.Boolean = _a$s; +})(); +Boolean.NAME = "BOOLEAN"; + +class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock) { + constructor({ isConstructed = false, ...parameters } = {}) { + super(parameters); + this.isConstructed = isConstructed; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + let resultOffset = 0; + if (this.isConstructed) { + this.isHexOnly = false; + resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength, context); + if (resultOffset === -1) + return resultOffset; + for (let i = 0; i < this.value.length; i++) { + const currentBlockName = this.value[i].constructor.NAME; + if (currentBlockName === END_OF_CONTENT_NAME) { + if (this.isIndefiniteForm) + break; + else { + this.error = "EndOfContent is unexpected, OCTET STRING may consists of OCTET STRINGs only"; + return -1; + } + } + if (currentBlockName !== OCTET_STRING_NAME) { + this.error = "OCTET STRING may consists of OCTET STRINGs only"; + return -1; + } + } + } + else { + this.isHexOnly = true; + resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength); + this.blockLength = inputLength; + } + return resultOffset; + } + toBER(sizeOnly, writer) { + if (this.isConstructed) + return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer); + return sizeOnly + ? new ArrayBuffer(this.valueHexView.byteLength) + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + isConstructed: this.isConstructed, + }; + } +} +LocalOctetStringValueBlock.NAME = "OctetStringValueBlock"; + +var _a$r; +class OctetString extends BaseBlock { + constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) { + var _b, _c; + (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length)); + super({ + idBlock: { + isConstructed: parameters.isConstructed, + ...idBlock, + }, + lenBlock: { + ...lenBlock, + isIndefiniteForm: !!parameters.isIndefiniteForm, + }, + ...parameters, + }, LocalOctetStringValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 4; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + this.valueBlock.isConstructed = this.idBlock.isConstructed; + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + if (inputLength === 0) { + if (this.idBlock.error.length === 0) + this.blockLength += this.idBlock.blockLength; + if (this.lenBlock.error.length === 0) + this.blockLength += this.lenBlock.blockLength; + return inputOffset; + } + if (!this.valueBlock.isConstructed) { + const view = inputBuffer instanceof ArrayBuffer ? new Uint8Array(inputBuffer) : inputBuffer; + const buf = view.subarray(inputOffset, inputOffset + inputLength); + try { + if (buf.byteLength) { + const parseContext = context !== null && context !== void 0 ? context : createFromBerContext(); + const asn = localFromBERWithChildContext(buf, 0, buf.byteLength, parseContext); + if (asn.offset !== -1 && asn.offset === inputLength) { + this.valueBlock.value = [asn.result]; + } + } + } + catch { + } + } + return super.fromBER(inputBuffer, inputOffset, inputLength, context); + } + onAsciiEncoding() { + if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) { + return Constructed.prototype.onAsciiEncoding.call(this); + } + const name = this.constructor.NAME; + const value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueBlock.valueHexView); + return `${name} : ${value}`; + } + getValue() { + if (!this.idBlock.isConstructed) { + return this.valueBlock.valueHexView.slice().buffer; + } + const array = []; + for (const content of this.valueBlock.value) { + if (content instanceof _a$r) { + array.push(content.valueBlock.valueHexView); + } + } + return pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.concat(array); + } +} +_a$r = OctetString; +(() => { + typeStore.OctetString = _a$r; +})(); +OctetString.NAME = OCTET_STRING_NAME; + +class LocalBitStringValueBlock extends HexBlock(LocalConstructedValueBlock) { + constructor({ unusedBits = 0, isConstructed = false, ...parameters } = {}) { + super(parameters); + this.unusedBits = unusedBits; + this.isConstructed = isConstructed; + this.blockLength = this.valueHexView.byteLength; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + if (!inputLength) { + return inputOffset; + } + let resultOffset = -1; + if (this.isConstructed) { + resultOffset = LocalConstructedValueBlock.prototype.fromBER.call(this, inputBuffer, inputOffset, inputLength, context); + if (resultOffset === -1) + return resultOffset; + for (const value of this.value) { + const currentBlockName = value.constructor.NAME; + if (currentBlockName === END_OF_CONTENT_NAME) { + if (this.isIndefiniteForm) + break; + else { + this.error = "EndOfContent is unexpected, BIT STRING may consists of BIT STRINGs only"; + return -1; + } + } + if (currentBlockName !== BIT_STRING_NAME) { + this.error = "BIT STRING may consists of BIT STRINGs only"; + return -1; + } + const valueBlock = value.valueBlock; + if ((this.unusedBits > 0) && (valueBlock.unusedBits > 0)) { + this.error = "Using of \"unused bits\" inside constructive BIT STRING allowed for least one only"; + return -1; + } + this.unusedBits = valueBlock.unusedBits; + } + return resultOffset; + } + const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.unusedBits = intBuffer[0]; + if (this.unusedBits > 7) { + this.error = "Unused bits for BitString must be in range 0-7"; + return -1; + } + if (!this.unusedBits) { + const buf = intBuffer.subarray(1); + try { + if (buf.byteLength) { + const parseContext = context !== null && context !== void 0 ? context : createFromBerContext(); + const asn = localFromBERWithChildContext(buf, 0, buf.byteLength, parseContext); + if (asn.offset !== -1 && asn.offset === (inputLength - 1)) { + this.value = [asn.result]; + } + } + } + catch { + } + } + this.valueHexView = intBuffer.subarray(1); + this.blockLength = intBuffer.length; + return (inputOffset + inputLength); + } + toBER(sizeOnly, writer) { + if (this.isConstructed) { + return LocalConstructedValueBlock.prototype.toBER.call(this, sizeOnly, writer); + } + if (sizeOnly) { + return new ArrayBuffer(this.valueHexView.byteLength + 1); + } + if (!this.valueHexView.byteLength) { + const empty = new Uint8Array(1); + empty[0] = 0; + return empty.buffer; + } + const retView = new Uint8Array(this.valueHexView.length + 1); + retView[0] = this.unusedBits; + retView.set(this.valueHexView, 1); + return retView.buffer; + } + toJSON() { + return { + ...super.toJSON(), + unusedBits: this.unusedBits, + isConstructed: this.isConstructed, + }; + } +} +LocalBitStringValueBlock.NAME = "BitStringValueBlock"; + +var _a$q; +class BitString extends BaseBlock { + constructor({ idBlock = {}, lenBlock = {}, ...parameters } = {}) { + var _b, _c; + (_b = parameters.isConstructed) !== null && _b !== void 0 ? _b : (parameters.isConstructed = !!((_c = parameters.value) === null || _c === void 0 ? void 0 : _c.length)); + super({ + idBlock: { + isConstructed: parameters.isConstructed, + ...idBlock, + }, + lenBlock: { + ...lenBlock, + isIndefiniteForm: !!parameters.isIndefiniteForm, + }, + ...parameters, + }, LocalBitStringValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 3; + } + fromBER(inputBuffer, inputOffset, inputLength, context) { + this.valueBlock.isConstructed = this.idBlock.isConstructed; + this.valueBlock.isIndefiniteForm = this.lenBlock.isIndefiniteForm; + return super.fromBER(inputBuffer, inputOffset, inputLength, context); + } + onAsciiEncoding() { + if (this.valueBlock.isConstructed || (this.valueBlock.value && this.valueBlock.value.length)) { + return Constructed.prototype.onAsciiEncoding.call(this); + } + else { + const bits = []; + const valueHex = this.valueBlock.valueHexView; + for (const byte of valueHex) { + bits.push(byte.toString(2).padStart(8, "0")); + } + const bitsStr = bits.join(""); + const name = this.constructor.NAME; + const value = bitsStr.substring(0, bitsStr.length - this.valueBlock.unusedBits); + return `${name} : ${value}`; + } + } +} +_a$q = BitString; +(() => { + typeStore.BitString = _a$q; +})(); +BitString.NAME = BIT_STRING_NAME; + +var _a$p; +function viewAdd(first, second) { + const c = new Uint8Array([0]); + const firstView = new Uint8Array(first); + const secondView = new Uint8Array(second); + let firstViewCopy = firstView.slice(0); + const firstViewCopyLength = firstViewCopy.length - 1; + const secondViewCopy = secondView.slice(0); + const secondViewCopyLength = secondViewCopy.length - 1; + let value = 0; + const max = (secondViewCopyLength < firstViewCopyLength) ? firstViewCopyLength : secondViewCopyLength; + let counter = 0; + for (let i = max; i >= 0; i--, counter++) { + switch (true) { + case (counter < secondViewCopy.length): + value = firstViewCopy[firstViewCopyLength - counter] + secondViewCopy[secondViewCopyLength - counter] + c[0]; + break; + default: + value = firstViewCopy[firstViewCopyLength - counter] + c[0]; + } + c[0] = value / 10; + switch (true) { + case (counter >= firstViewCopy.length): + firstViewCopy = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(new Uint8Array([value % 10]), firstViewCopy); + break; + default: + firstViewCopy[firstViewCopyLength - counter] = value % 10; + } + } + if (c[0] > 0) + firstViewCopy = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(c, firstViewCopy); + return firstViewCopy; +} +function power2(n) { + if (n >= powers2.length) { + for (let p = powers2.length; p <= n; p++) { + const c = new Uint8Array([0]); + let digits = (powers2[p - 1]).slice(0); + for (let i = (digits.length - 1); i >= 0; i--) { + const newValue = new Uint8Array([(digits[i] << 1) + c[0]]); + c[0] = newValue[0] / 10; + digits[i] = newValue[0] % 10; + } + if (c[0] > 0) + digits = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilConcatView(c, digits); + powers2.push(digits); + } + } + return powers2[n]; +} +function viewSub(first, second) { + let b = 0; + const firstView = new Uint8Array(first); + const secondView = new Uint8Array(second); + const firstViewCopy = firstView.slice(0); + const firstViewCopyLength = firstViewCopy.length - 1; + const secondViewCopy = secondView.slice(0); + const secondViewCopyLength = secondViewCopy.length - 1; + let value; + let counter = 0; + for (let i = secondViewCopyLength; i >= 0; i--, counter++) { + value = firstViewCopy[firstViewCopyLength - counter] - secondViewCopy[secondViewCopyLength - counter] - b; + switch (true) { + case (value < 0): + b = 1; + firstViewCopy[firstViewCopyLength - counter] = value + 10; + break; + default: + b = 0; + firstViewCopy[firstViewCopyLength - counter] = value; + } + } + if (b > 0) { + for (let i = (firstViewCopyLength - secondViewCopyLength + 1); i >= 0; i--, counter++) { + value = firstViewCopy[firstViewCopyLength - counter] - b; + if (value < 0) { + b = 1; + firstViewCopy[firstViewCopyLength - counter] = value + 10; + } + else { + b = 0; + firstViewCopy[firstViewCopyLength - counter] = value; + break; + } + } + } + return firstViewCopy.slice(); +} +class LocalIntegerValueBlock extends HexBlock(ValueBlock) { + setValueHex() { + if (this.valueHexView.length >= 4) { + this.warnings.push("Too big Integer for decoding, hex only"); + this.isHexOnly = true; + this._valueDec = 0; + } + else { + this.isHexOnly = false; + if (this.valueHexView.length > 0) { + this._valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilDecodeTC.call(this); + } + } + } + constructor({ value, ...parameters } = {}) { + super(parameters); + this._valueDec = 0; + if (parameters.valueHex) { + this.setValueHex(); + } + if (value !== undefined) { + this.valueDec = value; + } + } + set valueDec(v) { + this._valueDec = v; + this.isHexOnly = false; + this.valueHexView = new Uint8Array(pvutils__WEBPACK_IMPORTED_MODULE_1__.utilEncodeTC(v)); + } + get valueDec() { + return this._valueDec; + } + fromDER(inputBuffer, inputOffset, inputLength, expectedLength = 0) { + const offset = this.fromBER(inputBuffer, inputOffset, inputLength); + if (offset === -1) + return offset; + const view = this.valueHexView; + if ((view[0] === 0x00) && ((view[1] & 0x80) !== 0)) { + this.valueHexView = view.subarray(1); + } + else { + if (expectedLength !== 0) { + if (view.length < expectedLength) { + if ((expectedLength - view.length) > 1) + expectedLength = view.length + 1; + this.valueHexView = view.subarray(expectedLength - view.length); + } + } + } + return offset; + } + toDER(sizeOnly = false) { + const view = this.valueHexView; + switch (true) { + case ((view[0] & 0x80) !== 0): + { + const updatedView = new Uint8Array(this.valueHexView.length + 1); + updatedView[0] = 0x00; + updatedView.set(view, 1); + this.valueHexView = updatedView; + } + break; + case ((view[0] === 0x00) && ((view[1] & 0x80) === 0)): + { + this.valueHexView = this.valueHexView.subarray(1); + } + break; + } + return this.toBER(sizeOnly); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const resultOffset = super.fromBER(inputBuffer, inputOffset, inputLength); + if (resultOffset === -1) { + return resultOffset; + } + this.setValueHex(); + return resultOffset; + } + toBER(sizeOnly) { + return sizeOnly + ? new ArrayBuffer(this.valueHexView.length) + : this.valueHexView.slice().buffer; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + }; + } + toString() { + const firstBit = (this.valueHexView.length * 8) - 1; + let digits = new Uint8Array((this.valueHexView.length * 8) / 3); + let bitNumber = 0; + let currentByte; + const asn1View = this.valueHexView; + let result = ""; + let flag = false; + for (let byteNumber = (asn1View.byteLength - 1); byteNumber >= 0; byteNumber--) { + currentByte = asn1View[byteNumber]; + for (let i = 0; i < 8; i++) { + if ((currentByte & 1) === 1) { + switch (bitNumber) { + case firstBit: + digits = viewSub(power2(bitNumber), digits); + result = "-"; + break; + default: + digits = viewAdd(digits, power2(bitNumber)); + } + } + bitNumber++; + currentByte >>= 1; + } + } + for (let i = 0; i < digits.length; i++) { + if (digits[i]) + flag = true; + if (flag) + result += digitsString.charAt(digits[i]); + } + if (flag === false) + result += digitsString.charAt(0); + return result; + } +} +_a$p = LocalIntegerValueBlock; +LocalIntegerValueBlock.NAME = "IntegerValueBlock"; +(() => { + Object.defineProperty(_a$p.prototype, "valueHex", { + set: function (v) { + this.valueHexView = new Uint8Array(v); + this.setValueHex(); + }, + get: function () { + return this.valueHexView.slice().buffer; + }, + }); +})(); + +var _a$o; +class Integer extends BaseBlock { + constructor(parameters = {}) { + super(parameters, LocalIntegerValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 2; + } + toBigInt() { + assertBigInt(); + return BigInt(this.valueBlock.toString()); + } + static fromBigInt(value) { + assertBigInt(); + const bigIntValue = BigInt(value); + const writer = new ViewWriter(); + const hex = bigIntValue.toString(16).replace(/^-/, ""); + const view = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromHex(hex)); + if (bigIntValue < 0) { + const first = new Uint8Array(view.length + (view[0] & 0x80 ? 1 : 0)); + first[0] |= 0x80; + const firstInt = BigInt(`0x${pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(first)}`); + const secondInt = firstInt + bigIntValue; + const second = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromHex(secondInt.toString(16))); + second[0] |= 0x80; + writer.write(second); + } + else { + if (view[0] & 0x80) { + writer.write(new Uint8Array([0])); + } + writer.write(view); + } + const res = new _a$o({ valueHex: writer.final() }); + return res; + } + convertToDER() { + const integer = new _a$o({ valueHex: this.valueBlock.valueHexView }); + integer.valueBlock.toDER(); + return integer; + } + convertFromDER() { + return new _a$o({ + valueHex: this.valueBlock.valueHexView[0] === 0 + ? this.valueBlock.valueHexView.subarray(1) + : this.valueBlock.valueHexView, + }); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString()}`; + } +} +_a$o = Integer; +(() => { + typeStore.Integer = _a$o; +})(); +Integer.NAME = "INTEGER"; + +var _a$n; +class Enumerated extends Integer { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 10; + } +} +_a$n = Enumerated; +(() => { + typeStore.Enumerated = _a$n; +})(); +Enumerated.NAME = "ENUMERATED"; + +class LocalSidValueBlock extends HexBlock(ValueBlock) { + constructor({ valueDec = -1, isFirstSid = false, ...parameters } = {}) { + super(parameters); + this.valueDec = valueDec; + this.isFirstSid = isFirstSid; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (!inputLength) { + return inputOffset; + } + const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, inputView, inputOffset, inputLength)) { + return -1; + } + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.valueHexView = new Uint8Array(inputLength); + for (let i = 0; i < inputLength; i++) { + this.valueHexView[i] = intBuffer[i] & 0x7F; + this.blockLength++; + if ((intBuffer[i] & 0x80) === 0x00) + break; + } + const tempView = new Uint8Array(this.blockLength); + for (let i = 0; i < this.blockLength; i++) { + tempView[i] = this.valueHexView[i]; + } + this.valueHexView = tempView; + if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + if (this.valueHexView[0] === 0x00) + this.warnings.push("Needlessly long format of SID encoding"); + if (this.blockLength <= 8) + this.valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(this.valueHexView, 7); + else { + this.isHexOnly = true; + this.warnings.push("Too big SID for decoding, hex only"); + } + return (inputOffset + this.blockLength); + } + set valueBigInt(value) { + assertBigInt(); + let bits = BigInt(value).toString(2); + while (bits.length % 7) { + bits = "0" + bits; + } + const bytes = new Uint8Array(bits.length / 7); + for (let i = 0; i < bytes.length; i++) { + bytes[i] = parseInt(bits.slice(i * 7, i * 7 + 7), 2) + (i + 1 < bytes.length ? 0x80 : 0); + } + this.fromBER(bytes.buffer, 0, bytes.length); + } + toBER(sizeOnly) { + if (this.isHexOnly) { + if (sizeOnly) + return (new ArrayBuffer(this.valueHexView.byteLength)); + const curView = this.valueHexView; + const retView = new Uint8Array(this.blockLength); + for (let i = 0; i < (this.blockLength - 1); i++) + retView[i] = curView[i] | 0x80; + retView[this.blockLength - 1] = curView[this.blockLength - 1]; + return retView.buffer; + } + const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.valueDec, 7); + if (encodedBuf.byteLength === 0) { + this.error = "Error during encoding SID value"; + return EMPTY_BUFFER; + } + const retView = new Uint8Array(encodedBuf.byteLength); + if (!sizeOnly) { + const encodedView = new Uint8Array(encodedBuf); + const len = encodedBuf.byteLength - 1; + for (let i = 0; i < len; i++) + retView[i] = encodedView[i] | 0x80; + retView[len] = encodedView[len]; + } + return retView; + } + toString() { + let result = ""; + if (this.isHexOnly) + result = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView); + else { + if (this.isFirstSid) { + let sidValue = this.valueDec; + if (this.valueDec <= 39) + result = "0."; + else { + if (this.valueDec <= 79) { + result = "1."; + sidValue -= 40; + } + else { + result = "2."; + sidValue -= 80; + } + } + result += sidValue.toString(); + } + else + result = this.valueDec.toString(); + } + return result; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + isFirstSid: this.isFirstSid, + }; + } +} +LocalSidValueBlock.NAME = "sidBlock"; + +class LocalObjectIdentifierValueBlock extends ValueBlock { + constructor({ value = EMPTY_STRING, ...parameters } = {}) { + super(parameters); + this.value = []; + if (value) { + this.fromString(value); + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + let resultOffset = inputOffset; + while (inputLength > 0) { + const sidBlock = new LocalSidValueBlock(); + resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength); + if (resultOffset === -1) { + this.blockLength = 0; + this.error = sidBlock.error; + return resultOffset; + } + if (this.value.length === 0) + sidBlock.isFirstSid = true; + this.blockLength += sidBlock.blockLength; + inputLength -= sidBlock.blockLength; + this.value.push(sidBlock); + } + return resultOffset; + } + toBER(sizeOnly) { + const retBuffers = []; + for (let i = 0; i < this.value.length; i++) { + const valueBuf = this.value[i].toBER(sizeOnly); + if (valueBuf.byteLength === 0) { + this.error = this.value[i].error; + return EMPTY_BUFFER; + } + retBuffers.push(valueBuf); + } + return concat(retBuffers); + } + fromString(string) { + this.value = []; + let pos1 = 0; + let pos2 = 0; + let sid = ""; + let flag = false; + do { + pos2 = string.indexOf(".", pos1); + if (pos2 === -1) + sid = string.substring(pos1); + else + sid = string.substring(pos1, pos2); + pos1 = pos2 + 1; + if (flag) { + const sidBlock = this.value[0]; + let plus = 0; + switch (sidBlock.valueDec) { + case 0: + break; + case 1: + plus = 40; + break; + case 2: + plus = 80; + break; + default: + this.value = []; + return; + } + const parsedSID = parseInt(sid, 10); + if (isNaN(parsedSID)) + return; + sidBlock.valueDec = parsedSID + plus; + flag = false; + } + else { + const sidBlock = new LocalSidValueBlock(); + if (sid > Number.MAX_SAFE_INTEGER) { + assertBigInt(); + const sidValue = BigInt(sid); + sidBlock.valueBigInt = sidValue; + } + else { + sidBlock.valueDec = parseInt(sid, 10); + if (isNaN(sidBlock.valueDec)) + return; + } + if (!this.value.length) { + sidBlock.isFirstSid = true; + flag = true; + } + this.value.push(sidBlock); + } + } while (pos2 !== -1); + } + toString() { + let result = ""; + let isHexOnly = false; + for (let i = 0; i < this.value.length; i++) { + isHexOnly = this.value[i].isHexOnly; + let sidStr = this.value[i].toString(); + if (i !== 0) + result = `${result}.`; + if (isHexOnly) { + sidStr = `{${sidStr}}`; + if (this.value[i].isFirstSid) + result = `2.{${sidStr} - 80}`; + else + result += sidStr; + } + else + result += sidStr; + } + return result; + } + toJSON() { + const object = { + ...super.toJSON(), + value: this.toString(), + sidArray: [], + }; + for (let i = 0; i < this.value.length; i++) { + object.sidArray.push(this.value[i].toJSON()); + } + return object; + } +} +LocalObjectIdentifierValueBlock.NAME = "ObjectIdentifierValueBlock"; + +var _a$m; +class ObjectIdentifier extends BaseBlock { + getValue() { + return this.valueBlock.toString(); + } + setValue(value) { + this.valueBlock.fromString(value); + } + constructor(parameters = {}) { + super(parameters, LocalObjectIdentifierValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 6; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`; + } + toJSON() { + return { + ...super.toJSON(), + value: this.getValue(), + }; + } +} +_a$m = ObjectIdentifier; +(() => { + typeStore.ObjectIdentifier = _a$m; +})(); +ObjectIdentifier.NAME = "OBJECT IDENTIFIER"; + +class LocalRelativeSidValueBlock extends HexBlock(LocalBaseBlock) { + constructor({ valueDec = 0, ...parameters } = {}) { + super(parameters); + this.valueDec = valueDec; + } + fromBER(inputBuffer, inputOffset, inputLength) { + if (inputLength === 0) + return inputOffset; + const inputView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + if (!checkBufferParams(this, inputView, inputOffset, inputLength)) + return -1; + const intBuffer = inputView.subarray(inputOffset, inputOffset + inputLength); + this.valueHexView = new Uint8Array(inputLength); + for (let i = 0; i < inputLength; i++) { + this.valueHexView[i] = intBuffer[i] & 0x7F; + this.blockLength++; + if ((intBuffer[i] & 0x80) === 0x00) + break; + } + const tempView = new Uint8Array(this.blockLength); + for (let i = 0; i < this.blockLength; i++) + tempView[i] = this.valueHexView[i]; + this.valueHexView = tempView; + if ((intBuffer[this.blockLength - 1] & 0x80) !== 0x00) { + this.error = "End of input reached before message was fully decoded"; + return -1; + } + if (this.valueHexView[0] === 0x00) + this.warnings.push("Needlessly long format of SID encoding"); + if (this.blockLength <= 8) + this.valueDec = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilFromBase(this.valueHexView, 7); + else { + this.isHexOnly = true; + this.warnings.push("Too big SID for decoding, hex only"); + } + return (inputOffset + this.blockLength); + } + toBER(sizeOnly) { + if (this.isHexOnly) { + if (sizeOnly) + return (new ArrayBuffer(this.valueHexView.byteLength)); + const curView = this.valueHexView; + const retView = new Uint8Array(this.blockLength); + for (let i = 0; i < (this.blockLength - 1); i++) + retView[i] = curView[i] | 0x80; + retView[this.blockLength - 1] = curView[this.blockLength - 1]; + return retView.buffer; + } + const encodedBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(this.valueDec, 7); + if (encodedBuf.byteLength === 0) { + this.error = "Error during encoding SID value"; + return EMPTY_BUFFER; + } + const retView = new Uint8Array(encodedBuf.byteLength); + if (!sizeOnly) { + const encodedView = new Uint8Array(encodedBuf); + const len = encodedBuf.byteLength - 1; + for (let i = 0; i < len; i++) + retView[i] = encodedView[i] | 0x80; + retView[len] = encodedView[len]; + } + return retView.buffer; + } + toString() { + let result = ""; + if (this.isHexOnly) + result = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToHex(this.valueHexView); + else { + result = this.valueDec.toString(); + } + return result; + } + toJSON() { + return { + ...super.toJSON(), + valueDec: this.valueDec, + }; + } +} +LocalRelativeSidValueBlock.NAME = "relativeSidBlock"; + +class LocalRelativeObjectIdentifierValueBlock extends ValueBlock { + constructor({ value = EMPTY_STRING, ...parameters } = {}) { + super(parameters); + this.value = []; + if (value) { + this.fromString(value); + } + } + fromBER(inputBuffer, inputOffset, inputLength) { + let resultOffset = inputOffset; + while (inputLength > 0) { + const sidBlock = new LocalRelativeSidValueBlock(); + resultOffset = sidBlock.fromBER(inputBuffer, resultOffset, inputLength); + if (resultOffset === -1) { + this.blockLength = 0; + this.error = sidBlock.error; + return resultOffset; + } + this.blockLength += sidBlock.blockLength; + inputLength -= sidBlock.blockLength; + this.value.push(sidBlock); + } + return resultOffset; + } + toBER(sizeOnly, _writer) { + const retBuffers = []; + for (let i = 0; i < this.value.length; i++) { + const valueBuf = this.value[i].toBER(sizeOnly); + if (valueBuf.byteLength === 0) { + this.error = this.value[i].error; + return EMPTY_BUFFER; + } + retBuffers.push(valueBuf); + } + return concat(retBuffers); + } + fromString(string) { + this.value = []; + let pos1 = 0; + let pos2 = 0; + let sid = ""; + do { + pos2 = string.indexOf(".", pos1); + if (pos2 === -1) + sid = string.substring(pos1); + else + sid = string.substring(pos1, pos2); + pos1 = pos2 + 1; + const sidBlock = new LocalRelativeSidValueBlock(); + sidBlock.valueDec = parseInt(sid, 10); + if (isNaN(sidBlock.valueDec)) + return true; + this.value.push(sidBlock); + } while (pos2 !== -1); + return true; + } + toString() { + let result = ""; + let isHexOnly = false; + for (let i = 0; i < this.value.length; i++) { + isHexOnly = this.value[i].isHexOnly; + let sidStr = this.value[i].toString(); + if (i !== 0) + result = `${result}.`; + if (isHexOnly) { + sidStr = `{${sidStr}}`; + result += sidStr; + } + else + result += sidStr; + } + return result; + } + toJSON() { + const object = { + ...super.toJSON(), + value: this.toString(), + sidArray: [], + }; + for (let i = 0; i < this.value.length; i++) + object.sidArray.push(this.value[i].toJSON()); + return object; + } +} +LocalRelativeObjectIdentifierValueBlock.NAME = "RelativeObjectIdentifierValueBlock"; + +var _a$l; +class RelativeObjectIdentifier extends BaseBlock { + getValue() { + return this.valueBlock.toString(); + } + setValue(value) { + this.valueBlock.fromString(value); + } + constructor(parameters = {}) { + super(parameters, LocalRelativeObjectIdentifierValueBlock); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 13; + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.valueBlock.toString() || "empty"}`; + } + toJSON() { + return { + ...super.toJSON(), + value: this.getValue(), + }; + } +} +_a$l = RelativeObjectIdentifier; +(() => { + typeStore.RelativeObjectIdentifier = _a$l; +})(); +RelativeObjectIdentifier.NAME = "RelativeObjectIdentifier"; + +var _a$k; +class Sequence extends Constructed { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 16; + } +} +_a$k = Sequence; +(() => { + typeStore.Sequence = _a$k; +})(); +Sequence.NAME = "SEQUENCE"; + +var _a$j; +class Set extends Constructed { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 17; + } +} +_a$j = Set; +(() => { + typeStore.Set = _a$j; +})(); +Set.NAME = "SET"; + +class LocalStringValueBlock extends HexBlock(ValueBlock) { + constructor({ ...parameters } = {}) { + super(parameters); + this.isHexOnly = true; + this.value = EMPTY_STRING; + } + toJSON() { + return { + ...super.toJSON(), + value: this.value, + }; + } +} +LocalStringValueBlock.NAME = "StringValueBlock"; + +class LocalSimpleStringValueBlock extends LocalStringValueBlock { +} +LocalSimpleStringValueBlock.NAME = "SimpleStringValueBlock"; + +class LocalSimpleStringBlock extends BaseStringBlock { + constructor({ ...parameters } = {}) { + super(parameters, LocalSimpleStringValueBlock); + } + fromBuffer(inputBuffer) { + this.valueBlock.value = String.fromCharCode.apply(null, pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer)); + } + fromString(inputString) { + const strLen = inputString.length; + const view = this.valueBlock.valueHexView = new Uint8Array(strLen); + for (let i = 0; i < strLen; i++) + view[i] = inputString.charCodeAt(i); + this.valueBlock.value = inputString; + } +} +LocalSimpleStringBlock.NAME = "SIMPLE STRING"; + +class LocalUtf8StringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + this.valueBlock.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + try { + this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToUtf8String(inputBuffer); + } + catch (ex) { + this.warnings.push(`Error during "decodeURIComponent": ${ex}, using raw string`); + this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToBinary(inputBuffer); + } + } + fromString(inputString) { + this.valueBlock.valueHexView = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromUtf8String(inputString)); + this.valueBlock.value = inputString; + } +} +LocalUtf8StringValueBlock.NAME = "Utf8StringValueBlock"; + +var _a$i; +class Utf8String extends LocalUtf8StringValueBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 12; + } +} +_a$i = Utf8String; +(() => { + typeStore.Utf8String = _a$i; +})(); +Utf8String.NAME = "UTF8String"; + +class LocalBmpStringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + this.valueBlock.value = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.ToUtf16String(inputBuffer); + this.valueBlock.valueHexView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer); + } + fromString(inputString) { + this.valueBlock.value = inputString; + this.valueBlock.valueHexView = new Uint8Array(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.Convert.FromUtf16String(inputString)); + } +} +LocalBmpStringValueBlock.NAME = "BmpStringValueBlock"; + +var _a$h; +class BmpString extends LocalBmpStringValueBlock { + constructor({ ...parameters } = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 30; + } +} +_a$h = BmpString; +(() => { + typeStore.BmpString = _a$h; +})(); +BmpString.NAME = "BMPString"; + +class LocalUniversalStringValueBlock extends LocalSimpleStringBlock { + fromBuffer(inputBuffer) { + const copyBuffer = ArrayBuffer.isView(inputBuffer) ? inputBuffer.slice().buffer : inputBuffer.slice(0); + const valueView = new Uint8Array(copyBuffer); + for (let i = 0; i < valueView.length; i += 4) { + valueView[i] = valueView[i + 3]; + valueView[i + 1] = valueView[i + 2]; + valueView[i + 2] = 0x00; + valueView[i + 3] = 0x00; + } + this.valueBlock.value = String.fromCharCode.apply(null, new Uint32Array(copyBuffer)); + } + fromString(inputString) { + const strLength = inputString.length; + const valueHexView = this.valueBlock.valueHexView = new Uint8Array(strLength * 4); + for (let i = 0; i < strLength; i++) { + const codeBuf = pvutils__WEBPACK_IMPORTED_MODULE_1__.utilToBase(inputString.charCodeAt(i), 8); + const codeView = new Uint8Array(codeBuf); + if (codeView.length > 4) + continue; + const dif = 4 - codeView.length; + for (let j = (codeView.length - 1); j >= 0; j--) + valueHexView[i * 4 + j + dif] = codeView[j]; + } + this.valueBlock.value = inputString; + } +} +LocalUniversalStringValueBlock.NAME = "UniversalStringValueBlock"; + +var _a$g; +class UniversalString extends LocalUniversalStringValueBlock { + constructor({ ...parameters } = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 28; + } +} +_a$g = UniversalString; +(() => { + typeStore.UniversalString = _a$g; +})(); +UniversalString.NAME = "UniversalString"; + +var _a$f; +class NumericString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 18; + } +} +_a$f = NumericString; +(() => { + typeStore.NumericString = _a$f; +})(); +NumericString.NAME = "NumericString"; + +var _a$e; +class PrintableString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 19; + } +} +_a$e = PrintableString; +(() => { + typeStore.PrintableString = _a$e; +})(); +PrintableString.NAME = "PrintableString"; + +var _a$d; +class TeletexString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 20; + } +} +_a$d = TeletexString; +(() => { + typeStore.TeletexString = _a$d; +})(); +TeletexString.NAME = "TeletexString"; + +var _a$c; +class VideotexString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 21; + } +} +_a$c = VideotexString; +(() => { + typeStore.VideotexString = _a$c; +})(); +VideotexString.NAME = "VideotexString"; + +var _a$b; +class IA5String extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 22; + } +} +_a$b = IA5String; +(() => { + typeStore.IA5String = _a$b; +})(); +IA5String.NAME = "IA5String"; + +var _a$a; +class GraphicString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 25; + } +} +_a$a = GraphicString; +(() => { + typeStore.GraphicString = _a$a; +})(); +GraphicString.NAME = "GraphicString"; + +var _a$9; +class VisibleString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 26; + } +} +_a$9 = VisibleString; +(() => { + typeStore.VisibleString = _a$9; +})(); +VisibleString.NAME = "VisibleString"; + +var _a$8; +class GeneralString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 27; + } +} +_a$8 = GeneralString; +(() => { + typeStore.GeneralString = _a$8; +})(); +GeneralString.NAME = "GeneralString"; + +var _a$7; +class CharacterString extends LocalSimpleStringBlock { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 29; + } +} +_a$7 = CharacterString; +(() => { + typeStore.CharacterString = _a$7; +})(); +CharacterString.NAME = "CharacterString"; + +var _a$6; +class UTCTime extends VisibleString { + constructor({ value, valueDate, ...parameters } = {}) { + super(parameters); + this.year = 0; + this.month = 0; + this.day = 0; + this.hour = 0; + this.minute = 0; + this.second = 0; + if (value) { + this.fromString(value); + this.valueBlock.valueHexView = new Uint8Array(value.length); + for (let i = 0; i < value.length; i++) + this.valueBlock.valueHexView[i] = value.charCodeAt(i); + } + if (valueDate) { + this.fromDate(valueDate); + this.valueBlock.valueHexView = new Uint8Array(this.toBuffer()); + } + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 23; + } + fromBuffer(inputBuffer) { + this.fromString(String.fromCharCode.apply(null, pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer))); + } + toBuffer() { + const str = this.toString(); + const buffer = new ArrayBuffer(str.length); + const view = new Uint8Array(buffer); + for (let i = 0; i < str.length; i++) + view[i] = str.charCodeAt(i); + return buffer; + } + fromDate(inputDate) { + this.year = inputDate.getUTCFullYear(); + this.month = inputDate.getUTCMonth() + 1; + this.day = inputDate.getUTCDate(); + this.hour = inputDate.getUTCHours(); + this.minute = inputDate.getUTCMinutes(); + this.second = inputDate.getUTCSeconds(); + } + toDate() { + return (new Date(Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second))); + } + fromString(inputString) { + const parser = /(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})Z/ig; + const parserArray = parser.exec(inputString); + if (parserArray === null) { + this.error = "Wrong input string for conversion"; + return; + } + const year = parseInt(parserArray[1], 10); + if (year >= 50) + this.year = 1900 + year; + else + this.year = 2000 + year; + this.month = parseInt(parserArray[2], 10); + this.day = parseInt(parserArray[3], 10); + this.hour = parseInt(parserArray[4], 10); + this.minute = parseInt(parserArray[5], 10); + this.second = parseInt(parserArray[6], 10); + } + toString(encoding = "iso") { + if (encoding === "iso") { + const outputArray = new Array(7); + outputArray[0] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(((this.year < 2000) ? (this.year - 1900) : (this.year - 2000)), 2); + outputArray[1] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.month, 2); + outputArray[2] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.day, 2); + outputArray[3] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.hour, 2); + outputArray[4] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.minute, 2); + outputArray[5] = pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.second, 2); + outputArray[6] = "Z"; + return outputArray.join(""); + } + return super.toString(encoding); + } + onAsciiEncoding() { + return `${this.constructor.NAME} : ${this.toDate().toISOString()}`; + } + toJSON() { + return { + ...super.toJSON(), + year: this.year, + month: this.month, + day: this.day, + hour: this.hour, + minute: this.minute, + second: this.second, + }; + } +} +_a$6 = UTCTime; +(() => { + typeStore.UTCTime = _a$6; +})(); +UTCTime.NAME = "UTCTime"; + +var _a$5; +class GeneralizedTime extends UTCTime { + constructor(parameters = {}) { + var _b; + super(parameters); + (_b = this.millisecond) !== null && _b !== void 0 ? _b : (this.millisecond = 0); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 24; + } + fromDate(inputDate) { + super.fromDate(inputDate); + this.millisecond = inputDate.getUTCMilliseconds(); + } + toDate() { + const utcDate = Date.UTC(this.year, this.month - 1, this.day, this.hour, this.minute, this.second, this.millisecond); + return (new Date(utcDate)); + } + fromString(inputString) { + let isUTC = false; + let timeString = ""; + let dateTimeString = ""; + let fractionPart = 0; + let parser; + let hourDifference = 0; + let minuteDifference = 0; + if (inputString[inputString.length - 1] === "Z") { + timeString = inputString.substring(0, inputString.length - 1); + isUTC = true; + } + else { + const number = new Number(inputString[inputString.length - 1]); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + timeString = inputString; + } + if (isUTC) { + if (timeString.indexOf("+") !== -1) + throw new Error("Wrong input string for conversion"); + if (timeString.indexOf("-") !== -1) + throw new Error("Wrong input string for conversion"); + } + else { + let multiplier = 1; + let differencePosition = timeString.indexOf("+"); + let differenceString = ""; + if (differencePosition === -1) { + differencePosition = timeString.indexOf("-"); + multiplier = -1; + } + if (differencePosition !== -1) { + differenceString = timeString.substring(differencePosition + 1); + timeString = timeString.substring(0, differencePosition); + if ((differenceString.length !== 2) && (differenceString.length !== 4)) + throw new Error("Wrong input string for conversion"); + let number = parseInt(differenceString.substring(0, 2), 10); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + hourDifference = multiplier * number; + if (differenceString.length === 4) { + number = parseInt(differenceString.substring(2, 4), 10); + if (isNaN(number.valueOf())) + throw new Error("Wrong input string for conversion"); + minuteDifference = multiplier * number; + } + } + } + let fractionPointPosition = timeString.indexOf("."); + if (fractionPointPosition === -1) + fractionPointPosition = timeString.indexOf(","); + if (fractionPointPosition !== -1) { + const fractionPartCheck = new Number(`0${timeString.substring(fractionPointPosition)}`); + if (isNaN(fractionPartCheck.valueOf())) + throw new Error("Wrong input string for conversion"); + fractionPart = fractionPartCheck.valueOf(); + dateTimeString = timeString.substring(0, fractionPointPosition); + } + else + dateTimeString = timeString; + switch (true) { + case (dateTimeString.length === 8): + parser = /(\d{4})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) + throw new Error("Wrong input string for conversion"); + break; + case (dateTimeString.length === 10): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + let fractionResult = 60 * fractionPart; + this.minute = Math.floor(fractionResult); + fractionResult = 60 * (fractionResult - this.minute); + this.second = Math.floor(fractionResult); + fractionResult = 1000 * (fractionResult - this.second); + this.millisecond = Math.floor(fractionResult); + } + break; + case (dateTimeString.length === 12): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + let fractionResult = 60 * fractionPart; + this.second = Math.floor(fractionResult); + fractionResult = 1000 * (fractionResult - this.second); + this.millisecond = Math.floor(fractionResult); + } + break; + case (dateTimeString.length === 14): + parser = /(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig; + if (fractionPointPosition !== -1) { + const fractionResult = 1000 * fractionPart; + this.millisecond = Math.floor(fractionResult); + } + break; + default: + throw new Error("Wrong input string for conversion"); + } + const parserArray = parser.exec(dateTimeString); + if (parserArray === null) + throw new Error("Wrong input string for conversion"); + for (let j = 1; j < parserArray.length; j++) { + switch (j) { + case 1: + this.year = parseInt(parserArray[j], 10); + break; + case 2: + this.month = parseInt(parserArray[j], 10); + break; + case 3: + this.day = parseInt(parserArray[j], 10); + break; + case 4: + this.hour = parseInt(parserArray[j], 10) + hourDifference; + break; + case 5: + this.minute = parseInt(parserArray[j], 10) + minuteDifference; + break; + case 6: + this.second = parseInt(parserArray[j], 10); + break; + default: + throw new Error("Wrong input string for conversion"); + } + } + if (isUTC === false) { + const tempDate = new Date(this.year, this.month, this.day, this.hour, this.minute, this.second, this.millisecond); + this.year = tempDate.getUTCFullYear(); + this.month = tempDate.getUTCMonth(); + this.day = tempDate.getUTCDay(); + this.hour = tempDate.getUTCHours(); + this.minute = tempDate.getUTCMinutes(); + this.second = tempDate.getUTCSeconds(); + this.millisecond = tempDate.getUTCMilliseconds(); + } + } + toString(encoding = "iso") { + if (encoding === "iso") { + const outputArray = []; + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.year, 4)); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.month, 2)); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.day, 2)); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.hour, 2)); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.minute, 2)); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.second, 2)); + if (this.millisecond !== 0) { + outputArray.push("."); + outputArray.push(pvutils__WEBPACK_IMPORTED_MODULE_1__.padNumber(this.millisecond, 3)); + } + outputArray.push("Z"); + return outputArray.join(""); + } + return super.toString(encoding); + } + toJSON() { + return { + ...super.toJSON(), + millisecond: this.millisecond, + }; + } +} +_a$5 = GeneralizedTime; +(() => { + typeStore.GeneralizedTime = _a$5; +})(); +GeneralizedTime.NAME = "GeneralizedTime"; + +var _a$4; +class DATE extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 31; + } +} +_a$4 = DATE; +(() => { + typeStore.DATE = _a$4; +})(); +DATE.NAME = "DATE"; + +var _a$3; +class TimeOfDay extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 32; + } +} +_a$3 = TimeOfDay; +(() => { + typeStore.TimeOfDay = _a$3; +})(); +TimeOfDay.NAME = "TimeOfDay"; + +var _a$2; +class DateTime extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 33; + } +} +_a$2 = DateTime; +(() => { + typeStore.DateTime = _a$2; +})(); +DateTime.NAME = "DateTime"; + +var _a$1; +class Duration extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 34; + } +} +_a$1 = Duration; +(() => { + typeStore.Duration = _a$1; +})(); +Duration.NAME = "Duration"; + +var _a; +class TIME extends Utf8String { + constructor(parameters = {}) { + super(parameters); + this.idBlock.tagClass = 1; + this.idBlock.tagNumber = 14; + } +} +_a = TIME; +(() => { + typeStore.TIME = _a; +})(); +TIME.NAME = "TIME"; + +class Any { + constructor({ name = EMPTY_STRING, optional = false } = {}) { + this.name = name; + this.optional = optional; + } +} + +class Choice extends Any { + constructor({ value = [], ...parameters } = {}) { + super(parameters); + this.value = value; + } +} + +class Repeated extends Any { + constructor({ value = new Any(), local = false, ...parameters } = {}) { + super(parameters); + this.value = value; + this.local = local; + } +} + +class RawData { + get data() { + return this.dataView.slice().buffer; + } + set data(value) { + this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(value); + } + constructor({ data = EMPTY_VIEW } = {}) { + this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(data); + } + fromBER(inputBuffer, inputOffset, inputLength) { + const endLength = inputOffset + inputLength; + this.dataView = pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer).subarray(inputOffset, endLength); + return endLength; + } + toBER(_sizeOnly) { + return this.dataView.slice().buffer; + } +} + +function compareSchema(root, inputData, inputSchema) { + if (inputSchema instanceof Choice) { + for (const element of inputSchema.value) { + const result = compareSchema(root, inputData, element); + if (result.verified) { + return { + verified: true, + result: root, + }; + } + } + { + const _result = { + verified: false, + result: { error: "Wrong values for Choice type" }, + }; + if (inputSchema.hasOwnProperty(NAME)) + _result.name = inputSchema.name; + return _result; + } + } + if (inputSchema instanceof Any) { + if (inputSchema.hasOwnProperty(NAME)) + root[inputSchema.name] = inputData; + return { + verified: true, + result: root, + }; + } + if ((root instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong root object" }, + }; + } + if ((inputData instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 data" }, + }; + } + if ((inputSchema instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if ((ID_BLOCK in inputSchema) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if ((FROM_BER in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if ((TO_BER in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + const encodedId = inputSchema.idBlock.toBER(false); + if (encodedId.byteLength === 0) { + return { + verified: false, + result: { error: "Error encoding idBlock for ASN.1 schema" }, + }; + } + const decodedOffset = inputSchema.idBlock.fromBER(encodedId, 0, encodedId.byteLength); + if (decodedOffset === -1) { + return { + verified: false, + result: { error: "Error decoding idBlock for ASN.1 schema" }, + }; + } + if (inputSchema.idBlock.hasOwnProperty(TAG_CLASS) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if (inputSchema.idBlock.tagClass !== inputData.idBlock.tagClass) { + return { + verified: false, + result: root, + }; + } + if (inputSchema.idBlock.hasOwnProperty(TAG_NUMBER) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if (inputSchema.idBlock.tagNumber !== inputData.idBlock.tagNumber) { + return { + verified: false, + result: root, + }; + } + if (inputSchema.idBlock.hasOwnProperty(IS_CONSTRUCTED) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if (inputSchema.idBlock.isConstructed !== inputData.idBlock.isConstructed) { + return { + verified: false, + result: root, + }; + } + if (!(IS_HEX_ONLY in inputSchema.idBlock)) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + if (inputSchema.idBlock.isHexOnly !== inputData.idBlock.isHexOnly) { + return { + verified: false, + result: root, + }; + } + if (inputSchema.idBlock.isHexOnly) { + if ((VALUE_HEX_VIEW in inputSchema.idBlock) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema" }, + }; + } + const schemaView = inputSchema.idBlock.valueHexView; + const asn1View = inputData.idBlock.valueHexView; + if (schemaView.length !== asn1View.length) { + return { + verified: false, + result: root, + }; + } + for (let i = 0; i < schemaView.length; i++) { + if (schemaView[i] !== asn1View[1]) { + return { + verified: false, + result: root, + }; + } + } + } + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + root[inputSchema.name] = inputData; + } + if (inputSchema instanceof typeStore.Constructed) { + let admission = 0; + let result = { + verified: false, + result: { error: "Unknown error" }, + }; + let maxLength = inputSchema.valueBlock.value.length; + if (maxLength > 0) { + if (inputSchema.valueBlock.value[0] instanceof Repeated) { + maxLength = inputData.valueBlock.value.length; + } + } + if (maxLength === 0) { + return { + verified: true, + result: root, + }; + } + if ((inputData.valueBlock.value.length === 0) + && (inputSchema.valueBlock.value.length !== 0)) { + let _optional = true; + for (let i = 0; i < inputSchema.valueBlock.value.length; i++) + _optional = _optional && (inputSchema.valueBlock.value[i].optional || false); + if (_optional) { + return { + verified: true, + result: root, + }; + } + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + root.error = "Inconsistent object length"; + return { + verified: false, + result: root, + }; + } + for (let i = 0; i < maxLength; i++) { + if ((i - admission) >= inputData.valueBlock.value.length) { + if (inputSchema.valueBlock.value[i].optional === false) { + const _result = { + verified: false, + result: root, + }; + root.error = "Inconsistent length between ASN.1 data and schema"; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + } + else { + if (inputSchema.valueBlock.value[0] instanceof Repeated) { + result = compareSchema(root, inputData.valueBlock.value[i], inputSchema.valueBlock.value[0].value); + if (result.verified === false) { + if (inputSchema.valueBlock.value[0].optional) + admission++; + else { + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + return result; + } + } + if ((NAME in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].name.length > 0)) { + let arrayRoot = {}; + if ((LOCAL in inputSchema.valueBlock.value[0]) && (inputSchema.valueBlock.value[0].local)) + arrayRoot = inputData; + else + arrayRoot = root; + if (typeof arrayRoot[inputSchema.valueBlock.value[0].name] === "undefined") + arrayRoot[inputSchema.valueBlock.value[0].name] = []; + arrayRoot[inputSchema.valueBlock.value[0].name].push(inputData.valueBlock.value[i]); + } + } + else { + result = compareSchema(root, inputData.valueBlock.value[i - admission], inputSchema.valueBlock.value[i]); + if (result.verified === false) { + if (inputSchema.valueBlock.value[i].optional) + admission++; + else { + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) + delete root[inputSchema.name]; + } + return result; + } + } + } + } + } + if (result.verified === false) { + const _result = { + verified: false, + result: root, + }; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + return { + verified: true, + result: root, + }; + } + if (inputSchema.primitiveSchema + && (VALUE_HEX_VIEW in inputData.valueBlock)) { + const asn1 = localFromBER(inputData.valueBlock.valueHexView); + if (asn1.offset === -1) { + const _result = { + verified: false, + result: asn1.result, + }; + if (inputSchema.name) { + inputSchema.name = inputSchema.name.replace(/^\s+|\s+$/g, EMPTY_STRING); + if (inputSchema.name) { + delete root[inputSchema.name]; + _result.name = inputSchema.name; + } + } + return _result; + } + return compareSchema(root, asn1.result, inputSchema.primitiveSchema); + } + return { + verified: true, + result: root, + }; +} +function verifySchema(inputBuffer, inputSchema) { + if ((inputSchema instanceof Object) === false) { + return { + verified: false, + result: { error: "Wrong ASN.1 schema type" }, + }; + } + const asn1 = localFromBER(pvtsutils__WEBPACK_IMPORTED_MODULE_0__.BufferSourceConverter.toUint8Array(inputBuffer)); + if (asn1.offset === -1) { + return { + verified: false, + result: asn1.result, + }; + } + return compareSchema(asn1.result, asn1.result, inputSchema); +} + + + + +/***/ }), + +/***/ 56009: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/es-object-atoms@1.1.2/node_modules/es-object-atoms/index.js ***! + \*****************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('.')} */ +module.exports = Object; + + +/***/ }), + +/***/ 56051: +/*!*************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+utils@2.0.3/node_modules/@peculiar/utils/build/esm/encoding/base64.js ***! + \*************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ base64: () => (/* binding */ base64), +/* harmony export */ decode: () => (/* binding */ decode), +/* harmony export */ encode: () => (/* binding */ encode), +/* harmony export */ is: () => (/* binding */ is), +/* harmony export */ normalize: () => (/* binding */ normalize), +/* harmony export */ pad: () => (/* binding */ pad) +/* harmony export */ }); +/* harmony import */ var _bytes_index_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../bytes/index.js */ 15246); +/* harmony import */ var _binary_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./binary.js */ 47521); + + +const BASE64_REGEX = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/; +function nodeBuffer() { + return globalThis.Buffer; +} +function normalize(text) { + return text.replace(/[\n\r\t ]/g, ""); +} +function pad(text) { + const remainder = text.length % 4; + return remainder ? text + "=".repeat(4 - remainder) : text; +} +function is(text) { + if (typeof text !== "string") { + return false; + } + const normalized = normalize(text); + return normalized === "" || BASE64_REGEX.test(normalized); +} +function encode(data, _options) { + const bytes = (0,_bytes_index_js__WEBPACK_IMPORTED_MODULE_0__.toUint8Array)(data); + const buffer = nodeBuffer(); + if (buffer) { + return buffer.from(bytes).toString("base64"); + } + return btoa((0,_binary_js__WEBPACK_IMPORTED_MODULE_1__.encode)(bytes)); +} +function decode(text, _options) { + const normalized = normalize(text); + if (!is(normalized)) { + throw new TypeError("Input is not valid Base64 text"); + } + const buffer = nodeBuffer(); + if (buffer) { + return new Uint8Array(buffer.from(normalized, "base64")); + } + return (0,_binary_js__WEBPACK_IMPORTED_MODULE_1__.decode)(atob(normalized)); +} +const base64 = { encode, decode, is, normalize, pad }; + + +/***/ }), + +/***/ 56130: +/*!*******************************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic/ec/index.js ***! + \*******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var BN = __webpack_require__(/*! bn.js */ 27019); +var HmacDRBG = __webpack_require__(/*! hmac-drbg */ 45232); +var utils = __webpack_require__(/*! ../utils */ 28432); +var curves = __webpack_require__(/*! ../curves */ 55897); +var rand = __webpack_require__(/*! brorand */ 1781); +var assert = utils.assert; + +var KeyPair = __webpack_require__(/*! ./key */ 79309); +var Signature = __webpack_require__(/*! ./signature */ 53556); + +function EC(options) { + if (!(this instanceof EC)) + return new EC(options); + + // Shortcut `elliptic.ec(curve-name)` + if (typeof options === 'string') { + assert(Object.prototype.hasOwnProperty.call(curves, options), + 'Unknown curve ' + options); + + options = curves[options]; + } + + // Shortcut for `elliptic.ec(elliptic.curves.curveName)` + if (options instanceof curves.PresetCurve) + options = { curve: options }; + + this.curve = options.curve.curve; + this.n = this.curve.n; + this.nh = this.n.ushrn(1); + this.g = this.curve.g; + + // Point on curve + this.g = options.curve.g; + this.g.precompute(options.curve.n.bitLength() + 1); + + // Hash for function for DRBG + this.hash = options.hash || options.curve.hash; +} +module.exports = EC; + +EC.prototype.keyPair = function keyPair(options) { + return new KeyPair(this, options); +}; + +EC.prototype.keyFromPrivate = function keyFromPrivate(priv, enc) { + return KeyPair.fromPrivate(this, priv, enc); +}; + +EC.prototype.keyFromPublic = function keyFromPublic(pub, enc) { + return KeyPair.fromPublic(this, pub, enc); +}; + +EC.prototype.genKeyPair = function genKeyPair(options) { + if (!options) + options = {}; + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + entropy: options.entropy || rand(this.hash.hmacStrength), + entropyEnc: options.entropy && options.entropyEnc || 'utf8', + nonce: this.n.toArray(), + }); + + var bytes = this.n.byteLength(); + var ns2 = this.n.sub(new BN(2)); + for (;;) { + var priv = new BN(drbg.generate(bytes)); + if (priv.cmp(ns2) > 0) + continue; + + priv.iaddn(1); + return this.keyFromPrivate(priv); + } +}; + +EC.prototype._truncateToN = function _truncateToN(msg, truncOnly, bitLength) { + var byteLength; + if (BN.isBN(msg) || typeof msg === 'number') { + msg = new BN(msg, 16); + byteLength = msg.byteLength(); + } else if (typeof msg === 'object') { + // BN assumes an array-like input and asserts length + byteLength = msg.length; + msg = new BN(msg, 16); + } else { + // BN converts the value to string + var str = msg.toString(); + // HEX encoding + byteLength = (str.length + 1) >>> 1; + msg = new BN(str, 16); + } + // Allow overriding + if (typeof bitLength !== 'number') { + bitLength = byteLength * 8; + } + var delta = bitLength - this.n.bitLength(); + if (delta > 0) + msg = msg.ushrn(delta); + if (!truncOnly && msg.cmp(this.n) >= 0) + return msg.sub(this.n); + else + return msg; +}; + +EC.prototype.sign = function sign(msg, key, enc, options) { + if (typeof enc === 'object') { + options = enc; + enc = null; + } + if (!options) + options = {}; + + if (typeof msg !== 'string' && typeof msg !== 'number' && !BN.isBN(msg)) { + assert(typeof msg === 'object' && msg && typeof msg.length === 'number', + 'Expected message to be an array-like, a hex string, or a BN instance'); + assert((msg.length >>> 0) === msg.length); // non-negative 32-bit integer + for (var i = 0; i < msg.length; i++) assert((msg[i] & 255) === msg[i]); + } + + key = this.keyFromPrivate(key, enc); + msg = this._truncateToN(msg, false, options.msgBitLength); + + // Would fail further checks, but let's make the error message clear + assert(!msg.isNeg(), 'Can not sign a negative message'); + + // Zero-extend key to provide enough entropy + var bytes = this.n.byteLength(); + var bkey = key.getPrivate().toArray('be', bytes); + + // Zero-extend nonce to have the same byte size as N + var nonce = msg.toArray('be', bytes); + + // Recheck nonce to be bijective to msg + assert((new BN(nonce)).eq(msg), 'Can not sign message'); + + // Instantiate Hmac_DRBG + var drbg = new HmacDRBG({ + hash: this.hash, + entropy: bkey, + nonce: nonce, + pers: options.pers, + persEnc: options.persEnc || 'utf8', + }); + + // Number of bytes to generate + var ns1 = this.n.sub(new BN(1)); + + for (var iter = 0; ; iter++) { + var k = options.k ? + options.k(iter) : + new BN(drbg.generate(this.n.byteLength())); + k = this._truncateToN(k, true); + if (k.cmpn(1) <= 0 || k.cmp(ns1) >= 0) + continue; + + var kp = this.g.mul(k); + if (kp.isInfinity()) + continue; + + var kpX = kp.getX(); + var r = kpX.umod(this.n); + if (r.cmpn(0) === 0) + continue; + + var s = k.invm(this.n).mul(r.mul(key.getPrivate()).iadd(msg)); + s = s.umod(this.n); + if (s.cmpn(0) === 0) + continue; + + var recoveryParam = (kp.getY().isOdd() ? 1 : 0) | + (kpX.cmp(r) !== 0 ? 2 : 0); + + // Use complement of `s`, if it is > `n / 2` + if (options.canonical && s.cmp(this.nh) > 0) { + s = this.n.sub(s); + recoveryParam ^= 1; + } + + return new Signature({ r: r, s: s, recoveryParam: recoveryParam }); + } +}; + +EC.prototype.verify = function verify(msg, signature, key, enc, options) { + if (!options) + options = {}; + + msg = this._truncateToN(msg, false, options.msgBitLength); + key = this.keyFromPublic(key, enc); + signature = new Signature(signature, 'hex'); + + // Perform primitive values validation + var r = signature.r; + var s = signature.s; + if (r.cmpn(1) < 0 || r.cmp(this.n) >= 0) + return false; + if (s.cmpn(1) < 0 || s.cmp(this.n) >= 0) + return false; + + // Validate signature + var sinv = s.invm(this.n); + var u1 = sinv.mul(msg).umod(this.n); + var u2 = sinv.mul(r).umod(this.n); + var p; + + if (!this.curve._maxwellTrick) { + p = this.g.mulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + return p.getX().umod(this.n).cmp(r) === 0; + } + + // NOTE: Greg Maxwell's trick, inspired by: + // https://git.io/vad3K + + p = this.g.jmulAdd(u1, key.getPublic(), u2); + if (p.isInfinity()) + return false; + + // Compare `p.x` of Jacobian point with `r`, + // this will do `p.x == r * p.z^2` instead of multiplying `p.x` by the + // inverse of `p.z^2` + return p.eqXToP(r); +}; + +EC.prototype.recoverPubKey = function(msg, signature, j, enc) { + assert((3 & j) === j, 'The recovery param is more than two bits'); + signature = new Signature(signature, enc); + + var n = this.n; + var e = new BN(msg); + var r = signature.r; + var s = signature.s; + + // A set LSB signifies that the y-coordinate is odd + var isYOdd = j & 1; + var isSecondKey = j >> 1; + if (r.cmp(this.curve.p.umod(this.curve.n)) >= 0 && isSecondKey) + throw new Error('Unable to find sencond key candinate'); + + // 1.1. Let x = r + jn. + if (isSecondKey) + r = this.curve.pointFromX(r.add(this.curve.n), isYOdd); + else + r = this.curve.pointFromX(r, isYOdd); + + var rInv = signature.r.invm(n); + var s1 = n.sub(e).mul(rInv).umod(n); + var s2 = s.mul(rInv).umod(n); + + // 1.6.1 Compute Q = r^-1 (sR - eG) + // Q = r^-1 (sR + -eG) + return this.g.mulAdd(s1, r, s2); +}; + +EC.prototype.getKeyRecoveryParam = function(e, signature, Q, enc) { + signature = new Signature(signature, enc); + if (signature.recoveryParam !== null) + return signature.recoveryParam; + + for (var i = 0; i < 4; i++) { + var Qprime; + try { + Qprime = this.recoverPubKey(e, signature, i); + } catch (e) { + continue; + } + + if (Qprime.eq(Q)) + return i; + } + throw new Error('Unable to find valid recovery factor'); +}; + + +/***/ }), + +/***/ 56253: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/mutex.js ***! + \***************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Mutex: () => (/* binding */ Mutex) +/* harmony export */ }); +var __classPrivateFieldGet = (undefined && undefined.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (undefined && undefined.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _Mutex_locked; +class Mutex { + constructor() { + _Mutex_locked.set(this, Promise.resolve()); + } + async lock() { + let releaseLock; + const nextLock = new Promise((resolve) => { + releaseLock = resolve; + }); + const previousLock = __classPrivateFieldGet(this, _Mutex_locked, "f"); + __classPrivateFieldSet(this, _Mutex_locked, nextLock, "f"); + await previousLock; + return releaseLock; + } +} +_Mutex_locked = new WeakMap(); + + +/***/ }), + +/***/ 56550: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/xCryptoKey.js ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ XCryptoKey: () => (/* binding */ XCryptoKey) +/* harmony export */ }); +class XCryptoKey { + constructor(name, key, type, usages = []) { + Object.defineProperty(this, "key", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "type", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "extractable", { + enumerable: true, + configurable: true, + writable: true, + value: true + }); + Object.defineProperty(this, "algorithm", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "usages", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.key = key; + this.type = type; + this.algorithm = { name: name }; + this.usages = usages; + if (type === "public") { + this.usages = []; + } + } +} + + +/***/ }), + +/***/ 56636: +/*!**************************************************************************!*\ + !*** ../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs ***! + \**************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ __addDisposableResource: () => (/* binding */ __addDisposableResource), +/* harmony export */ __assign: () => (/* binding */ __assign), +/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator), +/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator), +/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues), +/* harmony export */ __await: () => (/* binding */ __await), +/* harmony export */ __awaiter: () => (/* binding */ __awaiter), +/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet), +/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn), +/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet), +/* harmony export */ __createBinding: () => (/* binding */ __createBinding), +/* harmony export */ __decorate: () => (/* binding */ __decorate), +/* harmony export */ __disposeResources: () => (/* binding */ __disposeResources), +/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate), +/* harmony export */ __exportStar: () => (/* binding */ __exportStar), +/* harmony export */ __extends: () => (/* binding */ __extends), +/* harmony export */ __generator: () => (/* binding */ __generator), +/* harmony export */ __importDefault: () => (/* binding */ __importDefault), +/* harmony export */ __importStar: () => (/* binding */ __importStar), +/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject), +/* harmony export */ __metadata: () => (/* binding */ __metadata), +/* harmony export */ __param: () => (/* binding */ __param), +/* harmony export */ __propKey: () => (/* binding */ __propKey), +/* harmony export */ __read: () => (/* binding */ __read), +/* harmony export */ __rest: () => (/* binding */ __rest), +/* harmony export */ __rewriteRelativeImportExtension: () => (/* binding */ __rewriteRelativeImportExtension), +/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers), +/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName), +/* harmony export */ __spread: () => (/* binding */ __spread), +/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray), +/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays), +/* harmony export */ __values: () => (/* binding */ __values), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/****************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +/* global Reflect, Promise, SuppressedError, Symbol, Iterator */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; + +function __runInitializers(thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; + +function __propKey(x) { + return typeof x === "symbol" ? x : "".concat(x); +}; + +function __setFunctionName(f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); + return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +var __createBinding = Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +}); + +function __exportStar(m, o) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p); +} + +function __values(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +/** @deprecated */ +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +/** @deprecated */ +function __spreadArrays() { + for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; + for (var r = Array(s), k = 0, i = 0; i < il; i++) + for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) + r[k] = a[j]; + return r; +} + +function __spreadArray(to, from, pack) { + if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } + } + return to.concat(ar || Array.prototype.slice.call(from)); +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i; + function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; } + function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +var __setModuleDefault = Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}; + +var ownKeys = function(o) { + ownKeys = Object.getOwnPropertyNames || function (o) { + var ar = []; + for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; + return ar; + }; + return ownKeys(o); +}; + +function __importStar(mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); + __setModuleDefault(result, mod); + return result; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} + +function __classPrivateFieldGet(receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +} + +function __classPrivateFieldSet(receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +} + +function __classPrivateFieldIn(state, receiver) { + if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object"); + return typeof state === "function" ? receiver === state : state.has(receiver); +} + +function __addDisposableResource(env, value, async) { + if (value !== null && value !== void 0) { + if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected."); + var dispose, inner; + if (async) { + if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined."); + dispose = value[Symbol.asyncDispose]; + } + if (dispose === void 0) { + if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined."); + dispose = value[Symbol.dispose]; + if (async) inner = dispose; + } + if (typeof dispose !== "function") throw new TypeError("Object not disposable."); + if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } }; + env.stack.push({ value: value, dispose: dispose, async: async }); + } + else if (async) { + env.stack.push({ async: true }); + } + return value; +} + +var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { + var e = new Error(message); + return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; +}; + +function __disposeResources(env) { + function fail(e) { + env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e; + env.hasError = true; + } + var r, s = 0; + function next() { + while (r = env.stack.pop()) { + try { + if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next); + if (r.dispose) { + var result = r.dispose.call(r.value); + if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); }); + } + else s |= 1; + } + catch (e) { + fail(e); + } + } + if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve(); + if (env.hasError) throw env.error; + } + return next(); +} + +function __rewriteRelativeImportExtension(path, preserveJsx) { + if (typeof path === "string" && /^\.\.?\//.test(path)) { + return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) { + return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js"); + }); + } + return path; +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({ + __extends, + __assign, + __rest, + __decorate, + __param, + __esDecorate, + __runInitializers, + __propKey, + __setFunctionName, + __metadata, + __awaiter, + __generator, + __createBinding, + __exportStar, + __values, + __read, + __spread, + __spreadArrays, + __spreadArray, + __await, + __asyncGenerator, + __asyncDelegator, + __asyncValues, + __makeTemplateObject, + __importStar, + __importDefault, + __classPrivateFieldGet, + __classPrivateFieldSet, + __classPrivateFieldIn, + __addDisposableResource, + __disposeResources, + __rewriteRelativeImportExtension, +}); + + +/***/ }), + +/***/ 56735: +/*!******************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/decoders/pem.js ***! + \******************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var inherits = __webpack_require__(/*! inherits */ 18628); +var Buffer = (__webpack_require__(/*! buffer */ 62266).Buffer); + +var DERDecoder = __webpack_require__(/*! ./der */ 80338); + +function PEMDecoder(entity) { + DERDecoder.call(this, entity); + this.enc = 'pem'; +}; +inherits(PEMDecoder, DERDecoder); +module.exports = PEMDecoder; + +PEMDecoder.prototype.decode = function decode(data, options) { + var lines = data.toString().split(/[\r\n]+/g); + + var label = options.label.toUpperCase(); + + var re = /^-----(BEGIN|END) ([^-]+)-----$/; + var start = -1; + var end = -1; + for (var i = 0; i < lines.length; i++) { + var match = lines[i].match(re); + if (match === null) + continue; + + if (match[2] !== label) + continue; + + if (start === -1) { + if (match[1] !== 'BEGIN') + break; + start = i; + } else { + if (match[1] !== 'END') + break; + end = i; + break; + } + } + if (start === -1 || end === -1) + throw new Error('PEM section not found for: ' + label); + + var base64 = lines.slice(start + 1, end).join(''); + // Remove excessive symbols + base64.replace(/[^a-z0-9\+\/=]+/gi, ''); + + var input = new Buffer(base64, 'base64'); + return DERDecoder.prototype.decode.call(this, input, options); +}; + + +/***/ }), + +/***/ 56804: +/*!*********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/general_name.js ***! + \*********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnIpConverter: () => (/* binding */ AsnIpConverter), +/* harmony export */ EDIPartyName: () => (/* binding */ EDIPartyName), +/* harmony export */ GeneralName: () => (/* binding */ GeneralName), +/* harmony export */ OtherName: () => (/* binding */ OtherName) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _ip_converter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ip_converter.js */ 26320); +/* harmony import */ var _name_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./name.js */ 8481); + + + + +const AsnIpConverter = { + fromASN: (value) => _ip_converter_js__WEBPACK_IMPORTED_MODULE_2__.IpConverter.toString(_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnOctetStringConverter.fromASN(value)), + toASN: (value) => _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnOctetStringConverter.toASN(_ip_converter_js__WEBPACK_IMPORTED_MODULE_2__.IpConverter.fromString(value)), +}; +class OtherName { + typeId = ""; + value = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], OtherName.prototype, "typeId", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, context: 0, + }) +], OtherName.prototype, "value", void 0); +class EDIPartyName { + nameAssigner; + partyName = new _name_js__WEBPACK_IMPORTED_MODULE_3__.DirectoryString(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _name_js__WEBPACK_IMPORTED_MODULE_3__.DirectoryString, optional: true, context: 0, implicit: true, + }) +], EDIPartyName.prototype, "nameAssigner", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _name_js__WEBPACK_IMPORTED_MODULE_3__.DirectoryString, context: 1, implicit: true, + }) +], EDIPartyName.prototype, "partyName", void 0); +let GeneralName = class GeneralName { + otherName; + rfc822Name; + dNSName; + x400Address; + directoryName; + ediPartyName; + uniformResourceIdentifier; + iPAddress; + registeredID; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: OtherName, context: 0, implicit: true, + }) +], GeneralName.prototype, "otherName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String, context: 1, implicit: true, + }) +], GeneralName.prototype, "rfc822Name", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String, context: 2, implicit: true, + }) +], GeneralName.prototype, "dNSName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any, context: 3, implicit: true, + }) +], GeneralName.prototype, "x400Address", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _name_js__WEBPACK_IMPORTED_MODULE_3__.Name, context: 4, implicit: false, + }) +], GeneralName.prototype, "directoryName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: EDIPartyName, context: 5, + }) +], GeneralName.prototype, "ediPartyName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.IA5String, context: 6, implicit: true, + }) +], GeneralName.prototype, "uniformResourceIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.OctetString, + context: 7, + implicit: true, + converter: AsnIpConverter, + }) +], GeneralName.prototype, "iPAddress", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier, context: 8, implicit: true, + }) +], GeneralName.prototype, "registeredID", void 0); +GeneralName = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], GeneralName); + + + +/***/ }), + +/***/ 56807: +/*!********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/certificate.js ***! + \********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Certificate: () => (/* binding */ Certificate) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./algorithm_identifier.js */ 99875); +/* harmony import */ var _tbs_certificate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./tbs_certificate.js */ 37519); + + + + +class Certificate { + tbsCertificate = new _tbs_certificate_js__WEBPACK_IMPORTED_MODULE_3__.TBSCertificate(); + tbsCertificateRaw; + signatureAlgorithm = new _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + signatureValue = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _tbs_certificate_js__WEBPACK_IMPORTED_MODULE_3__.TBSCertificate, raw: true, + }) +], Certificate.prototype, "tbsCertificate", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _algorithm_identifier_js__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], Certificate.prototype, "signatureAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.BitString }) +], Certificate.prototype, "signatureValue", void 0); + + +/***/ }), + +/***/ 56915: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/p256.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ encodeToCurve: () => (/* binding */ encodeToCurve), +/* harmony export */ hashToCurve: () => (/* binding */ hashToCurve), +/* harmony export */ p256: () => (/* binding */ p256), +/* harmony export */ secp256r1: () => (/* binding */ secp256r1) +/* harmony export */ }); +/* harmony import */ var _nist_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./nist.js */ 35376); +/** + * NIST secp256r1 aka p256. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ + + +const p256 = _nist_js__WEBPACK_IMPORTED_MODULE_0__.p256; +const secp256r1 = _nist_js__WEBPACK_IMPORTED_MODULE_0__.p256; +const hashToCurve = /* @__PURE__ */ (() => _nist_js__WEBPACK_IMPORTED_MODULE_0__.p256_hasher.hashToCurve)(); +const encodeToCurve = /* @__PURE__ */ (() => _nist_js__WEBPACK_IMPORTED_MODULE_0__.p256_hasher.encodeToCurve)(); +//# sourceMappingURL=p256.js.map + +/***/ }), + +/***/ 57004: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/_dnt.shims.js ***! + \*********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ dntGlobalThis: () => (/* binding */ dntGlobalThis) +/* harmony export */ }); +const dntGlobals = {}; +const dntGlobalThis = createMergeProxy(globalThis, dntGlobals); +function createMergeProxy(baseObj, extObj) { + return new Proxy(baseObj, { + get(_target, prop, _receiver) { + if (prop in extObj) { + return extObj[prop]; + } + else { + return baseObj[prop]; + } + }, + set(_target, prop, value) { + if (prop in extObj) { + delete extObj[prop]; + } + baseObj[prop] = value; + return true; + }, + deleteProperty(_target, prop) { + let success = false; + if (prop in extObj) { + delete extObj[prop]; + success = true; + } + if (prop in baseObj) { + delete baseObj[prop]; + success = true; + } + return success; + }, + ownKeys(_target) { + const baseKeys = Reflect.ownKeys(baseObj); + const extKeys = Reflect.ownKeys(extObj); + const extKeysSet = new Set(extKeys); + return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys]; + }, + defineProperty(_target, prop, desc) { + if (prop in extObj) { + delete extObj[prop]; + } + Reflect.defineProperty(baseObj, prop, desc); + return true; + }, + getOwnPropertyDescriptor(_target, prop) { + if (prop in extObj) { + return Reflect.getOwnPropertyDescriptor(extObj, prop); + } + else { + return Reflect.getOwnPropertyDescriptor(baseObj, prop); + } + }, + has(_target, prop) { + return prop in extObj || prop in baseObj; + }, + }); +} + + +/***/ }), + +/***/ 57084: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/kek_recipient_info.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ KEKIdentifier: () => (/* binding */ KEKIdentifier), +/* harmony export */ KEKRecipientInfo: () => (/* binding */ KEKRecipientInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _other_key_attribute_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./other_key_attribute.js */ 79257); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ 96729); + + + + +class KEKIdentifier { + keyIdentifier = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + date; + other; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], KEKIdentifier.prototype, "keyIdentifier", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralizedTime, optional: true, + }) +], KEKIdentifier.prototype, "date", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _other_key_attribute_js__WEBPACK_IMPORTED_MODULE_2__.OtherKeyAttribute, optional: true, + }) +], KEKIdentifier.prototype, "other", void 0); +class KEKRecipientInfo { + version = _types_js__WEBPACK_IMPORTED_MODULE_3__.CMSVersion.v4; + kekid = new KEKIdentifier(); + keyEncryptionAlgorithm = new _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier(); + encryptedKey = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], KEKRecipientInfo.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: KEKIdentifier }) +], KEKRecipientInfo.prototype, "kekid", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _types_js__WEBPACK_IMPORTED_MODULE_3__.KeyEncryptionAlgorithmIdentifier }) +], KEKRecipientInfo.prototype, "keyEncryptionAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString }) +], KEKRecipientInfo.prototype, "encryptedKey", void 0); + + +/***/ }), + +/***/ 57409: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/asn1.js@4.10.1/node_modules/asn1.js/lib/asn1/base/index.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var base = exports; + +base.Reporter = (__webpack_require__(/*! ./reporter */ 12).Reporter); +base.DecoderBuffer = (__webpack_require__(/*! ./buffer */ 88179).DecoderBuffer); +base.EncoderBuffer = (__webpack_require__(/*! ./buffer */ 88179).EncoderBuffer); +base.Node = __webpack_require__(/*! ./node */ 2025); + + +/***/ }), + +/***/ 57430: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/inhibit_any_policy.js ***! + \**************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ InhibitAnyPolicy: () => (/* binding */ InhibitAnyPolicy), +/* harmony export */ id_ce_inhibitAnyPolicy: () => (/* binding */ id_ce_inhibitAnyPolicy) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + +const id_ce_inhibitAnyPolicy = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.54`; +let InhibitAnyPolicy = class InhibitAnyPolicy { + value; + constructor(value = new ArrayBuffer(0)) { + this.value = value; + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], InhibitAnyPolicy.prototype, "value", void 0); +InhibitAnyPolicy = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], InhibitAnyPolicy); + + + +/***/ }), + +/***/ 57522: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/functionCall.js ***! + \****************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./functionCall')} */ +module.exports = Function.prototype.call; + + +/***/ }), + +/***/ 57576: +/*!**********************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/md.js ***! + \**********************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Chi: () => (/* binding */ Chi), +/* harmony export */ HashMD: () => (/* binding */ HashMD), +/* harmony export */ Maj: () => (/* binding */ Maj), +/* harmony export */ SHA256_IV: () => (/* binding */ SHA256_IV), +/* harmony export */ SHA384_IV: () => (/* binding */ SHA384_IV), +/* harmony export */ SHA512_IV: () => (/* binding */ SHA512_IV) +/* harmony export */ }); +/* harmony import */ var _utils_noble_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/noble.js */ 63594); +// deno-lint-ignore-file no-explicit-any +/** + * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes). + * + * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-hashes/blob/2e0c00e1aa134082ba1380bf3afb8b1641f60fed/src/_md.ts + */ +/** + * Internal Merkle-Damgard hash utils. + * @module + */ + +/** Choice: a ? b : c */ +function Chi(a, b, c) { + return (a & b) ^ (~a & c); +} +/** Majority function, true if any two inputs is true. */ +function Maj(a, b, c) { + return (a & b) ^ (a & c) ^ (b & c); +} +/** + * Merkle-Damgard hash construction base class. + * Could be used to create MD5, RIPEMD, SHA1, SHA2. + */ +class HashMD { + constructor(blockLen, outputLen, padOffset, isLE) { + Object.defineProperty(this, "blockLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "outputLen", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "padOffset", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "isLE", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + // For partial updates less than block size + Object.defineProperty(this, "buffer", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "view", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "finished", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + Object.defineProperty(this, "length", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "pos", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "destroyed", { + enumerable: true, + configurable: true, + writable: true, + value: false + }); + this.blockLen = blockLen; + this.outputLen = outputLen; + this.padOffset = padOffset; + this.isLE = isLE; + this.buffer = new Uint8Array(blockLen); + this.view = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.createView)(this.buffer); + } + update(data) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.abytes)(data); + const { view, buffer, blockLen } = this; + const len = data.length; + for (let pos = 0; pos < len;) { + const take = Math.min(blockLen - this.pos, len - pos); + // Fast path: we have at least one block in input, cast it to view and process + if (take === blockLen) { + const dataView = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.createView)(data); + for (; blockLen <= len - pos; pos += blockLen) { + this.process(dataView, pos); + } + continue; + } + buffer.set(data.subarray(pos, pos + take), this.pos); + this.pos += take; + pos += take; + if (this.pos === blockLen) { + this.process(view, 0); + this.pos = 0; + } + } + this.length += data.length; + this.roundClean(); + return this; + } + digestInto(out) { + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.aexists)(this); + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.aoutput)(out, this); + this.finished = true; + // Padding + // We can avoid allocation of buffer for padding completely if it + // was previously not allocated here. But it won't change performance. + const { buffer, view, blockLen, isLE } = this; + let { pos } = this; + // append the bit '1' to the message + buffer[pos++] = 0b10000000; + (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.clean)(this.buffer.subarray(pos)); + // we have less than padOffset left in buffer, so we cannot put length in + // current block, need process it and pad again + if (this.padOffset > blockLen - pos) { + this.process(view, 0); + pos = 0; + } + // Pad until full block byte with zeros + for (let i = pos; i < blockLen; i++) + buffer[i] = 0; + // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that + // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen. + // So we just write lowest 64 bits of that value. + view.setBigUint64(blockLen - 8, (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.numberToBigint)(this.length * 8), isLE); + this.process(view, 0); + const oview = (0,_utils_noble_js__WEBPACK_IMPORTED_MODULE_0__.createView)(out); + const len = this.outputLen; + // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT + if (len % 4) + throw new Error("_sha2: outputLen must be aligned to 32bit"); + const outLen = len / 4; + const state = this.get(); + if (outLen > state.length) { + throw new Error("_sha2: outputLen bigger than state"); + } + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE); + } + digest() { + const { buffer, outputLen } = this; + this.digestInto(buffer); + const res = buffer.slice(0, outputLen); + this.destroy(); + return res; + } + _cloneInto(to) { + to ||= new this.constructor(); + to.set(...this.get()); + const { blockLen, buffer, length, finished, destroyed, pos } = this; + to.destroyed = destroyed; + to.finished = finished; + to.length = length; + to.pos = pos; + if (length % blockLen) + to.buffer.set(buffer); + return to; + } + clone() { + return this._cloneInto(); + } +} +/** + * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53. + * Check out `test/misc/sha2-gen-iv.js` for recomputation guide. + */ +/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */ +const SHA256_IV = /* @__PURE__ */ Uint32Array.from([ + 0x6a09e667, + 0xbb67ae85, + 0x3c6ef372, + 0xa54ff53a, + 0x510e527f, + 0x9b05688c, + 0x1f83d9ab, + 0x5be0cd19, +]); +/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */ +const SHA384_IV = /* @__PURE__ */ Uint32Array.from([ + 0xcbbb9d5d, + 0xc1059ed8, + 0x629a292a, + 0x367cd507, + 0x9159015a, + 0x3070dd17, + 0x152fecd8, + 0xf70e5939, + 0x67332667, + 0xffc00b31, + 0x8eb44a87, + 0x68581511, + 0xdb0c2e0d, + 0x64f98fa7, + 0x47b5481d, + 0xbefa4fa4, +]); +/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */ +const SHA512_IV = /* @__PURE__ */ Uint32Array.from([ + 0x6a09e667, + 0xf3bcc908, + 0xbb67ae85, + 0x84caa73b, + 0x3c6ef372, + 0xfe94f82b, + 0xa54ff53a, + 0x5f1d36f1, + 0x510e527f, + 0xade682d1, + 0x9b05688c, + 0x2b3e6c1f, + 0x1f83d9ab, + 0xfb41bd6b, + 0x5be0cd19, + 0x137e2179, +]); + + +/***/ }), + +/***/ 57846: +/*!***************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind-apply-helpers@1.0.2/node_modules/call-bind-apply-helpers/actualApply.js ***! + \***************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var bind = __webpack_require__(/*! function-bind */ 94867); + +var $apply = __webpack_require__(/*! ./functionApply */ 43920); +var $call = __webpack_require__(/*! ./functionCall */ 57522); +var $reflectApply = __webpack_require__(/*! ./reflectApply */ 34873); + +/** @type {import('./actualApply')} */ +module.exports = $reflectApply || bind.call($call, $apply); + + +/***/ }), + +/***/ 57992: +/*!********************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-aes@1.2.0/node_modules/browserify-aes/modes/cfb8.js ***! + \********************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer) + +function encryptByte (self, byteParam, decrypt) { + var pad = self._cipher.encryptBlock(self._prev) + var out = pad[0] ^ byteParam + + self._prev = Buffer.concat([ + self._prev.slice(1), + Buffer.from([decrypt ? byteParam : out]) + ]) + + return out +} + +exports.encrypt = function (self, chunk, decrypt) { + var len = chunk.length + var out = Buffer.allocUnsafe(len) + var i = -1 + + while (++i < len) { + out[i] = encryptByte(self, chunk[i], decrypt) + } + + return out +} + + +/***/ }), + +/***/ 58036: +/*!******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/data/size.js ***! + \******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ size: () => (/* binding */ size) +/* harmony export */ }); +/* harmony import */ var _isHex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isHex.js */ 76816); + +/** + * @description Retrieves the size of the value (in bytes). + * + * @param value The value (hex or byte array) to retrieve the size of. + * @returns The size of the value (in bytes). + */ +function size(value) { + if ((0,_isHex_js__WEBPACK_IMPORTED_MODULE_0__.isHex)(value, { strict: false })) + return Math.ceil((value.length - 2) / 2); + return value.length; +} +//# sourceMappingURL=size.js.map + +/***/ }), + +/***/ 58167: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509-attr@2.8.0/node_modules/@peculiar/asn1-x509-attr/build/es2015/target.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Target: () => (/* binding */ Target), +/* harmony export */ TargetCert: () => (/* binding */ TargetCert), +/* harmony export */ Targets: () => (/* binding */ Targets) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./issuer_serial.js */ 83996); +/* harmony import */ var _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./object_digest_info.js */ 80835); +var Targets_1; + + + + + +class TargetCert { + targetCertificate = new _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__.IssuerSerial(); + targetName; + certDigestInfo; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _issuer_serial_js__WEBPACK_IMPORTED_MODULE_3__.IssuerSerial }) +], TargetCert.prototype, "targetCertificate", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName, optional: true, + }) +], TargetCert.prototype, "targetName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _object_digest_info_js__WEBPACK_IMPORTED_MODULE_4__.ObjectDigestInfo, optional: true, + }) +], TargetCert.prototype, "certDigestInfo", void 0); +let Target = class Target { + targetName; + targetGroup; + targetCert; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName, context: 0, implicit: true, + }) +], Target.prototype, "targetName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.GeneralName, context: 1, implicit: true, + }) +], Target.prototype, "targetGroup", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: TargetCert, context: 2, implicit: true, + }) +], Target.prototype, "targetCert", void 0); +Target = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], Target); + +let Targets = Targets_1 = class Targets extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, Targets_1.prototype); + } +}; +Targets = Targets_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: Target, + }) +], Targets); + + + +/***/ }), + +/***/ 58269: +/*!*************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/encoding/fromHex.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ assertSize: () => (/* binding */ assertSize), +/* harmony export */ fromHex: () => (/* binding */ fromHex), +/* harmony export */ hexToBigInt: () => (/* binding */ hexToBigInt), +/* harmony export */ hexToBool: () => (/* binding */ hexToBool), +/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber), +/* harmony export */ hexToString: () => (/* binding */ hexToString) +/* harmony export */ }); +/* harmony import */ var _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/encoding.js */ 15923); +/* harmony import */ var _data_size_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/size.js */ 58036); +/* harmony import */ var _data_trim_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../data/trim.js */ 53273); +/* harmony import */ var _toBytes_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./toBytes.js */ 58548); + + + + +function assertSize(hexOrBytes, { size }) { + if ((0,_data_size_js__WEBPACK_IMPORTED_MODULE_1__.size)(hexOrBytes) > size) + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__.SizeOverflowError({ + givenSize: (0,_data_size_js__WEBPACK_IMPORTED_MODULE_1__.size)(hexOrBytes), + maxSize: size, + }); +} +/** + * Decodes a hex string into a string, number, bigint, boolean, or byte array. + * + * - Docs: https://viem.sh/docs/utilities/fromHex + * - Example: https://viem.sh/docs/utilities/fromHex#usage + * + * @param hex Hex string to decode. + * @param toOrOpts Type to convert to or options. + * @returns Decoded value. + * + * @example + * import { fromHex } from 'viem' + * const data = fromHex('0x1a4', 'number') + * // 420 + * + * @example + * import { fromHex } from 'viem' + * const data = fromHex('0x48656c6c6f20576f726c6421', 'string') + * // 'Hello world' + * + * @example + * import { fromHex } from 'viem' + * const data = fromHex('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', { + * size: 32, + * to: 'string' + * }) + * // 'Hello world' + */ +function fromHex(hex, toOrOpts) { + const opts = typeof toOrOpts === 'string' ? { to: toOrOpts } : toOrOpts; + const to = opts.to; + if (to === 'number') + return hexToNumber(hex, opts); + if (to === 'bigint') + return hexToBigInt(hex, opts); + if (to === 'string') + return hexToString(hex, opts); + if (to === 'boolean') + return hexToBool(hex, opts); + return (0,_toBytes_js__WEBPACK_IMPORTED_MODULE_3__.hexToBytes)(hex, opts); +} +/** + * Decodes a hex value into a bigint. + * + * - Docs: https://viem.sh/docs/utilities/fromHex#hextobigint + * + * @param hex Hex value to decode. + * @param opts Options. + * @returns BigInt value. + * + * @example + * import { hexToBigInt } from 'viem' + * const data = hexToBigInt('0x1a4', { signed: true }) + * // 420n + * + * @example + * import { hexToBigInt } from 'viem' + * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 }) + * // 420n + */ +function hexToBigInt(hex, opts = {}) { + const { signed } = opts; + if (opts.size) + assertSize(hex, { size: opts.size }); + const value = BigInt(hex); + if (!signed) + return value; + const size = (hex.length - 2) / 2; + const max = (1n << (BigInt(size) * 8n - 1n)) - 1n; + if (value <= max) + return value; + return value - BigInt(`0x${'f'.padStart(size * 2, 'f')}`) - 1n; +} +/** + * Decodes a hex value into a boolean. + * + * - Docs: https://viem.sh/docs/utilities/fromHex#hextobool + * + * @param hex Hex value to decode. + * @param opts Options. + * @returns Boolean value. + * + * @example + * import { hexToBool } from 'viem' + * const data = hexToBool('0x01') + * // true + * + * @example + * import { hexToBool } from 'viem' + * const data = hexToBool('0x0000000000000000000000000000000000000000000000000000000000000001', { size: 32 }) + * // true + */ +function hexToBool(hex_, opts = {}) { + let hex = hex_; + if (opts.size) { + assertSize(hex, { size: opts.size }); + hex = (0,_data_trim_js__WEBPACK_IMPORTED_MODULE_2__.trim)(hex); + } + if ((0,_data_trim_js__WEBPACK_IMPORTED_MODULE_2__.trim)(hex) === '0x00') + return false; + if ((0,_data_trim_js__WEBPACK_IMPORTED_MODULE_2__.trim)(hex) === '0x01') + return true; + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__.InvalidHexBooleanError(hex); +} +/** + * Decodes a hex string into a number. + * + * - Docs: https://viem.sh/docs/utilities/fromHex#hextonumber + * + * @param hex Hex value to decode. + * @param opts Options. + * @returns Number value. + * + * @example + * import { hexToNumber } from 'viem' + * const data = hexToNumber('0x1a4') + * // 420 + * + * @example + * import { hexToNumber } from 'viem' + * const data = hexToBigInt('0x00000000000000000000000000000000000000000000000000000000000001a4', { size: 32 }) + * // 420 + */ +function hexToNumber(hex, opts = {}) { + const value = hexToBigInt(hex, opts); + const number = Number(value); + if (!Number.isSafeInteger(number)) + throw new _errors_encoding_js__WEBPACK_IMPORTED_MODULE_0__.IntegerOutOfRangeError({ + max: `${Number.MAX_SAFE_INTEGER}`, + min: `${Number.MIN_SAFE_INTEGER}`, + signed: opts.signed, + size: opts.size, + value: `${value}n`, + }); + return number; +} +/** + * Decodes a hex value into a UTF-8 string. + * + * - Docs: https://viem.sh/docs/utilities/fromHex#hextostring + * + * @param hex Hex value to decode. + * @param opts Options. + * @returns String value. + * + * @example + * import { hexToString } from 'viem' + * const data = hexToString('0x48656c6c6f20576f726c6421') + * // 'Hello world!' + * + * @example + * import { hexToString } from 'viem' + * const data = hexToString('0x48656c6c6f20576f726c64210000000000000000000000000000000000000000', { + * size: 32, + * }) + * // 'Hello world' + */ +function hexToString(hex, opts = {}) { + let bytes = (0,_toBytes_js__WEBPACK_IMPORTED_MODULE_3__.hexToBytes)(hex); + if (opts.size) { + assertSize(bytes, { size: opts.size }); + bytes = (0,_data_trim_js__WEBPACK_IMPORTED_MODULE_2__.trim)(bytes, { dir: 'right' }); + } + return new TextDecoder().decode(bytes); +} +//# sourceMappingURL=fromHex.js.map + +/***/ }), + +/***/ 58471: +/*!***************************************************************************************!*\ + !*** ../node_modules/.pnpm/math-intrinsics@1.1.0/node_modules/math-intrinsics/min.js ***! + \***************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./min')} */ +module.exports = Math.min; + + +/***/ }), + +/***/ 58548: +/*!*************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/encoding/toBytes.js ***! + \*************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ boolToBytes: () => (/* binding */ boolToBytes), +/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes), +/* harmony export */ numberToBytes: () => (/* binding */ numberToBytes), +/* harmony export */ stringToBytes: () => (/* binding */ stringToBytes), +/* harmony export */ toBytes: () => (/* binding */ toBytes) +/* harmony export */ }); +/* harmony import */ var _errors_base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../errors/base.js */ 87035); +/* harmony import */ var _data_isHex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../data/isHex.js */ 76816); +/* harmony import */ var _data_pad_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../data/pad.js */ 89244); +/* harmony import */ var _fromHex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fromHex.js */ 58269); +/* harmony import */ var _toHex_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./toHex.js */ 32786); + + + + + +const encoder = /*#__PURE__*/ new TextEncoder(); +/** + * Encodes a UTF-8 string, hex value, bigint, number or boolean to a byte array. + * + * - Docs: https://viem.sh/docs/utilities/toBytes + * - Example: https://viem.sh/docs/utilities/toBytes#usage + * + * @param value Value to encode. + * @param opts Options. + * @returns Byte array value. + * + * @example + * import { toBytes } from 'viem' + * const data = toBytes('Hello world') + * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]) + * + * @example + * import { toBytes } from 'viem' + * const data = toBytes(420) + * // Uint8Array([1, 164]) + * + * @example + * import { toBytes } from 'viem' + * const data = toBytes(420, { size: 4 }) + * // Uint8Array([0, 0, 1, 164]) + */ +function toBytes(value, opts = {}) { + if (typeof value === 'number' || typeof value === 'bigint') + return numberToBytes(value, opts); + if (typeof value === 'boolean') + return boolToBytes(value, opts); + if ((0,_data_isHex_js__WEBPACK_IMPORTED_MODULE_1__.isHex)(value)) + return hexToBytes(value, opts); + return stringToBytes(value, opts); +} +/** + * Encodes a boolean into a byte array. + * + * - Docs: https://viem.sh/docs/utilities/toBytes#booltobytes + * + * @param value Boolean value to encode. + * @param opts Options. + * @returns Byte array value. + * + * @example + * import { boolToBytes } from 'viem' + * const data = boolToBytes(true) + * // Uint8Array([1]) + * + * @example + * import { boolToBytes } from 'viem' + * const data = boolToBytes(true, { size: 32 }) + * // Uint8Array([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, 0, 1]) + */ +function boolToBytes(value, opts = {}) { + const bytes = new Uint8Array(1); + bytes[0] = Number(value); + if (typeof opts.size === 'number') { + (0,_fromHex_js__WEBPACK_IMPORTED_MODULE_3__.assertSize)(bytes, { size: opts.size }); + return (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_2__.pad)(bytes, { size: opts.size }); + } + return bytes; +} +// We use very optimized technique to convert hex string to byte array +const charCodeMap = { + zero: 48, + nine: 57, + A: 65, + F: 70, + a: 97, + f: 102, +}; +function charCodeToBase16(char) { + if (char >= charCodeMap.zero && char <= charCodeMap.nine) + return char - charCodeMap.zero; + if (char >= charCodeMap.A && char <= charCodeMap.F) + return char - (charCodeMap.A - 10); + if (char >= charCodeMap.a && char <= charCodeMap.f) + return char - (charCodeMap.a - 10); + return undefined; +} +/** + * Encodes a hex string into a byte array. + * + * - Docs: https://viem.sh/docs/utilities/toBytes#hextobytes + * + * @param hex Hex string to encode. + * @param opts Options. + * @returns Byte array value. + * + * @example + * import { hexToBytes } from 'viem' + * const data = hexToBytes('0x48656c6c6f20776f726c6421') + * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33]) + * + * @example + * import { hexToBytes } from 'viem' + * const data = hexToBytes('0x48656c6c6f20776f726c6421', { size: 32 }) + * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + */ +function hexToBytes(hex_, opts = {}) { + let hex = hex_; + if (opts.size) { + (0,_fromHex_js__WEBPACK_IMPORTED_MODULE_3__.assertSize)(hex, { size: opts.size }); + hex = (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_2__.pad)(hex, { dir: 'right', size: opts.size }); + } + let hexString = hex.slice(2); + if (hexString.length % 2) + hexString = `0${hexString}`; + const length = hexString.length / 2; + const bytes = new Uint8Array(length); + for (let index = 0, j = 0; index < length; index++) { + const nibbleLeft = charCodeToBase16(hexString.charCodeAt(j++)); + const nibbleRight = charCodeToBase16(hexString.charCodeAt(j++)); + if (nibbleLeft === undefined || nibbleRight === undefined) { + throw new _errors_base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError(`Invalid byte sequence ("${hexString[j - 2]}${hexString[j - 1]}" in "${hexString}").`); + } + bytes[index] = nibbleLeft * 16 + nibbleRight; + } + return bytes; +} +/** + * Encodes a number into a byte array. + * + * - Docs: https://viem.sh/docs/utilities/toBytes#numbertobytes + * + * @param value Number to encode. + * @param opts Options. + * @returns Byte array value. + * + * @example + * import { numberToBytes } from 'viem' + * const data = numberToBytes(420) + * // Uint8Array([1, 164]) + * + * @example + * import { numberToBytes } from 'viem' + * const data = numberToBytes(420, { size: 4 }) + * // Uint8Array([0, 0, 1, 164]) + */ +function numberToBytes(value, opts) { + const hex = (0,_toHex_js__WEBPACK_IMPORTED_MODULE_4__.numberToHex)(value, opts); + return hexToBytes(hex); +} +/** + * Encodes a UTF-8 string into a byte array. + * + * - Docs: https://viem.sh/docs/utilities/toBytes#stringtobytes + * + * @param value String to encode. + * @param opts Options. + * @returns Byte array value. + * + * @example + * import { stringToBytes } from 'viem' + * const data = stringToBytes('Hello world!') + * // Uint8Array([72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33]) + * + * @example + * import { stringToBytes } from 'viem' + * const data = stringToBytes('Hello world!', { size: 32 }) + * // Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) + */ +function stringToBytes(value, opts = {}) { + const bytes = encoder.encode(value); + if (typeof opts.size === 'number') { + (0,_fromHex_js__WEBPACK_IMPORTED_MODULE_3__.assertSize)(bytes, { size: opts.size }); + return (0,_data_pad_js__WEBPACK_IMPORTED_MODULE_2__.pad)(bytes, { dir: 'right', size: opts.size }); + } + return bytes; +} +//# sourceMappingURL=toBytes.js.map + +/***/ }), + +/***/ 58575: +/*!*****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/style-loader@3.3.3_webpack@5.102.1/node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js ***! + \*****************************************************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/* istanbul ignore next */ +function setAttributesWithoutAttributes(styleElement) { + var nonce = true ? __webpack_require__.nc : 0; + if (nonce) { + styleElement.setAttribute("nonce", nonce); + } +} +module.exports = setAttributesWithoutAttributes; + +/***/ }), + +/***/ 58930: +/*!******************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/injectable.js ***! + \******************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _reflection_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reflection-helpers */ 90635); +/* harmony import */ var _dependency_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dependency-container */ 62625); + + + +function injectable(options) { + return function (target) { + _dependency_container__WEBPACK_IMPORTED_MODULE_1__.typeInfo.set(target, (0,_reflection_helpers__WEBPACK_IMPORTED_MODULE_0__.getParamInfo)(target)); + if (options && options.token) { + if (!Array.isArray(options.token)) { + _dependency_container__WEBPACK_IMPORTED_MODULE_1__.instance.register(options.token, target); + } + else { + options.token.forEach(function (token) { + _dependency_container__WEBPACK_IMPORTED_MODULE_1__.instance.register(token, target); + }); + } + } + }; +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (injectable); + + +/***/ }), + +/***/ 59419: +/*!***************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/blob/commitmentToVersionedHash.js ***! + \***************************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ commitmentToVersionedHash: () => (/* binding */ commitmentToVersionedHash) +/* harmony export */ }); +/* harmony import */ var _encoding_toHex_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../encoding/toHex.js */ 32786); +/* harmony import */ var _hash_sha256_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../hash/sha256.js */ 74566); + + +/** + * Transform a commitment to it's versioned hash. + * + * @example + * ```ts + * import { + * blobsToCommitments, + * commitmentToVersionedHash, + * toBlobs + * } from 'viem' + * import { kzg } from './kzg' + * + * const blobs = toBlobs({ data: '0x1234' }) + * const [commitment] = blobsToCommitments({ blobs, kzg }) + * const versionedHash = commitmentToVersionedHash({ commitment }) + * ``` + */ +function commitmentToVersionedHash(parameters) { + const { commitment, version = 1 } = parameters; + const to = parameters.to ?? (typeof commitment === 'string' ? 'hex' : 'bytes'); + const versionedHash = (0,_hash_sha256_js__WEBPACK_IMPORTED_MODULE_1__.sha256)(commitment, 'bytes'); + versionedHash.set([version], 0); + return (to === 'bytes' ? versionedHash : (0,_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_0__.bytesToHex)(versionedHash)); +} +//# sourceMappingURL=commitmentToVersionedHash.js.map + +/***/ }), + +/***/ 59431: +/*!**************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/ec.js ***! + \**************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Ec: () => (/* binding */ Ec) +/* harmony export */ }); +/* harmony import */ var _algorithm_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../algorithm.js */ 19437); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../consts.js */ 53838); +/* harmony import */ var _kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../kdfs/hkdf.js */ 40138); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../errors.js */ 48385); +/* harmony import */ var _identifiers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../identifiers.js */ 16780); +/* harmony import */ var _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../interfaces/dhkemPrimitives.js */ 41744); +/* harmony import */ var _utils_bignum_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../utils/bignum.js */ 69794); +/* harmony import */ var _utils_misc_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../utils/misc.js */ 30988); + + + + + + + + +// b"candidate" +// deno-fmt-ignore +const LABEL_CANDIDATE = /* @__PURE__ */ new Uint8Array([ + 99, 97, 110, 100, 105, 100, 97, 116, 101, +]); +// the order of the curve being used. +// deno-fmt-ignore +const ORDER_P_256 = /* @__PURE__ */ new Uint8Array([ + 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84, + 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51, +]); +// deno-fmt-ignore +const ORDER_P_384 = /* @__PURE__ */ new Uint8Array([ + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf, + 0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a, + 0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73, +]); +// deno-fmt-ignore +const ORDER_P_521 = /* @__PURE__ */ new Uint8Array([ + 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f, + 0x96, 0x6b, 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09, + 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c, + 0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38, + 0x64, 0x09, +]); +// deno-fmt-ignore +const PKCS8_ALG_ID_P_256 = /* @__PURE__ */ new Uint8Array([ + 48, 65, 2, 1, 0, 48, 19, 6, 7, 42, + 134, 72, 206, 61, 2, 1, 6, 8, 42, 134, + 72, 206, 61, 3, 1, 7, 4, 39, 48, 37, + 2, 1, 1, 4, 32, +]); +// deno-fmt-ignore +const PKCS8_ALG_ID_P_384 = /* @__PURE__ */ new Uint8Array([ + 48, 78, 2, 1, 0, 48, 16, 6, 7, 42, + 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, + 4, 0, 34, 4, 55, 48, 53, 2, 1, 1, + 4, 48, +]); +// deno-fmt-ignore +const PKCS8_ALG_ID_P_521 = /* @__PURE__ */ new Uint8Array([ + 48, 96, 2, 1, 0, 48, 16, 6, 7, 42, + 134, 72, 206, 61, 2, 1, 6, 5, 43, 129, + 4, 0, 35, 4, 73, 48, 71, 2, 1, 1, + 4, 66, +]); +const EC_P_256_PARAMS = { + p: 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn, + b: 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn, + gx: 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296n, + gy: 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5n, + coordinateSize: 32, +}; +const EC_P_384_PARAMS = { + p: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffffn, + b: 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aefn, + gx: 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7n, + gy: 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5fn, + coordinateSize: 48, +}; +const EC_P_521_PARAMS = { + p: (1n << 521n) - 1n, + b: 0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00n, + gx: 0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66n, + gy: 0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650n, + coordinateSize: 66, +}; +function mod(a, p) { + const r = a % p; + return r >= 0n ? r : r + p; +} +function modPow(base, exponent, p) { + let result = 1n; + let b = mod(base, p); + let e = exponent; + while (e > 0n) { + if ((e & 1n) === 1n) { + result = mod(result * b, p); + } + b = mod(b * b, p); + e >>= 1n; + } + return result; +} +function modSqrt(rhs, p) { + // P-256/P-384/P-521 primes satisfy p % 4 == 3. + const y = modPow(rhs, (p + 1n) >> 2n, p); + if (mod(y * y, p) !== mod(rhs, p)) { + throw new Error("Invalid ECDH point"); + } + return y; +} +function bytesToBigInt(bytes) { + let v = 0n; + for (const b of bytes) { + v = (v << 8n) | _consts_js__WEBPACK_IMPORTED_MODULE_1__.BYTE_TO_BIGINT_256[b]; + } + return v; +} +function bigIntToBytes(v, len) { + const out = new Uint8Array(len); + let n = v; + for (let i = len - 1; i >= 0; i--) { + out[i] = Number(n & 0xffn); + n >>= 8n; + } + if (n !== 0n) { + throw new Error("Invalid coordinate length"); + } + return out; +} +function buildRawUncompressedPublicKey(x, y, coordinateSize) { + const out = new Uint8Array(1 + coordinateSize * 2); + out[0] = 0x04; + out.set(bigIntToBytes(x, coordinateSize), 1); + out.set(bigIntToBytes(y, coordinateSize), 1 + coordinateSize); + return out; +} +class Ec extends _algorithm_js__WEBPACK_IMPORTED_MODULE_0__.NativeAlgorithm { + constructor(kem, hkdf) { + super(); + Object.defineProperty(this, "_hkdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_alg", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nPk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nSk", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_nDh", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + // EC specific arguments for deriving key pair. + Object.defineProperty(this, "_order", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_bitmask", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_pkcs8AlgId", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_curveParams", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._hkdf = hkdf; + switch (kem) { + case _identifiers_js__WEBPACK_IMPORTED_MODULE_4__.KemId.DhkemP256HkdfSha256: + this._alg = { name: "ECDH", namedCurve: "P-256" }; + this._nPk = 65; + this._nSk = 32; + this._nDh = 32; + this._order = ORDER_P_256; + this._bitmask = 0xFF; + this._pkcs8AlgId = PKCS8_ALG_ID_P_256; + this._curveParams = EC_P_256_PARAMS; + break; + case _identifiers_js__WEBPACK_IMPORTED_MODULE_4__.KemId.DhkemP384HkdfSha384: + this._alg = { name: "ECDH", namedCurve: "P-384" }; + this._nPk = 97; + this._nSk = 48; + this._nDh = 48; + this._order = ORDER_P_384; + this._bitmask = 0xFF; + this._pkcs8AlgId = PKCS8_ALG_ID_P_384; + this._curveParams = EC_P_384_PARAMS; + break; + default: + // case KemId.DhkemP521HkdfSha512: + this._alg = { name: "ECDH", namedCurve: "P-521" }; + this._nPk = 133; + this._nSk = 66; + this._nDh = 66; + this._order = ORDER_P_521; + this._bitmask = 0x01; + this._pkcs8AlgId = PKCS8_ALG_ID_P_521; + this._curveParams = EC_P_521_PARAMS; + break; + } + } + async serializePublicKey(key) { + await this._setup(); + try { + return await this._api.exportKey("raw", key); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.SerializeError(e); + } + } + async deserializePublicKey(key) { + await this._setup(); + try { + return await this._importRawKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key), true); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.DeserializeError(e); + } + } + async serializePrivateKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + if (!("d" in jwk)) { + throw new Error("Not private key"); + } + return (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_7__.base64UrlToBytes)(jwk["d"]).buffer; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.SerializeError(e); + } + } + async deserializePrivateKey(key) { + await this._setup(); + try { + return await this._importRawKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key), false); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.DeserializeError(e); + } + } + async importKey(format, key, isPublic) { + await this._setup(); + try { + if (format === "raw") { + return await this._importRawKey(key, isPublic); + } + // jwk + if (key instanceof ArrayBuffer) { + throw new Error("Invalid jwk key format"); + } + return await this._importJWK(key, isPublic); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.DeserializeError(e); + } + } + async generateKeyPair() { + await this._setup(); + try { + return await this._api.generateKey(this._alg, true, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_5__.KEM_USAGES); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.NotSupportedError(e); + } + } + async deriveKeyPair(ikm) { + await this._setup(); + try { + const rawIkm = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(ikm); + const dkpPrk = await this._hkdf.labeledExtract(_consts_js__WEBPACK_IMPORTED_MODULE_1__.EMPTY, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_5__.LABEL_DKP_PRK, new Uint8Array(rawIkm)); + const bn = new _utils_bignum_js__WEBPACK_IMPORTED_MODULE_6__.Bignum(this._nSk); + for (let counter = 0; bn.isZero() || !bn.lessThan(this._order); counter++) { + if (counter > 255) { + throw new Error("Faild to derive a key pair"); + } + const bytes = new Uint8Array(await this._hkdf.labeledExpand(dkpPrk, LABEL_CANDIDATE, (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_7__.i2Osp)(counter, 1), this._nSk)); + bytes[0] = bytes[0] & this._bitmask; + bn.set(bytes); + } + const sk = await this._deserializePkcs8Key(bn.val()); + bn.reset(); + return { + privateKey: sk, + publicKey: await this.derivePublicKey(sk), + }; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.DeriveKeyPairError(e); + } + } + async derivePublicKey(key) { + await this._setup(); + try { + const jwk = await this._api.exportKey("jwk", key); + delete jwk["d"]; + delete jwk["key_ops"]; + return await this._api.importKey("jwk", jwk, this._alg, true, []); + } + catch { + try { + // Firefox fails to export JWK from some imported ECDH private keys. + return await this._derivePublicKeyWithoutJwkExport(key); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.DeserializeError(e); + } + } + } + async dh(sk, pk) { + try { + await this._setup(); + const bits = await this._api.deriveBits({ + name: "ECDH", + public: pk, + }, sk, this._nDh * 8); + return bits; + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_3__.SerializeError(e); + } + } + async _importRawKey(key, isPublic) { + if (isPublic && key.byteLength !== this._nPk) { + throw new Error("Invalid public key for the ciphersuite"); + } + if (!isPublic && key.byteLength !== this._nSk) { + throw new Error("Invalid private key for the ciphersuite"); + } + if (isPublic) { + return await this._api.importKey("raw", key, this._alg, true, []); + } + return await this._deserializePkcs8Key(new Uint8Array(key)); + } + async _importJWK(key, isPublic) { + if (typeof key.crv === "undefined" || key.crv !== this._alg.namedCurve) { + throw new Error(`Invalid crv: ${key.crv}`); + } + if (isPublic) { + if (typeof key.d !== "undefined") { + throw new Error("Invalid key: `d` should not be set"); + } + return await this._api.importKey("jwk", key, this._alg, true, []); + } + if (typeof key.d === "undefined") { + throw new Error("Invalid key: `d` not found"); + } + return await this._api.importKey("jwk", key, this._alg, true, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_5__.KEM_USAGES); + } + async _deserializePkcs8Key(k) { + const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length); + pkcs8Key.set(this._pkcs8AlgId, 0); + pkcs8Key.set(k, this._pkcs8AlgId.length); + return await this._api.importKey("pkcs8", pkcs8Key, this._alg, true, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_5__.KEM_USAGES); + } + async _derivePublicKeyWithoutJwkExport(key) { + const basePointRaw = buildRawUncompressedPublicKey(this._curveParams.gx, this._curveParams.gy, this._curveParams.coordinateSize); + const basePoint = await this._api.importKey("raw", basePointRaw.buffer, this._alg, true, []); + const xBytes = new Uint8Array(await this._api.deriveBits({ + name: "ECDH", + public: basePoint, + }, key, this._nDh * 8)); + const p = this._curveParams.p; + const x = bytesToBigInt(xBytes); + const rhs = mod(modPow(x, 3n, p) - 3n * x + this._curveParams.b, p); + let y = modSqrt(rhs, p); + // Canonicalize sign so the encoded point is deterministic. + if ((y & 1n) === 1n) { + y = p - y; + } + const pubRaw = buildRawUncompressedPublicKey(x, y, this._curveParams.coordinateSize); + return await this._api.importKey("raw", pubRaw.buffer, this._alg, true, []); + } +} + + +/***/ }), + +/***/ 59900: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/curve/curve.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createKeygen: () => (/* binding */ createKeygen) +/* harmony export */ }); +/** + * This file is based on noble-curves (https://github.com/paulmillr/noble-curves). + * + * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/abstract/curve.ts + */ +function createKeygen( +// deno-lint-ignore ban-types +randomSecretKey, getPublicKey) { + return function keygen(seed) { + const secretKey = randomSecretKey(seed); + return { secretKey, publicKey: getPublicKey(secretKey) }; + }; +} + + +/***/ }), + +/***/ 59902: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/inject-with-transform.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _reflection_helpers__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../reflection-helpers */ 90635); + +function injectWithTransform(token, transformer) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + return (0,_reflection_helpers__WEBPACK_IMPORTED_MODULE_0__.defineInjectionTokenMetadata)(token, { + transformToken: transformer, + args: args + }); +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (injectWithTransform); + + +/***/ }), + +/***/ 60001: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/call-bind@1.0.9/node_modules/call-bind/index.js ***! + \*****************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var setFunctionLength = __webpack_require__(/*! set-function-length */ 11256); + +var $defineProperty = __webpack_require__(/*! es-define-property */ 69001); + +var callBindBasic = __webpack_require__(/*! call-bind-apply-helpers */ 26948); +var applyBind = __webpack_require__(/*! call-bind-apply-helpers/applyBind */ 127); + +module.exports = function callBind(originalFunction) { + var func = callBindBasic(arguments); + var adjustedLength = 1 + originalFunction.length - (arguments.length - 1); + return setFunctionLength( + func, + adjustedLength > 0 ? adjustedLength : 0, + true + ); +}; + +if ($defineProperty) { + $defineProperty(module.exports, 'apply', { value: applyBind }); +} else { + module.exports.apply = applyBind; +} + + +/***/ }), + +/***/ 60379: +/*!**************************************************************************************!*\ + !*** ../node_modules/.pnpm/core-util-is@1.0.3/node_modules/core-util-is/lib/util.js ***! + \**************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = __webpack_require__(/*! buffer */ 62266).Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +/***/ }), + +/***/ 60426: +/*!************************************************************************!*\ + !*** ../node_modules/.pnpm/cbor-js@0.1.0/node_modules/cbor-js/cbor.js ***! + \************************************************************************/ +/***/ (function(module, exports, __webpack_require__) { + +var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/* + * The MIT License (MIT) + * + * Copyright (c) 2014 Patrick Gansterer + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +(function(global, undefined) { "use strict"; +var POW_2_24 = Math.pow(2, -24), + POW_2_32 = Math.pow(2, 32), + POW_2_53 = Math.pow(2, 53); + +function encode(value) { + var data = new ArrayBuffer(256); + var dataView = new DataView(data); + var lastLength; + var offset = 0; + + function ensureSpace(length) { + var newByteLength = data.byteLength; + var requiredLength = offset + length; + while (newByteLength < requiredLength) + newByteLength *= 2; + if (newByteLength !== data.byteLength) { + var oldDataView = dataView; + data = new ArrayBuffer(newByteLength); + dataView = new DataView(data); + var uint32count = (offset + 3) >> 2; + for (var i = 0; i < uint32count; ++i) + dataView.setUint32(i * 4, oldDataView.getUint32(i * 4)); + } + + lastLength = length; + return dataView; + } + function write() { + offset += lastLength; + } + function writeFloat64(value) { + write(ensureSpace(8).setFloat64(offset, value)); + } + function writeUint8(value) { + write(ensureSpace(1).setUint8(offset, value)); + } + function writeUint8Array(value) { + var dataView = ensureSpace(value.length); + for (var i = 0; i < value.length; ++i) + dataView.setUint8(offset + i, value[i]); + write(); + } + function writeUint16(value) { + write(ensureSpace(2).setUint16(offset, value)); + } + function writeUint32(value) { + write(ensureSpace(4).setUint32(offset, value)); + } + function writeUint64(value) { + var low = value % POW_2_32; + var high = (value - low) / POW_2_32; + var dataView = ensureSpace(8); + dataView.setUint32(offset, high); + dataView.setUint32(offset + 4, low); + write(); + } + function writeTypeAndLength(type, length) { + if (length < 24) { + writeUint8(type << 5 | length); + } else if (length < 0x100) { + writeUint8(type << 5 | 24); + writeUint8(length); + } else if (length < 0x10000) { + writeUint8(type << 5 | 25); + writeUint16(length); + } else if (length < 0x100000000) { + writeUint8(type << 5 | 26); + writeUint32(length); + } else { + writeUint8(type << 5 | 27); + writeUint64(length); + } + } + + function encodeItem(value) { + var i; + + if (value === false) + return writeUint8(0xf4); + if (value === true) + return writeUint8(0xf5); + if (value === null) + return writeUint8(0xf6); + if (value === undefined) + return writeUint8(0xf7); + + switch (typeof value) { + case "number": + if (Math.floor(value) === value) { + if (0 <= value && value <= POW_2_53) + return writeTypeAndLength(0, value); + if (-POW_2_53 <= value && value < 0) + return writeTypeAndLength(1, -(value + 1)); + } + writeUint8(0xfb); + return writeFloat64(value); + + case "string": + var utf8data = []; + for (i = 0; i < value.length; ++i) { + var charCode = value.charCodeAt(i); + if (charCode < 0x80) { + utf8data.push(charCode); + } else if (charCode < 0x800) { + utf8data.push(0xc0 | charCode >> 6); + utf8data.push(0x80 | charCode & 0x3f); + } else if (charCode < 0xd800) { + utf8data.push(0xe0 | charCode >> 12); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } else { + charCode = (charCode & 0x3ff) << 10; + charCode |= value.charCodeAt(++i) & 0x3ff; + charCode += 0x10000; + + utf8data.push(0xf0 | charCode >> 18); + utf8data.push(0x80 | (charCode >> 12) & 0x3f); + utf8data.push(0x80 | (charCode >> 6) & 0x3f); + utf8data.push(0x80 | charCode & 0x3f); + } + } + + writeTypeAndLength(3, utf8data.length); + return writeUint8Array(utf8data); + + default: + var length; + if (Array.isArray(value)) { + length = value.length; + writeTypeAndLength(4, length); + for (i = 0; i < length; ++i) + encodeItem(value[i]); + } else if (value instanceof Uint8Array) { + writeTypeAndLength(2, value.length); + writeUint8Array(value); + } else { + var keys = Object.keys(value); + length = keys.length; + writeTypeAndLength(5, length); + for (i = 0; i < length; ++i) { + var key = keys[i]; + encodeItem(key); + encodeItem(value[key]); + } + } + } + } + + encodeItem(value); + + if ("slice" in data) + return data.slice(0, offset); + + var ret = new ArrayBuffer(offset); + var retView = new DataView(ret); + for (var i = 0; i < offset; ++i) + retView.setUint8(i, dataView.getUint8(i)); + return ret; +} + +function decode(data, tagger, simpleValue) { + var dataView = new DataView(data); + var offset = 0; + + if (typeof tagger !== "function") + tagger = function(value) { return value; }; + if (typeof simpleValue !== "function") + simpleValue = function() { return undefined; }; + + function read(value, length) { + offset += length; + return value; + } + function readArrayBuffer(length) { + return read(new Uint8Array(data, offset, length), length); + } + function readFloat16() { + var tempArrayBuffer = new ArrayBuffer(4); + var tempDataView = new DataView(tempArrayBuffer); + var value = readUint16(); + + var sign = value & 0x8000; + var exponent = value & 0x7c00; + var fraction = value & 0x03ff; + + if (exponent === 0x7c00) + exponent = 0xff << 10; + else if (exponent !== 0) + exponent += (127 - 15) << 10; + else if (fraction !== 0) + return fraction * POW_2_24; + + tempDataView.setUint32(0, sign << 16 | exponent << 13 | fraction << 13); + return tempDataView.getFloat32(0); + } + function readFloat32() { + return read(dataView.getFloat32(offset), 4); + } + function readFloat64() { + return read(dataView.getFloat64(offset), 8); + } + function readUint8() { + return read(dataView.getUint8(offset), 1); + } + function readUint16() { + return read(dataView.getUint16(offset), 2); + } + function readUint32() { + return read(dataView.getUint32(offset), 4); + } + function readUint64() { + return readUint32() * POW_2_32 + readUint32(); + } + function readBreak() { + if (dataView.getUint8(offset) !== 0xff) + return false; + offset += 1; + return true; + } + function readLength(additionalInformation) { + if (additionalInformation < 24) + return additionalInformation; + if (additionalInformation === 24) + return readUint8(); + if (additionalInformation === 25) + return readUint16(); + if (additionalInformation === 26) + return readUint32(); + if (additionalInformation === 27) + return readUint64(); + if (additionalInformation === 31) + return -1; + throw "Invalid length encoding"; + } + function readIndefiniteStringLength(majorType) { + var initialByte = readUint8(); + if (initialByte === 0xff) + return -1; + var length = readLength(initialByte & 0x1f); + if (length < 0 || (initialByte >> 5) !== majorType) + throw "Invalid indefinite length element"; + return length; + } + + function appendUtf16data(utf16data, length) { + for (var i = 0; i < length; ++i) { + var value = readUint8(); + if (value & 0x80) { + if (value < 0xe0) { + value = (value & 0x1f) << 6 + | (readUint8() & 0x3f); + length -= 1; + } else if (value < 0xf0) { + value = (value & 0x0f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 2; + } else { + value = (value & 0x0f) << 18 + | (readUint8() & 0x3f) << 12 + | (readUint8() & 0x3f) << 6 + | (readUint8() & 0x3f); + length -= 3; + } + } + + if (value < 0x10000) { + utf16data.push(value); + } else { + value -= 0x10000; + utf16data.push(0xd800 | (value >> 10)); + utf16data.push(0xdc00 | (value & 0x3ff)); + } + } + } + + function decodeItem() { + var initialByte = readUint8(); + var majorType = initialByte >> 5; + var additionalInformation = initialByte & 0x1f; + var i; + var length; + + if (majorType === 7) { + switch (additionalInformation) { + case 25: + return readFloat16(); + case 26: + return readFloat32(); + case 27: + return readFloat64(); + } + } + + length = readLength(additionalInformation); + if (length < 0 && (majorType < 2 || 6 < majorType)) + throw "Invalid length"; + + switch (majorType) { + case 0: + return length; + case 1: + return -1 - length; + case 2: + if (length < 0) { + var elements = []; + var fullArrayLength = 0; + while ((length = readIndefiniteStringLength(majorType)) >= 0) { + fullArrayLength += length; + elements.push(readArrayBuffer(length)); + } + var fullArray = new Uint8Array(fullArrayLength); + var fullArrayOffset = 0; + for (i = 0; i < elements.length; ++i) { + fullArray.set(elements[i], fullArrayOffset); + fullArrayOffset += elements[i].length; + } + return fullArray; + } + return readArrayBuffer(length); + case 3: + var utf16data = []; + if (length < 0) { + while ((length = readIndefiniteStringLength(majorType)) >= 0) + appendUtf16data(utf16data, length); + } else + appendUtf16data(utf16data, length); + return String.fromCharCode.apply(null, utf16data); + case 4: + var retArray; + if (length < 0) { + retArray = []; + while (!readBreak()) + retArray.push(decodeItem()); + } else { + retArray = new Array(length); + for (i = 0; i < length; ++i) + retArray[i] = decodeItem(); + } + return retArray; + case 5: + var retObject = {}; + for (i = 0; i < length || length < 0 && !readBreak(); ++i) { + var key = decodeItem(); + retObject[key] = decodeItem(); + } + return retObject; + case 6: + return tagger(decodeItem(), length); + case 7: + switch (length) { + case 20: + return false; + case 21: + return true; + case 22: + return null; + case 23: + return undefined; + default: + return simpleValue(length); + } + } + } + + var ret = decodeItem(); + if (offset !== data.byteLength) + throw "Remaining bytes"; + return ret; +} + +var obj = { encode: encode, decode: decode }; + +if (true) + !(__WEBPACK_AMD_DEFINE_FACTORY__ = (obj), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : + __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); +else // removed by dead control flow +{} + +})(this); + + +/***/ }), + +/***/ 60592: +/*!****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/style-loader@3.3.3_webpack@5.102.1/node_modules/style-loader/dist/runtime/styleTagTransform.js ***! + \****************************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/* istanbul ignore next */ +function styleTagTransform(css, styleElement) { + if (styleElement.styleSheet) { + styleElement.styleSheet.cssText = css; + } else { + while (styleElement.firstChild) { + styleElement.removeChild(styleElement.firstChild); + } + styleElement.appendChild(document.createTextNode(css)); + } +} +module.exports = styleTagTransform; + +/***/ }), + +/***/ 61221: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/signed_data.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DigestAlgorithmIdentifiers: () => (/* binding */ DigestAlgorithmIdentifiers), +/* harmony export */ SignedData: () => (/* binding */ SignedData) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _certificate_choices_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./certificate_choices.js */ 73968); +/* harmony import */ var _types_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./types.js */ 96729); +/* harmony import */ var _encapsulated_content_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./encapsulated_content_info.js */ 10102); +/* harmony import */ var _revocation_info_choice_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./revocation_info_choice.js */ 61695); +/* harmony import */ var _signer_info_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./signer_info.js */ 50275); +var DigestAlgorithmIdentifiers_1; + + + + + + + +let DigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = class DigestAlgorithmIdentifiers extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, DigestAlgorithmIdentifiers_1.prototype); + } +}; +DigestAlgorithmIdentifiers = DigestAlgorithmIdentifiers_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set, itemType: _types_js__WEBPACK_IMPORTED_MODULE_3__.DigestAlgorithmIdentifier, + }) +], DigestAlgorithmIdentifiers); + +class SignedData { + version = _types_js__WEBPACK_IMPORTED_MODULE_3__.CMSVersion.v0; + digestAlgorithms = new DigestAlgorithmIdentifiers(); + encapContentInfo = new _encapsulated_content_info_js__WEBPACK_IMPORTED_MODULE_4__.EncapsulatedContentInfo(); + certificates; + crls; + signerInfos = new _signer_info_js__WEBPACK_IMPORTED_MODULE_6__.SignerInfos(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], SignedData.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: DigestAlgorithmIdentifiers }) +], SignedData.prototype, "digestAlgorithms", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _encapsulated_content_info_js__WEBPACK_IMPORTED_MODULE_4__.EncapsulatedContentInfo }) +], SignedData.prototype, "encapContentInfo", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _certificate_choices_js__WEBPACK_IMPORTED_MODULE_2__.CertificateSet, context: 0, implicit: true, optional: true, + }) +], SignedData.prototype, "certificates", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _revocation_info_choice_js__WEBPACK_IMPORTED_MODULE_5__.RevocationInfoChoices, context: 1, implicit: true, optional: true, + }) +], SignedData.prototype, "crls", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _signer_info_js__WEBPACK_IMPORTED_MODULE_6__.SignerInfos }) +], SignedData.prototype, "signerInfos", void 0); + + +/***/ }), + +/***/ 61418: +/*!******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/index.js ***! + \******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AsnAnyConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnAnyConverter), +/* harmony export */ AsnArray: () => (/* reexport safe */ _objects_js__WEBPACK_IMPORTED_MODULE_7__.AsnArray), +/* harmony export */ AsnBitStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnBitStringConverter), +/* harmony export */ AsnBmpStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnBmpStringConverter), +/* harmony export */ AsnBooleanConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnBooleanConverter), +/* harmony export */ AsnCharacterStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnCharacterStringConverter), +/* harmony export */ AsnChoiceType: () => (/* reexport safe */ _decorators_js__WEBPACK_IMPORTED_MODULE_2__.AsnChoiceType), +/* harmony export */ AsnConstructedOctetStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnConstructedOctetStringConverter), +/* harmony export */ AsnConvert: () => (/* reexport safe */ _convert_js__WEBPACK_IMPORTED_MODULE_8__.AsnConvert), +/* harmony export */ AsnEnumeratedConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnEnumeratedConverter), +/* harmony export */ AsnGeneralStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnGeneralStringConverter), +/* harmony export */ AsnGeneralizedTimeConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnGeneralizedTimeConverter), +/* harmony export */ AsnGraphicStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnGraphicStringConverter), +/* harmony export */ AsnIA5StringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnIA5StringConverter), +/* harmony export */ AsnIntegerArrayBufferConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnIntegerArrayBufferConverter), +/* harmony export */ AsnIntegerBigIntConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnIntegerBigIntConverter), +/* harmony export */ AsnIntegerConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnIntegerConverter), +/* harmony export */ AsnNullConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnNullConverter), +/* harmony export */ AsnNumericStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnNumericStringConverter), +/* harmony export */ AsnObjectIdentifierConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnObjectIdentifierConverter), +/* harmony export */ AsnOctetStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnOctetStringConverter), +/* harmony export */ AsnParser: () => (/* reexport safe */ _parser_js__WEBPACK_IMPORTED_MODULE_4__.AsnParser), +/* harmony export */ AsnPrintableStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnPrintableStringConverter), +/* harmony export */ AsnProp: () => (/* reexport safe */ _decorators_js__WEBPACK_IMPORTED_MODULE_2__.AsnProp), +/* harmony export */ AsnPropTypes: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnPropTypes), +/* harmony export */ AsnSchemaValidationError: () => (/* reexport safe */ _errors_index_js__WEBPACK_IMPORTED_MODULE_6__.AsnSchemaValidationError), +/* harmony export */ AsnSequenceType: () => (/* reexport safe */ _decorators_js__WEBPACK_IMPORTED_MODULE_2__.AsnSequenceType), +/* harmony export */ AsnSerializer: () => (/* reexport safe */ _serializer_js__WEBPACK_IMPORTED_MODULE_5__.AsnSerializer), +/* harmony export */ AsnSetType: () => (/* reexport safe */ _decorators_js__WEBPACK_IMPORTED_MODULE_2__.AsnSetType), +/* harmony export */ AsnTeletexStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnTeletexStringConverter), +/* harmony export */ AsnType: () => (/* reexport safe */ _decorators_js__WEBPACK_IMPORTED_MODULE_2__.AsnType), +/* harmony export */ AsnTypeTypes: () => (/* reexport safe */ _enums_js__WEBPACK_IMPORTED_MODULE_3__.AsnTypeTypes), +/* harmony export */ AsnUTCTimeConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnUTCTimeConverter), +/* harmony export */ AsnUniversalStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnUniversalStringConverter), +/* harmony export */ AsnUtf8StringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnUtf8StringConverter), +/* harmony export */ AsnVideotexStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnVideotexStringConverter), +/* harmony export */ AsnVisibleStringConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.AsnVisibleStringConverter), +/* harmony export */ BitString: () => (/* reexport safe */ _types_index_js__WEBPACK_IMPORTED_MODULE_1__.BitString), +/* harmony export */ OctetString: () => (/* reexport safe */ _types_index_js__WEBPACK_IMPORTED_MODULE_1__.OctetString), +/* harmony export */ defaultConverter: () => (/* reexport safe */ _converters_js__WEBPACK_IMPORTED_MODULE_0__.defaultConverter) +/* harmony export */ }); +/* harmony import */ var _converters_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./converters.js */ 97057); +/* harmony import */ var _types_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types/index.js */ 96928); +/* harmony import */ var _decorators_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decorators.js */ 99542); +/* harmony import */ var _enums_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./enums.js */ 55904); +/* harmony import */ var _parser_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./parser.js */ 3043); +/* harmony import */ var _serializer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./serializer.js */ 16980); +/* harmony import */ var _errors_index_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./errors/index.js */ 3944); +/* harmony import */ var _objects_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./objects.js */ 27410); +/* harmony import */ var _convert_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./convert.js */ 80081); + + + + + + + + + + + +/***/ }), + +/***/ 61677: +/*!************************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-sign@4.2.6/node_modules/browserify-sign/browser/sign.js ***! + \************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// much of this based on https://github.com/indutny/self-signed/blob/gh-pages/lib/rsa.js +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var createHmac = __webpack_require__(/*! create-hmac */ 44226); +var crt = __webpack_require__(/*! browserify-rsa */ 45405); +var EC = (__webpack_require__(/*! elliptic */ 63174).ec); +var BN = __webpack_require__(/*! bn.js */ 40113); +var parseKeys = __webpack_require__(/*! parse-asn1 */ 15210); +var curves = __webpack_require__(/*! ./curves.json */ 39503); + +var RSA_PKCS1_PADDING = 1; + +function sign(hash, key, hashType, signType, tag) { + var priv = parseKeys(key); + if (priv.curve) { + // rsa keys can be interpreted as ecdsa ones in openssl + if (signType !== 'ecdsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); } + return ecSign(hash, priv); + } else if (priv.type === 'dsa') { + if (signType !== 'dsa') { throw new Error('wrong private key type'); } + return dsaSign(hash, priv, hashType); + } + if (signType !== 'rsa' && signType !== 'ecdsa/rsa') { throw new Error('wrong private key type'); } + if (key.padding !== undefined && key.padding !== RSA_PKCS1_PADDING) { throw new Error('illegal or unsupported padding mode'); } + + hash = Buffer.concat([tag, hash]); + var len = priv.modulus.byteLength(); + var pad = [0, 1]; + while (hash.length + pad.length + 1 < len) { pad.push(0xff); } + pad.push(0x00); + var i = -1; + while (++i < hash.length) { pad.push(hash[i]); } + + var out = crt(pad, priv); + return out; +} + +function ecSign(hash, priv) { + var curveId = curves[priv.curve.join('.')]; + if (!curveId) { throw new Error('unknown curve ' + priv.curve.join('.')); } + + var curve = new EC(curveId); + var key = curve.keyFromPrivate(priv.privateKey); + var out = key.sign(hash); + + return Buffer.from(out.toDER()); +} + +function dsaSign(hash, priv, algo) { + var x = priv.params.priv_key; + var p = priv.params.p; + var q = priv.params.q; + var g = priv.params.g; + var r = new BN(0); + var k; + var H = bits2int(hash, q).mod(q); + var s = false; + var kv = getKey(x, q, hash, algo); + while (s === false) { + k = makeKey(q, kv, algo); + r = makeR(g, k, p, q); + s = k.invm(q).imul(H.add(x.mul(r))).mod(q); + if (s.cmpn(0) === 0) { + s = false; + r = new BN(0); + } + } + return toDER(r, s); +} + +function toDER(r, s) { + r = r.toArray(); + s = s.toArray(); + + // Pad values + if (r[0] & 0x80) { r = [0].concat(r); } + if (s[0] & 0x80) { s = [0].concat(s); } + + var total = r.length + s.length + 4; + var res = [ + 0x30, total, 0x02, r.length + ]; + res = res.concat(r, [0x02, s.length], s); + return Buffer.from(res); +} + +function getKey(x, q, hash, algo) { + x = Buffer.from(x.toArray()); + if (x.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - x.length); + x = Buffer.concat([zeros, x]); + } + var hlen = hash.length; + var hbits = bits2octets(hash, q); + var v = Buffer.alloc(hlen); + v.fill(1); + var k = Buffer.alloc(hlen); + k = createHmac(algo, k).update(v).update(Buffer.from([0])).update(x).update(hbits).digest(); + v = createHmac(algo, k).update(v).digest(); + k = createHmac(algo, k).update(v).update(Buffer.from([1])).update(x).update(hbits).digest(); + v = createHmac(algo, k).update(v).digest(); + return { k: k, v: v }; +} + +function bits2int(obits, q) { + var bits = new BN(obits); + var shift = (obits.length << 3) - q.bitLength(); + if (shift > 0) { bits.ishrn(shift); } + return bits; +} + +function bits2octets(bits, q) { + bits = bits2int(bits, q); + bits = bits.mod(q); + var out = Buffer.from(bits.toArray()); + if (out.length < q.byteLength()) { + var zeros = Buffer.alloc(q.byteLength() - out.length); + out = Buffer.concat([zeros, out]); + } + return out; +} + +function makeKey(q, kv, algo) { + var t; + var k; + + do { + t = Buffer.alloc(0); + + while (t.length * 8 < q.bitLength()) { + kv.v = createHmac(algo, kv.k).update(kv.v).digest(); + t = Buffer.concat([t, kv.v]); + } + + k = bits2int(t, q); + kv.k = createHmac(algo, kv.k).update(kv.v).update(Buffer.from([0])).digest(); + kv.v = createHmac(algo, kv.k).update(kv.v).digest(); + } while (k.cmp(q) !== -1); + + return k; +} + +function makeR(g, k, p, q) { + return g.toRed(BN.mont(p)).redPow(k).fromRed().mod(q); +} + +module.exports = sign; +module.exports.getKey = getKey; +module.exports.makeKey = makeKey; + + +/***/ }), + +/***/ 61695: +/*!*****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/revocation_info_choice.js ***! + \*****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ OtherRevocationInfoFormat: () => (/* binding */ OtherRevocationInfoFormat), +/* harmony export */ RevocationInfoChoice: () => (/* binding */ RevocationInfoChoice), +/* harmony export */ RevocationInfoChoices: () => (/* binding */ RevocationInfoChoices), +/* harmony export */ id_ri: () => (/* binding */ id_ri), +/* harmony export */ id_ri_ocsp_response: () => (/* binding */ id_ri_ocsp_response), +/* harmony export */ id_ri_scvp: () => (/* binding */ id_ri_scvp) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +var RevocationInfoChoices_1; + + + +const id_ri = `${_peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.id_pkix}.16`; +const id_ri_ocsp_response = `${id_ri}.2`; +const id_ri_scvp = `${id_ri}.4`; +class OtherRevocationInfoFormat { + otherRevInfoFormat = ""; + otherRevInfo = new ArrayBuffer(0); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.ObjectIdentifier }) +], OtherRevocationInfoFormat.prototype, "otherRevInfoFormat", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Any }) +], OtherRevocationInfoFormat.prototype, "otherRevInfo", void 0); +let RevocationInfoChoice = class RevocationInfoChoice { + other = new OtherRevocationInfoFormat(); + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: OtherRevocationInfoFormat, context: 1, implicit: true, + }) +], RevocationInfoChoice.prototype, "other", void 0); +RevocationInfoChoice = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], RevocationInfoChoice); + +let RevocationInfoChoices = RevocationInfoChoices_1 = class RevocationInfoChoices extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, RevocationInfoChoices_1.prototype); + } +}; +RevocationInfoChoices = RevocationInfoChoices_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Set, itemType: RevocationInfoChoice, + }) +], RevocationInfoChoices); + + + +/***/ }), + +/***/ 61771: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/bags/types.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ id_CRLBag: () => (/* binding */ id_CRLBag), +/* harmony export */ id_SafeContents: () => (/* binding */ id_SafeContents), +/* harmony export */ id_SecretBag: () => (/* binding */ id_SecretBag), +/* harmony export */ id_certBag: () => (/* binding */ id_certBag), +/* harmony export */ id_keyBag: () => (/* binding */ id_keyBag), +/* harmony export */ id_pkcs8ShroudedKeyBag: () => (/* binding */ id_pkcs8ShroudedKeyBag), +/* harmony export */ id_pkcs_9: () => (/* binding */ id_pkcs_9) +/* harmony export */ }); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../object_identifiers.js */ 86610); + +const id_keyBag = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.1`; +const id_pkcs8ShroudedKeyBag = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.2`; +const id_certBag = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.3`; +const id_CRLBag = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.4`; +const id_SecretBag = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.5`; +const id_SafeContents = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_0__.id_bagtypes}.6`; +const id_pkcs_9 = "1.2.840.113549.1.9"; + + +/***/ }), + +/***/ 61782: +/*!****************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/utils/blob/toBlobSidecars.js ***! + \****************************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ toBlobSidecars: () => (/* binding */ toBlobSidecars) +/* harmony export */ }); +/* harmony import */ var _blobsToCommitments_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./blobsToCommitments.js */ 50469); +/* harmony import */ var _blobsToProofs_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./blobsToProofs.js */ 90036); +/* harmony import */ var _toBlobs_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./toBlobs.js */ 37177); + + + +/** + * Transforms arbitrary data (or blobs, commitments, & proofs) into a sidecar array. + * + * @example + * ```ts + * import { toBlobSidecars, stringToHex } from 'viem' + * + * const sidecars = toBlobSidecars({ data: stringToHex('hello world') }) + * ``` + * + * @example + * ```ts + * import { + * blobsToCommitments, + * toBlobs, + * blobsToProofs, + * toBlobSidecars, + * stringToHex + * } from 'viem' + * + * const blobs = toBlobs({ data: stringToHex('hello world') }) + * const commitments = blobsToCommitments({ blobs, kzg }) + * const proofs = blobsToProofs({ blobs, commitments, kzg }) + * + * const sidecars = toBlobSidecars({ blobs, commitments, proofs }) + * ``` + */ +function toBlobSidecars(parameters) { + const { data, kzg, to } = parameters; + const blobs = parameters.blobs ?? (0,_toBlobs_js__WEBPACK_IMPORTED_MODULE_2__.toBlobs)({ data: data, to }); + const commitments = parameters.commitments ?? (0,_blobsToCommitments_js__WEBPACK_IMPORTED_MODULE_0__.blobsToCommitments)({ blobs, kzg: kzg, to }); + const proofs = parameters.proofs ?? (0,_blobsToProofs_js__WEBPACK_IMPORTED_MODULE_1__.blobsToProofs)({ blobs, commitments, kzg: kzg, to }); + const sidecars = []; + for (let i = 0; i < blobs.length; i++) + sidecars.push({ + blob: blobs[i], + commitment: commitments[i], + proof: proofs[i], + }); + return sidecars; +} +//# sourceMappingURL=toBlobSidecars.js.map + +/***/ }), + +/***/ 61791: +/*!*************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+encoding@0.6.0/node_modules/@turnkey/encoding/dist/hex.mjs ***! + \*************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ hexToAscii: () => (/* binding */ hexToAscii), +/* harmony export */ normalizePadding: () => (/* binding */ normalizePadding), +/* harmony export */ uint8ArrayFromHexString: () => (/* binding */ uint8ArrayFromHexString), +/* harmony export */ uint8ArrayToHexString: () => (/* binding */ uint8ArrayToHexString) +/* harmony export */ }); +/** + * Converts a Uint8Array into a lowercase hex string. + * + * @param {Uint8Array} input - The input byte array. + * @returns {string} - The resulting hex string. + */ +function uint8ArrayToHexString(input) { + return input.reduce((result, x) => result + x.toString(16).padStart(2, "0"), ""); +} +/** + * Creates a Uint8Array from a hex string. + * + * @param {string} hexString - The input hex string. + * @param {number} [length] - Optional target length for the output. If specified, + * the result will be padded with leading 0s or throw if it overflows. + * @returns {Uint8Array} - The resulting byte array. + * @throws {Error} - If the hex string is invalid or too long for the specified length. + */ +const uint8ArrayFromHexString = (hexString, length) => { + const hexRegex = /^[0-9A-Fa-f]+$/; + if (!hexString || hexString.length % 2 != 0 || !hexRegex.test(hexString)) { + throw new Error(`cannot create uint8array from invalid hex string: "${hexString}"`); + } + const buffer = new Uint8Array(hexString.match(/../g).map((h) => parseInt(h, 16))); + if (!length) { + return buffer; + } + if (hexString.length / 2 > length) { + throw new Error("hex value cannot fit in a buffer of " + length + " byte(s)"); + } + // If a length is specified, ensure we sufficiently pad + let paddedBuffer = new Uint8Array(length); + paddedBuffer.set(buffer, length - buffer.length); + return paddedBuffer; +}; +/** + * Converts a hex string to an ASCII string. + * @param {string} hexString - The input hex string to convert. + * @returns {string} - The converted ASCII string. + */ +function hexToAscii(hexString) { + let asciiStr = ""; + for (let i = 0; i < hexString.length; i += 2) { + asciiStr += String.fromCharCode(parseInt(hexString.substr(i, 2), 16)); + } + return asciiStr; +} +/** + * Function to normalize padding of byte array with 0's to a target length. + * + * @param {Uint8Array} byteArray - The byte array to pad or trim. + * @param {number} targetLength - The target length after padding or trimming. + * @returns {Uint8Array} - The normalized byte array. + */ +const normalizePadding = (byteArray, targetLength) => { + const paddingLength = targetLength - byteArray.length; + // Add leading 0's to array + if (paddingLength > 0) { + const padding = new Uint8Array(paddingLength).fill(0); + return new Uint8Array([...padding, ...byteArray]); + } + // Remove leading 0's from array + if (paddingLength < 0) { + const expectedZeroCount = paddingLength * -1; + let zeroCount = 0; + for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) { + if (byteArray[i] === 0) { + zeroCount++; + } + } + // Check if the number of zeros found equals the number of zeroes expected + if (zeroCount !== expectedZeroCount) { + throw new Error(`invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`); + } + return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength); + } + return byteArray; +}; + + +//# sourceMappingURL=hex.mjs.map + + +/***/ }), + +/***/ 61827: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+curves@1.9.0/node_modules/@noble/curves/esm/abstract/edwards.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ twistedEdwards: () => (/* binding */ twistedEdwards) +/* harmony export */ }); +/* harmony import */ var _curve_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./curve.js */ 29072); +/* harmony import */ var _modular_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modular.js */ 51733); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils.js */ 96926); +/** + * Twisted Edwards curve. The formula is: ax² + y² = 1 + dx²y². + * For design rationale of types / exports, see weierstrass module documentation. + * @module + */ +/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */ +// prettier-ignore + + +// prettier-ignore + +// Be friendly to bad ECMAScript parsers by not using bigint literals +// prettier-ignore +const _0n = BigInt(0), _1n = BigInt(1), _2n = BigInt(2), _8n = BigInt(8); +// verification rule is either zip215 or rfc8032 / nist186-5. Consult fromHex: +const VERIFY_DEFAULT = { zip215: true }; +function validateOpts(curve) { + const opts = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.validateBasic)(curve); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.validateObject)(curve, { + hash: 'function', + a: 'bigint', + d: 'bigint', + randomBytes: 'function', + }, { + adjustScalarBytes: 'function', + domain: 'function', + uvRatio: 'function', + mapToCurve: 'function', + }); + // Set defaults + return Object.freeze({ ...opts }); +} +/** + * Creates Twisted Edwards curve with EdDSA signatures. + * @example + * import { Field } from '@noble/curves/abstract/modular'; + * // Before that, define BigInt-s: a, d, p, n, Gx, Gy, h + * const curve = twistedEdwards({ a, d, Fp: Field(p), n, Gx, Gy, h }) + */ +function twistedEdwards(curveDef) { + const CURVE = validateOpts(curveDef); + const { Fp, n: CURVE_ORDER, prehash: prehash, hash: cHash, randomBytes, nByteLength, h: cofactor, } = CURVE; + // Important: + // There are some places where Fp.BYTES is used instead of nByteLength. + // So far, everything has been tested with curves of Fp.BYTES == nByteLength. + // TODO: test and find curves which behave otherwise. + const MASK = _2n << (BigInt(nByteLength * 8) - _1n); + const modP = Fp.create; // Function overrides + const Fn = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.Field)(CURVE.n, CURVE.nBitLength); + // sqrt(u/v) + const uvRatio = CURVE.uvRatio || + ((u, v) => { + try { + return { isValid: true, value: Fp.sqrt(u * Fp.inv(v)) }; + } + catch (e) { + return { isValid: false, value: _0n }; + } + }); + const adjustScalarBytes = CURVE.adjustScalarBytes || ((bytes) => bytes); // NOOP + const domain = CURVE.domain || + ((data, ctx, phflag) => { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('phflag', phflag); + if (ctx.length || phflag) + throw new Error('Contexts/pre-hash are not supported'); + return data; + }); // NOOP + // 0 <= n < MASK + // Coordinates larger than Fp.ORDER are allowed for zip215 + function aCoordinate(title, n, banZero = false) { + const min = banZero ? _1n : _0n; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('coordinate ' + title, n, min, MASK); + } + function aextpoint(other) { + if (!(other instanceof Point)) + throw new Error('ExtendedPoint expected'); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + const toAffineMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p, iz) => { + const { ex: x, ey: y, ez: z } = p; + const is0 = p.is0(); + if (iz == null) + iz = is0 ? _8n : Fp.inv(z); // 8 was chosen arbitrarily + const ax = modP(x * iz); + const ay = modP(y * iz); + const zz = modP(z * iz); + if (is0) + return { x: _0n, y: _1n }; + if (zz !== _1n) + throw new Error('invZ was invalid'); + return { x: ax, y: ay }; + }); + const assertValidMemo = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.memoized)((p) => { + const { a, d } = CURVE; + if (p.is0()) + throw new Error('bad point: ZERO'); // TODO: optimize, with vars below? + // Equation in affine coordinates: ax² + y² = 1 + dx²y² + // Equation in projective coordinates (X/Z, Y/Z, Z): (aX² + Y²)Z² = Z⁴ + dX²Y² + const { ex: X, ey: Y, ez: Z, et: T } = p; + const X2 = modP(X * X); // X² + const Y2 = modP(Y * Y); // Y² + const Z2 = modP(Z * Z); // Z² + const Z4 = modP(Z2 * Z2); // Z⁴ + const aX2 = modP(X2 * a); // aX² + const left = modP(Z2 * modP(aX2 + Y2)); // (aX² + Y²)Z² + const right = modP(Z4 + modP(d * modP(X2 * Y2))); // Z⁴ + dX²Y² + if (left !== right) + throw new Error('bad point: equation left != right (1)'); + // In Extended coordinates we also have T, which is x*y=T/Z: check X*Y == Z*T + const XY = modP(X * Y); + const ZT = modP(Z * T); + if (XY !== ZT) + throw new Error('bad point: equation left != right (2)'); + return true; + }); + // Extended Point works in extended coordinates: (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy). + // https://en.wikipedia.org/wiki/Twisted_Edwards_curve#Extended_coordinates + class Point { + constructor(ex, ey, ez, et) { + aCoordinate('x', ex); + aCoordinate('y', ey); + aCoordinate('z', ez, true); + aCoordinate('t', et); + this.ex = ex; + this.ey = ey; + this.ez = ez; + this.et = et; + Object.freeze(this); + } + get x() { + return this.toAffine().x; + } + get y() { + return this.toAffine().y; + } + static fromAffine(p) { + if (p instanceof Point) + throw new Error('extended point not allowed'); + const { x, y } = p || {}; + aCoordinate('x', x); + aCoordinate('y', y); + return new Point(x, y, _1n, modP(x * y)); + } + static normalizeZ(points) { + const toInv = (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.FpInvertBatch)(Fp, points.map((p) => p.ez)); + return points.map((p, i) => p.toAffine(toInv[i])).map(Point.fromAffine); + } + // Multiscalar Multiplication + static msm(points, scalars) { + return (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.pippenger)(Point, Fn, points, scalars); + } + // "Private method", don't use it directly + _setWindowSize(windowSize) { + wnaf.setWindowSize(this, windowSize); + } + // Not required for fromHex(), which always creates valid points. + // Could be useful for fromAffine(). + assertValidity() { + assertValidMemo(this); + } + // Compare one point to another. + equals(other) { + aextpoint(other); + const { ex: X1, ey: Y1, ez: Z1 } = this; + const { ex: X2, ey: Y2, ez: Z2 } = other; + const X1Z2 = modP(X1 * Z2); + const X2Z1 = modP(X2 * Z1); + const Y1Z2 = modP(Y1 * Z2); + const Y2Z1 = modP(Y2 * Z1); + return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; + } + is0() { + return this.equals(Point.ZERO); + } + negate() { + // Flips point sign to a negative one (-x, y in affine coords) + return new Point(modP(-this.ex), this.ey, this.ez, modP(-this.et)); + } + // Fast algo for doubling Extended Point. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd + // Cost: 4M + 4S + 1*a + 6add + 1*2. + double() { + const { a } = CURVE; + const { ex: X1, ey: Y1, ez: Z1 } = this; + const A = modP(X1 * X1); // A = X12 + const B = modP(Y1 * Y1); // B = Y12 + const C = modP(_2n * modP(Z1 * Z1)); // C = 2*Z12 + const D = modP(a * A); // D = a*A + const x1y1 = X1 + Y1; + const E = modP(modP(x1y1 * x1y1) - A - B); // E = (X1+Y1)2-A-B + const G = D + B; // G = D+B + const F = G - C; // F = G-C + const H = D - B; // H = D-B + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + // Fast algo for adding 2 Extended Points. + // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#addition-add-2008-hwcd + // Cost: 9M + 1*a + 1*d + 7add. + add(other) { + aextpoint(other); + const { a, d } = CURVE; + const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; + const { ex: X2, ey: Y2, ez: Z2, et: T2 } = other; + const A = modP(X1 * X2); // A = X1*X2 + const B = modP(Y1 * Y2); // B = Y1*Y2 + const C = modP(T1 * d * T2); // C = T1*d*T2 + const D = modP(Z1 * Z2); // D = Z1*Z2 + const E = modP((X1 + Y1) * (X2 + Y2) - A - B); // E = (X1+Y1)*(X2+Y2)-A-B + const F = D - C; // F = D-C + const G = D + C; // G = D+C + const H = modP(B - a * A); // H = B-a*A + const X3 = modP(E * F); // X3 = E*F + const Y3 = modP(G * H); // Y3 = G*H + const T3 = modP(E * H); // T3 = E*H + const Z3 = modP(F * G); // Z3 = F*G + return new Point(X3, Y3, Z3, T3); + } + subtract(other) { + return this.add(other.negate()); + } + wNAF(n) { + return wnaf.wNAFCached(this, n, Point.normalizeZ); + } + // Constant-time multiplication. + multiply(scalar) { + const n = scalar; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', n, _1n, CURVE_ORDER); // 1 <= scalar < L + const { p, f } = this.wNAF(n); + return Point.normalizeZ([p, f])[0]; + } + // Non-constant-time multiplication. Uses double-and-add algorithm. + // It's faster, but should only be used when you don't care about + // an exposed private key e.g. sig verification. + // Does NOT allow scalars higher than CURVE.n. + // Accepts optional accumulator to merge with multiply (important for sparse scalars) + multiplyUnsafe(scalar, acc = Point.ZERO) { + const n = scalar; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('scalar', n, _0n, CURVE_ORDER); // 0 <= scalar < L + if (n === _0n) + return I; + if (this.is0() || n === _1n) + return this; + return wnaf.wNAFCachedUnsafe(this, n, Point.normalizeZ, acc); + } + // Checks if point is of small order. + // If you add something to small order point, you will have "dirty" + // point with torsion component. + // Multiplies point by cofactor and checks if the result is 0. + isSmallOrder() { + return this.multiplyUnsafe(cofactor).is0(); + } + // Multiplies point by curve order and checks if the result is 0. + // Returns `false` is the point is dirty. + isTorsionFree() { + return wnaf.unsafeLadder(this, CURVE_ORDER).is0(); + } + // Converts Extended point to default (x, y) coordinates. + // Can accept precomputed Z^-1 - for example, from invertBatch. + toAffine(iz) { + return toAffineMemo(this, iz); + } + clearCofactor() { + const { h: cofactor } = CURVE; + if (cofactor === _1n) + return this; + return this.multiplyUnsafe(cofactor); + } + // Converts hash string or Uint8Array to Point. + // Uses algo from RFC8032 5.1.3. + static fromHex(hex, zip215 = false) { + const { d, a } = CURVE; + const len = Fp.BYTES; + hex = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('pointHex', hex, len); // copy hex to a new array + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('zip215', zip215); + const normed = hex.slice(); // copy again, we'll manipulate it + const lastByte = hex[len - 1]; // select last byte + normed[len - 1] = lastByte & ~0x80; // clear last bit + const y = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberLE)(normed); + // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. + // RFC8032 prohibits >= p, but ZIP215 doesn't + // zip215=true: 0 <= y < MASK (2^256 for ed25519) + // zip215=false: 0 <= y < P (2^255-19 for ed25519) + const max = zip215 ? MASK : Fp.ORDER; + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('pointHex.y', y, _0n, max); + // Ed25519: x² = (y²-1)/(dy²+1) mod p. Ed448: x² = (y²-1)/(dy²-1) mod p. Generic case: + // ax²+y²=1+dx²y² => y²-1=dx²y²-ax² => y²-1=x²(dy²-a) => x²=(y²-1)/(dy²-a) + const y2 = modP(y * y); // denominator is always non-0 mod p. + const u = modP(y2 - _1n); // u = y² - 1 + const v = modP(d * y2 - a); // v = d y² + 1. + let { isValid, value: x } = uvRatio(u, v); // √(u/v) + if (!isValid) + throw new Error('Point.fromHex: invalid y coordinate'); + const isXOdd = (x & _1n) === _1n; // There are 2 square roots. Use x_0 bit to select proper + const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit + if (!zip215 && x === _0n && isLastByteOdd) + // if x=0 and x_0 = 1, fail + throw new Error('Point.fromHex: x=0 and x_0=1'); + if (isLastByteOdd !== isXOdd) + x = modP(-x); // if x_0 != x mod 2, set x = p-x + return Point.fromAffine({ x, y }); + } + static fromPrivateKey(privKey) { + const { scalar } = getPrivateScalar(privKey); + return G.multiply(scalar); // reduced one call of `toRawBytes` + } + toRawBytes() { + const { x, y } = this.toAffine(); + const bytes = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesLE)(y, Fp.BYTES); // each y has 2 x values (x, -y) + bytes[bytes.length - 1] |= x & _1n ? 0x80 : 0; // when compressing, it's enough to store y + return bytes; // and use the last byte to encode sign of x + } + toHex() { + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToHex)(this.toRawBytes()); // Same as toRawBytes, but returns string. + } + } + Point.BASE = new Point(CURVE.Gx, CURVE.Gy, _1n, modP(CURVE.Gx * CURVE.Gy)); + Point.ZERO = new Point(_0n, _1n, _1n, _0n); // 0, 1, 1, 0 + const { BASE: G, ZERO: I } = Point; + const wnaf = (0,_curve_js__WEBPACK_IMPORTED_MODULE_0__.wNAF)(Point, nByteLength * 8); + function modN(a) { + return (0,_modular_js__WEBPACK_IMPORTED_MODULE_1__.mod)(a, CURVE_ORDER); + } + // Little-endian SHA512 with modulo n + function modN_LE(hash) { + return modN((0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberLE)(hash)); + } + // Get the hashed private scalar per RFC8032 5.1.5 + function getPrivateScalar(key) { + const len = Fp.BYTES; + key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('private key', key, len); + // Hash private key with curve's hash function to produce uniformingly random input + // Check byte lengths: ensure(64, h(ensure(32, key))) + const hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('hashed private key', cHash(key), 2 * len); + const head = adjustScalarBytes(hashed.slice(0, len)); // clear first half bits, produce FE + const prefix = hashed.slice(len, 2 * len); // second half is called key prefix (5.1.6) + const scalar = modN_LE(head); // The actual private scalar + return { head, prefix, scalar }; + } + // Convenience method that creates public key from scalar. RFC8032 5.1.5 + function getExtendedPublicKey(key) { + const { head, prefix, scalar } = getPrivateScalar(key); + const point = G.multiply(scalar); // Point on Edwards curve aka public key + const pointBytes = point.toRawBytes(); // Uint8Array representation + return { head, prefix, scalar, point, pointBytes }; + } + // Calculates EdDSA pub key. RFC8032 5.1.5. Privkey is hashed. Use first half with 3 bits cleared + function getPublicKey(privKey) { + return getExtendedPublicKey(privKey).pointBytes; + } + // int('LE', SHA512(dom2(F, C) || msgs)) mod N + function hashDomainToScalar(context = Uint8Array.of(), ...msgs) { + const msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(...msgs); + return modN_LE(cHash(domain(msg, (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('context', context), !!prehash))); + } + /** Signs message with privateKey. RFC8032 5.1.6 */ + function sign(msg, privKey, options = {}) { + msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('message', msg); + if (prehash) + msg = prehash(msg); // for ed25519ph etc. + const { prefix, scalar, pointBytes } = getExtendedPublicKey(privKey); + const r = hashDomainToScalar(options.context, prefix, msg); // r = dom2(F, C) || prefix || PH(M) + const R = G.multiply(r).toRawBytes(); // R = rG + const k = hashDomainToScalar(options.context, R, pointBytes, msg); // R || A || PH(M) + const s = modN(r + k * scalar); // S = (r + k * s) mod L + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.aInRange)('signature.s', s, _0n, CURVE_ORDER); // 0 <= s < l + const res = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.concatBytes)(R, (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.numberToBytesLE)(s, Fp.BYTES)); + return (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('result', res, Fp.BYTES * 2); // 64-byte signature + } + const verifyOpts = VERIFY_DEFAULT; + /** + * Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + * An extended group equation is checked. + */ + function verify(sig, msg, publicKey, options = verifyOpts) { + const { context, zip215 } = options; + const len = Fp.BYTES; // Verifies EdDSA signature against message and public key. RFC8032 5.1.7. + sig = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('signature', sig, 2 * len); // An extended group equation is checked. + msg = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('message', msg); + publicKey = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.ensureBytes)('publicKey', publicKey, len); + if (zip215 !== undefined) + (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.abool)('zip215', zip215); + if (prehash) + msg = prehash(msg); // for ed25519ph, etc + const s = (0,_utils_js__WEBPACK_IMPORTED_MODULE_2__.bytesToNumberLE)(sig.slice(len, 2 * len)); + let A, R, SB; + try { + // zip215=true is good for consensus-critical apps. =false follows RFC8032 / NIST186-5. + // zip215=true: 0 <= y < MASK (2^256 for ed25519) + // zip215=false: 0 <= y < P (2^255-19 for ed25519) + A = Point.fromHex(publicKey, zip215); + R = Point.fromHex(sig.slice(0, len), zip215); + SB = G.multiplyUnsafe(s); // 0 <= s < l is done inside + } + catch (error) { + return false; + } + if (!zip215 && A.isSmallOrder()) + return false; + const k = hashDomainToScalar(context, R.toRawBytes(), A.toRawBytes(), msg); + const RkA = R.add(A.multiplyUnsafe(k)); + // Extended group equation + // [8][S]B = [8]R + [8][k]A' + return RkA.subtract(SB).clearCofactor().equals(Point.ZERO); + } + G._setWindowSize(8); // Enable precomputes. Slows down first publicKey computation by 20ms. + const utils = { + getExtendedPublicKey, + /** ed25519 priv keys are uniform 32b. No need to check for modulo bias, like in secp256k1. */ + randomPrivateKey: () => randomBytes(Fp.BYTES), + /** + * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT + * values. This slows down first getPublicKey() by milliseconds (see Speed section), + * but allows to speed-up subsequent getPublicKey() calls up to 20x. + * @param windowSize 2, 4, 8, 16 + */ + precompute(windowSize = 8, point = Point.BASE) { + point._setWindowSize(windowSize); + point.multiply(BigInt(3)); + return point; + }, + }; + return { + CURVE, + getPublicKey, + sign, + verify, + ExtendedPoint: Point, + utils, + }; +} +//# sourceMappingURL=edwards.js.map + +/***/ }), + +/***/ 62266: +/*!***********************************************************************!*\ + !*** ../node_modules/.pnpm/buffer@6.0.3/node_modules/buffer/index.js ***! + \***********************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/*! + * The buffer module from node.js, for the browser. + * + * @author Feross Aboukhadijeh + * @license MIT + */ +/* eslint-disable no-proto */ + + + +const base64 = __webpack_require__(/*! base64-js */ 27762) +const ieee754 = __webpack_require__(/*! ieee754 */ 36287) +const customInspectSymbol = + (typeof Symbol === 'function' && typeof Symbol['for'] === 'function') // eslint-disable-line dot-notation + ? Symbol['for']('nodejs.util.inspect.custom') // eslint-disable-line dot-notation + : null + +exports.Buffer = Buffer +exports.SlowBuffer = SlowBuffer +exports.INSPECT_MAX_BYTES = 50 + +const K_MAX_LENGTH = 0x7fffffff +exports.kMaxLength = K_MAX_LENGTH + +/** + * If `Buffer.TYPED_ARRAY_SUPPORT`: + * === true Use Uint8Array implementation (fastest) + * === false Print warning and recommend using `buffer` v4.x which has an Object + * implementation (most compatible, even IE6) + * + * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+, + * Opera 11.6+, iOS 4.2+. + * + * We report that the browser does not support typed arrays if the are not subclassable + * using __proto__. Firefox 4-29 lacks support for adding new properties to `Uint8Array` + * (See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438). IE 10 lacks support + * for __proto__ and has a buggy typed array implementation. + */ +Buffer.TYPED_ARRAY_SUPPORT = typedArraySupport() + +if (!Buffer.TYPED_ARRAY_SUPPORT && typeof console !== 'undefined' && + typeof console.error === 'function') { + console.error( + 'This browser lacks typed array (Uint8Array) support which is required by ' + + '`buffer` v5.x. Use `buffer` v4.x if you require old browser support.' + ) +} + +function typedArraySupport () { + // Can typed array instances can be augmented? + try { + const arr = new Uint8Array(1) + const proto = { foo: function () { return 42 } } + Object.setPrototypeOf(proto, Uint8Array.prototype) + Object.setPrototypeOf(arr, proto) + return arr.foo() === 42 + } catch (e) { + return false + } +} + +Object.defineProperty(Buffer.prototype, 'parent', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.buffer + } +}) + +Object.defineProperty(Buffer.prototype, 'offset', { + enumerable: true, + get: function () { + if (!Buffer.isBuffer(this)) return undefined + return this.byteOffset + } +}) + +function createBuffer (length) { + if (length > K_MAX_LENGTH) { + throw new RangeError('The value "' + length + '" is invalid for option "size"') + } + // Return an augmented `Uint8Array` instance + const buf = new Uint8Array(length) + Object.setPrototypeOf(buf, Buffer.prototype) + return buf +} + +/** + * The Buffer constructor returns instances of `Uint8Array` that have their + * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of + * `Uint8Array`, so the returned instances will have all the node `Buffer` methods + * and the `Uint8Array` methods. Square bracket notation works as expected -- it + * returns a single octet. + * + * The `Uint8Array` prototype remains unmodified. + */ + +function Buffer (arg, encodingOrOffset, length) { + // Common case. + if (typeof arg === 'number') { + if (typeof encodingOrOffset === 'string') { + throw new TypeError( + 'The "string" argument must be of type string. Received type number' + ) + } + return allocUnsafe(arg) + } + return from(arg, encodingOrOffset, length) +} + +Buffer.poolSize = 8192 // not used by this implementation + +function from (value, encodingOrOffset, length) { + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + if (ArrayBuffer.isView(value)) { + return fromArrayView(value) + } + + if (value == null) { + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) + } + + if (isInstance(value, ArrayBuffer) || + (value && isInstance(value.buffer, ArrayBuffer))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof SharedArrayBuffer !== 'undefined' && + (isInstance(value, SharedArrayBuffer) || + (value && isInstance(value.buffer, SharedArrayBuffer)))) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'number') { + throw new TypeError( + 'The "value" argument must not be of type number. Received type number' + ) + } + + const valueOf = value.valueOf && value.valueOf() + if (valueOf != null && valueOf !== value) { + return Buffer.from(valueOf, encodingOrOffset, length) + } + + const b = fromObject(value) + if (b) return b + + if (typeof Symbol !== 'undefined' && Symbol.toPrimitive != null && + typeof value[Symbol.toPrimitive] === 'function') { + return Buffer.from(value[Symbol.toPrimitive]('string'), encodingOrOffset, length) + } + + throw new TypeError( + 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, ' + + 'or Array-like Object. Received type ' + (typeof value) + ) +} + +/** + * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError + * if value is a number. + * Buffer.from(str[, encoding]) + * Buffer.from(array) + * Buffer.from(buffer) + * Buffer.from(arrayBuffer[, byteOffset[, length]]) + **/ +Buffer.from = function (value, encodingOrOffset, length) { + return from(value, encodingOrOffset, length) +} + +// Note: Change prototype *after* Buffer.from is defined to workaround Chrome bug: +// https://github.com/feross/buffer/pull/148 +Object.setPrototypeOf(Buffer.prototype, Uint8Array.prototype) +Object.setPrototypeOf(Buffer, Uint8Array) + +function assertSize (size) { + if (typeof size !== 'number') { + throw new TypeError('"size" argument must be of type number') + } else if (size < 0) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } +} + +function alloc (size, fill, encoding) { + assertSize(size) + if (size <= 0) { + return createBuffer(size) + } + if (fill !== undefined) { + // Only pay attention to encoding if it's a string. This + // prevents accidentally sending in a number that would + // be interpreted as a start offset. + return typeof encoding === 'string' + ? createBuffer(size).fill(fill, encoding) + : createBuffer(size).fill(fill) + } + return createBuffer(size) +} + +/** + * Creates a new filled Buffer instance. + * alloc(size[, fill[, encoding]]) + **/ +Buffer.alloc = function (size, fill, encoding) { + return alloc(size, fill, encoding) +} + +function allocUnsafe (size) { + assertSize(size) + return createBuffer(size < 0 ? 0 : checked(size) | 0) +} + +/** + * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance. + * */ +Buffer.allocUnsafe = function (size) { + return allocUnsafe(size) +} +/** + * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance. + */ +Buffer.allocUnsafeSlow = function (size) { + return allocUnsafe(size) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + + const length = byteLength(string, encoding) | 0 + let buf = createBuffer(length) + + const actual = buf.write(string, encoding) + + if (actual !== length) { + // Writing a hex string, for example, that contains invalid characters will + // cause everything after the first invalid character to be ignored. (e.g. + // 'abxxcd' will be treated as 'ab') + buf = buf.slice(0, actual) + } + + return buf +} + +function fromArrayLike (array) { + const length = array.length < 0 ? 0 : checked(array.length) | 0 + const buf = createBuffer(length) + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255 + } + return buf +} + +function fromArrayView (arrayView) { + if (isInstance(arrayView, Uint8Array)) { + const copy = new Uint8Array(arrayView) + return fromArrayBuffer(copy.buffer, copy.byteOffset, copy.byteLength) + } + return fromArrayLike(arrayView) +} + +function fromArrayBuffer (array, byteOffset, length) { + if (byteOffset < 0 || array.byteLength < byteOffset) { + throw new RangeError('"offset" is outside of buffer bounds') + } + + if (array.byteLength < byteOffset + (length || 0)) { + throw new RangeError('"length" is outside of buffer bounds') + } + + let buf + if (byteOffset === undefined && length === undefined) { + buf = new Uint8Array(array) + } else if (length === undefined) { + buf = new Uint8Array(array, byteOffset) + } else { + buf = new Uint8Array(array, byteOffset, length) + } + + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(buf, Buffer.prototype) + + return buf +} + +function fromObject (obj) { + if (Buffer.isBuffer(obj)) { + const len = checked(obj.length) | 0 + const buf = createBuffer(len) + + if (buf.length === 0) { + return buf + } + + obj.copy(buf, 0, 0, len) + return buf + } + + if (obj.length !== undefined) { + if (typeof obj.length !== 'number' || numberIsNaN(obj.length)) { + return createBuffer(0) + } + return fromArrayLike(obj) + } + + if (obj.type === 'Buffer' && Array.isArray(obj.data)) { + return fromArrayLike(obj.data) + } +} + +function checked (length) { + // Note: cannot use `length < K_MAX_LENGTH` here because that fails when + // length is NaN (which is otherwise coerced to zero.) + if (length >= K_MAX_LENGTH) { + throw new RangeError('Attempt to allocate Buffer larger than maximum ' + + 'size: 0x' + K_MAX_LENGTH.toString(16) + ' bytes') + } + return length | 0 +} + +function SlowBuffer (length) { + if (+length != length) { // eslint-disable-line eqeqeq + length = 0 + } + return Buffer.alloc(+length) +} + +Buffer.isBuffer = function isBuffer (b) { + return b != null && b._isBuffer === true && + b !== Buffer.prototype // so Buffer.isBuffer(Buffer.prototype) will be false +} + +Buffer.compare = function compare (a, b) { + if (isInstance(a, Uint8Array)) a = Buffer.from(a, a.offset, a.byteLength) + if (isInstance(b, Uint8Array)) b = Buffer.from(b, b.offset, b.byteLength) + if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) { + throw new TypeError( + 'The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array' + ) + } + + if (a === b) return 0 + + let x = a.length + let y = b.length + + for (let i = 0, len = Math.min(x, y); i < len; ++i) { + if (a[i] !== b[i]) { + x = a[i] + y = b[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +Buffer.isEncoding = function isEncoding (encoding) { + switch (String(encoding).toLowerCase()) { + case 'hex': + case 'utf8': + case 'utf-8': + case 'ascii': + case 'latin1': + case 'binary': + case 'base64': + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return true + default: + return false + } +} + +Buffer.concat = function concat (list, length) { + if (!Array.isArray(list)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } + + if (list.length === 0) { + return Buffer.alloc(0) + } + + let i + if (length === undefined) { + length = 0 + for (i = 0; i < list.length; ++i) { + length += list[i].length + } + } + + const buffer = Buffer.allocUnsafe(length) + let pos = 0 + for (i = 0; i < list.length; ++i) { + let buf = list[i] + if (isInstance(buf, Uint8Array)) { + if (pos + buf.length > buffer.length) { + if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf) + buf.copy(buffer, pos) + } else { + Uint8Array.prototype.set.call( + buffer, + buf, + pos + ) + } + } else if (!Buffer.isBuffer(buf)) { + throw new TypeError('"list" argument must be an Array of Buffers') + } else { + buf.copy(buffer, pos) + } + pos += buf.length + } + return buffer +} + +function byteLength (string, encoding) { + if (Buffer.isBuffer(string)) { + return string.length + } + if (ArrayBuffer.isView(string) || isInstance(string, ArrayBuffer)) { + return string.byteLength + } + if (typeof string !== 'string') { + throw new TypeError( + 'The "string" argument must be one of type string, Buffer, or ArrayBuffer. ' + + 'Received type ' + typeof string + ) + } + + const len = string.length + const mustMatch = (arguments.length > 2 && arguments[2] === true) + if (!mustMatch && len === 0) return 0 + + // Use a for loop to avoid recursion + let loweredCase = false + for (;;) { + switch (encoding) { + case 'ascii': + case 'latin1': + case 'binary': + return len + case 'utf8': + case 'utf-8': + return utf8ToBytes(string).length + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return len * 2 + case 'hex': + return len >>> 1 + case 'base64': + return base64ToBytes(string).length + default: + if (loweredCase) { + return mustMatch ? -1 : utf8ToBytes(string).length // assume utf8 + } + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} +Buffer.byteLength = byteLength + +function slowToString (encoding, start, end) { + let loweredCase = false + + // No need to verify that "this.length <= MAX_UINT32" since it's a read-only + // property of a typed array. + + // This behaves neither like String nor Uint8Array in that we set start/end + // to their upper/lower bounds if the value passed is out of range. + // undefined is handled specially as per ECMA-262 6th Edition, + // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization. + if (start === undefined || start < 0) { + start = 0 + } + // Return early if start > this.length. Done here to prevent potential uint32 + // coercion fail below. + if (start > this.length) { + return '' + } + + if (end === undefined || end > this.length) { + end = this.length + } + + if (end <= 0) { + return '' + } + + // Force coercion to uint32. This will also coerce falsey/NaN values to 0. + end >>>= 0 + start >>>= 0 + + if (end <= start) { + return '' + } + + if (!encoding) encoding = 'utf8' + + while (true) { + switch (encoding) { + case 'hex': + return hexSlice(this, start, end) + + case 'utf8': + case 'utf-8': + return utf8Slice(this, start, end) + + case 'ascii': + return asciiSlice(this, start, end) + + case 'latin1': + case 'binary': + return latin1Slice(this, start, end) + + case 'base64': + return base64Slice(this, start, end) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return utf16leSlice(this, start, end) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = (encoding + '').toLowerCase() + loweredCase = true + } + } +} + +// This property is used by `Buffer.isBuffer` (and the `is-buffer` npm package) +// to detect a Buffer instance. It's not possible to use `instanceof Buffer` +// reliably in a browserify context because there could be multiple different +// copies of the 'buffer' package in use. This method works even for Buffer +// instances that were created from another copy of the `buffer` package. +// See: https://github.com/feross/buffer/issues/154 +Buffer.prototype._isBuffer = true + +function swap (b, n, m) { + const i = b[n] + b[n] = b[m] + b[m] = i +} + +Buffer.prototype.swap16 = function swap16 () { + const len = this.length + if (len % 2 !== 0) { + throw new RangeError('Buffer size must be a multiple of 16-bits') + } + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1) + } + return this +} + +Buffer.prototype.swap32 = function swap32 () { + const len = this.length + if (len % 4 !== 0) { + throw new RangeError('Buffer size must be a multiple of 32-bits') + } + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3) + swap(this, i + 1, i + 2) + } + return this +} + +Buffer.prototype.swap64 = function swap64 () { + const len = this.length + if (len % 8 !== 0) { + throw new RangeError('Buffer size must be a multiple of 64-bits') + } + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7) + swap(this, i + 1, i + 6) + swap(this, i + 2, i + 5) + swap(this, i + 3, i + 4) + } + return this +} + +Buffer.prototype.toString = function toString () { + const length = this.length + if (length === 0) return '' + if (arguments.length === 0) return utf8Slice(this, 0, length) + return slowToString.apply(this, arguments) +} + +Buffer.prototype.toLocaleString = Buffer.prototype.toString + +Buffer.prototype.equals = function equals (b) { + if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer') + if (this === b) return true + return Buffer.compare(this, b) === 0 +} + +Buffer.prototype.inspect = function inspect () { + let str = '' + const max = exports.INSPECT_MAX_BYTES + str = this.toString('hex', 0, max).replace(/(.{2})/g, '$1 ').trim() + if (this.length > max) str += ' ... ' + return '' +} +if (customInspectSymbol) { + Buffer.prototype[customInspectSymbol] = Buffer.prototype.inspect +} + +Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) { + if (isInstance(target, Uint8Array)) { + target = Buffer.from(target, target.offset, target.byteLength) + } + if (!Buffer.isBuffer(target)) { + throw new TypeError( + 'The "target" argument must be one of type Buffer or Uint8Array. ' + + 'Received type ' + (typeof target) + ) + } + + if (start === undefined) { + start = 0 + } + if (end === undefined) { + end = target ? target.length : 0 + } + if (thisStart === undefined) { + thisStart = 0 + } + if (thisEnd === undefined) { + thisEnd = this.length + } + + if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) { + throw new RangeError('out of range index') + } + + if (thisStart >= thisEnd && start >= end) { + return 0 + } + if (thisStart >= thisEnd) { + return -1 + } + if (start >= end) { + return 1 + } + + start >>>= 0 + end >>>= 0 + thisStart >>>= 0 + thisEnd >>>= 0 + + if (this === target) return 0 + + let x = thisEnd - thisStart + let y = end - start + const len = Math.min(x, y) + + const thisCopy = this.slice(thisStart, thisEnd) + const targetCopy = target.slice(start, end) + + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i] + y = targetCopy[i] + break + } + } + + if (x < y) return -1 + if (y < x) return 1 + return 0 +} + +// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, +// OR the last index of `val` in `buffer` at offset <= `byteOffset`. +// +// Arguments: +// - buffer - a Buffer to search +// - val - a string, Buffer, or number +// - byteOffset - an index into `buffer`; will be clamped to an int32 +// - encoding - an optional encoding, relevant is val is a string +// - dir - true for indexOf, false for lastIndexOf +function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { + // Empty buffer means no match + if (buffer.length === 0) return -1 + + // Normalize byteOffset + if (typeof byteOffset === 'string') { + encoding = byteOffset + byteOffset = 0 + } else if (byteOffset > 0x7fffffff) { + byteOffset = 0x7fffffff + } else if (byteOffset < -0x80000000) { + byteOffset = -0x80000000 + } + byteOffset = +byteOffset // Coerce to Number. + if (numberIsNaN(byteOffset)) { + // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer + byteOffset = dir ? 0 : (buffer.length - 1) + } + + // Normalize byteOffset: negative offsets start from the end of the buffer + if (byteOffset < 0) byteOffset = buffer.length + byteOffset + if (byteOffset >= buffer.length) { + if (dir) return -1 + else byteOffset = buffer.length - 1 + } else if (byteOffset < 0) { + if (dir) byteOffset = 0 + else return -1 + } + + // Normalize val + if (typeof val === 'string') { + val = Buffer.from(val, encoding) + } + + // Finally, search either indexOf (if dir is true) or lastIndexOf + if (Buffer.isBuffer(val)) { + // Special case: looking for empty string/buffer always fails + if (val.length === 0) { + return -1 + } + return arrayIndexOf(buffer, val, byteOffset, encoding, dir) + } else if (typeof val === 'number') { + val = val & 0xFF // Search for a byte value [0-255] + if (typeof Uint8Array.prototype.indexOf === 'function') { + if (dir) { + return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset) + } else { + return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset) + } + } + return arrayIndexOf(buffer, [val], byteOffset, encoding, dir) + } + + throw new TypeError('val must be string, number or Buffer') +} + +function arrayIndexOf (arr, val, byteOffset, encoding, dir) { + let indexSize = 1 + let arrLength = arr.length + let valLength = val.length + + if (encoding !== undefined) { + encoding = String(encoding).toLowerCase() + if (encoding === 'ucs2' || encoding === 'ucs-2' || + encoding === 'utf16le' || encoding === 'utf-16le') { + if (arr.length < 2 || val.length < 2) { + return -1 + } + indexSize = 2 + arrLength /= 2 + valLength /= 2 + byteOffset /= 2 + } + } + + function read (buf, i) { + if (indexSize === 1) { + return buf[i] + } else { + return buf.readUInt16BE(i * indexSize) + } + } + + let i + if (dir) { + let foundIndex = -1 + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { + if (foundIndex === -1) foundIndex = i + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize + } else { + if (foundIndex !== -1) i -= i - foundIndex + foundIndex = -1 + } + } + } else { + if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength + for (i = byteOffset; i >= 0; i--) { + let found = true + for (let j = 0; j < valLength; j++) { + if (read(arr, i + j) !== read(val, j)) { + found = false + break + } + } + if (found) return i + } + } + + return -1 +} + +Buffer.prototype.includes = function includes (val, byteOffset, encoding) { + return this.indexOf(val, byteOffset, encoding) !== -1 +} + +Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, true) +} + +Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) { + return bidirectionalIndexOf(this, val, byteOffset, encoding, false) +} + +function hexWrite (buf, string, offset, length) { + offset = Number(offset) || 0 + const remaining = buf.length - offset + if (!length) { + length = remaining + } else { + length = Number(length) + if (length > remaining) { + length = remaining + } + } + + const strLen = string.length + + if (length > strLen / 2) { + length = strLen / 2 + } + let i + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16) + if (numberIsNaN(parsed)) return i + buf[offset + i] = parsed + } + return i +} + +function utf8Write (buf, string, offset, length) { + return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length) +} + +function asciiWrite (buf, string, offset, length) { + return blitBuffer(asciiToBytes(string), buf, offset, length) +} + +function base64Write (buf, string, offset, length) { + return blitBuffer(base64ToBytes(string), buf, offset, length) +} + +function ucs2Write (buf, string, offset, length) { + return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length) +} + +Buffer.prototype.write = function write (string, offset, length, encoding) { + // Buffer#write(string) + if (offset === undefined) { + encoding = 'utf8' + length = this.length + offset = 0 + // Buffer#write(string, encoding) + } else if (length === undefined && typeof offset === 'string') { + encoding = offset + length = this.length + offset = 0 + // Buffer#write(string, offset[, length][, encoding]) + } else if (isFinite(offset)) { + offset = offset >>> 0 + if (isFinite(length)) { + length = length >>> 0 + if (encoding === undefined) encoding = 'utf8' + } else { + encoding = length + length = undefined + } + } else { + throw new Error( + 'Buffer.write(string, encoding, offset[, length]) is no longer supported' + ) + } + + const remaining = this.length - offset + if (length === undefined || length > remaining) length = remaining + + if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) { + throw new RangeError('Attempt to write outside buffer bounds') + } + + if (!encoding) encoding = 'utf8' + + let loweredCase = false + for (;;) { + switch (encoding) { + case 'hex': + return hexWrite(this, string, offset, length) + + case 'utf8': + case 'utf-8': + return utf8Write(this, string, offset, length) + + case 'ascii': + case 'latin1': + case 'binary': + return asciiWrite(this, string, offset, length) + + case 'base64': + // Warning: maxLength not taken into account in base64Write + return base64Write(this, string, offset, length) + + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return ucs2Write(this, string, offset, length) + + default: + if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding) + encoding = ('' + encoding).toLowerCase() + loweredCase = true + } + } +} + +Buffer.prototype.toJSON = function toJSON () { + return { + type: 'Buffer', + data: Array.prototype.slice.call(this._arr || this, 0) + } +} + +function base64Slice (buf, start, end) { + if (start === 0 && end === buf.length) { + return base64.fromByteArray(buf) + } else { + return base64.fromByteArray(buf.slice(start, end)) + } +} + +function utf8Slice (buf, start, end) { + end = Math.min(buf.length, end) + const res = [] + + let i = start + while (i < end) { + const firstByte = buf[i] + let codePoint = null + let bytesPerSequence = (firstByte > 0xEF) + ? 4 + : (firstByte > 0xDF) + ? 3 + : (firstByte > 0xBF) + ? 2 + : 1 + + if (i + bytesPerSequence <= end) { + let secondByte, thirdByte, fourthByte, tempCodePoint + + switch (bytesPerSequence) { + case 1: + if (firstByte < 0x80) { + codePoint = firstByte + } + break + case 2: + secondByte = buf[i + 1] + if ((secondByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F) + if (tempCodePoint > 0x7F) { + codePoint = tempCodePoint + } + } + break + case 3: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F) + if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) { + codePoint = tempCodePoint + } + } + break + case 4: + secondByte = buf[i + 1] + thirdByte = buf[i + 2] + fourthByte = buf[i + 3] + if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) { + tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F) + if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) { + codePoint = tempCodePoint + } + } + } + } + + if (codePoint === null) { + // we did not generate a valid codePoint so insert a + // replacement char (U+FFFD) and advance only 1 byte + codePoint = 0xFFFD + bytesPerSequence = 1 + } else if (codePoint > 0xFFFF) { + // encode to utf16 (surrogate pair dance) + codePoint -= 0x10000 + res.push(codePoint >>> 10 & 0x3FF | 0xD800) + codePoint = 0xDC00 | codePoint & 0x3FF + } + + res.push(codePoint) + i += bytesPerSequence + } + + return decodeCodePointsArray(res) +} + +// Based on http://stackoverflow.com/a/22747272/680742, the browser with +// the lowest limit is Chrome, with 0x10000 args. +// We go 1 magnitude less, for safety +const MAX_ARGUMENTS_LENGTH = 0x1000 + +function decodeCodePointsArray (codePoints) { + const len = codePoints.length + if (len <= MAX_ARGUMENTS_LENGTH) { + return String.fromCharCode.apply(String, codePoints) // avoid extra slice() + } + + // Decode in chunks to avoid "call stack size exceeded". + let res = '' + let i = 0 + while (i < len) { + res += String.fromCharCode.apply( + String, + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) + ) + } + return res +} + +function asciiSlice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 0x7F) + } + return ret +} + +function latin1Slice (buf, start, end) { + let ret = '' + end = Math.min(buf.length, end) + + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]) + } + return ret +} + +function hexSlice (buf, start, end) { + const len = buf.length + + if (!start || start < 0) start = 0 + if (!end || end < 0 || end > len) end = len + + let out = '' + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]] + } + return out +} + +function utf16leSlice (buf, start, end) { + const bytes = buf.slice(start, end) + let res = '' + // If bytes.length is odd, the last 8 bits must be ignored (same as node.js) + for (let i = 0; i < bytes.length - 1; i += 2) { + res += String.fromCharCode(bytes[i] + (bytes[i + 1] * 256)) + } + return res +} + +Buffer.prototype.slice = function slice (start, end) { + const len = this.length + start = ~~start + end = end === undefined ? len : ~~end + + if (start < 0) { + start += len + if (start < 0) start = 0 + } else if (start > len) { + start = len + } + + if (end < 0) { + end += len + if (end < 0) end = 0 + } else if (end > len) { + end = len + } + + if (end < start) end = start + + const newBuf = this.subarray(start, end) + // Return an augmented `Uint8Array` instance + Object.setPrototypeOf(newBuf, Buffer.prototype) + + return newBuf +} + +/* + * Need to make sure that buffer isn't trying to write out of bounds. + */ +function checkOffset (offset, ext, length) { + if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') + if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') +} + +Buffer.prototype.readUintLE = +Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + + return val +} + +Buffer.prototype.readUintBE = +Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + checkOffset(offset, byteLength, this.length) + } + + let val = this[offset + --byteLength] + let mul = 1 + while (byteLength > 0 && (mul *= 0x100)) { + val += this[offset + --byteLength] * mul + } + + return val +} + +Buffer.prototype.readUint8 = +Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + return this[offset] +} + +Buffer.prototype.readUint16LE = +Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return this[offset] | (this[offset + 1] << 8) +} + +Buffer.prototype.readUint16BE = +Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + return (this[offset] << 8) | this[offset + 1] +} + +Buffer.prototype.readUint32LE = +Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return ((this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16)) + + (this[offset + 3] * 0x1000000) +} + +Buffer.prototype.readUint32BE = +Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] * 0x1000000) + + ((this[offset + 1] << 16) | + (this[offset + 2] << 8) | + this[offset + 3]) +} + +Buffer.prototype.readBigUInt64LE = defineBigIntMethod(function readBigUInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const lo = first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24 + + const hi = this[++offset] + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + last * 2 ** 24 + + return BigInt(lo) + (BigInt(hi) << BigInt(32)) +}) + +Buffer.prototype.readBigUInt64BE = defineBigIntMethod(function readBigUInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const hi = first * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + const lo = this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last + + return (BigInt(hi) << BigInt(32)) + BigInt(lo) +}) + +Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let val = this[offset] + let mul = 1 + let i = 0 + while (++i < byteLength && (mul *= 0x100)) { + val += this[offset + i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) { + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) checkOffset(offset, byteLength, this.length) + + let i = byteLength + let mul = 1 + let val = this[offset + --i] + while (i > 0 && (mul *= 0x100)) { + val += this[offset + --i] * mul + } + mul *= 0x80 + + if (val >= mul) val -= Math.pow(2, 8 * byteLength) + + return val +} + +Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 1, this.length) + if (!(this[offset] & 0x80)) return (this[offset]) + return ((0xff - this[offset] + 1) * -1) +} + +Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset] | (this[offset + 1] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 2, this.length) + const val = this[offset + 1] | (this[offset] << 8) + return (val & 0x8000) ? val | 0xFFFF0000 : val +} + +Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset]) | + (this[offset + 1] << 8) | + (this[offset + 2] << 16) | + (this[offset + 3] << 24) +} + +Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + + return (this[offset] << 24) | + (this[offset + 1] << 16) | + (this[offset + 2] << 8) | + (this[offset + 3]) +} + +Buffer.prototype.readBigInt64LE = defineBigIntMethod(function readBigInt64LE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = this[offset + 4] + + this[offset + 5] * 2 ** 8 + + this[offset + 6] * 2 ** 16 + + (last << 24) // Overflow + + return (BigInt(val) << BigInt(32)) + + BigInt(first + + this[++offset] * 2 ** 8 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 24) +}) + +Buffer.prototype.readBigInt64BE = defineBigIntMethod(function readBigInt64BE (offset) { + offset = offset >>> 0 + validateNumber(offset, 'offset') + const first = this[offset] + const last = this[offset + 7] + if (first === undefined || last === undefined) { + boundsError(offset, this.length - 8) + } + + const val = (first << 24) + // Overflow + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + this[++offset] + + return (BigInt(val) << BigInt(32)) + + BigInt(this[++offset] * 2 ** 24 + + this[++offset] * 2 ** 16 + + this[++offset] * 2 ** 8 + + last) +}) + +Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, true, 23, 4) +} + +Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 4, this.length) + return ieee754.read(this, offset, false, 23, 4) +} + +Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, true, 52, 8) +} + +Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) { + offset = offset >>> 0 + if (!noAssert) checkOffset(offset, 8, this.length) + return ieee754.read(this, offset, false, 52, 8) +} + +function checkInt (buf, value, offset, ext, max, min) { + if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance') + if (value > max || value < min) throw new RangeError('"value" argument is out of bounds') + if (offset + ext > buf.length) throw new RangeError('Index out of range') +} + +Buffer.prototype.writeUintLE = +Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let mul = 1 + let i = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUintBE = +Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + byteLength = byteLength >>> 0 + if (!noAssert) { + const maxBytes = Math.pow(2, 8 * byteLength) - 1 + checkInt(this, value, offset, byteLength, maxBytes, 0) + } + + let i = byteLength - 1 + let mul = 1 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + this[offset + i] = (value / mul) & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeUint8 = +Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0) + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeUint16LE = +Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeUint16BE = +Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeUint32LE = +Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset + 3] = (value >>> 24) + this[offset + 2] = (value >>> 16) + this[offset + 1] = (value >>> 8) + this[offset] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeUint32BE = +Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0) + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +function wrtBigUInt64LE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + lo = lo >> 8 + buf[offset++] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + hi = hi >> 8 + buf[offset++] = hi + return offset +} + +function wrtBigUInt64BE (buf, value, offset, min, max) { + checkIntBI(value, min, max, buf, offset, 7) + + let lo = Number(value & BigInt(0xffffffff)) + buf[offset + 7] = lo + lo = lo >> 8 + buf[offset + 6] = lo + lo = lo >> 8 + buf[offset + 5] = lo + lo = lo >> 8 + buf[offset + 4] = lo + let hi = Number(value >> BigInt(32) & BigInt(0xffffffff)) + buf[offset + 3] = hi + hi = hi >> 8 + buf[offset + 2] = hi + hi = hi >> 8 + buf[offset + 1] = hi + hi = hi >> 8 + buf[offset] = hi + return offset + 8 +} + +Buffer.prototype.writeBigUInt64LE = defineBigIntMethod(function writeBigUInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeBigUInt64BE = defineBigIntMethod(function writeBigUInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, BigInt(0), BigInt('0xffffffffffffffff')) +}) + +Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = 0 + let mul = 1 + let sub = 0 + this[offset] = value & 0xFF + while (++i < byteLength && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + const limit = Math.pow(2, (8 * byteLength) - 1) + + checkInt(this, value, offset, byteLength, limit - 1, -limit) + } + + let i = byteLength - 1 + let mul = 1 + let sub = 0 + this[offset + i] = value & 0xFF + while (--i >= 0 && (mul *= 0x100)) { + if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) { + sub = 1 + } + this[offset + i] = ((value / mul) >> 0) - sub & 0xFF + } + + return offset + byteLength +} + +Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80) + if (value < 0) value = 0xff + value + 1 + this[offset] = (value & 0xff) + return offset + 1 +} + +Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + return offset + 2 +} + +Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000) + this[offset] = (value >>> 8) + this[offset + 1] = (value & 0xff) + return offset + 2 +} + +Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + this[offset] = (value & 0xff) + this[offset + 1] = (value >>> 8) + this[offset + 2] = (value >>> 16) + this[offset + 3] = (value >>> 24) + return offset + 4 +} + +Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000) + if (value < 0) value = 0xffffffff + value + 1 + this[offset] = (value >>> 24) + this[offset + 1] = (value >>> 16) + this[offset + 2] = (value >>> 8) + this[offset + 3] = (value & 0xff) + return offset + 4 +} + +Buffer.prototype.writeBigInt64LE = defineBigIntMethod(function writeBigInt64LE (value, offset = 0) { + return wrtBigUInt64LE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +Buffer.prototype.writeBigInt64BE = defineBigIntMethod(function writeBigInt64BE (value, offset = 0) { + return wrtBigUInt64BE(this, value, offset, -BigInt('0x8000000000000000'), BigInt('0x7fffffffffffffff')) +}) + +function checkIEEE754 (buf, value, offset, ext, max, min) { + if (offset + ext > buf.length) throw new RangeError('Index out of range') + if (offset < 0) throw new RangeError('Index out of range') +} + +function writeFloat (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38) + } + ieee754.write(buf, value, offset, littleEndian, 23, 4) + return offset + 4 +} + +Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) { + return writeFloat(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) { + return writeFloat(this, value, offset, false, noAssert) +} + +function writeDouble (buf, value, offset, littleEndian, noAssert) { + value = +value + offset = offset >>> 0 + if (!noAssert) { + checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308) + } + ieee754.write(buf, value, offset, littleEndian, 52, 8) + return offset + 8 +} + +Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) { + return writeDouble(this, value, offset, true, noAssert) +} + +Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) { + return writeDouble(this, value, offset, false, noAssert) +} + +// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) +Buffer.prototype.copy = function copy (target, targetStart, start, end) { + if (!Buffer.isBuffer(target)) throw new TypeError('argument should be a Buffer') + if (!start) start = 0 + if (!end && end !== 0) end = this.length + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 + if (end > 0 && end < start) end = start + + // Copy 0 bytes; we're done + if (end === start) return 0 + if (target.length === 0 || this.length === 0) return 0 + + // Fatal error conditions + if (targetStart < 0) { + throw new RangeError('targetStart out of bounds') + } + if (start < 0 || start >= this.length) throw new RangeError('Index out of range') + if (end < 0) throw new RangeError('sourceEnd out of bounds') + + // Are we oob? + if (end > this.length) end = this.length + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start + } + + const len = end - start + + if (this === target && typeof Uint8Array.prototype.copyWithin === 'function') { + // Use built-in when available, missing from IE11 + this.copyWithin(targetStart, start, end) + } else { + Uint8Array.prototype.set.call( + target, + this.subarray(start, end), + targetStart + ) + } + + return len +} + +// Usage: +// buffer.fill(number[, offset[, end]]) +// buffer.fill(buffer[, offset[, end]]) +// buffer.fill(string[, offset[, end]][, encoding]) +Buffer.prototype.fill = function fill (val, start, end, encoding) { + // Handle string cases: + if (typeof val === 'string') { + if (typeof start === 'string') { + encoding = start + start = 0 + end = this.length + } else if (typeof end === 'string') { + encoding = end + end = this.length + } + if (encoding !== undefined && typeof encoding !== 'string') { + throw new TypeError('encoding must be a string') + } + if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) { + throw new TypeError('Unknown encoding: ' + encoding) + } + if (val.length === 1) { + const code = val.charCodeAt(0) + if ((encoding === 'utf8' && code < 128) || + encoding === 'latin1') { + // Fast path: If `val` fits into a single byte, use that numeric value. + val = code + } + } + } else if (typeof val === 'number') { + val = val & 255 + } else if (typeof val === 'boolean') { + val = Number(val) + } + + // Invalid ranges are not set to a default, so can range check early. + if (start < 0 || this.length < start || this.length < end) { + throw new RangeError('Out of range index') + } + + if (end <= start) { + return this + } + + start = start >>> 0 + end = end === undefined ? this.length : end >>> 0 + + if (!val) val = 0 + + let i + if (typeof val === 'number') { + for (i = start; i < end; ++i) { + this[i] = val + } + } else { + const bytes = Buffer.isBuffer(val) + ? val + : Buffer.from(val, encoding) + const len = bytes.length + if (len === 0) { + throw new TypeError('The value "' + val + + '" is invalid for argument "value"') + } + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes[i % len] + } + } + + return this +} + +// CUSTOM ERRORS +// ============= + +// Simplified versions from Node, changed for Buffer-only usage +const errors = {} +function E (sym, getMessage, Base) { + errors[sym] = class NodeError extends Base { + constructor () { + super() + + Object.defineProperty(this, 'message', { + value: getMessage.apply(this, arguments), + writable: true, + configurable: true + }) + + // Add the error code to the name to include it in the stack trace. + this.name = `${this.name} [${sym}]` + // Access the stack to generate the error message including the error code + // from the name. + this.stack // eslint-disable-line no-unused-expressions + // Reset the name to the actual name. + delete this.name + } + + get code () { + return sym + } + + set code (value) { + Object.defineProperty(this, 'code', { + configurable: true, + enumerable: true, + value, + writable: true + }) + } + + toString () { + return `${this.name} [${sym}]: ${this.message}` + } + } +} + +E('ERR_BUFFER_OUT_OF_BOUNDS', + function (name) { + if (name) { + return `${name} is outside of buffer bounds` + } + + return 'Attempt to access memory outside buffer bounds' + }, RangeError) +E('ERR_INVALID_ARG_TYPE', + function (name, actual) { + return `The "${name}" argument must be of type number. Received type ${typeof actual}` + }, TypeError) +E('ERR_OUT_OF_RANGE', + function (str, range, input) { + let msg = `The value of "${str}" is out of range.` + let received = input + if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) { + received = addNumericalSeparator(String(input)) + } else if (typeof input === 'bigint') { + received = String(input) + if (input > BigInt(2) ** BigInt(32) || input < -(BigInt(2) ** BigInt(32))) { + received = addNumericalSeparator(received) + } + received += 'n' + } + msg += ` It must be ${range}. Received ${received}` + return msg + }, RangeError) + +function addNumericalSeparator (val) { + let res = '' + let i = val.length + const start = val[0] === '-' ? 1 : 0 + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}` + } + return `${val.slice(0, i)}${res}` +} + +// CHECK FUNCTIONS +// =============== + +function checkBounds (buf, offset, byteLength) { + validateNumber(offset, 'offset') + if (buf[offset] === undefined || buf[offset + byteLength] === undefined) { + boundsError(offset, buf.length - (byteLength + 1)) + } +} + +function checkIntBI (value, min, max, buf, offset, byteLength) { + if (value > max || value < min) { + const n = typeof min === 'bigint' ? 'n' : '' + let range + if (byteLength > 3) { + if (min === 0 || min === BigInt(0)) { + range = `>= 0${n} and < 2${n} ** ${(byteLength + 1) * 8}${n}` + } else { + range = `>= -(2${n} ** ${(byteLength + 1) * 8 - 1}${n}) and < 2 ** ` + + `${(byteLength + 1) * 8 - 1}${n}` + } + } else { + range = `>= ${min}${n} and <= ${max}${n}` + } + throw new errors.ERR_OUT_OF_RANGE('value', range, value) + } + checkBounds(buf, offset, byteLength) +} + +function validateNumber (value, name) { + if (typeof value !== 'number') { + throw new errors.ERR_INVALID_ARG_TYPE(name, 'number', value) + } +} + +function boundsError (value, length, type) { + if (Math.floor(value) !== value) { + validateNumber(value, type) + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', 'an integer', value) + } + + if (length < 0) { + throw new errors.ERR_BUFFER_OUT_OF_BOUNDS() + } + + throw new errors.ERR_OUT_OF_RANGE(type || 'offset', + `>= ${type ? 1 : 0} and <= ${length}`, + value) +} + +// HELPER FUNCTIONS +// ================ + +const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g + +function base64clean (str) { + // Node takes equal signs as end of the Base64 encoding + str = str.split('=')[0] + // Node strips out invalid characters like \n and \t from the string, base64-js does not + str = str.trim().replace(INVALID_BASE64_RE, '') + // Node converts strings with length < 2 to '' + if (str.length < 2) return '' + // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not + while (str.length % 4 !== 0) { + str = str + '=' + } + return str +} + +function utf8ToBytes (string, units) { + units = units || Infinity + let codePoint + const length = string.length + let leadSurrogate = null + const bytes = [] + + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i) + + // is surrogate component + if (codePoint > 0xD7FF && codePoint < 0xE000) { + // last char was a lead + if (!leadSurrogate) { + // no lead yet + if (codePoint > 0xDBFF) { + // unexpected trail + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } else if (i + 1 === length) { + // unpaired lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + continue + } + + // valid lead + leadSurrogate = codePoint + + continue + } + + // 2 leads in a row + if (codePoint < 0xDC00) { + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + leadSurrogate = codePoint + continue + } + + // valid surrogate pair + codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000 + } else if (leadSurrogate) { + // valid bmp char, but last char was a lead + if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD) + } + + leadSurrogate = null + + // encode utf8 + if (codePoint < 0x80) { + if ((units -= 1) < 0) break + bytes.push(codePoint) + } else if (codePoint < 0x800) { + if ((units -= 2) < 0) break + bytes.push( + codePoint >> 0x6 | 0xC0, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x10000) { + if ((units -= 3) < 0) break + bytes.push( + codePoint >> 0xC | 0xE0, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else if (codePoint < 0x110000) { + if ((units -= 4) < 0) break + bytes.push( + codePoint >> 0x12 | 0xF0, + codePoint >> 0xC & 0x3F | 0x80, + codePoint >> 0x6 & 0x3F | 0x80, + codePoint & 0x3F | 0x80 + ) + } else { + throw new Error('Invalid code point') + } + } + + return bytes +} + +function asciiToBytes (str) { + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + // Node's code seems to be doing this and not & 0x7F.. + byteArray.push(str.charCodeAt(i) & 0xFF) + } + return byteArray +} + +function utf16leToBytes (str, units) { + let c, hi, lo + const byteArray = [] + for (let i = 0; i < str.length; ++i) { + if ((units -= 2) < 0) break + + c = str.charCodeAt(i) + hi = c >> 8 + lo = c % 256 + byteArray.push(lo) + byteArray.push(hi) + } + + return byteArray +} + +function base64ToBytes (str) { + return base64.toByteArray(base64clean(str)) +} + +function blitBuffer (src, dst, offset, length) { + let i + for (i = 0; i < length; ++i) { + if ((i + offset >= dst.length) || (i >= src.length)) break + dst[i + offset] = src[i] + } + return i +} + +// ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass +// the `instanceof` check but they should be treated as of that type. +// See: https://github.com/feross/buffer/issues/166 +function isInstance (obj, type) { + return obj instanceof type || + (obj != null && obj.constructor != null && obj.constructor.name != null && + obj.constructor.name === type.name) +} +function numberIsNaN (obj) { + // For IE11 support + return obj !== obj // eslint-disable-line no-self-compare +} + +// Create lookup table for `toString('hex')` +// See: https://github.com/feross/buffer/issues/219 +const hexSliceLookupTable = (function () { + const alphabet = '0123456789abcdef' + const table = new Array(256) + for (let i = 0; i < 16; ++i) { + const i16 = i * 16 + for (let j = 0; j < 16; ++j) { + table[i16 + j] = alphabet[i] + alphabet[j] + } + } + return table +})() + +// Return not function with Error if BigInt not supported +function defineBigIntMethod (fn) { + return typeof BigInt === 'undefined' ? BufferBigIntNotDefined : fn +} + +function BufferBigIntNotDefined () { + throw new Error('BigInt not supported') +} + + +/***/ }), + +/***/ 62625: +/*!*****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/dependency-container.js ***! + \*****************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ instance: () => (/* binding */ instance), +/* harmony export */ typeInfo: () => (/* binding */ typeInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 55334); +/* harmony import */ var _providers__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./providers */ 80893); +/* harmony import */ var _providers_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./providers/provider */ 38776); +/* harmony import */ var _providers_injection_token__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./providers/injection-token */ 99720); +/* harmony import */ var _registry__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./registry */ 77753); +/* harmony import */ var _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./types/lifecycle */ 96362); +/* harmony import */ var _resolution_context__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./resolution-context */ 88458); +/* harmony import */ var _error_helpers__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./error-helpers */ 86318); +/* harmony import */ var _lazy_helpers__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./lazy-helpers */ 24568); +/* harmony import */ var _types_disposable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./types/disposable */ 4678); +/* harmony import */ var _interceptors__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./interceptors */ 37454); + + + + + + + + + + + +var typeInfo = new Map(); +var InternalDependencyContainer = (function () { + function InternalDependencyContainer(parent) { + this.parent = parent; + this._registry = new _registry__WEBPACK_IMPORTED_MODULE_4__["default"](); + this.interceptors = new _interceptors__WEBPACK_IMPORTED_MODULE_10__["default"](); + this.disposed = false; + this.disposables = new Set(); + } + InternalDependencyContainer.prototype.register = function (token, providerOrConstructor, options) { + if (options === void 0) { options = { lifecycle: _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Transient }; } + this.ensureNotDisposed(); + var provider; + if (!(0,_providers_provider__WEBPACK_IMPORTED_MODULE_2__.isProvider)(providerOrConstructor)) { + provider = { useClass: providerOrConstructor }; + } + else { + provider = providerOrConstructor; + } + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isTokenProvider)(provider)) { + var path = [token]; + var tokenProvider = provider; + while (tokenProvider != null) { + var currentToken = tokenProvider.useToken; + if (path.includes(currentToken)) { + throw new Error("Token registration cycle detected! " + (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)(path, [currentToken]).join(" -> ")); + } + path.push(currentToken); + var registration = this._registry.get(currentToken); + if (registration && (0,_providers__WEBPACK_IMPORTED_MODULE_1__.isTokenProvider)(registration.provider)) { + tokenProvider = registration.provider; + } + else { + tokenProvider = null; + } + } + } + if (options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Singleton || + options.lifecycle == _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ContainerScoped || + options.lifecycle == _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ResolutionScoped) { + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isValueProvider)(provider) || (0,_providers__WEBPACK_IMPORTED_MODULE_1__.isFactoryProvider)(provider)) { + throw new Error("Cannot use lifecycle \"" + _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"][options.lifecycle] + "\" with ValueProviders or FactoryProviders"); + } + } + this._registry.set(token, { provider: provider, options: options }); + return this; + }; + InternalDependencyContainer.prototype.registerType = function (from, to) { + this.ensureNotDisposed(); + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(to)) { + return this.register(from, { + useToken: to + }); + } + return this.register(from, { + useClass: to + }); + }; + InternalDependencyContainer.prototype.registerInstance = function (token, instance) { + this.ensureNotDisposed(); + return this.register(token, { + useValue: instance + }); + }; + InternalDependencyContainer.prototype.registerSingleton = function (from, to) { + this.ensureNotDisposed(); + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(from)) { + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(to)) { + return this.register(from, { + useToken: to + }, { lifecycle: _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Singleton }); + } + else if (to) { + return this.register(from, { + useClass: to + }, { lifecycle: _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Singleton }); + } + throw new Error('Cannot register a type name as a singleton without a "to" token'); + } + var useClass = from; + if (to && !(0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(to)) { + useClass = to; + } + return this.register(from, { + useClass: useClass + }, { lifecycle: _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Singleton }); + }; + InternalDependencyContainer.prototype.resolve = function (token, context, isOptional) { + if (context === void 0) { context = new _resolution_context__WEBPACK_IMPORTED_MODULE_6__["default"](); } + if (isOptional === void 0) { isOptional = false; } + this.ensureNotDisposed(); + var registration = this.getRegistration(token); + if (!registration && (0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(token)) { + if (isOptional) { + return undefined; + } + throw new Error("Attempted to resolve unregistered dependency token: \"" + token.toString() + "\""); + } + this.executePreResolutionInterceptor(token, "Single"); + if (registration) { + var result = this.resolveRegistration(registration, context); + this.executePostResolutionInterceptor(token, result, "Single"); + return result; + } + if ((0,_providers_injection_token__WEBPACK_IMPORTED_MODULE_3__.isConstructorToken)(token)) { + var result = this.construct(token, context); + this.executePostResolutionInterceptor(token, result, "Single"); + return result; + } + throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function."); + }; + InternalDependencyContainer.prototype.executePreResolutionInterceptor = function (token, resolutionType) { + var e_1, _a; + if (this.interceptors.preResolution.has(token)) { + var remainingInterceptors = []; + try { + for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(this.interceptors.preResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { + var interceptor = _c.value; + if (interceptor.options.frequency != "Once") { + remainingInterceptors.push(interceptor); + } + interceptor.callback(token, resolutionType); + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_1) throw e_1.error; } + } + this.interceptors.preResolution.setAll(token, remainingInterceptors); + } + }; + InternalDependencyContainer.prototype.executePostResolutionInterceptor = function (token, result, resolutionType) { + var e_2, _a; + if (this.interceptors.postResolution.has(token)) { + var remainingInterceptors = []; + try { + for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(this.interceptors.postResolution.getAll(token)), _c = _b.next(); !_c.done; _c = _b.next()) { + var interceptor = _c.value; + if (interceptor.options.frequency != "Once") { + remainingInterceptors.push(interceptor); + } + interceptor.callback(token, result, resolutionType); + } + } + catch (e_2_1) { e_2 = { error: e_2_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_2) throw e_2.error; } + } + this.interceptors.postResolution.setAll(token, remainingInterceptors); + } + }; + InternalDependencyContainer.prototype.resolveRegistration = function (registration, context) { + this.ensureNotDisposed(); + if (registration.options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ResolutionScoped && + context.scopedResolutions.has(registration)) { + return context.scopedResolutions.get(registration); + } + var isSingleton = registration.options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].Singleton; + var isContainerScoped = registration.options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ContainerScoped; + var returnInstance = isSingleton || isContainerScoped; + var resolved; + if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isValueProvider)(registration.provider)) { + resolved = registration.provider.useValue; + } + else if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isTokenProvider)(registration.provider)) { + resolved = returnInstance + ? registration.instance || + (registration.instance = this.resolve(registration.provider.useToken, context)) + : this.resolve(registration.provider.useToken, context); + } + else if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isClassProvider)(registration.provider)) { + resolved = returnInstance + ? registration.instance || + (registration.instance = this.construct(registration.provider.useClass, context)) + : this.construct(registration.provider.useClass, context); + } + else if ((0,_providers__WEBPACK_IMPORTED_MODULE_1__.isFactoryProvider)(registration.provider)) { + resolved = registration.provider.useFactory(this); + } + else { + resolved = this.construct(registration.provider, context); + } + if (registration.options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ResolutionScoped) { + context.scopedResolutions.set(registration, resolved); + } + return resolved; + }; + InternalDependencyContainer.prototype.resolveAll = function (token, context, isOptional) { + var _this = this; + if (context === void 0) { context = new _resolution_context__WEBPACK_IMPORTED_MODULE_6__["default"](); } + if (isOptional === void 0) { isOptional = false; } + this.ensureNotDisposed(); + var registrations = this.getAllRegistrations(token); + if (!registrations && (0,_providers__WEBPACK_IMPORTED_MODULE_1__.isNormalToken)(token)) { + if (isOptional) { + return []; + } + throw new Error("Attempted to resolve unregistered dependency token: \"" + token.toString() + "\""); + } + this.executePreResolutionInterceptor(token, "All"); + if (registrations) { + var result_1 = registrations.map(function (item) { + return _this.resolveRegistration(item, context); + }); + this.executePostResolutionInterceptor(token, result_1, "All"); + return result_1; + } + var result = [this.construct(token, context)]; + this.executePostResolutionInterceptor(token, result, "All"); + return result; + }; + InternalDependencyContainer.prototype.isRegistered = function (token, recursive) { + if (recursive === void 0) { recursive = false; } + this.ensureNotDisposed(); + return (this._registry.has(token) || + (recursive && + (this.parent || false) && + this.parent.isRegistered(token, true))); + }; + InternalDependencyContainer.prototype.reset = function () { + this.ensureNotDisposed(); + this._registry.clear(); + this.interceptors.preResolution.clear(); + this.interceptors.postResolution.clear(); + }; + InternalDependencyContainer.prototype.clearInstances = function () { + var e_3, _a; + this.ensureNotDisposed(); + try { + for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_c.value, 2), token = _d[0], registrations = _d[1]; + this._registry.setAll(token, registrations + .filter(function (registration) { return !(0,_providers__WEBPACK_IMPORTED_MODULE_1__.isValueProvider)(registration.provider); }) + .map(function (registration) { + registration.instance = undefined; + return registration; + })); + } + } + catch (e_3_1) { e_3 = { error: e_3_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_3) throw e_3.error; } + } + }; + InternalDependencyContainer.prototype.createChildContainer = function () { + var e_4, _a; + this.ensureNotDisposed(); + var childContainer = new InternalDependencyContainer(this); + try { + for (var _b = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__values)(this._registry.entries()), _c = _b.next(); !_c.done; _c = _b.next()) { + var _d = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__read)(_c.value, 2), token = _d[0], registrations = _d[1]; + if (registrations.some(function (_a) { + var options = _a.options; + return options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ContainerScoped; + })) { + childContainer._registry.setAll(token, registrations.map(function (registration) { + if (registration.options.lifecycle === _types_lifecycle__WEBPACK_IMPORTED_MODULE_5__["default"].ContainerScoped) { + return { + provider: registration.provider, + options: registration.options + }; + } + return registration; + })); + } + } + } + catch (e_4_1) { e_4 = { error: e_4_1 }; } + finally { + try { + if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + } + finally { if (e_4) throw e_4.error; } + } + return childContainer; + }; + InternalDependencyContainer.prototype.beforeResolution = function (token, callback, options) { + if (options === void 0) { options = { frequency: "Always" }; } + this.interceptors.preResolution.set(token, { + callback: callback, + options: options + }); + }; + InternalDependencyContainer.prototype.afterResolution = function (token, callback, options) { + if (options === void 0) { options = { frequency: "Always" }; } + this.interceptors.postResolution.set(token, { + callback: callback, + options: options + }); + }; + InternalDependencyContainer.prototype.dispose = function () { + return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__awaiter)(this, void 0, void 0, function () { + var promises; + return (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__generator)(this, function (_a) { + switch (_a.label) { + case 0: + this.disposed = true; + promises = []; + this.disposables.forEach(function (disposable) { + var maybePromise = disposable.dispose(); + if (maybePromise) { + promises.push(maybePromise); + } + }); + return [4, Promise.all(promises)]; + case 1: + _a.sent(); + return [2]; + } + }); + }); + }; + InternalDependencyContainer.prototype.getRegistration = function (token) { + if (this.isRegistered(token)) { + return this._registry.get(token); + } + if (this.parent) { + return this.parent.getRegistration(token); + } + return null; + }; + InternalDependencyContainer.prototype.getAllRegistrations = function (token) { + if (this.isRegistered(token)) { + return this._registry.getAll(token); + } + if (this.parent) { + return this.parent.getAllRegistrations(token); + } + return null; + }; + InternalDependencyContainer.prototype.construct = function (ctor, context) { + var _this = this; + if (ctor instanceof _lazy_helpers__WEBPACK_IMPORTED_MODULE_8__.DelayedConstructor) { + return ctor.createProxy(function (target) { + return _this.resolve(target, context); + }); + } + var instance = (function () { + var paramInfo = typeInfo.get(ctor); + if (!paramInfo || paramInfo.length === 0) { + if (ctor.length === 0) { + return new ctor(); + } + else { + throw new Error("TypeInfo not known for \"" + ctor.name + "\""); + } + } + var params = paramInfo.map(_this.resolveParams(context, ctor)); + return new (ctor.bind.apply(ctor, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)([void 0], params)))(); + })(); + if ((0,_types_disposable__WEBPACK_IMPORTED_MODULE_9__.isDisposable)(instance)) { + this.disposables.add(instance); + } + return instance; + }; + InternalDependencyContainer.prototype.resolveParams = function (context, ctor) { + var _this = this; + return function (param, idx) { + var _a, _b, _c; + try { + if ((0,_providers_injection_token__WEBPACK_IMPORTED_MODULE_3__.isTokenDescriptor)(param)) { + if ((0,_providers_injection_token__WEBPACK_IMPORTED_MODULE_3__.isTransformDescriptor)(param)) { + return param.multiple + ? (_a = _this.resolve(param.transform)).transform.apply(_a, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)([_this.resolveAll(param.token, new _resolution_context__WEBPACK_IMPORTED_MODULE_6__["default"](), param.isOptional)], param.transformArgs)) : (_b = _this.resolve(param.transform)).transform.apply(_b, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)([_this.resolve(param.token, context, param.isOptional)], param.transformArgs)); + } + else { + return param.multiple + ? _this.resolveAll(param.token, new _resolution_context__WEBPACK_IMPORTED_MODULE_6__["default"](), param.isOptional) + : _this.resolve(param.token, context, param.isOptional); + } + } + else if ((0,_providers_injection_token__WEBPACK_IMPORTED_MODULE_3__.isTransformDescriptor)(param)) { + return (_c = _this.resolve(param.transform, context)).transform.apply(_c, (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__spread)([_this.resolve(param.token, context)], param.transformArgs)); + } + return _this.resolve(param, context); + } + catch (e) { + throw new Error((0,_error_helpers__WEBPACK_IMPORTED_MODULE_7__.formatErrorCtor)(ctor, idx, e)); + } + }; + }; + InternalDependencyContainer.prototype.ensureNotDisposed = function () { + if (this.disposed) { + throw new Error("This container has been disposed, you cannot interact with a disposed container"); + } + }; + return InternalDependencyContainer; +}()); +var instance = new InternalDependencyContainer(); +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (instance); + + +/***/ }), + +/***/ 62817: +/*!*****************************************************************************************!*\ + !*** ../node_modules/.pnpm/browserify-sign@4.2.6/node_modules/browserify-sign/algos.js ***! + \*****************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = __webpack_require__(/*! ./browser/algorithms.json */ 91801); + + +/***/ }), + +/***/ 62923: +/*!*************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pkcs8@2.8.0/node_modules/@peculiar/asn1-pkcs8/build/es2015/encrypted_private_key_info.js ***! + \*************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ EncryptedData: () => (/* binding */ EncryptedData), +/* harmony export */ EncryptedPrivateKeyInfo: () => (/* binding */ EncryptedPrivateKeyInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); + + + +class EncryptedData extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.OctetString { +} +class EncryptedPrivateKeyInfo { + encryptionAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(); + encryptedData = new EncryptedData(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier }) +], EncryptedPrivateKeyInfo.prototype, "encryptionAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: EncryptedData }) +], EncryptedPrivateKeyInfo.prototype, "encryptedData", void 0); + + +/***/ }), + +/***/ 63095: +/*!*****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/types/bit_string.js ***! + \*****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ BitString: () => (/* binding */ BitString) +/* harmony export */ }); +/* harmony import */ var asn1js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! asn1js */ 55966); +/* harmony import */ var _peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/utils/bytes */ 15246); + + +class BitString { + unusedBits = 0; + value = new ArrayBuffer(0); + constructor(params, unusedBits = 0) { + if (params) { + if (typeof params === "number") { + this.fromNumber(params); + } + else if ((0,_peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.isBufferSource)(params)) { + this.unusedBits = unusedBits; + this.value = (0,_peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.toArrayBuffer)(params); + } + else { + throw TypeError("Unsupported type of 'params' argument for BitString"); + } + } + } + fromASN(asn) { + if (!(asn instanceof asn1js__WEBPACK_IMPORTED_MODULE_0__.BitString)) { + throw new TypeError("Argument 'asn' is not instance of ASN.1 BitString"); + } + this.unusedBits = asn.valueBlock.unusedBits; + this.value = (0,_peculiar_utils_bytes__WEBPACK_IMPORTED_MODULE_1__.toArrayBuffer)(asn.valueBlock.valueHex); + return this; + } + toASN() { + return new asn1js__WEBPACK_IMPORTED_MODULE_0__.BitString({ + unusedBits: this.unusedBits, valueHex: this.value, + }); + } + toSchema(name) { + return new asn1js__WEBPACK_IMPORTED_MODULE_0__.BitString({ name }); + } + toNumber() { + let res = ""; + const uintArray = new Uint8Array(this.value); + for (const octet of uintArray) { + res += octet.toString(2).padStart(8, "0"); + } + res = res.split("").reverse().join(""); + if (this.unusedBits) { + res = res.slice(this.unusedBits).padStart(this.unusedBits, "0"); + } + return parseInt(res, 2); + } + fromNumber(value) { + let bits = value.toString(2); + const octetSize = (bits.length + 7) >> 3; + this.unusedBits = (octetSize << 3) - bits.length; + const octets = new Uint8Array(octetSize); + bits = bits + .padStart(octetSize << 3, "0") + .split("") + .reverse() + .join(""); + let index = 0; + while (index < octetSize) { + octets[index] = parseInt(bits.slice(index << 3, (index << 3) + 8), 2); + index++; + } + this.value = octets.buffer; + } +} + + +/***/ }), + +/***/ 63124: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/registry.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 55334); +/* harmony import */ var _dependency_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dependency-container */ 62625); + + +function registry(registrations) { + if (registrations === void 0) { registrations = []; } + return function (target) { + registrations.forEach(function (_a) { + var token = _a.token, options = _a.options, provider = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__rest)(_a, ["token", "options"]); + return _dependency_container__WEBPACK_IMPORTED_MODULE_1__.instance.register(token, provider, options); + }); + return target; + }; +} +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (registry); + + +/***/ }), + +/***/ 63146: +/*!******************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/_stream_duplex.js ***! + \******************************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __webpack_require__(/*! ./_stream_readable */ 81624); +var Writable = __webpack_require__(/*! ./_stream_writable */ 2376); +__webpack_require__(/*! inherits */ 18628)(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ 63174: +/*!**********************************************************************************!*\ + !*** ../node_modules/.pnpm/elliptic@6.6.1/node_modules/elliptic/lib/elliptic.js ***! + \**********************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +var elliptic = exports; + +elliptic.version = (__webpack_require__(/*! ../package.json */ 43561).version); +elliptic.utils = __webpack_require__(/*! ./elliptic/utils */ 28432); +elliptic.rand = __webpack_require__(/*! brorand */ 1781); +elliptic.curve = __webpack_require__(/*! ./elliptic/curve */ 5353); +elliptic.curves = __webpack_require__(/*! ./elliptic/curves */ 55897); + +// Protocols +elliptic.ec = __webpack_require__(/*! ./elliptic/ec */ 56130); +elliptic.eddsa = __webpack_require__(/*! ./elliptic/eddsa */ 42165); + + +/***/ }), + +/***/ 63230: +/*!**********************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/pfx.js ***! + \**********************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ PFX: () => (/* binding */ PFX) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_cms__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-cms */ 73116); +/* harmony import */ var _mac_data_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mac_data.js */ 5330); + + + + +class PFX { + version = 3; + authSafe = new _peculiar_asn1_cms__WEBPACK_IMPORTED_MODULE_2__.ContentInfo(); + macData = new _mac_data_js__WEBPACK_IMPORTED_MODULE_3__.MacData(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], PFX.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_cms__WEBPACK_IMPORTED_MODULE_2__.ContentInfo }) +], PFX.prototype, "authSafe", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _mac_data_js__WEBPACK_IMPORTED_MODULE_3__.MacData, optional: true, + }) +], PFX.prototype, "macData", void 0); + + +/***/ }), + +/***/ 63397: +/*!*********************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/progress.js ***! + \*********************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ defineProgressElement: () => (/* binding */ defineProgressElement), +/* harmony export */ isProgressSupported: () => (/* binding */ isProgressSupported) +/* harmony export */ }); +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } +function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } +function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } +function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } +function _wrapNativeSuper(t) { var r = "function" == typeof Map ? new Map() : void 0; return _wrapNativeSuper = function _wrapNativeSuper(t) { if (null === t || !_isNativeFunction(t)) return t; if ("function" != typeof t) throw new TypeError("Super expression must either be null or a function"); if (void 0 !== r) { if (r.has(t)) return r.get(t); r.set(t, Wrapper); } function Wrapper() { return _construct(t, arguments, _getPrototypeOf(this).constructor); } return Wrapper.prototype = Object.create(t.prototype, { constructor: { value: Wrapper, enumerable: !1, writable: !0, configurable: !0 } }), _setPrototypeOf(Wrapper, t); }, _wrapNativeSuper(t); } +function _construct(t, e, r) { if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments); var o = [null]; o.push.apply(o, e); var p = new (t.bind.apply(t, o))(); return r && _setPrototypeOf(p, r.prototype), p; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function _isNativeFunction(t) { try { return -1 !== Function.toString.call(t).indexOf("[native code]"); } catch (n) { return "function" == typeof t; } } +function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } +function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } +function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); } +function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); } +function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); } +function isProgressSupported() { + return "customElements" in self && !!HTMLElement.prototype.attachShadow; +} +function defineProgressElement() { + var _WebpackDevServerProgress; + if (customElements.get("wds-progress")) { + return; + } + var _WebpackDevServerProgress_brand = /*#__PURE__*/new WeakSet(); + var WebpackDevServerProgress = /*#__PURE__*/function (_HTMLElement) { + function WebpackDevServerProgress() { + var _this; + _classCallCheck(this, WebpackDevServerProgress); + _this = _callSuper(this, WebpackDevServerProgress); + _classPrivateMethodInitSpec(_this, _WebpackDevServerProgress_brand); + _this.attachShadow({ + mode: "open" + }); + _this.maxDashOffset = -219.99078369140625; + _this.animationTimer = null; + return _this; + } + _inherits(WebpackDevServerProgress, _HTMLElement); + return _createClass(WebpackDevServerProgress, [{ + key: "connectedCallback", + value: function connectedCallback() { + _assertClassBrand(_WebpackDevServerProgress_brand, this, _reset).call(this); + } + }, { + key: "attributeChangedCallback", + value: function attributeChangedCallback(name, oldValue, newValue) { + if (name === "progress") { + _assertClassBrand(_WebpackDevServerProgress_brand, this, _update).call(this, Number(newValue)); + } else if (name === "type") { + _assertClassBrand(_WebpackDevServerProgress_brand, this, _reset).call(this); + } + } + }], [{ + key: "observedAttributes", + get: function get() { + return ["progress", "type"]; + } + }]); + }(/*#__PURE__*/_wrapNativeSuper(HTMLElement)); + _WebpackDevServerProgress = WebpackDevServerProgress; + function _reset() { + var _this$getAttribute, _Number; + clearTimeout(this.animationTimer); + this.animationTimer = null; + var typeAttr = (_this$getAttribute = this.getAttribute("type")) === null || _this$getAttribute === void 0 ? void 0 : _this$getAttribute.toLowerCase(); + this.type = typeAttr === "circular" ? "circular" : "linear"; + var innerHTML = this.type === "circular" ? _circularTemplate.call(_WebpackDevServerProgress) : _linearTemplate.call(_WebpackDevServerProgress); + this.shadowRoot.innerHTML = innerHTML; + this.initialProgress = (_Number = Number(this.getAttribute("progress"))) !== null && _Number !== void 0 ? _Number : 0; + _assertClassBrand(_WebpackDevServerProgress_brand, this, _update).call(this, this.initialProgress); + } + function _circularTemplate() { + return "\n \n \n \n \n \n 0\n %\n \n \n "; + } + function _linearTemplate() { + return "\n \n
\n "; + } + function _update(percent) { + var element = this.shadowRoot.querySelector("#progress"); + if (this.type === "circular") { + var path = this.shadowRoot.querySelector("path"); + var value = this.shadowRoot.querySelector("#percent-value"); + var offset = (100 - percent) / 100 * this.maxDashOffset; + path.style.strokeDashoffset = offset; + value.textContent = percent; + } else { + element.style.width = "".concat(percent, "%"); + } + if (percent >= 100) { + _assertClassBrand(_WebpackDevServerProgress_brand, this, _hide).call(this); + } else if (percent > 0) { + _assertClassBrand(_WebpackDevServerProgress_brand, this, _show).call(this); + } + } + function _show() { + var element = this.shadowRoot.querySelector("#progress"); + element.classList.remove("hidden"); + } + function _hide() { + var _this2 = this; + var element = this.shadowRoot.querySelector("#progress"); + if (this.type === "circular") { + element.classList.add("disappear"); + element.addEventListener("animationend", function () { + element.classList.add("hidden"); + _assertClassBrand(_WebpackDevServerProgress_brand, _this2, _update).call(_this2, 0); + }, { + once: true + }); + } else if (this.type === "linear") { + element.classList.add("disappear"); + this.animationTimer = setTimeout(function () { + element.classList.remove("disappear"); + element.classList.add("hidden"); + element.style.width = "0%"; + _this2.animationTimer = null; + }, 800); + } + } + customElements.define("wds-progress", WebpackDevServerProgress); +} + +/***/ }), + +/***/ 63564: +/*!**********************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/accounts/utils/sign.js ***! + \**********************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ setSignEntropy: () => (/* binding */ setSignEntropy), +/* harmony export */ sign: () => (/* binding */ sign) +/* harmony export */ }); +/* harmony import */ var _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @noble/curves/secp256k1 */ 71961); +/* harmony import */ var _utils_data_isHex_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../utils/data/isHex.js */ 76816); +/* harmony import */ var _utils_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utils/encoding/toBytes.js */ 58548); +/* harmony import */ var _utils_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../utils/encoding/toHex.js */ 32786); +/* harmony import */ var _utils_signature_serializeSignature_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../utils/signature/serializeSignature.js */ 74761); +// TODO(v3): Convert to sync. + + + + + +let extraEntropy = false; +/** + * Sets extra entropy for signing functions. + */ +function setSignEntropy(entropy) { + if (!entropy) + throw new Error('must be a `true` or a hex value.'); + extraEntropy = entropy; +} +/** + * @description Signs a hash with a given private key. + * + * @param hash The hash to sign. + * @param privateKey The private key to sign with. + * + * @returns The signature. + */ +async function sign({ hash, privateKey, to = 'object', }) { + const { r, s, recovery } = _noble_curves_secp256k1__WEBPACK_IMPORTED_MODULE_0__.secp256k1.sign(hash.slice(2), privateKey.slice(2), { + lowS: true, + extraEntropy: (0,_utils_data_isHex_js__WEBPACK_IMPORTED_MODULE_1__.isHex)(extraEntropy, { strict: false }) + ? (0,_utils_encoding_toBytes_js__WEBPACK_IMPORTED_MODULE_2__.hexToBytes)(extraEntropy) + : extraEntropy, + }); + const signature = { + r: (0,_utils_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.numberToHex)(r, { size: 32 }), + s: (0,_utils_encoding_toHex_js__WEBPACK_IMPORTED_MODULE_3__.numberToHex)(s, { size: 32 }), + v: recovery ? 28n : 27n, + yParity: recovery, + }; + return (() => { + if (to === 'bytes' || to === 'hex') + return (0,_utils_signature_serializeSignature_js__WEBPACK_IMPORTED_MODULE_4__.serializeSignature)({ ...signature, to }); + return signature; + })(); +} +//# sourceMappingURL=sign.js.map + +/***/ }), + +/***/ 63594: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/noble.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ aInRange: () => (/* binding */ aInRange), +/* harmony export */ abytes: () => (/* binding */ abytes), +/* harmony export */ aexists: () => (/* binding */ aexists), +/* harmony export */ anumber: () => (/* binding */ anumber), +/* harmony export */ aoutput: () => (/* binding */ aoutput), +/* harmony export */ asciiToBytes: () => (/* binding */ asciiToBytes), +/* harmony export */ byteSwap: () => (/* binding */ byteSwap), +/* harmony export */ byteSwap32: () => (/* binding */ byteSwap32), +/* harmony export */ byteSwapIfBE: () => (/* binding */ byteSwapIfBE), +/* harmony export */ bytesToHex: () => (/* binding */ bytesToHex), +/* harmony export */ bytesToNumberBE: () => (/* binding */ bytesToNumberBE), +/* harmony export */ bytesToNumberLE: () => (/* binding */ bytesToNumberLE), +/* harmony export */ bytesToUtf8: () => (/* binding */ bytesToUtf8), +/* harmony export */ clean: () => (/* binding */ clean), +/* harmony export */ concatBytes: () => (/* binding */ concatBytes), +/* harmony export */ copyBytes: () => (/* binding */ copyBytes), +/* harmony export */ createView: () => (/* binding */ createView), +/* harmony export */ hexToBytes: () => (/* binding */ hexToBytes), +/* harmony export */ hexToNumber: () => (/* binding */ hexToNumber), +/* harmony export */ inRange: () => (/* binding */ inRange), +/* harmony export */ isBytes: () => (/* binding */ isBytes), +/* harmony export */ isLE: () => (/* binding */ isLE), +/* harmony export */ numberToBigint: () => (/* binding */ numberToBigint), +/* harmony export */ numberToBytesBE: () => (/* binding */ numberToBytesBE), +/* harmony export */ numberToBytesLE: () => (/* binding */ numberToBytesLE), +/* harmony export */ numberToHexUnpadded: () => (/* binding */ numberToHexUnpadded), +/* harmony export */ oidNist: () => (/* binding */ oidNist), +/* harmony export */ randomBytesAsync: () => (/* binding */ randomBytesAsync), +/* harmony export */ rotr: () => (/* binding */ rotr), +/* harmony export */ swap32IfBE: () => (/* binding */ swap32IfBE), +/* harmony export */ swap8IfBE: () => (/* binding */ swap8IfBE), +/* harmony export */ u32: () => (/* binding */ u32), +/* harmony export */ utf8ToBytes: () => (/* binding */ utf8ToBytes), +/* harmony export */ validateObject: () => (/* binding */ validateObject) +/* harmony export */ }); +/* harmony import */ var _misc_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./misc.js */ 30988); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../consts.js */ 53838); +// deno-lint-ignore-file no-explicit-any +/** + * This file is based on noble-curves (https://github.com/paulmillr/noble-curves). + * + * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) + * + * The original file is located at: + * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/utils.ts + */ +/** + * Hex, bytes and number utilities. + * @module + */ + + +/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */ +function isBytes(a) { + return a instanceof Uint8Array || + (ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array"); +} +/** Asserts something is positive integer. */ +function anumber(n, title = "") { + if (!Number.isSafeInteger(n) || n < 0) { + const prefix = title && `"${title}" `; + throw new Error(`${prefix}expected integer >0, got ${n}`); + } +} +/** Asserts something is Uint8Array. */ +function abytes(value, length, title = "") { + const bytes = isBytes(value); + const len = value?.length; + const needsLen = length !== undefined; + if (!bytes || (needsLen && len !== length)) { + const prefix = title && `"${title}" `; + const ofLen = needsLen ? ` of length ${length}` : ""; + const got = bytes ? `length=${len}` : `type=${typeof value}`; + throw new Error(prefix + "expected Uint8Array" + ofLen + ", got " + got); + } + return value; +} +// ahash function is now imported from ../hash/hash.ts +/** Asserts a hash instance has not been destroyed / finished */ +function aexists(instance, checkFinished = true) { + if (instance.destroyed) + throw new Error("Hash instance has been destroyed"); + if (checkFinished && instance.finished) { + throw new Error("Hash#digest() has already been called"); + } +} +/** Asserts output is properly-sized byte array */ +function aoutput(out, instance) { + abytes(out, undefined, "digestInto() output"); + const min = instance.outputLen; + if (out.length < min) { + throw new Error('"digestInto() output" expected to be of length >=' + min); + } +} +// Used in weierstrass, der +function abignumer(n) { + if (typeof n === "bigint") { + if (!isPosBig(n)) + throw new Error("positive bigint expected, got " + n); + } + else + anumber(n); + return n; +} +/** Cast u8 / u16 / u32 to u32. */ +function u32(arr) { + return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); +} +/** Zeroize a byte array. Warning: JS provides no guarantees. */ +function clean(...arrays) { + for (let i = 0; i < arrays.length; i++) { + arrays[i].fill(0); + } +} +/** Pre-computed buffer for endianness detection */ +const _endianTestBuffer = /* @__PURE__ */ new Uint32Array([0x11223344]); +const _endianTestBytes = /* @__PURE__ */ new Uint8Array(_endianTestBuffer.buffer); +/** Is current platform little-endian? Most are. Big-Endian platform: IBM */ +const isLE = /* @__PURE__ */ _endianTestBytes[0] === 0x44; +/** The byte swap operation for uint32 */ +function byteSwap(word) { + return (((word << 24) & 0xff000000) | + ((word << 8) & 0xff0000) | + ((word >>> 8) & 0xff00) | + ((word >>> 24) & 0xff)); +} +/** Conditionally byte swap if on a big-endian platform */ +function swap8IfBE(n) { + return isLE ? n : byteSwap(n); +} +/** @deprecated */ +const byteSwapIfBE = swap8IfBE; +/** In place byte swap for Uint32Array */ +function byteSwap32(arr) { + for (let i = 0; i < arr.length; i++) { + arr[i] = byteSwap(arr[i]); + } + return arr; +} +function swap32IfBE(u) { + return isLE ? u : byteSwap32(u); +} +/** Create DataView of an array for easy byte-level manipulation. */ +function createView(arr) { + return new DataView(arr.buffer, arr.byteOffset, arr.byteLength); +} +/** The rotate right (circular right shift) operation for uint32 */ +function rotr(word, shift) { + return (word << (32 - shift)) | (word >>> shift); +} +// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex +const hasHexBuiltin = /* @__PURE__ */ (() => +// @ts-ignore: to use toHex +typeof Uint8Array.from([]).toHex === "function" && + // @ts-ignore: to use fromHex + typeof Uint8Array.fromHex === "function")(); +// Array where index 0xf0 (240) is mapped to string 'f0' +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); +const HEX_TO_BIGINT = /* @__PURE__ */ [ + 0n, + 1n, + 2n, + 3n, + 4n, + 5n, + 6n, + 7n, + 8n, + 9n, + 10n, + 11n, + 12n, + 13n, + 14n, + 15n, +]; +/** + * Convert byte array to hex string. Uses built-in function, when available. + * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123' + */ +function bytesToHex(bytes) { + abytes(bytes); + // @ts-ignore: to use toHex + if (hasHexBuiltin) + return bytes.toHex(); + // pre-caching improves the speed 6x + let hex = ""; + for (let i = 0; i < bytes.length; i++) { + hex += hexes[bytes[i]]; + } + return hex; +} +// We use optimized technique to convert hex string to byte array +const asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 }; +function asciiToBase16(ch) { + if (ch >= asciis._0 && ch <= asciis._9) + return ch - asciis._0; // '2' => 50-48 + if (ch >= asciis.A && ch <= asciis.F) + return ch - (asciis.A - 10); // 'B' => 66-(65-10) + if (ch >= asciis.a && ch <= asciis.f) + return ch - (asciis.a - 10); // 'b' => 98-(97-10) + return; +} +/** + * Convert hex string to byte array. Uses built-in function, when available. + * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23]) + */ +function hexToBytes(hex) { + if (typeof hex !== "string") { + throw new Error("hex string expected, got " + typeof hex); + } + // @ts-ignore: to use fromHex + if (hasHexBuiltin) + return Uint8Array.fromHex(hex); + const hl = hex.length; + const al = hl / 2; + if (hl % 2) { + throw new Error("hex string expected, got unpadded hex of length " + hl); + } + const array = new Uint8Array(al); + for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { + const n1 = asciiToBase16(hex.charCodeAt(hi)); + const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); + if (n1 === undefined || n2 === undefined) { + const char = hex[hi] + hex[hi + 1]; + throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + + hi); + } + array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163 + } + return array; +} +/** + * Converts string to bytes using UTF8 encoding. + * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99]) + */ +function utf8ToBytes(str) { + if (typeof str !== "string") + throw new Error("string expected"); + return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809 +} +/** + * Converts bytes to string using UTF8 encoding. + * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc' + */ +function bytesToUtf8(bytes) { + return new TextDecoder().decode(bytes); +} +function numberToHexUnpadded(num) { + const hex = abignumer(num).toString(16); + return hex.length & 1 ? "0" + hex : hex; +} +function hexToNumber(hex) { + if (typeof hex !== "string") { + throw new Error("hex string expected, got " + typeof hex); + } + let out = _consts_js__WEBPACK_IMPORTED_MODULE_1__.N_0; + for (let i = 0; i < hex.length; i++) { + const n = asciiToBase16(hex.charCodeAt(i)); + if (n === undefined) { + throw new Error('hex string expected, got non-hex character "' + hex[i] + + '" at index ' + i); + } + out = (out << 4n) | HEX_TO_BIGINT[n]; + } + return out; // Big Endian +} +function numberToBigint(num) { + anumber(num, "numberToBigint"); + let n = num; + let out = _consts_js__WEBPACK_IMPORTED_MODULE_1__.N_0; + let bit = 1n; + while (n > 0) { + if (n % 2 === 1) + out += bit; + n = Math.floor(n / 2); + bit <<= 1n; + } + return out; +} +// BE: Big Endian, LE: Little Endian +function bytesToNumberBE(bytes) { + return hexToNumber(bytesToHex(bytes)); +} +function bytesToNumberLE(bytes) { + return hexToNumber(bytesToHex(copyBytes(abytes(bytes)).reverse())); +} +function numberToBytesBE(n, len) { + anumber(len); + n = abignumer(n); + const res = hexToBytes(n.toString(16).padStart(len * 2, "0")); + if (res.length !== len) + throw new Error("number too large"); + return res; +} +function numberToBytesLE(n, len) { + return numberToBytesBE(n, len).reverse(); +} +/** + * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer, + * and Buffer#slice creates mutable copy. Never use Buffers! + */ +function copyBytes(bytes) { + return Uint8Array.from(bytes); +} +/** Copies several Uint8Arrays into one. */ +function concatBytes(...arrays) { + let sum = 0; + for (let i = 0; i < arrays.length; i++) { + const a = arrays[i]; + abytes(a); + sum += a.length; + } + const res = new Uint8Array(sum); + for (let i = 0, pad = 0; i < arrays.length; i++) { + const a = arrays[i]; + res.set(a, pad); + pad += a.length; + } + return res; +} +/** + * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols + * Should be safe to use for things expected to be ASCII. + * Returns exact same result as utf8ToBytes for ASCII or throws. + */ +function asciiToBytes(ascii) { + return Uint8Array.from(ascii, (c, i) => { + const charCode = c.charCodeAt(0); + if (c.length !== 1 || charCode > 127) { + throw new Error(`string contains non-ASCII character "${ascii[i]}" with code ${charCode} at position ${i}`); + } + return charCode; + }); +} +// Is positive bigint +function isPosBig(n) { + return typeof n === "bigint" && _consts_js__WEBPACK_IMPORTED_MODULE_1__.N_0 <= n; +} +function inRange(n, min, max) { + return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max; +} +/** + * Asserts min <= n < max. NOTE: It's < max and not <= max. + * @example + * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n) + */ +function aInRange(title, n, min, max) { + // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)? + // consider P=256n, min=0n, max=P + // - a for min=0 would require -1: `inRange('x', x, -1n, P)` + // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)` + // - our way is the cleanest: `inRange('x', x, 0n, P) + if (!inRange(n, min, max)) { + throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n); + } +} +function validateObject(object, fields = {}, optFields = {}) { + if (!object || typeof object !== "object") { + throw new Error("expected valid options object"); + } + function checkField(fieldName, expectedType, isOpt) { + const val = object[fieldName]; + if (isOpt && val === undefined) + return; + const current = typeof val; + if (current !== expectedType || val === null) { + throw new Error(`param "${fieldName}" is invalid: expected ${expectedType}, got ${current}`); + } + } + const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt)); + iter(fields, false); + iter(optFields, true); +} +// createHasher function is now exported above with ahash +// /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */ +// export function randomBytes(bytesLength = 32): Uint8Array { +// const cr = typeof globalThis != null && (globalThis as any).crypto; +// if (!cr || typeof cr.getRandomValues !== "function") { +// throw new Error("crypto.getRandomValues must be defined"); +// } +// return cr.getRandomValues(new Uint8Array(bytesLength)); +// } +/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */ +async function randomBytesAsync(bytesLength = 32) { + const api = await (0,_misc_js__WEBPACK_IMPORTED_MODULE_0__.loadCrypto)(); + const rnd = new Uint8Array(bytesLength); + api.getRandomValues(rnd); + return rnd; +} +// 06 09 60 86 48 01 65 03 04 02 +function oidNist(suffix) { + return { + oid: Uint8Array.from([ + 0x06, + 0x09, + 0x60, + 0x86, + 0x48, + 0x01, + 0x65, + 0x03, + 0x04, + 0x02, + suffix, + ]), + }; +} + + +/***/ }), + +/***/ 63807: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/tsyringe@4.10.0/node_modules/tsyringe/dist/esm5/decorators/scoped.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (/* binding */ scoped) +/* harmony export */ }); +/* harmony import */ var _injectable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./injectable */ 58930); +/* harmony import */ var _dependency_container__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../dependency-container */ 62625); + + +function scoped(lifecycle, token) { + return function (target) { + (0,_injectable__WEBPACK_IMPORTED_MODULE_0__["default"])()(target); + _dependency_container__WEBPACK_IMPORTED_MODULE_1__.instance.register(token || target, target, { + lifecycle: lifecycle + }); + }; +} + + +/***/ }), + +/***/ 63926: +/*!****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/constants/kzg.js ***! + \****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ versionedHashVersionKzg: () => (/* binding */ versionedHashVersionKzg) +/* harmony export */ }); +// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4844.md#parameters +const versionedHashVersionKzg = 1; +//# sourceMappingURL=kzg.js.map + +/***/ }), + +/***/ 64519: +/*!********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_freshest.js ***! + \********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ FreshestCRL: () => (/* binding */ FreshestCRL), +/* harmony export */ id_ce_freshestCRL: () => (/* binding */ id_ce_freshestCRL) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +/* harmony import */ var _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./crl_distribution_points.js */ 68671); +var FreshestCRL_1; + + + + +const id_ce_freshestCRL = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.46`; +let FreshestCRL = FreshestCRL_1 = class FreshestCRL extends _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_3__.CRLDistributionPoints { + constructor(items) { + super(items); + Object.setPrototypeOf(this, FreshestCRL_1.prototype); + } +}; +FreshestCRL = FreshestCRL_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _crl_distribution_points_js__WEBPACK_IMPORTED_MODULE_3__.DistributionPoint, + }) +], FreshestCRL); + + + +/***/ }), + +/***/ 64572: +/*!*****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/validity.js ***! + \*****************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Validity: () => (/* binding */ Validity) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _time_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./time.js */ 71371); + + + +class Validity { + notBefore = new _time_js__WEBPACK_IMPORTED_MODULE_2__.Time(new Date()); + notAfter = new _time_js__WEBPACK_IMPORTED_MODULE_2__.Time(new Date()); + constructor(params) { + if (params) { + this.notBefore = new _time_js__WEBPACK_IMPORTED_MODULE_2__.Time(params.notBefore); + this.notAfter = new _time_js__WEBPACK_IMPORTED_MODULE_2__.Time(params.notAfter); + } + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _time_js__WEBPACK_IMPORTED_MODULE_2__.Time }) +], Validity.prototype, "notBefore", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _time_js__WEBPACK_IMPORTED_MODULE_2__.Time }) +], Validity.prototype, "notAfter", void 0); + + +/***/ }), + +/***/ 65061: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@solana+errors@2.3.0_typescript@5.4.3/node_modules/@solana/errors/dist/index.browser.mjs ***! + \**********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED: () => (/* binding */ SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED), +/* harmony export */ SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT: () => (/* binding */ SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT), +/* harmony export */ SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT: () => (/* binding */ SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT), +/* harmony export */ SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED: () => (/* binding */ SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED), +/* harmony export */ SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS: () => (/* binding */ SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS), +/* harmony export */ SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY: () => (/* binding */ SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY), +/* harmony export */ SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS: () => (/* binding */ SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS), +/* harmony export */ SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE: () => (/* binding */ SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE), +/* harmony export */ SOLANA_ERROR__ADDRESSES__MALFORMED_PDA: () => (/* binding */ SOLANA_ERROR__ADDRESSES__MALFORMED_PDA), +/* harmony export */ SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED: () => (/* binding */ SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED), +/* harmony export */ SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED: () => (/* binding */ SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED), +/* harmony export */ SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER: () => (/* binding */ SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER), +/* harmony export */ SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED: () => (/* binding */ SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED), +/* harmony export */ SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY: () => (/* binding */ SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY), +/* harmony export */ SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS: () => (/* binding */ SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS), +/* harmony export */ SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL: () => (/* binding */ SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL), +/* harmony export */ SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH: () => (/* binding */ SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH), +/* harmony export */ SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH: () => (/* binding */ SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH), +/* harmony export */ SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH: () => (/* binding */ SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH), +/* harmony export */ SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH: () => (/* binding */ SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH), +/* harmony export */ SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH: () => (/* binding */ SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH), +/* harmony export */ SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE: () => (/* binding */ SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_CONSTANT: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_CONSTANT), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS), +/* harmony export */ SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE: () => (/* binding */ SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE), +/* harmony export */ SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES: () => (/* binding */ SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES), +/* harmony export */ SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID), +/* harmony export */ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR: () => (/* binding */ SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR), +/* harmony export */ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS: () => (/* binding */ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS), +/* harmony export */ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA: () => (/* binding */ SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA), +/* harmony export */ SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH: () => (/* binding */ SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH), +/* harmony export */ SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__INVALID_NONCE: () => (/* binding */ SOLANA_ERROR__INVALID_NONCE), +/* harmony export */ SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING: () => (/* binding */ SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING), +/* harmony export */ SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE: () => (/* binding */ SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE), +/* harmony export */ SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING: () => (/* binding */ SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING), +/* harmony export */ SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE: () => (/* binding */ SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR: () => (/* binding */ SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR), +/* harmony export */ SOLANA_ERROR__JSON_RPC__INVALID_PARAMS: () => (/* binding */ SOLANA_ERROR__JSON_RPC__INVALID_PARAMS), +/* harmony export */ SOLANA_ERROR__JSON_RPC__INVALID_REQUEST: () => (/* binding */ SOLANA_ERROR__JSON_RPC__INVALID_REQUEST), +/* harmony export */ SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__JSON_RPC__PARSE_ERROR: () => (/* binding */ SOLANA_ERROR__JSON_RPC__PARSE_ERROR), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SCAN_ERROR: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SCAN_ERROR), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE), +/* harmony export */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: () => (/* binding */ SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION), +/* harmony export */ SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH: () => (/* binding */ SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH), +/* harmony export */ SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY: () => (/* binding */ SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY), +/* harmony export */ SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__MALFORMED_BIGINT_STRING: () => (/* binding */ SOLANA_ERROR__MALFORMED_BIGINT_STRING), +/* harmony export */ SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR: () => (/* binding */ SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR), +/* harmony export */ SOLANA_ERROR__MALFORMED_NUMBER_STRING: () => (/* binding */ SOLANA_ERROR__MALFORMED_NUMBER_STRING), +/* harmony export */ SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN: () => (/* binding */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN), +/* harmony export */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED: () => (/* binding */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED), +/* harmony export */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED: () => (/* binding */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED), +/* harmony export */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT: () => (/* binding */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT), +/* harmony export */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID: () => (/* binding */ SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID), +/* harmony export */ SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD: () => (/* binding */ SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD), +/* harmony export */ SOLANA_ERROR__RPC__INTEGER_OVERFLOW: () => (/* binding */ SOLANA_ERROR__RPC__INTEGER_OVERFLOW), +/* harmony export */ SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR: () => (/* binding */ SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR), +/* harmony export */ SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN: () => (/* binding */ SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN), +/* harmony export */ SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS: () => (/* binding */ SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER: () => (/* binding */ SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER), +/* harmony export */ SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS: () => (/* binding */ SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS), +/* harmony export */ SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING: () => (/* binding */ SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING), +/* harmony export */ SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED: () => (/* binding */ SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED), +/* harmony export */ SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION: () => (/* binding */ SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION), +/* harmony export */ SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES: () => (/* binding */ SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES), +/* harmony export */ SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME: () => (/* binding */ SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME), +/* harmony export */ SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME: () => (/* binding */ SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE: () => (/* binding */ SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE), +/* harmony export */ SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES: () => (/* binding */ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES), +/* harmony export */ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE: () => (/* binding */ SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE), +/* harmony export */ SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH: () => (/* binding */ SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH), +/* harmony export */ SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING: () => (/* binding */ SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING), +/* harmony export */ SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE: () => (/* binding */ SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE), +/* harmony export */ SolanaError: () => (/* binding */ SolanaError), +/* harmony export */ getSolanaErrorFromInstructionError: () => (/* binding */ getSolanaErrorFromInstructionError), +/* harmony export */ getSolanaErrorFromJsonRpcError: () => (/* binding */ getSolanaErrorFromJsonRpcError), +/* harmony export */ getSolanaErrorFromTransactionError: () => (/* binding */ getSolanaErrorFromTransactionError), +/* harmony export */ isSolanaError: () => (/* binding */ isSolanaError), +/* harmony export */ safeCaptureStackTrace: () => (/* binding */ safeCaptureStackTrace) +/* harmony export */ }); +// src/codes.ts +var SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED = 1; +var SOLANA_ERROR__INVALID_NONCE = 2; +var SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND = 3; +var SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE = 4; +var SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH = 5; +var SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE = 6; +var SOLANA_ERROR__MALFORMED_BIGINT_STRING = 7; +var SOLANA_ERROR__MALFORMED_NUMBER_STRING = 8; +var SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE = 9; +var SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR = 10; +var SOLANA_ERROR__JSON_RPC__PARSE_ERROR = -32700; +var SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR = -32603; +var SOLANA_ERROR__JSON_RPC__INVALID_PARAMS = -32602; +var SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND = -32601; +var SOLANA_ERROR__JSON_RPC__INVALID_REQUEST = -32600; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED = -32016; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION = -32015; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET = -32014; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH = -32013; +var SOLANA_ERROR__JSON_RPC__SCAN_ERROR = -32012; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE = -32011; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX = -32010; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED = -32009; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT = -32008; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED = -32007; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE = -32006; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY = -32005; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE = -32004; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE = -32003; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE = -32002; +var SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP = -32001; +var SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH = 28e5; +var SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE = 2800001; +var SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS = 2800002; +var SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY = 2800003; +var SOLANA_ERROR__ADDRESSES__MALFORMED_PDA = 2800004; +var SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE = 2800005; +var SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED = 2800006; +var SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED = 2800007; +var SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE = 2800008; +var SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED = 2800009; +var SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER = 2800010; +var SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS = 2800011; +var SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND = 323e4; +var SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND = 32300001; +var SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT = 3230002; +var SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT = 3230003; +var SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED = 3230004; +var SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT = 361e4; +var SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED = 3610001; +var SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED = 3610002; +var SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED = 3610003; +var SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED = 3610004; +var SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED = 3610005; +var SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED = 3610006; +var SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY = 3610007; +var SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED = 3611e3; +var SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH = 3704e3; +var SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH = 3704001; +var SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH = 3704002; +var SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE = 3704003; +var SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY = 3704004; +var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS = 4128e3; +var SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA = 4128001; +var SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH = 4128002; +var SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN = 4615e3; +var SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR = 4615001; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT = 4615002; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA = 4615003; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA = 4615004; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL = 4615005; +var SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS = 4615006; +var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID = 4615007; +var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE = 4615008; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED = 4615009; +var SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT = 4615010; +var SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION = 4615011; +var SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID = 4615012; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND = 4615013; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED = 4615014; +var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE = 4615015; +var SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED = 4615016; +var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX = 4615017; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED = 4615018; +var SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED = 4615019; +var SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS = 4615020; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED = 4615021; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE = 4615022; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED = 4615023; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 4615024; +var SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC = 4615025; +var SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM = 4615026; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR = 4615027; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED = 4615028; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE = 4615029; +var SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT = 4615030; +var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID = 4615031; +var SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH = 4615032; +var SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT = 4615033; +var SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED = 4615034; +var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED = 4615035; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS = 4615036; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC = 4615037; +var SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED = 4615038; +var SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION = 4615039; +var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE = 4615040; +var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE = 4615041; +var SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE = 4615042; +var SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE = 4615043; +var SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY = 4615044; +var SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR = 4615045; +var SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT = 4615046; +var SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER = 4615047; +var SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW = 4615048; +var SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR = 4615049; +var SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER = 4615050; +var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED = 4615051; +var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED = 4615052; +var SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED = 4615053; +var SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS = 4615054; +var SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS = 5508e3; +var SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER = 5508001; +var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER = 5508002; +var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER = 5508003; +var SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER = 5508004; +var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER = 5508005; +var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER = 5508006; +var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER = 5508007; +var SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER = 5508008; +var SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS = 5508009; +var SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING = 5508010; +var SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED = 5508011; +var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES = 5663e3; +var SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE = 5663001; +var SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME = 5663002; +var SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME = 5663003; +var SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE = 5663004; +var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING = 5663005; +var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE = 5663006; +var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND = 5663007; +var SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING = 5663008; +var SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING = 5663009; +var SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING = 5663010; +var SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING = 5663011; +var SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING = 5663012; +var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING = 5663013; +var SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE = 5663014; +var SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION = 5663015; +var SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES = 5663016; +var SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH = 5663017; +var SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT = 5663018; +var SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT = 5663019; +var SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT = 5663020; +var SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN = 705e4; +var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE = 7050001; +var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE = 7050002; +var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND = 7050003; +var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND = 7050004; +var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE = 7050005; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE = 7050006; +var SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED = 7050007; +var SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND = 7050008; +var SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP = 7050009; +var SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE = 7050010; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX = 7050011; +var SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE = 7050012; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION = 7050013; +var SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE = 7050014; +var SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE = 7050015; +var SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING = 7050016; +var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT = 7050017; +var SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION = 7050018; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT = 7050019; +var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT = 7050020; +var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT = 7050021; +var SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS = 7050022; +var SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND = 7050023; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER = 7050024; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA = 7050025; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX = 7050026; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT = 7050027; +var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT = 7050028; +var SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT = 7050029; +var SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION = 7050030; +var SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT = 7050031; +var SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED = 7050032; +var SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT = 7050033; +var SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED = 7050034; +var SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 7050035; +var SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION = 7050036; +var SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY = 8078e3; +var SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH = 8078001; +var SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH = 8078002; +var SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH = 8078003; +var SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH = 8078004; +var SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH = 8078005; +var SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH = 8078006; +var SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS = 8078007; +var SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE = 8078008; +var SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT = 8078009; +var SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT = 8078010; +var SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE = 8078011; +var SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE = 8078012; +var SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH = 8078013; +var SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE = 8078014; +var SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT = 8078015; +var SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE = 8078016; +var SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE = 8078017; +var SOLANA_ERROR__CODECS__INVALID_CONSTANT = 8078018; +var SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE = 8078019; +var SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL = 8078020; +var SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES = 8078021; +var SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS = 8078022; +var SOLANA_ERROR__RPC__INTEGER_OVERFLOW = 81e5; +var SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN = 8100001; +var SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR = 8100002; +var SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD = 8100003; +var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN = 819e4; +var SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID = 8190001; +var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED = 8190002; +var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED = 8190003; +var SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT = 8190004; +var SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING = 99e5; +var SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE = 9900001; +var SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING = 9900002; +var SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE = 9900003; +var SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED = 9900004; + +// src/context.ts +function encodeValue(value) { + if (Array.isArray(value)) { + const commaSeparatedValues = value.map(encodeValue).join( + "%2C%20" + /* ", " */ + ); + return "%5B" + commaSeparatedValues + /* "]" */ + "%5D"; + } else if (typeof value === "bigint") { + return `${value}n`; + } else { + return encodeURIComponent( + String( + value != null && Object.getPrototypeOf(value) === null ? ( + // Plain objects with no prototype don't have a `toString` method. + // Convert them before stringifying them. + { ...value } + ) : value + ) + ); + } +} +function encodeObjectContextEntry([key, value]) { + return `${key}=${encodeValue(value)}`; +} +function encodeContextObject(context) { + const searchParamsString = Object.entries(context).map(encodeObjectContextEntry).join("&"); + return btoa(searchParamsString); +} + +// src/messages.ts +var SolanaErrorMessages = { + [SOLANA_ERROR__ACCOUNTS__ACCOUNT_NOT_FOUND]: "Account not found at address: $address", + [SOLANA_ERROR__ACCOUNTS__EXPECTED_ALL_ACCOUNTS_TO_BE_DECODED]: "Not all accounts were decoded. Encoded accounts found at addresses: $addresses.", + [SOLANA_ERROR__ACCOUNTS__EXPECTED_DECODED_ACCOUNT]: "Expected decoded account at address: $address", + [SOLANA_ERROR__ACCOUNTS__FAILED_TO_DECODE_ACCOUNT]: "Failed to decode account data at address: $address", + [SOLANA_ERROR__ACCOUNTS__ONE_OR_MORE_ACCOUNTS_NOT_FOUND]: "Accounts not found at addresses: $addresses", + [SOLANA_ERROR__ADDRESSES__FAILED_TO_FIND_VIABLE_PDA_BUMP_SEED]: "Unable to find a viable program address bump seed.", + [SOLANA_ERROR__ADDRESSES__INVALID_BASE58_ENCODED_ADDRESS]: "$putativeAddress is not a base58-encoded address.", + [SOLANA_ERROR__ADDRESSES__INVALID_BYTE_LENGTH]: "Expected base58 encoded address to decode to a byte array of length 32. Actual length: $actualLength.", + [SOLANA_ERROR__ADDRESSES__INVALID_ED25519_PUBLIC_KEY]: "The `CryptoKey` must be an `Ed25519` public key.", + [SOLANA_ERROR__ADDRESSES__INVALID_OFF_CURVE_ADDRESS]: "$putativeOffCurveAddress is not a base58-encoded off-curve address.", + [SOLANA_ERROR__ADDRESSES__INVALID_SEEDS_POINT_ON_CURVE]: "Invalid seeds; point must fall off the Ed25519 curve.", + [SOLANA_ERROR__ADDRESSES__MALFORMED_PDA]: "Expected given program derived address to have the following format: [Address, ProgramDerivedAddressBump].", + [SOLANA_ERROR__ADDRESSES__MAX_NUMBER_OF_PDA_SEEDS_EXCEEDED]: "A maximum of $maxSeeds seeds, including the bump seed, may be supplied when creating an address. Received: $actual.", + [SOLANA_ERROR__ADDRESSES__MAX_PDA_SEED_LENGTH_EXCEEDED]: "The seed at index $index with length $actual exceeds the maximum length of $maxSeedLength bytes.", + [SOLANA_ERROR__ADDRESSES__PDA_BUMP_SEED_OUT_OF_RANGE]: "Expected program derived address bump to be in the range [0, 255], got: $bump.", + [SOLANA_ERROR__ADDRESSES__PDA_ENDS_WITH_PDA_MARKER]: "Program address cannot end with PDA marker.", + [SOLANA_ERROR__ADDRESSES__STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded address string of length in the range [32, 44]. Actual length: $actualLength.", + [SOLANA_ERROR__BLOCKHASH_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded blockash string of length in the range [32, 44]. Actual length: $actualLength.", + [SOLANA_ERROR__BLOCK_HEIGHT_EXCEEDED]: "The network has progressed past the last block for which this transaction could have been committed.", + [SOLANA_ERROR__CODECS__CANNOT_DECODE_EMPTY_BYTE_ARRAY]: "Codec [$codecDescription] cannot decode empty byte arrays.", + [SOLANA_ERROR__CODECS__CANNOT_USE_LEXICAL_VALUES_AS_ENUM_DISCRIMINATORS]: "Enum codec cannot use lexical values [$stringValues] as discriminators. Either remove all lexical values or set `useValuesAsDiscriminators` to `false`.", + [SOLANA_ERROR__CODECS__ENCODED_BYTES_MUST_NOT_INCLUDE_SENTINEL]: "Sentinel [$hexSentinel] must not be present in encoded bytes [$hexEncodedBytes].", + [SOLANA_ERROR__CODECS__ENCODER_DECODER_FIXED_SIZE_MISMATCH]: "Encoder and decoder must have the same fixed size, got [$encoderFixedSize] and [$decoderFixedSize].", + [SOLANA_ERROR__CODECS__ENCODER_DECODER_MAX_SIZE_MISMATCH]: "Encoder and decoder must have the same max size, got [$encoderMaxSize] and [$decoderMaxSize].", + [SOLANA_ERROR__CODECS__ENCODER_DECODER_SIZE_COMPATIBILITY_MISMATCH]: "Encoder and decoder must either both be fixed-size or variable-size.", + [SOLANA_ERROR__CODECS__ENUM_DISCRIMINATOR_OUT_OF_RANGE]: "Enum discriminator out of range. Expected a number in [$formattedValidDiscriminators], got $discriminator.", + [SOLANA_ERROR__CODECS__EXPECTED_FIXED_LENGTH]: "Expected a fixed-size codec, got a variable-size one.", + [SOLANA_ERROR__CODECS__EXPECTED_POSITIVE_BYTE_LENGTH]: "Codec [$codecDescription] expected a positive byte length, got $bytesLength.", + [SOLANA_ERROR__CODECS__EXPECTED_VARIABLE_LENGTH]: "Expected a variable-size codec, got a fixed-size one.", + [SOLANA_ERROR__CODECS__EXPECTED_ZERO_VALUE_TO_MATCH_ITEM_FIXED_SIZE]: "Codec [$codecDescription] expected zero-value [$hexZeroValue] to have the same size as the provided fixed-size item [$expectedSize bytes].", + [SOLANA_ERROR__CODECS__INVALID_BYTE_LENGTH]: "Codec [$codecDescription] expected $expected bytes, got $bytesLength.", + [SOLANA_ERROR__CODECS__INVALID_CONSTANT]: "Expected byte array constant [$hexConstant] to be present in data [$hexData] at offset [$offset].", + [SOLANA_ERROR__CODECS__INVALID_DISCRIMINATED_UNION_VARIANT]: "Invalid discriminated union variant. Expected one of [$variants], got $value.", + [SOLANA_ERROR__CODECS__INVALID_ENUM_VARIANT]: "Invalid enum variant. Expected one of [$stringValues] or a number in [$formattedNumericalValues], got $variant.", + [SOLANA_ERROR__CODECS__INVALID_LITERAL_UNION_VARIANT]: "Invalid literal union variant. Expected one of [$variants], got $value.", + [SOLANA_ERROR__CODECS__INVALID_NUMBER_OF_ITEMS]: "Expected [$codecDescription] to have $expected items, got $actual.", + [SOLANA_ERROR__CODECS__INVALID_STRING_FOR_BASE]: "Invalid value $value for base $base with alphabet $alphabet.", + [SOLANA_ERROR__CODECS__LITERAL_UNION_DISCRIMINATOR_OUT_OF_RANGE]: "Literal union discriminator out of range. Expected a number between $minRange and $maxRange, got $discriminator.", + [SOLANA_ERROR__CODECS__NUMBER_OUT_OF_RANGE]: "Codec [$codecDescription] expected number to be in the range [$min, $max], got $value.", + [SOLANA_ERROR__CODECS__OFFSET_OUT_OF_RANGE]: "Codec [$codecDescription] expected offset to be in the range [0, $bytesLength], got $offset.", + [SOLANA_ERROR__CODECS__SENTINEL_MISSING_IN_DECODED_BYTES]: "Expected sentinel [$hexSentinel] to be present in decoded bytes [$hexDecodedBytes].", + [SOLANA_ERROR__CODECS__UNION_VARIANT_OUT_OF_RANGE]: "Union variant out of range. Expected an index between $minRange and $maxRange, got $variant.", + [SOLANA_ERROR__CRYPTO__RANDOM_VALUES_FUNCTION_UNIMPLEMENTED]: "No random values implementation could be found.", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_ALREADY_INITIALIZED]: "instruction requires an uninitialized account", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_FAILED]: "instruction tries to borrow reference for an account which is already borrowed", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "instruction left account with an outstanding borrowed reference", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_SIZE_CHANGED]: "program other than the account's owner changed the size of the account data", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_DATA_TOO_SMALL]: "account data too small for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_EXECUTABLE]: "instruction expected an executable account", + [SOLANA_ERROR__INSTRUCTION_ERROR__ACCOUNT_NOT_RENT_EXEMPT]: "An account does not have enough lamports to be rent-exempt", + [SOLANA_ERROR__INSTRUCTION_ERROR__ARITHMETIC_OVERFLOW]: "Program arithmetic overflowed", + [SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR]: "Failed to serialize or deserialize account data: $encodedData", + [SOLANA_ERROR__INSTRUCTION_ERROR__BUILTIN_PROGRAMS_MUST_CONSUME_COMPUTE_UNITS]: "Builtin programs must consume compute units", + [SOLANA_ERROR__INSTRUCTION_ERROR__CALL_DEPTH]: "Cross-program invocation call depth too deep", + [SOLANA_ERROR__INSTRUCTION_ERROR__COMPUTATIONAL_BUDGET_EXCEEDED]: "Computational budget exceeded", + [SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM]: "custom program error: #$code", + [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_INDEX]: "instruction contains duplicate accounts", + [SOLANA_ERROR__INSTRUCTION_ERROR__DUPLICATE_ACCOUNT_OUT_OF_SYNC]: "instruction modifications of multiply-passed account differ", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_ACCOUNT_NOT_RENT_EXEMPT]: "executable accounts must be rent exempt", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_DATA_MODIFIED]: "instruction changed executable accounts data", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_LAMPORT_CHANGE]: "instruction changed the balance of an executable account", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXECUTABLE_MODIFIED]: "instruction changed executable bit of an account", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_DATA_MODIFIED]: "instruction modified data of an account it does not own", + [SOLANA_ERROR__INSTRUCTION_ERROR__EXTERNAL_ACCOUNT_LAMPORT_SPEND]: "instruction spent from the balance of an account it does not own", + [SOLANA_ERROR__INSTRUCTION_ERROR__GENERIC_ERROR]: "generic instruction error", + [SOLANA_ERROR__INSTRUCTION_ERROR__ILLEGAL_OWNER]: "Provided owner is not allowed", + [SOLANA_ERROR__INSTRUCTION_ERROR__IMMUTABLE]: "Account is immutable", + [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_AUTHORITY]: "Incorrect authority provided", + [SOLANA_ERROR__INSTRUCTION_ERROR__INCORRECT_PROGRAM_ID]: "incorrect program id for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__INSUFFICIENT_FUNDS]: "insufficient funds for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_DATA]: "invalid account data for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ACCOUNT_OWNER]: "Invalid account owner", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ARGUMENT]: "invalid program argument", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_ERROR]: "program returned invalid error code", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_INSTRUCTION_DATA]: "invalid instruction data", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_REALLOC]: "Failed to reallocate account data", + [SOLANA_ERROR__INSTRUCTION_ERROR__INVALID_SEEDS]: "Provided seeds do not result in a valid address", + [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_DATA_ALLOCATIONS_EXCEEDED]: "Accounts data allocations exceeded the maximum allowed per transaction", + [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_ACCOUNTS_EXCEEDED]: "Max accounts exceeded", + [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_INSTRUCTION_TRACE_LENGTH_EXCEEDED]: "Max instruction trace length exceeded", + [SOLANA_ERROR__INSTRUCTION_ERROR__MAX_SEED_LENGTH_EXCEEDED]: "Length of the seed is too long for address generation", + [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_ACCOUNT]: "An account required by the instruction is missing", + [SOLANA_ERROR__INSTRUCTION_ERROR__MISSING_REQUIRED_SIGNATURE]: "missing required signature for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__MODIFIED_PROGRAM_ID]: "instruction illegally modified the program id of an account", + [SOLANA_ERROR__INSTRUCTION_ERROR__NOT_ENOUGH_ACCOUNT_KEYS]: "insufficient account keys for instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__PRIVILEGE_ESCALATION]: "Cross-program invocation with unauthorized signer or writable account", + [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_ENVIRONMENT_SETUP_FAILURE]: "Failed to create program execution environment", + [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPILE]: "Program failed to compile", + [SOLANA_ERROR__INSTRUCTION_ERROR__PROGRAM_FAILED_TO_COMPLETE]: "Program failed to complete", + [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_DATA_MODIFIED]: "instruction modified data of a read-only account", + [SOLANA_ERROR__INSTRUCTION_ERROR__READONLY_LAMPORT_CHANGE]: "instruction changed the balance of a read-only account", + [SOLANA_ERROR__INSTRUCTION_ERROR__REENTRANCY_NOT_ALLOWED]: "Cross-program invocation reentrancy not allowed for this instruction", + [SOLANA_ERROR__INSTRUCTION_ERROR__RENT_EPOCH_MODIFIED]: "instruction modified rent epoch of an account", + [SOLANA_ERROR__INSTRUCTION_ERROR__UNBALANCED_INSTRUCTION]: "sum of account balances before and after instruction do not match", + [SOLANA_ERROR__INSTRUCTION_ERROR__UNINITIALIZED_ACCOUNT]: "instruction requires an initialized account", + [SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN]: "", + [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_PROGRAM_ID]: "Unsupported program id", + [SOLANA_ERROR__INSTRUCTION_ERROR__UNSUPPORTED_SYSVAR]: "Unsupported sysvar", + [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_ACCOUNTS]: "The instruction does not have any accounts.", + [SOLANA_ERROR__INSTRUCTION__EXPECTED_TO_HAVE_DATA]: "The instruction does not have any data.", + [SOLANA_ERROR__INSTRUCTION__PROGRAM_ID_MISMATCH]: "Expected instruction to have progress address $expectedProgramAddress, got $actualProgramAddress.", + [SOLANA_ERROR__INVALID_BLOCKHASH_BYTE_LENGTH]: "Expected base58 encoded blockhash to decode to a byte array of length 32. Actual length: $actualLength.", + [SOLANA_ERROR__INVALID_NONCE]: "The nonce `$expectedNonceValue` is no longer valid. It has advanced to `$actualNonceValue`", + [SOLANA_ERROR__INVARIANT_VIOLATION__CACHED_ABORTABLE_ITERABLE_CACHE_ENTRY_MISSING]: "Invariant violation: Found no abortable iterable cache entry for key `$cacheKey`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant", + [SOLANA_ERROR__INVARIANT_VIOLATION__DATA_PUBLISHER_CHANNEL_UNIMPLEMENTED]: "Invariant violation: This data publisher does not publish to the channel named `$channelName`. Supported channels include $supportedChannelNames.", + [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_MUST_NOT_POLL_BEFORE_RESOLVING_EXISTING_MESSAGE_PROMISE]: "Invariant violation: WebSocket message iterator state is corrupt; iterated without first resolving existing message promise. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant", + [SOLANA_ERROR__INVARIANT_VIOLATION__SUBSCRIPTION_ITERATOR_STATE_MISSING]: "Invariant violation: WebSocket message iterator is missing state storage. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant", + [SOLANA_ERROR__INVARIANT_VIOLATION__SWITCH_MUST_BE_EXHAUSTIVE]: "Invariant violation: Switch statement non-exhaustive. Received unexpected value `$unexpectedValue`. It should be impossible to hit this error; please file an issue at https://sola.na/web3invariant", + [SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR]: "JSON-RPC error: Internal JSON-RPC error ($__serverMessage)", + [SOLANA_ERROR__JSON_RPC__INVALID_PARAMS]: "JSON-RPC error: Invalid method parameter(s) ($__serverMessage)", + [SOLANA_ERROR__JSON_RPC__INVALID_REQUEST]: "JSON-RPC error: The JSON sent is not a valid `Request` object ($__serverMessage)", + [SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND]: "JSON-RPC error: The method does not exist / is not available ($__serverMessage)", + [SOLANA_ERROR__JSON_RPC__PARSE_ERROR]: "JSON-RPC error: An error occurred on the server while parsing the JSON text ($__serverMessage)", + [SOLANA_ERROR__JSON_RPC__SCAN_ERROR]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED]: "Minimum context slot has not been reached", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NODE_UNHEALTHY]: "Node is unhealthy; behind by $numSlotsBehind slots", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_NO_SNAPSHOT]: "No snapshot", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE]: "Transaction simulation failed", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE]: "Transaction history is not available from this node", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE]: "$__serverMessage", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH]: "Transaction signature length mismatch", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE]: "Transaction signature verification failure", + [SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION]: "$__serverMessage", + [SOLANA_ERROR__KEYS__INVALID_KEY_PAIR_BYTE_LENGTH]: "Key pair bytes must be of length 64, got $byteLength.", + [SOLANA_ERROR__KEYS__INVALID_PRIVATE_KEY_BYTE_LENGTH]: "Expected private key bytes with length 32. Actual length: $actualLength.", + [SOLANA_ERROR__KEYS__INVALID_SIGNATURE_BYTE_LENGTH]: "Expected base58-encoded signature to decode to a byte array of length 64. Actual length: $actualLength.", + [SOLANA_ERROR__KEYS__PUBLIC_KEY_MUST_MATCH_PRIVATE_KEY]: "The provided private key does not match the provided public key.", + [SOLANA_ERROR__KEYS__SIGNATURE_STRING_LENGTH_OUT_OF_RANGE]: "Expected base58-encoded signature string of length in the range [64, 88]. Actual length: $actualLength.", + [SOLANA_ERROR__LAMPORTS_OUT_OF_RANGE]: "Lamports value must be in the range [0, 2e64-1]", + [SOLANA_ERROR__MALFORMED_BIGINT_STRING]: "`$value` cannot be parsed as a `BigInt`", + [SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR]: "$message", + [SOLANA_ERROR__MALFORMED_NUMBER_STRING]: "`$value` cannot be parsed as a `Number`", + [SOLANA_ERROR__NONCE_ACCOUNT_NOT_FOUND]: "No nonce account could be found at address `$nonceAccountAddress`", + [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CANNOT_CREATE_SUBSCRIPTION_PLAN]: "The notification name must end in 'Notifications' and the API must supply a subscription plan creator function for the notification '$notificationName'.", + [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CLOSED_BEFORE_MESSAGE_BUFFERED]: "WebSocket was closed before payload could be added to the send buffer", + [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_CONNECTION_CLOSED]: "WebSocket connection closed", + [SOLANA_ERROR__RPC_SUBSCRIPTIONS__CHANNEL_FAILED_TO_CONNECT]: "WebSocket failed to connect", + [SOLANA_ERROR__RPC_SUBSCRIPTIONS__EXPECTED_SERVER_SUBSCRIPTION_ID]: "Failed to obtain a subscription id from the server", + [SOLANA_ERROR__RPC__API_PLAN_MISSING_FOR_RPC_METHOD]: "Could not find an API plan for RPC method: `$method`", + [SOLANA_ERROR__RPC__INTEGER_OVERFLOW]: "The $argumentLabel argument to the `$methodName` RPC method$optionalPathLabel was `$value`. This number is unsafe for use with the Solana JSON-RPC because it exceeds `Number.MAX_SAFE_INTEGER`.", + [SOLANA_ERROR__RPC__TRANSPORT_HTTP_ERROR]: "HTTP error ($statusCode): $message", + [SOLANA_ERROR__RPC__TRANSPORT_HTTP_HEADER_FORBIDDEN]: "HTTP header(s) forbidden: $headers. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.", + [SOLANA_ERROR__SIGNER__ADDRESS_CANNOT_HAVE_MULTIPLE_SIGNERS]: "Multiple distinct signers were identified for address `$address`. Please ensure that you are using the same signer instance for each address.", + [SOLANA_ERROR__SIGNER__EXPECTED_KEY_PAIR_SIGNER]: "The provided value does not implement the `KeyPairSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_MODIFYING_SIGNER]: "The provided value does not implement the `MessageModifyingSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_PARTIAL_SIGNER]: "The provided value does not implement the `MessagePartialSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_MESSAGE_SIGNER]: "The provided value does not implement any of the `MessageSigner` interfaces", + [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_MODIFYING_SIGNER]: "The provided value does not implement the `TransactionModifyingSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_PARTIAL_SIGNER]: "The provided value does not implement the `TransactionPartialSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SENDING_SIGNER]: "The provided value does not implement the `TransactionSendingSigner` interface", + [SOLANA_ERROR__SIGNER__EXPECTED_TRANSACTION_SIGNER]: "The provided value does not implement any of the `TransactionSigner` interfaces", + [SOLANA_ERROR__SIGNER__TRANSACTION_CANNOT_HAVE_MULTIPLE_SENDING_SIGNERS]: "More than one `TransactionSendingSigner` was identified.", + [SOLANA_ERROR__SIGNER__TRANSACTION_SENDING_SIGNER_MISSING]: "No `TransactionSendingSigner` was identified. Please provide a valid `TransactionWithSingleSendingSigner` transaction.", + [SOLANA_ERROR__SIGNER__WALLET_MULTISIGN_UNIMPLEMENTED]: "Wallet account signers do not support signing multiple messages/transactions in a single operation", + [SOLANA_ERROR__SUBTLE_CRYPTO__CANNOT_EXPORT_NON_EXTRACTABLE_KEY]: "Cannot export a non-extractable key.", + [SOLANA_ERROR__SUBTLE_CRYPTO__DIGEST_UNIMPLEMENTED]: "No digest implementation could be found.", + [SOLANA_ERROR__SUBTLE_CRYPTO__DISALLOWED_IN_INSECURE_CONTEXT]: "Cryptographic operations are only allowed in secure browser contexts. Read more here: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts.", + [SOLANA_ERROR__SUBTLE_CRYPTO__ED25519_ALGORITHM_UNIMPLEMENTED]: "This runtime does not support the generation of Ed25519 key pairs.\n\nInstall @solana/webcrypto-ed25519-polyfill and call its `install` function before generating keys in environments that do not support Ed25519.\n\nFor a list of runtimes that currently support Ed25519 operations, visit https://github.com/WICG/webcrypto-secure-curves/issues/20.", + [SOLANA_ERROR__SUBTLE_CRYPTO__EXPORT_FUNCTION_UNIMPLEMENTED]: "No signature verification implementation could be found.", + [SOLANA_ERROR__SUBTLE_CRYPTO__GENERATE_FUNCTION_UNIMPLEMENTED]: "No key generation implementation could be found.", + [SOLANA_ERROR__SUBTLE_CRYPTO__SIGN_FUNCTION_UNIMPLEMENTED]: "No signing implementation could be found.", + [SOLANA_ERROR__SUBTLE_CRYPTO__VERIFY_FUNCTION_UNIMPLEMENTED]: "No key export implementation could be found.", + [SOLANA_ERROR__TIMESTAMP_OUT_OF_RANGE]: "Timestamp value must be in the range [-(2n ** 63n), (2n ** 63n) - 1]. `$value` given", + [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_BORROW_OUTSTANDING]: "Transaction processing left an account with an outstanding borrowed reference", + [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_IN_USE]: "Account in use", + [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_LOADED_TWICE]: "Account loaded twice", + [SOLANA_ERROR__TRANSACTION_ERROR__ACCOUNT_NOT_FOUND]: "Attempt to debit an account but found no record of a prior credit.", + [SOLANA_ERROR__TRANSACTION_ERROR__ADDRESS_LOOKUP_TABLE_NOT_FOUND]: "Transaction loads an address table account that doesn't exist", + [SOLANA_ERROR__TRANSACTION_ERROR__ALREADY_PROCESSED]: "This transaction has already been processed", + [SOLANA_ERROR__TRANSACTION_ERROR__BLOCKHASH_NOT_FOUND]: "Blockhash not found", + [SOLANA_ERROR__TRANSACTION_ERROR__CALL_CHAIN_TOO_DEEP]: "Loader call chain is too deep", + [SOLANA_ERROR__TRANSACTION_ERROR__CLUSTER_MAINTENANCE]: "Transactions are currently disabled due to cluster maintenance", + [SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION]: "Transaction contains a duplicate instruction ($index) that is not allowed", + [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_FEE]: "Insufficient funds for fee", + [SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT]: "Transaction results in an account ($accountIndex) with insufficient funds for rent", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_FOR_FEE]: "This account may not be used to pay transaction fees", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ACCOUNT_INDEX]: "Transaction contains an invalid account reference", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_DATA]: "Transaction loads an address table account with invalid data", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_INDEX]: "Transaction address table lookup uses an invalid index", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_ADDRESS_LOOKUP_TABLE_OWNER]: "Transaction loads an address table account with an invalid owner", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_LOADED_ACCOUNTS_DATA_SIZE_LIMIT]: "LoadedAccountsDataSizeLimit set for transaction must be greater than 0.", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_PROGRAM_FOR_EXECUTION]: "This program may not be used for executing instructions", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_RENT_PAYING_ACCOUNT]: "Transaction leaves an account with a lower balance than rent-exempt minimum", + [SOLANA_ERROR__TRANSACTION_ERROR__INVALID_WRITABLE_ACCOUNT]: "Transaction loads a writable account that cannot be written", + [SOLANA_ERROR__TRANSACTION_ERROR__MAX_LOADED_ACCOUNTS_DATA_SIZE_EXCEEDED]: "Transaction exceeded max loaded accounts data size cap", + [SOLANA_ERROR__TRANSACTION_ERROR__MISSING_SIGNATURE_FOR_FEE]: "Transaction requires a fee but has no signature present", + [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_ACCOUNT_NOT_FOUND]: "Attempt to load a program that does not exist", + [SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED]: "Execution of the program referenced by account at index $accountIndex is temporarily restricted.", + [SOLANA_ERROR__TRANSACTION_ERROR__RESANITIZATION_NEEDED]: "ResanitizationNeeded", + [SOLANA_ERROR__TRANSACTION_ERROR__SANITIZE_FAILURE]: "Transaction failed to sanitize accounts offsets correctly", + [SOLANA_ERROR__TRANSACTION_ERROR__SIGNATURE_FAILURE]: "Transaction did not pass signature verification", + [SOLANA_ERROR__TRANSACTION_ERROR__TOO_MANY_ACCOUNT_LOCKS]: "Transaction locked too many accounts", + [SOLANA_ERROR__TRANSACTION_ERROR__UNBALANCED_TRANSACTION]: "Sum of account balances before and after transaction do not match", + [SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN]: "The transaction failed with the error `$errorName`", + [SOLANA_ERROR__TRANSACTION_ERROR__UNSUPPORTED_VERSION]: "Transaction version is unsupported", + [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_BLOCK_LIMIT]: "Transaction would exceed account data limit within the block", + [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_ACCOUNT_DATA_TOTAL_LIMIT]: "Transaction would exceed total account data limit", + [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_ACCOUNT_COST_LIMIT]: "Transaction would exceed max account limit within the block", + [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_BLOCK_COST_LIMIT]: "Transaction would exceed max Block Cost Limit", + [SOLANA_ERROR__TRANSACTION_ERROR__WOULD_EXCEED_MAX_VOTE_COST_LIMIT]: "Transaction would exceed max Vote Cost Limit", + [SOLANA_ERROR__TRANSACTION__ADDRESSES_CANNOT_SIGN_TRANSACTION]: "Attempted to sign a transaction with an address that is not a signer for it", + [SOLANA_ERROR__TRANSACTION__ADDRESS_MISSING]: "Transaction is missing an address at index: $index.", + [SOLANA_ERROR__TRANSACTION__CANNOT_ENCODE_WITH_EMPTY_SIGNATURES]: "Transaction has no expected signers therefore it cannot be encoded", + [SOLANA_ERROR__TRANSACTION__EXCEEDS_SIZE_LIMIT]: "Transaction size $transactionSize exceeds limit of $transactionSizeLimit bytes", + [SOLANA_ERROR__TRANSACTION__EXPECTED_BLOCKHASH_LIFETIME]: "Transaction does not have a blockhash lifetime", + [SOLANA_ERROR__TRANSACTION__EXPECTED_NONCE_LIFETIME]: "Transaction is not a durable nonce transaction", + [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_CONTENTS_MISSING]: "Contents of these address lookup tables unknown: $lookupTableAddresses", + [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_ADDRESS_LOOKUP_TABLE_INDEX_OUT_OF_RANGE]: "Lookup of address at index $highestRequestedIndex failed for lookup table `$lookupTableAddress`. Highest known index is $highestKnownIndex. The lookup table may have been extended since its contents were retrieved", + [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_FEE_PAYER_MISSING]: "No fee payer set in CompiledTransaction", + [SOLANA_ERROR__TRANSACTION__FAILED_TO_DECOMPILE_INSTRUCTION_PROGRAM_ADDRESS_NOT_FOUND]: "Could not find program address at index $index", + [SOLANA_ERROR__TRANSACTION__FAILED_TO_ESTIMATE_COMPUTE_LIMIT]: "Failed to estimate the compute unit consumption for this transaction message. This is likely because simulating the transaction failed. Inspect the `cause` property of this error to learn more", + [SOLANA_ERROR__TRANSACTION__FAILED_WHEN_SIMULATING_TO_ESTIMATE_COMPUTE_LIMIT]: "Transaction failed when it was simulated in order to estimate the compute unit consumption. The compute unit estimate provided is for a transaction that failed when simulated and may not be representative of the compute units this transaction would consume if successful. Inspect the `cause` property of this error to learn more", + [SOLANA_ERROR__TRANSACTION__FEE_PAYER_MISSING]: "Transaction is missing a fee payer.", + [SOLANA_ERROR__TRANSACTION__FEE_PAYER_SIGNATURE_MISSING]: "Could not determine this transaction's signature. Make sure that the transaction has been signed by its fee payer.", + [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_FIRST_INSTRUCTION_MUST_BE_ADVANCE_NONCE]: "Transaction first instruction is not advance nonce account instruction.", + [SOLANA_ERROR__TRANSACTION__INVALID_NONCE_TRANSACTION_INSTRUCTIONS_MISSING]: "Transaction with no instructions cannot be durable nonce transaction.", + [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_CANNOT_PAY_FEES]: "This transaction includes an address (`$programAddress`) which is both invoked and set as the fee payer. Program addresses may not pay fees", + [SOLANA_ERROR__TRANSACTION__INVOKED_PROGRAMS_MUST_NOT_BE_WRITABLE]: "This transaction includes an address (`$programAddress`) which is both invoked and marked writable. Program addresses may not be writable", + [SOLANA_ERROR__TRANSACTION__MESSAGE_SIGNATURES_MISMATCH]: "The transaction message expected the transaction to have $signerAddressesLength signatures, got $signaturesLength.", + [SOLANA_ERROR__TRANSACTION__SIGNATURES_MISSING]: "Transaction is missing signatures for addresses: $addresses.", + [SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_OUT_OF_RANGE]: "Transaction version must be in the range [0, 127]. `$actualVersion` given" +}; + +// src/message-formatter.ts +var START_INDEX = "i"; +var TYPE = "t"; +function getHumanReadableErrorMessage(code, context = {}) { + const messageFormatString = SolanaErrorMessages[code]; + if (messageFormatString.length === 0) { + return ""; + } + let state; + function commitStateUpTo(endIndex) { + if (state[TYPE] === 2 /* Variable */) { + const variableName = messageFormatString.slice(state[START_INDEX] + 1, endIndex); + fragments.push( + variableName in context ? ( + // eslint-disable-next-line @typescript-eslint/restrict-template-expressions + `${context[variableName]}` + ) : `$${variableName}` + ); + } else if (state[TYPE] === 1 /* Text */) { + fragments.push(messageFormatString.slice(state[START_INDEX], endIndex)); + } + } + const fragments = []; + messageFormatString.split("").forEach((char, ii) => { + if (ii === 0) { + state = { + [START_INDEX]: 0, + [TYPE]: messageFormatString[0] === "\\" ? 0 /* EscapeSequence */ : messageFormatString[0] === "$" ? 2 /* Variable */ : 1 /* Text */ + }; + return; + } + let nextState; + switch (state[TYPE]) { + case 0 /* EscapeSequence */: + nextState = { [START_INDEX]: ii, [TYPE]: 1 /* Text */ }; + break; + case 1 /* Text */: + if (char === "\\") { + nextState = { [START_INDEX]: ii, [TYPE]: 0 /* EscapeSequence */ }; + } else if (char === "$") { + nextState = { [START_INDEX]: ii, [TYPE]: 2 /* Variable */ }; + } + break; + case 2 /* Variable */: + if (char === "\\") { + nextState = { [START_INDEX]: ii, [TYPE]: 0 /* EscapeSequence */ }; + } else if (char === "$") { + nextState = { [START_INDEX]: ii, [TYPE]: 2 /* Variable */ }; + } else if (!char.match(/\w/)) { + nextState = { [START_INDEX]: ii, [TYPE]: 1 /* Text */ }; + } + break; + } + if (nextState) { + if (state !== nextState) { + commitStateUpTo(ii); + } + state = nextState; + } + }); + commitStateUpTo(); + return fragments.join(""); +} +function getErrorMessage(code, context = {}) { + if (true) { + return getHumanReadableErrorMessage(code, context); + } else // removed by dead control flow +{} +} + +// src/error.ts +function isSolanaError(e, code) { + const isSolanaError2 = e instanceof Error && e.name === "SolanaError"; + if (isSolanaError2) { + if (code !== void 0) { + return e.context.__code === code; + } + return true; + } + return false; +} +var SolanaError = class extends Error { + /** + * Indicates the root cause of this {@link SolanaError}, if any. + * + * For example, a transaction error might have an instruction error as its root cause. In this + * case, you will be able to access the instruction error on the transaction error as `cause`. + */ + cause = this.cause; + /** + * Contains context that can assist in understanding or recovering from a {@link SolanaError}. + */ + context; + constructor(...[code, contextAndErrorOptions]) { + let context; + let errorOptions; + if (contextAndErrorOptions) { + const { cause, ...contextRest } = contextAndErrorOptions; + if (cause) { + errorOptions = { cause }; + } + if (Object.keys(contextRest).length > 0) { + context = contextRest; + } + } + const message = getErrorMessage(code, context); + super(message, errorOptions); + this.context = { + __code: code, + ...context + }; + this.name = "SolanaError"; + } +}; + +// src/stack-trace.ts +function safeCaptureStackTrace(...args) { + if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") { + Error.captureStackTrace(...args); + } +} + +// src/rpc-enum-errors.ts +function getSolanaErrorFromRpcError({ errorCodeBaseOffset, getErrorContext, orderedErrorNames, rpcEnumError }, constructorOpt) { + let rpcErrorName; + let rpcErrorContext; + if (typeof rpcEnumError === "string") { + rpcErrorName = rpcEnumError; + } else { + rpcErrorName = Object.keys(rpcEnumError)[0]; + rpcErrorContext = rpcEnumError[rpcErrorName]; + } + const codeOffset = orderedErrorNames.indexOf(rpcErrorName); + const errorCode = errorCodeBaseOffset + codeOffset; + const errorContext = getErrorContext(errorCode, rpcErrorName, rpcErrorContext); + const err = new SolanaError(errorCode, errorContext); + safeCaptureStackTrace(err, constructorOpt); + return err; +} + +// src/instruction-error.ts +var ORDERED_ERROR_NAMES = [ + // Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/program/src/instruction.rs + // If this list ever gets too large, consider implementing a compression strategy like this: + // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47 + "GenericError", + "InvalidArgument", + "InvalidInstructionData", + "InvalidAccountData", + "AccountDataTooSmall", + "InsufficientFunds", + "IncorrectProgramId", + "MissingRequiredSignature", + "AccountAlreadyInitialized", + "UninitializedAccount", + "UnbalancedInstruction", + "ModifiedProgramId", + "ExternalAccountLamportSpend", + "ExternalAccountDataModified", + "ReadonlyLamportChange", + "ReadonlyDataModified", + "DuplicateAccountIndex", + "ExecutableModified", + "RentEpochModified", + "NotEnoughAccountKeys", + "AccountDataSizeChanged", + "AccountNotExecutable", + "AccountBorrowFailed", + "AccountBorrowOutstanding", + "DuplicateAccountOutOfSync", + "Custom", + "InvalidError", + "ExecutableDataModified", + "ExecutableLamportChange", + "ExecutableAccountNotRentExempt", + "UnsupportedProgramId", + "CallDepth", + "MissingAccount", + "ReentrancyNotAllowed", + "MaxSeedLengthExceeded", + "InvalidSeeds", + "InvalidRealloc", + "ComputationalBudgetExceeded", + "PrivilegeEscalation", + "ProgramEnvironmentSetupFailure", + "ProgramFailedToComplete", + "ProgramFailedToCompile", + "Immutable", + "IncorrectAuthority", + "BorshIoError", + "AccountNotRentExempt", + "InvalidAccountOwner", + "ArithmeticOverflow", + "UnsupportedSysvar", + "IllegalOwner", + "MaxAccountsDataAllocationsExceeded", + "MaxAccountsExceeded", + "MaxInstructionTraceLengthExceeded", + "BuiltinProgramsMustConsumeComputeUnits" +]; +function getSolanaErrorFromInstructionError(index, instructionError) { + const numberIndex = Number(index); + return getSolanaErrorFromRpcError( + { + errorCodeBaseOffset: 4615001, + getErrorContext(errorCode, rpcErrorName, rpcErrorContext) { + if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__UNKNOWN) { + return { + errorName: rpcErrorName, + index: numberIndex, + ...rpcErrorContext !== void 0 ? { instructionErrorContext: rpcErrorContext } : null + }; + } else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__CUSTOM) { + return { + code: Number(rpcErrorContext), + index: numberIndex + }; + } else if (errorCode === SOLANA_ERROR__INSTRUCTION_ERROR__BORSH_IO_ERROR) { + return { + encodedData: rpcErrorContext, + index: numberIndex + }; + } + return { index: numberIndex }; + }, + orderedErrorNames: ORDERED_ERROR_NAMES, + rpcEnumError: instructionError + }, + getSolanaErrorFromInstructionError + ); +} + +// src/transaction-error.ts +var ORDERED_ERROR_NAMES2 = [ + // Keep synced with RPC source: https://github.com/anza-xyz/agave/blob/master/sdk/src/transaction/error.rs + // If this list ever gets too large, consider implementing a compression strategy like this: + // https://gist.github.com/steveluscher/aaa7cbbb5433b1197983908a40860c47 + "AccountInUse", + "AccountLoadedTwice", + "AccountNotFound", + "ProgramAccountNotFound", + "InsufficientFundsForFee", + "InvalidAccountForFee", + "AlreadyProcessed", + "BlockhashNotFound", + // `InstructionError` intentionally omitted; delegated to `getSolanaErrorFromInstructionError` + "CallChainTooDeep", + "MissingSignatureForFee", + "InvalidAccountIndex", + "SignatureFailure", + "InvalidProgramForExecution", + "SanitizeFailure", + "ClusterMaintenance", + "AccountBorrowOutstanding", + "WouldExceedMaxBlockCostLimit", + "UnsupportedVersion", + "InvalidWritableAccount", + "WouldExceedMaxAccountCostLimit", + "WouldExceedAccountDataBlockLimit", + "TooManyAccountLocks", + "AddressLookupTableNotFound", + "InvalidAddressLookupTableOwner", + "InvalidAddressLookupTableData", + "InvalidAddressLookupTableIndex", + "InvalidRentPayingAccount", + "WouldExceedMaxVoteCostLimit", + "WouldExceedAccountDataTotalLimit", + "DuplicateInstruction", + "InsufficientFundsForRent", + "MaxLoadedAccountsDataSizeExceeded", + "InvalidLoadedAccountsDataSizeLimit", + "ResanitizationNeeded", + "ProgramExecutionTemporarilyRestricted", + "UnbalancedTransaction" +]; +function getSolanaErrorFromTransactionError(transactionError) { + if (typeof transactionError === "object" && "InstructionError" in transactionError) { + return getSolanaErrorFromInstructionError( + ...transactionError.InstructionError + ); + } + return getSolanaErrorFromRpcError( + { + errorCodeBaseOffset: 7050001, + getErrorContext(errorCode, rpcErrorName, rpcErrorContext) { + if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__UNKNOWN) { + return { + errorName: rpcErrorName, + ...rpcErrorContext !== void 0 ? { transactionErrorContext: rpcErrorContext } : null + }; + } else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__DUPLICATE_INSTRUCTION) { + return { + index: Number(rpcErrorContext) + }; + } else if (errorCode === SOLANA_ERROR__TRANSACTION_ERROR__INSUFFICIENT_FUNDS_FOR_RENT || errorCode === SOLANA_ERROR__TRANSACTION_ERROR__PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED) { + return { + accountIndex: Number(rpcErrorContext.account_index) + }; + } + }, + orderedErrorNames: ORDERED_ERROR_NAMES2, + rpcEnumError: transactionError + }, + getSolanaErrorFromTransactionError + ); +} + +// src/json-rpc-error.ts +function getSolanaErrorFromJsonRpcError(putativeErrorResponse) { + let out; + if (isRpcErrorResponse(putativeErrorResponse)) { + const { code: rawCode, data, message } = putativeErrorResponse; + const code = Number(rawCode); + if (code === SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE) { + const { err, ...preflightErrorContext } = data; + const causeObject = err ? { cause: getSolanaErrorFromTransactionError(err) } : null; + out = new SolanaError(SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE, { + ...preflightErrorContext, + ...causeObject + }); + } else { + let errorContext; + switch (code) { + case SOLANA_ERROR__JSON_RPC__INTERNAL_ERROR: + case SOLANA_ERROR__JSON_RPC__INVALID_PARAMS: + case SOLANA_ERROR__JSON_RPC__INVALID_REQUEST: + case SOLANA_ERROR__JSON_RPC__METHOD_NOT_FOUND: + case SOLANA_ERROR__JSON_RPC__PARSE_ERROR: + case SOLANA_ERROR__JSON_RPC__SCAN_ERROR: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_CLEANED_UP: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_NOT_AVAILABLE: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_SLOT_SKIPPED: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: + case SOLANA_ERROR__JSON_RPC__SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: + errorContext = { __serverMessage: message }; + break; + default: + if (typeof data === "object" && !Array.isArray(data)) { + errorContext = data; + } + } + out = new SolanaError(code, errorContext); + } + } else { + const message = typeof putativeErrorResponse === "object" && putativeErrorResponse !== null && "message" in putativeErrorResponse && typeof putativeErrorResponse.message === "string" ? putativeErrorResponse.message : "Malformed JSON-RPC error with no message attribute"; + out = new SolanaError(SOLANA_ERROR__MALFORMED_JSON_RPC_ERROR, { error: putativeErrorResponse, message }); + } + safeCaptureStackTrace(out, getSolanaErrorFromJsonRpcError); + return out; +} +function isRpcErrorResponse(value) { + return typeof value === "object" && value !== null && "code" in value && "message" in value && (typeof value.code === "number" || typeof value.code === "bigint") && typeof value.message === "string"; +} + + +//# sourceMappingURL=index.browser.mjs.map +//# sourceMappingURL=index.browser.mjs.map + +/***/ }), + +/***/ 65493: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/string_decoder@1.3.0/node_modules/string_decoder/lib/string_decoder.js ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 65615: +/*!****************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsaes_oaep.js ***! + \****************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ RSAES_OAEP: () => (/* binding */ RSAES_OAEP), +/* harmony export */ RsaEsOaepParams: () => (/* binding */ RsaEsOaepParams) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../object_identifiers.js */ 47618); +/* harmony import */ var _algorithms_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../algorithms.js */ 17852); + + + + + +class RsaEsOaepParams { + hashAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(_algorithms_js__WEBPACK_IMPORTED_MODULE_4__.sha1); + maskGenAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier({ + algorithm: _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_mgf1, + parameters: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnConvert.serialize(_algorithms_js__WEBPACK_IMPORTED_MODULE_4__.sha1), + }); + pSourceAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier(_algorithms_js__WEBPACK_IMPORTED_MODULE_4__.pSpecifiedEmpty); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier, context: 0, defaultValue: _algorithms_js__WEBPACK_IMPORTED_MODULE_4__.sha1, + }) +], RsaEsOaepParams.prototype, "hashAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier, context: 1, defaultValue: _algorithms_js__WEBPACK_IMPORTED_MODULE_4__.mgf1SHA1, + }) +], RsaEsOaepParams.prototype, "maskGenAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier, context: 2, defaultValue: _algorithms_js__WEBPACK_IMPORTED_MODULE_4__.pSpecifiedEmpty, + }) +], RsaEsOaepParams.prototype, "pSourceAlgorithm", void 0); +const RSAES_OAEP = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_2__.AlgorithmIdentifier({ + algorithm: _object_identifiers_js__WEBPACK_IMPORTED_MODULE_3__.id_RSAES_OAEP, + parameters: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnConvert.serialize(new RsaEsOaepParams()), +}); + + +/***/ }), + +/***/ 65779: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/pbkdf2@3.1.6/node_modules/pbkdf2/lib/to-buffer.js ***! + \*******************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(/*! safe-buffer */ 26859).Buffer); +var toBuffer = __webpack_require__(/*! to-buffer */ 33384); + +var useUint8Array = typeof Uint8Array !== 'undefined'; +var useArrayBuffer = useUint8Array && typeof ArrayBuffer !== 'undefined'; +var isView = useArrayBuffer && ArrayBuffer.isView; + +module.exports = function (thing, encoding, name) { + if ( + typeof thing === 'string' + || Buffer.isBuffer(thing) + || (useUint8Array && thing instanceof Uint8Array) + || (isView && isView(thing)) + ) { + return toBuffer(thing, encoding); + } + throw new TypeError(name + ' must be a string, a Buffer, a Uint8Array, or a DataView'); +}; + + +/***/ }), + +/***/ 66139: +/*!***********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/parameters/rsassa_pkcs1_v1_5.js ***! + \***********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DigestInfo: () => (/* binding */ DigestInfo) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-x509 */ 12824); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); + + + +class DigestInfo { + digestAlgorithm = new _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier(); + digest = new _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.OctetString(); + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnProp)({ type: _peculiar_asn1_x509__WEBPACK_IMPORTED_MODULE_1__.AlgorithmIdentifier }) +], DigestInfo.prototype, "digestAlgorithm", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_2__.OctetString }) +], DigestInfo.prototype, "digest", void 0); + + +/***/ }), + +/***/ 66162: +/*!*************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-cms@2.8.0/node_modules/@peculiar/asn1-cms/build/es2015/object_identifiers.js ***! + \*************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ id_authData: () => (/* binding */ id_authData), +/* harmony export */ id_ct_contentInfo: () => (/* binding */ id_ct_contentInfo), +/* harmony export */ id_data: () => (/* binding */ id_data), +/* harmony export */ id_digestedData: () => (/* binding */ id_digestedData), +/* harmony export */ id_encryptedData: () => (/* binding */ id_encryptedData), +/* harmony export */ id_envelopedData: () => (/* binding */ id_envelopedData), +/* harmony export */ id_signedData: () => (/* binding */ id_signedData) +/* harmony export */ }); +const id_ct_contentInfo = "1.2.840.113549.1.9.16.1.6"; +const id_data = "1.2.840.113549.1.7.1"; +const id_signedData = "1.2.840.113549.1.7.2"; +const id_envelopedData = "1.2.840.113549.1.7.3"; +const id_digestedData = "1.2.840.113549.1.7.5"; +const id_encryptedData = "1.2.840.113549.1.7.6"; +const id_authData = "1.2.840.113549.1.9.16.1.2"; + + +/***/ }), + +/***/ 66264: +/*!**************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack@5.102.1_@swc+core@1.15.43_@swc+helpers@0.5.23__webpack-cli@5.1.4/node_modules/webpack/hot/log.js ***! + \**************************************************************************************************************************************/ +/***/ ((module) => { + +/** @typedef {"info" | "warning" | "error"} LogLevel */ + +/** @type {LogLevel} */ +var logLevel = "info"; + +function dummy() {} + +/** + * @param {LogLevel} level log level + * @returns {boolean} true, if should log + */ +function shouldLog(level) { + var shouldLog = + (logLevel === "info" && level === "info") || + (["info", "warning"].indexOf(logLevel) >= 0 && level === "warning") || + (["info", "warning", "error"].indexOf(logLevel) >= 0 && level === "error"); + return shouldLog; +} + +/** + * @param {(msg?: string) => void} logFn log function + * @returns {(level: LogLevel, msg?: string) => void} function that logs when log level is sufficient + */ +function logGroup(logFn) { + return function (level, msg) { + if (shouldLog(level)) { + logFn(msg); + } + }; +} + +/** + * @param {LogLevel} level log level + * @param {string|Error} msg message + */ +module.exports = function (level, msg) { + if (shouldLog(level)) { + if (level === "info") { + console.log(msg); + } else if (level === "warning") { + console.warn(msg); + } else if (level === "error") { + console.error(msg); + } + } +}; + +/** + * @param {Error} err error + * @returns {string} formatted error + */ +module.exports.formatError = function (err) { + var message = err.message; + var stack = err.stack; + if (!stack) { + return message; + } else if (stack.indexOf(message) < 0) { + return message + "\n" + stack; + } + return stack; +}; + +var group = console.group || dummy; +var groupCollapsed = console.groupCollapsed || dummy; +var groupEnd = console.groupEnd || dummy; + +module.exports.group = logGroup(group); + +module.exports.groupCollapsed = logGroup(groupCollapsed); + +module.exports.groupEnd = logGroup(groupEnd); + +/** + * @param {LogLevel} level log level + */ +module.exports.setLogLevel = function (level) { + logLevel = level; +}; + + +/***/ }), + +/***/ 66307: +/*!*****************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/index.js ***! + \*****************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('.')} */ +module.exports = Error; + + +/***/ }), + +/***/ 66676: +/*!*******************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-schema@2.8.0/node_modules/@peculiar/asn1-schema/build/es2015/helper.js ***! + \*******************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ isArrayEqual: () => (/* binding */ isArrayEqual), +/* harmony export */ isConvertible: () => (/* binding */ isConvertible), +/* harmony export */ isTypeOfArray: () => (/* binding */ isTypeOfArray) +/* harmony export */ }); +function isConvertible(target) { + if (typeof target === "function" && target.prototype) { + if (target.prototype.toASN && target.prototype.fromASN) { + return true; + } + else { + return isConvertible(target.prototype); + } + } + else { + return !!(target && typeof target === "object" && "toASN" in target && "fromASN" in target); + } +} +function isTypeOfArray(target) { + if (target) { + const proto = Object.getPrototypeOf(target); + if (proto?.prototype?.constructor === Array) { + return true; + } + return isTypeOfArray(proto); + } + return false; +} +function isArrayEqual(bytes1, bytes2) { + if (!(bytes1 && bytes2)) { + return false; + } + if (bytes1.byteLength !== bytes2.byteLength) { + return false; + } + const b1 = new Uint8Array(bytes1); + const b2 = new Uint8Array(bytes2); + for (let i = 0; i < bytes1.byteLength; i++) { + if (b1[i] !== b2[i]) { + return false; + } + } + return true; +} + + +/***/ }), + +/***/ 66895: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/des.js@1.1.0/node_modules/des.js/lib/des/utils.js ***! + \*******************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +exports.readUInt32BE = function readUInt32BE(bytes, off) { + var res = (bytes[0 + off] << 24) | + (bytes[1 + off] << 16) | + (bytes[2 + off] << 8) | + bytes[3 + off]; + return res >>> 0; +}; + +exports.writeUInt32BE = function writeUInt32BE(bytes, value, off) { + bytes[0 + off] = value >>> 24; + bytes[1 + off] = (value >>> 16) & 0xff; + bytes[2 + off] = (value >>> 8) & 0xff; + bytes[3 + off] = value & 0xff; +}; + +exports.ip = function ip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + + for (var i = 6; i >= 0; i -= 2) { + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + } + for (var j = 1; j <= 25; j += 8) { + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.rip = function rip(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + for (var i = 0; i < 4; i++) { + for (var j = 24; j >= 0; j -= 8) { + outL <<= 1; + outL |= (inR >>> (j + i)) & 1; + outL <<= 1; + outL |= (inL >>> (j + i)) & 1; + } + } + for (var i = 4; i < 8; i++) { + for (var j = 24; j >= 0; j -= 8) { + outR <<= 1; + outR |= (inR >>> (j + i)) & 1; + outR <<= 1; + outR |= (inL >>> (j + i)) & 1; + } + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.pc1 = function pc1(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + // 7, 15, 23, 31, 39, 47, 55, 63 + // 6, 14, 22, 30, 39, 47, 55, 63 + // 5, 13, 21, 29, 39, 47, 55, 63 + // 4, 12, 20, 28 + for (var i = 7; i >= 5; i--) { + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outL <<= 1; + outL |= (inR >> (j + i)) & 1; + } + + // 1, 9, 17, 25, 33, 41, 49, 57 + // 2, 10, 18, 26, 34, 42, 50, 58 + // 3, 11, 19, 27, 35, 43, 51, 59 + // 36, 44, 52, 60 + for (var i = 1; i <= 3; i++) { + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inR >> (j + i)) & 1; + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + } + for (var j = 0; j <= 24; j += 8) { + outR <<= 1; + outR |= (inL >> (j + i)) & 1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.r28shl = function r28shl(num, shift) { + return ((num << shift) & 0xfffffff) | (num >>> (28 - shift)); +}; + +var pc2table = [ + // inL => outL + 14, 11, 17, 4, 27, 23, 25, 0, + 13, 22, 7, 18, 5, 9, 16, 24, + 2, 20, 12, 21, 1, 8, 15, 26, + + // inR => outR + 15, 4, 25, 19, 9, 1, 26, 16, + 5, 11, 23, 8, 12, 7, 17, 0, + 22, 3, 10, 14, 6, 20, 27, 24 +]; + +exports.pc2 = function pc2(inL, inR, out, off) { + var outL = 0; + var outR = 0; + + var len = pc2table.length >>> 1; + for (var i = 0; i < len; i++) { + outL <<= 1; + outL |= (inL >>> pc2table[i]) & 0x1; + } + for (var i = len; i < pc2table.length; i++) { + outR <<= 1; + outR |= (inR >>> pc2table[i]) & 0x1; + } + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +exports.expand = function expand(r, out, off) { + var outL = 0; + var outR = 0; + + outL = ((r & 1) << 5) | (r >>> 27); + for (var i = 23; i >= 15; i -= 4) { + outL <<= 6; + outL |= (r >>> i) & 0x3f; + } + for (var i = 11; i >= 3; i -= 4) { + outR |= (r >>> i) & 0x3f; + outR <<= 6; + } + outR |= ((r & 0x1f) << 1) | (r >>> 31); + + out[off + 0] = outL >>> 0; + out[off + 1] = outR >>> 0; +}; + +var sTable = [ + 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 +]; + +exports.substitute = function substitute(inL, inR) { + var out = 0; + for (var i = 0; i < 4; i++) { + var b = (inL >>> (18 - i * 6)) & 0x3f; + var sb = sTable[i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + for (var i = 0; i < 4; i++) { + var b = (inR >>> (18 - i * 6)) & 0x3f; + var sb = sTable[4 * 0x40 + i * 0x40 + b]; + + out <<= 4; + out |= sb; + } + return out >>> 0; +}; + +var permuteTable = [ + 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 +]; + +exports.permute = function permute(num) { + var out = 0; + for (var i = 0; i < permuteTable.length; i++) { + out <<= 1; + out |= (num >>> permuteTable[i]) & 0x1; + } + return out >>> 0; +}; + +exports.padSplit = function padSplit(num, size, group) { + var str = num.toString(2); + while (str.length < size) + str = '0' + str; + + var out = []; + for (var i = 0; i < size; i += group) + out.push(str.slice(i, i + group)); + return out.join(' '); +}; + + +/***/ }), + +/***/ 67023: +/*!*******************************************************************************!*\ + !*** ../node_modules/.pnpm/buffer-xor@1.0.3/node_modules/buffer-xor/index.js ***! + \*******************************************************************************/ +/***/ ((module) => { + +module.exports = function xor (a, b) { + var length = Math.min(a.length, b.length) + var buffer = new Buffer(length) + + for (var i = 0; i < length; ++i) { + buffer[i] = a[i] ^ b[i] + } + + return buffer +} + + +/***/ }), + +/***/ 67060: +/*!*********************************************************************************************!*\ + !*** ../node_modules/.pnpm/stream-browserify@3.0.0/node_modules/stream-browserify/index.js ***! + \*********************************************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Stream; + +var EE = (__webpack_require__(/*! events */ 43236).EventEmitter); +var inherits = __webpack_require__(/*! inherits */ 18628); + +inherits(Stream, EE); +Stream.Readable = __webpack_require__(/*! readable-stream/lib/_stream_readable.js */ 81624); +Stream.Writable = __webpack_require__(/*! readable-stream/lib/_stream_writable.js */ 2376); +Stream.Duplex = __webpack_require__(/*! readable-stream/lib/_stream_duplex.js */ 63146); +Stream.Transform = __webpack_require__(/*! readable-stream/lib/_stream_transform.js */ 93558); +Stream.PassThrough = __webpack_require__(/*! readable-stream/lib/_stream_passthrough.js */ 29388); +Stream.finished = __webpack_require__(/*! readable-stream/lib/internal/streams/end-of-stream.js */ 40874) +Stream.pipeline = __webpack_require__(/*! readable-stream/lib/internal/streams/pipeline.js */ 48610) + +// Backwards-compat with node 0.4.x +Stream.Stream = Stream; + + + +// old-style streams. Note that the pipe method (the only relevant +// part of this class) is overridden in the Readable class. + +function Stream() { + EE.call(this); +} + +Stream.prototype.pipe = function(dest, options) { + var source = this; + + function ondata(chunk) { + if (dest.writable) { + if (false === dest.write(chunk) && source.pause) { + source.pause(); + } + } + } + + source.on('data', ondata); + + function ondrain() { + if (source.readable && source.resume) { + source.resume(); + } + } + + dest.on('drain', ondrain); + + // If the 'end' option is not supplied, dest.end() will be called when + // source gets the 'end' or 'close' events. Only dest.end() once. + if (!dest._isStdio && (!options || options.end !== false)) { + source.on('end', onend); + source.on('close', onclose); + } + + var didOnEnd = false; + function onend() { + if (didOnEnd) return; + didOnEnd = true; + + dest.end(); + } + + + function onclose() { + if (didOnEnd) return; + didOnEnd = true; + + if (typeof dest.destroy === 'function') dest.destroy(); + } + + // don't leave dangling pipes when there are errors. + function onerror(er) { + cleanup(); + if (EE.listenerCount(this, 'error') === 0) { + throw er; // Unhandled stream error in pipe. + } + } + + source.on('error', onerror); + dest.on('error', onerror); + + // remove all the event listeners that were added. + function cleanup() { + source.removeListener('data', ondata); + dest.removeListener('drain', ondrain); + + source.removeListener('end', onend); + source.removeListener('close', onclose); + + source.removeListener('error', onerror); + dest.removeListener('error', onerror); + + source.removeListener('end', cleanup); + source.removeListener('close', cleanup); + + dest.removeListener('close', cleanup); + } + + source.on('end', cleanup); + source.on('close', cleanup); + + dest.on('close', cleanup); + + dest.emit('pipe', source); + + // Allow for unix-like usage: A.pipe(B).pipe(C) + return dest; +}; + + +/***/ }), + +/***/ 67265: +/*!***********************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/invalidity_date.js ***! + \***********************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ InvalidityDate: () => (/* binding */ InvalidityDate), +/* harmony export */ id_ce_invalidityDate: () => (/* binding */ id_ce_invalidityDate) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); + + + +const id_ce_invalidityDate = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_2__.id_ce}.24`; +let InvalidityDate = class InvalidityDate { + value = new Date(); + constructor(value) { + if (value) { + this.value = value; + } + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.GeneralizedTime }) +], InvalidityDate.prototype, "value", void 0); +InvalidityDate = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], InvalidityDate); + + + +/***/ }), + +/***/ 67768: +/*!*******************************************************************!*\ + !*** ../node_modules/.pnpm/gopd@1.2.0/node_modules/gopd/index.js ***! + \*******************************************************************/ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +/** @type {import('.')} */ +var $gOPD = __webpack_require__(/*! ./gOPD */ 6124); + +if ($gOPD) { + try { + $gOPD([], 'length'); + } catch (e) { + // IE 8 has a broken gOPD + $gOPD = null; + } +} + +module.exports = $gOPD; + + +/***/ }), + +/***/ 67990: +/*!****************************************************************************************!*\ + !*** ../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/esm/hkdf.js ***! + \****************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ expand: () => (/* binding */ expand), +/* harmony export */ extract: () => (/* binding */ extract), +/* harmony export */ hkdf: () => (/* binding */ hkdf) +/* harmony export */ }); +/* harmony import */ var _hmac_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hmac.js */ 29362); +/* harmony import */ var _utils_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils.js */ 29964); +/** + * HKDF (RFC 5869): extract + expand in one step. + * See https://soatok.blog/2021/11/17/understanding-hkdf/. + * @module + */ + + +/** + * HKDF-extract from spec. Less important part. `HKDF-Extract(IKM, salt) -> PRK` + * Arguments position differs from spec (IKM is first one, since it is not optional) + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + */ +function extract(hash, ikm, salt) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ahash)(hash); + // NOTE: some libraries treat zero-length array as 'not provided'; + // we don't, since we have undefined as 'not provided' + // https://github.com/RustCrypto/KDFs/issues/15 + if (salt === undefined) + salt = new Uint8Array(hash.outputLen); + return (0,_hmac_js__WEBPACK_IMPORTED_MODULE_0__.hmac)(hash, (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(salt), (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.toBytes)(ikm)); +} +const HKDF_COUNTER = /* @__PURE__ */ Uint8Array.from([0]); +const EMPTY_BUFFER = /* @__PURE__ */ Uint8Array.of(); +/** + * HKDF-expand from the spec. The most important part. `HKDF-Expand(PRK, info, L) -> OKM` + * @param hash - hash function that would be used (e.g. sha256) + * @param prk - a pseudorandom key of at least HashLen octets (usually, the output from the extract step) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in bytes + */ +function expand(hash, prk, info, length = 32) { + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.ahash)(hash); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.anumber)(length); + const olen = hash.outputLen; + if (length > 255 * olen) + throw new Error('Length should be <= 255*HashLen'); + const blocks = Math.ceil(length / olen); + if (info === undefined) + info = EMPTY_BUFFER; + // first L(ength) octets of T + const okm = new Uint8Array(blocks * olen); + // Re-use HMAC instance between blocks + const HMAC = _hmac_js__WEBPACK_IMPORTED_MODULE_0__.hmac.create(hash, prk); + const HMACTmp = HMAC._cloneInto(); + const T = new Uint8Array(HMAC.outputLen); + for (let counter = 0; counter < blocks; counter++) { + HKDF_COUNTER[0] = counter + 1; + // T(0) = empty string (zero length) + // T(N) = HMAC-Hash(PRK, T(N-1) | info | N) + HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T) + .update(info) + .update(HKDF_COUNTER) + .digestInto(T); + okm.set(T, olen * counter); + HMAC._cloneInto(HMACTmp); + } + HMAC.destroy(); + HMACTmp.destroy(); + (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.clean)(T, HKDF_COUNTER); + return okm.slice(0, length); +} +/** + * HKDF (RFC 5869): derive keys from an initial input. + * Combines hkdf_extract + hkdf_expand in one step + * @param hash - hash function that would be used (e.g. sha256) + * @param ikm - input keying material, the initial key + * @param salt - optional salt value (a non-secret random value) + * @param info - optional context and application specific information (can be a zero-length string) + * @param length - length of output keying material in bytes + * @example + * import { hkdf } from '@noble/hashes/hkdf'; + * import { sha256 } from '@noble/hashes/sha2'; + * import { randomBytes } from '@noble/hashes/utils'; + * const inputKey = randomBytes(32); + * const salt = randomBytes(32); + * const info = 'application-key'; + * const hk1 = hkdf(sha256, inputKey, salt, info, 32); + */ +const hkdf = (hash, ikm, salt, info, length) => expand(hash, extract(hash, ikm, salt), info, length); +//# sourceMappingURL=hkdf.js.map + +/***/ }), + +/***/ 68016: +/*!****************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/viem@2.45.0_bufferutil@4.1.0_typescript@5.4.3_utf-8-validate@6.0.6/node_modules/viem/_esm/errors/cursor.js ***! + \****************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ NegativeOffsetError: () => (/* binding */ NegativeOffsetError), +/* harmony export */ PositionOutOfBoundsError: () => (/* binding */ PositionOutOfBoundsError), +/* harmony export */ RecursiveReadLimitExceededError: () => (/* binding */ RecursiveReadLimitExceededError) +/* harmony export */ }); +/* harmony import */ var _base_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./base.js */ 87035); + +class NegativeOffsetError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ offset }) { + super(`Offset \`${offset}\` cannot be negative.`, { + name: 'NegativeOffsetError', + }); + } +} +class PositionOutOfBoundsError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ length, position }) { + super(`Position \`${position}\` is out of bounds (\`0 < position < ${length}\`).`, { name: 'PositionOutOfBoundsError' }); + } +} +class RecursiveReadLimitExceededError extends _base_js__WEBPACK_IMPORTED_MODULE_0__.BaseError { + constructor({ count, limit }) { + super(`Recursive read limit of \`${limit}\` exceeded (recursive read count: \`${count}\`).`, { name: 'RecursiveReadLimitExceededError' }); + } +} +//# sourceMappingURL=cursor.js.map + +/***/ }), + +/***/ 68022: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-rsa@2.8.0/node_modules/@peculiar/asn1-rsa/build/es2015/rsa_private_key.js ***! + \**********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ RSAPrivateKey: () => (/* binding */ RSAPrivateKey) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _other_prime_info_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./other_prime_info.js */ 17725); + + + +class RSAPrivateKey { + version = 0; + modulus = new ArrayBuffer(0); + publicExponent = new ArrayBuffer(0); + privateExponent = new ArrayBuffer(0); + prime1 = new ArrayBuffer(0); + prime2 = new ArrayBuffer(0); + exponent1 = new ArrayBuffer(0); + exponent2 = new ArrayBuffer(0); + coefficient = new ArrayBuffer(0); + otherPrimeInfos; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer }) +], RSAPrivateKey.prototype, "version", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "modulus", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "publicExponent", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "privateExponent", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "prime1", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "prime2", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "exponent1", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "exponent2", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnPropTypes.Integer, converter: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnIntegerArrayBufferConverter, + }) +], RSAPrivateKey.prototype, "coefficient", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _other_prime_info_js__WEBPACK_IMPORTED_MODULE_2__.OtherPrimeInfos, optional: true, + }) +], RSAPrivateKey.prototype, "otherPrimeInfos", void 0); + + +/***/ }), + +/***/ 68427: +/*!**********************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/general_names.js ***! + \**********************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ GeneralNames: () => (/* binding */ GeneralNames) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _general_name_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./general_name.js */ 56804); +var GeneralNames_1; + + + +let GeneralNames = GeneralNames_1 = class GeneralNames extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, GeneralNames_1.prototype); + } +}; +GeneralNames = GeneralNames_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: _general_name_js__WEBPACK_IMPORTED_MODULE_2__.GeneralName, + }) +], GeneralNames); + + + +/***/ }), + +/***/ 68671: +/*!*******************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-x509@2.8.0/node_modules/@peculiar/asn1-x509/build/es2015/extensions/crl_distribution_points.js ***! + \*******************************************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ CRLDistributionPoints: () => (/* binding */ CRLDistributionPoints), +/* harmony export */ DistributionPoint: () => (/* binding */ DistributionPoint), +/* harmony export */ DistributionPointName: () => (/* binding */ DistributionPointName), +/* harmony export */ Reason: () => (/* binding */ Reason), +/* harmony export */ ReasonFlags: () => (/* binding */ ReasonFlags), +/* harmony export */ id_ce_cRLDistributionPoints: () => (/* binding */ id_ce_cRLDistributionPoints) +/* harmony export */ }); +/* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ 56636); +/* harmony import */ var _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @peculiar/asn1-schema */ 61418); +/* harmony import */ var _name_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../name.js */ 8481); +/* harmony import */ var _general_name_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../general_name.js */ 56804); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../object_identifiers.js */ 70542); +var CRLDistributionPoints_1; + + + + + +const id_ce_cRLDistributionPoints = `${_object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_ce}.31`; +var ReasonFlags; +(function (ReasonFlags) { + ReasonFlags[ReasonFlags["unused"] = 1] = "unused"; + ReasonFlags[ReasonFlags["keyCompromise"] = 2] = "keyCompromise"; + ReasonFlags[ReasonFlags["cACompromise"] = 4] = "cACompromise"; + ReasonFlags[ReasonFlags["affiliationChanged"] = 8] = "affiliationChanged"; + ReasonFlags[ReasonFlags["superseded"] = 16] = "superseded"; + ReasonFlags[ReasonFlags["cessationOfOperation"] = 32] = "cessationOfOperation"; + ReasonFlags[ReasonFlags["certificateHold"] = 64] = "certificateHold"; + ReasonFlags[ReasonFlags["privilegeWithdrawn"] = 128] = "privilegeWithdrawn"; + ReasonFlags[ReasonFlags["aACompromise"] = 256] = "aACompromise"; +})(ReasonFlags || (ReasonFlags = {})); +class Reason extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.BitString { + toJSON() { + const res = []; + const flags = this.toNumber(); + if (flags & ReasonFlags.aACompromise) { + res.push("aACompromise"); + } + if (flags & ReasonFlags.affiliationChanged) { + res.push("affiliationChanged"); + } + if (flags & ReasonFlags.cACompromise) { + res.push("cACompromise"); + } + if (flags & ReasonFlags.certificateHold) { + res.push("certificateHold"); + } + if (flags & ReasonFlags.cessationOfOperation) { + res.push("cessationOfOperation"); + } + if (flags & ReasonFlags.keyCompromise) { + res.push("keyCompromise"); + } + if (flags & ReasonFlags.privilegeWithdrawn) { + res.push("privilegeWithdrawn"); + } + if (flags & ReasonFlags.superseded) { + res.push("superseded"); + } + if (flags & ReasonFlags.unused) { + res.push("unused"); + } + return res; + } + toString() { + return `[${this.toJSON().join(", ")}]`; + } +} +let DistributionPointName = class DistributionPointName { + fullName; + nameRelativeToCRLIssuer; + constructor(params = {}) { + Object.assign(this, params); + } +}; +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _general_name_js__WEBPACK_IMPORTED_MODULE_3__.GeneralName, context: 0, repeated: "sequence", implicit: true, + }) +], DistributionPointName.prototype, "fullName", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _name_js__WEBPACK_IMPORTED_MODULE_2__.RelativeDistinguishedName, context: 1, implicit: true, + }) +], DistributionPointName.prototype, "nameRelativeToCRLIssuer", void 0); +DistributionPointName = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Choice }) +], DistributionPointName); + +class DistributionPoint { + distributionPoint; + reasons; + cRLIssuer; + constructor(params = {}) { + Object.assign(this, params); + } +} +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: DistributionPointName, context: 0, optional: true, + }) +], DistributionPoint.prototype, "distributionPoint", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: Reason, context: 1, optional: true, implicit: true, + }) +], DistributionPoint.prototype, "reasons", void 0); +(0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnProp)({ + type: _general_name_js__WEBPACK_IMPORTED_MODULE_3__.GeneralName, context: 2, optional: true, repeated: "sequence", implicit: true, + }) +], DistributionPoint.prototype, "cRLIssuer", void 0); +let CRLDistributionPoints = CRLDistributionPoints_1 = class CRLDistributionPoints extends _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnArray { + constructor(items) { + super(items); + Object.setPrototypeOf(this, CRLDistributionPoints_1.prototype); + } +}; +CRLDistributionPoints = CRLDistributionPoints_1 = (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([ + (0,_peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnType)({ + type: _peculiar_asn1_schema__WEBPACK_IMPORTED_MODULE_1__.AsnTypeTypes.Sequence, itemType: DistributionPoint, + }) +], CRLDistributionPoints); + + + +/***/ }), + +/***/ 68815: +/*!**************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/kemInterface.js ***! + \**************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ SUITE_ID_HEADER_KEM: () => (/* binding */ SUITE_ID_HEADER_KEM) +/* harmony export */ }); +// b"KEM" +const SUITE_ID_HEADER_KEM = /* @__PURE__ */ new Uint8Array([ + 75, + 69, + 77, + 0, + 0, +]); + + +/***/ }), + +/***/ 68869: +/*!*********************************************************************************!*\ + !*** ../node_modules/.pnpm/uuid@8.3.2/node_modules/uuid/dist/esm-browser/v1.js ***! + \*********************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) +/* harmony export */ }); +/* harmony import */ var _rng_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./rng.js */ 86439); +/* harmony import */ var _stringify_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./stringify.js */ 15247); + + // **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html + +var _nodeId; + +var _clockseq; // Previous uuid creation time + + +var _lastMSecs = 0; +var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + var i = buf && offset || 0; + var b = buf || new Array(16); + options = options || {}; + var node = options.node || _nodeId; + var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + var seedBytes = options.random || (options.rng || _rng_js__WEBPACK_IMPORTED_MODULE_0__["default"])(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + var msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + var tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (var n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0,_stringify_js__WEBPACK_IMPORTED_MODULE_1__["default"])(b); +} + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (v1); + +/***/ }), + +/***/ 68968: +/*!*****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/hybridkem.js ***! + \*****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Hybridkem: () => (/* binding */ Hybridkem) +/* harmony export */ }); +/* harmony import */ var _consts_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../consts.js */ 53838); +/* harmony import */ var _errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../errors.js */ 48385); +/* harmony import */ var _kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../kdfs/hkdf.js */ 40138); +/* harmony import */ var _identifiers_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../identifiers.js */ 16780); +/* harmony import */ var _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../interfaces/dhkemPrimitives.js */ 41744); +/* harmony import */ var _interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../interfaces/kemInterface.js */ 68815); +/* harmony import */ var _utils_misc_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/misc.js */ 30988); +/* harmony import */ var _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../xCryptoKey.js */ 56550); + + + + + + + + +class Hybridkem { + constructor(id, a, b, kdf) { + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _identifiers_js__WEBPACK_IMPORTED_MODULE_3__.KemId.NotAssigned + }); + Object.defineProperty(this, "name", { + enumerable: true, + configurable: true, + writable: true, + value: "" + }); + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 0 + }); + Object.defineProperty(this, "_a", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_b", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "_kdf", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.id = id; + this._a = a; + this._b = b; + this._kdf = kdf; + const suiteId = new Uint8Array(_interfaces_kemInterface_js__WEBPACK_IMPORTED_MODULE_5__.SUITE_ID_HEADER_KEM); + suiteId.set((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.i2Osp)(this.id, 2), 3); + this._kdf.init(suiteId); + } + async serializePublicKey(key) { + try { + return await this._serializePublicKey(key); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.SerializeError(e); + } + } + async deserializePublicKey(key) { + try { + return await this._deserializePublicKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key)); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e); + } + } + async serializePrivateKey(key) { + try { + return await this._serializePrivateKey(key); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.SerializeError(e); + } + } + async deserializePrivateKey(key) { + try { + return await this._deserializePrivateKey((0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(key)); + } + catch (e) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.DeserializeError(e); + } + } + async generateKeyPair() { + const kpA = await this._a.generateKeyPair(); + const kpB = await this._b.generateKeyPair(); + const pkA = await this._a.serializePublicKey(kpA.publicKey); + const skA = await this._a.serializePrivateKey(kpA.privateKey); + const pkB = await this._b.serializePublicKey(kpB.publicKey); + const skB = await this._b.serializePrivateKey(kpB.privateKey); + return { + publicKey: await this.deserializePublicKey((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(pkA), new Uint8Array(pkB)).buffer), + privateKey: await this.deserializePrivateKey((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(skA), new Uint8Array(skB)).buffer), + }; + } + async deriveKeyPair(ikm) { + const rawIkm = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(ikm); + const dkpPrk = await this._kdf.labeledExtract(_consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY.buffer, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_4__.LABEL_DKP_PRK, new Uint8Array(rawIkm)); + const seed = new Uint8Array(await this._kdf.labeledExpand(dkpPrk, _interfaces_dhkemPrimitives_js__WEBPACK_IMPORTED_MODULE_4__.LABEL_SK, _consts_js__WEBPACK_IMPORTED_MODULE_0__.EMPTY, 32 + 64)); + const seed1 = seed.slice(0, 32); + const seed2 = seed.slice(32, 96); + const kpA = await this._a.deriveKeyPair(seed1.buffer); + const kpB = await this._b.deriveKeyPair(seed2.buffer); + const pkA = await this._a.serializePublicKey(kpA.publicKey); + const skA = await this._a.serializePrivateKey(kpA.privateKey); + const pkB = await this._b.serializePublicKey(kpB.publicKey); + const skB = await this._b.serializePrivateKey(kpB.privateKey); + return { + publicKey: await this.deserializePublicKey((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(pkA), new Uint8Array(pkB)).buffer), + privateKey: await this.deserializePrivateKey((0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(skA), new Uint8Array(skB)).buffer), + }; + } + async importKey(format, key, isPublic = true) { + if (format !== "raw") { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.NotSupportedError("'jwk' is not supported"); + } + if (!(key instanceof ArrayBuffer)) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidParamError("Invalid type of key"); + } + if (isPublic) { + return await this.deserializePublicKey(key); + } + return await this.deserializePrivateKey(key); + } + async encap(params) { + let ekmA = undefined; + let ekmB = undefined; + if (params.ekm !== undefined && !(0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.isCryptoKeyPair)(params.ekm)) { + const ekm = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(params.ekm); + if (ekm.byteLength !== 64) { + throw new _errors_js__WEBPACK_IMPORTED_MODULE_1__.InvalidParamError("ekm must be 64 bytes in length"); + } + ekmA = ekm.slice(0, 32); + ekmB = ekm.slice(32); + } + const pkR = new Uint8Array(await this.serializePublicKey(params.recipientPublicKey)); + const pkRA = await this._a.deserializePublicKey(pkR.slice(0, this._a.publicKeySize).buffer); + const pkRB = await this._b.deserializePublicKey(pkR.slice(this._a.publicKeySize).buffer); + const resA = await this._a.encap({ recipientPublicKey: pkRA, ekm: ekmA }); + const resB = await this._b.encap({ recipientPublicKey: pkRB, ekm: ekmB }); + return { + sharedSecret: (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(resA.sharedSecret), new Uint8Array(resB.sharedSecret)).buffer, + enc: (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(resA.enc), new Uint8Array(resB.enc)) + .buffer, + }; + } + async decap(params) { + const enc = (0,_kdfs_hkdf_js__WEBPACK_IMPORTED_MODULE_2__.toArrayBuffer)(params.enc); + const sk = (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.isCryptoKeyPair)(params.recipientKey) + ? params.recipientKey.privateKey + : params.recipientKey; + const skR = new Uint8Array(await this.serializePrivateKey(sk)); + const skRA = await this._a.deserializePrivateKey(skR.slice(0, this._a.privateKeySize).buffer); + const skRB = await this._b.deserializePrivateKey(skR.slice(this._a.privateKeySize).buffer); + const ssA = await this._a.decap({ + recipientKey: skRA, + enc: enc.slice(0, this._a.encSize), + }); + const ssB = await this._b.decap({ + recipientKey: skRB, + enc: enc.slice(this._a.encSize), + }); + return (0,_utils_misc_js__WEBPACK_IMPORTED_MODULE_6__.concat)(new Uint8Array(ssA), new Uint8Array(ssB)) + .buffer; + } + _serializePublicKey(k) { + return new Promise((resolve, reject) => { + if (k.type !== "public") { + reject(new Error("Not public key")); + } + if (k.algorithm.name !== this.name) { + reject(new Error(`Invalid algorithm name: ${k.algorithm.name}`)); + } + if (k.key.byteLength !== this.publicKeySize) { + reject(new Error(`Invalid key length: ${k.key.byteLength}`)); + } + resolve(k.key.buffer); + }); + } + _deserializePublicKey(k) { + return new Promise((resolve, reject) => { + if (k.byteLength !== this.publicKeySize) { + reject(new Error(`Invalid key length: ${k.byteLength}`)); + } + resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_7__.XCryptoKey(this.name, new Uint8Array(k), "public")); + }); + } + _serializePrivateKey(k) { + return new Promise((resolve, reject) => { + if (k.type !== "private") { + reject(new Error("Not private key")); + } + if (k.algorithm.name !== this.name) { + reject(new Error(`Invalid algorithm name: ${k.algorithm.name}`)); + } + if (k.key.byteLength !== this.privateKeySize) { + reject(new Error(`Invalid key length: ${k.key.byteLength}`)); + } + resolve(k.key.buffer); + }); + } + _deserializePrivateKey(k) { + return new Promise((resolve, reject) => { + if (k.byteLength !== this.privateKeySize) { + reject(new Error(`Invalid key length: ${k.byteLength}`)); + } + resolve(new _xCryptoKey_js__WEBPACK_IMPORTED_MODULE_7__.XCryptoKey(this.name, new Uint8Array(k), "private", ["deriveBits"])); + }); + } +} + + +/***/ }), + +/***/ 69001: +/*!***********************************************************************************************!*\ + !*** ../node_modules/.pnpm/es-define-property@1.0.1/node_modules/es-define-property/index.js ***! + \***********************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('.')} */ +var $defineProperty = Object.defineProperty || false; +if ($defineProperty) { + try { + $defineProperty({}, 'a', { value: 1 }); + } catch (e) { + // IE 8 has a broken defineProperty + $defineProperty = false; + } +} + +module.exports = $defineProperty; + + +/***/ }), + +/***/ 69449: +/*!****************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@turnkey+encoding@0.6.0/node_modules/@turnkey/encoding/dist/base64.mjs ***! + \****************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ atob: () => (/* binding */ atob), +/* harmony export */ base64StringToBase64UrlEncodedString: () => (/* binding */ base64StringToBase64UrlEncodedString), +/* harmony export */ base64UrlToBase64: () => (/* binding */ base64UrlToBase64), +/* harmony export */ decodeBase64urlToString: () => (/* binding */ decodeBase64urlToString), +/* harmony export */ hexStringToBase64url: () => (/* binding */ hexStringToBase64url), +/* harmony export */ stringToBase64urlString: () => (/* binding */ stringToBase64urlString) +/* harmony export */ }); +/* harmony import */ var _hex_mjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hex.mjs */ 61791); + + +/** + * Code modified from https://github.com/github/webauthn-json/blob/e932b3585fa70b0bd5b5a4012ba7dbad7b0a0d0f/src/webauthn-json/base64url.ts#L23 + */ +/** + * Converts a plain string into a base64url-encoded string. + * + * @param {string} input - The input string to encode. + * @returns {string} - The base64url-encoded string. + */ +function stringToBase64urlString(input) { + // string to base64 + // we do not rely on the browser's btoa since it's not present in React Native environments + const base64String = btoa(input); + return base64StringToBase64UrlEncodedString(base64String); +} +/** + * Converts a hex string into a base64url-encoded string. + * + * @param {string} input - The input hex string. + * @param {number} [length] - Optional length for the resulting buffer. Pads with leading 0s if needed. + * @returns {string} - The base64url-encoded representation of the hex string. + * @throws {Error} - If the hex string is invalid or too long for the specified length. + */ +function hexStringToBase64url(input, length) { + // Add an extra 0 to the start of the string to get a valid hex string (even length) + // (e.g. 0x0123 instead of 0x123) + const hexString = input.padStart(Math.ceil(input.length / 2) * 2, "0"); + const buffer = (0,_hex_mjs__WEBPACK_IMPORTED_MODULE_0__.uint8ArrayFromHexString)(hexString, length); + return stringToBase64urlString(buffer.reduce((result, x) => result + String.fromCharCode(x), "")); +} +/** + * Converts a base64 string into a base64url-encoded string. + * + * @param {string} input - The input base64 string. + * @returns {string} - The base64url-encoded string. + */ +function base64StringToBase64UrlEncodedString(input) { + return input.replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, ""); +} +/** + * Converts a base64url-encoded string into a standard base64-encoded string. + * + * - Replaces URL-safe characters (`-` and `_`) back to standard base64 characters (`+` and `/`). + * - Pads the result with `=` to ensure the length is a multiple of 4. + * + * @param {string} input - The base64url-encoded string to convert. + * @returns {string} - The equivalent base64-encoded string. + */ +function base64UrlToBase64(input) { + let b64 = input.replace(/-/g, "+").replace(/_/g, "/"); + const padLen = (4 - (b64.length % 4)) % 4; + return b64 + "=".repeat(padLen); +} +/** + * Decodes a base64url-encoded string into a plain UTF-8 string. + * + * - Converts the input from base64url to base64. + * - Decodes the base64 string into a plain string using a pure JS `atob` implementation. + * + * @param {string} input - The base64url-encoded string to decode. + * @returns {string} - The decoded plain string. + * @throws {Error} If the input is not correctly base64url/base64 encoded. + */ +function decodeBase64urlToString(input) { + const b64 = base64UrlToBase64(input); + return atob(b64); +} +// Pure JS implementation of btoa. This is adapted from the following: +// https://github.com/jsdom/abab/blob/80874ae1fe1cde2e587bb6e51b6d7c9b42ca1d34/lib/btoa.js +function btoa(s) { + if (arguments.length === 0) { + throw new TypeError("1 argument required, but only 0 present."); + } + let i; + // String conversion as required by Web IDL. + s = `${s}`; + // "The btoa() method must throw an "InvalidCharacterError" DOMException if + // data contains any character whose code point is greater than U+00FF." + for (i = 0; i < s.length; i++) { + if (s.charCodeAt(i) > 255) { + throw new Error(`InvalidCharacterError: found code point greater than 255:${s.charCodeAt(i)} at position ${i}`); + } + } + let out = ""; + for (i = 0; i < s.length; i += 3) { + const groupsOfSix = [ + undefined, + undefined, + undefined, + undefined, + ]; + groupsOfSix[0] = s.charCodeAt(i) >> 2; + groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4; + if (s.length > i + 1) { + groupsOfSix[1] |= s.charCodeAt(i + 1) >> 4; + groupsOfSix[2] = (s.charCodeAt(i + 1) & 0x0f) << 2; + } + if (s.length > i + 2) { + groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6; + groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f; + } + for (let j = 0; j < groupsOfSix.length; j++) { + if (typeof groupsOfSix[j] === "undefined") { + out += "="; + } + else { + out += btoaLookup(groupsOfSix[j]); + } + } + } + return out; +} +function btoaLookup(index) { + /** + * Lookup table for btoa(), which converts a six-bit number into the + * corresponding ASCII character. + */ + const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + if (index >= 0 && index < 64) { + return keystr[index]; + } + // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests. + return undefined; +} +// Pure JS implementation of btoa. +function atob(input) { + if (arguments.length === 0) { + throw new TypeError("1 argument required, but only 0 present."); + } + // convert to string and remove invalid characters upfront + const str = String(input).replace(/[^A-Za-z0-9+/=]/g, ""); + // the atob() method must throw an "InvalidCharacterError" if + // the length of the string is not a multiple of 4 + if (str.length % 4 === 1) { + throw new Error("InvalidCharacterError: The string to be decoded is not correctly encoded."); + } + const keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + let output = ""; + let buffer = 0; + let bits = 0; + let i = 0; + // process each character + while (i < str.length) { + const ch = str.charAt(i); + const index = keyStr.indexOf(ch); + if (index < 0 || index > 64) { + i++; + continue; + } + if (ch === "=") { + // we skip padding characters + bits = 0; + } + else { + buffer = (buffer << 6) | index; + bits += 6; + } + // output complete bytes + while (bits >= 8) { + bits -= 8; + output += String.fromCharCode((buffer >> bits) & 0xff); + } + i++; + } + return output; +} + + +//# sourceMappingURL=base64.mjs.map + + +/***/ }), + +/***/ 69652: +/*!****************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/readable-stream@3.6.2/node_modules/readable-stream/lib/internal/streams/destroy.js ***! + \****************************************************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ 69794: +/*!***************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/bignum.js ***! + \***************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Bignum: () => (/* binding */ Bignum) +/* harmony export */ }); +/** + * The minimum inplementation of bignum to derive an EC key pair. + */ +class Bignum { + constructor(size) { + Object.defineProperty(this, "_num", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this._num = new Uint8Array(size); + } + val() { + return this._num; + } + reset() { + this._num.fill(0); + } + set(src) { + if (src.length !== this._num.length) { + throw new Error("Bignum.set: invalid argument"); + } + this._num.set(src); + } + isZero() { + for (let i = 0; i < this._num.length; i++) { + if (this._num[i] !== 0) { + return false; + } + } + return true; + } + lessThan(v) { + if (v.length !== this._num.length) { + throw new Error("Bignum.lessThan: invalid argument"); + } + for (let i = 0; i < this._num.length; i++) { + if (this._num[i] < v[i]) { + return true; + } + if (this._num[i] > v[i]) { + return false; + } + } + return false; + } +} + + +/***/ }), + +/***/ 69852: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@peculiar+asn1-pfx@2.8.0/node_modules/@peculiar/asn1-pfx/build/es2015/index.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ AuthenticatedSafe: () => (/* reexport safe */ _authenticated_safe_js__WEBPACK_IMPORTED_MODULE_1__.AuthenticatedSafe), +/* harmony export */ CRLBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.CRLBag), +/* harmony export */ CertBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.CertBag), +/* harmony export */ KeyBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.KeyBag), +/* harmony export */ MacData: () => (/* reexport safe */ _mac_data_js__WEBPACK_IMPORTED_MODULE_3__.MacData), +/* harmony export */ PFX: () => (/* reexport safe */ _pfx_js__WEBPACK_IMPORTED_MODULE_5__.PFX), +/* harmony export */ PKCS12AttrSet: () => (/* reexport safe */ _attribute_js__WEBPACK_IMPORTED_MODULE_0__.PKCS12AttrSet), +/* harmony export */ PKCS12Attribute: () => (/* reexport safe */ _attribute_js__WEBPACK_IMPORTED_MODULE_0__.PKCS12Attribute), +/* harmony export */ PKCS8ShroudedKeyBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.PKCS8ShroudedKeyBag), +/* harmony export */ SafeBag: () => (/* reexport safe */ _safe_bag_js__WEBPACK_IMPORTED_MODULE_6__.SafeBag), +/* harmony export */ SafeContents: () => (/* reexport safe */ _safe_bag_js__WEBPACK_IMPORTED_MODULE_6__.SafeContents), +/* harmony export */ SecretBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.SecretBag), +/* harmony export */ id_CRLBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_CRLBag), +/* harmony export */ id_SafeContents: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_SafeContents), +/* harmony export */ id_SecretBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_SecretBag), +/* harmony export */ id_bagtypes: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_bagtypes), +/* harmony export */ id_certBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_certBag), +/* harmony export */ id_certTypes: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_certTypes), +/* harmony export */ id_crlTypes: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_crlTypes), +/* harmony export */ id_keyBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_keyBag), +/* harmony export */ id_pbeWithSHAAnd128BitRC2_CBC: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbeWithSHAAnd128BitRC2_CBC), +/* harmony export */ id_pbeWithSHAAnd128BitRC4: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbeWithSHAAnd128BitRC4), +/* harmony export */ id_pbeWithSHAAnd2_KeyTripleDES_CBC: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbeWithSHAAnd2_KeyTripleDES_CBC), +/* harmony export */ id_pbeWithSHAAnd3_KeyTripleDES_CBC: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbeWithSHAAnd3_KeyTripleDES_CBC), +/* harmony export */ id_pbeWithSHAAnd40BitRC4: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbeWithSHAAnd40BitRC4), +/* harmony export */ id_pbewithSHAAnd40BitRC2_CBC: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pbewithSHAAnd40BitRC2_CBC), +/* harmony export */ id_pkcs: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pkcs), +/* harmony export */ id_pkcs8ShroudedKeyBag: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_pkcs8ShroudedKeyBag), +/* harmony export */ id_pkcs_12: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pkcs_12), +/* harmony export */ id_pkcs_12PbeIds: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_pkcs_12PbeIds), +/* harmony export */ id_pkcs_9: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_pkcs_9), +/* harmony export */ id_rsadsi: () => (/* reexport safe */ _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__.id_rsadsi), +/* harmony export */ id_sdsiCertificate: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_sdsiCertificate), +/* harmony export */ id_x509CRL: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_x509CRL), +/* harmony export */ id_x509Certificate: () => (/* reexport safe */ _bags_index_js__WEBPACK_IMPORTED_MODULE_2__.id_x509Certificate) +/* harmony export */ }); +/* harmony import */ var _attribute_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./attribute.js */ 23400); +/* harmony import */ var _authenticated_safe_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./authenticated_safe.js */ 55363); +/* harmony import */ var _bags_index_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./bags/index.js */ 46390); +/* harmony import */ var _mac_data_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./mac_data.js */ 5330); +/* harmony import */ var _object_identifiers_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./object_identifiers.js */ 86610); +/* harmony import */ var _pfx_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./pfx.js */ 63230); +/* harmony import */ var _safe_bag_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./safe_bag.js */ 97670); + + + + + + + + + +/***/ }), + +/***/ 70064: +/*!******************************************************************************!*\ + !*** ../node_modules/.pnpm/es-errors@1.3.0/node_modules/es-errors/syntax.js ***! + \******************************************************************************/ +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./syntax')} */ +module.exports = SyntaxError; + + +/***/ }), + +/***/ 70148: +/*!************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/text-encoding-utf-8@1.0.2/node_modules/text-encoding-utf-8/lib/encoding.lib.js ***! + \************************************************************************************************************/ +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +// This is free and unencumbered software released into the public domain. +// See LICENSE.md for more information. + +// +// Utilities +// + +/** + * @param {number} a The number to test. + * @param {number} min The minimum value in the range, inclusive. + * @param {number} max The maximum value in the range, inclusive. + * @return {boolean} True if a >= min and a <= max. + */ +function inRange(a, min, max) { + return min <= a && a <= max; +} + +/** + * @param {*} o + * @return {Object} + */ +function ToDictionary(o) { + if (o === undefined) return {}; + if (o === Object(o)) return o; + throw TypeError('Could not convert argument to dictionary'); +} + +/** + * @param {string} string Input string of UTF-16 code units. + * @return {!Array.} Code points. + */ +function stringToCodePoints(string) { + // https://heycam.github.io/webidl/#dfn-obtain-unicode + + // 1. Let S be the DOMString value. + var s = String(string); + + // 2. Let n be the length of S. + var n = s.length; + + // 3. Initialize i to 0. + var i = 0; + + // 4. Initialize U to be an empty sequence of Unicode characters. + var u = []; + + // 5. While i < n: + while (i < n) { + + // 1. Let c be the code unit in S at index i. + var c = s.charCodeAt(i); + + // 2. Depending on the value of c: + + // c < 0xD800 or c > 0xDFFF + if (c < 0xD800 || c > 0xDFFF) { + // Append to U the Unicode character with code point c. + u.push(c); + } + + // 0xDC00 ≤ c ≤ 0xDFFF + else if (0xDC00 <= c && c <= 0xDFFF) { + // Append to U a U+FFFD REPLACEMENT CHARACTER. + u.push(0xFFFD); + } + + // 0xD800 ≤ c ≤ 0xDBFF + else if (0xD800 <= c && c <= 0xDBFF) { + // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT + // CHARACTER. + if (i === n - 1) { + u.push(0xFFFD); + } + // 2. Otherwise, i < n−1: + else { + // 1. Let d be the code unit in S at index i+1. + var d = string.charCodeAt(i + 1); + + // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then: + if (0xDC00 <= d && d <= 0xDFFF) { + // 1. Let a be c & 0x3FF. + var a = c & 0x3FF; + + // 2. Let b be d & 0x3FF. + var b = d & 0x3FF; + + // 3. Append to U the Unicode character with code point + // 2^16+2^10*a+b. + u.push(0x10000 + (a << 10) + b); + + // 4. Set i to i+1. + i += 1; + } + + // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a + // U+FFFD REPLACEMENT CHARACTER. + else { + u.push(0xFFFD); + } + } + } + + // 3. Set i to i+1. + i += 1; + } + + // 6. Return U. + return u; +} + +/** + * @param {!Array.} code_points Array of code points. + * @return {string} string String of UTF-16 code units. + */ +function codePointsToString(code_points) { + var s = ''; + for (var i = 0; i < code_points.length; ++i) { + var cp = code_points[i]; + if (cp <= 0xFFFF) { + s += String.fromCharCode(cp); + } else { + cp -= 0x10000; + s += String.fromCharCode((cp >> 10) + 0xD800, + (cp & 0x3FF) + 0xDC00); + } + } + return s; +} + + +// +// Implementation of Encoding specification +// https://encoding.spec.whatwg.org/ +// + +// +// 3. Terminology +// + +/** + * End-of-stream is a special token that signifies no more tokens + * are in the stream. + * @const + */ var end_of_stream = -1; + +/** + * A stream represents an ordered sequence of tokens. + * + * @constructor + * @param {!(Array.|Uint8Array)} tokens Array of tokens that provide the + * stream. + */ +function Stream(tokens) { + /** @type {!Array.} */ + this.tokens = [].slice.call(tokens); +} + +Stream.prototype = { + /** + * @return {boolean} True if end-of-stream has been hit. + */ + endOfStream: function() { + return !this.tokens.length; + }, + + /** + * When a token is read from a stream, the first token in the + * stream must be returned and subsequently removed, and + * end-of-stream must be returned otherwise. + * + * @return {number} Get the next token from the stream, or + * end_of_stream. + */ + read: function() { + if (!this.tokens.length) + return end_of_stream; + return this.tokens.shift(); + }, + + /** + * When one or more tokens are prepended to a stream, those tokens + * must be inserted, in given order, before the first token in the + * stream. + * + * @param {(number|!Array.)} token The token(s) to prepend to the stream. + */ + prepend: function(token) { + if (Array.isArray(token)) { + var tokens = /**@type {!Array.}*/(token); + while (tokens.length) + this.tokens.unshift(tokens.pop()); + } else { + this.tokens.unshift(token); + } + }, + + /** + * When one or more tokens are pushed to a stream, those tokens + * must be inserted, in given order, after the last token in the + * stream. + * + * @param {(number|!Array.)} token The tokens(s) to prepend to the stream. + */ + push: function(token) { + if (Array.isArray(token)) { + var tokens = /**@type {!Array.}*/(token); + while (tokens.length) + this.tokens.push(tokens.shift()); + } else { + this.tokens.push(token); + } + } +}; + +// +// 4. Encodings +// + +// 4.1 Encoders and decoders + +/** @const */ +var finished = -1; + +/** + * @param {boolean} fatal If true, decoding errors raise an exception. + * @param {number=} opt_code_point Override the standard fallback code point. + * @return {number} The code point to insert on a decoding error. + */ +function decoderError(fatal, opt_code_point) { + if (fatal) + throw TypeError('Decoder error'); + return opt_code_point || 0xFFFD; +} + +// +// 7. API +// + +/** @const */ var DEFAULT_ENCODING = 'utf-8'; + +// 7.1 Interface TextDecoder + +/** + * @constructor + * @param {string=} encoding The label of the encoding; + * defaults to 'utf-8'. + * @param {Object=} options + */ +function TextDecoder(encoding, options) { + if (!(this instanceof TextDecoder)) { + return new TextDecoder(encoding, options); + } + encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING; + if (encoding !== DEFAULT_ENCODING) { + throw new Error('Encoding not supported. Only utf-8 is supported'); + } + options = ToDictionary(options); + + /** @private @type {boolean} */ + this._streaming = false; + /** @private @type {boolean} */ + this._BOMseen = false; + /** @private @type {?Decoder} */ + this._decoder = null; + /** @private @type {boolean} */ + this._fatal = Boolean(options['fatal']); + /** @private @type {boolean} */ + this._ignoreBOM = Boolean(options['ignoreBOM']); + + Object.defineProperty(this, 'encoding', {value: 'utf-8'}); + Object.defineProperty(this, 'fatal', {value: this._fatal}); + Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM}); +} + +TextDecoder.prototype = { + /** + * @param {ArrayBufferView=} input The buffer of bytes to decode. + * @param {Object=} options + * @return {string} The decoded string. + */ + decode: function decode(input, options) { + var bytes; + if (typeof input === 'object' && input instanceof ArrayBuffer) { + bytes = new Uint8Array(input); + } else if (typeof input === 'object' && 'buffer' in input && + input.buffer instanceof ArrayBuffer) { + bytes = new Uint8Array(input.buffer, + input.byteOffset, + input.byteLength); + } else { + bytes = new Uint8Array(0); + } + + options = ToDictionary(options); + + if (!this._streaming) { + this._decoder = new UTF8Decoder({fatal: this._fatal}); + this._BOMseen = false; + } + this._streaming = Boolean(options['stream']); + + var input_stream = new Stream(bytes); + + var code_points = []; + + /** @type {?(number|!Array.)} */ + var result; + + while (!input_stream.endOfStream()) { + result = this._decoder.handler(input_stream, input_stream.read()); + if (result === finished) + break; + if (result === null) + continue; + if (Array.isArray(result)) + code_points.push.apply(code_points, /**@type {!Array.}*/(result)); + else + code_points.push(result); + } + if (!this._streaming) { + do { + result = this._decoder.handler(input_stream, input_stream.read()); + if (result === finished) + break; + if (result === null) + continue; + if (Array.isArray(result)) + code_points.push.apply(code_points, /**@type {!Array.}*/(result)); + else + code_points.push(result); + } while (!input_stream.endOfStream()); + this._decoder = null; + } + + if (code_points.length) { + // If encoding is one of utf-8, utf-16be, and utf-16le, and + // ignore BOM flag and BOM seen flag are unset, run these + // subsubsteps: + if (['utf-8'].indexOf(this.encoding) !== -1 && + !this._ignoreBOM && !this._BOMseen) { + // If token is U+FEFF, set BOM seen flag. + if (code_points[0] === 0xFEFF) { + this._BOMseen = true; + code_points.shift(); + } else { + // Otherwise, if token is not end-of-stream, set BOM seen + // flag and append token to output. + this._BOMseen = true; + } + } + } + + return codePointsToString(code_points); + } +}; + +// 7.2 Interface TextEncoder + +/** + * @constructor + * @param {string=} encoding The label of the encoding; + * defaults to 'utf-8'. + * @param {Object=} options + */ +function TextEncoder(encoding, options) { + if (!(this instanceof TextEncoder)) + return new TextEncoder(encoding, options); + encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING; + if (encoding !== DEFAULT_ENCODING) { + throw new Error('Encoding not supported. Only utf-8 is supported'); + } + options = ToDictionary(options); + + /** @private @type {boolean} */ + this._streaming = false; + /** @private @type {?Encoder} */ + this._encoder = null; + /** @private @type {{fatal: boolean}} */ + this._options = {fatal: Boolean(options['fatal'])}; + + Object.defineProperty(this, 'encoding', {value: 'utf-8'}); +} + +TextEncoder.prototype = { + /** + * @param {string=} opt_string The string to encode. + * @param {Object=} options + * @return {Uint8Array} Encoded bytes, as a Uint8Array. + */ + encode: function encode(opt_string, options) { + opt_string = opt_string ? String(opt_string) : ''; + options = ToDictionary(options); + + // NOTE: This option is nonstandard. None of the encodings + // permitted for encoding (i.e. UTF-8, UTF-16) are stateful, + // so streaming is not necessary. + if (!this._streaming) + this._encoder = new UTF8Encoder(this._options); + this._streaming = Boolean(options['stream']); + + var bytes = []; + var input_stream = new Stream(stringToCodePoints(opt_string)); + /** @type {?(number|!Array.)} */ + var result; + while (!input_stream.endOfStream()) { + result = this._encoder.handler(input_stream, input_stream.read()); + if (result === finished) + break; + if (Array.isArray(result)) + bytes.push.apply(bytes, /**@type {!Array.}*/(result)); + else + bytes.push(result); + } + if (!this._streaming) { + while (true) { + result = this._encoder.handler(input_stream, input_stream.read()); + if (result === finished) + break; + if (Array.isArray(result)) + bytes.push.apply(bytes, /**@type {!Array.}*/(result)); + else + bytes.push(result); + } + this._encoder = null; + } + return new Uint8Array(bytes); + } +}; + +// +// 8. The encoding +// + +// 8.1 utf-8 + +/** + * @constructor + * @implements {Decoder} + * @param {{fatal: boolean}} options + */ +function UTF8Decoder(options) { + var fatal = options.fatal; + + // utf-8's decoder's has an associated utf-8 code point, utf-8 + // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8 + // lower boundary (initially 0x80), and a utf-8 upper boundary + // (initially 0xBF). + var /** @type {number} */ utf8_code_point = 0, + /** @type {number} */ utf8_bytes_seen = 0, + /** @type {number} */ utf8_bytes_needed = 0, + /** @type {number} */ utf8_lower_boundary = 0x80, + /** @type {number} */ utf8_upper_boundary = 0xBF; + + /** + * @param {Stream} stream The stream of bytes being decoded. + * @param {number} bite The next byte read from the stream. + * @return {?(number|!Array.)} The next code point(s) + * decoded, or null if not enough data exists in the input + * stream to decode a complete code point. + */ + this.handler = function(stream, bite) { + // 1. If byte is end-of-stream and utf-8 bytes needed is not 0, + // set utf-8 bytes needed to 0 and return error. + if (bite === end_of_stream && utf8_bytes_needed !== 0) { + utf8_bytes_needed = 0; + return decoderError(fatal); + } + + // 2. If byte is end-of-stream, return finished. + if (bite === end_of_stream) + return finished; + + // 3. If utf-8 bytes needed is 0, based on byte: + if (utf8_bytes_needed === 0) { + + // 0x00 to 0x7F + if (inRange(bite, 0x00, 0x7F)) { + // Return a code point whose value is byte. + return bite; + } + + // 0xC2 to 0xDF + if (inRange(bite, 0xC2, 0xDF)) { + // Set utf-8 bytes needed to 1 and utf-8 code point to byte + // − 0xC0. + utf8_bytes_needed = 1; + utf8_code_point = bite - 0xC0; + } + + // 0xE0 to 0xEF + else if (inRange(bite, 0xE0, 0xEF)) { + // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0. + if (bite === 0xE0) + utf8_lower_boundary = 0xA0; + // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F. + if (bite === 0xED) + utf8_upper_boundary = 0x9F; + // 3. Set utf-8 bytes needed to 2 and utf-8 code point to + // byte − 0xE0. + utf8_bytes_needed = 2; + utf8_code_point = bite - 0xE0; + } + + // 0xF0 to 0xF4 + else if (inRange(bite, 0xF0, 0xF4)) { + // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90. + if (bite === 0xF0) + utf8_lower_boundary = 0x90; + // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F. + if (bite === 0xF4) + utf8_upper_boundary = 0x8F; + // 3. Set utf-8 bytes needed to 3 and utf-8 code point to + // byte − 0xF0. + utf8_bytes_needed = 3; + utf8_code_point = bite - 0xF0; + } + + // Otherwise + else { + // Return error. + return decoderError(fatal); + } + + // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code + // point to utf-8 code point << (6 × utf-8 bytes needed) and + // return continue. + utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed); + return null; + } + + // 4. If byte is not in the range utf-8 lower boundary to utf-8 + // upper boundary, run these substeps: + if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) { + + // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8 + // bytes seen to 0, set utf-8 lower boundary to 0x80, and set + // utf-8 upper boundary to 0xBF. + utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0; + utf8_lower_boundary = 0x80; + utf8_upper_boundary = 0xBF; + + // 2. Prepend byte to stream. + stream.prepend(bite); + + // 3. Return error. + return decoderError(fatal); + } + + // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary + // to 0xBF. + utf8_lower_boundary = 0x80; + utf8_upper_boundary = 0xBF; + + // 6. Increase utf-8 bytes seen by one and set utf-8 code point + // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes + // needed − utf-8 bytes seen)). + utf8_bytes_seen += 1; + utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen)); + + // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed, + // continue. + if (utf8_bytes_seen !== utf8_bytes_needed) + return null; + + // 8. Let code point be utf-8 code point. + var code_point = utf8_code_point; + + // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes + // seen to 0. + utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0; + + // 10. Return a code point whose value is code point. + return code_point; + }; +} + +/** + * @constructor + * @implements {Encoder} + * @param {{fatal: boolean}} options + */ +function UTF8Encoder(options) { + var fatal = options.fatal; + /** + * @param {Stream} stream Input stream. + * @param {number} code_point Next code point read from the stream. + * @return {(number|!Array.)} Byte(s) to emit. + */ + this.handler = function(stream, code_point) { + // 1. If code point is end-of-stream, return finished. + if (code_point === end_of_stream) + return finished; + + // 2. If code point is in the range U+0000 to U+007F, return a + // byte whose value is code point. + if (inRange(code_point, 0x0000, 0x007f)) + return code_point; + + // 3. Set count and offset based on the range code point is in: + var count, offset; + // U+0080 to U+07FF: 1 and 0xC0 + if (inRange(code_point, 0x0080, 0x07FF)) { + count = 1; + offset = 0xC0; + } + // U+0800 to U+FFFF: 2 and 0xE0 + else if (inRange(code_point, 0x0800, 0xFFFF)) { + count = 2; + offset = 0xE0; + } + // U+10000 to U+10FFFF: 3 and 0xF0 + else if (inRange(code_point, 0x10000, 0x10FFFF)) { + count = 3; + offset = 0xF0; + } + + // 4.Let bytes be a byte sequence whose first byte is (code + // point >> (6 × count)) + offset. + var bytes = [(code_point >> (6 * count)) + offset]; + + // 5. Run these substeps while count is greater than 0: + while (count > 0) { + + // 1. Set temp to code point >> (6 × (count − 1)). + var temp = code_point >> (6 * (count - 1)); + + // 2. Append to bytes 0x80 | (temp & 0x3F). + bytes.push(0x80 | (temp & 0x3F)); + + // 3. Decrease count by one. + count -= 1; + } + + // 6. Return bytes bytes, in order. + return bytes; + }; +} + +exports.TextEncoder = TextEncoder; +exports.TextDecoder = TextDecoder; + +/***/ }), + +/***/ 70206: +/*!**************************************************************************************************!*\ + !*** ../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemX25519.js ***! + \**************************************************************************************************/ +/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ DhkemX25519HkdfSha256: () => (/* binding */ DhkemX25519HkdfSha256) +/* harmony export */ }); +/* harmony import */ var _hpke_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @hpke/common */ 15905); +/* harmony import */ var _dhkemPrimitives_x25519_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dhkemPrimitives/x25519.js */ 27727); + + +/** + * The DHKEM(X25519, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}. + * + * The instance of this class can be specified to the + * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteParams | CipherSuiteParams} as follows: + * + * @example + * + * ```ts + * import { + * Aes128Gcm, + * CipherSuite, + * HkdfSha256, + * DhkemX25519HkdfSha256, + * } from "@hpke/core"; + * + * const suite = new CipherSuite({ + * kem: new DhkemX25519HkdfSha256(), + * kdf: new HkdfSha256(), + * aead: new Aes128Gcm(), + * }); + * ``` + */ +class DhkemX25519HkdfSha256 extends _hpke_common__WEBPACK_IMPORTED_MODULE_0__.Dhkem { + constructor() { + const kdf = new _hpke_common__WEBPACK_IMPORTED_MODULE_0__.HkdfSha256Native(); + super(_hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemX25519HkdfSha256, new _dhkemPrimitives_x25519_js__WEBPACK_IMPORTED_MODULE_1__.X25519(kdf), kdf); + /** KemId.DhkemX25519HkdfSha256 (0x0020) */ + Object.defineProperty(this, "id", { + enumerable: true, + configurable: true, + writable: true, + value: _hpke_common__WEBPACK_IMPORTED_MODULE_0__.KemId.DhkemX25519HkdfSha256 + }); + /** 32 */ + Object.defineProperty(this, "secretSize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + /** 32 */ + Object.defineProperty(this, "encSize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + /** 32 */ + Object.defineProperty(this, "publicKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + /** 32 */ + Object.defineProperty(this, "privateKeySize", { + enumerable: true, + configurable: true, + writable: true, + value: 32 + }); + } +} + + +/***/ }), + +/***/ 70336: +/*!********************************************************************************************************************************************************************************************************************************************************************************************************************!*\ + !*** ../node_modules/.pnpm/webpack-dev-server@5.2.2_bufferutil@4.1.0_tslib@2.8.1_utf-8-validate@6.0.6_webpack-cli@5.1.4_webpack@5.102.1/node_modules/webpack-dev-server/client/index.js?protocol=ws%3A&hostname=0.0.0.0&port=8086&pathname=%2Fws&logging=info&overlay=true&reconnect=10&hot=true&live-reload=true ***! + \********************************************************************************************************************************************************************************************************************************************************************************************************************/ +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +var __resourceQuery = "?protocol=ws%3A&hostname=0.0.0.0&port=8086&pathname=%2Fws&logging=info&overlay=true&reconnect=10&hot=true&live-reload=true"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ createSocketURL: () => (/* binding */ createSocketURL), +/* harmony export */ getCurrentScriptSource: () => (/* binding */ getCurrentScriptSource), +/* harmony export */ parseURL: () => (/* binding */ parseURL) +/* harmony export */ }); +/* harmony import */ var webpack_hot_log_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack/hot/log.js */ 66264); +/* harmony import */ var webpack_hot_log_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webpack_hot_log_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var webpack_hot_emitter_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! webpack/hot/emitter.js */ 98920); +/* harmony import */ var webpack_hot_emitter_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(webpack_hot_emitter_js__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var _socket_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./socket.js */ 17527); +/* harmony import */ var _overlay_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./overlay.js */ 53820); +/* harmony import */ var _utils_log_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/log.js */ 49708); +/* harmony import */ var _utils_sendMessage_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/sendMessage.js */ 21999); +/* harmony import */ var _progress_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./progress.js */ 63397); +function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } +function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } +function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +/* global __resourceQuery, __webpack_hash__ */ +/// + + + + + + + + +/** + * @typedef {Object} OverlayOptions + * @property {boolean | (error: Error) => boolean} [warnings] + * @property {boolean | (error: Error) => boolean} [errors] + * @property {boolean | (error: Error) => boolean} [runtimeErrors] + * @property {string} [trustedTypesPolicyName] + */ + +/** + * @typedef {Object} Options + * @property {boolean} hot + * @property {boolean} liveReload + * @property {boolean} progress + * @property {boolean | OverlayOptions} overlay + * @property {string} [logging] + * @property {number} [reconnect] + */ + +/** + * @typedef {Object} Status + * @property {boolean} isUnloading + * @property {string} currentHash + * @property {string} [previousHash] + */ + +/** + * @param {boolean | { warnings?: boolean | string; errors?: boolean | string; runtimeErrors?: boolean | string; }} overlayOptions + */ +var decodeOverlayOptions = function decodeOverlayOptions(overlayOptions) { + if (_typeof(overlayOptions) === "object") { + ["warnings", "errors", "runtimeErrors"].forEach(function (property) { + if (typeof overlayOptions[property] === "string") { + var overlayFilterFunctionString = decodeURIComponent(overlayOptions[property]); + + // eslint-disable-next-line no-new-func + overlayOptions[property] = new Function("message", "var callback = ".concat(overlayFilterFunctionString, "\n return callback(message)")); + } + }); + } +}; + +/** + * @type {Status} + */ +var status = { + isUnloading: false, + // eslint-disable-next-line camelcase + currentHash: __webpack_require__.h() +}; + +/** + * @returns {string} + */ +var getCurrentScriptSource = function getCurrentScriptSource() { + // `document.currentScript` is the most accurate way to find the current script, + // but is not supported in all browsers. + if (document.currentScript) { + return document.currentScript.getAttribute("src"); + } + + // Fallback to getting all scripts running in the document. + var scriptElements = document.scripts || []; + var scriptElementsWithSrc = Array.prototype.filter.call(scriptElements, function (element) { + return element.getAttribute("src"); + }); + if (scriptElementsWithSrc.length > 0) { + var currentScript = scriptElementsWithSrc[scriptElementsWithSrc.length - 1]; + return currentScript.getAttribute("src"); + } + + // Fail as there was no script to use. + throw new Error("[webpack-dev-server] Failed to get current script source."); +}; + +/** + * @param {string} resourceQuery + * @returns {{ [key: string]: string | boolean }} + */ +var parseURL = function parseURL(resourceQuery) { + /** @type {{ [key: string]: string }} */ + var result = {}; + if (typeof resourceQuery === "string" && resourceQuery !== "") { + var searchParams = resourceQuery.slice(1).split("&"); + for (var i = 0; i < searchParams.length; i++) { + var pair = searchParams[i].split("="); + result[pair[0]] = decodeURIComponent(pair[1]); + } + } else { + // Else, get the url from the \ No newline at end of file + + + + + + Turnkey Export + + + + + + + +

Export Key Material

+

+ + This public key will be sent along with a private key ID or wallet ID + inside of a new EXPORT_PRIVATE_KEY or + EXPORT_WALLET activity + +

+
+ + + +
+
+
+
+

Inject Key Export Bundle

+

+ The export bundle comes from the parent page and is composed of a + public key and an encrypted payload. The payload is encrypted to this + document's embedded key (stored in local storage and displayed above). + The scheme relies on + HPKE (RFC 9180). +

+
+ + + +
+ + +
+ + +
+
+
+

Inject Wallet Export Bundle

+

+ The export bundle comes from the parent page and is composed of a + public key and an encrypted payload. The payload is encrypted to this + document's embedded key (stored in local storage and displayed above). + The scheme relies on + HPKE (RFC 9180). +

+
+ + + +
+ + +
+
+
+

Sign Transaction

+

+ Input a serialized transaction to sign. +

+
+ + + +
+
+
+

Sign Message

+

+ Input a serialized message to sign. +

+
+ + + +
+
+
+

Message log

+

+ Below we display a log of the messages sent / received. The forms above + send messages, and the code communicates results by sending events via + the postMessage API. +

+
+
+ + diff --git a/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css b/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css deleted file mode 100644 index 671526a9..00000000 --- a/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css +++ /dev/null @@ -1,83 +0,0 @@ -body { - text-align: center; - font-family: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande", - "Lucida Sans Unicode", Geneva, Verdana, sans-serif; - max-width: 1024px; - margin: auto; -} - -label { - display: inline-block; - width: 8em; -} - -form { - text-align: left; -} - -input[type="text"], -input:not([type]), -select { - width: 40em; - margin: 0.5em; - font-family: "Courier New", Courier, monospace; - font-size: 1em; - height: 1.8em; - color: rgb(18, 87, 18); - border: 1px rgb(217, 240, 221) solid; - border-radius: 4px; -} - -input:disabled { - background-color: rgb(239, 243, 240); -} - -#reset { - color: white; - width: 7em; - font-size: 1em; - padding: 0.38em; - border-radius: 4px; - background-color: rgb(187, 100, 100); - border: 1px rgb(112, 42, 42) solid; - cursor: pointer; - display: inline; -} - -#inject-key, -#inject-wallet, -#sign-transaction, -#sign-message { - color: white; - width: 7em; - font-size: 1em; - padding: 0.38em; - border-radius: 4px; - background-color: rgb(50, 44, 44); - border: 1px rgb(33, 33, 33) solid; - cursor: pointer; - display: inline; -} - -#message-log { - border: 1px #2a2828 solid; - padding: 0 0.7em; - border-radius: 4px; - margin-top: 2em; - max-width: 800px; - margin: auto; - display: block; -} - -#message-log p { - font-size: 0.9em; - text-align: left; - word-break: break-all; -} - -.hidden { - display: none; -} - - -/*# sourceMappingURL=styles.e084a69a94c0575bc6ba.css.map*/ \ No newline at end of file diff --git a/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css.map b/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css.map deleted file mode 100644 index d14debfd..00000000 --- a/export-and-sign/dist/styles.e084a69a94c0575bc6ba.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"styles.e084a69a94c0575bc6ba.css","mappings":"AAAA;EACE,kBAAkB;EAClB;sDACoD;EACpD,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,qBAAqB;EACrB,UAAU;AACZ;;AAEA;EACE,gBAAgB;AAClB;;AAEA;;;EAGE,WAAW;EACX,aAAa;EACb,8CAA8C;EAC9C,cAAc;EACd,aAAa;EACb,sBAAsB;EACtB,oCAAoC;EACpC,kBAAkB;AACpB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;EACE,YAAY;EACZ,UAAU;EACV,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,oCAAoC;EACpC,kCAAkC;EAClC,eAAe;EACf,eAAe;AACjB;;AAEA;;;;EAIE,YAAY;EACZ,UAAU;EACV,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,iCAAiC;EACjC,iCAAiC;EACjC,eAAe;EACf,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,gBAAgB;EAChB,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,aAAa;AACf","sources":["webpack://export-and-sign/./src/styles.css"],"sourcesContent":["body {\n text-align: center;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n max-width: 1024px;\n margin: auto;\n}\n\nlabel {\n display: inline-block;\n width: 8em;\n}\n\nform {\n text-align: left;\n}\n\ninput[type=\"text\"],\ninput:not([type]),\nselect {\n width: 40em;\n margin: 0.5em;\n font-family: \"Courier New\", Courier, monospace;\n font-size: 1em;\n height: 1.8em;\n color: rgb(18, 87, 18);\n border: 1px rgb(217, 240, 221) solid;\n border-radius: 4px;\n}\n\ninput:disabled {\n background-color: rgb(239, 243, 240);\n}\n\n#reset {\n color: white;\n width: 7em;\n font-size: 1em;\n padding: 0.38em;\n border-radius: 4px;\n background-color: rgb(187, 100, 100);\n border: 1px rgb(112, 42, 42) solid;\n cursor: pointer;\n display: inline;\n}\n\n#inject-key,\n#inject-wallet,\n#sign-transaction,\n#sign-message {\n color: white;\n width: 7em;\n font-size: 1em;\n padding: 0.38em;\n border-radius: 4px;\n background-color: rgb(50, 44, 44);\n border: 1px rgb(33, 33, 33) solid;\n cursor: pointer;\n display: inline;\n}\n\n#message-log {\n border: 1px #2a2828 solid;\n padding: 0 0.7em;\n border-radius: 4px;\n margin-top: 2em;\n max-width: 800px;\n margin: auto;\n display: block;\n}\n\n#message-log p {\n font-size: 0.9em;\n text-align: left;\n word-break: break-all;\n}\n\n.hidden {\n display: none;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/export-and-sign/index.test.js b/export-and-sign/index.test.ts similarity index 84% rename from export-and-sign/index.test.js rename to export-and-sign/index.test.ts index 341c5016..c2a28158 100644 --- a/export-and-sign/index.test.js +++ b/export-and-sign/index.test.ts @@ -1,7 +1,4 @@ import "@testing-library/jest-dom"; -import { JSDOM } from "jsdom"; -import fs from "fs"; -import path from "path"; import * as crypto from "crypto"; import { DEFAULT_TTL_MILLISECONDS, @@ -19,6 +16,7 @@ import { recoverMessageAddress, } from "viem"; import { privateKeyToAccount } from "viem/accounts"; +import { TKHQ } from "./src/turnkey-core.js"; jest.mock("@solana/web3.js", () => { const mockKeypair = { @@ -48,54 +46,24 @@ jest.mock("@solana/web3.js", () => { }; }); -const html = fs - .readFileSync(path.resolve(__dirname, "./src/index.template.html"), "utf8") - .replace("__TURNKEY_SIGNER_ENVIRONMENT__", "prod"); - -let dom; -let TKHQ; -let TKHQModule; - -describe("TKHQ", () => { - beforeEach(async () => { - dom = new JSDOM(html, { - runScripts: "dangerously", // For script tags - url: "http://localhost", // For local storage - - // Necessary for TextDecoder to be available. - // See https://github.com/jsdom/jsdom/issues/2524 - beforeParse(window) { - window.TextDecoder = TextDecoder; - window.TextEncoder = TextEncoder; - window.__TURNKEY_SIGNER_ENVIRONMENT__ = "prod"; // Hardcode for testing - }, - }); - - // Necessary for crypto to be available. - // See https://github.com/jsdom/jsdom/issues/1612 - Object.defineProperty(dom.window, "crypto", { - value: crypto.webcrypto, - }); - - // Create a script element and inject the bundled TKHQ utilities - global.window = dom.window; - global.document = dom.window.document; - global.localStorage = dom.window.localStorage; - global.crypto = crypto.webcrypto; - - const module = await import("./src/turnkey-core.js"); - TKHQModule = module.TKHQ; +beforeAll(async () => { + Object.defineProperty(window, "TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", { + value: "prod", + }); - // Expose TKHQ module via DOM window for testing - dom.window.TKHQ = TKHQModule; - TKHQ = dom.window.TKHQ; + // Necessary for crypto to be available. + // See https://github.com/jsdom/jsdom/issues/1612 + Object.defineProperty(window, "crypto", { + value: crypto.webcrypto, }); +}); +describe("TKHQ", () => { describe("LocalStorage with expiry", () => { it("gets and sets items with expiry localStorage", async () => { // Set a TTL of 1000ms TKHQ.setItemWithExpiry("k", "v", 1000); - let item = JSON.parse(dom.window.localStorage.getItem("k")); + let item = JSON.parse(window.localStorage.getItem("k")!); expect(item.value).toBe("v"); expect(item.expiry).toBeTruthy(); @@ -106,7 +74,7 @@ describe("TKHQ", () => { // Test expired item: use setItemWithExpiry, then manually set expiry in the past TKHQ.setItemWithExpiry("a", "b", 500); // Verify the item was set correctly with setItemWithExpiry - let itemA = JSON.parse(dom.window.localStorage.getItem("a")); + let itemA = JSON.parse(window.localStorage.getItem("a")!); expect(itemA.value).toBe("b"); expect(itemA.expiry).toBeTruthy(); @@ -115,24 +83,28 @@ describe("TKHQ", () => { value: "b", expiry: new Date().getTime() - 1000, }; - dom.window.localStorage.setItem("a", JSON.stringify(expiredItem)); + window.localStorage.setItem("a", JSON.stringify(expiredItem)); const expiredResult = TKHQ.getItemWithExpiry("a"); expect(expiredResult).toBeNull(); // Returns null if getItemWithExpiry is called for item without expiry - dom.window.localStorage.setItem("k", JSON.stringify({ value: "v" })); + window.localStorage.setItem("k", JSON.stringify({ value: "v" })); item = TKHQ.getItemWithExpiry("k"); expect(item).toBeNull(); }); }); describe("Embedded key management", () => { + beforeEach(() => { + window.localStorage.clear(); + }); + it("gets and sets embedded key in localStorage", async () => { expect(TKHQ.getEmbeddedKey()).toBe(null); // Set a dummy "key" - TKHQ.setEmbeddedKey({ foo: "bar" }); - expect(TKHQ.getEmbeddedKey()).toEqual({ foo: "bar" }); + TKHQ.setEmbeddedKey({ alg: "bar" }); + expect(TKHQ.getEmbeddedKey()).toEqual({ alg: "bar" }); }); it("inits embedded key and is idempotent", async () => { @@ -222,8 +194,9 @@ describe("TKHQ", () => { "98,117,102,102,101,114" ); - // Error case: bad value + // expect(() => { + // @ts-expect-error Error case: bad value TKHQ.uint8arrayFromHexString({}); }).toThrow("cannot create uint8array from invalid hex string"); // Error case: empty string @@ -434,18 +407,22 @@ describe("TKHQ", () => { describe("Settings and styles validation", () => { it("validates styles", async () => { - let simpleValid = { padding: "10px" }; - expect(TKHQ.validateStyles(simpleValid)).toEqual(simpleValid); + const simpleValid1 = { padding: "10px" }; + expect(TKHQ.validateStyles(simpleValid1)).toEqual(simpleValid1); - simpleValid = { padding: "10px", margin: "10px", fontSize: "16px" }; - expect(TKHQ.validateStyles(simpleValid)).toEqual(simpleValid); + const simpleValid2 = { + padding: "10px", + margin: "10px", + fontSize: "16px", + }; + expect(TKHQ.validateStyles(simpleValid2)).toEqual(simpleValid2); let simpleValidPadding = { "padding ": "10px", margin: "10px", fontSize: "16px", }; - expect(TKHQ.validateStyles(simpleValidPadding)).toEqual(simpleValid); + expect(TKHQ.validateStyles(simpleValidPadding)).toEqual(simpleValid2); let simpleInvalidCase = { padding: "10px", @@ -560,9 +537,7 @@ describe("Event Handler Expiration Flow", () => { }); const EXPIRED_TIME_MS = DEFAULT_TTL_MILLISECONDS + 1; - let dom; - let TKHQ; - let sendMessageSpy; + let sendMessageSpy: jest.SpyInstance; function buildBundle(organizationId = "org-test") { const signedData = { @@ -587,32 +562,14 @@ describe("Event Handler Expiration Flow", () => { beforeEach(async () => { jest.useFakeTimers().setSystemTime(new Date("2025-01-01T00:00:00Z")); - dom = new JSDOM( - `
`, - { - url: "http://localhost", - } - ); - - global.window = dom.window; - global.document = dom.window.document; - global.localStorage = dom.window.localStorage; - global.TextEncoder = TextEncoder; - global.TextDecoder = TextDecoder; - global.crypto = crypto.webcrypto; - - const module = await import("./src/turnkey-core.js"); - TKHQ = module.TKHQ; - dom.window.TKHQ = TKHQ; - sendMessageSpy = jest .spyOn(TKHQ, "sendMessageUp") .mockImplementation(() => {}); jest.spyOn(TKHQ, "verifyEnclaveSignature").mockResolvedValue(true); // Set a dummy embedded key for testing - TKHQ.setEmbeddedKey({ foo: "bar" }); - expect(TKHQ.getEmbeddedKey()).toEqual({ foo: "bar" }); + TKHQ.setEmbeddedKey({ alg: "bar" }); + expect(TKHQ.getEmbeddedKey()).toEqual({ alg: "bar" }); jest.spyOn(TKHQ, "onResetEmbeddedKey").mockImplementation(() => {}); jest.spyOn(TKHQ, "uint8arrayFromHexString").mockImplementation((hex) => { if (typeof hex !== "string" || hex.length === 0 || hex.length % 2 !== 0) { @@ -643,10 +600,6 @@ describe("Event Handler Expiration Flow", () => { afterEach(() => { jest.useRealTimers(); jest.restoreAllMocks(); - delete global.window; - delete global.document; - delete global.localStorage; - delete global.crypto; }); it("allows signing before expiry", async () => { @@ -695,7 +648,7 @@ describe("Event Handler Expiration Flow", () => { await onSignTransaction(requestId, serializedTransaction, undefined); } catch (e) { // onSignTransaction throws when key is expired, simulate the message listener error handling - TKHQ.sendMessageUp("ERROR", e.toString(), requestId); + TKHQ.sendMessageUp("ERROR", String(e), requestId); } const keyAddress = "default"; @@ -731,7 +684,7 @@ describe("Event Handler Expiration Flow", () => { try { await onSignTransaction(requestId, serializedTransaction, "test-address"); } catch (e) { - errorMessage = e.toString(); + errorMessage = String(e); expect(errorMessage).toContain("key bytes have expired"); } @@ -740,7 +693,7 @@ describe("Event Handler Expiration Flow", () => { try { await onSignTransaction(requestId, serializedTransaction, "test-address"); } catch (e) { - errorMessage = e.toString(); + errorMessage = String(e); expect(errorMessage).toContain("key bytes not found"); expect(errorMessage).not.toContain("expired"); } @@ -809,14 +762,14 @@ describe("Event Handler Expiration Flow", () => { try { await onSignTransaction(requestId, serializedTransaction, "key1"); } catch (e) { - expect(e.toString()).toContain("key bytes have expired"); + expect(String(e)).toContain("key bytes have expired"); } // Verify key1 was cleared (second attempt should say "not found") try { await onSignTransaction(requestId, serializedTransaction, "key1"); } catch (e) { - expect(e.toString()).toContain("key bytes not found"); + expect(String(e)).toContain("key bytes not found"); } // Verify key2 still works (proves it wasn't cleared) @@ -850,15 +803,15 @@ describe("Event Handler Expiration Flow", () => { try { await onSignTransaction(requestId, serializedTransaction, undefined); } catch (e) { - expect(e.toString()).toContain("key bytes have expired"); + expect(String(e)).toContain("key bytes have expired"); } // Second attempt: should get "not found" error (proves key was removed) try { await onSignTransaction(requestId, serializedTransaction, undefined); } catch (e) { - expect(e.toString()).toContain("key bytes not found"); - expect(e.toString()).not.toContain("expired"); + expect(String(e)).toContain("key bytes not found"); + expect(String(e)).not.toContain("expired"); } }); }); @@ -872,9 +825,7 @@ describe("EVM Signing", () => { "0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"; const evmAccount = privateKeyToAccount(EVM_PRIVATE_KEY); - let dom; - let TKHQ; - let sendMessageSpy; + let sendMessageSpy: jest.SpyInstance; function buildBundle(organizationId = "org-test") { const signedData = { @@ -899,27 +850,11 @@ describe("EVM Signing", () => { beforeEach(async () => { jest.useFakeTimers().setSystemTime(new Date("2025-01-01T00:00:00Z")); - dom = new JSDOM( - `
`, - { url: "http://localhost" } - ); - - global.window = dom.window; - global.document = dom.window.document; - global.localStorage = dom.window.localStorage; - global.TextEncoder = TextEncoder; - global.TextDecoder = TextDecoder; - global.crypto = crypto.webcrypto; - - const module = await import("./src/turnkey-core.js"); - TKHQ = module.TKHQ; - dom.window.TKHQ = TKHQ; - sendMessageSpy = jest .spyOn(TKHQ, "sendMessageUp") .mockImplementation(() => {}); jest.spyOn(TKHQ, "verifyEnclaveSignature").mockResolvedValue(true); - TKHQ.setEmbeddedKey({ foo: "bar" }); + TKHQ.setEmbeddedKey({ alg: "bar" }); // Mirror the real impl (strip 0x) so both the bundle-data decode and the // HEXADECIMAL key load work. @@ -943,13 +878,9 @@ describe("EVM Signing", () => { afterEach(() => { jest.useRealTimers(); jest.restoreAllMocks(); - delete global.window; - delete global.document; - delete global.localStorage; - delete global.crypto; }); - async function injectEvmKey(address) { + async function injectEvmKey(address: string | undefined) { const HpkeDecryptMock = jest .fn() .mockResolvedValue(new Uint8Array(32).fill(9)); @@ -1058,9 +989,7 @@ describe("Embedded Key Override", () => { transaction: "00", }); - let dom; - let TKHQ; - let sendMessageSpy; + let sendMessageSpy: jest.SpyInstance; // Mock raw 32-byte P-256 private key (embedded key) // This is what Turnkey exports after HPKE decryption - raw key bytes, not a JWK. @@ -1089,30 +1018,12 @@ describe("Embedded Key Override", () => { beforeEach(async () => { jest.useFakeTimers().setSystemTime(new Date("2025-01-01T00:00:00Z")); - dom = new JSDOM( - `
`, - { - url: "http://localhost", - } - ); - - global.window = dom.window; - global.document = dom.window.document; - global.localStorage = dom.window.localStorage; - global.TextEncoder = TextEncoder; - global.TextDecoder = TextDecoder; - global.crypto = crypto.webcrypto; - - const module = await import("./src/turnkey-core.js"); - TKHQ = module.TKHQ; - dom.window.TKHQ = TKHQ; - sendMessageSpy = jest .spyOn(TKHQ, "sendMessageUp") .mockImplementation(() => {}); jest.spyOn(TKHQ, "verifyEnclaveSignature").mockResolvedValue(true); - TKHQ.setEmbeddedKey({ foo: "bar" }); + TKHQ.setEmbeddedKey({ alg: "bar" }); jest.spyOn(TKHQ, "onResetEmbeddedKey").mockImplementation(() => {}); jest.spyOn(TKHQ, "uint8arrayFromHexString").mockImplementation((hex) => { if (typeof hex !== "string" || hex.length === 0 || hex.length % 2 !== 0) { @@ -1144,10 +1055,6 @@ describe("Embedded Key Override", () => { onResetToDefaultEmbeddedKey("cleanup"); jest.useRealTimers(); jest.restoreAllMocks(); - delete global.window; - delete global.document; - delete global.localStorage; - delete global.crypto; }); describe("SET_EMBEDDED_KEY_OVERRIDE handler", () => { @@ -1216,7 +1123,7 @@ describe("Embedded Key Override", () => { // Verify the second HpkeDecrypt call used the injected key (not the embedded key) const secondCall = HpkeDecryptMock.mock.calls[1][0]; - expect(secondCall.receiverPrivJwk).not.toEqual({ foo: "bar" }); // not the embedded key + expect(secondCall.receiverPrivJwk).not.toEqual({ alg: "bar" }); // not the embedded key expect(secondCall.receiverPrivJwk.kty).toBe("EC"); expect(secondCall.receiverPrivJwk.crv).toBe("P-256"); @@ -1264,7 +1171,7 @@ describe("Embedded Key Override", () => { const lastCall = HpkeDecryptMock.mock.calls[HpkeDecryptMock.mock.calls.length - 1][0]; - expect(lastCall.receiverPrivJwk).toEqual({ foo: "bar" }); // back to the embedded key + expect(lastCall.receiverPrivJwk).toEqual({ alg: "bar" }); // back to the embedded key }); }); @@ -1346,19 +1253,18 @@ describe("Embedded Key Override", () => { const lastCall = HpkeDecryptMock.mock.calls[HpkeDecryptMock.mock.calls.length - 1][0]; - expect(lastCall.receiverPrivJwk).toEqual({ foo: "bar" }); // embedded key + expect(lastCall.receiverPrivJwk).toEqual({ alg: "bar" }); // embedded key }); }); }); // Minimal HTML supplying the DOM elements that initEventHandlers() requires. -const MINIMAL_INIT_HTML = ` +const MINIMAL_INIT_HTML = ` - -`; + `; describe("Channel Establishment Guard", () => { /** @@ -1375,49 +1281,27 @@ describe("Channel Establishment Guard", () => { * the first await), so any concurrent invocation returns immediately. */ - let dom; - let TKHQModule; - beforeEach(async () => { - dom = new JSDOM(MINIMAL_INIT_HTML, { url: "http://localhost" }); - - global.window = dom.window; - global.document = dom.window.document; - global.localStorage = dom.window.localStorage; - global.TextEncoder = TextEncoder; - global.TextDecoder = TextDecoder; - global.crypto = crypto.webcrypto; - - // initEventHandlers() calls `new AbortController()` and passes the resulting - // signal to window.addEventListener(). JSDOM validates that the signal is an - // instance of *its own* AbortSignal, not Node's native one. Shadow the global - // so that signals created inside initEventHandlers() are recognised by JSDOM. - global.AbortController = dom.window.AbortController; + window.document.body.innerHTML = MINIMAL_INIT_HTML; - const module = await import("./src/turnkey-core.js"); - TKHQModule = module.TKHQ; - - jest.spyOn(TKHQModule, "sendMessageUp").mockImplementation(() => {}); + jest.spyOn(TKHQ, "sendMessageUp").mockImplementation(() => {}); jest - .spyOn(TKHQModule, "setParentFrameMessageChannelPort") + .spyOn(TKHQ, "setParentFrameMessageChannelPort") .mockImplementation(() => {}); - jest.spyOn(TKHQModule, "initEmbeddedKey").mockResolvedValue(undefined); + jest.spyOn(TKHQ, "initEmbeddedKey").mockResolvedValue(undefined); jest - .spyOn(TKHQModule, "getEmbeddedKey") + .spyOn(TKHQ, "getEmbeddedKey") .mockReturnValue({ kty: "EC", crv: "P-256" }); jest - .spyOn(TKHQModule, "p256JWKPrivateToPublic") + .spyOn(TKHQ, "p256JWKPrivateToPublic") .mockResolvedValue(new Uint8Array(65).fill(0x04)); - jest.spyOn(TKHQModule, "uint8arrayToHexString").mockReturnValue("aabbccdd"); + jest.spyOn(TKHQ, "uint8arrayToHexString").mockReturnValue("aabbccdd"); }); afterEach(() => { + window.document.body.innerHTML = ""; + jest.restoreAllMocks(); - delete global.window; - delete global.document; - delete global.localStorage; - delete global.crypto; - delete global.AbortController; }); /** @@ -1427,8 +1311,11 @@ describe("Channel Establishment Guard", () => { * property (TKHQ.setParentFrameMessageChannelPort is mocked anyway). */ function makeInitEvent(origin = "https://app.turnkey.com") { - const port = { onmessage: null, postMessage: jest.fn() }; - const event = new dom.window.MessageEvent("message", { + const port = { + onmessage: null, + postMessage: jest.fn(), + } as unknown as MessagePort; + const event = new window.MessageEvent("message", { data: { type: "TURNKEY_INIT_MESSAGE_CHANNEL" }, ports: [port], origin, @@ -1440,16 +1327,14 @@ describe("Channel Establishment Guard", () => { initEventHandlers(jest.fn()); const { event } = makeInitEvent(); - dom.window.dispatchEvent(event); + window.dispatchEvent(event); // Allow the async handler to finish await new Promise((resolve) => setTimeout(resolve, 0)); - expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1); - expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes( - 1 - ); - expect(TKHQModule.sendMessageUp).toHaveBeenCalledWith( + expect(TKHQ.initEmbeddedKey).toHaveBeenCalledTimes(1); + expect(TKHQ.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(1); + expect(TKHQ.sendMessageUp).toHaveBeenCalledWith( "PUBLIC_KEY_READY", "aabbccdd" ); @@ -1480,24 +1365,20 @@ describe("Channel Establishment Guard", () => { ); // Dispatch both before any awaited work completes. - dom.window.dispatchEvent(event1); - dom.window.dispatchEvent(event2); + window.dispatchEvent(event1); + window.dispatchEvent(event2); await new Promise((resolve) => setTimeout(resolve, 0)); // Only the first message should have been handled. - expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1); - expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes( - 1 - ); - expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledWith( - port1 + expect(TKHQ.initEmbeddedKey).toHaveBeenCalledTimes(1); + expect(TKHQ.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(1); + expect(TKHQ.setParentFrameMessageChannelPort).toHaveBeenCalledWith(port1); + expect(TKHQ.setParentFrameMessageChannelPort).not.toHaveBeenCalledWith( + port2 ); - expect( - TKHQModule.setParentFrameMessageChannelPort - ).not.toHaveBeenCalledWith(port2); - expect(TKHQModule.sendMessageUp).toHaveBeenCalledTimes(1); - expect(TKHQModule.sendMessageUp).toHaveBeenCalledWith( + expect(TKHQ.sendMessageUp).toHaveBeenCalledTimes(1); + expect(TKHQ.sendMessageUp).toHaveBeenCalledWith( "PUBLIC_KEY_READY", "aabbccdd" ); @@ -1516,24 +1397,22 @@ describe("Channel Establishment Guard", () => { "https://malicious.example.com" ); - dom.window.dispatchEvent(event1); + window.dispatchEvent(event1); await new Promise((resolve) => setTimeout(resolve, 0)); // First handler is now fully done. - expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1); + expect(TKHQ.initEmbeddedKey).toHaveBeenCalledTimes(1); // Late second message. - dom.window.dispatchEvent(event2); + window.dispatchEvent(event2); await new Promise((resolve) => setTimeout(resolve, 0)); // Nothing new should have happened. - expect(TKHQModule.initEmbeddedKey).toHaveBeenCalledTimes(1); - expect(TKHQModule.setParentFrameMessageChannelPort).toHaveBeenCalledTimes( - 1 + expect(TKHQ.initEmbeddedKey).toHaveBeenCalledTimes(1); + expect(TKHQ.setParentFrameMessageChannelPort).toHaveBeenCalledTimes(1); + expect(TKHQ.setParentFrameMessageChannelPort).not.toHaveBeenCalledWith( + port2 ); - expect( - TKHQModule.setParentFrameMessageChannelPort - ).not.toHaveBeenCalledWith(port2); - expect(TKHQModule.sendMessageUp).toHaveBeenCalledTimes(1); + expect(TKHQ.sendMessageUp).toHaveBeenCalledTimes(1); }); }); diff --git a/export-and-sign/jest.config.js b/export-and-sign/jest.config.js deleted file mode 100644 index 47e58ba7..00000000 --- a/export-and-sign/jest.config.js +++ /dev/null @@ -1,11 +0,0 @@ -const path = require("path"); - -module.exports = { - clearMocks: true, - setupFilesAfterEnv: ["regenerator-runtime/runtime"], - testPathIgnorePatterns: ["/node_modules/"], - transformIgnorePatterns: ["node_modules/(?!(@noble|@hpke)/)"], - moduleNameMapper: { - "^@shared/(.*)$": path.resolve(__dirname, "../shared/$1"), - }, -}; diff --git a/export-and-sign/jest.config.ts b/export-and-sign/jest.config.ts new file mode 100644 index 00000000..f4ff6bed --- /dev/null +++ b/export-and-sign/jest.config.ts @@ -0,0 +1,15 @@ +import type { Config } from "jest"; + +export default { + clearMocks: true, + setupFiles: ["/jest.setup.ts"], + testEnvironment: "jsdom", + testEnvironmentOptions: { + url: "http://localhost", + }, + transform: { + "^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }], + }, + testPathIgnorePatterns: ["/node_modules/"], + transformIgnorePatterns: ["/node_modules/.pnpm/(?!(@noble|@hpke)/)"], +} satisfies Config; diff --git a/export-and-sign/jest.setup.ts b/export-and-sign/jest.setup.ts new file mode 100644 index 00000000..5a339390 --- /dev/null +++ b/export-and-sign/jest.setup.ts @@ -0,0 +1,21 @@ +import "regenerator-runtime/runtime"; +import { TextEncoder, TextDecoder } from "util"; +import { ReadableStream } from "node:stream/web"; +import { MessagePort } from "node:worker_threads"; + +if (typeof global.MessagePort === "undefined") { + global.MessagePort = MessagePort as unknown as typeof global.MessagePort; +} + +if (typeof global.ReadableStream === "undefined") { + global.ReadableStream = + ReadableStream as unknown as typeof global.ReadableStream; +} + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} diff --git a/export-and-sign/package.json b/export-and-sign/package.json index 6abc3d56..36f7524b 100644 --- a/export-and-sign/package.json +++ b/export-and-sign/package.json @@ -1,13 +1,15 @@ { - "name": "export-and-sign", + "name": "@turnkey/frames-export-and-sign", "version": "0.1.0", "main": "index.test.js", + "private": true, "scripts": { "build": "webpack --mode=production", "build:dev": "webpack --mode=development", - "start": "serve dist", + "clean": "rm -rf dist", + "start": "serve -l 8086 dist", "dev": "webpack serve --mode=development --open", - "test": "jest", + "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js", "lint": "eslint '**/*.{js,ts}'", "lint:write": "eslint '**/*.{js,ts}' --fix", "prettier:check": "prettier --check \"**/*.{css,html,js,json,md,ts,tsx,yaml,yml}\" --ignore-path ../.prettierignore", @@ -19,31 +21,37 @@ "license": "MIT", "dependencies": { "@hpke/core": "1.7.5", - "bech32": "2.0.0", "@noble/ed25519": "2.0.0", "@noble/hashes": "1.8.0", "@solana/web3.js": "1.98.4", "@turnkey/crypto": "2.8.6", + "@turnkey/encoding": "0.6.0", + "@turnkey/frames-shared": "workspace:*", + "crypto-browserify": "3.12.1", + "stream-browserify": "3.0.0", "viem": "2.45.0" }, "devDependencies": { - "@babel/core": "7.23.0", - "@babel/preset-env": "7.22.20", + "@swc/register": "0.1.10", "@testing-library/dom": "9.3.3", - "@testing-library/jest-dom": "6.1.3", - "babel-jest": "29.7.0", - "babel-loader": "9.1.3", + "@testing-library/jest-dom": "^6.9.1", + "@types/jest": "30.0.0", + "@types/jsdom": "28.0.3", "css-loader": "6.8.1", "eslint": "8.57.0", "html-webpack-plugin": "5.5.3", - "jest": "29.7.0", - "jest-environment-jsdom": "29.7.0", - "jsdom": "22.1.0", + "jest": "30.4.2", + "jest-environment-jsdom": "30.4.1", "mini-css-extract-plugin": "2.9.4", "prettier": "2.8.4", "regenerator-runtime": "0.14.1", "serve": "14.2.5", "style-loader": "3.3.3", + "ts-jest": "29.4.11", + "ts-loader": "9.6.2", + "ts-node": "10.9.2", + "typescript": "5.4.3", + "util": "0.12.5", "webpack": "5.102.1", "webpack-cli": "5.1.4", "webpack-dev-server": "5.2.2", diff --git a/export-and-sign/src/event-handlers.js b/export-and-sign/src/event-handlers.js index fb1045c2..a8c858d9 100644 --- a/export-and-sign/src/event-handlers.js +++ b/export-and-sign/src/event-handlers.js @@ -14,6 +14,8 @@ let injectedEmbeddedKey = null; export const DEFAULT_TTL_MILLISECONDS = 1000 * 24 * 60 * 60; // 24 hours or 86,400,000 milliseconds +console.warn("TextEncoder", typeof TextEncoder, typeof window.TextEncoder); + // Instantiate these once (for perf) const textEncoder = new TextEncoder(); const textDecoder = new TextDecoder(); @@ -128,7 +130,7 @@ async function onGetPublicEmbeddedKey(requestId) { /** * Encodes raw key bytes and loads them into the in-memory key store. - * @param {string} address - Wallet address (case-sensitive) + * @param {string | undefined} address - Wallet address (case-sensitive) * @param {ArrayBuffer} keyBytes - Raw decrypted private key bytes * @param {string} keyFormat - "SOLANA" | "HEXADECIMAL" * @param {string} organizationId - Organization ID @@ -177,7 +179,7 @@ async function loadKeyIntoMemory(address, keyBytes, keyFormat, organizationId) { * @param {string} organizationId * @param {string} bundle * @param {string} keyFormat - * @param {string} address + * @param {string | undefined} address * @param {Function} HpkeDecrypt // TODO: import this directly (instead of passing around) */ async function onInjectKeyBundle( @@ -221,7 +223,7 @@ async function onApplySettings(settings, requestId) { * Function triggered when SIGN_TRANSACTION event is received. * @param {string} requestId * @param {string} transaction (serialized) - * @param {string} address (case-sensitive --> enforce this, optional for backwards compatibility) + * @param {string} [address] (case-sensitive --> enforce this, optional for backwards compatibility) */ async function onSignTransaction(requestId, serializedTransaction, address) { // If no address provided, use "default" @@ -271,7 +273,7 @@ async function onSignTransaction(requestId, serializedTransaction, address) { * Function triggered when SIGN_MESSAGE event is received. * @param {string} requestId * @param {string} message (serialized, JSON-stringified) - * @param {string} address (case-sensitive --> enforce this, optional for backwards compatibility) + * @param {string} [address] (case-sensitive --> enforce this, optional for backwards compatibility) */ async function onSignMessage(requestId, serializedMessage, address) { // Backwards compatibility: if no address provided, use "default" diff --git a/export-and-sign/src/index.js b/export-and-sign/src/index.js index 421b88b9..a143b528 100644 --- a/export-and-sign/src/index.js +++ b/export-and-sign/src/index.js @@ -3,14 +3,21 @@ // Import relevant modules import { TKHQ } from "./turnkey-core.js"; import { initEventHandlers } from "./event-handlers.js"; -import { HpkeDecrypt } from "@shared/crypto-utils.js"; +import { HpkeDecrypt } from "@turnkey/frames-shared"; import "./styles.css"; // Surface TKHQ for external access window.TKHQ = TKHQ; +if (window.TURNKEY_E2E_TEST) { + console.warn("E2E TEST ENVIRONMENT DETECTED"); + TKHQ.unsafeSkipDoubleIframeCheck(); +} + // Init app document.addEventListener("DOMContentLoaded", async function () { + console.warn("DOM CONTENT LOADED"); + await TKHQ.initEmbeddedKey(); const embeddedKeyJwk = await TKHQ.getEmbeddedKey(); const targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk); @@ -25,5 +32,7 @@ document.addEventListener("DOMContentLoaded", async function () { TKHQ.applySettings(styleSettings); } + console.warn("SENDING MESSAGE UP"); + TKHQ.sendMessageUp("PUBLIC_KEY_READY", targetPubHex); }); diff --git a/export-and-sign/src/index.template.html b/export-and-sign/src/index.template.html index 8a7d556a..eb075145 100644 --- a/export-and-sign/src/index.template.html +++ b/export-and-sign/src/index.template.html @@ -5,20 +5,22 @@ Turnkey Export - + + +

Export Key Material

- This public key will be sent along with a private key ID or wallet ID + + This public key will be sent along with a private key ID or wallet ID inside of a new EXPORT_PRIVATE_KEY or - EXPORT_WALLET activity + EXPORT_WALLET activity +

diff --git a/export-and-sign/src/turnkey-core.js b/export-and-sign/src/turnkey-core.js index 8c79de79..880461d8 100644 --- a/export-and-sign/src/turnkey-core.js +++ b/export-and-sign/src/turnkey-core.js @@ -1,10 +1,10 @@ import * as nobleEd25519 from "@noble/ed25519"; import * as nobleHashes from "@noble/hashes/sha512"; import { fromDerSignature } from "@turnkey/crypto"; -import * as SharedTKHQ from "@shared/turnkey-core.js"; +import * as SharedTKHQ from "@turnkey/frames-shared"; const { - initEmbeddedKey: sharedInitEmbeddedKey, + initEmbeddedKey, generateTargetKey, setItemWithExpiry, getItemWithExpiry, @@ -25,90 +25,11 @@ const { getSettings, setSettings, parsePrivateKey, + unsafeSkipDoubleIframeCheck, validateStyles, - isDoublyIframed, - loadQuorumKey, + verifyEnclaveSignature, } = SharedTKHQ; -/** - * Creates a new public/private key pair and persists it in localStorage - */ -async function initEmbeddedKey() { - if (isDoublyIframed()) { - throw new Error("Doubly iframed"); - } - return await sharedInitEmbeddedKey(); -} - -/** - * Function to verify enclave signature on import bundle received from the server. - * @param {string} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature - * @param {string} publicSignature signature bytes encoded as a hexadecimal string - * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes - */ -async function verifyEnclaveSignature( - enclaveQuorumPublic, - publicSignature, - signedData -) { - /** Turnkey Signer enclave's public keys */ - const TURNKEY_SIGNERS_ENCLAVES = { - prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", - preprod: - "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", - }; - - // Read environment from meta tag (templated at deploy time), fall back to window variable (for testing) - let environment = null; - if (typeof document !== "undefined") { - const meta = document.querySelector( - 'meta[name="turnkey-signer-environment"]' - ); - if ( - meta && - meta.content && - meta.content !== "__TURNKEY_SIGNER_ENVIRONMENT__" - ) { - environment = meta.content; - } - } - if (!environment && typeof window !== "undefined") { - environment = window.__TURNKEY_SIGNER_ENVIRONMENT__; - } - const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = - TURNKEY_SIGNERS_ENCLAVES[environment]; - - if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { - throw new Error( - `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined` - ); - } - - if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { - throw new Error( - `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` - ); - } - - const encryptionQuorumPublicBuf = new Uint8Array( - uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) - ); - const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); - if (!quorumKey) { - throw new Error("failed to load quorum key"); - } - - // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format - const publicSignatureBuf = fromDerSignature(publicSignature); - const signedDataBuf = uint8arrayFromHexString(signedData); - return await crypto.subtle.verify( - { name: "ECDSA", hash: "SHA-256" }, - quorumKey, - publicSignatureBuf, - signedDataBuf - ); -} - /** * Returns the public key bytes for a hex-encoded Ed25519 private key. * @param {string} privateKeyHex @@ -177,4 +98,5 @@ export const TKHQ = { getSettings, setSettings, parsePrivateKey, + unsafeSkipDoubleIframeCheck, }; diff --git a/export-and-sign/tsconfig.json b/export-and-sign/tsconfig.json new file mode 100644 index 00000000..670e0b70 --- /dev/null +++ b/export-and-sign/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": ".", + "tsBuildInfoFile": "./.cache/.tsbuildinfo", + "types": ["jest"] + }, + "include": ["src/**/*.ts", "src/**/*.js", "*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/export-and-sign/webpack.config.js b/export-and-sign/webpack.config.js index 78f6c5ca..23f02d51 100644 --- a/export-and-sign/webpack.config.js +++ b/export-and-sign/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); +const webpack = require("webpack"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity"); @@ -6,9 +7,23 @@ const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity"); module.exports = (env, argv) => { const isProduction = argv.mode === "production"; + const signerEnvironment = + process.env.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE || undefined; + if (signerEnvironment != null) { + console.warn(`Applying signer environment override: ${signerEnvironment}`); + } + + const e2eTestEnvironment = !!process.env.TURNKEY_E2E_TEST; + return { mode: isProduction ? "production" : "development", context: __dirname, // Set context to frame directory so module resolution works correctly + devServer: { + port: 8086, + devMiddleware: { + writeToDisk: true, + }, + }, entry: "./src/index.js", output: { path: path.resolve(__dirname, "dist"), @@ -21,12 +36,12 @@ module.exports = (env, argv) => { module: { rules: [ { - test: /\.js$/, + test: /\.(j|t)ts?$/, exclude: /node_modules/, use: { - loader: "babel-loader", + loader: "ts-loader", options: { - presets: ["@babel/preset-env"], + transpileOnly: true, }, }, }, @@ -40,6 +55,11 @@ module.exports = (env, argv) => { ], }, plugins: [ + new webpack.DefinePlugin({ + "window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE": + JSON.stringify(signerEnvironment), + "window.TURNKEY_E2E_TEST": JSON.stringify(e2eTestEnvironment), + }), new HtmlWebpackPlugin({ template: "./src/index.template.html", filename: "index.html", @@ -79,23 +99,32 @@ module.exports = (env, argv) => { : []), ], resolve: { - extensions: [".js", ".mjs"], + extensions: [".js", ".mjs", ".ts", ".tsx"], fallback: { - crypto: false, - }, - alias: { - "@shared": path.resolve(__dirname, "../shared"), + buffer: false, + crypto: require.resolve("crypto-browserify"), + stream: require.resolve("stream-browserify"), + fs: false, + http: false, + https: false, + net: false, + os: false, + path: false, + tls: false, + url: false, + vm: false, + util: require.resolve("util"), + zlib: false, }, - conditionNames: ["import", "require", "node", "default"], // Ensure modules are resolved from frame's node_modules, not shared folder's modules: [path.resolve(__dirname, "node_modules"), "node_modules"], // Don't use package.json from shared folder for module resolution descriptionFiles: ["package.json"], // Force resolution to start from context (frame directory) not file location - symlinks: false, + symlinks: true, }, resolveLoader: { - modules: [path.resolve(__dirname, "node_modules"), "node_modules"], + modules: ["node_modules", path.resolve(__dirname, "node_modules")], }, externals: { "node:crypto": "crypto", diff --git a/export/.eslintignore b/export/.eslintignore index e7467c05..50760c29 100644 --- a/export/.eslintignore +++ b/export/.eslintignore @@ -1,6 +1,3 @@ dist node_modules - -noble-hashes.js -noble-ed25519.js -hpke-core.js \ No newline at end of file +.turbo diff --git a/export/dist/bundle.7a7963e95974af7ea4b2.js b/export/dist/bundle.7a7963e95974af7ea4b2.js new file mode 100644 index 00000000..17568fb2 --- /dev/null +++ b/export/dist/bundle.7a7963e95974af7ea4b2.js @@ -0,0 +1 @@ +(self.webpackChunk_turnkey_frames_export=self.webpackChunk_turnkey_frames_export||[]).push([[122],{741:()=>{}}]); \ No newline at end of file diff --git a/export/dist/bundle.979ac810bff953662560.js b/export/dist/bundle.979ac810bff953662560.js new file mode 100644 index 00000000..38c8e694 --- /dev/null +++ b/export/dist/bundle.979ac810bff953662560.js @@ -0,0 +1,3 @@ +/*! For license information please see bundle.979ac810bff953662560.js.LICENSE.txt */ +(()=>{"use strict";var e,t,r,n,o,a={106:(e,t,r)=>{var n=r(236);r(604);const o="TURNKEY_EMBEDDED_KEY",a="TURNKEY_SETTINGS";let i=null;function c(){return"undefined"!=typeof globalThis&&globalThis.crypto&&globalThis.crypto.subtle?globalThis.crypto.subtle:"undefined"!=typeof window&&window.crypto&&window.crypto.subtle?window.crypto.subtle:"undefined"!=typeof global&&global.crypto&&global.crypto.subtle?global.crypto.subtle:"undefined"!=typeof crypto&&crypto.subtle?crypto.subtle:null}async function u(){const e=c();if(!e)throw new Error("WebCrypto subtle API is unavailable");const t=await e.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveBits"]);return await e.exportKey("jwk",t.privateKey)}function s(){const e=f(o);return e?JSON.parse(e):null}function d(e){l(o,JSON.stringify(e),1728e5)}function l(e,t,r){const n={value:t,expiry:(new Date).getTime()+r};window.localStorage.setItem(e,JSON.stringify(n))}function f(e){const t=window.localStorage.getItem(e);if(!t)return null;const r=JSON.parse(t);return Object.prototype.hasOwnProperty.call(r,"expiry")&&Object.prototype.hasOwnProperty.call(r,"value")?(new Date).getTime()>r.expiry?(window.localStorage.removeItem(e),null):r.value:(window.localStorage.removeItem(e),null)}function p(e){if(!e||"string"!=typeof e)throw new Error("cannot create uint8array from invalid hex string");const t=e.startsWith("0x")||e.startsWith("0X")?e.slice(2):e;if(t.length%2!=0||!/^[0-9A-Fa-f]+$/.test(t))throw new Error("cannot create uint8array from invalid hex string");return new Uint8Array(t.match(/../g).map(e=>parseInt(e,16)))}function y(e,t){const r=t-e.length;if(r>0){const t=new Uint8Array(r).fill(0);return new Uint8Array([...t,...e])}if(r<0){const n=-1*r;let o=0;for(let t=0;t0;){var c=r[i];a=(c=void 0===c?a:58*c+a)>>8,r[i]=c%256,i++}}var u=n.concat(r.reverse());return new Uint8Array(u)}var m=r(252);const b=(new TextEncoder).encode("turnkey_hpke");async function E({ciphertextBuf:e,encappedKeyBuf:t,receiverPrivJwk:r}){const n=new m.RG;var o,a=await n.importKey("jwk",{...r},!1),i=new m.GR({kem:n,kdf:new m.v7,aead:new m.ws}),c=await i.createRecipientContext({recipientKey:a,enc:t,info:b}),u=h(t,await w(r));try{o=await c.open(e,u)}catch(e){throw new Error("unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: "+e.toString())}return o}function S(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof c?n:c,s=Object.create(u.prototype);return k(s,"_invoke",function(r,n,o){var a,c,u,s=0,d=o||[],l=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,c=0,u=e,f.n=r,i}};function p(r,n){for(c=r,u=n,t=0;!l&&s&&!o&&t3?(o=y===n)&&(u=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=r<2&&pn||n>y)&&(a[4]=r,a[5]=n,f.n=y,c=0))}if(o||r>1)return i;throw l=!0,n}return function(o,d,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===d&&p(d,y),c=d,u=y;(t=c<2?e:u)||!l;){a||(c?c<3?(c>1&&(f.n=-1),p(c,u)):f.n=u:f.v=u);try{if(s=2,a){if(c||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=a.return)&&t.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((t=(l=f.n<0)?u:r.call(n,f))!==i)break}catch(t){a=e,c=1,u=t}finally{s=1}}return{value:t,done:l}}}(r,o,a),!0),s}var i={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var d=[][n]?t(t([][n]())):(k(t={},n,function(){return this}),t),l=s.prototype=c.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,k(e,o,"GeneratorFunction")),e.prototype=Object.create(l),e}return u.prototype=s,k(l,"constructor",s),k(s,"constructor",u),u.displayName="GeneratorFunction",k(s,o,"GeneratorFunction"),k(l),k(l,o,"Generator"),k(l,n,function(){return this}),k(l,"toString",function(){return"[object Generator]"}),(S=function(){return{w:a,m:f}})()}function k(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}k=function(e,t,r,n){function a(t,r){k(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},k(e,t,r,n)}function x(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function I(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){x(a,n,o,i,c,"next",e)}function c(e){x(a,n,o,i,c,"throw",e)}i(void 0)})}}var O=u,T=l,_=f,A=s,N=d,P=w,C=function(e){let t="",r=[0];for(let t=0;t0;)r.push(n%58),n=n/58|0}for(let e=0;ee.toString(16).padStart(2,"0")).join("")},D=y,B=h;function M(e){return L.apply(this,arguments)}function L(){return(L=I(S().m(function e(t){var r,n,o,a,i,c;return S().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,crypto.subtle.digest("SHA-256",t);case 1:return r=e.v,n=new Uint8Array(r),e.n=2,crypto.subtle.digest("SHA-256",n);case 2:return o=e.v,a=new Uint8Array(o),i=a.slice(0,4),(c=new Uint8Array(t.length+4)).set(t,0),c.set(i,t.length),e.a(2,C(c))}},e)}))).apply(this,arguments)}var $="qpzry9x8gf2tvdw0s3jn54khce6mua7l",F=function(){for(var e={},t=0;t<32;t++)e[$[t]]=t;return e}();function H(e){for(var t=1,r=[996825010,642813549,513874426,1027748829,705979059],n=0;n>>25;t=(33554431&t)<<5^e[n];for(var a=0;a<5;a++)o>>>a&1&&(t^=r[a])}return t}function G(e){for(var t=[],r=0;r>5)}t.push(0);for(var o=0;o255)throw new Error("invalid byte value for bech32");for(t=t<<8|a,r+=8;r>=5;)r-=5,n.push(t>>r&31)}return r>0&&n.push(t<<5-r&31),n}(t),n=function(e,t){for(var r=1^H(G(e).concat(t).concat([0,0,0,0,0,0])),n=[],o=0;o<6;o++)n.push(r>>5*(5-o)&31);return n}(e,r),o=r.concat(n),a=e+"1",i=0;i>5)throw new Error("invalid bech32 word");for(t=4095&(t<<5|a),r+=5;r>=8;)r-=8,n.push(t>>r&255)}if(r>=5)throw new Error("excess padding in bech32 data");if(t&(1<t.length)throw new Error("invalid bech32: bad separator or too short");var n=t.slice(0,r),o=t.slice(r+1);if(!n||n.length<1)throw new Error("invalid bech32: HRP too short");for(var a=[],i=0;i1:window.parent!==window.top)throw new Error("Doubly iframed");null===await s()&&d(await u())},generateTargetKey:O,setItemWithExpiry:T,getItemWithExpiry:_,getEmbeddedKey:A,setEmbeddedKey:N,onResetEmbeddedKey:function(){window.localStorage.removeItem(o),window.localStorage.removeItem("TURNKEY_EMBEDDED_KEY_ORIGIN")},p256JWKPrivateToPublic:P,base58Encode:C,base58Decode:U,base58CheckEncode:M,encodeKey:function(e,t,r){return z.apply(this,arguments)},sendMessageUp:function(e,t,r){const n={type:e,value:t};r&&(n.requestId=r),i?i.postMessage(n):window.parent!==window&&window.parent.postMessage({type:e,value:t},"*"),v(`⬆️ Sent message ${e}: ${t}`)},logMessage:R,uint8arrayFromHexString:K,uint8arrayToHexString:j,setParentFrameMessageChannelPort:function(e){i=e},normalizePadding:D,fromDerSignature:n.g8,additionalAssociatedData:B,verifyEnclaveSignature:async function(e,t,r){const n=window.TURNKEY_SIGNER_ENVIRONMENT;if(void 0===n)throw new Error("Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined");const o={prod:"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569",preprod:"04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212",dev:"048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d"}[n];if(void 0===o)throw new Error("Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined");if(e&&e!==o)throw new Error(`enclave quorum public keys from client and bundle do not match. Client: ${o}. Bundle: ${e}.`);const a=new Uint8Array(p(o)),i=await async function(e){const t=c();if(!t)throw new Error("WebCrypto subtle API is unavailable");return await t.importKey("raw",e,{name:"ECDSA",namedCurve:"P-256"},!0,["verify"])}(a);if(!i)throw new Error("failed to load quorum key");const u=function(e){const t=p(e);let r=2;if(2!==t[r])throw new Error("failed to convert DER-encoded signature: invalid tag for r");r++;const n=t[r];r++;const o=t.slice(r,r+n);if(r+=n,2!==t[r])throw new Error("failed to convert DER-encoded signature: invalid tag for s");r++;const a=t[r];r++;const i=t.slice(r,r+a),c=y(o,32),u=y(i,32);return new Uint8Array([...c,...u])}(t),s=p(r),d=c();if(!d)throw new Error("WebCrypto subtle API is unavailable");return await d.verify({name:"ECDSA",hash:"SHA-256"},i,u,s)},validateStyles:function(e,t){const r={},n={padding:"^(\\d+(px|em|%|rem) ?){1,4}$",margin:"^(\\d+(px|em|%|rem) ?){1,4}$",borderWidth:"^(\\d+(px|em|rem) ?){1,4}$",borderStyle:"^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$",borderColor:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",borderRadius:"^(\\d+(px|em|%|rem) ?){1,4}$",fontSize:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$",fontWeight:"^(normal|bold|bolder|lighter|\\d{3})$",fontFamily:'^[^";<>]*$',color:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",labelColor:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",backgroundColor:"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$",width:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$",height:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$",maxWidth:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$",maxHeight:"^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$",lineHeight:"^(\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$",boxShadow:"^(none|(\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)) ?(inset)?)$",textAlign:"^(left|right|center|justify|initial|inherit)$",overflowWrap:"^(normal|break-word|anywhere)$",wordWrap:"^(normal|break-word)$",resize:"^(none|both|horizontal|vertical|block|inline)$"};return Object.entries(e).forEach(([e,t])=>{const o=e.trim();if(0===o.length)throw new Error("css style property cannot be empty");const a=n[o];if(!a)throw new Error(`invalid or unsupported css style property: "${o}"`);const i=new RegExp(a),c=t.trim();if(0==c.length)throw new Error(`css style for "${o}" is empty`);if(!i.test(c))throw new Error(`invalid css style value for property "${o}"`);r[o]=c}),r},getSettings:function(){const e=window.localStorage.getItem(a);return e?JSON.parse(e):null},setSettings:function(e){window.localStorage.setItem(a,JSON.stringify(e))},parsePrivateKey:function(e){if(Array.isArray(e))return new Uint8Array(e);if("string"==typeof e){if(e.startsWith("0x")&&(e=e.slice(2)),64===e.length&&/^[0-9a-fA-F]+$/.test(e))return p(e);try{return g(e)}catch(e){throw new Error("Invalid private key format. Use hex (64 chars) or base58 format.")}}throw new Error("Private key must be a string (hex/base58) or number array")}};function Y(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function a(r,n,o,a){var u=n&&n.prototype instanceof c?n:c,s=Object.create(u.prototype);return q(s,"_invoke",function(r,n,o){var a,c,u,s=0,d=o||[],l=!1,f={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return a=t,c=0,u=e,f.n=r,i}};function p(r,n){for(c=r,u=n,t=0;!l&&s&&!o&&t3?(o=y===n)&&(u=a[(c=a[4])?5:(c=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=r<2&&pn||n>y)&&(a[4]=r,a[5]=n,f.n=y,c=0))}if(o||r>1)return i;throw l=!0,n}return function(o,d,y){if(s>1)throw TypeError("Generator is already running");for(l&&1===d&&p(d,y),c=d,u=y;(t=c<2?e:u)||!l;){a||(c?c<3?(c>1&&(f.n=-1),p(c,u)):f.n=u:f.v=u);try{if(s=2,a){if(c||(o="next"),t=a[o]){if(!(t=t.call(a,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,c<2&&(c=0)}else 1===c&&(t=a.return)&&t.call(a),c<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),c=1);a=e}else if((t=(l=f.n<0)?u:r.call(n,f))!==i)break}catch(t){a=e,c=1,u=t}finally{s=1}}return{value:t,done:l}}}(r,o,a),!0),s}var i={};function c(){}function u(){}function s(){}t=Object.getPrototypeOf;var d=[][n]?t(t([][n]())):(q(t={},n,function(){return this}),t),l=s.prototype=c.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,q(e,o,"GeneratorFunction")),e.prototype=Object.create(l),e}return u.prototype=s,q(l,"constructor",s),q(s,"constructor",u),u.displayName="GeneratorFunction",q(s,o,"GeneratorFunction"),q(l),q(l,o,"Generator"),q(l,n,function(){return this}),q(l,"toString",function(){return"[object Generator]"}),(Y=function(){return{w:a,m:f}})()}function q(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}q=function(e,t,r,n){function a(t,r){q(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},q(e,t,r,n)}function X(e,t,r,n,o,a,i){try{var c=e[a](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,o)}function Q(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var a=e.apply(t,r);function i(e){X(a,n,o,i,c,"next",e)}function c(e){X(a,n,o,i,c,"throw",e)}i(void 0)})}}var V=null,Z=new AbortController,ee=new AbortController,te=!1,re=function(){document.getElementById("inject-key").addEventListener("click",function(){var e=Q(Y().m(function e(t){return Y().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"INJECT_KEY_EXPORT_BUNDLE",value:document.getElementById("key-export-bundle").value,keyFormat:document.getElementById("key-export-format").value,organizationId:document.getElementById("key-organization-id").value});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("inject-wallet").addEventListener("click",function(){var e=Q(Y().m(function e(t){return Y().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"INJECT_WALLET_EXPORT_BUNDLE",value:document.getElementById("wallet-export-bundle").value,organizationId:document.getElementById("wallet-organization-id").value});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("reset").addEventListener("click",function(){var e=Q(Y().m(function e(t){return Y().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"RESET_EMBEDDED_KEY"});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1)},ne=function(){var e=Q(Y().m(function e(t){var r,n,o;return Y().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t.data||"INJECT_KEY_EXPORT_BUNDLE"!=t.data.type){e.n=4;break}return J.logMessage("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.keyFormat,", ").concat(t.data.organizationId)),e.p=1,e.n=2,ce(t.data.value,t.data.keyFormat,t.data.organizationId,t.data.requestId);case 2:e.n=4;break;case 3:e.p=3,r=e.v,J.sendMessageUp("ERROR",r.toString(),t.data.requestId);case 4:if(!t.data||"INJECT_WALLET_EXPORT_BUNDLE"!=t.data.type){e.n=8;break}return J.logMessage("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.organizationId)),e.p=5,e.n=6,se(t.data.value,t.data.organizationId,t.data.requestId);case 6:e.n=8;break;case 7:e.p=7,n=e.v,J.sendMessageUp("ERROR",n.toString(),t.data.requestId);case 8:if(!t.data||"APPLY_SETTINGS"!=t.data.type){e.n=12;break}return e.p=9,e.n=10,le(t.data.value,t.data.requestId);case 10:e.n=12;break;case 11:e.p=11,o=e.v,J.sendMessageUp("ERROR",o.toString(),t.data.requestId);case 12:if(t.data&&"RESET_EMBEDDED_KEY"==t.data.type){J.logMessage("⬇️ Received message ".concat(t.data.type));try{J.onResetEmbeddedKey()}catch(e){J.sendMessageUp("ERROR",e.toString())}}case 13:return e.a(2)}},e,null,[[9,11],[5,7],[1,3]])}));return function(t){return e.apply(this,arguments)}}();function oe(e){Array.from(document.body.children).forEach(function(e){"SCRIPT"!==e.tagName&&"key-div"!==e.id&&(e.style.display="none")});var t={border:"none",color:"#555b64",fontSize:".875rem",lineHeight:"1.25rem",overflowWrap:"break-word",textAlign:"left"},r=document.getElementById("key-div");for(var n in r.innerText=e,t)r.style[n]=t[n];document.body.appendChild(r),J.applySettings(J.getSettings())}function ae(e,t){return ie.apply(this,arguments)}function ie(){return(ie=Q(Y().m(function e(t,r){var n,o,a,i,c,u;return Y().w(function(e){for(;;)switch(e.n){case 0:a=JSON.parse(t),u=a.version,e.n="v1.0.0"===u?1:12;break;case 1:if(a.data){e.n=2;break}throw new Error('missing "data" in bundle');case 2:if(a.dataSignature){e.n=3;break}throw new Error('missing "dataSignature" in bundle');case 3:if(a.enclaveQuorumPublic){e.n=4;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 4:if(J.verifyEnclaveSignature){e.n=5;break}throw new Error("method not loaded");case 5:return e.n=6,J.verifyEnclaveSignature(a.enclaveQuorumPublic,a.dataSignature,a.data);case 6:if(e.v){e.n=7;break}throw new Error("failed to verify enclave signature: ".concat(t));case 7:if(i=JSON.parse((new TextDecoder).decode(J.uint8arrayFromHexString(a.data))),r){e.n=8;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.n=9;break;case 8:if(i.organizationId&&i.organizationId===r){e.n=9;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(i.organizationId,"."));case 9:if(i.encappedPublic){e.n=10;break}throw new Error('missing "encappedPublic" in bundle signed data');case 10:if(i.ciphertext){e.n=11;break}throw new Error('missing "ciphertext" in bundle signed data');case 11:return n=J.uint8arrayFromHexString(i.encappedPublic),o=J.uint8arrayFromHexString(i.ciphertext),e.a(3,13);case 12:throw new Error("unsupported version: ".concat(a.version));case 13:return e.n=14,J.getEmbeddedKey();case 14:return c=e.v,e.n=15,E({ciphertextBuf:o,encappedKeyBuf:n,receiverPrivJwk:c});case 15:return e.a(2,e.v)}},e)}))).apply(this,arguments)}function ce(e,t,r,n){return ue.apply(this,arguments)}function ue(){return(ue=Q(Y().m(function e(t,r,n,o){var a,i,c,u,s;return Y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ae(t,n);case 1:if(a=e.v,J.onResetEmbeddedKey(),c=new Uint8Array(a),"SOLANA"!==r){e.n=3;break}return u=J.uint8arrayToHexString(c.subarray(0,32)),s=J.getEd25519PublicKey(u),e.n=2,J.encodeKey(c,r,s);case 2:i=e.v,e.n=5;break;case 3:return e.n=4,J.encodeKey(c,r);case 4:i=e.v;case 5:oe(i),J.sendMessageUp("BUNDLE_INJECTED",!0,o);case 6:return e.a(2)}},e)}))).apply(this,arguments)}function se(e,t,r){return de.apply(this,arguments)}function de(){return(de=Q(Y().m(function e(t,r,n){var o;return Y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,ae(t,r);case 1:o=e.v,J.onResetEmbeddedKey(),oe(J.encodeWallet(new Uint8Array(o)).mnemonic),J.sendMessageUp("BUNDLE_INJECTED",!0,n);case 2:return e.a(2)}},e)}))).apply(this,arguments)}function le(e,t){return fe.apply(this,arguments)}function fe(){return(fe=Q(Y().m(function e(t,r){var n;return Y().w(function(e){for(;;)switch(e.n){case 0:n=J.applySettings(t),J.setSettings(n),J.sendMessageUp("SETTINGS_APPLIED",!0,r);case 1:return e.a(2)}},e)}))).apply(this,arguments)}document.addEventListener("DOMContentLoaded",Q(Y().m(function e(){var t,r,n,o;return Y().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,J.initEmbeddedKey();case 1:return e.n=2,J.getEmbeddedKey();case 2:return t=e.v,e.n=3,J.p256JWKPrivateToPublic(t);case 3:r=e.v,n=J.uint8arrayToHexString(r),document.getElementById("embedded-key").value=n,window.addEventListener("message",ne,{capture:!1,signal:Z.signal}),re(),Z.signal.aborted||((o=J.getSettings())&&J.applySettings(o),J.sendMessageUp("PUBLIC_KEY_READY",n));case 4:return e.a(2)}},e)})),!1),window.addEventListener("message",function(){var e=Q(Y().m(function e(t){var r,n,o,a;return Y().w(function(e){for(;;)switch(e.n){case 0:if(!t.data||"TURNKEY_INIT_MESSAGE_CHANNEL"!=t.data.type||null===(r=t.ports)||void 0===r||!r[0]){e.n=5;break}if(!te){e.n=1;break}return e.a(2);case 1:return te=!0,Z.abort(),(V=t.ports[0]).onmessage=ne,J.setParentFrameMessageChannelPort(V),e.n=2,J.initEmbeddedKey();case 2:return e.n=3,J.getEmbeddedKey();case 3:return n=e.v,e.n=4,J.p256JWKPrivateToPublic(n);case 4:o=e.v,a=J.uint8arrayToHexString(o),document.getElementById("embedded-key").value=a,J.sendMessageUp("PUBLIC_KEY_READY",a),ee.abort();case 5:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),{signal:ee.signal})}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return a[e].call(r.exports,r,r.exports,c),r.exports}c.m=a,e=[],c.O=(t,r,n,o)=>{if(!r){var a=1/0;for(d=0;d=o)&&Object.keys(c.O).every(e=>c.O[e](r[u]))?r.splice(u--,1):(i=!1,o0&&e[d-1][2]>o;d--)e[d]=e[d-1];e[d]=[r,n,o]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var o=Object.create(null);c.r(o);var a={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,c.d(o,a),o},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,r)=>(c.f[r](e,t),t),[])),c.u=e=>"bundle."+{122:"7a7963e95974af7ea4b2",640:"a218929b7e4650aad3c1"}[e]+".js",c.miniCssF=e=>{},c.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},o="@turnkey/frames-export:",c.l=(e,t,r,a)=>{if(n[e])n[e].push(t);else{var i,u;if(void 0!==r)for(var s=document.getElementsByTagName("script"),d=0;d{i.onerror=i.onload=null,clearTimeout(p);var o=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},p=setTimeout(f.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=f.bind(null,i.onerror),i.onload=f.bind(null,i.onload),u&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.p="/",c.sriHashes={122:"sha384-2oJFkr0JnE7f4U8QrWR3cj8Coqw+8utP2lTJLx1wtbr5EzDZ/jwsFha5BlBCBUYy",640:"sha384-6GqXq343QvwDdwAAl42olKZAorNPsiiGPaK+jkbsi2EIGeCvv1CDJ1GmBsioiS6M"},(()=>{var e={792:0};c.f.j=(t,r)=>{var n=c.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var o=new Promise((r,o)=>n=e[t]=[r,o]);r.push(n[2]=o);var a=c.p+c.u(t),i=new Error;c.l(a,r=>{if(c.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var o=r&&("load"===r.type?"missing":r.type),a=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,n[1](i)}},"chunk-"+t,t)}},c.O.j=t=>0===e[t];var t=(t,r)=>{var n,o,[a,i,u]=r,s=0;if(a.some(t=>0!==e[t])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);if(u)var d=u(c)}for(t&&t(r);sc(106));u=c.O(u)})(); +//# sourceMappingURL=bundle.979ac810bff953662560.js.map \ No newline at end of file diff --git a/export-and-sign/dist/bundle.6f3ad536a859e78bdbd5.js.LICENSE.txt b/export/dist/bundle.979ac810bff953662560.js.LICENSE.txt similarity index 100% rename from export-and-sign/dist/bundle.6f3ad536a859e78bdbd5.js.LICENSE.txt rename to export/dist/bundle.979ac810bff953662560.js.LICENSE.txt diff --git a/export/dist/bundle.979ac810bff953662560.js.map b/export/dist/bundle.979ac810bff953662560.js.map new file mode 100644 index 00000000..37bee550 --- /dev/null +++ b/export/dist/bundle.979ac810bff953662560.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bundle.979ac810bff953662560.js","mappings":";uBAAAA,ECCAC,EADAC,ECAAC,EACA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AA,CAAAC,EAAAlR,KACA,IAGAgN,EAAAwB,GAHAlB,EAAA6D,EAAAC,GAAApR,EAGAvJ,EAAA,EACA,GAAA6W,EAAA+D,KAAAlI,GAAA,IAAAuH,EAAAvH,IAAA,CACA,IAAA6D,KAAAmE,EACApE,EAAAhS,EAAAoW,EAAAnE,KACAD,EAAAtQ,EAAAuQ,GAAAmE,EAAAnE,IAGA,GAAAoE,EAAA,IAAAxY,EAAAwY,EAAArE,EACA,CAEA,IADAmE,GAAAA,EAAAlR,GACMvJ,EAAA6W,EAAA5X,OAAqBe,IAC3B+X,EAAAlB,EAAA7W,GACAsW,EAAAhS,EAAA2V,EAAAlC,IAAAkC,EAAAlC,IACAkC,EAAAlC,GAAA,KAEAkC,EAAAlC,GAAA,EAEA,OAAAzB,EAAAM,EAAAzU,IAGA0Y,EAAAC,KAAA,mCAAAA,KAAA,uCACAD,EAAA9K,QAAAyK,EAAArV,KAAA,SACA0V,EAAA9Y,KAAAyY,EAAArV,KAAA,KAAA0V,EAAA9Y,KAAAoD,KAAA0V,QClFA,IAAAE,EAAAzE,EAAAM,OAAA1U,EAAA,SAAAoU,EAAA,MACAyE,EAAAzE,EAAAM,EAAAmE","sources":["webpack://@turnkey/frames-export/webpack/runtime/chunk loaded","webpack://@turnkey/frames-export/webpack/runtime/create fake namespace object","webpack://@turnkey/frames-export/webpack/runtime/load script","webpack://@turnkey/frames-export/../shared/dist/turnkey-core.mjs","webpack://@turnkey/frames-export/../shared/dist/crypto-utils.mjs","webpack://@turnkey/frames-export/./src/turnkey-core.js","webpack://@turnkey/frames-export/./src/index.js","webpack://@turnkey/frames-export/webpack/bootstrap","webpack://@turnkey/frames-export/webpack/runtime/define property getters","webpack://@turnkey/frames-export/webpack/runtime/ensure chunk","webpack://@turnkey/frames-export/webpack/runtime/get javascript chunk filename","webpack://@turnkey/frames-export/webpack/runtime/get mini-css chunk filename","webpack://@turnkey/frames-export/webpack/runtime/global","webpack://@turnkey/frames-export/webpack/runtime/hasOwnProperty shorthand","webpack://@turnkey/frames-export/webpack/runtime/make namespace object","webpack://@turnkey/frames-export/webpack/runtime/publicPath","webpack://@turnkey/frames-export/webpack/runtime/compat","webpack://@turnkey/frames-export/webpack/runtime/jsonp chunk loading","webpack://@turnkey/frames-export/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"@turnkey/frames-export:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t\tif (script.src.indexOf(window.location.origin + '/') !== 0) {\n\t\t\tscript.crossOrigin = \"anonymous\";\n\t\t}\n\t\tscript.integrity = __webpack_require__.sriHashes[chunkId];\n\t\tscript.crossOrigin = \"anonymous\";\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import { bech32 } from 'bech32';\n\n/**\n * Turnkey Core Module - Shared\n * Contains all the core cryptographic and utility functions shared across frames\n */\n\n/** constants for LocalStorage */\nconst TURNKEY_EMBEDDED_KEY = \"TURNKEY_EMBEDDED_KEY\";\nconst TURNKEY_TARGET_EMBEDDED_KEY = \"TURNKEY_TARGET_EMBEDDED_KEY\";\nconst TURNKEY_SETTINGS = \"TURNKEY_SETTINGS\";\n/** 48 hours in milliseconds */\nconst TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS = 1000 * 60 * 60 * 48;\nconst TURNKEY_EMBEDDED_KEY_ORIGIN = \"TURNKEY_EMBEDDED_KEY_ORIGIN\";\n\nlet parentFrameMessageChannelPort = null;\nvar cryptoProviderOverride = null;\n\n/*\n * Returns a reference to the WebCrypto subtle interface regardless of the host environment.\n */\nfunction getSubtleCrypto() {\n if (cryptoProviderOverride && cryptoProviderOverride.subtle) {\n return cryptoProviderOverride.subtle;\n }\n if (\n typeof globalThis !== \"undefined\" &&\n globalThis.crypto &&\n globalThis.crypto.subtle\n ) {\n return globalThis.crypto.subtle;\n }\n if (typeof window !== \"undefined\" && window.crypto && window.crypto.subtle) {\n return window.crypto.subtle;\n }\n if (typeof global !== \"undefined\" && global.crypto && global.crypto.subtle) {\n return global.crypto.subtle;\n }\n if (typeof crypto !== \"undefined\" && crypto.subtle) {\n return crypto.subtle;\n }\n\n return null;\n}\n\n/*\n * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime\n * environment does not expose one on the global/window objects.\n */\nfunction setCryptoProvider(cryptoProvider) {\n cryptoProviderOverride = cryptoProvider || null;\n}\n\n/* Security functions */\n\nfunction isDoublyIframed() {\n if (window.location.ancestorOrigins !== undefined) {\n // Does not exist in IE and firefox.\n // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works\n return window.location.ancestorOrigins.length > 1;\n } else {\n return window.parent !== window.top;\n }\n}\n\n/*\n * Loads the quorum public key as a CryptoKey.\n */\nasync function loadQuorumKey(quorumPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.importKey(\n \"raw\",\n quorumPublic,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n [\"verify\"]\n );\n}\n\n/*\n * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key.\n */\nasync function loadTargetKey(targetPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const targetKey = await subtle.importKey(\n \"raw\",\n targetPublic,\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n\n return await subtle.exportKey(\"jwk\", targetKey);\n}\n\n/**\n * Creates a new public/private key pair and persists it in localStorage\n */\nasync function initEmbeddedKey() {\n if (isDoublyIframed()) {\n throw new Error(\"Doubly iframed\");\n }\n const retrievedKey = await getEmbeddedKey();\n if (retrievedKey === null) {\n const targetKey = await generateTargetKey();\n setEmbeddedKey(targetKey);\n }\n // Nothing to do, key is correctly initialized!\n}\n\n/*\n * Generate a key to encrypt to and export it as a JSON Web Key.\n */\nasync function generateTargetKey() {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const p256key = await subtle.generateKey(\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n [\"deriveBits\"]\n );\n\n return await subtle.exportKey(\"jwk\", p256key.privateKey);\n}\n\n/**\n * Gets the current embedded private key JWK. Returns `null` if not found.\n */\nfunction getEmbeddedKey() {\n const jwtKey = getItemWithExpiry(TURNKEY_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the embedded private key JWK with the default expiration time.\n * @param {JsonWebKey} targetKey\n */\nfunction setEmbeddedKey(targetKey) {\n setItemWithExpiry(\n TURNKEY_EMBEDDED_KEY,\n JSON.stringify(targetKey),\n TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS\n );\n}\n\n/**\n * Gets the current target embedded private key JWK. Returns `null` if not found.\n */\nfunction getTargetEmbeddedKey() {\n const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the target embedded public key JWK.\n * @param {JsonWebKey} targetKey\n */\nfunction setTargetEmbeddedKey(targetKey) {\n window.localStorage.setItem(\n TURNKEY_TARGET_EMBEDDED_KEY,\n JSON.stringify(targetKey)\n );\n}\n\n/**\n * Resets the current embedded private key JWK.\n */\nfunction onResetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY);\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY_ORIGIN);\n}\n\n/**\n * Resets the current target embedded private key JWK.\n */\nfunction resetTargetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY);\n}\n\nfunction setParentFrameMessageChannelPort(port) {\n parentFrameMessageChannelPort = port;\n}\n\n/**\n * Gets the current settings.\n */\nfunction getSettings() {\n const settings = window.localStorage.getItem(TURNKEY_SETTINGS);\n return settings ? JSON.parse(settings) : null;\n}\n\n/**\n * Sets the settings object.\n * @param {Object} settings\n */\nfunction setSettings(settings) {\n window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings));\n}\n\n/**\n * Set an item in localStorage with an expiration time\n * @param {string} key\n * @param {string} value\n * @param {number} ttl expiration time in milliseconds\n */\nfunction setItemWithExpiry(key, value, ttl) {\n const now = new Date();\n const item = {\n value: value,\n expiry: now.getTime() + ttl,\n };\n window.localStorage.setItem(key, JSON.stringify(item));\n}\n\n/**\n * Get an item from localStorage. Returns `null` and\n * removes the item from localStorage if expired or\n * expiry time is missing.\n * @param {string} key\n */\nfunction getItemWithExpiry(key) {\n const itemStr = window.localStorage.getItem(key);\n if (!itemStr) {\n return null;\n }\n const item = JSON.parse(itemStr);\n if (\n !Object.prototype.hasOwnProperty.call(item, \"expiry\") ||\n !Object.prototype.hasOwnProperty.call(item, \"value\")\n ) {\n window.localStorage.removeItem(key);\n return null;\n }\n const now = new Date();\n if (now.getTime() > item.expiry) {\n window.localStorage.removeItem(key);\n return null;\n }\n return item.value;\n}\n\n/**\n * Takes a hex string (e.g. \"e4567ab\" or \"0xe4567ab\") and returns an array buffer (Uint8Array)\n * @param {string} hexString - Hex string with or without \"0x\" prefix\n * @returns {Uint8Array}\n */\nfunction uint8arrayFromHexString(hexString) {\n if (!hexString || typeof hexString !== \"string\") {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n\n // Remove 0x prefix if present\n const hexWithoutPrefix =\n hexString.startsWith(\"0x\") || hexString.startsWith(\"0X\")\n ? hexString.slice(2)\n : hexString;\n\n var hexRegex = /^[0-9A-Fa-f]+$/;\n if (hexWithoutPrefix.length % 2 != 0 || !hexRegex.test(hexWithoutPrefix)) {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n return new Uint8Array(\n hexWithoutPrefix.match(/../g).map((h) => parseInt(h, 16))\n );\n}\n\n/**\n * Takes a Uint8Array and returns a hex string\n * @param {Uint8Array} buffer\n * @return {string}\n */\nfunction uint8arrayToHexString(buffer) {\n return [...buffer].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Function to normalize padding of byte array with 0's to a target length\n */\nfunction normalizePadding(byteArray, targetLength) {\n const paddingLength = targetLength - byteArray.length;\n\n // Add leading 0's to array\n if (paddingLength > 0) {\n const padding = new Uint8Array(paddingLength).fill(0);\n return new Uint8Array([...padding, ...byteArray]);\n }\n\n // Remove leading 0's from array\n if (paddingLength < 0) {\n const expectedZeroCount = paddingLength * -1;\n let zeroCount = 0;\n for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) {\n if (byteArray[i] === 0) {\n zeroCount++;\n }\n }\n // Check if the number of zeros found equals the number of zeroes expected\n if (zeroCount !== expectedZeroCount) {\n throw new Error(\n `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`\n );\n }\n return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength);\n }\n return byteArray;\n}\n\n/**\n * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate.\n */\nfunction additionalAssociatedData(senderPubBuf, receiverPubBuf) {\n const s = Array.from(new Uint8Array(senderPubBuf));\n const r = Array.from(new Uint8Array(receiverPubBuf));\n return new Uint8Array([...s, ...r]);\n}\n\n/**\n * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses.\n *\n * @param {string} derSignature - The DER-encoded signature as a hexadecimal string.\n * @returns {Uint8Array} - The raw signature as a Uint8Array.\n */\nfunction fromDerSignature(derSignature) {\n const derSignatureBuf = uint8arrayFromHexString(derSignature);\n\n // Check and skip the sequence tag (0x30)\n let index = 2;\n\n // Parse 'r' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for r\"\n );\n }\n index++; // Move past the INTEGER tag\n const rLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const r = derSignatureBuf.slice(index, index + rLength);\n index += rLength; // Move to the start of s\n\n // Parse 's' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for s\"\n );\n }\n index++; // Move past the INTEGER tag\n const sLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const s = derSignatureBuf.slice(index, index + sLength);\n\n // Normalize 'r' and 's' to 32 bytes each\n const rPadded = normalizePadding(r, 32);\n const sPadded = normalizePadding(s, 32);\n\n // Concatenate and return the raw signature\n return new Uint8Array([...rPadded, ...sPadded]);\n}\n\n/**\n * Function to verify enclave signature on import bundle received from the server.\n * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature\n * @param {string} publicSignature signature bytes encoded as a hexadecimal string\n * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes\n */\nasync function verifyEnclaveSignature(\n enclaveQuorumPublic,\n publicSignature,\n signedData\n) {\n /** Turnkey Signer enclave's public keys */\n const TURNKEY_SIGNERS_ENCLAVES = {\n prod: \"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\",\n preprod:\n \"04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212\",\n dev: \"048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d\",\n };\n\n // The TURNKEY_SIGNER_ENVIRONMENT must be defined either:\n //\n // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE)\n // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT)\n // - By setting either of these in test environment\n const TURNKEY_SIGNER_ENVIRONMENT =\n window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE ||\n window.TURNKEY_SIGNER_ENVIRONMENT;\n if (TURNKEY_SIGNER_ENVIRONMENT === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined`\n );\n }\n\n const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY =\n TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT];\n\n if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined`\n );\n }\n\n // todo(olivia): throw error if enclave quorum public is null once server changes are deployed\n if (enclaveQuorumPublic) {\n if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) {\n throw new Error(\n `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.`\n );\n }\n }\n\n const encryptionQuorumPublicBuf = new Uint8Array(\n uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY)\n );\n const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf);\n if (!quorumKey) {\n throw new Error(\"failed to load quorum key\");\n }\n\n // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format\n const publicSignatureBuf = fromDerSignature(publicSignature);\n const signedDataBuf = uint8arrayFromHexString(signedData);\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.verify(\n { name: \"ECDSA\", hash: \"SHA-256\" },\n quorumKey,\n publicSignatureBuf,\n signedDataBuf\n );\n}\n\n/**\n * Function to send a message.\n *\n * If this page is embedded as an iframe we'll send a postMessage\n * in one of two ways depending on the version of @turnkey/iframe-stamper:\n * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages.\n * 2. older versions ( 0) {\n digits.push(carry % 58);\n carry = (carry / 58) | 0;\n }\n }\n // Convert digits to a base58 string\n for (let k = 0; k < digits.length; k++) {\n result = alphabet[digits[k]] + result;\n }\n\n // Add '1' for each leading 0 byte\n for (let i = 0; bytes[i] === 0 && i < bytes.length - 1; i++) {\n result = \"1\" + result;\n }\n return result;\n}\n\n/**\n * Decodes a base58-encoded string into a buffer\n * This function throws an error when the string contains invalid characters.\n * @param {string} s The base58-encoded string.\n * @return {Uint8Array} The decoded buffer.\n */\nfunction base58Decode(s) {\n // See https://en.bitcoin.it/wiki/Base58Check_encoding\n var alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n var decodedBytes = [];\n var leadingZeros = [];\n for (var i = 0; i < s.length; i++) {\n if (alphabet.indexOf(s[i]) === -1) {\n throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`);\n }\n var carry = alphabet.indexOf(s[i]);\n\n // If the current base58 digit is 0, append a 0 byte.\n // \"i == leadingZeros.length\" can only be true if we have not seen non-zero bytes so far.\n // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length`\n if (carry == 0 && i === leadingZeros.length) {\n leadingZeros.push(0);\n }\n\n var j = 0;\n while (j < decodedBytes.length || carry > 0) {\n var currentByte = decodedBytes[j];\n\n // shift the current byte 58 units and add the carry amount\n // (or just add the carry amount if this is a new byte -- undefined case)\n if (currentByte === undefined) {\n currentByte = carry;\n } else {\n currentByte = currentByte * 58 + carry;\n }\n\n // find the new carry amount (1-byte shift of current byte value)\n carry = currentByte >> 8;\n // reset the current byte to the remainder (the carry amount will pass on the overflow)\n decodedBytes[j] = currentByte % 256;\n j++;\n }\n }\n\n var result = leadingZeros.concat(decodedBytes.reverse());\n return new Uint8Array(result);\n}\n\n/**\n * Decodes a base58check-encoded string and verifies the checksum.\n * Base58Check encoding includes a 4-byte checksum at the end to detect errors.\n * The checksum is the first 4 bytes of SHA256(SHA256(payload)).\n * This function throws an error if the checksum is invalid.\n * @param {string} s The base58check-encoded string.\n * @return {Promise} The decoded payload (without checksum).\n */\nasync function base58CheckDecode(s) {\n const decoded = base58Decode(s);\n\n if (decoded.length < 5) {\n throw new Error(\n `invalid base58check length: expected at least 5 bytes, got ${decoded.length}`\n );\n }\n\n const payload = decoded.subarray(0, decoded.length - 4);\n const checksum = decoded.subarray(decoded.length - 4);\n\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n\n // Compute double SHA256 hash\n const hash1Buf = await subtle.digest(\"SHA-256\", payload);\n const hash1 = new Uint8Array(hash1Buf);\n const hash2Buf = await subtle.digest(\"SHA-256\", hash1);\n const hash2 = new Uint8Array(hash2Buf);\n const computedChecksum = hash2.subarray(0, 4);\n\n // Verify checksum\n const mismatch =\n (checksum[0] ^ computedChecksum[0]) |\n (checksum[1] ^ computedChecksum[1]) |\n (checksum[2] ^ computedChecksum[2]) |\n (checksum[3] ^ computedChecksum[3]);\n if (mismatch !== 0) {\n throw new Error(\"invalid base58check checksum\");\n }\n\n return payload;\n}\n\n/**\n * Returns private key bytes from a private key, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {string} privateKey\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\", \"SUI_BECH32\", \"BITCOIN_MAINNET_WIF\", \"BITCOIN_TESTNET_WIF\" or \"SOLANA\"\n * @return {Promise}\n */\nasync function decodeKey(privateKey, keyFormat) {\n switch (keyFormat) {\n case \"SOLANA\": {\n const decodedKeyBytes = base58Decode(privateKey);\n if (decodedKeyBytes.length !== 64) {\n throw new Error(\n `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.`\n );\n }\n return decodedKeyBytes.subarray(0, 32);\n }\n case \"HEXADECIMAL\":\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n case \"BITCOIN_MAINNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0x80 = mainnet\n if (version !== 0x80) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0x80 (mainnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"BITCOIN_TESTNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0xEF = testnet\n if (version !== 0xef) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0xEF (testnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"SUI_BECH32\": {\n const { prefix, words } = bech32.decode(privateKey);\n\n if (prefix !== \"suiprivkey\") {\n throw new Error(\n `invalid SUI private key human-readable part (HRP): expected \"suiprivkey\"`\n );\n }\n\n const bytes = bech32.fromWords(words);\n if (bytes.length !== 33) {\n throw new Error(\n `invalid SUI private key length: expected 33 bytes, got ${bytes.length}`\n );\n }\n\n const schemeFlag = bytes[0];\n const privkey = bytes.slice(1);\n\n // schemeFlag = 0 is Ed25519; We currently only support Ed25519 keys for SUI.\n if (schemeFlag !== 0) {\n throw new Error(\n `invalid SUI private key scheme flag: expected 0 (Ed25519). Turnkey only supports Ed25519 keys for SUI.`\n );\n }\n\n return new Uint8Array(privkey);\n }\n default:\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n }\n}\n\n/**\n * Returns a private key from private key bytes, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {Uint8Array} privateKeyBytes\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\" or \"SOLANA\"\n * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is \"SOLANA\"\n * @return {string}\n */\nasync function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) {\n switch (keyFormat) {\n case \"SOLANA\":\n if (!publicKeyBytes) {\n throw new Error(\"public key must be specified for SOLANA key format\");\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n if (publicKeyBytes.length !== 32) {\n throw new Error(\n `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.`\n );\n }\n {\n const concatenatedBytes = new Uint8Array(64);\n concatenatedBytes.set(privateKeyBytes, 0);\n concatenatedBytes.set(publicKeyBytes, 32);\n return base58Encode(concatenatedBytes);\n }\n case \"HEXADECIMAL\":\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n default:\n // keeping console.warn for debugging purposes.\n // eslint-disable-next-line no-console\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n }\n}\n\n/**\n * Helper to parse a private key into a Solana base58 private key.\n * To be used if a wallet account is exported without the `SOLANA` address format.\n *\n * @param {string | Array} privateKey\n * @returns {Uint8Array}\n */\nfunction parsePrivateKey(privateKey) {\n if (Array.isArray(privateKey)) {\n return new Uint8Array(privateKey);\n }\n\n if (typeof privateKey === \"string\") {\n // Remove 0x prefix if present\n if (privateKey.startsWith(\"0x\")) {\n privateKey = privateKey.slice(2);\n }\n\n // Check if it's hex-formatted correctly (i.e. 64 hex chars)\n if (privateKey.length === 64 && /^[0-9a-fA-F]+$/.test(privateKey)) {\n return uint8arrayFromHexString(privateKey);\n }\n\n // Otherwise assume it's base58 format (for Solana)\n try {\n return base58Decode(privateKey);\n } catch (error) {\n throw new Error(\n \"Invalid private key format. Use hex (64 chars) or base58 format.\"\n );\n }\n }\n\n throw new Error(\"Private key must be a string (hex/base58) or number array\");\n}\n\n/**\n * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions).\n * Any invalid style throws an error. Returns an object of valid styles.\n * @param {Object} styles\n * @param {HTMLElement} [element] - Optional element parameter (for import frame)\n * @return {Object}\n */\nfunction validateStyles(styles, element) {\n const validStyles = {};\n\n const cssValidationRegex = {\n padding: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n margin: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n borderWidth: \"^(\\\\d+(px|em|rem) ?){1,4}$\",\n borderStyle:\n \"^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$\",\n borderColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n borderRadius: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n fontSize: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$\",\n fontWeight: \"^(normal|bold|bolder|lighter|\\\\d{3})$\",\n fontFamily: '^[^\";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection\n color:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n labelColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n backgroundColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n width: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n height: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n maxWidth: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n maxHeight:\n \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n lineHeight:\n \"^(\\\\d+(\\\\.\\\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$\",\n boxShadow:\n \"^(none|(\\\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)) ?(inset)?)$\",\n textAlign: \"^(left|right|center|justify|initial|inherit)$\",\n overflowWrap: \"^(normal|break-word|anywhere)$\",\n wordWrap: \"^(normal|break-word)$\",\n resize: \"^(none|both|horizontal|vertical|block|inline)$\",\n };\n\n Object.entries(styles).forEach(([property, value]) => {\n const styleProperty = property.trim();\n if (styleProperty.length === 0) {\n throw new Error(\"css style property cannot be empty\");\n }\n const styleRegexStr = cssValidationRegex[styleProperty];\n if (!styleRegexStr) {\n throw new Error(\n `invalid or unsupported css style property: \"${styleProperty}\"`\n );\n }\n const styleRegex = new RegExp(styleRegexStr);\n const styleValue = value.trim();\n if (styleValue.length == 0) {\n throw new Error(`css style for \"${styleProperty}\" is empty`);\n }\n const isValidStyle = styleRegex.test(styleValue);\n if (!isValidStyle) {\n throw new Error(\n `invalid css style value for property \"${styleProperty}\"`\n );\n }\n validStyles[styleProperty] = styleValue;\n });\n\n return validStyles;\n}\n\nexport { additionalAssociatedData, base58CheckDecode, base58Decode, base58Encode, decodeKey, encodeKey, fromDerSignature, generateTargetKey, getEmbeddedKey, getItemWithExpiry, getSettings, getSubtleCrypto, getTargetEmbeddedKey, initEmbeddedKey, isDoublyIframed, loadQuorumKey, loadTargetKey, logMessage, normalizePadding, onResetEmbeddedKey, p256JWKPrivateToPublic, parsePrivateKey, resetTargetEmbeddedKey, sendMessageUp, setCryptoProvider, setEmbeddedKey, setItemWithExpiry, setParentFrameMessageChannelPort, setSettings, setTargetEmbeddedKey, uint8arrayFromHexString, uint8arrayToHexString, validateStyles, verifyEnclaveSignature };\n//# sourceMappingURL=turnkey-core.mjs.map\n","import { p256JWKPrivateToPublic, additionalAssociatedData, uint8arrayToHexString } from './turnkey-core.mjs';\nimport { DhkemP256HkdfSha256, CipherSuite, Aes256Gcm, HkdfSha256 } from '@hpke/core';\n\n/**\n * Crypto Utilities - Shared\n * Contains HPKE encryption and decryption functions\n */\n\n\n// Pre-compute const (for perf)\nconst TURNKEY_HPKE_INFO = new TextEncoder().encode(\"turnkey_hpke\");\n\n/**\n * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer)\n * and the receivers private key (JSON Web Key).\n */\nasync function HpkeDecrypt({\n ciphertextBuf,\n encappedKeyBuf,\n receiverPrivJwk,\n}) {\n const kemContext = new DhkemP256HkdfSha256();\n var receiverPriv = await kemContext.importKey(\n \"jwk\",\n { ...receiverPrivJwk },\n false\n );\n\n var suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n var recipientCtx = await suite.createRecipientContext({\n recipientKey: receiverPriv,\n enc: encappedKeyBuf,\n info: TURNKEY_HPKE_INFO,\n });\n\n var receiverPubBuf = await p256JWKPrivateToPublic(receiverPrivJwk);\n var aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n var res;\n try {\n res = await recipientCtx.open(ciphertextBuf, aad);\n } catch (e) {\n throw new Error(\n \"unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: \" +\n e.toString()\n );\n }\n return res;\n}\n\n/**\n * Encrypt plaintext using HPKE with the receiver's public key.\n * @param {Object} params\n * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt\n * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format\n * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext\n */\nasync function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: TURNKEY_HPKE_INFO,\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = uint8arrayToHexString(new Uint8Array(ciphertextBuf));\n const encappedKeyBufHex = uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\n\nexport { HpkeDecrypt, HpkeEncrypt };\n//# sourceMappingURL=crypto-utils.mjs.map\n","import { fromDerSignature } from \"@turnkey/crypto\";\nimport * as SharedTKHQ from \"@turnkey/frames-shared\";\n\nconst {\n initEmbeddedKey,\n generateTargetKey,\n setItemWithExpiry,\n getItemWithExpiry,\n getEmbeddedKey,\n setEmbeddedKey,\n onResetEmbeddedKey,\n p256JWKPrivateToPublic,\n base58Encode,\n base58Decode,\n sendMessageUp,\n logMessage,\n uint8arrayFromHexString,\n uint8arrayToHexString,\n setParentFrameMessageChannelPort,\n normalizePadding,\n additionalAssociatedData,\n getSettings,\n setSettings,\n parsePrivateKey,\n validateStyles,\n verifyEnclaveSignature,\n} = SharedTKHQ;\n\n/**\n * Encodes a Uint8Array into a base58-check-encoded string\n * Throws an error if the input is invalid or the checksum is invalid.\n * @param {Uint8Array} payload The raw payload to encode.\n * @return {Promise} The base58check-encoded string.\n */\nasync function base58CheckEncode(payload) {\n const hash1Buf = await crypto.subtle.digest(\"SHA-256\", payload);\n const hash1 = new Uint8Array(hash1Buf);\n\n const hash2Buf = await crypto.subtle.digest(\"SHA-256\", hash1);\n const hash2 = new Uint8Array(hash2Buf);\n\n const checksum = hash2.slice(0, 4);\n\n const full = new Uint8Array(payload.length + 4);\n full.set(payload, 0);\n full.set(checksum, payload.length);\n\n return base58Encode(full);\n}\n\n/**\n * Bech32 character set as defined in BIP173.\n * Reference: https://github.com/bitcoinjs/bech32/blob/5ceb0e3d4625561a459c85643ca6947739b2d83c/src/index.ts#L2\n * The alphabet excludes '1', 'b', 'i', and 'o' to avoid confusion with similar-looking characters.\n */\nconst BECH32_CHARSET = \"qpzry9x8gf2tvdw0s3jn54khce6mua7l\";\n\n/**\n * Map each bech32 character to its 5-bit value (0-31).\n * Used for decoding bech32 strings.\n */\nconst BECH32_CHAR_MAP = (() => {\n const map = {};\n for (let i = 0; i < BECH32_CHARSET.length; i++) {\n map[BECH32_CHARSET[i]] = i;\n }\n return map;\n})();\n\n/**\n * Internal function that computes the Bech32 checksum polymod.\n * This implements the BCH code checksum as specified in BIP173.\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * The generator polynomial constants are derived from the BCH code generator.\n * The function processes 5-bit values and XORs them with generator values\n * based on the top 5 bits of the current checksum state.\n *\n * @param {number[]} values - Array of 5-bit values to process\n * @returns {number} - The checksum polymod result\n */\nfunction bech32Polymod(values) {\n let chk = 1;\n // Generator polynomial constants for BCH code (BIP173) (see https://github.com/bitcoinjs/bech32/blob/5ceb0e3d4625561a459c85643ca6947739b2d83c/src/index.ts#L10)\n const GEN = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3];\n for (let p = 0; p < values.length; p++) {\n const v = values[p];\n const top = chk >>> 25; // Extract top 5 bits\n chk = ((chk & 0x1ffffff) << 5) ^ v; // Shift left and XOR with value\n for (let i = 0; i < 5; i++) {\n if (((top >>> i) & 1) !== 0) {\n chk ^= GEN[i]; // XOR with generator if bit is set\n }\n }\n }\n return chk;\n}\n\n/**\n * Expand the Human-Readable Part (HRP) for Bech32 checksum computation.\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * The HRP is expanded by taking:\n * 1. The upper 3 bits of each character (right-shifted by 5)\n * 2. A separator (0)\n * 3. The lower 5 bits of each character (masked with 31)\n *\n * For example, \"bc\" becomes [3, 3, 0, 2, 3] where:\n * - 'b' (0x62) → upper: 3, lower: 2\n * - 'c' (0x63) → upper: 3, lower: 3\n *\n * @param {string} hrp - Human-Readable Part (e.g., \"bc\", \"suiprivkey\")\n * @returns {number[]} - Expanded array of 5-bit values\n */\nfunction bech32HrpExpand(hrp) {\n const ret = [];\n // Extract upper 3 bits of each character\n for (let i = 0; i < hrp.length; i++) {\n const c = hrp.charCodeAt(i);\n ret.push(c >> 5);\n }\n ret.push(0); // Separator\n // Extract lower 5 bits of each character\n for (let i = 0; i < hrp.length; i++) {\n const c = hrp.charCodeAt(i);\n ret.push(c & 31);\n }\n return ret;\n}\n\n/**\n * Create a Bech32 checksum (6 characters).\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * The checksum is computed by:\n * 1. Expanding the HRP and concatenating with the data\n * 2. Appending six zero values\n * 3. Computing the polymod\n * 4. XORing with the bech32 constant (1)\n * 5. Extracting six 5-bit values from the result\n *\n * Note: This uses the bech32 constant (1). For bech32m (BIP350), the constant is 0x2bc830a3.\n *\n * @param {string} hrp - Human-Readable Part\n * @param {number[]} data - Array of 5-bit values representing the payload\n * @returns {number[]} - Array of 6 checksum values (5-bit each)\n */\nfunction bech32CreateChecksum(hrp, data) {\n const values = bech32HrpExpand(hrp).concat(data);\n const polymod = bech32Polymod(values.concat([0, 0, 0, 0, 0, 0])) ^ 1; // bech32 const = 1\n const checksum = [];\n for (let i = 0; i < 6; i++) {\n checksum.push((polymod >> (5 * (5 - i))) & 31); // Extract 5 bits\n }\n return checksum;\n}\n\n/**\n * Convert from 8-bit bytes to 5-bit words (groups).\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * This function repacks data from 8-bit bytes to 5-bit groups.\n * Since 8 and 5 don't evenly divide, we use an accumulator to handle the conversion.\n *\n * For example, 2 bytes (16 bits) → 3.2 groups (16/5), so we pad to 4 groups (20 bits).\n * The final group may have zero-padding in the lower bits.\n *\n * @param {Uint8Array} bytes - Input data as 8-bit bytes\n * @returns {number[]} - Array of 5-bit values (0-31)\n */\nfunction bech32ToWords(bytes) {\n const fromBits = 8;\n const toBits = 5;\n const pad = true;\n\n let acc = 0;\n let bits = 0;\n const maxv = (1 << toBits) - 1;\n const result = [];\n\n for (let i = 0; i < bytes.length; i++) {\n const value = bytes[i];\n if (value < 0 || value > 255) {\n throw new Error(\"invalid byte value for bech32\");\n }\n acc = (acc << fromBits) | value;\n bits += fromBits;\n while (bits >= toBits) {\n bits -= toBits;\n result.push((acc >> bits) & maxv);\n }\n }\n\n if (pad) {\n if (bits > 0) {\n result.push((acc << (toBits - bits)) & maxv);\n }\n } else {\n if (bits >= fromBits) {\n throw new Error(\"excess padding in bech32 data\");\n }\n if ((acc & ((1 << bits) - 1)) !== 0) {\n throw new Error(\"non-zero padding in bech32 data\");\n }\n }\n\n return result;\n}\n\n/**\n * Convert from 5-bit words (groups) back to 8-bit bytes.\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * This is the inverse of bech32ToWords. It repacks 5-bit groups back to 8-bit bytes.\n * Unlike encoding, decoding does NOT add padding (pad = false) to ensure the data\n * length is exact and any trailing bits are validated to be zero.\n *\n * The maxAcc limit prevents accumulator overflow during bit manipulation.\n *\n * @param {number[]} words - Array of 5-bit values (0-31)\n * @returns {Uint8Array} - Output data as 8-bit bytes\n */\nfunction bech32FromWords(words) {\n const fromBits = 5;\n const toBits = 8;\n const pad = false;\n\n let acc = 0;\n let bits = 0;\n const maxv = (1 << toBits) - 1;\n const maxAcc = (1 << (fromBits + toBits - 1)) - 1;\n const result = [];\n\n for (let i = 0; i < words.length; i++) {\n const value = words[i];\n if (value < 0 || value >> fromBits !== 0) {\n throw new Error(\"invalid bech32 word\");\n }\n acc = ((acc << fromBits) | value) & maxAcc;\n bits += fromBits;\n while (bits >= toBits) {\n bits -= toBits;\n result.push((acc >> bits) & maxv);\n }\n }\n\n if (pad) {\n if (bits > 0) {\n result.push((acc << (toBits - bits)) & maxv);\n }\n } else {\n if (bits >= fromBits) {\n throw new Error(\"excess padding in bech32 data\");\n }\n if ((acc & ((1 << bits) - 1)) !== 0) {\n throw new Error(\"non-zero padding in bech32 data\");\n }\n }\n\n return new Uint8Array(result);\n}\n\n/**\n * Encode bytes into a Bech32 string.\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * Creates a complete bech32-encoded string in the format: hrp + \"1\" + data + checksum\n * For example: \"suiprivkey1\" + encoded_data + 6_checksum_chars\n *\n * The separator \"1\" is used because it's not part of the bech32 character set.\n *\n * @param {string} hrp - Human-Readable Part (e.g., \"suiprivkey\")\n * @param {Uint8Array} bytes - Raw bytes to encode\n * @returns {string} - Complete bech32-encoded string\n */\nfunction encodeBech32(hrp, bytes) {\n const words = bech32ToWords(bytes);\n const checksum = bech32CreateChecksum(hrp, words);\n const combined = words.concat(checksum);\n\n let out = hrp + \"1\";\n for (let i = 0; i < combined.length; i++) {\n out += BECH32_CHARSET[combined[i]];\n }\n return out;\n}\n\n/**\n * Decode a Bech32 or Bech32m string.\n * Reference: https://en.bitcoin.it/wiki/Bech32\n *\n * This function:\n * 1. Splits the string at the last \"1\" separator into HRP and data\n * 2. Validates the character set\n * 3. Computes and verifies the checksum\n * 4. Returns the HRP, data words (without checksum), and variant\n *\n * Supports both bech32 (const=1) and bech32m (const=0x2bc830a3) variants.\n * The variant is determined by the checksum validation.\n *\n * @param {string} str - Bech32-encoded string\n * @returns {{hrp: string, words: number[], variant: string}} - Decoded components\n */\nfunction decodeBech32(str) {\n // Enforce lower-case (Sui uses lowercase)\n const s = str.toLowerCase();\n\n // Split HRP and data at last '1'\n const pos = s.lastIndexOf(\"1\");\n if (pos <= 0 || pos + 7 > s.length) {\n throw new Error(\"invalid bech32: bad separator or too short\");\n }\n\n const hrp = s.slice(0, pos);\n const dataPart = s.slice(pos + 1);\n\n if (!hrp || hrp.length < 1) {\n throw new Error(\"invalid bech32: HRP too short\");\n }\n\n const data = [];\n for (let i = 0; i < dataPart.length; i++) {\n const c = dataPart[i];\n const v = BECH32_CHAR_MAP[c];\n if (v == null) {\n throw new Error(`invalid bech32 character: '${c}'`);\n }\n data.push(v);\n }\n\n if (data.length < 6) {\n throw new Error(\"invalid bech32: data too short (no room for checksum)\");\n }\n\n const values = bech32HrpExpand(hrp).concat(data);\n const polymod = bech32Polymod(values);\n\n // bech32 checksum = 1, bech32m checksum = 0x2bc830a3\n const BECH32_CONST = 1;\n const BECH32M_CONST = 0x2bc830a3;\n\n if (polymod !== BECH32_CONST && polymod !== BECH32M_CONST) {\n throw new Error(\"invalid bech32: checksum mismatch\");\n }\n\n // strip checksum (last 6 words)\n const words = data.slice(0, data.length - 6);\n\n return {\n hrp,\n words,\n variant: polymod === BECH32_CONST ? \"bech32\" : \"bech32m\",\n };\n}\n\n/**\n * Returns a private key from private key bytes, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {Uint8Array} privateKeyBytes\n * @param {string} keyFormat Can be \"HEXADECIMAL\", \"SUI_BECH32\", \"BITCOIN_MAINNET_WIF\", \"BITCOIN_TESTNET_WIF\" or \"SOLANA\"\n */\nasync function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) {\n switch (keyFormat) {\n case \"SOLANA\": {\n if (!publicKeyBytes) {\n throw new Error(\"public key must be specified for SOLANA key format\");\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n if (publicKeyBytes.length !== 32) {\n throw new Error(\n `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.`\n );\n }\n const concatenatedBytes = new Uint8Array(64);\n concatenatedBytes.set(privateKeyBytes, 0);\n concatenatedBytes.set(publicKeyBytes, 32);\n return base58Encode(concatenatedBytes);\n }\n case \"HEXADECIMAL\":\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n case \"BITCOIN_MAINNET_WIF\":\n case \"BITCOIN_TESTNET_WIF\": {\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n\n const version = keyFormat === \"BITCOIN_MAINNET_WIF\" ? 0x80 : 0xef;\n const wifPayload = new Uint8Array(34);\n wifPayload[0] = version;\n wifPayload.set(privateKeyBytes, 1);\n wifPayload[33] = 0x01; // compressed flag\n\n return await base58CheckEncode(wifPayload);\n }\n case \"SUI_BECH32\": {\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n\n const schemeFlag = 0x00; // ED25519 | We only support ED25519 keys for Sui currently\n const bech32Payload = new Uint8Array(1 + 32);\n bech32Payload[0] = schemeFlag;\n bech32Payload.set(privateKeyBytes, 1);\n\n return encodeBech32(\"suiprivkey\", bech32Payload);\n }\n default:\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n }\n}\n\n/**\n * Returns a UTF-8 encoded wallet mnemonic + newline optional passphrase\n * from wallet bytes.\n * @param {Uint8Array} walletBytes\n */\nfunction encodeWallet(walletBytes) {\n const decoder = new TextDecoder(\"utf-8\");\n const wallet = decoder.decode(walletBytes);\n let mnemonic;\n let passphrase = null;\n\n if (wallet.includes(\"\\n\")) {\n const parts = wallet.split(\"\\n\");\n mnemonic = parts[0];\n passphrase = parts[1];\n } else {\n mnemonic = wallet;\n }\n\n return {\n mnemonic: mnemonic,\n passphrase: passphrase,\n };\n}\n\nexport const TKHQ = {\n bech32FromWords,\n decodeBech32,\n encodeBech32,\n encodeWallet,\n initEmbeddedKey,\n generateTargetKey,\n setItemWithExpiry,\n getItemWithExpiry,\n getEmbeddedKey,\n setEmbeddedKey,\n onResetEmbeddedKey,\n p256JWKPrivateToPublic,\n base58Encode,\n base58Decode,\n base58CheckEncode,\n encodeKey,\n sendMessageUp,\n logMessage,\n uint8arrayFromHexString,\n uint8arrayToHexString,\n setParentFrameMessageChannelPort,\n normalizePadding,\n fromDerSignature,\n additionalAssociatedData,\n verifyEnclaveSignature,\n validateStyles,\n getSettings,\n setSettings,\n parsePrivateKey,\n};\n","import { TKHQ } from \"./turnkey-core\";\nimport { HpkeDecrypt } from \"@turnkey/frames-shared\";\n\n// persist the MessageChannel object so we can use it to communicate with the parent window\nvar iframeMessagePort = null;\n\n// controllers to remove event listeners\nconst messageListenerController = new AbortController();\nconst turnkeyInitController = new AbortController();\n\n// Guard to prevent concurrent channel establishment from multiple senders\nlet channelEstablished = false;\n\n/**\n * DOM Event handlers to power the export flow in standalone mode\n * Instead of receiving events from the parent page, forms trigger them.\n * This is useful for debugging as well.\n */\nvar addDOMEventListeners = function () {\n document.getElementById(\"inject-key\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"INJECT_KEY_EXPORT_BUNDLE\",\n value: document.getElementById(\"key-export-bundle\").value,\n keyFormat: document.getElementById(\"key-export-format\").value,\n organizationId: document.getElementById(\"key-organization-id\").value,\n });\n },\n false\n );\n document.getElementById(\"inject-wallet\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"INJECT_WALLET_EXPORT_BUNDLE\",\n value: document.getElementById(\"wallet-export-bundle\").value,\n organizationId: document.getElementById(\"wallet-organization-id\").value,\n });\n },\n false\n );\n document.getElementById(\"reset\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({ type: \"RESET_EMBEDDED_KEY\" });\n },\n false\n );\n};\n\n/**\n * Message Event Handlers to process messages from the parent frame\n */\nvar messageEventListener = async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_KEY_EXPORT_BUNDLE\") {\n TKHQ.logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"keyFormat\"]}, ${event.data[\"organizationId\"]}`\n );\n try {\n await onInjectKeyBundle(\n event.data[\"value\"],\n event.data[\"keyFormat\"],\n event.data[\"organizationId\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"INJECT_WALLET_EXPORT_BUNDLE\") {\n TKHQ.logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"organizationId\"]}`\n );\n try {\n await onInjectWalletBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"requestId\"]\n );\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"APPLY_SETTINGS\") {\n try {\n await onApplySettings(event.data[\"value\"], event.data[\"requestId\"]);\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString(), event.data[\"requestId\"]);\n }\n }\n if (event.data && event.data[\"type\"] == \"RESET_EMBEDDED_KEY\") {\n TKHQ.logMessage(`⬇️ Received message ${event.data[\"type\"]}`);\n try {\n TKHQ.onResetEmbeddedKey();\n } catch (e) {\n TKHQ.sendMessageUp(\"ERROR\", e.toString());\n }\n }\n};\n\n/**\n * Initialize the embedded key and set up the DOM and message event listeners\n */\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async function () {\n await TKHQ.initEmbeddedKey();\n const embeddedKeyJwk = await TKHQ.getEmbeddedKey();\n const targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk);\n const targetPubHex = TKHQ.uint8arrayToHexString(targetPubBuf);\n document.getElementById(\"embedded-key\").value = targetPubHex;\n\n window.addEventListener(\"message\", messageEventListener, {\n capture: false,\n signal: messageListenerController.signal,\n });\n\n addDOMEventListeners();\n\n if (!messageListenerController.signal.aborted) {\n // If styles are saved in local storage, sanitize and apply them.\n const styleSettings = TKHQ.getSettings();\n if (styleSettings) {\n TKHQ.applySettings(styleSettings);\n }\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", targetPubHex);\n }\n },\n false\n);\n\nwindow.addEventListener(\n \"message\",\n async function (event) {\n /**\n * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame.\n * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort.\n * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice.\n * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp\n */\n if (\n event.data &&\n event.data[\"type\"] == \"TURNKEY_INIT_MESSAGE_CHANNEL\" &&\n event.ports?.[0]\n ) {\n // Synchronously check-and-set the flag before any await. This prevents\n // a second concurrent invocation from racing through while the first is\n // suspended at an await, which would allow multiple origins to establish\n // a channel before turnkeyInitController.abort() is reached.\n if (channelEstablished) {\n return;\n }\n channelEstablished = true;\n\n // remove the message event listener that was added in the DOMContentLoaded event\n messageListenerController.abort();\n\n iframeMessagePort = event.ports[0];\n iframeMessagePort.onmessage = messageEventListener;\n\n TKHQ.setParentFrameMessageChannelPort(iframeMessagePort);\n\n await TKHQ.initEmbeddedKey();\n var embeddedKeyJwk = await TKHQ.getEmbeddedKey();\n var targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk);\n var targetPubHex = TKHQ.uint8arrayToHexString(targetPubBuf);\n document.getElementById(\"embedded-key\").value = targetPubHex;\n\n TKHQ.sendMessageUp(\"PUBLIC_KEY_READY\", targetPubHex);\n\n // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed\n turnkeyInitController.abort();\n }\n },\n { signal: turnkeyInitController.signal }\n);\n\n/**\n * Hide every HTML element in except any

Export Key Material

This public key will be sent along with a private key ID or wallet ID inside of a new EXPORT_PRIVATE_KEY or EXPORT_WALLET activity




Inject Key Export Bundle

The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180).




Inject Wallet Export Bundle

The export bundle comes from the parent page and is composed of a public key and an encrypted payload. The payload is encrypted to this document's embedded key (stored in local storage and displayed above). The scheme relies on HPKE (RFC 9180).




Message log

Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.

\ No newline at end of file diff --git a/export/hpke-core.js b/export/hpke-core.js deleted file mode 100644 index 531eadca..00000000 --- a/export/hpke-core.js +++ /dev/null @@ -1,4 +0,0 @@ -// The following is vendored via https://esm.sh/@hpke/core@1.2.7. Note that we have excluded the source maps. - -/* esm.sh - esbuild bundle(@hpke/core@1.2.7) es2022 production */ -var ve={},fe=Se(globalThis,ve);function Se(i,e){return new Proxy(i,{get(t,r,n){return r in e?e[r]:i[r]},set(t,r,n){return r in e&&delete e[r],i[r]=n,!0},deleteProperty(t,r){let n=!1;return r in e&&(delete e[r],n=!0),r in i&&(delete i[r],n=!0),n},ownKeys(t){let r=Reflect.ownKeys(i),n=Reflect.ownKeys(e),a=new Set(n);return[...r.filter(s=>!a.has(s)),...n]},defineProperty(t,r,n){return r in e&&delete e[r],Reflect.defineProperty(i,r,n),!0},getOwnPropertyDescriptor(t,r){return r in e?Reflect.getOwnPropertyDescriptor(e,r):Reflect.getOwnPropertyDescriptor(i,r)},has(t,r){return r in e||r in i}})}var ee=class extends Error{constructor(e){let t;e instanceof Error?t=e.message:typeof e=="string"?t=e:t="",super(t),this.name=this.constructor.name}},h=class extends ee{},l=class extends h{},de=class extends h{},P=class extends h{},g=class extends h{},D=class extends h{},N=class extends h{},T=class extends h{},C=class extends h{},M=class extends h{},R=class extends h{},B=class extends h{},p=class extends h{};async function Ae(){if(fe!==void 0&&globalThis.crypto!==void 0)return globalThis.crypto.subtle;try{let{webcrypto:i}=await import("/v135/crypto-browserify@3.12.0/es2022/crypto-browserify.mjs");return i.subtle}catch(i){throw new p(i)}}var w=class{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){this._api===void 0&&(this._api=await Ae())}};var x={Base:0,Psk:1,Auth:2,AuthPsk:3},Ee={NotAssigned:0,DhkemP256HkdfSha256:16,DhkemP384HkdfSha384:17,DhkemP521HkdfSha512:18,DhkemSecp256k1HkdfSha256:19,DhkemX25519HkdfSha256:32,DhkemX448HkdfSha512:33,HybridkemX25519Kyber768:48},f=Ee,Ie={HkdfSha256:1,HkdfSha384:2,HkdfSha512:3},v=Ie,Le={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},m=Le;var ye=["encrypt","decrypt"];var te=class extends w{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,r){await this._setupKey();let n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.encrypt(n,this._key,t)}async open(e,t,r){await this._setupKey();let n={name:"AES-GCM",iv:e,additionalData:r};return await this._api.decrypt(n,this._key,t)}async _setupKey(){if(this._key!==void 0)return;await this._setup();let e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,ye)}},G=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.Aes128Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new te(e)}},re=class extends G{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.Aes256Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}};var ie=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:m.ExportOnly}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:0})}createEncryptionContext(e){throw new p("Export only")}};var c=new Uint8Array(0);function ne(){return new Promise((i,e)=>{e(new p("Not supported"))})}var Ue=new Uint8Array([115,101,99]),S=class{constructor(e,t,r){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=r}async seal(e,t){return await ne()}async open(e,t){return await ne()}async export(e,t){if(e.byteLength>8192)throw new l("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,Ue,new Uint8Array(e),t)}catch(r){throw new T(r)}}},F=class extends S{},q=class extends S{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=n}};var K=i=>typeof i=="object"&&i!==null&&typeof i.privateKey=="object"&&typeof i.publicKey=="object";function _(i,e){if(e<=0)throw new Error("i2Osp: too small size");if(i>=256**e)throw new Error("i2Osp: too large integer");let t=new Uint8Array(e);for(let r=0;r>8;return t}function z(i,e){let t=new Uint8Array(i.length+e.length);return t.set(i,0),t.set(e,i.length),t}function be(i){let e=i.replace(/-/g,"+").replace(/_/g,"/"),t=atob(e),r=new Uint8Array(t.length);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new R("Message limit reached");e.seq+=1}};var Y=class extends A{async open(e,t=c){let r;try{r=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(n){throw new M(n)}return this.incrementSeq(this._ctx),r}};var X=class extends A{constructor(e,t,r,n){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=n}async seal(e,t=c){let r;try{r=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(n){throw new C(n)}return this.incrementSeq(this._ctx),r}};var ze=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),He=new Uint8Array([101,120,112]),je=new Uint8Array([105,110,102,111,95,104,97,115,104]),De=new Uint8Array([107,101,121]),Ne=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),Te=new Uint8Array([115,101,99,114,101,116]),Ce=new Uint8Array([72,80,75,69,0,0,0,0,0,0]),J=class extends w{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof e.kem=="number")throw new l("KemId cannot be used");if(this._kem=e.kem,typeof e.kdf=="number")throw new l("KdfId cannot be used");if(this._kdf=e.kdf,typeof e.aead=="number")throw new l("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(Ce),this._suiteId.set(_(this._kem.id,2),4),this._suiteId.set(_(this._kdf.id,2),6),this._suiteId.set(_(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.encap(e),r;return e.psk!==void 0?r=e.senderKey!==void 0?x.AuthPsk:x.Psk:r=e.senderKey!==void 0?x.Auth:x.Base,await this._keyScheduleS(r,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.decap(e),r;return e.psk!==void 0?r=e.senderPublicKey!==void 0?x.AuthPsk:x.Psk:r=e.senderPublicKey!==void 0?x.Auth:x.Base,await this._keyScheduleR(r,t,e)}async seal(e,t,r=c){let n=await this.createSenderContext(e);return{ct:await n.seal(t,r),enc:n.enc}}async open(e,t,r=c){return await(await this.createRecipientContext(e)).open(t,r)}async _keySchedule(e,t,r){let n=r.psk===void 0?c:new Uint8Array(r.psk.id),a=await this._kdf.labeledExtract(c,Ne,n),s=r.info===void 0?c:new Uint8Array(r.info),o=await this._kdf.labeledExtract(c,je,s),u=new Uint8Array(1+a.byteLength+o.byteLength);u.set(new Uint8Array([e]),0),u.set(new Uint8Array(a),1),u.set(new Uint8Array(o),1+a.byteLength);let y=r.psk===void 0?c:new Uint8Array(r.psk.key),b=this._kdf.buildLabeledIkm(Te,y),j=this._kdf.buildLabeledInfo(He,u,this._kdf.hashSize),d=await this._kdf.extractAndExpand(t,b,j,this._kdf.hashSize);if(this._aead.id===m.ExportOnly)return{aead:this._aead,exporterSecret:d};let me=this._kdf.buildLabeledInfo(De,u,this._aead.keySize),ge=await this._kdf.extractAndExpand(t,b,me,this._aead.keySize),ke=this._kdf.buildLabeledInfo(ze,u,this._aead.nonceSize),Pe=await this._kdf.extractAndExpand(t,b,ke,this._aead.nonceSize);return{aead:this._aead,exporterSecret:d,key:ge,baseNonce:new Uint8Array(Pe),seq:0}}async _keyScheduleS(e,t,r,n){let a=await this._keySchedule(e,t,n);return a.key===void 0?new q(this._api,this._kdf,a.exporterSecret,r):new X(this._api,this._kdf,a,r)}async _keyScheduleR(e,t,r){let n=await this._keySchedule(e,t,r);return n.key===void 0?new F(this._api,this._kdf,n.exporterSecret):new Y(this._api,this._kdf,n)}_validateInputLength(e){if(e.info!==void 0&&e.info.byteLength>8192)throw new l("Too long info");if(e.psk!==void 0){if(e.psk.key.byteLength<32)throw new l(`PSK must have at least ${32} bytes`);if(e.psk.key.byteLength>8192)throw new l("Too long psk.key");if(e.psk.id.byteLength>8192)throw new l("Too long psk.id")}}};var we=new Uint8Array([72,80,75,69,45,118,49]),H=class extends w{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:c}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();let r=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(we,0),r.set(this._suiteId,7),r.set(e,7+this._suiteId.byteLength),r.set(t,7+this._suiteId.byteLength+e.byteLength),r}buildLabeledInfo(e,t,r){this._checkInit();let n=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(new Uint8Array([0,r]),0),n.set(we,2),n.set(this._suiteId,9),n.set(e,9+this._suiteId.byteLength),n.set(t,9+this._suiteId.byteLength+e.byteLength),n}async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new l("The salt length must be the same as the hashSize");let r=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",r,t)}async expand(e,t,r){await this._setup();let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),a=new ArrayBuffer(r),s=new Uint8Array(a),o=c,u=new Uint8Array(t),y=new Uint8Array(1);if(r>255*this.hashSize)throw new Error("Entropy limit reached");let b=new Uint8Array(this.hashSize+u.length+1);for(let j=1,d=0;d=o.length?(s.set(o,d),d+=o.length):(s.set(o.slice(0,s.length-d),d),d+=s.length-d);return a}async extractAndExpand(e,t,r,n){await this._setup();let a=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:r},a,n*8)}async labeledExtract(e,t,r){return await this.extract(e,this.buildLabeledIkm(t,r))}async labeledExpand(e,t,r,n){return await this.expand(e,this.buildLabeledInfo(t,r,n),n)}_checkInit(){if(this._suiteId===c)throw new Error("Not initialized. Call init()")}},E=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}},I=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha384}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-384",length:384}})}},L=class extends H{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:v.HkdfSha512}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-512",length:512}})}};var _e=new Uint8Array([75,69,77,0,0]);var Me=new Uint8Array([101,97,101,95,112,114,107]),Re=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);function Be(i,e,t){let r=new Uint8Array(i.length+e.length+t.length);return r.set(i,0),r.set(e,i.length),r.set(t,i.length+e.length),r}var U=class{constructor(e,t,r){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=r;let n=new Uint8Array(_e);n.set(_(this.id,2),3),this._kdf.init(n)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(e)}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(e)}async importKey(e,t,r=!0){return await this._prim.importKey(e,t,r)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){if(e.byteLength>8192)throw new l("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;e.ekm===void 0?t=await this.generateKeyPair():K(e.ekm)?t=e.ekm:t=await this.deriveKeyPair(e.ekm);let r=await this._prim.serializePublicKey(t.publicKey),n=await this._prim.serializePublicKey(e.recipientPublicKey);try{let a;if(e.senderKey===void 0)a=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{let u=K(e.senderKey)?e.senderKey.privateKey:e.senderKey,y=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),b=new Uint8Array(await this._prim.dh(u,e.recipientPublicKey));a=z(y,b)}let s;if(e.senderKey===void 0)s=z(new Uint8Array(r),new Uint8Array(n));else{let u=K(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),y=await this._prim.serializePublicKey(u);s=Be(new Uint8Array(r),new Uint8Array(n),new Uint8Array(y))}let o=await this._generateSharedSecret(a,s);return{enc:r,sharedSecret:o}}catch(a){throw new D(a)}}async decap(e){let t=await this._prim.deserializePublicKey(e.enc),r=K(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,n=K(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),a=await this._prim.serializePublicKey(n);try{let s;if(e.senderPublicKey===void 0)s=new Uint8Array(await this._prim.dh(r,t));else{let u=new Uint8Array(await this._prim.dh(r,t)),y=new Uint8Array(await this._prim.dh(r,e.senderPublicKey));s=z(u,y)}let o;if(e.senderPublicKey===void 0)o=z(new Uint8Array(e.enc),new Uint8Array(a));else{let u=await this._prim.serializePublicKey(e.senderPublicKey);o=new Uint8Array(e.enc.byteLength+a.byteLength+u.byteLength),o.set(new Uint8Array(e.enc),0),o.set(new Uint8Array(a),e.enc.byteLength),o.set(new Uint8Array(u),e.enc.byteLength+a.byteLength)}return await this._generateSharedSecret(s,o)}catch(s){throw new N(s)}}async _generateSharedSecret(e,t){let r=this._kdf.buildLabeledIkm(Me,e),n=this._kdf.buildLabeledInfo(Re,t,this.secretSize);return await this._kdf.extractAndExpand(c,r,n,this.secretSize)}};var W=["deriveBits"],xe=new Uint8Array([100,107,112,95,112,114,107]),Jt=new Uint8Array([115,107]);var Z=class{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}};var Ge=new Uint8Array([99,97,110,100,105,100,97,116,101]),Fe=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),qe=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),Ye=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),Xe=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),Je=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),We=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),O=class extends w{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case f.DhkemP256HkdfSha256:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=Fe,this._bitmask=255,this._pkcs8AlgId=Xe;break;case f.DhkemP384HkdfSha384:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=qe,this._bitmask=255,this._pkcs8AlgId=Je;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=Ye,this._bitmask=1,this._pkcs8AlgId=We;break}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(t){throw new P(t)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(t){throw new g(t)}}async serializePrivateKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return be(t.d)}catch(t){throw new P(t)}}async deserializePrivateKey(e){await this._setup();try{return await this._importRawKey(e,!1)}catch(t){throw new g(t)}}async importKey(e,t,r){await this._setup();try{if(e==="raw")return await this._importRawKey(t,r);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,r)}catch(n){throw new g(n)}}async generateKeyPair(){await this._setup();try{return await this._api.generateKey(this._alg,!0,W)}catch(e){throw new p(e)}}async deriveKeyPair(e){await this._setup();try{let t=await this._hkdf.labeledExtract(c,xe,new Uint8Array(e)),r=new Z(this._nSk);for(let a=0;r.isZero()||!r.lessThan(this._order);a++){if(a>255)throw new Error("Faild to derive a key pair");let s=new Uint8Array(await this._hkdf.labeledExpand(t,Ge,_(a,1),this._nSk));s[0]=s[0]&this._bitmask,r.set(s)}let n=await this._deserializePkcs8Key(r.val());return r.reset(),{privateKey:n,publicKey:await this.derivePublicKey(n)}}catch(t){throw new B(t)}}async derivePublicKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(t){throw new g(t)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,this._nDh*8)}catch(r){throw new P(r)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(typeof e.crv>"u"||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(typeof e.d<"u")throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(typeof e.d>"u")throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,W)}async _deserializePkcs8Key(e){let t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,W)}};var $=class extends U{constructor(){let e=new E,t=new O(f.DhkemP256HkdfSha256,e);super(f.DhkemP256HkdfSha256,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP256HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}},Q=class extends U{constructor(){let e=new I,t=new O(f.DhkemP384HkdfSha384,e);super(f.DhkemP384HkdfSha384,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP384HkdfSha384}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:48})}},V=class extends U{constructor(){let e=new L,t=new O(f.DhkemP521HkdfSha512,e);super(f.DhkemP521HkdfSha512,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:f.DhkemP521HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:64})}};var ae=class extends J{},se=class extends ${},oe=class extends Q{},ue=class extends V{},ce=class extends E{},le=class extends I{},he=class extends L{};export{m as AeadId,G as Aes128Gcm,re as Aes256Gcm,ee as BaseError,ae as CipherSuite,N as DecapError,B as DeriveKeyPairError,g as DeserializeError,se as DhkemP256HkdfSha256,oe as DhkemP384HkdfSha384,ue as DhkemP521HkdfSha512,D as EncapError,T as ExportError,ie as ExportOnly,ce as HkdfSha256,le as HkdfSha384,he as HkdfSha512,h as HpkeError,l as InvalidParamError,v as KdfId,f as KemId,R as MessageLimitReachedError,p as NotSupportedError,M as OpenError,C as SealError,P as SerializeError,de as ValidationError}; diff --git a/export/index.template.html b/export/index.template.html index 388ea781..40c6cae4 100644 --- a/export/index.template.html +++ b/export/index.template.html @@ -76,6 +76,12 @@ display: none; } + + + @@ -162,1502 +168,5 @@

Message log

- - - - - - - - diff --git a/export/index.test.js b/export/index.test.ts similarity index 93% rename from export/index.test.js rename to export/index.test.ts index 79648fed..cd6f435d 100644 --- a/export/index.test.js +++ b/export/index.test.ts @@ -1,44 +1,28 @@ import "@testing-library/jest-dom"; -import { JSDOM } from "jsdom"; -import fs from "fs"; -import path from "path"; import * as crypto from "crypto"; +import { TKHQ } from "./src/turnkey-core"; -const html = fs - .readFileSync(path.resolve(__dirname, "./index.template.html"), "utf8") - .replace("${TURNKEY_SIGNER_ENVIRONMENT}", "prod"); +beforeAll(async () => { + Object.defineProperty(window, "TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", { + value: "prod", + }); -let dom; -let TKHQ; + // Necessary for crypto to be available. + // See https://github.com/jsdom/jsdom/issues/1612 + Object.defineProperty(window, "crypto", { + value: crypto.webcrypto, + }); +}); describe("TKHQ", () => { beforeEach(() => { - dom = new JSDOM(html, { - // Necessary to run script tags - runScripts: "dangerously", - // Necessary to have access to localStorage - url: "http://localhost", - // Necessary for TextDecoder to be available. - // See https://github.com/jsdom/jsdom/issues/2524 - beforeParse(window) { - window.TextDecoder = TextDecoder; - window.TextEncoder = TextEncoder; - }, - }); - - // Necessary for crypto to be available. - // See https://github.com/jsdom/jsdom/issues/1612 - Object.defineProperty(dom.window, "crypto", { - value: crypto.webcrypto, - }); - - TKHQ = dom.window.TKHQ; + window.localStorage.clear(); }); it("gets and sets items with expiry localStorage", async () => { // Set a TTL of 1000ms TKHQ.setItemWithExpiry("k", "v", 1000); - let item = JSON.parse(dom.window.localStorage.getItem("k")); + let item = JSON.parse(window.localStorage.getItem("k")!); expect(item.value).toBe("v"); expect(item.expiry).toBeTruthy(); @@ -54,7 +38,7 @@ describe("TKHQ", () => { }, 600); // Wait for 600ms to ensure the item has expired // Returns null if getItemWithExpiry is called for item without expiry - dom.window.localStorage.setItem("k", JSON.stringify({ value: "v" })); + window.localStorage.setItem("k", JSON.stringify({ value: "v" })); item = TKHQ.getItemWithExpiry("k"); expect(item).toBeNull(); }); @@ -63,8 +47,8 @@ describe("TKHQ", () => { expect(TKHQ.getEmbeddedKey()).toBe(null); // Set a dummy "key" - TKHQ.setEmbeddedKey({ foo: "bar" }); - expect(TKHQ.getEmbeddedKey()).toEqual({ foo: "bar" }); + TKHQ.setEmbeddedKey({ alg: "bar" }); + expect(TKHQ.getEmbeddedKey()).toEqual({ alg: "bar" }); }); it("inits embedded key and is idempotent", async () => { @@ -230,8 +214,8 @@ describe("TKHQ", () => { "98,117,102,102,101,114" ); - // Error case: bad value expect(() => { + // @ts-expect-error Error case: bad value TKHQ.uint8arrayFromHexString({}); }).toThrow("cannot create uint8array from invalid hex string"); // Error case: empty string diff --git a/export/jest.config.js b/export/jest.config.js deleted file mode 100644 index ffcfa55f..00000000 --- a/export/jest.config.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - clearMocks: true, - setupFilesAfterEnv: ["regenerator-runtime/runtime"], - testPathIgnorePatterns: ["/node_modules/"], -}; diff --git a/export/jest.config.ts b/export/jest.config.ts new file mode 100644 index 00000000..f4ff6bed --- /dev/null +++ b/export/jest.config.ts @@ -0,0 +1,15 @@ +import type { Config } from "jest"; + +export default { + clearMocks: true, + setupFiles: ["/jest.setup.ts"], + testEnvironment: "jsdom", + testEnvironmentOptions: { + url: "http://localhost", + }, + transform: { + "^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }], + }, + testPathIgnorePatterns: ["/node_modules/"], + transformIgnorePatterns: ["/node_modules/.pnpm/(?!(@noble|@hpke)/)"], +} satisfies Config; diff --git a/export/jest.setup.ts b/export/jest.setup.ts new file mode 100644 index 00000000..5a339390 --- /dev/null +++ b/export/jest.setup.ts @@ -0,0 +1,21 @@ +import "regenerator-runtime/runtime"; +import { TextEncoder, TextDecoder } from "util"; +import { ReadableStream } from "node:stream/web"; +import { MessagePort } from "node:worker_threads"; + +if (typeof global.MessagePort === "undefined") { + global.MessagePort = MessagePort as unknown as typeof global.MessagePort; +} + +if (typeof global.ReadableStream === "undefined") { + global.ReadableStream = + ReadableStream as unknown as typeof global.ReadableStream; +} + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} diff --git a/export/noble-ed25519.js b/export/noble-ed25519.js deleted file mode 100644 index ec6f4982..00000000 --- a/export/noble-ed25519.js +++ /dev/null @@ -1,415 +0,0 @@ -"use strict"; -var nobleEd25519 = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // only exporting what we need for getting the public key - var input_exports = {}; - __export(input_exports, { - getPublicKey: () => getPublicKey, - etc: () => etc - }); - - const P = 2n ** 255n - 19n; // ed25519 is twisted edwards curve - const N = 2n ** 252n + 27742317777372353535851937790883648493n; // curve's (group) order - const Gx = 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an; // base point x - const Gy = 0x6666666666666666666666666666666666666666666666666666666666666658n; // base point y - const CURVE = { - a: -1n, // where a=-1, d = -(121665/121666) == -(121665 * inv(121666)) mod P - d: 37095705934669439343138083508754565189542113879843219016388785533085940283555n, - p: P, n: N, h: 8, Gx, Gy // field prime, curve (group) order, cofactor - }; - const err = (m = '') => { throw new Error(m); }; // error helper, messes-up stack trace - const str = (s) => typeof s === 'string'; // is string - const isu8 = (a) => (a instanceof Uint8Array || - (a != null && typeof a === 'object' && a.constructor.name === 'Uint8Array')); - const au8 = (a, l) => // is Uint8Array (of specific length) - !isu8(a) || (typeof l === 'number' && l > 0 && a.length !== l) ? - err('Uint8Array of valid length expected') : a; - const u8n = (data) => new Uint8Array(data); // creates Uint8Array - const toU8 = (a, len) => au8(str(a) ? h2b(a) : u8n(au8(a)), len); // norm(hex/u8a) to u8a - const mod = (a, b = P) => { let r = a % b; return r >= 0n ? r : b + r; }; // mod division - const isPoint = (p) => (p instanceof Point ? p : err('Point expected')); // is xyzt point - class Point { - constructor(ex, ey, ez, et) { - this.ex = ex; - this.ey = ey; - this.ez = ez; - this.et = et; - } - static fromAffine(p) { return new Point(p.x, p.y, 1n, mod(p.x * p.y)); } - static fromHex(hex, zip215 = false) { - const { d } = CURVE; - hex = toU8(hex, 32); - const normed = hex.slice(); // copy the array to not mess it up - const lastByte = hex[31]; - normed[31] = lastByte & ~0x80; // adjust first LE byte = last BE byte - const y = b2n_LE(normed); // decode as little-endian, convert to num - if (zip215 && !(0n <= y && y < 2n ** 256n)) - err('bad y coord 1'); // zip215=true [1..2^256-1] - if (!zip215 && !(0n <= y && y < P)) - err('bad y coord 2'); // zip215=false [1..P-1] - const y2 = mod(y * y); // y² - const u = mod(y2 - 1n); // u=y²-1 - const v = mod(d * y2 + 1n); // v=dy²+1 - let { isValid, value: x } = uvRatio(u, v); // (uv³)(uv⁷)^(p-5)/8; square root - if (!isValid) - err('bad y coordinate 3'); // not square root: bad point - const isXOdd = (x & 1n) === 1n; // adjust sign of x coordinate - const isLastByteOdd = (lastByte & 0x80) !== 0; // x_0, last bit - if (!zip215 && x === 0n && isLastByteOdd) - err('bad y coord 3'); // x=0 and x_0 = 1 - if (isLastByteOdd !== isXOdd) - x = mod(-x); - return new Point(x, y, 1n, mod(x * y)); // Z=1, T=xy - } - get x() { return this.toAffine().x; } // .x, .y will call expensive toAffine. - get y() { return this.toAffine().y; } // Should be used with care. - equals(other) { - const { ex: X1, ey: Y1, ez: Z1 } = this; - const { ex: X2, ey: Y2, ez: Z2 } = isPoint(other); // isPoint() checks class equality - const X1Z2 = mod(X1 * Z2), X2Z1 = mod(X2 * Z1); - const Y1Z2 = mod(Y1 * Z2), Y2Z1 = mod(Y2 * Z1); - return X1Z2 === X2Z1 && Y1Z2 === Y2Z1; - } - is0() { return this.equals(I); } - negate() { - return new Point(mod(-this.ex), this.ey, this.ez, mod(-this.et)); - } - double() { - const { ex: X1, ey: Y1, ez: Z1 } = this; // Cost: 4M + 4S + 1*a + 6add + 1*2 - const { a } = CURVE; // https://hyperelliptic.org/EFD/g1p/auto-twisted-extended.html#doubling-dbl-2008-hwcd - const A = mod(X1 * X1); - const B = mod(Y1 * Y1); - const C = mod(2n * mod(Z1 * Z1)); - const D = mod(a * A); - const x1y1 = X1 + Y1; - const E = mod(mod(x1y1 * x1y1) - A - B); - const G = D + B; - const F = G - C; - const H = D - B; - const X3 = mod(E * F); - const Y3 = mod(G * H); - const T3 = mod(E * H); - const Z3 = mod(F * G); - return new Point(X3, Y3, Z3, T3); - } - add(other) { - const { ex: X1, ey: Y1, ez: Z1, et: T1 } = this; // Cost: 8M + 1*k + 8add + 1*2. - const { ex: X2, ey: Y2, ez: Z2, et: T2 } = isPoint(other); // doesn't check if other on-curve - const { a, d } = CURVE; // http://hyperelliptic.org/EFD/g1p/auto-twisted-extended-1.html#addition-add-2008-hwcd-3 - const A = mod(X1 * X2); - const B = mod(Y1 * Y2); - const C = mod(T1 * d * T2); - const D = mod(Z1 * Z2); - const E = mod((X1 + Y1) * (X2 + Y2) - A - B); - const F = mod(D - C); - const G = mod(D + C); - const H = mod(B - a * A); - const X3 = mod(E * F); - const Y3 = mod(G * H); - const T3 = mod(E * H); - const Z3 = mod(F * G); - return new Point(X3, Y3, Z3, T3); - } - mul(n, safe = true) { - if (n === 0n) - return safe === true ? err('cannot multiply by 0') : I; - if (!(typeof n === 'bigint' && 0n < n && n < N)) - err('invalid scalar, must be < L'); - if (!safe && this.is0() || n === 1n) - return this; // safe=true bans 0. safe=false allows 0. - if (this.equals(G)) - return wNAF(n).p; // use wNAF precomputes for base points - let p = I, f = G; // init result point & fake point - for (let d = this; n > 0n; d = d.double(), n >>= 1n) { // double-and-add ladder - if (n & 1n) - p = p.add(d); // if bit is present, add to point - else if (safe) - f = f.add(d); // if not, add to fake for timing safety - } - return p; - } - multiply(scalar) { return this.mul(scalar); } // Aliases for compatibilty - clearCofactor() { return this.mul(BigInt(CURVE.h), false); } // multiply by cofactor - isSmallOrder() { return this.clearCofactor().is0(); } // check if P is small order - isTorsionFree() { - let p = this.mul(N / 2n, false).double(); // ensures the point is not "bad". - if (N % 2n) - p = p.add(this); // P^(N+1) // P*N == (P*(N/2))*2+P - return p.is0(); - } - toAffine() { - const { ex: x, ey: y, ez: z } = this; // (x, y, z, t) ∋ (x=x/z, y=y/z, t=xy) - if (this.equals(I)) - return { x: 0n, y: 1n }; // fast-path for zero point - const iz = invert(z); // z^-1: invert z - if (mod(z * iz) !== 1n) - err('invalid inverse'); // (z * z^-1) must be 1, otherwise bad math - return { x: mod(x * iz), y: mod(y * iz) }; // x = x*z^-1; y = y*z^-1 - } - toRawBytes() { - const { x, y } = this.toAffine(); // convert to affine 2d point - const b = n2b_32LE(y); // encode number to 32 bytes - b[31] |= x & 1n ? 0x80 : 0; // store sign in first LE byte - return b; - } - toHex() { return b2h(this.toRawBytes()); } // encode to hex string - } - Point.BASE = new Point(Gx, Gy, 1n, mod(Gx * Gy)); // Generator / Base point - Point.ZERO = new Point(0n, 1n, 1n, 0n); // Identity / Zero point - const { BASE: G, ZERO: I } = Point; // Generator, identity points - const padh = (num, pad) => num.toString(16).padStart(pad, '0'); - const b2h = (b) => Array.from(b).map(e => padh(e, 2)).join(''); // bytes to hex - const h2b = (hex) => { - const l = hex.length; // error if not string, - if (!str(hex) || l % 2) - err('hex invalid 1'); // or has odd length like 3, 5. - const arr = u8n(l / 2); // create result array - for (let i = 0; i < arr.length; i++) { - const j = i * 2; - const h = hex.slice(j, j + 2); // hexByte. slice is faster than substr - const b = Number.parseInt(h, 16); // byte, created from string part - if (Number.isNaN(b) || b < 0) - err('hex invalid 2'); // byte must be valid 0 <= byte < 256 - arr[i] = b; - } - return arr; - }; - const n2b_32LE = (num) => h2b(padh(num, 32 * 2)).reverse(); // number to bytes LE - const b2n_LE = (b) => BigInt('0x' + b2h(u8n(au8(b)).reverse())); // bytes LE to num - const concatB = (...arrs) => { - const r = u8n(arrs.reduce((sum, a) => sum + au8(a).length, 0)); // create u8a of summed length - let pad = 0; // walk through each array, - arrs.forEach(a => { r.set(a, pad); pad += a.length; }); // ensure they have proper type - return r; - }; - const invert = (num, md = P) => { - if (num === 0n || md <= 0n) - err('no inverse n=' + num + ' mod=' + md); // no neg exponent for now - let a = mod(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n; - while (a !== 0n) { // uses euclidean gcd algorithm - const q = b / a, r = b % a; // not constant-time - const m = x - u * q, n = y - v * q; - b = a, a = r, x = u, y = v, u = m, v = n; - } - return b === 1n ? mod(x, md) : err('no inverse'); // b is gcd at this point - }; - const pow2 = (x, power) => { - let r = x; - while (power-- > 0n) { - r *= r; - r %= P; - } - return r; - }; - const pow_2_252_3 = (x) => { - const x2 = (x * x) % P; // x^2, bits 1 - const b2 = (x2 * x) % P; // x^3, bits 11 - const b4 = (pow2(b2, 2n) * b2) % P; // x^(2^4-1), bits 1111 - const b5 = (pow2(b4, 1n) * x) % P; // x^(2^5-1), bits 11111 - const b10 = (pow2(b5, 5n) * b5) % P; // x^(2^10) - const b20 = (pow2(b10, 10n) * b10) % P; // x^(2^20) - const b40 = (pow2(b20, 20n) * b20) % P; // x^(2^40) - const b80 = (pow2(b40, 40n) * b40) % P; // x^(2^80) - const b160 = (pow2(b80, 80n) * b80) % P; // x^(2^160) - const b240 = (pow2(b160, 80n) * b80) % P; // x^(2^240) - const b250 = (pow2(b240, 10n) * b10) % P; // x^(2^250) - const pow_p_5_8 = (pow2(b250, 2n) * x) % P; // < To pow to (p+3)/8, multiply it by x. - return { pow_p_5_8, b2 }; - }; - const RM1 = 19681161376707505956807079304988542015446066515923890162744021073123829784752n; // √-1 - const uvRatio = (u, v) => { - const v3 = mod(v * v * v); // v³ - const v7 = mod(v3 * v3 * v); // v⁷ - const pow = pow_2_252_3(u * v7).pow_p_5_8; // (uv⁷)^(p-5)/8 - let x = mod(u * v3 * pow); // (uv³)(uv⁷)^(p-5)/8 - const vx2 = mod(v * x * x); // vx² - const root1 = x; // First root candidate - const root2 = mod(x * RM1); // Second root candidate; RM1 is √-1 - const useRoot1 = vx2 === u; // If vx² = u (mod p), x is a square root - const useRoot2 = vx2 === mod(-u); // If vx² = -u, set x <-- x * 2^((p-1)/4) - const noRoot = vx2 === mod(-u * RM1); // There is no valid root, vx² = -u√-1 - if (useRoot1) - x = root1; - if (useRoot2 || noRoot) - x = root2; // We return root2 anyway, for const-time - if ((mod(x) & 1n) === 1n) - x = mod(-x); // edIsNegative - return { isValid: useRoot1 || useRoot2, value: x }; - }; - const modL_LE = (hash) => mod(b2n_LE(hash), N); // modulo L; but little-endian - let _shaS; - const sha512a = (...m) => etc.sha512Async(...m); // Async SHA512 - const sha512s = (...m) => // Sync SHA512, not set by default - typeof _shaS === 'function' ? _shaS(...m) : err('etc.sha512Sync not set'); - const hash2extK = (hashed) => { - const head = hashed.slice(0, 32); // slice creates a copy, unlike subarray - head[0] &= 248; // Clamp bits: 0b1111_1000, - head[31] &= 127; // 0b0111_1111, - head[31] |= 64; // 0b0100_0000 - const prefix = hashed.slice(32, 64); // private key "prefix" - const scalar = modL_LE(head); // modular division over curve order - const point = G.mul(scalar); // public key point - const pointBytes = point.toRawBytes(); // point serialized to Uint8Array - return { head, prefix, scalar, point, pointBytes }; - }; - // RFC8032 5.1.5; getPublicKey async, sync. Hash priv key and extract point. - const getExtendedPublicKeyAsync = (priv) => sha512a(toU8(priv, 32)).then(hash2extK); - const getExtendedPublicKey = (priv) => hash2extK(sha512s(toU8(priv, 32))); - const getPublicKeyAsync = (priv) => getExtendedPublicKeyAsync(priv).then(p => p.pointBytes); - const getPublicKey = (priv) => getExtendedPublicKey(priv).pointBytes; - function hashFinish(asynchronous, res) { - if (asynchronous) - return sha512a(res.hashable).then(res.finish); - return res.finish(sha512s(res.hashable)); - } - const _sign = (e, rBytes, msg) => { - const { pointBytes: P, scalar: s } = e; - const r = modL_LE(rBytes); // r was created outside, reduce it modulo L - const R = G.mul(r).toRawBytes(); // R = [r]B - const hashable = concatB(R, P, msg); // dom2(F, C) || R || A || PH(M) - const finish = (hashed) => { - const S = mod(r + modL_LE(hashed) * s, N); // S = (r + k * s) mod L; 0 <= s < l - return au8(concatB(R, n2b_32LE(S)), 64); // 64-byte sig: 32b R.x + 32b LE(S) - }; - return { hashable, finish }; - }; - const signAsync = async (msg, privKey) => { - const m = toU8(msg); // RFC8032 5.1.6: sign msg with key async - const e = await getExtendedPublicKeyAsync(privKey); // pub,prfx - const rBytes = await sha512a(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinish(true, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature - }; - const sign = (msg, privKey) => { - const m = toU8(msg); // RFC8032 5.1.6: sign msg with key sync - const e = getExtendedPublicKey(privKey); // pub,prfx - const rBytes = sha512s(e.prefix, m); // r = SHA512(dom2(F, C) || prefix || PH(M)) - return hashFinish(false, _sign(e, rBytes, m)); // gen R, k, S, then 64-byte signature - }; - const dvo = { zip215: true }; - const _verify = (sig, msg, pub, opts = dvo) => { - msg = toU8(msg); // Message hex str/Bytes - sig = toU8(sig, 64); // Signature hex str/Bytes, must be 64 bytes - const { zip215 } = opts; // switch between zip215 and rfc8032 verif - let A, R, s, SB, hashable = new Uint8Array(); - try { - A = Point.fromHex(pub, zip215); // public key A decoded - R = Point.fromHex(sig.slice(0, 32), zip215); // 0 <= R < 2^256: ZIP215 R can be >= P - s = b2n_LE(sig.slice(32, 64)); // Decode second half as an integer S - SB = G.mul(s, false); // in the range 0 <= s < L - hashable = concatB(R.toRawBytes(), A.toRawBytes(), msg); // dom2(F, C) || R || A || PH(M) - } - catch (_error) { - // Error caught during parsing - will be handled by checking SB == null below - } - const finish = (hashed) => { - if (SB == null) - return false; // false if try-catch catched an error - if (!zip215 && A.isSmallOrder()) - return false; // false for SBS: Strongly Binding Signature - const k = modL_LE(hashed); // decode in little-endian, modulo L - const RkA = R.add(A.mul(k, false)); // [8]R + [8][k]A' - return RkA.add(SB.negate()).clearCofactor().is0(); // [8][S]B = [8]R + [8][k]A' - }; - return { hashable, finish }; - }; - // RFC8032 5.1.7: verification async, sync - const verifyAsync = async (s, m, p, opts = dvo) => hashFinish(true, _verify(s, m, p, opts)); - const verify = (s, m, p, opts = dvo) => hashFinish(false, _verify(s, m, p, opts)); - const cr = () => // We support: 1) browsers 2) node.js 19+ - typeof globalThis === 'object' && 'crypto' in globalThis ? globalThis.crypto : undefined; - const etc = { - bytesToHex: b2h, hexToBytes: h2b, concatBytes: concatB, - mod, invert, - randomBytes: (len = 32) => { - const crypto = cr(); // Can be shimmed in node.js <= 18 to prevent error: - // import { webcrypto } from 'node:crypto'; - // if (!globalThis.crypto) globalThis.crypto = webcrypto; - if (!crypto || !crypto.getRandomValues) - err('crypto.getRandomValues must be defined'); - return crypto.getRandomValues(u8n(len)); - }, - sha512Async: async (...messages) => { - const crypto = cr(); - if (!crypto || !crypto.subtle) - err('crypto.subtle or etc.sha512Async must be defined'); - const m = concatB(...messages); - return u8n(await crypto.subtle.digest('SHA-512', m.buffer)); - }, - sha512Sync: undefined, // Actual logic below - }; - Object.defineProperties(etc, { sha512Sync: { - configurable: false, get() { return _shaS; }, set(f) { if (!_shaS) - _shaS = f; }, - } }); - const utils = { - getExtendedPublicKeyAsync, getExtendedPublicKey, - randomPrivateKey: () => etc.randomBytes(32), - precompute(w = 8, p = G) { p.multiply(3n); w; return p; }, // no-op - }; - const W = 8; // Precomputes-related code. W = window size - const precompute = () => { - const points = []; // 10x sign(), 2x verify(). To achieve this, - const windows = 256 / W + 1; // app needs to spend 40ms+ to calculate - let p = G, b = p; // a lot of points related to base point G. - for (let w = 0; w < windows; w++) { // Points are stored in array and used - b = p; // any time Gx multiplication is done. - points.push(b); // They consume 16-32 MiB of RAM. - for (let i = 1; i < 2 ** (W - 1); i++) { - b = b.add(p); - points.push(b); - } - p = b.double(); // Precomputes don't speed-up getSharedKey, - } // which multiplies user point by scalar, - return points; // when precomputes are using base point - }; - let Gpows = undefined; // precomputes for base point G - const wNAF = (n) => { - // Compared to other point mult methods, - const comp = Gpows || (Gpows = precompute()); // stores 2x less points using subtraction - const neg = (cnd, p) => { let n = p.negate(); return cnd ? n : p; }; // negate - let p = I, f = G; // f must be G, or could become I in the end - const windows = 1 + 256 / W; // W=8 17 windows - const wsize = 2 ** (W - 1); // W=8 128 window size - const mask = BigInt(2 ** W - 1); // W=8 will create mask 0b11111111 - const maxNum = 2 ** W; // W=8 256 - const shiftBy = BigInt(W); // W=8 8 - for (let w = 0; w < windows; w++) { - const off = w * wsize; - let wbits = Number(n & mask); // extract W bits. - n >>= shiftBy; // shift number by W bits. - if (wbits > wsize) { - wbits -= maxNum; - n += 1n; - } // split if bits > max: +224 => 256-32 - const off1 = off, off2 = off + Math.abs(wbits) - 1; // offsets, evaluate both - const cnd1 = w % 2 !== 0, cnd2 = wbits < 0; // conditions, evaluate both - if (wbits === 0) { - f = f.add(neg(cnd1, comp[off1])); // bits are 0: add garbage to fake point - } - else { // ^ can't add off2, off2 = I - p = p.add(neg(cnd2, comp[off2])); // bits are 1: add to result point - } - } - return { p, f }; // return both real and fake points for JIT - }; // !! you can disable precomputes by commenting-out call of the wNAF() inside Point#mul() - - return __toCommonJS(input_exports); -})(); -/*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) */ \ No newline at end of file diff --git a/export/noble-hashes.js b/export/noble-hashes.js deleted file mode 100644 index 7cab1209..00000000 --- a/export/noble-hashes.js +++ /dev/null @@ -1,2772 +0,0 @@ -"use strict"; -var nobleHashes = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // input.js - var input_exports = {}; - __export(input_exports, { - argon2id: () => argon2id, - blake2b: () => blake2b, - blake2s: () => blake2s, - blake3: () => blake3, - cshake128: () => cshake128, - cshake256: () => cshake256, - eskdf: () => eskdf, - hkdf: () => hkdf, - hmac: () => hmac, - k12: () => k12, - keccak_224: () => keccak_224, - keccak_256: () => keccak_256, - keccak_384: () => keccak_384, - keccak_512: () => keccak_512, - kmac128: () => kmac128, - kmac256: () => kmac256, - m14: () => m14, - pbkdf2: () => pbkdf2, - pbkdf2Async: () => pbkdf2Async, - ripemd160: () => ripemd160, - scrypt: () => scrypt, - scryptAsync: () => scryptAsync, - sha1: () => sha1, - sha256: () => sha256, - sha3_224: () => sha3_224, - sha3_256: () => sha3_256, - sha3_384: () => sha3_384, - sha3_512: () => sha3_512, - sha512: () => sha512, - turboshake128: () => turboshake128, - turboshake256: () => turboshake256, - utils: () => utils - }); - - // ../src/crypto.ts - var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0; - - // ../esm/_assert.js - function number(n) { - if (!Number.isSafeInteger(n) || n < 0) - throw new Error(`positive integer expected, not ${n}`); - } - function isBytes(a) { - return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array"; - } - function bytes(b, ...lengths) { - if (!isBytes(b)) - throw new Error("Uint8Array expected"); - if (lengths.length > 0 && !lengths.includes(b.length)) - throw new Error(`Uint8Array expected of length ${lengths}, not of length=${b.length}`); - } - function hash(h) { - if (typeof h !== "function" || typeof h.create !== "function") - throw new Error("Hash should be wrapped by utils.wrapConstructor"); - number(h.outputLen); - number(h.blockLen); - } - function exists(instance, checkFinished = true) { - if (instance.destroyed) - throw new Error("Hash instance has been destroyed"); - if (checkFinished && instance.finished) - throw new Error("Hash#digest() has already been called"); - } - function output(out, instance) { - bytes(out); - const min = instance.outputLen; - if (out.length < min) { - throw new Error(`digestInto() expects output buffer of length at least ${min}`); - } - } - - // ../esm/utils.js - var u8 = (arr) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength); - var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4)); - var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); - var rotr = (word, shift) => word << 32 - shift | word >>> shift; - var rotl = (word, shift) => word << shift | word >>> 32 - shift >>> 0; - var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; - var byteSwap = (word) => word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255; - var byteSwapIfBE = isLE ? (n) => n : (n) => byteSwap(n); - function byteSwap32(arr) { - for (let i = 0; i < arr.length; i++) { - arr[i] = byteSwap(arr[i]); - } - } - var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); - function bytesToHex(bytes2) { - bytes(bytes2); - let hex = ""; - for (let i = 0; i < bytes2.length; i++) { - hex += hexes[bytes2[i]]; - } - return hex; - } - var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 }; - function asciiToBase16(char) { - if (char >= asciis._0 && char <= asciis._9) - return char - asciis._0; - if (char >= asciis._A && char <= asciis._F) - return char - (asciis._A - 10); - if (char >= asciis._a && char <= asciis._f) - return char - (asciis._a - 10); - return; - } - function hexToBytes(hex) { - if (typeof hex !== "string") - throw new Error("hex string expected, got " + typeof hex); - const hl = hex.length; - const al = hl / 2; - if (hl % 2) - throw new Error("padded hex string expected, got unpadded hex of length " + hl); - const array = new Uint8Array(al); - for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) { - const n1 = asciiToBase16(hex.charCodeAt(hi)); - const n2 = asciiToBase16(hex.charCodeAt(hi + 1)); - if (n1 === void 0 || n2 === void 0) { - const char = hex[hi] + hex[hi + 1]; - throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi); - } - array[ai] = n1 * 16 + n2; - } - return array; - } - var nextTick = async () => { - }; - async function asyncLoop(iters, tick, cb) { - let ts = Date.now(); - for (let i = 0; i < iters; i++) { - cb(i); - const diff = Date.now() - ts; - if (diff >= 0 && diff < tick) - continue; - await nextTick(); - ts += diff; - } - } - function utf8ToBytes(str) { - if (typeof str !== "string") - throw new Error(`utf8ToBytes expected string, got ${typeof str}`); - return new Uint8Array(new TextEncoder().encode(str)); - } - function toBytes(data) { - if (typeof data === "string") - data = utf8ToBytes(data); - bytes(data); - return data; - } - function concatBytes(...arrays) { - let sum = 0; - for (let i = 0; i < arrays.length; i++) { - const a = arrays[i]; - bytes(a); - sum += a.length; - } - const res = new Uint8Array(sum); - for (let i = 0, pad = 0; i < arrays.length; i++) { - const a = arrays[i]; - res.set(a, pad); - pad += a.length; - } - return res; - } - var Hash = class { - // Safe version that clones internal state - clone() { - return this._cloneInto(); - } - }; - var toStr = {}.toString; - function checkOpts(defaults, opts) { - if (opts !== void 0 && toStr.call(opts) !== "[object Object]") - throw new Error("Options should be object or undefined"); - const merged = Object.assign(defaults, opts); - return merged; - } - function wrapConstructor(hashCons) { - const hashC = (msg) => hashCons().update(toBytes(msg)).digest(); - const tmp = hashCons(); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = () => hashCons(); - return hashC; - } - function wrapConstructorWithOpts(hashCons) { - const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); - const tmp = hashCons({}); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = (opts) => hashCons(opts); - return hashC; - } - function wrapXOFConstructorWithOpts(hashCons) { - const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest(); - const tmp = hashCons({}); - hashC.outputLen = tmp.outputLen; - hashC.blockLen = tmp.blockLen; - hashC.create = (opts) => hashCons(opts); - return hashC; - } - function randomBytes(bytesLength = 32) { - if (crypto && typeof crypto.getRandomValues === "function") { - return crypto.getRandomValues(new Uint8Array(bytesLength)); - } - throw new Error("crypto.getRandomValues must be defined"); - } - - // ../esm/_blake.js - var SIGMA = /* @__PURE__ */ new Uint8Array([ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 14, - 10, - 4, - 8, - 9, - 15, - 13, - 6, - 1, - 12, - 0, - 2, - 11, - 7, - 5, - 3, - 11, - 8, - 12, - 0, - 5, - 2, - 15, - 13, - 10, - 14, - 3, - 6, - 7, - 1, - 9, - 4, - 7, - 9, - 3, - 1, - 13, - 12, - 11, - 14, - 2, - 6, - 5, - 10, - 4, - 0, - 15, - 8, - 9, - 0, - 5, - 7, - 2, - 4, - 10, - 15, - 14, - 1, - 11, - 12, - 6, - 8, - 3, - 13, - 2, - 12, - 6, - 10, - 0, - 11, - 8, - 3, - 4, - 13, - 7, - 5, - 15, - 14, - 1, - 9, - 12, - 5, - 1, - 15, - 14, - 13, - 4, - 10, - 0, - 7, - 6, - 3, - 9, - 2, - 8, - 11, - 13, - 11, - 7, - 14, - 12, - 1, - 3, - 9, - 5, - 0, - 15, - 4, - 8, - 6, - 2, - 10, - 6, - 15, - 14, - 9, - 11, - 3, - 0, - 8, - 12, - 2, - 13, - 7, - 1, - 4, - 10, - 5, - 10, - 2, - 8, - 4, - 7, - 6, - 1, - 5, - 15, - 11, - 9, - 14, - 3, - 12, - 13, - 0, - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 14, - 10, - 4, - 8, - 9, - 15, - 13, - 6, - 1, - 12, - 0, - 2, - 11, - 7, - 5, - 3 - ]); - var BLAKE = class extends Hash { - constructor(blockLen, outputLen, opts = {}, keyLen, saltLen, persLen) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.length = 0; - this.pos = 0; - this.finished = false; - this.destroyed = false; - number(blockLen); - number(outputLen); - number(keyLen); - if (outputLen < 0 || outputLen > keyLen) - throw new Error("outputLen bigger than keyLen"); - if (opts.key !== void 0 && (opts.key.length < 1 || opts.key.length > keyLen)) - throw new Error(`key must be up 1..${keyLen} byte long or undefined`); - if (opts.salt !== void 0 && opts.salt.length !== saltLen) - throw new Error(`salt must be ${saltLen} byte long or undefined`); - if (opts.personalization !== void 0 && opts.personalization.length !== persLen) - throw new Error(`personalization must be ${persLen} byte long or undefined`); - this.buffer32 = u32(this.buffer = new Uint8Array(blockLen)); - } - update(data) { - exists(this); - const { blockLen, buffer, buffer32 } = this; - data = toBytes(data); - const len = data.length; - const offset = data.byteOffset; - const buf = data.buffer; - for (let pos = 0; pos < len; ) { - if (this.pos === blockLen) { - if (!isLE) - byteSwap32(buffer32); - this.compress(buffer32, 0, false); - if (!isLE) - byteSwap32(buffer32); - this.pos = 0; - } - const take = Math.min(blockLen - this.pos, len - pos); - const dataOffset = offset + pos; - if (take === blockLen && !(dataOffset % 4) && pos + take < len) { - const data32 = new Uint32Array(buf, dataOffset, Math.floor((len - pos) / 4)); - if (!isLE) - byteSwap32(data32); - for (let pos32 = 0; pos + blockLen < len; pos32 += buffer32.length, pos += blockLen) { - this.length += blockLen; - this.compress(data32, pos32, false); - } - if (!isLE) - byteSwap32(data32); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - this.length += take; - pos += take; - } - return this; - } - digestInto(out) { - exists(this); - output(out, this); - const { pos, buffer32 } = this; - this.finished = true; - this.buffer.subarray(pos).fill(0); - if (!isLE) - byteSwap32(buffer32); - this.compress(buffer32, 0, true); - if (!isLE) - byteSwap32(buffer32); - const out32 = u32(out); - this.get().forEach((v, i) => out32[i] = byteSwapIfBE(v)); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - const { buffer, length, finished, destroyed, outputLen, pos } = this; - to || (to = new this.constructor({ dkLen: outputLen })); - to.set(...this.get()); - to.length = length; - to.finished = finished; - to.destroyed = destroyed; - to.outputLen = outputLen; - to.buffer.set(buffer); - to.pos = pos; - return to; - } - }; - - // ../esm/_u64.js - var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1); - var _32n = /* @__PURE__ */ BigInt(32); - function fromBig(n, le = false) { - if (le) - return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) }; - return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 }; - } - function split(lst, le = false) { - let Ah = new Uint32Array(lst.length); - let Al = new Uint32Array(lst.length); - for (let i = 0; i < lst.length; i++) { - const { h, l } = fromBig(lst[i], le); - [Ah[i], Al[i]] = [h, l]; - } - return [Ah, Al]; - } - var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0); - var shrSH = (h, _l, s) => h >>> s; - var shrSL = (h, l, s) => h << 32 - s | l >>> s; - var rotrSH = (h, l, s) => h >>> s | l << 32 - s; - var rotrSL = (h, l, s) => h << 32 - s | l >>> s; - var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32; - var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s; - var rotr32H = (_h, l) => l; - var rotr32L = (h, _l) => h; - var rotlSH = (h, l, s) => h << s | l >>> 32 - s; - var rotlSL = (h, l, s) => l << s | h >>> 32 - s; - var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s; - var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s; - function add(Ah, Al, Bh, Bl) { - const l = (Al >>> 0) + (Bl >>> 0); - return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 }; - } - var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0); - var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0; - var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0); - var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0; - var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0); - var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0; - var u64 = { - fromBig, - split, - toBig, - shrSH, - shrSL, - rotrSH, - rotrSL, - rotrBH, - rotrBL, - rotr32H, - rotr32L, - rotlSH, - rotlSL, - rotlBH, - rotlBL, - add, - add3L, - add3H, - add4L, - add4H, - add5H, - add5L - }; - var u64_default = u64; - - // ../esm/blake2b.js - var B2B_IV = /* @__PURE__ */ new Uint32Array([ - 4089235720, - 1779033703, - 2227873595, - 3144134277, - 4271175723, - 1013904242, - 1595750129, - 2773480762, - 2917565137, - 1359893119, - 725511199, - 2600822924, - 4215389547, - 528734635, - 327033209, - 1541459225 - ]); - var BBUF = /* @__PURE__ */ new Uint32Array(32); - function G1b(a, b, c, d, msg, x) { - const Xl = msg[x], Xh = msg[x + 1]; - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; - let ll = u64_default.add3L(Al, Bl, Xl); - Ah = u64_default.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64_default.rotr32H(Dh, Dl), Dl: u64_default.rotr32L(Dh, Dl) }); - ({ h: Ch, l: Cl } = u64_default.add(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64_default.rotrSH(Bh, Bl, 24), Bl: u64_default.rotrSL(Bh, Bl, 24) }); - BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah; - BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh; - BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch; - BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh; - } - function G2b(a, b, c, d, msg, x) { - const Xl = msg[x], Xh = msg[x + 1]; - let Al = BBUF[2 * a], Ah = BBUF[2 * a + 1]; - let Bl = BBUF[2 * b], Bh = BBUF[2 * b + 1]; - let Cl = BBUF[2 * c], Ch = BBUF[2 * c + 1]; - let Dl = BBUF[2 * d], Dh = BBUF[2 * d + 1]; - let ll = u64_default.add3L(Al, Bl, Xl); - Ah = u64_default.add3H(ll, Ah, Bh, Xh); - Al = ll | 0; - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: u64_default.rotrSH(Dh, Dl, 16), Dl: u64_default.rotrSL(Dh, Dl, 16) }); - ({ h: Ch, l: Cl } = u64_default.add(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: u64_default.rotrBH(Bh, Bl, 63), Bl: u64_default.rotrBL(Bh, Bl, 63) }); - BBUF[2 * a] = Al, BBUF[2 * a + 1] = Ah; - BBUF[2 * b] = Bl, BBUF[2 * b + 1] = Bh; - BBUF[2 * c] = Cl, BBUF[2 * c + 1] = Ch; - BBUF[2 * d] = Dl, BBUF[2 * d + 1] = Dh; - } - var BLAKE2b = class extends BLAKE { - constructor(opts = {}) { - super(128, opts.dkLen === void 0 ? 64 : opts.dkLen, opts, 64, 16, 16); - this.v0l = B2B_IV[0] | 0; - this.v0h = B2B_IV[1] | 0; - this.v1l = B2B_IV[2] | 0; - this.v1h = B2B_IV[3] | 0; - this.v2l = B2B_IV[4] | 0; - this.v2h = B2B_IV[5] | 0; - this.v3l = B2B_IV[6] | 0; - this.v3h = B2B_IV[7] | 0; - this.v4l = B2B_IV[8] | 0; - this.v4h = B2B_IV[9] | 0; - this.v5l = B2B_IV[10] | 0; - this.v5h = B2B_IV[11] | 0; - this.v6l = B2B_IV[12] | 0; - this.v6h = B2B_IV[13] | 0; - this.v7l = B2B_IV[14] | 0; - this.v7h = B2B_IV[15] | 0; - const keyLength = opts.key ? opts.key.length : 0; - this.v0l ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24; - if (opts.salt) { - const salt = u32(toBytes(opts.salt)); - this.v4l ^= byteSwapIfBE(salt[0]); - this.v4h ^= byteSwapIfBE(salt[1]); - this.v5l ^= byteSwapIfBE(salt[2]); - this.v5h ^= byteSwapIfBE(salt[3]); - } - if (opts.personalization) { - const pers = u32(toBytes(opts.personalization)); - this.v6l ^= byteSwapIfBE(pers[0]); - this.v6h ^= byteSwapIfBE(pers[1]); - this.v7l ^= byteSwapIfBE(pers[2]); - this.v7h ^= byteSwapIfBE(pers[3]); - } - if (opts.key) { - const tmp = new Uint8Array(this.blockLen); - tmp.set(toBytes(opts.key)); - this.update(tmp); - } - } - // prettier-ignore - get() { - let { v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h } = this; - return [v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h]; - } - // prettier-ignore - set(v0l, v0h, v1l, v1h, v2l, v2h, v3l, v3h, v4l, v4h, v5l, v5h, v6l, v6h, v7l, v7h) { - this.v0l = v0l | 0; - this.v0h = v0h | 0; - this.v1l = v1l | 0; - this.v1h = v1h | 0; - this.v2l = v2l | 0; - this.v2h = v2h | 0; - this.v3l = v3l | 0; - this.v3h = v3h | 0; - this.v4l = v4l | 0; - this.v4h = v4h | 0; - this.v5l = v5l | 0; - this.v5h = v5h | 0; - this.v6l = v6l | 0; - this.v6h = v6h | 0; - this.v7l = v7l | 0; - this.v7h = v7h | 0; - } - compress(msg, offset, isLast) { - this.get().forEach((v, i) => BBUF[i] = v); - BBUF.set(B2B_IV, 16); - let { h, l } = u64_default.fromBig(BigInt(this.length)); - BBUF[24] = B2B_IV[8] ^ l; - BBUF[25] = B2B_IV[9] ^ h; - if (isLast) { - BBUF[28] = ~BBUF[28]; - BBUF[29] = ~BBUF[29]; - } - let j = 0; - const s = SIGMA; - for (let i = 0; i < 12; i++) { - G1b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G2b(0, 4, 8, 12, msg, offset + 2 * s[j++]); - G1b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G2b(1, 5, 9, 13, msg, offset + 2 * s[j++]); - G1b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G2b(2, 6, 10, 14, msg, offset + 2 * s[j++]); - G1b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - G2b(3, 7, 11, 15, msg, offset + 2 * s[j++]); - G1b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G2b(0, 5, 10, 15, msg, offset + 2 * s[j++]); - G1b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G2b(1, 6, 11, 12, msg, offset + 2 * s[j++]); - G1b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G2b(2, 7, 8, 13, msg, offset + 2 * s[j++]); - G1b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - G2b(3, 4, 9, 14, msg, offset + 2 * s[j++]); - } - this.v0l ^= BBUF[0] ^ BBUF[16]; - this.v0h ^= BBUF[1] ^ BBUF[17]; - this.v1l ^= BBUF[2] ^ BBUF[18]; - this.v1h ^= BBUF[3] ^ BBUF[19]; - this.v2l ^= BBUF[4] ^ BBUF[20]; - this.v2h ^= BBUF[5] ^ BBUF[21]; - this.v3l ^= BBUF[6] ^ BBUF[22]; - this.v3h ^= BBUF[7] ^ BBUF[23]; - this.v4l ^= BBUF[8] ^ BBUF[24]; - this.v4h ^= BBUF[9] ^ BBUF[25]; - this.v5l ^= BBUF[10] ^ BBUF[26]; - this.v5h ^= BBUF[11] ^ BBUF[27]; - this.v6l ^= BBUF[12] ^ BBUF[28]; - this.v6h ^= BBUF[13] ^ BBUF[29]; - this.v7l ^= BBUF[14] ^ BBUF[30]; - this.v7h ^= BBUF[15] ^ BBUF[31]; - BBUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer32.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - } - }; - var blake2b = /* @__PURE__ */ wrapConstructorWithOpts((opts) => new BLAKE2b(opts)); - - // ../esm/blake2s.js - var B2S_IV = /* @__PURE__ */ new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ]); - function G1s(a, b, c, d, x) { - a = a + b + x | 0; - d = rotr(d ^ a, 16); - c = c + d | 0; - b = rotr(b ^ c, 12); - return { a, b, c, d }; - } - function G2s(a, b, c, d, x) { - a = a + b + x | 0; - d = rotr(d ^ a, 8); - c = c + d | 0; - b = rotr(b ^ c, 7); - return { a, b, c, d }; - } - function compress(s, offset, msg, rounds, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) { - let j = 0; - for (let i = 0; i < rounds; i++) { - ({ a: v0, b: v4, c: v8, d: v12 } = G1s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v0, b: v4, c: v8, d: v12 } = G2s(v0, v4, v8, v12, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G1s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v1, b: v5, c: v9, d: v13 } = G2s(v1, v5, v9, v13, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G1s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v2, b: v6, c: v10, d: v14 } = G2s(v2, v6, v10, v14, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G1s(v3, v7, v11, v15, msg[offset + s[j++]])); - ({ a: v3, b: v7, c: v11, d: v15 } = G2s(v3, v7, v11, v15, msg[offset + s[j++]])); - ({ a: v0, b: v5, c: v10, d: v15 } = G1s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v0, b: v5, c: v10, d: v15 } = G2s(v0, v5, v10, v15, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G1s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v1, b: v6, c: v11, d: v12 } = G2s(v1, v6, v11, v12, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G1s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v2, b: v7, c: v8, d: v13 } = G2s(v2, v7, v8, v13, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G1s(v3, v4, v9, v14, msg[offset + s[j++]])); - ({ a: v3, b: v4, c: v9, d: v14 } = G2s(v3, v4, v9, v14, msg[offset + s[j++]])); - } - return { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 }; - } - var BLAKE2s = class extends BLAKE { - constructor(opts = {}) { - super(64, opts.dkLen === void 0 ? 32 : opts.dkLen, opts, 32, 8, 8); - this.v0 = B2S_IV[0] | 0; - this.v1 = B2S_IV[1] | 0; - this.v2 = B2S_IV[2] | 0; - this.v3 = B2S_IV[3] | 0; - this.v4 = B2S_IV[4] | 0; - this.v5 = B2S_IV[5] | 0; - this.v6 = B2S_IV[6] | 0; - this.v7 = B2S_IV[7] | 0; - const keyLength = opts.key ? opts.key.length : 0; - this.v0 ^= this.outputLen | keyLength << 8 | 1 << 16 | 1 << 24; - if (opts.salt) { - const salt = u32(toBytes(opts.salt)); - this.v4 ^= byteSwapIfBE(salt[0]); - this.v5 ^= byteSwapIfBE(salt[1]); - } - if (opts.personalization) { - const pers = u32(toBytes(opts.personalization)); - this.v6 ^= byteSwapIfBE(pers[0]); - this.v7 ^= byteSwapIfBE(pers[1]); - } - if (opts.key) { - const tmp = new Uint8Array(this.blockLen); - tmp.set(toBytes(opts.key)); - this.update(tmp); - } - } - get() { - const { v0, v1, v2, v3, v4, v5, v6, v7 } = this; - return [v0, v1, v2, v3, v4, v5, v6, v7]; - } - // prettier-ignore - set(v0, v1, v2, v3, v4, v5, v6, v7) { - this.v0 = v0 | 0; - this.v1 = v1 | 0; - this.v2 = v2 | 0; - this.v3 = v3 | 0; - this.v4 = v4 | 0; - this.v5 = v5 | 0; - this.v6 = v6 | 0; - this.v7 = v7 | 0; - } - compress(msg, offset, isLast) { - const { h, l } = fromBig(BigInt(this.length)); - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA, offset, msg, 10, this.v0, this.v1, this.v2, this.v3, this.v4, this.v5, this.v6, this.v7, B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l ^ B2S_IV[4], h ^ B2S_IV[5], isLast ? ~B2S_IV[6] : B2S_IV[6], B2S_IV[7]); - this.v0 ^= v0 ^ v8; - this.v1 ^= v1 ^ v9; - this.v2 ^= v2 ^ v10; - this.v3 ^= v3 ^ v11; - this.v4 ^= v4 ^ v12; - this.v5 ^= v5 ^ v13; - this.v6 ^= v6 ^ v14; - this.v7 ^= v7 ^ v15; - } - destroy() { - this.destroyed = true; - this.buffer32.fill(0); - this.set(0, 0, 0, 0, 0, 0, 0, 0); - } - }; - var blake2s = /* @__PURE__ */ wrapConstructorWithOpts((opts) => new BLAKE2s(opts)); - - // ../esm/blake3.js - var SIGMA2 = /* @__PURE__ */ (() => { - const Id2 = Array.from({ length: 16 }, (_, i) => i); - const permute = (arr) => [2, 6, 3, 10, 7, 0, 4, 13, 1, 11, 12, 5, 9, 14, 15, 8].map((i) => arr[i]); - const res = []; - for (let i = 0, v = Id2; i < 7; i++, v = permute(v)) - res.push(...v); - return Uint8Array.from(res); - })(); - var BLAKE3 = class _BLAKE3 extends BLAKE { - constructor(opts = {}, flags = 0) { - super(64, opts.dkLen === void 0 ? 32 : opts.dkLen, {}, Number.MAX_SAFE_INTEGER, 0, 0); - this.flags = 0 | 0; - this.chunkPos = 0; - this.chunksDone = 0; - this.stack = []; - this.posOut = 0; - this.bufferOut32 = new Uint32Array(16); - this.chunkOut = 0; - this.enableXOF = true; - this.outputLen = opts.dkLen === void 0 ? 32 : opts.dkLen; - number(this.outputLen); - if (opts.key !== void 0 && opts.context !== void 0) - throw new Error("Blake3: only key or context can be specified at same time"); - else if (opts.key !== void 0) { - const key = toBytes(opts.key).slice(); - if (key.length !== 32) - throw new Error("Blake3: key should be 32 byte"); - this.IV = u32(key); - if (!isLE) - byteSwap32(this.IV); - this.flags = flags | 16; - } else if (opts.context !== void 0) { - const context_key = new _BLAKE3( - { dkLen: 32 }, - 32 - /* B3_Flags.DERIVE_KEY_CONTEXT */ - ).update(opts.context).digest(); - this.IV = u32(context_key); - if (!isLE) - byteSwap32(this.IV); - this.flags = flags | 64; - } else { - this.IV = B2S_IV.slice(); - this.flags = flags; - } - this.state = this.IV.slice(); - this.bufferOut = u8(this.bufferOut32); - } - // Unused - get() { - return []; - } - set() { - } - b2Compress(counter, flags, buf, bufPos = 0) { - const { state: s, pos } = this; - const { h, l } = fromBig(BigInt(counter), true); - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA2, bufPos, buf, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], h, l, pos, flags); - s[0] = v0 ^ v8; - s[1] = v1 ^ v9; - s[2] = v2 ^ v10; - s[3] = v3 ^ v11; - s[4] = v4 ^ v12; - s[5] = v5 ^ v13; - s[6] = v6 ^ v14; - s[7] = v7 ^ v15; - } - compress(buf, bufPos = 0, isLast = false) { - let flags = this.flags; - if (!this.chunkPos) - flags |= 1; - if (this.chunkPos === 15 || isLast) - flags |= 2; - if (!isLast) - this.pos = this.blockLen; - this.b2Compress(this.chunksDone, flags, buf, bufPos); - this.chunkPos += 1; - if (this.chunkPos === 16 || isLast) { - let chunk = this.state; - this.state = this.IV.slice(); - for (let last, chunks = this.chunksDone + 1; isLast || !(chunks & 1); chunks >>= 1) { - if (!(last = this.stack.pop())) - break; - this.buffer32.set(last, 0); - this.buffer32.set(chunk, 8); - this.pos = this.blockLen; - this.b2Compress(0, this.flags | 4, this.buffer32, 0); - chunk = this.state; - this.state = this.IV.slice(); - } - this.chunksDone++; - this.chunkPos = 0; - this.stack.push(chunk); - } - this.pos = 0; - } - _cloneInto(to) { - to = super._cloneInto(to); - const { IV, flags, state, chunkPos, posOut, chunkOut, stack, chunksDone } = this; - to.state.set(state.slice()); - to.stack = stack.map((i) => Uint32Array.from(i)); - to.IV.set(IV); - to.flags = flags; - to.chunkPos = chunkPos; - to.chunksDone = chunksDone; - to.posOut = posOut; - to.chunkOut = chunkOut; - to.enableXOF = this.enableXOF; - to.bufferOut32.set(this.bufferOut32); - return to; - } - destroy() { - this.destroyed = true; - this.state.fill(0); - this.buffer32.fill(0); - this.IV.fill(0); - this.bufferOut32.fill(0); - for (let i of this.stack) - i.fill(0); - } - // Same as b2Compress, but doesn't modify state and returns 16 u32 array (instead of 8) - b2CompressOut() { - const { state: s, pos, flags, buffer32, bufferOut32: out32 } = this; - const { h, l } = fromBig(BigInt(this.chunkOut++)); - if (!isLE) - byteSwap32(buffer32); - const { v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15 } = compress(SIGMA2, 0, buffer32, 7, s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], B2S_IV[0], B2S_IV[1], B2S_IV[2], B2S_IV[3], l, h, pos, flags); - out32[0] = v0 ^ v8; - out32[1] = v1 ^ v9; - out32[2] = v2 ^ v10; - out32[3] = v3 ^ v11; - out32[4] = v4 ^ v12; - out32[5] = v5 ^ v13; - out32[6] = v6 ^ v14; - out32[7] = v7 ^ v15; - out32[8] = s[0] ^ v8; - out32[9] = s[1] ^ v9; - out32[10] = s[2] ^ v10; - out32[11] = s[3] ^ v11; - out32[12] = s[4] ^ v12; - out32[13] = s[5] ^ v13; - out32[14] = s[6] ^ v14; - out32[15] = s[7] ^ v15; - if (!isLE) { - byteSwap32(buffer32); - byteSwap32(out32); - } - this.posOut = 0; - } - finish() { - if (this.finished) - return; - this.finished = true; - this.buffer.fill(0, this.pos); - let flags = this.flags | 8; - if (this.stack.length) { - flags |= 4; - if (!isLE) - byteSwap32(this.buffer32); - this.compress(this.buffer32, 0, true); - if (!isLE) - byteSwap32(this.buffer32); - this.chunksDone = 0; - this.pos = this.blockLen; - } else { - flags |= (!this.chunkPos ? 1 : 0) | 2; - } - this.flags = flags; - this.b2CompressOut(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const { blockLen, bufferOut } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) - this.b2CompressOut(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - if (!this.enableXOF) - throw new Error("XOF is not possible after digest call"); - return this.writeInto(out); - } - xof(bytes2) { - number(bytes2); - return this.xofInto(new Uint8Array(bytes2)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error("digest() was already called"); - this.enableXOF = false; - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - }; - var blake3 = /* @__PURE__ */ wrapXOFConstructorWithOpts((opts) => new BLAKE3(opts)); - - // ../esm/hmac.js - var HMAC = class extends Hash { - constructor(hash2, _key) { - super(); - this.finished = false; - this.destroyed = false; - hash(hash2); - const key = toBytes(_key); - this.iHash = hash2.create(); - if (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 blockLen = this.blockLen; - const pad = new Uint8Array(blockLen); - pad.set(key.length > blockLen ? hash2.create().update(key).digest() : key); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54; - this.iHash.update(pad); - this.oHash = hash2.create(); - for (let i = 0; i < pad.length; i++) - pad[i] ^= 54 ^ 92; - this.oHash.update(pad); - pad.fill(0); - } - update(buf) { - exists(this); - this.iHash.update(buf); - return this; - } - digestInto(out) { - exists(this); - bytes(out, this.outputLen); - this.finished = true; - this.iHash.digestInto(out); - this.oHash.update(out); - this.oHash.digestInto(out); - this.destroy(); - } - digest() { - const out = new Uint8Array(this.oHash.outputLen); - this.digestInto(out); - return out; - } - _cloneInto(to) { - to || (to = Object.create(Object.getPrototypeOf(this), {})); - const { oHash, iHash, finished, destroyed, blockLen, outputLen } = this; - to.finished = finished; - to.destroyed = destroyed; - to.blockLen = blockLen; - to.outputLen = outputLen; - to.oHash = oHash._cloneInto(to.oHash); - to.iHash = iHash._cloneInto(to.iHash); - return to; - } - destroy() { - this.destroyed = true; - this.oHash.destroy(); - this.iHash.destroy(); - } - }; - var hmac = (hash2, key, message) => new HMAC(hash2, key).update(message).digest(); - hmac.create = (hash2, key) => new HMAC(hash2, key); - - // ../esm/hkdf.js - function extract(hash2, ikm, salt) { - hash(hash2); - if (salt === void 0) - salt = new Uint8Array(hash2.outputLen); - return hmac(hash2, toBytes(salt), toBytes(ikm)); - } - var HKDF_COUNTER = /* @__PURE__ */ new Uint8Array([0]); - var EMPTY_BUFFER = /* @__PURE__ */ new Uint8Array(); - function expand(hash2, prk, info, length = 32) { - hash(hash2); - number(length); - if (length > 255 * hash2.outputLen) - throw new Error("Length should be <= 255*HashLen"); - const blocks = Math.ceil(length / hash2.outputLen); - if (info === void 0) - info = EMPTY_BUFFER; - const okm = new Uint8Array(blocks * hash2.outputLen); - const HMAC2 = hmac.create(hash2, prk); - const HMACTmp = HMAC2._cloneInto(); - const T = new Uint8Array(HMAC2.outputLen); - for (let counter = 0; counter < blocks; counter++) { - HKDF_COUNTER[0] = counter + 1; - HMACTmp.update(counter === 0 ? EMPTY_BUFFER : T).update(info).update(HKDF_COUNTER).digestInto(T); - okm.set(T, hash2.outputLen * counter); - HMAC2._cloneInto(HMACTmp); - } - HMAC2.destroy(); - HMACTmp.destroy(); - T.fill(0); - HKDF_COUNTER.fill(0); - return okm.slice(0, length); - } - var hkdf = (hash2, ikm, salt, info, length) => expand(hash2, extract(hash2, ikm, salt), info, length); - - // ../esm/pbkdf2.js - function pbkdf2Init(hash2, _password, _salt, _opts) { - hash(hash2); - const opts = checkOpts({ dkLen: 32, asyncTick: 10 }, _opts); - const { c, dkLen, asyncTick } = opts; - number(c); - number(dkLen); - number(asyncTick); - if (c < 1) - throw new Error("PBKDF2: iterations (c) should be >= 1"); - const password = toBytes(_password); - const salt = toBytes(_salt); - const DK = new Uint8Array(dkLen); - const PRF = hmac.create(hash2, password); - const PRFSalt = PRF._cloneInto().update(salt); - return { c, dkLen, asyncTick, DK, PRF, PRFSalt }; - } - function pbkdf2Output(PRF, PRFSalt, DK, prfW, u) { - PRF.destroy(); - PRFSalt.destroy(); - if (prfW) - prfW.destroy(); - u.fill(0); - return DK; - } - function pbkdf2(hash2, password, salt, opts) { - const { c, dkLen, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - for (let ui = 1; ui < c; ui++) { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - } - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); - } - async function pbkdf2Async(hash2, password, salt, opts) { - const { c, dkLen, asyncTick, DK, PRF, PRFSalt } = pbkdf2Init(hash2, password, salt, opts); - let prfW; - const arr = new Uint8Array(4); - const view = createView(arr); - const u = new Uint8Array(PRF.outputLen); - for (let ti = 1, pos = 0; pos < dkLen; ti++, pos += PRF.outputLen) { - const Ti = DK.subarray(pos, pos + PRF.outputLen); - view.setInt32(0, ti, false); - (prfW = PRFSalt._cloneInto(prfW)).update(arr).digestInto(u); - Ti.set(u.subarray(0, Ti.length)); - await asyncLoop(c - 1, asyncTick, () => { - PRF._cloneInto(prfW).update(u).digestInto(u); - for (let i = 0; i < Ti.length; i++) - Ti[i] ^= u[i]; - }); - } - return pbkdf2Output(PRF, PRFSalt, DK, prfW, u); - } - - // ../esm/_md.js - function setBigUint64(view, byteOffset, value, isLE2) { - if (typeof view.setBigUint64 === "function") - return view.setBigUint64(byteOffset, value, isLE2); - const _32n2 = BigInt(32); - const _u32_max = BigInt(4294967295); - const wh = Number(value >> _32n2 & _u32_max); - const wl = Number(value & _u32_max); - const h = isLE2 ? 4 : 0; - const l = isLE2 ? 0 : 4; - view.setUint32(byteOffset + h, wh, isLE2); - view.setUint32(byteOffset + l, wl, isLE2); - } - var Chi = (a, b, c) => a & b ^ ~a & c; - var Maj = (a, b, c) => a & b ^ a & c ^ b & c; - var HashMD = class extends Hash { - constructor(blockLen, outputLen, padOffset, isLE2) { - super(); - this.blockLen = blockLen; - this.outputLen = outputLen; - this.padOffset = padOffset; - this.isLE = isLE2; - this.finished = false; - this.length = 0; - this.pos = 0; - this.destroyed = false; - this.buffer = new Uint8Array(blockLen); - this.view = createView(this.buffer); - } - update(data) { - exists(this); - const { view, buffer, blockLen } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - if (take === blockLen) { - const dataView = createView(data); - for (; blockLen <= len - pos; pos += blockLen) - this.process(dataView, pos); - continue; - } - buffer.set(data.subarray(pos, pos + take), this.pos); - this.pos += take; - pos += take; - if (this.pos === blockLen) { - this.process(view, 0); - this.pos = 0; - } - } - this.length += data.length; - this.roundClean(); - return this; - } - digestInto(out) { - exists(this); - output(out, this); - this.finished = true; - const { buffer, view, blockLen, isLE: isLE2 } = this; - let { pos } = this; - buffer[pos++] = 128; - this.buffer.subarray(pos).fill(0); - if (this.padOffset > blockLen - pos) { - this.process(view, 0); - pos = 0; - } - for (let i = pos; i < blockLen; i++) - buffer[i] = 0; - setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); - this.process(view, 0); - const oview = createView(out); - const len = this.outputLen; - if (len % 4) - throw new Error("_sha2: outputLen should be aligned to 32bit"); - const outLen = len / 4; - const state = this.get(); - if (outLen > state.length) - throw new Error("_sha2: outputLen bigger than state"); - for (let i = 0; i < outLen; i++) - oview.setUint32(4 * i, state[i], isLE2); - } - digest() { - const { buffer, outputLen } = this; - this.digestInto(buffer); - const res = buffer.slice(0, outputLen); - this.destroy(); - return res; - } - _cloneInto(to) { - to || (to = new this.constructor()); - to.set(...this.get()); - const { blockLen, buffer, length, finished, destroyed, pos } = this; - to.length = length; - to.pos = pos; - to.finished = finished; - to.destroyed = destroyed; - if (length % blockLen) - to.buffer.set(buffer); - return to; - } - }; - - // ../esm/ripemd160.js - var Rho = /* @__PURE__ */ new Uint8Array([7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8]); - var Id = /* @__PURE__ */ new Uint8Array(new Array(16).fill(0).map((_, i) => i)); - var Pi = /* @__PURE__ */ Id.map((i) => (9 * i + 5) % 16); - var idxL = [Id]; - var idxR = [Pi]; - for (let i = 0; i < 4; i++) - for (let j of [idxL, idxR]) - j.push(j[i].map((k) => Rho[k])); - var shifts = /* @__PURE__ */ [ - [11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8], - [12, 13, 11, 15, 6, 9, 9, 7, 12, 15, 11, 13, 7, 8, 7, 7], - [13, 15, 14, 11, 7, 7, 6, 8, 13, 14, 13, 12, 5, 5, 6, 9], - [14, 11, 12, 14, 8, 6, 5, 5, 15, 12, 15, 14, 9, 9, 8, 6], - [15, 12, 13, 13, 9, 5, 8, 6, 14, 11, 12, 11, 8, 6, 5, 5] - ].map((i) => new Uint8Array(i)); - var shiftsL = /* @__PURE__ */ idxL.map((idx, i) => idx.map((j) => shifts[i][j])); - var shiftsR = /* @__PURE__ */ idxR.map((idx, i) => idx.map((j) => shifts[i][j])); - var Kl = /* @__PURE__ */ new Uint32Array([ - 0, - 1518500249, - 1859775393, - 2400959708, - 2840853838 - ]); - var Kr = /* @__PURE__ */ new Uint32Array([ - 1352829926, - 1548603684, - 1836072691, - 2053994217, - 0 - ]); - function f(group, x, y, z) { - if (group === 0) - return x ^ y ^ z; - else if (group === 1) - return x & y | ~x & z; - else if (group === 2) - return (x | ~y) ^ z; - else if (group === 3) - return x & z | y & ~z; - else - return x ^ (y | ~z); - } - var R_BUF = /* @__PURE__ */ new Uint32Array(16); - var RIPEMD160 = class extends HashMD { - constructor() { - super(64, 20, 8, true); - this.h0 = 1732584193 | 0; - this.h1 = 4023233417 | 0; - this.h2 = 2562383102 | 0; - this.h3 = 271733878 | 0; - this.h4 = 3285377520 | 0; - } - get() { - const { h0, h1, h2, h3, h4 } = this; - return [h0, h1, h2, h3, h4]; - } - set(h0, h1, h2, h3, h4) { - this.h0 = h0 | 0; - this.h1 = h1 | 0; - this.h2 = h2 | 0; - this.h3 = h3 | 0; - this.h4 = h4 | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - R_BUF[i] = view.getUint32(offset, true); - let al = this.h0 | 0, ar = al, bl = this.h1 | 0, br = bl, cl = this.h2 | 0, cr = cl, dl = this.h3 | 0, dr = dl, el = this.h4 | 0, er = el; - for (let group = 0; group < 5; group++) { - const rGroup = 4 - group; - const hbl = Kl[group], hbr = Kr[group]; - const rl = idxL[group], rr = idxR[group]; - const sl = shiftsL[group], sr = shiftsR[group]; - for (let i = 0; i < 16; i++) { - const tl = rotl(al + f(group, bl, cl, dl) + R_BUF[rl[i]] + hbl, sl[i]) + el | 0; - al = el, el = dl, dl = rotl(cl, 10) | 0, cl = bl, bl = tl; - } - for (let i = 0; i < 16; i++) { - const tr = rotl(ar + f(rGroup, br, cr, dr) + R_BUF[rr[i]] + hbr, sr[i]) + er | 0; - ar = er, er = dr, dr = rotl(cr, 10) | 0, cr = br, br = tr; - } - } - this.set(this.h1 + cl + dr | 0, this.h2 + dl + er | 0, this.h3 + el + ar | 0, this.h4 + al + br | 0, this.h0 + bl + cr | 0); - } - roundClean() { - R_BUF.fill(0); - } - destroy() { - this.destroyed = true; - this.buffer.fill(0); - this.set(0, 0, 0, 0, 0); - } - }; - var ripemd160 = /* @__PURE__ */ wrapConstructor(() => new RIPEMD160()); - - // ../esm/sha256.js - var SHA256_K = /* @__PURE__ */ 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 - ]); - var SHA256_IV = /* @__PURE__ */ new Uint32Array([ - 1779033703, - 3144134277, - 1013904242, - 2773480762, - 1359893119, - 2600822924, - 528734635, - 1541459225 - ]); - var SHA256_W = /* @__PURE__ */ new Uint32Array(64); - var SHA256 = class extends HashMD { - constructor() { - super(64, 32, 8, false); - this.A = SHA256_IV[0] | 0; - this.B = SHA256_IV[1] | 0; - this.C = SHA256_IV[2] | 0; - this.D = SHA256_IV[3] | 0; - this.E = SHA256_IV[4] | 0; - this.F = SHA256_IV[5] | 0; - this.G = SHA256_IV[6] | 0; - this.H = SHA256_IV[7] | 0; - } - get() { - const { A, B, C, D, E, F, G: G2, H } = this; - return [A, B, C, D, E, F, G2, H]; - } - // prettier-ignore - set(A, B, C, D, E, F, G2, H) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - this.F = F | 0; - this.G = G2 | 0; - this.H = H | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA256_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 64; i++) { - const W15 = SHA256_W[i - 15]; - const W2 = SHA256_W[i - 2]; - const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; - const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; - SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; - } - let { A, B, C, D, E, F, G: G2, H } = this; - for (let i = 0; i < 64; i++) { - const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25); - const T1 = H + sigma1 + Chi(E, F, G2) + SHA256_K[i] + SHA256_W[i] | 0; - const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22); - const T2 = sigma0 + Maj(A, B, C) | 0; - H = G2; - G2 = F; - F = E; - E = D + T1 | 0; - D = C; - C = B; - B = A; - A = T1 + T2 | 0; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - F = F + this.F | 0; - G2 = G2 + this.G | 0; - H = H + this.H | 0; - this.set(A, B, C, D, E, F, G2, H); - } - roundClean() { - SHA256_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - var sha256 = /* @__PURE__ */ wrapConstructor(() => new SHA256()); - - // ../esm/scrypt.js - function XorAndSalsa(prev, pi, input, ii, out, oi) { - let y00 = prev[pi++] ^ input[ii++], y01 = prev[pi++] ^ input[ii++]; - let y02 = prev[pi++] ^ input[ii++], y03 = prev[pi++] ^ input[ii++]; - let y04 = prev[pi++] ^ input[ii++], y05 = prev[pi++] ^ input[ii++]; - let y06 = prev[pi++] ^ input[ii++], y07 = prev[pi++] ^ input[ii++]; - let y08 = prev[pi++] ^ input[ii++], y09 = prev[pi++] ^ input[ii++]; - let y10 = prev[pi++] ^ input[ii++], y11 = prev[pi++] ^ input[ii++]; - let y12 = prev[pi++] ^ input[ii++], y13 = prev[pi++] ^ input[ii++]; - let y14 = prev[pi++] ^ input[ii++], y15 = prev[pi++] ^ input[ii++]; - let x00 = y00, x01 = y01, x02 = y02, x03 = y03, x04 = y04, x05 = y05, x06 = y06, x07 = y07, x08 = y08, x09 = y09, x10 = y10, x11 = y11, x12 = y12, x13 = y13, x14 = y14, x15 = y15; - for (let i = 0; i < 8; i += 2) { - x04 ^= rotl(x00 + x12 | 0, 7); - x08 ^= rotl(x04 + x00 | 0, 9); - x12 ^= rotl(x08 + x04 | 0, 13); - x00 ^= rotl(x12 + x08 | 0, 18); - x09 ^= rotl(x05 + x01 | 0, 7); - x13 ^= rotl(x09 + x05 | 0, 9); - x01 ^= rotl(x13 + x09 | 0, 13); - x05 ^= rotl(x01 + x13 | 0, 18); - x14 ^= rotl(x10 + x06 | 0, 7); - x02 ^= rotl(x14 + x10 | 0, 9); - x06 ^= rotl(x02 + x14 | 0, 13); - x10 ^= rotl(x06 + x02 | 0, 18); - x03 ^= rotl(x15 + x11 | 0, 7); - x07 ^= rotl(x03 + x15 | 0, 9); - x11 ^= rotl(x07 + x03 | 0, 13); - x15 ^= rotl(x11 + x07 | 0, 18); - x01 ^= rotl(x00 + x03 | 0, 7); - x02 ^= rotl(x01 + x00 | 0, 9); - x03 ^= rotl(x02 + x01 | 0, 13); - x00 ^= rotl(x03 + x02 | 0, 18); - x06 ^= rotl(x05 + x04 | 0, 7); - x07 ^= rotl(x06 + x05 | 0, 9); - x04 ^= rotl(x07 + x06 | 0, 13); - x05 ^= rotl(x04 + x07 | 0, 18); - x11 ^= rotl(x10 + x09 | 0, 7); - x08 ^= rotl(x11 + x10 | 0, 9); - x09 ^= rotl(x08 + x11 | 0, 13); - x10 ^= rotl(x09 + x08 | 0, 18); - x12 ^= rotl(x15 + x14 | 0, 7); - x13 ^= rotl(x12 + x15 | 0, 9); - x14 ^= rotl(x13 + x12 | 0, 13); - x15 ^= rotl(x14 + x13 | 0, 18); - } - out[oi++] = y00 + x00 | 0; - out[oi++] = y01 + x01 | 0; - out[oi++] = y02 + x02 | 0; - out[oi++] = y03 + x03 | 0; - out[oi++] = y04 + x04 | 0; - out[oi++] = y05 + x05 | 0; - out[oi++] = y06 + x06 | 0; - out[oi++] = y07 + x07 | 0; - out[oi++] = y08 + x08 | 0; - out[oi++] = y09 + x09 | 0; - out[oi++] = y10 + x10 | 0; - out[oi++] = y11 + x11 | 0; - out[oi++] = y12 + x12 | 0; - out[oi++] = y13 + x13 | 0; - out[oi++] = y14 + x14 | 0; - out[oi++] = y15 + x15 | 0; - } - function BlockMix(input, ii, out, oi, r) { - let head = oi + 0; - let tail = oi + 16 * r; - for (let i = 0; i < 16; i++) - out[tail + i] = input[ii + (2 * r - 1) * 16 + i]; - for (let i = 0; i < r; i++, head += 16, ii += 16) { - XorAndSalsa(out, tail, input, ii, out, head); - if (i > 0) - tail += 16; - XorAndSalsa(out, head, input, ii += 16, out, tail); - } - } - function scryptInit(password, salt, _opts) { - const opts = checkOpts({ - dkLen: 32, - asyncTick: 10, - maxmem: 1024 ** 3 + 1024 - }, _opts); - const { N, r, p, dkLen, asyncTick, maxmem, onProgress } = opts; - number(N); - number(r); - number(p); - number(dkLen); - number(asyncTick); - number(maxmem); - if (onProgress !== void 0 && typeof onProgress !== "function") - throw new Error("progressCb should be function"); - const blockSize = 128 * r; - const blockSize32 = blockSize / 4; - if (N <= 1 || (N & N - 1) !== 0 || N >= 2 ** (blockSize / 8) || N > 2 ** 32) { - throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32"); - } - if (p < 0 || p > (2 ** 32 - 1) * 32 / blockSize) { - throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)"); - } - if (dkLen < 0 || dkLen > (2 ** 32 - 1) * 32) { - throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32"); - } - const memUsed = blockSize * (N + p); - if (memUsed > maxmem) { - throw new Error(`Scrypt: parameters too large, ${memUsed} (128 * r * (N + p)) > ${maxmem} (maxmem)`); - } - const B = pbkdf2(sha256, password, salt, { c: 1, dkLen: blockSize * p }); - const B32 = u32(B); - const V = u32(new Uint8Array(blockSize * N)); - const tmp = u32(new Uint8Array(blockSize)); - let blockMixCb = () => { - }; - if (onProgress) { - const totalBlockMix = 2 * N * p; - const callbackPer = Math.max(Math.floor(totalBlockMix / 1e4), 1); - let blockMixCnt = 0; - blockMixCb = () => { - blockMixCnt++; - if (onProgress && (!(blockMixCnt % callbackPer) || blockMixCnt === totalBlockMix)) - onProgress(blockMixCnt / totalBlockMix); - }; - } - return { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick }; - } - function scryptOutput(password, dkLen, B, V, tmp) { - const res = pbkdf2(sha256, password, B, { c: 1, dkLen }); - B.fill(0); - V.fill(0); - tmp.fill(0); - return res; - } - function scrypt(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb } = scryptInit(password, salt, opts); - if (!isLE) - byteSwap32(B32); - for (let pi = 0; pi < p; pi++) { - const Pi2 = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi2 + i]; - for (let i = 0, pos = 0; i < N - 1; i++) { - BlockMix(V, pos, V, pos += blockSize32, r); - blockMixCb(); - } - BlockMix(V, (N - 1) * blockSize32, B32, Pi2, r); - blockMixCb(); - for (let i = 0; i < N; i++) { - const j = B32[Pi2 + blockSize32 - 16] % N; - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi2 + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi2, r); - blockMixCb(); - } - } - if (!isLE) - byteSwap32(B32); - return scryptOutput(password, dkLen, B, V, tmp); - } - async function scryptAsync(password, salt, opts) { - const { N, r, p, dkLen, blockSize32, V, B32, B, tmp, blockMixCb, asyncTick } = scryptInit(password, salt, opts); - if (!isLE) - byteSwap32(B32); - for (let pi = 0; pi < p; pi++) { - const Pi2 = blockSize32 * pi; - for (let i = 0; i < blockSize32; i++) - V[i] = B32[Pi2 + i]; - let pos = 0; - await asyncLoop(N - 1, asyncTick, () => { - BlockMix(V, pos, V, pos += blockSize32, r); - blockMixCb(); - }); - BlockMix(V, (N - 1) * blockSize32, B32, Pi2, r); - blockMixCb(); - await asyncLoop(N, asyncTick, () => { - const j = B32[Pi2 + blockSize32 - 16] % N; - for (let k = 0; k < blockSize32; k++) - tmp[k] = B32[Pi2 + k] ^ V[j * blockSize32 + k]; - BlockMix(tmp, 0, B32, Pi2, r); - blockMixCb(); - }); - } - if (!isLE) - byteSwap32(B32); - return scryptOutput(password, dkLen, B, V, tmp); - } - - // ../esm/sha512.js - var [SHA512_Kh, SHA512_Kl] = /* @__PURE__ */ (() => u64_default.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((n) => BigInt(n))))(); - var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80); - var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80); - var SHA512 = class extends HashMD { - constructor() { - super(128, 64, 16, false); - this.Ah = 1779033703 | 0; - this.Al = 4089235720 | 0; - this.Bh = 3144134277 | 0; - this.Bl = 2227873595 | 0; - this.Ch = 1013904242 | 0; - this.Cl = 4271175723 | 0; - this.Dh = 2773480762 | 0; - this.Dl = 1595750129 | 0; - this.Eh = 1359893119 | 0; - this.El = 2917565137 | 0; - this.Fh = 2600822924 | 0; - this.Fl = 725511199 | 0; - this.Gh = 528734635 | 0; - this.Gl = 4215389547 | 0; - this.Hh = 1541459225 | 0; - this.Hl = 327033209 | 0; - } - // prettier-ignore - get() { - const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl]; - } - // prettier-ignore - set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) { - this.Ah = Ah | 0; - this.Al = Al | 0; - this.Bh = Bh | 0; - this.Bl = Bl | 0; - this.Ch = Ch | 0; - this.Cl = Cl | 0; - this.Dh = Dh | 0; - this.Dl = Dl | 0; - this.Eh = Eh | 0; - this.El = El | 0; - this.Fh = Fh | 0; - this.Fl = Fl | 0; - this.Gh = Gh | 0; - this.Gl = Gl | 0; - this.Hh = Hh | 0; - this.Hl = Hl | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) { - SHA512_W_H[i] = view.getUint32(offset); - SHA512_W_L[i] = view.getUint32(offset += 4); - } - for (let i = 16; i < 80; i++) { - const W15h = SHA512_W_H[i - 15] | 0; - const W15l = SHA512_W_L[i - 15] | 0; - const s0h = u64_default.rotrSH(W15h, W15l, 1) ^ u64_default.rotrSH(W15h, W15l, 8) ^ u64_default.shrSH(W15h, W15l, 7); - const s0l = u64_default.rotrSL(W15h, W15l, 1) ^ u64_default.rotrSL(W15h, W15l, 8) ^ u64_default.shrSL(W15h, W15l, 7); - const W2h = SHA512_W_H[i - 2] | 0; - const W2l = SHA512_W_L[i - 2] | 0; - const s1h = u64_default.rotrSH(W2h, W2l, 19) ^ u64_default.rotrBH(W2h, W2l, 61) ^ u64_default.shrSH(W2h, W2l, 6); - const s1l = u64_default.rotrSL(W2h, W2l, 19) ^ u64_default.rotrBL(W2h, W2l, 61) ^ u64_default.shrSL(W2h, W2l, 6); - const SUMl = u64_default.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]); - const SUMh = u64_default.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]); - SHA512_W_H[i] = SUMh | 0; - SHA512_W_L[i] = SUMl | 0; - } - let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this; - for (let i = 0; i < 80; i++) { - const sigma1h = u64_default.rotrSH(Eh, El, 14) ^ u64_default.rotrSH(Eh, El, 18) ^ u64_default.rotrBH(Eh, El, 41); - const sigma1l = u64_default.rotrSL(Eh, El, 14) ^ u64_default.rotrSL(Eh, El, 18) ^ u64_default.rotrBL(Eh, El, 41); - const CHIh = Eh & Fh ^ ~Eh & Gh; - const CHIl = El & Fl ^ ~El & Gl; - const T1ll = u64_default.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]); - const T1h = u64_default.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]); - const T1l = T1ll | 0; - const sigma0h = u64_default.rotrSH(Ah, Al, 28) ^ u64_default.rotrBH(Ah, Al, 34) ^ u64_default.rotrBH(Ah, Al, 39); - const sigma0l = u64_default.rotrSL(Ah, Al, 28) ^ u64_default.rotrBL(Ah, Al, 34) ^ u64_default.rotrBL(Ah, Al, 39); - const MAJh = Ah & Bh ^ Ah & Ch ^ Bh & Ch; - const MAJl = Al & Bl ^ Al & Cl ^ Bl & Cl; - Hh = Gh | 0; - Hl = Gl | 0; - Gh = Fh | 0; - Gl = Fl | 0; - Fh = Eh | 0; - Fl = El | 0; - ({ h: Eh, l: El } = u64_default.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0)); - Dh = Ch | 0; - Dl = Cl | 0; - Ch = Bh | 0; - Cl = Bl | 0; - Bh = Ah | 0; - Bl = Al | 0; - const All = u64_default.add3L(T1l, sigma0l, MAJl); - Ah = u64_default.add3H(All, T1h, sigma0h, MAJh); - Al = All | 0; - } - ({ h: Ah, l: Al } = u64_default.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0)); - ({ h: Bh, l: Bl } = u64_default.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0)); - ({ h: Ch, l: Cl } = u64_default.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0)); - ({ h: Dh, l: Dl } = u64_default.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0)); - ({ h: Eh, l: El } = u64_default.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0)); - ({ h: Fh, l: Fl } = u64_default.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0)); - ({ h: Gh, l: Gl } = u64_default.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0)); - ({ h: Hh, l: Hl } = u64_default.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0)); - this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl); - } - roundClean() { - SHA512_W_H.fill(0); - SHA512_W_L.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); - } - }; - var sha512 = /* @__PURE__ */ wrapConstructor(() => new SHA512()); - - // ../esm/sha3.js - var SHA3_PI = []; - var SHA3_ROTL = []; - var _SHA3_IOTA = []; - var _0n = /* @__PURE__ */ BigInt(0); - var _1n = /* @__PURE__ */ BigInt(1); - var _2n = /* @__PURE__ */ BigInt(2); - var _7n = /* @__PURE__ */ BigInt(7); - var _256n = /* @__PURE__ */ BigInt(256); - var _0x71n = /* @__PURE__ */ BigInt(113); - for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) { - [x, y] = [y, (2 * x + 3 * y) % 5]; - SHA3_PI.push(2 * (5 * y + x)); - SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64); - let t = _0n; - for (let j = 0; j < 7; j++) { - R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n; - if (R & _2n) - t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n; - } - _SHA3_IOTA.push(t); - } - var [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true); - var rotlH = (h, l, s) => s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s); - var rotlL = (h, l, s) => s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s); - function keccakP(s, rounds = 24) { - const B = new Uint32Array(5 * 2); - for (let round = 24 - rounds; round < 24; round++) { - for (let x = 0; x < 10; x++) - B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40]; - for (let x = 0; x < 10; x += 2) { - const idx1 = (x + 8) % 10; - const idx0 = (x + 2) % 10; - const B0 = B[idx0]; - const B1 = B[idx0 + 1]; - const Th = rotlH(B0, B1, 1) ^ B[idx1]; - const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1]; - for (let y = 0; y < 50; y += 10) { - s[x + y] ^= Th; - s[x + y + 1] ^= Tl; - } - } - let curH = s[2]; - let curL = s[3]; - for (let t = 0; t < 24; t++) { - const shift = SHA3_ROTL[t]; - const Th = rotlH(curH, curL, shift); - const Tl = rotlL(curH, curL, shift); - const PI = SHA3_PI[t]; - curH = s[PI]; - curL = s[PI + 1]; - s[PI] = Th; - s[PI + 1] = Tl; - } - for (let y = 0; y < 50; y += 10) { - for (let x = 0; x < 10; x++) - B[x] = s[y + x]; - for (let x = 0; x < 10; x++) - s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10]; - } - s[0] ^= SHA3_IOTA_H[round]; - s[1] ^= SHA3_IOTA_L[round]; - } - B.fill(0); - } - var Keccak = class _Keccak extends Hash { - // NOTE: we accept arguments in bytes instead of bits here. - constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) { - super(); - this.blockLen = blockLen; - this.suffix = suffix; - this.outputLen = outputLen; - this.enableXOF = enableXOF; - this.rounds = rounds; - this.pos = 0; - this.posOut = 0; - this.finished = false; - this.destroyed = false; - number(outputLen); - if (0 >= this.blockLen || this.blockLen >= 200) - throw new Error("Sha3 supports only keccak-f1600 function"); - this.state = new Uint8Array(200); - this.state32 = u32(this.state); - } - keccak() { - if (!isLE) - byteSwap32(this.state32); - keccakP(this.state32, this.rounds); - if (!isLE) - byteSwap32(this.state32); - this.posOut = 0; - this.pos = 0; - } - update(data) { - exists(this); - const { blockLen, state } = this; - data = toBytes(data); - const len = data.length; - for (let pos = 0; pos < len; ) { - const take = Math.min(blockLen - this.pos, len - pos); - for (let i = 0; i < take; i++) - state[this.pos++] ^= data[pos++]; - if (this.pos === blockLen) - this.keccak(); - } - return this; - } - finish() { - if (this.finished) - return; - this.finished = true; - const { state, suffix, pos, blockLen } = this; - state[pos] ^= suffix; - if ((suffix & 128) !== 0 && pos === blockLen - 1) - this.keccak(); - state[blockLen - 1] ^= 128; - this.keccak(); - } - writeInto(out) { - exists(this, false); - bytes(out); - this.finish(); - const bufferOut = this.state; - const { blockLen } = this; - for (let pos = 0, len = out.length; pos < len; ) { - if (this.posOut >= blockLen) - this.keccak(); - const take = Math.min(blockLen - this.posOut, len - pos); - out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos); - this.posOut += take; - pos += take; - } - return out; - } - xofInto(out) { - if (!this.enableXOF) - throw new Error("XOF is not possible for this instance"); - return this.writeInto(out); - } - xof(bytes2) { - number(bytes2); - return this.xofInto(new Uint8Array(bytes2)); - } - digestInto(out) { - output(out, this); - if (this.finished) - throw new Error("digest() was already called"); - this.writeInto(out); - this.destroy(); - return out; - } - digest() { - return this.digestInto(new Uint8Array(this.outputLen)); - } - destroy() { - this.destroyed = true; - this.state.fill(0); - } - _cloneInto(to) { - const { blockLen, suffix, outputLen, rounds, enableXOF } = this; - to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds)); - to.state32.set(this.state32); - to.pos = this.pos; - to.posOut = this.posOut; - to.finished = this.finished; - to.rounds = rounds; - to.suffix = suffix; - to.outputLen = outputLen; - to.enableXOF = enableXOF; - to.destroyed = this.destroyed; - return to; - } - }; - var gen = (suffix, blockLen, outputLen) => wrapConstructor(() => new Keccak(blockLen, suffix, outputLen)); - var sha3_224 = /* @__PURE__ */ gen(6, 144, 224 / 8); - var sha3_256 = /* @__PURE__ */ gen(6, 136, 256 / 8); - var sha3_384 = /* @__PURE__ */ gen(6, 104, 384 / 8); - var sha3_512 = /* @__PURE__ */ gen(6, 72, 512 / 8); - var keccak_224 = /* @__PURE__ */ gen(1, 144, 224 / 8); - var keccak_256 = /* @__PURE__ */ gen(1, 136, 256 / 8); - var keccak_384 = /* @__PURE__ */ gen(1, 104, 384 / 8); - var keccak_512 = /* @__PURE__ */ gen(1, 72, 512 / 8); - var genShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true)); - var shake128 = /* @__PURE__ */ genShake(31, 168, 128 / 8); - var shake256 = /* @__PURE__ */ genShake(31, 136, 256 / 8); - - // ../esm/sha3-addons.js - function leftEncode(n) { - const res = [n & 255]; - n >>= 8; - for (; n > 0; n >>= 8) - res.unshift(n & 255); - res.unshift(res.length); - return new Uint8Array(res); - } - function rightEncode(n) { - const res = [n & 255]; - n >>= 8; - for (; n > 0; n >>= 8) - res.unshift(n & 255); - res.push(res.length); - return new Uint8Array(res); - } - function chooseLen(opts, outputLen) { - return opts.dkLen === void 0 ? outputLen : opts.dkLen; - } - var toBytesOptional = (buf) => buf !== void 0 ? toBytes(buf) : new Uint8Array([]); - var getPadding = (len, block2) => new Uint8Array((block2 - len % block2) % block2); - function cshakePers(hash2, opts = {}) { - if (!opts || !opts.personalization && !opts.NISTfn) - return hash2; - const blockLenBytes = leftEncode(hash2.blockLen); - const fn = toBytesOptional(opts.NISTfn); - const fnLen = leftEncode(8 * fn.length); - const pers = toBytesOptional(opts.personalization); - const persLen = leftEncode(8 * pers.length); - if (!fn.length && !pers.length) - return hash2; - hash2.suffix = 4; - hash2.update(blockLenBytes).update(fnLen).update(fn).update(persLen).update(pers); - let totalLen = blockLenBytes.length + fnLen.length + fn.length + persLen.length + pers.length; - hash2.update(getPadding(totalLen, hash2.blockLen)); - return hash2; - } - var gencShake = (suffix, blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => cshakePers(new Keccak(blockLen, suffix, chooseLen(opts, outputLen), true), opts)); - var cshake128 = /* @__PURE__ */ (() => gencShake(31, 168, 128 / 8))(); - var cshake256 = /* @__PURE__ */ (() => gencShake(31, 136, 256 / 8))(); - var KMAC = class extends Keccak { - constructor(blockLen, outputLen, enableXOF, key, opts = {}) { - super(blockLen, 31, outputLen, enableXOF); - cshakePers(this, { NISTfn: "KMAC", personalization: opts.personalization }); - key = toBytes(key); - const blockLenBytes = leftEncode(this.blockLen); - const keyLen = leftEncode(8 * key.length); - this.update(blockLenBytes).update(keyLen).update(key); - const totalLen = blockLenBytes.length + keyLen.length + key.length; - this.update(getPadding(totalLen, this.blockLen)); - } - finish() { - if (!this.finished) - this.update(rightEncode(this.enableXOF ? 0 : this.outputLen * 8)); - super.finish(); - } - _cloneInto(to) { - if (!to) { - to = Object.create(Object.getPrototypeOf(this), {}); - to.state = this.state.slice(); - to.blockLen = this.blockLen; - to.state32 = u32(to.state); - } - return super._cloneInto(to); - } - clone() { - return this._cloneInto(); - } - }; - function genKmac(blockLen, outputLen, xof = false) { - const kmac = (key, message, opts) => kmac.create(key, opts).update(message).digest(); - kmac.create = (key, opts = {}) => new KMAC(blockLen, chooseLen(opts, outputLen), xof, key, opts); - return kmac; - } - var kmac128 = /* @__PURE__ */ (() => genKmac(168, 128 / 8))(); - var kmac256 = /* @__PURE__ */ (() => genKmac(136, 256 / 8))(); - var genTurboshake = (blockLen, outputLen) => wrapXOFConstructorWithOpts((opts = {}) => { - const D = opts.D === void 0 ? 31 : opts.D; - if (!Number.isSafeInteger(D) || D < 1 || D > 127) - throw new Error(`turboshake: wrong domain separation byte: ${D}, should be 0x01..0x7f`); - return new Keccak(blockLen, D, opts.dkLen === void 0 ? outputLen : opts.dkLen, true, 12); - }); - var turboshake128 = /* @__PURE__ */ genTurboshake(168, 256 / 8); - var turboshake256 = /* @__PURE__ */ genTurboshake(136, 512 / 8); - function rightEncodeK12(n) { - const res = []; - for (; n > 0; n >>= 8) - res.unshift(n & 255); - res.push(res.length); - return new Uint8Array(res); - } - var EMPTY = new Uint8Array([]); - var KangarooTwelve = class _KangarooTwelve extends Keccak { - constructor(blockLen, leafLen, outputLen, rounds, opts) { - super(blockLen, 7, outputLen, true, rounds); - this.leafLen = leafLen; - this.chunkLen = 8192; - this.chunkPos = 0; - this.chunksDone = 0; - const { personalization } = opts; - this.personalization = toBytesOptional(personalization); - } - update(data) { - data = toBytes(data); - const { chunkLen, blockLen, leafLen, rounds } = this; - for (let pos = 0, len = data.length; pos < len; ) { - if (this.chunkPos == chunkLen) { - if (this.leafHash) - super.update(this.leafHash.digest()); - else { - this.suffix = 6; - super.update(new Uint8Array([3, 0, 0, 0, 0, 0, 0, 0])); - } - this.leafHash = new Keccak(blockLen, 11, leafLen, false, rounds); - this.chunksDone++; - this.chunkPos = 0; - } - const take = Math.min(chunkLen - this.chunkPos, len - pos); - const chunk = data.subarray(pos, pos + take); - if (this.leafHash) - this.leafHash.update(chunk); - else - super.update(chunk); - this.chunkPos += take; - pos += take; - } - return this; - } - finish() { - if (this.finished) - return; - const { personalization } = this; - this.update(personalization).update(rightEncodeK12(personalization.length)); - if (this.leafHash) { - super.update(this.leafHash.digest()); - super.update(rightEncodeK12(this.chunksDone)); - super.update(new Uint8Array([255, 255])); - } - super.finish.call(this); - } - destroy() { - super.destroy.call(this); - if (this.leafHash) - this.leafHash.destroy(); - this.personalization = EMPTY; - } - _cloneInto(to) { - const { blockLen, leafLen, leafHash, outputLen, rounds } = this; - to || (to = new _KangarooTwelve(blockLen, leafLen, outputLen, rounds, {})); - super._cloneInto(to); - if (leafHash) - to.leafHash = leafHash._cloneInto(to.leafHash); - to.personalization.set(this.personalization); - to.leafLen = this.leafLen; - to.chunkPos = this.chunkPos; - to.chunksDone = this.chunksDone; - return to; - } - clone() { - return this._cloneInto(); - } - }; - var k12 = /* @__PURE__ */ (() => wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(168, 32, chooseLen(opts, 32), 12, opts)))(); - var m14 = /* @__PURE__ */ (() => wrapConstructorWithOpts((opts = {}) => new KangarooTwelve(136, 64, chooseLen(opts, 64), 14, opts)))(); - - // ../esm/sha1.js - var SHA1_IV = /* @__PURE__ */ new Uint32Array([ - 1732584193, - 4023233417, - 2562383102, - 271733878, - 3285377520 - ]); - var SHA1_W = /* @__PURE__ */ new Uint32Array(80); - var SHA1 = class extends HashMD { - constructor() { - super(64, 20, 8, false); - this.A = SHA1_IV[0] | 0; - this.B = SHA1_IV[1] | 0; - this.C = SHA1_IV[2] | 0; - this.D = SHA1_IV[3] | 0; - this.E = SHA1_IV[4] | 0; - } - get() { - const { A, B, C, D, E } = this; - return [A, B, C, D, E]; - } - set(A, B, C, D, E) { - this.A = A | 0; - this.B = B | 0; - this.C = C | 0; - this.D = D | 0; - this.E = E | 0; - } - process(view, offset) { - for (let i = 0; i < 16; i++, offset += 4) - SHA1_W[i] = view.getUint32(offset, false); - for (let i = 16; i < 80; i++) - SHA1_W[i] = rotl(SHA1_W[i - 3] ^ SHA1_W[i - 8] ^ SHA1_W[i - 14] ^ SHA1_W[i - 16], 1); - let { A, B, C, D, E } = this; - for (let i = 0; i < 80; i++) { - let F, K; - if (i < 20) { - F = Chi(B, C, D); - K = 1518500249; - } else if (i < 40) { - F = B ^ C ^ D; - K = 1859775393; - } else if (i < 60) { - F = Maj(B, C, D); - K = 2400959708; - } else { - F = B ^ C ^ D; - K = 3395469782; - } - const T = rotl(A, 5) + F + E + K + SHA1_W[i] | 0; - E = D; - D = C; - C = rotl(B, 30); - B = A; - A = T; - } - A = A + this.A | 0; - B = B + this.B | 0; - C = C + this.C | 0; - D = D + this.D | 0; - E = E + this.E | 0; - this.set(A, B, C, D, E); - } - roundClean() { - SHA1_W.fill(0); - } - destroy() { - this.set(0, 0, 0, 0, 0); - this.buffer.fill(0); - } - }; - var sha1 = /* @__PURE__ */ wrapConstructor(() => new SHA1()); - - // ../esm/argon2.js - var ARGON2_SYNC_POINTS = 4; - var toBytesOptional2 = (buf) => buf !== void 0 ? toBytes(buf) : new Uint8Array([]); - function mul(a, b) { - const aL = a & 65535; - const aH = a >>> 16; - const bL = b & 65535; - const bH = b >>> 16; - const ll = Math.imul(aL, bL); - const hl = Math.imul(aH, bL); - const lh = Math.imul(aL, bH); - const hh = Math.imul(aH, bH); - const BUF = (ll >>> 16) + (hl & 65535) + lh | 0; - const h = (hl >>> 16) + (BUF >>> 16) + hh | 0; - return { h, l: BUF << 16 | ll & 65535 }; - } - function relPos(areaSize, relativePos) { - return areaSize - 1 - mul(areaSize, mul(relativePos, relativePos).h).h; - } - function mul2(a, b) { - const { h, l } = mul(a, b); - return { h: (h << 1 | l >>> 31) & 4294967295, l: l << 1 & 4294967295 }; - } - function blamka(Ah, Al, Bh, Bl) { - const { h: Ch, l: Cl } = mul2(Al, Bl); - const Rll = add3L(Al, Bl, Cl); - return { h: add3H(Rll, Ah, Bh, Ch), l: Rll | 0 }; - } - var A2_BUF = new Uint32Array(256); - function G(a, b, c, d) { - let Al = A2_BUF[2 * a], Ah = A2_BUF[2 * a + 1]; - let Bl = A2_BUF[2 * b], Bh = A2_BUF[2 * b + 1]; - let Cl = A2_BUF[2 * c], Ch = A2_BUF[2 * c + 1]; - let Dl = A2_BUF[2 * d], Dh = A2_BUF[2 * d + 1]; - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotr32H(Dh, Dl), Dl: rotr32L(Dh, Dl) }); - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrSH(Bh, Bl, 24), Bl: rotrSL(Bh, Bl, 24) }); - ({ h: Ah, l: Al } = blamka(Ah, Al, Bh, Bl)); - ({ Dh, Dl } = { Dh: Dh ^ Ah, Dl: Dl ^ Al }); - ({ Dh, Dl } = { Dh: rotrSH(Dh, Dl, 16), Dl: rotrSL(Dh, Dl, 16) }); - ({ h: Ch, l: Cl } = blamka(Ch, Cl, Dh, Dl)); - ({ Bh, Bl } = { Bh: Bh ^ Ch, Bl: Bl ^ Cl }); - ({ Bh, Bl } = { Bh: rotrBH(Bh, Bl, 63), Bl: rotrBL(Bh, Bl, 63) }); - A2_BUF[2 * a] = Al, A2_BUF[2 * a + 1] = Ah; - A2_BUF[2 * b] = Bl, A2_BUF[2 * b + 1] = Bh; - A2_BUF[2 * c] = Cl, A2_BUF[2 * c + 1] = Ch; - A2_BUF[2 * d] = Dl, A2_BUF[2 * d + 1] = Dh; - } - function P(v00, v01, v02, v03, v04, v05, v06, v07, v08, v09, v10, v11, v12, v13, v14, v15) { - G(v00, v04, v08, v12); - G(v01, v05, v09, v13); - G(v02, v06, v10, v14); - G(v03, v07, v11, v15); - G(v00, v05, v10, v15); - G(v01, v06, v11, v12); - G(v02, v07, v08, v13); - G(v03, v04, v09, v14); - } - function block(x, xPos, yPos, outPos, needXor) { - for (let i = 0; i < 256; i++) - A2_BUF[i] = x[xPos + i] ^ x[yPos + i]; - for (let i = 0; i < 128; i += 16) { - P(i, i + 1, i + 2, i + 3, i + 4, i + 5, i + 6, i + 7, i + 8, i + 9, i + 10, i + 11, i + 12, i + 13, i + 14, i + 15); - } - for (let i = 0; i < 16; i += 2) { - P(i, i + 1, i + 16, i + 17, i + 32, i + 33, i + 48, i + 49, i + 64, i + 65, i + 80, i + 81, i + 96, i + 97, i + 112, i + 113); - } - if (needXor) - for (let i = 0; i < 256; i++) - x[outPos + i] ^= A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - else - for (let i = 0; i < 256; i++) - x[outPos + i] = A2_BUF[i] ^ x[xPos + i] ^ x[yPos + i]; - } - function Hp(A, dkLen) { - const A8 = u8(A); - const T = new Uint32Array(1); - const T8 = u8(T); - T[0] = dkLen; - if (dkLen <= 64) - return blake2b.create({ dkLen }).update(T8).update(A8).digest(); - const out = new Uint8Array(dkLen); - let V = blake2b.create({}).update(T8).update(A8).digest(); - let pos = 0; - out.set(V.subarray(0, 32)); - pos += 32; - for (; dkLen - pos > 64; pos += 32) - out.set((V = blake2b(V)).subarray(0, 32), pos); - out.set(blake2b(V, { dkLen: dkLen - pos }), pos); - return u32(out); - } - function indexAlpha(r, s, laneLen, segmentLen, index, randL, sameLane = false) { - let area; - if (0 == r) { - if (0 == s) - area = index - 1; - else if (sameLane) - area = s * segmentLen + index - 1; - else - area = s * segmentLen + (index == 0 ? -1 : 0); - } else if (sameLane) - area = laneLen - segmentLen + index - 1; - else - area = laneLen - segmentLen + (index == 0 ? -1 : 0); - const startPos = r !== 0 && s !== ARGON2_SYNC_POINTS - 1 ? (s + 1) * segmentLen : 0; - const rel = relPos(area, randL); - return (startPos + rel) % laneLen; - } - function argon2Init(type, password, salt, opts) { - password = toBytes(password); - salt = toBytes(salt); - let { p, dkLen, m, t, version, key, personalization, maxmem, onProgress } = { - ...opts, - version: opts.version || 19, - dkLen: opts.dkLen || 32, - maxmem: 2 ** 32 - }; - number(p); - number(dkLen); - number(m); - number(t); - number(version); - if (dkLen < 4 || dkLen >= 2 ** 32) - throw new Error("Argon2: dkLen should be at least 4 bytes"); - if (p < 1 || p >= 2 ** 32) - throw new Error("Argon2: p (parallelism) should be at least 1"); - if (t < 1 || t >= 2 ** 32) - throw new Error("Argon2: t (iterations) should be at least 1"); - if (m < 8 * p) - throw new Error(`Argon2: memory should be at least 8*p bytes`); - if (version !== 16 && version !== 19) - throw new Error(`Argon2: unknown version=${version}`); - password = toBytes(password); - if (password.length < 0 || password.length >= 2 ** 32) - throw new Error("Argon2: password should be less than 4 GB"); - salt = toBytes(salt); - if (salt.length < 8) - throw new Error("Argon2: salt should be at least 8 bytes"); - key = toBytesOptional2(key); - personalization = toBytesOptional2(personalization); - if (onProgress !== void 0 && typeof onProgress !== "function") - throw new Error("progressCb should be function"); - const lanes = p; - const mP = 4 * p * Math.floor(m / (ARGON2_SYNC_POINTS * p)); - const laneLen = Math.floor(mP / p); - const segmentLen = Math.floor(laneLen / ARGON2_SYNC_POINTS); - const h = blake2b.create({}); - const BUF = new Uint32Array(1); - const BUF8 = u8(BUF); - for (const i of [p, dkLen, m, t, version, type]) { - if (i < 0 || i >= 2 ** 32) - throw new Error(`Argon2: wrong parameter=${i}, expected uint32`); - BUF[0] = i; - h.update(BUF8); - } - for (let i of [password, salt, key, personalization]) { - BUF[0] = i.length; - h.update(BUF8).update(i); - } - const H0 = new Uint32Array(18); - const H0_8 = u8(H0); - h.digestInto(H0_8); - const memUsed = mP * 256; - if (memUsed < 0 || memUsed >= 2 ** 32 || memUsed > maxmem) { - throw new Error(`Argon2: wrong params (memUsed=${memUsed} maxmem=${maxmem}), should be less than 2**32`); - } - const B = new Uint32Array(memUsed); - for (let l = 0; l < p; l++) { - const i = 256 * laneLen * l; - H0[17] = l; - H0[16] = 0; - B.set(Hp(H0, 1024), i); - H0[16] = 1; - B.set(Hp(H0, 1024), i + 256); - } - let perBlock = () => { - }; - if (onProgress) { - const totalBlock = t * ARGON2_SYNC_POINTS * p * segmentLen; - const callbackPer = Math.max(Math.floor(totalBlock / 1e4), 1); - let blockCnt = 0; - perBlock = () => { - blockCnt++; - if (onProgress && (!(blockCnt % callbackPer) || blockCnt === totalBlock)) - onProgress(blockCnt / totalBlock); - }; - } - return { type, mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock }; - } - function argon2Output(B, p, laneLen, dkLen) { - const B_final = new Uint32Array(256); - for (let l = 0; l < p; l++) - for (let j = 0; j < 256; j++) - B_final[j] ^= B[256 * (laneLen * l + laneLen - 1) + j]; - return u8(Hp(B_final, dkLen)); - } - function processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor) { - if (offset % laneLen) - prev = offset - 1; - let randL, randH; - if (dataIndependent) { - if (index % 128 === 0) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - randL = address[2 * (index % 128)]; - randH = address[2 * (index % 128) + 1]; - } else { - const T = 256 * prev; - randL = B[T]; - randH = B[T + 1]; - } - const refLane = r === 0 && s === 0 ? l : randH % lanes; - const refPos = indexAlpha(r, s, laneLen, segmentLen, index, randL, refLane == l); - const refBlock = laneLen * refLane + refPos; - block(B, 256 * prev, 256 * refBlock, offset * 256, needXor); - } - function argon2(type, password, salt, opts) { - const { mP, p, t, version, B, laneLen, lanes, segmentLen, dkLen, perBlock } = argon2Init(type, password, salt, opts); - const address = new Uint32Array(3 * 256); - address[256 + 6] = mP; - address[256 + 8] = t; - address[256 + 10] = type; - for (let r = 0; r < t; r++) { - const needXor = r !== 0 && version === 19; - address[256 + 0] = r; - for (let s = 0; s < ARGON2_SYNC_POINTS; s++) { - address[256 + 4] = s; - const dataIndependent = type == 1 || type == 2 && r === 0 && s < 2; - for (let l = 0; l < p; l++) { - address[256 + 2] = l; - address[256 + 12] = 0; - let startPos = 0; - if (r === 0 && s === 0) { - startPos = 2; - if (dataIndependent) { - address[256 + 12]++; - block(address, 256, 2 * 256, 0, false); - block(address, 0, 2 * 256, 0, false); - } - } - let offset = l * laneLen + s * segmentLen + startPos; - let prev = offset % laneLen ? offset - 1 : offset + laneLen - 1; - for (let index = startPos; index < segmentLen; index++, offset++, prev++) { - perBlock(); - processBlock(B, address, l, r, s, index, laneLen, segmentLen, lanes, offset, prev, dataIndependent, needXor); - } - } - } - } - return argon2Output(B, p, laneLen, dkLen); - } - var argon2id = (password, salt, opts) => argon2(2, password, salt, opts); - - // ../esm/eskdf.js - var SCRYPT_FACTOR = 2 ** 19; - var PBKDF2_FACTOR = 2 ** 17; - function scrypt2(password, salt) { - return scrypt(password, salt, { N: SCRYPT_FACTOR, r: 8, p: 1, dkLen: 32 }); - } - function pbkdf22(password, salt) { - return pbkdf2(sha256, password, salt, { c: PBKDF2_FACTOR, dkLen: 32 }); - } - function xor32(a, b) { - bytes(a, 32); - bytes(b, 32); - const arr = new Uint8Array(32); - for (let i = 0; i < 32; i++) { - arr[i] = a[i] ^ b[i]; - } - return arr; - } - function strHasLength(str, min, max) { - return typeof str === "string" && str.length >= min && str.length <= max; - } - function deriveMainSeed(username, password) { - if (!strHasLength(username, 8, 255)) - throw new Error("invalid username"); - if (!strHasLength(password, 8, 255)) - throw new Error("invalid password"); - const scr = scrypt2(password + "", username + ""); - const pbk = pbkdf22(password + "", username + ""); - const res = xor32(scr, pbk); - scr.fill(0); - pbk.fill(0); - return res; - } - function getSaltInfo(protocol, accountId = 0) { - if (!(strHasLength(protocol, 3, 15) && /^[a-z0-9]{3,15}$/.test(protocol))) { - throw new Error("invalid protocol"); - } - const allowsStr = /^password\d{0,3}|ssh|tor|file$/.test(protocol); - let salt; - if (typeof accountId === "string") { - if (!allowsStr) - throw new Error("accountId must be a number"); - if (!strHasLength(accountId, 1, 255)) - throw new Error("accountId must be valid string"); - salt = toBytes(accountId); - } else if (Number.isSafeInteger(accountId)) { - if (accountId < 0 || accountId > 2 ** 32 - 1) - throw new Error("invalid accountId"); - salt = new Uint8Array(4); - createView(salt).setUint32(0, accountId, false); - } else { - throw new Error(`accountId must be a number${allowsStr ? " or string" : ""}`); - } - const info = toBytes(protocol); - return { salt, info }; - } - function countBytes(num) { - if (typeof num !== "bigint" || num <= BigInt(128)) - throw new Error("invalid number"); - return Math.ceil(num.toString(2).length / 8); - } - function getKeyLength(options) { - if (!options || typeof options !== "object") - return 32; - const hasLen = "keyLength" in options; - const hasMod = "modulus" in options; - if (hasLen && hasMod) - throw new Error("cannot combine keyLength and modulus options"); - if (!hasLen && !hasMod) - throw new Error("must have either keyLength or modulus option"); - const l = hasMod ? countBytes(options.modulus) + 8 : options.keyLength; - if (!(typeof l === "number" && l >= 16 && l <= 8192)) - throw new Error("invalid keyLength"); - return l; - } - function modReduceKey(key, modulus) { - const _1 = BigInt(1); - const num = BigInt("0x" + bytesToHex(key)); - const res = num % (modulus - _1) + _1; - if (res < _1) - throw new Error("expected positive number"); - const len = key.length - 8; - const hex = res.toString(16).padStart(len * 2, "0"); - const bytes2 = hexToBytes(hex); - if (bytes2.length !== len) - throw new Error("invalid length of result key"); - return bytes2; - } - async function eskdf(username, password) { - let seed = deriveMainSeed(username, password); - function deriveCK(protocol, accountId = 0, options) { - bytes(seed, 32); - const { salt, info } = getSaltInfo(protocol, accountId); - const keyLength = getKeyLength(options); - const key = hkdf(sha256, seed, salt, info, keyLength); - return options && "modulus" in options ? modReduceKey(key, options.modulus) : key; - } - function expire() { - if (seed) - seed.fill(1); - seed = void 0; - } - const fingerprint = Array.from(deriveCK("fingerprint", 0)).slice(0, 6).map((char) => char.toString(16).padStart(2, "0").toUpperCase()).join(":"); - return Object.freeze({ deriveChildKey: deriveCK, expire, fingerprint }); - } - - // input.js - var utils = { bytesToHex, hexToBytes, concatBytes, utf8ToBytes, randomBytes }; - return __toCommonJS(input_exports); -})(); -/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ \ No newline at end of file diff --git a/export/package.json b/export/package.json index 87d1dc44..80f07c28 100644 --- a/export/package.json +++ b/export/package.json @@ -1,9 +1,12 @@ { - "name": "export-tests", + "name": "@turnkey/frames-export", "version": "1.0.0", - "main": "index.test.js", + "private": true, "scripts": { - "start": "serve", + "build": "webpack --mode=production", + "build:dev": "webpack --mode=development", + "dev": "webpack serve --mode=development --open", + "start": "serve -l 8081 dist", "test": "jest", "lint": "eslint '**/*.{js,ts}'", "lint:write": "eslint '**/*.{js,ts}' --fix", @@ -18,14 +21,27 @@ "@babel/core": "^7.23.0", "@babel/preset-env": "^7.22.20", "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", + "@testing-library/jest-dom": "^6.9.1", + "@types/jest": "30.0.0", + "@types/jsdom": "28.0.3", "babel-jest": "^29.7.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", + "babel-loader": "9.1.3", + "html-webpack-plugin": "5.5.3", + "jest": "30.4.2", + "jest-environment-jsdom": "30.4.1", "eslint": "^8.57.0", "jsdom": "^22.1.0", + "mini-css-extract-plugin": "2.9.4", "prettier": "^2.8.4", "regenerator-runtime": "^0.14.1", - "serve": "^14.2.1" + "serve": "^14.2.1", + "webpack": "5.102.1", + "webpack-cli": "5.1.4", + "webpack-dev-server": "5.2.2", + "webpack-subresource-integrity": "5.2.0-rc.1" + }, + "dependencies": { + "@turnkey/frames-shared": "workspace:*", + "@turnkey/crypto": "2.8.6" } } diff --git a/export/src/index.js b/export/src/index.js new file mode 100644 index 00000000..c4b10432 --- /dev/null +++ b/export/src/index.js @@ -0,0 +1,371 @@ +import { TKHQ } from "./turnkey-core"; +import { HpkeDecrypt } from "@turnkey/frames-shared"; + +// persist the MessageChannel object so we can use it to communicate with the parent window +var iframeMessagePort = null; + +// controllers to remove event listeners +const messageListenerController = new AbortController(); +const turnkeyInitController = new AbortController(); + +// Guard to prevent concurrent channel establishment from multiple senders +let channelEstablished = false; + +/** + * DOM Event handlers to power the export flow in standalone mode + * Instead of receiving events from the parent page, forms trigger them. + * This is useful for debugging as well. + */ +var addDOMEventListeners = function () { + document.getElementById("inject-key").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ + type: "INJECT_KEY_EXPORT_BUNDLE", + value: document.getElementById("key-export-bundle").value, + keyFormat: document.getElementById("key-export-format").value, + organizationId: document.getElementById("key-organization-id").value, + }); + }, + false + ); + document.getElementById("inject-wallet").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ + type: "INJECT_WALLET_EXPORT_BUNDLE", + value: document.getElementById("wallet-export-bundle").value, + organizationId: document.getElementById("wallet-organization-id").value, + }); + }, + false + ); + document.getElementById("reset").addEventListener( + "click", + async (e) => { + e.preventDefault(); + window.postMessage({ type: "RESET_EMBEDDED_KEY" }); + }, + false + ); +}; + +/** + * Message Event Handlers to process messages from the parent frame + */ +var messageEventListener = async function (event) { + if (event.data && event.data["type"] == "INJECT_KEY_EXPORT_BUNDLE") { + TKHQ.logMessage( + `⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["keyFormat"]}, ${event.data["organizationId"]}` + ); + try { + await onInjectKeyBundle( + event.data["value"], + event.data["keyFormat"], + event.data["organizationId"], + event.data["requestId"] + ); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "INJECT_WALLET_EXPORT_BUNDLE") { + TKHQ.logMessage( + `⬇️ Received message ${event.data["type"]}: ${event.data["value"]}, ${event.data["organizationId"]}` + ); + try { + await onInjectWalletBundle( + event.data["value"], + event.data["organizationId"], + event.data["requestId"] + ); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "APPLY_SETTINGS") { + try { + await onApplySettings(event.data["value"], event.data["requestId"]); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString(), event.data["requestId"]); + } + } + if (event.data && event.data["type"] == "RESET_EMBEDDED_KEY") { + TKHQ.logMessage(`⬇️ Received message ${event.data["type"]}`); + try { + TKHQ.onResetEmbeddedKey(); + } catch (e) { + TKHQ.sendMessageUp("ERROR", e.toString()); + } + } +}; + +/** + * Initialize the embedded key and set up the DOM and message event listeners + */ +document.addEventListener( + "DOMContentLoaded", + async function () { + await TKHQ.initEmbeddedKey(); + const embeddedKeyJwk = await TKHQ.getEmbeddedKey(); + const targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk); + const targetPubHex = TKHQ.uint8arrayToHexString(targetPubBuf); + document.getElementById("embedded-key").value = targetPubHex; + + window.addEventListener("message", messageEventListener, { + capture: false, + signal: messageListenerController.signal, + }); + + addDOMEventListeners(); + + if (!messageListenerController.signal.aborted) { + // If styles are saved in local storage, sanitize and apply them. + const styleSettings = TKHQ.getSettings(); + if (styleSettings) { + TKHQ.applySettings(styleSettings); + } + TKHQ.sendMessageUp("PUBLIC_KEY_READY", targetPubHex); + } + }, + false +); + +window.addEventListener( + "message", + async function (event) { + /** + * @turnkey/iframe-stamper >= v2.1.0 is using a MessageChannel to communicate with the parent frame. + * The parent frame sends a TURNKEY_INIT_MESSAGE_CHANNEL event with the MessagePort. + * If we receive this event, we want to remove the message event listener that was added in the DOMContentLoaded event to avoid processing messages twice. + * We persist the MessagePort so we can use it to communicate with the parent window in subsequent calls to TKHQ.sendMessageUp + */ + if ( + event.data && + event.data["type"] == "TURNKEY_INIT_MESSAGE_CHANNEL" && + event.ports?.[0] + ) { + // Synchronously check-and-set the flag before any await. This prevents + // a second concurrent invocation from racing through while the first is + // suspended at an await, which would allow multiple origins to establish + // a channel before turnkeyInitController.abort() is reached. + if (channelEstablished) { + return; + } + channelEstablished = true; + + // remove the message event listener that was added in the DOMContentLoaded event + messageListenerController.abort(); + + iframeMessagePort = event.ports[0]; + iframeMessagePort.onmessage = messageEventListener; + + TKHQ.setParentFrameMessageChannelPort(iframeMessagePort); + + await TKHQ.initEmbeddedKey(); + var embeddedKeyJwk = await TKHQ.getEmbeddedKey(); + var targetPubBuf = await TKHQ.p256JWKPrivateToPublic(embeddedKeyJwk); + var targetPubHex = TKHQ.uint8arrayToHexString(targetPubBuf); + document.getElementById("embedded-key").value = targetPubHex; + + TKHQ.sendMessageUp("PUBLIC_KEY_READY", targetPubHex); + + // remove the listener for TURNKEY_INIT_MESSAGE_CHANNEL after it's been processed + turnkeyInitController.abort(); + } + }, + { signal: turnkeyInitController.signal } +); + +/** + * Hide every HTML element in except any \ No newline at end of file +Turnkey Import
\ No newline at end of file diff --git a/import/dist/index.styles.ffa96c55390662fee576.css.map b/import/dist/index.styles.ffa96c55390662fee576.css.map index 9d1c6454..7be395ce 100644 --- a/import/dist/index.styles.ffa96c55390662fee576.css.map +++ b/import/dist/index.styles.ffa96c55390662fee576.css.map @@ -1 +1 @@ -{"version":3,"file":"index.styles.ffa96c55390662fee576.css","mappings":"AAAA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,aAAa;EACb,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;AACd;AACA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;EACpD,aAAa;AACf;AACA;EACE,aAAa;EACb,YAAY;AACd;;AAEA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD","sources":["webpack://import/./src/styles.css"],"sourcesContent":["#plaintext {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 110px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#plaintext:focus {\n outline: none;\n border: none;\n}\n#passphrase {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 55px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n display: none;\n}\n#passphrase:focus {\n outline: none;\n border: none;\n}\n\n#passphrase-label {\n display: none;\n border: none;\n width: 300px;\n margin-top: 12px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#mnemonic-label {\n display: none;\n border: none;\n width: 300px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"index.styles.ffa96c55390662fee576.css","mappings":"AAAA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,aAAa;EACb,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;AACd;AACA;EACE,YAAY;EACZ,mBAAmB;EACnB,oBAAoB;EACpB,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,yBAAyB;EACzB;sDACoD;EACpD,aAAa;AACf;AACA;EACE,aAAa;EACb,YAAY;AACd;;AAEA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,gBAAgB;EAChB,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD;AACA;EACE,aAAa;EACb,YAAY;EACZ,YAAY;EACZ,kBAAkB;EAClB,mBAAmB;EACnB,oBAAoB;EACpB,cAAc;EACd;sDACoD;AACtD","sources":["webpack://@turnkey/frames-import/./src/styles.css"],"sourcesContent":["#plaintext {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 110px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#plaintext:focus {\n outline: none;\n border: none;\n}\n#passphrase {\n width: 300px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n height: 55px;\n color: #555b64;\n border: none;\n resize: none;\n word-wrap: break-word;\n overflow-wrap: break-word;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n display: none;\n}\n#passphrase:focus {\n outline: none;\n border: none;\n}\n\n#passphrase-label {\n display: none;\n border: none;\n width: 300px;\n margin-top: 12px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n#mnemonic-label {\n display: none;\n border: none;\n width: 300px;\n margin-bottom: 4px;\n font-size: 0.875rem;\n line-height: 1.25rem;\n color: #18191a;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/standalone.bundle.8e98d36b6446c5926864.js b/import/dist/standalone.bundle.8e98d36b6446c5926864.js new file mode 100644 index 00000000..8d950b0c --- /dev/null +++ b/import/dist/standalone.bundle.8e98d36b6446c5926864.js @@ -0,0 +1,3 @@ +/*! For license information please see standalone.bundle.8e98d36b6446c5926864.js.LICENSE.txt */ +(()=>{"use strict";var e,t,r,n,a,o={274:(e,t,r)=>{var n=r(931),a=r(166);function o(){var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function c(r,n,a,o){var c=n&&n.prototype instanceof d?n:d,s=Object.create(c.prototype);return i(s,"_invoke",function(r,n,a){var o,i,c,d=0,s=a||[],f=!1,l={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,r){return o=t,i=0,c=e,l.n=r,u}};function p(r,n){for(i=r,c=n,t=0;!f&&d&&!a&&t3?(a=v===n)&&(c=o[(i=o[4])?5:(i=3,3)],o[4]=o[5]=e):o[0]<=p&&((a=r<2&&pn||n>v)&&(o[4]=r,o[5]=n,l.n=v,i=0))}if(a||r>1)return u;throw f=!0,n}return function(a,s,v){if(d>1)throw TypeError("Generator is already running");for(f&&1===s&&p(s,v),i=s,c=v;(t=i<2?e:c)||!f;){o||(i?i<3?(i>1&&(l.n=-1),p(i,c)):l.n=c:l.v=c);try{if(d=2,o){if(i||(a="next"),t=o[a]){if(!(t=t.call(o,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,i<2&&(i=0)}else 1===i&&(t=o.return)&&t.call(o),i<2&&(c=TypeError("The iterator does not provide a '"+a+"' method"),i=1);o=e}else if((t=(f=l.n<0)?c:r.call(n,l))!==u)break}catch(t){o=e,i=1,c=t}finally{d=1}}return{value:t,done:f}}}(r,a,o),!0),s}var u={};function d(){}function s(){}function f(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(i(t={},n,function(){return this}),t),p=f.prototype=d.prototype=Object.create(l);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,f):(e.__proto__=f,i(e,a,"GeneratorFunction")),e.prototype=Object.create(p),e}return s.prototype=f,i(p,"constructor",f),i(f,"constructor",s),s.displayName="GeneratorFunction",i(f,a,"GeneratorFunction"),i(p),i(p,a,"Generator"),i(p,n,function(){return this}),i(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:c,m:v}})()}function i(e,t,r,n){var a=Object.defineProperty;try{a({},"",{})}catch(e){a=0}i=function(e,t,r,n){function o(t,r){i(e,t,function(e){return this._invoke(t,r,e)})}t?a?a(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(o("next",0),o("throw",1),o("return",2))},i(e,t,r,n)}function c(e,t,r,n,a,o,i){try{var c=e[o](i),u=c.value}catch(e){return void r(e)}c.done?t(u):Promise.resolve(u).then(n,a)}function u(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){c(o,n,a,i,u,"next",e)}function u(e){c(o,n,a,i,u,"throw",e)}i(void 0)})}}function d(e){var t=document.getElementById("message-log"),r=document.createElement("p");r.innerText=e,t.appendChild(r)}function s(e,t){null!==window.top&&window.top.postMessage({type:e,value:t},"*"),d("⬆️ Sent message ".concat(e,": ").concat(t))}function f(e,t,r){return l.apply(this,arguments)}function l(){return(l=u(o().m(function e(t,r,a){var i,c,u,d,f;return o().w(function(e){for(;;)switch(e.n){case 0:c=JSON.parse(t),f=c.version,e.n="v1.0.0"===f?1:13;break;case 1:if(c.data){e.n=2;break}throw new Error('missing "data" in bundle');case 2:if(c.dataSignature){e.n=3;break}throw new Error('missing "dataSignature" in bundle');case 3:if(c.enclaveQuorumPublic){e.n=4;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 4:if(n.verifyEnclaveSignature){e.n=5;break}throw new Error("method not loaded");case 5:return e.n=6,n.verifyEnclaveSignature(c.enclaveQuorumPublic,c.dataSignature,c.data);case 6:if(e.v){e.n=7;break}throw new Error("failed to verify enclave signature: ".concat(t));case 7:if(u=JSON.parse((new TextDecoder).decode(n.uint8arrayFromHexString(c.data))),r){e.n=8;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.n=9;break;case 8:if(u.organizationId&&u.organizationId===r){e.n=9;break}throw new Error("organization id does not match expected value. Expected: ".concat(r,". Found: ").concat(u.organizationId,"."));case 9:if(a){e.n=10;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.n=11;break;case 10:if(u.userId&&u.userId===a){e.n=11;break}throw new Error("user id does not match expected value. Expected: ".concat(a,". Found: ").concat(u.userId,"."));case 11:if(u.targetPublic){e.n=12;break}throw new Error('missing "targetPublic" in bundle signed data');case 12:return i=n.uint8arrayFromHexString(u.targetPublic),e.a(3,14);case 13:throw new Error("unsupported version: ".concat(c.version));case 14:return e.n=15,n.loadTargetKey(new Uint8Array(i));case 15:d=e.v,n.setTargetEmbeddedKey(d),s("BUNDLE_INJECTED",!0);case 16:return e.a(2)}},e)}))).apply(this,arguments)}function p(e){return v.apply(this,arguments)}function v(){return(v=u(o().m(function e(t){var r,i,c,u;return o().w(function(e){for(;;)switch(e.n){case 0:if(null!=(r=n.getTargetEmbeddedKey())){e.n=1;break}throw new Error("no target key found");case 1:if(i=t.trim()){e.n=2;break}throw new Error("no wallet mnemonic entered");case 2:return c=(new TextEncoder).encode(i),e.n=3,(0,a.qD)({plaintextBuf:c,receiverPubJwk:r});case 3:u=e.v,n.resetTargetEmbeddedKey(),s("ENCRYPTED_BUNDLE_EXTRACTED",u);case 4:return e.a(2)}},e)}))).apply(this,arguments)}function m(e,t){return y.apply(this,arguments)}function y(){return(y=u(o().m(function e(t,r){var i,c,u,d;return o().w(function(e){for(;;)switch(e.n){case 0:if(null!=(i=n.getTargetEmbeddedKey())){e.n=1;break}throw new Error("no target key found");case 1:if(c=t.trim()){e.n=2;break}throw new Error("no private key entered");case 2:return u=n.decodeKey(c,r),e.n=3,(0,a.qD)({plaintextBuf:u,receiverPubJwk:i});case 3:d=e.v,n.resetTargetEmbeddedKey(),s("ENCRYPTED_BUNDLE_EXTRACTED",d);case 4:return e.a(2)}},e)}))).apply(this,arguments)}window.TKHQ=n,document.addEventListener("DOMContentLoaded",u(o().m(function e(){return o().w(function(e){for(;;)switch(e.n){case 0:s("PUBLIC_KEY_READY",""),window.addEventListener("message",function(){var e=u(o().m(function e(t){return o().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.n=4;break}return d("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.organizationId,", ").concat(t.data.userId)),e.p=1,e.n=2,f(t.data.value,t.data.organizationId,t.data.userId);case 2:e.n=4;break;case 3:e.p=3,s("ERROR",e.v.toString());case 4:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.n=8;break}return d("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value)),e.p=5,e.n=6,p(t.data.value);case 6:e.n=8;break;case 7:e.p=7,s("ERROR",e.v.toString());case 8:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.n=12;break}return d("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.keyFormat)),e.p=9,e.n=10,m(t.data.value,t.data.keyFormat);case 10:e.n=12;break;case 11:e.p=11,s("ERROR",e.v.toString());case 12:return e.a(2)}},e,null,[[9,11],[5,7],[1,3]])}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("inject-import-bundle").addEventListener("click",function(){var e=u(o().m(function e(t){return o().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"INJECT_IMPORT_BUNDLE",value:document.getElementById("import-bundle").value,organizationId:document.getElementById("organization-id").value,userId:document.getElementById("user-id").value});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-wallet-bundle").addEventListener("click",function(){var e=u(o().m(function e(t){return o().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_WALLET_ENCRYPTED_BUNDLE",value:document.getElementById("wallet-plaintext").value});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-key-bundle").addEventListener("click",function(){var e=u(o().m(function e(t){return o().w(function(e){for(;;)switch(e.n){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_KEY_ENCRYPTED_BUNDLE",value:document.getElementById("key-plaintext").value,keyFormat:document.getElementById("key-import-format").value});case 1:return e.a(2)}},e)}));return function(t){return e.apply(this,arguments)}}(),!1);case 1:return e.a(2)}},e)})),!1)}},i={};function c(e){var t=i[e];if(void 0!==t)return t.exports;var r=i[e]={exports:{}};return o[e](r,r.exports,c),r.exports}c.m=o,e=[],c.O=(t,r,n,a)=>{if(!r){var o=1/0;for(s=0;s=a)&&Object.keys(c.O).every(e=>c.O[e](r[u]))?r.splice(u--,1):(i=!1,a0&&e[s-1][2]>a;s--)e[s]=e[s-1];e[s]=[r,n,a]},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,n){if(1&n&&(e=this(e)),8&n)return e;if("object"==typeof e&&e){if(4&n&&e.__esModule)return e;if(16&n&&"function"==typeof e.then)return e}var a=Object.create(null);c.r(a);var o={};t=t||[null,r({}),r([]),r(r)];for(var i=2&n&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=r(i))Object.getOwnPropertyNames(i).forEach(t=>o[t]=()=>e[t]);return o.default=()=>e,c.d(a,o),a},c.d=(e,t)=>{for(var r in t)c.o(t,r)&&!c.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce((t,r)=>(c.f[r](e,t),t),[])),c.u=e=>e+".bundle."+{122:"6023d312a2998e76e8e3",640:"c7459778221ad1c9e84a"}[e]+".js",c.miniCssF=e=>{},c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n={},a="@turnkey/frames-import:",c.l=(e,t,r,o)=>{if(n[e])n[e].push(t);else{var i,u;if(void 0!==r)for(var d=document.getElementsByTagName("script"),s=0;s{i.onerror=i.onload=null,clearTimeout(p);var a=n[e];if(delete n[e],i.parentNode&&i.parentNode.removeChild(i),a&&a.forEach(e=>e(r)),t)return t(r)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),u&&document.head.appendChild(i)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.p="/",(()=>{var e={362:0};c.f.j=(t,r)=>{var n=c.o(e,t)?e[t]:void 0;if(0!==n)if(n)r.push(n[2]);else{var a=new Promise((r,a)=>n=e[t]=[r,a]);r.push(n[2]=a);var o=c.p+c.u(t),i=new Error;c.l(o,r=>{if(c.o(e,t)&&(0!==(n=e[t])&&(e[t]=void 0),n)){var a=r&&("load"===r.type?"missing":r.type),o=r&&r.target&&r.target.src;i.message="Loading chunk "+t+" failed.\n("+a+": "+o+")",i.name="ChunkLoadError",i.type=a,i.request=o,n[1](i)}},"chunk-"+t,t)}},c.O.j=t=>0===e[t];var t=(t,r)=>{var n,a,[o,i,u]=r,d=0;if(o.some(t=>0!==e[t])){for(n in i)c.o(i,n)&&(c.m[n]=i[n]);if(u)var s=u(c)}for(t&&t(r);dc(274));u=c.O(u)})(); +//# sourceMappingURL=standalone.bundle.8e98d36b6446c5926864.js.map \ No newline at end of file diff --git a/import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.LICENSE.txt b/import/dist/standalone.bundle.8e98d36b6446c5926864.js.LICENSE.txt similarity index 100% rename from import/dist/index.bundle.5f5e5ca1b811d13b75e8.js.LICENSE.txt rename to import/dist/standalone.bundle.8e98d36b6446c5926864.js.LICENSE.txt diff --git a/import/dist/standalone.bundle.8e98d36b6446c5926864.js.map b/import/dist/standalone.bundle.8e98d36b6446c5926864.js.map new file mode 100644 index 00000000..f1805400 --- /dev/null +++ b/import/dist/standalone.bundle.8e98d36b6446c5926864.js.map @@ -0,0 +1 @@ +{"version":3,"file":"standalone.bundle.8e98d36b6446c5926864.js","mappings":";uBAAAA,ECCAC,EADAC,ECAAC,EACAC,sDCAA,IAAAC,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,EAAAC,EAAAX,GAAA,GAAAY,GAAA,EAAAC,EAAA,CAAAF,EAAA,EAAAb,EAAA,EAAAgB,EAAApB,EAAAqB,EAAAC,EAAAN,EAAAM,EAAAC,KAAAvB,EAAA,GAAAsB,EAAA,SAAArB,EAAAC,GAAA,OAAAM,EAAAP,EAAAQ,EAAA,EAAAG,EAAAZ,EAAAmB,EAAAf,EAAAF,EAAAmB,CAAA,YAAAC,EAAApB,EAAAE,GAAA,IAAAK,EAAAP,EAAAU,EAAAR,EAAAH,EAAA,GAAAiB,GAAAF,IAAAV,GAAAL,EAAAgB,EAAAO,OAAAvB,IAAA,KAAAK,EAAAE,EAAAS,EAAAhB,GAAAqB,EAAAH,EAAAF,EAAAQ,EAAAjB,EAAA,GAAAN,EAAA,GAAAI,EAAAmB,IAAArB,KAAAQ,EAAAJ,GAAAC,EAAAD,EAAA,OAAAC,EA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nkey/frames-import/webpack/runtime/chunk loaded","webpack://@turnkey/frames-import/webpack/runtime/create fake namespace object","webpack://@turnkey/frames-import/webpack/runtime/load script","webpack://@turnkey/frames-import/./src/standalone.js","webpack://@turnkey/frames-import/webpack/bootstrap","webpack://@turnkey/frames-import/webpack/runtime/define property getters","webpack://@turnkey/frames-import/webpack/runtime/ensure chunk","webpack://@turnkey/frames-import/webpack/runtime/get javascript chunk filename","webpack://@turnkey/frames-import/webpack/runtime/get mini-css chunk filename","webpack://@turnkey/frames-import/webpack/runtime/hasOwnProperty shorthand","webpack://@turnkey/frames-import/webpack/runtime/make namespace object","webpack://@turnkey/frames-import/webpack/runtime/publicPath","webpack://@turnkey/frames-import/webpack/runtime/jsonp chunk loading","webpack://@turnkey/frames-import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"@turnkey/frames-import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./standalone-styles.css\";\nimport * as TKHQ from \"./turnkey-core.js\";\nimport { HpkeEncrypt } from \"@turnkey/frames-shared\";\n\n// Make TKHQ available globally\nwindow.TKHQ = TKHQ;\n\n/**\n * Function to log a message and persist it in the page's DOM.\n */\nfunction logMessage(content) {\n const messageLog = document.getElementById(\"message-log\");\n const message = document.createElement(\"p\");\n message.innerText = content;\n messageLog.appendChild(message);\n}\n\n/**\n * Standalone-specific sendMessageUp that logs to DOM instead\n */\nfunction sendMessageUpStandalone(type, value) {\n if (window.top !== null) {\n window.top.postMessage(\n {\n type: type,\n value: value,\n },\n \"*\"\n );\n }\n logMessage(`⬆️ Sent message ${type}: ${value}`);\n}\n\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async () => {\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n sendMessageUpStandalone(\"PUBLIC_KEY_READY\", \"\");\n\n // TODO: find a way to filter messages and ensure they're coming from the parent window?\n // We do not want to arbitrarily receive messages from all origins.\n window.addEventListener(\n \"message\",\n async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"organizationId\"]}, ${event.data[\"userId\"]}`\n );\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n // TODO: deprecate EXTRACT_WALLET_ENCRYPTED_BUNDLE in favor of EXTRACT_ENCRYPTED_BUNDLE\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}`\n );\n try {\n await onExtractWalletEncryptedBundle(event.data[\"value\"]);\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"keyFormat\"]}`\n );\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"value\"],\n event.data[\"keyFormat\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n },\n false\n );\n\n /**\n * Event handlers to power the import flow in standalone mode\n * Instead of receiving events from the parent page, forms trigger them.\n * This is useful for debugging as well.\n */\n document.getElementById(\"inject-import-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"INJECT_IMPORT_BUNDLE\",\n value: document.getElementById(\"import-bundle\").value,\n organizationId: document.getElementById(\"organization-id\").value,\n userId: document.getElementById(\"user-id\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-wallet-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"wallet-plaintext\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-key-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_KEY_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"key-plaintext\").value,\n keyFormat: document.getElementById(\"key-import-format\").value,\n });\n },\n false\n );\n },\n false\n);\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\": {\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n }\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n sendMessageUpStandalone(\"BUNDLE_INJECTED\", true);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractWalletEncryptedBundle(plaintextValue) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n const plaintextBuf = new TextEncoder().encode(plaintext);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractKeyEncryptedBundle(plaintextValue, keyFormat) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\n// HpkeEncrypt is now imported from @turnkey/frames-shared\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"122\":\"6023d312a2998e76e8e3\",\"640\":\"c7459778221ad1c9e84a\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t362: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunk_turnkey_frames_import\"] = self[\"webpackChunk_turnkey_frames_import\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,931], () => (__webpack_require__(274)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","this","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","logMessage","content","messageLog","document","getElementById","message","createElement","innerText","appendChild","sendMessageUpStandalone","type","window","top","postMessage","concat","onInjectImportBundle","_x5","_x6","_x7","_onInjectImportBundle","_callee6","bundle","organizationId","userId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","_t4","_context6","JSON","parse","version","data","Error","dataSignature","enclaveQuorumPublic","TKHQ","TextDecoder","decode","console","warn","targetPublic","Uint8Array","onExtractWalletEncryptedBundle","_x8","_onExtractWalletEncryptedBundle","_callee7","plaintextValue","plaintext","plaintextBuf","encryptedBundle","_context7","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","onExtractKeyEncryptedBundle","_x9","_x0","_onExtractKeyEncryptedBundle","_callee8","keyFormat","_context8","addEventListener","_callee5","_context5","_ref2","_callee","event","_context","toString","_x","_ref3","_callee2","_context2","preventDefault","_x2","_ref4","_callee3","_context3","_x3","_ref5","_callee4","_context4","_x4","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","charset","nc","setAttribute","src","onScriptComplete","prev","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","target","head","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","name","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js b/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js deleted file mode 100644 index 7637b3bc..00000000 --- a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js +++ /dev/null @@ -1,3 +0,0 @@ -/*! For license information please see standalone.bundle.dd1ecee048c1237db1f7.js.LICENSE.txt */ -(()=>{"use strict";var e,t,n,r,o,a={635:(e,t,n)=>{var r=n(482),o=n(584);function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}function i(){var e=l(),t=e.m(i),n=(Object.getPrototypeOf?Object.getPrototypeOf(t):t.__proto__).constructor;function r(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===n||"GeneratorFunction"===(t.displayName||t.name))}var o={throw:1,return:2,break:3,continue:3};function a(e){var t,n;return function(r){t||(t={stop:function(){return n(r.a,2)},catch:function(){return r.v},abrupt:function(e,t){return n(r.a,o[e],t)},delegateYield:function(e,o,a){return t.resultName=o,n(r.d,u(e),a)},finish:function(e){return n(r.f,e)}},n=function(e,n,o){r.p=t.prev,r.n=t.next;try{return e(n,o)}finally{t.next=r.n}}),t.resultName&&(t[t.resultName]=r.v,t.resultName=void 0),t.sent=r.v,t.next=r.n;try{return e.call(this,t)}finally{r.p=t.prev,r.n=t.next}}}return(i=function(){return{wrap:function(t,n,r,o){return e.w(a(t),n,r,o&&o.reverse())},isGeneratorFunction:r,mark:e.m,awrap:function(e,t){return new v(e,t)},AsyncIterator:d,async:function(e,t,n,o,i){return(r(t)?f:s)(a(e),t,n,o,i)},keys:c,values:u}})()}function u(e){if(null!=e){var t=e["function"==typeof Symbol&&Symbol.iterator||"@@iterator"],n=0;if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length))return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}throw new TypeError(a(e)+" is not iterable")}function c(e){var t=Object(e),n=[];for(var r in t)n.unshift(r);return function e(){for(;n.length;)if((r=n.pop())in t)return e.value=r,e.done=!1,e;return e.done=!0,e}}function s(e,t,n,r,o){var a=f(e,t,n,r,o);return a.next().then(function(e){return e.done?e.value:a.next()})}function f(e,t,n,r,o){return new d(l().w(e,t,n,r),o||Promise)}function d(e,t){function n(r,o,a,i){try{var u=e[r](o),c=u.value;return c instanceof v?t.resolve(c.v).then(function(e){n("next",e,a,i)},function(e){n("throw",e,a,i)}):t.resolve(c).then(function(e){u.value=e,a(u)},function(e){return n("throw",e,a,i)})}catch(e){i(e)}}var r;this.next||(p(d.prototype),p(d.prototype,"function"==typeof Symbol&&Symbol.asyncIterator||"@asyncIterator",function(){return this})),p(this,"_invoke",function(e,o,a){function i(){return new t(function(t,r){n(e,a,t,r)})}return r=r?r.then(i,i):i()},!0)}function l(){var e,t,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",o=n.toStringTag||"@@toStringTag";function a(n,r,o,a){var c=r&&r.prototype instanceof u?r:u,s=Object.create(c.prototype);return p(s,"_invoke",function(n,r,o){var a,u,c,s=0,f=o||[],d=!1,l={p:0,n:0,v:e,a:p,f:p.bind(e,4),d:function(t,n){return a=t,u=0,c=e,l.n=n,i}};function p(n,r){for(u=n,c=r,t=0;!d&&s&&!o&&t3?(o=v===r)&&(c=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=e):a[0]<=p&&((o=n<2&&pr||r>v)&&(a[4]=n,a[5]=r,l.n=v,u=0))}if(o||n>1)return i;throw d=!0,r}return function(o,f,v){if(s>1)throw TypeError("Generator is already running");for(d&&1===f&&p(f,v),u=f,c=v;(t=u<2?e:c)||!d;){a||(u?u<3?(u>1&&(l.n=-1),p(u,c)):l.n=c:l.v=c);try{if(s=2,a){if(u||(o="next"),t=a[o]){if(!(t=t.call(a,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,u<2&&(u=0)}else 1===u&&(t=a.return)&&t.call(a),u<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=e}else if((t=(d=l.n<0)?c:n.call(r,l))!==i)break}catch(t){a=e,u=1,c=t}finally{s=1}}return{value:t,done:d}}}(n,o,a),!0),s}var i={};function u(){}function c(){}function s(){}t=Object.getPrototypeOf;var f=[][r]?t(t([][r]())):(p(t={},r,function(){return this}),t),d=s.prototype=u.prototype=Object.create(f);function v(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,s):(e.__proto__=s,p(e,o,"GeneratorFunction")),e.prototype=Object.create(d),e}return c.prototype=s,p(d,"constructor",s),p(s,"constructor",c),c.displayName="GeneratorFunction",p(s,o,"GeneratorFunction"),p(d),p(d,o,"Generator"),p(d,r,function(){return this}),p(d,"toString",function(){return"[object Generator]"}),(l=function(){return{w:a,m:v}})()}function p(e,t,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}p=function(e,t,n,r){function a(t,n){p(e,t,function(e){return this._invoke(t,n,e)})}t?o?o(e,t,{value:n,enumerable:!r,configurable:!r,writable:!r}):e[t]=n:(a("next",0),a("throw",1),a("return",2))},p(e,t,n,r)}function v(e,t){this.v=e,this.k=t}function y(e,t,n,r,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void n(e)}u.done?t(c):Promise.resolve(c).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){y(a,r,o,i,u,"next",e)}function u(e){y(a,r,o,i,u,"throw",e)}i(void 0)})}}function b(e){var t=document.getElementById("message-log"),n=document.createElement("p");n.innerText=e,t.appendChild(n)}function h(e,t){null!==window.top&&window.top.postMessage({type:e,value:t},"*"),b("⬆️ Sent message ".concat(e,": ").concat(t))}function g(e,t,n){return w.apply(this,arguments)}function w(){return(w=m(i().mark(function e(t,n,o){var a,u,c,s;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:u=JSON.parse(t),e.t0=u.version,e.next="v1.0.0"===e.t0?4:34;break;case 4:if(u.data){e.next=6;break}throw new Error('missing "data" in bundle');case 6:if(u.dataSignature){e.next=8;break}throw new Error('missing "dataSignature" in bundle');case 8:if(u.enclaveQuorumPublic){e.next=10;break}throw new Error('missing "enclaveQuorumPublic" in bundle');case 10:if(r.verifyEnclaveSignature){e.next=12;break}throw new Error("method not loaded");case 12:return e.next=14,r.verifyEnclaveSignature(u.enclaveQuorumPublic,u.dataSignature,u.data);case 14:if(e.sent){e.next=17;break}throw new Error("failed to verify enclave signature: ".concat(t));case 17:if(c=JSON.parse((new TextDecoder).decode(r.uint8arrayFromHexString(u.data))),n){e.next=22;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "organizationId" for security purposes.'),e.next=24;break;case 22:if(c.organizationId&&c.organizationId===n){e.next=24;break}throw new Error("organization id does not match expected value. Expected: ".concat(n,". Found: ").concat(c.organizationId,"."));case 24:if(o){e.next=28;break}console.warn('we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass "userId" for security purposes.'),e.next=30;break;case 28:if(c.userId&&c.userId===o){e.next=30;break}throw new Error("user id does not match expected value. Expected: ".concat(o,". Found: ").concat(c.userId,"."));case 30:if(c.targetPublic){e.next=32;break}throw new Error('missing "targetPublic" in bundle signed data');case 32:return a=r.uint8arrayFromHexString(c.targetPublic),e.abrupt("break",35);case 34:throw new Error("unsupported version: ".concat(u.version));case 35:return e.next=37,r.loadTargetKey(new Uint8Array(a));case 37:s=e.sent,r.setTargetEmbeddedKey(s),h("BUNDLE_INJECTED",!0);case 40:case"end":return e.stop()}},e)}))).apply(this,arguments)}function E(e){return x.apply(this,arguments)}function x(){return(x=m(i().mark(function e(t){var n,a,u,c;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=r.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(a=t.trim()){e.next=6;break}throw new Error("no wallet mnemonic entered");case 6:return u=(new TextEncoder).encode(a),e.next=9,(0,o.q)({plaintextBuf:u,receiverPubJwk:n});case 9:c=e.sent,r.resetTargetEmbeddedKey(),h("ENCRYPTED_BUNDLE_EXTRACTED",c);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(e,t){return T.apply(this,arguments)}function T(){return(T=m(i().mark(function e(t,n){var a,u,c,s;return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(a=r.getTargetEmbeddedKey())){e.next=3;break}throw new Error("no target key found");case 3:if(u=t.trim()){e.next=6;break}throw new Error("no private key entered");case 6:return c=r.decodeKey(u,n),e.next=9,(0,o.q)({plaintextBuf:c,receiverPubJwk:a});case 9:s=e.sent,r.resetTargetEmbeddedKey(),h("ENCRYPTED_BUNDLE_EXTRACTED",s);case 12:case"end":return e.stop()}},e)}))).apply(this,arguments)}window.TKHQ=r,document.addEventListener("DOMContentLoaded",m(i().mark(function e(){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:h("PUBLIC_KEY_READY",""),window.addEventListener("message",function(){var e=m(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.data||"INJECT_IMPORT_BUNDLE"!=t.data.type){e.next=10;break}return b("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.organizationId,", ").concat(t.data.userId)),e.prev=2,e.next=5,g(t.data.value,t.data.organizationId,t.data.userId);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),h("ERROR",e.t0.toString());case 10:if(!t.data||"EXTRACT_WALLET_ENCRYPTED_BUNDLE"!=t.data.type){e.next=20;break}return b("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value)),e.prev=12,e.next=15,E(t.data.value);case 15:e.next=20;break;case 17:e.prev=17,e.t1=e.catch(12),h("ERROR",e.t1.toString());case 20:if(!t.data||"EXTRACT_KEY_ENCRYPTED_BUNDLE"!=t.data.type){e.next=30;break}return b("⬇️ Received message ".concat(t.data.type,": ").concat(t.data.value,", ").concat(t.data.keyFormat)),e.prev=22,e.next=25,k(t.data.value,t.data.keyFormat);case 25:e.next=30;break;case 27:e.prev=27,e.t2=e.catch(22),h("ERROR",e.t2.toString());case 30:case"end":return e.stop()}},e,null,[[2,7],[12,17],[22,27]])}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("inject-import-bundle").addEventListener("click",function(){var e=m(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"INJECT_IMPORT_BUNDLE",value:document.getElementById("import-bundle").value,organizationId:document.getElementById("organization-id").value,userId:document.getElementById("user-id").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-wallet-bundle").addEventListener("click",function(){var e=m(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_WALLET_ENCRYPTED_BUNDLE",value:document.getElementById("wallet-plaintext").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1),document.getElementById("encrypt-key-bundle").addEventListener("click",function(){var e=m(i().mark(function e(t){return i().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.preventDefault(),window.postMessage({type:"EXTRACT_KEY_ENCRYPTED_BUNDLE",value:document.getElementById("key-plaintext").value,keyFormat:document.getElementById("key-import-format").value});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),!1);case 5:case"end":return e.stop()}},e)})),!1)}},i={};function u(e){var t=i[e];if(void 0!==t)return t.exports;var n=i[e]={exports:{}};return a[e](n,n.exports,u),n.exports}u.m=a,e=[],u.O=(t,n,r,o)=>{if(!n){var a=1/0;for(f=0;f=o)&&Object.keys(u.O).every(e=>u.O[e](n[c]))?n.splice(c--,1):(i=!1,o0&&e[f-1][2]>o;f--)e[f]=e[f-1];e[f]=[n,r,o]},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,u.t=function(e,r){if(1&r&&(e=this(e)),8&r)return e;if("object"==typeof e&&e){if(4&r&&e.__esModule)return e;if(16&r&&"function"==typeof e.then)return e}var o=Object.create(null);u.r(o);var a={};t=t||[null,n({}),n([]),n(n)];for(var i=2&r&&e;("object"==typeof i||"function"==typeof i)&&!~t.indexOf(i);i=n(i))Object.getOwnPropertyNames(i).forEach(t=>a[t]=()=>e[t]);return a.default=()=>e,u.d(o,a),o},u.d=(e,t)=>{for(var n in t)u.o(t,n)&&!u.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},u.f={},u.e=e=>Promise.all(Object.keys(u.f).reduce((t,n)=>(u.f[n](e,t),t),[])),u.u=e=>e+".bundle."+{291:"b62abe64ba4ebf68e89b",825:"3a4aff0e743a7540fe25"}[e]+".js",u.miniCssF=e=>{},u.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),u.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r={},o="import:",u.l=(e,t,n,a)=>{if(r[e])r[e].push(t);else{var i,c;if(void 0!==n)for(var s=document.getElementsByTagName("script"),f=0;f{i.onerror=i.onload=null,clearTimeout(p);var o=r[e];if(delete r[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(n)),t)return t(n)},p=setTimeout(l.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=l.bind(null,i.onerror),i.onload=l.bind(null,i.onload),c&&document.head.appendChild(i)}},u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.p="/",(()=>{var e={362:0};u.f.j=(t,n)=>{var r=u.o(e,t)?e[t]:void 0;if(0!==r)if(r)n.push(r[2]);else{var o=new Promise((n,o)=>r=e[t]=[n,o]);n.push(r[2]=o);var a=u.p+u.u(t),i=new Error;u.l(a,n=>{if(u.o(e,t)&&(0!==(r=e[t])&&(e[t]=void 0),r)){var o=n&&("load"===n.type?"missing":n.type),a=n&&n.target&&n.target.src;i.message="Loading chunk "+t+" failed.\n("+o+": "+a+")",i.name="ChunkLoadError",i.type=o,i.request=a,r[1](i)}},"chunk-"+t,t)}},u.O.j=t=>0===e[t];var t=(t,n)=>{var r,o,[a,i,c]=n,s=0;if(a.some(t=>0!==e[t])){for(r in i)u.o(i,r)&&(u.m[r]=i[r]);if(c)var f=c(u)}for(t&&t(n);su(635));c=u.O(c)})(); -//# sourceMappingURL=standalone.bundle.dd1ecee048c1237db1f7.js.map \ No newline at end of file diff --git a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.LICENSE.txt b/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.LICENSE.txt deleted file mode 100644 index 775d3936..00000000 --- a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.LICENSE.txt +++ /dev/null @@ -1 +0,0 @@ -/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ diff --git a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.map b/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.map deleted file mode 100644 index eaed39ab..00000000 --- a/import/dist/standalone.bundle.dd1ecee048c1237db1f7.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"standalone.bundle.dd1ecee048c1237db1f7.js","mappings":";uBAAIA,ECCAC,EADAC,ECAAC,EACAC,E,24ECAJ,IAAAC,EAAAC,EAAAC,EAAA,mBAAAC,OAAAA,OAAA,GAAAC,EAAAF,EAAAG,UAAA,aAAAC,EAAAJ,EAAAK,aAAA,yBAAAC,EAAAN,EAAAE,EAAAE,EAAAE,GAAA,IAAAC,EAAAL,GAAAA,EAAAM,qBAAAC,EAAAP,EAAAO,EAAAC,EAAAC,OAAAC,OAAAL,EAAAC,WAAA,OAAAK,EAAAH,EAAA,mBAAAV,EAAAE,EAAAE,GAAA,IAAAE,EAAAC,EAAAG,EAAAI,EAAA,EAAAC,EAAAX,GAAA,GAAAY,GAAA,EAAAC,EAAA,CAAAF,EAAA,EAAAb,EAAA,EAAAgB,EAAApB,EAAAqB,EAAAC,EAAAN,EAAAM,EAAAC,KAAAvB,EAAA,GAAAsB,EAAA,SAAArB,EAAAC,GAAA,OAAAM,EAAAP,EAAAQ,EAAA,EAAAG,EAAAZ,EAAAmB,EAAAf,EAAAF,EAAAmB,CAAA,YAAAC,EAAApB,EAAAE,GAAA,IAAAK,EAAAP,EAAAU,EAAAR,EAAAH,EAAA,GAAAiB,GAAAF,IAAAV,GAAAL,EAAAgB,EAAAO,OAAAvB,IAAA,KAAAK,EAAAE,EAAAS,EAAAhB,GAAAqB,EAAAH,EAAAF,EAAAQ,EAAAjB,EAAA,GAAAN,EAAA,GAAAI,EAAAmB,IAAArB,KAAAQ,EAAAJ,GAAAC,EAAAD,EAAA,OAAAC,EAAA,MAAAD,EAAA,GAAAA,EAAA,GAAAR,GAAAQ,EAAA,IAAAc,KAAAhB,EAAAJ,EA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J,EAAE+N,EAAa3E,KACrCD,EAAoBnH,EAAEoH,GAAY2E,EAAY3E,IAGhD,GAAG4E,EAAS,IAAIrE,EAASqE,EAAQ7E,EAClC,CAEA,IADG2E,GAA4BA,EAA2BvI,GACrDrF,EAAI0J,EAAS1I,OAAQhB,IACzBiL,EAAUvB,EAAS1J,GAChBiJ,EAAoBnJ,EAAEoN,EAAiBjC,IAAYiC,EAAgBjC,IACrEiC,EAAgBjC,GAAS,KAE1BiC,EAAgBjC,GAAW,EAE5B,OAAOhC,EAAoBO,EAAEC,IAG1BwE,EAAqBC,KAAyB,mBAAIA,KAAyB,oBAAK,GACpFD,EAAmBnD,QAAQ6C,EAAqB5M,KAAK,KAAM,IAC3DkN,EAAmBrC,KAAO+B,EAAqB5M,KAAK,KAAMkN,EAAmBrC,KAAK7K,KAAKkN,G,KClFvF,IAAIE,EAAsBlF,EAAoBO,OAAEJ,EAAW,CAAC,GAAG,KAAM,IAAOH,EAAoB,MAChGkF,EAAsBlF,EAAoBO,EAAE2E,E","sources":["webpack://import/webpack/runtime/chunk loaded","webpack://import/webpack/runtime/create fake namespace object","webpack://import/webpack/runtime/load script","webpack://import/./src/standalone.js","webpack://import/webpack/bootstrap","webpack://import/webpack/runtime/define property getters","webpack://import/webpack/runtime/ensure chunk","webpack://import/webpack/runtime/get javascript chunk filename","webpack://import/webpack/runtime/get mini-css chunk filename","webpack://import/webpack/runtime/global","webpack://import/webpack/runtime/hasOwnProperty shorthand","webpack://import/webpack/runtime/make namespace object","webpack://import/webpack/runtime/publicPath","webpack://import/webpack/runtime/jsonp chunk loading","webpack://import/webpack/startup"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; (typeof current == 'object' || typeof current == 'function') && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));\n\t}\n\tdef['default'] = () => (value);\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","var inProgress = {};\nvar dataWebpackPrefix = \"import:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\n\t\tscript.charset = 'utf-8';\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\n\t\tscript.src = url;\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","import \"./standalone-styles.css\";\nimport * as TKHQ from \"./turnkey-core.js\";\nimport { HpkeEncrypt } from \"@shared/crypto-utils.js\";\n\n// Make TKHQ available globally\nwindow.TKHQ = TKHQ;\n\n/**\n * Function to log a message and persist it in the page's DOM.\n */\nfunction logMessage(content) {\n const messageLog = document.getElementById(\"message-log\");\n const message = document.createElement(\"p\");\n message.innerText = content;\n messageLog.appendChild(message);\n}\n\n/**\n * Standalone-specific sendMessageUp that logs to DOM instead\n */\nfunction sendMessageUpStandalone(type, value) {\n if (window.top !== null) {\n window.top.postMessage(\n {\n type: type,\n value: value,\n },\n \"*\"\n );\n }\n logMessage(`⬆️ Sent message ${type}: ${value}`);\n}\n\ndocument.addEventListener(\n \"DOMContentLoaded\",\n async () => {\n // This is a workaround for how @turnkey/iframe-stamper is initialized. Currently,\n // init() waits for a public key to be initialized that can be used to send to the server\n // which will encrypt messages to this public key.\n // In the case of import, this public key is not used because the client encrypts messages\n // to the server's public key.\n sendMessageUpStandalone(\"PUBLIC_KEY_READY\", \"\");\n\n // TODO: find a way to filter messages and ensure they're coming from the parent window?\n // We do not want to arbitrarily receive messages from all origins.\n window.addEventListener(\n \"message\",\n async function (event) {\n if (event.data && event.data[\"type\"] == \"INJECT_IMPORT_BUNDLE\") {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"organizationId\"]}, ${event.data[\"userId\"]}`\n );\n try {\n await onInjectImportBundle(\n event.data[\"value\"],\n event.data[\"organizationId\"],\n event.data[\"userId\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n // TODO: deprecate EXTRACT_WALLET_ENCRYPTED_BUNDLE in favor of EXTRACT_ENCRYPTED_BUNDLE\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}`\n );\n try {\n await onExtractWalletEncryptedBundle(event.data[\"value\"]);\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n if (\n event.data &&\n event.data[\"type\"] == \"EXTRACT_KEY_ENCRYPTED_BUNDLE\"\n ) {\n logMessage(\n `⬇️ Received message ${event.data[\"type\"]}: ${event.data[\"value\"]}, ${event.data[\"keyFormat\"]}`\n );\n try {\n await onExtractKeyEncryptedBundle(\n event.data[\"value\"],\n event.data[\"keyFormat\"]\n );\n } catch (e) {\n sendMessageUpStandalone(\"ERROR\", e.toString());\n }\n }\n },\n false\n );\n\n /**\n * Event handlers to power the import flow in standalone mode\n * Instead of receiving events from the parent page, forms trigger them.\n * This is useful for debugging as well.\n */\n document.getElementById(\"inject-import-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"INJECT_IMPORT_BUNDLE\",\n value: document.getElementById(\"import-bundle\").value,\n organizationId: document.getElementById(\"organization-id\").value,\n userId: document.getElementById(\"user-id\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-wallet-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_WALLET_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"wallet-plaintext\").value,\n });\n },\n false\n );\n document.getElementById(\"encrypt-key-bundle\").addEventListener(\n \"click\",\n async (e) => {\n e.preventDefault();\n window.postMessage({\n type: \"EXTRACT_KEY_ENCRYPTED_BUNDLE\",\n value: document.getElementById(\"key-plaintext\").value,\n keyFormat: document.getElementById(\"key-import-format\").value,\n });\n },\n false\n );\n },\n false\n);\n\n/**\n * Function triggered when INJECT_IMPORT_BUNDLE event is received.\n * Parses the `import_bundle` and stores the target public key as a JWK\n * in local storage. Sends true upon success.\n * @param {string} bundle\n * Example bundle: {\"targetPublic\":\"0491ccb68758b822a6549257f87769eeed37c6cb68a6c6255c5f238e2b6e6e61838c8ac857f2e305970a6435715f84e5a2e4b02a4d1e5289ba7ec7910e47d2d50f\",\"targetPublicSignature\":\"3045022100cefc333c330c9fa300d1aa10a439a76539b4d6967301638ab9edc9fd9468bfdb0220339bba7e2b00b45d52e941d068ecd3bfd16fd1926da69dd7769893268990d62f\",\"enclaveQuorumPublic\":\"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\"}\n * @param {string} organizationId\n * @param {string} userId\n */\nasync function onInjectImportBundle(bundle, organizationId, userId) {\n let targetPublicBuf;\n let verified;\n\n // Parse the import bundle\n const bundleObj = JSON.parse(bundle);\n\n switch (bundleObj.version) {\n case \"v1.0.0\": {\n // Validate fields exist\n if (!bundleObj.data) {\n throw new Error('missing \"data\" in bundle');\n }\n if (!bundleObj.dataSignature) {\n throw new Error('missing \"dataSignature\" in bundle');\n }\n if (!bundleObj.enclaveQuorumPublic) {\n throw new Error('missing \"enclaveQuorumPublic\" in bundle');\n }\n\n // Verify enclave signature\n if (!TKHQ.verifyEnclaveSignature) {\n throw new Error(\"method not loaded\");\n }\n verified = await TKHQ.verifyEnclaveSignature(\n bundleObj.enclaveQuorumPublic,\n bundleObj.dataSignature,\n bundleObj.data\n );\n if (!verified) {\n throw new Error(`failed to verify enclave signature: ${bundle}`);\n }\n\n // Parse the signed data. The data is produced by JSON encoding followed by hex encoding. We reverse this here.\n const signedData = JSON.parse(\n new TextDecoder().decode(TKHQ.uint8arrayFromHexString(bundleObj.data))\n );\n\n // Validate fields match\n if (!organizationId) {\n // TODO: throw error if organization id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"organizationId\" for security purposes.'\n );\n } else if (\n !signedData.organizationId ||\n signedData.organizationId !== organizationId\n ) {\n throw new Error(\n `organization id does not match expected value. Expected: ${organizationId}. Found: ${signedData.organizationId}.`\n );\n }\n if (!userId) {\n // TODO: throw error if user id is undefined once we've fully transitioned to v1.0.0 server messages and v2.0.0 iframe-stamper\n console.warn(\n 'we highly recommend a version of @turnkey/iframe-stamper >= v2.0.0 to pass \"userId\" for security purposes.'\n );\n } else if (!signedData.userId || signedData.userId !== userId) {\n throw new Error(\n `user id does not match expected value. Expected: ${userId}. Found: ${signedData.userId}.`\n );\n }\n\n if (!signedData.targetPublic) {\n throw new Error('missing \"targetPublic\" in bundle signed data');\n }\n\n // Load target public key generated from enclave and set in local storage\n targetPublicBuf = TKHQ.uint8arrayFromHexString(signedData.targetPublic);\n break;\n }\n default:\n throw new Error(`unsupported version: ${bundleObj.version}`);\n }\n\n const targetPublicKeyJwk = await TKHQ.loadTargetKey(\n new Uint8Array(targetPublicBuf)\n );\n TKHQ.setTargetEmbeddedKey(targetPublicKeyJwk);\n\n // Send up BUNDLE_INJECTED message\n sendMessageUpStandalone(\"BUNDLE_INJECTED\", true);\n}\n\n/**\n * Function triggered when EXTRACT_WALLET_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractWalletEncryptedBundle(plaintextValue) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext wallet mnemonic\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no wallet mnemonic entered\");\n }\n const plaintextBuf = new TextEncoder().encode(plaintext);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\n/**\n * Function triggered when EXTRACT_KEY_ENCRYPTED_BUNDLE event is received.\n * Prerequisite: This function uses the target public key in local storage that is imported\n * from the INJECT_IMPORT_BUNDLE event.\n * Uses the target public key in local storage to encrypt the plaintextValue. Upon successful encryption, sends\n * an `encrypted_bundle` containing the ciphertext and encapped public key.\n * Example bundle: {\"encappedPublic\":\"0497f33f3306f67f4402d4824e15b63b04786b6558d417aac2fef69051e46fa7bfbe776b142e4ded4f02097617a7588e93c53b71f900a4a8831a31be6f95e5f60f\",\"ciphertext\":\"c17c3085505f3c094f0fa61791395b83ab1d8c90bdf9f12a64fc6e2e9cba266beb528f65c88bd933e36e6203752a9b63e6a92290a0ab6bf0ed591cf7bfa08006001e2cc63870165dc99ec61554ffdc14dea7d567e62cceed29314ae6c71a013843f5c06146dee5bf9c1d\"}\n */\nasync function onExtractKeyEncryptedBundle(plaintextValue, keyFormat) {\n // Get target embedded key from previous step (onInjectImportBundle)\n const targetPublicKeyJwk = TKHQ.getTargetEmbeddedKey();\n if (targetPublicKeyJwk == null) {\n throw new Error(\"no target key found\");\n }\n\n // Get plaintext private key\n const plaintext = plaintextValue.trim();\n if (!plaintext) {\n throw new Error(\"no private key entered\");\n }\n const plaintextBuf = TKHQ.decodeKey(plaintext, keyFormat);\n\n // Encrypt the bundle using the enclave target public key\n const encryptedBundle = await HpkeEncrypt({\n plaintextBuf,\n receiverPubJwk: targetPublicKeyJwk,\n });\n\n // Reset target embedded key after using for encryption\n TKHQ.resetTargetEmbeddedKey();\n\n // Send up ENCRYPTED_BUNDLE_EXTRACTED message\n sendMessageUpStandalone(\"ENCRYPTED_BUNDLE_EXTRACTED\", encryptedBundle);\n}\n\n// HpkeEncrypt is now imported from @shared/crypto-utils.js\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + chunkId + \".bundle.\" + {\"291\":\"b62abe64ba4ebf68e89b\",\"825\":\"3a4aff0e743a7540fe25\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t362: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(true) { // all chunks have JS\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkimport\"] = self[\"webpackChunkimport\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));","// startup\n// Load entry module and return exports\n// This entry module depends on other loaded chunks and execution need to be delayed\nvar __webpack_exports__ = __webpack_require__.O(undefined, [96,551], () => (__webpack_require__(635)))\n__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n"],"names":["deferred","leafPrototypes","getProto","inProgress","dataWebpackPrefix","e","t","r","Symbol","n","iterator","o","toStringTag","i","c","prototype","Generator","u","Object","create","_regeneratorDefine2","f","p","y","G","v","a","d","bind","length","l","TypeError","call","done","value","GeneratorFunction","GeneratorFunctionPrototype","getPrototypeOf","setPrototypeOf","__proto__","displayName","_regenerator","w","m","defineProperty","_invoke","enumerable","configurable","writable","_OverloadYield","k","asyncGeneratorStep","Promise","resolve","then","_asyncToGenerator","arguments","apply","_next","_throw","logMessage","content","messageLog","document","getElementById","message","createElement","innerText","appendChild","sendMessageUpStandalone","type","window","top","postMessage","concat","onInjectImportBundle","_x5","_x6","_x7","_onInjectImportBundle","_regeneratorRuntime","mark","_callee6","bundle","organizationId","userId","targetPublicBuf","bundleObj","signedData","targetPublicKeyJwk","wrap","_context6","prev","next","JSON","parse","t0","version","data","Error","dataSignature","enclaveQuorumPublic","TKHQ","sent","TextDecoder","decode","console","warn","targetPublic","abrupt","Uint8Array","stop","onExtractWalletEncryptedBundle","_x8","_onExtractWalletEncryptedBundle","_callee7","plaintextValue","plaintext","plaintextBuf","encryptedBundle","_context7","trim","TextEncoder","encode","HpkeEncrypt","receiverPubJwk","onExtractKeyEncryptedBundle","_x9","_x10","_onExtractKeyEncryptedBundle","_callee8","keyFormat","_context8","addEventListener","_callee5","_context5","_ref2","_callee","event","_context","toString","t1","t2","_x","_ref3","_callee2","_context2","preventDefault","_x2","_ref4","_callee3","_context3","_x3","_ref5","_callee4","_context4","_x4","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","exports","module","__webpack_modules__","O","result","chunkIds","fn","priority","notFulfilled","Infinity","fulfilled","j","keys","every","key","splice","obj","mode","this","__esModule","ns","def","current","indexOf","getOwnPropertyNames","forEach","definition","get","chunkId","all","reduce","promises","miniCssF","g","globalThis","Function","prop","hasOwnProperty","url","push","script","needAttach","scripts","getElementsByTagName","s","getAttribute","charset","nc","setAttribute","src","onScriptComplete","onerror","onload","clearTimeout","timeout","doneFns","parentNode","removeChild","setTimeout","target","head","installedChunks","installedChunkData","promise","reject","error","errorType","realSrc","name","request","webpackJsonpCallback","parentChunkLoadingFunction","moreModules","runtime","some","id","chunkLoadingGlobal","self","__webpack_exports__"],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/standalone.html b/import/dist/standalone.html index 4651ff01..0051ae42 100644 --- a/import/dist/standalone.html +++ b/import/dist/standalone.html @@ -1 +1 @@ -Turnkey Import (Standalone Mode)

Initialize Import




Import Wallet


Import Private Key



Message log

Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.

\ No newline at end of file +Turnkey Import (Standalone Mode)

Initialize Import




Import Wallet


Import Private Key



Message log

Below we display a log of the messages sent / received. The forms above send messages, and the code communicates results by sending events via the postMessage API.

\ No newline at end of file diff --git a/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map index ff369e5d..7f94583e 100644 --- a/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map +++ b/import/dist/standalone.styles.a83187f9b253fbae4dcd.css.map @@ -1 +1 @@ -{"version":3,"file":"standalone.styles.a83187f9b253fbae4dcd.css","mappings":"AAAA;EACE,kBAAkB;EAClB;sDACoD;EACpD,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,qBAAqB;EACrB,UAAU;AACZ;;AAEA;;EAEE,WAAW;EACX,aAAa;EACb,8CAA8C;EAC9C,cAAc;EACd,aAAa;EACb,sBAAsB;EACtB,oCAAoC;EACpC,kBAAkB;AACpB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;;;EAGE,YAAY;EACZ,WAAW;EACX,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,iCAAiC;EACjC,iCAAiC;EACjC,eAAe;EACf,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,gBAAgB;EAChB,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,aAAa;AACf","sources":["webpack://import/./src/standalone-styles.css"],"sourcesContent":["body {\n text-align: center;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n max-width: 1024px;\n margin: auto;\n}\n\nform {\n text-align: left;\n margin-bottom: 2rem;\n}\n\nlabel {\n display: inline-block;\n width: 8em;\n}\n\ninput[type=\"text\"],\nselect {\n width: 40em;\n margin: 0.5em;\n font-family: \"Courier New\", Courier, monospace;\n font-size: 1em;\n height: 1.8em;\n color: rgb(18, 87, 18);\n border: 1px rgb(217, 240, 221) solid;\n border-radius: 4px;\n}\n\ninput:disabled {\n background-color: rgb(239, 243, 240);\n}\n\n#inject-import-bundle,\n#encrypt-wallet-bundle,\n#encrypt-key-bundle {\n color: white;\n width: 10em;\n font-size: 1em;\n padding: 0.38em;\n border-radius: 4px;\n background-color: rgb(50, 44, 44);\n border: 1px rgb(33, 33, 33) solid;\n cursor: pointer;\n display: inline;\n}\n\n#message-log {\n border: 1px #2a2828 solid;\n padding: 0 0.7em;\n border-radius: 4px;\n margin-top: 2em;\n max-width: 800px;\n margin: auto;\n display: block;\n}\n\n#message-log p {\n font-size: 0.9em;\n text-align: left;\n word-break: break-all;\n}\n\n.hidden {\n display: none;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"standalone.styles.a83187f9b253fbae4dcd.css","mappings":"AAAA;EACE,kBAAkB;EAClB;sDACoD;EACpD,iBAAiB;EACjB,YAAY;AACd;;AAEA;EACE,gBAAgB;EAChB,mBAAmB;AACrB;;AAEA;EACE,qBAAqB;EACrB,UAAU;AACZ;;AAEA;;EAEE,WAAW;EACX,aAAa;EACb,8CAA8C;EAC9C,cAAc;EACd,aAAa;EACb,sBAAsB;EACtB,oCAAoC;EACpC,kBAAkB;AACpB;;AAEA;EACE,oCAAoC;AACtC;;AAEA;;;EAGE,YAAY;EACZ,WAAW;EACX,cAAc;EACd,eAAe;EACf,kBAAkB;EAClB,iCAAiC;EACjC,iCAAiC;EACjC,eAAe;EACf,eAAe;AACjB;;AAEA;EACE,yBAAyB;EACzB,gBAAgB;EAChB,kBAAkB;EAClB,eAAe;EACf,gBAAgB;EAChB,YAAY;EACZ,cAAc;AAChB;;AAEA;EACE,gBAAgB;EAChB,gBAAgB;EAChB,qBAAqB;AACvB;;AAEA;EACE,aAAa;AACf","sources":["webpack://@turnkey/frames-import/./src/standalone-styles.css"],"sourcesContent":["body {\n text-align: center;\n font-family: \"Lucida Sans\", \"Lucida Sans Regular\", \"Lucida Grande\",\n \"Lucida Sans Unicode\", Geneva, Verdana, sans-serif;\n max-width: 1024px;\n margin: auto;\n}\n\nform {\n text-align: left;\n margin-bottom: 2rem;\n}\n\nlabel {\n display: inline-block;\n width: 8em;\n}\n\ninput[type=\"text\"],\nselect {\n width: 40em;\n margin: 0.5em;\n font-family: \"Courier New\", Courier, monospace;\n font-size: 1em;\n height: 1.8em;\n color: rgb(18, 87, 18);\n border: 1px rgb(217, 240, 221) solid;\n border-radius: 4px;\n}\n\ninput:disabled {\n background-color: rgb(239, 243, 240);\n}\n\n#inject-import-bundle,\n#encrypt-wallet-bundle,\n#encrypt-key-bundle {\n color: white;\n width: 10em;\n font-size: 1em;\n padding: 0.38em;\n border-radius: 4px;\n background-color: rgb(50, 44, 44);\n border: 1px rgb(33, 33, 33) solid;\n cursor: pointer;\n display: inline;\n}\n\n#message-log {\n border: 1px #2a2828 solid;\n padding: 0 0.7em;\n border-radius: 4px;\n margin-top: 2em;\n max-width: 800px;\n margin: auto;\n display: block;\n}\n\n#message-log p {\n font-size: 0.9em;\n text-align: left;\n word-break: break-all;\n}\n\n.hidden {\n display: none;\n}\n"],"names":[],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/vendors.bundle.e0c655267435fe0beb13.js b/import/dist/vendors.bundle.e0c655267435fe0beb13.js deleted file mode 100644 index 368cbe7c..00000000 --- a/import/dist/vendors.bundle.e0c655267435fe0beb13.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";(self.webpackChunkimport=self.webpackChunkimport||[]).push([[96],{255:(e,t,r)=>{r.d(t,{ws:()=>G,GR:()=>fe,RG:()=>be,v7:()=>pe});class i extends Error{constructor(e){let t;t=e instanceof Error?e.message:"string"==typeof e?e:"",super(t),this.name=this.constructor.name}}class n extends i{}class a extends i{}class s extends i{}class o extends i{}class c extends i{}class h extends i{}class l extends i{}class u extends i{}class d extends i{}class w extends i{}class y extends i{}const f=(b=globalThis,p={},new Proxy(b,{get:(e,t,r)=>t in p?p[t]:b[t],set:(e,t,r)=>(t in p&&delete p[t],b[t]=r,!0),deleteProperty(e,t){let r=!1;return t in p&&(delete p[t],r=!0),t in b&&(delete b[t],r=!0),r},ownKeys(e){const t=Reflect.ownKeys(b),r=Reflect.ownKeys(p),i=new Set(r);return[...t.filter(e=>!i.has(e)),...r]},defineProperty:(e,t,r)=>(t in p&&delete p[t],Reflect.defineProperty(b,t,r),!0),getOwnPropertyDescriptor:(e,t)=>t in p?Reflect.getOwnPropertyDescriptor(p,t):Reflect.getOwnPropertyDescriptor(b,t),has:(e,t)=>t in p||t in b}));var b,p;class _{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){void 0===this._api&&(this._api=await async function(){if(void 0!==f&&void 0!==globalThis.crypto)return globalThis.crypto.subtle;try{const{webcrypto:e}=await r.e(825).then(r.t.bind(r,825,19));return e.subtle}catch(e){throw new y(e)}}())}}const g=8192,m=new Uint8Array(0),v=new Uint8Array([75,69,77,0,0]),k=e=>"object"==typeof e&&null!==e&&"object"==typeof e.privateKey&&"object"==typeof e.publicKey;function P(e,t){if(t<=0)throw new Error("i2Osp: too small size");if(e>=256**t)throw new Error("i2Osp: too large integer");const r=new Uint8Array(t);for(let i=0;i>=8;return r}function K(e,t){const r=new Uint8Array(e.length+t.length);return r.set(e,0),r.set(t,e.length),r}const A=new Uint8Array([101,97,101,95,112,114,107]),x=new Uint8Array([115,104,97,114,101,100,95,115,101,99,114,101,116]);class S{constructor(e,t,r){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_prim",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.id=e,this._prim=t,this._kdf=r;const i=new Uint8Array(v);i.set(P(this.id,2),3),this._kdf.init(i)}async serializePublicKey(e){return await this._prim.serializePublicKey(e)}async deserializePublicKey(e){return await this._prim.deserializePublicKey(e)}async serializePrivateKey(e){return await this._prim.serializePrivateKey(e)}async deserializePrivateKey(e){return await this._prim.deserializePrivateKey(e)}async importKey(e,t,r=!0){return await this._prim.importKey(e,t,r)}async generateKeyPair(){return await this._prim.generateKeyPair()}async deriveKeyPair(e){if(e.byteLength>g)throw new n("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;t=void 0===e.ekm?await this.generateKeyPair():k(e.ekm)?e.ekm:await this.deriveKeyPair(e.ekm);const r=await this._prim.serializePublicKey(t.publicKey),i=await this._prim.serializePublicKey(e.recipientPublicKey);try{let n,a;if(void 0===e.senderKey)n=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{const r=k(e.senderKey)?e.senderKey.privateKey:e.senderKey;n=K(new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),new Uint8Array(await this._prim.dh(r,e.recipientPublicKey)))}if(void 0===e.senderKey)a=K(new Uint8Array(r),new Uint8Array(i));else{const t=k(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),n=await this._prim.serializePublicKey(t);a=function(e,t,r){const i=new Uint8Array(e.length+t.length+r.length);return i.set(e,0),i.set(t,e.length),i.set(r,e.length+t.length),i}(new Uint8Array(r),new Uint8Array(i),new Uint8Array(n))}return{enc:r,sharedSecret:await this._generateSharedSecret(n,a)}}catch(e){throw new o(e)}}async decap(e){const t=await this._prim.deserializePublicKey(e.enc),r=k(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,i=k(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),n=await this._prim.serializePublicKey(i);try{let i,a;if(void 0===e.senderPublicKey)i=new Uint8Array(await this._prim.dh(r,t));else{i=K(new Uint8Array(await this._prim.dh(r,t)),new Uint8Array(await this._prim.dh(r,e.senderPublicKey)))}if(void 0===e.senderPublicKey)a=K(new Uint8Array(e.enc),new Uint8Array(n));else{const t=await this._prim.serializePublicKey(e.senderPublicKey);a=new Uint8Array(e.enc.byteLength+n.byteLength+t.byteLength),a.set(new Uint8Array(e.enc),0),a.set(new Uint8Array(n),e.enc.byteLength),a.set(new Uint8Array(t),e.enc.byteLength+n.byteLength)}return await this._generateSharedSecret(i,a)}catch(e){throw new c(e)}}async _generateSharedSecret(e,t){const r=this._kdf.buildLabeledIkm(A,e),i=this._kdf.buildLabeledInfo(x,t,this.secretSize);return await this._kdf.extractAndExpand(m.buffer,r.buffer,i.buffer,this.secretSize)}}const U=["deriveBits"],j=new Uint8Array([100,107,112,95,112,114,107]);new Uint8Array([115,107]);class E{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}}const O=new Uint8Array([99,97,110,100,105,100,97,116,101]),I=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),z=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),L=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),C=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),T=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),N=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]);class D extends _{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case 16:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=I,this._bitmask=255,this._pkcs8AlgId=C;break;case 17:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=z,this._bitmask=255,this._pkcs8AlgId=T;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=L,this._bitmask=1,this._pkcs8AlgId=N}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(e){throw new a(e)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(e){throw new s(e)}}async serializePrivateKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),i=new Uint8Array(r.length);for(let e=0;e255)throw new Error("Faild to derive a key pair");const i=new Uint8Array(await this._hkdf.labeledExpand(t,O,P(e,1),this._nSk));i[0]=i[0]&this._bitmask,r.set(i)}const i=await this._deserializePkcs8Key(r.val());return r.reset(),{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(e){throw new w(e)}}async derivePublicKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(e){throw new s(e)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,8*this._nDh)}catch(e){throw new a(e)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(void 0===e.crv||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(void 0!==e.d)throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(void 0===e.d)throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,U)}async _deserializePkcs8Key(e){const t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,U)}}const H=new Uint8Array([72,80,75,69,45,118,49]);class R extends _{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();const r=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(H,0),r.set(this._suiteId,7),r.set(e,7+this._suiteId.byteLength),r.set(t,7+this._suiteId.byteLength+e.byteLength),r}buildLabeledInfo(e,t,r){this._checkInit();const i=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return i.set(new Uint8Array([0,r]),0),i.set(H,2),i.set(this._suiteId,9),i.set(e,9+this._suiteId.byteLength),i.set(t,9+this._suiteId.byteLength+e.byteLength),i}async extract(e,t){if(await this._setup(),0===e.byteLength&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new n("The salt length must be the same as the hashSize");const r=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",r,t)}async expand(e,t,r){await this._setup();const i=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),n=new ArrayBuffer(r),a=new Uint8Array(n);let s=m;const o=new Uint8Array(t),c=new Uint8Array(1);if(r>255*this.hashSize)throw new Error("Entropy limit reached");const h=new Uint8Array(this.hashSize+o.length+1);for(let e=1,t=0;t=s.length?(a.set(s,t),t+=s.length):(a.set(s.slice(0,a.length-t),t),t+=a.length-t);return n}async extractAndExpand(e,t,r,i){await this._setup();const n=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:r},n,8*i)}async labeledExtract(e,t,r){return await this.extract(e,this.buildLabeledIkm(t,r).buffer)}async labeledExpand(e,t,r,i){return await this.expand(e,this.buildLabeledInfo(t,r,i).buffer,i)}_checkInit(){if(this._suiteId===m)throw new Error("Not initialized. Call init()")}}class M extends R{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}}const q=["encrypt","decrypt"];BigInt(0),BigInt(1),BigInt(2);class B extends _{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,r){await this._setupKey();const i={name:"AES-GCM",iv:e,additionalData:r};return await this._api.encrypt(i,this._key,t)}async open(e,t,r){await this._setupKey();const i={name:"AES-GCM",iv:e,additionalData:r};return await this._api.decrypt(i,this._key,t)}async _setupKey(){if(void 0!==this._key)return;await this._setup();const e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,q)}}class W{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new B(e)}}class G extends W{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:2}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}}function F(){return new Promise((e,t)=>{t(new y("Not supported"))})}const J=new Uint8Array([115,101,99]);class Z{constructor(e,t,r){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=r}async seal(e,t){return await F()}async open(e,t){return await F()}async export(e,t){if(e.byteLength>g)throw new n("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,J,new Uint8Array(e),t)}catch(e){throw new h(e)}}}class X extends Z{}class $ extends Z{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}}class Q extends Z{constructor(e,t,r){if(super(e,t,r.exporterSecret),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nT",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),void 0===r.key||void 0===r.baseNonce||void 0===r.seq)throw new Error("Required parameters are missing");this._aead=r.aead,this._nK=this._aead.keySize,this._nN=this._aead.nonceSize,this._nT=this._aead.tagSize;const i=this._aead.createEncryptionContext(r.key);this._ctx={key:i,baseNonce:r.baseNonce,seq:r.seq}}computeNonce(e){const t=P(e.seq,e.baseNonce.byteLength);return function(e,t){if(e.byteLength!==t.byteLength)throw new Error("xor: different length inputs");const r=new Uint8Array(e.byteLength);for(let i=0;iNumber.MAX_SAFE_INTEGER)throw new d("Message limit reached");e.seq+=1}}var V;class Y{constructor(){V.set(this,Promise.resolve())}async lock(){let e;const t=new Promise(t=>{e=t}),r=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)}(this,V,"f");return function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,V,t,"f"),await r,e}}V=new WeakMap;var ee,te=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};class re extends Q{constructor(){super(...arguments),ee.set(this,void 0)}async open(e,t=m.buffer){!function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,ee,te(this,ee,"f")??new Y,"f");const r=await te(this,ee,"f").lock();let i;try{i=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(e){throw new u(e)}finally{r()}return this.incrementSeq(this._ctx),i}}ee=new WeakMap;var ie,ne=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};class ae extends Q{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),ie.set(this,void 0),this.enc=i}async seal(e,t=m.buffer){!function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,ie,ne(this,ie,"f")??new Y,"f");const r=await ne(this,ie,"f").lock();let i;try{i=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(e){throw new l(e)}finally{r()}return this.incrementSeq(this._ctx),i}}ie=new WeakMap;const se=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),oe=new Uint8Array([101,120,112]),ce=new Uint8Array([105,110,102,111,95,104,97,115,104]),he=new Uint8Array([107,101,121]),le=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),ue=new Uint8Array([115,101,99,114,101,116]),de=new Uint8Array([72,80,75,69,0,0,0,0,0,0]);class we extends _{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),"number"==typeof e.kem)throw new n("KemId cannot be used");if(this._kem=e.kem,"number"==typeof e.kdf)throw new n("KdfId cannot be used");if(this._kdf=e.kdf,"number"==typeof e.aead)throw new n("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(de),this._suiteId.set(P(this._kem.id,2),4),this._suiteId.set(P(this._kdf.id,2),6),this._suiteId.set(P(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.encap(e);let r;return r=void 0!==e.psk?void 0!==e.senderKey?3:1:void 0!==e.senderKey?2:0,await this._keyScheduleS(r,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.decap(e);let r;return r=void 0!==e.psk?void 0!==e.senderPublicKey?3:1:void 0!==e.senderPublicKey?2:0,await this._keyScheduleR(r,t,e)}async seal(e,t,r=m.buffer){const i=await this.createSenderContext(e);return{ct:await i.seal(t,r),enc:i.enc}}async open(e,t,r=m.buffer){const i=await this.createRecipientContext(e);return await i.open(t,r)}async _keySchedule(e,t,r){const i=void 0===r.psk?m:new Uint8Array(r.psk.id),n=await this._kdf.labeledExtract(m.buffer,le,i),a=void 0===r.info?m:new Uint8Array(r.info),s=await this._kdf.labeledExtract(m.buffer,ce,a),o=new Uint8Array(1+n.byteLength+s.byteLength);o.set(new Uint8Array([e]),0),o.set(new Uint8Array(n),1),o.set(new Uint8Array(s),1+n.byteLength);const c=void 0===r.psk?m:new Uint8Array(r.psk.key),h=this._kdf.buildLabeledIkm(ue,c).buffer,l=this._kdf.buildLabeledInfo(oe,o,this._kdf.hashSize).buffer,u=await this._kdf.extractAndExpand(t,h,l,this._kdf.hashSize);if(65535===this._aead.id)return{aead:this._aead,exporterSecret:u};const d=this._kdf.buildLabeledInfo(he,o,this._aead.keySize).buffer,w=await this._kdf.extractAndExpand(t,h,d,this._aead.keySize),y=this._kdf.buildLabeledInfo(se,o,this._aead.nonceSize).buffer,f=await this._kdf.extractAndExpand(t,h,y,this._aead.nonceSize);return{aead:this._aead,exporterSecret:u,key:w,baseNonce:new Uint8Array(f),seq:0}}async _keyScheduleS(e,t,r,i){const n=await this._keySchedule(e,t,i);return void 0===n.key?new $(this._api,this._kdf,n.exporterSecret,r):new ae(this._api,this._kdf,n,r)}async _keyScheduleR(e,t,r){const i=await this._keySchedule(e,t,r);return void 0===i.key?new X(this._api,this._kdf,i.exporterSecret):new re(this._api,this._kdf,i)}_validateInputLength(e){if(void 0!==e.info&&e.info.byteLength>65536)throw new n("Too long info");if(void 0!==e.psk){if(e.psk.key.byteLength<32)throw new n("PSK must have at least 32 bytes");if(e.psk.key.byteLength>g)throw new n("Too long psk.key");if(e.psk.id.byteLength>g)throw new n("Too long psk.id")}}}class ye extends S{constructor(){const e=new M;super(16,new D(16,e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}}class fe extends we{}class be extends ye{}class pe extends M{}new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),new Uint8Array([48,70,2,1,0,48,5,6,3,43,101,111,4,58,4,56])},343:(e,t)=>{t.I=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",i={};for(let e=0;e<32;e++){const t=r.charAt(e);i[t]=e}function n(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function a(e){let t=1;for(let r=0;r126)return"Invalid prefix ("+e+")";t=n(t)^i>>5}t=n(t);for(let r=0;r=r;)a-=r,o.push(n>>a&s);if(i)a>0&&o.push(n<=t)return"Excess padding";if(n<r)return"Exceeds length limit";const s=e.toLowerCase(),o=e.toUpperCase();if(e!==s&&e!==o)return"Mixed-case string "+e;const c=(e=s).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const h=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let u=a(h);if("string"==typeof u)return u;const d=[];for(let e=0;e=l.length||d.push(r)}return u!==t?"Invalid checksum for "+e:{prefix:h,words:d}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=s(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=s(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,i,s){if(s=s||90,e.length+7+i.length>s)throw new TypeError("Exceeds length limit");let o=a(e=e.toLowerCase());if("string"==typeof o)throw new Error(o);let c=e+"1";for(let e=0;e>5)throw new Error("Non 5-bit word");o=n(o)^t,c+=r.charAt(t)}for(let e=0;e<6;++e)o=n(o);o^=t;for(let e=0;e<6;++e)c+=r.charAt(o>>5*(5-e)&31);return c},toWords:o,fromWordsUnsafe:c,fromWords:h}}t.I=l("bech32"),l("bech32m")}}]); -//# sourceMappingURL=vendors.bundle.e0c655267435fe0beb13.js.map \ No newline at end of file diff --git a/import/dist/vendors.bundle.e0c655267435fe0beb13.js.map b/import/dist/vendors.bundle.e0c655267435fe0beb13.js.map deleted file mode 100644 index ed3a33f7..00000000 --- a/import/dist/vendors.bundle.e0c655267435fe0beb13.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vendors.bundle.e0c655267435fe0beb13.js","mappings":"6IAIO,MAAMA,UAAkBC,MAC3B,WAAAC,CAAYC,GACR,IAAIC,EAEAA,EADAD,aAAaF,MACHE,EAAEC,QAEM,iBAAND,EACFA,EAGA,GAEdE,MAAMD,GACNE,KAAKC,KAAOD,KAAKJ,YAAYK,IACjC,EAMG,MAAM,UAA0BP,GAYhC,MAAM,UAAuBA,GAM7B,MAAM,UAAyBA,GAM/B,MAAMQ,UAAmBR,GAMzB,MAAMS,UAAmBT,GAMzB,MAAMU,UAAoBV,GAM1B,MAAMW,UAAkBX,GAMxB,MAAMY,UAAkBZ,GAMxB,MAAMa,UAAiCb,GAMvC,MAAMc,UAA2Bd,GAMjC,MAAM,UAA0BA,GC1FvC,MACae,GACaC,EADoBC,WACXC,EAFhB,CAAC,EAGT,IAAIC,MAAMH,EAAS,CACtBI,IAAG,CAACC,EAASC,EAAMC,IACXD,KAAQJ,EACDA,EAAOI,GAGPN,E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GAAIN,GAAK,EACL,MAAM,IAAItD,MAAM,kBACpBwT,EAAMJ,EAAYI,GAAOlQ,EACzByQ,GAAUf,EAASG,OAAO7P,EAC9B,CACA,IAAK,IAAIM,EAAI,EAAGA,EAAI,IAAKA,EACrB4P,EAAMJ,EAAYI,GAEtBA,GAAOiB,EACP,IAAK,IAAI7Q,EAAI,EAAGA,EAAI,IAAKA,EAErBmQ,GAAUf,EAASG,OADRK,GAAkB,GAAT,EAAI5P,GAAW,IAGvC,OAAOmQ,CACX,EAwDIE,UACAC,kBACAI,YAER,CACAvB,EAAQ,EAASwB,EAAuB,UACtBA,EAAuB,U","sources":["webpack://import/./node_modules/@hpke/common/esm/src/errors.js","webpack://import/./node_modules/@hpke/common/esm/_dnt.shims.js","webpack://import/./node_modules/@hpke/common/esm/src/algorithm.js","webpack://import/./node_modules/@hpke/common/esm/src/identifiers.js","webpack://import/./node_modules/@hpke/common/esm/src/consts.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/kemInterface.js","webpack://import/./node_modules/@hpke/common/esm/src/utils/misc.js","webpack://import/./node_modules/@hpke/common/esm/src/kems/dhkem.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js","webpack://import/./node_modules/@hpke/common/esm/src/utils/bignum.js","webpack://import/./node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/ec.js","webpack://import/./node_modules/@hpke/common/esm/src/kdfs/hkdf.js","webpack://import/./node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js","webpack://import/./node_modules/@hpke/common/esm/src/curve/montgomery.js","webpack://import/./node_modules/@hpke/core/esm/src/aeads/aesGcm.js","webpack://import/./node_modules/@hpke/core/esm/src/utils/emitNotSupported.js","webpack://import/./node_modules/@hpke/core/esm/src/exporterContext.js","webpack://import/./node_modules/@hpke/core/esm/src/encryptionContext.js","webpack://import/./node_modules/@hpke/core/esm/src/mutex.js","webpack://import/./node_modules/@hpke/core/esm/src/recipientContext.js","webpack://import/./node_modules/@hpke/core/esm/src/senderContext.js","webpack://import/./node_modules/@hpke/core/esm/src/cipherSuiteNative.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemNative.js","webpack://import/./node_modules/@hpke/core/esm/src/native.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js","webpack://import/./node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js","webpack://import/./node_modules/bech32/dist/index.js"],"sourcesContent":["/**\n * The base error class of hpke-js.\n * @group Errors\n */\nexport class HpkeError extends Error {\n constructor(e) {\n let message;\n if (e instanceof Error) {\n message = e.message;\n }\n else if (typeof e === \"string\") {\n message = e;\n }\n else {\n message = \"\";\n }\n super(message);\n this.name = this.constructor.name;\n }\n}\n/**\n * Invalid parameter.\n * @group Errors\n */\nexport class InvalidParamError extends HpkeError {\n}\n/**\n * KEM input or output validation failure.\n * @group Errors\n */\nexport class ValidationError extends HpkeError {\n}\n/**\n * Public or private key serialization failure.\n * @group Errors\n */\nexport class SerializeError extends HpkeError {\n}\n/**\n * Public or private key deserialization failure.\n * @group Errors\n */\nexport class DeserializeError extends HpkeError {\n}\n/**\n * encap() failure.\n * @group Errors\n */\nexport class EncapError extends HpkeError {\n}\n/**\n * decap() failure.\n * @group Errors\n */\nexport class DecapError extends HpkeError {\n}\n/**\n * Secret export failure.\n * @group Errors\n */\nexport class ExportError extends HpkeError {\n}\n/**\n * seal() failure.\n * @group Errors\n */\nexport class SealError extends HpkeError {\n}\n/**\n * open() failure.\n * @group Errors\n */\nexport class OpenError extends HpkeError {\n}\n/**\n * Sequence number overflow on the encryption context.\n * @group Errors\n */\nexport class MessageLimitReachedError extends HpkeError {\n}\n/**\n * Key pair derivation failure.\n * @group Errors\n */\nexport class DeriveKeyPairError extends HpkeError {\n}\n/**\n * Not supported failure.\n * @group Errors\n */\nexport class NotSupportedError extends HpkeError {\n}\n","const dntGlobals = {};\nexport const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);\nfunction createMergeProxy(baseObj, extObj) {\n return new Proxy(baseObj, {\n get(_target, prop, _receiver) {\n if (prop in extObj) {\n return extObj[prop];\n }\n else {\n return baseObj[prop];\n }\n },\n set(_target, prop, value) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n baseObj[prop] = value;\n return true;\n },\n deleteProperty(_target, prop) {\n let success = false;\n if (prop in extObj) {\n delete extObj[prop];\n success = true;\n }\n if (prop in baseObj) {\n delete baseObj[prop];\n success = true;\n }\n return success;\n },\n ownKeys(_target) {\n const baseKeys = Reflect.ownKeys(baseObj);\n const extKeys = Reflect.ownKeys(extObj);\n const extKeysSet = new Set(extKeys);\n return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];\n },\n defineProperty(_target, prop, desc) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n Reflect.defineProperty(baseObj, prop, desc);\n return true;\n },\n getOwnPropertyDescriptor(_target, prop) {\n if (prop in extObj) {\n return Reflect.getOwnPropertyDescriptor(extObj, prop);\n }\n else {\n return Reflect.getOwnPropertyDescriptor(baseObj, prop);\n }\n },\n has(_target, prop) {\n return prop in extObj || prop in baseObj;\n },\n });\n}\n","import * as dntShim from \"../_dnt.shims.js\";\nimport { NotSupportedError } from \"./errors.js\";\nasync function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n}\nexport class NativeAlgorithm {\n constructor() {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n }\n async _setup() {\n if (this._api !== undefined) {\n return;\n }\n this._api = await loadSubtleCrypto();\n }\n}\n","/**\n * The supported HPKE modes.\n */\nexport const Mode = {\n Base: 0x00,\n Psk: 0x01,\n Auth: 0x02,\n AuthPsk: 0x03,\n};\n/**\n * The supported Key Encapsulation Mechanism (KEM) identifiers.\n */\nexport const KemId = {\n NotAssigned: 0x0000,\n DhkemP256HkdfSha256: 0x0010,\n DhkemP384HkdfSha384: 0x0011,\n DhkemP521HkdfSha512: 0x0012,\n DhkemSecp256k1HkdfSha256: 0x0013,\n DhkemX25519HkdfSha256: 0x0020,\n DhkemX448HkdfSha512: 0x0021,\n HybridkemX25519Kyber768: 0x0030,\n MlKem512: 0x0040,\n MlKem768: 0x0041,\n MlKem1024: 0x0042,\n XWing: 0x647a,\n};\n/**\n * The supported Key Derivation Function (KDF) identifiers.\n */\nexport const KdfId = {\n HkdfSha256: 0x0001,\n HkdfSha384: 0x0002,\n HkdfSha512: 0x0003,\n};\n/**\n * The supported Authenticated Encryption with Associated Data (AEAD) identifiers.\n */\nexport const AeadId = {\n Aes128Gcm: 0x0001,\n Aes256Gcm: 0x0002,\n Chacha20Poly1305: 0x0003,\n ExportOnly: 0xFFFF,\n};\n","// The input length limit (psk, psk_id, info, exporter_context, ikm).\nexport const INPUT_LENGTH_LIMIT = 8192;\nexport const INFO_LENGTH_LIMIT = 65536;\n// The minimum length of a PSK.\nexport const MINIMUM_PSK_LENGTH = 32;\n// b\"\"\nexport const EMPTY = new Uint8Array(0);\n","// b\"KEM\"\nexport const SUITE_ID_HEADER_KEM = new Uint8Array([\n 75,\n 69,\n 77,\n 0,\n 0,\n]);\n","import * as dntShim from \"../../_dnt.shims.js\";\nimport { KemId } from \"../identifiers.js\";\nexport const isDenoV1 = () => \n// deno-lint-ignore no-explicit-any\ndntShim.dntGlobalThis.process === undefined;\n/**\n * Checks whether the runtime is Deno or not (Node.js).\n * @returns boolean - true if the runtime is Deno, false Node.js.\n */\nexport function isDeno() {\n // deno-lint-ignore no-explicit-any\n if (dntShim.dntGlobalThis.process === undefined) {\n return true;\n }\n // deno-lint-ignore no-explicit-any\n return dntShim.dntGlobalThis.process?.versions?.deno !== undefined;\n}\n/**\n * Checks whetehr the type of input is CryptoKeyPair or not.\n */\nexport const isCryptoKeyPair = (x) => typeof x === \"object\" &&\n x !== null &&\n typeof x.privateKey === \"object\" &&\n typeof x.publicKey === \"object\";\n/**\n * Converts integer to octet string. I2OSP implementation.\n */\nexport function i2Osp(n, w) {\n if (w <= 0) {\n throw new Error(\"i2Osp: too small size\");\n }\n if (n >= 256 ** w) {\n throw new Error(\"i2Osp: too large integer\");\n }\n const ret = new Uint8Array(w);\n for (let i = 0; i < w && n; i++) {\n ret[w - (i + 1)] = n % 256;\n n = n >> 8;\n }\n return ret;\n}\n/**\n * Concatenates two Uint8Arrays.\n * @param a Uint8Array\n * @param b Uint8Array\n * @returns Concatenated Uint8Array\n */\nexport function concat(a, b) {\n const ret = new Uint8Array(a.length + b.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n return ret;\n}\n/**\n * Decodes Base64Url-encoded data.\n * @param v Base64Url-encoded string\n * @returns Uint8Array\n */\nexport function base64UrlToBytes(v) {\n const base64 = v.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const byteString = atob(base64);\n const ret = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n ret[i] = byteString.charCodeAt(i);\n }\n return ret;\n}\n/**\n * Encodes Uint8Array to Base64Url.\n * @param v Uint8Array\n * @returns Base64Url-encoded string\n */\nexport function bytesToBase64Url(v) {\n return btoa(String.fromCharCode(...v))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=*$/g, \"\");\n}\n/**\n * Decodes hex string to Uint8Array.\n * @param v Hex string\n * @returns Uint8Array\n * @throws Error if the input is not a hex string.\n */\nexport function hexToBytes(v) {\n if (v.length === 0) {\n return new Uint8Array([]);\n }\n const res = v.match(/[\\da-f]{2}/gi);\n if (res == null) {\n throw new Error(\"Not hex string.\");\n }\n return new Uint8Array(res.map(function (h) {\n return parseInt(h, 16);\n }));\n}\n/**\n * Encodes Uint8Array to hex string.\n * @param v Uint8Array\n * @returns Hex string\n */\nexport function bytesToHex(v) {\n return [...v].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * Converts KemId to KeyAlgorithm.\n * @param kem KemId\n * @returns KeyAlgorithm\n */\nexport function kemToKeyGenAlgorithm(kem) {\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n return {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n };\n case KemId.DhkemP384HkdfSha384:\n return {\n name: \"ECDH\",\n namedCurve: \"P-384\",\n };\n case KemId.DhkemP521HkdfSha512:\n return {\n name: \"ECDH\",\n namedCurve: \"P-521\",\n };\n default:\n // case KemId.DhkemX25519HkdfSha256\n return {\n name: \"X25519\",\n };\n }\n}\nexport async function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (_e) {\n throw new Error(\"Failed to load SubtleCrypto\");\n }\n}\nexport async function loadCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto;\n }\n catch (_e) {\n throw new Error(\"Web Cryptograph API not supported\");\n }\n}\n/**\n * XOR for Uint8Array.\n */\nexport function xor(a, b) {\n if (a.byteLength !== b.byteLength) {\n throw new Error(\"xor: different length inputs\");\n }\n const buf = new Uint8Array(a.byteLength);\n for (let i = 0; i < a.byteLength; i++) {\n buf[i] = a[i] ^ b[i];\n }\n return buf;\n}\n","import { EMPTY, INPUT_LENGTH_LIMIT } from \"../consts.js\";\nimport { DecapError, EncapError, InvalidParamError } from \"../errors.js\";\nimport { SUITE_ID_HEADER_KEM } from \"../interfaces/kemInterface.js\";\nimport { concat, i2Osp, isCryptoKeyPair } from \"../utils/misc.js\";\n// b\"eae_prk\"\nconst LABEL_EAE_PRK = new Uint8Array([101, 97, 101, 95, 112, 114, 107]);\n// b\"shared_secret\"\n// deno-fmt-ignore\nconst LABEL_SHARED_SECRET = new Uint8Array([\n 115, 104, 97, 114, 101, 100, 95, 115, 101, 99,\n 114, 101, 116,\n]);\nfunction concat3(a, b, c) {\n const ret = new Uint8Array(a.length + b.length + c.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n ret.set(c, a.length + b.length);\n return ret;\n}\nexport class Dhkem {\n constructor(id, prim, kdf) {\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_prim\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.id = id;\n this._prim = prim;\n this._kdf = kdf;\n const suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);\n suiteId.set(i2Osp(this.id, 2), 3);\n this._kdf.init(suiteId);\n }\n async serializePublicKey(key) {\n return await this._prim.serializePublicKey(key);\n }\n async deserializePublicKey(key) {\n return await this._prim.deserializePublicKey(key);\n }\n async serializePrivateKey(key) {\n return await this._prim.serializePrivateKey(key);\n }\n async deserializePrivateKey(key) {\n return await this._prim.deserializePrivateKey(key);\n }\n async importKey(format, key, isPublic = true) {\n return await this._prim.importKey(format, key, isPublic);\n }\n async generateKeyPair() {\n return await this._prim.generateKeyPair();\n }\n async deriveKeyPair(ikm) {\n if (ikm.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long ikm\");\n }\n return await this._prim.deriveKeyPair(ikm);\n }\n async encap(params) {\n let ke;\n if (params.ekm === undefined) {\n ke = await this.generateKeyPair();\n }\n else if (isCryptoKeyPair(params.ekm)) {\n // params.ekm is only used for testing.\n ke = params.ekm;\n }\n else {\n // params.ekm is only used for testing.\n ke = await this.deriveKeyPair(params.ekm);\n }\n const enc = await this._prim.serializePublicKey(ke.publicKey);\n const pkrm = await this._prim.serializePublicKey(params.recipientPublicKey);\n try {\n let dh;\n if (params.senderKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n }\n else {\n const sks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.privateKey\n : params.senderKey;\n const dh1 = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n const dh2 = new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderKey === undefined) {\n kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n }\n else {\n const pks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.publicKey\n : await this._prim.derivePublicKey(params.senderKey);\n const pksm = await this._prim.serializePublicKey(pks);\n kemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm));\n }\n const sharedSecret = await this._generateSharedSecret(dh, kemContext);\n return {\n enc: enc,\n sharedSecret: sharedSecret,\n };\n }\n catch (e) {\n throw new EncapError(e);\n }\n }\n async decap(params) {\n const pke = await this._prim.deserializePublicKey(params.enc);\n const skr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.privateKey\n : params.recipientKey;\n const pkr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.publicKey\n : await this._prim.derivePublicKey(params.recipientKey);\n const pkrm = await this._prim.serializePublicKey(pkr);\n try {\n let dh;\n if (params.senderPublicKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(skr, pke));\n }\n else {\n const dh1 = new Uint8Array(await this._prim.dh(skr, pke));\n const dh2 = new Uint8Array(await this._prim.dh(skr, params.senderPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderPublicKey === undefined) {\n kemContext = concat(new Uint8Array(params.enc), new Uint8Array(pkrm));\n }\n else {\n const pksm = await this._prim.serializePublicKey(params.senderPublicKey);\n kemContext = new Uint8Array(params.enc.byteLength + pkrm.byteLength + pksm.byteLength);\n kemContext.set(new Uint8Array(params.enc), 0);\n kemContext.set(new Uint8Array(pkrm), params.enc.byteLength);\n kemContext.set(new Uint8Array(pksm), params.enc.byteLength + pkrm.byteLength);\n }\n return await this._generateSharedSecret(dh, kemContext);\n }\n catch (e) {\n throw new DecapError(e);\n }\n }\n async _generateSharedSecret(dh, kemContext) {\n const labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh);\n const labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize);\n return await this._kdf.extractAndExpand(EMPTY.buffer, labeledIkm.buffer, labeledInfo.buffer, this.secretSize);\n }\n}\n","// The key usages for KEM.\nexport const KEM_USAGES = [\"deriveBits\"];\n// b\"dkp_prk\"\nexport const LABEL_DKP_PRK = new Uint8Array([\n 100,\n 107,\n 112,\n 95,\n 112,\n 114,\n 107,\n]);\n// b\"sk\"\nexport const LABEL_SK = new Uint8Array([115, 107]);\n","/**\n * The minimum inplementation of bignum to derive an EC key pair.\n */\nexport class Bignum {\n constructor(size) {\n Object.defineProperty(this, \"_num\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._num = new Uint8Array(size);\n }\n val() {\n return this._num;\n }\n reset() {\n this._num.fill(0);\n }\n set(src) {\n if (src.length !== this._num.length) {\n throw new Error(\"Bignum.set: invalid argument\");\n }\n this._num.set(src);\n }\n isZero() {\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n lessThan(v) {\n if (v.length !== this._num.length) {\n throw new Error(\"Bignum.lessThan: invalid argument\");\n }\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] < v[i]) {\n return true;\n }\n if (this._num[i] > v[i]) {\n return false;\n }\n }\n return false;\n }\n}\n","import { NativeAlgorithm } from \"../../algorithm.js\";\nimport { EMPTY } from \"../../consts.js\";\nimport { DeriveKeyPairError, DeserializeError, NotSupportedError, SerializeError, } from \"../../errors.js\";\nimport { KemId } from \"../../identifiers.js\";\nimport { KEM_USAGES, LABEL_DKP_PRK } from \"../../interfaces/dhkemPrimitives.js\";\nimport { Bignum } from \"../../utils/bignum.js\";\nimport { base64UrlToBytes, i2Osp } from \"../../utils/misc.js\";\n// b\"candidate\"\n// deno-fmt-ignore\nconst LABEL_CANDIDATE = new Uint8Array([\n 99, 97, 110, 100, 105, 100, 97, 116, 101,\n]);\n// the order of the curve being used.\n// deno-fmt-ignore\nconst ORDER_P_256 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84,\n 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51,\n]);\n// deno-fmt-ignore\nconst ORDER_P_384 = new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf,\n 0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a,\n 0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73,\n]);\n// deno-fmt-ignore\nconst ORDER_P_521 = new Uint8Array([\n 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f,\n 0x96, 0x6b, 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09,\n 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c,\n 0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38,\n 0x64, 0x09,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_256 = new Uint8Array([\n 48, 65, 2, 1, 0, 48, 19, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 8, 42, 134,\n 72, 206, 61, 3, 1, 7, 4, 39, 48, 37,\n 2, 1, 1, 4, 32,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_384 = new Uint8Array([\n 48, 78, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 34, 4, 55, 48, 53, 2, 1, 1,\n 4, 48,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_521 = new Uint8Array([\n 48, 96, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 35, 4, 73, 48, 71, 2, 1, 1,\n 4, 66,\n]);\nexport class Ec extends NativeAlgorithm {\n constructor(kem, hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // EC specific arguments for deriving key pair.\n Object.defineProperty(this, \"_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_bitmask\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._hkdf = hkdf;\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n this._alg = { name: \"ECDH\", namedCurve: \"P-256\" };\n this._nPk = 65;\n this._nSk = 32;\n this._nDh = 32;\n this._order = ORDER_P_256;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_256;\n break;\n case KemId.DhkemP384HkdfSha384:\n this._alg = { name: \"ECDH\", namedCurve: \"P-384\" };\n this._nPk = 97;\n this._nSk = 48;\n this._nDh = 48;\n this._order = ORDER_P_384;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_384;\n break;\n default:\n // case KemId.DhkemP521HkdfSha512:\n this._alg = { name: \"ECDH\", namedCurve: \"P-521\" };\n this._nPk = 133;\n this._nSk = 66;\n this._nDh = 66;\n this._order = ORDER_P_521;\n this._bitmask = 0x01;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_521;\n break;\n }\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(this._alg, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const bn = new Bignum(this._nSk);\n for (let counter = 0; bn.isZero() || !bn.lessThan(this._order); counter++) {\n if (counter > 255) {\n throw new Error(\"Faild to derive a key pair\");\n }\n const bytes = new Uint8Array(await this._hkdf.labeledExpand(dkpPrk, LABEL_CANDIDATE, i2Osp(counter, 1), this._nSk));\n bytes[0] = bytes[0] & this._bitmask;\n bn.set(bytes);\n }\n const sk = await this._deserializePkcs8Key(bn.val());\n bn.reset();\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n try {\n await this._setup();\n const bits = await this._api.deriveBits({\n name: \"ECDH\",\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.crv === \"undefined\" || key.crv !== this._alg.namedCurve) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { EMPTY } from \"../consts.js\";\nimport { InvalidParamError } from \"../errors.js\";\nimport { KdfId } from \"../identifiers.js\";\nimport { NativeAlgorithm } from \"../algorithm.js\";\n// b\"HPKE-v1\"\nconst HPKE_VERSION = new Uint8Array([72, 80, 75, 69, 45, 118, 49]);\nexport class HkdfNative extends NativeAlgorithm {\n constructor() {\n super();\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: EMPTY\n });\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n init(suiteId) {\n this._suiteId = suiteId;\n }\n buildLabeledIkm(label, ikm) {\n this._checkInit();\n const ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength);\n ret.set(HPKE_VERSION, 0);\n ret.set(this._suiteId, 7);\n ret.set(label, 7 + this._suiteId.byteLength);\n ret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n buildLabeledInfo(label, info, len) {\n this._checkInit();\n const ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength);\n ret.set(new Uint8Array([0, len]), 0);\n ret.set(HPKE_VERSION, 2);\n ret.set(this._suiteId, 9);\n ret.set(label, 9 + this._suiteId.byteLength);\n ret.set(info, 9 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n async extract(salt, ikm) {\n await this._setup();\n if (salt.byteLength === 0) {\n salt = new ArrayBuffer(this.hashSize);\n }\n if (salt.byteLength !== this.hashSize) {\n throw new InvalidParamError(\"The salt length must be the same as the hashSize\");\n }\n const key = await this._api.importKey(\"raw\", salt, this.algHash, false, [\n \"sign\",\n ]);\n return await this._api.sign(\"HMAC\", key, ikm);\n }\n async expand(prk, info, len) {\n await this._setup();\n const key = await this._api.importKey(\"raw\", prk, this.algHash, false, [\n \"sign\",\n ]);\n const okm = new ArrayBuffer(len);\n const p = new Uint8Array(okm);\n let prev = EMPTY;\n const mid = new Uint8Array(info);\n const tail = new Uint8Array(1);\n if (len > 255 * this.hashSize) {\n throw new Error(\"Entropy limit reached\");\n }\n const tmp = new Uint8Array(this.hashSize + mid.length + 1);\n for (let i = 1, cur = 0; cur < p.length; i++) {\n tail[0] = i;\n tmp.set(prev, 0);\n tmp.set(mid, prev.length);\n tmp.set(tail, prev.length + mid.length);\n prev = new Uint8Array(await this._api.sign(\"HMAC\", key, tmp.slice(0, prev.length + mid.length + 1)));\n if (p.length - cur >= prev.length) {\n p.set(prev, cur);\n cur += prev.length;\n }\n else {\n p.set(prev.slice(0, p.length - cur), cur);\n cur += p.length - cur;\n }\n }\n return okm;\n }\n async extractAndExpand(salt, ikm, info, len) {\n await this._setup();\n const baseKey = await this._api.importKey(\"raw\", ikm, \"HKDF\", false, [\"deriveBits\"]);\n return await this._api.deriveBits({\n name: \"HKDF\",\n hash: this.algHash.hash,\n salt: salt,\n info: info,\n }, baseKey, len * 8);\n }\n async labeledExtract(salt, label, ikm) {\n return await this.extract(salt, this.buildLabeledIkm(label, ikm).buffer);\n }\n async labeledExpand(prk, label, info, len) {\n return await this.expand(prk, this.buildLabeledInfo(label, info, len).buffer, len);\n }\n _checkInit() {\n if (this._suiteId === EMPTY) {\n throw new Error(\"Not initialized. Call init()\");\n }\n }\n}\nexport class HkdfSha256Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha256 (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n /** 32 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n}\nexport class HkdfSha384Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha384 (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha384\n });\n /** 48 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-384\",\n length: 384,\n }\n });\n }\n}\nexport class HkdfSha512Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha512 (0x0003) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha512\n });\n /** 64 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-512\",\n length: 512,\n }\n });\n }\n}\n","// The key usages for AEAD.\nexport const AEAD_USAGES = [\"encrypt\", \"decrypt\"];\n","/**\n * This file is based on noble-curves (https://github.com/paulmillr/noble-curves).\n *\n * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/abstract/montgomery.ts\n */\n/**\n * Montgomery curve methods. It's not really whole montgomery curve,\n * just bunch of very specific methods for X25519 / X448 from\n * [RFC 7748](https://www.rfc-editor.org/rfc/rfc7748)\n * @module\n */\n/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */\nimport { abytes, aInRange, bytesToNumberLE, copyBytes, numberToBytesLE, randomBytesAsync, validateObject, } from \"../utils/noble.js\";\nimport { createKeygen } from \"./curve.js\";\nimport { mod } from \"./modular.js\";\nconst _0n = BigInt(0);\nconst _1n = BigInt(1);\nconst _2n = BigInt(2);\nfunction validateOpts(curve) {\n validateObject(curve, {\n adjustScalarBytes: \"function\",\n powPminus2: \"function\",\n });\n return Object.freeze({ ...curve });\n}\nexport function montgomery(curveDef) {\n const CURVE = validateOpts(curveDef);\n const { P, type, adjustScalarBytes, powPminus2, randomBytes: rand } = CURVE;\n const is25519 = type === \"x25519\";\n if (!is25519 && type !== \"x448\")\n throw new Error(\"invalid type\");\n const randomBytes_ = rand || randomBytesAsync;\n const montgomeryBits = is25519 ? 255 : 448;\n const fieldLen = is25519 ? 32 : 56;\n const Gu = is25519 ? BigInt(9) : BigInt(5);\n // RFC 7748 #5:\n // The constant a24 is (486662 - 2) / 4 = 121665 for curve25519/X25519 and\n // (156326 - 2) / 4 = 39081 for curve448/X448\n // const a = is25519 ? 156326n : 486662n;\n const a24 = is25519 ? BigInt(121665) : BigInt(39081);\n // RFC: x25519 \"the resulting integer is of the form 2^254 plus\n // eight times a value between 0 and 2^251 - 1 (inclusive)\"\n // x448: \"2^447 plus four times a value between 0 and 2^445 - 1 (inclusive)\"\n const minScalar = is25519 ? _2n ** BigInt(254) : _2n ** BigInt(447);\n const maxAdded = is25519\n ? BigInt(8) * _2n ** BigInt(251) - _1n\n : BigInt(4) * _2n ** BigInt(445) - _1n;\n const maxScalar = minScalar + maxAdded + _1n; // (inclusive)\n const modP = (n) => mod(n, P);\n const GuBytes = encodeU(Gu);\n function encodeU(u) {\n return numberToBytesLE(modP(u), fieldLen);\n }\n function decodeU(u) {\n const _u = copyBytes(abytes(u, fieldLen, \"uCoordinate\"));\n // RFC: When receiving such an array, implementations of X25519\n // (but not X448) MUST mask the most significant bit in the final byte.\n if (is25519)\n _u[31] &= 127; // 0b0111_1111\n // RFC: Implementations MUST accept non-canonical values and process them as\n // if they had been reduced modulo the field prime. The non-canonical\n // values are 2^255 - 19 through 2^255 - 1 for X25519 and 2^448 - 2^224\n // - 1 through 2^448 - 1 for X448.\n return modP(bytesToNumberLE(_u));\n }\n function decodeScalar(scalar) {\n return bytesToNumberLE(adjustScalarBytes(copyBytes(abytes(scalar, fieldLen, \"scalar\"))));\n }\n function scalarMult(scalar, u) {\n const pu = montgomeryLadder(decodeU(u), decodeScalar(scalar));\n // Some public keys are useless, of low-order. Curve author doesn't think\n // it needs to be validated, but we do it nonetheless.\n // https://cr.yp.to/ecdh.html#validate\n if (pu === _0n)\n throw new Error(\"invalid private or public key received\");\n return encodeU(pu);\n }\n // Computes public key from private. By doing scalar multiplication of base point.\n function scalarMultBase(scalar) {\n return scalarMult(scalar, GuBytes);\n }\n const getPublicKey = scalarMultBase;\n const getSharedSecret = scalarMult;\n // cswap from RFC7748 \"example code\"\n function cswap(swap, x_2, x_3) {\n // dummy = mask(swap) AND (x_2 XOR x_3)\n // Where mask(swap) is the all-1 or all-0 word of the same length as x_2\n // and x_3, computed, e.g., as mask(swap) = 0 - swap.\n const dummy = modP(swap * (x_2 - x_3));\n x_2 = modP(x_2 - dummy); // x_2 = x_2 XOR dummy\n x_3 = modP(x_3 + dummy); // x_3 = x_3 XOR dummy\n return { x_2, x_3 };\n }\n /**\n * Montgomery x-only multiplication ladder.\n * @param pointU u coordinate (x) on Montgomery Curve 25519\n * @param scalar by which the point would be multiplied\n * @returns new Point on Montgomery curve\n */\n function montgomeryLadder(u, scalar) {\n aInRange(\"u\", u, _0n, P);\n aInRange(\"scalar\", scalar, minScalar, maxScalar);\n const k = scalar;\n const x_1 = u;\n let x_2 = _1n;\n let z_2 = _0n;\n let x_3 = u;\n let z_3 = _1n;\n let swap = _0n;\n for (let t = BigInt(montgomeryBits - 1); t >= _0n; t--) {\n const k_t = (k >> t) & _1n;\n swap ^= k_t;\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n swap = k_t;\n const A = x_2 + z_2;\n const AA = modP(A * A);\n const B = x_2 - z_2;\n const BB = modP(B * B);\n const E = AA - BB;\n const C = x_3 + z_3;\n const D = x_3 - z_3;\n const DA = modP(D * A);\n const CB = modP(C * B);\n const dacb = DA + CB;\n const da_cb = DA - CB;\n x_3 = modP(dacb * dacb);\n z_3 = modP(x_1 * modP(da_cb * da_cb));\n x_2 = modP(AA * BB);\n z_2 = modP(E * (AA + modP(a24 * E)));\n }\n ({ x_2, x_3 } = cswap(swap, x_2, x_3));\n ({ x_2: z_2, x_3: z_3 } = cswap(swap, z_2, z_3));\n const z2 = powPminus2(z_2); // `Fp.pow(x, P - _2n)` is much slower equivalent\n return modP(x_2 * z2); // Return x_2 * (z_2^(p - 2))\n }\n const lengths = {\n secretKey: fieldLen,\n publicKey: fieldLen,\n seed: fieldLen,\n };\n const randomSecretKey = async (seed) => {\n if (seed === undefined) {\n seed = await randomBytes_(fieldLen);\n }\n abytes(seed, lengths.seed, \"seed\");\n return seed;\n };\n const utils = { randomSecretKey };\n return Object.freeze({\n keygen: createKeygen(randomSecretKey, getPublicKey),\n getSharedSecret,\n getPublicKey,\n scalarMult,\n scalarMultBase,\n utils,\n GuBytes: GuBytes.slice(),\n lengths,\n });\n}\n","import { AEAD_USAGES, AeadId, NativeAlgorithm } from \"@hpke/common\";\nexport class AesGcmContext extends NativeAlgorithm {\n constructor(key) {\n super();\n Object.defineProperty(this, \"_rawKey\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n this._rawKey = key;\n }\n async seal(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const ct = await this._api.encrypt(alg, this._key, data);\n return ct;\n }\n async open(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const pt = await this._api.decrypt(alg, this._key, data);\n return pt;\n }\n async _setupKey() {\n if (this._key !== undefined) {\n return;\n }\n await this._setup();\n const key = await this._importKey(this._rawKey);\n (new Uint8Array(this._rawKey)).fill(0);\n this._key = key;\n return;\n }\n async _importKey(key) {\n return await this._api.importKey(\"raw\", key, { name: \"AES-GCM\" }, true, AEAD_USAGES);\n }\n}\n/**\n * The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class Aes128Gcm {\n constructor() {\n /** AeadId.Aes128Gcm (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes128Gcm\n });\n /** 16 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n createEncryptionContext(key) {\n return new AesGcmContext(key);\n }\n}\n/**\n * The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class Aes256Gcm extends Aes128Gcm {\n constructor() {\n super(...arguments);\n /** AeadId.Aes256Gcm (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes256Gcm\n });\n /** 32 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n}\n","import { NotSupportedError } from \"@hpke/common\";\nexport function emitNotSupported() {\n return new Promise((_resolve, reject) => {\n reject(new NotSupportedError(\"Not supported\"));\n });\n}\n","import { ExportError, INPUT_LENGTH_LIMIT, InvalidParamError, } from \"@hpke/common\";\nimport { emitNotSupported } from \"./utils/emitNotSupported.js\";\n// b\"sec\"\nconst LABEL_SEC = new Uint8Array([115, 101, 99]);\nexport class ExporterContextImpl {\n constructor(api, kdf, exporterSecret) {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exporterSecret\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._api = api;\n this._kdf = kdf;\n this.exporterSecret = exporterSecret;\n }\n async seal(_data, _aad) {\n return await emitNotSupported();\n }\n async open(_data, _aad) {\n return await emitNotSupported();\n }\n async export(exporterContext, len) {\n if (exporterContext.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long exporter context\");\n }\n try {\n return await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(exporterContext), len);\n }\n catch (e) {\n throw new ExportError(e);\n }\n }\n}\nexport class RecipientExporterContextImpl extends ExporterContextImpl {\n}\nexport class SenderExporterContextImpl extends ExporterContextImpl {\n constructor(api, kdf, exporterSecret, enc) {\n super(api, kdf, exporterSecret);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.enc = enc;\n return;\n }\n}\n","import { i2Osp, MessageLimitReachedError, xor } from \"@hpke/common\";\nimport { ExporterContextImpl } from \"./exporterContext.js\";\nexport class EncryptionContextImpl extends ExporterContextImpl {\n constructor(api, kdf, params) {\n super(api, kdf, params.exporterSecret);\n // AEAD id.\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a key for the algorithm.\n Object.defineProperty(this, \"_nK\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a nonce for the algorithm.\n Object.defineProperty(this, \"_nN\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of an authentication tag for the algorithm.\n Object.defineProperty(this, \"_nT\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The end-to-end encryption key information.\n Object.defineProperty(this, \"_ctx\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n if (params.key === undefined || params.baseNonce === undefined ||\n params.seq === undefined) {\n throw new Error(\"Required parameters are missing\");\n }\n this._aead = params.aead;\n this._nK = this._aead.keySize;\n this._nN = this._aead.nonceSize;\n this._nT = this._aead.tagSize;\n const key = this._aead.createEncryptionContext(params.key);\n this._ctx = {\n key: key,\n baseNonce: params.baseNonce,\n seq: params.seq,\n };\n }\n computeNonce(k) {\n const seqBytes = i2Osp(k.seq, k.baseNonce.byteLength);\n return xor(k.baseNonce, seqBytes).buffer;\n }\n incrementSeq(k) {\n // if (this.seq >= (1 << (8 * this.baseNonce.byteLength)) - 1) {\n if (k.seq > Number.MAX_SAFE_INTEGER) {\n throw new MessageLimitReachedError(\"Message limit reached\");\n }\n k.seq += 1;\n return;\n }\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _Mutex_locked;\nexport class Mutex {\n constructor() {\n _Mutex_locked.set(this, Promise.resolve());\n }\n async lock() {\n let releaseLock;\n const nextLock = new Promise((resolve) => {\n releaseLock = resolve;\n });\n const previousLock = __classPrivateFieldGet(this, _Mutex_locked, \"f\");\n __classPrivateFieldSet(this, _Mutex_locked, nextLock, \"f\");\n await previousLock;\n return releaseLock;\n }\n}\n_Mutex_locked = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _RecipientContextImpl_mutex;\nimport { EMPTY, OpenError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class RecipientContextImpl extends EncryptionContextImpl {\n constructor() {\n super(...arguments);\n _RecipientContextImpl_mutex.set(this, void 0);\n }\n async open(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _RecipientContextImpl_mutex, __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\").lock();\n let pt;\n try {\n pt = await this._ctx.key.open(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new OpenError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return pt;\n }\n}\n_RecipientContextImpl_mutex = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _SenderContextImpl_mutex;\nimport { EMPTY, SealError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class SenderContextImpl extends EncryptionContextImpl {\n constructor(api, kdf, params, enc) {\n super(api, kdf, params);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n _SenderContextImpl_mutex.set(this, void 0);\n this.enc = enc;\n }\n async seal(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _SenderContextImpl_mutex, __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\").lock();\n let ct;\n try {\n ct = await this._ctx.key.seal(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new SealError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return ct;\n }\n}\n_SenderContextImpl_mutex = new WeakMap();\n","import { AeadId, EMPTY, i2Osp, INFO_LENGTH_LIMIT, INPUT_LENGTH_LIMIT, InvalidParamError, MINIMUM_PSK_LENGTH, Mode, NativeAlgorithm, } from \"@hpke/common\";\nimport { RecipientExporterContextImpl, SenderExporterContextImpl, } from \"./exporterContext.js\";\nimport { RecipientContextImpl } from \"./recipientContext.js\";\nimport { SenderContextImpl } from \"./senderContext.js\";\n// b\"base_nonce\"\n// deno-fmt-ignore\nconst LABEL_BASE_NONCE = new Uint8Array([\n 98, 97, 115, 101, 95, 110, 111, 110, 99, 101,\n]);\n// b\"exp\"\nconst LABEL_EXP = new Uint8Array([101, 120, 112]);\n// b\"info_hash\"\n// deno-fmt-ignore\nconst LABEL_INFO_HASH = new Uint8Array([\n 105, 110, 102, 111, 95, 104, 97, 115, 104,\n]);\n// b\"key\"\nconst LABEL_KEY = new Uint8Array([107, 101, 121]);\n// b\"psk_id_hash\"\n// deno-fmt-ignore\nconst LABEL_PSK_ID_HASH = new Uint8Array([\n 112, 115, 107, 95, 105, 100, 95, 104, 97, 115, 104,\n]);\n// b\"secret\"\nconst LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]);\n// b\"HPKE\"\n// deno-fmt-ignore\nconst SUITE_ID_HEADER_HPKE = new Uint8Array([\n 72, 80, 75, 69, 0, 0, 0, 0, 0, 0,\n]);\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This is the super class of {@link CipherSuite} and the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - DHKEM(X25519, HKDF-SHA256)\n * - DHKEM(X448, HKDF-SHA512)\n * - ChaCha20Poly1305\n *\n * In addtion, the HKDF functions contained in this class can only derive\n * keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * // Use an extension module.\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuiteNative extends NativeAlgorithm {\n /**\n * @param params A set of parameters for building a cipher suite.\n *\n * If the error occurred, throws {@link InvalidParamError}.\n *\n * @throws {@link InvalidParamError}\n */\n constructor(params) {\n super();\n Object.defineProperty(this, \"_kem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // KEM\n if (typeof params.kem === \"number\") {\n throw new InvalidParamError(\"KemId cannot be used\");\n }\n this._kem = params.kem;\n // KDF\n if (typeof params.kdf === \"number\") {\n throw new InvalidParamError(\"KdfId cannot be used\");\n }\n this._kdf = params.kdf;\n // AEAD\n if (typeof params.aead === \"number\") {\n throw new InvalidParamError(\"AeadId cannot be used\");\n }\n this._aead = params.aead;\n this._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE);\n this._suiteId.set(i2Osp(this._kem.id, 2), 4);\n this._suiteId.set(i2Osp(this._kdf.id, 2), 6);\n this._suiteId.set(i2Osp(this._aead.id, 2), 8);\n this._kdf.init(this._suiteId);\n }\n /**\n * Gets the KEM context of the ciphersuite.\n */\n get kem() {\n return this._kem;\n }\n /**\n * Gets the KDF context of the ciphersuite.\n */\n get kdf() {\n return this._kdf;\n }\n /**\n * Gets the AEAD context of the ciphersuite.\n */\n get aead() {\n return this._aead;\n }\n /**\n * Creates an encryption context for a sender.\n *\n * If the error occurred, throws {@link DecapError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the sender encryption context.\n * @returns A sender encryption context.\n * @throws {@link EncapError}, {@link ValidationError}\n */\n async createSenderContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const dh = await this._kem.encap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params);\n }\n /**\n * Creates an encryption context for a recipient.\n *\n * If the error occurred, throws {@link DecapError}\n * | {@link DeserializeError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the recipient encryption context.\n * @returns A recipient encryption context.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError}\n */\n async createRecipientContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const sharedSecret = await this._kem.decap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderPublicKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderPublicKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleR(mode, sharedSecret, params);\n }\n /**\n * Encrypts a message to a recipient.\n *\n * If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`.\n *\n * @param params A set of parameters for building a sender encryption context.\n * @param pt A plain text as bytes to be encrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A cipher text and an encapsulated key as bytes.\n * @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError}\n */\n async seal(params, pt, aad = EMPTY.buffer) {\n const ctx = await this.createSenderContext(params);\n return {\n ct: await ctx.seal(pt, aad),\n enc: ctx.enc,\n };\n }\n /**\n * Decrypts a message from a sender.\n *\n * If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`.\n *\n * @param params A set of parameters for building a recipient encryption context.\n * @param ct An encrypted text as bytes to be decrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A decrypted plain text as bytes.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError}\n */\n async open(params, ct, aad = EMPTY.buffer) {\n const ctx = await this.createRecipientContext(params);\n return await ctx.open(ct, aad);\n }\n // private verifyPskInputs(mode: Mode, params: KeyScheduleParams) {\n // const gotPsk = (params.psk !== undefined);\n // const gotPskId = (params.psk !== undefined && params.psk.id.byteLength > 0);\n // if (gotPsk !== gotPskId) {\n // throw new Error('Inconsistent PSK inputs');\n // }\n // if (gotPsk && (mode === Mode.Base || mode === Mode.Auth)) {\n // throw new Error('PSK input provided when not needed');\n // }\n // if (!gotPsk && (mode === Mode.Psk || mode === Mode.AuthPsk)) {\n // throw new Error('Missing required PSK input');\n // }\n // return;\n // }\n async _keySchedule(mode, sharedSecret, params) {\n // Currently, there is no point in executing this function\n // because this hpke library does not allow users to explicitly specify the mode.\n //\n // this.verifyPskInputs(mode, params);\n const pskId = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.id);\n const pskIdHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_PSK_ID_HASH, pskId);\n const info = params.info === undefined\n ? EMPTY\n : new Uint8Array(params.info);\n const infoHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_INFO_HASH, info);\n const keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength);\n keyScheduleContext.set(new Uint8Array([mode]), 0);\n keyScheduleContext.set(new Uint8Array(pskIdHash), 1);\n keyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength);\n const psk = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.key);\n const ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk)\n .buffer;\n const exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize).buffer;\n const exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize);\n if (this._aead.id === AeadId.ExportOnly) {\n return { aead: this._aead, exporterSecret: exporterSecret };\n }\n const keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize).buffer;\n const key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize);\n const baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize).buffer;\n const baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize);\n return {\n aead: this._aead,\n exporterSecret: exporterSecret,\n key: key,\n baseNonce: new Uint8Array(baseNonce),\n seq: 0,\n };\n }\n async _keyScheduleS(mode, sharedSecret, enc, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc);\n }\n return new SenderContextImpl(this._api, this._kdf, res, enc);\n }\n async _keyScheduleR(mode, sharedSecret, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret);\n }\n return new RecipientContextImpl(this._api, this._kdf, res);\n }\n _validateInputLength(params) {\n if (params.info !== undefined &&\n params.info.byteLength > INFO_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long info\");\n }\n if (params.psk !== undefined) {\n if (params.psk.key.byteLength < MINIMUM_PSK_LENGTH) {\n throw new InvalidParamError(`PSK must have at least ${MINIMUM_PSK_LENGTH} bytes`);\n }\n if (params.psk.key.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.key\");\n }\n if (params.psk.id.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.id\");\n }\n }\n return;\n }\n}\n","import { Dhkem, Ec, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, KemId, } from \"@hpke/common\";\nexport class DhkemP256HkdfSha256Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha256Native();\n const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf);\n super(KemId.DhkemP256HkdfSha256, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP256HkdfSha256\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n }\n}\nexport class DhkemP384HkdfSha384Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha384Native();\n const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf);\n super(KemId.DhkemP384HkdfSha384, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP384HkdfSha384\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n }\n}\nexport class DhkemP521HkdfSha512Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha512Native();\n const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf);\n super(KemId.DhkemP521HkdfSha512, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP521HkdfSha512\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n }\n}\n","import { HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, } from \"@hpke/common\";\nimport { CipherSuiteNative } from \"./cipherSuiteNative.js\";\nimport { DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, } from \"./kems/dhkemNative.js\";\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This class is the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - `DHKEM(X25519, HKDF-SHA256)`\n * - `DHKEM(X448, HKDF-SHA512)`\n * - `ChaCha20Poly1305`\n *\n * In addtion, the HKDF functions contained in this `CipherSuiteNative`\n * class can only derive keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuite extends CipherSuiteNative {\n}\n/**\n * The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP256HkdfSha256`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP256HkdfSha256 extends DhkemP256HkdfSha256Native {\n}\n/**\n * The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP384HkdfSha384`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP384HkdfSha384 extends DhkemP384HkdfSha384Native {\n}\n/**\n * The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP521HkdfSha512`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class DhkemP521HkdfSha512 extends DhkemP521HkdfSha512Native {\n}\n/**\n * The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha256 extends HkdfSha256Native {\n}\n/**\n * The HKDF-SHA384 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha384`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha384 extends HkdfSha384Native {\n}\n/**\n * The HKDF-SHA512 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha512`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class HkdfSha512 extends HkdfSha512Native {\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X25519\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X25519 = new Uint8Array([\n 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20,\n]);\nexport class X25519 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 32;\n this._nSk = 32;\n this._nDh = 32;\n this._pkcs8AlgId = PKCS8_ALG_ID_X25519;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X448\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X448 = new Uint8Array([\n 0x30, 0x46, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6f, 0x04, 0x3a, 0x04, 0x38,\n]);\nexport class X448 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 56;\n this._nSk = 56;\n this._nDh = 56;\n this._pkcs8AlgId = PKCS8_ALG_ID_X448;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bech32m = exports.bech32 = void 0;\nconst ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';\nconst ALPHABET_MAP = {};\nfor (let z = 0; z < ALPHABET.length; z++) {\n const x = ALPHABET.charAt(z);\n ALPHABET_MAP[x] = z;\n}\nfunction polymodStep(pre) {\n const b = pre >> 25;\n return (((pre & 0x1ffffff) << 5) ^\n (-((b >> 0) & 1) & 0x3b6a57b2) ^\n (-((b >> 1) & 1) & 0x26508e6d) ^\n (-((b >> 2) & 1) & 0x1ea119fa) ^\n (-((b >> 3) & 1) & 0x3d4233dd) ^\n (-((b >> 4) & 1) & 0x2a1462b3));\n}\nfunction prefixChk(prefix) {\n let chk = 1;\n for (let i = 0; i < prefix.length; ++i) {\n const c = prefix.charCodeAt(i);\n if (c < 33 || c > 126)\n return 'Invalid prefix (' + prefix + ')';\n chk = polymodStep(chk) ^ (c >> 5);\n }\n chk = polymodStep(chk);\n for (let i = 0; i < prefix.length; ++i) {\n const v = prefix.charCodeAt(i);\n chk = polymodStep(chk) ^ (v & 0x1f);\n }\n return chk;\n}\nfunction convert(data, inBits, outBits, pad) {\n let value = 0;\n let bits = 0;\n const maxV = (1 << outBits) - 1;\n const result = [];\n for (let i = 0; i < data.length; ++i) {\n value = (value << inBits) | data[i];\n bits += inBits;\n while (bits >= outBits) {\n bits -= outBits;\n result.push((value >> bits) & maxV);\n }\n }\n if (pad) {\n if (bits > 0) {\n result.push((value << (outBits - bits)) & maxV);\n }\n }\n else {\n if (bits >= inBits)\n return 'Excess padding';\n if ((value << (outBits - bits)) & maxV)\n return 'Non-zero padding';\n }\n return result;\n}\nfunction toWords(bytes) {\n return convert(bytes, 8, 5, true);\n}\nfunction fromWordsUnsafe(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n}\nfunction fromWords(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n throw new Error(res);\n}\nfunction getLibraryFromEncoding(encoding) {\n let ENCODING_CONST;\n if (encoding === 'bech32') {\n ENCODING_CONST = 1;\n }\n else {\n ENCODING_CONST = 0x2bc830a3;\n }\n function encode(prefix, words, LIMIT) {\n LIMIT = LIMIT || 90;\n if (prefix.length + 7 + words.length > LIMIT)\n throw new TypeError('Exceeds length limit');\n prefix = prefix.toLowerCase();\n // determine chk mod\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n throw new Error(chk);\n let result = prefix + '1';\n for (let i = 0; i < words.length; ++i) {\n const x = words[i];\n if (x >> 5 !== 0)\n throw new Error('Non 5-bit word');\n chk = polymodStep(chk) ^ x;\n result += ALPHABET.charAt(x);\n }\n for (let i = 0; i < 6; ++i) {\n chk = polymodStep(chk);\n }\n chk ^= ENCODING_CONST;\n for (let i = 0; i < 6; ++i) {\n const v = (chk >> ((5 - i) * 5)) & 0x1f;\n result += ALPHABET.charAt(v);\n }\n return result;\n }\n function __decode(str, LIMIT) {\n LIMIT = LIMIT || 90;\n if (str.length < 8)\n return str + ' too short';\n if (str.length > LIMIT)\n return 'Exceeds length limit';\n // don't allow mixed case\n const lowered = str.toLowerCase();\n const uppered = str.toUpperCase();\n if (str !== lowered && str !== uppered)\n return 'Mixed-case string ' + str;\n str = lowered;\n const split = str.lastIndexOf('1');\n if (split === -1)\n return 'No separator character for ' + str;\n if (split === 0)\n return 'Missing prefix for ' + str;\n const prefix = str.slice(0, split);\n const wordChars = str.slice(split + 1);\n if (wordChars.length < 6)\n return 'Data too short';\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n return chk;\n const words = [];\n for (let i = 0; i < wordChars.length; ++i) {\n const c = wordChars.charAt(i);\n const v = ALPHABET_MAP[c];\n if (v === undefined)\n return 'Unknown character ' + c;\n chk = polymodStep(chk) ^ v;\n // not in the checksum?\n if (i + 6 >= wordChars.length)\n continue;\n words.push(v);\n }\n if (chk !== ENCODING_CONST)\n return 'Invalid checksum for ' + str;\n return { prefix, words };\n }\n function decodeUnsafe(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n }\n function decode(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n throw new Error(res);\n }\n return {\n decodeUnsafe,\n decode,\n encode,\n toWords,\n fromWordsUnsafe,\n fromWords,\n };\n}\nexports.bech32 = getLibraryFromEncoding('bech32');\nexports.bech32m = getLibraryFromEncoding('bech32m');\n"],"names":["HpkeError","Error","constructor","e","message","super","this","name","EncapError","DecapError","ExportError","SealError","OpenError","MessageLimitReachedError","DeriveKeyPairError","dntGlobalThis","baseObj","globalThis","extObj","Proxy","get","_target","prop","_receiver","set","value","deleteProperty","success","ownKeys","baseKeys","Reflect","extKeys","extKeysSet","Set","filter","k","has","defineProperty","desc","getOwnPropertyDescriptor","NativeAlgorithm","Object","enumerable","configurable","writable","undefined","_setup","_api","async","crypto","subtle","webcrypto","loadSubtleCrypto","INPUT_LENGTH_LIMIT","Uint8Array","x","privateKey","publicKey","n","w","ret","i","a","b","length","LABEL_EAE_PRK","LABEL_SHARED_SECRET","Dhkem","id","prim","kdf","_prim","_kdf","suiteId","init","serializePublicKey","key","deserializePublicKey","serializePrivateKey","deserializePrivateKey","importKey","format","isPublic","generateKeyPair","deriveKeyPair","ikm","byteLength","encap","params","ke","ekm","enc","pkrm","recipientPublicKey","dh","kemContext","senderKey","sks","pks","derivePublicKey","pksm","c","concat3","sharedSecret","_generateSharedSecret","decap","pke","skr","recipientKey","pkr","senderPublicKey","labeledIkm","buildLabeledIkm","labeledInfo","buildLabeledInfo","secretSize","extractAndExpand","buffer","KEM_USAGES","Bignum","size","_num","val","reset","fill","src","isZero","lessThan","v","LABEL_CANDIDATE","ORDER_P_256","ORDER_P_384","ORDER_P_521","PKCS8_ALG_ID_P_256","PKCS8_ALG_ID_P_384","PKCS8_ALG_ID_P_521","Ec","kem","hkdf","_hkdf","_alg","namedCurve","_nPk","_nSk","_nDh","_order","_bitmask","_pkcs8AlgId","exportKey","_importRawKey","jwk","base64","replace","byteString","atob","charCodeAt","base64UrlToBytes","ArrayBuffer","_importJWK","generateKey","dkpPrk","labeledExtract","bn","counter","bytes","labeledExpand","sk","_deserializePkcs8Key","pk","deriveBits","public","crv","d","pkcs8Key","HPKE_VERSION","HkdfNative","hash","_suiteId","label","_checkInit","info","len","extract","salt","hashSize","algHash","sign","expand","prk","okm","p","prev","mid","tail","tmp","cur","slice","baseKey","HkdfSha256Native","arguments","AEAD_USAGES","BigInt","AesGcmContext","_rawKey","seal","iv","data","aad","_setupKey","alg","additionalData","encrypt","_key","open","decrypt","_importKey","Aes128Gcm","createEncryptionContext","Aes256Gcm","emitNotSupported","Promise","_resolve","reject","LABEL_SEC","ExporterContextImpl","api","exporterSecret","_data","_aad","exporterContext","RecipientExporterContextImpl","SenderExporterContextImpl","EncryptionContextImpl","baseNonce","seq","_aead","aead","_nK","keySize","_nN","nonceSize","_nT","tagSize","_ctx","computeNonce","seqBytes","buf","xor","incrementSeq","Number","MAX_SAFE_INTEGER","_Mutex_locked","Mutex","resolve","lock","releaseLock","nextLock","previousLock","receiver","state","kind","f","TypeError","call","__classPrivateFieldGet","__classPrivateFieldSet","WeakMap","_RecipientContextImpl_mutex","RecipientContextImpl","release","pt","_SenderContextImpl_mutex","SenderContextImpl","ct","LABEL_BASE_NONCE","LABEL_EXP","LABEL_INFO_HASH","LABEL_KEY","LABEL_PSK_ID_HASH","LABEL_SECRET","SUITE_ID_HEADER_HPKE","CipherSuiteNative","_kem","createSenderContext","_validateInputLength","mode","psk","_keyScheduleS","createRecipientContext","_keyScheduleR","ctx","_keySchedule","pskId","pskIdHash","infoHash","keyScheduleContext","exporterSecretInfo","keyInfo","baseNonceInfo","res","DhkemP256HkdfSha256Native","CipherSuite","DhkemP256HkdfSha256","HkdfSha256","exports","ALPHABET","ALPHABET_MAP","z","charAt","polymodStep","pre","prefixChk","prefix","chk","convert","inBits","outBits","pad","bits","maxV","result","push","toWords","fromWordsUnsafe","words","Array","isArray","fromWords","getLibraryFromEncoding","encoding","ENCODING_CONST","__decode","str","LIMIT","lowered","toLowerCase","uppered","toUpperCase","split","lastIndexOf","wordChars","decodeUnsafe","decode","encode"],"sourceRoot":""} \ No newline at end of file diff --git a/import/dist/vendors.bundle.e51510083e80829f1ae1.js b/import/dist/vendors.bundle.e51510083e80829f1ae1.js new file mode 100644 index 00000000..129d48de --- /dev/null +++ b/import/dist/vendors.bundle.e51510083e80829f1ae1.js @@ -0,0 +1,2 @@ +"use strict";(self.webpackChunk_turnkey_frames_import=self.webpackChunk_turnkey_frames_import||[]).push([[96],{252:(e,t,r)=>{r.d(t,{ws:()=>se,GR:()=>Ee,RG:()=>ze,v7:()=>Oe});class i extends Error{constructor(e){let t;t=e instanceof Error?e.message:"string"==typeof e?e:"",super(t),this.name=this.constructor.name}}class n extends i{}class a extends i{}class s extends i{}class o extends i{}class c extends i{}class h extends i{}class l extends i{}class f extends i{}class u extends i{}class d extends i{}class b extends i{}const w=(y=globalThis,p={},new Proxy(y,{get:(e,t,r)=>t in p?p[t]:y[t],set:(e,t,r)=>(t in p&&delete p[t],y[t]=r,!0),deleteProperty(e,t){let r=!1;return t in p&&(delete p[t],r=!0),t in y&&(delete y[t],r=!0),r},ownKeys(e){const t=Reflect.ownKeys(y),r=Reflect.ownKeys(p),i=new Set(r);return[...t.filter(e=>!i.has(e)),...r]},defineProperty:(e,t,r)=>(t in p&&delete p[t],Reflect.defineProperty(y,t,r),!0),getOwnPropertyDescriptor:(e,t)=>t in p?Reflect.getOwnPropertyDescriptor(p,t):Reflect.getOwnPropertyDescriptor(y,t),has:(e,t)=>t in p||t in y}));var y,p;class _{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){void 0===this._api&&(this._api=await async function(){if(void 0!==w&&void 0!==globalThis.crypto)return globalThis.crypto.subtle;try{const{webcrypto:e}=await r.e(640).then(r.t.bind(r,640,19));return e.subtle}catch(e){throw new b(e)}}())}}const g=8192,m=new Uint8Array(0),v=(()=>{const e=new Array(256);let t=0,r=0n;for(;t<256;)e[t]=r,t++,r+=1n;return e})(),k=new Uint8Array([75,69,77,0,0]),P=new Uint8Array([72,80,75,69,45,118,49]);function A(e){return e instanceof ArrayBuffer?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength).slice().buffer:new Uint8Array(e).slice().buffer}class K extends _{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:m}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();const r=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return r.set(P,0),r.set(this._suiteId,7),r.set(e,7+this._suiteId.byteLength),r.set(t,7+this._suiteId.byteLength+e.byteLength),r}buildLabeledInfo(e,t,r){this._checkInit();const i=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return i.set(new Uint8Array([0,r]),0),i.set(P,2),i.set(this._suiteId,9),i.set(e,9+this._suiteId.byteLength),i.set(t,9+this._suiteId.byteLength+e.byteLength),i}async extract(e,t){await this._setup();const r=0===e.byteLength?new ArrayBuffer(this.hashSize):A(e);if(r.byteLength!==this.hashSize)throw new n("The salt length must be the same as the hashSize");const i=A(t),a=await this._api.importKey("raw",r,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",a,i)}async expand(e,t,r){await this._setup();const i=A(e),n=await this._api.importKey("raw",i,this.algHash,!1,["sign"]),a=new ArrayBuffer(r),s=new Uint8Array(a);let o=m;const c=new Uint8Array(A(t)),h=new Uint8Array(1);if(r>255*this.hashSize)throw new Error("Entropy limit reached");const l=new Uint8Array(this.hashSize+c.length+1);for(let e=1,t=0;t=o.length?(s.set(o,t),t+=o.length):(s.set(o.slice(0,s.length-t),t),t+=s.length-t);return a}async extractAndExpand(e,t,r,i){await this._setup();const n=A(t),a=await this._api.importKey("raw",n,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:A(e),info:A(r)},a,8*i)}async labeledExtract(e,t,r){return await this.extract(e,this.buildLabeledIkm(t,r))}async labeledExpand(e,t,r,i){return await this.expand(e,this.buildLabeledInfo(t,r,i),i)}_checkInit(){if(this._suiteId===m)throw new Error("Not initialized. Call init()")}}class x extends K{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:1}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}}const U=e=>"object"==typeof e&&null!==e&&"object"==typeof e.privateKey&&"object"==typeof e.publicKey;function S(e,t){if(t<=0)throw new Error("i2Osp: too small size");if(e>=256**t)throw new Error("i2Osp: too large integer");const r=new Uint8Array(t);for(let i=0;ig)throw new n("Too long ikm");return await this._prim.deriveKeyPair(t)}async encap(e){let t;t=void 0===e.ekm?await this.generateKeyPair():U(e.ekm)?e.ekm:await this.deriveKeyPair(e.ekm);const r=await this._prim.serializePublicKey(t.publicKey),i=await this._prim.serializePublicKey(e.recipientPublicKey);try{let n,a;if(void 0===e.senderKey)n=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{const r=U(e.senderKey)?e.senderKey.privateKey:e.senderKey;n=j(new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),new Uint8Array(await this._prim.dh(r,e.recipientPublicKey)))}if(void 0===e.senderKey)a=j(new Uint8Array(r),new Uint8Array(i));else{const t=U(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),n=await this._prim.serializePublicKey(t);a=function(e,t,r){const i=new Uint8Array(e.length+t.length+r.length);return i.set(e,0),i.set(t,e.length),i.set(r,e.length+t.length),i}(new Uint8Array(r),new Uint8Array(i),new Uint8Array(n))}return{enc:r,sharedSecret:await this._generateSharedSecret(n,a)}}catch(e){throw new o(e)}}async decap(e){const t=A(e.enc),r=await this._prim.deserializePublicKey(t),i=U(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,n=U(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),a=await this._prim.serializePublicKey(n);try{let n,s;if(void 0===e.senderPublicKey)n=new Uint8Array(await this._prim.dh(i,r));else{n=j(new Uint8Array(await this._prim.dh(i,r)),new Uint8Array(await this._prim.dh(i,e.senderPublicKey)))}if(void 0===e.senderPublicKey)s=j(new Uint8Array(t),new Uint8Array(a));else{const r=await this._prim.serializePublicKey(e.senderPublicKey);s=new Uint8Array(t.byteLength+a.byteLength+r.byteLength),s.set(new Uint8Array(t),0),s.set(new Uint8Array(a),t.byteLength),s.set(new Uint8Array(r),t.byteLength+a.byteLength)}return await this._generateSharedSecret(n,s)}catch(e){throw new c(e)}}async _generateSharedSecret(e,t){const r=this._kdf.buildLabeledIkm(E,e),i=this._kdf.buildLabeledInfo(z,t,this.secretSize);return await this._kdf.extractAndExpand(m,r,i,this.secretSize)}}const I=["deriveBits"],L=new Uint8Array([100,107,112,95,112,114,107]);class C{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}}const T=new Uint8Array([99,97,110,100,105,100,97,116,101]),N=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),D=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),H=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),R=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),M=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),B=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),q={p:0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn,b:0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,gx:0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296n,gy:0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5n,coordinateSize:32},W={p:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffffn,b:0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aefn,gx:0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7n,gy:0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5fn,coordinateSize:48},G={p:(1n<<521n)-1n,b:0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00n,gx:0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66n,gy:0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650n,coordinateSize:66};function F(e,t){const r=e%t;return r>=0n?r:r+t}function J(e,t,r){let i=1n,n=F(e,r),a=t;for(;a>0n;)1n==(1n&a)&&(i=F(i*n,r)),n=F(n*n,r),a>>=1n;return i}function Z(e,t){const r=new Uint8Array(t);let i=e;for(let e=t-1;e>=0;e--)r[e]=Number(0xffn&i),i>>=8n;if(0n!==i)throw new Error("Invalid coordinate length");return r}function V(e,t,r){const i=new Uint8Array(1+2*r);return i[0]=4,i.set(Z(e,r),1),i.set(Z(t,r),1+r),i}class X extends _{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_curveParams",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case 16:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=N,this._bitmask=255,this._pkcs8AlgId=R,this._curveParams=q;break;case 17:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=D,this._bitmask=255,this._pkcs8AlgId=M,this._curveParams=W;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=H,this._bitmask=1,this._pkcs8AlgId=B,this._curveParams=G}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(e){throw new a(e)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(A(e),!0)}catch(e){throw new s(e)}}async serializePrivateKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return function(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=atob(t),i=new Uint8Array(r.length);for(let e=0;e255)throw new Error("Faild to derive a key pair");const t=new Uint8Array(await this._hkdf.labeledExpand(r,T,S(e,1),this._nSk));t[0]=t[0]&this._bitmask,i.set(t)}const n=await this._deserializePkcs8Key(i.val());return i.reset(),{privateKey:n,publicKey:await this.derivePublicKey(n)}}catch(e){throw new d(e)}}async derivePublicKey(e){await this._setup();try{const t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch{try{return await this._derivePublicKeyWithoutJwkExport(e)}catch(e){throw new s(e)}}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,8*this._nDh)}catch(e){throw new a(e)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(void 0===e.crv||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(void 0!==e.d)throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(void 0===e.d)throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,I)}async _deserializePkcs8Key(e){const t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,I)}async _derivePublicKeyWithoutJwkExport(e){const t=V(this._curveParams.gx,this._curveParams.gy,this._curveParams.coordinateSize),r=await this._api.importKey("raw",t.buffer,this._alg,!0,[]),i=new Uint8Array(await this._api.deriveBits({name:"ECDH",public:r},e,8*this._nDh)),n=this._curveParams.p,a=function(e){let t=0n;for(const r of e)t=t<<8n|v[r];return t}(i);let s=function(e,t){const r=J(e,t+1n>>2n,t);if(F(r*r,t)!==F(e,t))throw new Error("Invalid ECDH point");return r}(F(J(a,3n,n)-3n*a+this._curveParams.b,n),n);1n==(1n&s)&&(s=n-s);const o=V(a,s,this._curveParams.coordinateSize);return await this._api.importKey("raw",o.buffer,this._alg,!0,[])}}const $=["encrypt","decrypt"];new Uint8Array(new Uint32Array([287454020]).buffer)[0];const Q=0xffffffffn;function Y(e,t=!1){return t?{h:Number(e&Q),l:Number(e>>32n&Q)}:{h:0|Number(e>>32n&Q),l:0|Number(e&Q)}}const ee=[],te=[],re=[];for(let e=0,t=1n,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],ee.push(2*(5*i+r)),te.push((e+1)*(e+2)/2%64);let n=0n;for(let e=0;e<7;e++)t=(t<<1n^113n*(t>>7n))%256n,2n&t&&(n^=1n<<(1n<{t(new b("Not supported"))})}const ce=new Uint8Array([115,101,99]);class he{constructor(e,t,r){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=r}async seal(e,t){return await oe()}async open(e,t){return await oe()}async export(e,t){if(e.byteLength>g)throw new n("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,ce,new Uint8Array(e),t)}catch(e){throw new h(e)}}}class le extends he{}class fe extends he{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}}class ue extends he{constructor(e,t,r){if(super(e,t,r.exporterSecret),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nK",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nN",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nT",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),void 0===r.key||void 0===r.baseNonce||void 0===r.seq)throw new Error("Required parameters are missing");this._aead=r.aead,this._nK=this._aead.keySize,this._nN=this._aead.nonceSize,this._nT=this._aead.tagSize;const i=this._aead.createEncryptionContext(r.key);this._ctx={key:i,baseNonce:r.baseNonce,seq:r.seq}}computeNonce(e){const t=S(e.seq,e.baseNonce.byteLength);return function(e,t){if(e.byteLength!==t.byteLength)throw new Error("xor: different length inputs");const r=new Uint8Array(e.byteLength);for(let i=0;iNumber.MAX_SAFE_INTEGER)throw new u("Message limit reached");e.seq+=1}}var de;class be{constructor(){de.set(this,Promise.resolve())}async lock(){let e;const t=new Promise(t=>{e=t}),r=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)}(this,de,"f");return function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,de,t,"f"),await r,e}}de=new WeakMap;var we,ye=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};class pe extends ue{constructor(){super(...arguments),we.set(this,void 0)}async open(e,t=m.buffer){!function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,we,ye(this,we,"f")??new be,"f");const r=await ye(this,we,"f").lock();let i;try{i=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(e){throw new f(e)}finally{r()}return this.incrementSeq(this._ctx),i}}we=new WeakMap;var _e,ge=function(e,t,r,i){if("a"===r&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)};class me extends ue{constructor(e,t,r,i){super(e,t,r),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),_e.set(this,void 0),this.enc=i}async seal(e,t=m.buffer){!function(e,t,r,i,n){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!n)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?n.call(e,r):n?n.value=r:t.set(e,r)}(this,_e,ge(this,_e,"f")??new be,"f");const r=await ge(this,_e,"f").lock();let i;try{i=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(e){throw new l(e)}finally{r()}return this.incrementSeq(this._ctx),i}}_e=new WeakMap;const ve=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),ke=new Uint8Array([101,120,112]),Pe=new Uint8Array([105,110,102,111,95,104,97,115,104]),Ae=new Uint8Array([107,101,121]),Ke=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),xe=new Uint8Array([115,101,99,114,101,116]),Ue=new Uint8Array([72,80,75,69,0,0,0,0,0,0]);class Se extends _{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),"number"==typeof e.kem)throw new n("KemId cannot be used");if(this._kem=e.kem,"number"==typeof e.kdf)throw new n("KdfId cannot be used");if(this._kdf=e.kdf,"number"==typeof e.aead)throw new n("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(Ue),this._suiteId.set(S(this._kem.id,2),4),this._suiteId.set(S(this._kdf.id,2),6),this._suiteId.set(S(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.encap(e);let r;return r=void 0!==e.psk?void 0!==e.senderKey?3:1:void 0!==e.senderKey?2:0,await this._keyScheduleS(r,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();const t=await this._kem.decap(e);let r;return r=void 0!==e.psk?void 0!==e.senderPublicKey?3:1:void 0!==e.senderPublicKey?2:0,await this._keyScheduleR(r,t,e)}async seal(e,t,r=m.buffer){const i=await this.createSenderContext(e);return{ct:await i.seal(t,r),enc:i.enc}}async open(e,t,r=m.buffer){const i=await this.createRecipientContext(e);return await i.open(t,r)}async _keySchedule(e,t,r){const i=void 0===r.psk?m:new Uint8Array(r.psk.id),n=await this._kdf.labeledExtract(m.buffer,Ke,i),a=void 0===r.info?m:new Uint8Array(r.info),s=await this._kdf.labeledExtract(m.buffer,Pe,a),o=new Uint8Array(1+n.byteLength+s.byteLength);o.set(new Uint8Array([e]),0),o.set(new Uint8Array(n),1),o.set(new Uint8Array(s),1+n.byteLength);const c=void 0===r.psk?m:new Uint8Array(r.psk.key),h=this._kdf.buildLabeledIkm(xe,c).buffer,l=this._kdf.buildLabeledInfo(ke,o,this._kdf.hashSize).buffer,f=await this._kdf.extractAndExpand(t,h,l,this._kdf.hashSize);if(65535===this._aead.id)return{aead:this._aead,exporterSecret:f};const u=this._kdf.buildLabeledInfo(Ae,o,this._aead.keySize).buffer,d=await this._kdf.extractAndExpand(t,h,u,this._aead.keySize),b=this._kdf.buildLabeledInfo(ve,o,this._aead.nonceSize).buffer,w=await this._kdf.extractAndExpand(t,h,b,this._aead.nonceSize);return{aead:this._aead,exporterSecret:f,key:d,baseNonce:new Uint8Array(w),seq:0}}async _keyScheduleS(e,t,r,i){const n=await this._keySchedule(e,t,i);return void 0===n.key?new fe(this._api,this._kdf,n.exporterSecret,r):new me(this._api,this._kdf,n,r)}async _keyScheduleR(e,t,r){const i=await this._keySchedule(e,t,r);return void 0===i.key?new le(this._api,this._kdf,i.exporterSecret):new pe(this._api,this._kdf,i)}_validateInputLength(e){if(void 0!==e.info&&e.info.byteLength>268435456)throw new n("Too long info");if(void 0!==e.psk){if(e.psk.key.byteLength<32)throw new n("PSK must have at least 32 bytes");if(e.psk.key.byteLength>g)throw new n("Too long psk.key");if(e.psk.id.byteLength>g)throw new n("Too long psk.id")}}}class je extends O{constructor(){const e=new x;super(16,new X(16,e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}}class Ee extends Se{}class ze extends je{}class Oe extends x{}new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,110,4,34,4,32]),new Uint8Array([48,70,2,1,0,48,5,6,3,43,101,111,4,58,4,56])},604:(e,t)=>{t.I=void 0;const r="qpzry9x8gf2tvdw0s3jn54khce6mua7l",i={};for(let e=0;e<32;e++){const t=r.charAt(e);i[t]=e}function n(e){const t=e>>25;return(33554431&e)<<5^996825010&-(1&t)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function a(e){let t=1;for(let r=0;r126)return"Invalid prefix ("+e+")";t=n(t)^i>>5}t=n(t);for(let r=0;r=r;)a-=r,o.push(n>>a&s);if(i)a>0&&o.push(n<=t)return"Excess padding";if(n<r)return"Exceeds length limit";const s=e.toLowerCase(),o=e.toUpperCase();if(e!==s&&e!==o)return"Mixed-case string "+e;const c=(e=s).lastIndexOf("1");if(-1===c)return"No separator character for "+e;if(0===c)return"Missing prefix for "+e;const h=e.slice(0,c),l=e.slice(c+1);if(l.length<6)return"Data too short";let f=a(h);if("string"==typeof f)return f;const u=[];for(let e=0;e=l.length||u.push(r)}return f!==t?"Invalid checksum for "+e:{prefix:h,words:u}}return t="bech32"===e?1:734539939,{decodeUnsafe:function(e,t){const r=s(e,t);if("object"==typeof r)return r},decode:function(e,t){const r=s(e,t);if("object"==typeof r)return r;throw new Error(r)},encode:function(e,i,s){if(s=s||90,e.length+7+i.length>s)throw new TypeError("Exceeds length limit");let o=a(e=e.toLowerCase());if("string"==typeof o)throw new Error(o);let c=e+"1";for(let e=0;e>5)throw new Error("Non 5-bit word");o=n(o)^t,c+=r.charAt(t)}for(let e=0;e<6;++e)o=n(o);o^=t;for(let e=0;e<6;++e)c+=r.charAt(o>>5*(5-e)&31);return c},toWords:o,fromWordsUnsafe:c,fromWords:h}}t.I=l("bech32"),l("bech32m")}}]); +//# sourceMappingURL=vendors.bundle.e51510083e80829f1ae1.js.map \ No newline at end of file diff --git a/import/dist/vendors.bundle.e51510083e80829f1ae1.js.map b/import/dist/vendors.bundle.e51510083e80829f1ae1.js.map new file mode 100644 index 00000000..86bfb936 --- /dev/null +++ b/import/dist/vendors.bundle.e51510083e80829f1ae1.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vendors.bundle.e51510083e80829f1ae1.js","mappings":"8KAIO,MAAAA,UAAAC,MACP,WAAAC,CAAAC,GACA,IAAAC,EAEAA,EADAD,aAAAF,MACAE,EAAAC,QAEA,iBAAAD,EACAA,EAGA,GAEAE,MAAAD,GACAE,KAAAC,KAAAD,KAAAJ,YAAAK,IACA,EAMO,MAAMC,UAAiBR,GAYvB,MAAMS,UAAcT,GAMpB,MAAMU,UAAgBV,GAMtB,MAAAW,UAAAX,GAMA,MAAAY,UAAAZ,GAMA,MAAAa,UAAAb,GAMA,MAAAc,UAAAd,GAMA,MAAAe,UAAAf,GAMA,MAAAgB,UAAAhB,GAMA,MAAMiB,UAAkBjB,GAMxB,MAAMkB,UAAiBlB,GC1F9B,MACOmB,GACPC,EADOC,WACPC,EAFA,GAGA,IAAAC,MAAAH,EAAA,CACAI,IAAA,CAAAC,EAAAC,EAAAC,IACAD,KAAAJ,EACAA,EAAAI,GAGAN,EAAAM,GAGAE,IAAA,CAAAH,EAAAC,EAAAG,KAC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A7T,SAAkBb,EAAA,CAC1C,MAAAoD,EAAAsR,EAAA1U,GACA,GAAAoD,GAAA,EACA,UAAAtH,MAAA,kBACAmY,EAAAJ,EAAAI,GAAA7Q,EACAsF,GAAA+K,EAAAG,OAAAxQ,EACA,CACA,QAAApD,EAAA,EAAwBA,EAAA,IAAOA,EAC/BiU,EAAAJ,EAAAI,GAEAA,GAAAc,EACA,QAAA/U,EAAA,EAAwBA,EAAA,IAAOA,EAE/B0I,GAAA+K,EAAAG,OADAK,GAAA,KAAAjU,GAAA,IAGA,OAAA0I,CACA,EAwDA8L,UACAC,kBACAG,YAEA,CACArB,EAAAC,EAAcqB,EAAA,UACCA,EAAA","sources":["webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/errors.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/_dnt.shims.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/algorithm.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/identifiers.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/consts.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/kemInterface.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kdfs/hkdf.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/misc.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkem.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/dhkemPrimitives.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/bignum.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/kems/dhkemPrimitives/ec.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/interfaces/aeadEncryptionContext.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/utils/noble.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/md.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/u64.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/sha2.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+common@1.10.1/node_modules/@hpke/common/esm/src/hash/sha3.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/aeads/aesGcm.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/utils/emitNotSupported.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/exporterContext.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/encryptionContext.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/mutex.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/recipientContext.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/senderContext.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/cipherSuiteNative.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemNative.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/native.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x25519.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/@hpke+core@1.7.5/node_modules/@hpke/core/esm/src/kems/dhkemPrimitives/x448.js","webpack://@turnkey/frames-import/../node_modules/.pnpm/bech32@2.0.0/node_modules/bech32/dist/index.js"],"sourcesContent":["/**\n * The base error class of hpke-js.\n * @group Errors\n */\nexport class HpkeError extends Error {\n constructor(e) {\n let message;\n if (e instanceof Error) {\n message = e.message;\n }\n else if (typeof e === \"string\") {\n message = e;\n }\n else {\n message = \"\";\n }\n super(message);\n this.name = this.constructor.name;\n }\n}\n/**\n * Invalid parameter.\n * @group Errors\n */\nexport class InvalidParamError extends HpkeError {\n}\n/**\n * KEM input or output validation failure.\n * @group Errors\n */\nexport class ValidationError extends HpkeError {\n}\n/**\n * Public or private key serialization failure.\n * @group Errors\n */\nexport class SerializeError extends HpkeError {\n}\n/**\n * Public or private key deserialization failure.\n * @group Errors\n */\nexport class DeserializeError extends HpkeError {\n}\n/**\n * encap() failure.\n * @group Errors\n */\nexport class EncapError extends HpkeError {\n}\n/**\n * decap() failure.\n * @group Errors\n */\nexport class DecapError extends HpkeError {\n}\n/**\n * Secret export failure.\n * @group Errors\n */\nexport class ExportError extends HpkeError {\n}\n/**\n * seal() failure.\n * @group Errors\n */\nexport class SealError extends HpkeError {\n}\n/**\n * open() failure.\n * @group Errors\n */\nexport class OpenError extends HpkeError {\n}\n/**\n * Sequence number overflow on the encryption context.\n * @group Errors\n */\nexport class MessageLimitReachedError extends HpkeError {\n}\n/**\n * Key pair derivation failure.\n * @group Errors\n */\nexport class DeriveKeyPairError extends HpkeError {\n}\n/**\n * Not supported failure.\n * @group Errors\n */\nexport class NotSupportedError extends HpkeError {\n}\n","const dntGlobals = {};\nexport const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);\nfunction createMergeProxy(baseObj, extObj) {\n return new Proxy(baseObj, {\n get(_target, prop, _receiver) {\n if (prop in extObj) {\n return extObj[prop];\n }\n else {\n return baseObj[prop];\n }\n },\n set(_target, prop, value) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n baseObj[prop] = value;\n return true;\n },\n deleteProperty(_target, prop) {\n let success = false;\n if (prop in extObj) {\n delete extObj[prop];\n success = true;\n }\n if (prop in baseObj) {\n delete baseObj[prop];\n success = true;\n }\n return success;\n },\n ownKeys(_target) {\n const baseKeys = Reflect.ownKeys(baseObj);\n const extKeys = Reflect.ownKeys(extObj);\n const extKeysSet = new Set(extKeys);\n return [...baseKeys.filter((k) => !extKeysSet.has(k)), ...extKeys];\n },\n defineProperty(_target, prop, desc) {\n if (prop in extObj) {\n delete extObj[prop];\n }\n Reflect.defineProperty(baseObj, prop, desc);\n return true;\n },\n getOwnPropertyDescriptor(_target, prop) {\n if (prop in extObj) {\n return Reflect.getOwnPropertyDescriptor(extObj, prop);\n }\n else {\n return Reflect.getOwnPropertyDescriptor(baseObj, prop);\n }\n },\n has(_target, prop) {\n return prop in extObj || prop in baseObj;\n },\n });\n}\n","import * as dntShim from \"../_dnt.shims.js\";\nimport { NotSupportedError } from \"./errors.js\";\nasync function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n}\nexport class NativeAlgorithm {\n constructor() {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n }\n async _setup() {\n if (this._api !== undefined) {\n return;\n }\n this._api = await loadSubtleCrypto();\n }\n}\n","/**\n * The supported HPKE modes.\n */\nexport const Mode = {\n Base: 0x00,\n Psk: 0x01,\n Auth: 0x02,\n AuthPsk: 0x03,\n};\n/**\n * The supported Key Encapsulation Mechanism (KEM) identifiers.\n */\nexport const KemId = {\n NotAssigned: 0x0000,\n DhkemP256HkdfSha256: 0x0010,\n DhkemP384HkdfSha384: 0x0011,\n DhkemP521HkdfSha512: 0x0012,\n DhkemSecp256k1HkdfSha256: 0x0013,\n DhkemX25519HkdfSha256: 0x0020,\n DhkemX448HkdfSha512: 0x0021,\n HybridkemX25519Kyber768: 0x0030,\n MlKem512: 0x0040,\n MlKem768: 0x0041,\n MlKem1024: 0x0042,\n XWing: 0x647a,\n};\n/**\n * The supported Key Derivation Function (KDF) identifiers.\n */\nexport const KdfId = {\n HkdfSha256: 0x0001,\n HkdfSha384: 0x0002,\n HkdfSha512: 0x0003,\n Sha3256: 0x0004,\n Sha3384: 0x0005,\n Sha3512: 0x0006,\n Shake128: 0x0010,\n Shake256: 0x0011,\n TurboShake128: 0x0012,\n TurboShake256: 0x0013,\n};\n/**\n * The supported Authenticated Encryption with Associated Data (AEAD) identifiers.\n */\nexport const AeadId = {\n Aes128Gcm: 0x0001,\n Aes256Gcm: 0x0002,\n Chacha20Poly1305: 0x0003,\n ExportOnly: 0xFFFF,\n};\n","// The input length limit (psk, psk_id, info, exporter_context, ikm).\nexport const INPUT_LENGTH_LIMIT = 8192;\nexport const INFO_LENGTH_LIMIT = 268435456;\n// The minimum length of a PSK.\nexport const MINIMUM_PSK_LENGTH = 32;\n// b\"\"\nexport const EMPTY = /* @__PURE__ */ new Uint8Array(0);\n// Common BigInt constants\nexport const N_0 = 0n;\nexport const N_1 = 1n;\nexport const N_2 = 2n;\nexport const N_7 = 7n;\nexport const N_32 = 32n;\nexport const N_256 = 256n;\nexport const N_0x71 = 0x71n;\nexport const BYTE_TO_BIGINT_256 = /* @__PURE__ */ (() => {\n const out = new Array(256);\n let i = 0;\n let value = 0n;\n while (i < 256) {\n out[i] = value;\n i++;\n value += 1n;\n }\n return out;\n})();\n","// b\"KEM\"\nexport const SUITE_ID_HEADER_KEM = /* @__PURE__ */ new Uint8Array([\n 75,\n 69,\n 77,\n 0,\n 0,\n]);\n","import { EMPTY } from \"../consts.js\";\nimport { InvalidParamError } from \"../errors.js\";\nimport { KdfId } from \"../identifiers.js\";\nimport { NativeAlgorithm } from \"../algorithm.js\";\n// b\"HPKE-v1\"\nconst HPKE_VERSION = /* @__PURE__ */ new Uint8Array([\n 72,\n 80,\n 75,\n 69,\n 45,\n 118,\n 49,\n]);\nexport function toUint8Array(input) {\n return new Uint8Array(toArrayBuffer(input));\n}\nexport function toArrayBuffer(input) {\n if (input instanceof ArrayBuffer) {\n return input;\n }\n if (ArrayBuffer.isView(input)) {\n return new Uint8Array(input.buffer, input.byteOffset, input.byteLength)\n .slice().buffer;\n }\n return new Uint8Array(input).slice().buffer;\n}\nexport class HkdfNative extends NativeAlgorithm {\n constructor() {\n super();\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: EMPTY\n });\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n init(suiteId) {\n this._suiteId = suiteId;\n }\n buildLabeledIkm(label, ikm) {\n this._checkInit();\n const ret = new Uint8Array(7 + this._suiteId.byteLength + label.byteLength + ikm.byteLength);\n ret.set(HPKE_VERSION, 0);\n ret.set(this._suiteId, 7);\n ret.set(label, 7 + this._suiteId.byteLength);\n ret.set(ikm, 7 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n buildLabeledInfo(label, info, len) {\n this._checkInit();\n const ret = new Uint8Array(9 + this._suiteId.byteLength + label.byteLength + info.byteLength);\n ret.set(new Uint8Array([0, len]), 0);\n ret.set(HPKE_VERSION, 2);\n ret.set(this._suiteId, 9);\n ret.set(label, 9 + this._suiteId.byteLength);\n ret.set(info, 9 + this._suiteId.byteLength + label.byteLength);\n return ret;\n }\n async extract(salt, ikm) {\n await this._setup();\n const saltBuf = salt.byteLength === 0\n ? new ArrayBuffer(this.hashSize)\n : toArrayBuffer(salt);\n if (saltBuf.byteLength !== this.hashSize) {\n throw new InvalidParamError(\"The salt length must be the same as the hashSize\");\n }\n const ikmBuf = toArrayBuffer(ikm);\n const key = await this._api.importKey(\"raw\", saltBuf, this.algHash, false, [\n \"sign\",\n ]);\n return await this._api.sign(\"HMAC\", key, ikmBuf);\n }\n async expand(prk, info, len) {\n await this._setup();\n const prkBuf = toArrayBuffer(prk);\n const key = await this._api.importKey(\"raw\", prkBuf, this.algHash, false, [\n \"sign\",\n ]);\n const okm = new ArrayBuffer(len);\n const okmBytes = new Uint8Array(okm);\n let prev = EMPTY;\n const mid = toUint8Array(info);\n const tail = new Uint8Array(1);\n if (len > 255 * this.hashSize) {\n throw new Error(\"Entropy limit reached\");\n }\n const tmp = new Uint8Array(this.hashSize + mid.length + 1);\n for (let i = 1, cur = 0; cur < okmBytes.length; i++) {\n tail[0] = i;\n tmp.set(prev, 0);\n tmp.set(mid, prev.length);\n tmp.set(tail, prev.length + mid.length);\n prev = new Uint8Array(await this._api.sign(\"HMAC\", key, tmp.slice(0, prev.length + mid.length + 1)));\n if (okmBytes.length - cur >= prev.length) {\n okmBytes.set(prev, cur);\n cur += prev.length;\n }\n else {\n okmBytes.set(prev.slice(0, okmBytes.length - cur), cur);\n cur += okmBytes.length - cur;\n }\n }\n return okm;\n }\n async extractAndExpand(salt, ikm, info, len) {\n await this._setup();\n const ikmBuf = toArrayBuffer(ikm);\n const baseKey = await this._api.importKey(\"raw\", ikmBuf, \"HKDF\", false, [\"deriveBits\"]);\n return await this._api.deriveBits({\n name: \"HKDF\",\n hash: this.algHash.hash,\n salt: toArrayBuffer(salt),\n info: toArrayBuffer(info),\n }, baseKey, len * 8);\n }\n async labeledExtract(salt, label, ikm) {\n return await this.extract(salt, this.buildLabeledIkm(label, ikm));\n }\n async labeledExpand(prk, label, info, len) {\n return await this.expand(prk, this.buildLabeledInfo(label, info, len), len);\n }\n _checkInit() {\n if (this._suiteId === EMPTY) {\n throw new Error(\"Not initialized. Call init()\");\n }\n }\n}\nexport class HkdfSha256Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha256 (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha256\n });\n /** 32 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-256\",\n length: 256,\n }\n });\n }\n}\nexport class HkdfSha384Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha384 (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha384\n });\n /** 48 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-384\",\n length: 384,\n }\n });\n }\n}\nexport class HkdfSha512Native extends HkdfNative {\n constructor() {\n super(...arguments);\n /** KdfId.HkdfSha512 (0x0003) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KdfId.HkdfSha512\n });\n /** 64 */\n Object.defineProperty(this, \"hashSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n /** The parameters for Web Cryptography API */\n Object.defineProperty(this, \"algHash\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: {\n name: \"HMAC\",\n hash: \"SHA-512\",\n length: 512,\n }\n });\n }\n}\n","import * as dntShim from \"../../_dnt.shims.js\";\nimport { KemId } from \"../identifiers.js\";\nexport const isDenoV1 = () => \n// deno-lint-ignore no-explicit-any\ndntShim.dntGlobalThis.process === undefined;\n/**\n * Checks whether the runtime is Deno or not (Node.js).\n * @returns boolean - true if the runtime is Deno, false Node.js.\n */\nexport function isDeno() {\n // deno-lint-ignore no-explicit-any\n if (dntShim.dntGlobalThis.process === undefined) {\n return true;\n }\n // deno-lint-ignore no-explicit-any\n return dntShim.dntGlobalThis.process?.versions?.deno !== undefined;\n}\n/**\n * Checks whetehr the type of input is CryptoKeyPair or not.\n */\nexport const isCryptoKeyPair = (x) => typeof x === \"object\" &&\n x !== null &&\n typeof x.privateKey === \"object\" &&\n typeof x.publicKey === \"object\";\n/**\n * Converts integer to octet string. I2OSP implementation.\n */\nexport function i2Osp(n, w) {\n if (w <= 0) {\n throw new Error(\"i2Osp: too small size\");\n }\n if (n >= 256 ** w) {\n throw new Error(\"i2Osp: too large integer\");\n }\n const ret = new Uint8Array(w);\n for (let i = 0; i < w && n; i++) {\n ret[w - (i + 1)] = n % 256;\n n = Math.floor(n / 256);\n }\n return ret;\n}\n/**\n * Concatenates two Uint8Arrays.\n * @param a Uint8Array\n * @param b Uint8Array\n * @returns Concatenated Uint8Array\n */\nexport function concat(a, b) {\n const ret = new Uint8Array(a.length + b.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n return ret;\n}\n/**\n * Decodes Base64Url-encoded data.\n * @param v Base64Url-encoded string\n * @returns Uint8Array\n */\nexport function base64UrlToBytes(v) {\n const base64 = v.replace(/-/g, \"+\").replace(/_/g, \"/\");\n const byteString = atob(base64);\n const ret = new Uint8Array(byteString.length);\n for (let i = 0; i < byteString.length; i++) {\n ret[i] = byteString.charCodeAt(i);\n }\n return ret;\n}\n/**\n * Encodes Uint8Array to Base64Url.\n * @param v Uint8Array\n * @returns Base64Url-encoded string\n */\nexport function bytesToBase64Url(v) {\n return btoa(String.fromCharCode(...v))\n .replace(/\\+/g, \"-\")\n .replace(/\\//g, \"_\")\n .replace(/=*$/g, \"\");\n}\n/**\n * Decodes hex string to Uint8Array.\n * @param v Hex string\n * @returns Uint8Array\n * @throws Error if the input is not a hex string.\n */\nexport function hexToBytes(v) {\n if (v.length === 0) {\n return new Uint8Array([]);\n }\n const res = v.match(/[\\da-f]{2}/gi);\n if (res == null) {\n throw new Error(\"Not hex string.\");\n }\n return new Uint8Array(res.map(function (h) {\n return parseInt(h, 16);\n }));\n}\n/**\n * Encodes Uint8Array to hex string.\n * @param v Uint8Array\n * @returns Hex string\n */\nexport function bytesToHex(v) {\n return [...v].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n/**\n * Converts KemId to KeyAlgorithm.\n * @param kem KemId\n * @returns KeyAlgorithm\n */\nexport function kemToKeyGenAlgorithm(kem) {\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n return {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n };\n case KemId.DhkemP384HkdfSha384:\n return {\n name: \"ECDH\",\n namedCurve: \"P-384\",\n };\n case KemId.DhkemP521HkdfSha512:\n return {\n name: \"ECDH\",\n namedCurve: \"P-521\",\n };\n default:\n // case KemId.DhkemX25519HkdfSha256\n return {\n name: \"X25519\",\n };\n }\n}\nexport async function loadSubtleCrypto() {\n if (dntShim.dntGlobalThis !== undefined && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto.subtle;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto.subtle;\n }\n catch (_e) {\n throw new Error(\"Failed to load SubtleCrypto\");\n }\n}\nexport async function loadCrypto() {\n if (typeof dntShim.dntGlobalThis !== \"undefined\" && globalThis.crypto !== undefined) {\n // Browsers, Node.js >= v19, Cloudflare Workers, Bun, etc.\n return globalThis.crypto;\n }\n // Node.js <= v18\n try {\n // @ts-ignore: to ignore \"crypto\"\n const { webcrypto } = await import(\"crypto\"); // node:crypto\n return webcrypto;\n }\n catch (_e) {\n throw new Error(\"failed to load Crypto\");\n }\n}\n/**\n * XOR for Uint8Array.\n */\nexport function xor(a, b) {\n if (a.byteLength !== b.byteLength) {\n throw new Error(\"xor: different length inputs\");\n }\n const buf = new Uint8Array(a.byteLength);\n for (let i = 0; i < a.byteLength; i++) {\n buf[i] = a[i] ^ b[i];\n }\n return buf;\n}\n","import { EMPTY, INPUT_LENGTH_LIMIT } from \"../consts.js\";\nimport { DecapError, EncapError, InvalidParamError } from \"../errors.js\";\nimport { SUITE_ID_HEADER_KEM } from \"../interfaces/kemInterface.js\";\nimport { toArrayBuffer } from \"../kdfs/hkdf.js\";\nimport { concat, i2Osp, isCryptoKeyPair } from \"../utils/misc.js\";\n// b\"eae_prk\"\nconst LABEL_EAE_PRK = /* @__PURE__ */ new Uint8Array([\n 101,\n 97,\n 101,\n 95,\n 112,\n 114,\n 107,\n]);\n// b\"shared_secret\"\n// deno-fmt-ignore\nconst LABEL_SHARED_SECRET = /* @__PURE__ */ new Uint8Array([\n 115, 104, 97, 114, 101, 100, 95, 115, 101, 99,\n 114, 101, 116,\n]);\nfunction concat3(a, b, c) {\n const ret = new Uint8Array(a.length + b.length + c.length);\n ret.set(a, 0);\n ret.set(b, a.length);\n ret.set(c, a.length + b.length);\n return ret;\n}\nexport class Dhkem {\n constructor(id, prim, kdf) {\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"_prim\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.id = id;\n this._prim = prim;\n this._kdf = kdf;\n const suiteId = new Uint8Array(SUITE_ID_HEADER_KEM);\n suiteId.set(i2Osp(this.id, 2), 3);\n this._kdf.init(suiteId);\n }\n async serializePublicKey(key) {\n return await this._prim.serializePublicKey(key);\n }\n async deserializePublicKey(key) {\n return await this._prim.deserializePublicKey(toArrayBuffer(key));\n }\n async serializePrivateKey(key) {\n return await this._prim.serializePrivateKey(key);\n }\n async deserializePrivateKey(key) {\n return await this._prim.deserializePrivateKey(toArrayBuffer(key));\n }\n async importKey(format, key, isPublic = true) {\n return await this._prim.importKey(format, key, isPublic);\n }\n async generateKeyPair() {\n return await this._prim.generateKeyPair();\n }\n async deriveKeyPair(ikm) {\n const rawIkm = toArrayBuffer(ikm);\n if (rawIkm.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long ikm\");\n }\n return await this._prim.deriveKeyPair(rawIkm);\n }\n async encap(params) {\n let ke;\n if (params.ekm === undefined) {\n ke = await this.generateKeyPair();\n }\n else if (isCryptoKeyPair(params.ekm)) {\n // params.ekm is only used for testing.\n ke = params.ekm;\n }\n else {\n // params.ekm is only used for testing.\n ke = await this.deriveKeyPair(params.ekm);\n }\n const enc = await this._prim.serializePublicKey(ke.publicKey);\n const pkrm = await this._prim.serializePublicKey(params.recipientPublicKey);\n try {\n let dh;\n if (params.senderKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n }\n else {\n const sks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.privateKey\n : params.senderKey;\n const dh1 = new Uint8Array(await this._prim.dh(ke.privateKey, params.recipientPublicKey));\n const dh2 = new Uint8Array(await this._prim.dh(sks, params.recipientPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderKey === undefined) {\n kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n }\n else {\n const pks = isCryptoKeyPair(params.senderKey)\n ? params.senderKey.publicKey\n : await this._prim.derivePublicKey(params.senderKey);\n const pksm = await this._prim.serializePublicKey(pks);\n kemContext = concat3(new Uint8Array(enc), new Uint8Array(pkrm), new Uint8Array(pksm));\n }\n const sharedSecret = await this._generateSharedSecret(dh, kemContext);\n return {\n enc: enc,\n sharedSecret: sharedSecret,\n };\n }\n catch (e) {\n throw new EncapError(e);\n }\n }\n async decap(params) {\n const enc = toArrayBuffer(params.enc);\n const pke = await this._prim.deserializePublicKey(enc);\n const skr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.privateKey\n : params.recipientKey;\n const pkr = isCryptoKeyPair(params.recipientKey)\n ? params.recipientKey.publicKey\n : await this._prim.derivePublicKey(params.recipientKey);\n const pkrm = await this._prim.serializePublicKey(pkr);\n try {\n let dh;\n if (params.senderPublicKey === undefined) {\n dh = new Uint8Array(await this._prim.dh(skr, pke));\n }\n else {\n const dh1 = new Uint8Array(await this._prim.dh(skr, pke));\n const dh2 = new Uint8Array(await this._prim.dh(skr, params.senderPublicKey));\n dh = concat(dh1, dh2);\n }\n let kemContext;\n if (params.senderPublicKey === undefined) {\n kemContext = concat(new Uint8Array(enc), new Uint8Array(pkrm));\n }\n else {\n const pksm = await this._prim.serializePublicKey(params.senderPublicKey);\n kemContext = new Uint8Array(enc.byteLength + pkrm.byteLength + pksm.byteLength);\n kemContext.set(new Uint8Array(enc), 0);\n kemContext.set(new Uint8Array(pkrm), enc.byteLength);\n kemContext.set(new Uint8Array(pksm), enc.byteLength + pkrm.byteLength);\n }\n return await this._generateSharedSecret(dh, kemContext);\n }\n catch (e) {\n throw new DecapError(e);\n }\n }\n async _generateSharedSecret(dh, kemContext) {\n const labeledIkm = this._kdf.buildLabeledIkm(LABEL_EAE_PRK, dh);\n const labeledInfo = this._kdf.buildLabeledInfo(LABEL_SHARED_SECRET, kemContext, this.secretSize);\n return await this._kdf.extractAndExpand(EMPTY, labeledIkm, labeledInfo, this.secretSize);\n }\n}\n","// The key usages for KEM.\nexport const KEM_USAGES = [\"deriveBits\"];\n// b\"dkp_prk\"\nexport const LABEL_DKP_PRK = /* @__PURE__ */ new Uint8Array([\n 100,\n 107,\n 112,\n 95,\n 112,\n 114,\n 107,\n]);\n// b\"sk\"\nexport const LABEL_SK = /* @__PURE__ */ new Uint8Array([115, 107]);\n","/**\n * The minimum inplementation of bignum to derive an EC key pair.\n */\nexport class Bignum {\n constructor(size) {\n Object.defineProperty(this, \"_num\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._num = new Uint8Array(size);\n }\n val() {\n return this._num;\n }\n reset() {\n this._num.fill(0);\n }\n set(src) {\n if (src.length !== this._num.length) {\n throw new Error(\"Bignum.set: invalid argument\");\n }\n this._num.set(src);\n }\n isZero() {\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] !== 0) {\n return false;\n }\n }\n return true;\n }\n lessThan(v) {\n if (v.length !== this._num.length) {\n throw new Error(\"Bignum.lessThan: invalid argument\");\n }\n for (let i = 0; i < this._num.length; i++) {\n if (this._num[i] < v[i]) {\n return true;\n }\n if (this._num[i] > v[i]) {\n return false;\n }\n }\n return false;\n }\n}\n","import { NativeAlgorithm } from \"../../algorithm.js\";\nimport { BYTE_TO_BIGINT_256, EMPTY } from \"../../consts.js\";\nimport { toArrayBuffer } from \"../../kdfs/hkdf.js\";\nimport { DeriveKeyPairError, DeserializeError, NotSupportedError, SerializeError, } from \"../../errors.js\";\nimport { KemId } from \"../../identifiers.js\";\nimport { KEM_USAGES, LABEL_DKP_PRK } from \"../../interfaces/dhkemPrimitives.js\";\nimport { Bignum } from \"../../utils/bignum.js\";\nimport { base64UrlToBytes, i2Osp } from \"../../utils/misc.js\";\n// b\"candidate\"\n// deno-fmt-ignore\nconst LABEL_CANDIDATE = /* @__PURE__ */ new Uint8Array([\n 99, 97, 110, 100, 105, 100, 97, 116, 101,\n]);\n// the order of the curve being used.\n// deno-fmt-ignore\nconst ORDER_P_256 = /* @__PURE__ */ new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xbc, 0xe6, 0xfa, 0xad, 0xa7, 0x17, 0x9e, 0x84,\n 0xf3, 0xb9, 0xca, 0xc2, 0xfc, 0x63, 0x25, 0x51,\n]);\n// deno-fmt-ignore\nconst ORDER_P_384 = /* @__PURE__ */ new Uint8Array([\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xc7, 0x63, 0x4d, 0x81, 0xf4, 0x37, 0x2d, 0xdf,\n 0x58, 0x1a, 0x0d, 0xb2, 0x48, 0xb0, 0xa7, 0x7a,\n 0xec, 0xec, 0x19, 0x6a, 0xcc, 0xc5, 0x29, 0x73,\n]);\n// deno-fmt-ignore\nconst ORDER_P_521 = /* @__PURE__ */ new Uint8Array([\n 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,\n 0xff, 0xfa, 0x51, 0x86, 0x87, 0x83, 0xbf, 0x2f,\n 0x96, 0x6b, 0x7f, 0xcc, 0x01, 0x48, 0xf7, 0x09,\n 0xa5, 0xd0, 0x3b, 0xb5, 0xc9, 0xb8, 0x89, 0x9c,\n 0x47, 0xae, 0xbb, 0x6f, 0xb7, 0x1e, 0x91, 0x38,\n 0x64, 0x09,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_256 = /* @__PURE__ */ new Uint8Array([\n 48, 65, 2, 1, 0, 48, 19, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 8, 42, 134,\n 72, 206, 61, 3, 1, 7, 4, 39, 48, 37,\n 2, 1, 1, 4, 32,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_384 = /* @__PURE__ */ new Uint8Array([\n 48, 78, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 34, 4, 55, 48, 53, 2, 1, 1,\n 4, 48,\n]);\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_P_521 = /* @__PURE__ */ new Uint8Array([\n 48, 96, 2, 1, 0, 48, 16, 6, 7, 42,\n 134, 72, 206, 61, 2, 1, 6, 5, 43, 129,\n 4, 0, 35, 4, 73, 48, 71, 2, 1, 1,\n 4, 66,\n]);\nconst EC_P_256_PARAMS = {\n p: 0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn,\n b: 0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,\n gx: 0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296n,\n gy: 0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5n,\n coordinateSize: 32,\n};\nconst EC_P_384_PARAMS = {\n p: 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffffn,\n b: 0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aefn,\n gx: 0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7n,\n gy: 0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5fn,\n coordinateSize: 48,\n};\nconst EC_P_521_PARAMS = {\n p: (1n << 521n) - 1n,\n b: 0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00n,\n gx: 0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66n,\n gy: 0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650n,\n coordinateSize: 66,\n};\nfunction mod(a, p) {\n const r = a % p;\n return r >= 0n ? r : r + p;\n}\nfunction modPow(base, exponent, p) {\n let result = 1n;\n let b = mod(base, p);\n let e = exponent;\n while (e > 0n) {\n if ((e & 1n) === 1n) {\n result = mod(result * b, p);\n }\n b = mod(b * b, p);\n e >>= 1n;\n }\n return result;\n}\nfunction modSqrt(rhs, p) {\n // P-256/P-384/P-521 primes satisfy p % 4 == 3.\n const y = modPow(rhs, (p + 1n) >> 2n, p);\n if (mod(y * y, p) !== mod(rhs, p)) {\n throw new Error(\"Invalid ECDH point\");\n }\n return y;\n}\nfunction bytesToBigInt(bytes) {\n let v = 0n;\n for (const b of bytes) {\n v = (v << 8n) | BYTE_TO_BIGINT_256[b];\n }\n return v;\n}\nfunction bigIntToBytes(v, len) {\n const out = new Uint8Array(len);\n let n = v;\n for (let i = len - 1; i >= 0; i--) {\n out[i] = Number(n & 0xffn);\n n >>= 8n;\n }\n if (n !== 0n) {\n throw new Error(\"Invalid coordinate length\");\n }\n return out;\n}\nfunction buildRawUncompressedPublicKey(x, y, coordinateSize) {\n const out = new Uint8Array(1 + coordinateSize * 2);\n out[0] = 0x04;\n out.set(bigIntToBytes(x, coordinateSize), 1);\n out.set(bigIntToBytes(y, coordinateSize), 1 + coordinateSize);\n return out;\n}\nexport class Ec extends NativeAlgorithm {\n constructor(kem, hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // EC specific arguments for deriving key pair.\n Object.defineProperty(this, \"_order\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_bitmask\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_curveParams\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._hkdf = hkdf;\n switch (kem) {\n case KemId.DhkemP256HkdfSha256:\n this._alg = { name: \"ECDH\", namedCurve: \"P-256\" };\n this._nPk = 65;\n this._nSk = 32;\n this._nDh = 32;\n this._order = ORDER_P_256;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_256;\n this._curveParams = EC_P_256_PARAMS;\n break;\n case KemId.DhkemP384HkdfSha384:\n this._alg = { name: \"ECDH\", namedCurve: \"P-384\" };\n this._nPk = 97;\n this._nSk = 48;\n this._nDh = 48;\n this._order = ORDER_P_384;\n this._bitmask = 0xFF;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_384;\n this._curveParams = EC_P_384_PARAMS;\n break;\n default:\n // case KemId.DhkemP521HkdfSha512:\n this._alg = { name: \"ECDH\", namedCurve: \"P-521\" };\n this._nPk = 133;\n this._nSk = 66;\n this._nDh = 66;\n this._order = ORDER_P_521;\n this._bitmask = 0x01;\n this._pkcs8AlgId = PKCS8_ALG_ID_P_521;\n this._curveParams = EC_P_521_PARAMS;\n break;\n }\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(toArrayBuffer(key), true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(toArrayBuffer(key), false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(this._alg, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const rawIkm = toArrayBuffer(ikm);\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY, LABEL_DKP_PRK, new Uint8Array(rawIkm));\n const bn = new Bignum(this._nSk);\n for (let counter = 0; bn.isZero() || !bn.lessThan(this._order); counter++) {\n if (counter > 255) {\n throw new Error(\"Faild to derive a key pair\");\n }\n const bytes = new Uint8Array(await this._hkdf.labeledExpand(dkpPrk, LABEL_CANDIDATE, i2Osp(counter, 1), this._nSk));\n bytes[0] = bytes[0] & this._bitmask;\n bn.set(bytes);\n }\n const sk = await this._deserializePkcs8Key(bn.val());\n bn.reset();\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch {\n try {\n // Firefox fails to export JWK from some imported ECDH private keys.\n return await this._derivePublicKeyWithoutJwkExport(key);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n }\n async dh(sk, pk) {\n try {\n await this._setup();\n const bits = await this._api.deriveBits({\n name: \"ECDH\",\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.crv === \"undefined\" || key.crv !== this._alg.namedCurve) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n async _derivePublicKeyWithoutJwkExport(key) {\n const basePointRaw = buildRawUncompressedPublicKey(this._curveParams.gx, this._curveParams.gy, this._curveParams.coordinateSize);\n const basePoint = await this._api.importKey(\"raw\", basePointRaw.buffer, this._alg, true, []);\n const xBytes = new Uint8Array(await this._api.deriveBits({\n name: \"ECDH\",\n public: basePoint,\n }, key, this._nDh * 8));\n const p = this._curveParams.p;\n const x = bytesToBigInt(xBytes);\n const rhs = mod(modPow(x, 3n, p) - 3n * x + this._curveParams.b, p);\n let y = modSqrt(rhs, p);\n // Canonicalize sign so the encoded point is deterministic.\n if ((y & 1n) === 1n) {\n y = p - y;\n }\n const pubRaw = buildRawUncompressedPublicKey(x, y, this._curveParams.coordinateSize);\n return await this._api.importKey(\"raw\", pubRaw.buffer, this._alg, true, []);\n }\n}\n","// The key usages for AEAD.\nexport const AEAD_USAGES = [\"encrypt\", \"decrypt\"];\n","// deno-lint-ignore-file no-explicit-any\n/**\n * This file is based on noble-curves (https://github.com/paulmillr/noble-curves).\n *\n * noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-curves/blob/b9d49d2b41d550571a0c5be443ecb62109fa3373/src/utils.ts\n */\n/**\n * Hex, bytes and number utilities.\n * @module\n */\nimport { loadCrypto } from \"./misc.js\";\nimport { N_0 } from \"../consts.js\";\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a) {\n return a instanceof Uint8Array ||\n (ArrayBuffer.isView(a) && a.constructor.name === \"Uint8Array\");\n}\n/** Asserts something is positive integer. */\nexport function anumber(n, title = \"\") {\n if (!Number.isSafeInteger(n) || n < 0) {\n const prefix = title && `\"${title}\" `;\n throw new Error(`${prefix}expected integer >0, got ${n}`);\n }\n}\n/** Asserts something is Uint8Array. */\nexport function abytes(value, length, title = \"\") {\n const bytes = isBytes(value);\n const len = value?.length;\n const needsLen = length !== undefined;\n if (!bytes || (needsLen && len !== length)) {\n const prefix = title && `\"${title}\" `;\n const ofLen = needsLen ? ` of length ${length}` : \"\";\n const got = bytes ? `length=${len}` : `type=${typeof value}`;\n throw new Error(prefix + \"expected Uint8Array\" + ofLen + \", got \" + got);\n }\n return value;\n}\n// ahash function is now imported from ../hash/hash.ts\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance, checkFinished = true) {\n if (instance.destroyed)\n throw new Error(\"Hash instance has been destroyed\");\n if (checkFinished && instance.finished) {\n throw new Error(\"Hash#digest() has already been called\");\n }\n}\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out, instance) {\n abytes(out, undefined, \"digestInto() output\");\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error('\"digestInto() output\" expected to be of length >=' + min);\n }\n}\n// Used in weierstrass, der\nfunction abignumer(n) {\n if (typeof n === \"bigint\") {\n if (!isPosBig(n))\n throw new Error(\"positive bigint expected, got \" + n);\n }\n else\n anumber(n);\n return n;\n}\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr) {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays) {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n/** Pre-computed buffer for endianness detection */\nconst _endianTestBuffer = /* @__PURE__ */ new Uint32Array([0x11223344]);\nconst _endianTestBytes = /* @__PURE__ */ new Uint8Array(_endianTestBuffer.buffer);\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE = /* @__PURE__ */ _endianTestBytes[0] === 0x44;\n/** The byte swap operation for uint32 */\nexport function byteSwap(word) {\n return (((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff));\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport function swap8IfBE(n) {\n return isLE ? n : byteSwap(n);\n}\n/** @deprecated */\nexport const byteSwapIfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr) {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\nexport function swap32IfBE(u) {\n return isLE ? u : byteSwap32(u);\n}\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr) {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word, shift) {\n return (word << (32 - shift)) | (word >>> shift);\n}\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin = /* @__PURE__ */ (() => \n// @ts-ignore: to use toHex\ntypeof Uint8Array.from([]).toHex === \"function\" &&\n // @ts-ignore: to use fromHex\n typeof Uint8Array.fromHex === \"function\")();\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, \"0\"));\nconst HEX_TO_BIGINT = /* @__PURE__ */ [\n 0n,\n 1n,\n 2n,\n 3n,\n 4n,\n 5n,\n 6n,\n 7n,\n 8n,\n 9n,\n 10n,\n 11n,\n 12n,\n 13n,\n 14n,\n 15n,\n];\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes) {\n abytes(bytes);\n // @ts-ignore: to use toHex\n if (hasHexBuiltin)\n return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = \"\";\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };\nfunction asciiToBase16(ch) {\n if (ch >= asciis._0 && ch <= asciis._9)\n return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F)\n return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f)\n return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex) {\n if (typeof hex !== \"string\") {\n throw new Error(\"hex string expected, got \" + typeof hex);\n }\n // @ts-ignore: to use fromHex\n if (hasHexBuiltin)\n return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) {\n throw new Error(\"hex string expected, got unpadded hex of length \" + hl);\n }\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' +\n hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str) {\n if (typeof str !== \"string\")\n throw new Error(\"string expected\");\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes) {\n return new TextDecoder().decode(bytes);\n}\nexport function numberToHexUnpadded(num) {\n const hex = abignumer(num).toString(16);\n return hex.length & 1 ? \"0\" + hex : hex;\n}\nexport function hexToNumber(hex) {\n if (typeof hex !== \"string\") {\n throw new Error(\"hex string expected, got \" + typeof hex);\n }\n let out = N_0;\n for (let i = 0; i < hex.length; i++) {\n const n = asciiToBase16(hex.charCodeAt(i));\n if (n === undefined) {\n throw new Error('hex string expected, got non-hex character \"' + hex[i] +\n '\" at index ' + i);\n }\n out = (out << 4n) | HEX_TO_BIGINT[n];\n }\n return out; // Big Endian\n}\nexport function numberToBigint(num) {\n anumber(num, \"numberToBigint\");\n let n = num;\n let out = N_0;\n let bit = 1n;\n while (n > 0) {\n if (n % 2 === 1)\n out += bit;\n n = Math.floor(n / 2);\n bit <<= 1n;\n }\n return out;\n}\n// BE: Big Endian, LE: Little Endian\nexport function bytesToNumberBE(bytes) {\n return hexToNumber(bytesToHex(bytes));\n}\nexport function bytesToNumberLE(bytes) {\n return hexToNumber(bytesToHex(copyBytes(abytes(bytes)).reverse()));\n}\nexport function numberToBytesBE(n, len) {\n anumber(len);\n n = abignumer(n);\n const res = hexToBytes(n.toString(16).padStart(len * 2, \"0\"));\n if (res.length !== len)\n throw new Error(\"number too large\");\n return res;\n}\nexport function numberToBytesLE(n, len) {\n return numberToBytesBE(n, len).reverse();\n}\n/**\n * Copies Uint8Array. We can't use u8a.slice(), because u8a can be Buffer,\n * and Buffer#slice creates mutable copy. Never use Buffers!\n */\nexport function copyBytes(bytes) {\n return Uint8Array.from(bytes);\n}\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays) {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n/**\n * Decodes 7-bit ASCII string to Uint8Array, throws on non-ascii symbols\n * Should be safe to use for things expected to be ASCII.\n * Returns exact same result as utf8ToBytes for ASCII or throws.\n */\nexport function asciiToBytes(ascii) {\n return Uint8Array.from(ascii, (c, i) => {\n const charCode = c.charCodeAt(0);\n if (c.length !== 1 || charCode > 127) {\n throw new Error(`string contains non-ASCII character \"${ascii[i]}\" with code ${charCode} at position ${i}`);\n }\n return charCode;\n });\n}\n// Is positive bigint\nfunction isPosBig(n) {\n return typeof n === \"bigint\" && N_0 <= n;\n}\nexport function inRange(n, min, max) {\n return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;\n}\n/**\n * Asserts min <= n < max. NOTE: It's < max and not <= max.\n * @example\n * aInRange('x', x, 1n, 256n); // would assume x is in (1n..255n)\n */\nexport function aInRange(title, n, min, max) {\n // Why min <= n < max and not a (min < n < max) OR b (min <= n <= max)?\n // consider P=256n, min=0n, max=P\n // - a for min=0 would require -1: `inRange('x', x, -1n, P)`\n // - b would commonly require subtraction: `inRange('x', x, 0n, P - 1n)`\n // - our way is the cleanest: `inRange('x', x, 0n, P)\n if (!inRange(n, min, max)) {\n throw new Error(\"expected valid \" + title + \": \" + min + \" <= n < \" + max + \", got \" + n);\n }\n}\nexport function validateObject(object, fields = {}, optFields = {}) {\n if (!object || typeof object !== \"object\") {\n throw new Error(\"expected valid options object\");\n }\n function checkField(fieldName, expectedType, isOpt) {\n const val = object[fieldName];\n if (isOpt && val === undefined)\n return;\n const current = typeof val;\n if (current !== expectedType || val === null) {\n throw new Error(`param \"${fieldName}\" is invalid: expected ${expectedType}, got ${current}`);\n }\n }\n const iter = (f, isOpt) => Object.entries(f).forEach(([k, v]) => checkField(k, v, isOpt));\n iter(fields, false);\n iter(optFields, true);\n}\n// createHasher function is now exported above with ahash\n// /** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\n// export function randomBytes(bytesLength = 32): Uint8Array {\n// const cr = typeof globalThis != null && (globalThis as any).crypto;\n// if (!cr || typeof cr.getRandomValues !== \"function\") {\n// throw new Error(\"crypto.getRandomValues must be defined\");\n// }\n// return cr.getRandomValues(new Uint8Array(bytesLength));\n// }\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport async function randomBytesAsync(bytesLength = 32) {\n const api = await loadCrypto();\n const rnd = new Uint8Array(bytesLength);\n api.getRandomValues(rnd);\n return rnd;\n}\n// 06 09 60 86 48 01 65 03 04 02\nexport function oidNist(suffix) {\n return {\n oid: Uint8Array.from([\n 0x06,\n 0x09,\n 0x60,\n 0x86,\n 0x48,\n 0x01,\n 0x65,\n 0x03,\n 0x04,\n 0x02,\n suffix,\n ]),\n };\n}\n","// deno-lint-ignore-file no-explicit-any\n/**\n * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes).\n *\n * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-hashes/blob/2e0c00e1aa134082ba1380bf3afb8b1641f60fed/src/_md.ts\n */\n/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { abytes, aexists, aoutput, clean, createView, numberToBigint, } from \"../utils/noble.js\";\n/** Choice: a ? b : c */\nexport function Chi(a, b, c) {\n return (a & b) ^ (~a & c);\n}\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a, b, c) {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport class HashMD {\n constructor(blockLen, outputLen, padOffset, isLE) {\n Object.defineProperty(this, \"blockLen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"outputLen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"padOffset\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"isLE\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // For partial updates less than block size\n Object.defineProperty(this, \"buffer\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"view\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"finished\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"length\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"pos\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"destroyed\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data) {\n aexists(this);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen) {\n this.process(dataView, pos);\n }\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out) {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++)\n buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n view.setBigUint64(blockLen - 8, numberToBigint(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which must be fused in single op with modulo by JIT\n if (len % 4)\n throw new Error(\"_sha2: outputLen must be aligned to 32bit\");\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length) {\n throw new Error(\"_sha2: outputLen bigger than state\");\n }\n for (let i = 0; i < outLen; i++)\n oview.setUint32(4 * i, state[i], isLE);\n }\n digest() {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to) {\n to ||= new this.constructor();\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n if (length % blockLen)\n to.buffer.set(buffer);\n return to;\n }\n clone() {\n return this._cloneInto();\n }\n}\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667,\n 0xbb67ae85,\n 0x3c6ef372,\n 0xa54ff53a,\n 0x510e527f,\n 0x9b05688c,\n 0x1f83d9ab,\n 0x5be0cd19,\n]);\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d,\n 0xc1059ed8,\n 0x629a292a,\n 0x367cd507,\n 0x9159015a,\n 0x3070dd17,\n 0x152fecd8,\n 0xf70e5939,\n 0x67332667,\n 0xffc00b31,\n 0x8eb44a87,\n 0x68581511,\n 0xdb0c2e0d,\n 0x64f98fa7,\n 0x47b5481d,\n 0xbefa4fa4,\n]);\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667,\n 0xf3bcc908,\n 0xbb67ae85,\n 0x84caa73b,\n 0x3c6ef372,\n 0xfe94f82b,\n 0xa54ff53a,\n 0x5f1d36f1,\n 0x510e527f,\n 0xade682d1,\n 0x9b05688c,\n 0x2b3e6c1f,\n 0x1f83d9ab,\n 0xfb41bd6b,\n 0x5be0cd19,\n 0x137e2179,\n]);\n","/**\n * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes).\n *\n * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-hashes/blob/4e358a46d682adfb005ae6314ec999f2513086b9/src/_u64.ts\n */\n/**\n * Internal helpers for u64. BigUint64Array is too slow as per 2025, so we implement it using Uint32Array.\n * @todo re-check https://issues.chromium.org/issues/42212588\n * @module\n */\nconst U32_MASK64 = 0xffffffffn;\nconst _32n = 32n;\nfunction fromBig(n, le = false) {\n if (le) {\n return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n }\n return {\n h: Number((n >> _32n) & U32_MASK64) | 0,\n l: Number(n & U32_MASK64) | 0,\n };\n}\nfunction split(lst, le = false) {\n const len = lst.length;\n const Ah = new Uint32Array(len);\n const Al = new Uint32Array(len);\n for (let i = 0; i < len; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\nconst toBig = (h, l) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h, _l, s) => h >>> s;\nconst shrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h, l, s) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h, l, s) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h, l, s) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h, l, s) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h, l) => l;\nconst rotr32L = (h, _l) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h, l, s) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h, l, s) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h, l, s) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h, l, s) => (h << (s - 32)) | (l >>> (64 - s));\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah, Al, Bh, Bl) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low, Ah, Bh, Ch) => (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low, Ah, Bh, Ch, Dh) => (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low, Ah, Bh, Ch, Dh, Eh) => (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n// prettier-ignore\nexport { add, add3H, add3L, add4H, add4L, add5H, add5L, fromBig, rotlBH, rotlBL, rotlSH, rotlSL, rotr32H, rotr32L, rotrBH, rotrBL, rotrSH, rotrSL, shrSH, shrSL, split, toBig, };\n// prettier-ignore\nconst u64 = {\n fromBig,\n split,\n toBig,\n shrSH,\n shrSL,\n rotrSH,\n rotrSL,\n rotrBH,\n rotrBL,\n rotr32H,\n rotr32L,\n rotlSH,\n rotlSL,\n rotlBH,\n rotlBL,\n add,\n add3L,\n add3H,\n add4L,\n add4H,\n add5H,\n add5L,\n};\nexport default u64;\n","/**\n * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes).\n *\n * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-hashes/blob/2e0c00e1aa134082ba1380bf3afb8b1641f60fed/src/sha2.ts\n */\n/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://www.rfc-editor.org/rfc/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA256_IV, SHA384_IV, SHA512_IV } from \"./md.js\";\nimport * as u64 from \"./u64.js\";\nimport { clean, oidNist, rotr } from \"../utils/noble.js\";\nimport { createHasher } from \"./hash.js\";\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98,\n 0x71374491,\n 0xb5c0fbcf,\n 0xe9b5dba5,\n 0x3956c25b,\n 0x59f111f1,\n 0x923f82a4,\n 0xab1c5ed5,\n 0xd807aa98,\n 0x12835b01,\n 0x243185be,\n 0x550c7dc3,\n 0x72be5d74,\n 0x80deb1fe,\n 0x9bdc06a7,\n 0xc19bf174,\n 0xe49b69c1,\n 0xefbe4786,\n 0x0fc19dc6,\n 0x240ca1cc,\n 0x2de92c6f,\n 0x4a7484aa,\n 0x5cb0a9dc,\n 0x76f988da,\n 0x983e5152,\n 0xa831c66d,\n 0xb00327c8,\n 0xbf597fc7,\n 0xc6e00bf3,\n 0xd5a79147,\n 0x06ca6351,\n 0x14292967,\n 0x27b70a85,\n 0x2e1b2138,\n 0x4d2c6dfc,\n 0x53380d13,\n 0x650a7354,\n 0x766a0abb,\n 0x81c2c92e,\n 0x92722c85,\n 0xa2bfe8a1,\n 0xa81a664b,\n 0xc24b8b70,\n 0xc76c51a3,\n 0xd192e819,\n 0xd6990624,\n 0xf40e3585,\n 0x106aa070,\n 0x19a4c116,\n 0x1e376c08,\n 0x2748774c,\n 0x34b0bcb5,\n 0x391c0cb3,\n 0x4ed8aa4a,\n 0x5b9cca4f,\n 0x682e6ff3,\n 0x748f82ee,\n 0x78a5636f,\n 0x84c87814,\n 0x8cc70208,\n 0x90befffa,\n 0xa4506ceb,\n 0xbef9a3f7,\n 0xc67178f2,\n]);\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\n/** Internal 32-byte base SHA2 hash class. */\nclass SHA2_32B extends HashMD {\n constructor(outputLen) {\n super(64, outputLen, 8, false);\n }\n get() {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n set(A, B, C, D, E, F, G, H) {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA256_W[i] = view.getUint32(offset, false);\n }\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n roundClean() {\n clean(SHA256_W);\n }\n destroy() {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n/** Internal SHA2-256 hash class. */\nexport class _SHA256 extends SHA2_32B {\n constructor() {\n super(32);\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n Object.defineProperty(this, \"A\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[0] | 0\n });\n Object.defineProperty(this, \"B\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[1] | 0\n });\n Object.defineProperty(this, \"C\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[2] | 0\n });\n Object.defineProperty(this, \"D\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[3] | 0\n });\n Object.defineProperty(this, \"E\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[4] | 0\n });\n Object.defineProperty(this, \"F\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[5] | 0\n });\n Object.defineProperty(this, \"G\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[6] | 0\n });\n Object.defineProperty(this, \"H\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA256_IV[7] | 0\n });\n }\n}\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\nconst K512 = /* @__PURE__ */ (() => u64.split([\n 0x428a2f98d728ae22n,\n 0x7137449123ef65cdn,\n 0xb5c0fbcfec4d3b2fn,\n 0xe9b5dba58189dbbcn,\n 0x3956c25bf348b538n,\n 0x59f111f1b605d019n,\n 0x923f82a4af194f9bn,\n 0xab1c5ed5da6d8118n,\n 0xd807aa98a3030242n,\n 0x12835b0145706fben,\n 0x243185be4ee4b28cn,\n 0x550c7dc3d5ffb4e2n,\n 0x72be5d74f27b896fn,\n 0x80deb1fe3b1696b1n,\n 0x9bdc06a725c71235n,\n 0xc19bf174cf692694n,\n 0xe49b69c19ef14ad2n,\n 0xefbe4786384f25e3n,\n 0x0fc19dc68b8cd5b5n,\n 0x240ca1cc77ac9c65n,\n 0x2de92c6f592b0275n,\n 0x4a7484aa6ea6e483n,\n 0x5cb0a9dcbd41fbd4n,\n 0x76f988da831153b5n,\n 0x983e5152ee66dfabn,\n 0xa831c66d2db43210n,\n 0xb00327c898fb213fn,\n 0xbf597fc7beef0ee4n,\n 0xc6e00bf33da88fc2n,\n 0xd5a79147930aa725n,\n 0x06ca6351e003826fn,\n 0x142929670a0e6e70n,\n 0x27b70a8546d22ffcn,\n 0x2e1b21385c26c926n,\n 0x4d2c6dfc5ac42aedn,\n 0x53380d139d95b3dfn,\n 0x650a73548baf63den,\n 0x766a0abb3c77b2a8n,\n 0x81c2c92e47edaee6n,\n 0x92722c851482353bn,\n 0xa2bfe8a14cf10364n,\n 0xa81a664bbc423001n,\n 0xc24b8b70d0f89791n,\n 0xc76c51a30654be30n,\n 0xd192e819d6ef5218n,\n 0xd69906245565a910n,\n 0xf40e35855771202an,\n 0x106aa07032bbd1b8n,\n 0x19a4c116b8d2d0c8n,\n 0x1e376c085141ab53n,\n 0x2748774cdf8eeb99n,\n 0x34b0bcb5e19b48a8n,\n 0x391c0cb3c5c95a63n,\n 0x4ed8aa4ae3418acbn,\n 0x5b9cca4f7763e373n,\n 0x682e6ff3d6b2b8a3n,\n 0x748f82ee5defb2fcn,\n 0x78a5636f43172f60n,\n 0x84c87814a1f0ab72n,\n 0x8cc702081a6439ecn,\n 0x90befffa23631e28n,\n 0xa4506cebde82bde9n,\n 0xbef9a3f7b2c67915n,\n 0xc67178f2e372532bn,\n 0xca273eceea26619cn,\n 0xd186b8c721c0c207n,\n 0xeada7dd6cde0eb1en,\n 0xf57d4f7fee6ed178n,\n 0x06f067aa72176fban,\n 0x0a637dc5a2c898a6n,\n 0x113f9804bef90daen,\n 0x1b710b35131c471bn,\n 0x28db77f523047d84n,\n 0x32caab7b40c72493n,\n 0x3c9ebe0a15c9bebcn,\n 0x431d67c49c100d4cn,\n 0x4cc5d4becb3e42b6n,\n 0x597f299cfc657e2an,\n 0x5fcb6fab3ad6faecn,\n 0x6c44198c4a475817n,\n]))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n/** Internal 64-byte base SHA2 hash class. */\nclass SHA2_64B extends HashMD {\n constructor(outputLen) {\n super(128, outputLen, 16, false);\n }\n get() {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl) {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n process(view, offset) {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32(offset += 4);\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^\n u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^\n u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^\n u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^\n u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^\n u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^\n u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^\n u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^\n u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n roundClean() {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy() {\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n/** Internal SHA2-512 hash class. */\nexport class _SHA512 extends SHA2_64B {\n constructor() {\n super(64);\n Object.defineProperty(this, \"Ah\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[0] | 0\n });\n Object.defineProperty(this, \"Al\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[1] | 0\n });\n Object.defineProperty(this, \"Bh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[2] | 0\n });\n Object.defineProperty(this, \"Bl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[3] | 0\n });\n Object.defineProperty(this, \"Ch\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[4] | 0\n });\n Object.defineProperty(this, \"Cl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[5] | 0\n });\n Object.defineProperty(this, \"Dh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[6] | 0\n });\n Object.defineProperty(this, \"Dl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[7] | 0\n });\n Object.defineProperty(this, \"Eh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[8] | 0\n });\n Object.defineProperty(this, \"El\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[9] | 0\n });\n Object.defineProperty(this, \"Fh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[10] | 0\n });\n Object.defineProperty(this, \"Fl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[11] | 0\n });\n Object.defineProperty(this, \"Gh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[12] | 0\n });\n Object.defineProperty(this, \"Gl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[13] | 0\n });\n Object.defineProperty(this, \"Hh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[14] | 0\n });\n Object.defineProperty(this, \"Hl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA512_IV[15] | 0\n });\n }\n}\nexport class _SHA384 extends SHA2_64B {\n constructor() {\n super(48);\n Object.defineProperty(this, \"Ah\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[0] | 0\n });\n Object.defineProperty(this, \"Al\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[1] | 0\n });\n Object.defineProperty(this, \"Bh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[2] | 0\n });\n Object.defineProperty(this, \"Bl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[3] | 0\n });\n Object.defineProperty(this, \"Ch\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[4] | 0\n });\n Object.defineProperty(this, \"Cl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[5] | 0\n });\n Object.defineProperty(this, \"Dh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[6] | 0\n });\n Object.defineProperty(this, \"Dl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[7] | 0\n });\n Object.defineProperty(this, \"Eh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[8] | 0\n });\n Object.defineProperty(this, \"El\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[9] | 0\n });\n Object.defineProperty(this, \"Fh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[10] | 0\n });\n Object.defineProperty(this, \"Fl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[11] | 0\n });\n Object.defineProperty(this, \"Gh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[12] | 0\n });\n Object.defineProperty(this, \"Gl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[13] | 0\n });\n Object.defineProperty(this, \"Hh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[14] | 0\n });\n Object.defineProperty(this, \"Hl\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: SHA384_IV[15] | 0\n });\n }\n}\n/**\n * SHA2-256 hash function from RFC 4634. In JS it's the fastest: even faster than Blake3. Some info:\n *\n * - Trying 2^128 hashes would get 50% chance of collision, using birthday attack.\n * - BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n * - Each sha256 hash is executing 2^18 bit operations.\n * - Good 2024 ASICs can do 200Th/sec with 3500 watts of power, corresponding to 2^36 hashes/joule.\n */\nexport const sha256 = /* @__PURE__ */ createHasher(() => new _SHA256(), \n/* @__PURE__ */ oidNist(0x01));\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512 = /* @__PURE__ */ createHasher(() => new _SHA512(), \n/* @__PURE__ */ oidNist(0x03));\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384 = /* @__PURE__ */ createHasher(() => new _SHA384(), \n/* @__PURE__ */ oidNist(0x02));\n","/**\n * This file is based on noble-hashes (https://github.com/paulmillr/noble-hashes).\n *\n * noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com)\n *\n * The original file is located at:\n * https://github.com/paulmillr/noble-hashes/blob/4e358a46d682adfb005ae6314ec999f2513086b9/src/sha3.ts\n */\n/**\n * SHA3 (keccak) hash function, based on a new \"Sponge function\" design.\n * Different from older hashes, the internal state is bigger than output size.\n *\n * Check out [FIPS-202](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf),\n * [Website](https://keccak.team/keccak.html),\n * [the differences between SHA-3 and Keccak](https://crypto.stackexchange.com/questions/15727/what-are-the-key-differences-between-the-draft-sha-3-standard-and-the-keccak-sub).\n *\n * Check out `sha3-addons` module for cSHAKE, k12, and others.\n * @module\n */\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from \"./u64.js\";\nimport { abytes, aexists, anumber, aoutput, clean, oidNist, swap32IfBE, u32, } from \"../utils/noble.js\";\nimport { createHasher, } from \"./hash.js\";\n// No __PURE__ annotations in sha3 header:\n// EVERYTHING is in fact used on every export.\n// Various per round constants calculations\nconst _0n = 0n;\nconst _1n = 1n;\nconst _2n = 2n;\nconst _7n = 7n;\nconst _256n = 256n;\nconst _0x71n = 0x71n;\nconst SHA3_PI = [];\nconst SHA3_ROTL = [];\nconst _SHA3_IOTA = []; // no pure annotation: var is always used\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n)\n t ^= _1n << ((_1n << BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst IOTAS = split(_SHA3_IOTA, true);\nconst SHA3_IOTA_H = IOTAS[0];\nconst SHA3_IOTA_L = IOTAS[1];\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h, l, s) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h, l, s) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n/** `keccakf1600` internal function, additionally allows to adjust round count. */\nexport function keccakP(s, rounds = 24, B) {\n if (!B)\n B = new Uint32Array(10);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++) {\n B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n }\n // for (let x = 0; x < 10; x += 2) {\n // const idx1 = (x + 8) % 10;\n // const idx0 = (x + 2) % 10;\n // const B0 = B[idx0];\n // const B1 = B[idx0 + 1];\n // const Th = rotlH(B0, B1, 1) ^ B[idx1];\n // const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n // for (let y = 0; y < 50; y += 10) {\n // s[x + y] ^= Th;\n // s[x + y + 1] ^= Tl;\n // }\n // }\n { // x=0: idx0=2, idx1=8\n const Th = rotlH(B[2], B[3], 1) ^ B[8];\n const Tl = rotlL(B[2], B[3], 1) ^ B[9];\n s[0] ^= Th;\n s[1] ^= Tl;\n s[10] ^= Th;\n s[11] ^= Tl;\n s[20] ^= Th;\n s[21] ^= Tl;\n s[30] ^= Th;\n s[31] ^= Tl;\n s[40] ^= Th;\n s[41] ^= Tl;\n }\n { // x=2: idx0=4, idx1=0\n const Th = rotlH(B[4], B[5], 1) ^ B[0];\n const Tl = rotlL(B[4], B[5], 1) ^ B[1];\n s[2] ^= Th;\n s[3] ^= Tl;\n s[12] ^= Th;\n s[13] ^= Tl;\n s[22] ^= Th;\n s[23] ^= Tl;\n s[32] ^= Th;\n s[33] ^= Tl;\n s[42] ^= Th;\n s[43] ^= Tl;\n }\n { // x=4: idx0=6, idx1=2\n const Th = rotlH(B[6], B[7], 1) ^ B[2];\n const Tl = rotlL(B[6], B[7], 1) ^ B[3];\n s[4] ^= Th;\n s[5] ^= Tl;\n s[14] ^= Th;\n s[15] ^= Tl;\n s[24] ^= Th;\n s[25] ^= Tl;\n s[34] ^= Th;\n s[35] ^= Tl;\n s[44] ^= Th;\n s[45] ^= Tl;\n }\n { // x=6: idx0=8, idx1=4\n const Th = rotlH(B[8], B[9], 1) ^ B[4];\n const Tl = rotlL(B[8], B[9], 1) ^ B[5];\n s[6] ^= Th;\n s[7] ^= Tl;\n s[16] ^= Th;\n s[17] ^= Tl;\n s[26] ^= Th;\n s[27] ^= Tl;\n s[36] ^= Th;\n s[37] ^= Tl;\n s[46] ^= Th;\n s[47] ^= Tl;\n }\n { // x=8: idx0=0, idx1=6\n const Th = rotlH(B[0], B[1], 1) ^ B[6];\n const Tl = rotlL(B[0], B[1], 1) ^ B[7];\n s[8] ^= Th;\n s[9] ^= Tl;\n s[18] ^= Th;\n s[19] ^= Tl;\n s[28] ^= Th;\n s[29] ^= Tl;\n s[38] ^= Th;\n s[39] ^= Tl;\n s[48] ^= Th;\n s[49] ^= Tl;\n }\n // Rho (ρ) and Pi (π) — fully unrolled\n let curH = s[2];\n let curL = s[3];\n // for (let t = 0; t < 24; t++) {\n // const shift = SHA3_ROTL[t];\n // const Th = rotlH(curH, curL, shift);\n // const Tl = rotlL(curH, curL, shift);\n // const PI = SHA3_PI[t];\n // curH = s[PI];\n // curL = s[PI + 1];\n // s[PI] = Th;\n // s[PI + 1] = Tl;\n // }\n let Th, Tl;\n // t=0: shift=1(S), PI=20\n Th = rotlSH(curH, curL, 1);\n Tl = rotlSL(curH, curL, 1);\n curH = s[20];\n curL = s[21];\n s[20] = Th;\n s[21] = Tl;\n // t=1: shift=3(S), PI=14\n Th = rotlSH(curH, curL, 3);\n Tl = rotlSL(curH, curL, 3);\n curH = s[14];\n curL = s[15];\n s[14] = Th;\n s[15] = Tl;\n // t=2: shift=6(S), PI=22\n Th = rotlSH(curH, curL, 6);\n Tl = rotlSL(curH, curL, 6);\n curH = s[22];\n curL = s[23];\n s[22] = Th;\n s[23] = Tl;\n // t=3: shift=10(S), PI=34\n Th = rotlSH(curH, curL, 10);\n Tl = rotlSL(curH, curL, 10);\n curH = s[34];\n curL = s[35];\n s[34] = Th;\n s[35] = Tl;\n // t=4: shift=15(S), PI=36\n Th = rotlSH(curH, curL, 15);\n Tl = rotlSL(curH, curL, 15);\n curH = s[36];\n curL = s[37];\n s[36] = Th;\n s[37] = Tl;\n // t=5: shift=21(S), PI=6\n Th = rotlSH(curH, curL, 21);\n Tl = rotlSL(curH, curL, 21);\n curH = s[6];\n curL = s[7];\n s[6] = Th;\n s[7] = Tl;\n // t=6: shift=28(S), PI=10\n Th = rotlSH(curH, curL, 28);\n Tl = rotlSL(curH, curL, 28);\n curH = s[10];\n curL = s[11];\n s[10] = Th;\n s[11] = Tl;\n // t=7: shift=36(B), PI=32\n Th = rotlBH(curH, curL, 36);\n Tl = rotlBL(curH, curL, 36);\n curH = s[32];\n curL = s[33];\n s[32] = Th;\n s[33] = Tl;\n // t=8: shift=45(B), PI=16\n Th = rotlBH(curH, curL, 45);\n Tl = rotlBL(curH, curL, 45);\n curH = s[16];\n curL = s[17];\n s[16] = Th;\n s[17] = Tl;\n // t=9: shift=55(B), PI=42\n Th = rotlBH(curH, curL, 55);\n Tl = rotlBL(curH, curL, 55);\n curH = s[42];\n curL = s[43];\n s[42] = Th;\n s[43] = Tl;\n // t=10: shift=2(S), PI=48\n Th = rotlSH(curH, curL, 2);\n Tl = rotlSL(curH, curL, 2);\n curH = s[48];\n curL = s[49];\n s[48] = Th;\n s[49] = Tl;\n // t=11: shift=14(S), PI=8\n Th = rotlSH(curH, curL, 14);\n Tl = rotlSL(curH, curL, 14);\n curH = s[8];\n curL = s[9];\n s[8] = Th;\n s[9] = Tl;\n // t=12: shift=27(S), PI=30\n Th = rotlSH(curH, curL, 27);\n Tl = rotlSL(curH, curL, 27);\n curH = s[30];\n curL = s[31];\n s[30] = Th;\n s[31] = Tl;\n // t=13: shift=41(B), PI=46\n Th = rotlBH(curH, curL, 41);\n Tl = rotlBL(curH, curL, 41);\n curH = s[46];\n curL = s[47];\n s[46] = Th;\n s[47] = Tl;\n // t=14: shift=56(B), PI=38\n Th = rotlBH(curH, curL, 56);\n Tl = rotlBL(curH, curL, 56);\n curH = s[38];\n curL = s[39];\n s[38] = Th;\n s[39] = Tl;\n // t=15: shift=8(S), PI=26\n Th = rotlSH(curH, curL, 8);\n Tl = rotlSL(curH, curL, 8);\n curH = s[26];\n curL = s[27];\n s[26] = Th;\n s[27] = Tl;\n // t=16: shift=25(S), PI=24\n Th = rotlSH(curH, curL, 25);\n Tl = rotlSL(curH, curL, 25);\n curH = s[24];\n curL = s[25];\n s[24] = Th;\n s[25] = Tl;\n // t=17: shift=43(B), PI=4\n Th = rotlBH(curH, curL, 43);\n Tl = rotlBL(curH, curL, 43);\n curH = s[4];\n curL = s[5];\n s[4] = Th;\n s[5] = Tl;\n // t=18: shift=62(B), PI=40\n Th = rotlBH(curH, curL, 62);\n Tl = rotlBL(curH, curL, 62);\n curH = s[40];\n curL = s[41];\n s[40] = Th;\n s[41] = Tl;\n // t=19: shift=18(S), PI=28\n Th = rotlSH(curH, curL, 18);\n Tl = rotlSL(curH, curL, 18);\n curH = s[28];\n curL = s[29];\n s[28] = Th;\n s[29] = Tl;\n // t=20: shift=39(B), PI=44\n Th = rotlBH(curH, curL, 39);\n Tl = rotlBL(curH, curL, 39);\n curH = s[44];\n curL = s[45];\n s[44] = Th;\n s[45] = Tl;\n // t=21: shift=61(B), PI=18\n Th = rotlBH(curH, curL, 61);\n Tl = rotlBL(curH, curL, 61);\n curH = s[18];\n curL = s[19];\n s[18] = Th;\n s[19] = Tl;\n // t=22: shift=20(S), PI=12\n Th = rotlSH(curH, curL, 20);\n Tl = rotlSL(curH, curL, 20);\n curH = s[12];\n curL = s[13];\n s[12] = Th;\n s[13] = Tl;\n // t=23: shift=44(B), PI=2\n Th = rotlBH(curH, curL, 44);\n Tl = rotlBL(curH, curL, 44);\n s[2] = Th;\n s[3] = Tl;\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n B[0] = s[y];\n B[1] = s[y + 1];\n B[2] = s[y + 2];\n B[3] = s[y + 3];\n B[4] = s[y + 4];\n B[5] = s[y + 5];\n B[6] = s[y + 6];\n B[7] = s[y + 7];\n B[8] = s[y + 8];\n B[9] = s[y + 9];\n s[y + 0] ^= ~B[2] & B[4];\n s[y + 1] ^= ~B[3] & B[5];\n s[y + 2] ^= ~B[4] & B[6];\n s[y + 3] ^= ~B[5] & B[7];\n s[y + 4] ^= ~B[6] & B[8];\n s[y + 5] ^= ~B[7] & B[9];\n s[y + 6] ^= ~B[8] & B[0];\n s[y + 7] ^= ~B[9] & B[1];\n s[y + 8] ^= ~B[0] & B[2];\n s[y + 9] ^= ~B[1] & B[3];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n}\n/** Keccak sponge function. */\nexport class Keccak {\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {\n Object.defineProperty(this, \"state\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"pos\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"posOut\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 0\n });\n Object.defineProperty(this, \"finished\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"state32\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"destroyed\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"_B\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: new Uint32Array(10)\n });\n Object.defineProperty(this, \"blockLen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"suffix\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"outputLen\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"enableXOF\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: false\n });\n Object.defineProperty(this, \"rounds\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.blockLen = blockLen;\n this.suffix = suffix;\n this.outputLen = outputLen;\n this.enableXOF = enableXOF;\n this.rounds = rounds;\n // Can be passed from user as dkLen\n anumber(outputLen, \"outputLen\");\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n // 0 < blockLen < 200\n if (!(0 < blockLen && blockLen < 200)) {\n throw new Error(\"only keccak-f1600 function is supported\");\n }\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n clone() {\n return this._cloneInto();\n }\n /** Resets instance to initial (empty) state for reuse. */\n reset() {\n this.state.fill(0);\n this.pos = 0;\n this.posOut = 0;\n this.finished = false;\n this.destroyed = false;\n }\n keccak() {\n swap32IfBE(this.state32);\n keccakP(this.state32, this.rounds, this._B);\n swap32IfBE(this.state32);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data) {\n aexists(this);\n abytes(data);\n return this.updateUnsafe(data);\n }\n /** Like update(), but skips validation. Caller must ensure valid state and input. */\n updateUnsafe(data) {\n const { blockLen, state } = this;\n const len = data.length;\n for (let pos = 0; pos < len;) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++)\n state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen)\n this.keccak();\n }\n return this;\n }\n finish() {\n if (this.finished)\n return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1)\n this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n writeInto(out) {\n aexists(this, false);\n abytes(out);\n return this.writeIntoUnsafe(out);\n }\n /** Like writeInto(), but skips validation. Caller must ensure valid state and output. */\n writeIntoUnsafe(out) {\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len;) {\n if (this.posOut >= blockLen)\n this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out) {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF) {\n throw new Error(\"XOF is not possible for this instance\");\n }\n return this.writeInto(out);\n }\n xof(bytes) {\n anumber(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out) {\n aoutput(out, this);\n if (this.finished)\n throw new Error(\"digest() was already called\");\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n clean(this.state);\n }\n _cloneInto(to) {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\nconst genKeccak = (suffix, blockLen, outputLen, info = {}) => createHasher(() => new Keccak(blockLen, suffix, outputLen), info);\n// /** SHA3-224 hash function. */\n// export const sha3_224: CHash = /* @__PURE__ */ genKeccak(\n// 0x06,\n// 144,\n// 28,\n// /* @__PURE__ */ oidNist(0x07),\n// );\n/** SHA3-256 hash function. Different from keccak-256. */\nexport const sha3_256 = /* @__PURE__ */ genKeccak(0x06, 136, 32, \n/* @__PURE__ */ oidNist(0x08));\n/** SHA3-384 hash function. */\nexport const sha3_384 = /* @__PURE__ */ genKeccak(0x06, 104, 48, \n/* @__PURE__ */ oidNist(0x09));\n/** SHA3-512 hash function. */\nexport const sha3_512 = /* @__PURE__ */ genKeccak(0x06, 72, 64, \n/* @__PURE__ */ oidNist(0x0a));\n/** keccak-224 hash function. */\nexport const keccak_224 = /* @__PURE__ */ genKeccak(0x01, 144, 28);\n/** keccak-256 hash function. Different from SHA3-256. */\nexport const keccak_256 = /* @__PURE__ */ genKeccak(0x01, 136, 32);\n/** keccak-384 hash function. */\nexport const keccak_384 = /* @__PURE__ */ genKeccak(0x01, 104, 48);\n/** keccak-512 hash function. */\nexport const keccak_512 = /* @__PURE__ */ genKeccak(0x01, 72, 64);\nconst genShake = (suffix, blockLen, outputLen, info = {}) => createHasher((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true), info);\n/** SHAKE128 XOF with 128-bit security. */\nexport const shake128 = \n/* @__PURE__ */\ngenShake(0x1f, 168, 16, /* @__PURE__ */ oidNist(0x0b));\n/** SHAKE256 XOF with 256-bit security. */\nexport const shake256 = \n/* @__PURE__ */\ngenShake(0x1f, 136, 32, /* @__PURE__ */ oidNist(0x0c));\n// /** SHAKE128 XOF with 256-bit output (NIST version). */\n// export const shake128_32: CHashXOF =\n// /* @__PURE__ */\n// genShake(0x1f, 168, 32, /* @__PURE__ */ oidNist(0x0b));\n// /** SHAKE256 XOF with 512-bit output (NIST version). */\n// export const shake256_64: CHashXOF =\n// /* @__PURE__ */\n// genShake(0x1f, 136, 64, /* @__PURE__ */ oidNist(0x0c));\n","import { AEAD_USAGES, AeadId, NativeAlgorithm } from \"@hpke/common\";\nexport class AesGcmContext extends NativeAlgorithm {\n constructor(key) {\n super();\n Object.defineProperty(this, \"_rawKey\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_key\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: undefined\n });\n this._rawKey = key;\n }\n async seal(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const ct = await this._api.encrypt(alg, this._key, data);\n return ct;\n }\n async open(iv, data, aad) {\n await this._setupKey();\n const alg = {\n name: \"AES-GCM\",\n iv: iv,\n additionalData: aad,\n };\n const pt = await this._api.decrypt(alg, this._key, data);\n return pt;\n }\n async _setupKey() {\n if (this._key !== undefined) {\n return;\n }\n await this._setup();\n const key = await this._importKey(this._rawKey);\n (new Uint8Array(this._rawKey)).fill(0);\n this._key = key;\n return;\n }\n async _importKey(key) {\n return await this._api.importKey(\"raw\", key, { name: \"AES-GCM\" }, true, AEAD_USAGES);\n }\n}\n/**\n * The AES-128-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes128Gcm`.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class Aes128Gcm {\n constructor() {\n /** AeadId.Aes128Gcm (0x0001) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes128Gcm\n });\n /** 16 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n createEncryptionContext(key) {\n return new AesGcmContext(key);\n }\n}\n/**\n * The AES-256-GCM for HPKE AEAD implementing {@link AeadInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `aead` parameter of {@link CipherSuiteParams} instead of `AeadId.Aes256Gcm`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class Aes256Gcm extends Aes128Gcm {\n constructor() {\n super(...arguments);\n /** AeadId.Aes256Gcm (0x0002) */\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: AeadId.Aes256Gcm\n });\n /** 32 */\n Object.defineProperty(this, \"keySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n /** 12 */\n Object.defineProperty(this, \"nonceSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 12\n });\n /** 16 */\n Object.defineProperty(this, \"tagSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 16\n });\n }\n}\n","import { NotSupportedError } from \"@hpke/common\";\nexport function emitNotSupported() {\n return new Promise((_resolve, reject) => {\n reject(new NotSupportedError(\"Not supported\"));\n });\n}\n","import { ExportError, INPUT_LENGTH_LIMIT, InvalidParamError, } from \"@hpke/common\";\nimport { emitNotSupported } from \"./utils/emitNotSupported.js\";\n// b\"sec\"\nconst LABEL_SEC = new Uint8Array([115, 101, 99]);\nexport class ExporterContextImpl {\n constructor(api, kdf, exporterSecret) {\n Object.defineProperty(this, \"_api\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"exporterSecret\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._api = api;\n this._kdf = kdf;\n this.exporterSecret = exporterSecret;\n }\n async seal(_data, _aad) {\n return await emitNotSupported();\n }\n async open(_data, _aad) {\n return await emitNotSupported();\n }\n async export(exporterContext, len) {\n if (exporterContext.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long exporter context\");\n }\n try {\n return await this._kdf.labeledExpand(this.exporterSecret, LABEL_SEC, new Uint8Array(exporterContext), len);\n }\n catch (e) {\n throw new ExportError(e);\n }\n }\n}\nexport class RecipientExporterContextImpl extends ExporterContextImpl {\n}\nexport class SenderExporterContextImpl extends ExporterContextImpl {\n constructor(api, kdf, exporterSecret, enc) {\n super(api, kdf, exporterSecret);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this.enc = enc;\n return;\n }\n}\n","import { i2Osp, MessageLimitReachedError, xor } from \"@hpke/common\";\nimport { ExporterContextImpl } from \"./exporterContext.js\";\nexport class EncryptionContextImpl extends ExporterContextImpl {\n constructor(api, kdf, params) {\n super(api, kdf, params.exporterSecret);\n // AEAD id.\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a key for the algorithm.\n Object.defineProperty(this, \"_nK\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of a nonce for the algorithm.\n Object.defineProperty(this, \"_nN\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The length in bytes of an authentication tag for the algorithm.\n Object.defineProperty(this, \"_nT\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // The end-to-end encryption key information.\n Object.defineProperty(this, \"_ctx\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n if (params.key === undefined || params.baseNonce === undefined ||\n params.seq === undefined) {\n throw new Error(\"Required parameters are missing\");\n }\n this._aead = params.aead;\n this._nK = this._aead.keySize;\n this._nN = this._aead.nonceSize;\n this._nT = this._aead.tagSize;\n const key = this._aead.createEncryptionContext(params.key);\n this._ctx = {\n key: key,\n baseNonce: params.baseNonce,\n seq: params.seq,\n };\n }\n computeNonce(k) {\n const seqBytes = i2Osp(k.seq, k.baseNonce.byteLength);\n return xor(k.baseNonce, seqBytes).buffer;\n }\n incrementSeq(k) {\n // if (this.seq >= (1 << (8 * this.baseNonce.byteLength)) - 1) {\n if (k.seq > Number.MAX_SAFE_INTEGER) {\n throw new MessageLimitReachedError(\"Message limit reached\");\n }\n k.seq += 1;\n return;\n }\n}\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _Mutex_locked;\nexport class Mutex {\n constructor() {\n _Mutex_locked.set(this, Promise.resolve());\n }\n async lock() {\n let releaseLock;\n const nextLock = new Promise((resolve) => {\n releaseLock = resolve;\n });\n const previousLock = __classPrivateFieldGet(this, _Mutex_locked, \"f\");\n __classPrivateFieldSet(this, _Mutex_locked, nextLock, \"f\");\n await previousLock;\n return releaseLock;\n }\n}\n_Mutex_locked = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _RecipientContextImpl_mutex;\nimport { EMPTY, OpenError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class RecipientContextImpl extends EncryptionContextImpl {\n constructor() {\n super(...arguments);\n _RecipientContextImpl_mutex.set(this, void 0);\n }\n async open(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _RecipientContextImpl_mutex, __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _RecipientContextImpl_mutex, \"f\").lock();\n let pt;\n try {\n pt = await this._ctx.key.open(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new OpenError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return pt;\n }\n}\n_RecipientContextImpl_mutex = new WeakMap();\n","var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n};\nvar __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n};\nvar _SenderContextImpl_mutex;\nimport { EMPTY, SealError } from \"@hpke/common\";\nimport { EncryptionContextImpl } from \"./encryptionContext.js\";\nimport { Mutex } from \"./mutex.js\";\nexport class SenderContextImpl extends EncryptionContextImpl {\n constructor(api, kdf, params, enc) {\n super(api, kdf, params);\n Object.defineProperty(this, \"enc\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n _SenderContextImpl_mutex.set(this, void 0);\n this.enc = enc;\n }\n async seal(data, aad = EMPTY.buffer) {\n __classPrivateFieldSet(this, _SenderContextImpl_mutex, __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\") ?? new Mutex(), \"f\");\n const release = await __classPrivateFieldGet(this, _SenderContextImpl_mutex, \"f\").lock();\n let ct;\n try {\n ct = await this._ctx.key.seal(this.computeNonce(this._ctx), data, aad);\n }\n catch (e) {\n throw new SealError(e);\n }\n finally {\n release();\n }\n this.incrementSeq(this._ctx);\n return ct;\n }\n}\n_SenderContextImpl_mutex = new WeakMap();\n","import { AeadId, EMPTY, i2Osp, INFO_LENGTH_LIMIT, INPUT_LENGTH_LIMIT, InvalidParamError, MINIMUM_PSK_LENGTH, Mode, NativeAlgorithm, } from \"@hpke/common\";\nimport { RecipientExporterContextImpl, SenderExporterContextImpl, } from \"./exporterContext.js\";\nimport { RecipientContextImpl } from \"./recipientContext.js\";\nimport { SenderContextImpl } from \"./senderContext.js\";\n// b\"base_nonce\"\n// deno-fmt-ignore\nconst LABEL_BASE_NONCE = new Uint8Array([\n 98, 97, 115, 101, 95, 110, 111, 110, 99, 101,\n]);\n// b\"exp\"\nconst LABEL_EXP = new Uint8Array([101, 120, 112]);\n// b\"info_hash\"\n// deno-fmt-ignore\nconst LABEL_INFO_HASH = new Uint8Array([\n 105, 110, 102, 111, 95, 104, 97, 115, 104,\n]);\n// b\"key\"\nconst LABEL_KEY = new Uint8Array([107, 101, 121]);\n// b\"psk_id_hash\"\n// deno-fmt-ignore\nconst LABEL_PSK_ID_HASH = new Uint8Array([\n 112, 115, 107, 95, 105, 100, 95, 104, 97, 115, 104,\n]);\n// b\"secret\"\nconst LABEL_SECRET = new Uint8Array([115, 101, 99, 114, 101, 116]);\n// b\"HPKE\"\n// deno-fmt-ignore\nconst SUITE_ID_HEADER_HPKE = new Uint8Array([\n 72, 80, 75, 69, 0, 0, 0, 0, 0, 0,\n]);\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This is the super class of {@link CipherSuite} and the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuite | @hpke/core#CipherSuite} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - DHKEM(X25519, HKDF-SHA256)\n * - DHKEM(X448, HKDF-SHA512)\n * - ChaCha20Poly1305\n *\n * In addtion, the HKDF functions contained in this class can only derive\n * keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * // Use an extension module.\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuiteNative extends NativeAlgorithm {\n /**\n * @param params A set of parameters for building a cipher suite.\n *\n * If the error occurred, throws {@link InvalidParamError}.\n *\n * @throws {@link InvalidParamError}\n */\n constructor(params) {\n super();\n Object.defineProperty(this, \"_kem\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_kdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_aead\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_suiteId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n // KEM\n if (typeof params.kem === \"number\") {\n throw new InvalidParamError(\"KemId cannot be used\");\n }\n this._kem = params.kem;\n // KDF\n if (typeof params.kdf === \"number\") {\n throw new InvalidParamError(\"KdfId cannot be used\");\n }\n this._kdf = params.kdf;\n // AEAD\n if (typeof params.aead === \"number\") {\n throw new InvalidParamError(\"AeadId cannot be used\");\n }\n this._aead = params.aead;\n this._suiteId = new Uint8Array(SUITE_ID_HEADER_HPKE);\n this._suiteId.set(i2Osp(this._kem.id, 2), 4);\n this._suiteId.set(i2Osp(this._kdf.id, 2), 6);\n this._suiteId.set(i2Osp(this._aead.id, 2), 8);\n this._kdf.init(this._suiteId);\n }\n /**\n * Gets the KEM context of the ciphersuite.\n */\n get kem() {\n return this._kem;\n }\n /**\n * Gets the KDF context of the ciphersuite.\n */\n get kdf() {\n return this._kdf;\n }\n /**\n * Gets the AEAD context of the ciphersuite.\n */\n get aead() {\n return this._aead;\n }\n /**\n * Creates an encryption context for a sender.\n *\n * If the error occurred, throws {@link DecapError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the sender encryption context.\n * @returns A sender encryption context.\n * @throws {@link EncapError}, {@link ValidationError}\n */\n async createSenderContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const dh = await this._kem.encap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleS(mode, dh.sharedSecret, dh.enc, params);\n }\n /**\n * Creates an encryption context for a recipient.\n *\n * If the error occurred, throws {@link DecapError}\n * | {@link DeserializeError} | {@link ValidationError}.\n *\n * @param params A set of parameters for the recipient encryption context.\n * @returns A recipient encryption context.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link ValidationError}\n */\n async createRecipientContext(params) {\n this._validateInputLength(params);\n await this._setup();\n const sharedSecret = await this._kem.decap(params);\n let mode;\n if (params.psk !== undefined) {\n mode = params.senderPublicKey !== undefined ? Mode.AuthPsk : Mode.Psk;\n }\n else {\n mode = params.senderPublicKey !== undefined ? Mode.Auth : Mode.Base;\n }\n return await this._keyScheduleR(mode, sharedSecret, params);\n }\n /**\n * Encrypts a message to a recipient.\n *\n * If the error occurred, throws `EncapError` | `MessageLimitReachedError` | `SealError` | `ValidationError`.\n *\n * @param params A set of parameters for building a sender encryption context.\n * @param pt A plain text as bytes to be encrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A cipher text and an encapsulated key as bytes.\n * @throws {@link EncapError}, {@link MessageLimitReachedError}, {@link SealError}, {@link ValidationError}\n */\n async seal(params, pt, aad = EMPTY.buffer) {\n const ctx = await this.createSenderContext(params);\n return {\n ct: await ctx.seal(pt, aad),\n enc: ctx.enc,\n };\n }\n /**\n * Decrypts a message from a sender.\n *\n * If the error occurred, throws `DecapError` | `DeserializeError` | `OpenError` | `ValidationError`.\n *\n * @param params A set of parameters for building a recipient encryption context.\n * @param ct An encrypted text as bytes to be decrypted.\n * @param aad Additional authenticated data as bytes fed by an application.\n * @returns A decrypted plain text as bytes.\n * @throws {@link DecapError}, {@link DeserializeError}, {@link OpenError}, {@link ValidationError}\n */\n async open(params, ct, aad = EMPTY.buffer) {\n const ctx = await this.createRecipientContext(params);\n return await ctx.open(ct, aad);\n }\n // private verifyPskInputs(mode: Mode, params: KeyScheduleParams) {\n // const gotPsk = (params.psk !== undefined);\n // const gotPskId = (params.psk !== undefined && params.psk.id.byteLength > 0);\n // if (gotPsk !== gotPskId) {\n // throw new Error('Inconsistent PSK inputs');\n // }\n // if (gotPsk && (mode === Mode.Base || mode === Mode.Auth)) {\n // throw new Error('PSK input provided when not needed');\n // }\n // if (!gotPsk && (mode === Mode.Psk || mode === Mode.AuthPsk)) {\n // throw new Error('Missing required PSK input');\n // }\n // return;\n // }\n async _keySchedule(mode, sharedSecret, params) {\n // Currently, there is no point in executing this function\n // because this hpke library does not allow users to explicitly specify the mode.\n //\n // this.verifyPskInputs(mode, params);\n const pskId = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.id);\n const pskIdHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_PSK_ID_HASH, pskId);\n const info = params.info === undefined\n ? EMPTY\n : new Uint8Array(params.info);\n const infoHash = await this._kdf.labeledExtract(EMPTY.buffer, LABEL_INFO_HASH, info);\n const keyScheduleContext = new Uint8Array(1 + pskIdHash.byteLength + infoHash.byteLength);\n keyScheduleContext.set(new Uint8Array([mode]), 0);\n keyScheduleContext.set(new Uint8Array(pskIdHash), 1);\n keyScheduleContext.set(new Uint8Array(infoHash), 1 + pskIdHash.byteLength);\n const psk = params.psk === undefined\n ? EMPTY\n : new Uint8Array(params.psk.key);\n const ikm = this._kdf.buildLabeledIkm(LABEL_SECRET, psk)\n .buffer;\n const exporterSecretInfo = this._kdf.buildLabeledInfo(LABEL_EXP, keyScheduleContext, this._kdf.hashSize).buffer;\n const exporterSecret = await this._kdf.extractAndExpand(sharedSecret, ikm, exporterSecretInfo, this._kdf.hashSize);\n if (this._aead.id === AeadId.ExportOnly) {\n return { aead: this._aead, exporterSecret: exporterSecret };\n }\n const keyInfo = this._kdf.buildLabeledInfo(LABEL_KEY, keyScheduleContext, this._aead.keySize).buffer;\n const key = await this._kdf.extractAndExpand(sharedSecret, ikm, keyInfo, this._aead.keySize);\n const baseNonceInfo = this._kdf.buildLabeledInfo(LABEL_BASE_NONCE, keyScheduleContext, this._aead.nonceSize).buffer;\n const baseNonce = await this._kdf.extractAndExpand(sharedSecret, ikm, baseNonceInfo, this._aead.nonceSize);\n return {\n aead: this._aead,\n exporterSecret: exporterSecret,\n key: key,\n baseNonce: new Uint8Array(baseNonce),\n seq: 0,\n };\n }\n async _keyScheduleS(mode, sharedSecret, enc, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new SenderExporterContextImpl(this._api, this._kdf, res.exporterSecret, enc);\n }\n return new SenderContextImpl(this._api, this._kdf, res, enc);\n }\n async _keyScheduleR(mode, sharedSecret, params) {\n const res = await this._keySchedule(mode, sharedSecret, params);\n if (res.key === undefined) {\n return new RecipientExporterContextImpl(this._api, this._kdf, res.exporterSecret);\n }\n return new RecipientContextImpl(this._api, this._kdf, res);\n }\n _validateInputLength(params) {\n if (params.info !== undefined &&\n params.info.byteLength > INFO_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long info\");\n }\n if (params.psk !== undefined) {\n if (params.psk.key.byteLength < MINIMUM_PSK_LENGTH) {\n throw new InvalidParamError(`PSK must have at least ${MINIMUM_PSK_LENGTH} bytes`);\n }\n if (params.psk.key.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.key\");\n }\n if (params.psk.id.byteLength > INPUT_LENGTH_LIMIT) {\n throw new InvalidParamError(\"Too long psk.id\");\n }\n }\n return;\n }\n}\n","import { Dhkem, Ec, HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, KemId, } from \"@hpke/common\";\nexport class DhkemP256HkdfSha256Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha256Native();\n const prim = new Ec(KemId.DhkemP256HkdfSha256, kdf);\n super(KemId.DhkemP256HkdfSha256, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP256HkdfSha256\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 65\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 32\n });\n }\n}\nexport class DhkemP384HkdfSha384Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha384Native();\n const prim = new Ec(KemId.DhkemP384HkdfSha384, kdf);\n super(KemId.DhkemP384HkdfSha384, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP384HkdfSha384\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 97\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 48\n });\n }\n}\nexport class DhkemP521HkdfSha512Native extends Dhkem {\n constructor() {\n const kdf = new HkdfSha512Native();\n const prim = new Ec(KemId.DhkemP521HkdfSha512, kdf);\n super(KemId.DhkemP521HkdfSha512, prim, kdf);\n Object.defineProperty(this, \"id\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: KemId.DhkemP521HkdfSha512\n });\n Object.defineProperty(this, \"secretSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n Object.defineProperty(this, \"encSize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"publicKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 133\n });\n Object.defineProperty(this, \"privateKeySize\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: 64\n });\n }\n}\n","import { HkdfSha256Native, HkdfSha384Native, HkdfSha512Native, } from \"@hpke/common\";\nimport { CipherSuiteNative } from \"./cipherSuiteNative.js\";\nimport { DhkemP256HkdfSha256Native, DhkemP384HkdfSha384Native, DhkemP521HkdfSha512Native, } from \"./kems/dhkemNative.js\";\n/**\n * The Hybrid Public Key Encryption (HPKE) ciphersuite,\n * which is implemented using only\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n *\n * This class is the same as\n * {@link https://jsr.io/@hpke/core/doc/~/CipherSuiteNative | @hpke/core#CipherSuiteNative} as follows:\n * which supports only the ciphersuites that can be implemented on the native\n * {@link https://www.w3.org/TR/WebCryptoAPI/ | Web Cryptography API}.\n * Therefore, the following cryptographic algorithms are not supported for now:\n * - `DHKEM(X25519, HKDF-SHA256)`\n * - `DHKEM(X448, HKDF-SHA512)`\n * - `ChaCha20Poly1305`\n *\n * In addtion, the HKDF functions contained in this `CipherSuiteNative`\n * class can only derive keys of the same length as the `hashSize`.\n *\n * If you want to use the unsupported cryptographic algorithms\n * above or derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * This class provides following functions:\n *\n * - Creates encryption contexts both for senders and recipients.\n * - {@link createSenderContext}\n * - {@link createRecipientContext}\n * - Provides single-shot encryption API.\n * - {@link seal}\n * - {@link open}\n *\n * The calling of the constructor of this class is the starting\n * point for HPKE operations for both senders and recipients.\n *\n * @example Use only ciphersuites supported by Web Cryptography API.\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * CipherSuite,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n *\n * @example Use a ciphersuite which is currently not supported by Web Cryptography API.\n *\n * ```ts\n * import { Aes128Gcm, HkdfSha256, CipherSuite } from \"@hpke/core\";\n * import { DhkemX25519HkdfSha256 } from \"@hpke/dhkem-x25519\";\n * const suite = new CipherSuite({\n * kem: new DhkemX25519HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class CipherSuite extends CipherSuiteNative {\n}\n/**\n * The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP256HkdfSha256`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP256HkdfSha256 extends DhkemP256HkdfSha256Native {\n}\n/**\n * The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP384HkdfSha384`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class DhkemP384HkdfSha384 extends DhkemP384HkdfSha384Native {\n}\n/**\n * The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing {@link KemInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KemId.DhkemP521HkdfSha512`\n * as follows:\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class DhkemP521HkdfSha512 extends DhkemP521HkdfSha512Native {\n}\n/**\n * The HKDF-SHA256 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha256`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP256HkdfSha256,\n * HkdfSha256,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP256HkdfSha256(),\n * kdf: new HkdfSha256(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha256 extends HkdfSha256Native {\n}\n/**\n * The HKDF-SHA384 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha384`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes128Gcm,\n * CipherSuite,\n * DhkemP384HkdfSha384,\n * HkdfSha384,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP384HkdfSha384(),\n * kdf: new HkdfSha384(),\n * aead: new Aes128Gcm(),\n * });\n * ```\n */\nexport class HkdfSha384 extends HkdfSha384Native {\n}\n/**\n * The HKDF-SHA512 for HPKE KDF implementing {@link KdfInterface}.\n *\n * When using `@hpke/core`, the instance of this class must be specified\n * to the `kem` parameter of {@link CipherSuiteParams} instead of `KdfId.HkdfSha512`.\n *\n * The KDF class can only derive keys of the same length as the `hashSize`.\n * If you want to derive keys longer than the `hashSize`,\n * please use {@link https://jsr.io/@hpke/hpke-js/doc/~/CipherSuite | hpke-js#CipherSuite}.\n *\n * @example\n *\n * ```ts\n * import {\n * Aes256Gcm,\n * CipherSuite,\n * DhkemP521HkdfSha512,\n * HkdfSha512,\n * } from \"@hpke/core\";\n *\n * const suite = new CipherSuite({\n * kem: new DhkemP521HkdfSha512(),\n * kdf: new HkdfSha512(),\n * aead: new Aes256Gcm(),\n * });\n * ```\n */\nexport class HkdfSha512 extends HkdfSha512Native {\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X25519\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X25519 = new Uint8Array([\n 0x30, 0x2e, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6e, 0x04, 0x22, 0x04, 0x20,\n]);\nexport class X25519 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 32;\n this._nSk = 32;\n this._nDh = 32;\n this._pkcs8AlgId = PKCS8_ALG_ID_X25519;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","import { base64UrlToBytes, DeriveKeyPairError, DeserializeError, EMPTY, KEM_USAGES, LABEL_DKP_PRK, LABEL_SK, NativeAlgorithm, NotSupportedError, SerializeError, } from \"@hpke/common\";\nconst ALG_NAME = \"X448\";\n// deno-fmt-ignore\nconst PKCS8_ALG_ID_X448 = new Uint8Array([\n 0x30, 0x46, 0x02, 0x01, 0x00, 0x30, 0x05, 0x06,\n 0x03, 0x2b, 0x65, 0x6f, 0x04, 0x3a, 0x04, 0x38,\n]);\nexport class X448 extends NativeAlgorithm {\n constructor(hkdf) {\n super();\n Object.defineProperty(this, \"_hkdf\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_alg\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nPk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nSk\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_nDh\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n Object.defineProperty(this, \"_pkcs8AlgId\", {\n enumerable: true,\n configurable: true,\n writable: true,\n value: void 0\n });\n this._alg = { name: ALG_NAME };\n this._hkdf = hkdf;\n this._nPk = 56;\n this._nSk = 56;\n this._nDh = 56;\n this._pkcs8AlgId = PKCS8_ALG_ID_X448;\n }\n async serializePublicKey(key) {\n await this._setup();\n try {\n return await this._api.exportKey(\"raw\", key);\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePublicKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, true);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async serializePrivateKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n if (!(\"d\" in jwk)) {\n throw new Error(\"Not private key\");\n }\n return base64UrlToBytes(jwk[\"d\"]).buffer;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async deserializePrivateKey(key) {\n await this._setup();\n try {\n return await this._importRawKey(key, false);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async importKey(format, key, isPublic) {\n await this._setup();\n try {\n if (format === \"raw\") {\n return await this._importRawKey(key, isPublic);\n }\n // jwk\n if (key instanceof ArrayBuffer) {\n throw new Error(\"Invalid jwk key format\");\n }\n return await this._importJWK(key, isPublic);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async generateKeyPair() {\n await this._setup();\n try {\n return await this._api.generateKey(ALG_NAME, true, KEM_USAGES);\n }\n catch (e) {\n throw new NotSupportedError(e);\n }\n }\n async deriveKeyPair(ikm) {\n await this._setup();\n try {\n const dkpPrk = await this._hkdf.labeledExtract(EMPTY.buffer, LABEL_DKP_PRK, new Uint8Array(ikm));\n const rawSk = await this._hkdf.labeledExpand(dkpPrk, LABEL_SK, EMPTY, this._nSk);\n const rawSkBytes = new Uint8Array(rawSk);\n const sk = await this._deserializePkcs8Key(rawSkBytes);\n rawSkBytes.fill(0);\n return {\n privateKey: sk,\n publicKey: await this.derivePublicKey(sk),\n };\n }\n catch (e) {\n throw new DeriveKeyPairError(e);\n }\n }\n async derivePublicKey(key) {\n await this._setup();\n try {\n const jwk = await this._api.exportKey(\"jwk\", key);\n delete jwk[\"d\"];\n delete jwk[\"key_ops\"];\n return await this._api.importKey(\"jwk\", jwk, this._alg, true, []);\n }\n catch (e) {\n throw new DeserializeError(e);\n }\n }\n async dh(sk, pk) {\n await this._setup();\n try {\n const bits = await this._api.deriveBits({\n name: ALG_NAME,\n public: pk,\n }, sk, this._nDh * 8);\n return bits;\n }\n catch (e) {\n throw new SerializeError(e);\n }\n }\n async _importRawKey(key, isPublic) {\n if (isPublic && key.byteLength !== this._nPk) {\n throw new Error(\"Invalid public key for the ciphersuite\");\n }\n if (!isPublic && key.byteLength !== this._nSk) {\n throw new Error(\"Invalid private key for the ciphersuite\");\n }\n if (isPublic) {\n return await this._api.importKey(\"raw\", key, this._alg, true, []);\n }\n return await this._deserializePkcs8Key(new Uint8Array(key));\n }\n async _importJWK(key, isPublic) {\n if (typeof key.kty === \"undefined\" || key.kty !== \"OKP\") {\n throw new Error(`Invalid kty: ${key.crv}`);\n }\n if (typeof key.crv === \"undefined\" || key.crv !== ALG_NAME) {\n throw new Error(`Invalid crv: ${key.crv}`);\n }\n if (isPublic) {\n if (typeof key.d !== \"undefined\") {\n throw new Error(\"Invalid key: `d` should not be set\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, []);\n }\n if (typeof key.d === \"undefined\") {\n throw new Error(\"Invalid key: `d` not found\");\n }\n return await this._api.importKey(\"jwk\", key, this._alg, true, KEM_USAGES);\n }\n async _deserializePkcs8Key(k) {\n const pkcs8Key = new Uint8Array(this._pkcs8AlgId.length + k.length);\n pkcs8Key.set(this._pkcs8AlgId, 0);\n pkcs8Key.set(k, this._pkcs8AlgId.length);\n return await this._api.importKey(\"pkcs8\", pkcs8Key, this._alg, true, KEM_USAGES);\n }\n}\n","'use strict';\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.bech32m = exports.bech32 = void 0;\nconst ALPHABET = 'qpzry9x8gf2tvdw0s3jn54khce6mua7l';\nconst ALPHABET_MAP = {};\nfor (let z = 0; z < ALPHABET.length; z++) {\n const x = ALPHABET.charAt(z);\n ALPHABET_MAP[x] = z;\n}\nfunction polymodStep(pre) {\n const b = pre >> 25;\n return (((pre & 0x1ffffff) << 5) ^\n (-((b >> 0) & 1) & 0x3b6a57b2) ^\n (-((b >> 1) & 1) & 0x26508e6d) ^\n (-((b >> 2) & 1) & 0x1ea119fa) ^\n (-((b >> 3) & 1) & 0x3d4233dd) ^\n (-((b >> 4) & 1) & 0x2a1462b3));\n}\nfunction prefixChk(prefix) {\n let chk = 1;\n for (let i = 0; i < prefix.length; ++i) {\n const c = prefix.charCodeAt(i);\n if (c < 33 || c > 126)\n return 'Invalid prefix (' + prefix + ')';\n chk = polymodStep(chk) ^ (c >> 5);\n }\n chk = polymodStep(chk);\n for (let i = 0; i < prefix.length; ++i) {\n const v = prefix.charCodeAt(i);\n chk = polymodStep(chk) ^ (v & 0x1f);\n }\n return chk;\n}\nfunction convert(data, inBits, outBits, pad) {\n let value = 0;\n let bits = 0;\n const maxV = (1 << outBits) - 1;\n const result = [];\n for (let i = 0; i < data.length; ++i) {\n value = (value << inBits) | data[i];\n bits += inBits;\n while (bits >= outBits) {\n bits -= outBits;\n result.push((value >> bits) & maxV);\n }\n }\n if (pad) {\n if (bits > 0) {\n result.push((value << (outBits - bits)) & maxV);\n }\n }\n else {\n if (bits >= inBits)\n return 'Excess padding';\n if ((value << (outBits - bits)) & maxV)\n return 'Non-zero padding';\n }\n return result;\n}\nfunction toWords(bytes) {\n return convert(bytes, 8, 5, true);\n}\nfunction fromWordsUnsafe(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n}\nfunction fromWords(words) {\n const res = convert(words, 5, 8, false);\n if (Array.isArray(res))\n return res;\n throw new Error(res);\n}\nfunction getLibraryFromEncoding(encoding) {\n let ENCODING_CONST;\n if (encoding === 'bech32') {\n ENCODING_CONST = 1;\n }\n else {\n ENCODING_CONST = 0x2bc830a3;\n }\n function encode(prefix, words, LIMIT) {\n LIMIT = LIMIT || 90;\n if (prefix.length + 7 + words.length > LIMIT)\n throw new TypeError('Exceeds length limit');\n prefix = prefix.toLowerCase();\n // determine chk mod\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n throw new Error(chk);\n let result = prefix + '1';\n for (let i = 0; i < words.length; ++i) {\n const x = words[i];\n if (x >> 5 !== 0)\n throw new Error('Non 5-bit word');\n chk = polymodStep(chk) ^ x;\n result += ALPHABET.charAt(x);\n }\n for (let i = 0; i < 6; ++i) {\n chk = polymodStep(chk);\n }\n chk ^= ENCODING_CONST;\n for (let i = 0; i < 6; ++i) {\n const v = (chk >> ((5 - i) * 5)) & 0x1f;\n result += ALPHABET.charAt(v);\n }\n return result;\n }\n function __decode(str, LIMIT) {\n LIMIT = LIMIT || 90;\n if (str.length < 8)\n return str + ' too short';\n if (str.length > LIMIT)\n return 'Exceeds length limit';\n // don't allow mixed case\n const lowered = str.toLowerCase();\n const uppered = str.toUpperCase();\n if (str !== lowered && str !== uppered)\n return 'Mixed-case string ' + str;\n str = lowered;\n const split = str.lastIndexOf('1');\n if (split === -1)\n return 'No separator character for ' + str;\n if (split === 0)\n return 'Missing prefix for ' + str;\n const prefix = str.slice(0, split);\n const wordChars = str.slice(split + 1);\n if (wordChars.length < 6)\n return 'Data too short';\n let chk = prefixChk(prefix);\n if (typeof chk === 'string')\n return chk;\n const words = [];\n for (let i = 0; i < wordChars.length; ++i) {\n const c = wordChars.charAt(i);\n const v = ALPHABET_MAP[c];\n if (v === undefined)\n return 'Unknown character ' + c;\n chk = polymodStep(chk) ^ v;\n // not in the checksum?\n if (i + 6 >= wordChars.length)\n continue;\n words.push(v);\n }\n if (chk !== ENCODING_CONST)\n return 'Invalid checksum for ' + str;\n return { prefix, words };\n }\n function decodeUnsafe(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n }\n function decode(str, LIMIT) {\n const res = __decode(str, LIMIT);\n if (typeof res === 'object')\n return res;\n throw new Error(res);\n }\n return {\n decodeUnsafe,\n decode,\n encode,\n toWords,\n fromWordsUnsafe,\n fromWords,\n };\n}\nexports.bech32 = getLibraryFromEncoding('bech32');\nexports.bech32m = getLibraryFromEncoding('bech32m');\n"],"names":["HpkeError","Error","constructor","e","message","super","this","name","errors_InvalidParamError","errors_SerializeError","errors_DeserializeError","EncapError","DecapError","ExportError","SealError","OpenError","MessageLimitReachedError","errors_DeriveKeyPairError","errors_NotSupportedError","dntGlobalThis","baseObj","globalThis","extObj","Proxy","get","_target","prop","_receiver","set","value","deleteProperty","success","ownKeys","baseKeys","Reflect","extKeys","extKeysSet","Set","filter","k","has","defineProperty","desc","getOwnPropertyDescriptor","NativeAlgorithm","Object","enumerable","configurable","writable","undefined","_setup","_api","async","crypto","subtle","webcrypto","__webpack_require__","then","t","bind","loadSubtleCrypto","INPUT_LENGTH_LIMIT","consts_EMPTY","Uint8Array","BYTE_TO_BIGINT_256","out","Array","i","kemInterface_SUITE_ID_HEADER_KEM","HPKE_VERSION","hkdf_toArrayBuffer","input","ArrayBuffer","isView","buffer","byteOffset","byteLength","slice","HkdfNative","hash","length","init","suiteId","_suiteId","buildLabeledIkm","label","ikm","_checkInit","ret","buildLabeledInfo","info","len","extract","salt","saltBuf","hashSize","ikmBuf","key","importKey","algHash","sign","expand","prk","prkBuf","okm","okmBytes","prev","mid","tail","tmp","cur","extractAndExpand","baseKey","deriveBits","labeledExtract","labeledExpand","HkdfSha256Native","arguments","misc_isCryptoKeyPair","x","privateKey","publicKey","misc_i2Osp","n","w","Math","floor","misc_concat","a","b","LABEL_EAE_PRK","LABEL_SHARED_SECRET","Dhkem","id","prim","kdf","_prim","_kdf","serializePublicKey","deserializePublicKey","serializePrivateKey","deserializePrivateKey","format","isPublic","generateKeyPair","deriveKeyPair","rawIkm","encap","params","ke","ekm","enc","pkrm","recipientPublicKey","dh","kemContext","senderKey","sks","pks","derivePublicKey","pksm","c","concat3","sharedSecret","_generateSharedSecret","decap","pke","skr","recipientKey","pkr","senderPublicKey","labeledIkm","labeledInfo","secretSize","dhkemPrimitives_KEM_USAGES","dhkemPrimitives_LABEL_DKP_PRK","Bignum","size","_num","val","reset","fill","src","isZero","lessThan","v","LABEL_CANDIDATE","ORDER_P_256","ORDER_P_384","ORDER_P_521","PKCS8_ALG_ID_P_256","PKCS8_ALG_ID_P_384","PKCS8_ALG_ID_P_521","EC_P_256_PARAMS","p","gx","gy","coordinateSize","EC_P_384_PARAMS","EC_P_521_PARAMS","ec_mod","r","modPow","base","exponent","result","bigIntToBytes","Number","buildRawUncompressedPublicKey","y","Ec","kem","hkdf","_hkdf","_alg","namedCurve","_nPk","_nSk","_nDh","_order","_bitmask","_pkcs8AlgId","_curveParams","exportKey","_importRawKey","jwk","base64","replace","byteString","atob","charCodeAt","misc_base64UrlToBytes","_importJWK","generateKey","dkpPrk","bn","counter","bytes","sk","_deserializePkcs8Key","_derivePublicKeyWithoutJwkExport","pk","public","crv","d","pkcs8Key","basePointRaw","basePoint","xBytes","bytesToBigInt","rhs","modSqrt","pubRaw","AEAD_USAGES","Uint32Array","U32_MASK64","fromBig","le","h","l","SHA3_PI","SHA3_ROTL","_SHA3_IOTA","round","R","push","j","BigInt","IOTAS","lst","Ah","Al","split","AesGcmContext","_rawKey","seal","iv","data","aad","_setupKey","alg","additionalData","encrypt","_key","open","decrypt","_importKey","Aes128Gcm","createEncryptionContext","Aes256Gcm","emitNotSupported","Promise","_resolve","reject","LABEL_SEC","ExporterContextImpl","api","exporterSecret","_data","_aad","exporterContext","RecipientExporterContextImpl","SenderExporterContextImpl","EncryptionContextImpl","baseNonce","seq","_aead","aead","_nK","keySize","_nN","nonceSize","_nT","tagSize","_ctx","computeNonce","seqBytes","buf","xor","incrementSeq","MAX_SAFE_INTEGER","_Mutex_locked","Mutex","resolve","lock","releaseLock","nextLock","previousLock","receiver","state","kind","f","TypeError","call","__classPrivateFieldGet","__classPrivateFieldSet","WeakMap","_RecipientContextImpl_mutex","recipientContext_classPrivateFieldGet","RecipientContextImpl","recipientContext_classPrivateFieldSet","release","pt","_SenderContextImpl_mutex","senderContext_classPrivateFieldGet","SenderContextImpl","senderContext_classPrivateFieldSet","ct","LABEL_BASE_NONCE","LABEL_EXP","LABEL_INFO_HASH","LABEL_KEY","LABEL_PSK_ID_HASH","LABEL_SECRET","SUITE_ID_HEADER_HPKE","CipherSuiteNative","_kem","createSenderContext","_validateInputLength","mode","psk","_keyScheduleS","createRecipientContext","_keyScheduleR","ctx","_keySchedule","pskId","pskIdHash","infoHash","keyScheduleContext","exporterSecretInfo","keyInfo","baseNonceInfo","res","DhkemP256HkdfSha256Native","CipherSuite","DhkemP256HkdfSha256","HkdfSha256","exports","I","ALPHABET","ALPHABET_MAP","z","charAt","polymodStep","pre","prefixChk","prefix","chk","convert","inBits","outBits","pad","bits","maxV","toWords","fromWordsUnsafe","words","isArray","fromWords","getLibraryFromEncoding","encoding","ENCODING_CONST","__decode","str","LIMIT","lowered","toLowerCase","uppered","toUpperCase","lastIndexOf","wordChars","decodeUnsafe","decode","encode"],"sourceRoot":""} \ No newline at end of file diff --git a/import/index.test.js b/import/index.test.ts similarity index 94% rename from import/index.test.js rename to import/index.test.ts index 0fafc3e8..c09bb044 100644 --- a/import/index.test.js +++ b/import/index.test.ts @@ -5,9 +5,9 @@ import { bech32 } from "bech32"; // Mock the TURNKEY_SIGNER_ENVIRONMENT replacement that webpack would do const verifyEnclaveSignature = async function ( - enclaveQuorumPublic, - publicSignature, - signedData + enclaveQuorumPublic: string | null, + publicSignature: string, + signedData: string ) { // Replace the template string with actual environment const TURNKEY_SIGNERS_ENCLAVES = { @@ -51,7 +51,7 @@ const verifyEnclaveSignature = async function ( ); }; -async function loadQuorumKey(quorumPublic) { +async function loadQuorumKey(quorumPublic: Uint8Array) { return await crypto.webcrypto.subtle.importKey( "raw", quorumPublic, @@ -64,16 +64,22 @@ async function loadQuorumKey(quorumPublic) { ); } -describe("TKHQ", () => { - beforeEach(() => { - window.TextDecoder = global.TextDecoder; - window.TextEncoder = global.TextEncoder; - window.__TURNKEY_SIGNER_ENVIRONMENT__ = "prod"; +beforeAll(async () => { + Object.defineProperty(window, "TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", { + value: "prod", + }); + + // Necessary for crypto to be available. + // See https://github.com/jsdom/jsdom/issues/1612 + Object.defineProperty(window, "crypto", { + value: crypto.webcrypto, + }); - global.crypto = crypto.webcrypto; - window.crypto = crypto.webcrypto; - TKHQ.setCryptoProvider(crypto.webcrypto); + TKHQ.setCryptoProvider(crypto.webcrypto); +}); +describe("TKHQ", () => { + beforeEach(() => { window.localStorage.clear(); }); @@ -81,8 +87,8 @@ describe("TKHQ", () => { expect(TKHQ.getTargetEmbeddedKey()).toBe(null); // Set a dummy "key" - TKHQ.setTargetEmbeddedKey({ foo: "bar" }); - expect(TKHQ.getTargetEmbeddedKey()).toEqual({ foo: "bar" }); + TKHQ.setTargetEmbeddedKey({ alg: "bar" }); + expect(TKHQ.getTargetEmbeddedKey()).toEqual({ alg: "bar" }); }); it("imports P256 keys", async () => { @@ -362,18 +368,18 @@ describe("TKHQ", () => { }); it("validates styles", async () => { - let simpleValid = { padding: "10px" }; - expect(TKHQ.validateStyles(simpleValid)).toEqual(simpleValid); + const simpleValid1 = { padding: "10px" }; + expect(TKHQ.validateStyles(simpleValid1)).toEqual(simpleValid1); - simpleValid = { padding: "10px", margin: "10px", fontSize: "16px" }; - expect(TKHQ.validateStyles(simpleValid)).toEqual(simpleValid); + const simpleValid2 = { padding: "10px", margin: "10px", fontSize: "16px" }; + expect(TKHQ.validateStyles(simpleValid2)).toEqual(simpleValid2); let simpleValidPadding = { "padding ": "10px", margin: "10px", fontSize: "16px", }; - expect(TKHQ.validateStyles(simpleValidPadding)).toEqual(simpleValid); + expect(TKHQ.validateStyles(simpleValidPadding)).toEqual(simpleValid2); let simpleInvalidCase = { padding: "10px", diff --git a/import/jest.config.js b/import/jest.config.js deleted file mode 100644 index 8ed0ad26..00000000 --- a/import/jest.config.js +++ /dev/null @@ -1,12 +0,0 @@ -const path = require("path"); - -module.exports = { - clearMocks: true, - testEnvironment: "jsdom", - setupFiles: ["/jest.setup.js"], - setupFilesAfterEnv: ["regenerator-runtime/runtime"], - testPathIgnorePatterns: ["/node_modules/"], - moduleNameMapper: { - "^@shared/(.*)$": path.resolve(__dirname, "../shared/$1"), - }, -}; diff --git a/import/jest.config.ts b/import/jest.config.ts new file mode 100644 index 00000000..f4ff6bed --- /dev/null +++ b/import/jest.config.ts @@ -0,0 +1,15 @@ +import type { Config } from "jest"; + +export default { + clearMocks: true, + setupFiles: ["/jest.setup.ts"], + testEnvironment: "jsdom", + testEnvironmentOptions: { + url: "http://localhost", + }, + transform: { + "^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }], + }, + testPathIgnorePatterns: ["/node_modules/"], + transformIgnorePatterns: ["/node_modules/.pnpm/(?!(@noble|@hpke)/)"], +} satisfies Config; diff --git a/import/jest.setup.js b/import/jest.setup.js deleted file mode 100644 index 0d33ea41..00000000 --- a/import/jest.setup.js +++ /dev/null @@ -1,9 +0,0 @@ -const { TextEncoder, TextDecoder } = require("util"); - -if (typeof global.TextEncoder === "undefined") { - global.TextEncoder = TextEncoder; -} - -if (typeof global.TextDecoder === "undefined") { - global.TextDecoder = TextDecoder; -} diff --git a/import/jest.setup.ts b/import/jest.setup.ts new file mode 100644 index 00000000..5a339390 --- /dev/null +++ b/import/jest.setup.ts @@ -0,0 +1,21 @@ +import "regenerator-runtime/runtime"; +import { TextEncoder, TextDecoder } from "util"; +import { ReadableStream } from "node:stream/web"; +import { MessagePort } from "node:worker_threads"; + +if (typeof global.MessagePort === "undefined") { + global.MessagePort = MessagePort as unknown as typeof global.MessagePort; +} + +if (typeof global.ReadableStream === "undefined") { + global.ReadableStream = + ReadableStream as unknown as typeof global.ReadableStream; +} + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} diff --git a/import/package.json b/import/package.json index e3951f85..d85cb56a 100644 --- a/import/package.json +++ b/import/package.json @@ -1,10 +1,12 @@ { - "name": "import", + "name": "@turnkey/frames-import", "version": "1.0.0", "main": "index.test.js", + "private": true, "scripts": { "build": "webpack --mode=production", "build:dev": "webpack --mode=development", + "clean": "rm -rf dist", "start": "serve dist", "dev": "webpack serve --mode=development --open", "test": "jest", @@ -19,6 +21,7 @@ "license": "MIT", "dependencies": { "@hpke/core": "1.7.5", + "@turnkey/frames-shared": "workspace:*", "bech32": "2.0.0" }, "devDependencies": { @@ -26,15 +29,15 @@ "@babel/preset-env": "7.22.20", "@testing-library/dom": "9.3.3", "@testing-library/jest-dom": "6.1.3", + "@types/jest": "30.0.0", "babel-jest": "29.7.0", "babel-loader": "9.1.3", "copy-webpack-plugin": "11.0.0", "css-loader": "6.8.1", "eslint": "8.57.0", "html-webpack-plugin": "5.5.3", - "jest": "29.7.0", - "jest-environment-jsdom": "29.7.0", - "jsdom": "22.1.0", + "jest": "30.4.2", + "jest-environment-jsdom": "30.4.1", "mini-css-extract-plugin": "2.9.4", "prettier": "2.8.4", "regenerator-runtime": "0.14.1", diff --git a/import/src/index.js b/import/src/index.js index 6898e78f..172232f6 100644 --- a/import/src/index.js +++ b/import/src/index.js @@ -1,6 +1,6 @@ import "./styles.css"; import * as TKHQ from "./turnkey-core.js"; -import { HpkeEncrypt } from "@shared/crypto-utils.js"; +import { HpkeEncrypt } from "@turnkey/frames-shared"; // Make TKHQ available globally for backwards compatibility window.TKHQ = TKHQ; diff --git a/import/src/index.template.html b/import/src/index.template.html index a99b0b92..c0e9048c 100644 --- a/import/src/index.template.html +++ b/import/src/index.template.html @@ -10,6 +10,12 @@ Turnkey Import + + + diff --git a/import/src/standalone.js b/import/src/standalone.js index a16a1f4f..55f139f4 100644 --- a/import/src/standalone.js +++ b/import/src/standalone.js @@ -1,6 +1,6 @@ import "./standalone-styles.css"; import * as TKHQ from "./turnkey-core.js"; -import { HpkeEncrypt } from "@shared/crypto-utils.js"; +import { HpkeEncrypt } from "@turnkey/frames-shared"; // Make TKHQ available globally window.TKHQ = TKHQ; @@ -302,4 +302,4 @@ async function onExtractKeyEncryptedBundle(plaintextValue, keyFormat) { sendMessageUpStandalone("ENCRYPTED_BUNDLE_EXTRACTED", encryptedBundle); } -// HpkeEncrypt is now imported from @shared/crypto-utils.js +// HpkeEncrypt is now imported from @turnkey/frames-shared diff --git a/import/src/standalone.template.html b/import/src/standalone.template.html index aa709b9b..d69662e7 100644 --- a/import/src/standalone.template.html +++ b/import/src/standalone.template.html @@ -9,6 +9,12 @@ Turnkey Import (Standalone Mode) + + + diff --git a/import/src/turnkey-core.js b/import/src/turnkey-core.js index f142d734..4e6510ee 100644 --- a/import/src/turnkey-core.js +++ b/import/src/turnkey-core.js @@ -1,4 +1,4 @@ -import * as SharedTKHQ from "@shared/turnkey-core.js"; +import * as SharedTKHQ from "@turnkey/frames-shared"; const { setCryptoProvider, diff --git a/import/tsconfig.json b/import/tsconfig.json new file mode 100644 index 00000000..ab8138b7 --- /dev/null +++ b/import/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": ".", + "tsBuildInfoFile": "./.cache/.tsbuildinfo" + }, + "include": ["src/**/*.ts", "src/**/*.js", "*.ts"], + "exclude": ["dist", "node_modules"] +} diff --git a/import/webpack.config.js b/import/webpack.config.js index dd6189bd..b93a9346 100644 --- a/import/webpack.config.js +++ b/import/webpack.config.js @@ -1,4 +1,5 @@ const path = require("path"); +const webpack = require("webpack"); const HtmlWebpackPlugin = require("html-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const CopyWebpackPlugin = require("copy-webpack-plugin"); @@ -6,9 +7,21 @@ const CopyWebpackPlugin = require("copy-webpack-plugin"); module.exports = (env, argv) => { const isProduction = argv.mode === "production"; + const signerEnvironment = + process.env.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE || undefined; + if (signerEnvironment != null) { + console.warn(`Applying signer environment override: ${signerEnvironment}`); + } + return { mode: isProduction ? "production" : "development", context: __dirname, // Set context to frame directory so module resolution works correctly + devServer: { + port: 8083, + devMiddleware: { + writeToDisk: true, + }, + }, entry: { index: "./src/index.js", standalone: "./src/standalone.js", @@ -41,6 +54,10 @@ module.exports = (env, argv) => { ], }, plugins: [ + new webpack.DefinePlugin({ + "window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE": + JSON.stringify(signerEnvironment), + }), // Iframe page (embedded version) new HtmlWebpackPlugin({ template: "./src/index.template.html", @@ -112,16 +129,13 @@ module.exports = (env, argv) => { fallback: { crypto: false, }, - alias: { - "@shared": path.resolve(__dirname, "../shared"), - }, conditionNames: ["import", "require", "node", "default"], // Ensure modules are resolved from frame's node_modules, not shared folder's modules: [path.resolve(__dirname, "node_modules"), "node_modules"], // Don't use package.json from shared folder for module resolution descriptionFiles: ["package.json"], // Force resolution to start from context (frame directory) not file location - symlinks: false, + symlinks: true, }, resolveLoader: { modules: [path.resolve(__dirname, "node_modules"), "node_modules"], diff --git a/kustomize/base/resources.yaml b/kustomize/base/resources.yaml index 7dff3ec6..a4baff36 100644 --- a/kustomize/base/resources.yaml +++ b/kustomize/base/resources.yaml @@ -16,44 +16,6 @@ spec: env: - name: TURNKEY_SIGNER_ENVIRONMENT value: "prod" - command: - - sh - - -c - - | - mkdir -p templated/export templated/import templated/export-and-sign; - - envsubst '${TURNKEY_SIGNER_ENVIRONMENT}' < export/index.template.html > templated/export/index.html; - - # For export-and-sign, copy the webpack-built files and template the environment variable in HTML files - # Note: We template HTML instead of JS to preserve Subresource Integrity (SRI) hashes - if [ -d "export-and-sign" ]; then - cp -r export-and-sign/. templated/export-and-sign/; - ls -la templated/export-and-sign/ - fi - - # Template the environment variable in the HTML files (not JS, to preserve SRI) - for file in templated/export-and-sign/*.html; do - if [ -f "$file" ]; then - if sed "s/__TURNKEY_SIGNER_ENVIRONMENT__/${TURNKEY_SIGNER_ENVIRONMENT}/g" "$file" > "$file.tmp"; then - mv "$file.tmp" "$file" - fi - fi - done - - # Do the same for import: copy the webpack-built files and template the environment variable in JS files - if [ -d "/usr/share/nginx/import" ]; then - cp -r /usr/share/nginx/import/. templated/import/; - ls -la templated/import/ - fi - - # Template the environment variable in the built JavaScript files - for file in templated/import/*.js; do - if [ -f "$file" ]; then - if sed "s/__TURNKEY_SIGNER_ENVIRONMENT__/${TURNKEY_SIGNER_ENVIRONMENT}/g" "$file" > "$file.tmp"; then - mv "$file.tmp" "$file" - fi - fi - done securityContext: allowPrivilegeEscalation: false capabilities: diff --git a/nginx.conf b/nginx.conf index 7ea68e74..a97a2a8c 100644 --- a/nginx.conf +++ b/nginx.conf @@ -35,10 +35,7 @@ http { # Send access logs to stdout for logging access_log /dev/stdout main; - # Custom server blocks to serve auth and export frames on separate ports. - # Maintain recovery and auth separately for now for backwards-compatibility. - - # Prod + include /etc/nginx/nginx.upstreams.*.conf; # iframe server { @@ -54,10 +51,15 @@ http { } server { listen 8081; - root /usr/share/nginx; + root /usr/share/nginx/export; location / { - try_files /export/$uri /templated/export/$uri /templated/export/$uri/index.html =404; + ssi on; + set $ssi_turnkey_signer_environment "${TURNKEY_SIGNER_ENVIRONMENT}"; + try_files $uri $uri/ $uri/index.html =404; } + + set $devserver_upstream "http://export"; + include /etc/nginx/nginx.devserver.*.conf; } server { listen 8082; @@ -65,18 +67,28 @@ http { } server { listen 8083; - root /usr/share/nginx/templated/import; + root /usr/share/nginx/import; + ssi on; + set $ssi_turnkey_signer_environment "${TURNKEY_SIGNER_ENVIRONMENT}"; location / { try_files $uri $uri/ /index.html /standalone.html =404; } + + set $devserver_upstream "http://import"; + include /etc/nginx/nginx.devserver.*.conf; } server { listen 8086; + root /usr/share/nginx/export-and-sign; + ssi on; + set $ssi_turnkey_signer_environment "${TURNKEY_SIGNER_ENVIRONMENT}"; # optional: add CSP-related configs here later - root /usr/share/nginx/templated/export-and-sign; location / { try_files $uri $uri/ /index.html =404; } + + set $devserver_upstream "http://export-and-sign"; + include /etc/nginx/nginx.devserver.*.conf; } # oauth diff --git a/nginx.devserver.local.conf b/nginx.devserver.local.conf new file mode 100644 index 00000000..95037a84 --- /dev/null +++ b/nginx.devserver.local.conf @@ -0,0 +1,8 @@ +location /ws { + proxy_pass $devserver_upstream; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header Host $host; + proxy_read_timeout 86400s; +} \ No newline at end of file diff --git a/nginx.upstreams.local.conf b/nginx.upstreams.local.conf new file mode 100644 index 00000000..76beb5f8 --- /dev/null +++ b/nginx.upstreams.local.conf @@ -0,0 +1,11 @@ +upstream export { + server export:8081; +} + +upstream export-and-sign { + server export-and-sign:8086; +} + +upstream import { + server import:8083; +} \ No newline at end of file diff --git a/oauth-origin/package.json b/oauth-origin/package.json index a49272c7..919526a7 100644 --- a/oauth-origin/package.json +++ b/oauth-origin/package.json @@ -1,7 +1,8 @@ { - "name": "oauth-origin-tests", + "name": "@turnkey/oauth-origin-tests", "version": "1.0.0", "main": "index.test.js", + "private": true, "scripts": { "start": "serve", "test": "jest", @@ -18,7 +19,7 @@ "@babel/core": "^7.23.0", "@babel/preset-env": "^7.22.20", "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", + "@testing-library/jest-dom": "^6.9.1", "babel-jest": "^29.7.0", "eslint": "^8.57.0", "jest": "^29.7.0", diff --git a/oauth-redirect/package.json b/oauth-redirect/package.json index 76da1ce1..bedb41fb 100644 --- a/oauth-redirect/package.json +++ b/oauth-redirect/package.json @@ -1,7 +1,8 @@ { - "name": "oauth-redirect-tests", + "name": "@turnkey/oauth-redirect-tests", "version": "1.0.0", "main": "index.test.js", + "private": true, "scripts": { "start": "serve", "test": "jest", @@ -18,7 +19,7 @@ "@babel/core": "^7.23.0", "@babel/preset-env": "^7.22.20", "@testing-library/dom": "^9.3.3", - "@testing-library/jest-dom": "^6.1.3", + "@testing-library/jest-dom": "^6.9.1", "babel-jest": "^29.7.0", "eslint": "^8.57.0", "jest": "^29.7.0", diff --git a/package.json b/package.json new file mode 100644 index 00000000..64e5f7e7 --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "@turnkey/frames", + "version": "0.1.0", + "private": true, + "scripts": { + "build": "turbo build", + "clean": "turbo clean", + "dev": "turbo dev", + "lint": "turbo lint", + "prettier:check": "turbo prettier:check", + "prettier:write": "turbo prettier:write", + "start": "turbo start", + "test": "turbo test", + "watch": "turbo watch", + "compose:dev": "docker compose up server", + "compose:prod": "docker compose -f docker-compose.yaml -f docker-compose.prod.yaml up server", + "compose:e2e:dev": "docker compose run --build e2e", + "compose:e2e:prod": "docker compose -f docker-compose.yaml -f docker-compose.prod.yaml run --build e2e" + }, + "devDependencies": { + "@rollup/plugin-typescript": "^11.1.5", + "@tsconfig/node24": "24.0.4", + "@tsconfig/strictest": "2.0.8", + "rollup-plugin-node-externals": "^6.1.2", + "turbo": "^2.10.4", + "typescript": "5.4.3" + }, + "packageManager": "pnpm@11.13.1" +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 00000000..fef60fa1 --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,13048 @@ +lockfileVersion: '9.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +overrides: + minimatch@<3.1.3: ^3.1.4 + serialize-javascript@<7.0.2: ^7.0.3 + ws@<8.21.0: ^8.21.0 + +importers: + + .: + devDependencies: + '@rollup/plugin-typescript': + specifier: ^11.1.5 + version: 11.1.6(rollup@4.59.0)(tslib@2.8.1)(typescript@5.4.3) + '@tsconfig/node24': + specifier: 24.0.4 + version: 24.0.4 + '@tsconfig/strictest': + specifier: 2.0.8 + version: 2.0.8 + rollup-plugin-node-externals: + specifier: ^6.1.2 + version: 6.1.2(rollup@4.59.0) + turbo: + specifier: ^2.10.4 + version: 2.10.4 + typescript: + specifier: 5.4.3 + version: 5.4.3 + + auth: + devDependencies: + '@babel/core': + specifier: ^7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: ^9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + babel-jest: + specifier: ^29.7.0 + version: 29.7.0(@babel/core@7.23.0) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jsdom: + specifier: ^22.1.0 + version: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + prettier: + specifier: ^2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: ^0.14.1 + version: 0.14.1 + serve: + specifier: ^14.2.1 + version: 14.2.5 + + e2e: + devDependencies: + '@babel/core': + specifier: 7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: 7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: 9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + '@turnkey/http': + specifier: 5.0.0 + version: 5.0.0 + '@turnkey/iframe-stamper': + specifier: ^2.11.1 + version: 2.11.1 + '@types/jest': + specifier: 30.0.0 + version: 30.0.0 + '@types/jsdom': + specifier: 28.0.3 + version: 28.0.3 + '@vitest/browser-playwright': + specifier: ^4.1.10 + version: 4.1.10(bufferutil@4.1.0)(playwright@1.61.1)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10) + babel-jest: + specifier: 29.7.0 + version: 29.7.0(@babel/core@7.23.0) + babel-loader: + specifier: 9.1.3 + version: 9.1.3(@babel/core@7.23.0)(webpack@5.102.1) + css-loader: + specifier: 6.8.1 + version: 6.8.1(webpack@5.102.1) + eslint: + specifier: 8.57.0 + version: 8.57.0 + html-webpack-plugin: + specifier: 5.5.3 + version: 5.5.3(webpack@5.102.1) + jest: + specifier: 30.4.2 + version: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-environment-jsdom: + specifier: 30.4.1 + version: 30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) + jsdom: + specifier: ^22.1.0 + version: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + mini-css-extract-plugin: + specifier: 2.9.4 + version: 2.9.4(webpack@5.102.1) + prettier: + specifier: 2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: 0.14.1 + version: 0.14.1 + serve: + specifier: 14.2.5 + version: 14.2.5 + style-loader: + specifier: 3.3.3 + version: 3.3.3(webpack@5.102.1) + ts-jest: + specifier: 29.4.11 + version: 29.4.11(@babel/core@7.23.0)(@jest/transform@30.4.1)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.23.0))(jest-util@30.4.1)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(typescript@5.4.3) + typescript: + specifier: 5.4.3 + version: 5.4.3 + util: + specifier: 0.12.5 + version: 0.12.5 + vitest: + specifier: ^4.1.10 + version: 4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + webpack: + specifier: 5.102.1 + version: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-cli: + specifier: 5.1.4 + version: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + webpack-dev-server: + specifier: 5.2.2 + version: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + webpack-subresource-integrity: + specifier: 5.2.0-rc.1 + version: 5.2.0-rc.1(html-webpack-plugin@5.5.3(webpack@5.102.1))(webpack@5.102.1) + + export: + dependencies: + '@turnkey/crypto': + specifier: 2.8.6 + version: 2.8.6 + '@turnkey/frames-shared': + specifier: workspace:* + version: link:../shared + devDependencies: + '@babel/core': + specifier: ^7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: ^9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + '@types/jest': + specifier: 30.0.0 + version: 30.0.0 + '@types/jsdom': + specifier: 28.0.3 + version: 28.0.3 + babel-jest: + specifier: ^29.7.0 + version: 29.7.0(@babel/core@7.23.0) + babel-loader: + specifier: 9.1.3 + version: 9.1.3(@babel/core@7.23.0)(webpack@5.102.1) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + html-webpack-plugin: + specifier: 5.5.3 + version: 5.5.3(webpack@5.102.1) + jest: + specifier: 30.4.2 + version: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-environment-jsdom: + specifier: 30.4.1 + version: 30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) + jsdom: + specifier: ^22.1.0 + version: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + mini-css-extract-plugin: + specifier: 2.9.4 + version: 2.9.4(webpack@5.102.1) + prettier: + specifier: ^2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: ^0.14.1 + version: 0.14.1 + serve: + specifier: ^14.2.1 + version: 14.2.5 + webpack: + specifier: 5.102.1 + version: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + webpack-cli: + specifier: 5.1.4 + version: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + webpack-dev-server: + specifier: 5.2.2 + version: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + webpack-subresource-integrity: + specifier: 5.2.0-rc.1 + version: 5.2.0-rc.1(html-webpack-plugin@5.5.3(webpack@5.102.1))(webpack@5.102.1) + + export-and-sign: + dependencies: + '@hpke/core': + specifier: 1.7.5 + version: 1.7.5 + '@noble/ed25519': + specifier: 2.0.0 + version: 2.0.0 + '@noble/hashes': + specifier: 1.8.0 + version: 1.8.0 + '@solana/web3.js': + specifier: 1.98.4 + version: 1.98.4(bufferutil@4.1.0)(typescript@5.4.3)(utf-8-validate@6.0.6) + '@turnkey/crypto': + specifier: 2.8.6 + version: 2.8.6 + '@turnkey/encoding': + specifier: 0.6.0 + version: 0.6.0 + '@turnkey/frames-shared': + specifier: workspace:* + version: link:../shared + crypto-browserify: + specifier: 3.12.1 + version: 3.12.1 + stream-browserify: + specifier: 3.0.0 + version: 3.0.0 + viem: + specifier: 2.45.0 + version: 2.45.0(bufferutil@4.1.0)(typescript@5.4.3)(utf-8-validate@6.0.6) + devDependencies: + '@swc/register': + specifier: 0.1.10 + version: 0.1.10(@swc/core@1.15.43(@swc/helpers@0.5.23)) + '@testing-library/dom': + specifier: 9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + '@types/jest': + specifier: 30.0.0 + version: 30.0.0 + '@types/jsdom': + specifier: 28.0.3 + version: 28.0.3 + css-loader: + specifier: 6.8.1 + version: 6.8.1(webpack@5.102.1) + eslint: + specifier: 8.57.0 + version: 8.57.0 + html-webpack-plugin: + specifier: 5.5.3 + version: 5.5.3(webpack@5.102.1) + jest: + specifier: 30.4.2 + version: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-environment-jsdom: + specifier: 30.4.1 + version: 30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) + mini-css-extract-plugin: + specifier: 2.9.4 + version: 2.9.4(webpack@5.102.1) + prettier: + specifier: 2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: 0.14.1 + version: 0.14.1 + serve: + specifier: 14.2.5 + version: 14.2.5 + style-loader: + specifier: 3.3.3 + version: 3.3.3(webpack@5.102.1) + ts-jest: + specifier: 29.4.11 + version: 29.4.11(@babel/core@7.23.0)(@jest/transform@30.4.1)(@jest/types@30.4.1)(babel-jest@30.4.1(@babel/core@7.29.7))(jest-util@30.4.1)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(typescript@5.4.3) + ts-loader: + specifier: 9.6.2 + version: 9.6.2(typescript@5.4.3)(webpack@5.102.1) + ts-node: + specifier: 10.9.2 + version: 10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3) + typescript: + specifier: 5.4.3 + version: 5.4.3 + util: + specifier: 0.12.5 + version: 0.12.5 + webpack: + specifier: 5.102.1 + version: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + webpack-cli: + specifier: 5.1.4 + version: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + webpack-dev-server: + specifier: 5.2.2 + version: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + webpack-subresource-integrity: + specifier: 5.2.0-rc.1 + version: 5.2.0-rc.1(html-webpack-plugin@5.5.3(webpack@5.102.1))(webpack@5.102.1) + + import: + dependencies: + '@hpke/core': + specifier: 1.7.5 + version: 1.7.5 + '@turnkey/frames-shared': + specifier: workspace:* + version: link:../shared + bech32: + specifier: 2.0.0 + version: 2.0.0 + devDependencies: + '@babel/core': + specifier: 7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: 7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: 9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: 6.1.3 + version: 6.1.3(@jest/globals@30.4.1)(@types/jest@30.0.0)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(vitest@4.1.10) + '@types/jest': + specifier: 30.0.0 + version: 30.0.0 + babel-jest: + specifier: 29.7.0 + version: 29.7.0(@babel/core@7.23.0) + babel-loader: + specifier: 9.1.3 + version: 9.1.3(@babel/core@7.23.0)(webpack@5.102.1) + copy-webpack-plugin: + specifier: 11.0.0 + version: 11.0.0(webpack@5.102.1) + css-loader: + specifier: 6.8.1 + version: 6.8.1(webpack@5.102.1) + eslint: + specifier: 8.57.0 + version: 8.57.0 + html-webpack-plugin: + specifier: 5.5.3 + version: 5.5.3(webpack@5.102.1) + jest: + specifier: 30.4.2 + version: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-environment-jsdom: + specifier: 30.4.1 + version: 30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) + mini-css-extract-plugin: + specifier: 2.9.4 + version: 2.9.4(webpack@5.102.1) + prettier: + specifier: 2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: 0.14.1 + version: 0.14.1 + serve: + specifier: 14.2.5 + version: 14.2.5 + style-loader: + specifier: 3.3.3 + version: 3.3.3(webpack@5.102.1) + webpack: + specifier: 5.102.1 + version: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + webpack-cli: + specifier: 5.1.4 + version: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + webpack-dev-server: + specifier: 5.2.2 + version: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + + oauth-origin: + devDependencies: + '@babel/core': + specifier: ^7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: ^9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + babel-jest: + specifier: ^29.7.0 + version: 29.7.0(@babel/core@7.23.0) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jsdom: + specifier: ^22.1.0 + version: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + prettier: + specifier: ^2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: ^0.14.1 + version: 0.14.1 + serve: + specifier: ^14.2.1 + version: 14.2.5 + + oauth-redirect: + devDependencies: + '@babel/core': + specifier: ^7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/dom': + specifier: ^9.3.3 + version: 9.3.3 + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + babel-jest: + specifier: ^29.7.0 + version: 29.7.0(@babel/core@7.23.0) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jsdom: + specifier: ^22.1.0 + version: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + prettier: + specifier: ^2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: ^0.14.1 + version: 0.14.1 + serve: + specifier: ^14.2.1 + version: 14.2.5 + + shared: + dependencies: + '@hpke/core': + specifier: 1.7.5 + version: 1.7.5 + bech32: + specifier: ^2.0.0 + version: 2.0.0 + devDependencies: + '@babel/core': + specifier: ^7.23.0 + version: 7.23.0 + '@babel/preset-env': + specifier: ^7.22.20 + version: 7.22.20(@babel/core@7.23.0) + '@testing-library/jest-dom': + specifier: ^6.9.1 + version: 6.9.1 + '@types/jest': + specifier: 30.0.0 + version: 30.0.0 + babel-jest: + specifier: ^29.7.0 + version: 29.7.0(@babel/core@7.23.0) + eslint: + specifier: ^8.57.0 + version: 8.57.0 + jest: + specifier: 30.4.2 + version: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-environment-jsdom: + specifier: 30.4.1 + version: 30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6) + prettier: + specifier: ^2.8.4 + version: 2.8.4 + regenerator-runtime: + specifier: ^0.14.1 + version: 0.14.1 + rollup: + specifier: 4.59.0 + version: 4.59.0 + ts-jest: + specifier: 29.4.11 + version: 29.4.11(@babel/core@7.23.0)(@jest/transform@30.4.1)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.23.0))(jest-util@30.4.1)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(typescript@5.4.3) + +packages: + + '@adobe/css-tools@4.5.0': + resolution: {integrity: sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==} + + '@adraffy/ens-normalize@1.11.1': + resolution: {integrity: sha512-nhCBV3quEgesuf7c7KYfperqSS14T8bYuvJ8PcLJp6znkZpFc0AuW4qBtr8eKVyPPe/8RSr7sglCWPU5eaxwKQ==} + + '@ampproject/remapping@2.3.0': + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + + '@asamuzakjp/css-color@3.2.0': + resolution: {integrity: sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==} + + '@babel/code-frame@7.29.7': + resolution: {integrity: sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==} + engines: {node: '>=6.9.0'} + + '@babel/compat-data@7.29.7': + resolution: {integrity: sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==} + engines: {node: '>=6.9.0'} + + '@babel/core@7.23.0': + resolution: {integrity: sha512-97z/ju/Jy1rZmDxybphrBuI+jtJjFVoz7Mr9yUQVVVi+DNZE333uFQeMOqcCIy1x3WYBIbWftUSLmbNXNT7qFQ==} + engines: {node: '>=6.9.0'} + + '@babel/core@7.29.7': + resolution: {integrity: sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==} + engines: {node: '>=6.9.0'} + + '@babel/generator@7.29.7': + resolution: {integrity: sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-annotate-as-pure@7.29.7': + resolution: {integrity: sha512-OoK6239jHPuSQOoS0kfTVKn0b/rVTk0seKq4Gd2UMLtmOVLjDC0ki3e+c90Trqv2gMfvJFqkiljrr568+qddiw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-compilation-targets@7.29.7': + resolution: {integrity: sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==} + engines: {node: '>=6.9.0'} + + '@babel/helper-create-class-features-plugin@7.29.7': + resolution: {integrity: sha512-IY3ZD9Tmooqr3TUhc3DUWxiuo8xx1DWLhd5M7hQ+ZWJamqM2BbalrBJb2MisSLoYorOj75U03qULCxQTY9r3hg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-create-regexp-features-plugin@7.29.7': + resolution: {integrity: sha512-907Uymvqgg1dwUA+7IGwFAOSYzQOuzPXKNJ1yxzwPffzkYFg2q2eHi1fIOs6sXkG9NbIUMunnUlkYsfRFNvomg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-define-polyfill-provider@0.4.4': + resolution: {integrity: sha512-QcJMILQCu2jm5TFPGA3lCpJJTeEP+mqeXooG/NZbg/h5FTFi6V0+99ahlRsW8/kRLyb24LZVCCiclDedhLKcBA==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + '@babel/helper-define-polyfill-provider@0.5.0': + resolution: {integrity: sha512-NovQquuQLAQ5HuyjCz7WQP9MjRj7dx++yspwiyUiGl9ZyadHRSql1HZh5ogRd8W8w6YM6EQ/NTB8rgjLt5W65Q==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + '@babel/helper-define-polyfill-provider@0.6.8': + resolution: {integrity: sha512-47UwBLPpQi1NoWzLuHNjRoHlYXMwIJoBf7MFou6viC/sIHWYygpvr0B6IAyh5sBdA2nr2LPIRww8lfaUVQINBA==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + '@babel/helper-globals@7.29.7': + resolution: {integrity: sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==} + engines: {node: '>=6.9.0'} + + '@babel/helper-member-expression-to-functions@7.29.7': + resolution: {integrity: sha512-j+7JYmk1JYDtACIGj0QJqqWZjoUpMoEikQGADMaHgCMCSDqd2+P32rfcibUNrGOMWrlzK1WJBdxrB3JJQZwWtg==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-imports@7.29.7': + resolution: {integrity: sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==} + engines: {node: '>=6.9.0'} + + '@babel/helper-module-transforms@7.29.7': + resolution: {integrity: sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-optimise-call-expression@7.29.7': + resolution: {integrity: sha512-+kmGVjcT9RGYzoDwdwEqEvGgKe3BYq+O1iGzjFubaNgZHwYHP6lsF2Yghf4kEuv9BV7tYDZ913aBW9am6YKong==} + engines: {node: '>=6.9.0'} + + '@babel/helper-plugin-utils@7.29.7': + resolution: {integrity: sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-remap-async-to-generator@7.29.7': + resolution: {integrity: sha512-16AMiW26DbXWBbr3B8wNozKM0ydMLB892vaOaJW/fPJdnT8vJk5sdkQcU/isqUxyCE0cEoa8wZOcbgDuC4b6Og==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-replace-supers@7.29.7': + resolution: {integrity: sha512-atfGXWSeCiF4DnKZIfmJfQRkSw9b9gNNXR1kqKjbhG4pGYCOnkp8OcTB8E3NXjBu8NpheSnOeNKz8KT7UNFTmQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/helper-skip-transparent-expression-wrappers@7.29.7': + resolution: {integrity: sha512-brcMGQaVzIeUb+6/bs1Av0f8YuNNjKY2JyvfRCsFuFsdKccEQ5Ges2y74D74NZ1Rz8lKJ9ksJkfqwQFJ/iNEyQ==} + engines: {node: '>=6.9.0'} + + '@babel/helper-string-parser@7.29.7': + resolution: {integrity: sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-identifier@7.29.7': + resolution: {integrity: sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==} + engines: {node: '>=6.9.0'} + + '@babel/helper-validator-option@7.29.7': + resolution: {integrity: sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==} + engines: {node: '>=6.9.0'} + + '@babel/helper-wrap-function@7.29.7': + resolution: {integrity: sha512-iES0Skag9ERIF68aXadpO6dbXa03mNWK3sEqJaMnLNs/eC3l0lkImdfoy6Y09/SfkpawdAB4RjQ7PVA7TcVGdw==} + engines: {node: '>=6.9.0'} + + '@babel/helpers@7.29.7': + resolution: {integrity: sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==} + engines: {node: '>=6.9.0'} + + '@babel/parser@7.29.7': + resolution: {integrity: sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==} + engines: {node: '>=6.0.0'} + hasBin: true + + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.29.7': + resolution: {integrity: sha512-GE1TFSiuFeGsCxmYXZl8HwoPrVlwe4rHPFE8weieGKZqnDORK+Ar3vgWMgW+AOxQ6/2TgLSKx9p6W7O4rC6qgQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.29.7': + resolution: {integrity: sha512-QQt9qKHZ2sg/kivaLr7lnQr8HVrQDdBNSfCsTjiDxRuX/K5ORyKq+Bu8Xr0cDE3Dfkv0cw28Ve0EKyKMvulkOw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.13.0 + + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2': + resolution: {integrity: sha512-SOSkfJDddaM7mak6cPEpswyTRnuRltl429hMraQEglW+OkovnCzsiszTmsrlY//qLFjCpQDFRvjdm2wA5pPm9w==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-async-generators@7.8.4': + resolution: {integrity: sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-bigint@7.8.3': + resolution: {integrity: sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-properties@7.12.13': + resolution: {integrity: sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-class-static-block@7.14.5': + resolution: {integrity: sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-dynamic-import@7.8.3': + resolution: {integrity: sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-export-namespace-from@7.8.3': + resolution: {integrity: sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-assertions@7.29.7': + resolution: {integrity: sha512-/An1OCBN93thpBAGyfsK2pcf0jvju1SAtKkL2Ny++B5Sy6sqgzXDQH1cZxWbF96Wuk+bn41MDA9bLd4VVAw6rw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-attributes@7.29.7': + resolution: {integrity: sha512-zGYcYfq/WmZ4V+kBIXQon9dSSc8ircGZqw9ZaNhhGj9nZkeBu1jHLBDQqYYi5WA9uawvA2sIMbry2nCFhf5Djg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-import-meta@7.10.4': + resolution: {integrity: sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-json-strings@7.8.3': + resolution: {integrity: sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-jsx@7.29.7': + resolution: {integrity: sha512-TSu8+mHCoEaaCDEZ0I3+6mvTBYR4PCxQwf2z9/r5Tbztv6NaLR3B9thGTTxX2WGuGHJqRiAbKPeGTJ5XWXVg6A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4': + resolution: {integrity: sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3': + resolution: {integrity: sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-numeric-separator@7.10.4': + resolution: {integrity: sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-object-rest-spread@7.8.3': + resolution: {integrity: sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3': + resolution: {integrity: sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-optional-chaining@7.8.3': + resolution: {integrity: sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-private-property-in-object@7.14.5': + resolution: {integrity: sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-top-level-await@7.14.5': + resolution: {integrity: sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-typescript@7.29.7': + resolution: {integrity: sha512-ngr+82Sh0xMz25TPCZi+nC2iTzjfCdWS2ONXTp/PtSCHCgaCNBpdMqgvJ2ccdLlClVZ7sisIgB914j/JFe+RZA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-syntax-unicode-sets-regex@7.18.6': + resolution: {integrity: sha512-727YkEAPwSIQTv5im8QHz3upqp92JTWhidIC81Tdx4VJYIte/VndKf1qKrfnnhPLiPghStWfvC/iFaMCQu7Nqg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-arrow-functions@7.29.7': + resolution: {integrity: sha512-N7zArUXWzAMzm+/N0uPBeVB3Fam5lMxtUwMmDK5f/IBBS7a7p1qeUoxd/6CckXoxUdgsntq1Dh8xNW06maZbDQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-async-generator-functions@7.29.7': + resolution: {integrity: sha512-d98gXZkgswvkyohMBABkhm3GeXhYj8psWfwQ2C7gtfrKGTykQa/iOIi+JJhwMjPlZ6Vm2XN+DCf3Es1EoG4ZLA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-async-to-generator@7.29.7': + resolution: {integrity: sha512-pcUb2SS+RMo9TWVBwKGI5ShtoG7R+zBsFmCKDa6fe8c+hPr3XJlZgoE5j6i8W7gDjhyvy+85vmYexanvXh3d1w==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-block-scoped-functions@7.29.7': + resolution: {integrity: sha512-cUSmjh72N+rN4PrkFlN1dJwNCwjVp5d38/CQrEsFggkD10UiFlBFgdH3tv5dNsLuHY+3S8db2xCHjhZcv5WgvA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-block-scoping@7.29.7': + resolution: {integrity: sha512-ONyr4+AZhKh8yKWInVxU9AXA9EbsyeLcL6V0dJy6M2/62vuvpGm29zzuymbTpdc451GEpDIdAyPLP3r+P61yKQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-class-properties@7.29.7': + resolution: {integrity: sha512-GtcpjFvanPfzNQi3eTitsCqtRRmmqzpy/A+yhTR1HaZo1Ly3EA8ZXxlPyHdR8/IuRMYc3E4wdGBewB2QKQjAaA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-class-static-block@7.29.7': + resolution: {integrity: sha512-kibJgmEdX2iMwsHY2tSZNDgj8PwIlCQz7FK9KuGKO8zsuoUwSEhoNnNVp/emKWrbY4HeO6kkXfdMqRKKKXBm2A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.12.0 + + '@babel/plugin-transform-classes@7.29.7': + resolution: {integrity: sha512-qV0OGGBVacduzQHE649JyCneOFI/maT+YKsO+K4Yi3xv2wTPNjM/W2o2gdzMwEAZz7fXNTHAe0NcSg30bIN69g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-computed-properties@7.29.7': + resolution: {integrity: sha512-RK7/IyU5phpuCdBAuig5VkzG/EnbDaui5SQGdU9BFrHdV+mV4cUjLMQ9lJDjLNtWHsqtiefpGZUXQP2BiTYMsA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-destructuring@7.29.7': + resolution: {integrity: sha512-iPX8aD6H9zV5s7ZsqTdNocPN/MGQ5sSMnElKrktxjJRMnB2jN/1p2+R7GkfD6CAYoVFqy5A4XnSIUeGgJzIWpg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-dotall-regex@7.29.7': + resolution: {integrity: sha512-3qc18hsD2RdZiyJNDNc7HQpv6xbncwh8FYtxNFFzclSyh/trPD9KkVR9BDECUjDLvb7yJVF15GfYUuC+LMkkiQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-duplicate-keys@7.29.7': + resolution: {integrity: sha512-6IvRRriEMqnBwD6chtxdLpMYCHWEzN+oL5cyQtjykya19UgzbmKhxmhZgKC/LHxS2nYr9Q/qYPZ5Lr6jOL9+yQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-dynamic-import@7.29.7': + resolution: {integrity: sha512-giOlEm/EFjfjr+te9NsdjkUo2v4f8rS/SXPumRVHAtbNcyNlvtREkU1dZzaIDclNpnaVhlCqRdFKhJBjBikzLg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-exponentiation-operator@7.29.7': + resolution: {integrity: sha512-zFpMOTLZBdW5LfObqcSbL6kefg4R4eLdmvS0wbN9M6D5Mym/sKm9toOoWyVOa+xDjvCnuWcHls2YonXwHvH3CQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-export-namespace-from@7.29.7': + resolution: {integrity: sha512-24B2nOy2TeJSMheqwPD4DDQOV/elLSIlKxjZt4i05H5AgdPdWR3n18HnNrcJ+j76WJd9gbwb9jPjNYUy6RautA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-for-of@7.29.7': + resolution: {integrity: sha512-zeSIHh0+E1Um1WJRXCFlHQYu2ieJNdivLLjlBEp+dIBu3S51n+SZZmIXjxnItw6pz56Cn+KvK68BIBVsxq2JiQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-function-name@7.29.7': + resolution: {integrity: sha512-otRWaHXE6fbAGkePvaj/kvs3HsqXfPhlnzwSOlnFgbqCPMd975dW+4wZ00WFBt+/YlBGcJwNrARQTOJOb4ZrIg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-json-strings@7.29.7': + resolution: {integrity: sha512-RRnE2+eon1rJAq8MnoF1b5kTpY1vU88twHcvcKMrsqP/jxIRqDVs9iJB5fqPuqyeFAW0wJo4MlUIPpQCq/aRsg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-literals@7.29.7': + resolution: {integrity: sha512-DZ/oLP21ZuWx1vKqnoNv6/tvEK48AQOBRai40CX9dTjGluvT/YZCyY3rryDtyUqCEoyNroy5KKPwX2iQCiRvyw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-logical-assignment-operators@7.29.7': + resolution: {integrity: sha512-A0H91hh6W8MFRkp5TqJmMr39jzGD1A1E1Ysiv2O06Sfbhkapm+XyIzxWCEh5kqwOZ1/8QZ0dY3SeQ7XBqfJd5Q==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-member-expression-literals@7.29.7': + resolution: {integrity: sha512-hl1kwFZCCiDyfH25Xmco9jTrkPgnS9pmOzSG7W5I4SaGbLeqKv417hcU2RKmaxoPEgsoJh7ZPOrnPGq99bHoUg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-amd@7.29.7': + resolution: {integrity: sha512-fxtQoH3m5ywUSIfaH0FGCzWu4McsYon5bD3K4XnskC7f+OyQMj7rsOMi4NvvmJ83WwBAg4UCe+ov4VZlqEvyew==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-commonjs@7.29.7': + resolution: {integrity: sha512-j0vCldybPC5b5dwCQOJ21uKtHzt7hxLygJTg9eF1ScfaikEDNfzn94XoW5Fi+seBR0nCyL23xaBFFkq7dTM8XQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-systemjs@7.29.7': + resolution: {integrity: sha512-TM2ZcQLoG2/y4HODiStCo10DibYhWhGWAwVv+EQKmG/7GFl0N+AAmUiXOMKM+aiJ9XBJ9AHVZBvTzMnJ2sM3cQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-modules-umd@7.29.7': + resolution: {integrity: sha512-B4UkaTK3QpgCwJnrxKfMPKdo92CN7OKXAlpAAnM3UPu0Q0lCCk57ylA9AJbRy2v8dDKOPAAWcoR6CMyeoHwRCA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-named-capturing-groups-regex@7.29.7': + resolution: {integrity: sha512-vuFoLwr4qnv2xbZ16SQd6uPcH5FNrLHhk/Jzo++0XJFcaDsr4gjJVg6j398oMHiC+83k/GiBzviwF5KBJkPUtQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/plugin-transform-new-target@7.29.7': + resolution: {integrity: sha512-fEo41GmsOUhOBlw8ioo6zvjX5Xc2Lqkzlyfqbpsk3eB6TReV18uhxZ0esfEokVbY2+PVJAQHNKxER6lGrzNd3A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-nullish-coalescing-operator@7.29.7': + resolution: {integrity: sha512-idmp1dFaekP9GbcMvG24Kvw2BfhFZjHnNJCkV4WuIY4PskJzwI3f1N5OdgYke38T7rftO6ERulFRn2cFeZwRkg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-numeric-separator@7.29.7': + resolution: {integrity: sha512-zR7fv/z14OjgHl4AgRtkDBvBMhIzCxqV/qN/2BCRC7LjFwvuzjYe7gDWxC4Wl/SNsLM6SE1IWvRPYMgSJaUvNw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-object-rest-spread@7.29.7': + resolution: {integrity: sha512-Ld98jn4c0smUywL57m7SgsHq3OpThOa6LqZJif3G6jYOovPleoFhVrBJ1WegRApSFB2wu4+RelAj9AC9G08Z4A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-object-super@7.29.7': + resolution: {integrity: sha512-Ea/diGcw0twB5IlZPO5sgET6fJsLJqPABqTuFWIR+iMPGPZJkATEIWx0wa+aEQ5UY1CBQyP/gkAiLEqn1vBiQA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-optional-catch-binding@7.29.7': + resolution: {integrity: sha512-sLsyndxK2VwX6yNUOakMb7Sh553ZTe/vVM1XJ+9Z5aW1ytsc8xOIwmyk05NNjN60vkc5/KqoTH6hB4V41LJhng==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-optional-chaining@7.29.7': + resolution: {integrity: sha512-6GM1dhvK3gNODkXcEcMCOLEDCLSoZ/sBbro2Ax8HURyasQ4NshagQixkRFdh5niI6E4gmA/jYI/4aT7rRos3ZQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-parameters@7.29.7': + resolution: {integrity: sha512-ZDOBqV/qLYJI0YElr8DcENEyARsFQeESqWXH6gZlghYXuPPjvweuDhP4VyEi4BlUBlLRFZVjxoZDMjxhLW766g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-private-methods@7.29.7': + resolution: {integrity: sha512-/6Rz4DK1ETDEM/bWHsPHcaEe7ZaT1EqSXjtSP/L0DijOYuaUhiRiOKcwpZ8P7zR4xXEHc2ITdiCgBm9Tpyv9ug==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-private-property-in-object@7.29.7': + resolution: {integrity: sha512-+BNo06dnrzdNNqCm1X6YUaVv0DKk8Q+JYcoZfOkLhYWNCXzlwTSRq8zGWayT1csjcpNXV9CQTBRRbmTLZac5cA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-property-literals@7.29.7': + resolution: {integrity: sha512-bOMRLQuI0A5ZqHq3OWJ89/rXpJ/NJrbVhXiP4zwPGMs6kpcVsuTUNjwoE30K0Qm3mf48a/TnRYYD6vPNqcg6jA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-regenerator@7.29.7': + resolution: {integrity: sha512-rNNFV0DBAJp988xW2DOntfDoYn1eR8GGF5AT5vYc+rjyfaQkM242c9tZUHHPe7KYaiJizXPWhQTzzdbXySyhBw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-reserved-words@7.29.7': + resolution: {integrity: sha512-5+YhdpVgmfSmwZyLMftfaiffLRMHjzIRHFHHLdibcSyJm2pasMrKHrO3Ptrt2DRshjvpgjEJJ1zVW14WPq/6QA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-shorthand-properties@7.29.7': + resolution: {integrity: sha512-I+WYbGBAiCn7nA6xBrlgPH+MB7HWb4u8pv5S0Pv7OtwNvIFvCCb24YlttKEeUFVurfBCEaOTnuhlqsb7f0Z5Dg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-spread@7.29.7': + resolution: {integrity: sha512-/u5K1QWada7tbYNqTjMh96718g9NTwh9tfPJMsSmVsQwGT447FskV+KcfeXkXq2GWki4EM/MuTdmBec+hOuVTQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-sticky-regex@7.29.7': + resolution: {integrity: sha512-BCHzNYJGe9l7EpwwDBN/ztlL2NYFFq8hp9ddjtUEM9f2O7S7kKV/lL6Fwo7IF7NSkYhPK2vO+86nIGltA90MsA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-template-literals@7.29.7': + resolution: {integrity: sha512-NCSEJ4sLFU2gqAub45HYh4fus2yQ36rr6ei6vpU7NdoJqCpxvEG8E6eJpscGyXP3VHD2Ny+fSXr04k1hoUrFqA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-typeof-symbol@7.29.7': + resolution: {integrity: sha512-223mNGoTkBiTEWFoK+Q6Go3tueMRclO8vxxxxquNCYuNI4jWOofFKJRRDu6SDrB8Sgo1UEGW9T4GAQ8ZyRso1A==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-escapes@7.29.7': + resolution: {integrity: sha512-jCfXxSjf94lf4E0hKE0AByxF6F3/pVFqRdUUNkDJhsY0m1ZKjnN6ZYyMeHNpzflxb/0q5b7t3p+BE+SLF1WOtA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-property-regex@7.29.7': + resolution: {integrity: sha512-OgZ+zoAJgZLUCunsTRQ5LAjOywDv5zzZ2/hQ5aMw1pGXyY2rtE8/chXYUmu3AlVHKpm10KEdG9aMwbI/K76ZGw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-regex@7.29.7': + resolution: {integrity: sha512-7D/x/23/d/3VqZ0QA+LGbZMlGwZjztBygSWWWsfTPoQ1oQ6Q1P6Mr3d0kk42XabyUVw+fha3LqdRsFqeKqvCyA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/plugin-transform-unicode-sets-regex@7.29.7': + resolution: {integrity: sha512-BLOhLht9DOJwIxlmp91wHvkXv1lguuHS3/FwUO8HL1H0u8s4hR1gASVFyilu9iGtcTRYqjTZmlsFFeQletntEg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + + '@babel/preset-env@7.22.20': + resolution: {integrity: sha512-11MY04gGC4kSzlPHRfvVkNAZhUxOvm7DCJ37hPDnUENwe06npjIRAfInEMTGSb4LZK5ZgDFkv5hw0lGebHeTyg==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + + '@babel/preset-modules@0.1.6-no-external-plugins': + resolution: {integrity: sha512-HrcgcIESLm9aIR842yhJ5RWan/gebQUJ6E/E5+rf0y9o6oj7w0Br+sWuL6kEQ/o/AdfvR1Je9jG18/gnpwjEyA==} + peerDependencies: + '@babel/core': ^7.0.0-0 || ^8.0.0-0 <8.0.0 + + '@babel/runtime@7.29.7': + resolution: {integrity: sha512-Nq8OhGWiZIZGV6hLHoyAKLLcJihP/xFeBMGJoUrxTX2psI8dCifzLhZISFb+VWS3wFMRDmCGw5R+dOySCqPLhw==} + engines: {node: '>=6.9.0'} + + '@babel/template@7.29.7': + resolution: {integrity: sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==} + engines: {node: '>=6.9.0'} + + '@babel/traverse@7.29.7': + resolution: {integrity: sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==} + engines: {node: '>=6.9.0'} + + '@babel/types@7.29.7': + resolution: {integrity: sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==} + engines: {node: '>=6.9.0'} + + '@bcoe/v8-coverage@0.2.3': + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + + '@blazediff/core@1.9.1': + resolution: {integrity: sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA==} + + '@cspotcode/source-map-support@0.8.1': + resolution: {integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==} + engines: {node: '>=12'} + + '@csstools/color-helpers@5.1.0': + resolution: {integrity: sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==} + engines: {node: '>=18'} + + '@csstools/css-calc@2.1.4': + resolution: {integrity: sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-color-parser@3.1.0': + resolution: {integrity: sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-parser-algorithms': ^3.0.5 + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-parser-algorithms@3.0.5': + resolution: {integrity: sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==} + engines: {node: '>=18'} + peerDependencies: + '@csstools/css-tokenizer': ^3.0.4 + + '@csstools/css-tokenizer@3.0.4': + resolution: {integrity: sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==} + engines: {node: '>=18'} + + '@discoveryjs/json-ext@0.5.7': + resolution: {integrity: sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==} + engines: {node: '>=10.0.0'} + + '@emnapi/core@1.10.0': + resolution: {integrity: sha512-yq6OkJ4p82CAfPl0u9mQebQHKPJkY7WrIuk205cTYnYe+k2Z8YBh11FrbRG/H6ihirqcacOgl2BIO8oyMQLeXw==} + + '@emnapi/core@1.11.1': + resolution: {integrity: sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==} + + '@emnapi/runtime@1.10.0': + resolution: {integrity: sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==} + + '@emnapi/runtime@1.11.1': + resolution: {integrity: sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==} + + '@emnapi/wasi-threads@1.2.1': + resolution: {integrity: sha512-uTII7OYF+/Mes/MrcIOYp5yOtSMLBWSIoLPpcgwipoiKbli6k322tcoFsxoIIxPDqW01SQGAgko4EzZi2BNv2w==} + + '@emnapi/wasi-threads@1.2.2': + resolution: {integrity: sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==} + + '@eslint-community/eslint-utils@4.9.1': + resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + + '@eslint-community/regexpp@4.12.2': + resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + + '@eslint/eslintrc@2.1.4': + resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + '@eslint/js@8.57.0': + resolution: {integrity: sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + '@hpke/common@1.10.1': + resolution: {integrity: sha512-moJwhmtLtuxiUzzNp1jpfBfx8yefKoO9D/RCR9dmwrnc7qjJqId1rEtQz+lSlU5cabX8daToMSx/7HayXOiaFw==} + engines: {node: '>=16.0.0'} + + '@hpke/core@1.7.5': + resolution: {integrity: sha512-4xfckZuPaIodeu0HpuTRIdtmajhRHXM/6rjS2N62Ns9aOCkGbbeYRwktqR3bUScuhCwyEBsEQqtIh9f0iLP3WQ==} + engines: {node: '>=16.0.0'} + + '@humanwhocodes/config-array@0.11.14': + resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} + engines: {node: '>=10.10.0'} + deprecated: Use @eslint/config-array instead + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/object-schema@2.0.3': + resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} + deprecated: Use @eslint/object-schema instead + + '@isaacs/cliui@8.0.2': + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + + '@istanbuljs/load-nyc-config@1.1.0': + resolution: {integrity: sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==} + engines: {node: '>=8'} + + '@istanbuljs/schema@0.1.6': + resolution: {integrity: sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==} + engines: {node: '>=8'} + + '@jest/console@29.7.0': + resolution: {integrity: sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/console@30.4.1': + resolution: {integrity: sha512-v3bhyxUh9Hgmo5p6hAOXe14/R3ZxZDOsvHleh4B07z3m/x4/ngPUXEm9XwK4sF4u+f+P2ORb0Ge+MgpaqRMVDA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/core@29.7.0': + resolution: {integrity: sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/core@30.4.2': + resolution: {integrity: sha512-TZJA6cPJUFxoWhxaLo8t0VX/MZX2wPWr0uIDvLSHIvN4gu9h02vSzqI2kBADG1ExqQlC+cY09xKMSreivvrChQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/diff-sequences@30.4.0': + resolution: {integrity: sha512-zOpzlfUs45l6u7jm39qr87JCHUDsaeCtvL+kQe/Vn9jSnRB4/5IPXISm0h9I1vZW/o00Kn4UTJ2MOlhnUGwv3g==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/environment-jsdom-abstract@30.4.1': + resolution: {integrity: sha512-dSlKrqug3siYNHVnjwIldShY12wAH3spwRltO/+8VOjg0X+xEq7vOs3DbBs4LRKsu7OH+NUb9kuZUNBF9Ho3TA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + canvas: ^3.0.0 + jsdom: '*' + peerDependenciesMeta: + canvas: + optional: true + + '@jest/environment@29.7.0': + resolution: {integrity: sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/environment@30.4.1': + resolution: {integrity: sha512-AK9yNRqgKxiabqMoe4oW+3/TSSeV8vkdC7BGaxZdU0AFXfOpofTLqdru2GXKZghP3sdgwE9XXpnVwfZ8JnFV4w==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/expect-utils@29.7.0': + resolution: {integrity: sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/expect-utils@30.4.1': + resolution: {integrity: sha512-ZBn5CglH8fBsQsvs4VWNzD4aWfUYks+IdOOQU3MEK71ol/BcVm+P+rtb1KpiFBpSWSCE27uOahyyf1vfqOVbcQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/expect@29.7.0': + resolution: {integrity: sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/expect@30.4.1': + resolution: {integrity: sha512-ginrj6TMgh2GshLUGCjO94Ptx9HhdZA/I6A9iUfyeLKFtdAjnKzHDgzgP9HYQgbxM1lbXScQ2eUBz2lGeVDPWA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/fake-timers@29.7.0': + resolution: {integrity: sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/fake-timers@30.4.1': + resolution: {integrity: sha512-iW5umdmfPeWzehrVhugFQZqCchSCud5S1l2YT0O9ZhjRR0ExclANDZkiSBwzqtnlOn0J1JXvO+HZ6rkuyOVOgQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/get-type@30.1.0': + resolution: {integrity: sha512-eMbZE2hUnx1WV0pmURZY9XoXPkUYjpc55mb0CrhtdWLtzMQPFvu/rZkTLZFTsdaVQa+Tr4eWAteqcUzoawq/uA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/globals@29.7.0': + resolution: {integrity: sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/globals@30.4.1': + resolution: {integrity: sha512-ZbuY4cmXC8DkxYjfvT2DbcHWL2T6vmsMhXCDcmTB2T0y0gaezBI77ufq5ZAIdcRkYZ7NEQEDg1xFeKbxUJ5v5Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/pattern@30.4.0': + resolution: {integrity: sha512-RAWn3+f9u8BsHijKJ71uHcFp6vmyEt6VvoWXkl6hKF3qVIuWNmudVjg12DlBPGup/frIl5UcUlH5HfEuvHpEXg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/reporters@29.7.0': + resolution: {integrity: sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/reporters@30.4.1': + resolution: {integrity: sha512-/SnkPCzEQpUaBH81kjdEdDdo2WZl5hxw+BmLDGWjRkm8o7XlhjwsU36cqwe5PGBE5WYpBvDzRSdXx9rbGuJtNA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + '@jest/schemas@29.6.3': + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/schemas@30.4.1': + resolution: {integrity: sha512-i6b4qw5qnP8c5FEeBJg/uZQ4ddrkN6Ca8qISJh0pr7a5hfn3h3v5x60BEbOC7OYAGZNMs1LfFLwnW2CuK8F57Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/snapshot-utils@30.4.1': + resolution: {integrity: sha512-ObY4ljvQ95mt6iwKtVLetR/4yXiAgl3H4nJxhztr0MTjrN97TwDYrnCp/kF60Ec9HdhkWTHSu+Hg05aXfngpOA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/source-map@29.6.3': + resolution: {integrity: sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/source-map@30.0.1': + resolution: {integrity: sha512-MIRWMUUR3sdbP36oyNyhbThLHyJ2eEDClPCiHVbrYAe5g3CHRArIVpBw7cdSB5fr+ofSfIb2Tnsw8iEHL0PYQg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/test-result@29.7.0': + resolution: {integrity: sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/test-result@30.4.1': + resolution: {integrity: sha512-/ZG7pgEiOmmWkN9TplKbOu4id2N5lh7FHwRwlkgBVAzGdRH+OkkQ8wX/kIxg4zmd3ZQvAL1RwL2yWsvNYYECTw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/test-sequencer@29.7.0': + resolution: {integrity: sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/test-sequencer@30.4.1': + resolution: {integrity: sha512-PeYE+4td5rKjoRPxztObrXU+H8hsjZfxKMXOcmrr34JerSyB/ROOxbbicz8B7A5j9R9VayDnVPvBmedqCsFCdw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/transform@29.7.0': + resolution: {integrity: sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/transform@30.4.1': + resolution: {integrity: sha512-Wz0LyktlTvRefoymh+n64hQ84KNXsRGcwdoZ8CSa0Ea+fgYcHZlnk+hDP7v2MS7il2bQ5uTEIxf4/NNfhMN4KQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jest/types@29.6.3': + resolution: {integrity: sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + '@jest/types@30.4.1': + resolution: {integrity: sha512-f1x/vJXIfjOlEmejYpbkbgw1gOqpPECwMvMEtBqe47j7H2Hg8h8w3o3ikhSXq3MI15kg+oQ0exWO0uCtTNJLoQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + '@jridgewell/gen-mapping@0.3.13': + resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} + + '@jridgewell/remapping@2.3.5': + resolution: {integrity: sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==} + + '@jridgewell/resolve-uri@3.1.2': + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + + '@jridgewell/source-map@0.3.11': + resolution: {integrity: sha512-ZMp1V8ZFcPG5dIWnQLr3NSI1MiCU7UETdS/A0G8V/XWHvJv3ZsFqutJn1Y5RPmAPX6F3BiE397OqveU/9NCuIA==} + + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + + '@jridgewell/trace-mapping@0.3.31': + resolution: {integrity: sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==} + + '@jridgewell/trace-mapping@0.3.9': + resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} + + '@jsonjoy.com/base64@1.1.2': + resolution: {integrity: sha512-q6XAnWQDIMA3+FTiOYajoYqySkO+JSat0ytXGSuRdq9uXE7o92gzuQwQM14xaCRlBLGq3v5miDGC4vkVTn54xA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/base64@17.67.0': + resolution: {integrity: sha512-5SEsJGsm15aP8TQGkDfJvz9axgPwAEm98S5DxOuYe8e1EbfajcDmgeXXzccEjh+mLnjqEKrkBdjHWS5vFNwDdw==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/buffers@1.2.1': + resolution: {integrity: sha512-12cdlDwX4RUM3QxmUbVJWqZ/mrK6dFQH4Zxq6+r1YXKXYBNgZXndx2qbCJwh3+WWkCSn67IjnlG3XYTvmvYtgA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/buffers@17.67.0': + resolution: {integrity: sha512-tfExRpYxBvi32vPs9ZHaTjSP4fHAfzSmcahOfNxtvGHcyJel+aibkPlGeBB+7AoC6hL7lXIE++8okecBxx7lcw==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/codegen@1.0.0': + resolution: {integrity: sha512-E8Oy+08cmCf0EK/NMxpaJZmOxPqM+6iSe2S4nlSBrPZOORoDJILxtbSUEDKQyTamm/BVAhIGllOBNU79/dwf0g==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/codegen@17.67.0': + resolution: {integrity: sha512-idnkUplROpdBOV0HMcwhsCUS5TRUi9poagdGs70A6S4ux9+/aPuKbh8+UYRTLYQHtXvAdNfQWXDqZEx5k4Dj2Q==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-core@4.64.0': + resolution: {integrity: sha512-zs2TAq7Six5jgMuoMNjpspAvOP3mhtgq/k1UyQodEzCtQi/N83y2/y+zcvnZSGp/Rxq96DBN+bValOBQAyn/ew==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-fsa@4.64.0': + resolution: {integrity: sha512-nMWOVbkLFyEgmXZih3wyvxA9XpgyyqyfrINMHvEFqhi7uqfRl7c9ERJt6yX7vgMPrB9Uo+OJO+Spa0cFzPD01w==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-node-builtins@4.64.0': + resolution: {integrity: sha512-/o7WRFhUWaM/fOrslwLZGnzn4RmRILykn+lAL+mNObqqRNw+CQSiij6hpCeZ+C7buhdoVo7go/OYqzaSUfDYmA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-node-to-fsa@4.64.0': + resolution: {integrity: sha512-WDD9WVs0hb7UAEKTgZW2f66WDrbj7gIIWwpP3spbLyXa0rghtUaFTB8L4gdR3ZCWwiKIsj38/CNijpVmpnuPUw==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-node-utils@4.64.0': + resolution: {integrity: sha512-k5Indsx9hWW9xSF7Y6oSKKwtCUNhzZxadub3owhIlitc+iMRVlPPdX2duTKQWBL3qNWpXya8jykgaaWpheeS4w==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-node@4.64.0': + resolution: {integrity: sha512-dO+NNkODbUli4uV42bcNrrLvq5rE7SNpdZ5TNd0dtbLsAaNK3MDiIC9lUi+brboGoIjW6vd2fB1qao60nrk5xA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-print@4.64.0': + resolution: {integrity: sha512-PHZFccchvkhWrwPWHjmVAhbC3vSHCtyZvlZfJJ3ho2bnzl450hXri6/8e6pbkWdH+SkmLXNml0sV8e5HDAfxKw==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/fs-snapshot@4.64.0': + resolution: {integrity: sha512-oM7UDeL83q6NBzzsfKAsYKXKVXlykKFqqOLh4xZZKAzzROTlInkPbc6LTDGThEOnPiFiUzA7tYziHG9xavd76Q==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/json-pack@1.21.0': + resolution: {integrity: sha512-+AKG+R2cfZMShzrF2uQw34v3zbeDYUqnQ+jg7ORic3BGtfw9p/+N6RJbq/kkV8JmYZaINknaEQ2m0/f693ZPpg==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/json-pack@17.67.0': + resolution: {integrity: sha512-t0ejURcGaZsn1ClbJ/3kFqSOjlryd92eQY465IYrezsXmPcfHPE/av4twRSxf6WE+TkZgLY+71vCZbiIiFKA/w==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/json-pointer@1.0.2': + resolution: {integrity: sha512-Fsn6wM2zlDzY1U+v4Nc8bo3bVqgfNTGcn6dMgs6FjrEnt4ZCe60o6ByKRjOGlI2gow0aE/Q41QOigdTqkyK5fg==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/json-pointer@17.67.0': + resolution: {integrity: sha512-+iqOFInH+QZGmSuaybBUNdh7yvNrXvqR+h3wjXm0N/3JK1EyyFAeGJvqnmQL61d1ARLlk/wJdFKSL+LHJ1eaUA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/util@1.9.0': + resolution: {integrity: sha512-pLuQo+VPRnN8hfPqUTLTHk126wuYdXVxE6aDmjSeV4NCAgyxWbiOIeNJVtID3h1Vzpoi9m4jXezf73I6LgabgQ==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@jsonjoy.com/util@17.67.0': + resolution: {integrity: sha512-6+8xBaz1rLSohlGh68D1pdw3AwDi9xydm8QNlAFkvnavCJYSze+pxoW2VKP8p308jtlMRLs5NTHfPlZLd4w7ew==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + '@leichtgewicht/ip-codec@2.0.5': + resolution: {integrity: sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==} + + '@napi-rs/wasm-runtime@1.1.6': + resolution: {integrity: sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==} + peerDependencies: + '@emnapi/core': ^1.7.1 + '@emnapi/runtime': ^1.7.1 + + '@noble/ciphers@1.3.0': + resolution: {integrity: sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==} + engines: {node: ^14.21.3 || >=16} + + '@noble/curves@1.9.0': + resolution: {integrity: sha512-7YDlXiNMdO1YZeH6t/kvopHHbIZzlxrCV9WLqCY6QhcXOoXiNCMDqJIglZ9Yjx5+w7Dz30TITFrlTjnRg7sKEg==} + engines: {node: ^14.21.3 || >=16} + + '@noble/curves@1.9.1': + resolution: {integrity: sha512-k11yZxZg+t+gWvBbIswW0yoJlu8cHOC7dhunwOzoWH/mXGBiYyR4YY6hAEK/3EUs4UpB8la1RfdRpeGsFHkWsA==} + engines: {node: ^14.21.3 || >=16} + + '@noble/curves@1.9.7': + resolution: {integrity: sha512-gbKGcRUYIjA3/zCCNaWDciTMFI0dCkvou3TL8Zmy5Nc7sJ47a0jtOeZoTaMxkuqRo9cRhjOdZJXegxYE5FN/xw==} + engines: {node: ^14.21.3 || >=16} + + '@noble/ed25519@2.0.0': + resolution: {integrity: sha512-/extjhkwFupyopDrt80OMWKdLgP429qLZj+z6sYJz90rF2Iz0gjZh2ArMKPImUl13Kx+0EXI2hN9T/KJV0/Zng==} + + '@noble/hashes@1.8.0': + resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} + engines: {node: ^14.21.3 || >=16} + + '@nodelib/fs.scandir@2.1.5': + resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} + engines: {node: '>= 8'} + + '@nodelib/fs.stat@2.0.5': + resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==} + engines: {node: '>= 8'} + + '@nodelib/fs.walk@1.2.8': + resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} + engines: {node: '>= 8'} + + '@oxc-project/types@0.139.0': + resolution: {integrity: sha512-r9gHphtCs+1M7J0pw6Sn/hh/Wpa/iQrOOkrNAlVLF/gHq+/CJmHIWKKUUhdWjcD6CIa8idarspCsASiXCXvFUw==} + + '@peculiar/asn1-cms@2.8.0': + resolution: {integrity: sha512-NgekZOrSJFSBFLFoLfwePguAWAx7z1+f2TEsWFUMyiqqfntZ4+S/S5hzqME3q4pCA0iOsFKdwiQ35dwY24eVqA==} + + '@peculiar/asn1-csr@2.8.0': + resolution: {integrity: sha512-akbF8+uvleHs8sejNPQxwmVFuInAg6FMNHOwMILXfP518YfFJwdR3jr6oNUPOaEJfuEhn/vkNOCIT6ASUd4mbg==} + + '@peculiar/asn1-ecc@2.8.0': + resolution: {integrity: sha512-ohwlk+u9Rv2NOAY1c6MfHj45ATVF8R1DUN/WCgABiRtLi2ZftlZWZX7KvpAbU8v9xPcmoILfELeEABj/rn18AQ==} + + '@peculiar/asn1-pfx@2.8.0': + resolution: {integrity: sha512-5yof1ytoB++RQtaFbqSUJ8pxDJtZT6vbVqZ8XoJ61ph7UjNVvfFwAilnCodqkNsAodpy13gDhoxZXw00pghnyg==} + + '@peculiar/asn1-pkcs8@2.8.0': + resolution: {integrity: sha512-qAKXtLpBEw9LqhKpjw3ajZSXlBur+ipW+y2ivVBQAG6F6qRx94yO+1ZR4mvw+YaCfKSaOzLeYEzsPaBp4SJELA==} + + '@peculiar/asn1-pkcs9@2.8.0': + resolution: {integrity: sha512-b5nDWCnkV60+cQ141D6sVVwK9nz64R5n3zSVnklGd+ECdkW2Ol3U1a6yYFlalpSOaD557yuJB64A+q42jG7lUQ==} + + '@peculiar/asn1-rsa@2.8.0': + resolution: {integrity: sha512-zHEUlCqB2mk7x2lxDwHHJy7hWZOPdGHVlsmITWKB5/PbQo61atbu9PJ/0r9dQNMwFzbKPXZ8uK8/91eUhRznSg==} + + '@peculiar/asn1-schema@2.8.0': + resolution: {integrity: sha512-7YT0U/ze0tF2QOBbE15gKZwy5tvgGyLRiRHLzhlbOpf7BT032oBSd0haZqXn5W6l26WLlu3dyxzjM+2638/z2Q==} + + '@peculiar/asn1-x509-attr@2.8.0': + resolution: {integrity: sha512-tHjkfS/qhMnmrlB2J9NhflQlQ7In3khO3CfmVrriOlpTeErY9ZIKOso1hQ5JQiyrJ7ShvqVPk7E5fQmbclkSKA==} + + '@peculiar/asn1-x509@2.8.0': + resolution: {integrity: sha512-N0CMuhWUzsWEVq6F1q9X6+VKUnWzSW+cSVg+aPaGGwDdbFoFWTYgin5MHwXgpWd6y9COMBxnfy/Qc+Xc7F0Zwg==} + + '@peculiar/utils@2.0.3': + resolution: {integrity: sha512-+oL3HPFRIZ1St2K50lWCXiioIgSoxzz7R1J3uF6neO2yl1sgmpgY6XXJH4BdpoDkMWznQTeYF6oWNDZLCdQ4eQ==} + + '@peculiar/x509@1.12.3': + resolution: {integrity: sha512-+Mzq+W7cNEKfkNZzyLl6A6ffqc3r21HGZUezgfKxpZrkORfOqgRXnS80Zu0IV6a9Ue9QBJeKD7kN0iWfc3bhRQ==} + + '@pkgjs/parseargs@0.11.0': + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + + '@pkgr/core@0.3.6': + resolution: {integrity: sha512-SEeaJLb3qBNF/OaXnaR1NmmBbFYk1zC0ZH/52fATcRPLFg/p791YrcyFFy44Bo9sLaGuSuLp5Q6axbb/O+v/RA==} + engines: {node: ^14.18.0 || >=16.0.0} + + '@polka/url@1.0.0-next.29': + resolution: {integrity: sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww==} + + '@rolldown/binding-android-arm64@1.1.5': + resolution: {integrity: sha512-lZg8fqIv2v7FF237bwMgzGZEJvGL79/s5knJ/i6FmsGF4XXlzccZ4jb+TrFIxtSSxFtIpdsgrPZeMk1I9AFcyQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@rolldown/binding-darwin-arm64@1.1.5': + resolution: {integrity: sha512-51Bnx9pNiMRKSUNtBfySkNJ9vMU9Hh3I1ozDd6gyPPYzaXCfnptUcEZxXGYFn+ul2dtcMUiqGR1Yai2K10uoTw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@rolldown/binding-darwin-x64@1.1.5': + resolution: {integrity: sha512-Tm+gbfC0aHu1tBA/JvKQh32S0K6YgCHkiAF4/W6xX0K0RmNuc94VeK419dJoE65R5aRxmo+noZQSWrAMF6yb6g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@rolldown/binding-freebsd-x64@1.1.5': + resolution: {integrity: sha512-JMzDKCCXq93YccG5gz3hvOs1oXRKAf0XYpfOS88e+wZrC8Iugj6j68867vrYZkvpDDpKn/KoKORThmchMpF6TA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@rolldown/binding-linux-arm-gnueabihf@1.1.5': + resolution: {integrity: sha512-uML21j2K5TfPGutKxub+M+nLjZIrWjXQ5Grx4lCe/nimTj9B4L63zHpjXLl4y0L3mcm2htEQIb06oCG/szerNw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@rolldown/binding-linux-arm64-gnu@1.1.5': + resolution: {integrity: sha512-navSiuTMogvnQoZoM/v+l3ZWo50/NTwSHSzheABx/RCnmUPaKwq9qSo4Br2OYRs21+Fz8uFqITZM3H4opOB0/Q==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-arm64-musl@1.1.5': + resolution: {integrity: sha512-lAryqH7IteztmCXQXk0etKj4wBQ7Gx5S6LjKhsgp9zb8I5bsuvU/2llH1hDQcjsFeqIsovMVN339/8pUDDBXxA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rolldown/binding-linux-ppc64-gnu@1.1.5': + resolution: {integrity: sha512-fsK/sNBnxzBlL4O1JNrZakVQxPspqpED5dLtNsZS9oOKmtSpdNIzxH2kkol5HYTWJN47sE20ztMJPxfZ89qGOg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-s390x-gnu@1.1.5': + resolution: {integrity: sha512-gLYb4BIadlfTOYT5gO503n8zQjXflgzpD0FcyKh0Mzx3rqCZKnHoJWV9xe1KXUJ5lx2JfcSHr/mhzS0PC/McAA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-gnu@1.1.5': + resolution: {integrity: sha512-FjcpEKUyJygHgs1o50VYNvkt5+7Le/VEdYt0AkRpkL33MnyQfwr8l5mXwMmfmTbyMPr5vJLC+8/Gd9gXnwU1QQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rolldown/binding-linux-x64-musl@1.1.5': + resolution: {integrity: sha512-Me+PfPI2TMeOQk0gYWfLQZtTktrmzbr8cDboqX83XKc7UrgAi55gF+2dUkWdxd19n55Essp2yeca+O9N5rBxHg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rolldown/binding-openharmony-arm64@1.1.5': + resolution: {integrity: sha512-yc5WrLzXks6zCQfn9Oxr8pORKyl/pF+QjHmW/Qx3qu0oyrrNC+y2JLTU1E2rcWYAmzlnqngWXHQjy51VzW70Vw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@rolldown/binding-wasm32-wasi@1.1.5': + resolution: {integrity: sha512-VbQGPX2b4r48TAMIM2cjgluIM1HYutm4pcTEJsle7iEP7sB1dFqtPLBVbdLAZCxy1txCcPxf4QFf4v8uvltPqA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [wasm32] + + '@rolldown/binding-win32-arm64-msvc@1.1.5': + resolution: {integrity: sha512-gHv82k63z4qpV5+Q1y/12KrK0ltWBukVDI8nZcbT7Tt/ZlOIVwppazneq0F93oDxTo3IgAMEDIoQh3E2n6mVsw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@rolldown/binding-win32-x64-msvc@1.1.5': + resolution: {integrity: sha512-tTZuDBPw85tEN5PQi1pnEBzDy0Z49HtScLAbD5t6hyeU92A95pRWaSMw1GZZi/RwgSgUIl0xrSlXIT/9QzvYSA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@rolldown/pluginutils@1.0.1': + resolution: {integrity: sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==} + + '@rollup/plugin-typescript@11.1.6': + resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.14.0||^3.0.0||^4.0.0 + tslib: '*' + typescript: '>=3.7.0' + peerDependenciesMeta: + rollup: + optional: true + tslib: + optional: true + + '@rollup/pluginutils@5.4.0': + resolution: {integrity: sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + + '@rollup/rollup-android-arm-eabi@4.59.0': + resolution: {integrity: sha512-upnNBkA6ZH2VKGcBj9Fyl9IGNPULcjXRlg0LLeaioQWueH30p6IXtJEbKAgvyv+mJaMxSm1l6xwDXYjpEMiLMg==} + cpu: [arm] + os: [android] + + '@rollup/rollup-android-arm64@4.59.0': + resolution: {integrity: sha512-hZ+Zxj3SySm4A/DylsDKZAeVg0mvi++0PYVceVyX7hemkw7OreKdCvW2oQ3T1FMZvCaQXqOTHb8qmBShoqk69Q==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.59.0': + resolution: {integrity: sha512-W2Psnbh1J8ZJw0xKAd8zdNgF9HRLkdWwwdWqubSVk0pUuQkoHnv7rx4GiF9rT4t5DIZGAsConRE3AxCdJ4m8rg==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.59.0': + resolution: {integrity: sha512-ZW2KkwlS4lwTv7ZVsYDiARfFCnSGhzYPdiOU4IM2fDbL+QGlyAbjgSFuqNRbSthybLbIJ915UtZBtmuLrQAT/w==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.59.0': + resolution: {integrity: sha512-EsKaJ5ytAu9jI3lonzn3BgG8iRBjV4LxZexygcQbpiU0wU0ATxhNVEpXKfUa0pS05gTcSDMKpn3Sx+QB9RlTTA==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.59.0': + resolution: {integrity: sha512-d3DuZi2KzTMjImrxoHIAODUZYoUUMsuUiY4SRRcJy6NJoZ6iIqWnJu9IScV9jXysyGMVuW+KNzZvBLOcpdl3Vg==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.59.0': + resolution: {integrity: sha512-t4ONHboXi/3E0rT6OZl1pKbl2Vgxf9vJfWgmUoCEVQVxhW6Cw/c8I6hbbu7DAvgp82RKiH7TpLwxnJeKv2pbsw==} + cpu: [arm] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-arm-musleabihf@4.59.0': + resolution: {integrity: sha512-CikFT7aYPA2ufMD086cVORBYGHffBo4K8MQ4uPS/ZnY54GKj36i196u8U+aDVT2LX4eSMbyHtyOh7D7Zvk2VvA==} + cpu: [arm] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-arm64-gnu@4.59.0': + resolution: {integrity: sha512-jYgUGk5aLd1nUb1CtQ8E+t5JhLc9x5WdBKew9ZgAXg7DBk0ZHErLHdXM24rfX+bKrFe+Xp5YuJo54I5HFjGDAA==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-arm64-musl@4.59.0': + resolution: {integrity: sha512-peZRVEdnFWZ5Bh2KeumKG9ty7aCXzzEsHShOZEFiCQlDEepP1dpUl/SrUNXNg13UmZl+gzVDPsiCwnV1uI0RUA==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-loong64-gnu@4.59.0': + resolution: {integrity: sha512-gbUSW/97f7+r4gHy3Jlup8zDG190AuodsWnNiXErp9mT90iCy9NKKU0Xwx5k8VlRAIV2uU9CsMnEFg/xXaOfXg==} + cpu: [loong64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-loong64-musl@4.59.0': + resolution: {integrity: sha512-yTRONe79E+o0FWFijasoTjtzG9EBedFXJMl888NBEDCDV9I2wGbFFfJQQe63OijbFCUZqxpHz1GzpbtSFikJ4Q==} + cpu: [loong64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-ppc64-gnu@4.59.0': + resolution: {integrity: sha512-sw1o3tfyk12k3OEpRddF68a1unZ5VCN7zoTNtSn2KndUE+ea3m3ROOKRCZxEpmT9nsGnogpFP9x6mnLTCaoLkA==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-ppc64-musl@4.59.0': + resolution: {integrity: sha512-+2kLtQ4xT3AiIxkzFVFXfsmlZiG5FXYW7ZyIIvGA7Bdeuh9Z0aN4hVyXS/G1E9bTP/vqszNIN/pUKCk/BTHsKA==} + cpu: [ppc64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-riscv64-gnu@4.59.0': + resolution: {integrity: sha512-NDYMpsXYJJaj+I7UdwIuHHNxXZ/b/N2hR15NyH3m2qAtb/hHPA4g4SuuvrdxetTdndfj9b1WOmy73kcPRoERUg==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-riscv64-musl@4.59.0': + resolution: {integrity: sha512-nLckB8WOqHIf1bhymk+oHxvM9D3tyPndZH8i8+35p/1YiVoVswPid2yLzgX7ZJP0KQvnkhM4H6QZ5m0LzbyIAg==} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@rollup/rollup-linux-s390x-gnu@4.59.0': + resolution: {integrity: sha512-oF87Ie3uAIvORFBpwnCvUzdeYUqi2wY6jRFWJAy1qus/udHFYIkplYRW+wo+GRUP4sKzYdmE1Y3+rY5Gc4ZO+w==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-x64-gnu@4.59.0': + resolution: {integrity: sha512-3AHmtQq/ppNuUspKAlvA8HtLybkDflkMuLK4DPo77DfthRb71V84/c4MlWJXixZz4uruIH4uaa07IqoAkG64fg==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@rollup/rollup-linux-x64-musl@4.59.0': + resolution: {integrity: sha512-2UdiwS/9cTAx7qIUZB/fWtToJwvt0Vbo0zmnYt7ED35KPg13Q0ym1g442THLC7VyI6JfYTP4PiSOWyoMdV2/xg==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@rollup/rollup-openbsd-x64@4.59.0': + resolution: {integrity: sha512-M3bLRAVk6GOwFlPTIxVBSYKUaqfLrn8l0psKinkCFxl4lQvOSz8ZrKDz2gxcBwHFpci0B6rttydI4IpS4IS/jQ==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.59.0': + resolution: {integrity: sha512-tt9KBJqaqp5i5HUZzoafHZX8b5Q2Fe7UjYERADll83O4fGqJ49O1FsL6LpdzVFQcpwvnyd0i+K/VSwu/o/nWlA==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.59.0': + resolution: {integrity: sha512-V5B6mG7OrGTwnxaNUzZTDTjDS7F75PO1ae6MJYdiMu60sq0CqN5CVeVsbhPxalupvTX8gXVSU9gq+Rx1/hvu6A==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.59.0': + resolution: {integrity: sha512-UKFMHPuM9R0iBegwzKF4y0C4J9u8C6MEJgFuXTBerMk7EJ92GFVFYBfOZaSGLu6COf7FxpQNqhNS4c4icUPqxA==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.59.0': + resolution: {integrity: sha512-laBkYlSS1n2L8fSo1thDNGrCTQMmxjYY5G0WFWjFFYZkKPjsMBsgJfGf4TLxXrF6RyhI60L8TMOjBMvXiTcxeA==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.59.0': + resolution: {integrity: sha512-2HRCml6OztYXyJXAvdDXPKcawukWY2GpR5/nxKp4iBgiO3wcoEGkAaqctIbZcNB6KlUQBIqt8VYkNSj2397EfA==} + cpu: [x64] + os: [win32] + + '@scure/base@1.2.6': + resolution: {integrity: sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==} + + '@scure/bip32@1.7.0': + resolution: {integrity: sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==} + + '@scure/bip39@1.6.0': + resolution: {integrity: sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==} + + '@sinclair/typebox@0.27.10': + resolution: {integrity: sha512-MTBk/3jGLNB2tVxv6uLlFh1iu64iYOQ2PbdOSK3NW8JZsmlaOh2q6sdtKowBhfw8QFLmYNzTW4/oK4uATIi6ZA==} + + '@sinclair/typebox@0.34.50': + resolution: {integrity: sha512-ydBWw0G6WFwWHzh9RK4B5c690UkreOG0llq0r+DaI7LgKgxigf8mhHzIPI3S0850g1BPkq/zpuCfrq4QFgUlTQ==} + + '@sinonjs/commons@3.0.1': + resolution: {integrity: sha512-K3mCHKQ9sVh8o1C9cxkwxaOmXoAMlDxC1mYyHrjqOWEcBjYr76t96zL2zlj5dUGZ3HSw240X1qgH3Mjf1yJWpQ==} + + '@sinonjs/fake-timers@10.3.0': + resolution: {integrity: sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==} + + '@sinonjs/fake-timers@15.4.0': + resolution: {integrity: sha512-DsG+8/LscQIQg68J6Ef3dv10u6nVyetYn923s3/sus5eaGfTo1of5WMZSLf0UJc9KDuKPilPH0UDJCjvNbDNCA==} + + '@solana/buffer-layout@4.0.1': + resolution: {integrity: sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==} + engines: {node: '>=5.10'} + + '@solana/codecs-core@2.3.0': + resolution: {integrity: sha512-oG+VZzN6YhBHIoSKgS5ESM9VIGzhWjEHEGNPSibiDTxFhsFWxNaz8LbMDPjBUE69r9wmdGLkrQ+wVPbnJcZPvw==} + engines: {node: '>=20.18.0'} + peerDependencies: + typescript: '>=5.3.3' + + '@solana/codecs-numbers@2.3.0': + resolution: {integrity: sha512-jFvvwKJKffvG7Iz9dmN51OGB7JBcy2CJ6Xf3NqD/VP90xak66m/Lg48T01u5IQ/hc15mChVHiBm+HHuOFDUrQg==} + engines: {node: '>=20.18.0'} + peerDependencies: + typescript: '>=5.3.3' + + '@solana/errors@2.3.0': + resolution: {integrity: sha512-66RI9MAbwYV0UtP7kGcTBVLxJgUxoZGm8Fbc0ah+lGiAw17Gugco6+9GrJCV83VyF2mDWyYnYM9qdI3yjgpnaQ==} + engines: {node: '>=20.18.0'} + hasBin: true + peerDependencies: + typescript: '>=5.3.3' + + '@solana/web3.js@1.98.4': + resolution: {integrity: sha512-vv9lfnvjUsRiq//+j5pBdXig0IQdtzA0BRZ3bXEP4KaIyF1CcaydWqgyzQgfZMNIsWNWmG+AUHwPy4AHOD6gpw==} + + '@standard-schema/spec@1.1.0': + resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} + + '@swc/core-darwin-arm64@1.15.43': + resolution: {integrity: sha512-v1aVuvXdo/BHxJzco9V2xpHrvwWmhfS8t6gziY5wJxd+Z2h8AeJRnAwPD8itCDaGXVBwJ/CaKfxEzTkG0Va0OA==} + engines: {node: '>=10'} + cpu: [arm64] + os: [darwin] + + '@swc/core-darwin-x64@1.15.43': + resolution: {integrity: sha512-lp3d4Lamc8dt5huYdGLSR+9hLxmfr1jb0l+4XXG2zPqZwYWRN9R0U2qYoTrggiU2RWW0oV9VbWM3kBnqIc2kdQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [darwin] + + '@swc/core-linux-arm-gnueabihf@1.15.43': + resolution: {integrity: sha512-JWTQQELtsG5GgphDrr/XqqmM2pDN3cZqbMS0Mrg+iTiXL3F74sn/S2IyYE/5u4h2KLkTf9qQ7dXyxsbx7YzkeA==} + engines: {node: '>=10'} + cpu: [arm] + os: [linux] + + '@swc/core-linux-arm64-gnu@1.15.43': + resolution: {integrity: sha512-B4otJRdPWIsmiSBf0uG7Z/+vMWmkufjz5MmYxubwKuZazDW14Zd3symga1N62QR4RT+kEFeHEgsXfZGyn/w0hw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@swc/core-linux-arm64-musl@1.15.43': + resolution: {integrity: sha512-6zB6OnpViBxYy4tgY3v2i6AZY9fwkcHZ032UOwtwUuW1d19sdT07qF0kZe6/3UR1tUaK6jjg2rmVcUIBCEYVjQ==} + engines: {node: '>=10'} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@swc/core-linux-ppc64-gnu@1.15.43': + resolution: {integrity: sha512-coxE1ZWdB3uSDVNoEtYNrRi/1epvckZx9cTJ8ICUxTMTxGk+yvQ/Twacp3ruZSaMPGCriUjP86C37VhaT6nyRg==} + engines: {node: '>=10'} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@swc/core-linux-s390x-gnu@1.15.43': + resolution: {integrity: sha512-lXfLhs+LpBsD5inuYx+YDH5WsPPBQ95KPUiy8P5wq9ob9xKDZFqwNfU2QW6bGO8NqRO/H9JQomTSt5Yyh+FGfA==} + engines: {node: '>=10'} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@swc/core-linux-x64-gnu@1.15.43': + resolution: {integrity: sha512-07XnKwTmKy8TGOZG3D9fRnLWGynxPjwQnZLVmBFbo6F+7vHYzBIOuwXEhemrChBWb6yDNZsVCcMWCPX6FDD2xg==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@swc/core-linux-x64-musl@1.15.43': + resolution: {integrity: sha512-TJc+bsSIaBh+hZvZ5GRtW/K1bw66TJ9vsUwvVIsZdiWxU5ObLwZvfcnZ3UpgVfMnFibRes9uriJrQNBHEEogRQ==} + engines: {node: '>=10'} + cpu: [x64] + os: [linux] + libc: [musl] + + '@swc/core-win32-arm64-msvc@1.15.43': + resolution: {integrity: sha512-jfd7s2/bUQYkOHLs+LWQNKZdmDa8+sufKLllhpWAhVQ2GDCwsHe3vR/j+OSiItZNtkzFuaawa3+SAKz9y5gYfw==} + engines: {node: '>=10'} + cpu: [arm64] + os: [win32] + + '@swc/core-win32-ia32-msvc@1.15.43': + resolution: {integrity: sha512-rLAE8JvucqEW1ZGohxPQrQWPBQeJG4+ypKbWfdlU/qmKScvCkxf9/Jxnzki1dkUQCQ7P5Enp13RlvqOlvx/32g==} + engines: {node: '>=10'} + cpu: [ia32] + os: [win32] + + '@swc/core-win32-x64-msvc@1.15.43': + resolution: {integrity: sha512-h8MLDHZcfIukwQWj03rIJZx1I0E81AYj2X7J/nGErG4nz+QAv6G1Z+peotvinL3lqpbo32tLYSMFo32/ySzxKg==} + engines: {node: '>=10'} + cpu: [x64] + os: [win32] + + '@swc/core@1.15.43': + resolution: {integrity: sha512-1CuKjFkPxIgGdeHVuNbkxmBxkcbdc08u0aiI43pFq6yY1tTVKmXT9hFEooyyKs/sJ3xf1GPHyEwTtk9Xl8dvQw==} + engines: {node: '>=10'} + peerDependencies: + '@swc/helpers': '>=0.5.17' + peerDependenciesMeta: + '@swc/helpers': + optional: true + + '@swc/counter@0.1.3': + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + + '@swc/helpers@0.5.23': + resolution: {integrity: sha512-5lSsMOTXURePglDfvuAQUqkGek9Hg2kksOYay2m0+XR++b2NWYL/4sWyuvVBIs8oKnJaxkdi9whaL/sqN13afw==} + + '@swc/register@0.1.10': + resolution: {integrity: sha512-6STwH/q4dc3pitXLVkV7sP0Hiy+zBsU2wOF1aXpXR95pnH3RYHKIsDC+gvesfyB7jxNT9OOZgcqOp9RPxVTx9A==} + deprecated: Use @swc-node/register instead + hasBin: true + peerDependencies: + '@swc/core': ^1.0.46 + + '@swc/types@0.1.27': + resolution: {integrity: sha512-K6h3iUlqeM946U4sXFYeahefR1YBbXJvko+hv8WS8/0BNJ4OHiHRywMnQUJCqkR7Y9+hqQ1TvEpiKqUhz7NEFg==} + + '@testing-library/dom@9.3.3': + resolution: {integrity: sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==} + engines: {node: '>=14'} + + '@testing-library/jest-dom@6.1.3': + resolution: {integrity: sha512-YzpjRHoCBWPzpPNtg6gnhasqtE/5O4qz8WCwDEaxtfnPO6gkaLrnuXusrGSPyhIGPezr1HM7ZH0CFaUTY9PJEQ==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + peerDependencies: + '@jest/globals': '>= 28' + '@types/jest': '>= 28' + jest: '>= 28' + vitest: '>= 0.32' + peerDependenciesMeta: + '@jest/globals': + optional: true + '@types/jest': + optional: true + jest: + optional: true + vitest: + optional: true + + '@testing-library/jest-dom@6.9.1': + resolution: {integrity: sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + + '@tootallnate/once@2.0.1': + resolution: {integrity: sha512-HqmEUIGRJ5fSXchkVgR5F7qn48bDBzv0kWj/Kfu5e6uci4UlEeng4331LnBkWffb++Ei3FOVLxo8JJWMFBDMeQ==} + engines: {node: '>= 10'} + + '@tsconfig/node10@1.0.12': + resolution: {integrity: sha512-UCYBaeFvM11aU2y3YPZ//O5Rhj+xKyzy7mvcIoAjASbigy8mHMryP5cK7dgjlz2hWxh1g5pLw084E0a/wlUSFQ==} + + '@tsconfig/node12@1.0.11': + resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==} + + '@tsconfig/node14@1.0.3': + resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==} + + '@tsconfig/node16@1.0.4': + resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==} + + '@tsconfig/node24@24.0.4': + resolution: {integrity: sha512-2A933l5P5oCbv6qSxHs7ckKwobs8BDAe9SJ/Xr2Hy+nDlwmLE1GhFh/g/vXGRZWgxBg9nX/5piDtHR9Dkw/XuA==} + + '@tsconfig/strictest@2.0.8': + resolution: {integrity: sha512-XnQ7vNz5HRN0r88GYf1J9JJjqtZPiHt2woGJOo2dYqyHGGcd6OLGqSlBB6p1j9mpzja6Oe5BoPqWmeDx6X9rLw==} + + '@turbo/darwin-64@2.10.4': + resolution: {integrity: sha512-m1MUEI4MJ69r5CwfMYxmHi0H0rrgiYCBOp0tgBZ9x/YVvOb5uu/lRIDyDwdtH054R2yWeQaIigUGu6aCX9f8cA==} + cpu: [x64] + os: [darwin] + + '@turbo/darwin-arm64@2.10.4': + resolution: {integrity: sha512-VQ1Yxs5zkPT+2z7t1P4mvn6JmcKLkOCAsPuK9XbOvuVj0DlTlETfIXNisX0771v/vTWHOQqiwoGi+TtAUq8efw==} + cpu: [arm64] + os: [darwin] + + '@turbo/linux-64@2.10.4': + resolution: {integrity: sha512-IzV1QovmwX7mfGnVinmE++2IB8tbeo38weltiuH5zNqwCTBjLs/DytyRKx+bmnhHdXIq9SheR8p0Nip/LBUPHg==} + cpu: [x64] + os: [linux] + + '@turbo/linux-arm64@2.10.4': + resolution: {integrity: sha512-rfujSQkP5aYiRn0PgTM7F00WkJCP/bKDVZbOx3WmrZwa/vHA0bplhCl328kpX7VI9HH2vI90ISGwuSVgJgoqTw==} + cpu: [arm64] + os: [linux] + + '@turbo/windows-64@2.10.4': + resolution: {integrity: sha512-NnspP7Wd5fa3Wwnqv9bKfhegqZzuHBgbPxdZU/idTLQcazx/vgKu95JlCx2YHY0hdvKCnPcARrDwM+KEUmaO7A==} + cpu: [x64] + os: [win32] + + '@turbo/windows-arm64@2.10.4': + resolution: {integrity: sha512-Iv02YgOpaEShc2OkG7mgCJ2pEw1RUKiKbs0h8W5wAf4jZ5vpmraTEjuGTgHRuOORQnC1GN3KHo5WB+hu1abRMA==} + cpu: [arm64] + os: [win32] + + '@turnkey/api-key-stamper@0.6.8': + resolution: {integrity: sha512-kBXdNwl7LzqdzfzOtUSZaDf7FOTvD0lK0Ji5CLlPw8CQcXxTjapl9IYdIW7I5oc3r0+UnSrnWZhlNPVzu9k5tw==} + engines: {node: '>=18.0.0'} + + '@turnkey/crypto@2.10.1': + resolution: {integrity: sha512-A9dqEXHIhTNy4t32LodJOTm/I762TjcPAck8gl9E004f73Gz0WCGORnsgiSrSYHAkj4rC4oLUK8rbmRIikGBCQ==} + engines: {node: '>=18.0.0'} + + '@turnkey/crypto@2.8.6': + resolution: {integrity: sha512-Jd1YxOPxSXEYPixe71oyX2ogi5HwWxFLN/V16zl7AAv34xTsHomHmM7C9XUcLRYJY+NiXDHJvvEPkEhu69AH3A==} + engines: {node: '>=18.0.0'} + + '@turnkey/encoding@0.6.0': + resolution: {integrity: sha512-IC8qXvy36+iGAeiaVIuJvB35uU2Ld/RAWI/DRTKS+ttBej0GXhOn48Ouu5mlca4jt8ZEuwXmDVv74A8uBQclsA==} + engines: {node: '>=18.0.0'} + + '@turnkey/http@5.0.0': + resolution: {integrity: sha512-KL8FRWttsHPwciTFfXNv3IBLjr7+ipcTOa0i5PrtvqUv8iEkhHDpiZU9kbaQKnXon4BmkYRfZs2/Dox4DCeOpw==} + engines: {node: '>=18.0.0'} + + '@turnkey/iframe-stamper@2.11.1': + resolution: {integrity: sha512-S9BoAIyVBH1BurTKsX/YzjVrEhW6Zn0A/9WPfhhC9YA/9RDELP4wNL3jUcijJWgT9OO6BRbRDUs81FrC0ruLww==} + engines: {node: '>=18.0.0'} + + '@turnkey/sdk-types@0.9.0': + resolution: {integrity: sha512-xNIU9kZoYkfKTWtfgghW0FtxLqFDMRJRFXNyb+Yht0+MFf2pdkoOpTpKtqzLPE9tMU9QLD8ZGhqfHqHuouluAQ==} + engines: {node: '>=18.0.0'} + + '@turnkey/sdk-types@1.2.0': + resolution: {integrity: sha512-S37cabMXICiM5ZpeRhYDuPuRrtE3GLlsHjasWCusWS7PUOP7Ru+g7HOHHWhb7A390j+NKvz1CJ1z8kvdfC0nvg==} + engines: {node: '>=18.0.0'} + + '@turnkey/webauthn-stamper@0.6.0': + resolution: {integrity: sha512-jdN17QEnn7RBykEOhtKIialWmDjnDAH8DzbyITwn8jsKcwT1TBNYge89hTUTjbdsDLBAqQw8cHujPdy0RaAqvw==} + engines: {node: '>=18.0.0'} + + '@tybys/wasm-util@0.10.3': + resolution: {integrity: sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==} + + '@types/aria-query@5.0.4': + resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} + + '@types/babel__core@7.20.5': + resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} + + '@types/babel__generator@7.27.0': + resolution: {integrity: sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==} + + '@types/babel__template@7.4.4': + resolution: {integrity: sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==} + + '@types/babel__traverse@7.28.0': + resolution: {integrity: sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==} + + '@types/body-parser@1.19.6': + resolution: {integrity: sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g==} + + '@types/bonjour@3.5.13': + resolution: {integrity: sha512-z9fJ5Im06zvUL548KvYNecEVlA7cVDkGUi6kZusb04mpyEFKCIZJvloCcmpmLaIahDpOQGHaHmG6imtPMmPXGQ==} + + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/connect-history-api-fallback@1.5.4': + resolution: {integrity: sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==} + + '@types/connect@3.4.38': + resolution: {integrity: sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/eslint-scope@3.7.7': + resolution: {integrity: sha512-MzMFlSLBqNF2gcHWO0G1vP/YQyfvrxZ0bF+u7mzUdZ1/xK4A4sru+nraZz5i3iEIk1l1uyicaDVTB4QbbEkAYg==} + + '@types/eslint@9.6.1': + resolution: {integrity: sha512-FXx2pKgId/WyYo2jXw63kk7/+TY7u7AziEJxJAnSFzHlqTAS3Ync6SvgYAN/k4/PQpnnVuzoMuVnByKK2qp0ag==} + + '@types/estree@1.0.8': + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} + + '@types/estree@1.0.9': + resolution: {integrity: sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==} + + '@types/express-serve-static-core@4.19.9': + resolution: {integrity: sha512-QP2ESEe/ImWY0HDwNAnK9PvEffUyhLTnWkk7KXzHfyeWAnlrDe1fN77bXl6ia8KT3wPlmA7t9/VPRpnf4Ex9sg==} + + '@types/express@4.17.25': + resolution: {integrity: sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==} + + '@types/graceful-fs@4.1.9': + resolution: {integrity: sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==} + + '@types/html-minifier-terser@6.1.0': + resolution: {integrity: sha512-oh/6byDPnL1zeNXFrDXFLyZjkr1MsBG667IM792caf1L2UPOOMf65NFzjUH/ltyfwjAGfs1rsX1eftK0jC/KIg==} + + '@types/http-errors@2.0.5': + resolution: {integrity: sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg==} + + '@types/http-proxy@1.17.17': + resolution: {integrity: sha512-ED6LB+Z1AVylNTu7hdzuBqOgMnvG/ld6wGCG8wFnAzKX5uyW2K3WD52v0gnLCTK/VLpXtKckgWuyScYK6cSPaw==} + + '@types/istanbul-lib-coverage@2.0.6': + resolution: {integrity: sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==} + + '@types/istanbul-lib-report@3.0.3': + resolution: {integrity: sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==} + + '@types/istanbul-reports@3.0.4': + resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} + + '@types/jest@30.0.0': + resolution: {integrity: sha512-XTYugzhuwqWjws0CVz8QpM36+T+Dz5mTEBKhNs/esGLnCIlGdRy+Dq78NRjd7ls7r8BC8ZRMOrKlkO1hU0JOwA==} + + '@types/jsdom@21.1.7': + resolution: {integrity: sha512-yOriVnggzrnQ3a9OKOCxaVuSug3w3/SbOj5i7VwXWZEyUNl3bLF9V3MfxGbZKuwqJOQyRfqXyROBB1CoZLFWzA==} + + '@types/jsdom@28.0.3': + resolution: {integrity: sha512-/HQ2uFoetFTXuye8vzIcHw2z6Fwi7Hi/qcgC+RoS9NCyewiqxhVGqlG+ViGB6lkax481R6dmhf1I7lIGlzJStQ==} + + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/mime@1.3.5': + resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} + + '@types/node-forge@1.3.14': + resolution: {integrity: sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw==} + + '@types/node@12.20.55': + resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + + '@types/node@26.1.1': + resolution: {integrity: sha512-nxAkRSVkN1Y0JC1W8ky/fTfkGsMmcrRsbx+3XoZE+rMOX71kLYTV7fLXpqud1GpbpP5TuffXFqfX7fH2GgZREw==} + + '@types/qs@6.15.1': + resolution: {integrity: sha512-GZHUBZR9hckSUhrxmp1nG6NwdpM9fCunJwyThLW1X3AyHgd9IlHb6VANpQQqDr2o/qQp6McZ3y/IA2rVzKzSbw==} + + '@types/range-parser@1.2.7': + resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} + + '@types/retry@0.12.2': + resolution: {integrity: sha512-XISRgDJ2Tc5q4TRqvgJtzsRkFYNJzZrhTdtMoGVBttwzzQJkPnS3WWTFc7kuDRoPtPakl+T+OfdEUjYJj7Jbow==} + + '@types/send@0.17.6': + resolution: {integrity: sha512-Uqt8rPBE8SY0RK8JB1EzVOIZ32uqy8HwdxCnoCOsYrvnswqmFZ/k+9Ikidlk/ImhsdvBsloHbAlewb2IEBV/Og==} + + '@types/send@1.2.1': + resolution: {integrity: sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ==} + + '@types/serve-index@1.9.4': + resolution: {integrity: sha512-qLpGZ/c2fhSs5gnYsQxtDEq3Oy8SXPClIXkW5ghvAvsNuVSA8k+gCONcUCS/UjLEYvYps+e8uBtfgXgvhwfNug==} + + '@types/serve-static@1.15.10': + resolution: {integrity: sha512-tRs1dB+g8Itk72rlSI2ZrW6vZg0YrLI81iQSTkMmOqnqCaNr/8Ek4VwWcN5vZgCYWbg/JJSGBlUaYGAOP73qBw==} + + '@types/sockjs@0.3.36': + resolution: {integrity: sha512-MK9V6NzAS1+Ud7JV9lJLFqW85VbC9dq3LmwZCuBe4wBDgKC0Kj/jd8Xl+nSviU+Qc3+m7umHHyHg//2KSa0a0Q==} + + '@types/stack-utils@2.0.3': + resolution: {integrity: sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==} + + '@types/tough-cookie@4.0.5': + resolution: {integrity: sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==} + + '@types/uuid@10.0.0': + resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==} + + '@types/ws@7.4.7': + resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} + + '@types/ws@8.18.1': + resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} + + '@types/yargs-parser@21.0.3': + resolution: {integrity: sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==} + + '@types/yargs@17.0.35': + resolution: {integrity: sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==} + + '@ungap/structured-clone@1.3.2': + resolution: {integrity: sha512-5jsZFwgR5rTdKwidH9Qmat75RKwqfpKlWWB1frDkljN127mwqBu8K0PYo7/hFpF03IEJpfVPpCQDY/eDx3iHvA==} + + '@unrs/resolver-binding-android-arm-eabi@1.12.2': + resolution: {integrity: sha512-g5T90pqg1bo/7mytQx6F4iBNC0Wsh9cu+z9veDbFjc7HjpesJFWD7QMS0NGStXM075+7dJPPVvBbpZlnrdpi/w==} + cpu: [arm] + os: [android] + + '@unrs/resolver-binding-android-arm64@1.12.2': + resolution: {integrity: sha512-YGCRZv/9GLhwmz6mYDeTsm/92BAyR28l6c2ReweVW5pWgfsitWLY8upvfRlGdoyD8HjeTHSYJWyZGD4KJA/nFQ==} + cpu: [arm64] + os: [android] + + '@unrs/resolver-binding-darwin-arm64@1.12.2': + resolution: {integrity: sha512-u9DiNT1auQMO20A9SyTuG3wUgQWB9Z7KjAg0uFuCDR1FsAY8A0CG2S6JpHS1xwm/w1G08bjXZDcyOCjv1WAm2w==} + cpu: [arm64] + os: [darwin] + + '@unrs/resolver-binding-darwin-x64@1.12.2': + resolution: {integrity: sha512-f7rPLi/T1HVKZu/u6t87lroib16n8vrSzcyxI7lg4BGO9UF26KhQL44sd9eOUgrTYhvRXtWOIZT5PejdPyJfUA==} + cpu: [x64] + os: [darwin] + + '@unrs/resolver-binding-freebsd-x64@1.12.2': + resolution: {integrity: sha512-BpcOjWCJub6nRZUS2zA20pmLvjtqAtGejETaIyRLiZiQf++cbrjltLA5NN/xaXfqeOBOSlMFbemIl5/S5tljmg==} + cpu: [x64] + os: [freebsd] + + '@unrs/resolver-binding-linux-arm-gnueabihf@1.12.2': + resolution: {integrity: sha512-vZTDvdSISZjJx66OzJqtsOhzifbqRjbmI1Mnu49fQDwog5GtDI4QidRiEAYbZCRj9C8YZEW+3ZjqsyS9GR4k2A==} + cpu: [arm] + os: [linux] + + '@unrs/resolver-binding-linux-arm-musleabihf@1.12.2': + resolution: {integrity: sha512-BiPI+IrIlwcW4nLLMM21+B1dFPzd55yAVgVGrdgDjNef+ch03GdxrcyaIz8X9SsQirh/kCQ7mviyWlMxdh2D7g==} + cpu: [arm] + os: [linux] + + '@unrs/resolver-binding-linux-arm64-gnu@1.12.2': + resolution: {integrity: sha512-zJc0H99FEPoFfSrNpa91HYfxzfAJCr502oxNK1cfdC9hlaFI43RT+JFCann9JUgZmLzzntChHyn13Sgn9ljHNg==} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-arm64-musl@1.12.2': + resolution: {integrity: sha512-KQ3Lki6l+Pz1k/eBipN41ES+YUK30beLGb9YqcB1O542cyLCNE6GaxrfcY3T6EezmGGk84wb5XyO9loTM9tkcA==} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@unrs/resolver-binding-linux-loong64-gnu@1.12.2': + resolution: {integrity: sha512-3SJGEh1DborhG6pyxvhPzCT4bbSIVihsvgJc13P1bHG7KLdNDaF9T3gsTwFc7Jw/5Y5/iWOjkEx7Zy0NvCGX3Q==} + cpu: [loong64] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-loong64-musl@1.12.2': + resolution: {integrity: sha512-jiuG/Obbel7uw1PwHNFfrkiKhLAF6mnyZ6aWlOAVN9WqKm8v0OFGnciJIHu8+CMvXLQ8AD51LPzAoUfT21D5Ew==} + cpu: [loong64] + os: [linux] + libc: [musl] + + '@unrs/resolver-binding-linux-ppc64-gnu@1.12.2': + resolution: {integrity: sha512-q7xRvVpmcfeL+LlZg8Pbbo6QaTZwDU5BaGZbwfhkEsXJn3Was8xYfE0RBH266xZt0rM6B7i8xAYIvjthuUIWHg==} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-riscv64-gnu@1.12.2': + resolution: {integrity: sha512-0CVdx6lcnT3Q9inOH8tsMIOJ6ImndllMjqJHg8RLVdB7Vq4SfkEXl9mCSsVNuNA4MCYycRicCUxPCabVHJRr6A==} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-riscv64-musl@1.12.2': + resolution: {integrity: sha512-iOwlRo9vnp6R6ohHQS11n0NnfdXx/omhkocmIfaPRpQhKZ+3BDMkkdRVh53qjkFkpPddf+FETA28NwGN7l5l+w==} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@unrs/resolver-binding-linux-s390x-gnu@1.12.2': + resolution: {integrity: sha512-HYJtLfXq94q8iZNFT1lknx258wlkkWhZeUXJRqzKBBUJ00CvZ+N33zgbCqimLjsyw5Va6uUxhVa12mI+kaveEw==} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-x64-gnu@1.12.2': + resolution: {integrity: sha512-mPsUhunKKDih5O96Y6enDQyHc1SqBPlY1E/SfMWDM3EdJ95Z9CArPeCVwCCqbP45ljvivdEk8Fxn+SIb1rDAJQ==} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@unrs/resolver-binding-linux-x64-musl@1.12.2': + resolution: {integrity: sha512-azrt6+5ydLd8Vt210AAFis/lZevSfPw93EJRIJG+xPu4WCJ8K0kppCTpMyLPcKT7H15M4Jnt2tMp5bOvCkRC6A==} + cpu: [x64] + os: [linux] + libc: [musl] + + '@unrs/resolver-binding-openharmony-arm64@1.12.2': + resolution: {integrity: sha512-YZ9hP4O0X9PQb8eO980qmLNGH4zT3I9+SZTdt0Pr0YyuGQhYKoOZkV02VzrzyOZJ5xIJ3UFIenKkUkGg8GjgWQ==} + cpu: [arm64] + os: [openharmony] + + '@unrs/resolver-binding-wasm32-wasi@1.12.2': + resolution: {integrity: sha512-tYFDIkMxSflfEc/h92ZWNsZlHSwgimbNHSO3PL2JWQHfCuC2q316jMyYU9TIWZsFK2bQwyK5VAdYgn8ygPj69A==} + engines: {node: '>=14.0.0'} + cpu: [wasm32] + + '@unrs/resolver-binding-win32-arm64-msvc@1.12.2': + resolution: {integrity: sha512-qzNyg3xL0VPQmCaUh+N5jSitce6k+uCBfMDesWRnlULOZaqUkaJ0ybdT+UqlAWJoQjuqfIU/0Ptx9bteN4D82g==} + cpu: [arm64] + os: [win32] + + '@unrs/resolver-binding-win32-ia32-msvc@1.12.2': + resolution: {integrity: sha512-WD9sY00OfpHVGfsnHZoA8jVT+esS/Bg8z8jzxp5BnDCjjwsuKsPQrzswwpFy4J1AUJbXPRfkpcX0mXrzeXW79g==} + cpu: [ia32] + os: [win32] + + '@unrs/resolver-binding-win32-x64-msvc@1.12.2': + resolution: {integrity: sha512-nAB74NfSNKknqQ1RrYj6uz8FcXEomu/MATJZxh/x+BArzN2U3JbOYC0APYzUIGhVY3m5hRxA8VPNdPBoG8txlA==} + cpu: [x64] + os: [win32] + + '@vitest/browser-playwright@4.1.10': + resolution: {integrity: sha512-nMoXGEiRpT7m3W7NsbvrM2aKNwiNHZf+zEpUCvMteGjZFvfT96Q9fh7QyB98dvDWXiKvrLxA7bJ1mCOOv+JQPw==} + peerDependencies: + playwright: '*' + vitest: 4.1.10 + + '@vitest/browser@4.1.10': + resolution: {integrity: sha512-UDwuWGwXj646CBx/bQHOaJSX7np0I8JL/UKQYa1e4QrVHH8VdWtx8eaOuf8sy0ShwDgR6NjJAsp5eF6vjF6qng==} + peerDependencies: + vitest: 4.1.10 + + '@vitest/expect@4.1.10': + resolution: {integrity: sha512-YsCn+qAk1GWjQOWFEsEcL2gNQ0zmVmQu3T03qP6UyjhtmdtwtbuI+DASn/7iQB3HGTXkdBwGddzxPlmiql5vlA==} + + '@vitest/mocker@4.1.10': + resolution: {integrity: sha512-v0xaezt+DKEmKfaxg133ldzADrwLGd7Ze1MfQQTYfvs8OqZIwbxyxaYURivwV7sWy5fqn3rH5uOrSp07bp44Ow==} + peerDependencies: + msw: ^2.4.9 + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@4.1.10': + resolution: {integrity: sha512-W1HsjSH4MXQ9YfmmhLAoIYf1HRfekQCGngeIgcei6MP5QQGWUe0gkopdZQaVCFO+JDJMrAJGwa5pRpNpvy4P8Q==} + + '@vitest/runner@4.1.10': + resolution: {integrity: sha512-IKI6kpIH+LmpROplyLwBBaCfMgOZOMsygVa6BARD6ahA04VRuJSa6OaVG7kRvSEMD870Vd91rSSw0eegtWyLGg==} + + '@vitest/snapshot@4.1.10': + resolution: {integrity: sha512-xRkfOT1qpTAi/Ti4Y1LtfRc3kEuqxGw59eN2jN9pRWMtS/XDevekhcFSqvQqjUNGksfjMJu3Y+oJ+4Ypn2OaJw==} + + '@vitest/spy@4.1.10': + resolution: {integrity: sha512-PLf/Ugvoq5wO/b4rwYCR1h2PSIdXz7wnkQFMiUpLdtM7l6pqVFcQIBEHyT1+l+cj7mNwAfZHzqXqDyjvOuwbDw==} + + '@vitest/utils@4.1.10': + resolution: {integrity: sha512-fy9am/HWxbaGt/Sawrp90vt6Y6jQwf1RX77cz3uwoJwJVMli/e1IEwRPnMNJ7vKfPTwo0diXifkpPvwH9v7nGA==} + + '@webassemblyjs/ast@1.14.1': + resolution: {integrity: sha512-nuBEDgQfm1ccRp/8bCQrx1frohyufl4JlbMMZ4P1wpeOfDhF6FQkxZJ1b/e+PLwr6X1Nhw6OLme5usuBWYBvuQ==} + + '@webassemblyjs/floating-point-hex-parser@1.13.2': + resolution: {integrity: sha512-6oXyTOzbKxGH4steLbLNOu71Oj+C8Lg34n6CqRvqfS2O71BxY6ByfMDRhBytzknj9yGUPVJ1qIKhRlAwO1AovA==} + + '@webassemblyjs/helper-api-error@1.13.2': + resolution: {integrity: sha512-U56GMYxy4ZQCbDZd6JuvvNV/WFildOjsaWD3Tzzvmw/mas3cXzRJPMjP83JqEsgSbyrmaGjBfDtV7KDXV9UzFQ==} + + '@webassemblyjs/helper-buffer@1.14.1': + resolution: {integrity: sha512-jyH7wtcHiKssDtFPRB+iQdxlDf96m0E39yb0k5uJVhFGleZFoNw1c4aeIcVUPPbXUVJ94wwnMOAqUHyzoEPVMA==} + + '@webassemblyjs/helper-numbers@1.13.2': + resolution: {integrity: sha512-FE8aCmS5Q6eQYcV3gI35O4J789wlQA+7JrqTTpJqn5emA4U2hvwJmvFRC0HODS+3Ye6WioDklgd6scJ3+PLnEA==} + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': + resolution: {integrity: sha512-3QbLKy93F0EAIXLh0ogEVR6rOubA9AoZ+WRYhNbFyuB70j3dRdwH9g+qXhLAO0kiYGlg3TxDV+I4rQTr/YNXkA==} + + '@webassemblyjs/helper-wasm-section@1.14.1': + resolution: {integrity: sha512-ds5mXEqTJ6oxRoqjhWDU83OgzAYjwsCV8Lo/N+oRsNDmx/ZDpqalmrtgOMkHwxsG0iI//3BwWAErYRHtgn0dZw==} + + '@webassemblyjs/ieee754@1.13.2': + resolution: {integrity: sha512-4LtOzh58S/5lX4ITKxnAK2USuNEvpdVV9AlgGQb8rJDHaLeHciwG4zlGr0j/SNWlr7x3vO1lDEsuePvtcDNCkw==} + + '@webassemblyjs/leb128@1.13.2': + resolution: {integrity: sha512-Lde1oNoIdzVzdkNEAWZ1dZ5orIbff80YPdHx20mrHwHrVNNTjNr8E3xz9BdpcGqRQbAEa+fkrCb+fRFTl/6sQw==} + + '@webassemblyjs/utf8@1.13.2': + resolution: {integrity: sha512-3NQWGjKTASY1xV5m7Hr0iPeXD9+RDobLll3T9d2AO+g3my8xy5peVyjSag4I50mR1bBSN/Ct12lo+R9tJk0NZQ==} + + '@webassemblyjs/wasm-edit@1.14.1': + resolution: {integrity: sha512-RNJUIQH/J8iA/1NzlE4N7KtyZNHi3w7at7hDjvRNm5rcUXa00z1vRz3glZoULfJ5mpvYhLybmVcwcjGrC1pRrQ==} + + '@webassemblyjs/wasm-gen@1.14.1': + resolution: {integrity: sha512-AmomSIjP8ZbfGQhumkNvgC33AY7qtMCXnN6bL2u2Js4gVCg8fp735aEiMSBbDR7UQIj90n4wKAFUSEd0QN2Ukg==} + + '@webassemblyjs/wasm-opt@1.14.1': + resolution: {integrity: sha512-PTcKLUNvBqnY2U6E5bdOQcSM+oVP/PmrDY9NzowJjislEjwP/C4an2303MCVS2Mg9d3AJpIGdUFIQQWbPds0Sw==} + + '@webassemblyjs/wasm-parser@1.14.1': + resolution: {integrity: sha512-JLBl+KZ0R5qB7mCnud/yyX08jWFw5MsoalJ1pQ4EdFlgj9VdXKGuENGsiCIjegI1W7p91rUlcB/LB5yRJKNTcQ==} + + '@webassemblyjs/wast-printer@1.14.1': + resolution: {integrity: sha512-kPSSXE6De1XOR820C90RIo2ogvZG+c3KiHzqUoO/F34Y2shGzesfqv7o57xrxovZJH/MetF5UjroJ/R/3isoiw==} + + '@webpack-cli/configtest@2.1.1': + resolution: {integrity: sha512-wy0mglZpDSiSS0XHrVR+BAdId2+yxPSoJW8fsna3ZpYSlufjvxnP4YbKTCBZnNIcGN4r6ZPXV55X4mYExOfLmw==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/info@2.0.2': + resolution: {integrity: sha512-zLHQdI/Qs1UyT5UBdWNqsARasIA+AaF8t+4u2aS2nEpBQh2mWIVb8qAklq0eUENnC5mOItrIB4LiS9xMtph18A==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + + '@webpack-cli/serve@2.0.5': + resolution: {integrity: sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ==} + engines: {node: '>=14.15.0'} + peerDependencies: + webpack: 5.x.x + webpack-cli: 5.x.x + webpack-dev-server: '*' + peerDependenciesMeta: + webpack-dev-server: + optional: true + + '@xtuc/ieee754@1.2.0': + resolution: {integrity: sha512-DX8nKgqcGwsc0eJSqYt5lwP4DH5FlHnmuWWBRy7X0NcaGR0ZtuyeESgMwTYVEtxmsNGY+qit4QYT/MIYTOTPeA==} + + '@xtuc/long@4.2.2': + resolution: {integrity: sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==} + + '@zeit/schemas@2.36.0': + resolution: {integrity: sha512-7kjMwcChYEzMKjeex9ZFXkt1AyNov9R5HZtjBKVsmVpw7pa7ZtlCGvCBC2vnnXctaYN+aRI61HjIqeetZW5ROg==} + + abab@2.0.6: + resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==} + deprecated: Use your platform's native atob() and btoa() methods instead + + abitype@1.2.3: + resolution: {integrity: sha512-Ofer5QUnuUdTFsBRwARMoWKOH1ND5ehwYhJ3OJ/BQO+StkwQjHw0XyVh4vDttzHB7QOFhPHa/o413PJ82gU/Tg==} + peerDependencies: + typescript: '>=5.0.4' + zod: ^3.22.0 || ^4.0.0 + peerDependenciesMeta: + typescript: + optional: true + zod: + optional: true + + accepts@1.3.8: + resolution: {integrity: sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==} + engines: {node: '>= 0.6'} + + acorn-import-phases@1.0.4: + resolution: {integrity: sha512-wKmbr/DDiIXzEOiWrTTUcDm24kQ2vGfZQvM2fwg2vXqR5uW6aapr7ObPtj1th32b9u90/Pf4AItvdTh42fBmVQ==} + engines: {node: '>=10.13.0'} + peerDependencies: + acorn: ^8.14.0 + + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 + + acorn-walk@8.3.5: + resolution: {integrity: sha512-HEHNfbars9v4pgpW6SO1KSPkfoS0xVOM/9UzkJltjlsHZmJasxg8aXkuZa7SMf8vKGIBhpUsPluQSqhJFCqebw==} + engines: {node: '>=0.4.0'} + + acorn@8.17.0: + resolution: {integrity: sha512-xRQbDb9BnwDafYNn6Vwl839DYVjqXYb1XVGtWAZ1kcDc6iwAL4hg3B1dZlRiuENFeO2H53gFG3in621AdERVAg==} + engines: {node: '>=0.4.0'} + hasBin: true + + agent-base@6.0.2: + resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} + engines: {node: '>= 6.0.0'} + + agent-base@7.1.4: + resolution: {integrity: sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==} + engines: {node: '>= 14'} + + agentkeepalive@4.6.0: + resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==} + engines: {node: '>= 8.0.0'} + + ajv-formats@2.1.1: + resolution: {integrity: sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==} + peerDependencies: + ajv: ^8.0.0 + peerDependenciesMeta: + ajv: + optional: true + + ajv-keywords@5.1.0: + resolution: {integrity: sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==} + peerDependencies: + ajv: ^8.8.2 + + ajv@6.15.0: + resolution: {integrity: sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==} + + ajv@8.12.0: + resolution: {integrity: sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==} + + ajv@8.20.0: + resolution: {integrity: sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA==} + + ansi-align@3.0.1: + resolution: {integrity: sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==} + + ansi-escapes@4.3.2: + resolution: {integrity: sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==} + engines: {node: '>=8'} + + ansi-html-community@0.0.8: + resolution: {integrity: sha512-1APHAyr3+PCamwNw3bXCPp4HFLONZt/yIH0sZp0/469KWNTEy+qN5jQ3GVX6DMZ1UXAi34yVwtTeaG/HpBuuzw==} + engines: {'0': node >= 0.8.0} + hasBin: true + + ansi-regex@5.0.1: + resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} + engines: {node: '>=8'} + + ansi-regex@6.2.2: + resolution: {integrity: sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==} + engines: {node: '>=12'} + + ansi-styles@4.3.0: + resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==} + engines: {node: '>=8'} + + ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + + ansi-styles@6.2.3: + resolution: {integrity: sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==} + engines: {node: '>=12'} + + anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + + arch@2.2.0: + resolution: {integrity: sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ==} + + arg@4.1.3: + resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + + arg@5.0.2: + resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==} + + argparse@1.0.10: + resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} + + argparse@2.0.1: + resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} + + aria-query@5.1.3: + resolution: {integrity: sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==} + + aria-query@5.3.2: + resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} + engines: {node: '>= 0.4'} + + array-buffer-byte-length@1.0.2: + resolution: {integrity: sha512-LHE+8BuR7RYGDKvnrmcuSq3tDcKv9OFEXQt/HpbZhY7V6h0zlUXutnAD82GiFx9rdieCMjkvtcsPqBwgUl1Iiw==} + engines: {node: '>= 0.4'} + + array-flatten@1.1.1: + resolution: {integrity: sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==} + + asn1.js@4.10.1: + resolution: {integrity: sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==} + + asn1js@3.0.10: + resolution: {integrity: sha512-S2s3aOytiKdFRdulw2qPE51MzjzVOisppcVv7jVFR+Kw0kxwvFrDcYA0h7Ndqbmj0HkMIXYWaoj7fli8kgx1eg==} + engines: {node: '>=12.0.0'} + + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + + asynckit@0.4.0: + resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} + + available-typed-arrays@1.0.7: + resolution: {integrity: sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ==} + engines: {node: '>= 0.4'} + + babel-jest@29.7.0: + resolution: {integrity: sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.8.0 + + babel-jest@30.4.1: + resolution: {integrity: sha512-fATAbM8piYxkiXQp3RBXmZHxZVNJZAVXXfyeyCN2Tida3+qJ8ea9UxhiJ2y4fLO90ZImKt6k9FlcH2+rLkJGhw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@babel/core': ^7.11.0 || ^8.0.0-0 + + babel-loader@9.1.3: + resolution: {integrity: sha512-xG3ST4DglodGf8qSwv0MdeWLhrDsw/32QMdTO5T1ZIp9gQur0HkCyFs7Awskr10JKXFXwpAhiCuYX5oGXnRGbw==} + engines: {node: '>= 14.15.0'} + peerDependencies: + '@babel/core': ^7.12.0 + webpack: '>=5' + + babel-plugin-istanbul@6.1.1: + resolution: {integrity: sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==} + engines: {node: '>=8'} + + babel-plugin-istanbul@7.0.1: + resolution: {integrity: sha512-D8Z6Qm8jCvVXtIRkBnqNHX0zJ37rQcFJ9u8WOS6tkYOsRdHBzypCstaxWiu5ZIlqQtviRYbgnRLSoCEvjqcqbA==} + engines: {node: '>=12'} + + babel-plugin-jest-hoist@29.6.3: + resolution: {integrity: sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + babel-plugin-jest-hoist@30.4.0: + resolution: {integrity: sha512-9EdtWM/sSfXLOGLwSn+GS6pIXyBnL07/8gyJlwFXjWy4DxMOyItqyUT29d4lQiS380EZwYlX7/At4PgBS+m2aA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + babel-plugin-polyfill-corejs2@0.4.17: + resolution: {integrity: sha512-aTyf30K/rqAsNwN76zYrdtx8obu0E4KoUME29B1xj+B3WxgvWkp943vYQ+z8Mv3lw9xHXMHpvSPOBxzAkIa94w==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + babel-plugin-polyfill-corejs3@0.8.7: + resolution: {integrity: sha512-KyDvZYxAzkC0Aj2dAPyDzi2Ym15e5JKZSK+maI7NAwSqofvuFglbSsxE7wUOvTg9oFVnHMzVzBKcqEb4PJgtOA==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + babel-plugin-polyfill-regenerator@0.5.5: + resolution: {integrity: sha512-OJGYZlhLqBh2DDHeqAxWB1XIvr49CxiJ2gIt61/PU55CQK4Z58OzMqjDe1zwQdQk+rBYsRc+1rJmdajM3gimHg==} + peerDependencies: + '@babel/core': ^7.4.0 || ^8.0.0-0 <8.0.0 + + babel-preset-current-node-syntax@1.2.0: + resolution: {integrity: sha512-E/VlAEzRrsLEb2+dv8yp3bo4scof3l9nR4lrld+Iy5NyVqgVYUJnDAmunkhPMisRI32Qc4iRiz425d8vM++2fg==} + peerDependencies: + '@babel/core': ^7.0.0 || ^8.0.0-0 + + babel-preset-jest@29.6.3: + resolution: {integrity: sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@babel/core': ^7.0.0 + + babel-preset-jest@30.4.0: + resolution: {integrity: sha512-lBY4jxsNmCnSiu7kquw8ZC9F4+XLMOKypT3RnNHPvU2Kpd4W0xaPuLr5ZkRyOsvLYAY4yaW1ZwTW4xB7NIiZzg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@babel/core': ^7.11.0 || ^8.0.0-beta.1 + + balanced-match@1.0.2: + resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} + + base-x@3.0.11: + resolution: {integrity: sha512-xz7wQ8xDhdyP7tQxwdteLYeFfS68tSMNCZ/Y37WJ4bhGfKPpqEIlmIyueQHqOyoPhE6xNUqjzRr8ra0eF9VRvA==} + + base-x@5.0.1: + resolution: {integrity: sha512-M7uio8Zt++eg3jPj+rHMfCC+IuygQHHCOU+IYsVtik6FWjuYpVt/+MRKcgsAMHh8mMFAwnB+Bs+mTrFiXjMzKg==} + + base64-js@1.5.1: + resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} + + baseline-browser-mapping@2.10.42: + resolution: {integrity: sha512-c/jurFrDLyui7o1J86yLkRu4LMsTYcBohveus7/I2Hzdn9KIP2bdJPTue/lR1KH46enoPbD77GKeSYNdyPoD3Q==} + engines: {node: '>=6.0.0'} + hasBin: true + + batch@0.6.1: + resolution: {integrity: sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==} + + bech32@2.0.0: + resolution: {integrity: sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==} + + binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + + bn.js@4.12.5: + resolution: {integrity: sha512-3aRg6/JxfffFD+OlOjOFR3Vo79l39ooBTFucxx+MT3dhCtzn3EmiUPQo+6/OZuI2jbXi3YKgmiTFBgChQMwIRQ==} + + bn.js@5.2.5: + resolution: {integrity: sha512-Vq886eXykuP5E6HcKSSStP3bJgrE6In5WKxVUvJ8XGpWWYs2xZHWqUwzCtGgEtBcxyd57KBFDPFoUfNzdaHCNg==} + + body-parser@1.20.6: + resolution: {integrity: sha512-p5tAzS57i5MV9fZFDj9LeIiTZEufbSe2eDozP+ElheSUq1m74CRq1jI4mYNDdVs9vQztXFLuk/Gd6BWTdwRJ5g==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + + bonjour-service@1.4.3: + resolution: {integrity: sha512-2Kd5UYlFUVgAKMTyuBLl6w49wqfOnbxHqmuH0oCl/n7TfAikR0zoowNOP5BU4dfXmm+Vr9JyEN370auSMx+CNg==} + + boolbase@1.0.0: + resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} + + borsh@0.7.0: + resolution: {integrity: sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==} + + borsh@2.0.0: + resolution: {integrity: sha512-kc9+BgR3zz9+cjbwM8ODoUB4fs3X3I5A/HtX7LZKxCLaMrEeDFoBpnhZY//DTS1VZBSs6S5v46RZRbZjRFspEg==} + + boxen@7.0.0: + resolution: {integrity: sha512-j//dBVuyacJbvW+tvZ9HuH03fZ46QcaKvvhZickZqtB271DxJ7SNRSNxrV/dZX0085m7hISRZWbzWlJvx/rHSg==} + engines: {node: '>=14.16'} + + brace-expansion@1.1.16: + resolution: {integrity: sha512-IDw48K2/2kRkg9LdJxurvq3lV3aBgq0REY89duEqFRthjlPdXHKMj7EnQOXVckxzgisinf3nHfrcE2FufFLXMw==} + + brace-expansion@2.1.2: + resolution: {integrity: sha512-w5JZcKgdhDOgOwm8H+KgbosopHMuGcl6qbulwjtz3SM7I7P3yW1eAjzMPLrIE+NQ9vjgANKHWeMHnrT0OXW1oA==} + + braces@3.0.3: + resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} + engines: {node: '>=8'} + + brorand@1.1.0: + resolution: {integrity: sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==} + + browserify-aes@1.2.0: + resolution: {integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==} + + browserify-cipher@1.0.1: + resolution: {integrity: sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==} + + browserify-des@1.0.2: + resolution: {integrity: sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==} + + browserify-rsa@4.1.1: + resolution: {integrity: sha512-YBjSAiTqM04ZVei6sXighu679a3SqWORA3qZTEqZImnlkDIFtKc6pNutpjyZ8RJTjQtuYfeetkxM11GwoYXMIQ==} + engines: {node: '>= 0.10'} + + browserify-sign@4.2.6: + resolution: {integrity: sha512-sd+Q65fjlWCYWtZKXiKfrUc8d+4jtp/8f0W2NkwzLtoW4bI6UDnWusLWIurHnmurW0XShIRxpwiOX4EoPtXUAg==} + engines: {node: '>= 0.10'} + + browserslist@4.28.5: + resolution: {integrity: sha512-Cu2E6QejHWzuDMTkuwgpABFgDfZrXLQq5V13YOACZx4mFAG4IwGTbTfHPMr4WtxlHoXSM8FIuRwYYCz5XiabaQ==} + engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} + hasBin: true + + bs-logger@0.2.6: + resolution: {integrity: sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==} + engines: {node: '>= 6'} + + bs58@4.0.1: + resolution: {integrity: sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==} + + bs58@6.0.0: + resolution: {integrity: sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==} + + bs58check@4.0.0: + resolution: {integrity: sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g==} + + bser@2.1.1: + resolution: {integrity: sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==} + + buffer-from@1.1.2: + resolution: {integrity: sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==} + + buffer-xor@1.0.3: + resolution: {integrity: sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ==} + + buffer@6.0.3: + resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} + + bufferutil@4.1.0: + resolution: {integrity: sha512-ZMANVnAixE6AWWnPzlW2KpUrxhm9woycYvPOo67jWHyFowASTEd9s+QN1EIMsSDtwhIxN4sWE1jotpuDUIgyIw==} + engines: {node: '>=6.14.2'} + + bundle-name@4.1.0: + resolution: {integrity: sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==} + engines: {node: '>=18'} + + bytes@3.0.0: + resolution: {integrity: sha512-pMhOfFDPiv9t5jjIXkHosWmkSyQbvsgEVNkz0ERHbuLh2T/7j4Mqqpz523Fe8MVY89KC6Sh/QfS2sM+SjgFDcw==} + engines: {node: '>= 0.8'} + + bytes@3.1.2: + resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==} + engines: {node: '>= 0.8'} + + call-bind-apply-helpers@1.0.2: + resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} + engines: {node: '>= 0.4'} + + call-bind@1.0.9: + resolution: {integrity: sha512-a/hy+pNsFUTR+Iz8TCJvXudKVLAnz/DyeSUo10I5yvFDQJBFU2s9uqQpoSrJlroHUKoKqzg+epxyP9lqFdzfBQ==} + engines: {node: '>= 0.4'} + + call-bound@1.0.4: + resolution: {integrity: sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==} + engines: {node: '>= 0.4'} + + callsites@3.1.0: + resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} + engines: {node: '>=6'} + + camel-case@4.1.2: + resolution: {integrity: sha512-gxGWBrTT1JuMx6R+o5PTXMmUnhnVzLQ9SNutD4YqKtI6ap897t3tKECYla6gCWEkplXnlNybEkZg9GEGxKFCgw==} + + camelcase@5.3.1: + resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==} + engines: {node: '>=6'} + + camelcase@6.3.0: + resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==} + engines: {node: '>=10'} + + camelcase@7.0.1: + resolution: {integrity: sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==} + engines: {node: '>=14.16'} + + caniuse-lite@1.0.30001803: + resolution: {integrity: sha512-g/uHREV2ZpK9qMalCsWaxmA6ol+DX8GYhuf3T40RKoP+oL7vhRJh8LNt73PCjpnR6l14FzfPrB5Yux4PKm2meg==} + + cbor-js@0.1.0: + resolution: {integrity: sha512-7sQ/TvDZPl7csT1Sif9G0+MA0I0JOVah8+wWlJVQdVEgIbCzlN/ab3x+uvMNsc34TUvO6osQTAmB2ls80JX6tw==} + + chai@6.2.2: + resolution: {integrity: sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==} + engines: {node: '>=18'} + + chalk-template@0.4.0: + resolution: {integrity: sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==} + engines: {node: '>=12'} + + chalk@3.0.0: + resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} + engines: {node: '>=8'} + + chalk@4.1.2: + resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} + engines: {node: '>=10'} + + chalk@5.0.1: + resolution: {integrity: sha512-Fo07WOYGqMfCWHOzSXOt2CxDbC6skS/jO9ynEcmpANMoPrD+W1r1K6Vx7iNm+AQmETU1Xr2t+n8nzkV9t6xh3w==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + chalk@5.6.2: + resolution: {integrity: sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==} + engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} + + char-regex@1.0.2: + resolution: {integrity: sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==} + engines: {node: '>=10'} + + chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + + chrome-trace-event@1.0.4: + resolution: {integrity: sha512-rNjApaLzuwaOTjCiT8lSDdGN1APCiqkChLMJxJPWLunPAt5fy8xgU9/jNOchV84wfIxrA0lRQB7oCT8jrn/wrQ==} + engines: {node: '>=6.0'} + + ci-info@3.9.0: + resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} + engines: {node: '>=8'} + + ci-info@4.4.0: + resolution: {integrity: sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==} + engines: {node: '>=8'} + + cipher-base@1.0.7: + resolution: {integrity: sha512-Mz9QMT5fJe7bKI7MH31UilT5cEK5EHHRCccw/YRFsRY47AuNgaV6HY3rscp0/I4Q+tTW/5zoqpSeRRI54TkDWA==} + engines: {node: '>= 0.10'} + + cjs-module-lexer@1.4.3: + resolution: {integrity: sha512-9z8TZaGM1pfswYeXrUpzPrkx8UnWYdhJclsiYMm6x/w5+nN+8Tf/LnAgfLGQCm59qAOxU8WwHEq2vNwF6i4j+Q==} + + cjs-module-lexer@2.2.0: + resolution: {integrity: sha512-4bHTS2YuzUvtoLjdy+98ykbNB5jS0+07EvFNXerqZQJ89F7DI6ET7OQo/HJuW6K0aVsKA9hj9/RVb2kQVOrPDQ==} + + clean-css@5.3.3: + resolution: {integrity: sha512-D5J+kHaVb/wKSFcyyV75uCn8fiY4sV38XJoe4CUyGQ+mOU/fMVYUdH1hJC+CJQ5uY3EnW27SbJYS4X8BiLrAFg==} + engines: {node: '>= 10.0'} + + cli-boxes@3.0.0: + resolution: {integrity: sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==} + engines: {node: '>=10'} + + clipboardy@3.0.0: + resolution: {integrity: sha512-Su+uU5sr1jkUy1sGRpLKjKrvEOVXgSgiSInwa/qeID6aJ07yh+5NWc3h2QfjHjBnfX4LhtFcuAWKUsJ3r+fjbg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + cliui@8.0.1: + resolution: {integrity: sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==} + engines: {node: '>=12'} + + clone-deep@4.0.1: + resolution: {integrity: sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==} + engines: {node: '>=6'} + + co@4.6.0: + resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} + engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} + + collect-v8-coverage@1.0.3: + resolution: {integrity: sha512-1L5aqIkwPfiodaMgQunkF1zRhNqifHBmtbbbxcr6yVxxBnliw4TDOW6NxpO8DJLgJ16OT+Y4ztZqP6p/FtXnAw==} + + color-convert@2.0.1: + resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} + engines: {node: '>=7.0.0'} + + color-name@1.1.4: + resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} + + colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + + combined-stream@1.0.8: + resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} + engines: {node: '>= 0.8'} + + commander@10.0.1: + resolution: {integrity: sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==} + engines: {node: '>=14'} + + commander@14.0.3: + resolution: {integrity: sha512-H+y0Jo/T1RZ9qPP4Eh1pkcQcLRglraJaSLoyOtHxu6AapkjWVCy2Sit1QQ4x3Dng8qDlSsZEet7g5Pq06MvTgw==} + engines: {node: '>=20'} + + commander@2.20.3: + resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} + + commander@8.3.0: + resolution: {integrity: sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==} + engines: {node: '>= 12'} + + common-path-prefix@3.0.0: + resolution: {integrity: sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w==} + + compressible@2.0.18: + resolution: {integrity: sha512-AF3r7P5dWxL8MxyITRMlORQNaOA2IkAFaTr4k7BUumjPtRpGDTZpl0Pb1XCO6JeDCBdp126Cgs9sMxqSjgYyRg==} + engines: {node: '>= 0.6'} + + compression@1.8.1: + resolution: {integrity: sha512-9mAqGPHLakhCLeNyxPkK4xVo746zQ/czLH1Ky+vkitMnWfWZps8r0qXuwhwizagCRttsL4lfG4pIOvaWLpAP0w==} + engines: {node: '>= 0.8.0'} + + concat-map@0.0.1: + resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + + connect-history-api-fallback@2.0.0: + resolution: {integrity: sha512-U73+6lQFmfiNPrYbXqr6kZ1i1wiRqXnp2nhMsINseWXO8lDau0LGEffJ8kQi4EjLZympVgRdvqjAgiZ1tgzDDA==} + engines: {node: '>=0.8'} + + content-disposition@0.5.2: + resolution: {integrity: sha512-kRGRZw3bLlFISDBgwTSA1TMBFN6J6GWDeubmDE3AF+3+yXL8hTWv8r5rkLbqYXY4RjPk/EzHnClI3zQf1cFmHA==} + engines: {node: '>= 0.6'} + + content-disposition@0.5.4: + resolution: {integrity: sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==} + engines: {node: '>= 0.6'} + + content-type@1.0.5: + resolution: {integrity: sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==} + engines: {node: '>= 0.6'} + + convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + + cookie-signature@1.0.7: + resolution: {integrity: sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==} + + cookie@0.7.2: + resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} + engines: {node: '>= 0.6'} + + copy-webpack-plugin@11.0.0: + resolution: {integrity: sha512-fX2MWpamkW0hZxMEg0+mYnA40LTosOSa5TqZ9GYIBzyJa9C3QUaMPSE2xAi/buNr8u89SfD9wHSQVBzrRa/SOQ==} + engines: {node: '>= 14.15.0'} + peerDependencies: + webpack: ^5.1.0 + + core-js-compat@3.49.0: + resolution: {integrity: sha512-VQXt1jr9cBz03b331DFDCCP90b3fanciLkgiOoy8SBHy06gNf+vQ1A3WFLqG7I8TipYIKeYK9wxd0tUrvHcOZA==} + + core-util-is@1.0.3: + resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} + + create-ecdh@4.0.4: + resolution: {integrity: sha512-mf+TCx8wWc9VpuxfP2ht0iSISLZnt0JgWlrOKZiNqyUZWnjIaCIVNQArMHnCZKfEYRg6IM7A+NeJoN8gf/Ws0A==} + + create-hash@1.2.0: + resolution: {integrity: sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==} + + create-hmac@1.1.7: + resolution: {integrity: sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==} + + create-jest@29.7.0: + resolution: {integrity: sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + + create-require@1.1.1: + resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + + cross-fetch@3.2.0: + resolution: {integrity: sha512-Q+xVJLoGOeIMXZmbUK4HYk+69cQH6LudR0Vu/pRm2YlU/hDV9CiS0gKUMaWY5f2NeUH9C1nV3bsTlCo0FsTV1Q==} + + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + + crypto-browserify@3.12.1: + resolution: {integrity: sha512-r4ESw/IlusD17lgQi1O20Fa3qNnsckR126TdUuBgAu7GBYSIPvdNyONd3Zrxh0xCwA4+6w/TDArBPsMvhur+KQ==} + engines: {node: '>= 0.10'} + + css-loader@6.8.1: + resolution: {integrity: sha512-xDAXtEVGlD0gJ07iclwWVkLoZOpEvAWaSyf6W18S2pOC//K8+qUDIx8IIT3D+HjnmkJPQeesOPv5aiUaJsCM2g==} + engines: {node: '>= 12.13.0'} + peerDependencies: + webpack: ^5.0.0 + + css-select@4.3.0: + resolution: {integrity: sha512-wPpOYtnsVontu2mODhA19JrqWxNsfdatRKd64kmpRbQgh1KtItko5sTnEpPdpSaJszTOhEMlF/RPz28qj4HqhQ==} + + css-what@6.2.2: + resolution: {integrity: sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==} + engines: {node: '>= 6'} + + css.escape@1.5.1: + resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} + + cssesc@3.0.0: + resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} + engines: {node: '>=4'} + hasBin: true + + cssstyle@3.0.0: + resolution: {integrity: sha512-N4u2ABATi3Qplzf0hWbVCdjenim8F3ojEXpBDF5hBpjzW182MjNGLqfmQ0SkSPeQ+V86ZXgeH8aXj6kayd4jgg==} + engines: {node: '>=14'} + + cssstyle@4.6.0: + resolution: {integrity: sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==} + engines: {node: '>=18'} + + data-urls@4.0.0: + resolution: {integrity: sha512-/mMTei/JXPqvFqQtfyTowxmJVwr2PVAeCcDxyFf6LhoOu/09TX2OX3kb2wzi4DMXcfj4OItwDOnhl5oziPnT6g==} + engines: {node: '>=14'} + + data-urls@5.0.0: + resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} + engines: {node: '>=18'} + + debug@2.6.9: + resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + decimal.js@10.6.0: + resolution: {integrity: sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==} + + dedent@1.7.2: + resolution: {integrity: sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==} + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + + deep-equal@2.2.3: + resolution: {integrity: sha512-ZIwpnevOurS8bpT4192sqAowWM76JDKSHYzMLty3BZGSswgq6pBaH3DhCSW5xVAZICZyKdOBPjwww5wfgT/6PA==} + engines: {node: '>= 0.4'} + + deep-extend@0.6.0: + resolution: {integrity: sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==} + engines: {node: '>=4.0.0'} + + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + + deepmerge@4.3.1: + resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} + engines: {node: '>=0.10.0'} + + default-browser-id@5.0.1: + resolution: {integrity: sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==} + engines: {node: '>=18'} + + default-browser@5.5.0: + resolution: {integrity: sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==} + engines: {node: '>=18'} + + define-data-property@1.1.4: + resolution: {integrity: sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==} + engines: {node: '>= 0.4'} + + define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + + define-properties@1.2.1: + resolution: {integrity: sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg==} + engines: {node: '>= 0.4'} + + delay@5.0.0: + resolution: {integrity: sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==} + engines: {node: '>=10'} + + delayed-stream@1.0.0: + resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} + engines: {node: '>=0.4.0'} + + depd@1.1.2: + resolution: {integrity: sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ==} + engines: {node: '>= 0.6'} + + depd@2.0.0: + resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} + engines: {node: '>= 0.8'} + + des.js@1.1.0: + resolution: {integrity: sha512-r17GxjhUCjSRy8aiJpr8/UadFIzMzJGexI3Nmz4ADi9LYSFx4gTBp80+NaX/YsXWWLhpZ7v/v/ubEc/bCNfKwg==} + + destroy@1.2.0: + resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} + engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} + + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} + engines: {node: '>=8'} + + detect-newline@3.1.0: + resolution: {integrity: sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==} + engines: {node: '>=8'} + + detect-node@2.1.0: + resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} + + diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + diff@4.0.4: + resolution: {integrity: sha512-X07nttJQkwkfKfvTPG/KSnE2OMdcUCao6+eXF3wmnIQRn2aPAHH3VxDbDOdegkd6JbPsXqShpvEOHfAT+nCNwQ==} + engines: {node: '>=0.3.1'} + + diffie-hellman@5.0.3: + resolution: {integrity: sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==} + + dir-glob@3.0.1: + resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} + engines: {node: '>=8'} + + dns-packet@5.6.1: + resolution: {integrity: sha512-l4gcSouhcgIKRvyy99RNVOgxXiicE+2jZoNmaNmZ6JXiGajBOJAesk1OBlJuM5k2c+eudGdLxDqXuPCKIj6kpw==} + engines: {node: '>=6'} + + doctrine@3.0.0: + resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} + engines: {node: '>=6.0.0'} + + dom-accessibility-api@0.5.16: + resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + + dom-accessibility-api@0.6.3: + resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + + dom-converter@0.2.0: + resolution: {integrity: sha512-gd3ypIPfOMr9h5jIKq8E3sHOTCjeirnl0WK5ZdS1AW0Odt0b1PaWaHdJ4Qk4klv+YB9aJBS7mESXjFoDQPu6DA==} + + dom-serializer@1.4.1: + resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==} + + domelementtype@2.3.0: + resolution: {integrity: sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==} + + domexception@4.0.0: + resolution: {integrity: sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw==} + engines: {node: '>=12'} + deprecated: Use your platform's native DOMException instead + + domhandler@4.3.1: + resolution: {integrity: sha512-GrwoxYN+uWlzO8uhUXRl0P+kHE4GtVPfYzVLcUxPL7KNdHKj66vvlhiweIHqYYXWlw+T8iLMp42Lm67ghw4WMQ==} + engines: {node: '>= 4'} + + domutils@2.8.0: + resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} + + dot-case@3.0.4: + resolution: {integrity: sha512-Kv5nKlh6yRrdrGvxeJ2e5y2eRUpkUosIW4A2AS38zwSz27zu7ufDwQPi5Jhs3XAlGNetl3bmnGhQsMtkKJnj3w==} + + dunder-proto@1.0.1: + resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} + engines: {node: '>= 0.4'} + + eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + + ee-first@1.1.1: + resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} + + electron-to-chromium@1.5.389: + resolution: {integrity: sha512-cEto7aeOqBfU1D+c5py5pE+ooscKE75JifxLBdFUZsqAxRS6y7kebtxAZvICszSl05gPjYHDTjY+lXpyGvpJbg==} + + elliptic@6.6.1: + resolution: {integrity: sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==} + + emittery@0.13.1: + resolution: {integrity: sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==} + engines: {node: '>=12'} + + emoji-regex@8.0.0: + resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + + emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + + encodeurl@2.0.0: + resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==} + engines: {node: '>= 0.8'} + + enhanced-resolve@5.24.2: + resolution: {integrity: sha512-rpsZEGT1jFuve6QlpyRp9ckQ+kN61hvF9BzCPyMdaKTm8UJce96KBn3sorXOFXlzjPrs3Vc4T1NsSroZ3PxlFw==} + engines: {node: '>=10.13.0'} + + entities@2.2.0: + resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==} + + entities@6.0.1: + resolution: {integrity: sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==} + engines: {node: '>=0.12'} + + entities@8.0.0: + resolution: {integrity: sha512-zwfzJecQ/Uej6tusMqwAqU/6KL2XaB2VZ2Jg54Je6ahNBGNH6Ek6g3jjNCF0fG9EWQKGZNddNjU5F1ZQn/sBnA==} + engines: {node: '>=20.19.0'} + + envinfo@7.21.0: + resolution: {integrity: sha512-Lw7I8Zp5YKHFCXL7+Dz95g4CcbMEpgvqZNNq3AmlT5XAV6CgAAk6gyAMqn2zjw08K9BHfcNuKrMiCPLByGafow==} + engines: {node: '>=4'} + hasBin: true + + error-ex@1.3.4: + resolution: {integrity: sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==} + + es-define-property@1.0.1: + resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} + engines: {node: '>= 0.4'} + + es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} + engines: {node: '>= 0.4'} + + es-get-iterator@1.1.3: + resolution: {integrity: sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==} + + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + + es-module-lexer@2.3.0: + resolution: {integrity: sha512-KLdwQm2NvGLDkQDCGvmiQrhkd0JbMzXthwQAUgWjQuQdBLFa3eiBP5arXZyA+f8x+x7OXgud6bq2rxjGtHV2tw==} + + es-object-atoms@1.1.2: + resolution: {integrity: sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==} + engines: {node: '>= 0.4'} + + es-set-tostringtag@2.1.0: + resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} + engines: {node: '>= 0.4'} + + es6-promise@4.2.8: + resolution: {integrity: sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==} + + es6-promisify@5.0.0: + resolution: {integrity: sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==} + + escalade@3.2.0: + resolution: {integrity: sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==} + engines: {node: '>=6'} + + escape-html@1.0.3: + resolution: {integrity: sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==} + + escape-string-regexp@2.0.0: + resolution: {integrity: sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==} + engines: {node: '>=8'} + + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eslint-scope@5.1.1: + resolution: {integrity: sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==} + engines: {node: '>=8.0.0'} + + eslint-scope@7.2.2: + resolution: {integrity: sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint@8.57.0: + resolution: {integrity: sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + deprecated: This version is no longer supported. Please see https://eslint.org/version-support for other options. + hasBin: true + + espree@9.6.1: + resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + esprima@4.0.1: + resolution: {integrity: sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==} + engines: {node: '>=4'} + hasBin: true + + esquery@1.7.0: + resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@4.3.0: + resolution: {integrity: sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + estree-walker@2.0.2: + resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} + + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + + etag@1.8.1: + resolution: {integrity: sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==} + engines: {node: '>= 0.6'} + + eventemitter3@4.0.7: + resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + + eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + + eventemitter3@5.0.4: + resolution: {integrity: sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==} + + events@3.3.0: + resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} + engines: {node: '>=0.8.x'} + + evp_bytestokey@1.0.3: + resolution: {integrity: sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==} + + execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + + exit-x@0.2.2: + resolution: {integrity: sha512-+I6B/IkJc1o/2tiURyz/ivu/O0nKNEArIUB5O7zBrlDVJr22SCLH3xTeEry428LvFhRzIA1g8izguxJ/gbNcVQ==} + engines: {node: '>= 0.8.0'} + + exit@0.1.2: + resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} + engines: {node: '>= 0.8.0'} + + expect-type@1.4.0: + resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==} + engines: {node: '>=12.0.0'} + + expect@29.7.0: + resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + expect@30.4.1: + resolution: {integrity: sha512-PMARsyh/JtqC20HoGqlFcIlQAyqUtW4PlI1rup1uhYJtKuwAjbvWi3GQMAn+STdHum/dk8xrKfUM1+5SAwpolA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + express@4.22.2: + resolution: {integrity: sha512-IuL+Elrou2ZvCFHs18/CIzy2Nzvo25nZ1/D2eIZlz7c+QUayAcYoiM2BthCjs+EBHVpjYjcuLDAiCWgeIX3X1Q==} + engines: {node: '>= 0.10.0'} + + eyes@0.1.8: + resolution: {integrity: sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==} + engines: {node: '> 0.1.90'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-glob@3.3.3: + resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} + engines: {node: '>=8.6.0'} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + + fast-stable-stringify@1.0.0: + resolution: {integrity: sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==} + + fast-uri@3.1.3: + resolution: {integrity: sha512-i70LwGWUduXqzicKXWshooq+sWL1K3WUU5rKZNG/0i3a1OSoX3HqhH5WbWwTmqWfor4urUakGPiRQcleRZTwOg==} + + fastest-levenshtein@1.0.16: + resolution: {integrity: sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==} + engines: {node: '>= 4.9.1'} + + fastq@1.20.1: + resolution: {integrity: sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==} + + faye-websocket@0.11.4: + resolution: {integrity: sha512-CzbClwlXAuiRQAlUyfqPgvPoNKTckTPGfwZV4ZdAhVcP2lh9KUxJg2b5GkE7XbjKQ3YJnQ9z6D9ntLAlB+tP8g==} + engines: {node: '>=0.8.0'} + + fb-watchman@2.0.2: + resolution: {integrity: sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==} + + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + + file-entry-cache@6.0.1: + resolution: {integrity: sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==} + engines: {node: ^10.12.0 || >=12.0.0} + + fill-range@7.1.1: + resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} + engines: {node: '>=8'} + + finalhandler@1.3.2: + resolution: {integrity: sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==} + engines: {node: '>= 0.8'} + + find-cache-dir@4.0.0: + resolution: {integrity: sha512-9ZonPT4ZAK4a+1pUPVPZJapbi7O5qbbJPdYw/NOQWZZbVLdDTYM3A4R9z/DpAM08IDaFGsvPgiGZ82WEwUDWjg==} + engines: {node: '>=14.16'} + + find-up@4.1.0: + resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} + engines: {node: '>=8'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + + find-up@6.3.0: + resolution: {integrity: sha512-v2ZsoEuVHYy8ZIlYqwPe/39Cy+cFDzp4dXPaxNvkEuouymu+2Jbz0PxpKarJHYJTmv2HWT3O382qY8l4jMWthw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + flat-cache@3.2.0: + resolution: {integrity: sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==} + engines: {node: ^10.12.0 || >=12.0.0} + + flat@5.0.2: + resolution: {integrity: sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==} + hasBin: true + + flatted@3.4.2: + resolution: {integrity: sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==} + + follow-redirects@1.16.0: + resolution: {integrity: sha512-y5rN/uOsadFT/JfYwhxRS5R7Qce+g3zG97+JrtFZlC9klX/W5hD7iiLzScI4nZqUS7DNUdhPgw4xI8W2LuXlUw==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + + for-each@0.3.5: + resolution: {integrity: sha512-dKx12eRCVIzqCxFGplyFKJMPvLEWgmNtUrpTiJIR5u97zEhRG8ySrtboPHZXx7daLxQVrl643cTzbab2tkQjxg==} + engines: {node: '>= 0.4'} + + foreground-child@3.3.1: + resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} + engines: {node: '>=14'} + + form-data@4.0.6: + resolution: {integrity: sha512-vKatAh4SlVfgbv+YtmhiRjhEMJsYpsG1Y2rMQtR+SVSbytsSD1YGzDIcrAJmdFec88u/+VoGmxnl+80gL1tRCQ==} + engines: {node: '>= 6'} + + forwarded@0.2.0: + resolution: {integrity: sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==} + engines: {node: '>= 0.6'} + + fresh@0.5.2: + resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} + engines: {node: '>= 0.6'} + + fs.realpath@1.0.0: + resolution: {integrity: sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==} + + fsevents@2.3.2: + resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + + function-bind@1.1.2: + resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} + + functions-have-names@1.2.3: + resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} + + generator-function@2.0.1: + resolution: {integrity: sha512-SFdFmIJi+ybC0vjlHN0ZGVGHc3lgE0DxPAT0djjVg+kjOnSqclqmj0KQ7ykTOLP6YxoqOvuAODGdcHJn+43q3g==} + engines: {node: '>= 0.4'} + + gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + + get-caller-file@2.0.5: + resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} + engines: {node: 6.* || 8.* || >= 10.*} + + get-intrinsic@1.3.0: + resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} + engines: {node: '>= 0.4'} + + get-package-type@0.1.0: + resolution: {integrity: sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==} + engines: {node: '>=8.0.0'} + + get-proto@1.0.1: + resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} + engines: {node: '>= 0.4'} + + get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + + glob-parent@5.1.2: + resolution: {integrity: sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==} + engines: {node: '>= 6'} + + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + + glob-to-regex.js@1.2.0: + resolution: {integrity: sha512-QMwlOQKU/IzqMUOAZWubUOT8Qft+Y0KQWnX9nK3ch0CJg0tTp4TvGZsTfudYKv2NzoQSyPcnA6TYeIQ3jGichQ==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + glob-to-regexp@0.4.1: + resolution: {integrity: sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==} + + glob@10.5.0: + resolution: {integrity: sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + hasBin: true + + glob@7.2.3: + resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me + + globals@13.24.0: + resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} + engines: {node: '>=8'} + + globby@13.2.2: + resolution: {integrity: sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + gopd@1.2.0: + resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} + engines: {node: '>= 0.4'} + + graceful-fs@4.2.11: + resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + + graphemer@1.4.0: + resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} + + handle-thing@2.0.1: + resolution: {integrity: sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==} + + handlebars@4.7.9: + resolution: {integrity: sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==} + engines: {node: '>=0.4.7'} + hasBin: true + + has-bigints@1.1.0: + resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==} + engines: {node: '>= 0.4'} + + has-flag@4.0.0: + resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==} + engines: {node: '>=8'} + + has-property-descriptors@1.0.2: + resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} + + has-symbols@1.1.0: + resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} + engines: {node: '>= 0.4'} + + has-tostringtag@1.0.2: + resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} + engines: {node: '>= 0.4'} + + hash-base@3.0.5: + resolution: {integrity: sha512-vXm0l45VbcHEVlTCzs8M+s0VeYsB2lnlAaThoLKGXr3bE/VWDOelNUnycUPEhKEaXARL2TEFjBOyUiM6+55KBg==} + engines: {node: '>= 0.10'} + + hash-base@3.1.2: + resolution: {integrity: sha512-Bb33KbowVTIj5s7Ked1OsqHUeCpz//tPwR+E2zJgJKo9Z5XolZ9b6bdUgjmYlwnWhoOQKoTd1TYToZGn5mAYOg==} + engines: {node: '>= 0.8'} + + hash.js@1.1.7: + resolution: {integrity: sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==} + + hasown@2.0.4: + resolution: {integrity: sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==} + engines: {node: '>= 0.4'} + + he@1.2.0: + resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} + hasBin: true + + hmac-drbg@1.0.1: + resolution: {integrity: sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==} + + hpack.js@2.1.6: + resolution: {integrity: sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==} + + html-encoding-sniffer@3.0.0: + resolution: {integrity: sha512-oWv4T4yJ52iKrufjnyZPkrN0CH3QnrUqdB6In1g5Fe1mia8GmF36gnfNySxoZtxD5+NmYw1EElVXiBk93UeskA==} + engines: {node: '>=12'} + + html-encoding-sniffer@4.0.0: + resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} + engines: {node: '>=18'} + + html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + + html-minifier-terser@6.1.0: + resolution: {integrity: sha512-YXxSlJBZTP7RS3tWnQw74ooKa6L9b9i9QYXY21eUEvhZ3u9XLfv6OnFsQq6RxkhHygsaUMvYsZRV5rU/OVNZxw==} + engines: {node: '>=12'} + hasBin: true + + html-webpack-plugin@5.5.3: + resolution: {integrity: sha512-6YrDKTuqaP/TquFH7h4srYWsZx+x6k6+FbsTm0ziCwGHDP78Unr1r9F/H4+sGmMbX08GQcJ+K64x55b+7VM/jg==} + engines: {node: '>=10.13.0'} + peerDependencies: + webpack: ^5.20.0 + + htmlparser2@6.1.0: + resolution: {integrity: sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A==} + + http-deceiver@1.2.7: + resolution: {integrity: sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==} + + http-errors@1.8.1: + resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} + engines: {node: '>= 0.6'} + + http-errors@2.0.1: + resolution: {integrity: sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==} + engines: {node: '>= 0.8'} + + http-parser-js@0.5.10: + resolution: {integrity: sha512-Pysuw9XpUq5dVc/2SMHpuTY01RFl8fttgcyunjL7eEMhGM3cI4eOmiCycJDVCo/7O7ClfQD3SaI6ftDzqOXYMA==} + + http-proxy-agent@5.0.0: + resolution: {integrity: sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==} + engines: {node: '>= 6'} + + http-proxy-agent@7.0.2: + resolution: {integrity: sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==} + engines: {node: '>= 14'} + + http-proxy-middleware@2.0.10: + resolution: {integrity: sha512-RKzRWNPxUZqbuk3BC5mGVJbBnWgr+diEnjJexIOytFbBzDy88Fbh/YvBr3DsNrl1jYAfjWfpATEv0NO35FDuPQ==} + engines: {node: '>=12.0.0'} + peerDependencies: + '@types/express': ^4.17.13 + peerDependenciesMeta: + '@types/express': + optional: true + + http-proxy@1.18.1: + resolution: {integrity: sha512-7mz/721AbnJwIVbnaSv1Cz3Am0ZLT/UBwkC92VlxhXv/k/BBQfM2fXElQNC27BVGr0uwUpplYPQM9LnaBMR5NQ==} + engines: {node: '>=8.0.0'} + + https-proxy-agent@5.0.1: + resolution: {integrity: sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==} + engines: {node: '>= 6'} + + https-proxy-agent@7.0.6: + resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==} + engines: {node: '>= 14'} + + human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + + humanize-ms@1.2.1: + resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==} + + hyperdyperid@1.2.0: + resolution: {integrity: sha512-Y93lCzHYgGWdrJ66yIktxiaGULYc6oGiABxhcO5AufBeOyoIdZF7bIfLaOrbM0iGIOXQQgxxRrFEnb+Y6w1n4A==} + engines: {node: '>=10.18'} + + iconv-lite@0.4.24: + resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} + engines: {node: '>=0.10.0'} + + iconv-lite@0.6.3: + resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==} + engines: {node: '>=0.10.0'} + + icss-utils@5.1.0: + resolution: {integrity: sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + + ieee754@1.2.1: + resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} + + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + import-fresh@3.3.1: + resolution: {integrity: sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==} + engines: {node: '>=6'} + + import-local@3.2.0: + resolution: {integrity: sha512-2SPlun1JUPWoM6t3F0dw0FkCF/jWY8kttcY4f599GLTSjh2OCuuhdTkJQsEcZzBqbXZGKMK2OqW1oZsjtf/gQA==} + engines: {node: '>=8'} + hasBin: true + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + indent-string@4.0.0: + resolution: {integrity: sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==} + engines: {node: '>=8'} + + inflight@1.0.6: + resolution: {integrity: sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==} + deprecated: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. + + inherits@2.0.4: + resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} + + ini@1.3.8: + resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==} + + internal-slot@1.1.0: + resolution: {integrity: sha512-4gd7VpWNQNB4UKKCFFVcp1AVv+FMOgs9NKzjHKusc8jTMhd5eL1NqQqOpE0KzMds804/yHlglp3uxgluOqAPLw==} + engines: {node: '>= 0.4'} + + interpret@3.1.1: + resolution: {integrity: sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==} + engines: {node: '>=10.13.0'} + + ipaddr.js@1.9.1: + resolution: {integrity: sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==} + engines: {node: '>= 0.10'} + + ipaddr.js@2.4.0: + resolution: {integrity: sha512-9VGk3HGanVE6JoZXHiCpnGy5X0jYDnN4EA4lntFPj+1vIWlFhIylq2CrrCOJH9EAhc5CYhq18F2Av2tgoAPsYQ==} + engines: {node: '>= 10'} + + is-arguments@1.2.0: + resolution: {integrity: sha512-7bVbi0huj/wrIAOzb8U1aszg9kdi3KN/CyU19CTI7tAoZYEZoL9yCDXpbXN+uPsuWnP02cyug1gleqq+TU+YCA==} + engines: {node: '>= 0.4'} + + is-array-buffer@3.0.5: + resolution: {integrity: sha512-DDfANUiiG2wC1qawP66qlTugJeL5HyzMpfr8lLK+jMQirGzNod0B12cFB/9q838Ru27sBwfw78/rdoU7RERz6A==} + engines: {node: '>= 0.4'} + + is-arrayish@0.2.1: + resolution: {integrity: sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==} + + is-bigint@1.1.0: + resolution: {integrity: sha512-n4ZT37wG78iz03xPRKJrHTdZbe3IicyucEtdRsV5yglwc3GyUfbAfpSeD0FJ41NbUNSt5wbhqfp1fS+BgnvDFQ==} + engines: {node: '>= 0.4'} + + is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + + is-boolean-object@1.2.2: + resolution: {integrity: sha512-wa56o2/ElJMYqjCjGkXri7it5FbebW5usLw/nPmCMs5DeZ7eziSYZhSmPRn0txqeW4LnAmQQU7FgqLpsEFKM4A==} + engines: {node: '>= 0.4'} + + is-callable@1.2.7: + resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} + engines: {node: '>= 0.4'} + + is-core-module@2.16.2: + resolution: {integrity: sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==} + engines: {node: '>= 0.4'} + + is-date-object@1.1.0: + resolution: {integrity: sha512-PwwhEakHVKTdRNVOw+/Gyh0+MzlCl4R6qKvkhuvLtPMggI1WAHt9sOwZxQLSGpUaDnrdyDsomoRgNnCfKNSXXg==} + engines: {node: '>= 0.4'} + + is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + + is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-fullwidth-code-point@3.0.0: + resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} + engines: {node: '>=8'} + + is-generator-fn@2.1.0: + resolution: {integrity: sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==} + engines: {node: '>=6'} + + is-generator-function@1.1.2: + resolution: {integrity: sha512-upqt1SkGkODW9tsGNG5mtXTXtECizwtS2kA161M+gJPc1xdb/Ax629af6YrTwcOeQHbewrPNlE5Dx7kzvXTizA==} + engines: {node: '>= 0.4'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + + is-map@2.0.3: + resolution: {integrity: sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==} + engines: {node: '>= 0.4'} + + is-network-error@1.3.2: + resolution: {integrity: sha512-PhBY86zaxNZUuWP6h13Vu5oFe0XY6/UlKzQnYFELzGVHygP3MxmvTfYSG7GN3aIab/iWudSMgjSnG9Dq+nHrgA==} + engines: {node: '>=16'} + + is-number-object@1.1.1: + resolution: {integrity: sha512-lZhclumE1G6VYD8VHe35wFaIif+CTy5SJIi5+3y4psDgWu4wPDoBhF8NxUOinEc7pHgiTsT6MaBb92rKhhD+Xw==} + engines: {node: '>= 0.4'} + + is-number@7.0.0: + resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} + engines: {node: '>=0.12.0'} + + is-path-inside@3.0.3: + resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} + engines: {node: '>=8'} + + is-plain-obj@3.0.0: + resolution: {integrity: sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==} + engines: {node: '>=10'} + + is-plain-object@2.0.4: + resolution: {integrity: sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==} + engines: {node: '>=0.10.0'} + + is-port-reachable@4.0.0: + resolution: {integrity: sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + + is-regex@1.2.1: + resolution: {integrity: sha512-MjYsKHO5O7mCsmRGxWcLWheFqN9DJ/2TmngvjKXihe6efViPqc274+Fx/4fYj/r03+ESvBdTXK0V6tA3rgez1g==} + engines: {node: '>= 0.4'} + + is-set@2.0.3: + resolution: {integrity: sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==} + engines: {node: '>= 0.4'} + + is-shared-array-buffer@1.0.4: + resolution: {integrity: sha512-ISWac8drv4ZGfwKl5slpHG9OwPNty4jOWPRIhBpxOoD+hqITiwuipOQ2bNthAzwA3B4fIjO4Nln74N0S9byq8A==} + engines: {node: '>= 0.4'} + + is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + + is-string@1.1.1: + resolution: {integrity: sha512-BtEeSsoaQjlSPBemMQIrY1MY0uM6vnS1g5fmufYOtnxLGUZM2178PKbhsk7Ffv58IX+ZtcvoGwccYsh0PglkAA==} + engines: {node: '>= 0.4'} + + is-symbol@1.1.1: + resolution: {integrity: sha512-9gGx6GTtCQM73BgmHQXfDmLtfjjTUDSyoxTCbp5WtoixAhfgsDirWIcVQ/IHpvI5Vgd5i/J5F7B9cN/WlVbC/w==} + engines: {node: '>= 0.4'} + + is-typed-array@1.1.15: + resolution: {integrity: sha512-p3EcsicXjit7SaskXHs1hA91QxgTw46Fv6EFKKGS5DRFLD8yKnohjF3hxoju94b/OcMZoQukzpPpBE9uLVKzgQ==} + engines: {node: '>= 0.4'} + + is-weakmap@2.0.2: + resolution: {integrity: sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==} + engines: {node: '>= 0.4'} + + is-weakset@2.0.4: + resolution: {integrity: sha512-mfcwb6IzQyOKTs84CQMrOwW4gQcaTOAWJ0zzJCl2WSPDrWk/OzDaImWFH3djXhb24g4eudZfLRozAvPGw4d9hQ==} + engines: {node: '>= 0.4'} + + is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + + is-wsl@3.1.1: + resolution: {integrity: sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==} + engines: {node: '>=16'} + + isarray@1.0.0: + resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} + + isarray@2.0.5: + resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + + isobject@3.0.1: + resolution: {integrity: sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==} + engines: {node: '>=0.10.0'} + + isomorphic-ws@4.0.1: + resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==} + peerDependencies: + ws: ^8.21.0 + + isows@1.0.7: + resolution: {integrity: sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==} + peerDependencies: + ws: ^8.21.0 + + istanbul-lib-coverage@3.2.2: + resolution: {integrity: sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==} + engines: {node: '>=8'} + + istanbul-lib-instrument@5.2.1: + resolution: {integrity: sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==} + engines: {node: '>=8'} + + istanbul-lib-instrument@6.0.3: + resolution: {integrity: sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==} + engines: {node: '>=10'} + + istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + + istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} + + istanbul-lib-source-maps@5.0.6: + resolution: {integrity: sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==} + engines: {node: '>=10'} + + istanbul-reports@3.2.0: + resolution: {integrity: sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==} + engines: {node: '>=8'} + + jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + + jayson@4.3.0: + resolution: {integrity: sha512-AauzHcUcqs8OBnCHOkJY280VaTiCm57AbuO7lqzcw7JapGj50BisE3xhksye4zlTSR1+1tAz67wLTl8tEH1obQ==} + engines: {node: '>=8'} + hasBin: true + + jest-changed-files@29.7.0: + resolution: {integrity: sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-changed-files@30.4.1: + resolution: {integrity: sha512-IuctmYrxi21iOSOaIXpJWalHyPAsVv0GeBHKDn8C1CA4W5htHn7INL+wdnL4Bo0+olEndvAFkmb++tIQJG+vvg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-circus@29.7.0: + resolution: {integrity: sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-circus@30.4.2: + resolution: {integrity: sha512-rvHH7VlY6LgbJXJTQ87GW62g1FntOtbhh0zT+v04kC+pgL6aBKyYINXxWukCpj3dcIBMw5/XUbtDS9dU9JTXeQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-cli@29.7.0: + resolution: {integrity: sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jest-cli@30.4.2: + resolution: {integrity: sha512-jfA2ocvVHMXS2QijrJ0d31ektP+d/W0T5RpcTX2Pq+3sVqHlsXVCM2+FmwpL+bdY8OfHpIg9xMxLF17Zg0U49Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jest-config@29.7.0: + resolution: {integrity: sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + peerDependencies: + '@types/node': '*' + ts-node: '>=9.0.0' + peerDependenciesMeta: + '@types/node': + optional: true + ts-node: + optional: true + + jest-config@30.4.2: + resolution: {integrity: sha512-rNHAShJQqQwFNoL0hbf3BphSBOWnpOUAKvidLS/AjNVLPfoj5mSf4jQMfW3cYOs6hXeZC7nF7mDHaBnbxELOzg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + '@types/node': '*' + esbuild-register: '>=3.4.0' + ts-node: '>=9.0.0' + peerDependenciesMeta: + '@types/node': + optional: true + esbuild-register: + optional: true + ts-node: + optional: true + + jest-diff@29.7.0: + resolution: {integrity: sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-diff@30.4.1: + resolution: {integrity: sha512-CRpFK0RtLriVDGcPPAnR6HMVI8bSR2jnUIgralhauzYQZIb4RH9AtEInTuQr65LmmGggGcRT6HIASxwqsVsmlA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-docblock@29.7.0: + resolution: {integrity: sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-docblock@30.4.0: + resolution: {integrity: sha512-ZPMabUZCx5MpbZ2eBYSvZ0J8fvo3dR9oM+eeUpb3aKNQFuS2tu3Duw1TNlMoP8k3WQgKGJuhcMFvwcVuq6T7oA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-each@29.7.0: + resolution: {integrity: sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-each@30.4.1: + resolution: {integrity: sha512-/8MJbH6fuj48TstjrMf+u/pd06Qezz5xOXvZA6442heNOWr8bdeoGZX2d9fCn028CoMgYmroH9//zky5GfyYmA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-environment-jsdom@30.4.1: + resolution: {integrity: sha512-o3nfaN4zej7qgk2X0j8Jhq/S9nAVKs2xK3QeQxeHVvpkEPxaA1yxDGydR+iVI7zPy7Cp62Aq2h3Ja46QvfWHGA==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + peerDependencies: + canvas: ^3.0.0 + peerDependenciesMeta: + canvas: + optional: true + + jest-environment-node@29.7.0: + resolution: {integrity: sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-environment-node@30.4.1: + resolution: {integrity: sha512-4FZYVOk85hz2AyT6BbarKy9u37g6DbrDyCdFhsnDdXqyrueYQvB+0zO4f/kqLCRD0BsPRXPMNJeQwihKZV8naw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-get-type@29.6.3: + resolution: {integrity: sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-haste-map@29.7.0: + resolution: {integrity: sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-haste-map@30.4.1: + resolution: {integrity: sha512-rFrcONd8jeFsyw+Z9CrScJgglRf2+NFmNam8dKu7n+SoHqNYT47mn0DdEcVUZJpvh7Iz6/si7f7yUH7GJHVgnw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-leak-detector@29.7.0: + resolution: {integrity: sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-leak-detector@30.4.1: + resolution: {integrity: sha512-IpmyiioeHxiWDhesHnUFmOxcTzwCwKpgACgWajtAP+nYQXiY7DakTxB6Bx9JFiRMljr0AX1PvnQdaU1KFoz6NQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-matcher-utils@29.7.0: + resolution: {integrity: sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-matcher-utils@30.4.1: + resolution: {integrity: sha512-zvYfX5CaeEkFrrLS9suWe9rvJrm9J1Iv3ua8kIBv9GEPzcnsfBf0bob37la7s67fs0nlBC3EuvkOLnXQKxtx4A==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-message-util@29.7.0: + resolution: {integrity: sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-message-util@30.4.1: + resolution: {integrity: sha512-kwCKIvq0MCW1HzLoGola9Te6JUdzgV0loyKJ3Qghrkz9i5/RRIHsL95BMQc2HBBhlBKC4j22K9p11TGHH8RBpQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-mock@29.7.0: + resolution: {integrity: sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-mock@30.4.1: + resolution: {integrity: sha512-/i8SVb8/NSB7RfNi8gfqu8gxLV23KaL5EpAttyb9iz8qWRIqXRLflycz/32wXsYkOnaUlx8NAKnJYtpsmXUmfw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-pnp-resolver@1.2.3: + resolution: {integrity: sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==} + engines: {node: '>=6'} + peerDependencies: + jest-resolve: '*' + peerDependenciesMeta: + jest-resolve: + optional: true + + jest-regex-util@29.6.3: + resolution: {integrity: sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-regex-util@30.4.0: + resolution: {integrity: sha512-mWlvLviKIgIQ8VCuM1xRdD0TWp3zlzionlmDBjuXVBs+VkmXq6FgW9T4Emr7oGz/Rk6feDCGyiugolcQEyp3mg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-resolve-dependencies@29.7.0: + resolution: {integrity: sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-resolve-dependencies@30.4.2: + resolution: {integrity: sha512-gDiVh1I+GxYzz9oXlyw+1wv6VOYX1WYxMOfjsA3iGKePV2oxmbHhwxfkALxNxYy1ciw6APWwkW2zZONwP97aEQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-resolve@29.7.0: + resolution: {integrity: sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-resolve@30.4.1: + resolution: {integrity: sha512-Zry8Yq/yJcNAZ7dJ5F2heic8AheXvbFZ7XI5V+h28nrYZ7Qoyy4dItq8OodjnYD270mvX+ZudmrNV9cysqhW5Q==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-runner@29.7.0: + resolution: {integrity: sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-runner@30.4.2: + resolution: {integrity: sha512-2dw0PslVYXxffXGpLo+Ejad+KcI1Qkjn7f4X4619gf21oCUmL+SPfjqIa/losUem3yEOvfNZe/F1HWUcNpODcg==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-runtime@29.7.0: + resolution: {integrity: sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-runtime@30.4.2: + resolution: {integrity: sha512-3/5e8iPz2k/VLqlr8DgTftYyLUv8Su3FkCAO2/Od81UsUTpSxOrS6O5x5KkoQwyUjmpYyDJKeyAvg2T2nvpNkQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-snapshot@29.7.0: + resolution: {integrity: sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-snapshot@30.4.1: + resolution: {integrity: sha512-tEOkkfOMppUyeiHwjZswOQ3lcnoTnws/q5FnGIaeIh/jmoU0ZlgMYRR8sTlTj+nNGCoJ0RDq6SfxGxCsyMTPmw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-util@29.7.0: + resolution: {integrity: sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-util@30.4.1: + resolution: {integrity: sha512-vjQb1sACEiv13DKJMDToJpzVW0joCsIQrmbg0fi7CyOOt+g9jTuQl2A216pWRBYhOVt53XbL/2LbMKg1BECWOw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-validate@29.7.0: + resolution: {integrity: sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-validate@30.4.1: + resolution: {integrity: sha512-PDWi4SOwLnwqNDfHZjOcsEFyZ4fc/2W2gVL3DEoyqnB6jCQMLRtfBong8s6omIw3lI0HWOus12xfnFmQtjW3fw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-watcher@29.7.0: + resolution: {integrity: sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-watcher@30.4.1: + resolution: {integrity: sha512-/l9UonmvCwjHH7d2h3iAwIloLc1H0S8mJZ/LNK3i86hqwPAz8otUJjP9MfYtz9Tt77Su5FD2xGjZn8d31IZHlw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest-worker@27.5.1: + resolution: {integrity: sha512-7vuh85V5cdDofPyxn58nrPjBktZo0u9x1g8WtjQol+jZDaE+fhN+cIvTj11GndBnMnyfrUOG1sZQxCdjKh+DKg==} + engines: {node: '>= 10.13.0'} + + jest-worker@29.7.0: + resolution: {integrity: sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + jest-worker@30.4.1: + resolution: {integrity: sha512-SHynN/q/QD++iNyvMdy+WMmbCGk8jIsNcRxycXbWubSOhvo6T+j2afcfUSl+3hYsiBebOTo0cT7c2H7CXugu1g==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + jest@29.7.0: + resolution: {integrity: sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + jest@30.4.2: + resolution: {integrity: sha512-Yi1jqNC/Oq0N4hBgNH/YvBpP1P57QqundgytzYqy3yqAa7NZPNjSoi4SGbRAXDMdBzNE6xBCi5U7RgfrvMEUVQ==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 + peerDependenciesMeta: + node-notifier: + optional: true + + js-tokens@4.0.0: + resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + + js-yaml@3.15.0: + resolution: {integrity: sha512-ttBQIIQPDeLjpPOohtUdXuXUVoA2uIB6fEH9HyJ7234s5mBJ5wTx20njxplLZQgLaOfpmPQA7X2t5AX6tIPbog==} + hasBin: true + + js-yaml@4.3.0: + resolution: {integrity: sha512-1td788aAnnZ5qs7V2QIRl1owjtYpbKt749Y3xauqQgwIIGF/xXWz1wMTEBx5O3LK3lXLVuqXPdPxj2BoFHaW9Q==} + hasBin: true + + jsdom@22.1.0: + resolution: {integrity: sha512-/9AVW7xNbsBv6GfWho4TTNjEo9fe6Zhf9O7s0Fhhr3u+awPwAJMKwAMXnkk5vBxflqLW9hTHX/0cs+P3gW+cQw==} + engines: {node: '>=16'} + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + + jsdom@26.1.0: + resolution: {integrity: sha512-Cvc9WUhxSMEo4McES3P7oK3QaXldCfNWp7pl2NNeiIFlCoLr3kfq9kb1fxftiwk1FLV7CvpvDfonxtzUDeSOPg==} + engines: {node: '>=18'} + peerDependencies: + canvas: ^3.0.0 + peerDependenciesMeta: + canvas: + optional: true + + jsesc@3.1.0: + resolution: {integrity: sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==} + engines: {node: '>=6'} + hasBin: true + + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-parse-even-better-errors@2.3.1: + resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-schema-traverse@1.0.0: + resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + json-stringify-safe@5.0.1: + resolution: {integrity: sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==} + + json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + + kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + + kleur@3.0.3: + resolution: {integrity: sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==} + engines: {node: '>=6'} + + launch-editor@2.14.1: + resolution: {integrity: sha512-QWBrQsMpH7gPr965dsKD/3cKWiNoTjpATQf++Xq63N6sKRGMwlVXz41O1IZTMfZQgBctD/K5Zt06+/I6pP6+HA==} + + leven@3.1.0: + resolution: {integrity: sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==} + engines: {node: '>=6'} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + + lightningcss-android-arm64@1.32.0: + resolution: {integrity: sha512-YK7/ClTt4kAK0vo6w3X+Pnm0D2cf2vPHbhOXdoNti1Ga0al1P4TBZhwjATvjNwLEBCnKvjJc2jQgHXH0NEwlAg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [android] + + lightningcss-darwin-arm64@1.32.0: + resolution: {integrity: sha512-RzeG9Ju5bag2Bv1/lwlVJvBE3q6TtXskdZLLCyfg5pt+HLz9BqlICO7LZM7VHNTTn/5PRhHFBSjk5lc4cmscPQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [darwin] + + lightningcss-darwin-x64@1.32.0: + resolution: {integrity: sha512-U+QsBp2m/s2wqpUYT/6wnlagdZbtZdndSmut/NJqlCcMLTWp5muCrID+K5UJ6jqD2BFshejCYXniPDbNh73V8w==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [darwin] + + lightningcss-freebsd-x64@1.32.0: + resolution: {integrity: sha512-JCTigedEksZk3tHTTthnMdVfGf61Fky8Ji2E4YjUTEQX14xiy/lTzXnu1vwiZe3bYe0q+SpsSH/CTeDXK6WHig==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [freebsd] + + lightningcss-linux-arm-gnueabihf@1.32.0: + resolution: {integrity: sha512-x6rnnpRa2GL0zQOkt6rts3YDPzduLpWvwAF6EMhXFVZXD4tPrBkEFqzGowzCsIWsPjqSK+tyNEODUBXeeVHSkw==} + engines: {node: '>= 12.0.0'} + cpu: [arm] + os: [linux] + + lightningcss-linux-arm64-gnu@1.32.0: + resolution: {integrity: sha512-0nnMyoyOLRJXfbMOilaSRcLH3Jw5z9HDNGfT/gwCPgaDjnx0i8w7vBzFLFR1f6CMLKF8gVbebmkUN3fa/kQJpQ==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [glibc] + + lightningcss-linux-arm64-musl@1.32.0: + resolution: {integrity: sha512-UpQkoenr4UJEzgVIYpI80lDFvRmPVg6oqboNHfoH4CQIfNA+HOrZ7Mo7KZP02dC6LjghPQJeBsvXhJod/wnIBg==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [linux] + libc: [musl] + + lightningcss-linux-x64-gnu@1.32.0: + resolution: {integrity: sha512-V7Qr52IhZmdKPVr+Vtw8o+WLsQJYCTd8loIfpDaMRWGUZfBOYEJeyJIkqGIDMZPwPx24pUMfwSxxI8phr/MbOA==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [glibc] + + lightningcss-linux-x64-musl@1.32.0: + resolution: {integrity: sha512-bYcLp+Vb0awsiXg/80uCRezCYHNg1/l3mt0gzHnWV9XP1W5sKa5/TCdGWaR/zBM2PeF/HbsQv/j2URNOiVuxWg==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [linux] + libc: [musl] + + lightningcss-win32-arm64-msvc@1.32.0: + resolution: {integrity: sha512-8SbC8BR40pS6baCM8sbtYDSwEVQd4JlFTOlaD3gWGHfThTcABnNDBda6eTZeqbofalIJhFx0qKzgHJmcPTnGdw==} + engines: {node: '>= 12.0.0'} + cpu: [arm64] + os: [win32] + + lightningcss-win32-x64-msvc@1.32.0: + resolution: {integrity: sha512-Amq9B/SoZYdDi1kFrojnoqPLxYhQ4Wo5XiL8EVJrVsB8ARoC1PWW6VGtT0WKCemjy8aC+louJnjS7U18x3b06Q==} + engines: {node: '>= 12.0.0'} + cpu: [x64] + os: [win32] + + lightningcss@1.32.0: + resolution: {integrity: sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==} + engines: {node: '>= 12.0.0'} + + lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + + loader-runner@4.3.2: + resolution: {integrity: sha512-DFEqQ3ihfS9blba08cLfYf1NRAIEm+dDjic073DRDc3/JspI/8wYmtDsHwd3+4hwvdxSK7PGaElfTmm0awWJ4w==} + engines: {node: '>=6.11.5'} + + locate-path@5.0.0: + resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} + engines: {node: '>=8'} + + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + + locate-path@7.2.0: + resolution: {integrity: sha512-gvVijfZvn7R+2qyPX8mAuKcFGDf6Nc61GdvGafQsHL0sBIxfKzA+usWn4GFC/bk+QdwPUD4kWFJLhElipq+0VA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + lodash.clonedeep@4.5.0: + resolution: {integrity: sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ==} + + lodash.debounce@4.0.8: + resolution: {integrity: sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==} + + lodash.memoize@4.1.2: + resolution: {integrity: sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==} + + lodash.merge@4.6.2: + resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} + + lodash@4.18.1: + resolution: {integrity: sha512-dMInicTPVE8d1e5otfwmmjlxkZoUpiVLwyeTdUsi/Caj/gfzzblBcCE5sRHV/AsjuCmxWrte2TNGSYuCeCq+0Q==} + + lower-case@2.0.2: + resolution: {integrity: sha512-7fm3l3NAF9WfN6W3JOmf5drwpVqX78JtoGJ3A6W0a6ZnldM41w2fV5D490psKFTpMds8TJse/eHLFFsNHHjHgg==} + + lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + + lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + + lz-string@1.5.0: + resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} + hasBin: true + + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + + make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + + make-error@1.3.6: + resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + + makeerror@1.0.12: + resolution: {integrity: sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==} + + math-intrinsics@1.1.0: + resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} + engines: {node: '>= 0.4'} + + md5.js@1.3.5: + resolution: {integrity: sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==} + + media-typer@0.3.0: + resolution: {integrity: sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==} + engines: {node: '>= 0.6'} + + memfs@4.64.0: + resolution: {integrity: sha512-Kw72fgY7Wn+sD8KmtNWSafl1dz0UvAsE/PHs3YVfLiaZuA3HxNm9sRLqAu0ATiBGJvME1PxZXbBZPv5GycDeAw==} + peerDependencies: + tslib: '2' + + merge-descriptors@1.0.3: + resolution: {integrity: sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==} + + merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + + merge2@1.4.1: + resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} + engines: {node: '>= 8'} + + methods@1.1.2: + resolution: {integrity: sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==} + engines: {node: '>= 0.6'} + + micromatch@4.0.8: + resolution: {integrity: sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==} + engines: {node: '>=8.6'} + + miller-rabin@4.0.1: + resolution: {integrity: sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==} + hasBin: true + + mime-db@1.33.0: + resolution: {integrity: sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==} + engines: {node: '>= 0.6'} + + mime-db@1.52.0: + resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} + engines: {node: '>= 0.6'} + + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + + mime-types@2.1.18: + resolution: {integrity: sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==} + engines: {node: '>= 0.6'} + + mime-types@2.1.35: + resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} + engines: {node: '>= 0.6'} + + mime-types@3.0.2: + resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} + engines: {node: '>=18'} + + mime@1.6.0: + resolution: {integrity: sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==} + engines: {node: '>=4'} + hasBin: true + + mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + + min-indent@1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + + mini-css-extract-plugin@2.9.4: + resolution: {integrity: sha512-ZWYT7ln73Hptxqxk2DxPU9MmapXRhxkJD6tkSR04dnQxm8BGu2hzgKLugK5yySD97u/8yy7Ma7E76k9ZdvtjkQ==} + engines: {node: '>= 12.13.0'} + peerDependencies: + webpack: ^5.0.0 + + minimalistic-assert@1.0.1: + resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} + + minimalistic-crypto-utils@1.0.1: + resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} + + minimatch@3.1.5: + resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} + + minimatch@9.0.9: + resolution: {integrity: sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==} + engines: {node: '>=16 || 14 >=14.17'} + + minimist@1.2.8: + resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + + minipass@7.1.3: + resolution: {integrity: sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==} + engines: {node: '>=16 || 14 >=14.17'} + + mrmime@2.0.1: + resolution: {integrity: sha512-Y3wQdFg2Va6etvQ5I82yUhGdsKrcYox6p7FfL1LbK2J4V01F9TGlepTIhnK24t7koZibmg82KGglhA1XK5IsLQ==} + engines: {node: '>=10'} + + ms@2.0.0: + resolution: {integrity: sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==} + + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + multicast-dns@7.2.5: + resolution: {integrity: sha512-2eznPJP8z2BFLX50tf0LuODrpINqP1RVIm/CObbTcBRITQgmC/TjcREF1NeTBzIcR5XO/ukWo+YHOjBbFwIupg==} + hasBin: true + + nanoid@3.3.15: + resolution: {integrity: sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + + napi-postinstall@0.3.4: + resolution: {integrity: sha512-PHI5f1O0EP5xJ9gQmFGMS6IZcrVvTjpXjz7Na41gTE7eE2hK11lg04CECCYEEjdc17EV4DO+fkGEtt7TpTaTiQ==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + hasBin: true + + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + + negotiator@0.6.3: + resolution: {integrity: sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==} + engines: {node: '>= 0.6'} + + negotiator@0.6.4: + resolution: {integrity: sha512-myRT3DiWPHqho5PrJaIRyaMv2kgYf0mUVgBNOYMuCH5Ki1yEiQaf/ZJuQ62nvpc44wL5WDbTX7yGJi1Neevw8w==} + engines: {node: '>= 0.6'} + + neo-async@2.6.2: + resolution: {integrity: sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==} + + no-case@3.0.4: + resolution: {integrity: sha512-fgAN3jGAh+RoxUGZHTSOLJIqUc2wmoBwGR4tbpNAKmmovFoWq0OdRkb0VkldReO2a2iBT/OEulG9XSUc10r3zg==} + + node-fetch@2.7.0: + resolution: {integrity: sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==} + engines: {node: 4.x || >=6.0.0} + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + + node-forge@1.4.0: + resolution: {integrity: sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==} + engines: {node: '>= 6.13.0'} + + node-gyp-build@4.8.4: + resolution: {integrity: sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==} + hasBin: true + + node-int64@0.4.0: + resolution: {integrity: sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==} + + node-releases@2.0.51: + resolution: {integrity: sha512-wRNIrw4DmVLKQlbgOMdkMx27Wrpzes2hh5Jtbi2bjPd+4wJstWIqP5A+lscnqbm0xxmT5Bpg8Lec5ItEBwx6BQ==} + engines: {node: '>=18'} + + normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + + npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + + nth-check@2.1.1: + resolution: {integrity: sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==} + + nwsapi@2.2.24: + resolution: {integrity: sha512-7YRhZ3jS45LwmSCT4b2sVFHt/WuovaktDU07QrtOBY2PXskss5a9jfmR9jptyumwXST+rFjrmppMY1KT/yn35A==} + + object-inspect@1.13.4: + resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} + engines: {node: '>= 0.4'} + + object-is@1.1.6: + resolution: {integrity: sha512-F8cZ+KfGlSGi09lJT7/Nd6KJZ9ygtvYC0/UYYLI9nmQKLMnydpB9yvbv9K1uSkEu7FU9vYPmVwLg328tX+ot3Q==} + engines: {node: '>= 0.4'} + + object-keys@1.1.1: + resolution: {integrity: sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==} + engines: {node: '>= 0.4'} + + object.assign@4.1.7: + resolution: {integrity: sha512-nK28WOo+QIjBkDduTINE4JkF/UJJKyf2EJxvJKfblDpyg0Q+pkOHNTL0Qwy6NP6FhE/EnzV73BxxqcJaXY9anw==} + engines: {node: '>= 0.4'} + + obuf@1.1.2: + resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} + + obug@2.1.3: + resolution: {integrity: sha512-9miFgM2OFba7hB+pRgvtV84pYTBaoTHohvmIgiRt6dRIzbwEOIaNaP+dIlGs2fNFoB0SeISs0Jz5WFVRid6Xyg==} + engines: {node: '>=12.20.0'} + + on-finished@2.4.1: + resolution: {integrity: sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==} + engines: {node: '>= 0.8'} + + on-headers@1.1.0: + resolution: {integrity: sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==} + engines: {node: '>= 0.8'} + + once@1.4.0: + resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} + + onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + + open@10.2.0: + resolution: {integrity: sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==} + engines: {node: '>=18'} + + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + + ox@0.11.3: + resolution: {integrity: sha512-1bWYGk/xZel3xro3l8WGg6eq4YEKlaqvyMtVhfMFpbJzK2F6rj4EDRtqDCWVEJMkzcmEi9uW2QxsqELokOlarw==} + peerDependencies: + typescript: '>=5.4.0' + peerDependenciesMeta: + typescript: + optional: true + + p-limit@2.3.0: + resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==} + engines: {node: '>=6'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-limit@4.0.0: + resolution: {integrity: sha512-5b0R4txpzjPWVw/cXXUResoD4hb6U/x9BH08L7nw+GN1sezDzPdxeRvpc9c433fZhBan/wusjbCsqwqm4EIBIQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + p-locate@4.1.0: + resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} + engines: {node: '>=8'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + p-locate@6.0.0: + resolution: {integrity: sha512-wPrq66Llhl7/4AGC6I+cqxT07LhXvWL08LNXz1fENOw0Ap4sRZZ/gZpTTJ5jpurzzzfS2W/Ge9BY3LgLjCShcw==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + p-retry@6.2.1: + resolution: {integrity: sha512-hEt02O4hUct5wtwg4H4KcWgDdm+l1bOaEy/hWzd8xtXB9BqxTWBBhb+2ImAtH4Cv4rPjV76xN3Zumqk3k3AhhQ==} + engines: {node: '>=16.17'} + + p-try@2.2.0: + resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} + engines: {node: '>=6'} + + package-json-from-dist@1.0.1: + resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==} + + param-case@3.0.4: + resolution: {integrity: sha512-RXlj7zCYokReqWpOPH9oYivUzLYZ5vAPIfEmCTNViosC78F8F0H9y7T7gG2M39ymgutxF5gcFEsyZQSph9Bp3A==} + + parent-module@1.0.1: + resolution: {integrity: sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==} + engines: {node: '>=6'} + + parse-asn1@5.1.9: + resolution: {integrity: sha512-fIYNuZ/HastSb80baGOuPRo1O9cf4baWw5WsAp7dBuUzeTD/BoaG8sVTdlPFksBE2lF21dN+A1AnrpIjSWqHHg==} + engines: {node: '>= 0.10'} + + parse-json@5.2.0: + resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} + engines: {node: '>=8'} + + parse5@7.3.0: + resolution: {integrity: sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==} + + parse5@8.0.1: + resolution: {integrity: sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==} + + parseurl@1.3.3: + resolution: {integrity: sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==} + engines: {node: '>= 0.8'} + + pascal-case@3.1.2: + resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-exists@5.0.0: + resolution: {integrity: sha512-RjhtfwJOxzcFmNOi6ltcbcu4Iu+FL3zEj83dk4kAS+fVpTxXLO1b38RvJgT/0QwvV/L3aY9TAnyv0EOqW4GoMQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + + path-is-absolute@1.0.1: + resolution: {integrity: sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==} + engines: {node: '>=0.10.0'} + + path-is-inside@1.0.2: + resolution: {integrity: sha512-DUWJr3+ULp4zXmol/SZkFf3JGsS9/SIv+Y3Rt93/UjPpDpklB5f1er4O3POIbUuUJ3FXgqte2Q7SrU6zAqwk8w==} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + + path-parse@1.0.7: + resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + + path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + + path-to-regexp@0.1.13: + resolution: {integrity: sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==} + + path-to-regexp@3.3.0: + resolution: {integrity: sha512-qyCH421YQPS2WFDxDjftfc1ZR5WKQzVzqsp4n9M2kQhVOo/ByahFoUNJfl58kOcEGfQ//7weFTDhm+ss8Ecxgw==} + + path-type@4.0.0: + resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} + engines: {node: '>=8'} + + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pbkdf2@3.1.6: + resolution: {integrity: sha512-BT6eelPB1EyGHo8pC0o9Bl6k6SYVhKO1jEbd3lcTrtr7XHdjP8BW1YpfCV3G9Kwkxgattk+S5q2/RvuttCsS1g==} + engines: {node: '>= 0.10'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + + picomatch@2.3.2: + resolution: {integrity: sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==} + engines: {node: '>=8.6'} + + picomatch@4.0.5: + resolution: {integrity: sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==} + engines: {node: '>=12'} + + pirates@4.0.7: + resolution: {integrity: sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==} + engines: {node: '>= 6'} + + pkg-dir@4.2.0: + resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} + engines: {node: '>=8'} + + pkg-dir@7.0.0: + resolution: {integrity: sha512-Ie9z/WINcxxLp27BKOCHGde4ITq9UklYKDzVo1nhk5sqGEXU3FpkwP5GM2voTGJkGd9B3Otl+Q4uwSOeSUtOBA==} + engines: {node: '>=14.16'} + + playwright-core@1.61.1: + resolution: {integrity: sha512-h7Qlt6m4REp25qvIdvbDtVmD4LqVXfpRxhORv9L0jzETM05p4fuPJ3dKyuSXQxDSbXnmS79HAgi9589lGSpLkg==} + engines: {node: '>=18'} + hasBin: true + + playwright@1.61.1: + resolution: {integrity: sha512-DWnY5o3YbLWK4GovuAVwpqL+1VwGNdUGrRr++8j8PtQQzvAVZUIMjKQ90fY689sEJZJBbZVw1rXaOKSTitkzPQ==} + engines: {node: '>=18'} + hasBin: true + + pngjs@7.0.0: + resolution: {integrity: sha512-LKWqWJRhstyYo9pGvgor/ivk2w94eSjE3RGVuzLGlr3NmD8bf7RcYGze1mNdEHRP6TRP6rMuDHk5t44hnTRyow==} + engines: {node: '>=14.19.0'} + + possible-typed-array-names@1.1.0: + resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} + engines: {node: '>= 0.4'} + + postcss-modules-extract-imports@3.1.0: + resolution: {integrity: sha512-k3kNe0aNFQDAZGbin48pL2VNidTF0w4/eASDsxlyspobzU3wZQLOGj7L9gfRe0Jo9/4uud09DsjFNH7winGv8Q==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + + postcss-modules-local-by-default@4.2.0: + resolution: {integrity: sha512-5kcJm/zk+GJDSfw+V/42fJ5fhjL5YbFDl8nVdXkJPLLW+Vf9mTD5Xe0wqIaDnLuL2U6cDNpTr+UQ+v2HWIBhzw==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + + postcss-modules-scope@3.2.1: + resolution: {integrity: sha512-m9jZstCVaqGjTAuny8MdgE88scJnCiQSlSrOWcTQgM2t32UBe+MUmFSO5t7VMSfAf/FJKImAxBav8ooCHJXCJA==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + + postcss-modules-values@4.0.0: + resolution: {integrity: sha512-RDxHkAiEGI78gS2ofyvCsu7iycRv7oqw5xMWn9iMoR0N/7mf9D50ecQqUo5BZ9Zh2vH4bCUR/ktCqbB9m8vJjQ==} + engines: {node: ^10 || ^12 || >= 14} + peerDependencies: + postcss: ^8.1.0 + + postcss-selector-parser@7.1.4: + resolution: {integrity: sha512-HeP7D2wyhkR+XaK6v4W8oRF62Dsz4flyuczALJp61GckGm42u1saSSJ/0auvcBqxs3jMRFEcPK34At/0JBKdOg==} + engines: {node: '>=4'} + + postcss-value-parser@4.2.0: + resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==} + + postcss@8.5.16: + resolution: {integrity: sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==} + engines: {node: ^10 || ^12 || >=14} + + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier@2.8.4: + resolution: {integrity: sha512-vIS4Rlc2FNh0BySk3Wkd6xmwxB0FpOndW5fisM5H8hsZSxU2VWVB5CWIkIjWvrHjIhxk2g3bfMKM87zNTrZddw==} + engines: {node: '>=10.13.0'} + hasBin: true + + pretty-error@4.0.0: + resolution: {integrity: sha512-AoJ5YMAcXKYxKhuJGdcvse+Voc6v1RgnsR3nWcYU7q4t6z0Q6T86sv5Zq8VIRbOWWFpvdGE83LtdSMNd+6Y0xw==} + + pretty-format@27.5.1: + resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + + pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + + pretty-format@30.4.1: + resolution: {integrity: sha512-K6KiKMHTL4jjX4u3Kir2EW07nRfcqVTXIImx50wbjHQTcZPgg+gjVeNTIT3l3L1Rd4UefxfogquC9J37SoFyyw==} + engines: {node: ^18.14.0 || ^20.0.0 || ^22.0.0 || >=24.0.0} + + process-nextick-args@2.0.1: + resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} + + prompts@2.4.2: + resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==} + engines: {node: '>= 6'} + + proxy-addr@2.0.7: + resolution: {integrity: sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==} + engines: {node: '>= 0.10'} + + psl@1.15.0: + resolution: {integrity: sha512-JZd3gMVBAVQkSs6HdNZo9Sdo0LNcQeMNP3CozBJb3JYC/QUYZTnKxP+f8oWRX4rHP5EurWxqAHTSwUCjlNKa1w==} + + public-encrypt@4.0.3: + resolution: {integrity: sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==} + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + + pure-rand@6.1.0: + resolution: {integrity: sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==} + + pure-rand@7.0.1: + resolution: {integrity: sha512-oTUZM/NAZS8p7ANR3SHh30kXB+zK2r2BPcEn/awJIbOvq82WoMN4p62AWWp3Hhw50G0xMsw1mhIBLqHw64EcNQ==} + + pvtsutils@1.3.6: + resolution: {integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==} + + pvutils@1.1.5: + resolution: {integrity: sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==} + engines: {node: '>=16.0.0'} + + qs@6.15.3: + resolution: {integrity: sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==} + engines: {node: '>=0.6'} + + querystringify@2.2.0: + resolution: {integrity: sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==} + + queue-microtask@1.2.3: + resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} + + randombytes@2.1.0: + resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==} + + randomfill@1.0.4: + resolution: {integrity: sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==} + + range-parser@1.2.0: + resolution: {integrity: sha512-kA5WQoNVo4t9lNx2kQNFCxKeBl5IbbSNBl1M/tLkw9WCn+hxNBAW5Qh8gdhs63CJnhjJ2zQWFoqPJP2sK1AV5A==} + engines: {node: '>= 0.6'} + + range-parser@1.2.1: + resolution: {integrity: sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==} + engines: {node: '>= 0.6'} + + range-parser@1.3.0: + resolution: {integrity: sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw==} + engines: {node: '>= 0.6'} + + raw-body@2.5.3: + resolution: {integrity: sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==} + engines: {node: '>= 0.8'} + + rc@1.2.8: + resolution: {integrity: sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==} + hasBin: true + + react-is@17.0.2: + resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + + react-is@18.3.1: + resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} + + react-is@19.2.7: + resolution: {integrity: sha512-kZFnouyVv7eP/Phmrlo9FK+zcAdriZJvzxXHF1Sl1P377WSGe2G/JxVolhTrB/jeV47lKImhNUsijjHAAbcl/A==} + + readable-stream@2.3.8: + resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} + + readable-stream@3.6.2: + resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} + engines: {node: '>= 6'} + + readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + + rechoir@0.8.0: + resolution: {integrity: sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==} + engines: {node: '>= 10.13.0'} + + redent@3.0.0: + resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} + engines: {node: '>=8'} + + reflect-metadata@0.2.2: + resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} + + regenerate-unicode-properties@10.2.2: + resolution: {integrity: sha512-m03P+zhBeQd1RGnYxrGyDAPpWX/epKirLrp8e3qevZdVkKtnCrjjWczIbYc8+xd6vcTStVlqfycTx1KR4LOr0g==} + engines: {node: '>=4'} + + regenerate@1.4.2: + resolution: {integrity: sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==} + + regenerator-runtime@0.14.1: + resolution: {integrity: sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==} + + regexp.prototype.flags@1.5.4: + resolution: {integrity: sha512-dYqgNSZbDwkaJ2ceRd9ojCGjBq+mOm9LmtXnAnEGyHhN/5R7iDW2TRw3h+o/jCFxus3P2LfWIIiwowAjANm7IA==} + engines: {node: '>= 0.4'} + + regexpu-core@6.4.0: + resolution: {integrity: sha512-0ghuzq67LI9bLXpOX/ISfve/Mq33a4aFRzoQYhnnok1JOFpmE/A2TBGkNVenOGEeSBCjIiWcc6MVOG5HEQv0sA==} + engines: {node: '>=4'} + + registry-auth-token@3.3.2: + resolution: {integrity: sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==} + + registry-url@3.1.0: + resolution: {integrity: sha512-ZbgR5aZEdf4UKZVBPYIgaglBmSF2Hi94s2PcIHhRGFjKYu+chjJdYfHn4rt3hB6eCKLJ8giVIIfgMa1ehDfZKA==} + engines: {node: '>=0.10.0'} + + regjsgen@0.8.0: + resolution: {integrity: sha512-RvwtGe3d7LvWiDQXeQw8p5asZUmfU1G/l6WbUXeHta7Y2PEIvBTwH6E2EfmYUK8pxcxEdEmaomqyp0vZZ7C+3Q==} + + regjsparser@0.13.2: + resolution: {integrity: sha512-NgRBy2Nx/bE+9F27nVHnqcN5HjyLmecqsqx2PJHu3/IEtADD4WuxuXIVExD5PoSDFVrl78dOonfcOe5O+5nbzQ==} + hasBin: true + + relateurl@0.2.7: + resolution: {integrity: sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==} + engines: {node: '>= 0.10'} + + renderkid@3.0.0: + resolution: {integrity: sha512-q/7VIQA8lmM1hF+jn+sFSPWGlMkSAeNYcPLmDQx2zzuiDfaLrOmumR8iaUKlenFgh0XRPIUeSPlH3A+AW3Z5pg==} + + require-directory@2.1.1: + resolution: {integrity: sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==} + engines: {node: '>=0.10.0'} + + require-from-string@2.0.2: + resolution: {integrity: sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==} + engines: {node: '>=0.10.0'} + + requires-port@1.0.0: + resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} + + resolve-cwd@3.0.0: + resolution: {integrity: sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==} + engines: {node: '>=8'} + + resolve-from@4.0.0: + resolution: {integrity: sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==} + engines: {node: '>=4'} + + resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + + resolve.exports@2.0.3: + resolution: {integrity: sha512-OcXjMsGdhL4XnbShKpAcSqPMzQoYkYyhbEaeSko47MjRP9NfEQMhZkXL1DoFlt9LWQn4YttrdnV6X2OiyzBi+A==} + engines: {node: '>=10'} + + resolve@1.22.12: + resolution: {integrity: sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==} + engines: {node: '>= 0.4'} + hasBin: true + + retry@0.13.1: + resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} + engines: {node: '>= 4'} + + reusify@1.1.0: + resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} + engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + + rimraf@3.0.2: + resolution: {integrity: sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==} + deprecated: Rimraf versions prior to v4 are no longer supported + hasBin: true + + ripemd160@2.0.3: + resolution: {integrity: sha512-5Di9UC0+8h1L6ZD2d7awM7E/T4uA1fJRlx6zk/NvdCCVEoAnFqvHmCuNeIKoCeIixBX/q8uM+6ycDvF8woqosA==} + engines: {node: '>= 0.8'} + + rolldown@1.1.5: + resolution: {integrity: sha512-t9z29cJjXf/vxQ8dyhCSpt6H6aSwHTk8cT5I3iy6SMXuFpk5mB6PL6XfC8PCwrPTx93udwKUm9HRteAlTGBLiA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + + rollup-plugin-node-externals@6.1.2: + resolution: {integrity: sha512-2TWan0u0/zHcgPrKpIPgKSY8OMqwDAYD380I0hxx7iUQw8mrN34DWwG9sQUMEo5Yy4xd6/5QEAySYgiKN9fdBQ==} + engines: {node: '>=16.0.0'} + peerDependencies: + rollup: ^3.0.0 || ^4.0.0 + + rollup@4.59.0: + resolution: {integrity: sha512-2oMpl67a3zCH9H79LeMcbDhXW/UmWG/y2zuqnF2jQq5uq9TbM9TVyXvA4+t+ne2IIkBdrLpAaRQAvo7YI/Yyeg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + + rpc-websockets@9.3.9: + resolution: {integrity: sha512-2iQDaTB4g5fDB2ihrTFSJSibCEuxaRi1q7qTW7ZO9/M5/TC+ToHA4D9/ffNLEbAoHNNrcdeP05oATNk44SKZXA==} + + rrweb-cssom@0.6.0: + resolution: {integrity: sha512-APM0Gt1KoXBz0iIkkdB/kfvGOwC4UuJFeG/c+yV7wSc7q96cG/kJ0HiYCnzivD9SB53cLV1MlHFNfOuPaadYSw==} + + rrweb-cssom@0.8.0: + resolution: {integrity: sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==} + + run-applescript@7.1.0: + resolution: {integrity: sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==} + engines: {node: '>=18'} + + run-parallel@1.2.0: + resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} + + safe-buffer@5.1.2: + resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} + + safe-buffer@5.2.1: + resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} + + safe-regex-test@1.1.0: + resolution: {integrity: sha512-x/+Cz4YrimQxQccJf5mKEbIa1NzeCRNI5Ecl/ekmlYaampdNLPalVyIcCZNNH3MvmqBugV5TMYZXv0ljslUlaw==} + engines: {node: '>= 0.4'} + + safer-buffer@2.1.2: + resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + + schema-utils@4.3.3: + resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} + engines: {node: '>= 10.13.0'} + + select-hose@2.0.0: + resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} + + selfsigned@2.4.1: + resolution: {integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==} + engines: {node: '>=10'} + + semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + + semver@7.8.5: + resolution: {integrity: sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==} + engines: {node: '>=10'} + hasBin: true + + send@0.19.2: + resolution: {integrity: sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==} + engines: {node: '>= 0.8.0'} + + serialize-javascript@7.0.7: + resolution: {integrity: sha512-YAy8Od6KV+uuwUuU50np8fGB/Aues6Y0nAhA9y/hId74PlKUcme4pXcBD46NWKr1Q4osN/iseZ17YqO1XfmI8g==} + engines: {node: '>=20.0.0'} + + serve-handler@6.1.6: + resolution: {integrity: sha512-x5RL9Y2p5+Sh3D38Fh9i/iQ5ZK+e4xuXRd/pGbM4D13tgo/MGwbttUk8emytcr1YYzBYs+apnUngBDFYfpjPuQ==} + + serve-index@1.9.2: + resolution: {integrity: sha512-KDj11HScOaLmrPxl70KYNW1PksP4Nb/CLL2yvC+Qd2kHMPEEpfc4Re2e4FOay+bC/+XQl/7zAcWON3JVo5v3KQ==} + engines: {node: '>= 0.8.0'} + + serve-static@1.16.3: + resolution: {integrity: sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==} + engines: {node: '>= 0.8.0'} + + serve@14.2.5: + resolution: {integrity: sha512-Qn/qMkzCcMFVPb60E/hQy+iRLpiU8PamOfOSYoAHmmF+fFFmpPpqa6Oci2iWYpTdOUM3VF+TINud7CfbQnsZbA==} + engines: {node: '>= 14'} + hasBin: true + + set-function-length@1.2.2: + resolution: {integrity: sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==} + engines: {node: '>= 0.4'} + + set-function-name@2.0.2: + resolution: {integrity: sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ==} + engines: {node: '>= 0.4'} + + setprototypeof@1.2.0: + resolution: {integrity: sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==} + + sha.js@2.4.12: + resolution: {integrity: sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==} + engines: {node: '>= 0.10'} + hasBin: true + + sha256-uint8array@0.10.7: + resolution: {integrity: sha512-1Q6JQU4tX9NqsDGodej6pkrUVQVNapLZnvkwIhddH/JqzBZF1fSaxSWNY6sziXBE8aEa2twtGkXUrwzGeZCMpQ==} + + shallow-clone@3.0.1: + resolution: {integrity: sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==} + engines: {node: '>=8'} + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + + shell-quote@1.9.0: + resolution: {integrity: sha512-Iov+JwFv/2HcTpcwNMKd8+IWNb8tboQJNQTkAY/LLVK7gGH9jy+LGkVqPxfekHl+yMmiqXszdGWXgkfml7hjqA==} + engines: {node: '>= 0.4'} + + side-channel-list@1.0.1: + resolution: {integrity: sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==} + engines: {node: '>= 0.4'} + + side-channel-map@1.0.1: + resolution: {integrity: sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==} + engines: {node: '>= 0.4'} + + side-channel-weakmap@1.0.2: + resolution: {integrity: sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==} + engines: {node: '>= 0.4'} + + side-channel@1.1.1: + resolution: {integrity: sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==} + engines: {node: '>= 0.4'} + + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + + signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + + signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + + sirv@3.0.2: + resolution: {integrity: sha512-2wcC/oGxHis/BoHkkPwldgiPSYcpZK3JU28WoMVv55yHJgcZ8rlXvuG9iZggz+sU1d4bRgIGASwyWqjxu3FM0g==} + engines: {node: '>=18'} + + sisteransi@1.0.5: + resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} + + slash@3.0.0: + resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} + engines: {node: '>=8'} + + slash@4.0.0: + resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==} + engines: {node: '>=12'} + + sockjs@0.3.24: + resolution: {integrity: sha512-GJgLTZ7vYb/JtPSSZ10hsOYIvEYsjbNU+zPdIHcUaWVNUEPivzxku31865sSSud0Da0W4lEeOPlmw93zLQchuQ==} + + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + + source-map-support@0.5.13: + resolution: {integrity: sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==} + + source-map-support@0.5.21: + resolution: {integrity: sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==} + + source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + + source-map@0.7.6: + resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} + engines: {node: '>= 12'} + + spdy-transport@3.0.0: + resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} + + spdy@4.0.2: + resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} + engines: {node: '>=6.0.0'} + + sprintf-js@1.0.3: + resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + + stack-utils@2.0.6: + resolution: {integrity: sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==} + engines: {node: '>=10'} + + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + statuses@1.5.0: + resolution: {integrity: sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA==} + engines: {node: '>= 0.6'} + + statuses@2.0.2: + resolution: {integrity: sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==} + engines: {node: '>= 0.8'} + + std-env@4.2.0: + resolution: {integrity: sha512-oCUKSupKTHX53EyjDtuZQ64pjLJ6yYCtpmEw0goYxtjG9KpbRe8KAsl2tBUGU9DyMcJ0RwJ8GqJAFzMXcXW1Rw==} + + stop-iteration-iterator@1.1.0: + resolution: {integrity: sha512-eLoXW/DHyl62zxY4SCaIgnRhuMr6ri4juEYARS8E6sCEqzKpOiE521Ucofdx+KnDZl5xmvGYaaKCk5FEOxJCoQ==} + engines: {node: '>= 0.4'} + + stream-browserify@3.0.0: + resolution: {integrity: sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==} + + stream-chain@2.2.5: + resolution: {integrity: sha512-1TJmBx6aSWqZ4tx7aTpBDXK0/e2hhcNSTV8+CbFJtDjbb+I1mZ8lHit0Grw9GRT+6JbIrrDd8esncgBi8aBXGA==} + + stream-json@1.9.1: + resolution: {integrity: sha512-uWkjJ+2Nt/LO9Z/JyKZbMusL8Dkh97uUBTv3AJQ74y07lVahLY4eEFsPsE97pxYBwr8nnjMAIch5eqI0gPShyw==} + + string-length@4.0.2: + resolution: {integrity: sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==} + engines: {node: '>=10'} + + string-width@4.2.3: + resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} + engines: {node: '>=8'} + + string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + + string_decoder@1.1.1: + resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} + + string_decoder@1.3.0: + resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} + + strip-ansi@6.0.1: + resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} + engines: {node: '>=8'} + + strip-ansi@7.2.0: + resolution: {integrity: sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==} + engines: {node: '>=12'} + + strip-bom@4.0.0: + resolution: {integrity: sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==} + engines: {node: '>=8'} + + strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + + strip-indent@3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + + strip-json-comments@2.0.1: + resolution: {integrity: sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==} + engines: {node: '>=0.10.0'} + + strip-json-comments@3.1.1: + resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} + engines: {node: '>=8'} + + style-loader@3.3.3: + resolution: {integrity: sha512-53BiGLXAcll9maCYtZi2RCQZKa8NQQai5C4horqKyRmHj9H7QmcUyucrH+4KW/gBQbXM2AsB0axoEcFZPlfPcw==} + engines: {node: '>= 12.13.0'} + peerDependencies: + webpack: ^5.0.0 + + superstruct@2.0.2: + resolution: {integrity: sha512-uV+TFRZdXsqXTL2pRvujROjdZQ4RAlBUS5BTh9IGm+jTqQntYThciG/qu57Gs69yjnVUSqdxF9YLmSnpupBW9A==} + engines: {node: '>=14.0.0'} + + supports-color@7.2.0: + resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==} + engines: {node: '>=8'} + + supports-color@8.1.1: + resolution: {integrity: sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==} + engines: {node: '>=10'} + + supports-preserve-symlinks-flag@1.0.0: + resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} + engines: {node: '>= 0.4'} + + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + + synckit@0.11.13: + resolution: {integrity: sha512-eNRKgb3z66Yp3D2CixVujOUvXLFUTij/zVnV8KRyvFdQwpz7I5DS8UfRkTeLzb64u+dkzDSdelE24izu+zSSUg==} + engines: {node: ^14.18.0 || >=16.0.0} + + tapable@2.3.3: + resolution: {integrity: sha512-uxc/zpqFg6x7C8vOE7lh6Lbda8eEL9zmVm/PLeTPBRhh1xCgdWaQ+J1CUieGpIfm2HdtsUpRv+HshiasBMcc6A==} + engines: {node: '>=6'} + + terser-webpack-plugin@5.6.1: + resolution: {integrity: sha512-201R5j+sJpK8nFWwKVyNfZot8FaJbLZDq5evriVzbV1wDtSXDjRUDRfJzHpAaxFDMEhsZL1QkeqM61wgsS3KaQ==} + engines: {node: '>= 10.13.0'} + peerDependencies: + '@minify-html/node': '*' + '@swc/core': '*' + '@swc/css': '*' + '@swc/html': '*' + clean-css: '*' + cssnano: '*' + csso: '*' + esbuild: '*' + html-minifier-terser: '*' + lightningcss: '*' + postcss: '*' + uglify-js: '*' + webpack: ^5.1.0 + peerDependenciesMeta: + '@minify-html/node': + optional: true + '@swc/core': + optional: true + '@swc/css': + optional: true + '@swc/html': + optional: true + clean-css: + optional: true + cssnano: + optional: true + csso: + optional: true + esbuild: + optional: true + html-minifier-terser: + optional: true + lightningcss: + optional: true + postcss: + optional: true + uglify-js: + optional: true + + terser@5.49.0: + resolution: {integrity: sha512-SNiDnXyHSrxVcIOtVbULzcTmniUiwcV7Nwdyj1twVubeTmbjoa8p69KKDpfkdoOavuM4/GRm1+ykI8qqnavHoA==} + engines: {node: '>=10'} + hasBin: true + + test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} + + text-encoding-utf-8@1.0.2: + resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} + + text-table@0.2.0: + resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} + + thingies@2.6.0: + resolution: {integrity: sha512-rMHRjmlFLM1R96UYPvpmnc3LYtdFrT33JIB7L9hetGue1qAPfn1N2LJeEjxUSidu1Iku+haLZXDuEXUHNGO/lg==} + engines: {node: '>=10.18'} + peerDependencies: + tslib: ^2 + + thunky@1.1.0: + resolution: {integrity: sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==} + + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@1.2.4: + resolution: {integrity: sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==} + engines: {node: '>=18'} + + tinyglobby@0.2.17: + resolution: {integrity: sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==} + engines: {node: '>=12.0.0'} + + tinyrainbow@3.1.0: + resolution: {integrity: sha512-Bf+ILmBgretUrdJxzXM0SgXLZ3XfiaUuOj/IKQHuTXip+05Xn+uyEYdVg0kYDipTBcLrCVyUzAPz7QmArb0mmw==} + engines: {node: '>=14.0.0'} + + tldts-core@6.1.86: + resolution: {integrity: sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==} + + tldts@6.1.86: + resolution: {integrity: sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==} + hasBin: true + + tmpl@1.0.5: + resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==} + + to-buffer@1.2.2: + resolution: {integrity: sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==} + engines: {node: '>= 0.4'} + + to-regex-range@5.0.1: + resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} + engines: {node: '>=8.0'} + + toidentifier@1.0.1: + resolution: {integrity: sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==} + engines: {node: '>=0.6'} + + totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + + tough-cookie@4.1.4: + resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} + engines: {node: '>=6'} + + tough-cookie@5.1.2: + resolution: {integrity: sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==} + engines: {node: '>=16'} + + tr46@0.0.3: + resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} + + tr46@4.1.1: + resolution: {integrity: sha512-2lv/66T7e5yNyhAAC4NaKe5nVavzuGJQVVtRYLyQ2OI8tsJ61PMLlelehb0wi2Hx6+hT/OJUWZcw8MjlSRnxvw==} + engines: {node: '>=14'} + + tr46@5.1.1: + resolution: {integrity: sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==} + engines: {node: '>=18'} + + tree-dump@1.1.0: + resolution: {integrity: sha512-rMuvhU4MCDbcbnleZTFezWsaZXRFemSqAM+7jPnzUl1fo9w3YEKOxAeui0fz3OI4EU4hf23iyA7uQRVko+UaBA==} + engines: {node: '>=10.0'} + peerDependencies: + tslib: '2' + + ts-jest@29.4.11: + resolution: {integrity: sha512-IrFl7l9AuB/qrNw5quqvAv/hmKMb8dhWOH4jQOGo0Oq8tCeo1O86/iTFG1FaRimgUkF13l4PcepO8ATFT6Ns4g==} + engines: {node: ^14.15.0 || ^16.10.0 || ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@babel/core': '>=7.0.0-beta.0 <8' + '@jest/transform': ^29.0.0 || ^30.0.0 + '@jest/types': ^29.0.0 || ^30.0.0 + babel-jest: ^29.0.0 || ^30.0.0 + esbuild: '*' + jest: ^29.0.0 || ^30.0.0 + jest-util: ^29.0.0 || ^30.0.0 + typescript: '>=4.3 <7' + peerDependenciesMeta: + '@babel/core': + optional: true + '@jest/transform': + optional: true + '@jest/types': + optional: true + babel-jest: + optional: true + esbuild: + optional: true + jest-util: + optional: true + + ts-loader@9.6.2: + resolution: {integrity: sha512-R4iuczmtgxvtuI556s+hTZ6/7Ee03VCAk/l/M8LY1OAsUgB7YydsCxkgq9D9pKRaD7GJqUi2u8fp9zZP/ufjKA==} + engines: {node: '>=12.0.0'} + peerDependencies: + loader-utils: '*' + typescript: '*' + webpack: ^4.0.0 || ^5.0.0 + peerDependenciesMeta: + loader-utils: + optional: true + + ts-node@10.9.2: + resolution: {integrity: sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==} + hasBin: true + peerDependencies: + '@swc/core': '>=1.2.50' + '@swc/wasm': '>=1.2.50' + '@types/node': '*' + typescript: '>=2.7' + peerDependenciesMeta: + '@swc/core': + optional: true + '@swc/wasm': + optional: true + + tslib@1.14.1: + resolution: {integrity: sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==} + + tslib@2.8.1: + resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + + tsyringe@4.10.0: + resolution: {integrity: sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==} + engines: {node: '>= 6.0.0'} + + turbo@2.10.4: + resolution: {integrity: sha512-GQpduILaKjoaGljw097ScsSyKTtZSY7cZ3bJktzfTkPMyCf3ShKLuXK2IaOEN2Plziml+ArR7WJ1m+V4VbnaKQ==} + hasBin: true + + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + + type-fest@0.20.2: + resolution: {integrity: sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==} + engines: {node: '>=10'} + + type-fest@0.21.3: + resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==} + engines: {node: '>=10'} + + type-fest@2.19.0: + resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==} + engines: {node: '>=12.20'} + + type-fest@4.41.0: + resolution: {integrity: sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==} + engines: {node: '>=16'} + + type-is@1.6.18: + resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} + engines: {node: '>= 0.6'} + + typed-array-buffer@1.0.3: + resolution: {integrity: sha512-nAYYwfY3qnzX30IkA6AQZjVbtK6duGontcQm1WSG1MD94YLqK0515GNApXkoxKOWMusVssAHWLh9SeaoefYFGw==} + engines: {node: '>= 0.4'} + + typescript@5.4.3: + resolution: {integrity: sha512-KrPd3PKaCLr78MalgiwJnA25Nm8HAmdwN3mYUYZgG/wizIo9EainNVQI9/yDavtVFRN2h3k8uf3GLHuhDMgEHg==} + engines: {node: '>=14.17'} + hasBin: true + + uglify-js@3.19.3: + resolution: {integrity: sha512-v3Xu+yuwBXisp6QYTcH4UbH+xYJXqnq2m/LtQVWKWzYc1iehYnLixoQDN9FH6/j9/oybfd6W9Ghwkl8+UMKTKQ==} + engines: {node: '>=0.8.0'} + hasBin: true + + undici-types@7.28.0: + resolution: {integrity: sha512-LJAfY+2w6HGeT8d8J1wNQsUGUEGio6NWWpwdwurQe4f6oojzCFuGLizl1KSve4irsTxyLly1QhEeE6iapdaIvQ==} + + undici-types@8.3.0: + resolution: {integrity: sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==} + + unicode-canonical-property-names-ecmascript@2.0.1: + resolution: {integrity: sha512-dA8WbNeb2a6oQzAQ55YlT5vQAWGV9WXOsi3SskE3bcCdM0P4SDd+24zS/OCacdRq5BkdsRj9q3Pg6YyQoxIGqg==} + engines: {node: '>=4'} + + unicode-match-property-ecmascript@2.0.0: + resolution: {integrity: sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==} + engines: {node: '>=4'} + + unicode-match-property-value-ecmascript@2.2.1: + resolution: {integrity: sha512-JQ84qTuMg4nVkx8ga4A16a1epI9H6uTXAknqxkGF/aFfRLw1xC/Bp24HNLaZhHSkWd3+84t8iXnp1J0kYcZHhg==} + engines: {node: '>=4'} + + unicode-property-aliases-ecmascript@2.2.0: + resolution: {integrity: sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==} + engines: {node: '>=4'} + + universalify@0.2.0: + resolution: {integrity: sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==} + engines: {node: '>= 4.0.0'} + + unpipe@1.0.0: + resolution: {integrity: sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==} + engines: {node: '>= 0.8'} + + unrs-resolver@1.12.2: + resolution: {integrity: sha512-dmlRxBJJayXjqTwC+JtF1HhJmgf3ftQ3YejFcZrf4+KKtJv0qDsK1pjqaaVjG7wJ5NJ6UVP1OqRMQ71Z4C3rxQ==} + + update-browserslist-db@1.2.3: + resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} + hasBin: true + peerDependencies: + browserslist: '>= 4.21.0' + + update-check@1.5.4: + resolution: {integrity: sha512-5YHsflzHP4t1G+8WGPlvKbJEbAJGCgw+Em+dGR1KmBUbr1J36SJBqlHLjR7oob7sco5hWHGQVcr9B2poIVDDTQ==} + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + url-parse@1.5.10: + resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} + + utf-8-validate@6.0.6: + resolution: {integrity: sha512-q3l3P9UtEEiAHcsgsqTgf9PPjctrDWoIXW3NpOHFdRDbLvu4DLIcxHangJ4RLrWkBcKjmcs/6NkerI8T/rE4LA==} + engines: {node: '>=6.14.2'} + + util-deprecate@1.0.2: + resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} + + util@0.12.5: + resolution: {integrity: sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==} + + utila@0.4.0: + resolution: {integrity: sha512-Z0DbgELS9/L/75wZbro8xAnT50pBVFQZ+hUEueGDU5FN51YSCYM+jdxsfCiHjwNP/4LCDD0i/graKpeBnOXKRA==} + + utils-merge@1.0.1: + resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==} + engines: {node: '>= 0.4.0'} + + uuid@14.0.1: + resolution: {integrity: sha512-6ZxzVpzDXDa3bJWaHilVayA+BH/1zmxCJoVgvmqJnid/gPoKHxUrS/aC/T6LGQtNHT+XHG9fXPJB4d+IrU30Ew==} + hasBin: true + + uuid@8.3.2: + resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} + deprecated: uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028). + hasBin: true + + v8-compile-cache-lib@3.0.1: + resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + + v8-to-istanbul@9.3.0: + resolution: {integrity: sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==} + engines: {node: '>=10.12.0'} + + vary@1.1.2: + resolution: {integrity: sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==} + engines: {node: '>= 0.8'} + + viem@2.45.0: + resolution: {integrity: sha512-iVA9qrAgRdtpWa80lCZ6Jri6XzmLOwwA1wagX2HnKejKeliFLpON0KOdyfqvcy+gUpBVP59LBxP2aKiL3aj8fg==} + peerDependencies: + typescript: '>=5.0.4' + peerDependenciesMeta: + typescript: + optional: true + + vite@8.1.4: + resolution: {integrity: sha512-bTT9PsdWO+MQMNG9ZXIP/qM9wGh37DFxTV/sPq9cFpHr3w4jkgef032PkAL9jAqhk3Nz8NQw3O8n6/xFkqO4QQ==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + '@types/node': ^20.19.0 || >=22.12.0 + '@vitejs/devtools': ^0.3.0 + esbuild: ^0.27.0 || ^0.28.0 + jiti: '>=1.21.0' + less: ^4.0.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 + peerDependenciesMeta: + '@types/node': + optional: true + '@vitejs/devtools': + optional: true + esbuild: + optional: true + jiti: + optional: true + less: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: + optional: true + + vitest@4.1.10: + resolution: {integrity: sha512-R9jUTe5S4Qb0HCd4TNqpC7oGcrMssMRGXLW80ubjWsW9VH5GF8y1Y0SFLY9AbqSk6nt0PnOx4H4WNJYZ13GUPw==} + engines: {node: ^20.0.0 || ^22.0.0 || >=24.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@opentelemetry/api': ^1.9.0 + '@types/node': ^20.0.0 || ^22.0.0 || >=24.0.0 + '@vitest/browser-playwright': 4.1.10 + '@vitest/browser-preview': 4.1.10 + '@vitest/browser-webdriverio': 4.1.10 + '@vitest/coverage-istanbul': 4.1.10 + '@vitest/coverage-v8': 4.1.10 + '@vitest/ui': 4.1.10 + happy-dom: '*' + jsdom: '*' + vite: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@opentelemetry/api': + optional: true + '@types/node': + optional: true + '@vitest/browser-playwright': + optional: true + '@vitest/browser-preview': + optional: true + '@vitest/browser-webdriverio': + optional: true + '@vitest/coverage-istanbul': + optional: true + '@vitest/coverage-v8': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + w3c-xmlserializer@4.0.0: + resolution: {integrity: sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw==} + engines: {node: '>=14'} + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + + walker@1.0.8: + resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} + + watchpack@2.5.2: + resolution: {integrity: sha512-6i/00NBjP4yGPs+caKSyRfpTF/8Torsu0MOW3mMzIbhgISFder8i7xbqgHlLMwJrdiN8ndBV3UA1/AfzPSr+jg==} + engines: {node: '>=10.13.0'} + + wbuf@1.7.3: + resolution: {integrity: sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==} + + webidl-conversions@3.0.1: + resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} + + webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + + webpack-cli@5.1.4: + resolution: {integrity: sha512-pIDJHIEI9LR0yxHXQ+Qh95k2EvXpWzZ5l+d+jIo+RdSm9MiHfzazIxwwni/p7+x4eJZuvG1AJwgC4TNQ7NRgsg==} + engines: {node: '>=14.15.0'} + hasBin: true + peerDependencies: + '@webpack-cli/generators': '*' + webpack: 5.x.x + webpack-bundle-analyzer: '*' + webpack-dev-server: '*' + peerDependenciesMeta: + '@webpack-cli/generators': + optional: true + webpack-bundle-analyzer: + optional: true + webpack-dev-server: + optional: true + + webpack-dev-middleware@7.4.5: + resolution: {integrity: sha512-uxQ6YqGdE4hgDKNf7hUiPXOdtkXvBJXrfEGYSx7P7LC8hnUYGK70X6xQXUvXeNyBDDcsiQXpG2m3G9vxowaEuA==} + engines: {node: '>= 18.12.0'} + peerDependencies: + webpack: ^5.0.0 + peerDependenciesMeta: + webpack: + optional: true + + webpack-dev-server@5.2.2: + resolution: {integrity: sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==} + engines: {node: '>= 18.12.0'} + hasBin: true + peerDependencies: + webpack: ^5.0.0 + webpack-cli: '*' + peerDependenciesMeta: + webpack: + optional: true + webpack-cli: + optional: true + + webpack-merge@5.10.0: + resolution: {integrity: sha512-+4zXKdx7UnO+1jaN4l2lHVD+mFvnlZQP/6ljaJVb4SZiwIKeUnrT5l0gkT8z+n4hKpC+jpOv6O9R+gLtag7pSA==} + engines: {node: '>=10.0.0'} + + webpack-sources@3.5.1: + resolution: {integrity: sha512-jyuiGJdtvY434z5bUZrjz67v76/ePNvFZTp9Mdz29IlH4+GPsgyGjiv0fKI+M7BdkU6ADjulUcKAd3tUK3WlEw==} + engines: {node: '>=10.13.0'} + + webpack-subresource-integrity@5.2.0-rc.1: + resolution: {integrity: sha512-SyjlQ3VZVwpNeVPIMpYf9Qt6oTnq9G3lCcr5YNwjW9TfUoip70MlB9ZDNhJPhkHvfvajMDQwZFfDVVL1QVwnLQ==} + engines: {node: '>= 12'} + peerDependencies: + html-webpack-plugin: '>= 5.0.0-beta.1 < 6' + webpack: ^5.12.0 + peerDependenciesMeta: + html-webpack-plugin: + optional: true + + webpack@5.102.1: + resolution: {integrity: sha512-7h/weGm9d/ywQ6qzJ+Xy+r9n/3qgp/thalBbpOi5i223dPXKi04IBtqPN9nTd+jBc7QKfvDbaBnFipYp4sJAUQ==} + engines: {node: '>=10.13.0'} + hasBin: true + peerDependencies: + webpack-cli: '*' + peerDependenciesMeta: + webpack-cli: + optional: true + + websocket-driver@0.7.5: + resolution: {integrity: sha512-ZL2+3c7kMBdIRCMz6l8jQMHyGVxj+UL+xVk74Ombiciboca8rHa15L86B19E5oh1pL9Ii/uj54gtsIrZGMo6zA==} + engines: {node: '>=0.8.0'} + + websocket-extensions@0.1.4: + resolution: {integrity: sha512-OqedPIGOfsDlo31UNwYbCFMSaO9m9G/0faIHj5/dZFDMFqPTcx6UwqyOy3COEaEOg/9VsGIpdqn62W5KhoKSpg==} + engines: {node: '>=0.8.0'} + + whatwg-encoding@2.0.0: + resolution: {integrity: sha512-p41ogyeMUrw3jWclHWTQg1k05DSVXPLcVxRTYsXUk+ZooOCZLcoYgPZ/HL/D/N+uQPOtcp1me1WhBEaX02mhWg==} + engines: {node: '>=12'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation + + whatwg-encoding@3.1.1: + resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} + engines: {node: '>=18'} + deprecated: Use @exodus/bytes instead for a more spec-conformant and faster implementation + + whatwg-mimetype@3.0.0: + resolution: {integrity: sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q==} + engines: {node: '>=12'} + + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-url@12.0.1: + resolution: {integrity: sha512-Ed/LrqB8EPlGxjS+TrsXcpUond1mhccS3pchLhzSgPCnTimUCKj3IZE75pAs5m6heB2U2TMerKFUXheyHY+VDQ==} + engines: {node: '>=14'} + + whatwg-url@14.2.0: + resolution: {integrity: sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==} + engines: {node: '>=18'} + + whatwg-url@5.0.0: + resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} + + which-boxed-primitive@1.1.1: + resolution: {integrity: sha512-TbX3mj8n0odCBFVlY8AxkqcHASw3L60jIuF8jFP78az3C2YhmGvqbHBpAjTRH2/xqYunrJ9g1jSyjCjpoWzIAA==} + engines: {node: '>= 0.4'} + + which-collection@1.0.2: + resolution: {integrity: sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==} + engines: {node: '>= 0.4'} + + which-typed-array@1.1.22: + resolution: {integrity: sha512-fvO4ExWMFsqyhG3AiPAObMuY1lxaqgYcxbc49CNdWDDECOJNgQyvsOWVwbZc+qf3rzRtxojBK+CMEv0Ld5CYpw==} + engines: {node: '>= 0.4'} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + + widest-line@4.0.1: + resolution: {integrity: sha512-o0cyEG0e8GPzT4iGHphIOh0cJOV8fivsXxddQasHPHfoZf1ZexrfeA21w2NaEN1RHE+fXlfISmOE8R9N3u3Qig==} + engines: {node: '>=12'} + + wildcard@2.0.1: + resolution: {integrity: sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==} + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + wordwrap@1.0.0: + resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==} + + wrap-ansi@7.0.0: + resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==} + engines: {node: '>=10'} + + wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + + wrappy@1.0.2: + resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==} + + write-file-atomic@4.0.2: + resolution: {integrity: sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==} + engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0} + + write-file-atomic@5.0.1: + resolution: {integrity: sha512-+QU2zd6OTD8XWIJCbffaiQeH9U73qIqafo1x6V1snCWYGJf6cVE0cDR4D8xRzcEnfI21IFrUPzPGtcPf8AC+Rw==} + engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} + + ws@8.21.0: + resolution: {integrity: sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==} + engines: {node: '>=10.0.0'} + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: '>=5.0.2' + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + + wsl-utils@0.1.0: + resolution: {integrity: sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==} + engines: {node: '>=18'} + + xml-name-validator@4.0.0: + resolution: {integrity: sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw==} + engines: {node: '>=12'} + + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + + y18n@5.0.8: + resolution: {integrity: sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==} + engines: {node: '>=10'} + + yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + + yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + + yargs@17.7.3: + resolution: {integrity: sha512-GZtjxm/J/4TSxuL3FNYjCmLktBTnIw/rVmKSIyKeYAZpmJB2ig9VauCC5xsa82GNKVKDAqpOn3KVzNt0zmrU0g==} + engines: {node: '>=12'} + + yn@3.1.1: + resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} + engines: {node: '>=6'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} + + yocto-queue@1.2.2: + resolution: {integrity: sha512-4LCcse/U2MHZ63HAJVE+v71o7yOdIe4cZ70Wpf8D/IyjDKYQLV5GD46B+hSTjJsvV5PztjvHoU580EftxjDZFQ==} + engines: {node: '>=12.20'} + +snapshots: + + '@adobe/css-tools@4.5.0': {} + + '@adraffy/ens-normalize@1.11.1': {} + + '@ampproject/remapping@2.3.0': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@asamuzakjp/css-color@3.2.0': + dependencies: + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-color-parser': 3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + lru-cache: 10.4.3 + + '@babel/code-frame@7.29.7': + dependencies: + '@babel/helper-validator-identifier': 7.29.7 + js-tokens: 4.0.0 + picocolors: 1.1.1 + + '@babel/compat-data@7.29.7': {} + + '@babel/core@7.23.0': + dependencies: + '@ampproject/remapping': 2.3.0 + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.23.0) + '@babel/helpers': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/template': 7.29.7 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + convert-source-map: 2.0.0 + debug: 4.4.3 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/core@7.29.7': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.29.7) + '@babel/helpers': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/template': 7.29.7 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + '@jridgewell/remapping': 2.3.5 + convert-source-map: 2.0.0 + debug: 4.4.3 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/generator@7.29.7': + dependencies: + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + jsesc: 3.1.0 + + '@babel/helper-annotate-as-pure@7.29.7': + dependencies: + '@babel/types': 7.29.7 + + '@babel/helper-compilation-targets@7.29.7': + dependencies: + '@babel/compat-data': 7.29.7 + '@babel/helper-validator-option': 7.29.7 + browserslist: 4.28.5 + lru-cache: 5.1.1 + semver: 6.3.1 + + '@babel/helper-create-class-features-plugin@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-member-expression-to-functions': 7.29.7 + '@babel/helper-optimise-call-expression': 7.29.7 + '@babel/helper-replace-supers': 7.29.7(@babel/core@7.23.0) + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/traverse': 7.29.7 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/helper-create-regexp-features-plugin@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-annotate-as-pure': 7.29.7 + regexpu-core: 6.4.0 + semver: 6.3.1 + + '@babel/helper-define-polyfill-provider@0.4.4(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + debug: 4.4.3 + lodash.debounce: 4.0.8 + resolve: 1.22.12 + transitivePeerDependencies: + - supports-color + + '@babel/helper-define-polyfill-provider@0.5.0(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + debug: 4.4.3 + lodash.debounce: 4.0.8 + resolve: 1.22.12 + transitivePeerDependencies: + - supports-color + + '@babel/helper-define-polyfill-provider@0.6.8(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + debug: 4.4.3 + lodash.debounce: 4.0.8 + resolve: 1.22.12 + transitivePeerDependencies: + - supports-color + + '@babel/helper-globals@7.29.7': {} + + '@babel/helper-member-expression-to-functions@7.29.7': + dependencies: + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-imports@7.29.7': + dependencies: + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-transforms@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-imports': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-module-transforms@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-module-imports': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-optimise-call-expression@7.29.7': + dependencies: + '@babel/types': 7.29.7 + + '@babel/helper-plugin-utils@7.29.7': {} + + '@babel/helper-remap-async-to-generator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-wrap-function': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-replace-supers@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-member-expression-to-functions': 7.29.7 + '@babel/helper-optimise-call-expression': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-skip-transparent-expression-wrappers@7.29.7': + dependencies: + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helper-string-parser@7.29.7': {} + + '@babel/helper-validator-identifier@7.29.7': {} + + '@babel/helper-validator-option@7.29.7': {} + + '@babel/helper-wrap-function@7.29.7': + dependencies: + '@babel/template': 7.29.7 + '@babel/traverse': 7.29.7 + '@babel/types': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/helpers@7.29.7': + dependencies: + '@babel/template': 7.29.7 + '@babel/types': 7.29.7 + + '@babel/parser@7.29.7': + dependencies: + '@babel/types': 7.29.7 + + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + '@babel/plugin-transform-optional-chaining': 7.29.7(@babel/core@7.23.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-proposal-private-property-in-object@7.21.0-placeholder-for-preset-env.2(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-async-generators@7.8.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-bigint@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-properties@7.12.13(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-class-static-block@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-dynamic-import@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-export-namespace-from@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-assertions@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-attributes@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-attributes@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-import-meta@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-json-strings@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-logical-assignment-operators@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-nullish-coalescing-operator@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-numeric-separator@7.10.4(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-object-rest-spread@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-catch-binding@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-optional-chaining@7.8.3(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-private-property-in-object@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-top-level-await@7.14.5(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.7)': + dependencies: + '@babel/core': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-syntax-unicode-sets-regex@7.18.6(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-arrow-functions@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-async-generator-functions@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-remap-async-to-generator': 7.29.7(@babel/core@7.23.0) + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-async-to-generator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-imports': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-remap-async-to-generator': 7.29.7(@babel/core@7.23.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-block-scoped-functions@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-block-scoping@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-class-properties@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-class-static-block@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-classes@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-globals': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-replace-supers': 7.29.7(@babel/core@7.23.0) + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-computed-properties@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/template': 7.29.7 + + '@babel/plugin-transform-destructuring@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-dotall-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-duplicate-keys@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-dynamic-import@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-exponentiation-operator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-export-namespace-from@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-for-of@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-function-name@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-json-strings@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-literals@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-logical-assignment-operators@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-member-expression-literals@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-modules-amd@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-commonjs@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-systemjs@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-modules-umd@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-module-transforms': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-named-capturing-groups-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-new-target@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-nullish-coalescing-operator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-numeric-separator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-object-rest-spread@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/plugin-transform-destructuring': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-parameters': 7.29.7(@babel/core@7.23.0) + '@babel/traverse': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-object-super@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-replace-supers': 7.29.7(@babel/core@7.23.0) + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-optional-catch-binding@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-optional-chaining@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-parameters@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-private-methods@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-private-property-in-object@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-annotate-as-pure': 7.29.7 + '@babel/helper-create-class-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-property-literals@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-regenerator@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-reserved-words@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-shorthand-properties@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-spread@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-skip-transparent-expression-wrappers': 7.29.7 + transitivePeerDependencies: + - supports-color + + '@babel/plugin-transform-sticky-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-template-literals@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-typeof-symbol@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-unicode-escapes@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-unicode-property-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-unicode-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/plugin-transform-unicode-sets-regex@7.29.7(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-create-regexp-features-plugin': 7.29.7(@babel/core@7.23.0) + '@babel/helper-plugin-utils': 7.29.7 + + '@babel/preset-env@7.22.20(@babel/core@7.23.0)': + dependencies: + '@babel/compat-data': 7.29.7 + '@babel/core': 7.23.0 + '@babel/helper-compilation-targets': 7.29.7 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/helper-validator-option': 7.29.7 + '@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-proposal-private-property-in-object': 7.21.0-placeholder-for-preset-env.2(@babel/core@7.23.0) + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.0) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.0) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.23.0) + '@babel/plugin-syntax-dynamic-import': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-export-namespace-from': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-import-assertions': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-syntax-import-attributes': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.23.0) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.0) + '@babel/plugin-syntax-unicode-sets-regex': 7.18.6(@babel/core@7.23.0) + '@babel/plugin-transform-arrow-functions': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-async-generator-functions': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-async-to-generator': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-block-scoped-functions': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-block-scoping': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-class-properties': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-class-static-block': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-classes': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-computed-properties': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-destructuring': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-dotall-regex': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-duplicate-keys': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-dynamic-import': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-exponentiation-operator': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-export-namespace-from': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-for-of': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-function-name': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-json-strings': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-literals': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-logical-assignment-operators': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-member-expression-literals': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-modules-amd': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-modules-commonjs': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-modules-systemjs': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-modules-umd': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-named-capturing-groups-regex': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-new-target': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-nullish-coalescing-operator': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-numeric-separator': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-object-rest-spread': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-object-super': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-optional-catch-binding': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-optional-chaining': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-parameters': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-private-methods': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-private-property-in-object': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-property-literals': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-regenerator': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-reserved-words': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-shorthand-properties': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-spread': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-sticky-regex': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-template-literals': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-typeof-symbol': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-unicode-escapes': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-unicode-property-regex': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-unicode-regex': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-transform-unicode-sets-regex': 7.29.7(@babel/core@7.23.0) + '@babel/preset-modules': 0.1.6-no-external-plugins(@babel/core@7.23.0) + '@babel/types': 7.29.7 + babel-plugin-polyfill-corejs2: 0.4.17(@babel/core@7.23.0) + babel-plugin-polyfill-corejs3: 0.8.7(@babel/core@7.23.0) + babel-plugin-polyfill-regenerator: 0.5.5(@babel/core@7.23.0) + core-js-compat: 3.49.0 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + '@babel/preset-modules@0.1.6-no-external-plugins(@babel/core@7.23.0)': + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-plugin-utils': 7.29.7 + '@babel/types': 7.29.7 + esutils: 2.0.3 + + '@babel/runtime@7.29.7': {} + + '@babel/template@7.29.7': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 + + '@babel/traverse@7.29.7': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/helper-globals': 7.29.7 + '@babel/parser': 7.29.7 + '@babel/template': 7.29.7 + '@babel/types': 7.29.7 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + '@babel/types@7.29.7': + dependencies: + '@babel/helper-string-parser': 7.29.7 + '@babel/helper-validator-identifier': 7.29.7 + + '@bcoe/v8-coverage@0.2.3': {} + + '@blazediff/core@1.9.1': {} + + '@cspotcode/source-map-support@0.8.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.9 + + '@csstools/color-helpers@5.1.0': {} + + '@csstools/css-calc@2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-color-parser@3.1.0(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/color-helpers': 5.1.0 + '@csstools/css-calc': 2.1.4(@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4))(@csstools/css-tokenizer@3.0.4) + '@csstools/css-parser-algorithms': 3.0.5(@csstools/css-tokenizer@3.0.4) + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-parser-algorithms@3.0.5(@csstools/css-tokenizer@3.0.4)': + dependencies: + '@csstools/css-tokenizer': 3.0.4 + + '@csstools/css-tokenizer@3.0.4': {} + + '@discoveryjs/json-ext@0.5.7': {} + + '@emnapi/core@1.10.0': + dependencies: + '@emnapi/wasi-threads': 1.2.1 + tslib: 2.8.1 + optional: true + + '@emnapi/core@1.11.1': + dependencies: + '@emnapi/wasi-threads': 1.2.2 + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.10.0': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/runtime@1.11.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.1': + dependencies: + tslib: 2.8.1 + optional: true + + '@emnapi/wasi-threads@1.2.2': + dependencies: + tslib: 2.8.1 + optional: true + + '@eslint-community/eslint-utils@4.9.1(eslint@8.57.0)': + dependencies: + eslint: 8.57.0 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.2': {} + + '@eslint/eslintrc@2.1.4': + dependencies: + ajv: 6.15.0 + debug: 4.4.3 + espree: 9.6.1 + globals: 13.24.0 + ignore: 5.3.2 + import-fresh: 3.3.1 + js-yaml: 4.3.0 + minimatch: 3.1.5 + strip-json-comments: 3.1.1 + transitivePeerDependencies: + - supports-color + + '@eslint/js@8.57.0': {} + + '@hpke/common@1.10.1': {} + + '@hpke/core@1.7.5': + dependencies: + '@hpke/common': 1.10.1 + + '@humanwhocodes/config-array@0.11.14': + dependencies: + '@humanwhocodes/object-schema': 2.0.3 + debug: 4.4.3 + minimatch: 3.1.5 + transitivePeerDependencies: + - supports-color + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/object-schema@2.0.3': {} + + '@isaacs/cliui@8.0.2': + dependencies: + string-width: 5.1.2 + string-width-cjs: string-width@4.2.3 + strip-ansi: 7.2.0 + strip-ansi-cjs: strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: wrap-ansi@7.0.0 + + '@istanbuljs/load-nyc-config@1.1.0': + dependencies: + camelcase: 5.3.1 + find-up: 4.1.0 + get-package-type: 0.1.0 + js-yaml: 3.15.0 + resolve-from: 5.0.0 + + '@istanbuljs/schema@0.1.6': {} + + '@jest/console@29.7.0': + dependencies: + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + chalk: 4.1.2 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + slash: 3.0.0 + + '@jest/console@30.4.1': + dependencies: + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + chalk: 4.1.2 + jest-message-util: 30.4.1 + jest-util: 30.4.1 + slash: 3.0.0 + + '@jest/core@29.7.0(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3))': + dependencies: + '@jest/console': 29.7.0 + '@jest/reporters': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 3.9.0 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-changed-files: 29.7.0 + jest-config: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-resolve-dependencies: 29.7.0 + jest-runner: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + jest-watcher: 29.7.0 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-ansi: 6.0.1 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + - ts-node + + '@jest/core@30.4.2(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3))': + dependencies: + '@jest/console': 30.4.1 + '@jest/pattern': 30.4.0 + '@jest/reporters': 30.4.1 + '@jest/test-result': 30.4.1 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + ci-info: 4.4.0 + exit-x: 0.2.2 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-changed-files: 30.4.1 + jest-config: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-haste-map: 30.4.1 + jest-message-util: 30.4.1 + jest-regex-util: 30.4.0 + jest-resolve: 30.4.1 + jest-resolve-dependencies: 30.4.2 + jest-runner: 30.4.2 + jest-runtime: 30.4.2 + jest-snapshot: 30.4.1 + jest-util: 30.4.1 + jest-validate: 30.4.1 + jest-watcher: 30.4.1 + pretty-format: 30.4.1 + slash: 3.0.0 + transitivePeerDependencies: + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + '@jest/diff-sequences@30.4.0': {} + + '@jest/environment-jsdom-abstract@30.4.1(jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))': + dependencies: + '@jest/environment': 30.4.1 + '@jest/fake-timers': 30.4.1 + '@jest/types': 30.4.1 + '@types/jsdom': 21.1.7 + '@types/node': 26.1.1 + jest-mock: 30.4.1 + jest-util: 30.4.1 + jsdom: 26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + + '@jest/environment@29.7.0': + dependencies: + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + jest-mock: 29.7.0 + + '@jest/environment@30.4.1': + dependencies: + '@jest/fake-timers': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + jest-mock: 30.4.1 + + '@jest/expect-utils@29.7.0': + dependencies: + jest-get-type: 29.6.3 + + '@jest/expect-utils@30.4.1': + dependencies: + '@jest/get-type': 30.1.0 + + '@jest/expect@29.7.0': + dependencies: + expect: 29.7.0 + jest-snapshot: 29.7.0 + transitivePeerDependencies: + - supports-color + + '@jest/expect@30.4.1': + dependencies: + expect: 30.4.1 + jest-snapshot: 30.4.1 + transitivePeerDependencies: + - supports-color + + '@jest/fake-timers@29.7.0': + dependencies: + '@jest/types': 29.6.3 + '@sinonjs/fake-timers': 10.3.0 + '@types/node': 26.1.1 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-util: 29.7.0 + + '@jest/fake-timers@30.4.1': + dependencies: + '@jest/types': 30.4.1 + '@sinonjs/fake-timers': 15.4.0 + '@types/node': 26.1.1 + jest-message-util: 30.4.1 + jest-mock: 30.4.1 + jest-util: 30.4.1 + + '@jest/get-type@30.1.0': {} + + '@jest/globals@29.7.0': + dependencies: + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/types': 29.6.3 + jest-mock: 29.7.0 + transitivePeerDependencies: + - supports-color + + '@jest/globals@30.4.1': + dependencies: + '@jest/environment': 30.4.1 + '@jest/expect': 30.4.1 + '@jest/types': 30.4.1 + jest-mock: 30.4.1 + transitivePeerDependencies: + - supports-color + + '@jest/pattern@30.4.0': + dependencies: + '@types/node': 26.1.1 + jest-regex-util: 30.4.0 + + '@jest/reporters@29.7.0': + dependencies: + '@bcoe/v8-coverage': 0.2.3 + '@jest/console': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@jridgewell/trace-mapping': 0.3.31 + '@types/node': 26.1.1 + chalk: 4.1.2 + collect-v8-coverage: 1.0.3 + exit: 0.1.2 + glob: 7.2.3 + graceful-fs: 4.2.11 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-instrument: 6.0.3 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 4.0.1 + istanbul-reports: 3.2.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + jest-worker: 29.7.0 + slash: 3.0.0 + string-length: 4.0.2 + strip-ansi: 6.0.1 + v8-to-istanbul: 9.3.0 + transitivePeerDependencies: + - supports-color + + '@jest/reporters@30.4.1': + dependencies: + '@bcoe/v8-coverage': 0.2.3 + '@jest/console': 30.4.1 + '@jest/test-result': 30.4.1 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + '@jridgewell/trace-mapping': 0.3.31 + '@types/node': 26.1.1 + chalk: 4.1.2 + collect-v8-coverage: 1.0.3 + exit-x: 0.2.2 + glob: 10.5.0 + graceful-fs: 4.2.11 + istanbul-lib-coverage: 3.2.2 + istanbul-lib-instrument: 6.0.3 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 5.0.6 + istanbul-reports: 3.2.0 + jest-message-util: 30.4.1 + jest-util: 30.4.1 + jest-worker: 30.4.1 + slash: 3.0.0 + string-length: 4.0.2 + v8-to-istanbul: 9.3.0 + transitivePeerDependencies: + - supports-color + + '@jest/schemas@29.6.3': + dependencies: + '@sinclair/typebox': 0.27.10 + + '@jest/schemas@30.4.1': + dependencies: + '@sinclair/typebox': 0.34.50 + + '@jest/snapshot-utils@30.4.1': + dependencies: + '@jest/types': 30.4.1 + chalk: 4.1.2 + graceful-fs: 4.2.11 + natural-compare: 1.4.0 + + '@jest/source-map@29.6.3': + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + callsites: 3.1.0 + graceful-fs: 4.2.11 + + '@jest/source-map@30.0.1': + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + callsites: 3.1.0 + graceful-fs: 4.2.11 + + '@jest/test-result@29.7.0': + dependencies: + '@jest/console': 29.7.0 + '@jest/types': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.6 + collect-v8-coverage: 1.0.3 + + '@jest/test-result@30.4.1': + dependencies: + '@jest/console': 30.4.1 + '@jest/types': 30.4.1 + '@types/istanbul-lib-coverage': 2.0.6 + collect-v8-coverage: 1.0.3 + + '@jest/test-sequencer@29.7.0': + dependencies: + '@jest/test-result': 29.7.0 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + slash: 3.0.0 + + '@jest/test-sequencer@30.4.1': + dependencies: + '@jest/test-result': 30.4.1 + graceful-fs: 4.2.11 + jest-haste-map: 30.4.1 + slash: 3.0.0 + + '@jest/transform@29.7.0': + dependencies: + '@babel/core': 7.23.0 + '@jest/types': 29.6.3 + '@jridgewell/trace-mapping': 0.3.31 + babel-plugin-istanbul: 6.1.1 + chalk: 4.1.2 + convert-source-map: 2.0.0 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + micromatch: 4.0.8 + pirates: 4.0.7 + slash: 3.0.0 + write-file-atomic: 4.0.2 + transitivePeerDependencies: + - supports-color + + '@jest/transform@30.4.1': + dependencies: + '@babel/core': 7.29.7 + '@jest/types': 30.4.1 + '@jridgewell/trace-mapping': 0.3.31 + babel-plugin-istanbul: 7.0.1 + chalk: 4.1.2 + convert-source-map: 2.0.0 + fast-json-stable-stringify: 2.1.0 + graceful-fs: 4.2.11 + jest-haste-map: 30.4.1 + jest-regex-util: 30.4.0 + jest-util: 30.4.1 + pirates: 4.0.7 + slash: 3.0.0 + write-file-atomic: 5.0.1 + transitivePeerDependencies: + - supports-color + + '@jest/types@29.6.3': + dependencies: + '@jest/schemas': 29.6.3 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 26.1.1 + '@types/yargs': 17.0.35 + chalk: 4.1.2 + + '@jest/types@30.4.1': + dependencies: + '@jest/pattern': 30.4.0 + '@jest/schemas': 30.4.1 + '@types/istanbul-lib-coverage': 2.0.6 + '@types/istanbul-reports': 3.0.4 + '@types/node': 26.1.1 + '@types/yargs': 17.0.35 + chalk: 4.1.2 + + '@jridgewell/gen-mapping@0.3.13': + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/remapping@2.3.5': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/resolve-uri@3.1.2': {} + + '@jridgewell/source-map@0.3.11': + dependencies: + '@jridgewell/gen-mapping': 0.3.13 + '@jridgewell/trace-mapping': 0.3.31 + + '@jridgewell/sourcemap-codec@1.5.5': {} + + '@jridgewell/trace-mapping@0.3.31': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@jridgewell/trace-mapping@0.3.9': + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.5.5 + + '@jsonjoy.com/base64@1.1.2(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/base64@17.67.0(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/buffers@1.2.1(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/buffers@17.67.0(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/codegen@1.0.0(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/codegen@17.67.0(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/fs-core@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + thingies: 2.6.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-fsa@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-core': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + thingies: 2.6.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-node-builtins@4.64.0(tslib@2.8.1)': + dependencies: + tslib: 2.8.1 + + '@jsonjoy.com/fs-node-to-fsa@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-fsa': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-node-utils@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + glob-to-regex.js: 1.2.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-node@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-core': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-print': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-snapshot': 4.64.0(tslib@2.8.1) + glob-to-regex.js: 1.2.0(tslib@2.8.1) + thingies: 2.6.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-print@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + tree-dump: 1.1.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/fs-snapshot@4.64.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/buffers': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/json-pack': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/util': 17.67.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/json-pack@1.21.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/base64': 1.1.2(tslib@2.8.1) + '@jsonjoy.com/buffers': 1.2.1(tslib@2.8.1) + '@jsonjoy.com/codegen': 1.0.0(tslib@2.8.1) + '@jsonjoy.com/json-pointer': 1.0.2(tslib@2.8.1) + '@jsonjoy.com/util': 1.9.0(tslib@2.8.1) + hyperdyperid: 1.2.0 + thingies: 2.6.0(tslib@2.8.1) + tree-dump: 1.1.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/json-pack@17.67.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/base64': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/buffers': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/codegen': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/json-pointer': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/util': 17.67.0(tslib@2.8.1) + hyperdyperid: 1.2.0 + thingies: 2.6.0(tslib@2.8.1) + tree-dump: 1.1.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/json-pointer@1.0.2(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/codegen': 1.0.0(tslib@2.8.1) + '@jsonjoy.com/util': 1.9.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/json-pointer@17.67.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/util': 17.67.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/util@1.9.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/buffers': 1.2.1(tslib@2.8.1) + '@jsonjoy.com/codegen': 1.0.0(tslib@2.8.1) + tslib: 2.8.1 + + '@jsonjoy.com/util@17.67.0(tslib@2.8.1)': + dependencies: + '@jsonjoy.com/buffers': 17.67.0(tslib@2.8.1) + '@jsonjoy.com/codegen': 17.67.0(tslib@2.8.1) + tslib: 2.8.1 + + '@leichtgewicht/ip-codec@2.0.5': {} + + '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0)': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@tybys/wasm-util': 0.10.3 + optional: true + + '@napi-rs/wasm-runtime@1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1)': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@tybys/wasm-util': 0.10.3 + optional: true + + '@noble/ciphers@1.3.0': {} + + '@noble/curves@1.9.0': + dependencies: + '@noble/hashes': 1.8.0 + + '@noble/curves@1.9.1': + dependencies: + '@noble/hashes': 1.8.0 + + '@noble/curves@1.9.7': + dependencies: + '@noble/hashes': 1.8.0 + + '@noble/ed25519@2.0.0': {} + + '@noble/hashes@1.8.0': {} + + '@nodelib/fs.scandir@2.1.5': + dependencies: + '@nodelib/fs.stat': 2.0.5 + run-parallel: 1.2.0 + + '@nodelib/fs.stat@2.0.5': {} + + '@nodelib/fs.walk@1.2.8': + dependencies: + '@nodelib/fs.scandir': 2.1.5 + fastq: 1.20.1 + + '@oxc-project/types@0.139.0': {} + + '@peculiar/asn1-cms@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + '@peculiar/asn1-x509-attr': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-csr@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-ecc@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-pfx@2.8.0': + dependencies: + '@peculiar/asn1-cms': 2.8.0 + '@peculiar/asn1-pkcs8': 2.8.0 + '@peculiar/asn1-rsa': 2.8.0 + '@peculiar/asn1-schema': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-pkcs8@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-pkcs9@2.8.0': + dependencies: + '@peculiar/asn1-cms': 2.8.0 + '@peculiar/asn1-pfx': 2.8.0 + '@peculiar/asn1-pkcs8': 2.8.0 + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + '@peculiar/asn1-x509-attr': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-rsa@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-schema@2.8.0': + dependencies: + '@peculiar/utils': 2.0.3 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-x509-attr@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/asn1-x509@2.8.0': + dependencies: + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/utils': 2.0.3 + asn1js: 3.0.10 + tslib: 2.8.1 + + '@peculiar/utils@2.0.3': + dependencies: + tslib: 2.8.1 + + '@peculiar/x509@1.12.3': + dependencies: + '@peculiar/asn1-cms': 2.8.0 + '@peculiar/asn1-csr': 2.8.0 + '@peculiar/asn1-ecc': 2.8.0 + '@peculiar/asn1-pkcs9': 2.8.0 + '@peculiar/asn1-rsa': 2.8.0 + '@peculiar/asn1-schema': 2.8.0 + '@peculiar/asn1-x509': 2.8.0 + pvtsutils: 1.3.6 + reflect-metadata: 0.2.2 + tslib: 2.8.1 + tsyringe: 4.10.0 + + '@pkgjs/parseargs@0.11.0': + optional: true + + '@pkgr/core@0.3.6': {} + + '@polka/url@1.0.0-next.29': {} + + '@rolldown/binding-android-arm64@1.1.5': + optional: true + + '@rolldown/binding-darwin-arm64@1.1.5': + optional: true + + '@rolldown/binding-darwin-x64@1.1.5': + optional: true + + '@rolldown/binding-freebsd-x64@1.1.5': + optional: true + + '@rolldown/binding-linux-arm-gnueabihf@1.1.5': + optional: true + + '@rolldown/binding-linux-arm64-gnu@1.1.5': + optional: true + + '@rolldown/binding-linux-arm64-musl@1.1.5': + optional: true + + '@rolldown/binding-linux-ppc64-gnu@1.1.5': + optional: true + + '@rolldown/binding-linux-s390x-gnu@1.1.5': + optional: true + + '@rolldown/binding-linux-x64-gnu@1.1.5': + optional: true + + '@rolldown/binding-linux-x64-musl@1.1.5': + optional: true + + '@rolldown/binding-openharmony-arm64@1.1.5': + optional: true + + '@rolldown/binding-wasm32-wasi@1.1.5': + dependencies: + '@emnapi/core': 1.11.1 + '@emnapi/runtime': 1.11.1 + '@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.11.1)(@emnapi/runtime@1.11.1) + optional: true + + '@rolldown/binding-win32-arm64-msvc@1.1.5': + optional: true + + '@rolldown/binding-win32-x64-msvc@1.1.5': + optional: true + + '@rolldown/pluginutils@1.0.1': {} + + '@rollup/plugin-typescript@11.1.6(rollup@4.59.0)(tslib@2.8.1)(typescript@5.4.3)': + dependencies: + '@rollup/pluginutils': 5.4.0(rollup@4.59.0) + resolve: 1.22.12 + typescript: 5.4.3 + optionalDependencies: + rollup: 4.59.0 + tslib: 2.8.1 + + '@rollup/pluginutils@5.4.0(rollup@4.59.0)': + dependencies: + '@types/estree': 1.0.9 + estree-walker: 2.0.2 + picomatch: 4.0.5 + optionalDependencies: + rollup: 4.59.0 + + '@rollup/rollup-android-arm-eabi@4.59.0': + optional: true + + '@rollup/rollup-android-arm64@4.59.0': + optional: true + + '@rollup/rollup-darwin-arm64@4.59.0': + optional: true + + '@rollup/rollup-darwin-x64@4.59.0': + optional: true + + '@rollup/rollup-freebsd-arm64@4.59.0': + optional: true + + '@rollup/rollup-freebsd-x64@4.59.0': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.59.0': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.59.0': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.59.0': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-x64-gnu@4.59.0': + optional: true + + '@rollup/rollup-linux-x64-musl@4.59.0': + optional: true + + '@rollup/rollup-openbsd-x64@4.59.0': + optional: true + + '@rollup/rollup-openharmony-arm64@4.59.0': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.59.0': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.59.0': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.59.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.59.0': + optional: true + + '@scure/base@1.2.6': {} + + '@scure/bip32@1.7.0': + dependencies: + '@noble/curves': 1.9.7 + '@noble/hashes': 1.8.0 + '@scure/base': 1.2.6 + + '@scure/bip39@1.6.0': + dependencies: + '@noble/hashes': 1.8.0 + '@scure/base': 1.2.6 + + '@sinclair/typebox@0.27.10': {} + + '@sinclair/typebox@0.34.50': {} + + '@sinonjs/commons@3.0.1': + dependencies: + type-detect: 4.0.8 + + '@sinonjs/fake-timers@10.3.0': + dependencies: + '@sinonjs/commons': 3.0.1 + + '@sinonjs/fake-timers@15.4.0': + dependencies: + '@sinonjs/commons': 3.0.1 + + '@solana/buffer-layout@4.0.1': + dependencies: + buffer: 6.0.3 + + '@solana/codecs-core@2.3.0(typescript@5.4.3)': + dependencies: + '@solana/errors': 2.3.0(typescript@5.4.3) + typescript: 5.4.3 + + '@solana/codecs-numbers@2.3.0(typescript@5.4.3)': + dependencies: + '@solana/codecs-core': 2.3.0(typescript@5.4.3) + '@solana/errors': 2.3.0(typescript@5.4.3) + typescript: 5.4.3 + + '@solana/errors@2.3.0(typescript@5.4.3)': + dependencies: + chalk: 5.6.2 + commander: 14.0.3 + typescript: 5.4.3 + + '@solana/web3.js@1.98.4(bufferutil@4.1.0)(typescript@5.4.3)(utf-8-validate@6.0.6)': + dependencies: + '@babel/runtime': 7.29.7 + '@noble/curves': 1.9.7 + '@noble/hashes': 1.8.0 + '@solana/buffer-layout': 4.0.1 + '@solana/codecs-numbers': 2.3.0(typescript@5.4.3) + agentkeepalive: 4.6.0 + bn.js: 5.2.5 + borsh: 0.7.0 + bs58: 4.0.1 + buffer: 6.0.3 + fast-stable-stringify: 1.0.0 + jayson: 4.3.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + node-fetch: 2.7.0 + rpc-websockets: 9.3.9 + superstruct: 2.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - typescript + - utf-8-validate + + '@standard-schema/spec@1.1.0': {} + + '@swc/core-darwin-arm64@1.15.43': + optional: true + + '@swc/core-darwin-x64@1.15.43': + optional: true + + '@swc/core-linux-arm-gnueabihf@1.15.43': + optional: true + + '@swc/core-linux-arm64-gnu@1.15.43': + optional: true + + '@swc/core-linux-arm64-musl@1.15.43': + optional: true + + '@swc/core-linux-ppc64-gnu@1.15.43': + optional: true + + '@swc/core-linux-s390x-gnu@1.15.43': + optional: true + + '@swc/core-linux-x64-gnu@1.15.43': + optional: true + + '@swc/core-linux-x64-musl@1.15.43': + optional: true + + '@swc/core-win32-arm64-msvc@1.15.43': + optional: true + + '@swc/core-win32-ia32-msvc@1.15.43': + optional: true + + '@swc/core-win32-x64-msvc@1.15.43': + optional: true + + '@swc/core@1.15.43(@swc/helpers@0.5.23)': + dependencies: + '@swc/counter': 0.1.3 + '@swc/types': 0.1.27 + optionalDependencies: + '@swc/core-darwin-arm64': 1.15.43 + '@swc/core-darwin-x64': 1.15.43 + '@swc/core-linux-arm-gnueabihf': 1.15.43 + '@swc/core-linux-arm64-gnu': 1.15.43 + '@swc/core-linux-arm64-musl': 1.15.43 + '@swc/core-linux-ppc64-gnu': 1.15.43 + '@swc/core-linux-s390x-gnu': 1.15.43 + '@swc/core-linux-x64-gnu': 1.15.43 + '@swc/core-linux-x64-musl': 1.15.43 + '@swc/core-win32-arm64-msvc': 1.15.43 + '@swc/core-win32-ia32-msvc': 1.15.43 + '@swc/core-win32-x64-msvc': 1.15.43 + '@swc/helpers': 0.5.23 + + '@swc/counter@0.1.3': {} + + '@swc/helpers@0.5.23': + dependencies: + tslib: 2.8.1 + + '@swc/register@0.1.10(@swc/core@1.15.43(@swc/helpers@0.5.23))': + dependencies: + '@swc/core': 1.15.43(@swc/helpers@0.5.23) + lodash.clonedeep: 4.5.0 + pirates: 4.0.7 + source-map-support: 0.5.21 + + '@swc/types@0.1.27': + dependencies: + '@swc/counter': 0.1.3 + + '@testing-library/dom@9.3.3': + dependencies: + '@babel/code-frame': 7.29.7 + '@babel/runtime': 7.29.7 + '@types/aria-query': 5.0.4 + aria-query: 5.1.3 + chalk: 4.1.2 + dom-accessibility-api: 0.5.16 + lz-string: 1.5.0 + pretty-format: 27.5.1 + + '@testing-library/jest-dom@6.1.3(@jest/globals@30.4.1)(@types/jest@30.0.0)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(vitest@4.1.10)': + dependencies: + '@adobe/css-tools': 4.5.0 + '@babel/runtime': 7.29.7 + aria-query: 5.3.2 + chalk: 3.0.0 + css.escape: 1.5.1 + dom-accessibility-api: 0.5.16 + lodash: 4.18.1 + redent: 3.0.0 + optionalDependencies: + '@jest/globals': 30.4.1 + '@types/jest': 30.0.0 + jest: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + vitest: 4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + + '@testing-library/jest-dom@6.9.1': + dependencies: + '@adobe/css-tools': 4.5.0 + aria-query: 5.3.2 + css.escape: 1.5.1 + dom-accessibility-api: 0.6.3 + picocolors: 1.1.1 + redent: 3.0.0 + + '@tootallnate/once@2.0.1': {} + + '@tsconfig/node10@1.0.12': {} + + '@tsconfig/node12@1.0.11': {} + + '@tsconfig/node14@1.0.3': {} + + '@tsconfig/node16@1.0.4': {} + + '@tsconfig/node24@24.0.4': {} + + '@tsconfig/strictest@2.0.8': {} + + '@turbo/darwin-64@2.10.4': + optional: true + + '@turbo/darwin-arm64@2.10.4': + optional: true + + '@turbo/linux-64@2.10.4': + optional: true + + '@turbo/linux-arm64@2.10.4': + optional: true + + '@turbo/windows-64@2.10.4': + optional: true + + '@turbo/windows-arm64@2.10.4': + optional: true + + '@turnkey/api-key-stamper@0.6.8': + dependencies: + '@noble/curves': 1.9.7 + '@turnkey/crypto': 2.10.1 + '@turnkey/encoding': 0.6.0 + sha256-uint8array: 0.10.7 + + '@turnkey/crypto@2.10.1': + dependencies: + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.0 + '@noble/hashes': 1.8.0 + '@peculiar/x509': 1.12.3 + '@turnkey/encoding': 0.6.0 + '@turnkey/sdk-types': 1.2.0 + borsh: 2.0.0 + cbor-js: 0.1.0 + + '@turnkey/crypto@2.8.6': + dependencies: + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.0 + '@noble/hashes': 1.8.0 + '@peculiar/x509': 1.12.3 + '@turnkey/encoding': 0.6.0 + '@turnkey/sdk-types': 0.9.0 + borsh: 2.0.0 + cbor-js: 0.1.0 + + '@turnkey/encoding@0.6.0': + dependencies: + bs58: 6.0.0 + bs58check: 4.0.0 + + '@turnkey/http@5.0.0': + dependencies: + '@turnkey/api-key-stamper': 0.6.8 + '@turnkey/encoding': 0.6.0 + '@turnkey/webauthn-stamper': 0.6.0 + cross-fetch: 3.2.0 + transitivePeerDependencies: + - encoding + + '@turnkey/iframe-stamper@2.11.1': {} + + '@turnkey/sdk-types@0.9.0': {} + + '@turnkey/sdk-types@1.2.0': {} + + '@turnkey/webauthn-stamper@0.6.0': + dependencies: + sha256-uint8array: 0.10.7 + + '@tybys/wasm-util@0.10.3': + dependencies: + tslib: 2.8.1 + optional: true + + '@types/aria-query@5.0.4': {} + + '@types/babel__core@7.20.5': + dependencies: + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 + '@types/babel__generator': 7.27.0 + '@types/babel__template': 7.4.4 + '@types/babel__traverse': 7.28.0 + + '@types/babel__generator@7.27.0': + dependencies: + '@babel/types': 7.29.7 + + '@types/babel__template@7.4.4': + dependencies: + '@babel/parser': 7.29.7 + '@babel/types': 7.29.7 + + '@types/babel__traverse@7.28.0': + dependencies: + '@babel/types': 7.29.7 + + '@types/body-parser@1.19.6': + dependencies: + '@types/connect': 3.4.38 + '@types/node': 26.1.1 + + '@types/bonjour@3.5.13': + dependencies: + '@types/node': 26.1.1 + + '@types/chai@5.2.3': + dependencies: + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/connect-history-api-fallback@1.5.4': + dependencies: + '@types/express-serve-static-core': 4.19.9 + '@types/node': 26.1.1 + + '@types/connect@3.4.38': + dependencies: + '@types/node': 26.1.1 + + '@types/deep-eql@4.0.2': {} + + '@types/eslint-scope@3.7.7': + dependencies: + '@types/eslint': 9.6.1 + '@types/estree': 1.0.9 + + '@types/eslint@9.6.1': + dependencies: + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + + '@types/estree@1.0.8': {} + + '@types/estree@1.0.9': {} + + '@types/express-serve-static-core@4.19.9': + dependencies: + '@types/node': 26.1.1 + '@types/qs': 6.15.1 + '@types/range-parser': 1.2.7 + '@types/send': 1.2.1 + + '@types/express@4.17.25': + dependencies: + '@types/body-parser': 1.19.6 + '@types/express-serve-static-core': 4.19.9 + '@types/qs': 6.15.1 + '@types/serve-static': 1.15.10 + + '@types/graceful-fs@4.1.9': + dependencies: + '@types/node': 26.1.1 + + '@types/html-minifier-terser@6.1.0': {} + + '@types/http-errors@2.0.5': {} + + '@types/http-proxy@1.17.17': + dependencies: + '@types/node': 26.1.1 + + '@types/istanbul-lib-coverage@2.0.6': {} + + '@types/istanbul-lib-report@3.0.3': + dependencies: + '@types/istanbul-lib-coverage': 2.0.6 + + '@types/istanbul-reports@3.0.4': + dependencies: + '@types/istanbul-lib-report': 3.0.3 + + '@types/jest@30.0.0': + dependencies: + expect: 30.4.1 + pretty-format: 30.4.1 + + '@types/jsdom@21.1.7': + dependencies: + '@types/node': 26.1.1 + '@types/tough-cookie': 4.0.5 + parse5: 7.3.0 + + '@types/jsdom@28.0.3': + dependencies: + '@types/node': 26.1.1 + '@types/tough-cookie': 4.0.5 + parse5: 8.0.1 + undici-types: 7.28.0 + + '@types/json-schema@7.0.15': {} + + '@types/mime@1.3.5': {} + + '@types/node-forge@1.3.14': + dependencies: + '@types/node': 26.1.1 + + '@types/node@12.20.55': {} + + '@types/node@26.1.1': + dependencies: + undici-types: 8.3.0 + + '@types/qs@6.15.1': {} + + '@types/range-parser@1.2.7': {} + + '@types/retry@0.12.2': {} + + '@types/send@0.17.6': + dependencies: + '@types/mime': 1.3.5 + '@types/node': 26.1.1 + + '@types/send@1.2.1': + dependencies: + '@types/node': 26.1.1 + + '@types/serve-index@1.9.4': + dependencies: + '@types/express': 4.17.25 + + '@types/serve-static@1.15.10': + dependencies: + '@types/http-errors': 2.0.5 + '@types/node': 26.1.1 + '@types/send': 0.17.6 + + '@types/sockjs@0.3.36': + dependencies: + '@types/node': 26.1.1 + + '@types/stack-utils@2.0.3': {} + + '@types/tough-cookie@4.0.5': {} + + '@types/uuid@10.0.0': {} + + '@types/ws@7.4.7': + dependencies: + '@types/node': 26.1.1 + + '@types/ws@8.18.1': + dependencies: + '@types/node': 26.1.1 + + '@types/yargs-parser@21.0.3': {} + + '@types/yargs@17.0.35': + dependencies: + '@types/yargs-parser': 21.0.3 + + '@ungap/structured-clone@1.3.2': {} + + '@unrs/resolver-binding-android-arm-eabi@1.12.2': + optional: true + + '@unrs/resolver-binding-android-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-darwin-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-darwin-x64@1.12.2': + optional: true + + '@unrs/resolver-binding-freebsd-x64@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm-gnueabihf@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm-musleabihf@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-arm64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-loong64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-loong64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-ppc64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-riscv64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-riscv64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-s390x-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-x64-gnu@1.12.2': + optional: true + + '@unrs/resolver-binding-linux-x64-musl@1.12.2': + optional: true + + '@unrs/resolver-binding-openharmony-arm64@1.12.2': + optional: true + + '@unrs/resolver-binding-wasm32-wasi@1.12.2': + dependencies: + '@emnapi/core': 1.10.0 + '@emnapi/runtime': 1.10.0 + '@napi-rs/wasm-runtime': 1.1.6(@emnapi/core@1.10.0)(@emnapi/runtime@1.10.0) + optional: true + + '@unrs/resolver-binding-win32-arm64-msvc@1.12.2': + optional: true + + '@unrs/resolver-binding-win32-ia32-msvc@1.12.2': + optional: true + + '@unrs/resolver-binding-win32-x64-msvc@1.12.2': + optional: true + + '@vitest/browser-playwright@4.1.10(bufferutil@4.1.0)(playwright@1.61.1)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10)': + dependencies: + '@vitest/browser': 4.1.10(bufferutil@4.1.0)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10) + '@vitest/mocker': 4.1.10(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + playwright: 1.61.1 + tinyrainbow: 3.1.0 + vitest: 4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + transitivePeerDependencies: + - bufferutil + - msw + - utf-8-validate + - vite + + '@vitest/browser@4.1.10(bufferutil@4.1.0)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10)': + dependencies: + '@blazediff/core': 1.9.1 + '@vitest/mocker': 4.1.10(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + '@vitest/utils': 4.1.10 + magic-string: 0.30.21 + pngjs: 7.0.0 + sirv: 3.0.2 + tinyrainbow: 3.1.0 + vitest: 4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + transitivePeerDependencies: + - bufferutil + - msw + - utf-8-validate + - vite + + '@vitest/expect@4.1.10': + dependencies: + '@standard-schema/spec': 1.1.0 + '@types/chai': 5.2.3 + '@vitest/spy': 4.1.10 + '@vitest/utils': 4.1.10 + chai: 6.2.2 + tinyrainbow: 3.1.0 + + '@vitest/mocker@4.1.10(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))': + dependencies: + '@vitest/spy': 4.1.10 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 8.1.4(@types/node@26.1.1)(terser@5.49.0) + + '@vitest/pretty-format@4.1.10': + dependencies: + tinyrainbow: 3.1.0 + + '@vitest/runner@4.1.10': + dependencies: + '@vitest/utils': 4.1.10 + pathe: 2.0.3 + + '@vitest/snapshot@4.1.10': + dependencies: + '@vitest/pretty-format': 4.1.10 + '@vitest/utils': 4.1.10 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@4.1.10': {} + + '@vitest/utils@4.1.10': + dependencies: + '@vitest/pretty-format': 4.1.10 + convert-source-map: 2.0.0 + tinyrainbow: 3.1.0 + + '@webassemblyjs/ast@1.14.1': + dependencies: + '@webassemblyjs/helper-numbers': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + + '@webassemblyjs/floating-point-hex-parser@1.13.2': {} + + '@webassemblyjs/helper-api-error@1.13.2': {} + + '@webassemblyjs/helper-buffer@1.14.1': {} + + '@webassemblyjs/helper-numbers@1.13.2': + dependencies: + '@webassemblyjs/floating-point-hex-parser': 1.13.2 + '@webassemblyjs/helper-api-error': 1.13.2 + '@xtuc/long': 4.2.2 + + '@webassemblyjs/helper-wasm-bytecode@1.13.2': {} + + '@webassemblyjs/helper-wasm-section@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/wasm-gen': 1.14.1 + + '@webassemblyjs/ieee754@1.13.2': + dependencies: + '@xtuc/ieee754': 1.2.0 + + '@webassemblyjs/leb128@1.13.2': + dependencies: + '@xtuc/long': 4.2.2 + + '@webassemblyjs/utf8@1.13.2': {} + + '@webassemblyjs/wasm-edit@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/helper-wasm-section': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-opt': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + '@webassemblyjs/wast-printer': 1.14.1 + + '@webassemblyjs/wasm-gen@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wasm-opt@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-buffer': 1.14.1 + '@webassemblyjs/wasm-gen': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + + '@webassemblyjs/wasm-parser@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/helper-api-error': 1.13.2 + '@webassemblyjs/helper-wasm-bytecode': 1.13.2 + '@webassemblyjs/ieee754': 1.13.2 + '@webassemblyjs/leb128': 1.13.2 + '@webassemblyjs/utf8': 1.13.2 + + '@webassemblyjs/wast-printer@1.14.1': + dependencies: + '@webassemblyjs/ast': 1.14.1 + '@xtuc/long': 4.2.2 + + '@webpack-cli/configtest@2.1.1(webpack-cli@5.1.4)(webpack@5.102.1)': + dependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + + '@webpack-cli/info@2.0.2(webpack-cli@5.1.4)(webpack@5.102.1)': + dependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + + '@webpack-cli/serve@2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.2.2)(webpack@5.102.1)': + dependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + optionalDependencies: + webpack-dev-server: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + + '@xtuc/ieee754@1.2.0': {} + + '@xtuc/long@4.2.2': {} + + '@zeit/schemas@2.36.0': {} + + abab@2.0.6: {} + + abitype@1.2.3(typescript@5.4.3): + optionalDependencies: + typescript: 5.4.3 + + accepts@1.3.8: + dependencies: + mime-types: 2.1.35 + negotiator: 0.6.3 + + acorn-import-phases@1.0.4(acorn@8.17.0): + dependencies: + acorn: 8.17.0 + + acorn-jsx@5.3.2(acorn@8.17.0): + dependencies: + acorn: 8.17.0 + + acorn-walk@8.3.5: + dependencies: + acorn: 8.17.0 + + acorn@8.17.0: {} + + agent-base@6.0.2: + dependencies: + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + agent-base@7.1.4: {} + + agentkeepalive@4.6.0: + dependencies: + humanize-ms: 1.2.1 + + ajv-formats@2.1.1(ajv@8.20.0): + optionalDependencies: + ajv: 8.20.0 + + ajv-keywords@5.1.0(ajv@8.20.0): + dependencies: + ajv: 8.20.0 + fast-deep-equal: 3.1.3 + + ajv@6.15.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + + ajv@8.12.0: + dependencies: + fast-deep-equal: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + uri-js: 4.4.1 + + ajv@8.20.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-uri: 3.1.3 + json-schema-traverse: 1.0.0 + require-from-string: 2.0.2 + + ansi-align@3.0.1: + dependencies: + string-width: 4.2.3 + + ansi-escapes@4.3.2: + dependencies: + type-fest: 0.21.3 + + ansi-html-community@0.0.8: {} + + ansi-regex@5.0.1: {} + + ansi-regex@6.2.2: {} + + ansi-styles@4.3.0: + dependencies: + color-convert: 2.0.1 + + ansi-styles@5.2.0: {} + + ansi-styles@6.2.3: {} + + anymatch@3.1.3: + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.2 + + arch@2.2.0: {} + + arg@4.1.3: {} + + arg@5.0.2: {} + + argparse@1.0.10: + dependencies: + sprintf-js: 1.0.3 + + argparse@2.0.1: {} + + aria-query@5.1.3: + dependencies: + deep-equal: 2.2.3 + + aria-query@5.3.2: {} + + array-buffer-byte-length@1.0.2: + dependencies: + call-bound: 1.0.4 + is-array-buffer: 3.0.5 + + array-flatten@1.1.1: {} + + asn1.js@4.10.1: + dependencies: + bn.js: 4.12.5 + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + + asn1js@3.0.10: + dependencies: + pvtsutils: 1.3.6 + pvutils: 1.1.5 + tslib: 2.8.1 + + assertion-error@2.0.1: {} + + asynckit@0.4.0: {} + + available-typed-arrays@1.0.7: + dependencies: + possible-typed-array-names: 1.1.0 + + babel-jest@29.7.0(@babel/core@7.23.0): + dependencies: + '@babel/core': 7.23.0 + '@jest/transform': 29.7.0 + '@types/babel__core': 7.20.5 + babel-plugin-istanbul: 6.1.1 + babel-preset-jest: 29.6.3(@babel/core@7.23.0) + chalk: 4.1.2 + graceful-fs: 4.2.11 + slash: 3.0.0 + transitivePeerDependencies: + - supports-color + + babel-jest@30.4.1(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + '@jest/transform': 30.4.1 + '@types/babel__core': 7.20.5 + babel-plugin-istanbul: 7.0.1 + babel-preset-jest: 30.4.0(@babel/core@7.29.7) + chalk: 4.1.2 + graceful-fs: 4.2.11 + slash: 3.0.0 + transitivePeerDependencies: + - supports-color + + babel-loader@9.1.3(@babel/core@7.23.0)(webpack@5.102.1): + dependencies: + '@babel/core': 7.23.0 + find-cache-dir: 4.0.0 + schema-utils: 4.3.3 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + + babel-plugin-istanbul@6.1.1: + dependencies: + '@babel/helper-plugin-utils': 7.29.7 + '@istanbuljs/load-nyc-config': 1.1.0 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-instrument: 5.2.1 + test-exclude: 6.0.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-istanbul@7.0.1: + dependencies: + '@babel/helper-plugin-utils': 7.29.7 + '@istanbuljs/load-nyc-config': 1.1.0 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-instrument: 6.0.3 + test-exclude: 6.0.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-jest-hoist@29.6.3: + dependencies: + '@babel/template': 7.29.7 + '@babel/types': 7.29.7 + '@types/babel__core': 7.20.5 + '@types/babel__traverse': 7.28.0 + + babel-plugin-jest-hoist@30.4.0: + dependencies: + '@types/babel__core': 7.20.5 + + babel-plugin-polyfill-corejs2@0.4.17(@babel/core@7.23.0): + dependencies: + '@babel/compat-data': 7.29.7 + '@babel/core': 7.23.0 + '@babel/helper-define-polyfill-provider': 0.6.8(@babel/core@7.23.0) + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + babel-plugin-polyfill-corejs3@0.8.7(@babel/core@7.23.0): + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-define-polyfill-provider': 0.4.4(@babel/core@7.23.0) + core-js-compat: 3.49.0 + transitivePeerDependencies: + - supports-color + + babel-plugin-polyfill-regenerator@0.5.5(@babel/core@7.23.0): + dependencies: + '@babel/core': 7.23.0 + '@babel/helper-define-polyfill-provider': 0.5.0(@babel/core@7.23.0) + transitivePeerDependencies: + - supports-color + + babel-preset-current-node-syntax@1.2.0(@babel/core@7.23.0): + dependencies: + '@babel/core': 7.23.0 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.23.0) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.23.0) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.23.0) + '@babel/plugin-syntax-import-attributes': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.23.0) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.23.0) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.23.0) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.23.0) + + babel-preset-current-node-syntax@1.2.0(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + '@babel/plugin-syntax-async-generators': 7.8.4(@babel/core@7.29.7) + '@babel/plugin-syntax-bigint': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-class-properties': 7.12.13(@babel/core@7.29.7) + '@babel/plugin-syntax-class-static-block': 7.14.5(@babel/core@7.29.7) + '@babel/plugin-syntax-import-attributes': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-syntax-import-meta': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-json-strings': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-logical-assignment-operators': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-nullish-coalescing-operator': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-numeric-separator': 7.10.4(@babel/core@7.29.7) + '@babel/plugin-syntax-object-rest-spread': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-optional-catch-binding': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-optional-chaining': 7.8.3(@babel/core@7.29.7) + '@babel/plugin-syntax-private-property-in-object': 7.14.5(@babel/core@7.29.7) + '@babel/plugin-syntax-top-level-await': 7.14.5(@babel/core@7.29.7) + + babel-preset-jest@29.6.3(@babel/core@7.23.0): + dependencies: + '@babel/core': 7.23.0 + babel-plugin-jest-hoist: 29.6.3 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.23.0) + + babel-preset-jest@30.4.0(@babel/core@7.29.7): + dependencies: + '@babel/core': 7.29.7 + babel-plugin-jest-hoist: 30.4.0 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) + + balanced-match@1.0.2: {} + + base-x@3.0.11: + dependencies: + safe-buffer: 5.2.1 + + base-x@5.0.1: {} + + base64-js@1.5.1: {} + + baseline-browser-mapping@2.10.42: {} + + batch@0.6.1: {} + + bech32@2.0.0: {} + + binary-extensions@2.3.0: {} + + bn.js@4.12.5: {} + + bn.js@5.2.5: {} + + body-parser@1.20.6: + dependencies: + bytes: 3.1.2 + content-type: 1.0.5 + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + http-errors: 2.0.1 + iconv-lite: 0.4.24 + on-finished: 2.4.1 + qs: 6.15.3 + raw-body: 2.5.3 + type-is: 1.6.18 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + + bonjour-service@1.4.3: + dependencies: + fast-deep-equal: 3.1.3 + multicast-dns: 7.2.5 + + boolbase@1.0.0: {} + + borsh@0.7.0: + dependencies: + bn.js: 5.2.5 + bs58: 4.0.1 + text-encoding-utf-8: 1.0.2 + + borsh@2.0.0: {} + + boxen@7.0.0: + dependencies: + ansi-align: 3.0.1 + camelcase: 7.0.1 + chalk: 5.6.2 + cli-boxes: 3.0.0 + string-width: 5.1.2 + type-fest: 2.19.0 + widest-line: 4.0.1 + wrap-ansi: 8.1.0 + + brace-expansion@1.1.16: + dependencies: + balanced-match: 1.0.2 + concat-map: 0.0.1 + + brace-expansion@2.1.2: + dependencies: + balanced-match: 1.0.2 + + braces@3.0.3: + dependencies: + fill-range: 7.1.1 + + brorand@1.1.0: {} + + browserify-aes@1.2.0: + dependencies: + buffer-xor: 1.0.3 + cipher-base: 1.0.7 + create-hash: 1.2.0 + evp_bytestokey: 1.0.3 + inherits: 2.0.4 + safe-buffer: 5.2.1 + + browserify-cipher@1.0.1: + dependencies: + browserify-aes: 1.2.0 + browserify-des: 1.0.2 + evp_bytestokey: 1.0.3 + + browserify-des@1.0.2: + dependencies: + cipher-base: 1.0.7 + des.js: 1.1.0 + inherits: 2.0.4 + safe-buffer: 5.2.1 + + browserify-rsa@4.1.1: + dependencies: + bn.js: 5.2.5 + randombytes: 2.1.0 + safe-buffer: 5.2.1 + + browserify-sign@4.2.6: + dependencies: + bn.js: 5.2.5 + browserify-rsa: 4.1.1 + create-hash: 1.2.0 + create-hmac: 1.1.7 + elliptic: 6.6.1 + inherits: 2.0.4 + parse-asn1: 5.1.9 + readable-stream: 2.3.8 + safe-buffer: 5.2.1 + + browserslist@4.28.5: + dependencies: + baseline-browser-mapping: 2.10.42 + caniuse-lite: 1.0.30001803 + electron-to-chromium: 1.5.389 + node-releases: 2.0.51 + update-browserslist-db: 1.2.3(browserslist@4.28.5) + + bs-logger@0.2.6: + dependencies: + fast-json-stable-stringify: 2.1.0 + + bs58@4.0.1: + dependencies: + base-x: 3.0.11 + + bs58@6.0.0: + dependencies: + base-x: 5.0.1 + + bs58check@4.0.0: + dependencies: + '@noble/hashes': 1.8.0 + bs58: 6.0.0 + + bser@2.1.1: + dependencies: + node-int64: 0.4.0 + + buffer-from@1.1.2: {} + + buffer-xor@1.0.3: {} + + buffer@6.0.3: + dependencies: + base64-js: 1.5.1 + ieee754: 1.2.1 + + bufferutil@4.1.0: + dependencies: + node-gyp-build: 4.8.4 + optional: true + + bundle-name@4.1.0: + dependencies: + run-applescript: 7.1.0 + + bytes@3.0.0: {} + + bytes@3.1.2: {} + + call-bind-apply-helpers@1.0.2: + dependencies: + es-errors: 1.3.0 + function-bind: 1.1.2 + + call-bind@1.0.9: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + get-intrinsic: 1.3.0 + set-function-length: 1.2.2 + + call-bound@1.0.4: + dependencies: + call-bind-apply-helpers: 1.0.2 + get-intrinsic: 1.3.0 + + callsites@3.1.0: {} + + camel-case@4.1.2: + dependencies: + pascal-case: 3.1.2 + tslib: 2.8.1 + + camelcase@5.3.1: {} + + camelcase@6.3.0: {} + + camelcase@7.0.1: {} + + caniuse-lite@1.0.30001803: {} + + cbor-js@0.1.0: {} + + chai@6.2.2: {} + + chalk-template@0.4.0: + dependencies: + chalk: 4.1.2 + + chalk@3.0.0: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chalk@4.1.2: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + + chalk@5.0.1: {} + + chalk@5.6.2: {} + + char-regex@1.0.2: {} + + chokidar@3.6.0: + dependencies: + anymatch: 3.1.3 + braces: 3.0.3 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + + chrome-trace-event@1.0.4: {} + + ci-info@3.9.0: {} + + ci-info@4.4.0: {} + + cipher-base@1.0.7: + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + to-buffer: 1.2.2 + + cjs-module-lexer@1.4.3: {} + + cjs-module-lexer@2.2.0: {} + + clean-css@5.3.3: + dependencies: + source-map: 0.6.1 + + cli-boxes@3.0.0: {} + + clipboardy@3.0.0: + dependencies: + arch: 2.2.0 + execa: 5.1.1 + is-wsl: 2.2.0 + + cliui@8.0.1: + dependencies: + string-width: 4.2.3 + strip-ansi: 6.0.1 + wrap-ansi: 7.0.0 + + clone-deep@4.0.1: + dependencies: + is-plain-object: 2.0.4 + kind-of: 6.0.3 + shallow-clone: 3.0.1 + + co@4.6.0: {} + + collect-v8-coverage@1.0.3: {} + + color-convert@2.0.1: + dependencies: + color-name: 1.1.4 + + color-name@1.1.4: {} + + colorette@2.0.20: {} + + combined-stream@1.0.8: + dependencies: + delayed-stream: 1.0.0 + + commander@10.0.1: {} + + commander@14.0.3: {} + + commander@2.20.3: {} + + commander@8.3.0: {} + + common-path-prefix@3.0.0: {} + + compressible@2.0.18: + dependencies: + mime-db: 1.54.0 + + compression@1.8.1: + dependencies: + bytes: 3.1.2 + compressible: 2.0.18 + debug: 2.6.9 + negotiator: 0.6.4 + on-headers: 1.1.0 + safe-buffer: 5.2.1 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + concat-map@0.0.1: {} + + connect-history-api-fallback@2.0.0: {} + + content-disposition@0.5.2: {} + + content-disposition@0.5.4: + dependencies: + safe-buffer: 5.2.1 + + content-type@1.0.5: {} + + convert-source-map@2.0.0: {} + + cookie-signature@1.0.7: {} + + cookie@0.7.2: {} + + copy-webpack-plugin@11.0.0(webpack@5.102.1): + dependencies: + fast-glob: 3.3.3 + glob-parent: 6.0.2 + globby: 13.2.2 + normalize-path: 3.0.0 + schema-utils: 4.3.3 + serialize-javascript: 7.0.7 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + + core-js-compat@3.49.0: + dependencies: + browserslist: 4.28.5 + + core-util-is@1.0.3: {} + + create-ecdh@4.0.4: + dependencies: + bn.js: 4.12.5 + elliptic: 6.6.1 + + create-hash@1.2.0: + dependencies: + cipher-base: 1.0.7 + inherits: 2.0.4 + md5.js: 1.3.5 + ripemd160: 2.0.3 + sha.js: 2.4.12 + + create-hmac@1.1.7: + dependencies: + cipher-base: 1.0.7 + create-hash: 1.2.0 + inherits: 2.0.4 + ripemd160: 2.0.3 + safe-buffer: 5.2.1 + sha.js: 2.4.12 + + create-jest@29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + exit: 0.1.2 + graceful-fs: 4.2.11 + jest-config: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-util: 29.7.0 + prompts: 2.4.2 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + create-require@1.1.1: {} + + cross-fetch@3.2.0: + dependencies: + node-fetch: 2.7.0 + transitivePeerDependencies: + - encoding + + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + + crypto-browserify@3.12.1: + dependencies: + browserify-cipher: 1.0.1 + browserify-sign: 4.2.6 + create-ecdh: 4.0.4 + create-hash: 1.2.0 + create-hmac: 1.1.7 + diffie-hellman: 5.0.3 + hash-base: 3.0.5 + inherits: 2.0.4 + pbkdf2: 3.1.6 + public-encrypt: 4.0.3 + randombytes: 2.1.0 + randomfill: 1.0.4 + + css-loader@6.8.1(webpack@5.102.1): + dependencies: + icss-utils: 5.1.0(postcss@8.5.16) + postcss: 8.5.16 + postcss-modules-extract-imports: 3.1.0(postcss@8.5.16) + postcss-modules-local-by-default: 4.2.0(postcss@8.5.16) + postcss-modules-scope: 3.2.1(postcss@8.5.16) + postcss-modules-values: 4.0.0(postcss@8.5.16) + postcss-value-parser: 4.2.0 + semver: 7.8.5 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + + css-select@4.3.0: + dependencies: + boolbase: 1.0.0 + css-what: 6.2.2 + domhandler: 4.3.1 + domutils: 2.8.0 + nth-check: 2.1.1 + + css-what@6.2.2: {} + + css.escape@1.5.1: {} + + cssesc@3.0.0: {} + + cssstyle@3.0.0: + dependencies: + rrweb-cssom: 0.6.0 + + cssstyle@4.6.0: + dependencies: + '@asamuzakjp/css-color': 3.2.0 + rrweb-cssom: 0.8.0 + + data-urls@4.0.0: + dependencies: + abab: 2.0.6 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + + data-urls@5.0.0: + dependencies: + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + + debug@2.6.9: + dependencies: + ms: 2.0.0 + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + decimal.js@10.6.0: {} + + dedent@1.7.2: {} + + deep-equal@2.2.3: + dependencies: + array-buffer-byte-length: 1.0.2 + call-bind: 1.0.9 + es-get-iterator: 1.1.3 + get-intrinsic: 1.3.0 + is-arguments: 1.2.0 + is-array-buffer: 3.0.5 + is-date-object: 1.1.0 + is-regex: 1.2.1 + is-shared-array-buffer: 1.0.4 + isarray: 2.0.5 + object-is: 1.1.6 + object-keys: 1.1.1 + object.assign: 4.1.7 + regexp.prototype.flags: 1.5.4 + side-channel: 1.1.1 + which-boxed-primitive: 1.1.1 + which-collection: 1.0.2 + which-typed-array: 1.1.22 + + deep-extend@0.6.0: {} + + deep-is@0.1.4: {} + + deepmerge@4.3.1: {} + + default-browser-id@5.0.1: {} + + default-browser@5.5.0: + dependencies: + bundle-name: 4.1.0 + default-browser-id: 5.0.1 + + define-data-property@1.1.4: + dependencies: + es-define-property: 1.0.1 + es-errors: 1.3.0 + gopd: 1.2.0 + + define-lazy-prop@3.0.0: {} + + define-properties@1.2.1: + dependencies: + define-data-property: 1.1.4 + has-property-descriptors: 1.0.2 + object-keys: 1.1.1 + + delay@5.0.0: {} + + delayed-stream@1.0.0: {} + + depd@1.1.2: {} + + depd@2.0.0: {} + + des.js@1.1.0: + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + + destroy@1.2.0: {} + + detect-libc@2.1.2: {} + + detect-newline@3.1.0: {} + + detect-node@2.1.0: {} + + diff-sequences@29.6.3: {} + + diff@4.0.4: {} + + diffie-hellman@5.0.3: + dependencies: + bn.js: 4.12.5 + miller-rabin: 4.0.1 + randombytes: 2.1.0 + + dir-glob@3.0.1: + dependencies: + path-type: 4.0.0 + + dns-packet@5.6.1: + dependencies: + '@leichtgewicht/ip-codec': 2.0.5 + + doctrine@3.0.0: + dependencies: + esutils: 2.0.3 + + dom-accessibility-api@0.5.16: {} + + dom-accessibility-api@0.6.3: {} + + dom-converter@0.2.0: + dependencies: + utila: 0.4.0 + + dom-serializer@1.4.1: + dependencies: + domelementtype: 2.3.0 + domhandler: 4.3.1 + entities: 2.2.0 + + domelementtype@2.3.0: {} + + domexception@4.0.0: + dependencies: + webidl-conversions: 7.0.0 + + domhandler@4.3.1: + dependencies: + domelementtype: 2.3.0 + + domutils@2.8.0: + dependencies: + dom-serializer: 1.4.1 + domelementtype: 2.3.0 + domhandler: 4.3.1 + + dot-case@3.0.4: + dependencies: + no-case: 3.0.4 + tslib: 2.8.1 + + dunder-proto@1.0.1: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-errors: 1.3.0 + gopd: 1.2.0 + + eastasianwidth@0.2.0: {} + + ee-first@1.1.1: {} + + electron-to-chromium@1.5.389: {} + + elliptic@6.6.1: + dependencies: + bn.js: 4.12.5 + brorand: 1.1.0 + hash.js: 1.1.7 + hmac-drbg: 1.0.1 + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + + emittery@0.13.1: {} + + emoji-regex@8.0.0: {} + + emoji-regex@9.2.2: {} + + encodeurl@2.0.0: {} + + enhanced-resolve@5.24.2: + dependencies: + graceful-fs: 4.2.11 + tapable: 2.3.3 + + entities@2.2.0: {} + + entities@6.0.1: {} + + entities@8.0.0: {} + + envinfo@7.21.0: {} + + error-ex@1.3.4: + dependencies: + is-arrayish: 0.2.1 + + es-define-property@1.0.1: {} + + es-errors@1.3.0: {} + + es-get-iterator@1.1.3: + dependencies: + call-bind: 1.0.9 + get-intrinsic: 1.3.0 + has-symbols: 1.1.0 + is-arguments: 1.2.0 + is-map: 2.0.3 + is-set: 2.0.3 + is-string: 1.1.1 + isarray: 2.0.5 + stop-iteration-iterator: 1.1.0 + + es-module-lexer@1.7.0: {} + + es-module-lexer@2.3.0: {} + + es-object-atoms@1.1.2: + dependencies: + es-errors: 1.3.0 + + es-set-tostringtag@2.1.0: + dependencies: + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + has-tostringtag: 1.0.2 + hasown: 2.0.4 + + es6-promise@4.2.8: {} + + es6-promisify@5.0.0: + dependencies: + es6-promise: 4.2.8 + + escalade@3.2.0: {} + + escape-html@1.0.3: {} + + escape-string-regexp@2.0.0: {} + + escape-string-regexp@4.0.0: {} + + eslint-scope@5.1.1: + dependencies: + esrecurse: 4.3.0 + estraverse: 4.3.0 + + eslint-scope@7.2.2: + dependencies: + esrecurse: 4.3.0 + estraverse: 5.3.0 + + eslint-visitor-keys@3.4.3: {} + + eslint@8.57.0: + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@8.57.0) + '@eslint-community/regexpp': 4.12.2 + '@eslint/eslintrc': 2.1.4 + '@eslint/js': 8.57.0 + '@humanwhocodes/config-array': 0.11.14 + '@humanwhocodes/module-importer': 1.0.1 + '@nodelib/fs.walk': 1.2.8 + '@ungap/structured-clone': 1.3.2 + ajv: 6.15.0 + chalk: 4.1.2 + cross-spawn: 7.0.6 + debug: 4.4.3 + doctrine: 3.0.0 + escape-string-regexp: 4.0.0 + eslint-scope: 7.2.2 + eslint-visitor-keys: 3.4.3 + espree: 9.6.1 + esquery: 1.7.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 6.0.1 + find-up: 5.0.0 + glob-parent: 6.0.2 + globals: 13.24.0 + graphemer: 1.4.0 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + is-path-inside: 3.0.3 + js-yaml: 4.3.0 + json-stable-stringify-without-jsonify: 1.0.1 + levn: 0.4.1 + lodash.merge: 4.6.2 + minimatch: 3.1.5 + natural-compare: 1.4.0 + optionator: 0.9.4 + strip-ansi: 6.0.1 + text-table: 0.2.0 + transitivePeerDependencies: + - supports-color + + espree@9.6.1: + dependencies: + acorn: 8.17.0 + acorn-jsx: 5.3.2(acorn@8.17.0) + eslint-visitor-keys: 3.4.3 + + esprima@4.0.1: {} + + esquery@1.7.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@4.3.0: {} + + estraverse@5.3.0: {} + + estree-walker@2.0.2: {} + + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.9 + + esutils@2.0.3: {} + + etag@1.8.1: {} + + eventemitter3@4.0.7: {} + + eventemitter3@5.0.1: {} + + eventemitter3@5.0.4: {} + + events@3.3.0: {} + + evp_bytestokey@1.0.3: + dependencies: + md5.js: 1.3.5 + safe-buffer: 5.2.1 + + execa@5.1.1: + dependencies: + cross-spawn: 7.0.6 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + + exit-x@0.2.2: {} + + exit@0.1.2: {} + + expect-type@1.4.0: {} + + expect@29.7.0: + dependencies: + '@jest/expect-utils': 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + + expect@30.4.1: + dependencies: + '@jest/expect-utils': 30.4.1 + '@jest/get-type': 30.1.0 + jest-matcher-utils: 30.4.1 + jest-message-util: 30.4.1 + jest-mock: 30.4.1 + jest-util: 30.4.1 + + express@4.22.2: + dependencies: + accepts: 1.3.8 + array-flatten: 1.1.1 + body-parser: 1.20.6 + content-disposition: 0.5.4 + content-type: 1.0.5 + cookie: 0.7.2 + cookie-signature: 1.0.7 + debug: 2.6.9 + depd: 2.0.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + finalhandler: 1.3.2 + fresh: 0.5.2 + http-errors: 2.0.1 + merge-descriptors: 1.0.3 + methods: 1.1.2 + on-finished: 2.4.1 + parseurl: 1.3.3 + path-to-regexp: 0.1.13 + proxy-addr: 2.0.7 + qs: 6.15.3 + range-parser: 1.2.1 + safe-buffer: 5.2.1 + send: 0.19.2 + serve-static: 1.16.3 + setprototypeof: 1.2.0 + statuses: 2.0.2 + type-is: 1.6.18 + utils-merge: 1.0.1 + vary: 1.1.2 + transitivePeerDependencies: + - supports-color + + eyes@0.1.8: {} + + fast-deep-equal@3.1.3: {} + + fast-glob@3.3.3: + dependencies: + '@nodelib/fs.stat': 2.0.5 + '@nodelib/fs.walk': 1.2.8 + glob-parent: 5.1.2 + merge2: 1.4.1 + micromatch: 4.0.8 + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + + fast-stable-stringify@1.0.0: {} + + fast-uri@3.1.3: {} + + fastest-levenshtein@1.0.16: {} + + fastq@1.20.1: + dependencies: + reusify: 1.1.0 + + faye-websocket@0.11.4: + dependencies: + websocket-driver: 0.7.5 + + fb-watchman@2.0.2: + dependencies: + bser: 2.1.1 + + fdir@6.5.0(picomatch@4.0.5): + optionalDependencies: + picomatch: 4.0.5 + + file-entry-cache@6.0.1: + dependencies: + flat-cache: 3.2.0 + + fill-range@7.1.1: + dependencies: + to-regex-range: 5.0.1 + + finalhandler@1.3.2: + dependencies: + debug: 2.6.9 + encodeurl: 2.0.0 + escape-html: 1.0.3 + on-finished: 2.4.1 + parseurl: 1.3.3 + statuses: 2.0.2 + unpipe: 1.0.0 + transitivePeerDependencies: + - supports-color + + find-cache-dir@4.0.0: + dependencies: + common-path-prefix: 3.0.0 + pkg-dir: 7.0.0 + + find-up@4.1.0: + dependencies: + locate-path: 5.0.0 + path-exists: 4.0.0 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + + find-up@6.3.0: + dependencies: + locate-path: 7.2.0 + path-exists: 5.0.0 + + flat-cache@3.2.0: + dependencies: + flatted: 3.4.2 + keyv: 4.5.4 + rimraf: 3.0.2 + + flat@5.0.2: {} + + flatted@3.4.2: {} + + follow-redirects@1.16.0: {} + + for-each@0.3.5: + dependencies: + is-callable: 1.2.7 + + foreground-child@3.3.1: + dependencies: + cross-spawn: 7.0.6 + signal-exit: 4.1.0 + + form-data@4.0.6: + dependencies: + asynckit: 0.4.0 + combined-stream: 1.0.8 + es-set-tostringtag: 2.1.0 + hasown: 2.0.4 + mime-types: 2.1.35 + + forwarded@0.2.0: {} + + fresh@0.5.2: {} + + fs.realpath@1.0.0: {} + + fsevents@2.3.2: + optional: true + + fsevents@2.3.3: + optional: true + + function-bind@1.1.2: {} + + functions-have-names@1.2.3: {} + + generator-function@2.0.1: {} + + gensync@1.0.0-beta.2: {} + + get-caller-file@2.0.5: {} + + get-intrinsic@1.3.0: + dependencies: + call-bind-apply-helpers: 1.0.2 + es-define-property: 1.0.1 + es-errors: 1.3.0 + es-object-atoms: 1.1.2 + function-bind: 1.1.2 + get-proto: 1.0.1 + gopd: 1.2.0 + has-symbols: 1.1.0 + hasown: 2.0.4 + math-intrinsics: 1.1.0 + + get-package-type@0.1.0: {} + + get-proto@1.0.1: + dependencies: + dunder-proto: 1.0.1 + es-object-atoms: 1.1.2 + + get-stream@6.0.1: {} + + glob-parent@5.1.2: + dependencies: + is-glob: 4.0.3 + + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 + + glob-to-regex.js@1.2.0(tslib@2.8.1): + dependencies: + tslib: 2.8.1 + + glob-to-regexp@0.4.1: {} + + glob@10.5.0: + dependencies: + foreground-child: 3.3.1 + jackspeak: 3.4.3 + minimatch: 9.0.9 + minipass: 7.1.3 + package-json-from-dist: 1.0.1 + path-scurry: 1.11.1 + + glob@7.2.3: + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.5 + once: 1.4.0 + path-is-absolute: 1.0.1 + + globals@13.24.0: + dependencies: + type-fest: 0.20.2 + + globby@13.2.2: + dependencies: + dir-glob: 3.0.1 + fast-glob: 3.3.3 + ignore: 5.3.2 + merge2: 1.4.1 + slash: 4.0.0 + + gopd@1.2.0: {} + + graceful-fs@4.2.11: {} + + graphemer@1.4.0: {} + + handle-thing@2.0.1: {} + + handlebars@4.7.9: + dependencies: + minimist: 1.2.8 + neo-async: 2.6.2 + source-map: 0.6.1 + wordwrap: 1.0.0 + optionalDependencies: + uglify-js: 3.19.3 + + has-bigints@1.1.0: {} + + has-flag@4.0.0: {} + + has-property-descriptors@1.0.2: + dependencies: + es-define-property: 1.0.1 + + has-symbols@1.1.0: {} + + has-tostringtag@1.0.2: + dependencies: + has-symbols: 1.1.0 + + hash-base@3.0.5: + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + + hash-base@3.1.2: + dependencies: + inherits: 2.0.4 + readable-stream: 2.3.8 + safe-buffer: 5.2.1 + to-buffer: 1.2.2 + + hash.js@1.1.7: + dependencies: + inherits: 2.0.4 + minimalistic-assert: 1.0.1 + + hasown@2.0.4: + dependencies: + function-bind: 1.1.2 + + he@1.2.0: {} + + hmac-drbg@1.0.1: + dependencies: + hash.js: 1.1.7 + minimalistic-assert: 1.0.1 + minimalistic-crypto-utils: 1.0.1 + + hpack.js@2.1.6: + dependencies: + inherits: 2.0.4 + obuf: 1.1.2 + readable-stream: 2.3.8 + wbuf: 1.7.3 + + html-encoding-sniffer@3.0.0: + dependencies: + whatwg-encoding: 2.0.0 + + html-encoding-sniffer@4.0.0: + dependencies: + whatwg-encoding: 3.1.1 + + html-escaper@2.0.2: {} + + html-minifier-terser@6.1.0: + dependencies: + camel-case: 4.1.2 + clean-css: 5.3.3 + commander: 8.3.0 + he: 1.2.0 + param-case: 3.0.4 + relateurl: 0.2.7 + terser: 5.49.0 + + html-webpack-plugin@5.5.3(webpack@5.102.1): + dependencies: + '@types/html-minifier-terser': 6.1.0 + html-minifier-terser: 6.1.0 + lodash: 4.18.1 + pretty-error: 4.0.0 + tapable: 2.3.3 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + + htmlparser2@6.1.0: + dependencies: + domelementtype: 2.3.0 + domhandler: 4.3.1 + domutils: 2.8.0 + entities: 2.2.0 + + http-deceiver@1.2.7: {} + + http-errors@1.8.1: + dependencies: + depd: 1.1.2 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 1.5.0 + toidentifier: 1.0.1 + + http-errors@2.0.1: + dependencies: + depd: 2.0.0 + inherits: 2.0.4 + setprototypeof: 1.2.0 + statuses: 2.0.2 + toidentifier: 1.0.1 + + http-parser-js@0.5.10: {} + + http-proxy-agent@5.0.0: + dependencies: + '@tootallnate/once': 2.0.1 + agent-base: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + http-proxy-agent@7.0.2: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + http-proxy-middleware@2.0.10(@types/express@4.17.25): + dependencies: + '@types/http-proxy': 1.17.17 + http-proxy: 1.18.1 + is-glob: 4.0.3 + is-plain-obj: 3.0.0 + micromatch: 4.0.8 + optionalDependencies: + '@types/express': 4.17.25 + transitivePeerDependencies: + - debug + + http-proxy@1.18.1: + dependencies: + eventemitter3: 4.0.7 + follow-redirects: 1.16.0 + requires-port: 1.0.0 + transitivePeerDependencies: + - debug + + https-proxy-agent@5.0.1: + dependencies: + agent-base: 6.0.2 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + https-proxy-agent@7.0.6: + dependencies: + agent-base: 7.1.4 + debug: 4.4.3 + transitivePeerDependencies: + - supports-color + + human-signals@2.1.0: {} + + humanize-ms@1.2.1: + dependencies: + ms: 2.1.3 + + hyperdyperid@1.2.0: {} + + iconv-lite@0.4.24: + dependencies: + safer-buffer: 2.1.2 + + iconv-lite@0.6.3: + dependencies: + safer-buffer: 2.1.2 + + icss-utils@5.1.0(postcss@8.5.16): + dependencies: + postcss: 8.5.16 + + ieee754@1.2.1: {} + + ignore@5.3.2: {} + + import-fresh@3.3.1: + dependencies: + parent-module: 1.0.1 + resolve-from: 4.0.0 + + import-local@3.2.0: + dependencies: + pkg-dir: 4.2.0 + resolve-cwd: 3.0.0 + + imurmurhash@0.1.4: {} + + indent-string@4.0.0: {} + + inflight@1.0.6: + dependencies: + once: 1.4.0 + wrappy: 1.0.2 + + inherits@2.0.4: {} + + ini@1.3.8: {} + + internal-slot@1.1.0: + dependencies: + es-errors: 1.3.0 + hasown: 2.0.4 + side-channel: 1.1.1 + + interpret@3.1.1: {} + + ipaddr.js@1.9.1: {} + + ipaddr.js@2.4.0: {} + + is-arguments@1.2.0: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-array-buffer@3.0.5: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + + is-arrayish@0.2.1: {} + + is-bigint@1.1.0: + dependencies: + has-bigints: 1.1.0 + + is-binary-path@2.1.0: + dependencies: + binary-extensions: 2.3.0 + + is-boolean-object@1.2.2: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-callable@1.2.7: {} + + is-core-module@2.16.2: + dependencies: + hasown: 2.0.4 + + is-date-object@1.1.0: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-docker@2.2.1: {} + + is-docker@3.0.0: {} + + is-extglob@2.1.1: {} + + is-fullwidth-code-point@3.0.0: {} + + is-generator-fn@2.1.0: {} + + is-generator-function@1.1.2: + dependencies: + call-bound: 1.0.4 + generator-function: 2.0.1 + get-proto: 1.0.1 + has-tostringtag: 1.0.2 + safe-regex-test: 1.1.0 + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + is-inside-container@1.0.0: + dependencies: + is-docker: 3.0.0 + + is-map@2.0.3: {} + + is-network-error@1.3.2: {} + + is-number-object@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-number@7.0.0: {} + + is-path-inside@3.0.3: {} + + is-plain-obj@3.0.0: {} + + is-plain-object@2.0.4: + dependencies: + isobject: 3.0.1 + + is-port-reachable@4.0.0: {} + + is-potential-custom-element-name@1.0.1: {} + + is-regex@1.2.1: + dependencies: + call-bound: 1.0.4 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + hasown: 2.0.4 + + is-set@2.0.3: {} + + is-shared-array-buffer@1.0.4: + dependencies: + call-bound: 1.0.4 + + is-stream@2.0.1: {} + + is-string@1.1.1: + dependencies: + call-bound: 1.0.4 + has-tostringtag: 1.0.2 + + is-symbol@1.1.1: + dependencies: + call-bound: 1.0.4 + has-symbols: 1.1.0 + safe-regex-test: 1.1.0 + + is-typed-array@1.1.15: + dependencies: + which-typed-array: 1.1.22 + + is-weakmap@2.0.2: {} + + is-weakset@2.0.4: + dependencies: + call-bound: 1.0.4 + get-intrinsic: 1.3.0 + + is-wsl@2.2.0: + dependencies: + is-docker: 2.2.1 + + is-wsl@3.1.1: + dependencies: + is-inside-container: 1.0.0 + + isarray@1.0.0: {} + + isarray@2.0.5: {} + + isexe@2.0.0: {} + + isobject@3.0.1: {} + + isomorphic-ws@4.0.1(ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)): + dependencies: + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + + isows@1.0.7(ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)): + dependencies: + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + + istanbul-lib-coverage@3.2.2: {} + + istanbul-lib-instrument@5.2.1: + dependencies: + '@babel/core': 7.23.0 + '@babel/parser': 7.29.7 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-coverage: 3.2.2 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + + istanbul-lib-instrument@6.0.3: + dependencies: + '@babel/core': 7.29.7 + '@babel/parser': 7.29.7 + '@istanbuljs/schema': 0.1.6 + istanbul-lib-coverage: 3.2.2 + semver: 7.8.5 + transitivePeerDependencies: + - supports-color + + istanbul-lib-report@3.0.1: + dependencies: + istanbul-lib-coverage: 3.2.2 + make-dir: 4.0.0 + supports-color: 7.2.0 + + istanbul-lib-source-maps@4.0.1: + dependencies: + debug: 4.4.3 + istanbul-lib-coverage: 3.2.2 + source-map: 0.6.1 + transitivePeerDependencies: + - supports-color + + istanbul-lib-source-maps@5.0.6: + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + debug: 4.4.3 + istanbul-lib-coverage: 3.2.2 + transitivePeerDependencies: + - supports-color + + istanbul-reports@3.2.0: + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + + jackspeak@3.4.3: + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + + jayson@4.3.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + '@types/connect': 3.4.38 + '@types/node': 12.20.55 + '@types/ws': 7.4.7 + commander: 2.20.3 + delay: 5.0.0 + es6-promisify: 5.0.0 + eyes: 0.1.8 + isomorphic-ws: 4.0.1(ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)) + json-stringify-safe: 5.0.1 + stream-json: 1.9.1 + uuid: 8.3.2 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + + jest-changed-files@29.7.0: + dependencies: + execa: 5.1.1 + jest-util: 29.7.0 + p-limit: 3.1.0 + + jest-changed-files@30.4.1: + dependencies: + execa: 5.1.1 + jest-util: 30.4.1 + p-limit: 3.1.0 + + jest-circus@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/expect': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + chalk: 4.1.2 + co: 4.6.0 + dedent: 1.7.2 + is-generator-fn: 2.1.0 + jest-each: 29.7.0 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-runtime: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + p-limit: 3.1.0 + pretty-format: 29.7.0 + pure-rand: 6.1.0 + slash: 3.0.0 + stack-utils: 2.0.6 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-circus@30.4.2: + dependencies: + '@jest/environment': 30.4.1 + '@jest/expect': 30.4.1 + '@jest/test-result': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + chalk: 4.1.2 + co: 4.6.0 + dedent: 1.7.2 + is-generator-fn: 2.1.0 + jest-each: 30.4.1 + jest-matcher-utils: 30.4.1 + jest-message-util: 30.4.1 + jest-runtime: 30.4.2 + jest-snapshot: 30.4.1 + jest-util: 30.4.1 + p-limit: 3.1.0 + pretty-format: 30.4.1 + pure-rand: 7.0.1 + slash: 3.0.0 + stack-utils: 2.0.6 + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-cli@29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + chalk: 4.1.2 + create-jest: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + exit: 0.1.2 + import-local: 3.2.0 + jest-config: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-util: 29.7.0 + jest-validate: 29.7.0 + yargs: 17.7.3 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + jest-cli@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@jest/core': 30.4.2(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + '@jest/test-result': 30.4.1 + '@jest/types': 30.4.1 + chalk: 4.1.2 + exit-x: 0.2.2 + import-local: 3.2.0 + jest-config: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + jest-util: 30.4.1 + jest-validate: 30.4.1 + yargs: 17.7.3 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + jest-config@29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@babel/core': 7.23.0 + '@jest/test-sequencer': 29.7.0 + '@jest/types': 29.6.3 + babel-jest: 29.7.0(@babel/core@7.23.0) + chalk: 4.1.2 + ci-info: 3.9.0 + deepmerge: 4.3.1 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-circus: 29.7.0 + jest-environment-node: 29.7.0 + jest-get-type: 29.6.3 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-runner: 29.7.0 + jest-util: 29.7.0 + jest-validate: 29.7.0 + micromatch: 4.0.8 + parse-json: 5.2.0 + pretty-format: 29.7.0 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 26.1.1 + ts-node: 10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-config@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@babel/core': 7.29.7 + '@jest/get-type': 30.1.0 + '@jest/pattern': 30.4.0 + '@jest/test-sequencer': 30.4.1 + '@jest/types': 30.4.1 + babel-jest: 30.4.1(@babel/core@7.29.7) + chalk: 4.1.2 + ci-info: 4.4.0 + deepmerge: 4.3.1 + glob: 10.5.0 + graceful-fs: 4.2.11 + jest-circus: 30.4.2 + jest-docblock: 30.4.0 + jest-environment-node: 30.4.1 + jest-regex-util: 30.4.0 + jest-resolve: 30.4.1 + jest-runner: 30.4.2 + jest-util: 30.4.1 + jest-validate: 30.4.1 + parse-json: 5.2.0 + pretty-format: 30.4.1 + slash: 3.0.0 + strip-json-comments: 3.1.1 + optionalDependencies: + '@types/node': 26.1.1 + ts-node: 10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3) + transitivePeerDependencies: + - babel-plugin-macros + - supports-color + + jest-diff@29.7.0: + dependencies: + chalk: 4.1.2 + diff-sequences: 29.6.3 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-diff@30.4.1: + dependencies: + '@jest/diff-sequences': 30.4.0 + '@jest/get-type': 30.1.0 + chalk: 4.1.2 + pretty-format: 30.4.1 + + jest-docblock@29.7.0: + dependencies: + detect-newline: 3.1.0 + + jest-docblock@30.4.0: + dependencies: + detect-newline: 3.1.0 + + jest-each@29.7.0: + dependencies: + '@jest/types': 29.6.3 + chalk: 4.1.2 + jest-get-type: 29.6.3 + jest-util: 29.7.0 + pretty-format: 29.7.0 + + jest-each@30.4.1: + dependencies: + '@jest/get-type': 30.1.0 + '@jest/types': 30.4.1 + chalk: 4.1.2 + jest-util: 30.4.1 + pretty-format: 30.4.1 + + jest-environment-jsdom@30.4.1(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + '@jest/environment': 30.4.1 + '@jest/environment-jsdom-abstract': 30.4.1(jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)) + jsdom: 26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + jest-environment-node@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + jest-mock: 29.7.0 + jest-util: 29.7.0 + + jest-environment-node@30.4.1: + dependencies: + '@jest/environment': 30.4.1 + '@jest/fake-timers': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + jest-mock: 30.4.1 + jest-util: 30.4.1 + jest-validate: 30.4.1 + + jest-get-type@29.6.3: {} + + jest-haste-map@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/graceful-fs': 4.1.9 + '@types/node': 26.1.1 + anymatch: 3.1.3 + fb-watchman: 2.0.2 + graceful-fs: 4.2.11 + jest-regex-util: 29.6.3 + jest-util: 29.7.0 + jest-worker: 29.7.0 + micromatch: 4.0.8 + walker: 1.0.8 + optionalDependencies: + fsevents: 2.3.3 + + jest-haste-map@30.4.1: + dependencies: + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + anymatch: 3.1.3 + fb-watchman: 2.0.2 + graceful-fs: 4.2.11 + jest-regex-util: 30.4.0 + jest-util: 30.4.1 + jest-worker: 30.4.1 + picomatch: 4.0.5 + walker: 1.0.8 + optionalDependencies: + fsevents: 2.3.3 + + jest-leak-detector@29.7.0: + dependencies: + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-leak-detector@30.4.1: + dependencies: + '@jest/get-type': 30.1.0 + pretty-format: 30.4.1 + + jest-matcher-utils@29.7.0: + dependencies: + chalk: 4.1.2 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + pretty-format: 29.7.0 + + jest-matcher-utils@30.4.1: + dependencies: + '@jest/get-type': 30.1.0 + chalk: 4.1.2 + jest-diff: 30.4.1 + pretty-format: 30.4.1 + + jest-message-util@29.7.0: + dependencies: + '@babel/code-frame': 7.29.7 + '@jest/types': 29.6.3 + '@types/stack-utils': 2.0.3 + chalk: 4.1.2 + graceful-fs: 4.2.11 + micromatch: 4.0.8 + pretty-format: 29.7.0 + slash: 3.0.0 + stack-utils: 2.0.6 + + jest-message-util@30.4.1: + dependencies: + '@babel/code-frame': 7.29.7 + '@jest/types': 30.4.1 + '@types/stack-utils': 2.0.3 + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-util: 30.4.1 + picomatch: 4.0.5 + pretty-format: 30.4.1 + slash: 3.0.0 + stack-utils: 2.0.6 + + jest-mock@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + jest-util: 29.7.0 + + jest-mock@30.4.1: + dependencies: + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + jest-util: 30.4.1 + + jest-pnp-resolver@1.2.3(jest-resolve@29.7.0): + optionalDependencies: + jest-resolve: 29.7.0 + + jest-pnp-resolver@1.2.3(jest-resolve@30.4.1): + optionalDependencies: + jest-resolve: 30.4.1 + + jest-regex-util@29.6.3: {} + + jest-regex-util@30.4.0: {} + + jest-resolve-dependencies@29.7.0: + dependencies: + jest-regex-util: 29.6.3 + jest-snapshot: 29.7.0 + transitivePeerDependencies: + - supports-color + + jest-resolve-dependencies@30.4.2: + dependencies: + jest-regex-util: 30.4.0 + jest-snapshot: 30.4.1 + transitivePeerDependencies: + - supports-color + + jest-resolve@29.7.0: + dependencies: + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-pnp-resolver: 1.2.3(jest-resolve@29.7.0) + jest-util: 29.7.0 + jest-validate: 29.7.0 + resolve: 1.22.12 + resolve.exports: 2.0.3 + slash: 3.0.0 + + jest-resolve@30.4.1: + dependencies: + chalk: 4.1.2 + graceful-fs: 4.2.11 + jest-haste-map: 30.4.1 + jest-pnp-resolver: 1.2.3(jest-resolve@30.4.1) + jest-util: 30.4.1 + jest-validate: 30.4.1 + slash: 3.0.0 + unrs-resolver: 1.12.2 + + jest-runner@29.7.0: + dependencies: + '@jest/console': 29.7.0 + '@jest/environment': 29.7.0 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + chalk: 4.1.2 + emittery: 0.13.1 + graceful-fs: 4.2.11 + jest-docblock: 29.7.0 + jest-environment-node: 29.7.0 + jest-haste-map: 29.7.0 + jest-leak-detector: 29.7.0 + jest-message-util: 29.7.0 + jest-resolve: 29.7.0 + jest-runtime: 29.7.0 + jest-util: 29.7.0 + jest-watcher: 29.7.0 + jest-worker: 29.7.0 + p-limit: 3.1.0 + source-map-support: 0.5.13 + transitivePeerDependencies: + - supports-color + + jest-runner@30.4.2: + dependencies: + '@jest/console': 30.4.1 + '@jest/environment': 30.4.1 + '@jest/test-result': 30.4.1 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + chalk: 4.1.2 + emittery: 0.13.1 + exit-x: 0.2.2 + graceful-fs: 4.2.11 + jest-docblock: 30.4.0 + jest-environment-node: 30.4.1 + jest-haste-map: 30.4.1 + jest-leak-detector: 30.4.1 + jest-message-util: 30.4.1 + jest-resolve: 30.4.1 + jest-runtime: 30.4.2 + jest-util: 30.4.1 + jest-watcher: 30.4.1 + jest-worker: 30.4.1 + p-limit: 3.1.0 + source-map-support: 0.5.13 + transitivePeerDependencies: + - supports-color + + jest-runtime@29.7.0: + dependencies: + '@jest/environment': 29.7.0 + '@jest/fake-timers': 29.7.0 + '@jest/globals': 29.7.0 + '@jest/source-map': 29.6.3 + '@jest/test-result': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + chalk: 4.1.2 + cjs-module-lexer: 1.4.3 + collect-v8-coverage: 1.0.3 + glob: 7.2.3 + graceful-fs: 4.2.11 + jest-haste-map: 29.7.0 + jest-message-util: 29.7.0 + jest-mock: 29.7.0 + jest-regex-util: 29.6.3 + jest-resolve: 29.7.0 + jest-snapshot: 29.7.0 + jest-util: 29.7.0 + slash: 3.0.0 + strip-bom: 4.0.0 + transitivePeerDependencies: + - supports-color + + jest-runtime@30.4.2: + dependencies: + '@jest/environment': 30.4.1 + '@jest/fake-timers': 30.4.1 + '@jest/globals': 30.4.1 + '@jest/source-map': 30.0.1 + '@jest/test-result': 30.4.1 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + chalk: 4.1.2 + cjs-module-lexer: 2.2.0 + collect-v8-coverage: 1.0.3 + glob: 10.5.0 + graceful-fs: 4.2.11 + jest-haste-map: 30.4.1 + jest-message-util: 30.4.1 + jest-mock: 30.4.1 + jest-regex-util: 30.4.0 + jest-resolve: 30.4.1 + jest-snapshot: 30.4.1 + jest-util: 30.4.1 + slash: 3.0.0 + strip-bom: 4.0.0 + transitivePeerDependencies: + - supports-color + + jest-snapshot@29.7.0: + dependencies: + '@babel/core': 7.23.0 + '@babel/generator': 7.29.7 + '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.23.0) + '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.23.0) + '@babel/types': 7.29.7 + '@jest/expect-utils': 29.7.0 + '@jest/transform': 29.7.0 + '@jest/types': 29.6.3 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.23.0) + chalk: 4.1.2 + expect: 29.7.0 + graceful-fs: 4.2.11 + jest-diff: 29.7.0 + jest-get-type: 29.6.3 + jest-matcher-utils: 29.7.0 + jest-message-util: 29.7.0 + jest-util: 29.7.0 + natural-compare: 1.4.0 + pretty-format: 29.7.0 + semver: 7.8.5 + transitivePeerDependencies: + - supports-color + + jest-snapshot@30.4.1: + dependencies: + '@babel/core': 7.29.7 + '@babel/generator': 7.29.7 + '@babel/plugin-syntax-jsx': 7.29.7(@babel/core@7.29.7) + '@babel/plugin-syntax-typescript': 7.29.7(@babel/core@7.29.7) + '@babel/types': 7.29.7 + '@jest/expect-utils': 30.4.1 + '@jest/get-type': 30.1.0 + '@jest/snapshot-utils': 30.4.1 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + babel-preset-current-node-syntax: 1.2.0(@babel/core@7.29.7) + chalk: 4.1.2 + expect: 30.4.1 + graceful-fs: 4.2.11 + jest-diff: 30.4.1 + jest-matcher-utils: 30.4.1 + jest-message-util: 30.4.1 + jest-util: 30.4.1 + pretty-format: 30.4.1 + semver: 7.8.5 + synckit: 0.11.13 + transitivePeerDependencies: + - supports-color + + jest-util@29.7.0: + dependencies: + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + chalk: 4.1.2 + ci-info: 3.9.0 + graceful-fs: 4.2.11 + picomatch: 2.3.2 + + jest-util@30.4.1: + dependencies: + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + chalk: 4.1.2 + ci-info: 4.4.0 + graceful-fs: 4.2.11 + picomatch: 4.0.5 + + jest-validate@29.7.0: + dependencies: + '@jest/types': 29.6.3 + camelcase: 6.3.0 + chalk: 4.1.2 + jest-get-type: 29.6.3 + leven: 3.1.0 + pretty-format: 29.7.0 + + jest-validate@30.4.1: + dependencies: + '@jest/get-type': 30.1.0 + '@jest/types': 30.4.1 + camelcase: 6.3.0 + chalk: 4.1.2 + leven: 3.1.0 + pretty-format: 30.4.1 + + jest-watcher@29.7.0: + dependencies: + '@jest/test-result': 29.7.0 + '@jest/types': 29.6.3 + '@types/node': 26.1.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + emittery: 0.13.1 + jest-util: 29.7.0 + string-length: 4.0.2 + + jest-watcher@30.4.1: + dependencies: + '@jest/test-result': 30.4.1 + '@jest/types': 30.4.1 + '@types/node': 26.1.1 + ansi-escapes: 4.3.2 + chalk: 4.1.2 + emittery: 0.13.1 + jest-util: 30.4.1 + string-length: 4.0.2 + + jest-worker@27.5.1: + dependencies: + '@types/node': 26.1.1 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest-worker@29.7.0: + dependencies: + '@types/node': 26.1.1 + jest-util: 29.7.0 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest-worker@30.4.1: + dependencies: + '@types/node': 26.1.1 + '@ungap/structured-clone': 1.3.2 + jest-util: 30.4.1 + merge-stream: 2.0.0 + supports-color: 8.1.1 + + jest@29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + '@jest/types': 29.6.3 + import-local: 3.2.0 + jest-cli: 29.7.0(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - supports-color + - ts-node + + jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)): + dependencies: + '@jest/core': 30.4.2(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + '@jest/types': 30.4.1 + import-local: 3.2.0 + jest-cli: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - esbuild-register + - supports-color + - ts-node + + js-tokens@4.0.0: {} + + js-yaml@3.15.0: + dependencies: + argparse: 1.0.10 + esprima: 4.0.1 + + js-yaml@4.3.0: + dependencies: + argparse: 2.0.1 + + jsdom@22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + abab: 2.0.6 + cssstyle: 3.0.0 + data-urls: 4.0.0 + decimal.js: 10.6.0 + domexception: 4.0.0 + form-data: 4.0.6 + html-encoding-sniffer: 3.0.0 + http-proxy-agent: 5.0.0 + https-proxy-agent: 5.0.1 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.24 + parse5: 7.3.0 + rrweb-cssom: 0.6.0 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 4.1.4 + w3c-xmlserializer: 4.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 2.0.0 + whatwg-mimetype: 3.0.0 + whatwg-url: 12.0.1 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + xml-name-validator: 4.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): + dependencies: + cssstyle: 4.6.0 + data-urls: 5.0.0 + decimal.js: 10.6.0 + html-encoding-sniffer: 4.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.6 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.24 + parse5: 7.3.0 + rrweb-cssom: 0.8.0 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 5.1.2 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 3.1.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 14.2.0 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + + jsesc@3.1.0: {} + + json-buffer@3.0.1: {} + + json-parse-even-better-errors@2.3.1: {} + + json-schema-traverse@0.4.1: {} + + json-schema-traverse@1.0.0: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + + json-stringify-safe@5.0.1: {} + + json5@2.2.3: {} + + keyv@4.5.4: + dependencies: + json-buffer: 3.0.1 + + kind-of@6.0.3: {} + + kleur@3.0.3: {} + + launch-editor@2.14.1: + dependencies: + picocolors: 1.1.1 + shell-quote: 1.9.0 + + leven@3.1.0: {} + + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + + lightningcss-android-arm64@1.32.0: + optional: true + + lightningcss-darwin-arm64@1.32.0: + optional: true + + lightningcss-darwin-x64@1.32.0: + optional: true + + lightningcss-freebsd-x64@1.32.0: + optional: true + + lightningcss-linux-arm-gnueabihf@1.32.0: + optional: true + + lightningcss-linux-arm64-gnu@1.32.0: + optional: true + + lightningcss-linux-arm64-musl@1.32.0: + optional: true + + lightningcss-linux-x64-gnu@1.32.0: + optional: true + + lightningcss-linux-x64-musl@1.32.0: + optional: true + + lightningcss-win32-arm64-msvc@1.32.0: + optional: true + + lightningcss-win32-x64-msvc@1.32.0: + optional: true + + lightningcss@1.32.0: + dependencies: + detect-libc: 2.1.2 + optionalDependencies: + lightningcss-android-arm64: 1.32.0 + lightningcss-darwin-arm64: 1.32.0 + lightningcss-darwin-x64: 1.32.0 + lightningcss-freebsd-x64: 1.32.0 + lightningcss-linux-arm-gnueabihf: 1.32.0 + lightningcss-linux-arm64-gnu: 1.32.0 + lightningcss-linux-arm64-musl: 1.32.0 + lightningcss-linux-x64-gnu: 1.32.0 + lightningcss-linux-x64-musl: 1.32.0 + lightningcss-win32-arm64-msvc: 1.32.0 + lightningcss-win32-x64-msvc: 1.32.0 + + lines-and-columns@1.2.4: {} + + loader-runner@4.3.2: {} + + locate-path@5.0.0: + dependencies: + p-locate: 4.1.0 + + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + + locate-path@7.2.0: + dependencies: + p-locate: 6.0.0 + + lodash.clonedeep@4.5.0: {} + + lodash.debounce@4.0.8: {} + + lodash.memoize@4.1.2: {} + + lodash.merge@4.6.2: {} + + lodash@4.18.1: {} + + lower-case@2.0.2: + dependencies: + tslib: 2.8.1 + + lru-cache@10.4.3: {} + + lru-cache@5.1.1: + dependencies: + yallist: 3.1.1 + + lz-string@1.5.0: {} + + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + + make-dir@4.0.0: + dependencies: + semver: 7.8.5 + + make-error@1.3.6: {} + + makeerror@1.0.12: + dependencies: + tmpl: 1.0.5 + + math-intrinsics@1.1.0: {} + + md5.js@1.3.5: + dependencies: + hash-base: 3.0.5 + inherits: 2.0.4 + safe-buffer: 5.2.1 + + media-typer@0.3.0: {} + + memfs@4.64.0(tslib@2.8.1): + dependencies: + '@jsonjoy.com/fs-core': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-fsa': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-builtins': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-to-fsa': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-node-utils': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-print': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/fs-snapshot': 4.64.0(tslib@2.8.1) + '@jsonjoy.com/json-pack': 1.21.0(tslib@2.8.1) + '@jsonjoy.com/util': 1.9.0(tslib@2.8.1) + glob-to-regex.js: 1.2.0(tslib@2.8.1) + thingies: 2.6.0(tslib@2.8.1) + tree-dump: 1.1.0(tslib@2.8.1) + tslib: 2.8.1 + + merge-descriptors@1.0.3: {} + + merge-stream@2.0.0: {} + + merge2@1.4.1: {} + + methods@1.1.2: {} + + micromatch@4.0.8: + dependencies: + braces: 3.0.3 + picomatch: 2.3.2 + + miller-rabin@4.0.1: + dependencies: + bn.js: 4.12.5 + brorand: 1.1.0 + + mime-db@1.33.0: {} + + mime-db@1.52.0: {} + + mime-db@1.54.0: {} + + mime-types@2.1.18: + dependencies: + mime-db: 1.33.0 + + mime-types@2.1.35: + dependencies: + mime-db: 1.52.0 + + mime-types@3.0.2: + dependencies: + mime-db: 1.54.0 + + mime@1.6.0: {} + + mimic-fn@2.1.0: {} + + min-indent@1.0.1: {} + + mini-css-extract-plugin@2.9.4(webpack@5.102.1): + dependencies: + schema-utils: 4.3.3 + tapable: 2.3.3 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + + minimalistic-assert@1.0.1: {} + + minimalistic-crypto-utils@1.0.1: {} + + minimatch@3.1.5: + dependencies: + brace-expansion: 1.1.16 + + minimatch@9.0.9: + dependencies: + brace-expansion: 2.1.2 + + minimist@1.2.8: {} + + minipass@7.1.3: {} + + mrmime@2.0.1: {} + + ms@2.0.0: {} + + ms@2.1.3: {} + + multicast-dns@7.2.5: + dependencies: + dns-packet: 5.6.1 + thunky: 1.1.0 + + nanoid@3.3.15: {} + + napi-postinstall@0.3.4: {} + + natural-compare@1.4.0: {} + + negotiator@0.6.3: {} + + negotiator@0.6.4: {} + + neo-async@2.6.2: {} + + no-case@3.0.4: + dependencies: + lower-case: 2.0.2 + tslib: 2.8.1 + + node-fetch@2.7.0: + dependencies: + whatwg-url: 5.0.0 + + node-forge@1.4.0: {} + + node-gyp-build@4.8.4: + optional: true + + node-int64@0.4.0: {} + + node-releases@2.0.51: {} + + normalize-path@3.0.0: {} + + npm-run-path@4.0.1: + dependencies: + path-key: 3.1.1 + + nth-check@2.1.1: + dependencies: + boolbase: 1.0.0 + + nwsapi@2.2.24: {} + + object-inspect@1.13.4: {} + + object-is@1.1.6: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + + object-keys@1.1.1: {} + + object.assign@4.1.7: + dependencies: + call-bind: 1.0.9 + call-bound: 1.0.4 + define-properties: 1.2.1 + es-object-atoms: 1.1.2 + has-symbols: 1.1.0 + object-keys: 1.1.1 + + obuf@1.1.2: {} + + obug@2.1.3: {} + + on-finished@2.4.1: + dependencies: + ee-first: 1.1.1 + + on-headers@1.1.0: {} + + once@1.4.0: + dependencies: + wrappy: 1.0.2 + + onetime@5.1.2: + dependencies: + mimic-fn: 2.1.0 + + open@10.2.0: + dependencies: + default-browser: 5.5.0 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + wsl-utils: 0.1.0 + + optionator@0.9.4: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.5 + + ox@0.11.3(typescript@5.4.3): + dependencies: + '@adraffy/ens-normalize': 1.11.1 + '@noble/ciphers': 1.3.0 + '@noble/curves': 1.9.1 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.2.3(typescript@5.4.3) + eventemitter3: 5.0.1 + optionalDependencies: + typescript: 5.4.3 + transitivePeerDependencies: + - zod + + p-limit@2.3.0: + dependencies: + p-try: 2.2.0 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-limit@4.0.0: + dependencies: + yocto-queue: 1.2.2 + + p-locate@4.1.0: + dependencies: + p-limit: 2.3.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + p-locate@6.0.0: + dependencies: + p-limit: 4.0.0 + + p-retry@6.2.1: + dependencies: + '@types/retry': 0.12.2 + is-network-error: 1.3.2 + retry: 0.13.1 + + p-try@2.2.0: {} + + package-json-from-dist@1.0.1: {} + + param-case@3.0.4: + dependencies: + dot-case: 3.0.4 + tslib: 2.8.1 + + parent-module@1.0.1: + dependencies: + callsites: 3.1.0 + + parse-asn1@5.1.9: + dependencies: + asn1.js: 4.10.1 + browserify-aes: 1.2.0 + evp_bytestokey: 1.0.3 + pbkdf2: 3.1.6 + safe-buffer: 5.2.1 + + parse-json@5.2.0: + dependencies: + '@babel/code-frame': 7.29.7 + error-ex: 1.3.4 + json-parse-even-better-errors: 2.3.1 + lines-and-columns: 1.2.4 + + parse5@7.3.0: + dependencies: + entities: 6.0.1 + + parse5@8.0.1: + dependencies: + entities: 8.0.0 + + parseurl@1.3.3: {} + + pascal-case@3.1.2: + dependencies: + no-case: 3.0.4 + tslib: 2.8.1 + + path-exists@4.0.0: {} + + path-exists@5.0.0: {} + + path-is-absolute@1.0.1: {} + + path-is-inside@1.0.2: {} + + path-key@3.1.1: {} + + path-parse@1.0.7: {} + + path-scurry@1.11.1: + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.3 + + path-to-regexp@0.1.13: {} + + path-to-regexp@3.3.0: {} + + path-type@4.0.0: {} + + pathe@2.0.3: {} + + pbkdf2@3.1.6: + dependencies: + create-hash: 1.2.0 + create-hmac: 1.1.7 + ripemd160: 2.0.3 + safe-buffer: 5.2.1 + sha.js: 2.4.12 + to-buffer: 1.2.2 + + picocolors@1.1.1: {} + + picomatch@2.3.2: {} + + picomatch@4.0.5: {} + + pirates@4.0.7: {} + + pkg-dir@4.2.0: + dependencies: + find-up: 4.1.0 + + pkg-dir@7.0.0: + dependencies: + find-up: 6.3.0 + + playwright-core@1.61.1: {} + + playwright@1.61.1: + dependencies: + playwright-core: 1.61.1 + optionalDependencies: + fsevents: 2.3.2 + + pngjs@7.0.0: {} + + possible-typed-array-names@1.1.0: {} + + postcss-modules-extract-imports@3.1.0(postcss@8.5.16): + dependencies: + postcss: 8.5.16 + + postcss-modules-local-by-default@4.2.0(postcss@8.5.16): + dependencies: + icss-utils: 5.1.0(postcss@8.5.16) + postcss: 8.5.16 + postcss-selector-parser: 7.1.4 + postcss-value-parser: 4.2.0 + + postcss-modules-scope@3.2.1(postcss@8.5.16): + dependencies: + postcss: 8.5.16 + postcss-selector-parser: 7.1.4 + + postcss-modules-values@4.0.0(postcss@8.5.16): + dependencies: + icss-utils: 5.1.0(postcss@8.5.16) + postcss: 8.5.16 + + postcss-selector-parser@7.1.4: + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + + postcss-value-parser@4.2.0: {} + + postcss@8.5.16: + dependencies: + nanoid: 3.3.15 + picocolors: 1.1.1 + source-map-js: 1.2.1 + + prelude-ls@1.2.1: {} + + prettier@2.8.4: {} + + pretty-error@4.0.0: + dependencies: + lodash: 4.18.1 + renderkid: 3.0.0 + + pretty-format@27.5.1: + dependencies: + ansi-regex: 5.0.1 + ansi-styles: 5.2.0 + react-is: 17.0.2 + + pretty-format@29.7.0: + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.3.1 + + pretty-format@30.4.1: + dependencies: + '@jest/schemas': 30.4.1 + ansi-styles: 5.2.0 + react-is-18: react-is@18.3.1 + react-is-19: react-is@19.2.7 + + process-nextick-args@2.0.1: {} + + prompts@2.4.2: + dependencies: + kleur: 3.0.3 + sisteransi: 1.0.5 + + proxy-addr@2.0.7: + dependencies: + forwarded: 0.2.0 + ipaddr.js: 1.9.1 + + psl@1.15.0: + dependencies: + punycode: 2.3.1 + + public-encrypt@4.0.3: + dependencies: + bn.js: 4.12.5 + browserify-rsa: 4.1.1 + create-hash: 1.2.0 + parse-asn1: 5.1.9 + randombytes: 2.1.0 + safe-buffer: 5.2.1 + + punycode@2.3.1: {} + + pure-rand@6.1.0: {} + + pure-rand@7.0.1: {} + + pvtsutils@1.3.6: + dependencies: + tslib: 2.8.1 + + pvutils@1.1.5: {} + + qs@6.15.3: + dependencies: + es-define-property: 1.0.1 + side-channel: 1.1.1 + + querystringify@2.2.0: {} + + queue-microtask@1.2.3: {} + + randombytes@2.1.0: + dependencies: + safe-buffer: 5.2.1 + + randomfill@1.0.4: + dependencies: + randombytes: 2.1.0 + safe-buffer: 5.2.1 + + range-parser@1.2.0: {} + + range-parser@1.2.1: {} + + range-parser@1.3.0: {} + + raw-body@2.5.3: + dependencies: + bytes: 3.1.2 + http-errors: 2.0.1 + iconv-lite: 0.4.24 + unpipe: 1.0.0 + + rc@1.2.8: + dependencies: + deep-extend: 0.6.0 + ini: 1.3.8 + minimist: 1.2.8 + strip-json-comments: 2.0.1 + + react-is@17.0.2: {} + + react-is@18.3.1: {} + + react-is@19.2.7: {} + + readable-stream@2.3.8: + dependencies: + core-util-is: 1.0.3 + inherits: 2.0.4 + isarray: 1.0.0 + process-nextick-args: 2.0.1 + safe-buffer: 5.1.2 + string_decoder: 1.1.1 + util-deprecate: 1.0.2 + + readable-stream@3.6.2: + dependencies: + inherits: 2.0.4 + string_decoder: 1.3.0 + util-deprecate: 1.0.2 + + readdirp@3.6.0: + dependencies: + picomatch: 2.3.2 + + rechoir@0.8.0: + dependencies: + resolve: 1.22.12 + + redent@3.0.0: + dependencies: + indent-string: 4.0.0 + strip-indent: 3.0.0 + + reflect-metadata@0.2.2: {} + + regenerate-unicode-properties@10.2.2: + dependencies: + regenerate: 1.4.2 + + regenerate@1.4.2: {} + + regenerator-runtime@0.14.1: {} + + regexp.prototype.flags@1.5.4: + dependencies: + call-bind: 1.0.9 + define-properties: 1.2.1 + es-errors: 1.3.0 + get-proto: 1.0.1 + gopd: 1.2.0 + set-function-name: 2.0.2 + + regexpu-core@6.4.0: + dependencies: + regenerate: 1.4.2 + regenerate-unicode-properties: 10.2.2 + regjsgen: 0.8.0 + regjsparser: 0.13.2 + unicode-match-property-ecmascript: 2.0.0 + unicode-match-property-value-ecmascript: 2.2.1 + + registry-auth-token@3.3.2: + dependencies: + rc: 1.2.8 + safe-buffer: 5.2.1 + + registry-url@3.1.0: + dependencies: + rc: 1.2.8 + + regjsgen@0.8.0: {} + + regjsparser@0.13.2: + dependencies: + jsesc: 3.1.0 + + relateurl@0.2.7: {} + + renderkid@3.0.0: + dependencies: + css-select: 4.3.0 + dom-converter: 0.2.0 + htmlparser2: 6.1.0 + lodash: 4.18.1 + strip-ansi: 6.0.1 + + require-directory@2.1.1: {} + + require-from-string@2.0.2: {} + + requires-port@1.0.0: {} + + resolve-cwd@3.0.0: + dependencies: + resolve-from: 5.0.0 + + resolve-from@4.0.0: {} + + resolve-from@5.0.0: {} + + resolve.exports@2.0.3: {} + + resolve@1.22.12: + dependencies: + es-errors: 1.3.0 + is-core-module: 2.16.2 + path-parse: 1.0.7 + supports-preserve-symlinks-flag: 1.0.0 + + retry@0.13.1: {} + + reusify@1.1.0: {} + + rimraf@3.0.2: + dependencies: + glob: 7.2.3 + + ripemd160@2.0.3: + dependencies: + hash-base: 3.1.2 + inherits: 2.0.4 + + rolldown@1.1.5: + dependencies: + '@oxc-project/types': 0.139.0 + '@rolldown/pluginutils': 1.0.1 + optionalDependencies: + '@rolldown/binding-android-arm64': 1.1.5 + '@rolldown/binding-darwin-arm64': 1.1.5 + '@rolldown/binding-darwin-x64': 1.1.5 + '@rolldown/binding-freebsd-x64': 1.1.5 + '@rolldown/binding-linux-arm-gnueabihf': 1.1.5 + '@rolldown/binding-linux-arm64-gnu': 1.1.5 + '@rolldown/binding-linux-arm64-musl': 1.1.5 + '@rolldown/binding-linux-ppc64-gnu': 1.1.5 + '@rolldown/binding-linux-s390x-gnu': 1.1.5 + '@rolldown/binding-linux-x64-gnu': 1.1.5 + '@rolldown/binding-linux-x64-musl': 1.1.5 + '@rolldown/binding-openharmony-arm64': 1.1.5 + '@rolldown/binding-wasm32-wasi': 1.1.5 + '@rolldown/binding-win32-arm64-msvc': 1.1.5 + '@rolldown/binding-win32-x64-msvc': 1.1.5 + + rollup-plugin-node-externals@6.1.2(rollup@4.59.0): + dependencies: + rollup: 4.59.0 + + rollup@4.59.0: + dependencies: + '@types/estree': 1.0.8 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.59.0 + '@rollup/rollup-android-arm64': 4.59.0 + '@rollup/rollup-darwin-arm64': 4.59.0 + '@rollup/rollup-darwin-x64': 4.59.0 + '@rollup/rollup-freebsd-arm64': 4.59.0 + '@rollup/rollup-freebsd-x64': 4.59.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.59.0 + '@rollup/rollup-linux-arm-musleabihf': 4.59.0 + '@rollup/rollup-linux-arm64-gnu': 4.59.0 + '@rollup/rollup-linux-arm64-musl': 4.59.0 + '@rollup/rollup-linux-loong64-gnu': 4.59.0 + '@rollup/rollup-linux-loong64-musl': 4.59.0 + '@rollup/rollup-linux-ppc64-gnu': 4.59.0 + '@rollup/rollup-linux-ppc64-musl': 4.59.0 + '@rollup/rollup-linux-riscv64-gnu': 4.59.0 + '@rollup/rollup-linux-riscv64-musl': 4.59.0 + '@rollup/rollup-linux-s390x-gnu': 4.59.0 + '@rollup/rollup-linux-x64-gnu': 4.59.0 + '@rollup/rollup-linux-x64-musl': 4.59.0 + '@rollup/rollup-openbsd-x64': 4.59.0 + '@rollup/rollup-openharmony-arm64': 4.59.0 + '@rollup/rollup-win32-arm64-msvc': 4.59.0 + '@rollup/rollup-win32-ia32-msvc': 4.59.0 + '@rollup/rollup-win32-x64-gnu': 4.59.0 + '@rollup/rollup-win32-x64-msvc': 4.59.0 + fsevents: 2.3.3 + + rpc-websockets@9.3.9: + dependencies: + '@swc/helpers': 0.5.23 + '@types/uuid': 10.0.0 + '@types/ws': 8.18.1 + buffer: 6.0.3 + eventemitter3: 5.0.4 + uuid: 14.0.1 + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + optionalDependencies: + bufferutil: 4.1.0 + utf-8-validate: 6.0.6 + + rrweb-cssom@0.6.0: {} + + rrweb-cssom@0.8.0: {} + + run-applescript@7.1.0: {} + + run-parallel@1.2.0: + dependencies: + queue-microtask: 1.2.3 + + safe-buffer@5.1.2: {} + + safe-buffer@5.2.1: {} + + safe-regex-test@1.1.0: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-regex: 1.2.1 + + safer-buffer@2.1.2: {} + + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + + schema-utils@4.3.3: + dependencies: + '@types/json-schema': 7.0.15 + ajv: 8.20.0 + ajv-formats: 2.1.1(ajv@8.20.0) + ajv-keywords: 5.1.0(ajv@8.20.0) + + select-hose@2.0.0: {} + + selfsigned@2.4.1: + dependencies: + '@types/node-forge': 1.3.14 + node-forge: 1.4.0 + + semver@6.3.1: {} + + semver@7.8.5: {} + + send@0.19.2: + dependencies: + debug: 2.6.9 + depd: 2.0.0 + destroy: 1.2.0 + encodeurl: 2.0.0 + escape-html: 1.0.3 + etag: 1.8.1 + fresh: 0.5.2 + http-errors: 2.0.1 + mime: 1.6.0 + ms: 2.1.3 + on-finished: 2.4.1 + range-parser: 1.2.1 + statuses: 2.0.2 + transitivePeerDependencies: + - supports-color + + serialize-javascript@7.0.7: {} + + serve-handler@6.1.6: + dependencies: + bytes: 3.0.0 + content-disposition: 0.5.2 + mime-types: 2.1.18 + minimatch: 3.1.5 + path-is-inside: 1.0.2 + path-to-regexp: 3.3.0 + range-parser: 1.2.0 + + serve-index@1.9.2: + dependencies: + accepts: 1.3.8 + batch: 0.6.1 + debug: 2.6.9 + escape-html: 1.0.3 + http-errors: 1.8.1 + mime-types: 2.1.35 + parseurl: 1.3.3 + transitivePeerDependencies: + - supports-color + + serve-static@1.16.3: + dependencies: + encodeurl: 2.0.0 + escape-html: 1.0.3 + parseurl: 1.3.3 + send: 0.19.2 + transitivePeerDependencies: + - supports-color + + serve@14.2.5: + dependencies: + '@zeit/schemas': 2.36.0 + ajv: 8.12.0 + arg: 5.0.2 + boxen: 7.0.0 + chalk: 5.0.1 + chalk-template: 0.4.0 + clipboardy: 3.0.0 + compression: 1.8.1 + is-port-reachable: 4.0.0 + serve-handler: 6.1.6 + update-check: 1.5.4 + transitivePeerDependencies: + - supports-color + + set-function-length@1.2.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + function-bind: 1.1.2 + get-intrinsic: 1.3.0 + gopd: 1.2.0 + has-property-descriptors: 1.0.2 + + set-function-name@2.0.2: + dependencies: + define-data-property: 1.1.4 + es-errors: 1.3.0 + functions-have-names: 1.2.3 + has-property-descriptors: 1.0.2 + + setprototypeof@1.2.0: {} + + sha.js@2.4.12: + dependencies: + inherits: 2.0.4 + safe-buffer: 5.2.1 + to-buffer: 1.2.2 + + sha256-uint8array@0.10.7: {} + + shallow-clone@3.0.1: + dependencies: + kind-of: 6.0.3 + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + + shell-quote@1.9.0: {} + + side-channel-list@1.0.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + + side-channel-map@1.0.1: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + + side-channel-weakmap@1.0.2: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + get-intrinsic: 1.3.0 + object-inspect: 1.13.4 + side-channel-map: 1.0.1 + + side-channel@1.1.1: + dependencies: + es-errors: 1.3.0 + object-inspect: 1.13.4 + side-channel-list: 1.0.1 + side-channel-map: 1.0.1 + side-channel-weakmap: 1.0.2 + + siginfo@2.0.0: {} + + signal-exit@3.0.7: {} + + signal-exit@4.1.0: {} + + sirv@3.0.2: + dependencies: + '@polka/url': 1.0.0-next.29 + mrmime: 2.0.1 + totalist: 3.0.1 + + sisteransi@1.0.5: {} + + slash@3.0.0: {} + + slash@4.0.0: {} + + sockjs@0.3.24: + dependencies: + faye-websocket: 0.11.4 + uuid: 8.3.2 + websocket-driver: 0.7.5 + + source-map-js@1.2.1: {} + + source-map-support@0.5.13: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map-support@0.5.21: + dependencies: + buffer-from: 1.1.2 + source-map: 0.6.1 + + source-map@0.6.1: {} + + source-map@0.7.6: {} + + spdy-transport@3.0.0: + dependencies: + debug: 4.4.3 + detect-node: 2.1.0 + hpack.js: 2.1.6 + obuf: 1.1.2 + readable-stream: 3.6.2 + wbuf: 1.7.3 + transitivePeerDependencies: + - supports-color + + spdy@4.0.2: + dependencies: + debug: 4.4.3 + handle-thing: 2.0.1 + http-deceiver: 1.2.7 + select-hose: 2.0.0 + spdy-transport: 3.0.0 + transitivePeerDependencies: + - supports-color + + sprintf-js@1.0.3: {} + + stack-utils@2.0.6: + dependencies: + escape-string-regexp: 2.0.0 + + stackback@0.0.2: {} + + statuses@1.5.0: {} + + statuses@2.0.2: {} + + std-env@4.2.0: {} + + stop-iteration-iterator@1.1.0: + dependencies: + es-errors: 1.3.0 + internal-slot: 1.1.0 + + stream-browserify@3.0.0: + dependencies: + inherits: 2.0.4 + readable-stream: 3.6.2 + + stream-chain@2.2.5: {} + + stream-json@1.9.1: + dependencies: + stream-chain: 2.2.5 + + string-length@4.0.2: + dependencies: + char-regex: 1.0.2 + strip-ansi: 6.0.1 + + string-width@4.2.3: + dependencies: + emoji-regex: 8.0.0 + is-fullwidth-code-point: 3.0.0 + strip-ansi: 6.0.1 + + string-width@5.1.2: + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.2.0 + + string_decoder@1.1.1: + dependencies: + safe-buffer: 5.1.2 + + string_decoder@1.3.0: + dependencies: + safe-buffer: 5.2.1 + + strip-ansi@6.0.1: + dependencies: + ansi-regex: 5.0.1 + + strip-ansi@7.2.0: + dependencies: + ansi-regex: 6.2.2 + + strip-bom@4.0.0: {} + + strip-final-newline@2.0.0: {} + + strip-indent@3.0.0: + dependencies: + min-indent: 1.0.1 + + strip-json-comments@2.0.1: {} + + strip-json-comments@3.1.1: {} + + style-loader@3.3.3(webpack@5.102.1): + dependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + + superstruct@2.0.2: {} + + supports-color@7.2.0: + dependencies: + has-flag: 4.0.0 + + supports-color@8.1.1: + dependencies: + has-flag: 4.0.0 + + supports-preserve-symlinks-flag@1.0.0: {} + + symbol-tree@3.2.4: {} + + synckit@0.11.13: + dependencies: + '@pkgr/core': 0.3.6 + + tapable@2.3.3: {} + + terser-webpack-plugin@5.6.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack@5.102.1): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + terser: 5.49.0 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + optionalDependencies: + '@swc/core': 1.15.43(@swc/helpers@0.5.23) + postcss: 8.5.16 + + terser-webpack-plugin@5.6.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack@5.102.1): + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + jest-worker: 27.5.1 + schema-utils: 4.3.3 + terser: 5.49.0 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + optionalDependencies: + '@swc/core': 1.15.43(@swc/helpers@0.5.23) + + terser@5.49.0: + dependencies: + '@jridgewell/source-map': 0.3.11 + acorn: 8.17.0 + commander: 2.20.3 + source-map-support: 0.5.21 + + test-exclude@6.0.0: + dependencies: + '@istanbuljs/schema': 0.1.6 + glob: 7.2.3 + minimatch: 3.1.5 + + text-encoding-utf-8@1.0.2: {} + + text-table@0.2.0: {} + + thingies@2.6.0(tslib@2.8.1): + dependencies: + tslib: 2.8.1 + + thunky@1.1.0: {} + + tinybench@2.9.0: {} + + tinyexec@1.2.4: {} + + tinyglobby@0.2.17: + dependencies: + fdir: 6.5.0(picomatch@4.0.5) + picomatch: 4.0.5 + + tinyrainbow@3.1.0: {} + + tldts-core@6.1.86: {} + + tldts@6.1.86: + dependencies: + tldts-core: 6.1.86 + + tmpl@1.0.5: {} + + to-buffer@1.2.2: + dependencies: + isarray: 2.0.5 + safe-buffer: 5.2.1 + typed-array-buffer: 1.0.3 + + to-regex-range@5.0.1: + dependencies: + is-number: 7.0.0 + + toidentifier@1.0.1: {} + + totalist@3.0.1: {} + + tough-cookie@4.1.4: + dependencies: + psl: 1.15.0 + punycode: 2.3.1 + universalify: 0.2.0 + url-parse: 1.5.10 + + tough-cookie@5.1.2: + dependencies: + tldts: 6.1.86 + + tr46@0.0.3: {} + + tr46@4.1.1: + dependencies: + punycode: 2.3.1 + + tr46@5.1.1: + dependencies: + punycode: 2.3.1 + + tree-dump@1.1.0(tslib@2.8.1): + dependencies: + tslib: 2.8.1 + + ts-jest@29.4.11(@babel/core@7.23.0)(@jest/transform@30.4.1)(@jest/types@30.4.1)(babel-jest@29.7.0(@babel/core@7.23.0))(jest-util@30.4.1)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(typescript@5.4.3): + dependencies: + bs-logger: 0.2.6 + fast-json-stable-stringify: 2.1.0 + handlebars: 4.7.9 + jest: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + json5: 2.2.3 + lodash.memoize: 4.1.2 + make-error: 1.3.6 + semver: 7.8.5 + type-fest: 4.41.0 + typescript: 5.4.3 + yargs-parser: 21.1.1 + optionalDependencies: + '@babel/core': 7.23.0 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + babel-jest: 29.7.0(@babel/core@7.23.0) + jest-util: 30.4.1 + + ts-jest@29.4.11(@babel/core@7.23.0)(@jest/transform@30.4.1)(@jest/types@30.4.1)(babel-jest@30.4.1(@babel/core@7.29.7))(jest-util@30.4.1)(jest@30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)))(typescript@5.4.3): + dependencies: + bs-logger: 0.2.6 + fast-json-stable-stringify: 2.1.0 + handlebars: 4.7.9 + jest: 30.4.2(@types/node@26.1.1)(ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3)) + json5: 2.2.3 + lodash.memoize: 4.1.2 + make-error: 1.3.6 + semver: 7.8.5 + type-fest: 4.41.0 + typescript: 5.4.3 + yargs-parser: 21.1.1 + optionalDependencies: + '@babel/core': 7.23.0 + '@jest/transform': 30.4.1 + '@jest/types': 30.4.1 + babel-jest: 30.4.1(@babel/core@7.29.7) + jest-util: 30.4.1 + + ts-loader@9.6.2(typescript@5.4.3)(webpack@5.102.1): + dependencies: + chalk: 4.1.2 + picomatch: 4.0.5 + source-map: 0.7.6 + typescript: 5.4.3 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4) + + ts-node@10.9.2(@swc/core@1.15.43(@swc/helpers@0.5.23))(@types/node@26.1.1)(typescript@5.4.3): + dependencies: + '@cspotcode/source-map-support': 0.8.1 + '@tsconfig/node10': 1.0.12 + '@tsconfig/node12': 1.0.11 + '@tsconfig/node14': 1.0.3 + '@tsconfig/node16': 1.0.4 + '@types/node': 26.1.1 + acorn: 8.17.0 + acorn-walk: 8.3.5 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.4 + make-error: 1.3.6 + typescript: 5.4.3 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + optionalDependencies: + '@swc/core': 1.15.43(@swc/helpers@0.5.23) + + tslib@1.14.1: {} + + tslib@2.8.1: {} + + tsyringe@4.10.0: + dependencies: + tslib: 1.14.1 + + turbo@2.10.4: + optionalDependencies: + '@turbo/darwin-64': 2.10.4 + '@turbo/darwin-arm64': 2.10.4 + '@turbo/linux-64': 2.10.4 + '@turbo/linux-arm64': 2.10.4 + '@turbo/windows-64': 2.10.4 + '@turbo/windows-arm64': 2.10.4 + + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + type-detect@4.0.8: {} + + type-fest@0.20.2: {} + + type-fest@0.21.3: {} + + type-fest@2.19.0: {} + + type-fest@4.41.0: {} + + type-is@1.6.18: + dependencies: + media-typer: 0.3.0 + mime-types: 2.1.35 + + typed-array-buffer@1.0.3: + dependencies: + call-bound: 1.0.4 + es-errors: 1.3.0 + is-typed-array: 1.1.15 + + typescript@5.4.3: {} + + uglify-js@3.19.3: + optional: true + + undici-types@7.28.0: {} + + undici-types@8.3.0: {} + + unicode-canonical-property-names-ecmascript@2.0.1: {} + + unicode-match-property-ecmascript@2.0.0: + dependencies: + unicode-canonical-property-names-ecmascript: 2.0.1 + unicode-property-aliases-ecmascript: 2.2.0 + + unicode-match-property-value-ecmascript@2.2.1: {} + + unicode-property-aliases-ecmascript@2.2.0: {} + + universalify@0.2.0: {} + + unpipe@1.0.0: {} + + unrs-resolver@1.12.2: + dependencies: + napi-postinstall: 0.3.4 + optionalDependencies: + '@unrs/resolver-binding-android-arm-eabi': 1.12.2 + '@unrs/resolver-binding-android-arm64': 1.12.2 + '@unrs/resolver-binding-darwin-arm64': 1.12.2 + '@unrs/resolver-binding-darwin-x64': 1.12.2 + '@unrs/resolver-binding-freebsd-x64': 1.12.2 + '@unrs/resolver-binding-linux-arm-gnueabihf': 1.12.2 + '@unrs/resolver-binding-linux-arm-musleabihf': 1.12.2 + '@unrs/resolver-binding-linux-arm64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-arm64-musl': 1.12.2 + '@unrs/resolver-binding-linux-loong64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-loong64-musl': 1.12.2 + '@unrs/resolver-binding-linux-ppc64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-riscv64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-riscv64-musl': 1.12.2 + '@unrs/resolver-binding-linux-s390x-gnu': 1.12.2 + '@unrs/resolver-binding-linux-x64-gnu': 1.12.2 + '@unrs/resolver-binding-linux-x64-musl': 1.12.2 + '@unrs/resolver-binding-openharmony-arm64': 1.12.2 + '@unrs/resolver-binding-wasm32-wasi': 1.12.2 + '@unrs/resolver-binding-win32-arm64-msvc': 1.12.2 + '@unrs/resolver-binding-win32-ia32-msvc': 1.12.2 + '@unrs/resolver-binding-win32-x64-msvc': 1.12.2 + + update-browserslist-db@1.2.3(browserslist@4.28.5): + dependencies: + browserslist: 4.28.5 + escalade: 3.2.0 + picocolors: 1.1.1 + + update-check@1.5.4: + dependencies: + registry-auth-token: 3.3.2 + registry-url: 3.1.0 + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + url-parse@1.5.10: + dependencies: + querystringify: 2.2.0 + requires-port: 1.0.0 + + utf-8-validate@6.0.6: + dependencies: + node-gyp-build: 4.8.4 + optional: true + + util-deprecate@1.0.2: {} + + util@0.12.5: + dependencies: + inherits: 2.0.4 + is-arguments: 1.2.0 + is-generator-function: 1.1.2 + is-typed-array: 1.1.15 + which-typed-array: 1.1.22 + + utila@0.4.0: {} + + utils-merge@1.0.1: {} + + uuid@14.0.1: {} + + uuid@8.3.2: {} + + v8-compile-cache-lib@3.0.1: {} + + v8-to-istanbul@9.3.0: + dependencies: + '@jridgewell/trace-mapping': 0.3.31 + '@types/istanbul-lib-coverage': 2.0.6 + convert-source-map: 2.0.0 + + vary@1.1.2: {} + + viem@2.45.0(bufferutil@4.1.0)(typescript@5.4.3)(utf-8-validate@6.0.6): + dependencies: + '@noble/curves': 1.9.1 + '@noble/hashes': 1.8.0 + '@scure/bip32': 1.7.0 + '@scure/bip39': 1.6.0 + abitype: 1.2.3(typescript@5.4.3) + isows: 1.0.7(ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6)) + ox: 0.11.3(typescript@5.4.3) + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + optionalDependencies: + typescript: 5.4.3 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + + vite@8.1.4(@types/node@26.1.1)(terser@5.49.0): + dependencies: + lightningcss: 1.32.0 + picomatch: 4.0.5 + postcss: 8.5.16 + rolldown: 1.1.5 + tinyglobby: 0.2.17 + optionalDependencies: + '@types/node': 26.1.1 + fsevents: 2.3.3 + terser: 5.49.0 + + vitest@4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)): + dependencies: + '@vitest/expect': 4.1.10 + '@vitest/mocker': 4.1.10(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + '@vitest/pretty-format': 4.1.10 + '@vitest/runner': 4.1.10 + '@vitest/snapshot': 4.1.10 + '@vitest/spy': 4.1.10 + '@vitest/utils': 4.1.10 + es-module-lexer: 2.3.0 + expect-type: 1.4.0 + magic-string: 0.30.21 + obug: 2.1.3 + pathe: 2.0.3 + picomatch: 4.0.5 + std-env: 4.2.0 + tinybench: 2.9.0 + tinyexec: 1.2.4 + tinyglobby: 0.2.17 + tinyrainbow: 3.1.0 + vite: 8.1.4(@types/node@26.1.1)(terser@5.49.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 26.1.1 + '@vitest/browser-playwright': 4.1.10(bufferutil@4.1.0)(playwright@1.61.1)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10) + jsdom: 22.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + transitivePeerDependencies: + - msw + + vitest@4.1.10(@types/node@26.1.1)(@vitest/browser-playwright@4.1.10)(jsdom@26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6))(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)): + dependencies: + '@vitest/expect': 4.1.10 + '@vitest/mocker': 4.1.10(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0)) + '@vitest/pretty-format': 4.1.10 + '@vitest/runner': 4.1.10 + '@vitest/snapshot': 4.1.10 + '@vitest/spy': 4.1.10 + '@vitest/utils': 4.1.10 + es-module-lexer: 2.3.0 + expect-type: 1.4.0 + magic-string: 0.30.21 + obug: 2.1.3 + pathe: 2.0.3 + picomatch: 4.0.5 + std-env: 4.2.0 + tinybench: 2.9.0 + tinyexec: 1.2.4 + tinyglobby: 0.2.17 + tinyrainbow: 3.1.0 + vite: 8.1.4(@types/node@26.1.1)(terser@5.49.0) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 26.1.1 + '@vitest/browser-playwright': 4.1.10(bufferutil@4.1.0)(playwright@1.61.1)(utf-8-validate@6.0.6)(vite@8.1.4(@types/node@26.1.1)(terser@5.49.0))(vitest@4.1.10) + jsdom: 26.1.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + transitivePeerDependencies: + - msw + optional: true + + w3c-xmlserializer@4.0.0: + dependencies: + xml-name-validator: 4.0.0 + + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + + walker@1.0.8: + dependencies: + makeerror: 1.0.12 + + watchpack@2.5.2: + dependencies: + graceful-fs: 4.2.11 + + wbuf@1.7.3: + dependencies: + minimalistic-assert: 1.0.1 + + webidl-conversions@3.0.1: {} + + webidl-conversions@7.0.0: {} + + webpack-cli@5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1): + dependencies: + '@discoveryjs/json-ext': 0.5.7 + '@webpack-cli/configtest': 2.1.1(webpack-cli@5.1.4)(webpack@5.102.1) + '@webpack-cli/info': 2.0.2(webpack-cli@5.1.4)(webpack@5.102.1) + '@webpack-cli/serve': 2.0.5(webpack-cli@5.1.4)(webpack-dev-server@5.2.2)(webpack@5.102.1) + colorette: 2.0.20 + commander: 10.0.1 + cross-spawn: 7.0.6 + envinfo: 7.21.0 + fastest-levenshtein: 1.0.16 + import-local: 3.2.0 + interpret: 3.1.1 + rechoir: 0.8.0 + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-merge: 5.10.0 + optionalDependencies: + webpack-dev-server: 5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1) + + webpack-dev-middleware@7.4.5(tslib@2.8.1)(webpack@5.102.1): + dependencies: + colorette: 2.0.20 + memfs: 4.64.0(tslib@2.8.1) + mime-types: 3.0.2 + on-finished: 2.4.1 + range-parser: 1.3.0 + schema-utils: 4.3.3 + optionalDependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + transitivePeerDependencies: + - tslib + + webpack-dev-server@5.2.2(bufferutil@4.1.0)(tslib@2.8.1)(utf-8-validate@6.0.6)(webpack-cli@5.1.4)(webpack@5.102.1): + dependencies: + '@types/bonjour': 3.5.13 + '@types/connect-history-api-fallback': 1.5.4 + '@types/express': 4.17.25 + '@types/express-serve-static-core': 4.19.9 + '@types/serve-index': 1.9.4 + '@types/serve-static': 1.15.10 + '@types/sockjs': 0.3.36 + '@types/ws': 8.18.1 + ansi-html-community: 0.0.8 + bonjour-service: 1.4.3 + chokidar: 3.6.0 + colorette: 2.0.20 + compression: 1.8.1 + connect-history-api-fallback: 2.0.0 + express: 4.22.2 + graceful-fs: 4.2.11 + http-proxy-middleware: 2.0.10(@types/express@4.17.25) + ipaddr.js: 2.4.0 + launch-editor: 2.14.1 + open: 10.2.0 + p-retry: 6.2.1 + schema-utils: 4.3.3 + selfsigned: 2.4.1 + serve-index: 1.9.2 + sockjs: 0.3.24 + spdy: 4.0.2 + webpack-dev-middleware: 7.4.5(tslib@2.8.1)(webpack@5.102.1) + ws: 8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6) + optionalDependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + transitivePeerDependencies: + - bufferutil + - debug + - supports-color + - tslib + - utf-8-validate + + webpack-merge@5.10.0: + dependencies: + clone-deep: 4.0.1 + flat: 5.0.2 + wildcard: 2.0.1 + + webpack-sources@3.5.1: {} + + webpack-subresource-integrity@5.2.0-rc.1(html-webpack-plugin@5.5.3(webpack@5.102.1))(webpack@5.102.1): + dependencies: + webpack: 5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4) + optionalDependencies: + html-webpack-plugin: 5.5.3(webpack@5.102.1) + + webpack@5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack-cli@5.1.4): + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.17.0 + acorn-import-phases: 1.0.4(acorn@8.17.0) + browserslist: 4.28.5 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.24.2 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.2 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.3 + terser-webpack-plugin: 5.6.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(postcss@8.5.16)(webpack@5.102.1) + watchpack: 2.5.2 + webpack-sources: 3.5.1 + optionalDependencies: + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + transitivePeerDependencies: + - '@minify-html/node' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - lightningcss + - postcss + - uglify-js + + webpack@5.102.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack-cli@5.1.4): + dependencies: + '@types/eslint-scope': 3.7.7 + '@types/estree': 1.0.9 + '@types/json-schema': 7.0.15 + '@webassemblyjs/ast': 1.14.1 + '@webassemblyjs/wasm-edit': 1.14.1 + '@webassemblyjs/wasm-parser': 1.14.1 + acorn: 8.17.0 + acorn-import-phases: 1.0.4(acorn@8.17.0) + browserslist: 4.28.5 + chrome-trace-event: 1.0.4 + enhanced-resolve: 5.24.2 + es-module-lexer: 1.7.0 + eslint-scope: 5.1.1 + events: 3.3.0 + glob-to-regexp: 0.4.1 + graceful-fs: 4.2.11 + json-parse-even-better-errors: 2.3.1 + loader-runner: 4.3.2 + mime-types: 2.1.35 + neo-async: 2.6.2 + schema-utils: 4.3.3 + tapable: 2.3.3 + terser-webpack-plugin: 5.6.1(@swc/core@1.15.43(@swc/helpers@0.5.23))(webpack@5.102.1) + watchpack: 2.5.2 + webpack-sources: 3.5.1 + optionalDependencies: + webpack-cli: 5.1.4(webpack-dev-server@5.2.2)(webpack@5.102.1) + transitivePeerDependencies: + - '@minify-html/node' + - '@swc/core' + - '@swc/css' + - '@swc/html' + - clean-css + - cssnano + - csso + - esbuild + - html-minifier-terser + - lightningcss + - postcss + - uglify-js + + websocket-driver@0.7.5: + dependencies: + http-parser-js: 0.5.10 + safe-buffer: 5.2.1 + websocket-extensions: 0.1.4 + + websocket-extensions@0.1.4: {} + + whatwg-encoding@2.0.0: + dependencies: + iconv-lite: 0.6.3 + + whatwg-encoding@3.1.1: + dependencies: + iconv-lite: 0.6.3 + + whatwg-mimetype@3.0.0: {} + + whatwg-mimetype@4.0.0: {} + + whatwg-url@12.0.1: + dependencies: + tr46: 4.1.1 + webidl-conversions: 7.0.0 + + whatwg-url@14.2.0: + dependencies: + tr46: 5.1.1 + webidl-conversions: 7.0.0 + + whatwg-url@5.0.0: + dependencies: + tr46: 0.0.3 + webidl-conversions: 3.0.1 + + which-boxed-primitive@1.1.1: + dependencies: + is-bigint: 1.1.0 + is-boolean-object: 1.2.2 + is-number-object: 1.1.1 + is-string: 1.1.1 + is-symbol: 1.1.1 + + which-collection@1.0.2: + dependencies: + is-map: 2.0.3 + is-set: 2.0.3 + is-weakmap: 2.0.2 + is-weakset: 2.0.4 + + which-typed-array@1.1.22: + dependencies: + available-typed-arrays: 1.0.7 + call-bind: 1.0.9 + call-bound: 1.0.4 + for-each: 0.3.5 + get-proto: 1.0.1 + gopd: 1.2.0 + has-tostringtag: 1.0.2 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + + widest-line@4.0.1: + dependencies: + string-width: 5.1.2 + + wildcard@2.0.1: {} + + word-wrap@1.2.5: {} + + wordwrap@1.0.0: {} + + wrap-ansi@7.0.0: + dependencies: + ansi-styles: 4.3.0 + string-width: 4.2.3 + strip-ansi: 6.0.1 + + wrap-ansi@8.1.0: + dependencies: + ansi-styles: 6.2.3 + string-width: 5.1.2 + strip-ansi: 7.2.0 + + wrappy@1.0.2: {} + + write-file-atomic@4.0.2: + dependencies: + imurmurhash: 0.1.4 + signal-exit: 3.0.7 + + write-file-atomic@5.0.1: + dependencies: + imurmurhash: 0.1.4 + signal-exit: 4.1.0 + + ws@8.21.0(bufferutil@4.1.0)(utf-8-validate@6.0.6): + optionalDependencies: + bufferutil: 4.1.0 + utf-8-validate: 6.0.6 + + wsl-utils@0.1.0: + dependencies: + is-wsl: 3.1.1 + + xml-name-validator@4.0.0: {} + + xml-name-validator@5.0.0: {} + + xmlchars@2.2.0: {} + + y18n@5.0.8: {} + + yallist@3.1.1: {} + + yargs-parser@21.1.1: {} + + yargs@17.7.3: + dependencies: + cliui: 8.0.1 + escalade: 3.2.0 + get-caller-file: 2.0.5 + require-directory: 2.1.1 + string-width: 4.2.3 + y18n: 5.0.8 + yargs-parser: 21.1.1 + + yn@3.1.1: {} + + yocto-queue@0.1.0: {} + + yocto-queue@1.2.2: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 00000000..4f4a960c --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,27 @@ +packages: + - auth + - e2e + - export + - export-and-sign + - import + - oauth-origin + - oauth-redirect + - shared +overrides: + "minimatch@<3.1.3": "^3.1.4" + "serialize-javascript@<7.0.2": "^7.0.3" + "ws@<8.21.0": "^8.21.0" +allowBuilds: + '@swc/core': false + bufferutil: false + unrs-resolver: false + utf-8-validate: false +minimumReleaseAgeExclude: + - '@turnkey/api-key-stamper@0.6.8' + - '@turnkey/crypto@2.10.1' + - '@turnkey/http@5.0.0' + - '@turnkey/indexed-db-stamper@1.3.2' + - '@turnkey/sdk-browser@7.0.0' + - '@turnkey/sdk-types@1.2.0' + - '@turnkey/wallet-stamper@1.1.20' + - '@turnkey/sdk-server@7.0.0' diff --git a/rollup.config.base.mjs b/rollup.config.base.mjs new file mode 100644 index 00000000..2345ee15 --- /dev/null +++ b/rollup.config.base.mjs @@ -0,0 +1,45 @@ +import typescript from "@rollup/plugin-typescript"; +import nodeExternals from "rollup-plugin-node-externals"; +import path from "node:path"; + +const getFormatConfig = (format) => { + const pkgPath = path.join(process.cwd(), "package.json"); + + /** @type {import('rollup').RollupOptions} */ + return { + input: "src/index.ts", + output: { + format, + dir: "dist", + entryFileNames: `[name].${format === "esm" ? "mjs" : "js"}`, + preserveModules: true, + preserveModulesRoot: "src", + sourcemap: true, + }, + plugins: [ + typescript({ + tsconfig: "./tsconfig.json", + outputToFilesystem: false, + compilerOptions: { + outDir: "dist", + composite: false, + declaration: format === "esm", + declarationMap: format === "esm", + sourceMap: true, + skipLibCheck: true, + }, + }), + nodeExternals({ + packagePath: pkgPath, + builtinsPrefix: "ignore", + }), + ], + }; +}; + +export default () => { + const esm = getFormatConfig("esm"); + const cjs = getFormatConfig("cjs"); + + return [esm, cjs]; +}; diff --git a/shared/.eslintignore b/shared/.eslintignore index db4c6d9b..50760c29 100644 --- a/shared/.eslintignore +++ b/shared/.eslintignore @@ -1,2 +1,3 @@ dist -node_modules \ No newline at end of file +node_modules +.turbo diff --git a/shared/dist/crypto-utils.d.ts b/shared/dist/crypto-utils.d.ts new file mode 100644 index 00000000..721634ab --- /dev/null +++ b/shared/dist/crypto-utils.d.ts @@ -0,0 +1,21 @@ +/** + * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer) + * and the receivers private key (JSON Web Key). + */ +export function HpkeDecrypt({ ciphertextBuf, encappedKeyBuf, receiverPrivJwk, }: { + ciphertextBuf: any; + encappedKeyBuf: any; + receiverPrivJwk: any; +}): Promise; +/** + * Encrypt plaintext using HPKE with the receiver's public key. + * @param {Object} params + * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt + * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format + * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext + */ +export function HpkeEncrypt({ plaintextBuf, receiverPubJwk }: { + plaintextBuf: Uint8Array; + receiverPubJwk: JsonWebKey; +}): Promise; +//# sourceMappingURL=crypto-utils.d.ts.map \ No newline at end of file diff --git a/shared/dist/crypto-utils.d.ts.map b/shared/dist/crypto-utils.d.ts.map new file mode 100644 index 00000000..422248dd --- /dev/null +++ b/shared/dist/crypto-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-utils.d.ts","sourceRoot":"","sources":["../src/crypto-utils.js"],"names":[],"mappings":"AAoBA;;;GAGG;AACH;;;;yBAoCC;AAED;;;;;;GAMG;AACH;IAJ8B,YAAY,EAA/B,UAAU;IACS,cAAc,EAAjC,UAAU;IACR,QAAQ,MAAM,CAAC,CAyD3B"} \ No newline at end of file diff --git a/shared/dist/crypto-utils.js b/shared/dist/crypto-utils.js new file mode 100644 index 00000000..31899358 --- /dev/null +++ b/shared/dist/crypto-utils.js @@ -0,0 +1,123 @@ +'use strict'; + +var turnkeyCore = require('./turnkey-core.js'); +var core = require('@hpke/core'); + +/** + * Crypto Utilities - Shared + * Contains HPKE encryption and decryption functions + */ + + +// Pre-compute const (for perf) +const TURNKEY_HPKE_INFO = new TextEncoder().encode("turnkey_hpke"); + +/** + * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer) + * and the receivers private key (JSON Web Key). + */ +async function HpkeDecrypt({ + ciphertextBuf, + encappedKeyBuf, + receiverPrivJwk, +}) { + const kemContext = new core.DhkemP256HkdfSha256(); + var receiverPriv = await kemContext.importKey( + "jwk", + { ...receiverPrivJwk }, + false + ); + + var suite = new core.CipherSuite({ + kem: kemContext, + kdf: new core.HkdfSha256(), + aead: new core.Aes256Gcm(), + }); + + var recipientCtx = await suite.createRecipientContext({ + recipientKey: receiverPriv, + enc: encappedKeyBuf, + info: TURNKEY_HPKE_INFO, + }); + + var receiverPubBuf = await turnkeyCore.p256JWKPrivateToPublic(receiverPrivJwk); + var aad = turnkeyCore.additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + var res; + try { + res = await recipientCtx.open(ciphertextBuf, aad); + } catch (e) { + throw new Error( + "unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: " + + e.toString() + ); + } + return res; +} + +/** + * Encrypt plaintext using HPKE with the receiver's public key. + * @param {Object} params + * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt + * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format + * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext + */ +async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) { + const kemContext = new core.DhkemP256HkdfSha256(); + const receiverPub = await kemContext.importKey( + "jwk", + { ...receiverPubJwk }, + true + ); + + const suite = new core.CipherSuite({ + kem: kemContext, + kdf: new core.HkdfSha256(), + aead: new core.Aes256Gcm(), + }); + + const senderCtx = await suite.createSenderContext({ + recipientPublicKey: receiverPub, + info: TURNKEY_HPKE_INFO, + }); + + // Need to import the key again as a JWK to export as a raw key, the format needed to + // create the aad with the newly generated raw encapped key. + const receiverPubCryptoKey = await crypto.subtle.importKey( + "jwk", + receiverPubJwk, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + [] + ); + const receiverPubRaw = await crypto.subtle.exportKey( + "raw", + receiverPubCryptoKey + ); + const receiverPubBuf = new Uint8Array(receiverPubRaw); + + const encappedKeyBuf = new Uint8Array(senderCtx.enc); + + const aad = turnkeyCore.additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + + var ciphertextBuf; + try { + ciphertextBuf = await senderCtx.seal(plaintextBuf, aad); + } catch (e) { + throw new Error("failed to encrypt import bundle: " + e.toString()); + } + + const ciphertextHex = turnkeyCore.uint8arrayToHexString(new Uint8Array(ciphertextBuf)); + const encappedKeyBufHex = turnkeyCore.uint8arrayToHexString(encappedKeyBuf); + const encryptedBundle = JSON.stringify({ + encappedPublic: encappedKeyBufHex, + ciphertext: ciphertextHex, + }); + return encryptedBundle; +} + +exports.HpkeDecrypt = HpkeDecrypt; +exports.HpkeEncrypt = HpkeEncrypt; +//# sourceMappingURL=crypto-utils.js.map diff --git a/shared/dist/crypto-utils.js.map b/shared/dist/crypto-utils.js.map new file mode 100644 index 00000000..d4476b15 --- /dev/null +++ b/shared/dist/crypto-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-utils.js","sources":["../src/crypto-utils.js"],"sourcesContent":["/**\n * Crypto Utilities - Shared\n * Contains HPKE encryption and decryption functions\n */\n\nimport {\n p256JWKPrivateToPublic,\n additionalAssociatedData,\n uint8arrayToHexString,\n} from \"./turnkey-core.js\";\nimport {\n CipherSuite,\n DhkemP256HkdfSha256,\n HkdfSha256,\n Aes256Gcm,\n} from \"@hpke/core\";\n\n// Pre-compute const (for perf)\nconst TURNKEY_HPKE_INFO = new TextEncoder().encode(\"turnkey_hpke\");\n\n/**\n * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer)\n * and the receivers private key (JSON Web Key).\n */\nexport async function HpkeDecrypt({\n ciphertextBuf,\n encappedKeyBuf,\n receiverPrivJwk,\n}) {\n const kemContext = new DhkemP256HkdfSha256();\n var receiverPriv = await kemContext.importKey(\n \"jwk\",\n { ...receiverPrivJwk },\n false\n );\n\n var suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n var recipientCtx = await suite.createRecipientContext({\n recipientKey: receiverPriv,\n enc: encappedKeyBuf,\n info: TURNKEY_HPKE_INFO,\n });\n\n var receiverPubBuf = await p256JWKPrivateToPublic(receiverPrivJwk);\n var aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n var res;\n try {\n res = await recipientCtx.open(ciphertextBuf, aad);\n } catch (e) {\n throw new Error(\n \"unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: \" +\n e.toString()\n );\n }\n return res;\n}\n\n/**\n * Encrypt plaintext using HPKE with the receiver's public key.\n * @param {Object} params\n * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt\n * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format\n * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext\n */\nexport async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: TURNKEY_HPKE_INFO,\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = uint8arrayToHexString(new Uint8Array(ciphertextBuf));\n const encappedKeyBufHex = uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\n"],"names":["DhkemP256HkdfSha256","CipherSuite","HkdfSha256","Aes256Gcm","p256JWKPrivateToPublic","additionalAssociat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AAM,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,GAAG,CAAC;AAC3D,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE;AACd,IAAI,MAAM,IAAI,KAAK,CAAC,mCAAmC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvE,EAAE;;AAEF,EAAE,MAAM,aAAa,GAAGC,iCAAqB,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;AAC5E,EAAE,MAAM,iBAAiB,GAAGA,iCAAqB,CAAC,cAAc,CAAC;AACjE,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC;AACzC,IAAI,cAAc,EAAE,iBAAiB;AACrC,IAAI,UAAU,EAAE,aAAa;AAC7B,GAAG,CAAC;AACJ,EAAE,OAAO,eAAe;AACxB;;;;;"} \ No newline at end of file diff --git a/shared/dist/crypto-utils.mjs b/shared/dist/crypto-utils.mjs new file mode 100644 index 00000000..0678cbda --- /dev/null +++ b/shared/dist/crypto-utils.mjs @@ -0,0 +1,120 @@ +import { p256JWKPrivateToPublic, additionalAssociatedData, uint8arrayToHexString } from './turnkey-core.mjs'; +import { DhkemP256HkdfSha256, CipherSuite, Aes256Gcm, HkdfSha256 } from '@hpke/core'; + +/** + * Crypto Utilities - Shared + * Contains HPKE encryption and decryption functions + */ + + +// Pre-compute const (for perf) +const TURNKEY_HPKE_INFO = new TextEncoder().encode("turnkey_hpke"); + +/** + * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer) + * and the receivers private key (JSON Web Key). + */ +async function HpkeDecrypt({ + ciphertextBuf, + encappedKeyBuf, + receiverPrivJwk, +}) { + const kemContext = new DhkemP256HkdfSha256(); + var receiverPriv = await kemContext.importKey( + "jwk", + { ...receiverPrivJwk }, + false + ); + + var suite = new CipherSuite({ + kem: kemContext, + kdf: new HkdfSha256(), + aead: new Aes256Gcm(), + }); + + var recipientCtx = await suite.createRecipientContext({ + recipientKey: receiverPriv, + enc: encappedKeyBuf, + info: TURNKEY_HPKE_INFO, + }); + + var receiverPubBuf = await p256JWKPrivateToPublic(receiverPrivJwk); + var aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + var res; + try { + res = await recipientCtx.open(ciphertextBuf, aad); + } catch (e) { + throw new Error( + "unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: " + + e.toString() + ); + } + return res; +} + +/** + * Encrypt plaintext using HPKE with the receiver's public key. + * @param {Object} params + * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt + * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format + * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext + */ +async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) { + const kemContext = new DhkemP256HkdfSha256(); + const receiverPub = await kemContext.importKey( + "jwk", + { ...receiverPubJwk }, + true + ); + + const suite = new CipherSuite({ + kem: kemContext, + kdf: new HkdfSha256(), + aead: new Aes256Gcm(), + }); + + const senderCtx = await suite.createSenderContext({ + recipientPublicKey: receiverPub, + info: TURNKEY_HPKE_INFO, + }); + + // Need to import the key again as a JWK to export as a raw key, the format needed to + // create the aad with the newly generated raw encapped key. + const receiverPubCryptoKey = await crypto.subtle.importKey( + "jwk", + receiverPubJwk, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + [] + ); + const receiverPubRaw = await crypto.subtle.exportKey( + "raw", + receiverPubCryptoKey + ); + const receiverPubBuf = new Uint8Array(receiverPubRaw); + + const encappedKeyBuf = new Uint8Array(senderCtx.enc); + + const aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf); + + var ciphertextBuf; + try { + ciphertextBuf = await senderCtx.seal(plaintextBuf, aad); + } catch (e) { + throw new Error("failed to encrypt import bundle: " + e.toString()); + } + + const ciphertextHex = uint8arrayToHexString(new Uint8Array(ciphertextBuf)); + const encappedKeyBufHex = uint8arrayToHexString(encappedKeyBuf); + const encryptedBundle = JSON.stringify({ + encappedPublic: encappedKeyBufHex, + ciphertext: ciphertextHex, + }); + return encryptedBundle; +} + +export { HpkeDecrypt, HpkeEncrypt }; +//# sourceMappingURL=crypto-utils.mjs.map diff --git a/shared/dist/crypto-utils.mjs.map b/shared/dist/crypto-utils.mjs.map new file mode 100644 index 00000000..cb607879 --- /dev/null +++ b/shared/dist/crypto-utils.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-utils.mjs","sources":["../src/crypto-utils.js"],"sourcesContent":["/**\n * Crypto Utilities - Shared\n * Contains HPKE encryption and decryption functions\n */\n\nimport {\n p256JWKPrivateToPublic,\n additionalAssociatedData,\n uint8arrayToHexString,\n} from \"./turnkey-core.js\";\nimport {\n CipherSuite,\n DhkemP256HkdfSha256,\n HkdfSha256,\n Aes256Gcm,\n} from \"@hpke/core\";\n\n// Pre-compute const (for perf)\nconst TURNKEY_HPKE_INFO = new TextEncoder().encode(\"turnkey_hpke\");\n\n/**\n * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer)\n * and the receivers private key (JSON Web Key).\n */\nexport async function HpkeDecrypt({\n ciphertextBuf,\n encappedKeyBuf,\n receiverPrivJwk,\n}) {\n const kemContext = new DhkemP256HkdfSha256();\n var receiverPriv = await kemContext.importKey(\n \"jwk\",\n { ...receiverPrivJwk },\n false\n );\n\n var suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n var recipientCtx = await suite.createRecipientContext({\n recipientKey: receiverPriv,\n enc: encappedKeyBuf,\n info: TURNKEY_HPKE_INFO,\n });\n\n var receiverPubBuf = await p256JWKPrivateToPublic(receiverPrivJwk);\n var aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n var res;\n try {\n res = await recipientCtx.open(ciphertextBuf, aad);\n } catch (e) {\n throw new Error(\n \"unable to decrypt bundle using embedded key. the bundle may be incorrect. failed with error: \" +\n e.toString()\n );\n }\n return res;\n}\n\n/**\n * Encrypt plaintext using HPKE with the receiver's public key.\n * @param {Object} params\n * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt\n * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format\n * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext\n */\nexport async function HpkeEncrypt({ plaintextBuf, receiverPubJwk }) {\n const kemContext = new DhkemP256HkdfSha256();\n const receiverPub = await kemContext.importKey(\n \"jwk\",\n { ...receiverPubJwk },\n true\n );\n\n const suite = new CipherSuite({\n kem: kemContext,\n kdf: new HkdfSha256(),\n aead: new Aes256Gcm(),\n });\n\n const senderCtx = await suite.createSenderContext({\n recipientPublicKey: receiverPub,\n info: TURNKEY_HPKE_INFO,\n });\n\n // Need to import the key again as a JWK to export as a raw key, the format needed to\n // create the aad with the newly generated raw encapped key.\n const receiverPubCryptoKey = await crypto.subtle.importKey(\n \"jwk\",\n receiverPubJwk,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n const receiverPubRaw = await crypto.subtle.exportKey(\n \"raw\",\n receiverPubCryptoKey\n );\n const receiverPubBuf = new Uint8Array(receiverPubRaw);\n\n const encappedKeyBuf = new Uint8Array(senderCtx.enc);\n\n const aad = additionalAssociatedData(encappedKeyBuf, receiverPubBuf);\n\n var ciphertextBuf;\n try {\n ciphertextBuf = await senderCtx.seal(plaintextBuf, aad);\n } catch (e) {\n throw new Error(\"failed to encrypt import bundle: \" + e.toString());\n }\n\n const ciphertextHex = uint8arrayToHexString(new Uint8Array(ciphertextBuf));\n const encappedKeyBufHex = uint8arrayToHexString(encappedKeyBuf);\n const encryptedBundle = JSON.stringify({\n encappedPublic: encappedKeyBufHex,\n ciphertext: ciphertextHex,\n });\n return encryptedBundle;\n}\n"],"names":[],"mappings":";;;AAAA;AACA;AACA;AACA;;;AAcA;AACA,MAAM,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC;;AAElE;AACA;AACA;AACA;AACO,eAAe,WAAW,CAAC;AAClC,EAAE,aAAa;AACf,EAAE,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BAAqB,CAAC,IAAI,UAAU,CAAC,aAAa,CAAC,CAAC;AAC5E,EAAE,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,cAAc,CAAC;AACjE,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC;AACzC,IAAI,cAAc,EAAE,iBAAiB;AACrC,IAAI,UAAU,EAAE,aAAa;AAC7B,GAAG,CAAC;AACJ,EAAE,OAAO,eAAe;AACxB;;;;"} \ No newline at end of file diff --git a/shared/dist/index.d.ts b/shared/dist/index.d.ts new file mode 100644 index 00000000..725fa905 --- /dev/null +++ b/shared/dist/index.d.ts @@ -0,0 +1,3 @@ +export * from "./crypto-utils.js"; +export * from "./turnkey-core.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/shared/dist/index.d.ts.map b/shared/dist/index.d.ts.map new file mode 100644 index 00000000..45c6a2b5 --- /dev/null +++ b/shared/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"} \ No newline at end of file diff --git a/shared/dist/index.js b/shared/dist/index.js new file mode 100644 index 00000000..a70e9fdd --- /dev/null +++ b/shared/dist/index.js @@ -0,0 +1,44 @@ +'use strict'; + +var cryptoUtils = require('./crypto-utils.js'); +var turnkeyCore = require('./turnkey-core.js'); + + + +exports.HpkeDecrypt = cryptoUtils.HpkeDecrypt; +exports.HpkeEncrypt = cryptoUtils.HpkeEncrypt; +exports.additionalAssociatedData = turnkeyCore.additionalAssociatedData; +exports.base58CheckDecode = turnkeyCore.base58CheckDecode; +exports.base58Decode = turnkeyCore.base58Decode; +exports.base58Encode = turnkeyCore.base58Encode; +exports.decodeKey = turnkeyCore.decodeKey; +exports.encodeKey = turnkeyCore.encodeKey; +exports.fromDerSignature = turnkeyCore.fromDerSignature; +exports.generateTargetKey = turnkeyCore.generateTargetKey; +exports.getEmbeddedKey = turnkeyCore.getEmbeddedKey; +exports.getItemWithExpiry = turnkeyCore.getItemWithExpiry; +exports.getSettings = turnkeyCore.getSettings; +exports.getSubtleCrypto = turnkeyCore.getSubtleCrypto; +exports.getTargetEmbeddedKey = turnkeyCore.getTargetEmbeddedKey; +exports.initEmbeddedKey = turnkeyCore.initEmbeddedKey; +exports.loadQuorumKey = turnkeyCore.loadQuorumKey; +exports.loadTargetKey = turnkeyCore.loadTargetKey; +exports.logMessage = turnkeyCore.logMessage; +exports.normalizePadding = turnkeyCore.normalizePadding; +exports.onResetEmbeddedKey = turnkeyCore.onResetEmbeddedKey; +exports.p256JWKPrivateToPublic = turnkeyCore.p256JWKPrivateToPublic; +exports.parsePrivateKey = turnkeyCore.parsePrivateKey; +exports.resetTargetEmbeddedKey = turnkeyCore.resetTargetEmbeddedKey; +exports.sendMessageUp = turnkeyCore.sendMessageUp; +exports.setCryptoProvider = turnkeyCore.setCryptoProvider; +exports.setEmbeddedKey = turnkeyCore.setEmbeddedKey; +exports.setItemWithExpiry = turnkeyCore.setItemWithExpiry; +exports.setParentFrameMessageChannelPort = turnkeyCore.setParentFrameMessageChannelPort; +exports.setSettings = turnkeyCore.setSettings; +exports.setTargetEmbeddedKey = turnkeyCore.setTargetEmbeddedKey; +exports.uint8arrayFromHexString = turnkeyCore.uint8arrayFromHexString; +exports.uint8arrayToHexString = turnkeyCore.uint8arrayToHexString; +exports.unsafeSkipDoubleIframeCheck = turnkeyCore.unsafeSkipDoubleIframeCheck; +exports.validateStyles = turnkeyCore.validateStyles; +exports.verifyEnclaveSignature = turnkeyCore.verifyEnclaveSignature; +//# sourceMappingURL=index.js.map diff --git a/shared/dist/index.js.map b/shared/dist/index.js.map new file mode 100644 index 00000000..3a975f0b --- /dev/null +++ b/shared/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/shared/dist/index.mjs b/shared/dist/index.mjs new file mode 100644 index 00000000..b15bdce6 --- /dev/null +++ b/shared/dist/index.mjs @@ -0,0 +1,3 @@ +export { HpkeDecrypt, HpkeEncrypt } from './crypto-utils.mjs'; +export { additionalAssociatedData, base58CheckDecode, base58Decode, base58Encode, decodeKey, encodeKey, fromDerSignature, generateTargetKey, getEmbeddedKey, getItemWithExpiry, getSettings, getSubtleCrypto, getTargetEmbeddedKey, initEmbeddedKey, loadQuorumKey, loadTargetKey, logMessage, normalizePadding, onResetEmbeddedKey, p256JWKPrivateToPublic, parsePrivateKey, resetTargetEmbeddedKey, sendMessageUp, setCryptoProvider, setEmbeddedKey, setItemWithExpiry, setParentFrameMessageChannelPort, setSettings, setTargetEmbeddedKey, uint8arrayFromHexString, uint8arrayToHexString, unsafeSkipDoubleIframeCheck, validateStyles, verifyEnclaveSignature } from './turnkey-core.mjs'; +//# sourceMappingURL=index.mjs.map diff --git a/shared/dist/index.mjs.map b/shared/dist/index.mjs.map new file mode 100644 index 00000000..36420662 --- /dev/null +++ b/shared/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"} \ No newline at end of file diff --git a/shared/dist/jest.config.d.ts b/shared/dist/jest.config.d.ts new file mode 100644 index 00000000..28b263ed --- /dev/null +++ b/shared/dist/jest.config.d.ts @@ -0,0 +1,17 @@ +declare const _default: { + clearMocks: true; + setupFiles: string[]; + testEnvironment: string; + testEnvironmentOptions: { + url: string; + }; + transform: { + "^.+\\.[tj]sx?$": [string, { + useESM: boolean; + }]; + }; + testPathIgnorePatterns: string[]; + transformIgnorePatterns: string[]; +}; +export default _default; +//# sourceMappingURL=jest.config.d.ts.map \ No newline at end of file diff --git a/shared/dist/jest.config.d.ts.map b/shared/dist/jest.config.d.ts.map new file mode 100644 index 00000000..6b27354a --- /dev/null +++ b/shared/dist/jest.config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jest.config.d.ts","sourceRoot":"","sources":["../jest.config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,wBAYmB"} \ No newline at end of file diff --git a/shared/dist/jest.setup.d.ts b/shared/dist/jest.setup.d.ts new file mode 100644 index 00000000..2d5da0dc --- /dev/null +++ b/shared/dist/jest.setup.d.ts @@ -0,0 +1,2 @@ +import "regenerator-runtime/runtime"; +//# sourceMappingURL=jest.setup.d.ts.map \ No newline at end of file diff --git a/shared/dist/jest.setup.d.ts.map b/shared/dist/jest.setup.d.ts.map new file mode 100644 index 00000000..9cc67880 --- /dev/null +++ b/shared/dist/jest.setup.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"jest.setup.d.ts","sourceRoot":"","sources":["../jest.setup.ts"],"names":[],"mappings":"AAAA,OAAO,6BAA6B,CAAC"} \ No newline at end of file diff --git a/shared/dist/src/crypto-utils.d.ts b/shared/dist/src/crypto-utils.d.ts new file mode 100644 index 00000000..721634ab --- /dev/null +++ b/shared/dist/src/crypto-utils.d.ts @@ -0,0 +1,21 @@ +/** + * Decrypt the ciphertext (ArrayBuffer) given an encapsulation key (ArrayBuffer) + * and the receivers private key (JSON Web Key). + */ +export function HpkeDecrypt({ ciphertextBuf, encappedKeyBuf, receiverPrivJwk, }: { + ciphertextBuf: any; + encappedKeyBuf: any; + receiverPrivJwk: any; +}): Promise; +/** + * Encrypt plaintext using HPKE with the receiver's public key. + * @param {Object} params + * @param {Uint8Array} params.plaintextBuf - Plaintext to encrypt + * @param {JsonWebKey} params.receiverPubJwk - Receiver's public key in JWK format + * @returns {Promise} JSON stringified encrypted bundle with encappedPublic and ciphertext + */ +export function HpkeEncrypt({ plaintextBuf, receiverPubJwk }: { + plaintextBuf: Uint8Array; + receiverPubJwk: JsonWebKey; +}): Promise; +//# sourceMappingURL=crypto-utils.d.ts.map \ No newline at end of file diff --git a/shared/dist/src/crypto-utils.d.ts.map b/shared/dist/src/crypto-utils.d.ts.map new file mode 100644 index 00000000..01383b19 --- /dev/null +++ b/shared/dist/src/crypto-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-utils.d.ts","sourceRoot":"","sources":["../../src/crypto-utils.js"],"names":[],"mappings":"AAoBA;;;GAGG;AACH;;;;yBAoCC;AAED;;;;;;GAMG;AACH;IAJ8B,YAAY,EAA/B,UAAU;IACS,cAAc,EAAjC,UAAU;IACR,QAAQ,MAAM,CAAC,CAyD3B"} \ No newline at end of file diff --git a/shared/dist/src/index.d.ts b/shared/dist/src/index.d.ts new file mode 100644 index 00000000..725fa905 --- /dev/null +++ b/shared/dist/src/index.d.ts @@ -0,0 +1,3 @@ +export * from "./crypto-utils.js"; +export * from "./turnkey-core.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/shared/dist/src/index.d.ts.map b/shared/dist/src/index.d.ts.map new file mode 100644 index 00000000..c050a6d7 --- /dev/null +++ b/shared/dist/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC"} \ No newline at end of file diff --git a/shared/dist/src/turnkey-core.d.ts b/shared/dist/src/turnkey-core.d.ts new file mode 100644 index 00000000..24fc5e91 --- /dev/null +++ b/shared/dist/src/turnkey-core.d.ts @@ -0,0 +1,176 @@ +export function setCryptoProvider(cryptoProvider: any): void; +export function getSubtleCrypto(): any; +export function loadQuorumKey(quorumPublic: any): Promise; +export function loadTargetKey(targetPublic: any): Promise; +/** + * Creates a new public/private key pair and persists it in localStorage + */ +export function initEmbeddedKey(): Promise; +export function unsafeSkipDoubleIframeCheck(): void; +export function generateTargetKey(): Promise; +/** + * Gets the current embedded private key JWK. Returns `null` if not found. + */ +export function getEmbeddedKey(): any; +/** + * Sets the embedded private key JWK with the default expiration time. + * @param {JsonWebKey} targetKey + */ +export function setEmbeddedKey(targetKey: JsonWebKey): void; +/** + * Gets the current target embedded private key JWK. Returns `null` if not found. + */ +export function getTargetEmbeddedKey(): any; +/** + * Sets the target embedded public key JWK. + * @param {JsonWebKey} targetKey + */ +export function setTargetEmbeddedKey(targetKey: JsonWebKey): void; +/** + * Resets the current embedded private key JWK. + */ +export function onResetEmbeddedKey(): void; +/** + * Resets the current target embedded private key JWK. + */ +export function resetTargetEmbeddedKey(): void; +export function setParentFrameMessageChannelPort(port: any): void; +/** + * Gets the current settings. + */ +export function getSettings(): any; +/** + * Sets the settings object. + * @param {Object} settings + */ +export function setSettings(settings: any): void; +/** + * Set an item in localStorage with an expiration time + * @param {string} key + * @param {string} value + * @param {number} ttl expiration time in milliseconds + */ +export function setItemWithExpiry(key: string, value: string, ttl: number): void; +/** + * Get an item from localStorage. Returns `null` and + * removes the item from localStorage if expired or + * expiry time is missing. + * @param {string} key + */ +export function getItemWithExpiry(key: string): any; +/** + * Takes a hex string (e.g. "e4567ab" or "0xe4567ab") and returns an array buffer (Uint8Array) + * @param {string} hexString - Hex string with or without "0x" prefix + * @returns {Uint8Array} + */ +export function uint8arrayFromHexString(hexString: string): any; +/** + * Takes a Uint8Array and returns a hex string + * @param {Uint8Array} buffer + * @return {string} + */ +export function uint8arrayToHexString(buffer: Uint8Array): string; +/** + * Function to normalize padding of byte array with 0's to a target length + */ +export function normalizePadding(byteArray: any, targetLength: any): any; +/** + * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate. + */ +export function additionalAssociatedData(senderPubBuf: any, receiverPubBuf: any): Uint8Array; +/** + * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + * + * @param {string} derSignature - The DER-encoded signature as a hexadecimal string. + * @returns {Uint8Array} - The raw signature as a Uint8Array. + */ +export function fromDerSignature(derSignature: string): any; +/** + * Function to verify enclave signature on import bundle received from the server. + * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string} publicSignature signature bytes encoded as a hexadecimal string + * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes + */ +export function verifyEnclaveSignature(enclaveQuorumPublic: string | null, publicSignature: string, signedData: string): Promise; +/** + * Function to send a message. + * + * If this page is embedded as an iframe we'll send a postMessage + * in one of two ways depending on the version of @turnkey/iframe-stamper: + * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages. + * 2. older versions (} The decoded payload (without checksum). + */ +export function base58CheckDecode(s: string): Promise; +/** + * Returns private key bytes from a private key, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {string} privateKey + * @param {string} [keyFormat] Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" + * @return {Promise} + */ +export function decodeKey(privateKey: string, keyFormat?: string): Promise; +/** + * Returns a private key from private key bytes, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {Uint8Array} privateKeyBytes + * @param {string} [keyFormat] Can be "HEXADECIMAL" or "SOLANA" + * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is "SOLANA" + * @return {string} + */ +export function encodeKey(privateKeyBytes: Uint8Array, keyFormat?: string, publicKeyBytes?: Uint8Array): string; +/** + * Helper to parse a private key into a Solana base58 private key. + * To be used if a wallet account is exported without the `SOLANA` address format. + * + * @param {string | Array} privateKey + * @returns {Uint8Array} + */ +export function parsePrivateKey(privateKey: string | Array): Uint8Array; +/** + * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). + * Any invalid style throws an error. Returns an object of valid styles. + * @param {Object} styles + * @param {HTMLElement} [element] - Optional element parameter (for import frame) + * @return {Object} + */ +export function validateStyles(styles: any, element?: HTMLElement): any; +//# sourceMappingURL=turnkey-core.d.ts.map \ No newline at end of file diff --git a/shared/dist/src/turnkey-core.d.ts.map b/shared/dist/src/turnkey-core.d.ts.map new file mode 100644 index 00000000..a7e8a747 --- /dev/null +++ b/shared/dist/src/turnkey-core.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.d.ts","sourceRoot":"","sources":["../../src/turnkey-core.js"],"names":[],"mappings":"AAiDA,6DAEC;AA9BD,uCAsBC;AAiCD,+DAeC;AAKD,+DAiBC;AAED;;GAEG;AACH,iDAUC;AA3DD,oDAEC;AA8DD,kDAeC;AAED;;GAEG;AACH,sCAGC;AAED;;;GAGG;AACH,0CAFW,UAAU,QAQpB;AAED;;GAEG;AACH,4CAGC;AAED;;;GAGG;AACH,gDAFW,UAAU,QAOpB;AAED;;GAEG;AACH,2CAGC;AAED;;GAEG;AACH,+CAEC;AAED,kEAEC;AAED;;GAEG;AACH,mCAGC;AAED;;;GAGG;AACH,iDAEC;AAED;;;;;GAKG;AACH,uCAJW,MAAM,SACN,MAAM,OACN,MAAM,QAShB;AAED;;;;;GAKG;AACH,uCAFW,MAAM,OAqBhB;AAED;;;;GAIG;AACH,mDAHW,MAAM,OAqBhB;AAED;;;;GAIG;AACH,8CAHW,UAAU,GACT,MAAM,CAIjB;AAED;;GAEG;AACH,yEA2BC;AAED;;GAEG;AACH,6FAIC;AAED;;;;;GAKG;AACH,+CAHW,MAAM,OAsChB;AAED;;;;;GAKG;AACH,4DAJW,MAAM,GAAG,IAAI,mBACb,MAAM,cACN,MAAM,gBAoEhB;AAED;;;;;;;;;;;;GAYG;AACH,2EAuBC;AAED;;GAEG;AACH,+CAOC;AAED;;;;GAIG;AACH,oEAoBC;AAED;;;;GAIG;AACH,oCAHW,UAAU,GACT,MAAM,CA8BjB;AAED;;;;;GAKG;AACH,gCAHW,MAAM,GACL,UAAU,CA0CrB;AAED;;;;;;;GAOG;AACH,qCAHW,MAAM,GACL,QAAQ,UAAU,CAAC,CAqC9B;AAED;;;;;;;GAOG;AACH,sCAJW,MAAM,cACN,MAAM,GACL,QAAQ,UAAU,CAAC,CAyG9B;AAED;;;;;;;;GAQG;AACH,2CALW,UAAU,cACV,MAAM,mBACN,UAAU,GACT,MAAM,CAkCjB;AAED;;;;;;GAMG;AACH,4CAHW,MAAM,GAAG,MAAM,MAAM,CAAC,GACpB,UAAU,CA6BtB;AAED;;;;;;GAMG;AACH,sDAHW,WAAW,OAiErB"} \ No newline at end of file diff --git a/shared/dist/src/turnkey-core.test.d.ts b/shared/dist/src/turnkey-core.test.d.ts new file mode 100644 index 00000000..0f91e5aa --- /dev/null +++ b/shared/dist/src/turnkey-core.test.d.ts @@ -0,0 +1,6 @@ +/** + * Tests for shared turnkey-core utilities + * These tests cover functionality that is shared across all frames + */ +import "@testing-library/jest-dom"; +//# sourceMappingURL=turnkey-core.test.d.ts.map \ No newline at end of file diff --git a/shared/dist/src/turnkey-core.test.d.ts.map b/shared/dist/src/turnkey-core.test.d.ts.map new file mode 100644 index 00000000..46259a35 --- /dev/null +++ b/shared/dist/src/turnkey-core.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.test.d.ts","sourceRoot":"","sources":["../../src/turnkey-core.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,2BAA2B,CAAC"} \ No newline at end of file diff --git a/shared/dist/turnkey-core.d.ts b/shared/dist/turnkey-core.d.ts new file mode 100644 index 00000000..723fc8ce --- /dev/null +++ b/shared/dist/turnkey-core.d.ts @@ -0,0 +1,165 @@ +export function setCryptoProvider(cryptoProvider: any): void; +export function getSubtleCrypto(): any; +export function isDoublyIframed(): boolean; +export function loadQuorumKey(quorumPublic: any): Promise; +export function loadTargetKey(targetPublic: any): Promise; +/** + * Creates a new public/private key pair and persists it in localStorage + */ +export function initEmbeddedKey(): Promise; +export function generateTargetKey(): Promise; +/** + * Gets the current embedded private key JWK. Returns `null` if not found. + */ +export function getEmbeddedKey(): any; +/** + * Sets the embedded private key JWK with the default expiration time. + * @param {JsonWebKey} targetKey + */ +export function setEmbeddedKey(targetKey: JsonWebKey): void; +/** + * Gets the current target embedded private key JWK. Returns `null` if not found. + */ +export function getTargetEmbeddedKey(): any; +/** + * Sets the target embedded public key JWK. + * @param {JsonWebKey} targetKey + */ +export function setTargetEmbeddedKey(targetKey: JsonWebKey): void; +/** + * Resets the current embedded private key JWK. + */ +export function onResetEmbeddedKey(): void; +/** + * Resets the current target embedded private key JWK. + */ +export function resetTargetEmbeddedKey(): void; +export function setParentFrameMessageChannelPort(port: any): void; +/** + * Gets the current settings. + */ +export function getSettings(): any; +/** + * Sets the settings object. + * @param {Object} settings + */ +export function setSettings(settings: any): void; +/** + * Set an item in localStorage with an expiration time + * @param {string} key + * @param {string} value + * @param {number} ttl expiration time in milliseconds + */ +export function setItemWithExpiry(key: string, value: string, ttl: number): void; +/** + * Get an item from localStorage. Returns `null` and + * removes the item from localStorage if expired or + * expiry time is missing. + * @param {string} key + */ +export function getItemWithExpiry(key: string): any; +/** + * Takes a hex string (e.g. "e4567ab" or "0xe4567ab") and returns an array buffer (Uint8Array) + * @param {string} hexString - Hex string with or without "0x" prefix + * @returns {Uint8Array} + */ +export function uint8arrayFromHexString(hexString: string): Uint8Array; +/** + * Takes a Uint8Array and returns a hex string + * @param {Uint8Array} buffer + * @return {string} + */ +export function uint8arrayToHexString(buffer: Uint8Array): string; +/** + * Function to normalize padding of byte array with 0's to a target length + */ +export function normalizePadding(byteArray: any, targetLength: any): any; +/** + * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate. + */ +export function additionalAssociatedData(senderPubBuf: any, receiverPubBuf: any): Uint8Array; +/** + * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + */ +export function fromDerSignature(derSignature: any): Uint8Array; +/** + * Function to verify enclave signature on import bundle received from the server. + * @param {string} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string} publicSignature signature bytes encoded as a hexadecimal string + * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes + */ +export function verifyEnclaveSignature(enclaveQuorumPublic: string, publicSignature: string, signedData: string): Promise; +/** + * Function to send a message. + * + * If this page is embedded as an iframe we'll send a postMessage + * in one of two ways depending on the version of @turnkey/iframe-stamper: + * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages. + * 2. older versions (} The decoded payload (without checksum). + */ +export function base58CheckDecode(s: string): Promise; +/** + * Returns private key bytes from a private key, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {string} privateKey + * @param {string} keyFormat Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" + * @return {Promise} + */ +export function decodeKey(privateKey: string, keyFormat: string): Promise; +/** + * Returns a private key from private key bytes, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {Uint8Array} privateKeyBytes + * @param {string} [keyFormat] Can be "HEXADECIMAL" or "SOLANA" + * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is "SOLANA" + */ +export function encodeKey(privateKeyBytes: Uint8Array, keyFormat?: string, publicKeyBytes?: Uint8Array): Promise; +export function parsePrivateKey(privateKey: any): Uint8Array; +/** + * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). + * Any invalid style throws an error. Returns an object of valid styles. + * @param {Object} styles + * @param {HTMLElement} [element] - Optional element parameter (for import frame) + * @return {Object} + */ +export function validateStyles(styles: any, element?: HTMLElement): any; +//# sourceMappingURL=turnkey-core.d.ts.map \ No newline at end of file diff --git a/shared/dist/turnkey-core.d.ts.map b/shared/dist/turnkey-core.d.ts.map new file mode 100644 index 00000000..02b4e721 --- /dev/null +++ b/shared/dist/turnkey-core.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.d.ts","sourceRoot":"","sources":["../src/turnkey-core.js"],"names":[],"mappings":"AAiDA,6DAEC;AA9BD,uCAsBC;AAYD,2CAQC;AAKD,+DAeC;AAKD,+DAiBC;AAED;;GAEG;AACH,iDAUC;AAKD,kDAeC;AAED;;GAEG;AACH,sCAGC;AAED;;;GAGG;AACH,0CAFW,UAAU,QAQpB;AAED;;GAEG;AACH,4CAGC;AAED;;;GAGG;AACH,gDAFW,UAAU,QAOpB;AAED;;GAEG;AACH,2CAGC;AAED;;GAEG;AACH,+CAEC;AAED,kEAEC;AAED;;GAEG;AACH,mCAGC;AAED;;;GAGG;AACH,iDAEC;AAED;;;;;GAKG;AACH,uCAJW,MAAM,SACN,MAAM,OACN,MAAM,QAShB;AAED;;;;;GAKG;AACH,uCAFW,MAAM,OAqBhB;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,UAAU,CAoBtB;AAED;;;;GAIG;AACH,8CAHW,UAAU,GACT,MAAM,CAIjB;AAED;;GAEG;AACH,yEA2BC;AAED;;GAEG;AACH,6FAIC;AAED;;GAEG;AACH,gEAmCC;AAED;;;;;GAKG;AACH,4DAJW,MAAM,mBACN,MAAM,cACN,MAAM,gBA0DhB;AAED;;;;;;;;;;;;GAYG;AACH,2EAuBC;AAED;;GAEG;AACH,+CAOC;AAED;;;;GAIG;AACH,oEAoBC;AAED;;;;GAIG;AACH,oCAHW,UAAU,GACT,MAAM,CA8BjB;AAED;;;;;GAKG;AACH,gCAHW,MAAM,GACL,UAAU,CA0CrB;AAED;;;;;;;GAOG;AACH,qCAHW,MAAM,GACL,QAAQ,UAAU,CAAC,CAqC9B;AAED;;;;;;;GAOG;AACH,sCAJW,MAAM,aACN,MAAM,GACL,QAAQ,UAAU,CAAC,CAyG9B;AAED;;;;;;;GAOG;AACH,2CAJW,UAAU,cACV,MAAM,mBACN,UAAU,mBAkCpB;AAID,6DA2BC;AAED;;;;;;GAMG;AACH,sDAHW,WAAW,OAiErB"} \ No newline at end of file diff --git a/shared/dist/turnkey-core.js b/shared/dist/turnkey-core.js new file mode 100644 index 00000000..e32a29a6 --- /dev/null +++ b/shared/dist/turnkey-core.js @@ -0,0 +1,963 @@ +'use strict'; + +var bech32 = require('bech32'); + +/** + * Turnkey Core Module - Shared + * Contains all the core cryptographic and utility functions shared across frames + */ + +/** constants for LocalStorage */ +const TURNKEY_EMBEDDED_KEY = "TURNKEY_EMBEDDED_KEY"; +const TURNKEY_TARGET_EMBEDDED_KEY = "TURNKEY_TARGET_EMBEDDED_KEY"; +const TURNKEY_SETTINGS = "TURNKEY_SETTINGS"; +/** 48 hours in milliseconds */ +const TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS = 1000 * 60 * 60 * 48; +const TURNKEY_EMBEDDED_KEY_ORIGIN = "TURNKEY_EMBEDDED_KEY_ORIGIN"; + +let parentFrameMessageChannelPort = null; +var cryptoProviderOverride = null; + +/* + * Returns a reference to the WebCrypto subtle interface regardless of the host environment. + */ +function getSubtleCrypto() { + if (cryptoProviderOverride && cryptoProviderOverride.subtle) { + return cryptoProviderOverride.subtle; + } + if ( + typeof globalThis !== "undefined" && + globalThis.crypto && + globalThis.crypto.subtle + ) { + return globalThis.crypto.subtle; + } + if (typeof window !== "undefined" && window.crypto && window.crypto.subtle) { + return window.crypto.subtle; + } + if (typeof global !== "undefined" && global.crypto && global.crypto.subtle) { + return global.crypto.subtle; + } + if (typeof crypto !== "undefined" && crypto.subtle) { + return crypto.subtle; + } + + return null; +} + +/* + * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime + * environment does not expose one on the global/window objects. + */ +function setCryptoProvider(cryptoProvider) { + cryptoProviderOverride = cryptoProvider || null; +} + +/* Security functions */ + +let unsafeDoubleFrameCheckSkipped = false; + +function isDoublyIframed() { + if (unsafeDoubleFrameCheckSkipped) return false; + + if (window.location.ancestorOrigins !== undefined) { + // Does not exist in IE and firefox. + // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works + return window.location.ancestorOrigins.length > 1; + } else { + return window.parent !== window.top; + } +} + +function unsafeSkipDoubleIframeCheck() { + unsafeDoubleFrameCheckSkipped = true; +} + +/* + * Loads the quorum public key as a CryptoKey. + */ +async function loadQuorumKey(quorumPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.importKey( + "raw", + quorumPublic, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + ["verify"] + ); +} + +/* + * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key. + */ +async function loadTargetKey(targetPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + const targetKey = await subtle.importKey( + "raw", + targetPublic, + { + name: "ECDH", + namedCurve: "P-256", + }, + true, + [] + ); + + return await subtle.exportKey("jwk", targetKey); +} + +/** + * Creates a new public/private key pair and persists it in localStorage + */ +async function initEmbeddedKey() { + if (isDoublyIframed()) { + throw new Error("Doubly iframed"); + } + const retrievedKey = await getEmbeddedKey(); + if (retrievedKey === null) { + const targetKey = await generateTargetKey(); + setEmbeddedKey(targetKey); + } + // Nothing to do, key is correctly initialized! +} + +/* + * Generate a key to encrypt to and export it as a JSON Web Key. + */ +async function generateTargetKey() { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + const p256key = await subtle.generateKey( + { + name: "ECDH", + namedCurve: "P-256", + }, + true, + ["deriveBits"] + ); + + return await subtle.exportKey("jwk", p256key.privateKey); +} + +/** + * Gets the current embedded private key JWK. Returns `null` if not found. + */ +function getEmbeddedKey() { + const jwtKey = getItemWithExpiry(TURNKEY_EMBEDDED_KEY); + return jwtKey ? JSON.parse(jwtKey) : null; +} + +/** + * Sets the embedded private key JWK with the default expiration time. + * @param {JsonWebKey} targetKey + */ +function setEmbeddedKey(targetKey) { + setItemWithExpiry( + TURNKEY_EMBEDDED_KEY, + JSON.stringify(targetKey), + TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS + ); +} + +/** + * Gets the current target embedded private key JWK. Returns `null` if not found. + */ +function getTargetEmbeddedKey() { + const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY); + return jwtKey ? JSON.parse(jwtKey) : null; +} + +/** + * Sets the target embedded public key JWK. + * @param {JsonWebKey} targetKey + */ +function setTargetEmbeddedKey(targetKey) { + window.localStorage.setItem( + TURNKEY_TARGET_EMBEDDED_KEY, + JSON.stringify(targetKey) + ); +} + +/** + * Resets the current embedded private key JWK. + */ +function onResetEmbeddedKey() { + window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY); + window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY_ORIGIN); +} + +/** + * Resets the current target embedded private key JWK. + */ +function resetTargetEmbeddedKey() { + window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY); +} + +function setParentFrameMessageChannelPort(port) { + parentFrameMessageChannelPort = port; +} + +/** + * Gets the current settings. + */ +function getSettings() { + const settings = window.localStorage.getItem(TURNKEY_SETTINGS); + return settings ? JSON.parse(settings) : null; +} + +/** + * Sets the settings object. + * @param {Object} settings + */ +function setSettings(settings) { + window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings)); +} + +/** + * Set an item in localStorage with an expiration time + * @param {string} key + * @param {string} value + * @param {number} ttl expiration time in milliseconds + */ +function setItemWithExpiry(key, value, ttl) { + const now = new Date(); + const item = { + value: value, + expiry: now.getTime() + ttl, + }; + window.localStorage.setItem(key, JSON.stringify(item)); +} + +/** + * Get an item from localStorage. Returns `null` and + * removes the item from localStorage if expired or + * expiry time is missing. + * @param {string} key + */ +function getItemWithExpiry(key) { + const itemStr = window.localStorage.getItem(key); + if (!itemStr) { + return null; + } + const item = JSON.parse(itemStr); + if ( + !Object.prototype.hasOwnProperty.call(item, "expiry") || + !Object.prototype.hasOwnProperty.call(item, "value") + ) { + window.localStorage.removeItem(key); + return null; + } + const now = new Date(); + if (now.getTime() > item.expiry) { + window.localStorage.removeItem(key); + return null; + } + return item.value; +} + +/** + * Takes a hex string (e.g. "e4567ab" or "0xe4567ab") and returns an array buffer (Uint8Array) + * @param {string} hexString - Hex string with or without "0x" prefix + * @returns {Uint8Array} + */ +function uint8arrayFromHexString(hexString) { + if (!hexString || typeof hexString !== "string") { + throw new Error("cannot create uint8array from invalid hex string"); + } + + // Remove 0x prefix if present + const hexWithoutPrefix = + hexString.startsWith("0x") || hexString.startsWith("0X") + ? hexString.slice(2) + : hexString; + + var hexRegex = /^[0-9A-Fa-f]+$/; + if (hexWithoutPrefix.length % 2 != 0 || !hexRegex.test(hexWithoutPrefix)) { + throw new Error("cannot create uint8array from invalid hex string"); + } + return new Uint8Array( + hexWithoutPrefix.match(/../g).map((h) => parseInt(h, 16)) + ); +} + +/** + * Takes a Uint8Array and returns a hex string + * @param {Uint8Array} buffer + * @return {string} + */ +function uint8arrayToHexString(buffer) { + return [...buffer].map((x) => x.toString(16).padStart(2, "0")).join(""); +} + +/** + * Function to normalize padding of byte array with 0's to a target length + */ +function normalizePadding(byteArray, targetLength) { + const paddingLength = targetLength - byteArray.length; + + // Add leading 0's to array + if (paddingLength > 0) { + const padding = new Uint8Array(paddingLength).fill(0); + return new Uint8Array([...padding, ...byteArray]); + } + + // Remove leading 0's from array + if (paddingLength < 0) { + const expectedZeroCount = paddingLength * -1; + let zeroCount = 0; + for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) { + if (byteArray[i] === 0) { + zeroCount++; + } + } + // Check if the number of zeros found equals the number of zeroes expected + if (zeroCount !== expectedZeroCount) { + throw new Error( + `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.` + ); + } + return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength); + } + return byteArray; +} + +/** + * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate. + */ +function additionalAssociatedData(senderPubBuf, receiverPubBuf) { + const s = Array.from(new Uint8Array(senderPubBuf)); + const r = Array.from(new Uint8Array(receiverPubBuf)); + return new Uint8Array([...s, ...r]); +} + +/** + * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + * + * @param {string} derSignature - The DER-encoded signature as a hexadecimal string. + * @returns {Uint8Array} - The raw signature as a Uint8Array. + */ +function fromDerSignature(derSignature) { + const derSignatureBuf = uint8arrayFromHexString(derSignature); + + // Check and skip the sequence tag (0x30) + let index = 2; + + // Parse 'r' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for r" + ); + } + index++; // Move past the INTEGER tag + const rLength = derSignatureBuf[index]; + index++; // Move past the length byte + const r = derSignatureBuf.slice(index, index + rLength); + index += rLength; // Move to the start of s + + // Parse 's' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for s" + ); + } + index++; // Move past the INTEGER tag + const sLength = derSignatureBuf[index]; + index++; // Move past the length byte + const s = derSignatureBuf.slice(index, index + sLength); + + // Normalize 'r' and 's' to 32 bytes each + const rPadded = normalizePadding(r, 32); + const sPadded = normalizePadding(s, 32); + + // Concatenate and return the raw signature + return new Uint8Array([...rPadded, ...sPadded]); +} + +/** + * Function to verify enclave signature on import bundle received from the server. + * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string} publicSignature signature bytes encoded as a hexadecimal string + * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes + */ +async function verifyEnclaveSignature( + enclaveQuorumPublic, + publicSignature, + signedData +) { + /** Turnkey Signer enclave's public keys */ + const TURNKEY_SIGNERS_ENCLAVES = { + prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", + preprod: + "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", + dev: "048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d", + }; + + // The TURNKEY_SIGNER_ENVIRONMENT must be defined either: + // + // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE) + // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT) + // - By setting either of these in test environment + const TURNKEY_SIGNER_ENVIRONMENT = + window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE || + window.TURNKEY_SIGNER_ENVIRONMENT; + if (TURNKEY_SIGNER_ENVIRONMENT === undefined) { + throw new Error( + `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined` + ); + } + + const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = + TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT]; + + if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { + throw new Error( + `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined` + ); + } + + // todo(olivia): throw error if enclave quorum public is null once server changes are deployed + if (enclaveQuorumPublic) { + if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { + throw new Error( + `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` + ); + } + } + + const encryptionQuorumPublicBuf = new Uint8Array( + uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) + ); + const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); + if (!quorumKey) { + throw new Error("failed to load quorum key"); + } + + // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format + const publicSignatureBuf = fromDerSignature(publicSignature); + const signedDataBuf = uint8arrayFromHexString(signedData); + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.verify( + { name: "ECDSA", hash: "SHA-256" }, + quorumKey, + publicSignatureBuf, + signedDataBuf + ); +} + +/** + * Function to send a message. + * + * If this page is embedded as an iframe we'll send a postMessage + * in one of two ways depending on the version of @turnkey/iframe-stamper: + * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages. + * 2. older versions ( 0) { + digits.push(carry % 58); + carry = (carry / 58) | 0; + } + } + // Convert digits to a base58 string + for (let k = 0; k < digits.length; k++) { + result = alphabet[digits[k]] + result; + } + + // Add '1' for each leading 0 byte + for (let i = 0; bytes[i] === 0 && i < bytes.length - 1; i++) { + result = "1" + result; + } + return result; +} + +/** + * Decodes a base58-encoded string into a buffer + * This function throws an error when the string contains invalid characters. + * @param {string} s The base58-encoded string. + * @return {Uint8Array} The decoded buffer. + */ +function base58Decode(s) { + // See https://en.bitcoin.it/wiki/Base58Check_encoding + var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + var decodedBytes = []; + var leadingZeros = []; + for (var i = 0; i < s.length; i++) { + if (alphabet.indexOf(s[i]) === -1) { + throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`); + } + var carry = alphabet.indexOf(s[i]); + + // If the current base58 digit is 0, append a 0 byte. + // "i == leadingZeros.length" can only be true if we have not seen non-zero bytes so far. + // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length` + if (carry == 0 && i === leadingZeros.length) { + leadingZeros.push(0); + } + + var j = 0; + while (j < decodedBytes.length || carry > 0) { + var currentByte = decodedBytes[j]; + + // shift the current byte 58 units and add the carry amount + // (or just add the carry amount if this is a new byte -- undefined case) + if (currentByte === undefined) { + currentByte = carry; + } else { + currentByte = currentByte * 58 + carry; + } + + // find the new carry amount (1-byte shift of current byte value) + carry = currentByte >> 8; + // reset the current byte to the remainder (the carry amount will pass on the overflow) + decodedBytes[j] = currentByte % 256; + j++; + } + } + + var result = leadingZeros.concat(decodedBytes.reverse()); + return new Uint8Array(result); +} + +/** + * Decodes a base58check-encoded string and verifies the checksum. + * Base58Check encoding includes a 4-byte checksum at the end to detect errors. + * The checksum is the first 4 bytes of SHA256(SHA256(payload)). + * This function throws an error if the checksum is invalid. + * @param {string} s The base58check-encoded string. + * @return {Promise} The decoded payload (without checksum). + */ +async function base58CheckDecode(s) { + const decoded = base58Decode(s); + + if (decoded.length < 5) { + throw new Error( + `invalid base58check length: expected at least 5 bytes, got ${decoded.length}` + ); + } + + const payload = decoded.subarray(0, decoded.length - 4); + const checksum = decoded.subarray(decoded.length - 4); + + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + + // Compute double SHA256 hash + const hash1Buf = await subtle.digest("SHA-256", payload); + const hash1 = new Uint8Array(hash1Buf); + const hash2Buf = await subtle.digest("SHA-256", hash1); + const hash2 = new Uint8Array(hash2Buf); + const computedChecksum = hash2.subarray(0, 4); + + // Verify checksum + const mismatch = + (checksum[0] ^ computedChecksum[0]) | + (checksum[1] ^ computedChecksum[1]) | + (checksum[2] ^ computedChecksum[2]) | + (checksum[3] ^ computedChecksum[3]); + if (mismatch !== 0) { + throw new Error("invalid base58check checksum"); + } + + return payload; +} + +/** + * Returns private key bytes from a private key, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {string} privateKey + * @param {string} [keyFormat] Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" + * @return {Promise} + */ +async function decodeKey(privateKey, keyFormat) { + switch (keyFormat) { + case "SOLANA": { + const decodedKeyBytes = base58Decode(privateKey); + if (decodedKeyBytes.length !== 64) { + throw new Error( + `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.` + ); + } + return decodedKeyBytes.subarray(0, 32); + } + case "HEXADECIMAL": + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + case "BITCOIN_MAINNET_WIF": { + const payload = await base58CheckDecode(privateKey); + + const version = payload[0]; + const keyAndFlags = payload.subarray(1); + + // 0x80 = mainnet + if (version !== 0x80) { + throw new Error( + `invalid WIF version byte: ${version}. Expected 0x80 (mainnet).` + ); + } + + // Check for common mistake: uncompressed keys + if (keyAndFlags.length === 32) { + throw new Error("uncompressed WIF keys not supported"); + } + + // Validate compressed format + if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) { + throw new Error("invalid WIF format: expected compressed private key"); + } + + return keyAndFlags.subarray(0, 32); + } + case "BITCOIN_TESTNET_WIF": { + const payload = await base58CheckDecode(privateKey); + + const version = payload[0]; + const keyAndFlags = payload.subarray(1); + + // 0xEF = testnet + if (version !== 0xef) { + throw new Error( + `invalid WIF version byte: ${version}. Expected 0xEF (testnet).` + ); + } + + // Check for common mistake: uncompressed keys + if (keyAndFlags.length === 32) { + throw new Error("uncompressed WIF keys not supported"); + } + + // Validate compressed format + if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) { + throw new Error("invalid WIF format: expected compressed private key"); + } + + return keyAndFlags.subarray(0, 32); + } + case "SUI_BECH32": { + const { prefix, words } = bech32.bech32.decode(privateKey); + + if (prefix !== "suiprivkey") { + throw new Error( + `invalid SUI private key human-readable part (HRP): expected "suiprivkey"` + ); + } + + const bytes = bech32.bech32.fromWords(words); + if (bytes.length !== 33) { + throw new Error( + `invalid SUI private key length: expected 33 bytes, got ${bytes.length}` + ); + } + + const schemeFlag = bytes[0]; + const privkey = bytes.slice(1); + + // schemeFlag = 0 is Ed25519; We currently only support Ed25519 keys for SUI. + if (schemeFlag !== 0) { + throw new Error( + `invalid SUI private key scheme flag: expected 0 (Ed25519). Turnkey only supports Ed25519 keys for SUI.` + ); + } + + return new Uint8Array(privkey); + } + default: + console.warn( + `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.` + ); + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + } +} + +/** + * Returns a private key from private key bytes, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {Uint8Array} privateKeyBytes + * @param {string} [keyFormat] Can be "HEXADECIMAL" or "SOLANA" + * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is "SOLANA" + * @return {string} + */ +async function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) { + switch (keyFormat) { + case "SOLANA": + if (!publicKeyBytes) { + throw new Error("public key must be specified for SOLANA key format"); + } + if (privateKeyBytes.length !== 32) { + throw new Error( + `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.` + ); + } + if (publicKeyBytes.length !== 32) { + throw new Error( + `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.` + ); + } + { + const concatenatedBytes = new Uint8Array(64); + concatenatedBytes.set(privateKeyBytes, 0); + concatenatedBytes.set(publicKeyBytes, 32); + return base58Encode(concatenatedBytes); + } + case "HEXADECIMAL": + return "0x" + uint8arrayToHexString(privateKeyBytes); + default: + // keeping console.warn for debugging purposes. + // eslint-disable-next-line no-console + console.warn( + `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.` + ); + return "0x" + uint8arrayToHexString(privateKeyBytes); + } +} + +/** + * Helper to parse a private key into a Solana base58 private key. + * To be used if a wallet account is exported without the `SOLANA` address format. + * + * @param {string | Array} privateKey + * @returns {Uint8Array} + */ +function parsePrivateKey(privateKey) { + if (Array.isArray(privateKey)) { + return new Uint8Array(privateKey); + } + + if (typeof privateKey === "string") { + // Remove 0x prefix if present + if (privateKey.startsWith("0x")) { + privateKey = privateKey.slice(2); + } + + // Check if it's hex-formatted correctly (i.e. 64 hex chars) + if (privateKey.length === 64 && /^[0-9a-fA-F]+$/.test(privateKey)) { + return uint8arrayFromHexString(privateKey); + } + + // Otherwise assume it's base58 format (for Solana) + try { + return base58Decode(privateKey); + } catch (error) { + throw new Error( + "Invalid private key format. Use hex (64 chars) or base58 format." + ); + } + } + + throw new Error("Private key must be a string (hex/base58) or number array"); +} + +/** + * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). + * Any invalid style throws an error. Returns an object of valid styles. + * @param {Object} styles + * @param {HTMLElement} [element] - Optional element parameter (for import frame) + * @return {Object} + */ +function validateStyles(styles, element) { + const validStyles = {}; + + const cssValidationRegex = { + padding: "^(\\d+(px|em|%|rem) ?){1,4}$", + margin: "^(\\d+(px|em|%|rem) ?){1,4}$", + borderWidth: "^(\\d+(px|em|rem) ?){1,4}$", + borderStyle: + "^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$", + borderColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + borderRadius: "^(\\d+(px|em|%|rem) ?){1,4}$", + fontSize: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$", + fontWeight: "^(normal|bold|bolder|lighter|\\d{3})$", + fontFamily: '^[^";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection + color: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + labelColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + backgroundColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + width: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + height: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + maxWidth: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + maxHeight: + "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + lineHeight: + "^(\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$", + boxShadow: + "^(none|(\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)) ?(inset)?)$", + textAlign: "^(left|right|center|justify|initial|inherit)$", + overflowWrap: "^(normal|break-word|anywhere)$", + wordWrap: "^(normal|break-word)$", + resize: "^(none|both|horizontal|vertical|block|inline)$", + }; + + Object.entries(styles).forEach(([property, value]) => { + const styleProperty = property.trim(); + if (styleProperty.length === 0) { + throw new Error("css style property cannot be empty"); + } + const styleRegexStr = cssValidationRegex[styleProperty]; + if (!styleRegexStr) { + throw new Error( + `invalid or unsupported css style property: "${styleProperty}"` + ); + } + const styleRegex = new RegExp(styleRegexStr); + const styleValue = value.trim(); + if (styleValue.length == 0) { + throw new Error(`css style for "${styleProperty}" is empty`); + } + const isValidStyle = styleRegex.test(styleValue); + if (!isValidStyle) { + throw new Error( + `invalid css style value for property "${styleProperty}"` + ); + } + validStyles[styleProperty] = styleValue; + }); + + return validStyles; +} + +exports.additionalAssociatedData = additionalAssociatedData; +exports.base58CheckDecode = base58CheckDecode; +exports.base58Decode = base58Decode; +exports.base58Encode = base58Encode; +exports.decodeKey = decodeKey; +exports.encodeKey = encodeKey; +exports.fromDerSignature = fromDerSignature; +exports.generateTargetKey = generateTargetKey; +exports.getEmbeddedKey = getEmbeddedKey; +exports.getItemWithExpiry = getItemWithExpiry; +exports.getSettings = getSettings; +exports.getSubtleCrypto = getSubtleCrypto; +exports.getTargetEmbeddedKey = getTargetEmbeddedKey; +exports.initEmbeddedKey = initEmbeddedKey; +exports.loadQuorumKey = loadQuorumKey; +exports.loadTargetKey = loadTargetKey; +exports.logMessage = logMessage; +exports.normalizePadding = normalizePadding; +exports.onResetEmbeddedKey = onResetEmbeddedKey; +exports.p256JWKPrivateToPublic = p256JWKPrivateToPublic; +exports.parsePrivateKey = parsePrivateKey; +exports.resetTargetEmbeddedKey = resetTargetEmbeddedKey; +exports.sendMessageUp = sendMessageUp; +exports.setCryptoProvider = setCryptoProvider; +exports.setEmbeddedKey = setEmbeddedKey; +exports.setItemWithExpiry = setItemWithExpiry; +exports.setParentFrameMessageChannelPort = setParentFrameMessageChannelPort; +exports.setSettings = setSettings; +exports.setTargetEmbeddedKey = setTargetEmbeddedKey; +exports.uint8arrayFromHexString = uint8arrayFromHexString; +exports.uint8arrayToHexString = uint8arrayToHexString; +exports.unsafeSkipDoubleIframeCheck = unsafeSkipDoubleIframeCheck; +exports.validateStyles = validateStyles; +exports.verifyEnclaveSignature = verifyEnclaveSignature; +//# sourceMappingURL=turnkey-core.js.map diff --git a/shared/dist/turnkey-core.js.map b/shared/dist/turnkey-core.js.map new file mode 100644 index 00000000..e8a1b623 --- /dev/null +++ b/shared/dist/turnkey-core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.js","sources":["../src/turnkey-core.js"],"sourcesContent":["import { bech32 } from \"bech32\";\n\n/**\n * Turnkey Core Module - Shared\n * Contains all the core cryptographic and utility functions shared across frames\n */\n\n/** constants for LocalStorage */\nconst TURNKEY_EMBEDDED_KEY = \"TURNKEY_EMBEDDED_KEY\";\nconst TURNKEY_TARGET_EMBEDDED_KEY = \"TURNKEY_TARGET_EMBEDDED_KEY\";\nconst TURNKEY_SETTINGS = \"TURNKEY_SETTINGS\";\n/** 48 hours in milliseconds */\nconst TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS = 1000 * 60 * 60 * 48;\nconst TURNKEY_EMBEDDED_KEY_ORIGIN = \"TURNKEY_EMBEDDED_KEY_ORIGIN\";\n\nlet parentFrameMessageChannelPort = null;\nvar cryptoProviderOverride = null;\n\n/*\n * Returns a reference to the WebCrypto subtle interface regardless of the host environment.\n */\nfunction getSubtleCrypto() {\n if (cryptoProviderOverride && cryptoProviderOverride.subtle) {\n return cryptoProviderOverride.subtle;\n }\n if (\n typeof globalThis !== \"undefined\" &&\n globalThis.crypto &&\n globalThis.crypto.subtle\n ) {\n return globalThis.crypto.subtle;\n }\n if (typeof window !== \"undefined\" && window.crypto && window.crypto.subtle) {\n return window.crypto.subtle;\n }\n if (typeof global !== \"undefined\" && global.crypto && global.crypto.subtle) {\n return global.crypto.subtle;\n }\n if (typeof crypto !== \"undefined\" && crypto.subtle) {\n return crypto.subtle;\n }\n\n return null;\n}\n\n/*\n * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime\n * environment does not expose one on the global/window objects.\n */\nfunction setCryptoProvider(cryptoProvider) {\n cryptoProviderOverride = cryptoProvider || null;\n}\n\n/* Security functions */\n\nlet unsafeDoubleFrameCheckSkipped = false;\n\nfunction isDoublyIframed() {\n if (unsafeDoubleFrameCheckSkipped) return false;\n\n if (window.location.ancestorOrigins !== undefined) {\n // Does not exist in IE and firefox.\n // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works\n return window.location.ancestorOrigins.length > 1;\n } else {\n return window.parent !== window.top;\n }\n}\n\nfunction unsafeSkipDoubleIframeCheck() {\n unsafeDoubleFrameCheckSkipped = true;\n}\n\n/*\n * Loads the quorum public key as a CryptoKey.\n */\nasync function loadQuorumKey(quorumPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.importKey(\n \"raw\",\n quorumPublic,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n [\"verify\"]\n );\n}\n\n/*\n * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key.\n */\nasync function loadTargetKey(targetPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const targetKey = await subtle.importKey(\n \"raw\",\n targetPublic,\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n\n return await subtle.exportKey(\"jwk\", targetKey);\n}\n\n/**\n * Creates a new public/private key pair and persists it in localStorage\n */\nasync function initEmbeddedKey() {\n if (isDoublyIframed()) {\n throw new Error(\"Doubly iframed\");\n }\n const retrievedKey = await getEmbeddedKey();\n if (retrievedKey === null) {\n const targetKey = await generateTargetKey();\n setEmbeddedKey(targetKey);\n }\n // Nothing to do, key is correctly initialized!\n}\n\n/*\n * Generate a key to encrypt to and export it as a JSON Web Key.\n */\nasync function generateTargetKey() {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const p256key = await subtle.generateKey(\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n [\"deriveBits\"]\n );\n\n return await subtle.exportKey(\"jwk\", p256key.privateKey);\n}\n\n/**\n * Gets the current embedded private key JWK. Returns `null` if not found.\n */\nfunction getEmbeddedKey() {\n const jwtKey = getItemWithExpiry(TURNKEY_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the embedded private key JWK with the default expiration time.\n * @param {JsonWebKey} targetKey\n */\nfunction setEmbeddedKey(targetKey) {\n setItemWithExpiry(\n TURNKEY_EMBEDDED_KEY,\n JSON.stringify(targetKey),\n TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS\n );\n}\n\n/**\n * Gets the current target embedded private key JWK. Returns `null` if not found.\n */\nfunction getTargetEmbeddedKey() {\n const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the target embedded public key JWK.\n * @param {JsonWebKey} targetKey\n */\nfunction setTargetEmbeddedKey(targetKey) {\n window.localStorage.setItem(\n TURNKEY_TARGET_EMBEDDED_KEY,\n JSON.stringify(targetKey)\n );\n}\n\n/**\n * Resets the current embedded private key JWK.\n */\nfunction onResetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY);\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY_ORIGIN);\n}\n\n/**\n * Resets the current target embedded private key JWK.\n */\nfunction resetTargetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY);\n}\n\nfunction setParentFrameMessageChannelPort(port) {\n parentFrameMessageChannelPort = port;\n}\n\n/**\n * Gets the current settings.\n */\nfunction getSettings() {\n const settings = window.localStorage.getItem(TURNKEY_SETTINGS);\n return settings ? JSON.parse(settings) : null;\n}\n\n/**\n * Sets the settings object.\n * @param {Object} settings\n */\nfunction setSettings(settings) {\n window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings));\n}\n\n/**\n * Set an item in localStorage with an expiration time\n * @param {string} key\n * @param {string} value\n * @param {number} ttl expiration time in milliseconds\n */\nfunction setItemWithExpiry(key, value, ttl) {\n const now = new Date();\n const item = {\n value: value,\n expiry: now.getTime() + ttl,\n };\n window.localStorage.setItem(key, JSON.stringify(item));\n}\n\n/**\n * Get an item from localStorage. Returns `null` and\n * removes the item from localStorage if expired or\n * expiry time is missing.\n * @param {string} key\n */\nfunction getItemWithExpiry(key) {\n const itemStr = window.localStorage.getItem(key);\n if (!itemStr) {\n return null;\n }\n const item = JSON.parse(itemStr);\n if (\n !Object.prototype.hasOwnProperty.call(item, \"expiry\") ||\n !Object.prototype.hasOwnProperty.call(item, \"value\")\n ) {\n window.localStorage.removeItem(key);\n return null;\n }\n const now = new Date();\n if (now.getTime() > item.expiry) {\n window.localStorage.removeItem(key);\n return null;\n }\n return item.value;\n}\n\n/**\n * Takes a hex string (e.g. \"e4567ab\" or \"0xe4567ab\") and returns an array buffer (Uint8Array)\n * @param {string} hexString - Hex string with or without \"0x\" prefix\n * @returns {Uint8Array}\n */\nfunction uint8arrayFromHexString(hexString) {\n if (!hexString || typeof hexString !== \"string\") {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n\n // Remove 0x prefix if present\n const hexWithoutPrefix =\n hexString.startsWith(\"0x\") || hexString.startsWith(\"0X\")\n ? hexString.slice(2)\n : hexString;\n\n var hexRegex = /^[0-9A-Fa-f]+$/;\n if (hexWithoutPrefix.length % 2 != 0 || !hexRegex.test(hexWithoutPrefix)) {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n return new Uint8Array(\n hexWithoutPrefix.match(/../g).map((h) => parseInt(h, 16))\n );\n}\n\n/**\n * Takes a Uint8Array and returns a hex string\n * @param {Uint8Array} buffer\n * @return {string}\n */\nfunction uint8arrayToHexString(buffer) {\n return [...buffer].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Function to normalize padding of byte array with 0's to a target length\n */\nfunction normalizePadding(byteArray, targetLength) {\n const paddingLength = targetLength - byteArray.length;\n\n // Add leading 0's to array\n if (paddingLength > 0) {\n const padding = new Uint8Array(paddingLength).fill(0);\n return new Uint8Array([...padding, ...byteArray]);\n }\n\n // Remove leading 0's from array\n if (paddingLength < 0) {\n const expectedZeroCount = paddingLength * -1;\n let zeroCount = 0;\n for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) {\n if (byteArray[i] === 0) {\n zeroCount++;\n }\n }\n // Check if the number of zeros found equals the number of zeroes expected\n if (zeroCount !== expectedZeroCount) {\n throw new Error(\n `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`\n );\n }\n return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength);\n }\n return byteArray;\n}\n\n/**\n * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate.\n */\nfunction additionalAssociatedData(senderPubBuf, receiverPubBuf) {\n const s = Array.from(new Uint8Array(senderPubBuf));\n const r = Array.from(new Uint8Array(receiverPubBuf));\n return new Uint8Array([...s, ...r]);\n}\n\n/**\n * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses.\n *\n * @param {string} derSignature - The DER-encoded signature as a hexadecimal string.\n * @returns {Uint8Array} - The raw signature as a Uint8Array.\n */\nfunction fromDerSignature(derSignature) {\n const derSignatureBuf = uint8arrayFromHexString(derSignature);\n\n // Check and skip the sequence tag (0x30)\n let index = 2;\n\n // Parse 'r' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for r\"\n );\n }\n index++; // Move past the INTEGER tag\n const rLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const r = derSignatureBuf.slice(index, index + rLength);\n index += rLength; // Move to the start of s\n\n // Parse 's' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for s\"\n );\n }\n index++; // Move past the INTEGER tag\n const sLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const s = derSignatureBuf.slice(index, index + sLength);\n\n // Normalize 'r' and 's' to 32 bytes each\n const rPadded = normalizePadding(r, 32);\n const sPadded = normalizePadding(s, 32);\n\n // Concatenate and return the raw signature\n return new Uint8Array([...rPadded, ...sPadded]);\n}\n\n/**\n * Function to verify enclave signature on import bundle received from the server.\n * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature\n * @param {string} publicSignature signature bytes encoded as a hexadecimal string\n * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes\n */\nasync function verifyEnclaveSignature(\n enclaveQuorumPublic,\n publicSignature,\n signedData\n) {\n /** Turnkey Signer enclave's public keys */\n const TURNKEY_SIGNERS_ENCLAVES = {\n prod: \"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\",\n preprod:\n \"04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212\",\n dev: \"048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d\",\n };\n\n // The TURNKEY_SIGNER_ENVIRONMENT must be defined either:\n //\n // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE)\n // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT)\n // - By setting either of these in test environment\n const TURNKEY_SIGNER_ENVIRONMENT =\n window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE ||\n window.TURNKEY_SIGNER_ENVIRONMENT;\n if (TURNKEY_SIGNER_ENVIRONMENT === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined`\n );\n }\n\n const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY =\n TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT];\n\n if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined`\n );\n }\n\n // todo(olivia): throw error if enclave quorum public is null once server changes are deployed\n if (enclaveQuorumPublic) {\n if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) {\n throw new Error(\n `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.`\n );\n }\n }\n\n const encryptionQuorumPublicBuf = new Uint8Array(\n uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY)\n );\n const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf);\n if (!quorumKey) {\n throw new Error(\"failed to load quorum key\");\n }\n\n // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format\n const publicSignatureBuf = fromDerSignature(publicSignature);\n const signedDataBuf = uint8arrayFromHexString(signedData);\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.verify(\n { name: \"ECDSA\", hash: \"SHA-256\" },\n quorumKey,\n publicSignatureBuf,\n signedDataBuf\n );\n}\n\n/**\n * Function to send a message.\n *\n * If this page is embedded as an iframe we'll send a postMessage\n * in one of two ways depending on the version of @turnkey/iframe-stamper:\n * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages.\n * 2. older versions ( 0) {\n digits.push(carry % 58);\n carry = (carry / 58) | 0;\n }\n }\n // Convert digits to a base58 string\n for (let k = 0; k < digits.length; k++) {\n result = alphabet[digits[k]] + result;\n }\n\n // Add '1' for each leading 0 byte\n for (let i = 0; bytes[i] === 0 && i < bytes.length - 1; i++) {\n result = \"1\" + result;\n }\n return result;\n}\n\n/**\n * Decodes a base58-encoded string into a buffer\n * This function throws an error when the string contains invalid characters.\n * @param {string} s The base58-encoded string.\n * @return {Uint8Array} The decoded buffer.\n */\nfunction base58Decode(s) {\n // See https://en.bitcoin.it/wiki/Base58Check_encoding\n var alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n var decodedBytes = [];\n var leadingZeros = [];\n for (var i = 0; i < s.length; i++) {\n if (alphabet.indexOf(s[i]) === -1) {\n throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`);\n }\n var carry = alphabet.indexOf(s[i]);\n\n // If the current base58 digit is 0, append a 0 byte.\n // \"i == leadingZeros.length\" can only be true if we have not seen non-zero bytes so far.\n // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length`\n if (carry == 0 && i === leadingZeros.length) {\n leadingZeros.push(0);\n }\n\n var j = 0;\n while (j < decodedBytes.length || carry > 0) {\n var currentByte = decodedBytes[j];\n\n // shift the current byte 58 units and add the carry amount\n // (or just add the carry amount if this is a new byte -- undefined case)\n if (currentByte === undefined) {\n currentByte = carry;\n } else {\n currentByte = currentByte * 58 + carry;\n }\n\n // find the new carry amount (1-byte shift of current byte value)\n carry = currentByte >> 8;\n // reset the current byte to the remainder (the carry amount will pass on the overflow)\n decodedBytes[j] = currentByte % 256;\n j++;\n }\n }\n\n var result = leadingZeros.concat(decodedBytes.reverse());\n return new Uint8Array(result);\n}\n\n/**\n * Decodes a base58check-encoded string and verifies the checksum.\n * Base58Check encoding includes a 4-byte checksum at the end to detect errors.\n * The checksum is the first 4 bytes of SHA256(SHA256(payload)).\n * This function throws an error if the checksum is invalid.\n * @param {string} s The base58check-encoded string.\n * @return {Promise} The decoded payload (without checksum).\n */\nasync function base58CheckDecode(s) {\n const decoded = base58Decode(s);\n\n if (decoded.length < 5) {\n throw new Error(\n `invalid base58check length: expected at least 5 bytes, got ${decoded.length}`\n );\n }\n\n const payload = decoded.subarray(0, decoded.length - 4);\n const checksum = decoded.subarray(decoded.length - 4);\n\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n\n // Compute double SHA256 hash\n const hash1Buf = await subtle.digest(\"SHA-256\", payload);\n const hash1 = new Uint8Array(hash1Buf);\n const hash2Buf = await subtle.digest(\"SHA-256\", hash1);\n const hash2 = new Uint8Array(hash2Buf);\n const computedChecksum = hash2.subarray(0, 4);\n\n // Verify checksum\n const mismatch =\n (checksum[0] ^ computedChecksum[0]) |\n (checksum[1] ^ computedChecksum[1]) |\n (checksum[2] ^ computedChecksum[2]) |\n (checksum[3] ^ computedChecksum[3]);\n if (mismatch !== 0) {\n throw new Error(\"invalid base58check checksum\");\n }\n\n return payload;\n}\n\n/**\n * Returns private key bytes from a private key, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {string} privateKey\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\", \"SUI_BECH32\", \"BITCOIN_MAINNET_WIF\", \"BITCOIN_TESTNET_WIF\" or \"SOLANA\"\n * @return {Promise}\n */\nasync function decodeKey(privateKey, keyFormat) {\n switch (keyFormat) {\n case \"SOLANA\": {\n const decodedKeyBytes = base58Decode(privateKey);\n if (decodedKeyBytes.length !== 64) {\n throw new Error(\n `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.`\n );\n }\n return decodedKeyBytes.subarray(0, 32);\n }\n case \"HEXADECIMAL\":\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n case \"BITCOIN_MAINNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0x80 = mainnet\n if (version !== 0x80) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0x80 (mainnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"BITCOIN_TESTNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0xEF = testnet\n if (version !== 0xef) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0xEF (testnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"SUI_BECH32\": {\n const { prefix, words } = bech32.decode(privateKey);\n\n if (prefix !== \"suiprivkey\") {\n throw new Error(\n `invalid SUI private key human-readable part (HRP): expected \"suiprivkey\"`\n );\n }\n\n const bytes = bech32.fromWords(words);\n if (bytes.length !== 33) {\n throw new Error(\n `invalid SUI private key length: expected 33 bytes, got ${bytes.length}`\n );\n }\n\n const schemeFlag = bytes[0];\n const privkey = bytes.slice(1);\n\n // schemeFlag = 0 is Ed25519; We currently only support Ed25519 keys for SUI.\n if (schemeFlag !== 0) {\n throw new Error(\n `invalid SUI private key scheme flag: expected 0 (Ed25519). Turnkey only supports Ed25519 keys for SUI.`\n );\n }\n\n return new Uint8Array(privkey);\n }\n default:\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n }\n}\n\n/**\n * Returns a private key from private key bytes, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {Uint8Array} privateKeyBytes\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\" or \"SOLANA\"\n * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is \"SOLANA\"\n * @return {string}\n */\nasync function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) {\n switch (keyFormat) {\n case \"SOLANA\":\n if (!publicKeyBytes) {\n throw new Error(\"public key must be specified for SOLANA key format\");\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n if (publicKeyBytes.length !== 32) {\n throw new Error(\n `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.`\n );\n }\n {\n const concatenatedBytes = new Uint8Array(64);\n concatenatedBytes.set(privateKeyBytes, 0);\n concatenatedBytes.set(publicKeyBytes, 32);\n return base58Encode(concatenatedBytes);\n }\n case \"HEXADECIMAL\":\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n default:\n // keeping console.warn for debugging purposes.\n // eslint-disable-next-line no-console\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n }\n}\n\n/**\n * Helper to parse a private key into a Solana base58 private key.\n * To be used if a wallet account is exported without the `SOLANA` address format.\n *\n * @param {string | Array} privateKey\n * @returns {Uint8Array}\n */\nfunction parsePrivateKey(privateKey) {\n if (Array.isArray(privateKey)) {\n return new Uint8Array(privateKey);\n }\n\n if (typeof privateKey === \"string\") {\n // Remove 0x prefix if present\n if (privateKey.startsWith(\"0x\")) {\n privateKey = privateKey.slice(2);\n }\n\n // Check if it's hex-formatted correctly (i.e. 64 hex chars)\n if (privateKey.length === 64 && /^[0-9a-fA-F]+$/.test(privateKey)) {\n return uint8arrayFromHexString(privateKey);\n }\n\n // Otherwise assume it's base58 format (for Solana)\n try {\n return base58Decode(privateKey);\n } catch (error) {\n throw new Error(\n \"Invalid private key format. Use hex (64 chars) or base58 format.\"\n );\n }\n }\n\n throw new Error(\"Private key must be a string (hex/base58) or number array\");\n}\n\n/**\n * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions).\n * Any invalid style throws an error. Returns an object of valid styles.\n * @param {Object} styles\n * @param {HTMLElement} [element] - Optional element parameter (for import frame)\n * @return {Object}\n */\nfunction validateStyles(styles, element) {\n const validStyles = {};\n\n const cssValidationRegex = {\n padding: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n margin: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n borderWidth: \"^(\\\\d+(px|em|rem) ?){1,4}$\",\n borderStyle:\n \"^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$\",\n borderColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n borderRadius: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n fontSize: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$\",\n fontWeight: \"^(normal|bold|bolder|lighter|\\\\d{3})$\",\n fontFamily: '^[^\";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection\n color:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n labelColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n backgroundColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n width: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n height: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n maxWidth: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n maxHeight:\n \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n lineHeight:\n \"^(\\\\d+(\\\\.\\\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$\",\n boxShadow:\n \"^(none|(\\\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)) ?(inset)?)$\",\n textAlign: \"^(left|right|center|justify|initial|inherit)$\",\n overflowWrap: \"^(normal|break-word|anywhere)$\",\n wordWrap: \"^(normal|break-word)$\",\n resize: \"^(none|both|horizontal|vertical|block|inline)$\",\n };\n\n Object.entries(styles).forEach(([property, value]) => {\n const styleProperty = property.trim();\n if (styleProperty.length === 0) {\n throw new Error(\"css style property cannot be empty\");\n }\n const styleRegexStr = cssValidationRegex[styleProperty];\n if (!styleRegexStr) {\n throw new Error(\n `invalid or unsupported css style property: \"${styleProperty}\"`\n );\n }\n const styleRegex = new RegExp(styleRegexStr);\n const styleValue = value.trim();\n if (styleValue.length == 0) {\n throw new Error(`css style for \"${styleProperty}\" is empty`);\n }\n const isValidStyle = styleRegex.test(styleValue);\n if (!isValidStyle) {\n throw new Error(\n `invalid css style value for property \"${styleProperty}\"`\n );\n }\n validStyles[styleProperty] = styleValue;\n });\n\n return validStyles;\n}\n\n// Export all shared functions\nexport {\n setCryptoProvider,\n getSubtleCrypto,\n loadQuorumKey,\n loadTargetKey,\n initEmbeddedKey,\n unsafeSkipDoubleIframeCheck,\n generateTargetKey,\n getEmbeddedKey,\n setEmbeddedKey,\n getTargetEmbeddedKey,\n setTargetEmbeddedKey,\n onResetEmbeddedKey,\n resetTargetEmbeddedKey,\n setParentFrameMessageChannelPort,\n getSettings,\n setSettings,\n setItemWithExpiry,\n getItemWithExpiry,\n uint8arrayFromHexString,\n uint8arrayToHexString,\n normalizePadding,\n additionalAssociatedData,\n fromDerSignature,\n verifyEnclaveSignature,\n sendMessageUp,\n logMessage,\n p256JWKPrivateToPublic,\n base58Encode,\n base58Decode,\n base58CheckDecode,\n decodeKey,\n encodeKey,\n parsePrivateKey,\n validateStyles,\n};\n"],"names":["bech32"],"mappings":";;;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAM,oBAAoB,GAAG,sBAAsB;AACnD,MAAM,2BAA2B,GAAG,6BAA6B;AACjE,MAAM,gBAAgB,GAAG,kBAAkB;AAC3C;AACA,MAAM,kCAAkC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AAC9D,MAAM,2BAA2B,GAAG,6BAA6B;;AAEjE,IAAI,6BAA6B,GAAG,IAAI;AACxC,IAAI,sBAAsB,GAAG,IAAI;;AAEjC;AACA;AACA;AACA,SAAS,eAAe,GAAG;AAC3B,EAAE,IAAI,sBAAsB,IAAI,sBAAsB,CAAC,MAAM,EAAE;AAC/D,IAAI,OAAO,sBAAsB,CAAC,MAAM;AACxC,EAAE;AACF,EAAE;AACF,IAAI,OAAO,UAAU,KAAK,WAAW;AACrC,IAAI,UAAU,CAAC,MAAM;AACrB,IAAI,UAAU,CAAC,MAAM,CAAC;AACtB,IAAI;AACJ,IAAI,OAAO,UAAU,CAAC,MAAM,CAAC,MAAM;AACnC,EAAE;AACF,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;AAC9E,IAAI,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM;AAC/B,EAAE;AACF,EAAE,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,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,CAAC;;AAEJ,EAAE,OAAO,WAAW;AACpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/shared/dist/turnkey-core.mjs b/shared/dist/turnkey-core.mjs new file mode 100644 index 00000000..9f27122b --- /dev/null +++ b/shared/dist/turnkey-core.mjs @@ -0,0 +1,928 @@ +import { bech32 } from 'bech32'; + +/** + * Turnkey Core Module - Shared + * Contains all the core cryptographic and utility functions shared across frames + */ + +/** constants for LocalStorage */ +const TURNKEY_EMBEDDED_KEY = "TURNKEY_EMBEDDED_KEY"; +const TURNKEY_TARGET_EMBEDDED_KEY = "TURNKEY_TARGET_EMBEDDED_KEY"; +const TURNKEY_SETTINGS = "TURNKEY_SETTINGS"; +/** 48 hours in milliseconds */ +const TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS = 1000 * 60 * 60 * 48; +const TURNKEY_EMBEDDED_KEY_ORIGIN = "TURNKEY_EMBEDDED_KEY_ORIGIN"; + +let parentFrameMessageChannelPort = null; +var cryptoProviderOverride = null; + +/* + * Returns a reference to the WebCrypto subtle interface regardless of the host environment. + */ +function getSubtleCrypto() { + if (cryptoProviderOverride && cryptoProviderOverride.subtle) { + return cryptoProviderOverride.subtle; + } + if ( + typeof globalThis !== "undefined" && + globalThis.crypto && + globalThis.crypto.subtle + ) { + return globalThis.crypto.subtle; + } + if (typeof window !== "undefined" && window.crypto && window.crypto.subtle) { + return window.crypto.subtle; + } + if (typeof global !== "undefined" && global.crypto && global.crypto.subtle) { + return global.crypto.subtle; + } + if (typeof crypto !== "undefined" && crypto.subtle) { + return crypto.subtle; + } + + return null; +} + +/* + * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime + * environment does not expose one on the global/window objects. + */ +function setCryptoProvider(cryptoProvider) { + cryptoProviderOverride = cryptoProvider || null; +} + +/* Security functions */ + +let unsafeDoubleFrameCheckSkipped = false; + +function isDoublyIframed() { + if (unsafeDoubleFrameCheckSkipped) return false; + + if (window.location.ancestorOrigins !== undefined) { + // Does not exist in IE and firefox. + // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works + return window.location.ancestorOrigins.length > 1; + } else { + return window.parent !== window.top; + } +} + +function unsafeSkipDoubleIframeCheck() { + unsafeDoubleFrameCheckSkipped = true; +} + +/* + * Loads the quorum public key as a CryptoKey. + */ +async function loadQuorumKey(quorumPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.importKey( + "raw", + quorumPublic, + { + name: "ECDSA", + namedCurve: "P-256", + }, + true, + ["verify"] + ); +} + +/* + * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key. + */ +async function loadTargetKey(targetPublic) { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + const targetKey = await subtle.importKey( + "raw", + targetPublic, + { + name: "ECDH", + namedCurve: "P-256", + }, + true, + [] + ); + + return await subtle.exportKey("jwk", targetKey); +} + +/** + * Creates a new public/private key pair and persists it in localStorage + */ +async function initEmbeddedKey() { + if (isDoublyIframed()) { + throw new Error("Doubly iframed"); + } + const retrievedKey = await getEmbeddedKey(); + if (retrievedKey === null) { + const targetKey = await generateTargetKey(); + setEmbeddedKey(targetKey); + } + // Nothing to do, key is correctly initialized! +} + +/* + * Generate a key to encrypt to and export it as a JSON Web Key. + */ +async function generateTargetKey() { + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + const p256key = await subtle.generateKey( + { + name: "ECDH", + namedCurve: "P-256", + }, + true, + ["deriveBits"] + ); + + return await subtle.exportKey("jwk", p256key.privateKey); +} + +/** + * Gets the current embedded private key JWK. Returns `null` if not found. + */ +function getEmbeddedKey() { + const jwtKey = getItemWithExpiry(TURNKEY_EMBEDDED_KEY); + return jwtKey ? JSON.parse(jwtKey) : null; +} + +/** + * Sets the embedded private key JWK with the default expiration time. + * @param {JsonWebKey} targetKey + */ +function setEmbeddedKey(targetKey) { + setItemWithExpiry( + TURNKEY_EMBEDDED_KEY, + JSON.stringify(targetKey), + TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS + ); +} + +/** + * Gets the current target embedded private key JWK. Returns `null` if not found. + */ +function getTargetEmbeddedKey() { + const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY); + return jwtKey ? JSON.parse(jwtKey) : null; +} + +/** + * Sets the target embedded public key JWK. + * @param {JsonWebKey} targetKey + */ +function setTargetEmbeddedKey(targetKey) { + window.localStorage.setItem( + TURNKEY_TARGET_EMBEDDED_KEY, + JSON.stringify(targetKey) + ); +} + +/** + * Resets the current embedded private key JWK. + */ +function onResetEmbeddedKey() { + window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY); + window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY_ORIGIN); +} + +/** + * Resets the current target embedded private key JWK. + */ +function resetTargetEmbeddedKey() { + window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY); +} + +function setParentFrameMessageChannelPort(port) { + parentFrameMessageChannelPort = port; +} + +/** + * Gets the current settings. + */ +function getSettings() { + const settings = window.localStorage.getItem(TURNKEY_SETTINGS); + return settings ? JSON.parse(settings) : null; +} + +/** + * Sets the settings object. + * @param {Object} settings + */ +function setSettings(settings) { + window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings)); +} + +/** + * Set an item in localStorage with an expiration time + * @param {string} key + * @param {string} value + * @param {number} ttl expiration time in milliseconds + */ +function setItemWithExpiry(key, value, ttl) { + const now = new Date(); + const item = { + value: value, + expiry: now.getTime() + ttl, + }; + window.localStorage.setItem(key, JSON.stringify(item)); +} + +/** + * Get an item from localStorage. Returns `null` and + * removes the item from localStorage if expired or + * expiry time is missing. + * @param {string} key + */ +function getItemWithExpiry(key) { + const itemStr = window.localStorage.getItem(key); + if (!itemStr) { + return null; + } + const item = JSON.parse(itemStr); + if ( + !Object.prototype.hasOwnProperty.call(item, "expiry") || + !Object.prototype.hasOwnProperty.call(item, "value") + ) { + window.localStorage.removeItem(key); + return null; + } + const now = new Date(); + if (now.getTime() > item.expiry) { + window.localStorage.removeItem(key); + return null; + } + return item.value; +} + +/** + * Takes a hex string (e.g. "e4567ab" or "0xe4567ab") and returns an array buffer (Uint8Array) + * @param {string} hexString - Hex string with or without "0x" prefix + * @returns {Uint8Array} + */ +function uint8arrayFromHexString(hexString) { + if (!hexString || typeof hexString !== "string") { + throw new Error("cannot create uint8array from invalid hex string"); + } + + // Remove 0x prefix if present + const hexWithoutPrefix = + hexString.startsWith("0x") || hexString.startsWith("0X") + ? hexString.slice(2) + : hexString; + + var hexRegex = /^[0-9A-Fa-f]+$/; + if (hexWithoutPrefix.length % 2 != 0 || !hexRegex.test(hexWithoutPrefix)) { + throw new Error("cannot create uint8array from invalid hex string"); + } + return new Uint8Array( + hexWithoutPrefix.match(/../g).map((h) => parseInt(h, 16)) + ); +} + +/** + * Takes a Uint8Array and returns a hex string + * @param {Uint8Array} buffer + * @return {string} + */ +function uint8arrayToHexString(buffer) { + return [...buffer].map((x) => x.toString(16).padStart(2, "0")).join(""); +} + +/** + * Function to normalize padding of byte array with 0's to a target length + */ +function normalizePadding(byteArray, targetLength) { + const paddingLength = targetLength - byteArray.length; + + // Add leading 0's to array + if (paddingLength > 0) { + const padding = new Uint8Array(paddingLength).fill(0); + return new Uint8Array([...padding, ...byteArray]); + } + + // Remove leading 0's from array + if (paddingLength < 0) { + const expectedZeroCount = paddingLength * -1; + let zeroCount = 0; + for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) { + if (byteArray[i] === 0) { + zeroCount++; + } + } + // Check if the number of zeros found equals the number of zeroes expected + if (zeroCount !== expectedZeroCount) { + throw new Error( + `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.` + ); + } + return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength); + } + return byteArray; +} + +/** + * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate. + */ +function additionalAssociatedData(senderPubBuf, receiverPubBuf) { + const s = Array.from(new Uint8Array(senderPubBuf)); + const r = Array.from(new Uint8Array(receiverPubBuf)); + return new Uint8Array([...s, ...r]); +} + +/** + * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + * + * @param {string} derSignature - The DER-encoded signature as a hexadecimal string. + * @returns {Uint8Array} - The raw signature as a Uint8Array. + */ +function fromDerSignature(derSignature) { + const derSignatureBuf = uint8arrayFromHexString(derSignature); + + // Check and skip the sequence tag (0x30) + let index = 2; + + // Parse 'r' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for r" + ); + } + index++; // Move past the INTEGER tag + const rLength = derSignatureBuf[index]; + index++; // Move past the length byte + const r = derSignatureBuf.slice(index, index + rLength); + index += rLength; // Move to the start of s + + // Parse 's' and check for integer tag (0x02) + if (derSignatureBuf[index] !== 0x02) { + throw new Error( + "failed to convert DER-encoded signature: invalid tag for s" + ); + } + index++; // Move past the INTEGER tag + const sLength = derSignatureBuf[index]; + index++; // Move past the length byte + const s = derSignatureBuf.slice(index, index + sLength); + + // Normalize 'r' and 's' to 32 bytes each + const rPadded = normalizePadding(r, 32); + const sPadded = normalizePadding(s, 32); + + // Concatenate and return the raw signature + return new Uint8Array([...rPadded, ...sPadded]); +} + +/** + * Function to verify enclave signature on import bundle received from the server. + * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string} publicSignature signature bytes encoded as a hexadecimal string + * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes + */ +async function verifyEnclaveSignature( + enclaveQuorumPublic, + publicSignature, + signedData +) { + /** Turnkey Signer enclave's public keys */ + const TURNKEY_SIGNERS_ENCLAVES = { + prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", + preprod: + "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", + dev: "048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d", + }; + + // The TURNKEY_SIGNER_ENVIRONMENT must be defined either: + // + // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE) + // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT) + // - By setting either of these in test environment + const TURNKEY_SIGNER_ENVIRONMENT = + window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE || + window.TURNKEY_SIGNER_ENVIRONMENT; + if (TURNKEY_SIGNER_ENVIRONMENT === undefined) { + throw new Error( + `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined` + ); + } + + const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = + TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT]; + + if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { + throw new Error( + `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined` + ); + } + + // todo(olivia): throw error if enclave quorum public is null once server changes are deployed + if (enclaveQuorumPublic) { + if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { + throw new Error( + `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` + ); + } + } + + const encryptionQuorumPublicBuf = new Uint8Array( + uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) + ); + const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); + if (!quorumKey) { + throw new Error("failed to load quorum key"); + } + + // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format + const publicSignatureBuf = fromDerSignature(publicSignature); + const signedDataBuf = uint8arrayFromHexString(signedData); + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + return await subtle.verify( + { name: "ECDSA", hash: "SHA-256" }, + quorumKey, + publicSignatureBuf, + signedDataBuf + ); +} + +/** + * Function to send a message. + * + * If this page is embedded as an iframe we'll send a postMessage + * in one of two ways depending on the version of @turnkey/iframe-stamper: + * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages. + * 2. older versions ( 0) { + digits.push(carry % 58); + carry = (carry / 58) | 0; + } + } + // Convert digits to a base58 string + for (let k = 0; k < digits.length; k++) { + result = alphabet[digits[k]] + result; + } + + // Add '1' for each leading 0 byte + for (let i = 0; bytes[i] === 0 && i < bytes.length - 1; i++) { + result = "1" + result; + } + return result; +} + +/** + * Decodes a base58-encoded string into a buffer + * This function throws an error when the string contains invalid characters. + * @param {string} s The base58-encoded string. + * @return {Uint8Array} The decoded buffer. + */ +function base58Decode(s) { + // See https://en.bitcoin.it/wiki/Base58Check_encoding + var alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; + var decodedBytes = []; + var leadingZeros = []; + for (var i = 0; i < s.length; i++) { + if (alphabet.indexOf(s[i]) === -1) { + throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`); + } + var carry = alphabet.indexOf(s[i]); + + // If the current base58 digit is 0, append a 0 byte. + // "i == leadingZeros.length" can only be true if we have not seen non-zero bytes so far. + // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length` + if (carry == 0 && i === leadingZeros.length) { + leadingZeros.push(0); + } + + var j = 0; + while (j < decodedBytes.length || carry > 0) { + var currentByte = decodedBytes[j]; + + // shift the current byte 58 units and add the carry amount + // (or just add the carry amount if this is a new byte -- undefined case) + if (currentByte === undefined) { + currentByte = carry; + } else { + currentByte = currentByte * 58 + carry; + } + + // find the new carry amount (1-byte shift of current byte value) + carry = currentByte >> 8; + // reset the current byte to the remainder (the carry amount will pass on the overflow) + decodedBytes[j] = currentByte % 256; + j++; + } + } + + var result = leadingZeros.concat(decodedBytes.reverse()); + return new Uint8Array(result); +} + +/** + * Decodes a base58check-encoded string and verifies the checksum. + * Base58Check encoding includes a 4-byte checksum at the end to detect errors. + * The checksum is the first 4 bytes of SHA256(SHA256(payload)). + * This function throws an error if the checksum is invalid. + * @param {string} s The base58check-encoded string. + * @return {Promise} The decoded payload (without checksum). + */ +async function base58CheckDecode(s) { + const decoded = base58Decode(s); + + if (decoded.length < 5) { + throw new Error( + `invalid base58check length: expected at least 5 bytes, got ${decoded.length}` + ); + } + + const payload = decoded.subarray(0, decoded.length - 4); + const checksum = decoded.subarray(decoded.length - 4); + + const subtle = getSubtleCrypto(); + if (!subtle) { + throw new Error("WebCrypto subtle API is unavailable"); + } + + // Compute double SHA256 hash + const hash1Buf = await subtle.digest("SHA-256", payload); + const hash1 = new Uint8Array(hash1Buf); + const hash2Buf = await subtle.digest("SHA-256", hash1); + const hash2 = new Uint8Array(hash2Buf); + const computedChecksum = hash2.subarray(0, 4); + + // Verify checksum + const mismatch = + (checksum[0] ^ computedChecksum[0]) | + (checksum[1] ^ computedChecksum[1]) | + (checksum[2] ^ computedChecksum[2]) | + (checksum[3] ^ computedChecksum[3]); + if (mismatch !== 0) { + throw new Error("invalid base58check checksum"); + } + + return payload; +} + +/** + * Returns private key bytes from a private key, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {string} privateKey + * @param {string} [keyFormat] Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" + * @return {Promise} + */ +async function decodeKey(privateKey, keyFormat) { + switch (keyFormat) { + case "SOLANA": { + const decodedKeyBytes = base58Decode(privateKey); + if (decodedKeyBytes.length !== 64) { + throw new Error( + `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.` + ); + } + return decodedKeyBytes.subarray(0, 32); + } + case "HEXADECIMAL": + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + case "BITCOIN_MAINNET_WIF": { + const payload = await base58CheckDecode(privateKey); + + const version = payload[0]; + const keyAndFlags = payload.subarray(1); + + // 0x80 = mainnet + if (version !== 0x80) { + throw new Error( + `invalid WIF version byte: ${version}. Expected 0x80 (mainnet).` + ); + } + + // Check for common mistake: uncompressed keys + if (keyAndFlags.length === 32) { + throw new Error("uncompressed WIF keys not supported"); + } + + // Validate compressed format + if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) { + throw new Error("invalid WIF format: expected compressed private key"); + } + + return keyAndFlags.subarray(0, 32); + } + case "BITCOIN_TESTNET_WIF": { + const payload = await base58CheckDecode(privateKey); + + const version = payload[0]; + const keyAndFlags = payload.subarray(1); + + // 0xEF = testnet + if (version !== 0xef) { + throw new Error( + `invalid WIF version byte: ${version}. Expected 0xEF (testnet).` + ); + } + + // Check for common mistake: uncompressed keys + if (keyAndFlags.length === 32) { + throw new Error("uncompressed WIF keys not supported"); + } + + // Validate compressed format + if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) { + throw new Error("invalid WIF format: expected compressed private key"); + } + + return keyAndFlags.subarray(0, 32); + } + case "SUI_BECH32": { + const { prefix, words } = bech32.decode(privateKey); + + if (prefix !== "suiprivkey") { + throw new Error( + `invalid SUI private key human-readable part (HRP): expected "suiprivkey"` + ); + } + + const bytes = bech32.fromWords(words); + if (bytes.length !== 33) { + throw new Error( + `invalid SUI private key length: expected 33 bytes, got ${bytes.length}` + ); + } + + const schemeFlag = bytes[0]; + const privkey = bytes.slice(1); + + // schemeFlag = 0 is Ed25519; We currently only support Ed25519 keys for SUI. + if (schemeFlag !== 0) { + throw new Error( + `invalid SUI private key scheme flag: expected 0 (Ed25519). Turnkey only supports Ed25519 keys for SUI.` + ); + } + + return new Uint8Array(privkey); + } + default: + console.warn( + `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.` + ); + if (privateKey.startsWith("0x")) { + return uint8arrayFromHexString(privateKey.slice(2)); + } + return uint8arrayFromHexString(privateKey); + } +} + +/** + * Returns a private key from private key bytes, represented in + * the encoding and format specified by `keyFormat`. Defaults to + * hex-encoding if `keyFormat` isn't passed. + * @param {Uint8Array} privateKeyBytes + * @param {string} [keyFormat] Can be "HEXADECIMAL" or "SOLANA" + * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is "SOLANA" + * @return {string} + */ +async function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) { + switch (keyFormat) { + case "SOLANA": + if (!publicKeyBytes) { + throw new Error("public key must be specified for SOLANA key format"); + } + if (privateKeyBytes.length !== 32) { + throw new Error( + `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.` + ); + } + if (publicKeyBytes.length !== 32) { + throw new Error( + `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.` + ); + } + { + const concatenatedBytes = new Uint8Array(64); + concatenatedBytes.set(privateKeyBytes, 0); + concatenatedBytes.set(publicKeyBytes, 32); + return base58Encode(concatenatedBytes); + } + case "HEXADECIMAL": + return "0x" + uint8arrayToHexString(privateKeyBytes); + default: + // keeping console.warn for debugging purposes. + // eslint-disable-next-line no-console + console.warn( + `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.` + ); + return "0x" + uint8arrayToHexString(privateKeyBytes); + } +} + +/** + * Helper to parse a private key into a Solana base58 private key. + * To be used if a wallet account is exported without the `SOLANA` address format. + * + * @param {string | Array} privateKey + * @returns {Uint8Array} + */ +function parsePrivateKey(privateKey) { + if (Array.isArray(privateKey)) { + return new Uint8Array(privateKey); + } + + if (typeof privateKey === "string") { + // Remove 0x prefix if present + if (privateKey.startsWith("0x")) { + privateKey = privateKey.slice(2); + } + + // Check if it's hex-formatted correctly (i.e. 64 hex chars) + if (privateKey.length === 64 && /^[0-9a-fA-F]+$/.test(privateKey)) { + return uint8arrayFromHexString(privateKey); + } + + // Otherwise assume it's base58 format (for Solana) + try { + return base58Decode(privateKey); + } catch (error) { + throw new Error( + "Invalid private key format. Use hex (64 chars) or base58 format." + ); + } + } + + throw new Error("Private key must be a string (hex/base58) or number array"); +} + +/** + * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). + * Any invalid style throws an error. Returns an object of valid styles. + * @param {Object} styles + * @param {HTMLElement} [element] - Optional element parameter (for import frame) + * @return {Object} + */ +function validateStyles(styles, element) { + const validStyles = {}; + + const cssValidationRegex = { + padding: "^(\\d+(px|em|%|rem) ?){1,4}$", + margin: "^(\\d+(px|em|%|rem) ?){1,4}$", + borderWidth: "^(\\d+(px|em|rem) ?){1,4}$", + borderStyle: + "^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$", + borderColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + borderRadius: "^(\\d+(px|em|%|rem) ?){1,4}$", + fontSize: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$", + fontWeight: "^(normal|bold|bolder|lighter|\\d{3})$", + fontFamily: '^[^";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection + color: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + labelColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + backgroundColor: + "^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)|hsla?\\(\\d{1,3}, \\d{1,3}%, \\d{1,3}%(, \\d?(\\.\\d{1,2})?)?\\))$", + width: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + height: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$", + maxWidth: "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + maxHeight: + "^(\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$", + lineHeight: + "^(\\d+(\\.\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$", + boxShadow: + "^(none|(\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\(\\d{1,3}, \\d{1,3}, \\d{1,3}(, \\d?(\\.\\d{1,2})?)?\\)) ?(inset)?)$", + textAlign: "^(left|right|center|justify|initial|inherit)$", + overflowWrap: "^(normal|break-word|anywhere)$", + wordWrap: "^(normal|break-word)$", + resize: "^(none|both|horizontal|vertical|block|inline)$", + }; + + Object.entries(styles).forEach(([property, value]) => { + const styleProperty = property.trim(); + if (styleProperty.length === 0) { + throw new Error("css style property cannot be empty"); + } + const styleRegexStr = cssValidationRegex[styleProperty]; + if (!styleRegexStr) { + throw new Error( + `invalid or unsupported css style property: "${styleProperty}"` + ); + } + const styleRegex = new RegExp(styleRegexStr); + const styleValue = value.trim(); + if (styleValue.length == 0) { + throw new Error(`css style for "${styleProperty}" is empty`); + } + const isValidStyle = styleRegex.test(styleValue); + if (!isValidStyle) { + throw new Error( + `invalid css style value for property "${styleProperty}"` + ); + } + validStyles[styleProperty] = styleValue; + }); + + return validStyles; +} + +export { additionalAssociatedData, base58CheckDecode, base58Decode, base58Encode, decodeKey, encodeKey, fromDerSignature, generateTargetKey, getEmbeddedKey, getItemWithExpiry, getSettings, getSubtleCrypto, getTargetEmbeddedKey, initEmbeddedKey, loadQuorumKey, loadTargetKey, logMessage, normalizePadding, onResetEmbeddedKey, p256JWKPrivateToPublic, parsePrivateKey, resetTargetEmbeddedKey, sendMessageUp, setCryptoProvider, setEmbeddedKey, setItemWithExpiry, setParentFrameMessageChannelPort, setSettings, setTargetEmbeddedKey, uint8arrayFromHexString, uint8arrayToHexString, unsafeSkipDoubleIframeCheck, validateStyles, verifyEnclaveSignature }; +//# sourceMappingURL=turnkey-core.mjs.map diff --git a/shared/dist/turnkey-core.mjs.map b/shared/dist/turnkey-core.mjs.map new file mode 100644 index 00000000..7bc049d1 --- /dev/null +++ b/shared/dist/turnkey-core.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.mjs","sources":["../src/turnkey-core.js"],"sourcesContent":["import { bech32 } from \"bech32\";\n\n/**\n * Turnkey Core Module - Shared\n * Contains all the core cryptographic and utility functions shared across frames\n */\n\n/** constants for LocalStorage */\nconst TURNKEY_EMBEDDED_KEY = \"TURNKEY_EMBEDDED_KEY\";\nconst TURNKEY_TARGET_EMBEDDED_KEY = \"TURNKEY_TARGET_EMBEDDED_KEY\";\nconst TURNKEY_SETTINGS = \"TURNKEY_SETTINGS\";\n/** 48 hours in milliseconds */\nconst TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS = 1000 * 60 * 60 * 48;\nconst TURNKEY_EMBEDDED_KEY_ORIGIN = \"TURNKEY_EMBEDDED_KEY_ORIGIN\";\n\nlet parentFrameMessageChannelPort = null;\nvar cryptoProviderOverride = null;\n\n/*\n * Returns a reference to the WebCrypto subtle interface regardless of the host environment.\n */\nfunction getSubtleCrypto() {\n if (cryptoProviderOverride && cryptoProviderOverride.subtle) {\n return cryptoProviderOverride.subtle;\n }\n if (\n typeof globalThis !== \"undefined\" &&\n globalThis.crypto &&\n globalThis.crypto.subtle\n ) {\n return globalThis.crypto.subtle;\n }\n if (typeof window !== \"undefined\" && window.crypto && window.crypto.subtle) {\n return window.crypto.subtle;\n }\n if (typeof global !== \"undefined\" && global.crypto && global.crypto.subtle) {\n return global.crypto.subtle;\n }\n if (typeof crypto !== \"undefined\" && crypto.subtle) {\n return crypto.subtle;\n }\n\n return null;\n}\n\n/*\n * Allows tests to explicitly set the crypto provider (e.g. crypto.webcrypto) when the runtime\n * environment does not expose one on the global/window objects.\n */\nfunction setCryptoProvider(cryptoProvider) {\n cryptoProviderOverride = cryptoProvider || null;\n}\n\n/* Security functions */\n\nlet unsafeDoubleFrameCheckSkipped = false;\n\nfunction isDoublyIframed() {\n if (unsafeDoubleFrameCheckSkipped) return false;\n\n if (window.location.ancestorOrigins !== undefined) {\n // Does not exist in IE and firefox.\n // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works\n return window.location.ancestorOrigins.length > 1;\n } else {\n return window.parent !== window.top;\n }\n}\n\nfunction unsafeSkipDoubleIframeCheck() {\n unsafeDoubleFrameCheckSkipped = true;\n}\n\n/*\n * Loads the quorum public key as a CryptoKey.\n */\nasync function loadQuorumKey(quorumPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.importKey(\n \"raw\",\n quorumPublic,\n {\n name: \"ECDSA\",\n namedCurve: \"P-256\",\n },\n true,\n [\"verify\"]\n );\n}\n\n/*\n * Load a key to encrypt to as a CryptoKey and return it as a JSON Web Key.\n */\nasync function loadTargetKey(targetPublic) {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const targetKey = await subtle.importKey(\n \"raw\",\n targetPublic,\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n []\n );\n\n return await subtle.exportKey(\"jwk\", targetKey);\n}\n\n/**\n * Creates a new public/private key pair and persists it in localStorage\n */\nasync function initEmbeddedKey() {\n if (isDoublyIframed()) {\n throw new Error(\"Doubly iframed\");\n }\n const retrievedKey = await getEmbeddedKey();\n if (retrievedKey === null) {\n const targetKey = await generateTargetKey();\n setEmbeddedKey(targetKey);\n }\n // Nothing to do, key is correctly initialized!\n}\n\n/*\n * Generate a key to encrypt to and export it as a JSON Web Key.\n */\nasync function generateTargetKey() {\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n const p256key = await subtle.generateKey(\n {\n name: \"ECDH\",\n namedCurve: \"P-256\",\n },\n true,\n [\"deriveBits\"]\n );\n\n return await subtle.exportKey(\"jwk\", p256key.privateKey);\n}\n\n/**\n * Gets the current embedded private key JWK. Returns `null` if not found.\n */\nfunction getEmbeddedKey() {\n const jwtKey = getItemWithExpiry(TURNKEY_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the embedded private key JWK with the default expiration time.\n * @param {JsonWebKey} targetKey\n */\nfunction setEmbeddedKey(targetKey) {\n setItemWithExpiry(\n TURNKEY_EMBEDDED_KEY,\n JSON.stringify(targetKey),\n TURNKEY_EMBEDDED_KEY_TTL_IN_MILLIS\n );\n}\n\n/**\n * Gets the current target embedded private key JWK. Returns `null` if not found.\n */\nfunction getTargetEmbeddedKey() {\n const jwtKey = window.localStorage.getItem(TURNKEY_TARGET_EMBEDDED_KEY);\n return jwtKey ? JSON.parse(jwtKey) : null;\n}\n\n/**\n * Sets the target embedded public key JWK.\n * @param {JsonWebKey} targetKey\n */\nfunction setTargetEmbeddedKey(targetKey) {\n window.localStorage.setItem(\n TURNKEY_TARGET_EMBEDDED_KEY,\n JSON.stringify(targetKey)\n );\n}\n\n/**\n * Resets the current embedded private key JWK.\n */\nfunction onResetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY);\n window.localStorage.removeItem(TURNKEY_EMBEDDED_KEY_ORIGIN);\n}\n\n/**\n * Resets the current target embedded private key JWK.\n */\nfunction resetTargetEmbeddedKey() {\n window.localStorage.removeItem(TURNKEY_TARGET_EMBEDDED_KEY);\n}\n\nfunction setParentFrameMessageChannelPort(port) {\n parentFrameMessageChannelPort = port;\n}\n\n/**\n * Gets the current settings.\n */\nfunction getSettings() {\n const settings = window.localStorage.getItem(TURNKEY_SETTINGS);\n return settings ? JSON.parse(settings) : null;\n}\n\n/**\n * Sets the settings object.\n * @param {Object} settings\n */\nfunction setSettings(settings) {\n window.localStorage.setItem(TURNKEY_SETTINGS, JSON.stringify(settings));\n}\n\n/**\n * Set an item in localStorage with an expiration time\n * @param {string} key\n * @param {string} value\n * @param {number} ttl expiration time in milliseconds\n */\nfunction setItemWithExpiry(key, value, ttl) {\n const now = new Date();\n const item = {\n value: value,\n expiry: now.getTime() + ttl,\n };\n window.localStorage.setItem(key, JSON.stringify(item));\n}\n\n/**\n * Get an item from localStorage. Returns `null` and\n * removes the item from localStorage if expired or\n * expiry time is missing.\n * @param {string} key\n */\nfunction getItemWithExpiry(key) {\n const itemStr = window.localStorage.getItem(key);\n if (!itemStr) {\n return null;\n }\n const item = JSON.parse(itemStr);\n if (\n !Object.prototype.hasOwnProperty.call(item, \"expiry\") ||\n !Object.prototype.hasOwnProperty.call(item, \"value\")\n ) {\n window.localStorage.removeItem(key);\n return null;\n }\n const now = new Date();\n if (now.getTime() > item.expiry) {\n window.localStorage.removeItem(key);\n return null;\n }\n return item.value;\n}\n\n/**\n * Takes a hex string (e.g. \"e4567ab\" or \"0xe4567ab\") and returns an array buffer (Uint8Array)\n * @param {string} hexString - Hex string with or without \"0x\" prefix\n * @returns {Uint8Array}\n */\nfunction uint8arrayFromHexString(hexString) {\n if (!hexString || typeof hexString !== \"string\") {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n\n // Remove 0x prefix if present\n const hexWithoutPrefix =\n hexString.startsWith(\"0x\") || hexString.startsWith(\"0X\")\n ? hexString.slice(2)\n : hexString;\n\n var hexRegex = /^[0-9A-Fa-f]+$/;\n if (hexWithoutPrefix.length % 2 != 0 || !hexRegex.test(hexWithoutPrefix)) {\n throw new Error(\"cannot create uint8array from invalid hex string\");\n }\n return new Uint8Array(\n hexWithoutPrefix.match(/../g).map((h) => parseInt(h, 16))\n );\n}\n\n/**\n * Takes a Uint8Array and returns a hex string\n * @param {Uint8Array} buffer\n * @return {string}\n */\nfunction uint8arrayToHexString(buffer) {\n return [...buffer].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n}\n\n/**\n * Function to normalize padding of byte array with 0's to a target length\n */\nfunction normalizePadding(byteArray, targetLength) {\n const paddingLength = targetLength - byteArray.length;\n\n // Add leading 0's to array\n if (paddingLength > 0) {\n const padding = new Uint8Array(paddingLength).fill(0);\n return new Uint8Array([...padding, ...byteArray]);\n }\n\n // Remove leading 0's from array\n if (paddingLength < 0) {\n const expectedZeroCount = paddingLength * -1;\n let zeroCount = 0;\n for (let i = 0; i < expectedZeroCount && i < byteArray.length; i++) {\n if (byteArray[i] === 0) {\n zeroCount++;\n }\n }\n // Check if the number of zeros found equals the number of zeroes expected\n if (zeroCount !== expectedZeroCount) {\n throw new Error(\n `invalid number of starting zeroes. Expected number of zeroes: ${expectedZeroCount}. Found: ${zeroCount}.`\n );\n }\n return byteArray.slice(expectedZeroCount, expectedZeroCount + targetLength);\n }\n return byteArray;\n}\n\n/**\n * Additional Associated Data (AAD) in the format dictated by the enclave_encrypt crate.\n */\nfunction additionalAssociatedData(senderPubBuf, receiverPubBuf) {\n const s = Array.from(new Uint8Array(senderPubBuf));\n const r = Array.from(new Uint8Array(receiverPubBuf));\n return new Uint8Array([...s, ...r]);\n}\n\n/**\n * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses.\n *\n * @param {string} derSignature - The DER-encoded signature as a hexadecimal string.\n * @returns {Uint8Array} - The raw signature as a Uint8Array.\n */\nfunction fromDerSignature(derSignature) {\n const derSignatureBuf = uint8arrayFromHexString(derSignature);\n\n // Check and skip the sequence tag (0x30)\n let index = 2;\n\n // Parse 'r' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for r\"\n );\n }\n index++; // Move past the INTEGER tag\n const rLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const r = derSignatureBuf.slice(index, index + rLength);\n index += rLength; // Move to the start of s\n\n // Parse 's' and check for integer tag (0x02)\n if (derSignatureBuf[index] !== 0x02) {\n throw new Error(\n \"failed to convert DER-encoded signature: invalid tag for s\"\n );\n }\n index++; // Move past the INTEGER tag\n const sLength = derSignatureBuf[index];\n index++; // Move past the length byte\n const s = derSignatureBuf.slice(index, index + sLength);\n\n // Normalize 'r' and 's' to 32 bytes each\n const rPadded = normalizePadding(r, 32);\n const sPadded = normalizePadding(s, 32);\n\n // Concatenate and return the raw signature\n return new Uint8Array([...rPadded, ...sPadded]);\n}\n\n/**\n * Function to verify enclave signature on import bundle received from the server.\n * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature\n * @param {string} publicSignature signature bytes encoded as a hexadecimal string\n * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes\n */\nasync function verifyEnclaveSignature(\n enclaveQuorumPublic,\n publicSignature,\n signedData\n) {\n /** Turnkey Signer enclave's public keys */\n const TURNKEY_SIGNERS_ENCLAVES = {\n prod: \"04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569\",\n preprod:\n \"04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212\",\n dev: \"048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d\",\n };\n\n // The TURNKEY_SIGNER_ENVIRONMENT must be defined either:\n //\n // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE)\n // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT)\n // - By setting either of these in test environment\n const TURNKEY_SIGNER_ENVIRONMENT =\n window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE ||\n window.TURNKEY_SIGNER_ENVIRONMENT;\n if (TURNKEY_SIGNER_ENVIRONMENT === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined`\n );\n }\n\n const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY =\n TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT];\n\n if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) {\n throw new Error(\n `Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined`\n );\n }\n\n // todo(olivia): throw error if enclave quorum public is null once server changes are deployed\n if (enclaveQuorumPublic) {\n if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) {\n throw new Error(\n `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.`\n );\n }\n }\n\n const encryptionQuorumPublicBuf = new Uint8Array(\n uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY)\n );\n const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf);\n if (!quorumKey) {\n throw new Error(\"failed to load quorum key\");\n }\n\n // The ECDSA signature is ASN.1 DER encoded but WebCrypto uses raw format\n const publicSignatureBuf = fromDerSignature(publicSignature);\n const signedDataBuf = uint8arrayFromHexString(signedData);\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n return await subtle.verify(\n { name: \"ECDSA\", hash: \"SHA-256\" },\n quorumKey,\n publicSignatureBuf,\n signedDataBuf\n );\n}\n\n/**\n * Function to send a message.\n *\n * If this page is embedded as an iframe we'll send a postMessage\n * in one of two ways depending on the version of @turnkey/iframe-stamper:\n * 1. newer versions (>=v2.1.0) pass a MessageChannel MessagePort from the parent frame for postMessages.\n * 2. older versions ( 0) {\n digits.push(carry % 58);\n carry = (carry / 58) | 0;\n }\n }\n // Convert digits to a base58 string\n for (let k = 0; k < digits.length; k++) {\n result = alphabet[digits[k]] + result;\n }\n\n // Add '1' for each leading 0 byte\n for (let i = 0; bytes[i] === 0 && i < bytes.length - 1; i++) {\n result = \"1\" + result;\n }\n return result;\n}\n\n/**\n * Decodes a base58-encoded string into a buffer\n * This function throws an error when the string contains invalid characters.\n * @param {string} s The base58-encoded string.\n * @return {Uint8Array} The decoded buffer.\n */\nfunction base58Decode(s) {\n // See https://en.bitcoin.it/wiki/Base58Check_encoding\n var alphabet = \"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz\";\n var decodedBytes = [];\n var leadingZeros = [];\n for (var i = 0; i < s.length; i++) {\n if (alphabet.indexOf(s[i]) === -1) {\n throw new Error(`cannot base58-decode: ${s[i]} isn't a valid character`);\n }\n var carry = alphabet.indexOf(s[i]);\n\n // If the current base58 digit is 0, append a 0 byte.\n // \"i == leadingZeros.length\" can only be true if we have not seen non-zero bytes so far.\n // If we had seen a non-zero byte, carry wouldn't be 0, and i would be strictly more than `leadingZeros.length`\n if (carry == 0 && i === leadingZeros.length) {\n leadingZeros.push(0);\n }\n\n var j = 0;\n while (j < decodedBytes.length || carry > 0) {\n var currentByte = decodedBytes[j];\n\n // shift the current byte 58 units and add the carry amount\n // (or just add the carry amount if this is a new byte -- undefined case)\n if (currentByte === undefined) {\n currentByte = carry;\n } else {\n currentByte = currentByte * 58 + carry;\n }\n\n // find the new carry amount (1-byte shift of current byte value)\n carry = currentByte >> 8;\n // reset the current byte to the remainder (the carry amount will pass on the overflow)\n decodedBytes[j] = currentByte % 256;\n j++;\n }\n }\n\n var result = leadingZeros.concat(decodedBytes.reverse());\n return new Uint8Array(result);\n}\n\n/**\n * Decodes a base58check-encoded string and verifies the checksum.\n * Base58Check encoding includes a 4-byte checksum at the end to detect errors.\n * The checksum is the first 4 bytes of SHA256(SHA256(payload)).\n * This function throws an error if the checksum is invalid.\n * @param {string} s The base58check-encoded string.\n * @return {Promise} The decoded payload (without checksum).\n */\nasync function base58CheckDecode(s) {\n const decoded = base58Decode(s);\n\n if (decoded.length < 5) {\n throw new Error(\n `invalid base58check length: expected at least 5 bytes, got ${decoded.length}`\n );\n }\n\n const payload = decoded.subarray(0, decoded.length - 4);\n const checksum = decoded.subarray(decoded.length - 4);\n\n const subtle = getSubtleCrypto();\n if (!subtle) {\n throw new Error(\"WebCrypto subtle API is unavailable\");\n }\n\n // Compute double SHA256 hash\n const hash1Buf = await subtle.digest(\"SHA-256\", payload);\n const hash1 = new Uint8Array(hash1Buf);\n const hash2Buf = await subtle.digest(\"SHA-256\", hash1);\n const hash2 = new Uint8Array(hash2Buf);\n const computedChecksum = hash2.subarray(0, 4);\n\n // Verify checksum\n const mismatch =\n (checksum[0] ^ computedChecksum[0]) |\n (checksum[1] ^ computedChecksum[1]) |\n (checksum[2] ^ computedChecksum[2]) |\n (checksum[3] ^ computedChecksum[3]);\n if (mismatch !== 0) {\n throw new Error(\"invalid base58check checksum\");\n }\n\n return payload;\n}\n\n/**\n * Returns private key bytes from a private key, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {string} privateKey\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\", \"SUI_BECH32\", \"BITCOIN_MAINNET_WIF\", \"BITCOIN_TESTNET_WIF\" or \"SOLANA\"\n * @return {Promise}\n */\nasync function decodeKey(privateKey, keyFormat) {\n switch (keyFormat) {\n case \"SOLANA\": {\n const decodedKeyBytes = base58Decode(privateKey);\n if (decodedKeyBytes.length !== 64) {\n throw new Error(\n `invalid key length. Expected 64 bytes. Got ${decodedKeyBytes.length}.`\n );\n }\n return decodedKeyBytes.subarray(0, 32);\n }\n case \"HEXADECIMAL\":\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n case \"BITCOIN_MAINNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0x80 = mainnet\n if (version !== 0x80) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0x80 (mainnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"BITCOIN_TESTNET_WIF\": {\n const payload = await base58CheckDecode(privateKey);\n\n const version = payload[0];\n const keyAndFlags = payload.subarray(1);\n\n // 0xEF = testnet\n if (version !== 0xef) {\n throw new Error(\n `invalid WIF version byte: ${version}. Expected 0xEF (testnet).`\n );\n }\n\n // Check for common mistake: uncompressed keys\n if (keyAndFlags.length === 32) {\n throw new Error(\"uncompressed WIF keys not supported\");\n }\n\n // Validate compressed format\n if (keyAndFlags.length !== 33 || keyAndFlags[32] !== 0x01) {\n throw new Error(\"invalid WIF format: expected compressed private key\");\n }\n\n return keyAndFlags.subarray(0, 32);\n }\n case \"SUI_BECH32\": {\n const { prefix, words } = bech32.decode(privateKey);\n\n if (prefix !== \"suiprivkey\") {\n throw new Error(\n `invalid SUI private key human-readable part (HRP): expected \"suiprivkey\"`\n );\n }\n\n const bytes = bech32.fromWords(words);\n if (bytes.length !== 33) {\n throw new Error(\n `invalid SUI private key length: expected 33 bytes, got ${bytes.length}`\n );\n }\n\n const schemeFlag = bytes[0];\n const privkey = bytes.slice(1);\n\n // schemeFlag = 0 is Ed25519; We currently only support Ed25519 keys for SUI.\n if (schemeFlag !== 0) {\n throw new Error(\n `invalid SUI private key scheme flag: expected 0 (Ed25519). Turnkey only supports Ed25519 keys for SUI.`\n );\n }\n\n return new Uint8Array(privkey);\n }\n default:\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n if (privateKey.startsWith(\"0x\")) {\n return uint8arrayFromHexString(privateKey.slice(2));\n }\n return uint8arrayFromHexString(privateKey);\n }\n}\n\n/**\n * Returns a private key from private key bytes, represented in\n * the encoding and format specified by `keyFormat`. Defaults to\n * hex-encoding if `keyFormat` isn't passed.\n * @param {Uint8Array} privateKeyBytes\n * @param {string} [keyFormat] Can be \"HEXADECIMAL\" or \"SOLANA\"\n * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is \"SOLANA\"\n * @return {string}\n */\nasync function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) {\n switch (keyFormat) {\n case \"SOLANA\":\n if (!publicKeyBytes) {\n throw new Error(\"public key must be specified for SOLANA key format\");\n }\n if (privateKeyBytes.length !== 32) {\n throw new Error(\n `invalid private key length. Expected 32 bytes. Got ${privateKeyBytes.length}.`\n );\n }\n if (publicKeyBytes.length !== 32) {\n throw new Error(\n `invalid public key length. Expected 32 bytes. Got ${publicKeyBytes.length}.`\n );\n }\n {\n const concatenatedBytes = new Uint8Array(64);\n concatenatedBytes.set(privateKeyBytes, 0);\n concatenatedBytes.set(publicKeyBytes, 32);\n return base58Encode(concatenatedBytes);\n }\n case \"HEXADECIMAL\":\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n default:\n // keeping console.warn for debugging purposes.\n // eslint-disable-next-line no-console\n console.warn(\n `invalid key format: ${keyFormat}. Defaulting to HEXADECIMAL.`\n );\n return \"0x\" + uint8arrayToHexString(privateKeyBytes);\n }\n}\n\n/**\n * Helper to parse a private key into a Solana base58 private key.\n * To be used if a wallet account is exported without the `SOLANA` address format.\n *\n * @param {string | Array} privateKey\n * @returns {Uint8Array}\n */\nfunction parsePrivateKey(privateKey) {\n if (Array.isArray(privateKey)) {\n return new Uint8Array(privateKey);\n }\n\n if (typeof privateKey === \"string\") {\n // Remove 0x prefix if present\n if (privateKey.startsWith(\"0x\")) {\n privateKey = privateKey.slice(2);\n }\n\n // Check if it's hex-formatted correctly (i.e. 64 hex chars)\n if (privateKey.length === 64 && /^[0-9a-fA-F]+$/.test(privateKey)) {\n return uint8arrayFromHexString(privateKey);\n }\n\n // Otherwise assume it's base58 format (for Solana)\n try {\n return base58Decode(privateKey);\n } catch (error) {\n throw new Error(\n \"Invalid private key format. Use hex (64 chars) or base58 format.\"\n );\n }\n }\n\n throw new Error(\"Private key must be a string (hex/base58) or number array\");\n}\n\n/**\n * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions).\n * Any invalid style throws an error. Returns an object of valid styles.\n * @param {Object} styles\n * @param {HTMLElement} [element] - Optional element parameter (for import frame)\n * @return {Object}\n */\nfunction validateStyles(styles, element) {\n const validStyles = {};\n\n const cssValidationRegex = {\n padding: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n margin: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n borderWidth: \"^(\\\\d+(px|em|rem) ?){1,4}$\",\n borderStyle:\n \"^(none|solid|dashed|dotted|double|groove|ridge|inset|outset)$\",\n borderColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n borderRadius: \"^(\\\\d+(px|em|%|rem) ?){1,4}$\",\n fontSize: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax))$\",\n fontWeight: \"^(normal|bold|bolder|lighter|\\\\d{3})$\",\n fontFamily: '^[^\";<>]*$', // checks for the absence of some characters that could lead to CSS/HTML injection\n color:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n labelColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n backgroundColor:\n \"^(transparent|inherit|initial|#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)|hsla?\\\\(\\\\d{1,3}, \\\\d{1,3}%, \\\\d{1,3}%(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\))$\",\n width: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n height: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|auto)$\",\n maxWidth: \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n maxHeight:\n \"^(\\\\d+(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|none)$\",\n lineHeight:\n \"^(\\\\d+(\\\\.\\\\d+)?(px|em|rem|%|vh|vw|in|cm|mm|pt|pc|ex|ch|vmin|vmax)|normal)$\",\n boxShadow:\n \"^(none|(\\\\d+(px|em|rem) ?){2,4} (#[0-9a-f]{3,8}|rgba?\\\\(\\\\d{1,3}, \\\\d{1,3}, \\\\d{1,3}(, \\\\d?(\\\\.\\\\d{1,2})?)?\\\\)) ?(inset)?)$\",\n textAlign: \"^(left|right|center|justify|initial|inherit)$\",\n overflowWrap: \"^(normal|break-word|anywhere)$\",\n wordWrap: \"^(normal|break-word)$\",\n resize: \"^(none|both|horizontal|vertical|block|inline)$\",\n };\n\n Object.entries(styles).forEach(([property, value]) => {\n const styleProperty = property.trim();\n if (styleProperty.length === 0) {\n throw new Error(\"css style property cannot be empty\");\n }\n const styleRegexStr = cssValidationRegex[styleProperty];\n if (!styleRegexStr) {\n throw new Error(\n `invalid or unsupported css style property: \"${styleProperty}\"`\n );\n }\n const styleRegex = new RegExp(styleRegexStr);\n const styleValue = value.trim();\n if (styleValue.length == 0) {\n throw new Error(`css style for \"${styleProperty}\" is empty`);\n }\n const isValidStyle = styleRegex.test(styleValue);\n if (!isValidStyle) {\n throw new Error(\n `invalid css style value for property \"${styleProperty}\"`\n );\n }\n validStyles[styleProperty] = styleValue;\n });\n\n return validStyles;\n}\n\n// Export all shared functions\nexport {\n setCryptoProvider,\n getSubtleCrypto,\n loadQuorumKey,\n loadTargetKey,\n initEmbeddedKey,\n unsafeSkipDoubleIframeCheck,\n generateTargetKey,\n getEmbeddedKey,\n setEmbeddedKey,\n getTargetEmbeddedKey,\n setTargetEmbeddedKey,\n onResetEmbeddedKey,\n resetTargetEmbeddedKey,\n setParentFrameMessageChannelPort,\n getSettings,\n setSettings,\n setItemWithExpiry,\n getItemWithExpiry,\n uint8arrayFromHexString,\n uint8arrayToHexString,\n normalizePadding,\n additionalAssociatedData,\n fromDerSignature,\n verifyEnclaveSignature,\n sendMessageUp,\n logMessage,\n p256JWKPrivateToPublic,\n base58Encode,\n base58Decode,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AM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK;AACxD,IAAI,MAAM,aAAa,GAAG,QAAQ,CAAC,IAAI,EAAE;AACzC,IAAI,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE;AACpC,MAAM,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG,kBAAkB,CAAC,aAAa,CAAC;AAC3D,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,MAAM,MAAM,IAAI,KAAK;AACrB,QAAQ,CAAC,4CAA4C,EAAE,aAAa,CAAC,CAAC;AACtE,OAAO;AACP,IAAI;AACJ,IAAI,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,aAAa,CAAC;AAChD,IAAI,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,EAAE;AACnC,IAAI,IAAI,UAAU,CAAC,MAAM,IAAI,CAAC,EAAE;AAChC,MAAM,MAAM,IAAI,KAAK,CAAC,CAAC,eAAe,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;AAClE,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC;AACpD,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,MAAM,MAAM,IAAI,KAAK;AACrB,QAAQ,CAAC,sCAAsC,EAAE,aAAa,CAAC,CAAC;AAChE,OAAO;AACP,IAAI;AACJ,IAAI,WAAW,CAAC,aAAa,CAAC,GAAG,UAAU;AAC3C,EAAE,CAAC,CAAC;;AAEJ,EAAE,OAAO,WAAW;AACpB;;;;"} \ No newline at end of file diff --git a/shared/dist/turnkey-core.test.d.ts b/shared/dist/turnkey-core.test.d.ts new file mode 100644 index 00000000..0f91e5aa --- /dev/null +++ b/shared/dist/turnkey-core.test.d.ts @@ -0,0 +1,6 @@ +/** + * Tests for shared turnkey-core utilities + * These tests cover functionality that is shared across all frames + */ +import "@testing-library/jest-dom"; +//# sourceMappingURL=turnkey-core.test.d.ts.map \ No newline at end of file diff --git a/shared/dist/turnkey-core.test.d.ts.map b/shared/dist/turnkey-core.test.d.ts.map new file mode 100644 index 00000000..05ad8974 --- /dev/null +++ b/shared/dist/turnkey-core.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"turnkey-core.test.d.ts","sourceRoot":"","sources":["../src/turnkey-core.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,2BAA2B,CAAC"} \ No newline at end of file diff --git a/shared/jest.config.js b/shared/jest.config.js deleted file mode 100644 index eba907fa..00000000 --- a/shared/jest.config.js +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = { - clearMocks: true, - testEnvironment: "jsdom", - setupFilesAfterEnv: ["regenerator-runtime/runtime"], - testPathIgnorePatterns: ["/node_modules/"], - transformIgnorePatterns: ["node_modules/(?!(@hpke)/)"], -}; diff --git a/shared/jest.config.ts b/shared/jest.config.ts new file mode 100644 index 00000000..4b391fb3 --- /dev/null +++ b/shared/jest.config.ts @@ -0,0 +1,15 @@ +import type { Config } from "jest"; + +export default { + clearMocks: true, + setupFiles: ["/jest.setup.ts"], + testEnvironment: "jsdom", + testEnvironmentOptions: { + url: "http://localhost", + }, + transform: { + "^.+\\.[tj]sx?$": ["ts-jest", { useESM: true }], + }, + testPathIgnorePatterns: ["/node_modules/", "/.rollup.cache/"], + transformIgnorePatterns: ["/node_modules/.pnpm/(?!(@noble|@hpke)/)"], +} satisfies Config; diff --git a/shared/jest.setup.ts b/shared/jest.setup.ts new file mode 100644 index 00000000..5a339390 --- /dev/null +++ b/shared/jest.setup.ts @@ -0,0 +1,21 @@ +import "regenerator-runtime/runtime"; +import { TextEncoder, TextDecoder } from "util"; +import { ReadableStream } from "node:stream/web"; +import { MessagePort } from "node:worker_threads"; + +if (typeof global.MessagePort === "undefined") { + global.MessagePort = MessagePort as unknown as typeof global.MessagePort; +} + +if (typeof global.ReadableStream === "undefined") { + global.ReadableStream = + ReadableStream as unknown as typeof global.ReadableStream; +} + +if (typeof global.TextEncoder === "undefined") { + global.TextEncoder = TextEncoder; +} + +if (typeof global.TextDecoder === "undefined") { + global.TextDecoder = TextDecoder; +} diff --git a/shared/package.json b/shared/package.json index e5aeacac..fc568b4b 100644 --- a/shared/package.json +++ b/shared/package.json @@ -1,9 +1,21 @@ { - "name": "frames-shared", + "name": "@turnkey/frames-shared", "version": "1.0.0", "description": "Shared utilities for Turnkey frames", - "main": "turnkey-core.js", + "private": true, + "main": "./dist/index.js", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "default": "./dist/index.mjs" + } + }, "scripts": { + "build": "rollup -c", "test": "jest", "lint": "eslint '**/*.{js,ts}'", "lint:write": "eslint '**/*.{js,ts}' --fix", @@ -14,13 +26,16 @@ "devDependencies": { "@babel/core": "^7.23.0", "@babel/preset-env": "^7.22.20", - "@testing-library/jest-dom": "^6.1.3", + "@testing-library/jest-dom": "^6.9.1", + "@types/jest": "30.0.0", "babel-jest": "^29.7.0", "eslint": "^8.57.0", - "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", + "jest": "30.4.2", + "jest-environment-jsdom": "30.4.1", "prettier": "^2.8.4", - "regenerator-runtime": "^0.14.1" + "regenerator-runtime": "^0.14.1", + "rollup": "4.59.0", + "ts-jest": "29.4.11" }, "dependencies": { "@hpke/core": "1.7.5", diff --git a/shared/rollup.config.mjs b/shared/rollup.config.mjs new file mode 100644 index 00000000..26385cdf --- /dev/null +++ b/shared/rollup.config.mjs @@ -0,0 +1,3 @@ +import rollup from "../rollup.config.base.mjs"; + +export default (options) => rollup(); diff --git a/shared/crypto-utils.js b/shared/src/crypto-utils.js similarity index 100% rename from shared/crypto-utils.js rename to shared/src/crypto-utils.js diff --git a/shared/src/index.ts b/shared/src/index.ts new file mode 100644 index 00000000..1304b0f0 --- /dev/null +++ b/shared/src/index.ts @@ -0,0 +1,2 @@ +export * from "./crypto-utils.js"; +export * from "./turnkey-core.js"; diff --git a/shared/turnkey-core.js b/shared/src/turnkey-core.js similarity index 94% rename from shared/turnkey-core.js rename to shared/src/turnkey-core.js index 97071c19..a93d82a4 100644 --- a/shared/turnkey-core.js +++ b/shared/src/turnkey-core.js @@ -53,7 +53,11 @@ function setCryptoProvider(cryptoProvider) { /* Security functions */ +let unsafeDoubleFrameCheckSkipped = false; + function isDoublyIframed() { + if (unsafeDoubleFrameCheckSkipped) return false; + if (window.location.ancestorOrigins !== undefined) { // Does not exist in IE and firefox. // See https://developer.mozilla.org/en-US/docs/Web/API/Location/ancestorOrigins for how this works @@ -63,6 +67,10 @@ function isDoublyIframed() { } } +function unsafeSkipDoubleIframeCheck() { + unsafeDoubleFrameCheckSkipped = true; +} + /* * Loads the quorum public key as a CryptoKey. */ @@ -259,7 +267,7 @@ function getItemWithExpiry(key) { /** * Takes a hex string (e.g. "e4567ab" or "0xe4567ab") and returns an array buffer (Uint8Array) * @param {string} hexString - Hex string with or without "0x" prefix - * @returns {Uint8Array} + * @returns {Uint8Array} */ function uint8arrayFromHexString(hexString) { if (!hexString || typeof hexString !== "string") { @@ -333,6 +341,9 @@ function additionalAssociatedData(senderPubBuf, receiverPubBuf) { /** * Converts an ASN.1 DER-encoded ECDSA signature to the raw format that WebCrypto uses. + * + * @param {string} derSignature - The DER-encoded signature as a hexadecimal string. + * @returns {Uint8Array} - The raw signature as a Uint8Array. */ function fromDerSignature(derSignature) { const derSignatureBuf = uint8arrayFromHexString(derSignature); @@ -373,7 +384,7 @@ function fromDerSignature(derSignature) { /** * Function to verify enclave signature on import bundle received from the server. - * @param {string} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature + * @param {string | null} enclaveQuorumPublic uncompressed public key for the quorum key which produced the signature * @param {string} publicSignature signature bytes encoded as a hexadecimal string * @param {string} signedData signed bytes encoded as a hexadecimal string. This could be public key bytes directly, or JSON-encoded bytes */ @@ -390,12 +401,22 @@ async function verifyEnclaveSignature( dev: "048cf9ed5f579298cc1571823a3222b82d80c529c551f6070fbe712ae1a9e8d1a23b7006e306d27190358dfcd9c44624918a00f23c920a33cb14f5b026eafc865d", }; - // Use window.__TURNKEY_SIGNER_ENVIRONMENT__ if available (for testing), otherwise use the webpack replacement - const environment = - (typeof window !== "undefined" && window.__TURNKEY_SIGNER_ENVIRONMENT__) || - "__TURNKEY_SIGNER_ENVIRONMENT__"; + // The TURNKEY_SIGNER_ENVIRONMENT must be defined either: + // + // - By webpack's DefinePlugin (TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE) + // - By nginx's envsubst applied to an index.html template (TURNKEY_SIGNER_ENVIRONMENT) + // - By setting either of these in test environment + const TURNKEY_SIGNER_ENVIRONMENT = + window.TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE || + window.TURNKEY_SIGNER_ENVIRONMENT; + if (TURNKEY_SIGNER_ENVIRONMENT === undefined) { + throw new Error( + `Configuration error: TURNKEY_SIGNER_ENVIRONMENT is undefined` + ); + } + const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = - TURNKEY_SIGNERS_ENCLAVES[environment]; + TURNKEY_SIGNERS_ENCLAVES[TURNKEY_SIGNER_ENVIRONMENT]; if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { throw new Error( @@ -645,7 +666,7 @@ async function base58CheckDecode(s) { * the encoding and format specified by `keyFormat`. Defaults to * hex-encoding if `keyFormat` isn't passed. * @param {string} privateKey - * @param {string} keyFormat Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" + * @param {string} [keyFormat] Can be "HEXADECIMAL", "SUI_BECH32", "BITCOIN_MAINNET_WIF", "BITCOIN_TESTNET_WIF" or "SOLANA" * @return {Promise} */ async function decodeKey(privateKey, keyFormat) { @@ -758,7 +779,9 @@ async function decodeKey(privateKey, keyFormat) { * the encoding and format specified by `keyFormat`. Defaults to * hex-encoding if `keyFormat` isn't passed. * @param {Uint8Array} privateKeyBytes - * @param {string} keyFormat Can be "HEXADECIMAL" or "SOLANA" + * @param {string} [keyFormat] Can be "HEXADECIMAL" or "SOLANA" + * @param {Uint8Array} [publicKeyBytes] Required if keyFormat is "SOLANA" + * @return {string} */ async function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) { switch (keyFormat) { @@ -794,8 +817,13 @@ async function encodeKey(privateKeyBytes, keyFormat, publicKeyBytes) { } } -// Helper to parse a private key into a Solana base58 private key. -// To be used if a wallet account is exported without the `SOLANA` address format. +/** + * Helper to parse a private key into a Solana base58 private key. + * To be used if a wallet account is exported without the `SOLANA` address format. + * + * @param {string | Array} privateKey + * @returns {Uint8Array} + */ function parsePrivateKey(privateKey) { if (Array.isArray(privateKey)) { return new Uint8Array(privateKey); @@ -829,7 +857,7 @@ function parsePrivateKey(privateKey) { * Function to validate and sanitize the styles object using the accepted map of style keys and values (as regular expressions). * Any invalid style throws an error. Returns an object of valid styles. * @param {Object} styles - * @param {HTMLElement} element - Optional element parameter (for import frame) + * @param {HTMLElement} [element] - Optional element parameter (for import frame) * @return {Object} */ function validateStyles(styles, element) { @@ -900,10 +928,10 @@ function validateStyles(styles, element) { export { setCryptoProvider, getSubtleCrypto, - isDoublyIframed, loadQuorumKey, loadTargetKey, initEmbeddedKey, + unsafeSkipDoubleIframeCheck, generateTargetKey, getEmbeddedKey, setEmbeddedKey, diff --git a/shared/turnkey-core.test.js b/shared/src/turnkey-core.test.ts similarity index 84% rename from shared/turnkey-core.test.js rename to shared/src/turnkey-core.test.ts index 6ed89885..0a38e76f 100644 --- a/shared/turnkey-core.test.js +++ b/shared/src/turnkey-core.test.ts @@ -7,77 +7,22 @@ import "@testing-library/jest-dom"; import * as crypto from "crypto"; import * as SharedTKHQ from "./turnkey-core.js"; -// Mock the TURNKEY_SIGNER_ENVIRONMENT replacement that webpack would do -const verifyEnclaveSignature = async function ( - enclaveQuorumPublic, - publicSignature, - signedData -) { - // Replace the template string with actual environment - const TURNKEY_SIGNERS_ENCLAVES = { - prod: "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", - preprod: - "04f3422b8afbe425d6ece77b8d2469954715a2ff273ab7ac89f1ed70e0a9325eaa1698b4351fd1b23734e65c0b6a86b62dd49d70b37c94606aac402cbd84353212", - }; - - const TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY = - TURNKEY_SIGNERS_ENCLAVES["prod"]; - - if (TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY === undefined) { - throw new Error( - "Configuration error: TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY is undefined" - ); - } - - if (enclaveQuorumPublic) { - if (enclaveQuorumPublic !== TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) { - throw new Error( - `enclave quorum public keys from client and bundle do not match. Client: ${TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY}. Bundle: ${enclaveQuorumPublic}.` - ); - } - } - - const encryptionQuorumPublicBuf = new Uint8Array( - SharedTKHQ.uint8arrayFromHexString(TURNKEY_SIGNER_ENCLAVE_QUORUM_PUBLIC_KEY) - ); - const quorumKey = await loadQuorumKey(encryptionQuorumPublicBuf); - if (!quorumKey) { - throw new Error("failed to load quorum key"); - } - - const publicSignatureBuf = SharedTKHQ.fromDerSignature(publicSignature); - const signedDataBuf = SharedTKHQ.uint8arrayFromHexString(signedData); - return await crypto.webcrypto.subtle.verify( - { name: "ECDSA", hash: "SHA-256" }, - quorumKey, - publicSignatureBuf, - signedDataBuf - ); -}; - -async function loadQuorumKey(quorumPublic) { - return await crypto.webcrypto.subtle.importKey( - "raw", - quorumPublic, - { - name: "ECDSA", - namedCurve: "P-256", - }, - true, - ["verify"] - ); -} +beforeAll(async () => { + Object.defineProperty(window, "TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", { + value: "prod", + }); -describe("Shared TKHQ Utilities", () => { - beforeEach(() => { - window.TextDecoder = global.TextDecoder; - window.TextEncoder = global.TextEncoder; - window.__TURNKEY_SIGNER_ENVIRONMENT__ = "prod"; + // Necessary for crypto to be available. + // See https://github.com/jsdom/jsdom/issues/1612 + Object.defineProperty(window, "crypto", { + value: crypto.webcrypto, + }); - global.crypto = crypto.webcrypto; - window.crypto = crypto.webcrypto; - SharedTKHQ.setCryptoProvider(crypto.webcrypto); + SharedTKHQ.setCryptoProvider(crypto.webcrypto); +}); +describe("Shared TKHQ Utilities", () => { + beforeEach(() => { window.localStorage.clear(); }); @@ -85,7 +30,7 @@ describe("Shared TKHQ Utilities", () => { it("gets and sets items with expiry localStorage", async () => { // Set a TTL of 1000ms SharedTKHQ.setItemWithExpiry("k", "v", 1000); - let item = JSON.parse(window.localStorage.getItem("k")); + let item = JSON.parse(window.localStorage.getItem("k")!); expect(item.value).toBe("v"); expect(item.expiry).toBeTruthy(); @@ -96,7 +41,7 @@ describe("Shared TKHQ Utilities", () => { // Test expired item: use setItemWithExpiry, then manually set expiry in the past SharedTKHQ.setItemWithExpiry("a", "b", 500); // Verify the item was set correctly with setItemWithExpiry - let itemA = JSON.parse(window.localStorage.getItem("a")); + let itemA = JSON.parse(window.localStorage.getItem("a")!); expect(itemA.value).toBe("b"); expect(itemA.expiry).toBeTruthy(); @@ -121,8 +66,8 @@ describe("Shared TKHQ Utilities", () => { expect(SharedTKHQ.getTargetEmbeddedKey()).toBe(null); // Set a dummy "key" - SharedTKHQ.setTargetEmbeddedKey({ foo: "bar" }); - expect(SharedTKHQ.getTargetEmbeddedKey()).toEqual({ foo: "bar" }); + SharedTKHQ.setTargetEmbeddedKey({ alg: "bar" }); + expect(SharedTKHQ.getTargetEmbeddedKey()).toEqual({ alg: "bar" }); // Reset it SharedTKHQ.resetTargetEmbeddedKey(); @@ -238,8 +183,8 @@ describe("Shared TKHQ Utilities", () => { SharedTKHQ.uint8arrayFromHexString("627566666572").toString() ).toEqual("98,117,102,102,101,114"); - // Error case: bad value expect(() => { + // @ts-expect-error Error case: bad value SharedTKHQ.uint8arrayFromHexString({}); }).toThrow("cannot create uint8array from invalid hex string"); // Error case: empty string @@ -327,8 +272,8 @@ describe("Shared TKHQ Utilities", () => { SharedTKHQ.parsePrivateKey("invalid-key"); }).toThrow("Invalid private key format"); - // Error case: invalid type expect(() => { + // @ts-expect-error Error case: invalid type SharedTKHQ.parsePrivateKey(12345); }).toThrow("Private key must be a string"); }); @@ -407,7 +352,7 @@ describe("Shared TKHQ Utilities", () => { describe("Enclave signature verification", () => { it("verifies enclave signature", async () => { // Valid signature - let verified = await verifyEnclaveSignature( + let verified = await SharedTKHQ.verifyEnclaveSignature( "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04e479640d6d3487bbf132f6258ee24073411b8325ea68bb28883e45b650d059f82c48db965b8f777b30ab9e7810826bfbe8ad1789f9f10bf76dcd36b2ee399bc5" @@ -415,7 +360,7 @@ describe("Shared TKHQ Utilities", () => { expect(verified).toBe(true); // Invalid signature - verified = await verifyEnclaveSignature( + verified = await SharedTKHQ.verifyEnclaveSignature( "04cf288fe433cc4e1aa0ce1632feac4ea26bf2f5a09dcfe5a42c398e06898710330f0572882f4dbdf0f5304b8fc8703acd69adca9a4bbf7f5d00d20a5e364b2569", "30440220773382ac39085f58a584fd5ad8c8b91b50993ad480af2c5eaefe0b09447b6dca02205201c8e20a92bce524caac08a956b0c2e7447de9c68f91ab1e09fd58988041b5", "04d32d8e0fe5a401a717971fabfabe02ddb6bea39b72a18a415fc0273579b394650aae97f75b0462ffa8880a1899c7a930569974519685a995d2e74e372e105bf4" diff --git a/shared/tsconfig.json b/shared/tsconfig.json new file mode 100644 index 00000000..5bcfee4d --- /dev/null +++ b/shared/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../tsconfig.base.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": ".", + "tsBuildInfoFile": "./.cache/.tsbuildinfo" + }, + "include": ["src/**/*.ts", "src/**/*.js", "*.ts"], + "exclude": ["dist", "node_modules", ".rollup.cache"] +} diff --git a/tsconfig.base.json b/tsconfig.base.json new file mode 100644 index 00000000..a30c918e --- /dev/null +++ b/tsconfig.base.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "composite": true, + "declaration": true, + "declarationMap": true, + "incremental": true, + "isolatedModules": true, + "resolveJsonModule": true, + "sourceMap": true, + "target": "ESNext", + "lib": ["ESNext", "DOM"], + "module": "esnext", + "moduleResolution": "bundler", + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "allowJs": true + } +} diff --git a/turbo.json b/turbo.json new file mode 100644 index 00000000..48e369f7 --- /dev/null +++ b/turbo.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://turborepo.dev/schema.json", + "tasks": { + "build": { + "inputs": ["src/**", "webpack.config.js", "package.json", "tsconfig.json"], + "dependsOn": ["^build", "lint", "prettier:write"], + "env": ["TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", "TURNKEY_E2E_TEST"], + "outputs": [ + "dist/**" + ] + }, + "clean": { + "cache": false + }, + "lint": { + "inputs": ["**/*.js", "**/*.ts", "!dist", ".eslintrc.json", ".eslintignore", "$TURBO_ROOT$/.eslintrc.js", "$TURBO_ROOT$/.eslintignore"] + }, + "prettier:check": { + "inputs": ["**/*.{css,html,js,json,md,ts,tsx,yaml,yml}"], + "outputs": [] + }, + "prettier:write": { + "inputs": ["**/*.{css,html,js,json,md,ts,tsx,yaml,yml}"] + }, + "test": { + "dependsOn": ["^build"], + "cache": false + }, + "dev": { + "persistent": true, + "cache": false, + "dependsOn": ["^build"], + "env": ["TURNKEY_SIGNER_ENVIRONMENT_OVERRIDE", "TURNKEY_E2E_TEST"] + }, + "start": { + "persistent": true, + "cache": false, + "dependsOn": ["build"] + } + }, + "globalDependencies": [ + "pnpm-workspace.yaml", + "rollup.config.base.mjs" + ], + "globalPassThroughEnv": [ + "ORGANIZATION_ID", + "API_PUBLIC_KEY", + "API_PRIVATE_KEY", + "BASE_URL" + ] +}