miawrouter 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/app/.next-cli-build/BUILD_ID +1 -1
- package/app/.next-cli-build/app-path-routes-manifest.json +9 -9
- package/app/.next-cli-build/build-manifest.json +2 -2
- package/app/.next-cli-build/prerender-manifest.json +3 -3
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/a2a/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/a2a/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/activity/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/activity/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/agent-skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-endpoints/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/api-endpoints/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/basic-chat/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/batch/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/batch/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cache/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cache/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/[toolId]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cli-tools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cloud-agents/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/cloud-agents/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/combos/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/console-log/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/costs/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/costs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/discovery/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/discovery/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/endpoint/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/free-provider-rankings/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/free-provider-rankings/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/free-tiers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/free-tiers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/guardrails/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/guardrails/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/health/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/logs/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mcp/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/[kind]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/combo/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/media-providers/web/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/memory/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/memory/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/mitm/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/playground/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/privacy/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/privacy/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/profile/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-stats/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/provider-stats/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/[id]/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/new/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/providers/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/proxy-pools/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/pxpipe/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/quota/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/runtime/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/runtime/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/feature-flags/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/feature-flags/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/settings/pricing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skill-discovery/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skill-discovery/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/skills/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/token-saver/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/translator/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/usage/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/webhooks/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/(dashboard)/dashboard/webhooks/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/.well-known/agent.json/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_global-error.html +1 -1
- package/app/.next-cli-build/server/app/_global-error.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/app/.next-cli-build/server/app/_not-found/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/_not-found.html +1 -1
- package/app/.next-cli-build/server/app/_not-found.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/api/a2a/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/a2a/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agents/[id]/actions/route.js +1 -1
- package/app/.next-cli-build/server/app/api/agents/[id]/actions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/agents/route.js +1 -1
- package/app/.next-cli-build/server/app/api/agents/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/logout/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/callback/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/oidc/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/reset-password/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/auth/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batch/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/[id]/cancel/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/[id]/errors/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/[id]/results/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/[id]/retry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/batches/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cache/clear/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cache/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/catalog/opencode/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js +5 -5
- package/app/.next-cli-build/server/app/api/cli-tools/all-statuses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/antigravity-mitm/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/claude-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cline-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/codex-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/copilot-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-registry/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-mcp-tools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/cowork-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js +3 -3
- package/app/.next-cli-build/server/app/api/cli-tools/deepseek-tui-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/devin-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/droid-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/grok-build-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/hermes-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/jcode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/kilo-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/oh-my-pi-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/oh-my-pi-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/openclaw-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js +2 -2
- package/app/.next-cli-build/server/app/api/cli-tools/opencode-settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/subagents/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cli-tools/subagents/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/cloud-agents/status/route.js +1 -1
- package/app/.next-cli-build/server/app/api/cloud-agents/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/combos/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/dashboard/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/discovery/endpoints/route.js +1 -1
- package/app/.next-cli-build/server/app/api/discovery/endpoints/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/discovery/route.js +1 -1
- package/app/.next-cli-build/server/app/api/discovery/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/discovery/skills/route.js +1 -1
- package/app/.next-cli-build/server/app/api/discovery/skills/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/events/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/extras/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/proxy/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/headroom/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/hermes/autonomy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/init/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/keys/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/locale/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/message/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/[plugin]/sse/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/route.js +1 -1
- package/app/.next-cli-build/server/app/api/mcp/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/mcp/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/deepgram/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/elevenlabs/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/inworld/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/minimax/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/media-providers/tts/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/memory/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/memory/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/memory/reindex/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/memory/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/memory/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/metrics/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/alias/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/availability/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/custom/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/disabled/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/models/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/[provider]/[action]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/bulk-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js +1 -1
- package/app/.next-cli-build/server/app/api/oauth/codex/import-token/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/cursor/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/gitlab/pat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/iflow/cookie/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/api-key/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/auto-import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/import-cli-proxy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-authorize/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/oauth/kiro/social-exchange/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pricing/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/provider-nodes/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/export/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/onboard/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/onboard/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/[id]/test-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js +1 -1
- package/app/.next-cli-build/server/app/api/providers/client/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/kilo/free-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/suggested-models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/test-batch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/providers/validate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/[id]/test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/cloudflare-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/deno-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js +1 -1
- package/app/.next-cli-build/server/app/api/proxy-pools/vercel-deploy/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/health/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/restart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/start/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/pxpipe/stop/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/saver/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/database/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/proxy-test/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/require-login/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/settings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skill-discovery/[id]/install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skill-discovery/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skill-discovery/[id]/uninstall/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skill-discovery/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/skill-discovery/sync/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tags/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/console-logs/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/load/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/save/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/send/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js +1 -1
- package/app/.next-cli-build/server/app/api/translator/translate/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/status/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-check/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-disable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-enable/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js +2 -2
- package/app/.next-cli-build/server/app/api/tunnel/tailscale-install/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/codex-reset-credits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/[connectionId]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/chart/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/history/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/local-snapshot/route.js +1 -1
- package/app/.next-cli-build/server/app/api/usage/local-snapshot/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/providers/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-details/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/request-logs/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stats/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/usage/stream/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/api/chat/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/speech/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/transcriptions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/audio/voices/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/chat/completions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/embeddings/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/images/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/count_tokens/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/messages/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/[kind]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/info/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/compact/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/responses/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/search/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/edits/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/extensions/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/videos/generations/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js +1 -1
- package/app/.next-cli-build/server/app/api/v1/web/fetch/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/[...path]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/v1beta/models/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js +1 -1
- package/app/.next-cli-build/server/app/api/version/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/shutdown/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/version/update/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/webhooks/[id]/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/webhooks/events/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/api/webhooks/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/callback/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/callback.html +1 -1
- package/app/.next-cli-build/server/app/callback.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/callback.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/callback.segments/callback/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/dashboard/a2a.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/a2a.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/a2a.segments/!KGRhc2hib2FyZCk/dashboard/a2a/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/a2a.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/a2a.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/activity.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/activity.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/activity.segments/!KGRhc2hib2FyZCk/dashboard/activity/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/activity.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/activity.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/agent-skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/agent-skills.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/agent-skills.segments/!KGRhc2hib2FyZCk/dashboard/agent-skills/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/agent-skills.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/agent-skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/api-endpoints.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/api-endpoints.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/api-endpoints.segments/!KGRhc2hib2FyZCk/dashboard/api-endpoints/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/api-endpoints.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/api-endpoints.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/basic-chat.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/basic-chat.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/!KGRhc2hib2FyZCk/dashboard/basic-chat/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/basic-chat.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/batch.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/batch.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/batch.segments/!KGRhc2hib2FyZCk/dashboard/batch/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/batch.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/batch.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cache.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cache.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cache.segments/!KGRhc2hib2FyZCk/dashboard/cache/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cache.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cache.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cli-tools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cli-tools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/!KGRhc2hib2FyZCk/dashboard/cli-tools/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cli-tools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/cloud-agents.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/cloud-agents.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cloud-agents.segments/!KGRhc2hib2FyZCk/dashboard/cloud-agents/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cloud-agents.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/cloud-agents.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/combos.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/combos.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/!KGRhc2hib2FyZCk/dashboard/combos/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/combos.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/costs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/costs.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/costs.segments/!KGRhc2hib2FyZCk/dashboard/costs/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/costs.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/costs.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/discovery.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/discovery.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/discovery.segments/!KGRhc2hib2FyZCk/dashboard/discovery/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/discovery.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/discovery.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/endpoint.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/endpoint.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/!KGRhc2hib2FyZCk/dashboard/endpoint/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/endpoint.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/free-provider-rankings.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/free-provider-rankings.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-provider-rankings.segments/!KGRhc2hib2FyZCk/dashboard/free-provider-rankings/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-provider-rankings.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-provider-rankings.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/free-tiers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/free-tiers.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-tiers.segments/!KGRhc2hib2FyZCk/dashboard/free-tiers/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-tiers.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/free-tiers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/guardrails.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/guardrails.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/guardrails.segments/!KGRhc2hib2FyZCk/dashboard/guardrails/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/guardrails.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/guardrails.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/health.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/health.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/health.segments/!KGRhc2hib2FyZCk/dashboard/health/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/health.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/health.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/logs.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/logs.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/!KGRhc2hib2FyZCk/dashboard/logs/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/logs.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mcp.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mcp.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mcp.segments/!KGRhc2hib2FyZCk/dashboard/mcp/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mcp.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mcp.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/!KGRhc2hib2FyZCk/dashboard/media-providers/web/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/media-providers/web.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/memory.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/memory.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/memory.segments/!KGRhc2hib2FyZCk/dashboard/memory/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/memory.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/memory.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/mitm.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/mitm.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/!KGRhc2hib2FyZCk/dashboard/mitm/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/mitm.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/playground.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/playground.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/playground.segments/!KGRhc2hib2FyZCk/dashboard/playground/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/playground.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/playground.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/privacy.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/privacy.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/privacy.segments/!KGRhc2hib2FyZCk/dashboard/privacy/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/privacy.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/privacy.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/profile.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/profile.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/!KGRhc2hib2FyZCk/dashboard/profile/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/profile.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/provider-stats.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/provider-stats.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-stats.segments/!KGRhc2hib2FyZCk/dashboard/provider-stats/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-stats.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/provider-stats.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers/new.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers/new.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/!KGRhc2hib2FyZCk/dashboard/providers/new/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers/new.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/providers.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/providers.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/!KGRhc2hib2FyZCk/dashboard/providers/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/providers.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/!KGRhc2hib2FyZCk/dashboard/proxy-pools/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/proxy-pools.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/pxpipe.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/pxpipe.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/!KGRhc2hib2FyZCk/dashboard/pxpipe/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/pxpipe.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.html +2 -2
- package/app/.next-cli-build/server/app/dashboard/quota.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/!KGRhc2hib2FyZCk/dashboard/quota/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/quota.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/runtime.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/runtime.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/runtime.segments/!KGRhc2hib2FyZCk/dashboard/runtime/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/runtime.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/runtime.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/feature-flags.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/feature-flags.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/feature-flags.segments/!KGRhc2hib2FyZCk/dashboard/settings/feature-flags/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/feature-flags.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/feature-flags.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/!KGRhc2hib2FyZCk/dashboard/settings/pricing/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/settings/pricing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skill-discovery.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skill-discovery.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skill-discovery.segments/!KGRhc2hib2FyZCk/dashboard/skill-discovery/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skill-discovery.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skill-discovery.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/skills.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/skills.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/!KGRhc2hib2FyZCk/dashboard/skills/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/skills.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/token-saver.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/token-saver.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/!KGRhc2hib2FyZCk/dashboard/token-saver/__PAGE__.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_full.segment.rsc +8 -8
- package/app/.next-cli-build/server/app/dashboard/token-saver.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/translator.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/translator.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/!KGRhc2hib2FyZCk/dashboard/translator/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/translator.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/usage.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/usage.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/!KGRhc2hib2FyZCk/dashboard/usage/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/usage.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard/webhooks.html +1 -1
- package/app/.next-cli-build/server/app/dashboard/webhooks.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/webhooks.segments/!KGRhc2hib2FyZCk/dashboard/webhooks/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/webhooks.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard/webhooks.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/dashboard.html +1 -1
- package/app/.next-cli-build/server/app/dashboard.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/!KGRhc2hib2FyZCk/dashboard/__PAGE__.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/_full.segment.rsc +7 -7
- package/app/.next-cli-build/server/app/dashboard.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/favicon.ico/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/index.html +1 -1
- package/app/.next-cli-build/server/app/index.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/index.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/landing/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/landing.html +1 -1
- package/app/.next-cli-build/server/app/landing.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_full.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/landing.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/landing.segments/landing/__PAGE__.segment.rsc +5 -5
- package/app/.next-cli-build/server/app/login/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/login/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app/login.html +1 -1
- package/app/.next-cli-build/server/app/login.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_full.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/login.segments/_tree.segment.rsc +2 -2
- package/app/.next-cli-build/server/app/login.segments/login/__PAGE__.segment.rsc +6 -6
- package/app/.next-cli-build/server/app/manifest.webmanifest/route.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page.js.nft.json +1 -1
- package/app/.next-cli-build/server/app/page_client-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/app-paths-manifest.json +9 -9
- package/app/.next-cli-build/server/chunks/112.js +1 -1
- package/app/.next-cli-build/server/chunks/2638.js +1 -1
- package/app/.next-cli-build/server/chunks/2813.js +1 -1
- package/app/.next-cli-build/server/chunks/2974.js +1 -1
- package/app/.next-cli-build/server/chunks/318.js +1 -1
- package/app/.next-cli-build/server/chunks/3755.js +1 -1
- package/app/.next-cli-build/server/chunks/4037.js +1 -1
- package/app/.next-cli-build/server/chunks/4303.js +1 -1
- package/app/.next-cli-build/server/chunks/5243.js +1 -1
- package/app/.next-cli-build/server/chunks/5731.js +1 -1
- package/app/.next-cli-build/server/chunks/6270.js +1 -1
- package/app/.next-cli-build/server/chunks/6664.js +1 -1
- package/app/.next-cli-build/server/chunks/7403.js +1 -1
- package/app/.next-cli-build/server/chunks/772.js +1 -1
- package/app/.next-cli-build/server/chunks/{4018.js → 7937.js} +5 -5
- package/app/.next-cli-build/server/chunks/8499.js +1 -1
- package/app/.next-cli-build/server/chunks/8537.js +1 -1
- package/app/.next-cli-build/server/chunks/862.js +1 -1
- package/app/.next-cli-build/server/chunks/869.js +1 -1
- package/app/.next-cli-build/server/chunks/8750.js +1 -1
- package/app/.next-cli-build/server/instrumentation.js.nft.json +1 -1
- package/app/.next-cli-build/server/middleware-build-manifest.js +1 -1
- package/app/.next-cli-build/server/middleware.js +4 -4
- package/app/.next-cli-build/server/middleware.js.nft.json +1 -1
- package/app/.next-cli-build/server/pages/404.html +1 -1
- package/app/.next-cli-build/server/pages/500.html +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.js +1 -1
- package/app/.next-cli-build/server/server-reference-manifest.json +1 -1
- package/app/.next-cli-build/static/chunks/{1321-b974e2c6d758f2eb.js → 1321-6b997794bb843da8.js} +1 -1
- package/app/.next-cli-build/static/chunks/{7780-8fef40eb7ea5a323.js → 7780-f3508723257e47c1.js} +1 -1
- package/app/.next-cli-build/static/chunks/app/(dashboard)/dashboard/cli-tools/{page-8f34a6d3a99ebd37.js → page-f7cbd07558c7b42e.js} +1 -1
- package/app/.next-cli-build/static/css/01b1ec05918332c3.css +1 -0
- package/app/package.json +79 -78
- package/app/src/mitm/server.js +40 -42
- package/cli.js +10 -0
- package/hooks/opencodeBridgeRuntime.js +77 -0
- package/hooks/sqliteRuntime.js +156 -156
- package/hooks/trayRuntime.js +107 -107
- package/package.json +49 -49
- package/vendor/opencode-free-bridge/LICENSE +21 -0
- package/vendor/opencode-free-bridge/README.md +762 -0
- package/vendor/opencode-free-bridge/THIRD_PARTY_NOTICES.md +33 -0
- package/vendor/opencode-free-bridge/UPSTREAM_COMMIT +1 -0
- package/vendor/opencode-free-bridge/identity.js +2624 -0
- package/vendor/opencode-free-bridge/package.json +54 -0
- package/vendor/opencode-free-bridge/panel.js +515 -0
- package/vendor/opencode-free-bridge/proxy.js +980 -0
- package/vendor/opencode-free-bridge/server.js +3357 -0
- package/vendor/opencode-free-bridge/token-budget.js +107 -0
- package/vendor/opencode-free-bridge/transport-baseline.json +39 -0
- package/app/.next-cli-build/static/css/8ba5c8dbc4e30aa0.css +0 -1
- /package/app/.next-cli-build/static/{X4uxXfKI78mMCnlqFsTAr → DryEkcB2pIbzN1YYgNcUS}/_buildManifest.js +0 -0
- /package/app/.next-cli-build/static/{X4uxXfKI78mMCnlqFsTAr → DryEkcB2pIbzN1YYgNcUS}/_ssgManifest.js +0 -0
package/app/src/mitm/server.js
CHANGED
|
@@ -1,64 +1,62 @@
|
|
|
1
|
-
var F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ur=F((Dp,oi)=>{var Gu=require("fs"),Yr=require("path"),ni=require("os"),Fa="miawrouter";function ii(){return process.platform==="win32"?Yr.join(process.env.APPDATA||Yr.join(ni.homedir(),"AppData","Roaming"),Fa):Yr.join(ni.homedir(),`.${Fa}`)}function zu(){let e=process.env.DATA_DIR;if(!e)return ii();try{return Gu.mkdirSync(e,{recursive:!0}),e}catch(t){if(t?.code==="EACCES"||t?.code==="EPERM")return console.warn(`[DATA_DIR] '${e}' not writable \u2192 fallback ~/.${Fa}`),ii();throw t}}var si=zu(),Qu=Yr.join(si,"mitm");oi.exports={DATA_DIR:si,MITM_DIR:Qu}});var br=F((Up,ci)=>{var ui=require("fs"),$u=process.env.NODE_ENV==="development",ju=(()=>{if(process.platform==="win32")return null;for(let e of["/usr/sbin/lsof","/usr/bin/lsof","/sbin/lsof"])try{return ui.accessSync(e,ui.constants.X_OK),e}catch{}return"lsof"})(),Yu=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com","runtime.us-east-1.kiro.dev","api2.cursor.sh","agent.api5.cursor.sh","agentn.api5.cursor.sh","agent.us.api5.cursor.sh","agentn.us.api5.cursor.sh","agent.global.api5.cursor.sh","agentn.global.api5.cursor.sh","cli-chat-proxy.grok.com","apis.iflow.cn"],Wu={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"],"grok-cli":["/responses"],iflow:["/chat/completions"]},Xu={antigravity:{"gemini-default":"gemini-3.8-flash-medium","gemini-3.8-flash":"gemini-3.8-flash-high","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-3.7-flash":"gemini-3.7-flash-high","gemini-3.7-flash-high":"gemini-3.7-flash-high","gemini-3.7-flash-medium":"gemini-3.7-flash-medium","gemini-3.7-flash-low":"gemini-3.7-flash-low","gemini-3.5-flash-high":"gemini-3-flash-agent","gemini-3.5-flash-medium":"gemini-3.5-flash-low","gemini-3.5-flash-extra-low":"gemini-3.5-flash-extra-low","gemini-3.1-pro-high":"gemini-pro-agent","gemini-3-pro-high":"gemini-pro-agent","gemini-3-pro-low":"gemini-3.1-pro-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-opus-5-5-thinking":"claude-opus-5-5"}},Ju={antigravity:[{match:/^gemini-3\.8-flash-tiered\(medium\)$/i,alias:"gemini-3.8-flash-medium"},{match:/^gemini-3\.8-flash-tiered\(low\)$/i,alias:"gemini-3.8-flash-low"},{match:/^gemini-3\.8-flash-tiered\(high\)$/i,alias:"gemini-3.8-flash-high"},{match:/gemini-3\.8/i,alias:"gemini-3.8-flash-high"},{match:/^gemini-3\.7-flash-tiered\(medium\)$/i,alias:"gemini-3.7-flash-medium"},{match:/^gemini-3\.7-flash-tiered\(low\)$/i,alias:"gemini-3.7-flash-low"},{match:/^gemini-3\.7-flash-tiered\(high\)$/i,alias:"gemini-3.7-flash-high"},{match:/gemini-3\.7/i,alias:"gemini-3.7-flash-high"},{match:/flash.*extra.*low|extra.*low.*flash|flash.*low|low.*flash/i,alias:"gemini-3.5-flash-extra-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.5-flash-low"},{match:/flash.*agent|agent.*flash|flash/i,alias:"gemini-3-flash-agent"},{match:/pro.*low|low.*pro/i,alias:"gemini-3.1-pro-low"},{match:/gemini.*pro|pro.*gemini/i,alias:"gemini-pro-agent"},{match:/claude[-.]opus[-.]5[-.]5/i,alias:"claude-opus-5-5"},{match:/claude[-.]sonnet[-.]5[-.]5/i,alias:"claude-sonnet-5-5"},{match:/^(?!.*5[-.]5).*opus/i,alias:"claude-opus-4-6-thinking"},{match:/^(?!.*5[-.]5).*(?:sonnet|claude)/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"}]},Zu={antigravity:[/^tab[_-]/i]},ec=["recordCodeAssistMetrics","recordTrajectoryAnalytics","fetchAdminControls","listExperiments","fetchUserInfo"];function tc(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"||t==="codewhisperer.us-east-1.amazonaws.com"||t==="runtime.us-east-1.kiro.dev"?"kiro":t==="api2.cursor.sh"||/^agentn?(?:\.(?:us|global))?\.api5\.cursor\.sh$/.test(t)?"cursor":t==="cli-chat-proxy.grok.com"?"grok-cli":t==="apis.iflow.cn"?"iflow":null}function rc(e){if(!e||e.length===0)return!1;let t=e.slice(0,Math.min(100,e.length)),a=0;for(let r=0;r<t.length;r++){let n=t[r];n<32&&n!==9&&n!==10&&n!==13&&a++,n>126&&a++}return a/t.length>.3}function ac(e,t){let r=e.match(/\/models\/([^/:]+)/)?.[1]||null;if(rc(t))return r;try{let n=JSON.parse(t.toString());if(n.conversationState)return n.conversationState.currentMessage?.userInputMessage?.modelId||null;let
|
|
1
|
+
var F=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ur=F((Dp,oi)=>{var Gu=require("fs"),Yr=require("path"),ni=require("os"),Fa="miawrouter";function ii(){return process.platform==="win32"?Yr.join(process.env.APPDATA||Yr.join(ni.homedir(),"AppData","Roaming"),Fa):Yr.join(ni.homedir(),`.${Fa}`)}function zu(){let e=process.env.DATA_DIR;if(!e)return ii();try{return Gu.mkdirSync(e,{recursive:!0}),e}catch(t){if(t?.code==="EACCES"||t?.code==="EPERM")return console.warn(`[DATA_DIR] '${e}' not writable \u2192 fallback ~/.${Fa}`),ii();throw t}}var si=zu(),Qu=Yr.join(si,"mitm");oi.exports={DATA_DIR:si,MITM_DIR:Qu}});var br=F((Up,ci)=>{var ui=require("fs"),$u=process.env.NODE_ENV==="development",ju=(()=>{if(process.platform==="win32")return null;for(let e of["/usr/sbin/lsof","/usr/bin/lsof","/sbin/lsof"])try{return ui.accessSync(e,ui.constants.X_OK),e}catch{}return"lsof"})(),Yu=["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com","api.individual.githubcopilot.com","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com","runtime.us-east-1.kiro.dev","api2.cursor.sh","agent.api5.cursor.sh","agentn.api5.cursor.sh","agent.us.api5.cursor.sh","agentn.us.api5.cursor.sh","agent.global.api5.cursor.sh","agentn.global.api5.cursor.sh","cli-chat-proxy.grok.com","apis.iflow.cn"],Wu={antigravity:[":generateContent",":streamGenerateContent"],copilot:["/chat/completions","/v1/messages","/responses"],kiro:["/generateAssistantResponse"],cursor:["/BidiAppend","/RunSSE","/RunPoll","/Run"],"grok-cli":["/responses"],iflow:["/chat/completions"]},Xu={antigravity:{"gemini-4-argon":"gemini-4-argon-high","gemini-default":"gemini-3.8-flash-medium","gemini-3.8-flash":"gemini-3.8-flash-high","gemini-3.8-flash-high":"gemini-3.8-flash-high","gemini-3.8-flash-medium":"gemini-3.8-flash-medium","gemini-3.8-flash-low":"gemini-3.8-flash-low","gemini-3.7-flash":"gemini-3.7-flash-high","gemini-3.7-flash-high":"gemini-3.7-flash-high","gemini-3.7-flash-medium":"gemini-3.7-flash-medium","gemini-3.7-flash-low":"gemini-3.7-flash-low","gemini-3.5-flash-high":"gemini-3-flash-agent","gemini-3.5-flash-medium":"gemini-3.5-flash-low","gemini-3.5-flash-extra-low":"gemini-3.5-flash-extra-low","gemini-3.1-pro-high":"gemini-pro-agent","gemini-3-pro-high":"gemini-pro-agent","gemini-3-pro-low":"gemini-3.1-pro-low","claude-sonnet-5-5-thinking":"claude-sonnet-5-5","claude-opus-5-5-thinking":"claude-opus-5-5"}},Ju={antigravity:[{match:/^gemini-3\.8-flash-tiered\(medium\)$/i,alias:"gemini-3.8-flash-medium"},{match:/^gemini-3\.8-flash-tiered\(low\)$/i,alias:"gemini-3.8-flash-low"},{match:/^gemini-3\.8-flash-tiered\(high\)$/i,alias:"gemini-3.8-flash-high"},{match:/gemini-3\.8/i,alias:"gemini-3.8-flash-high"},{match:/^gemini-3\.7-flash-tiered\(medium\)$/i,alias:"gemini-3.7-flash-medium"},{match:/^gemini-3\.7-flash-tiered\(low\)$/i,alias:"gemini-3.7-flash-low"},{match:/^gemini-3\.7-flash-tiered\(high\)$/i,alias:"gemini-3.7-flash-high"},{match:/gemini-3\.7/i,alias:"gemini-3.7-flash-high"},{match:/flash.*extra.*low|extra.*low.*flash|flash.*low|low.*flash/i,alias:"gemini-3.5-flash-extra-low"},{match:/flash.*medium|medium.*flash/i,alias:"gemini-3.5-flash-low"},{match:/flash.*agent|agent.*flash|flash/i,alias:"gemini-3-flash-agent"},{match:/pro.*low|low.*pro/i,alias:"gemini-3.1-pro-low"},{match:/gemini.*pro|pro.*gemini/i,alias:"gemini-pro-agent"},{match:/claude[-.]opus[-.]5[-.]5/i,alias:"claude-opus-5-5"},{match:/claude[-.]sonnet[-.]5[-.]5/i,alias:"claude-sonnet-5-5"},{match:/^(?!.*5[-.]5).*opus/i,alias:"claude-opus-4-6-thinking"},{match:/^(?!.*5[-.]5).*(?:sonnet|claude)/i,alias:"claude-sonnet-4-6"},{match:/gpt.*oss|oss/i,alias:"gpt-oss-120b-medium"}]},Zu={antigravity:[/^tab[_-]/i]},ec=["recordCodeAssistMetrics","recordTrajectoryAnalytics","fetchAdminControls","listExperiments","fetchUserInfo"];function tc(e){let t=(e||"").split(":")[0];return t==="api.individual.githubcopilot.com"?"copilot":t==="daily-cloudcode-pa.googleapis.com"||t==="cloudcode-pa.googleapis.com"?"antigravity":t==="q.us-east-1.amazonaws.com"||t==="codewhisperer.us-east-1.amazonaws.com"||t==="runtime.us-east-1.kiro.dev"?"kiro":t==="api2.cursor.sh"||/^agentn?(?:\.(?:us|global))?\.api5\.cursor\.sh$/.test(t)?"cursor":t==="cli-chat-proxy.grok.com"?"grok-cli":t==="apis.iflow.cn"?"iflow":null}function rc(e){if(!e||e.length===0)return!1;let t=e.slice(0,Math.min(100,e.length)),a=0;for(let r=0;r<t.length;r++){let n=t[r];n<32&&n!==9&&n!==10&&n!==13&&a++,n>126&&a++}return a/t.length>.3}function ac(e,t){let r=e.match(/\/models\/([^/:]+)/)?.[1]||null;if(rc(t))return r;try{let n=JSON.parse(t.toString());if(n.conversationState)return n.conversationState.currentMessage?.userInputMessage?.modelId||null;let i=r||n.model||null,s=String(i).replace(/^models\//,"").match(/^gemini-(3\.6|3\.7|3\.8)-flash-tiered$/);if(s){let o=n.request?.generationConfig?.thinkingConfig?.thinkingLevel||n.generationConfig?.thinkingConfig?.thinkingLevel,u=["high","medium","low"].includes(String(o).toLowerCase())?String(o).toLowerCase():"medium";return`gemini-${s[1]}-flash-${u}`}return i}catch{return r}}ci.exports={IS_DEV:$u,LSOF_BIN:ju,TARGET_HOSTS:Yu,URL_PATTERNS:Wu,MODEL_SYNONYMS:Xu,MODEL_PATTERNS:Ju,MODEL_NO_MAP:Zu,LOG_BLACKLIST_URL_PARTS:ec,getToolForHost:tc,extractModel:ac}});var Dt=F((Pp,vi)=>{var ht=require("fs"),cr=require("path"),Ma=require("zlib"),nc=require("crypto"),{DATA_DIR:hi}=ur(),{LOG_BLACKLIST_URL_PARTS:ic}=br();function pi(){return new Date().toLocaleTimeString("en-US",{hour12:!1})}var sc=e=>console.log(`[${pi()}] [MITM] ${e}`),oc=e=>console.error(`[${pi()}] \u274C [MITM] ${e}`),Yt=cr.join(hi,"logs","mitm");ht.existsSync(Yt)||ht.mkdirSync(Yt,{recursive:!0});function uc(){try{if(!ht.existsSync(Yt))return;for(let e of ht.readdirSync(Yt))try{ht.rmSync(cr.join(Yt,e),{recursive:!0,force:!0})}catch{}}catch{}}var cc=/^\s*(\{\s*\}|\[\s*\]|null)?\s*$/;function gi(e,t=80){return String(e).replace(/[^a-zA-Z0-9]/g,"_").substring(0,t)}function yi(e){return e?ic.some(t=>e.includes(t)):!1}function lc(e,t){if(!e||e.length===0)return e;try{let a=(t||"").toLowerCase();if(a.includes("gzip"))return Ma.gunzipSync(e);if(a.includes("br"))return Ma.brotliDecompressSync(e);if(a.includes("deflate"))return Ma.inflateSync(e)}catch{}return e}function fc(e,t,a="raw"){if(yi(e.url))return null;try{let r=new Date().toISOString().replace(/[:.]/g,"-"),n=gi((e.headers.host||"")+e.url),i=cr.join(Yt,`${r}_${a}_${n}.req.json`),s=null;try{s=JSON.parse(t.toString())}catch{}return ht.writeFileSync(i,JSON.stringify({method:e.method,url:e.url,host:e.headers.host,headers:e.headers,body:s??t.toString("utf8")},null,2)),i}catch{return null}}function dc(e,t="raw"){if(yi(e.url))return null;let a=new Date().toISOString().replace(/[:.]/g,"-"),r=gi((e.headers.host||"")+e.url),n=cr.join(Yt,`${a}_${t}_${r}.res.txt`),i=0,s={},o=[];return{writeHeader:(u,c)=>{i=u,s=c||{}},writeChunk:u=>{u!=null&&o.push(Buffer.isBuffer(u)?u:Buffer.from(u))},end:()=>{try{let u=Buffer.concat(o),c=s["content-encoding"]||s["Content-Encoding"],f=lc(u,c).toString("utf8");if(cc.test(f))return;let p={...s};delete p["content-encoding"],delete p["Content-Encoding"];let v=`STATUS: ${i}
|
|
2
2
|
HEADERS: ${JSON.stringify(p,null,2)}
|
|
3
3
|
---BODY---
|
|
4
|
-
${f}`;ht.writeFileSync(n,v)}catch{}},file:n}}var hc=process.env.MITM_CURSOR_CAPTURE==="1",pc=process.env.MITM_CURSOR_CAPTURE_FULL==="1",li=cr.join(hi,"logs","mitm","cursor-capture"),fi=4*1024*1024,di=16*1024*1024;function gc(e){if(!e)return"";let t=e.indexOf("?");return t===-1?e:e.slice(0,t)}function yc(e){if(!hc)return null;let t=pc,a=new Date().toISOString().replace(/[:.]/g,"-"),r=`${Date.now().toString(36)}-${nc.randomBytes(8).toString("hex")}`,n=cr.join(li,`${a}_${r}`),
|
|
5
|
-
`)}return r};Ka.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=Ci[t];if(!a){a=Ci[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,s=t.charAt(0),i=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var u=0,c=o;u<i.length;++u)c+=i[u]*n,i[u]=c&255,c>>=8;for(;c>0;)i.push(c&255),c>>=8}for(var l=0;e[l]===s&&l<e.length-1;++l)i.push(0);return typeof Buffer<"u"?Buffer.from(i.reverse()):new Uint8Array(i.reverse())};function vc(e,t){var a=0,r=t.length,n=t.charAt(0),s=[0];for(a=0;a<e.length();++a){for(var i=0,o=e.at(a);i<s.length;++i)o+=s[i]<<8,s[i]=o%r,o=o/r|0;for(;o>0;)s.push(o%r),o=o/r|0}var u="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)u+=n;for(a=s.length-1;a>=0;--a)u+=t[s[a]];return u}});var ne=F((Fp,Ii)=>{var Si=$(),Ti=xi(),S=Ii.exports=Si.util=Si.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){S.nextTick=process.nextTick,typeof setImmediate=="function"?S.setImmediate=setImmediate:S.setImmediate=S.nextTick;return}if(typeof setImmediate=="function"){S.setImmediate=function(){return setImmediate.apply(void 0,arguments)},S.nextTick=function(o){return setImmediate(o)};return}if(S.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(u){if(u.source===window&&u.data===e){u.stopPropagation();var c=t.slice();t.length=0,c.forEach(function(l){l()})}};var i=o,e="forge.setImmediate",t=[];S.setImmediate=function(u){t.push(u),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,n=document.createElement("div"),t=[];new MutationObserver(function(){var u=t.slice();t.length=0,u.forEach(function(c){c()})}).observe(n,{attributes:!0});var s=S.setImmediate;S.setImmediate=function(u){Date.now()-a>15?(a=Date.now(),s(u)):(t.push(u),t.length===1&&n.setAttribute("a",r=!r))}}S.nextTick=S.setImmediate})();S.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;S.globalScope=(function(){return S.isNodejs?global:typeof self>"u"?window:self})();S.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};S.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};S.isArrayBufferView=function(e){return e&&S.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function wr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}S.ByteBuffer=qa;function qa(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(S.isArrayBuffer(e)||S.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof qa||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}S.ByteStringBuffer=qa;var mc=4096;S.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>mc&&(this.data.substr(0,1),this._constructedStringLength=0)};S.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};S.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};S.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};S.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};S.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};S.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(S.encodeUtf8(e))};S.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};S.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};S.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};S.ByteStringBuffer.prototype.putInt=function(e,t){wr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)};S.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};S.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};S.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};S.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};S.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e};S.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e};S.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};S.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e};S.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e};S.ByteStringBuffer.prototype.getInt=function(e){wr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};S.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};S.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};S.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};S.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};S.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this};S.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};S.ByteStringBuffer.prototype.copy=function(){var e=S.createBuffer(this.data);return e.read=this.read,e};S.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};S.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};S.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this};S.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e};S.ByteStringBuffer.prototype.toString=function(){return S.decodeUtf8(this.bytes())};function Cc(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=S.isArrayBuffer(e),r=S.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}S.DataBuffer=Cc;S.DataBuffer.prototype.length=function(){return this.write-this.read};S.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};S.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this};S.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};S.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this};S.DataBuffer.prototype.putBytes=function(e,t){if(S.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var n=new Uint8Array(this.data.buffer,this.write);return n.set(a),this.write+=r,this}if(S.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof S.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&S.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var n=new Uint8Array(e.data.byteLength,this.write);return n.set(a),this.write+=a.byteLength,this}if(e instanceof S.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var s;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),s=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.hex.decode(e,s,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),s=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.base64.decode(e,s,this.write),this;if(t==="utf8"&&(e=S.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),s=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.raw.decode(s),this;if(t==="utf16")return this.accommodate(e.length*2),s=new Uint16Array(this.data.buffer,this.write),this.write+=S.text.utf16.encode(s),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};S.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};S.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};S.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};S.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this};S.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};S.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};S.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this};S.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};S.DataBuffer.prototype.putInt=function(e,t){wr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};S.DataBuffer.prototype.putSignedInt=function(e,t){return wr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};S.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};S.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};S.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};S.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};S.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};S.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};S.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};S.DataBuffer.prototype.getInt=function(e){wr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};S.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};S.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};S.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};S.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};S.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};S.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};S.DataBuffer.prototype.copy=function(){return new S.DataBuffer(this)};S.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this};S.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};S.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};S.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e};S.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return S.binary.raw.encode(t);if(e==="hex")return S.binary.hex.encode(t);if(e==="base64")return S.binary.base64.encode(t);if(e==="utf8")return S.text.utf8.decode(t);if(e==="utf16")return S.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};S.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=S.encodeUtf8(e)),new S.ByteBuffer(e)};S.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a};S.xorBytes=function(e,t,a){for(var r="",n="",s="",i=0,o=0;a>0;--a,++i)n=e.charCodeAt(i)^t.charCodeAt(i),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(n),++o;return r+=s,r};S.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t};S.bytesToHex=function(e){return S.createBuffer(e).toHex()};S.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var Ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pt=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Ai="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";S.encode64=function(e,t){for(var a="",r="",n,s,i,o=0;o<e.length;)n=e.charCodeAt(o++),s=e.charCodeAt(o++),i=e.charCodeAt(o++),a+=Ut.charAt(n>>2),a+=Ut.charAt((n&3)<<4|s>>4),isNaN(s)?a+="==":(a+=Ut.charAt((s&15)<<2|i>>6),a+=isNaN(i)?"=":Ut.charAt(i&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
|
|
6
|
-
`,a=a.substr(t));return r+=a,r};S.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,s
|
|
7
|
-
`,a=a.substr(t));return r+=a,r};S.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var n,s,i,o,u=0,c=a;u<e.length;)n=Pt[e.charCodeAt(u++)-43],s=Pt[e.charCodeAt(u++)-43],i=Pt[e.charCodeAt(u++)-43],o=Pt[e.charCodeAt(u++)-43],r[c++]=n<<2|s>>4,i!==64&&(r[c++]=(s&15)<<4|i>>2,o!==64&&(r[c++]=(i&3)<<6|o));return t?c-a:r.subarray(0,c)};S.binary.base58.encode=function(e,t){return S.binary.baseN.encode(e,Ai,t)};S.binary.base58.decode=function(e,t){return S.binary.baseN.decode(e,Ai,t)};S.text={utf8:{},utf16:{}};S.text.utf8.encode=function(e,t,a){e=S.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,s=0;s<e.length;++s)r[n++]=e.charCodeAt(s);return t?n-a:r};S.text.utf8.decode=function(e){return S.decodeUtf8(String.fromCharCode.apply(null,e))};S.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var n=new Uint16Array(r.buffer);a=a||0;for(var s=a,i=a,o=0;o<e.length;++o)n[i++]=e.charCodeAt(o),s+=2;return t?s-a:r};S.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};S.deflate=function(e,t,a){if(t=S.decode64(e.deflate(S.encode64(t)).rval),a){var r=2,n=t.charCodeAt(1);n&32&&(r=6),t=t.substring(r,t.length-4)}return t};S.inflate=function(e,t,a){var r=e.inflate(S.encode64(t)).rval;return r===null?null:S.decode64(r)};var Ha=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=S.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}},Ga=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(S.decode64(a))),a},Ec=function(e,t,a,r){var n=Ga(e,t);n===null&&(n={}),n[a]=r,Ha(e,t,n)},xc=function(e,t,a){var r=Ga(e,t);return r!==null&&(r=a in r?r[a]:null),r},Sc=function(e,t,a){var r=Ga(e,t);if(r!==null&&a in r){delete r[a];var n=!0;for(var s in r){n=!1;break}n&&(r=null),Ha(e,t,r)}},Tc=function(e,t){Ha(e,t,null)},Wr=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var n,s=!1,i=null;for(var o in a){n=a[o];try{if(n==="flash"||n==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),s=n==="flash"}(n==="web"||n==="both")&&(t[0]=localStorage,r=e.apply(this,t),s=!0)}catch(u){i=u}if(s)break}if(!s)throw i;return r};S.setItem=function(e,t,a,r,n){Wr(Ec,arguments,n)};S.getItem=function(e,t,a,r){return Wr(xc,arguments,r)};S.removeItem=function(e,t,a,r){Wr(Sc,arguments,r)};S.clearItems=function(e,t,a){Wr(Tc,arguments,a)};S.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};S.format=function(e){for(var t=/%./g,a,r,n=0,s=[],i=0;a=t.exec(e);){r=e.substring(i,t.lastIndex-2),r.length>0&&s.push(r),i=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":n<arguments.length?s.push(arguments[n+++1]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(e.substring(i)),s.join("")};S.formatNumber=function(e,t,a,r){var n=e,s=isNaN(t=Math.abs(t))?2:t,i=a===void 0?",":a,o=r===void 0?".":r,u=n<0?"-":"",c=parseInt(n=Math.abs(+n||0).toFixed(s),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+o:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?i+Math.abs(n-c).toFixed(s).slice(2):"")};S.formatSize=function(e){return e>=1073741824?e=S.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=S.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=S.formatNumber(e/1024,0)+" KiB":e=S.formatNumber(e,0)+" bytes",e};S.bytesFromIP=function(e){return e.indexOf(".")!==-1?S.bytesFromIPv4(e):e.indexOf(":")!==-1?S.bytesFromIPv6(e):null};S.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=S.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};S.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(i){return i.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=S.createBuffer(),n=0;n<8;++n){if(!e[n]||e[n].length===0){r.fillWithByte(0,a),a=0;continue}var s=S.hexToBytes(e[n]);s.length<2&&r.putByte(0),r.putBytes(s)}return r.getBytes()};S.bytesToIP=function(e){return e.length===4?S.bytesToIPv4(e):e.length===16?S.bytesToIPv6(e):null};S.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")};S.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,n=0;n<e.length;n+=2){for(var s=S.bytesToHex(e[n]+e[n+1]);s[0]==="0"&&s!=="0";)s=s.substr(1);if(s==="0"){var i=a[a.length-1],o=t.length;!i||o!==i.end+1?a.push({start:o,end:o}):(i.end=o,i.end-i.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(s)}if(a.length>0){var u=a[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),u.start===0&&t.unshift(""),u.end===7&&t.push(""))}return t.join(":")};S.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in S&&!e.update)return t(null,S.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return S.cores=navigator.hardwareConcurrency,t(null,S.cores);if(typeof Worker>"u")return S.cores=1,t(null,S.cores);if(typeof Blob>"u")return S.cores=2,t(null,S.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(i){for(var o=Date.now(),u=o+4;Date.now()<u;);self.postMessage({st:o,et:u})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(i,o,u){if(o===0){var c=Math.floor(i.reduce(function(l,f){return l+f},0)/i.length);return S.cores=Math.max(1,c),URL.revokeObjectURL(a),t(null,S.cores)}n(u,function(l,f){i.push(s(u,f)),r(i,o-1,u)})}function n(i,o){for(var u=[],c=[],l=0;l<i;++l){var f=new Worker(a);f.addEventListener("message",function(p){if(c.push(p.data),c.length===i){for(var v=0;v<i;++v)u[v].terminate();o(null,c)}}),u.push(f)}for(var l=0;l<i;++l)u[l].postMessage(l)}function s(i,o){for(var u=[],c=0;c<i;++c)for(var l=o[c],f=u[c]=[],p=0;p<i;++p)if(c!==p){var v=o[p];(l.st>v.st&&l.st<v.et||v.st>l.st&&v.st<l.et)&&f.push(p)}return u.reduce(function(y,m){return Math.max(y,m.length)},0)}}});var Xr=F((Mp,Bi)=>{var Ie=$();ne();Bi.exports=Ie.cipher=Ie.cipher||{};Ie.cipher.algorithms=Ie.cipher.algorithms||{};Ie.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Ie.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Ie.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})};Ie.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Ie.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Ie.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})};Ie.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Ie.cipher.algorithms[e]=t};Ie.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Ie.cipher.algorithms?Ie.cipher.algorithms[e]:null};var za=Ie.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};za.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Ie.util.createBuffer(),this.output=e.output||Ie.util.createBuffer(),this.mode.start(t)};za.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};za.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))}});var $a=F((Kp,bi)=>{var Be=$();ne();Be.cipher=Be.cipher||{};var W=bi.exports=Be.cipher.modes=Be.cipher.modes||{};W.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.ecb.prototype.start=function(e){};W.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=Jr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};W.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock};W.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)};W.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb.prototype.decrypt=W.ofb.prototype.encrypt;W.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Zr(this._inBlock)};W.ctr.prototype.decrypt=W.ctr.prototype.encrypt;W.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0,this._R=3774873600};W.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Be.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=Be.util.createBuffer(e.additionalData):a=Be.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Be.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Qa(r*8)))}this._inBlock=this._j0.slice(0),Zr(this._inBlock),this._partialBytes=0,a=Be.util.createBuffer(a),this._aDataLength=Qa(a.length()*8);var n=a.length()%this.blockSize;for(n&&a.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])};W.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-r)%this.blockSize;s>0&&(s=this.blockSize-s),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(s<=0||a){if(a){var i=r%this.blockSize;this._cipherLength+=i,this._partialOutput.truncate(this.blockSize-i)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Zr(this._inBlock)};W.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Zr(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize};W.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Be.util.createBuffer();var r=this._aDataLength.concat(Qa(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var n=[];this.cipher.encrypt(this._j0,n);for(var s=0;s<this._ints;++s)this.tag.putInt32(this._s[s]^n[s]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a};W.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),n=0;n<128;++n){var s=e[n/32|0]&1<<31-n%32;s&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a};W.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)};W.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,n=e[r]>>>(7-a%8)*4&15,s=this._m[a][n];t[0]^=s[0],t[1]^=s[1],t[2]^=s[2],t[3]^=s[3]}return t};W.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)};W.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,n=16*a,s=new Array(n),i=0;i<n;++i){var o=[0,0,0,0],u=i/r|0,c=(r-1-i%r)*t;o[u]=1<<t-1<<c,s[i]=this.generateSubHashTable(this.multiply(o,e),t)}return s};W.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,n=new Array(a);n[r]=e.slice(0);for(var s=r>>>1;s>0;)this.pow(n[2*s],n[s]=[]),s>>=1;for(s=2;s<r;){for(var i=1;i<s;++i){var o=n[s],u=n[i];n[s+i]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}s*=2}for(n[0]=[0,0,0,0],s=r+1;s<a;++s){var c=n[s^r];n[s]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return n};function Jr(e,t){if(typeof e=="string"&&(e=Be.util.createBuffer(e)),Be.util.isArray(e)&&e.length>4){var a=e;e=Be.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Be.util.isArray(e)){for(var n=[],s=t/4,r=0;r<s;++r)n.push(e.getInt32());e=n}return e}function Zr(e){e[e.length-1]=e[e.length-1]+1&4294967295}function Qa(e){return[e/4294967296|0,e&4294967295]}});var Ot=F((qp,Ri)=>{var he=$();Xr();$a();ne();Ri.exports=he.aes=he.aes||{};he.aes.startEncrypting=function(e,t,a,r){var n=ea({key:e,output:a,decrypt:!1,mode:r});return n.start(t),n};he.aes.createEncryptionCipher=function(e,t){return ea({key:e,output:null,decrypt:!1,mode:t})};he.aes.startDecrypting=function(e,t,a,r){var n=ea({key:e,output:a,decrypt:!0,mode:r});return n.start(t),n};he.aes.createDecryptionCipher=function(e,t){return ea({key:e,output:null,decrypt:!0,mode:t})};he.aes.Algorithm=function(e,t){Wa||_i();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,n){return Ya(a._w,r,n,!1)},decrypt:function(r,n){return Ya(a._w,r,n,!0)}}}),a._init=!1};he.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=he.util.createBuffer(t);else if(he.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=he.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!he.util.isArray(t)){a=t,t=[];var n=a.length();if(n===16||n===24||n===32){n=n>>>2;for(var r=0;r<n;++r)t.push(a.getInt32())}}if(!he.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var s=this.mode.name,i=["CFB","OFB","CTR","GCM"].indexOf(s)!==-1;this._w=Ni(t,e.decrypt&&!i),this._init=!0}};he.aes._expandKey=function(e,t){return Wa||_i(),Ni(e,t)};he.aes._updateBlock=Ya;fr("AES-ECB",he.cipher.modes.ecb);fr("AES-CBC",he.cipher.modes.cbc);fr("AES-CFB",he.cipher.modes.cfb);fr("AES-OFB",he.cipher.modes.ofb);fr("AES-CTR",he.cipher.modes.ctr);fr("AES-GCM",he.cipher.modes.gcm);function fr(e,t){var a=function(){return new he.aes.Algorithm(e,t)};he.cipher.registerAlgorithm(e,a)}var Wa=!1,lr=4,je,ja,wi,Wt,pt;function _i(){Wa=!0,wi=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;je=new Array(256),ja=new Array(256),Wt=new Array(4),pt=new Array(4);for(var t=0;t<4;++t)Wt[t]=new Array(256),pt[t]=new Array(256);for(var a=0,r=0,n,s,i,o,u,c,l,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,je[a]=o,ja[o]=a,u=e[o],n=e[a],s=e[n],i=e[s],c=u<<24^o<<16^o<<8^(o^u),l=(n^s^i)<<24^(a^i)<<16^(a^s^i)<<8^(a^n^i);for(var f=0;f<4;++f)Wt[f][a]=c,pt[f][o]=l,c=c<<24|c>>>8,l=l<<24|l>>>8;a===0?a=r=1:(a=n^e[e[e[n^i]]],r^=e[e[r]])}}function Ni(e,t){for(var a=e.slice(0),r,n=1,s=a.length,i=s+6+1,o=lr*i,u=s;u<o;++u)r=a[u-1],u%s===0?(r=je[r>>>16&255]<<24^je[r>>>8&255]<<16^je[r&255]<<8^je[r>>>24]^wi[n]<<24,n++):s>6&&u%s===4&&(r=je[r>>>24]<<24^je[r>>>16&255]<<16^je[r>>>8&255]<<8^je[r&255]),a[u]=a[u-s]^r;if(t){var c,l=pt[0],f=pt[1],p=pt[2],v=pt[3],y=a.slice(0);o=a.length;for(var u=0,m=o-lr;u<o;u+=lr,m-=lr)if(u===0||u===o-lr)y[u]=a[m],y[u+1]=a[m+3],y[u+2]=a[m+2],y[u+3]=a[m+1];else for(var x=0;x<lr;++x)c=a[m+x],y[u+(3&-x)]=l[je[c>>>24]]^f[je[c>>>16&255]]^p[je[c>>>8&255]]^v[je[c&255]];a=y}return a}function Ya(e,t,a,r){var n=e.length/4-1,s,i,o,u,c;r?(s=pt[0],i=pt[1],o=pt[2],u=pt[3],c=ja):(s=Wt[0],i=Wt[1],o=Wt[2],u=Wt[3],c=je);var l,f,p,v,y,m,x;l=t[0]^e[0],f=t[r?3:1]^e[1],p=t[2]^e[2],v=t[r?1:3]^e[3];for(var T=3,B=1;B<n;++B)y=s[l>>>24]^i[f>>>16&255]^o[p>>>8&255]^u[v&255]^e[++T],m=s[f>>>24]^i[p>>>16&255]^o[v>>>8&255]^u[l&255]^e[++T],x=s[p>>>24]^i[v>>>16&255]^o[l>>>8&255]^u[f&255]^e[++T],v=s[v>>>24]^i[l>>>16&255]^o[f>>>8&255]^u[p&255]^e[++T],l=y,f=m,p=x;a[0]=c[l>>>24]<<24^c[f>>>16&255]<<16^c[p>>>8&255]<<8^c[v&255]^e[++T],a[r?3:1]=c[f>>>24]<<24^c[p>>>16&255]<<16^c[v>>>8&255]<<8^c[l&255]^e[++T],a[2]=c[p>>>24]<<24^c[v>>>16&255]<<16^c[l>>>8&255]<<8^c[f&255]^e[++T],a[r?1:3]=c[v>>>24]<<24^c[l>>>16&255]<<16^c[f>>>8&255]<<8^c[p&255]^e[++T]}function ea(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=he.cipher.createDecipher(a,e.key):r=he.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof he.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var Vt=F((Hp,Li)=>{var _r=$();_r.pki=_r.pki||{};var Xa=Li.exports=_r.pki.oids=_r.oids=_r.oids||{};function N(e,t){Xa[e]=t,Xa[t]=e}function ie(e,t){Xa[e]=t}N("1.2.840.113549.1.1.1","rsaEncryption");N("1.2.840.113549.1.1.4","md5WithRSAEncryption");N("1.2.840.113549.1.1.5","sha1WithRSAEncryption");N("1.2.840.113549.1.1.7","RSAES-OAEP");N("1.2.840.113549.1.1.8","mgf1");N("1.2.840.113549.1.1.9","pSpecified");N("1.2.840.113549.1.1.10","RSASSA-PSS");N("1.2.840.113549.1.1.11","sha256WithRSAEncryption");N("1.2.840.113549.1.1.12","sha384WithRSAEncryption");N("1.2.840.113549.1.1.13","sha512WithRSAEncryption");N("1.3.101.112","EdDSA25519");N("1.2.840.10040.4.3","dsa-with-sha1");N("1.3.14.3.2.7","desCBC");N("1.3.14.3.2.26","sha1");N("1.3.14.3.2.29","sha1WithRSASignature");N("2.16.840.1.101.3.4.2.1","sha256");N("2.16.840.1.101.3.4.2.2","sha384");N("2.16.840.1.101.3.4.2.3","sha512");N("2.16.840.1.101.3.4.2.4","sha224");N("2.16.840.1.101.3.4.2.5","sha512-224");N("2.16.840.1.101.3.4.2.6","sha512-256");N("1.2.840.113549.2.2","md2");N("1.2.840.113549.2.5","md5");N("1.2.840.113549.1.7.1","data");N("1.2.840.113549.1.7.2","signedData");N("1.2.840.113549.1.7.3","envelopedData");N("1.2.840.113549.1.7.4","signedAndEnvelopedData");N("1.2.840.113549.1.7.5","digestedData");N("1.2.840.113549.1.7.6","encryptedData");N("1.2.840.113549.1.9.1","emailAddress");N("1.2.840.113549.1.9.2","unstructuredName");N("1.2.840.113549.1.9.3","contentType");N("1.2.840.113549.1.9.4","messageDigest");N("1.2.840.113549.1.9.5","signingTime");N("1.2.840.113549.1.9.6","counterSignature");N("1.2.840.113549.1.9.7","challengePassword");N("1.2.840.113549.1.9.8","unstructuredAddress");N("1.2.840.113549.1.9.14","extensionRequest");N("1.2.840.113549.1.9.20","friendlyName");N("1.2.840.113549.1.9.21","localKeyId");N("1.2.840.113549.1.9.22.1","x509Certificate");N("1.2.840.113549.1.12.10.1.1","keyBag");N("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");N("1.2.840.113549.1.12.10.1.3","certBag");N("1.2.840.113549.1.12.10.1.4","crlBag");N("1.2.840.113549.1.12.10.1.5","secretBag");N("1.2.840.113549.1.12.10.1.6","safeContentsBag");N("1.2.840.113549.1.5.13","pkcs5PBES2");N("1.2.840.113549.1.5.12","pkcs5PBKDF2");N("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");N("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");N("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");N("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");N("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");N("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");N("1.2.840.113549.2.7","hmacWithSHA1");N("1.2.840.113549.2.8","hmacWithSHA224");N("1.2.840.113549.2.9","hmacWithSHA256");N("1.2.840.113549.2.10","hmacWithSHA384");N("1.2.840.113549.2.11","hmacWithSHA512");N("1.2.840.113549.3.7","des-EDE3-CBC");N("2.16.840.1.101.3.4.1.2","aes128-CBC");N("2.16.840.1.101.3.4.1.22","aes192-CBC");N("2.16.840.1.101.3.4.1.42","aes256-CBC");N("2.5.4.3","commonName");N("2.5.4.4","surname");N("2.5.4.5","serialNumber");N("2.5.4.6","countryName");N("2.5.4.7","localityName");N("2.5.4.8","stateOrProvinceName");N("2.5.4.9","streetAddress");N("2.5.4.10","organizationName");N("2.5.4.11","organizationalUnitName");N("2.5.4.12","title");N("2.5.4.13","description");N("2.5.4.15","businessCategory");N("2.5.4.17","postalCode");N("2.5.4.42","givenName");N("2.5.4.65","pseudonym");N("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");N("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");N("2.16.840.1.113730.1.1","nsCertType");N("2.16.840.1.113730.1.13","nsComment");ie("2.5.29.1","authorityKeyIdentifier");ie("2.5.29.2","keyAttributes");ie("2.5.29.3","certificatePolicies");ie("2.5.29.4","keyUsageRestriction");ie("2.5.29.5","policyMapping");ie("2.5.29.6","subtreesConstraint");ie("2.5.29.7","subjectAltName");ie("2.5.29.8","issuerAltName");ie("2.5.29.9","subjectDirectoryAttributes");ie("2.5.29.10","basicConstraints");ie("2.5.29.11","nameConstraints");ie("2.5.29.12","policyConstraints");ie("2.5.29.13","basicConstraints");N("2.5.29.14","subjectKeyIdentifier");N("2.5.29.15","keyUsage");ie("2.5.29.16","privateKeyUsagePeriod");N("2.5.29.17","subjectAltName");N("2.5.29.18","issuerAltName");N("2.5.29.19","basicConstraints");ie("2.5.29.20","cRLNumber");ie("2.5.29.21","cRLReason");ie("2.5.29.22","expirationDate");ie("2.5.29.23","instructionCode");ie("2.5.29.24","invalidityDate");ie("2.5.29.25","cRLDistributionPoints");ie("2.5.29.26","issuingDistributionPoint");ie("2.5.29.27","deltaCRLIndicator");ie("2.5.29.28","issuingDistributionPoint");ie("2.5.29.29","certificateIssuer");ie("2.5.29.30","nameConstraints");N("2.5.29.31","cRLDistributionPoints");N("2.5.29.32","certificatePolicies");ie("2.5.29.33","policyMappings");ie("2.5.29.34","policyConstraints");N("2.5.29.35","authorityKeyIdentifier");ie("2.5.29.36","policyConstraints");N("2.5.29.37","extKeyUsage");ie("2.5.29.46","freshestCRL");ie("2.5.29.54","inhibitAnyPolicy");N("1.3.6.1.4.1.11129.2.4.2","timestampList");N("1.3.6.1.5.5.7.1.1","authorityInfoAccess");N("1.3.6.1.5.5.7.3.1","serverAuth");N("1.3.6.1.5.5.7.3.2","clientAuth");N("1.3.6.1.5.5.7.3.3","codeSigning");N("1.3.6.1.5.5.7.3.4","emailProtection");N("1.3.6.1.5.5.7.3.8","timeStamping")});var gt=F((Gp,Di)=>{var ye=$();ne();Vt();var U=Di.exports=ye.asn1=ye.asn1||{};U.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};U.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};U.maxDepth=256;U.create=function(e,t,a,r,n){if(ye.util.isArray(r)){for(var s=[],i=0;i<r.length;++i)r[i]!==void 0&&s.push(r[i]);r=s}var o={tagClass:e,type:t,constructed:a,composed:a||ye.util.isArray(r),value:r};return n&&"bitStringContents"in n&&(o.bitStringContents=n.bitStringContents,o.original=U.copy(o)),o};U.copy=function(e,t){var a;if(ye.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(U.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:U.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)};U.equals=function(e,t,a){if(ye.util.isArray(e)){if(!ye.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!U.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var n=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&U.equals(e.value,t.value);return a&&a.includeBitStringContents&&(n=n&&e.bitStringContents===t.bitStringContents),n};U.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function Nr(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var Ac=function(e,t){var a=e.getByte();if(t--,a!==128){var r,n=a&128;if(!n)r=a;else{var s=a&127;Nr(e,t,s),r=e.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};U.fromDer=function(e,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=U.maxDepth),typeof e=="string"&&(e=ye.util.createBuffer(e));var a=e.length(),r=ta(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var n=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw n.byteCount=a,n.remaining=e.length(),n}return r};function ta(e,t,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var n;Nr(e,t,2);var s=e.getByte();t--;var i=s&192,o=s&31;n=e.length();var u=Ac(e,t);if(t-=n-e.length(),u!==void 0&&u>t){if(r.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=e.length(),c.remaining=t,c.requested=u,c}u=t}var l,f,p=(s&32)===32;if(p)if(l=[],u===void 0)for(;;){if(Nr(e,t,2),e.bytes(2)==="\0\0"){e.getBytes(2),t-=2;break}n=e.length(),l.push(ta(e,t,a+1,r)),t-=n-e.length()}else for(;u>0;)n=e.length(),l.push(ta(e,u,a+1,r)),t-=n-e.length(),u-=n-e.length();if(l===void 0&&i===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&(f=e.bytes(u)),l===void 0&&r.decodeBitStrings&&i===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&u>1){var v=e.read,y=t,m=0;if(o===U.Type.BITSTRING&&(Nr(e,t,1),m=e.getByte(),t--),m===0)try{n=e.length();var x={strict:!0,decodeBitStrings:!0},T=ta(e,t,a+1,x),B=n-e.length();t-=B,o==U.Type.BITSTRING&&B++;var b=T.tagClass;B===u&&(b===U.Class.UNIVERSAL||b===U.Class.CONTEXT_SPECIFIC)&&(l=[T])}catch{}l===void 0&&(e.read=v,t=y)}if(l===void 0){if(u===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");u=t}if(o===U.Type.BMPSTRING)for(l="";u>0;u-=2)Nr(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(u),t-=u}var P=f===void 0?null:{bitStringContents:f};return U.create(i,o,p,l,P)}U.toDer=function(e){var t=ye.util.createBuffer(),a=e.tagClass|e.type,r=ye.util.createBuffer(),n=!1;if("bitStringContents"in e&&(n=!0,e.original&&(n=U.equals(e,e.original))),n)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var s=0;s<e.value.length;++s)e.value[s]!==void 0&&r.putBuffer(U.toDer(e.value[s]))}else if(e.type===U.Type.BMPSTRING)for(var s=0;s<e.value.length;++s)r.putInt16(e.value.charCodeAt(s));else e.type===U.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var i=r.length(),o="";do o+=String.fromCharCode(i&255),i=i>>>8;while(i>0);t.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)t.putByte(o.charCodeAt(s))}return t.putBuffer(r),t};U.oidToDer=function(e){var t=e.split("."),a=ye.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,n,s,i,o=2;o<t.length;++o){if(r=!0,n=[],s=parseInt(t[o],10),s>4294967295)throw new Error("OID value too large; max is 32-bits.");do i=s&127,s=s>>>7,r||(i|=128),n.push(i),r=!1;while(s>0);for(var u=n.length-1;u>=0;--u)a.putByte(n[u])}return a};U.derToOid=function(e){var t;typeof e=="string"&&(e=ye.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=e.getByte(),r=r*128,a&128?r+=a&127:(t+="."+(r+a),r=0)}return t};U.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),s=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var u=e.charAt(10),c=10;u!=="+"&&u!=="-"&&(o=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,0),c&&(u=e.charAt(c),u==="+"||u==="-")){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),p=l*60+f;p*=6e4,u==="+"?t.setTime(+t-p):t.setTime(+t+p)}return t};U.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),i=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;e.charAt(e.length-1)==="Z"&&(l=!0);var f=e.length-5,p=e.charAt(f);if(p==="+"||p==="-"){var v=parseInt(e.substr(f+1,2),10),y=parseInt(e.substr(f+4,2),10);c=v*60+y,c*=6e4,p==="+"&&(c*=-1),l=!0}return e.charAt(14)==="."&&(u=parseFloat(e.substr(14),10)*1e3),l?(t.setUTCFullYear(a,r,n),t.setUTCHours(s,i,o,u),t.setTime(+t+c)):(t.setFullYear(a,r,n),t.setHours(s,i,o,u)),t};U.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.integerToDer=function(e){var t=ye.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a};U.derToInteger=function(e){typeof e=="string"&&(e=ye.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};U.validate=function(e,t,a,r){var n=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(n=!0,t.value&&ye.util.isArray(t.value))for(var s=0,i=0;n&&i<t.value.length;++i){var o=t.value[i];n=!!o.optional;var u=e.value[s];if(!u){o.optional||(n=!1,r&&r.push("["+t.name+'] Missing required element. Expected tag class "'+o.tagClass+'", type "'+o.type+'"'));continue}var c=typeof o.tagClass<"u"&&typeof o.type<"u";if(c&&(u.tagClass!==o.tagClass||u.type!==o.type))if(o.optional){n=!0;continue}else{n=!1,r&&r.push("["+t.name+"] Tag mismatch. Expected ("+o.tagClass+","+o.type+"), got ("+u.tagClass+","+u.type+")");break}var l=U.validate(u,o,a,r);if(l)++s,n=!0;else if(o.optional)n=!0;else{n=!1;break}}if(n&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){var f;if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var p=e.bitStringContents.charCodeAt(0);if(p!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return n};var ki=/[^\\u0000-\\u00ff]/;U.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
|
|
8
|
-
`);for(var n="",
|
|
4
|
+
${f}`;ht.writeFileSync(n,v)}catch{}},file:n}}var hc=process.env.MITM_CURSOR_CAPTURE==="1",pc=process.env.MITM_CURSOR_CAPTURE_FULL==="1",li=cr.join(hi,"logs","mitm","cursor-capture"),fi=4*1024*1024,di=16*1024*1024;function gc(e){if(!e)return"";let t=e.indexOf("?");return t===-1?e:e.slice(0,t)}function yc(e){if(!hc)return null;let t=pc,a=new Date().toISOString().replace(/[:.]/g,"-"),r=`${Date.now().toString(36)}-${nc.randomBytes(8).toString("hex")}`,n=cr.join(li,`${a}_${r}`),i=`${n}.meta.json`,s=`${n}.request.bin`,o=`${n}.response.bin`,u=t?[]:null,c=t?[]:null,l=0,f=0,p={timestamp:new Date().toISOString(),method:e.method,pathname:gc(e.url),byteCounts:{request:0,response:0},capturedByteCounts:{request:0,response:0},truncated:{request:!1,response:!1},responseStatus:null,responseHeaderNames:[],trailerNames:[],error:null},v=!1;try{ht.mkdirSync(li,{recursive:!0,mode:448})}catch{}return{writeRequestChunk(y){if(v||y==null||(p.byteCounts.request+=y.length,!u))return;if(l>=fi){p.truncated.request=!0;return}let m=fi-l,x=y.length>m?y.subarray(0,m):y;u.push(x),l+=x.length,y.length>m&&(p.truncated.request=!0)},writeResponseChunk(y){if(v||y==null||(p.byteCounts.response+=y.length,!c))return;if(f>=di){p.truncated.response=!0;return}let m=di-f,x=y.length>m?y.subarray(0,m):y;c.push(x),f+=x.length,y.length>m&&(p.truncated.response=!0)},setResponse(y,m){v||(p.responseStatus=y,p.responseHeaderNames=(m||[]).map(String))},setTrailers(y){v||(p.trailerNames=(y||[]).map(String))},error(y){v||!y||(p.error=String(y).slice(0,1e3))},end(){if(!v){v=!0;try{p.capturedByteCounts.request=l,p.capturedByteCounts.response=f,ht.writeFileSync(i,JSON.stringify(p,null,2),{mode:384}),u&&l>0&&ht.writeFileSync(s,Buffer.concat(u),{mode:384}),c&&f>0&&ht.writeFileSync(o,Buffer.concat(c),{mode:384})}catch{}}}}}vi.exports={log:sc,err:oc,dumpRequest:fc,createResponseDumper:dc,clearDumpDir:uc,createCursorCapture:yc}});var $=F((Op,mi)=>{mi.exports={options:{usePureJavaScript:!1}}});var xi=F((Vp,Ei)=>{var Ka={};Ei.exports=Ka;var Ci={};Ka.encode=function(e,t,a){if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');if(a!==void 0&&typeof a!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(e instanceof Uint8Array))r=vc(e,t);else{var n=0,i=t.length,s=t.charAt(0),o=[0];for(n=0;n<e.length;++n){for(var u=0,c=e[n];u<o.length;++u)c+=o[u]<<8,o[u]=c%i,c=c/i|0;for(;c>0;)o.push(c%i),c=c/i|0}for(n=0;e[n]===0&&n<e.length-1;++n)r+=s;for(n=o.length-1;n>=0;--n)r+=t[o[n]]}if(a){var l=new RegExp(".{1,"+a+"}","g");r=r.match(l).join(`\r
|
|
5
|
+
`)}return r};Ka.decode=function(e,t){if(typeof e!="string")throw new TypeError('"input" must be a string.');if(typeof t!="string")throw new TypeError('"alphabet" must be a string.');var a=Ci[t];if(!a){a=Ci[t]=[];for(var r=0;r<t.length;++r)a[t.charCodeAt(r)]=r}e=e.replace(/\s/g,"");for(var n=t.length,i=t.charAt(0),s=[0],r=0;r<e.length;r++){var o=a[e.charCodeAt(r)];if(o===void 0)return;for(var u=0,c=o;u<s.length;++u)c+=s[u]*n,s[u]=c&255,c>>=8;for(;c>0;)s.push(c&255),c>>=8}for(var l=0;e[l]===i&&l<e.length-1;++l)s.push(0);return typeof Buffer<"u"?Buffer.from(s.reverse()):new Uint8Array(s.reverse())};function vc(e,t){var a=0,r=t.length,n=t.charAt(0),i=[0];for(a=0;a<e.length();++a){for(var s=0,o=e.at(a);s<i.length;++s)o+=i[s]<<8,i[s]=o%r,o=o/r|0;for(;o>0;)i.push(o%r),o=o/r|0}var u="";for(a=0;e.at(a)===0&&a<e.length()-1;++a)u+=n;for(a=i.length-1;a>=0;--a)u+=t[i[a]];return u}});var ne=F((Fp,Ii)=>{var Si=$(),Ti=xi(),S=Ii.exports=Si.util=Si.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){S.nextTick=process.nextTick,typeof setImmediate=="function"?S.setImmediate=setImmediate:S.setImmediate=S.nextTick;return}if(typeof setImmediate=="function"){S.setImmediate=function(){return setImmediate.apply(void 0,arguments)},S.nextTick=function(o){return setImmediate(o)};return}if(S.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(u){if(u.source===window&&u.data===e){u.stopPropagation();var c=t.slice();t.length=0,c.forEach(function(l){l()})}};var s=o,e="forge.setImmediate",t=[];S.setImmediate=function(u){t.push(u),t.length===1&&window.postMessage(e,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var a=Date.now(),r=!0,n=document.createElement("div"),t=[];new MutationObserver(function(){var u=t.slice();t.length=0,u.forEach(function(c){c()})}).observe(n,{attributes:!0});var i=S.setImmediate;S.setImmediate=function(u){Date.now()-a>15?(a=Date.now(),i(u)):(t.push(u),t.length===1&&n.setAttribute("a",r=!r))}}S.nextTick=S.setImmediate})();S.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;S.globalScope=(function(){return S.isNodejs?global:typeof self>"u"?window:self})();S.isArray=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};S.isArrayBuffer=function(e){return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer};S.isArrayBufferView=function(e){return e&&S.isArrayBuffer(e.buffer)&&e.byteLength!==void 0};function wr(e){if(!(e===8||e===16||e===24||e===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}S.ByteBuffer=qa;function qa(e){if(this.data="",this.read=0,typeof e=="string")this.data=e;else if(S.isArrayBuffer(e)||S.isArrayBufferView(e))if(typeof Buffer<"u"&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch{for(var a=0;a<t.length;++a)this.putByte(t[a])}}else(e instanceof qa||typeof e=="object"&&typeof e.data=="string"&&typeof e.read=="number")&&(this.data=e.data,this.read=e.read);this._constructedStringLength=0}S.ByteStringBuffer=qa;var mc=4096;S.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>mc&&(this.data.substr(0,1),this._constructedStringLength=0)};S.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};S.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};S.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))};S.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var a=this.data;t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return this.data=a,this._optimizeConstructedString(t),this};S.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this};S.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(S.encodeUtf8(e))};S.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255))};S.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255))};S.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))};S.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(e&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))};S.ByteStringBuffer.prototype.putInt=function(e,t){wr(t);var a="";do t-=8,a+=String.fromCharCode(e>>t&255);while(t>0);return this.putBytes(a)};S.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<<t-1),this.putInt(e,t)};S.ByteStringBuffer.prototype.putBuffer=function(e){return this.putBytes(e.getBytes())};S.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};S.ByteStringBuffer.prototype.getInt16=function(){var e=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,e};S.ByteStringBuffer.prototype.getInt24=function(){var e=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,e};S.ByteStringBuffer.prototype.getInt32=function(){var e=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,e};S.ByteStringBuffer.prototype.getInt16Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,e};S.ByteStringBuffer.prototype.getInt24Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,e};S.ByteStringBuffer.prototype.getInt32Le=function(){var e=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,e};S.ByteStringBuffer.prototype.getInt=function(e){wr(e);var t=0;do t=(t<<8)+this.data.charCodeAt(this.read++),e-=8;while(e>0);return t};S.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};S.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};S.ByteStringBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};S.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)};S.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this};S.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};S.ByteStringBuffer.prototype.copy=function(){var e=S.createBuffer(this.data);return e.read=this.read,e};S.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};S.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};S.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this};S.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.length;++t){var a=this.data.charCodeAt(t);a<16&&(e+="0"),e+=a.toString(16)}return e};S.ByteStringBuffer.prototype.toString=function(){return S.decodeUtf8(this.bytes())};function Cc(e,t){t=t||{},this.read=t.readOffset||0,this.growSize=t.growSize||1024;var a=S.isArrayBuffer(e),r=S.isArrayBufferView(e);if(a||r){a?this.data=new DataView(e):this.data=new DataView(e.buffer,e.byteOffset,e.byteLength),this.write="writeOffset"in t?t.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,e!=null&&this.putBytes(e),"writeOffset"in t&&(this.write=t.writeOffset)}S.DataBuffer=Cc;S.DataBuffer.prototype.length=function(){return this.write-this.read};S.DataBuffer.prototype.isEmpty=function(){return this.length()<=0};S.DataBuffer.prototype.accommodate=function(e,t){if(this.length()>=e)return this;t=Math.max(t||this.growSize,e);var a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+t);return r.set(a),this.data=new DataView(r.buffer),this};S.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this};S.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var a=0;a<t;++a)this.data.setUint8(e);return this};S.DataBuffer.prototype.putBytes=function(e,t){if(S.isArrayBufferView(e)){var a=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),r=a.byteLength-a.byteOffset;this.accommodate(r);var n=new Uint8Array(this.data.buffer,this.write);return n.set(a),this.write+=r,this}if(S.isArrayBuffer(e)){var a=new Uint8Array(e);this.accommodate(a.byteLength);var n=new Uint8Array(this.data.buffer);return n.set(a,this.write),this.write+=a.byteLength,this}if(e instanceof S.DataBuffer||typeof e=="object"&&typeof e.read=="number"&&typeof e.write=="number"&&S.isArrayBufferView(e.data)){var a=new Uint8Array(e.data.byteLength,e.read,e.length());this.accommodate(a.byteLength);var n=new Uint8Array(e.data.byteLength,this.write);return n.set(a),this.write+=a.byteLength,this}if(e instanceof S.ByteStringBuffer&&(e=e.data,t="binary"),t=t||"binary",typeof e=="string"){var i;if(t==="hex")return this.accommodate(Math.ceil(e.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.hex.decode(e,i,this.write),this;if(t==="base64")return this.accommodate(Math.ceil(e.length/4)*3),i=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.base64.decode(e,i,this.write),this;if(t==="utf8"&&(e=S.encodeUtf8(e),t="binary"),t==="binary"||t==="raw")return this.accommodate(e.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=S.binary.raw.decode(i),this;if(t==="utf16")return this.accommodate(e.length*2),i=new Uint16Array(this.data.buffer,this.write),this.write+=S.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+t)}throw Error("Invalid parameter: "+e)};S.DataBuffer.prototype.putBuffer=function(e){return this.putBytes(e),e.clear(),this};S.DataBuffer.prototype.putString=function(e){return this.putBytes(e,"utf16")};S.DataBuffer.prototype.putInt16=function(e){return this.accommodate(2),this.data.setInt16(this.write,e),this.write+=2,this};S.DataBuffer.prototype.putInt24=function(e){return this.accommodate(3),this.data.setInt16(this.write,e>>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this};S.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this};S.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this};S.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this};S.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this};S.DataBuffer.prototype.putInt=function(e,t){wr(t),this.accommodate(t/8);do t-=8,this.data.setInt8(this.write++,e>>t&255);while(t>0);return this};S.DataBuffer.prototype.putSignedInt=function(e,t){return wr(t),this.accommodate(t/8),e<0&&(e+=2<<t-1),this.putInt(e,t)};S.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};S.DataBuffer.prototype.getInt16=function(){var e=this.data.getInt16(this.read);return this.read+=2,e};S.DataBuffer.prototype.getInt24=function(){var e=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,e};S.DataBuffer.prototype.getInt32=function(){var e=this.data.getInt32(this.read);return this.read+=4,e};S.DataBuffer.prototype.getInt16Le=function(){var e=this.data.getInt16(this.read,!0);return this.read+=2,e};S.DataBuffer.prototype.getInt24Le=function(){var e=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,e};S.DataBuffer.prototype.getInt32Le=function(){var e=this.data.getInt32(this.read,!0);return this.read+=4,e};S.DataBuffer.prototype.getInt=function(e){wr(e);var t=0;do t=(t<<8)+this.data.getInt8(this.read++),e-=8;while(e>0);return t};S.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),a=2<<e-2;return t>=a&&(t-=a<<1),t};S.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):e===0?t="":(t=this.read===0?this.data:this.data.slice(this.read),this.clear()),t};S.DataBuffer.prototype.bytes=function(e){return typeof e>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+e)};S.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)};S.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this};S.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};S.DataBuffer.prototype.copy=function(){return new S.DataBuffer(this)};S.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this};S.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};S.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this};S.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t<this.data.byteLength;++t){var a=this.data.getUint8(t);a<16&&(e+="0"),e+=a.toString(16)}return e};S.DataBuffer.prototype.toString=function(e){var t=new Uint8Array(this.data,this.read,this.length());if(e=e||"utf8",e==="binary"||e==="raw")return S.binary.raw.encode(t);if(e==="hex")return S.binary.hex.encode(t);if(e==="base64")return S.binary.base64.encode(t);if(e==="utf8")return S.text.utf8.decode(t);if(e==="utf16")return S.text.utf16.decode(t);throw new Error("Invalid encoding: "+e)};S.createBuffer=function(e,t){return t=t||"raw",e!==void 0&&t==="utf8"&&(e=S.encodeUtf8(e)),new S.ByteBuffer(e)};S.fillString=function(e,t){for(var a="";t>0;)t&1&&(a+=e),t>>>=1,t>0&&(e+=e);return a};S.xorBytes=function(e,t,a){for(var r="",n="",i="",s=0,o=0;a>0;--a,++s)n=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(r+=i,i="",o=0),i+=String.fromCharCode(n),++o;return r+=i,r};S.hexToBytes=function(e){var t="",a=0;for(e.length&!0&&(a=1,t+=String.fromCharCode(parseInt(e[0],16)));a<e.length;a+=2)t+=String.fromCharCode(parseInt(e.substr(a,2),16));return t};S.bytesToHex=function(e){return S.createBuffer(e).toHex()};S.int32ToBytes=function(e){return String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(e&255)};var Ut="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Pt=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],Ai="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";S.encode64=function(e,t){for(var a="",r="",n,i,s,o=0;o<e.length;)n=e.charCodeAt(o++),i=e.charCodeAt(o++),s=e.charCodeAt(o++),a+=Ut.charAt(n>>2),a+=Ut.charAt((n&3)<<4|i>>4),isNaN(i)?a+="==":(a+=Ut.charAt((i&15)<<2|s>>6),a+=isNaN(s)?"=":Ut.charAt(s&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
|
|
6
|
+
`,a=a.substr(t));return r+=a,r};S.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t="",a,r,n,i,s=0;s<e.length;)a=Pt[e.charCodeAt(s++)-43],r=Pt[e.charCodeAt(s++)-43],n=Pt[e.charCodeAt(s++)-43],i=Pt[e.charCodeAt(s++)-43],t+=String.fromCharCode(a<<2|r>>4),n!==64&&(t+=String.fromCharCode((r&15)<<4|n>>2),i!==64&&(t+=String.fromCharCode((n&3)<<6|i)));return t};S.encodeUtf8=function(e){return unescape(encodeURIComponent(e))};S.decodeUtf8=function(e){return decodeURIComponent(escape(e))};S.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Ti.encode,decode:Ti.decode}};S.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)};S.binary.raw.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,i=0;i<e.length;++i)r[n++]=e.charCodeAt(i);return t?n-a:r};S.binary.hex.encode=S.bytesToHex;S.binary.hex.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/2))),a=a||0;var n=0,i=a;for(e.length&1&&(n=1,r[i++]=parseInt(e[0],16));n<e.length;n+=2)r[i++]=parseInt(e.substr(n,2),16);return t?i-a:r};S.binary.base64.encode=function(e,t){for(var a="",r="",n,i,s,o=0;o<e.byteLength;)n=e[o++],i=e[o++],s=e[o++],a+=Ut.charAt(n>>2),a+=Ut.charAt((n&3)<<4|i>>4),isNaN(i)?a+="==":(a+=Ut.charAt((i&15)<<2|s>>6),a+=isNaN(s)?"=":Ut.charAt(s&63)),t&&a.length>t&&(r+=a.substr(0,t)+`\r
|
|
7
|
+
`,a=a.substr(t));return r+=a,r};S.binary.base64.decode=function(e,t,a){var r=t;r||(r=new Uint8Array(Math.ceil(e.length/4)*3)),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,""),a=a||0;for(var n,i,s,o,u=0,c=a;u<e.length;)n=Pt[e.charCodeAt(u++)-43],i=Pt[e.charCodeAt(u++)-43],s=Pt[e.charCodeAt(u++)-43],o=Pt[e.charCodeAt(u++)-43],r[c++]=n<<2|i>>4,s!==64&&(r[c++]=(i&15)<<4|s>>2,o!==64&&(r[c++]=(s&3)<<6|o));return t?c-a:r.subarray(0,c)};S.binary.base58.encode=function(e,t){return S.binary.baseN.encode(e,Ai,t)};S.binary.base58.decode=function(e,t){return S.binary.baseN.decode(e,Ai,t)};S.text={utf8:{},utf16:{}};S.text.utf8.encode=function(e,t,a){e=S.encodeUtf8(e);var r=t;r||(r=new Uint8Array(e.length)),a=a||0;for(var n=a,i=0;i<e.length;++i)r[n++]=e.charCodeAt(i);return t?n-a:r};S.text.utf8.decode=function(e){return S.decodeUtf8(String.fromCharCode.apply(null,e))};S.text.utf16.encode=function(e,t,a){var r=t;r||(r=new Uint8Array(e.length*2));var n=new Uint16Array(r.buffer);a=a||0;for(var i=a,s=a,o=0;o<e.length;++o)n[s++]=e.charCodeAt(o),i+=2;return t?i-a:r};S.text.utf16.decode=function(e){return String.fromCharCode.apply(null,new Uint16Array(e.buffer))};S.deflate=function(e,t,a){if(t=S.decode64(e.deflate(S.encode64(t)).rval),a){var r=2,n=t.charCodeAt(1);n&32&&(r=6),t=t.substring(r,t.length-4)}return t};S.inflate=function(e,t,a){var r=e.inflate(S.encode64(t)).rval;return r===null?null:S.decode64(r)};var Ha=function(e,t,a){if(!e)throw new Error("WebStorage not available.");var r;if(a===null?r=e.removeItem(t):(a=S.encode64(JSON.stringify(a)),r=e.setItem(t,a)),typeof r<"u"&&r.rval!==!0){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}},Ga=function(e,t){if(!e)throw new Error("WebStorage not available.");var a=e.getItem(t);if(e.init)if(a.rval===null){if(a.error){var r=new Error(a.error.message);throw r.id=a.error.id,r.name=a.error.name,r}a=null}else a=a.rval;return a!==null&&(a=JSON.parse(S.decode64(a))),a},Ec=function(e,t,a,r){var n=Ga(e,t);n===null&&(n={}),n[a]=r,Ha(e,t,n)},xc=function(e,t,a){var r=Ga(e,t);return r!==null&&(r=a in r?r[a]:null),r},Sc=function(e,t,a){var r=Ga(e,t);if(r!==null&&a in r){delete r[a];var n=!0;for(var i in r){n=!1;break}n&&(r=null),Ha(e,t,r)}},Tc=function(e,t){Ha(e,t,null)},Wr=function(e,t,a){var r=null;typeof a>"u"&&(a=["web","flash"]);var n,i=!1,s=null;for(var o in a){n=a[o];try{if(n==="flash"||n==="both"){if(t[0]===null)throw new Error("Flash local storage not available.");r=e.apply(this,t),i=n==="flash"}(n==="web"||n==="both")&&(t[0]=localStorage,r=e.apply(this,t),i=!0)}catch(u){s=u}if(i)break}if(!i)throw s;return r};S.setItem=function(e,t,a,r,n){Wr(Ec,arguments,n)};S.getItem=function(e,t,a,r){return Wr(xc,arguments,r)};S.removeItem=function(e,t,a,r){Wr(Sc,arguments,r)};S.clearItems=function(e,t,a){Wr(Tc,arguments,a)};S.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0};S.format=function(e){for(var t=/%./g,a,r,n=0,i=[],s=0;a=t.exec(e);){r=e.substring(s,t.lastIndex-2),r.length>0&&i.push(r),s=t.lastIndex;var o=a[0][1];switch(o){case"s":case"o":n<arguments.length?i.push(arguments[n+++1]):i.push("<?>");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")};S.formatNumber=function(e,t,a,r){var n=e,i=isNaN(t=Math.abs(t))?2:t,s=a===void 0?",":a,o=r===void 0?".":r,u=n<0?"-":"",c=parseInt(n=Math.abs(+n||0).toFixed(i),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+o:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(n-c).toFixed(i).slice(2):"")};S.formatSize=function(e){return e>=1073741824?e=S.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?e=S.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?e=S.formatNumber(e/1024,0)+" KiB":e=S.formatNumber(e,0)+" bytes",e};S.bytesFromIP=function(e){return e.indexOf(".")!==-1?S.bytesFromIPv4(e):e.indexOf(":")!==-1?S.bytesFromIPv6(e):null};S.bytesFromIPv4=function(e){if(e=e.split("."),e.length!==4)return null;for(var t=S.createBuffer(),a=0;a<e.length;++a){var r=parseInt(e[a],10);if(isNaN(r))return null;t.putByte(r)}return t.getBytes()};S.bytesFromIPv6=function(e){var t=0;e=e.split(":").filter(function(s){return s.length===0&&++t,!0});for(var a=(8-e.length+t)*2,r=S.createBuffer(),n=0;n<8;++n){if(!e[n]||e[n].length===0){r.fillWithByte(0,a),a=0;continue}var i=S.hexToBytes(e[n]);i.length<2&&r.putByte(0),r.putBytes(i)}return r.getBytes()};S.bytesToIP=function(e){return e.length===4?S.bytesToIPv4(e):e.length===16?S.bytesToIPv6(e):null};S.bytesToIPv4=function(e){if(e.length!==4)return null;for(var t=[],a=0;a<e.length;++a)t.push(e.charCodeAt(a));return t.join(".")};S.bytesToIPv6=function(e){if(e.length!==16)return null;for(var t=[],a=[],r=0,n=0;n<e.length;n+=2){for(var i=S.bytesToHex(e[n]+e[n+1]);i[0]==="0"&&i!=="0";)i=i.substr(1);if(i==="0"){var s=a[a.length-1],o=t.length;!s||o!==s.end+1?a.push({start:o,end:o}):(s.end=o,s.end-s.start>a[r].end-a[r].start&&(r=a.length-1))}t.push(i)}if(a.length>0){var u=a[r];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),u.start===0&&t.unshift(""),u.end===7&&t.push(""))}return t.join(":")};S.estimateCores=function(e,t){if(typeof e=="function"&&(t=e,e={}),e=e||{},"cores"in S&&!e.update)return t(null,S.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return S.cores=navigator.hardwareConcurrency,t(null,S.cores);if(typeof Worker>"u")return S.cores=1,t(null,S.cores);if(typeof Blob>"u")return S.cores=2,t(null,S.cores);var a=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(s){for(var o=Date.now(),u=o+4;Date.now()<u;);self.postMessage({st:o,et:u})})}.toString(),")()"],{type:"application/javascript"}));r([],5,16);function r(s,o,u){if(o===0){var c=Math.floor(s.reduce(function(l,f){return l+f},0)/s.length);return S.cores=Math.max(1,c),URL.revokeObjectURL(a),t(null,S.cores)}n(u,function(l,f){s.push(i(u,f)),r(s,o-1,u)})}function n(s,o){for(var u=[],c=[],l=0;l<s;++l){var f=new Worker(a);f.addEventListener("message",function(p){if(c.push(p.data),c.length===s){for(var v=0;v<s;++v)u[v].terminate();o(null,c)}}),u.push(f)}for(var l=0;l<s;++l)u[l].postMessage(l)}function i(s,o){for(var u=[],c=0;c<s;++c)for(var l=o[c],f=u[c]=[],p=0;p<s;++p)if(c!==p){var v=o[p];(l.st>v.st&&l.st<v.et||v.st>l.st&&v.st<l.et)&&f.push(p)}return u.reduce(function(y,m){return Math.max(y,m.length)},0)}}});var Xr=F((Mp,Bi)=>{var Ie=$();ne();Bi.exports=Ie.cipher=Ie.cipher||{};Ie.cipher.algorithms=Ie.cipher.algorithms||{};Ie.cipher.createCipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Ie.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Ie.cipher.BlockCipher({algorithm:a,key:t,decrypt:!1})};Ie.cipher.createDecipher=function(e,t){var a=e;if(typeof a=="string"&&(a=Ie.cipher.getAlgorithm(a),a&&(a=a())),!a)throw new Error("Unsupported algorithm: "+e);return new Ie.cipher.BlockCipher({algorithm:a,key:t,decrypt:!0})};Ie.cipher.registerAlgorithm=function(e,t){e=e.toUpperCase(),Ie.cipher.algorithms[e]=t};Ie.cipher.getAlgorithm=function(e){return e=e.toUpperCase(),e in Ie.cipher.algorithms?Ie.cipher.algorithms[e]:null};var za=Ie.cipher.BlockCipher=function(e){this.algorithm=e.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=e.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=e.decrypt,this.algorithm.initialize(e)};za.prototype.start=function(e){e=e||{};var t={};for(var a in e)t[a]=e[a];t.decrypt=this._decrypt,this._finish=!1,this._input=Ie.util.createBuffer(),this.output=e.output||Ie.util.createBuffer(),this.mode.start(t)};za.prototype.update=function(e){for(e&&this._input.putBuffer(e);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};za.prototype.finish=function(e){e&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(a){return e(this.blockSize,a,!1)},this.mode.unpad=function(a){return e(this.blockSize,a,!0)});var t={};return t.decrypt=this._decrypt,t.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,t)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,t))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,t))}});var $a=F((Kp,bi)=>{var Be=$();ne();Be.cipher=Be.cipher||{};var W=bi.exports=Be.cipher.modes=Be.cipher.modes||{};W.ecb=function(e){e=e||{},this.name="ECB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.ecb.prototype.start=function(e){};W.ecb.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r])};W.ecb.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.ecb.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};W.cbc.prototype.start=function(e){if(e.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in e)this._iv=Jr(e.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};W.cbc.prototype.encrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=this._prev[r]^e.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._outBlock[r]);this._prev=this._outBlock};W.cbc.prototype.decrypt=function(e,t,a){if(e.length()<this.blockSize&&!(a&&e.length()>0))return!0;for(var r=0;r<this._ints;++r)this._inBlock[r]=e.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var r=0;r<this._ints;++r)t.putInt32(this._prev[r]^this._outBlock[r]);this._prev=this._inBlock.slice(0)};W.cbc.prototype.pad=function(e,t){var a=e.length()===this.blockSize?this.blockSize:this.blockSize-e.length();return e.fillWithByte(a,a),!0};W.cbc.prototype.unpad=function(e,t){if(t.overflow>0)return!1;var a=e.length(),r=e.at(a-1);return r>this.blockSize<<2?!1:(e.truncate(r),!0)};W.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.cfb.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32()^this._outBlock[n],t.putInt32(this._inBlock[n]);return}var i=(this.blockSize-r)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32()^this._outBlock[n],this._partialOutput.putInt32(this._partialBlock[n]);if(i>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!a)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.cfb.prototype.decrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)this._inBlock[n]=e.getInt32(),t.putInt32(this._inBlock[n]^this._outBlock[n]);return}var i=(this.blockSize-r)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialBlock[n]=e.getInt32(),this._partialOutput.putInt32(this._partialBlock[n]^this._outBlock[n]);if(i>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._partialBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!a)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ofb.prototype.encrypt=function(e,t,a){var r=e.length();if(e.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]),this._inBlock[n]=this._outBlock[n];return}var i=(this.blockSize-r)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(i>0)e.read-=this.blockSize;else for(var n=0;n<this._ints;++n)this._inBlock[n]=this._outBlock[n];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!a)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};W.ofb.prototype.decrypt=W.ofb.prototype.encrypt;W.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0};W.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=Jr(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};W.ctr.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var n=0;n<this._ints;++n)t.putInt32(e.getInt32()^this._outBlock[n]);else{var i=(this.blockSize-r)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(i>0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!a)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Zr(this._inBlock)};W.ctr.prototype.decrypt=W.ctr.prototype.encrypt;W.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=Be.util.createBuffer(),this._partialBytes=0,this._R=3774873600};W.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t=Be.util.createBuffer(e.iv);this._cipherLength=0;var a;if("additionalData"in e?a=Be.util.createBuffer(e.additionalData):a=Be.util.createBuffer(),"tagLength"in e?this._tagLength=e.tagLength:this._tagLength=128,this._tag=null,e.decrypt&&(this._tag=Be.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var r=t.length();if(r===12)this._j0=[t.getInt32(),t.getInt32(),t.getInt32(),1];else{for(this._j0=[0,0,0,0];t.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Qa(r*8)))}this._inBlock=this._j0.slice(0),Zr(this._inBlock),this._partialBytes=0,a=Be.util.createBuffer(a),this._aDataLength=Qa(a.length()*8);var n=a.length()%this.blockSize;for(n&&a.fillWithByte(0,this.blockSize-n),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])};W.gcm.prototype.encrypt=function(e,t,a){var r=e.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^=e.getInt32());this._cipherLength+=this.blockSize}else{var i=(this.blockSize-r)%this.blockSize;i>0&&(i=this.blockSize-i),this._partialOutput.clear();for(var n=0;n<this._ints;++n)this._partialOutput.putInt32(e.getInt32()^this._outBlock[n]);if(i<=0||a){if(a){var s=r%this.blockSize;this._cipherLength+=s,this._partialOutput.truncate(this.blockSize-s)}else this._cipherLength+=this.blockSize;for(var n=0;n<this._ints;++n)this._outBlock[n]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!a)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Zr(this._inBlock)};W.gcm.prototype.decrypt=function(e,t,a){var r=e.length();if(r<this.blockSize&&!(a&&r>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Zr(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n<this._ints;++n)t.putInt32(this._outBlock[n]^this._hashBlock[n]);r<this.blockSize?this._cipherLength+=r%this.blockSize:this._cipherLength+=this.blockSize};W.gcm.prototype.afterFinish=function(e,t){var a=!0;t.decrypt&&t.overflow&&e.truncate(this.blockSize-t.overflow),this.tag=Be.util.createBuffer();var r=this._aDataLength.concat(Qa(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,r);var n=[];this.cipher.encrypt(this._j0,n);for(var i=0;i<this._ints;++i)this.tag.putInt32(this._s[i]^n[i]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),t.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a};W.gcm.prototype.multiply=function(e,t){for(var a=[0,0,0,0],r=t.slice(0),n=0;n<128;++n){var i=e[n/32|0]&1<<31-n%32;i&&(a[0]^=r[0],a[1]^=r[1],a[2]^=r[2],a[3]^=r[3]),this.pow(r,r)}return a};W.gcm.prototype.pow=function(e,t){for(var a=e[3]&1,r=3;r>0;--r)t[r]=e[r]>>>1|(e[r-1]&1)<<31;t[0]=e[0]>>>1,a&&(t[0]^=this._R)};W.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],a=0;a<32;++a){var r=a/8|0,n=e[r]>>>(7-a%8)*4&15,i=this._m[a][n];t[0]^=i[0],t[1]^=i[1],t[2]^=i[2],t[3]^=i[3]}return t};W.gcm.prototype.ghash=function(e,t,a){return t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3],this.tableMultiply(t)};W.gcm.prototype.generateHashTable=function(e,t){for(var a=8/t,r=4*a,n=16*a,i=new Array(n),s=0;s<n;++s){var o=[0,0,0,0],u=s/r|0,c=(r-1-s%r)*t;o[u]=1<<t-1<<c,i[s]=this.generateSubHashTable(this.multiply(o,e),t)}return i};W.gcm.prototype.generateSubHashTable=function(e,t){var a=1<<t,r=a>>>1,n=new Array(a);n[r]=e.slice(0);for(var i=r>>>1;i>0;)this.pow(n[2*i],n[i]=[]),i>>=1;for(i=2;i<r;){for(var s=1;s<i;++s){var o=n[i],u=n[s];n[i+s]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}i*=2}for(n[0]=[0,0,0,0],i=r+1;i<a;++i){var c=n[i^r];n[i]=[e[0]^c[0],e[1]^c[1],e[2]^c[2],e[3]^c[3]]}return n};function Jr(e,t){if(typeof e=="string"&&(e=Be.util.createBuffer(e)),Be.util.isArray(e)&&e.length>4){var a=e;e=Be.util.createBuffer();for(var r=0;r<a.length;++r)e.putByte(a[r])}if(e.length()<t)throw new Error("Invalid IV length; got "+e.length()+" bytes and expected "+t+" bytes.");if(!Be.util.isArray(e)){for(var n=[],i=t/4,r=0;r<i;++r)n.push(e.getInt32());e=n}return e}function Zr(e){e[e.length-1]=e[e.length-1]+1&4294967295}function Qa(e){return[e/4294967296|0,e&4294967295]}});var Ot=F((qp,Ri)=>{var he=$();Xr();$a();ne();Ri.exports=he.aes=he.aes||{};he.aes.startEncrypting=function(e,t,a,r){var n=ea({key:e,output:a,decrypt:!1,mode:r});return n.start(t),n};he.aes.createEncryptionCipher=function(e,t){return ea({key:e,output:null,decrypt:!1,mode:t})};he.aes.startDecrypting=function(e,t,a,r){var n=ea({key:e,output:a,decrypt:!0,mode:r});return n.start(t),n};he.aes.createDecryptionCipher=function(e,t){return ea({key:e,output:null,decrypt:!0,mode:t})};he.aes.Algorithm=function(e,t){Wa||_i();var a=this;a.name=e,a.mode=new t({blockSize:16,cipher:{encrypt:function(r,n){return Ya(a._w,r,n,!1)},decrypt:function(r,n){return Ya(a._w,r,n,!0)}}}),a._init=!1};he.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t=e.key,a;if(typeof t=="string"&&(t.length===16||t.length===24||t.length===32))t=he.util.createBuffer(t);else if(he.util.isArray(t)&&(t.length===16||t.length===24||t.length===32)){a=t,t=he.util.createBuffer();for(var r=0;r<a.length;++r)t.putByte(a[r])}if(!he.util.isArray(t)){a=t,t=[];var n=a.length();if(n===16||n===24||n===32){n=n>>>2;for(var r=0;r<n;++r)t.push(a.getInt32())}}if(!he.util.isArray(t)||!(t.length===4||t.length===6||t.length===8))throw new Error("Invalid key parameter.");var i=this.mode.name,s=["CFB","OFB","CTR","GCM"].indexOf(i)!==-1;this._w=Ni(t,e.decrypt&&!s),this._init=!0}};he.aes._expandKey=function(e,t){return Wa||_i(),Ni(e,t)};he.aes._updateBlock=Ya;fr("AES-ECB",he.cipher.modes.ecb);fr("AES-CBC",he.cipher.modes.cbc);fr("AES-CFB",he.cipher.modes.cfb);fr("AES-OFB",he.cipher.modes.ofb);fr("AES-CTR",he.cipher.modes.ctr);fr("AES-GCM",he.cipher.modes.gcm);function fr(e,t){var a=function(){return new he.aes.Algorithm(e,t)};he.cipher.registerAlgorithm(e,a)}var Wa=!1,lr=4,je,ja,wi,Wt,pt;function _i(){Wa=!0,wi=[0,1,2,4,8,16,32,64,128,27,54];for(var e=new Array(256),t=0;t<128;++t)e[t]=t<<1,e[t+128]=t+128<<1^283;je=new Array(256),ja=new Array(256),Wt=new Array(4),pt=new Array(4);for(var t=0;t<4;++t)Wt[t]=new Array(256),pt[t]=new Array(256);for(var a=0,r=0,n,i,s,o,u,c,l,t=0;t<256;++t){o=r^r<<1^r<<2^r<<3^r<<4,o=o>>8^o&255^99,je[a]=o,ja[o]=a,u=e[o],n=e[a],i=e[n],s=e[i],c=u<<24^o<<16^o<<8^(o^u),l=(n^i^s)<<24^(a^s)<<16^(a^i^s)<<8^(a^n^s);for(var f=0;f<4;++f)Wt[f][a]=c,pt[f][o]=l,c=c<<24|c>>>8,l=l<<24|l>>>8;a===0?a=r=1:(a=n^e[e[e[n^s]]],r^=e[e[r]])}}function Ni(e,t){for(var a=e.slice(0),r,n=1,i=a.length,s=i+6+1,o=lr*s,u=i;u<o;++u)r=a[u-1],u%i===0?(r=je[r>>>16&255]<<24^je[r>>>8&255]<<16^je[r&255]<<8^je[r>>>24]^wi[n]<<24,n++):i>6&&u%i===4&&(r=je[r>>>24]<<24^je[r>>>16&255]<<16^je[r>>>8&255]<<8^je[r&255]),a[u]=a[u-i]^r;if(t){var c,l=pt[0],f=pt[1],p=pt[2],v=pt[3],y=a.slice(0);o=a.length;for(var u=0,m=o-lr;u<o;u+=lr,m-=lr)if(u===0||u===o-lr)y[u]=a[m],y[u+1]=a[m+3],y[u+2]=a[m+2],y[u+3]=a[m+1];else for(var x=0;x<lr;++x)c=a[m+x],y[u+(3&-x)]=l[je[c>>>24]]^f[je[c>>>16&255]]^p[je[c>>>8&255]]^v[je[c&255]];a=y}return a}function Ya(e,t,a,r){var n=e.length/4-1,i,s,o,u,c;r?(i=pt[0],s=pt[1],o=pt[2],u=pt[3],c=ja):(i=Wt[0],s=Wt[1],o=Wt[2],u=Wt[3],c=je);var l,f,p,v,y,m,x;l=t[0]^e[0],f=t[r?3:1]^e[1],p=t[2]^e[2],v=t[r?1:3]^e[3];for(var T=3,B=1;B<n;++B)y=i[l>>>24]^s[f>>>16&255]^o[p>>>8&255]^u[v&255]^e[++T],m=i[f>>>24]^s[p>>>16&255]^o[v>>>8&255]^u[l&255]^e[++T],x=i[p>>>24]^s[v>>>16&255]^o[l>>>8&255]^u[f&255]^e[++T],v=i[v>>>24]^s[l>>>16&255]^o[f>>>8&255]^u[p&255]^e[++T],l=y,f=m,p=x;a[0]=c[l>>>24]<<24^c[f>>>16&255]<<16^c[p>>>8&255]<<8^c[v&255]^e[++T],a[r?3:1]=c[f>>>24]<<24^c[p>>>16&255]<<16^c[v>>>8&255]<<8^c[l&255]^e[++T],a[2]=c[p>>>24]<<24^c[v>>>16&255]<<16^c[l>>>8&255]<<8^c[f&255]^e[++T],a[r?1:3]=c[v>>>24]<<24^c[l>>>16&255]<<16^c[f>>>8&255]<<8^c[p&255]^e[++T]}function ea(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="AES-"+t,r;e.decrypt?r=he.cipher.createDecipher(a,e.key):r=he.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(i,s){var o=null;s instanceof he.util.ByteBuffer&&(o=s,s={}),s=s||{},s.output=o,s.iv=i,n.call(r,s)},r}});var Vt=F((Hp,Li)=>{var _r=$();_r.pki=_r.pki||{};var Xa=Li.exports=_r.pki.oids=_r.oids=_r.oids||{};function N(e,t){Xa[e]=t,Xa[t]=e}function ie(e,t){Xa[e]=t}N("1.2.840.113549.1.1.1","rsaEncryption");N("1.2.840.113549.1.1.4","md5WithRSAEncryption");N("1.2.840.113549.1.1.5","sha1WithRSAEncryption");N("1.2.840.113549.1.1.7","RSAES-OAEP");N("1.2.840.113549.1.1.8","mgf1");N("1.2.840.113549.1.1.9","pSpecified");N("1.2.840.113549.1.1.10","RSASSA-PSS");N("1.2.840.113549.1.1.11","sha256WithRSAEncryption");N("1.2.840.113549.1.1.12","sha384WithRSAEncryption");N("1.2.840.113549.1.1.13","sha512WithRSAEncryption");N("1.3.101.112","EdDSA25519");N("1.2.840.10040.4.3","dsa-with-sha1");N("1.3.14.3.2.7","desCBC");N("1.3.14.3.2.26","sha1");N("1.3.14.3.2.29","sha1WithRSASignature");N("2.16.840.1.101.3.4.2.1","sha256");N("2.16.840.1.101.3.4.2.2","sha384");N("2.16.840.1.101.3.4.2.3","sha512");N("2.16.840.1.101.3.4.2.4","sha224");N("2.16.840.1.101.3.4.2.5","sha512-224");N("2.16.840.1.101.3.4.2.6","sha512-256");N("1.2.840.113549.2.2","md2");N("1.2.840.113549.2.5","md5");N("1.2.840.113549.1.7.1","data");N("1.2.840.113549.1.7.2","signedData");N("1.2.840.113549.1.7.3","envelopedData");N("1.2.840.113549.1.7.4","signedAndEnvelopedData");N("1.2.840.113549.1.7.5","digestedData");N("1.2.840.113549.1.7.6","encryptedData");N("1.2.840.113549.1.9.1","emailAddress");N("1.2.840.113549.1.9.2","unstructuredName");N("1.2.840.113549.1.9.3","contentType");N("1.2.840.113549.1.9.4","messageDigest");N("1.2.840.113549.1.9.5","signingTime");N("1.2.840.113549.1.9.6","counterSignature");N("1.2.840.113549.1.9.7","challengePassword");N("1.2.840.113549.1.9.8","unstructuredAddress");N("1.2.840.113549.1.9.14","extensionRequest");N("1.2.840.113549.1.9.20","friendlyName");N("1.2.840.113549.1.9.21","localKeyId");N("1.2.840.113549.1.9.22.1","x509Certificate");N("1.2.840.113549.1.12.10.1.1","keyBag");N("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");N("1.2.840.113549.1.12.10.1.3","certBag");N("1.2.840.113549.1.12.10.1.4","crlBag");N("1.2.840.113549.1.12.10.1.5","secretBag");N("1.2.840.113549.1.12.10.1.6","safeContentsBag");N("1.2.840.113549.1.5.13","pkcs5PBES2");N("1.2.840.113549.1.5.12","pkcs5PBKDF2");N("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");N("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");N("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");N("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");N("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");N("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");N("1.2.840.113549.2.7","hmacWithSHA1");N("1.2.840.113549.2.8","hmacWithSHA224");N("1.2.840.113549.2.9","hmacWithSHA256");N("1.2.840.113549.2.10","hmacWithSHA384");N("1.2.840.113549.2.11","hmacWithSHA512");N("1.2.840.113549.3.7","des-EDE3-CBC");N("2.16.840.1.101.3.4.1.2","aes128-CBC");N("2.16.840.1.101.3.4.1.22","aes192-CBC");N("2.16.840.1.101.3.4.1.42","aes256-CBC");N("2.5.4.3","commonName");N("2.5.4.4","surname");N("2.5.4.5","serialNumber");N("2.5.4.6","countryName");N("2.5.4.7","localityName");N("2.5.4.8","stateOrProvinceName");N("2.5.4.9","streetAddress");N("2.5.4.10","organizationName");N("2.5.4.11","organizationalUnitName");N("2.5.4.12","title");N("2.5.4.13","description");N("2.5.4.15","businessCategory");N("2.5.4.17","postalCode");N("2.5.4.42","givenName");N("2.5.4.65","pseudonym");N("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");N("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");N("2.16.840.1.113730.1.1","nsCertType");N("2.16.840.1.113730.1.13","nsComment");ie("2.5.29.1","authorityKeyIdentifier");ie("2.5.29.2","keyAttributes");ie("2.5.29.3","certificatePolicies");ie("2.5.29.4","keyUsageRestriction");ie("2.5.29.5","policyMapping");ie("2.5.29.6","subtreesConstraint");ie("2.5.29.7","subjectAltName");ie("2.5.29.8","issuerAltName");ie("2.5.29.9","subjectDirectoryAttributes");ie("2.5.29.10","basicConstraints");ie("2.5.29.11","nameConstraints");ie("2.5.29.12","policyConstraints");ie("2.5.29.13","basicConstraints");N("2.5.29.14","subjectKeyIdentifier");N("2.5.29.15","keyUsage");ie("2.5.29.16","privateKeyUsagePeriod");N("2.5.29.17","subjectAltName");N("2.5.29.18","issuerAltName");N("2.5.29.19","basicConstraints");ie("2.5.29.20","cRLNumber");ie("2.5.29.21","cRLReason");ie("2.5.29.22","expirationDate");ie("2.5.29.23","instructionCode");ie("2.5.29.24","invalidityDate");ie("2.5.29.25","cRLDistributionPoints");ie("2.5.29.26","issuingDistributionPoint");ie("2.5.29.27","deltaCRLIndicator");ie("2.5.29.28","issuingDistributionPoint");ie("2.5.29.29","certificateIssuer");ie("2.5.29.30","nameConstraints");N("2.5.29.31","cRLDistributionPoints");N("2.5.29.32","certificatePolicies");ie("2.5.29.33","policyMappings");ie("2.5.29.34","policyConstraints");N("2.5.29.35","authorityKeyIdentifier");ie("2.5.29.36","policyConstraints");N("2.5.29.37","extKeyUsage");ie("2.5.29.46","freshestCRL");ie("2.5.29.54","inhibitAnyPolicy");N("1.3.6.1.4.1.11129.2.4.2","timestampList");N("1.3.6.1.5.5.7.1.1","authorityInfoAccess");N("1.3.6.1.5.5.7.3.1","serverAuth");N("1.3.6.1.5.5.7.3.2","clientAuth");N("1.3.6.1.5.5.7.3.3","codeSigning");N("1.3.6.1.5.5.7.3.4","emailProtection");N("1.3.6.1.5.5.7.3.8","timeStamping")});var gt=F((Gp,Di)=>{var ye=$();ne();Vt();var U=Di.exports=ye.asn1=ye.asn1||{};U.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};U.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};U.maxDepth=256;U.create=function(e,t,a,r,n){if(ye.util.isArray(r)){for(var i=[],s=0;s<r.length;++s)r[s]!==void 0&&i.push(r[s]);r=i}var o={tagClass:e,type:t,constructed:a,composed:a||ye.util.isArray(r),value:r};return n&&"bitStringContents"in n&&(o.bitStringContents=n.bitStringContents,o.original=U.copy(o)),o};U.copy=function(e,t){var a;if(ye.util.isArray(e)){a=[];for(var r=0;r<e.length;++r)a.push(U.copy(e[r],t));return a}return typeof e=="string"?e:(a={tagClass:e.tagClass,type:e.type,constructed:e.constructed,composed:e.composed,value:U.copy(e.value,t)},t&&!t.excludeBitStringContents&&(a.bitStringContents=e.bitStringContents),a)};U.equals=function(e,t,a){if(ye.util.isArray(e)){if(!ye.util.isArray(t)||e.length!==t.length)return!1;for(var r=0;r<e.length;++r)if(!U.equals(e[r],t[r]))return!1;return!0}if(typeof e!=typeof t)return!1;if(typeof e=="string")return e===t;var n=e.tagClass===t.tagClass&&e.type===t.type&&e.constructed===t.constructed&&e.composed===t.composed&&U.equals(e.value,t.value);return a&&a.includeBitStringContents&&(n=n&&e.bitStringContents===t.bitStringContents),n};U.getBerValueLength=function(e){var t=e.getByte();if(t!==128){var a,r=t&128;return r?a=e.getInt((t&127)<<3):a=t,a}};function Nr(e,t,a){if(a>t){var r=new Error("Too few bytes to parse DER.");throw r.available=e.length(),r.remaining=t,r.requested=a,r}}var Ac=function(e,t){var a=e.getByte();if(t--,a!==128){var r,n=a&128;if(!n)r=a;else{var i=a&127;Nr(e,t,i),r=e.getInt(i<<3)}if(r<0)throw new Error("Negative length: "+r);return r}};U.fromDer=function(e,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=U.maxDepth),typeof e=="string"&&(e=ye.util.createBuffer(e));var a=e.length(),r=ta(e,e.length(),0,t);if(t.parseAllBytes&&e.length()!==0){var n=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw n.byteCount=a,n.remaining=e.length(),n}return r};function ta(e,t,a,r){if(a>=r.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var n;Nr(e,t,2);var i=e.getByte();t--;var s=i&192,o=i&31;n=e.length();var u=Ac(e,t);if(t-=n-e.length(),u!==void 0&&u>t){if(r.strict){var c=new Error("Too few bytes to read ASN.1 value.");throw c.available=e.length(),c.remaining=t,c.requested=u,c}u=t}var l,f,p=(i&32)===32;if(p)if(l=[],u===void 0)for(;;){if(Nr(e,t,2),e.bytes(2)==="\0\0"){e.getBytes(2),t-=2;break}n=e.length(),l.push(ta(e,t,a+1,r)),t-=n-e.length()}else for(;u>0;)n=e.length(),l.push(ta(e,u,a+1,r)),t-=n-e.length(),u-=n-e.length();if(l===void 0&&s===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&(f=e.bytes(u)),l===void 0&&r.decodeBitStrings&&s===U.Class.UNIVERSAL&&o===U.Type.BITSTRING&&u>1){var v=e.read,y=t,m=0;if(o===U.Type.BITSTRING&&(Nr(e,t,1),m=e.getByte(),t--),m===0)try{n=e.length();var x={strict:!0,decodeBitStrings:!0},T=ta(e,t,a+1,x),B=n-e.length();t-=B,o==U.Type.BITSTRING&&B++;var b=T.tagClass;B===u&&(b===U.Class.UNIVERSAL||b===U.Class.CONTEXT_SPECIFIC)&&(l=[T])}catch{}l===void 0&&(e.read=v,t=y)}if(l===void 0){if(u===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");u=t}if(o===U.Type.BMPSTRING)for(l="";u>0;u-=2)Nr(e,t,2),l+=String.fromCharCode(e.getInt16()),t-=2;else l=e.getBytes(u),t-=u}var P=f===void 0?null:{bitStringContents:f};return U.create(s,o,p,l,P)}U.toDer=function(e){var t=ye.util.createBuffer(),a=e.tagClass|e.type,r=ye.util.createBuffer(),n=!1;if("bitStringContents"in e&&(n=!0,e.original&&(n=U.equals(e,e.original))),n)r.putBytes(e.bitStringContents);else if(e.composed){e.constructed?a|=32:r.putByte(0);for(var i=0;i<e.value.length;++i)e.value[i]!==void 0&&r.putBuffer(U.toDer(e.value[i]))}else if(e.type===U.Type.BMPSTRING)for(var i=0;i<e.value.length;++i)r.putInt16(e.value.charCodeAt(i));else e.type===U.Type.INTEGER&&e.value.length>1&&(e.value.charCodeAt(0)===0&&(e.value.charCodeAt(1)&128)===0||e.value.charCodeAt(0)===255&&(e.value.charCodeAt(1)&128)===128)?r.putBytes(e.value.substr(1)):r.putBytes(e.value);if(t.putByte(a),r.length()<=127)t.putByte(r.length()&127);else{var s=r.length(),o="";do o+=String.fromCharCode(s&255),s=s>>>8;while(s>0);t.putByte(o.length|128);for(var i=o.length-1;i>=0;--i)t.putByte(o.charCodeAt(i))}return t.putBuffer(r),t};U.oidToDer=function(e){var t=e.split("."),a=ye.util.createBuffer();a.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var r,n,i,s,o=2;o<t.length;++o){if(r=!0,n=[],i=parseInt(t[o],10),i>4294967295)throw new Error("OID value too large; max is 32-bits.");do s=i&127,i=i>>>7,r||(s|=128),n.push(s),r=!1;while(i>0);for(var u=n.length-1;u>=0;--u)a.putByte(n[u])}return a};U.derToOid=function(e){var t;typeof e=="string"&&(e=ye.util.createBuffer(e));var a=e.getByte();t=Math.floor(a/40)+"."+a%40;for(var r=0;e.length()>0;){if(r>70368744177663)throw new Error("OID value too large; max is 53-bits.");a=e.getByte(),r=r*128,a&128?r+=a&127:(t+="."+(r+a),r=0)}return t};U.utcTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,2),10);a=a>=50?1900+a:2e3+a;var r=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var u=e.charAt(10),c=10;u!=="+"&&u!=="-"&&(o=parseInt(e.substr(10,2),10),c+=2)}if(t.setUTCFullYear(a,r,n),t.setUTCHours(i,s,o,0),c&&(u=e.charAt(c),u==="+"||u==="-")){var l=parseInt(e.substr(c+1,2),10),f=parseInt(e.substr(c+4,2),10),p=l*60+f;p*=6e4,u==="+"?t.setTime(+t-p):t.setTime(+t+p)}return t};U.generalizedTimeToDate=function(e){var t=new Date,a=parseInt(e.substr(0,4),10),r=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),u=0,c=0,l=!1;e.charAt(e.length-1)==="Z"&&(l=!0);var f=e.length-5,p=e.charAt(f);if(p==="+"||p==="-"){var v=parseInt(e.substr(f+1,2),10),y=parseInt(e.substr(f+4,2),10);c=v*60+y,c*=6e4,p==="+"&&(c*=-1),l=!0}return e.charAt(14)==="."&&(u=parseFloat(e.substr(14),10)*1e3),l?(t.setUTCFullYear(a,r,n),t.setUTCHours(i,s,o,u),t.setTime(+t+c)):(t.setFullYear(a,r,n),t.setHours(i,s,o,u)),t};U.dateToUtcTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push((""+e.getUTCFullYear()).substr(2)),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.dateToGeneralizedTime=function(e){if(typeof e=="string")return e;var t="",a=[];a.push(""+e.getUTCFullYear()),a.push(""+(e.getUTCMonth()+1)),a.push(""+e.getUTCDate()),a.push(""+e.getUTCHours()),a.push(""+e.getUTCMinutes()),a.push(""+e.getUTCSeconds());for(var r=0;r<a.length;++r)a[r].length<2&&(t+="0"),t+=a[r];return t+="Z",t};U.integerToDer=function(e){var t=ye.util.createBuffer();if(e>=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var a=new Error("Integer too large; max is 32-bits.");throw a.integer=e,a};U.derToInteger=function(e){typeof e=="string"&&(e=ye.util.createBuffer(e));var t=e.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)};U.validate=function(e,t,a,r){var n=!1;if((e.tagClass===t.tagClass||typeof t.tagClass>"u")&&(e.type===t.type||typeof t.type>"u"))if(e.constructed===t.constructed||typeof t.constructed>"u"){if(n=!0,t.value&&ye.util.isArray(t.value))for(var i=0,s=0;n&&s<t.value.length;++s){var o=t.value[s];n=!!o.optional;var u=e.value[i];if(!u){o.optional||(n=!1,r&&r.push("["+t.name+'] Missing required element. Expected tag class "'+o.tagClass+'", type "'+o.type+'"'));continue}var c=typeof o.tagClass<"u"&&typeof o.type<"u";if(c&&(u.tagClass!==o.tagClass||u.type!==o.type))if(o.optional){n=!0;continue}else{n=!1,r&&r.push("["+t.name+"] Tag mismatch. Expected ("+o.tagClass+","+o.type+"), got ("+u.tagClass+","+u.type+")");break}var l=U.validate(u,o,a,r);if(l)++i,n=!0;else if(o.optional)n=!0;else{n=!1;break}}if(n&&a&&(t.capture&&(a[t.capture]=e.value),t.captureAsn1&&(a[t.captureAsn1]=e),t.captureBitStringContents&&"bitStringContents"in e&&(a[t.captureBitStringContents]=e.bitStringContents),t.captureBitStringValue&&"bitStringContents"in e)){var f;if(e.bitStringContents.length<2)a[t.captureBitStringValue]="";else{var p=e.bitStringContents.charCodeAt(0);if(p!==0)throw new Error("captureBitStringValue only supported for zero unused bits");a[t.captureBitStringValue]=e.bitStringContents.slice(1)}}}else r&&r.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+e.constructed+'"');else r&&(e.tagClass!==t.tagClass&&r.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&r.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));return n};var ki=/[^\\u0000-\\u00ff]/;U.prettyPrint=function(e,t,a){var r="";t=t||0,a=a||2,t>0&&(r+=`
|
|
8
|
+
`);for(var n="",i=0;i<t*a;++i)n+=" ";switch(r+=n+"Tag: ",e.tagClass){case U.Class.UNIVERSAL:r+="Universal:";break;case U.Class.APPLICATION:r+="Application:";break;case U.Class.CONTEXT_SPECIFIC:r+="Context-Specific:";break;case U.Class.PRIVATE:r+="Private:";break}if(e.tagClass===U.Class.UNIVERSAL)switch(r+=e.type,e.type){case U.Type.NONE:r+=" (None)";break;case U.Type.BOOLEAN:r+=" (Boolean)";break;case U.Type.INTEGER:r+=" (Integer)";break;case U.Type.BITSTRING:r+=" (Bit string)";break;case U.Type.OCTETSTRING:r+=" (Octet string)";break;case U.Type.NULL:r+=" (Null)";break;case U.Type.OID:r+=" (Object Identifier)";break;case U.Type.ODESC:r+=" (Object Descriptor)";break;case U.Type.EXTERNAL:r+=" (External or Instance of)";break;case U.Type.REAL:r+=" (Real)";break;case U.Type.ENUMERATED:r+=" (Enumerated)";break;case U.Type.EMBEDDED:r+=" (Embedded PDV)";break;case U.Type.UTF8:r+=" (UTF8)";break;case U.Type.ROID:r+=" (Relative Object Identifier)";break;case U.Type.SEQUENCE:r+=" (Sequence)";break;case U.Type.SET:r+=" (Set)";break;case U.Type.PRINTABLESTRING:r+=" (Printable String)";break;case U.Type.IA5String:r+=" (IA5String (ASCII))";break;case U.Type.UTCTIME:r+=" (UTC time)";break;case U.Type.GENERALIZEDTIME:r+=" (Generalized time)";break;case U.Type.BMPSTRING:r+=" (BMP String)";break}else r+=e.type;if(r+=`
|
|
9
9
|
`,r+=n+"Constructed: "+e.constructed+`
|
|
10
|
-
`,e.composed){for(var
|
|
10
|
+
`,e.composed){for(var s=0,o="",i=0;i<e.value.length;++i)e.value[i]!==void 0&&(s+=1,o+=U.prettyPrint(e.value[i],t+1,a),i+1<e.value.length&&(o+=","));r+=n+"Sub values: "+s+o}else{if(r+=n+"Value: ",e.type===U.Type.OID){var u=U.derToOid(e.value);r+=u,ye.pki&&ye.pki.oids&&u in ye.pki.oids&&(r+=" ("+ye.pki.oids[u]+") ")}if(e.type===U.Type.INTEGER)try{r+=U.derToInteger(e.value)}catch{r+="0x"+ye.util.bytesToHex(e.value)}else if(e.type===U.Type.BITSTRING){if(e.value.length>1?r+="0x"+ye.util.bytesToHex(e.value.slice(1)):r+="(none)",e.value.length>0){var c=e.value.charCodeAt(0);c==1?r+=" (1 unused bit shown)":c>1&&(r+=" ("+c+" unused bits shown)")}}else if(e.type===U.Type.OCTETSTRING)ki.test(e.value)||(r+="("+e.value+") "),r+="0x"+ye.util.bytesToHex(e.value);else if(e.type===U.Type.UTF8)try{r+=ye.util.decodeUtf8(e.value)}catch(l){if(l.message==="URI malformed")r+="0x"+ye.util.bytesToHex(e.value)+" (malformed UTF8)";else throw l}else e.type===U.Type.PRINTABLESTRING||e.type===U.Type.IA5String?r+=e.value:ki.test(e.value)?r+="0x"+ye.util.bytesToHex(e.value):e.value.length===0?r+="[null]":r+=e.value}return r}});var vt=F((zp,Ui)=>{var ra=$();Ui.exports=ra.md=ra.md||{};ra.md.algorithms=ra.md.algorithms||{}});var dr=F((Qp,Pi)=>{var wt=$();vt();ne();var Ic=Pi.exports=wt.hmac=wt.hmac||{};Ic.create=function(){var e=null,t=null,a=null,r=null,n={};return n.start=function(i,s){if(i!==null)if(typeof i=="string")if(i=i.toLowerCase(),i in wt.md.algorithms)t=wt.md.algorithms[i].create();else throw new Error('Unknown hash algorithm "'+i+'"');else t=i;if(s===null)s=e;else{if(typeof s=="string")s=wt.util.createBuffer(s);else if(wt.util.isArray(s)){var o=s;s=wt.util.createBuffer();for(var u=0;u<o.length;++u)s.putByte(o[u])}var c=s.length();c>t.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),a=wt.util.createBuffer(),r=wt.util.createBuffer(),c=s.length();for(var u=0;u<c;++u){var o=s.at(u);a.putByte(54^o),r.putByte(92^o)}if(c<t.blockLength)for(var o=t.blockLength-c,u=0;u<o;++u)a.putByte(54),r.putByte(92);e=s,a=a.bytes(),r=r.bytes()}t.start(),t.update(a)},n.update=function(i){t.update(i)},n.getMac=function(){var i=t.digest().bytes();return t.start(),t.update(r),t.update(i),t.digest()},n.digest=n.getMac,n}});var na=F(($p,Mi)=>{var mt=$();vt();ne();var Vi=Mi.exports=mt.md5=mt.md5||{};mt.md.md5=mt.md.algorithms.md5=Vi;Vi.create=function(){Fi||Bc();var e=null,t=mt.util.createBuffer(),a=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,i=0;i<n;++i)r.fullMessageLength.push(0);return t=mt.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},r},r.start(),r.update=function(n,i){i==="utf8"&&(n=mt.util.encodeUtf8(n));var s=n.length;r.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=s[1],s[1]=s[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),Oi(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=mt.util.createBuffer();n.putBytes(t.bytes());var i=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,s=i&r.blockLength-1;n.putBytes(Ja.substr(0,r.blockLength-s));for(var o,u=0,c=r.fullMessageLength.length-1;c>=0;--c)o=r.fullMessageLength[c]*8+u,u=o/4294967296>>>0,n.putInt32Le(o>>>0);var l={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};Oi(l,a,n);var f=mt.util.createBuffer();return f.putInt32Le(l.h0),f.putInt32Le(l.h1),f.putInt32Le(l.h2),f.putInt32Le(l.h3),f},r};var Ja=null,aa=null,Rr=null,hr=null,Fi=!1;function Bc(){Ja="\x80",Ja+=mt.util.fillString("\0",64),aa=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],Rr=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],hr=new Array(64);for(var e=0;e<64;++e)hr[e]=Math.floor(Math.abs(Math.sin(e+1))*4294967296);Fi=!0}function Oi(e,t,a){for(var r,n,i,s,o,u,c,l,f=a.length();f>=64;){for(n=e.h0,i=e.h1,s=e.h2,o=e.h3,l=0;l<16;++l)t[l]=a.getInt32Le(),u=o^i&(s^o),r=n+u+hr[l]+t[l],c=Rr[l],n=o,o=s,s=i,i+=r<<c|r>>>32-c;for(;l<32;++l)u=s^o&(i^s),r=n+u+hr[l]+t[aa[l]],c=Rr[l],n=o,o=s,s=i,i+=r<<c|r>>>32-c;for(;l<48;++l)u=i^s^o,r=n+u+hr[l]+t[aa[l]],c=Rr[l],n=o,o=s,s=i,i+=r<<c|r>>>32-c;for(;l<64;++l)u=s^(i|~o),r=n+u+hr[l]+t[aa[l]],c=Rr[l],n=o,o=s,s=i,i+=r<<c|r>>>32-c;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,f-=64}}});var Xt=F((jp,qi)=>{var sa=$();ne();var Ki=qi.exports=sa.pem=sa.pem||{};Ki.encode=function(e,t){t=t||{};var a="-----BEGIN "+e.type+`-----\r
|
|
11
11
|
`,r;if(e.procType&&(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]},a+=ia(r)),e.contentDomain&&(r={name:"Content-Domain",values:[e.contentDomain]},a+=ia(r)),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=ia(r)),e.headers)for(var n=0;n<e.headers.length;++n)a+=ia(e.headers[n]);return e.procType&&(a+=`\r
|
|
12
12
|
`),a+=sa.util.encode64(e.body,t.maxline||64)+`\r
|
|
13
13
|
`,a+="-----END "+e.type+`-----\r
|
|
14
|
-
`,a};Ki.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,
|
|
15
|
-
`;for(var
|
|
16
|
-
`+t.substr(
|
|
17
|
-
`+o+t.substr(i+1),s=n-i-1,i=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(i=n);return t}function bc(e){return e.replace(/^\s+/,"")}});var Lr=F((Yp,Gi)=>{var me=$();Xr();$a();ne();Gi.exports=me.des=me.des||{};me.des.startEncrypting=function(e,t,a,r){var n=oa({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};me.des.createEncryptionCipher=function(e,t){return oa({key:e,output:null,decrypt:!1,mode:t})};me.des.startDecrypting=function(e,t,a,r){var n=oa({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};me.des.createDecryptionCipher=function(e,t){return oa({key:e,output:null,decrypt:!0,mode:t})};me.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,n){return Hi(a._keys,r,n,!1)},decrypt:function(r,n){return Hi(a._keys,r,n,!0)}}}),a._init=!1};me.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=me.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=Pc(t),this._init=!0}};Ct("DES-ECB",me.cipher.modes.ecb);Ct("DES-CBC",me.cipher.modes.cbc);Ct("DES-CFB",me.cipher.modes.cfb);Ct("DES-OFB",me.cipher.modes.ofb);Ct("DES-CTR",me.cipher.modes.ctr);Ct("3DES-ECB",me.cipher.modes.ecb);Ct("3DES-CBC",me.cipher.modes.cbc);Ct("3DES-CFB",me.cipher.modes.cfb);Ct("3DES-OFB",me.cipher.modes.ofb);Ct("3DES-CTR",me.cipher.modes.ctr);function Ct(e,t){var a=function(){return new me.des.Algorithm(e,t)};me.cipher.registerAlgorithm(e,a)}var wc=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],_c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],Nc=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Rc=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],Lc=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],kc=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Dc=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Uc=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Pc(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],i=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],v=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,x=[],T=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,b,P=0;P<m;P++){var R=e.getInt32(),L=e.getInt32();b=(R>>>4^L)&252645135,L^=b,R^=b<<4,b=(L>>>-16^R)&65535,R^=b,L^=b<<-16,b=(R>>>2^L)&858993459,L^=b,R^=b<<2,b=(L>>>-16^R)&65535,R^=b,L^=b<<-16,b=(R>>>1^L)&1431655765,L^=b,R^=b<<1,b=(L>>>8^R)&16711935,R^=b,L^=b<<8,b=(R>>>1^L)&1431655765,L^=b,R^=b<<1,b=R<<8|L>>>20&240,R=L<<24|L<<8&16711680|L>>>8&65280|L>>>24&240,L=b;for(var z=0;z<T.length;++z){T[z]?(R=R<<2|R>>>26,L=L<<2|L>>>26):(R=R<<1|R>>>27,L=L<<1|L>>>27),R&=-15,L&=-15;var j=t[R>>>28]|a[R>>>24&15]|r[R>>>20&15]|n[R>>>16&15]|s[R>>>12&15]|i[R>>>8&15]|o[R>>>4&15],oe=u[L>>>28]|c[L>>>24&15]|l[L>>>20&15]|f[L>>>16&15]|p[L>>>12&15]|v[L>>>8&15]|y[L>>>4&15];b=(oe>>>16^j)&65535,x[B++]=j^b,x[B++]=oe^b<<16}}return x}function Hi(e,t,a,r){var n=e.length===32?3:9,s;n===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var i,o=t[0],u=t[1];i=(o>>>4^u)&252645135,u^=i,o^=i<<4,i=(o>>>16^u)&65535,u^=i,o^=i<<16,i=(u>>>2^o)&858993459,o^=i,u^=i<<2,i=(u>>>8^o)&16711935,o^=i,u^=i<<8,i=(o>>>1^u)&1431655765,u^=i,o^=i<<1,o=o<<1|o>>>31,u=u<<1|u>>>31;for(var c=0;c<n;c+=3){for(var l=s[c+1],f=s[c+2],p=s[c];p!=l;p+=f){var v=u^e[p],y=(u>>>4|u<<28)^e[p+1];i=o,o=u,u=i^(_c[v>>>24&63]|Rc[v>>>16&63]|kc[v>>>8&63]|Uc[v&63]|wc[y>>>24&63]|Nc[y>>>16&63]|Lc[y>>>8&63]|Dc[y&63])}i=o,o=u,u=i}o=o>>>1|o<<31,u=u>>>1|u<<31,i=(o>>>1^u)&1431655765,u^=i,o^=i<<1,i=(u>>>8^o)&16711935,o^=i,u^=i<<8,i=(u>>>2^o)&858993459,o^=i,u^=i<<2,i=(o>>>16^u)&65535,u^=i,o^=i<<16,i=(o>>>4^u)&252645135,u^=i,o^=i<<4,a[0]=o,a[1]=u}function oa(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=me.cipher.createDecipher(a,e.key):r=me.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(s,i){var o=null;i instanceof me.util.ByteBuffer&&(o=i,i={}),i=i||{},i.output=o,i.iv=s,n.call(r,i)},r}});var ua=F((Wp,zi)=>{var Ye=$();dr();vt();ne();var Oc=Ye.pkcs5=Ye.pkcs5||{},_t;Ye.util.isNodejs&&!Ye.options.usePureJavaScript&&(_t=require("crypto"));zi.exports=Ye.pbkdf2=Oc.pbkdf2=function(e,t,a,r,n,s){if(typeof n=="function"&&(s=n,n=null),Ye.util.isNodejs&&!Ye.options.usePureJavaScript&&_t.pbkdf2&&(n===null||typeof n!="object")&&(_t.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),s?_t.pbkdf2Sync.length===4?_t.pbkdf2(e,t,a,r,function(b,P){if(b)return s(b);s(null,P.toString("binary"))}):_t.pbkdf2(e,t,a,r,n,function(b,P){if(b)return s(b);s(null,P.toString("binary"))}):_t.pbkdf2Sync.length===4?_t.pbkdf2Sync(e,t,a,r).toString("binary"):_t.pbkdf2Sync(e,t,a,r,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Ye.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Ye.md[n].create()}var i=n.digestLength;if(r>4294967295*i){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var u=Math.ceil(r/i),c=r-(u-1)*i,l=Ye.hmac.create();l.start(n,e);var f="",p,v,y;if(!s){for(var m=1;m<=u;++m){l.start(null,null),l.update(t),l.update(Ye.util.int32ToBytes(m)),p=y=l.digest().getBytes();for(var x=2;x<=a;++x)l.start(null,null),l.update(y),v=l.digest().getBytes(),p=Ye.util.xorBytes(p,v,i),y=v;f+=m<u?p:p.substr(0,c)}return f}var m=1,x;function T(){if(m>u)return s(null,f);l.start(null,null),l.update(t),l.update(Ye.util.int32ToBytes(m)),p=y=l.digest().getBytes(),x=2,B()}function B(){if(x<=a)return l.start(null,null),l.update(y),v=l.digest().getBytes(),p=Ye.util.xorBytes(p,v,i),y=v,++x,Ye.util.setImmediate(B);f+=m<u?p:p.substr(0,c),++m,T()}T()}});var en=F((Xp,Wi)=>{var Et=$();vt();ne();var $i=Wi.exports=Et.sha256=Et.sha256||{};Et.md.sha256=Et.md.algorithms.sha256=$i;$i.create=function(){ji||Vc();var e=null,t=Et.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=Et.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=Et.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),Qi(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=Et.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(Za.substr(0,r.blockLength-i));for(var o,u,c=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,u=o/4294967296>>>0,c+=u,n.putInt32(c>>>0),c=o>>>0;n.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};Qi(f,a,n);var p=Et.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p.putInt32(f.h5),p.putInt32(f.h6),p.putInt32(f.h7),p},r};var Za=null,ji=!1,Yi=null;function Vc(){Za="\x80",Za+=Et.util.fillString("\0",64),Yi=[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],ji=!0}function Qi(e,t,a){for(var r,n,s,i,o,u,c,l,f,p,v,y,m,x,T,B=a.length();B>=64;){for(c=0;c<16;++c)t[c]=a.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,n=t[c-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=r+t[c-7]+n+t[c-16]|0;for(l=e.h0,f=e.h1,p=e.h2,v=e.h3,y=e.h4,m=e.h5,x=e.h6,T=e.h7,c=0;c<64;++c)i=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=x^y&(m^x),s=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),u=l&f|p&(l^f),r=T+i+o+Yi[c]+t[c],n=s+u,T=x,x=m,m=y,y=v+r>>>0,v=p,p=f,f=l,l=r+n>>>0;e.h0=e.h0+l|0,e.h1=e.h1+f|0,e.h2=e.h2+p|0,e.h3=e.h3+v|0,e.h4=e.h4+y|0,e.h5=e.h5+m|0,e.h6=e.h6+x|0,e.h7=e.h7+T|0,B-=64}}});var tn=F((Jp,Xi)=>{var xt=$();ne();var ca=null;xt.util.isNodejs&&!xt.options.usePureJavaScript&&!process.versions["node-webkit"]&&(ca=require("crypto"));var Fc=Xi.exports=xt.prng=xt.prng||{};Fc.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),n=0;n<32;++n)r[n]=a.create();t.pools=r,t.pool=0,t.generate=function(c,l){if(!l)return t.generateSync(c);var f=t.plugin.cipher,p=t.plugin.increment,v=t.plugin.formatKey,y=t.plugin.formatSeed,m=xt.util.createBuffer();t.key=null,x();function x(T){if(T)return l(T);if(m.length()>=c)return l(null,m.getBytes(c));if(t.generated>1048575&&(t.key=null),t.key===null)return xt.util.nextTick(function(){s(x)});var B=f(t.key,t.seed);t.generated+=B.length,m.putBytes(B),t.key=v(f(t.key,p(t.seed))),t.seed=y(f(t.key,t.seed)),xt.util.setImmediate(x)}},t.generateSync=function(c){var l=t.plugin.cipher,f=t.plugin.increment,p=t.plugin.formatKey,v=t.plugin.formatSeed;t.key=null;for(var y=xt.util.createBuffer();y.length()<c;){t.generated>1048575&&(t.key=null),t.key===null&&i();var m=l(t.key,t.seed);t.generated+=m.length,y.putBytes(m),t.key=p(l(t.key,f(t.seed))),t.seed=v(l(t.key,t.seed))}return y.getBytes(c)};function s(c){if(t.pools[0].messageLength>=32)return o(),c();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(f,p){if(f)return c(f);t.collect(p),o(),c()})}function i(){if(t.pools[0].messageLength>=32)return o();var c=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(c)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var c=t.plugin.md.create();c.update(t.keyBytes);for(var l=1,f=0;f<32;++f)t.reseeds%l===0&&(c.update(t.pools[f].digest().getBytes()),t.pools[f].start()),l=l<<1;t.keyBytes=c.digest().getBytes(),c.start(),c.update(t.keyBytes);var p=c.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(p),t.generated=0}function u(c){var l=null,f=xt.util.globalScope,p=f.crypto||f.msCrypto;p&&p.getRandomValues&&(l=function(R){return p.getRandomValues(R)});var v=xt.util.createBuffer();if(l)for(;v.length()<c;){var y=Math.max(1,Math.min(c-v.length(),65536)/4),m=new Uint32Array(Math.floor(y));try{l(m);for(var x=0;x<m.length;++x)v.putInt32(m[x])}catch(R){if(!(typeof QuotaExceededError<"u"&&R instanceof QuotaExceededError))throw R}}if(v.length()<c)for(var T,B,b,P=Math.floor(Math.random()*65536);v.length()<c;){B=16807*(P&65535),T=16807*(P>>16),B+=(T&32767)<<16,B+=T>>15,B=(B&2147483647)+(B>>31),P=B&4294967295;for(var x=0;x<3;++x)b=P>>>(x<<3),b^=Math.floor(Math.random()*256),v.putByte(b&255)}return v.getBytes(c)}return ca?(t.seedFile=function(c,l){ca.randomBytes(c,function(f,p){if(f)return l(f);l(null,p.toString())})},t.seedFileSync=function(c){return ca.randomBytes(c).toString()}):(t.seedFile=function(c,l){try{l(null,u(c))}catch(f){l(f)}},t.seedFileSync=u),t.collect=function(c){for(var l=c.length,f=0;f<l;++f)t.pools[t.pool].update(c.substr(f,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(c,l){for(var f="",p=0;p<l;p+=8)f+=String.fromCharCode(c>>p&255);t.collect(f)},t.registerWorker=function(c){if(c===self)t.seedFile=function(f,p){function v(y){var m=y.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",v),p(m.forge.prng.err,m.forge.prng.bytes))}self.addEventListener("message",v),self.postMessage({forge:{prng:{needed:f}}})};else{var l=function(f){var p=f.data;p.forge&&p.forge.prng&&t.seedFile(p.forge.prng.needed,function(v,y){c.postMessage({forge:{prng:{err:v,bytes:y}}})})};c.addEventListener("message",l)}},t}});var ot=F((Zp,rn)=>{var be=$();Ot();en();tn();ne();(function(){if(be.random&&be.random.getBytes){rn.exports=be.random;return}(function(e){var t={},a=new Array(4),r=be.util.createBuffer();t.formatKey=function(f){var p=be.util.createBuffer(f);return f=new Array(4),f[0]=p.getInt32(),f[1]=p.getInt32(),f[2]=p.getInt32(),f[3]=p.getInt32(),be.aes._expandKey(f,!1)},t.formatSeed=function(f){var p=be.util.createBuffer(f);return f=new Array(4),f[0]=p.getInt32(),f[1]=p.getInt32(),f[2]=p.getInt32(),f[3]=p.getInt32(),f},t.cipher=function(f,p){return be.aes._updateBlock(f,p,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(f){return++f[3],f},t.md=be.md.sha256;function n(){var f=be.prng.create(t);return f.getBytes=function(p,v){return f.generate(p,v)},f.getBytesSync=function(p){return f.generate(p)},f}var s=n(),i=null,o=be.util.globalScope,u=o.crypto||o.msCrypto;if(u&&u.getRandomValues&&(i=function(f){return u.getRandomValues(f)}),be.options.usePureJavaScript||!be.util.isNodejs&&!i){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var l in navigator)try{typeof navigator[l]=="string"&&(c+=navigator[l])}catch{}s.collect(c),c=null}e&&(e().mousemove(function(f){s.collectInt(f.clientX,16),s.collectInt(f.clientY,16)}),e().keypress(function(f){s.collectInt(f.charCode,8)}))}if(!be.random)be.random=s;else for(var l in s)be.random[l]=s[l];be.random.createInstance=n,rn.exports=be.random})(typeof jQuery<"u"?jQuery:null)})()});var nn=F((eg,es)=>{var Je=$();ne();var an=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Ji=[1,2,3,5],Mc=function(e,t){return e<<t&65535|(e&65535)>>16-t},Kc=function(e,t){return(e&65535)>>t|e<<16-t&65535};es.exports=Je.rc2=Je.rc2||{};Je.rc2.expandKey=function(e,t){typeof e=="string"&&(e=Je.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),n=t,s=Math.ceil(n/8),i=255>>(n&7),o;for(o=r;o<128;o++)a.putByte(an[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-s,an[a.at(128-s)&i]),o=127-s;o>=0;o--)a.setAt(o,an[a.at(o+1)^a.at(o+s)]);return a};var Zi=function(e,t,a){var r=!1,n=null,s=null,i=null,o,u,c,l,f=[];for(e=Je.rc2.expandKey(e,t),c=0;c<64;c++)f.push(e.getInt16Le());a?(o=function(y){for(c=0;c<4;c++)y[c]+=f[l]+(y[(c+3)%4]&y[(c+2)%4])+(~y[(c+3)%4]&y[(c+1)%4]),y[c]=Mc(y[c],Ji[c]),l++},u=function(y){for(c=0;c<4;c++)y[c]+=f[y[(c+3)%4]&63]}):(o=function(y){for(c=3;c>=0;c--)y[c]=Kc(y[c],Ji[c]),y[c]-=f[l]+(y[(c+3)%4]&y[(c+2)%4])+(~y[(c+3)%4]&y[(c+1)%4]),l--},u=function(y){for(c=3;c>=0;c--)y[c]-=f[y[(c+3)%4]&63]});var p=function(y){var m=[];for(c=0;c<4;c++){var x=n.getInt16Le();i!==null&&(a?x^=i.getInt16Le():i.putInt16Le(x)),m.push(x&65535)}l=a?0:63;for(var T=0;T<y.length;T++)for(var B=0;B<y[T][0];B++)y[T][1](m);for(c=0;c<4;c++)i!==null&&(a?i.putInt16Le(m[c]):m[c]^=i.getInt16Le()),s.putInt16Le(m[c])},v=null;return v={start:function(y,m){y&&typeof y=="string"&&(y=Je.util.createBuffer(y)),r=!1,n=Je.util.createBuffer(),s=m||new Je.util.createBuffer,i=y,v.output=s},update:function(y){for(r||n.putBuffer(y);n.length()>=8;)p([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(y){var m=!0;if(a)if(y)m=y(8,n,!a);else{var x=n.length()===8?8:8-n.length();n.fillWithByte(x,x)}if(m&&(r=!0,v.update()),!a&&(m=n.length()===0,m))if(y)m=y(8,s,!a);else{var T=s.length(),B=s.at(T-1);B>T?m=!1:s.truncate(B)}return m}},v};Je.rc2.startEncrypting=function(e,t,a){var r=Je.rc2.createEncryptionCipher(e,128);return r.start(t,a),r};Je.rc2.createEncryptionCipher=function(e,t){return Zi(e,t,!0)};Je.rc2.startDecrypting=function(e,t,a){var r=Je.rc2.createDecryptionCipher(e,128);return r.start(t,a),r};Je.rc2.createDecryptionCipher=function(e,t){return Zi(e,t,!1)}});var Dr=F((tg,us)=>{var sn=$();us.exports=sn.jsbn=sn.jsbn||{};var Nt,qc=0xdeadbeefcafe,ts=(qc&16777215)==15715070;function w(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}sn.jsbn.BigInteger=w;function te(){return new w(null)}function Hc(e,t,a,r,n,s){for(;--s>=0;){var i=t*this.data[e++]+a.data[r]+n;n=Math.floor(i/67108864),a.data[r++]=i&67108863}return n}function Gc(e,t,a,r,n,s){for(var i=t&32767,o=t>>15;--s>=0;){var u=this.data[e]&32767,c=this.data[e++]>>15,l=o*u+c*i;u=i*u+((l&32767)<<15)+a.data[r]+(n&1073741823),n=(u>>>30)+(l>>>15)+o*c+(n>>>30),a.data[r++]=u&1073741823}return n}function rs(e,t,a,r,n,s){for(var i=t&16383,o=t>>14;--s>=0;){var u=this.data[e]&16383,c=this.data[e++]>>14,l=o*u+c*i;u=i*u+((l&16383)<<14)+a.data[r]+n,n=(u>>28)+(l>>14)+o*c,a.data[r++]=u&268435455}return n}typeof navigator>"u"?(w.prototype.am=rs,Nt=28):ts&&navigator.appName=="Microsoft Internet Explorer"?(w.prototype.am=Gc,Nt=30):ts&&navigator.appName!="Netscape"?(w.prototype.am=Hc,Nt=26):(w.prototype.am=rs,Nt=28);w.prototype.DB=Nt;w.prototype.DM=(1<<Nt)-1;w.prototype.DV=1<<Nt;var on=52;w.prototype.FV=Math.pow(2,on);w.prototype.F1=on-Nt;w.prototype.F2=2*Nt-on;var zc="0123456789abcdefghijklmnopqrstuvwxyz",la=new Array,pr,ut;pr=48;for(ut=0;ut<=9;++ut)la[pr++]=ut;pr=97;for(ut=10;ut<36;++ut)la[pr++]=ut;pr=65;for(ut=10;ut<36;++ut)la[pr++]=ut;function as(e){return zc.charAt(e)}function ns(e,t){var a=la[e.charCodeAt(t)];return a??-1}function Qc(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function $c(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function Ft(e){var t=te();return t.fromInt(e),t}function jc(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,s=0;--r>=0;){var i=a==8?e[r]&255:ns(e,r);if(i<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,s==0?this.data[this.t++]=i:s+a>this.DB?(this.data[this.t-1]|=(i&(1<<this.DB-s)-1)<<s,this.data[this.t++]=i>>this.DB-s):this.data[this.t-1]|=i<<s,s+=a,s>=this.DB&&(s-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),n&&w.ZERO.subTo(this,this)}function Yc(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function Wc(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,n=!1,s="",i=this.t,o=this.DB-i*this.DB%t;if(i-- >0)for(o<this.DB&&(r=this.data[i]>>o)>0&&(n=!0,s=as(r));i>=0;)o<t?(r=(this.data[i]&(1<<o)-1)<<t-o,r|=this.data[--i]>>(o+=this.DB-t)):(r=this.data[i]>>(o-=t)&a,o<=0&&(o+=this.DB,--i)),r>0&&(n=!0),n&&(s+=as(r));return n?s:"0"}function Xc(){var e=te();return w.ZERO.subTo(this,e),e}function Jc(){return this.s<0?this.negate():this}function Zc(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function fa(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function el(){return this.t<=0?0:this.DB*(this.t-1)+fa(this.data[this.t-1]^this.s&this.DM)}function tl(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function rl(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function al(e,t){var a=e%this.DB,r=this.DB-a,n=(1<<r)-1,s=Math.floor(e/this.DB),i=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+s+1]=this.data[o]>>r|i,i=(this.data[o]&n)<<a;for(o=s-1;o>=0;--o)t.data[o]=0;t.data[s]=i,t.t=this.t+s+1,t.s=this.s,t.clamp()}function nl(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,s=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var i=a+1;i<this.t;++i)t.data[i-a-1]|=(this.data[i]&s)<<n,t.data[i-a]=this.data[i]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&s)<<n),t.t=this.t-a,t.clamp()}function il(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function sl(e,t){var a=this.abs(),r=e.abs(),n=a.t;for(t.t=n+r.t;--n>=0;)t.data[n]=0;for(n=0;n<r.t;++n)t.data[n+a.t]=a.am(0,r.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&w.ZERO.subTo(t,t)}function ol(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function ul(e,t,a){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=te());var s=te(),i=this.s,o=e.s,u=this.DB-fa(r.data[r.t-1]);u>0?(r.lShiftTo(u,s),n.lShiftTo(u,a)):(r.copyTo(s),n.copyTo(a));var c=s.t,l=s.data[c-1];if(l!=0){var f=l*(1<<this.F1)+(c>1?s.data[c-2]>>this.F2:0),p=this.FV/f,v=(1<<this.F1)/f,y=1<<this.F2,m=a.t,x=m-c,T=t??te();for(s.dlShiftTo(x,T),a.compareTo(T)>=0&&(a.data[a.t++]=1,a.subTo(T,a)),w.ONE.dlShiftTo(c,T),T.subTo(s,s);s.t<c;)s.data[s.t++]=0;for(;--x>=0;){var B=a.data[--m]==l?this.DM:Math.floor(a.data[m]*p+(a.data[m-1]+y)*v);if((a.data[m]+=s.am(0,B,a,x,0,c))<B)for(s.dlShiftTo(x,T),a.subTo(T,a);a.data[m]<--B;)a.subTo(T,a)}t!=null&&(a.drShiftTo(c,t),i!=o&&w.ZERO.subTo(t,t)),a.t=c,a.clamp(),u>0&&a.rShiftTo(u,a),i<0&&w.ZERO.subTo(a,a)}}}function cl(e){var t=te();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(w.ZERO)>0&&e.subTo(t,t),t}function Jt(e){this.m=e}function ll(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function fl(e){return e}function dl(e){e.divRemTo(this.m,null,e)}function hl(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function pl(e,t){e.squareTo(t),this.reduce(t)}Jt.prototype.convert=ll;Jt.prototype.revert=fl;Jt.prototype.reduce=dl;Jt.prototype.mulTo=hl;Jt.prototype.sqrTo=pl;function gl(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Zt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function yl(e){var t=te();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(w.ZERO)>0&&this.m.subTo(t,t),t}function vl(e){var t=te();return e.copyTo(t),this.reduce(t),t}function ml(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Cl(e,t){e.squareTo(t),this.reduce(t)}function El(e,t,a){e.multiplyTo(t,a),this.reduce(a)}Zt.prototype.convert=yl;Zt.prototype.revert=vl;Zt.prototype.reduce=ml;Zt.prototype.mulTo=El;Zt.prototype.sqrTo=Cl;function xl(){return(this.t>0?this.data[0]&1:this.s)==0}function Sl(e,t){if(e>4294967295||e<1)return w.ONE;var a=te(),r=te(),n=t.convert(this),s=fa(e)-1;for(n.copyTo(a);--s>=0;)if(t.sqrTo(a,r),(e&1<<s)>0)t.mulTo(r,n,a);else{var i=a;a=r,r=i}return t.revert(a)}function Tl(e,t){var a;return e<256||t.isEven()?a=new Jt(t):a=new Zt(t),this.exp(e,a)}w.prototype.copyTo=Qc;w.prototype.fromInt=$c;w.prototype.fromString=jc;w.prototype.clamp=Yc;w.prototype.dlShiftTo=tl;w.prototype.drShiftTo=rl;w.prototype.lShiftTo=al;w.prototype.rShiftTo=nl;w.prototype.subTo=il;w.prototype.multiplyTo=sl;w.prototype.squareTo=ol;w.prototype.divRemTo=ul;w.prototype.invDigit=gl;w.prototype.isEven=xl;w.prototype.exp=Sl;w.prototype.toString=Wc;w.prototype.negate=Xc;w.prototype.abs=Jc;w.prototype.compareTo=Zc;w.prototype.bitLength=el;w.prototype.mod=cl;w.prototype.modPowInt=Tl;w.ZERO=Ft(0);w.ONE=Ft(1);function Al(){var e=te();return this.copyTo(e),e}function Il(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Bl(){return this.t==0?this.s:this.data[0]<<24>>24}function bl(){return this.t==0?this.s:this.data[0]<<16>>16}function wl(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function _l(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Nl(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=Ft(a),n=te(),s=te(),i="";for(this.divRemTo(r,n,s);n.signum()>0;)i=(a+s.intValue()).toString(e).substr(1)+i,n.divRemTo(r,n,s);return s.intValue().toString(e)+i}function Rl(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),n=!1,s=0,i=0,o=0;o<e.length;++o){var u=ns(e,o);if(u<0){e.charAt(o)=="-"&&this.signum()==0&&(n=!0);continue}i=t*i+u,++s>=a&&(this.dMultiply(r),this.dAddOffset(i,0),s=0,i=0)}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(i,0)),n&&w.ZERO.subTo(this,this)}function Ll(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(w.ONE.shiftLeft(e-1),un,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(w.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function kl(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function Dl(e){return this.compareTo(e)==0}function Ul(e){return this.compareTo(e)<0?this:e}function Pl(e){return this.compareTo(e)>0?this:e}function Ol(e,t,a){var r,n,s=Math.min(e.t,this.t);for(r=0;r<s;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(n=e.s&this.DM,r=s;r<this.t;++r)a.data[r]=t(this.data[r],n);a.t=this.t}else{for(n=this.s&this.DM,r=s;r<e.t;++r)a.data[r]=t(n,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function Vl(e,t){return e&t}function Fl(e){var t=te();return this.bitwiseTo(e,Vl,t),t}function un(e,t){return e|t}function Ml(e){var t=te();return this.bitwiseTo(e,un,t),t}function is(e,t){return e^t}function Kl(e){var t=te();return this.bitwiseTo(e,is,t),t}function ss(e,t){return e&~t}function ql(e){var t=te();return this.bitwiseTo(e,ss,t),t}function Hl(){for(var e=te(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function Gl(e){var t=te();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function zl(e){var t=te();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Ql(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function $l(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+Ql(this.data[e]);return this.s<0?this.t*this.DB:-1}function jl(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Yl(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=jl(this.data[a]^t);return e}function Wl(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function Xl(e,t){var a=w.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function Jl(e){return this.changeBit(e,un)}function Zl(e){return this.changeBit(e,ss)}function e0(e){return this.changeBit(e,is)}function t0(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function r0(e){var t=te();return this.addTo(e,t),t}function a0(e){var t=te();return this.subTo(e,t),t}function n0(e){var t=te();return this.multiplyTo(e,t),t}function i0(){var e=te();return this.squareTo(e),e}function s0(e){var t=te();return this.divRemTo(e,t,null),t}function o0(e){var t=te();return this.divRemTo(e,null,t),t}function u0(e){var t=te(),a=te();return this.divRemTo(e,t,a),new Array(t,a)}function c0(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function l0(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function kr(){}function os(e){return e}function f0(e,t,a){e.multiplyTo(t,a)}function d0(e,t){e.squareTo(t)}kr.prototype.convert=os;kr.prototype.revert=os;kr.prototype.mulTo=f0;kr.prototype.sqrTo=d0;function h0(e){return this.exp(e,new kr)}function p0(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var n;for(n=a.t-this.t;r<n;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function g0(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function gr(e){this.r2=te(),this.q3=te(),w.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function y0(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=te();return e.copyTo(t),this.reduce(t),t}function v0(e){return e}function m0(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function C0(e,t){e.squareTo(t),this.reduce(t)}function E0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}gr.prototype.convert=y0;gr.prototype.revert=v0;gr.prototype.reduce=m0;gr.prototype.mulTo=E0;gr.prototype.sqrTo=C0;function x0(e,t){var a=e.bitLength(),r,n=Ft(1),s;if(a<=0)return n;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?s=new Jt(t):t.isEven()?s=new gr(t):s=new Zt(t);var i=new Array,o=3,u=r-1,c=(1<<r)-1;if(i[1]=s.convert(this),r>1){var l=te();for(s.sqrTo(i[1],l);o<=c;)i[o]=te(),s.mulTo(l,i[o-2],i[o]),o+=2}var f=e.t-1,p,v=!0,y=te(),m;for(a=fa(e.data[f])-1;f>=0;){for(a>=u?p=e.data[f]>>a-u&c:(p=(e.data[f]&(1<<a+1)-1)<<u-a,f>0&&(p|=e.data[f-1]>>this.DB+a-u)),o=r;(p&1)==0;)p>>=1,--o;if((a-=o)<0&&(a+=this.DB,--f),v)i[p].copyTo(n),v=!1;else{for(;o>1;)s.sqrTo(n,y),s.sqrTo(y,n),o-=2;o>0?s.sqrTo(n,y):(m=n,n=y,y=m),s.mulTo(y,i[p],n)}for(;f>=0&&(e.data[f]&1<<a)==0;)s.sqrTo(n,y),m=n,n=y,y=m,--a<0&&(a=this.DB-1,--f)}return s.revert(n)}function S0(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var n=t.getLowestSetBit(),s=a.getLowestSetBit();if(s<0)return t;for(n<s&&(s=n),s>0&&(t.rShiftTo(s,t),a.rShiftTo(s,a));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=a.getLowestSetBit())>0&&a.rShiftTo(n,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return s>0&&a.lShiftTo(s,a),a}function T0(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function A0(e){if(this.signum()==0)return w.ZERO;var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return w.ZERO;for(var a=e.clone(),r=this.clone(),n=Ft(1),s=Ft(0),i=Ft(0),o=Ft(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!n.isEven()||!s.isEven())&&(n.addTo(this,n),s.subTo(e,s)),n.rShiftTo(1,n)):s.isEven()||s.subTo(e,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),t?((!i.isEven()||!o.isEven())&&(i.addTo(this,i),o.subTo(e,o)),i.rShiftTo(1,i)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&n.subTo(i,n),s.subTo(o,s)):(r.subTo(a,r),t&&i.subTo(n,i),o.subTo(s,o))}if(r.compareTo(w.ONE)!=0)return w.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var yt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],I0=(1<<26)/yt[yt.length-1];function B0(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=yt[yt.length-1]){for(t=0;t<yt.length;++t)if(a.data[0]==yt[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<yt.length;){for(var r=yt[t],n=t+1;n<yt.length&&r<I0;)r*=yt[n++];for(r=a.modInt(r);t<n;)if(r%yt[t++]==0)return!1}return a.millerRabin(e)}function b0(e){var t=this.subtract(w.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),n=w0(),s,i=0;i<e;++i){do s=new w(this.bitLength(),n);while(s.compareTo(w.ONE)<=0||s.compareTo(t)>=0);var o=s.modPow(r,this);if(o.compareTo(w.ONE)!=0&&o.compareTo(t)!=0){for(var u=1;u++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(w.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function w0(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}w.prototype.chunkSize=wl;w.prototype.toRadix=Nl;w.prototype.fromRadix=Rl;w.prototype.fromNumber=Ll;w.prototype.bitwiseTo=Ol;w.prototype.changeBit=Xl;w.prototype.addTo=t0;w.prototype.dMultiply=c0;w.prototype.dAddOffset=l0;w.prototype.multiplyLowerTo=p0;w.prototype.multiplyUpperTo=g0;w.prototype.modInt=T0;w.prototype.millerRabin=b0;w.prototype.clone=Al;w.prototype.intValue=Il;w.prototype.byteValue=Bl;w.prototype.shortValue=bl;w.prototype.signum=_l;w.prototype.toByteArray=kl;w.prototype.equals=Dl;w.prototype.min=Ul;w.prototype.max=Pl;w.prototype.and=Fl;w.prototype.or=Ml;w.prototype.xor=Kl;w.prototype.andNot=ql;w.prototype.not=Hl;w.prototype.shiftLeft=Gl;w.prototype.shiftRight=zl;w.prototype.getLowestSetBit=$l;w.prototype.bitCount=Yl;w.prototype.testBit=Wl;w.prototype.setBit=Jl;w.prototype.clearBit=Zl;w.prototype.flipBit=e0;w.prototype.add=r0;w.prototype.subtract=a0;w.prototype.multiply=n0;w.prototype.divide=s0;w.prototype.remainder=o0;w.prototype.divideAndRemainder=u0;w.prototype.modPow=x0;w.prototype.modInverse=A0;w.prototype.pow=h0;w.prototype.gcd=S0;w.prototype.isProbablePrime=B0;w.prototype.square=i0});var yr=F((rg,ds)=>{var St=$();vt();ne();var ls=ds.exports=St.sha1=St.sha1||{};St.md.sha1=St.md.algorithms.sha1=ls;ls.create=function(){fs||_0();var e=null,t=St.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,s=0;s<n;++s)r.fullMessageLength.push(0);return t=St.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(n,s){s==="utf8"&&(n=St.util.encodeUtf8(n));var i=n.length;r.messageLength+=i,i=[i/4294967296>>>0,i>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=i[1],i[1]=i[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,i[0]=i[1]/4294967296>>>0;return t.putBytes(n),cs(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=St.util.createBuffer();n.putBytes(t.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,i=s&r.blockLength-1;n.putBytes(cn.substr(0,r.blockLength-i));for(var o,u,c=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,u=o/4294967296>>>0,c+=u,n.putInt32(c>>>0),c=o>>>0;n.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};cs(f,a,n);var p=St.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p},r};var cn=null,fs=!1;function _0(){cn="\x80",cn+=St.util.fillString("\0",64),fs=!0}function cs(e,t,a){for(var r,n,s,i,o,u,c,l,f=a.length();f>=64;){for(n=e.h0,s=e.h1,i=e.h2,o=e.h3,u=e.h4,l=0;l<16;++l)r=a.getInt32(),t[l]=r,c=o^s&(i^o),r=(n<<5|n>>>27)+c+u+1518500249+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;l<20;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,c=o^s&(i^o),r=(n<<5|n>>>27)+c+u+1518500249+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;l<32;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,c=s^i^o,r=(n<<5|n>>>27)+c+u+1859775393+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;l<40;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=s^i^o,r=(n<<5|n>>>27)+c+u+1859775393+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;l<60;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=s&i|o&(s^i),r=(n<<5|n>>>27)+c+u+2400959708+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;for(;l<80;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=s^i^o,r=(n<<5|n>>>27)+c+u+3395469782+r,u=o,o=i,i=(s<<30|s>>>2)>>>0,s=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+s|0,e.h2=e.h2+i|0,e.h3=e.h3+o|0,e.h4=e.h4+u|0,f-=64}}});var ln=F((ag,ps)=>{var Tt=$();ne();ot();yr();var hs=ps.exports=Tt.pkcs1=Tt.pkcs1||{};hs.encode_rsa_oaep=function(e,t,a){var r,n,s,i;typeof a=="string"?(r=a,n=arguments[3]||void 0,s=arguments[4]||void 0):a&&(r=a.label||void 0,n=a.seed||void 0,s=a.md||void 0,a.mgf1&&a.mgf1.md&&(i=a.mgf1.md)),s?s.start():s=Tt.md.sha1.create(),i||(i=s);var o=Math.ceil(e.n.bitLength()/8),u=o-2*s.digestLength-2;if(t.length>u){var c=new Error("RSAES-OAEP input message length is too long.");throw c.length=t.length,c.maxLength=u,c}r||(r=""),s.update(r,"raw");for(var l=s.digest(),f="",p=u-t.length,v=0;v<p;v++)f+="\0";var y=l.getBytes()+f+""+t;if(!n)n=Tt.random.getBytes(s.digestLength);else if(n.length!==s.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=n.length,c.digestLength=s.digestLength,c}var m=da(n,o-s.digestLength-1,i),x=Tt.util.xorBytes(y,m,y.length),T=da(x,s.digestLength,i),B=Tt.util.xorBytes(n,T,n.length);return"\0"+B+x};hs.decode_rsa_oaep=function(e,t,a){var r,n,s;typeof a=="string"?(r=a,n=arguments[3]||void 0):a&&(r=a.label||void 0,n=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md));var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var x=new Error("RSAES-OAEP encoded message length is invalid.");throw x.length=t.length,x.expectedLength=i,x}if(n===void 0?n=Tt.md.sha1.create():n.start(),s||(s=n),i<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),n.update(r,"raw");for(var o=n.digest().getBytes(),u=t.charAt(0),c=t.substring(1,n.digestLength+1),l=t.substring(1+n.digestLength),f=da(l,n.digestLength,s),p=Tt.util.xorBytes(c,f,c.length),v=da(p,i-n.digestLength-1,s),y=Tt.util.xorBytes(l,v,l.length),m=y.substring(0,n.digestLength),x=u!=="\0",T=0;T<n.digestLength;++T)x|=o.charAt(T)!==m.charAt(T);for(var B=1,b=n.digestLength,P=n.digestLength;P<y.length;P++){var R=y.charCodeAt(P),L=R&1^1,z=B?65534:0;x|=R&z,B=B&L,b+=B}if(x||y.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(b+1)};function da(e,t,a){a||(a=Tt.md.sha1.create());for(var r="",n=Math.ceil(t/a.digestLength),s=0;s<n;++s){var i=String.fromCharCode(s>>24&255,s>>16&255,s>>8&255,s&255);a.start(),a.update(e+i),r+=a.digest().getBytes()}return r.substring(0,t)}});var dn=F((ng,fn)=>{var Mt=$();ne();Dr();ot();(function(){if(Mt.prime){fn.exports=Mt.prime;return}var e=fn.exports=Mt.prime=Mt.prime||{},t=Mt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var n=function(f,p){return f|p};e.generateProbablePrime=function(f,p,v){typeof p=="function"&&(v=p,p={}),p=p||{};var y=p.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var m=p.prng||Mt.random,x={nextBytes:function(T){for(var B=m.getBytesSync(T.length),b=0;b<T.length;++b)T[b]=B.charCodeAt(b)}};if(y.name==="PRIMEINC")return s(f,x,y.options,v);throw new Error("Invalid prime generation algorithm: "+y.name)};function s(f,p,v,y){return"workers"in v?u(f,p,v,y):i(f,p,v,y)}function i(f,p,v,y){var m=c(f,p),x=0,T=l(m.bitLength());"millerRabinTests"in v&&(T=v.millerRabinTests);var B=10;"maxBlockTime"in v&&(B=v.maxBlockTime),o(m,f,p,x,T,B,y)}function o(f,p,v,y,m,x,T){var B=+new Date;do{if(f.bitLength()>p&&(f=c(p,v)),f.isProbablePrime(m))return T(null,f);f.dAddOffset(a[y++%8],0)}while(x<0||+new Date-B<x);Mt.util.setImmediate(function(){o(f,p,v,y,m,x,T)})}function u(f,p,v,y){if(typeof Worker>"u")return i(f,p,v,y);var m=c(f,p),x=v.workers,T=v.workLoad||100,B=T*30/8,b=v.workerScript||"forge/prime.worker.js";if(x===-1)return Mt.util.estimateCores(function(R,L){R&&(L=2),x=L-1,P()});P();function P(){x=Math.max(1,x);for(var R=[],L=0;L<x;++L)R[L]=new Worker(b);for(var z=x,L=0;L<x;++L)R[L].addEventListener("message",oe);var j=!1;function oe(ce){if(!j){--z;var de=ce.data;if(de.found){for(var ge=0;ge<R.length;++ge)R[ge].terminate();return j=!0,y(null,new t(de.prime,16))}m.bitLength()>f&&(m=c(f,p));var $e=m.toString(16);ce.target.postMessage({hex:$e,workLoad:T}),m.dAddOffset(B,0)}}}}function c(f,p){var v=new t(f,p),y=f-1;return v.testBit(y)||v.bitwiseTo(t.ONE.shiftLeft(y),n,v),v.dAddOffset(31-v.mod(r).byteValue(),0),v}function l(f){return f<=100?27:f<=150?18:f<=200?15:f<=250?12:f<=300?9:f<=350?8:f<=400?7:f<=500?6:f<=600?5:f<=800?4:f<=1250?3:2}})()});var Ur=F((ig,xs)=>{var K=$();gt();Dr();Vt();ln();dn();ot();ne();typeof re>"u"&&(re=K.jsbn.BigInteger);var re,hn=K.util.isNodejs?require("crypto"):null,A=K.asn1,ct=K.util;K.pki=K.pki||{};xs.exports=K.pki.rsa=K.rsa=K.rsa||{};var G=K.pki,N0=[6,4,2,4,2,4,6,2],R0={name:"PrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},L0={name:"RSAPrivateKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},k0={name:"RSAPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},D0=K.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},U0={name:"DigestInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},P0=function(e){var t;if(e.algorithm in G.oids)t=G.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=A.oidToDer(t).getBytes(),n=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[]),s=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[]);s.value.push(A.create(A.Class.UNIVERSAL,A.Type.OID,!1,r)),s.value.push(A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,""));var i=A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(s),n.value.push(i),A.toDer(n).getBytes()},Cs=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(re.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(re.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new re(K.util.bytesToHex(K.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(re.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var n=e.mod(t.p).modPow(t.dP,t.p),s=e.mod(t.q).modPow(t.dQ,t.q);n.compareTo(s)<0;)n=n.add(t.p);var i=n.subtract(s).multiply(t.qInv).mod(t.p).multiply(t.q).add(s);return i=i.multiply(r.modInverse(t.n)).mod(t.n),i};G.rsa.encrypt=function(e,t,a){var r=a,n,s=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,n=Es(e,t,a)):(n=K.util.createBuffer(),n.putBytes(e));for(var i=new re(n.toHex(),16),o=Cs(i,t,r),u=o.toString(16),c=K.util.createBuffer(),l=s-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(K.util.hexToBytes(u)),c.getBytes()};G.rsa.decrypt=function(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8);if(e.length!==n){var s=new Error("Encrypted message length is invalid.");throw s.length=e.length,s.expected=n,s}var i=new re(K.util.createBuffer(e).toHex(),16);if(i.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=Cs(i,t,a),u=o.toString(16),c=K.util.createBuffer(),l=n-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(K.util.hexToBytes(u)),r!==!1?ha(c.getBytes(),t,a):c.getBytes()};G.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||K.random,n={nextBytes:function(o){for(var u=r.getBytesSync(o.length),c=0;c<o.length;++c)o[c]=u.charCodeAt(c)}},s=a.algorithm||"PRIMEINC",i;if(s==="PRIMEINC")i={algorithm:s,state:0,bits:e,rng:n,eInt:t||65537,e:new re(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},i.e.fromInt(i.eInt);else throw new Error("Invalid key generation algorithm: "+s);return i};G.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new re(null);a.fromInt(30);for(var r=0,n=function(f,p){return f|p},s=+new Date,i,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var u=e.p===null?e.pBits:e.qBits,c=u-1;e.pqState===0?(e.num=new re(u,e.rng),e.num.testBit(c)||e.num.bitwiseTo(re.ONE.shiftLeft(c),n,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>u?e.pqState=0:e.num.isProbablePrime(V0(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(N0[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(re.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:G.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:G.rsa.setPublicKey(e.n,e.e)}}i=+new Date,o+=i-s,s=i}return e.keys!==null};G.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!K.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(gs("generateKeyPair"))return hn.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,u,c){if(o)return r(o);r(null,{privateKey:G.privateKeyFromPem(c),publicKey:G.publicKeyFromPem(u)})});if(ys("generateKey")&&ys("exportKey"))return ct.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ms(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return ct.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var u=G.privateKeyFromAsn1(A.fromDer(K.util.createBuffer(o)));r(null,{privateKey:u,publicKey:G.setRsaPublicKey(u.n,u.e)})}});if(vs("generateKey")&&vs("exportKey")){var n=ct.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ms(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var u=o.target.result,c=ct.globalScope.msCrypto.subtle.exportKey("pkcs8",u.privateKey);c.oncomplete=function(l){var f=l.target.result,p=G.privateKeyFromAsn1(A.fromDer(K.util.createBuffer(f)));r(null,{privateKey:p,publicKey:G.setRsaPublicKey(p.n,p.e)})},c.onerror=function(l){r(l)}},n.onerror=function(o){r(o)};return}}else if(gs("generateKeyPairSync")){var s=hn.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:G.privateKeyFromPem(s.privateKey),publicKey:G.publicKeyFromPem(s.publicKey)}}}var i=G.rsa.createKeyPairGenerationState(e,t,a);if(!r)return G.rsa.stepKeyPairGenerationState(i,0),i.keys;O0(i,a,r)};G.setRsaPublicKey=G.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,n,s){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,u,c){return Es(o,u,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,u){return K.pkcs1.encode_rsa_oaep(u,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var i=n.encode(r,a,!0);return G.rsa.encrypt(i,a,!0)},a.verify=function(r,n,s,i){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),i===void 0&&(i={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in i||(i._parseAllDigestBytes=!0),"_skipPaddingChecks"in i||(i._skipPaddingChecks=!1),s==="RSASSA-PKCS1-V1_5"?s={verify:function(u,c){c=ha(c,a,!0,void 0,i);var l=A.fromDer(c,{parseAllBytes:i._parseAllDigestBytes}),f={},p=[];if(!A.validate(l,U0,f,p)||l.value.length!==2){var v=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw v.errors=p,v}var y=A.derToOid(f.algorithmIdentifier);if(!(y===K.oids.md2||y===K.oids.md5||y===K.oids.sha1||y===K.oids.sha224||y===K.oids.sha256||y===K.oids.sha384||y===K.oids.sha512||y===K.oids["sha512-224"]||y===K.oids["sha512-256"])){var v=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw v.oid=y,v}if((y===K.oids.md2||y===K.oids.md5)&&!("parameters"in f))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return u===f.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(u,c){return c=ha(c,a,!0,void 0,i),u===c}});var o=G.rsa.decrypt(n,a,!0,!1);return s.verify(r,o,a.n.bitLength())},a};G.setRsaPrivateKey=G.rsa.setPrivateKey=function(e,t,a,r,n,s,i,o){var u={n:e,e:t,d:a,p:r,q:n,dP:s,dQ:i,qInv:o};return u.decrypt=function(c,l,f){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var p=G.rsa.decrypt(c,u,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:ha};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(v,y){return K.pkcs1.decode_rsa_oaep(y,v,f)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(v){return v}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(p,u,!1)},u.sign=function(c,l){var f=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:P0},f=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return c}},f=1);var p=l.encode(c,u.n.bitLength());return G.rsa.encrypt(p,u,f)},u};G.wrapRsaPrivateKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,A.integerToDer(0).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(G.oids.rsaEncryption).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")]),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,A.toDer(e).getBytes())])};G.privateKeyFromAsn1=function(e){var t={},a=[];if(A.validate(e,R0,t,a)&&(e=A.fromDer(K.util.createBuffer(t.privateKey))),t={},a=[],!A.validate(e,L0,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var n,s,i,o,u,c,l,f;return n=K.util.createBuffer(t.privateKeyModulus).toHex(),s=K.util.createBuffer(t.privateKeyPublicExponent).toHex(),i=K.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=K.util.createBuffer(t.privateKeyPrime1).toHex(),u=K.util.createBuffer(t.privateKeyPrime2).toHex(),c=K.util.createBuffer(t.privateKeyExponent1).toHex(),l=K.util.createBuffer(t.privateKeyExponent2).toHex(),f=K.util.createBuffer(t.privateKeyCoefficient).toHex(),G.setRsaPrivateKey(new re(n,16),new re(s,16),new re(i,16),new re(o,16),new re(u,16),new re(c,16),new re(l,16),new re(f,16))};G.privateKeyToAsn1=G.privateKeyToRSAPrivateKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,A.integerToDer(0).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.n)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.e)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.d)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.p)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.q)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.dP)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.dQ)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.qInv))])};G.publicKeyFromAsn1=function(e){var t={},a=[];if(A.validate(e,D0,t,a)){var r=A.derToOid(t.publicKeyOid);if(r!==G.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=r,n}e=t.rsaPublicKey}if(a=[],!A.validate(e,k0,t,a)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=a,n}var s=K.util.createBuffer(t.publicKeyModulus).toHex(),i=K.util.createBuffer(t.publicKeyExponent).toHex();return G.setRsaPublicKey(new re(s,16),new re(i,16))};G.publicKeyToAsn1=G.publicKeyToSubjectPublicKeyInfo=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(G.oids.rsaEncryption).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")]),A.create(A.Class.UNIVERSAL,A.Type.BITSTRING,!1,[G.publicKeyToRSAPublicKey(e)])])};G.publicKeyToRSAPublicKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.n)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.e))])};function Es(e,t,a){var r=K.util.createBuffer(),n=Math.ceil(t.n.bitLength()/8);if(e.length>n-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=n-11,s}r.putByte(0),r.putByte(a);var i=n-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var u=0;u<i;++u)r.putByte(o)}else for(;i>0;){for(var c=0,l=K.random.getBytes(i),u=0;u<i;++u)o=l.charCodeAt(u),o===0?++c:r.putByte(o);i=c}return r.putByte(0),r.putBytes(e),r}function ha(e,t,a,r,n){var s=Math.ceil(t.n.bitLength()/8),i=K.util.createBuffer(e),o=i.getByte(),u=i.getByte();if(o!==0||a&&u!==0&&u!==1||!a&&u!==2||a&&u===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var c=0;if(u===0){c=s-3-r;for(var l=0;l<c;++l)if(i.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(u===1){for(c=0;i.length()>1;){if(i.getByte()!==255){--i.read;break}++c}if(c<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(u===2){for(c=0;i.length()>1;){if(i.getByte()===0){--i.read;break}++c}if(c<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var f=i.getByte();if(f!==0||c!==s-3-i.length())throw new Error("Encryption block is invalid.");return i.getBytes()}function O0(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),n();function n(){s(e.pBits,function(o,u){if(o)return a(o);if(e.p=u,e.q!==null)return i(o,e.q);s(e.qBits,i)})}function s(o,u){K.prime.generateProbablePrime(o,r,u)}function i(o,u){if(o)return a(o);if(e.q=u,e.p.compareTo(e.q)<0){var c=e.p;e.p=e.q,e.q=c}if(e.p.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.p=null,n();return}if(e.q.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.q=null,s(e.qBits,i);return}if(e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(re.ONE)!==0){e.p=e.q=null,n();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,s(e.qBits,i);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:G.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:G.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function At(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=K.util.hexToBytes(t);return a.length>1&&(a.charCodeAt(0)===0&&(a.charCodeAt(1)&128)===0||a.charCodeAt(0)===255&&(a.charCodeAt(1)&128)===128)?a.substr(1):a}function V0(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function gs(e){return K.util.isNodejs&&typeof hn[e]=="function"}function ys(e){return typeof ct.globalScope<"u"&&typeof ct.globalScope.crypto=="object"&&typeof ct.globalScope.crypto.subtle=="object"&&typeof ct.globalScope.crypto.subtle[e]=="function"}function vs(e){return typeof ct.globalScope<"u"&&typeof ct.globalScope.msCrypto=="object"&&typeof ct.globalScope.msCrypto.subtle=="object"&&typeof ct.globalScope.msCrypto.subtle[e]=="function"}function ms(e){for(var t=K.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}});var pn=F((sg,Bs)=>{var V=$();Ot();gt();Lr();vt();Vt();ua();Xt();ot();nn();Ur();ne();typeof Ss>"u"&&(Ss=V.jsbn.BigInteger);var Ss,I=V.asn1,Q=V.pki=V.pki||{};Bs.exports=Q.pbe=V.pbe=V.pbe||{};var er=Q.oids,F0={name:"EncryptedPrivateKeyInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},M0={name:"PBES2Algorithms",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},K0={name:"pkcs-12PbeParams",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"iterations"}]};Q.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=V.random.getBytesSync(a.saltSize),n=a.count,s=I.integerToDer(n),i,o,u;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var c,l,f;switch(a.algorithm){case"aes128":i=16,c=16,l=er["aes128-CBC"],f=V.aes.createEncryptionCipher;break;case"aes192":i=24,c=16,l=er["aes192-CBC"],f=V.aes.createEncryptionCipher;break;case"aes256":i=32,c=16,l=er["aes256-CBC"],f=V.aes.createEncryptionCipher;break;case"des":i=8,c=8,l=er.desCBC,f=V.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=a.algorithm,p}var v="hmacWith"+a.prfAlgorithm.toUpperCase(),y=Is(v),m=V.pkcs5.pbkdf2(t,r,n,i,y),x=V.random.getBytesSync(c),T=f(m);T.start(x),T.update(I.toDer(e)),T.finish(),u=T.output.getBytes();var B=q0(r,s,i,v);o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er.pkcs5PBES2).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er.pkcs5PBKDF2).getBytes()),B]),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(l).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,x)])])])}else if(a.algorithm==="3des"){i=24;var b=new V.util.ByteBuffer(r),m=Q.pbe.generatePkcs12Key(t,b,1,n,i),x=Q.pbe.generatePkcs12Key(t,b,2,n,i),T=V.des.createEncryptionCipher(m);T.start(x),T.update(I.toDer(e)),T.finish(),u=T.output.getBytes(),o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,r),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,s.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=a.algorithm,p}var P=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[o,I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,u)]);return P};Q.decryptPrivateKeyInfo=function(e,t){var a=null,r={},n=[];if(!I.validate(e,F0,r,n)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=I.derToOid(r.encryptionOid),o=Q.pbe.getCipher(i,r.encryptionParams,t),u=V.util.createBuffer(r.encryptedData);return o.update(u),o.finish()&&(a=I.fromDer(o.output)),a};Q.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:I.toDer(e).getBytes()};return V.pem.encode(a,{maxline:t})};Q.encryptedPrivateKeyFromPem=function(e){var t=V.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return I.fromDer(t.body)};Q.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=Q.wrapRsaPrivateKey(Q.privateKeyToAsn1(e));return r=Q.encryptPrivateKeyInfo(r,t,a),Q.encryptedPrivateKeyToPem(r)}var n,s,i,o;switch(a.algorithm){case"aes128":n="AES-128-CBC",i=16,s=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",i=24,s=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",i=32,s=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",i=24,s=V.random.getBytesSync(8),o=V.des.createEncryptionCipher;break;case"des":n="DES-CBC",i=8,s=V.random.getBytesSync(8),o=V.des.createEncryptionCipher;break;default:var u=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw u.algorithm=a.algorithm,u}var c=V.pbe.opensslDeriveBytes(t,s.substr(0,8),i),l=o(c);l.start(s),l.update(I.toDer(Q.privateKeyToAsn1(e))),l.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:V.util.bytesToHex(s).toUpperCase()},body:l.output.getBytes()};return V.pem.encode(f)};Q.decryptRsaPrivateKey=function(e,t){var a=null,r=V.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,i;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,i=V.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,i=V.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,i=V.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,i=V.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,i=V.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,i=function(f){return V.rc2.createDecryptionCipher(f,40)};break;case"RC2-64-CBC":s=8,i=function(f){return V.rc2.createDecryptionCipher(f,64)};break;case"RC2-128-CBC":s=16,i=function(f){return V.rc2.createDecryptionCipher(f,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw n.algorithm=r.dekInfo.algorithm,n}var o=V.util.hexToBytes(r.dekInfo.parameters),u=V.pbe.opensslDeriveBytes(t,o.substr(0,8),s),c=i(u);if(c.start(o),c.update(V.util.createBuffer(r.body)),c.finish())a=c.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=Q.decryptPrivateKeyInfo(I.fromDer(a),t):a=I.fromDer(a),a!==null&&(a=Q.privateKeyFromAsn1(a)),a};Q.pbe.generatePkcs12Key=function(e,t,a,r,n,s){var i,o;if(typeof s>"u"||s===null){if(!("sha1"in V.md))throw new Error('"sha1" hash algorithm unavailable.');s=V.md.sha1.create()}var u=s.digestLength,c=s.blockLength,l=new V.util.ByteBuffer,f=new V.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)f.putInt16(e.charCodeAt(o));f.putInt16(0)}var p=f.length(),v=t.length(),y=new V.util.ByteBuffer;y.fillWithByte(a,c);var m=c*Math.ceil(v/c),x=new V.util.ByteBuffer;for(o=0;o<m;o++)x.putByte(t.at(o%v));var T=c*Math.ceil(p/c),B=new V.util.ByteBuffer;for(o=0;o<T;o++)B.putByte(f.at(o%p));var b=x;b.putBuffer(B);for(var P=Math.ceil(n/u),R=1;R<=P;R++){var L=new V.util.ByteBuffer;L.putBytes(y.bytes()),L.putBytes(b.bytes());for(var z=0;z<r;z++)s.start(),s.update(L.getBytes()),L=s.digest();var j=new V.util.ByteBuffer;for(o=0;o<c;o++)j.putByte(L.at(o%u));var oe=Math.ceil(v/c)+Math.ceil(p/c),ce=new V.util.ByteBuffer;for(i=0;i<oe;i++){var de=new V.util.ByteBuffer(b.getBytes(c)),ge=511;for(o=j.length()-1;o>=0;o--)ge=ge>>8,ge+=j.at(o)+de.at(o),de.setAt(o,ge&255);ce.putBuffer(de)}b=ce,l.putBuffer(L)}return l.truncate(l.length()-n),l};Q.pbe.getCipher=function(e,t,a){switch(e){case Q.oids.pkcs5PBES2:return Q.pbe.getCipherForPBES2(e,t,a);case Q.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Q.oids["pbewithSHAAnd40BitRC2-CBC"]:return Q.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};Q.pbe.getCipherForPBES2=function(e,t,a){var r={},n=[];if(!I.validate(t,M0,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}if(e=I.derToOid(r.kdfOid),e!==Q.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=e,s.supportedOids=["pkcs5PBKDF2"],s}if(e=I.derToOid(r.encOid),e!==Q.oids["aes128-CBC"]&&e!==Q.oids["aes192-CBC"]&&e!==Q.oids["aes256-CBC"]&&e!==Q.oids["des-EDE3-CBC"]&&e!==Q.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=e,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var i=r.kdfSalt,o=V.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var u,c;switch(Q.oids[e]){case"aes128-CBC":u=16,c=V.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,c=V.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,c=V.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,c=V.des.createDecryptionCipher;break;case"desCBC":u=8,c=V.des.createDecryptionCipher;break}var l=As(r.prfOid),f=V.pkcs5.pbkdf2(a,i,o,u,l),p=r.encIv,v=c(f);return v.start(p),v};Q.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},n=[];if(!I.validate(t,K0,r,n)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=n,s}var i=V.util.createBuffer(r.salt),o=V.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var u,c,l;switch(e){case Q.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,l=V.des.startDecrypting;break;case Q.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,l=function(m,x){var T=V.rc2.createDecryptionCipher(m,40);return T.start(x,null),T};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=e,s}var f=As(r.prfOid),p=Q.pbe.generatePkcs12Key(a,i,1,o,u,f);f.start();var v=Q.pbe.generatePkcs12Key(a,i,2,o,c,f);return l(p,v)};Q.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in V.md))throw new Error('"md5" hash algorithm unavailable.');r=V.md.md5.create()}t===null&&(t="");for(var n=[Ts(r,e+t)],s=16,i=1;s<a;++i,s+=16)n.push(Ts(r,n[i-1]+e+t));return n.join("").substr(0,a)};function Ts(e,t){return e.start().update(t).digest().getBytes()}function As(e){var t;if(!e)t="hmacWithSHA1";else if(t=Q.oids[I.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return Is(t)}function Is(e){var t=V.md;switch(e){case"hmacWithSHA224":t=V.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function q0(e,t,a,r){var n=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,e),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&n.value.push(I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,V.util.hexToBytes(a.toString(16))),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(Q.oids[r]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")])),n}});var gn=F((og,_s)=>{var vr=$();gt();ne();var O=vr.asn1,mr=_s.exports=vr.pkcs7asn1=vr.pkcs7asn1||{};vr.pkcs7=vr.pkcs7||{};vr.pkcs7.asn1=mr;var bs={name:"ContentInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};mr.contentInfoValidator=bs;var ws={name:"EncryptedContentInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};mr.envelopedDataValidator={name:"EnvelopedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(ws)};mr.encryptedDataValidator={name:"EncryptedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"}].concat(ws)};var H0={name:"SignerInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};mr.signedDataValidator={name:"SignedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},bs,{name:"SignedData.Certificates",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,capture:"signerInfos",optional:!0,value:[H0]}]};mr.recipientInfoValidator={name:"RecipientInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var yn=F((ug,Ns)=>{var tr=$();ne();tr.mgf=tr.mgf||{};var G0=Ns.exports=tr.mgf.mgf1=tr.mgf1=tr.mgf1||{};G0.create=function(e){var t={generate:function(a,r){for(var n=new tr.util.ByteBuffer,s=Math.ceil(r/e.digestLength),i=0;i<s;i++){var o=new tr.util.ByteBuffer;o.putInt32(i),e.start(),e.update(a+o.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}};return t}});var Ls=F((cg,Rs)=>{var pa=$();yn();Rs.exports=pa.mgf=pa.mgf||{};pa.mgf.mgf1=pa.mgf1});var ga=F((lg,ks)=>{var rr=$();ot();ne();var z0=ks.exports=rr.pss=rr.pss||{};z0.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,n=e.salt||null;typeof n=="string"&&(n=rr.util.createBuffer(n));var s;if("saltLength"in e)s=e.saltLength;else if(n!==null)s=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==s)throw new Error("Given salt length does not match length of given salt.");var i=e.prng||rr.random,o={};return o.encode=function(u,c){var l,f=c-1,p=Math.ceil(f/8),v=u.digest().getBytes();if(p<r+s+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=i.getBytesSync(s):y=n.bytes();var m=new rr.util.ByteBuffer;m.fillWithByte(0,8),m.putBytes(v),m.putBytes(y),t.start(),t.update(m.getBytes());var x=t.digest().getBytes(),T=new rr.util.ByteBuffer;T.fillWithByte(0,p-s-r-2),T.putByte(1),T.putBytes(y);var B=T.getBytes(),b=p-r-1,P=a.generate(x,b),R="";for(l=0;l<b;l++)R+=String.fromCharCode(B.charCodeAt(l)^P.charCodeAt(l));var L=65280>>8*p-f&255;return R=String.fromCharCode(R.charCodeAt(0)&~L)+R.substr(1),R+x+"\xBC"},o.verify=function(u,c,l){var f,p=l-1,v=Math.ceil(p/8);if(c=c.substr(-v),v<r+s+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(c.charCodeAt(v-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=v-r-1,m=c.substr(0,y),x=c.substr(y,r),T=65280>>8*v-p&255;if((m.charCodeAt(0)&T)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(x,y),b="";for(f=0;f<y;f++)b+=String.fromCharCode(m.charCodeAt(f)^B.charCodeAt(f));b=String.fromCharCode(b.charCodeAt(0)&~T)+b.substr(1);var P=v-r-s-2;for(f=0;f<P;f++)if(b.charCodeAt(f)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(P)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var R=b.substr(-s),L=new rr.util.ByteBuffer;L.fillWithByte(0,8),L.putBytes(u),L.putBytes(R),t.start(),t.update(L.getBytes());var z=t.digest().getBytes();return x===z},o}});var ma=F((fg,Vs)=>{var q=$();Ot();gt();Lr();vt();Ls();Vt();Xt();ga();Ur();ne();var d=q.asn1,k=Vs.exports=q.pki=q.pki||{},ae=k.oids,Ce={};Ce.CN=ae.commonName;Ce.commonName="CN";Ce.C=ae.countryName;Ce.countryName="C";Ce.L=ae.localityName;Ce.localityName="L";Ce.ST=ae.stateOrProvinceName;Ce.stateOrProvinceName="ST";Ce.O=ae.organizationName;Ce.organizationName="O";Ce.OU=ae.organizationalUnitName;Ce.organizationalUnitName="OU";Ce.E=ae.emailAddress;Ce.emailAddress="E";var Us=q.pki.rsa.publicKeyValidator,Q0={name:"Certificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Us,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},$0={name:"rsapss",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},j0={name:"CertificationRequestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Us,{name:"CertificationRequestInfo.attributes",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:d.Class.UNIVERSAL,type:d.Type.SET,constructed:!0}]}]}]},Y0={name:"CertificationRequest",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[j0,{name:"CertificationRequest.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};k.RDNAttributesAsArray=function(e,t){for(var a=[],r,n,s,i=0;i<e.value.length;++i){r=e.value[i];for(var o=0;o<r.value.length;++o)s={},n=r.value[o],s.type=d.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in ae&&(s.name=ae[s.type],s.name in Ce&&(s.shortName=Ce[s.name])),t&&(t.update(s.type),t.update(s.value)),a.push(s)}return a};k.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],n=d.derToOid(r.value[0].value),s=r.value[1].value,i=0;i<s.length;++i){var o={};if(o.type=n,o.value=s[i].value,o.valueTagClass=s[i].type,o.type in ae&&(o.name=ae[o.type],o.name in Ce&&(o.shortName=Ce[o.name])),o.type===ae.extensionRequest){o.extensions=[];for(var u=0;u<o.value.length;++u)o.extensions.push(k.certificateExtensionFromAsn1(o.value[u]))}t.push(o)}return t};function Kt(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,n=0;a===null&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var ya=function(e,t,a){var r={};if(e!==ae["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:ae.sha1},mgf:{algorithmOid:ae.mgf1,hash:{algorithmOid:ae.sha1}},saltLength:20});var n={},s=[];if(!d.validate(t,$0,n,s)){var i=new Error("Cannot read RSASSA-PSS parameter block.");throw i.errors=s,i}return n.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=d.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=d.derToOid(n.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=d.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(r.saltLength=n.saltLength.charCodeAt(0)),r},va=function(e){switch(ae[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return q.md.sha1.create();case"md5WithRSAEncryption":return q.md.md5.create();case"sha256WithRSAEncryption":return q.md.sha256.create();case"sha384WithRSAEncryption":return q.md.sha384.create();case"sha512WithRSAEncryption":return q.md.sha512.create();case"RSASSA-PSS":return q.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},Ps=function(e){var t=e.certificate,a;switch(t.signatureOid){case ae.sha1WithRSAEncryption:case ae.sha1WithRSASignature:break;case ae["RSASSA-PSS"]:var r,n;if(r=ae[t.signatureParameters.mgf.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported MGF hash function.");throw s.oid=t.signatureParameters.mgf.hash.algorithmOid,s.name=r,s}if(n=ae[t.signatureParameters.mgf.algorithmOid],n===void 0||q.mgf[n]===void 0){var s=new Error("Unsupported MGF function.");throw s.oid=t.signatureParameters.mgf.algorithmOid,s.name=n,s}if(n=q.mgf[n].create(q.md[r].create()),r=ae[t.signatureParameters.hash.algorithmOid],r===void 0||q.md[r]===void 0){var s=new Error("Unsupported RSASSA-PSS hash function.");throw s.oid=t.signatureParameters.hash.algorithmOid,s.name=r,s}a=q.pss.create(q.md[r].create(),n,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,a)};k.certificateFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var s=d.fromDer(r.body,a);return k.certificateFromAsn1(s,t)};k.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:d.toDer(k.certificateToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyFromPem=function(e){var t=q.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=d.fromDer(t.body);return k.publicKeyFromAsn1(r)};k.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:d.toDer(k.publicKeyToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:d.toDer(k.publicKeyToRSAPublicKey(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||q.md.sha1.create(),r=t.type||"RSAPublicKey",n;switch(r){case"RSAPublicKey":n=d.toDer(k.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":n=d.toDer(k.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(n);var s=a.digest();if(t.encoding==="hex"){var i=s.toHex();return t.delimiter?i.match(/.{2}/g).join(t.delimiter):i}else{if(t.encoding==="binary")return s.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return s};k.certificationRequestFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var s=d.fromDer(r.body,a);return k.certificationRequestFromAsn1(s,t)};k.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:d.toDer(k.certificationRequestToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Kt(e.issuer,t)},e.issuer.addField=function(t){lt([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Kt(e.subject,t)},e.subject.addField=function(t){lt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){lt(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){lt(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)Os(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,n=0;a===null&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=k.getTBSCertificate(e);var s=d.toDer(e.tbsCertificate);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,n=e.subject,s=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw s.expectedIssuer=n.attributes,s.actualIssuer=r.attributes,s}var i=t.md;if(i===null){i=va({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||k.getTBSCertificate(t),u=d.toDer(o);i.update(u.getBytes())}return i!==null&&(a=Ps({certificate:e,md:i,signature:t.signature})),a},e.isIssuer=function(t){var a=!1,r=e.issuer,n=t.subject;if(r.hash&&n.hash)a=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){a=!0;for(var s,i,o=0;a&&o<r.attributes.length;++o)s=r.attributes[o],i=n.attributes[o],(s.type!==i.type||s.value!==i.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return k.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=ae.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var n=e.generateSubjectKeyIdentifier().getBytes();return q.util.hexToBytes(r.subjectKeyIdentifier)===n}}return!1},e};k.certificateFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,Q0,a,r)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=r,n}var s=d.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificate();i.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=q.util.createBuffer(a.certSerialNumber);i.serialNumber=o.toHex(),i.signatureOid=q.asn1.derToOid(a.certSignatureOid),i.signatureParameters=ya(i.signatureOid,a.certSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.certinfoSignatureOid),i.siginfo.parameters=ya(i.siginfo.algorithmOid,a.certinfoSignatureParams,!1),i.signature=a.certSignature;var u=[];if(a.certValidity1UTCTime!==void 0&&u.push(d.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&u.push(d.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&u.push(d.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&u.push(d.generalizedTimeToDate(a.certValidity4GeneralizedTime)),u.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(u.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(i.validity.notBefore=u[0],i.validity.notAfter=u[1],i.tbsCertificate=a.tbsCertificate,t){i.md=va({signatureOid:i.signatureOid,type:"certificate"});var c=d.toDer(i.tbsCertificate);i.md.update(c.getBytes())}var l=q.md.sha1.create(),f=d.toDer(a.certIssuer);l.update(f.getBytes()),i.issuer.getField=function(y){return Kt(i.issuer,y)},i.issuer.addField=function(y){lt([y]),i.issuer.attributes.push(y)},i.issuer.attributes=k.RDNAttributesAsArray(a.certIssuer),a.certIssuerUniqueId&&(i.issuer.uniqueId=a.certIssuerUniqueId),i.issuer.hash=l.digest().toHex();var p=q.md.sha1.create(),v=d.toDer(a.certSubject);return p.update(v.getBytes()),i.subject.getField=function(y){return Kt(i.subject,y)},i.subject.addField=function(y){lt([y]),i.subject.attributes.push(y)},i.subject.attributes=k.RDNAttributesAsArray(a.certSubject),a.certSubjectUniqueId&&(i.subject.uniqueId=a.certSubjectUniqueId),i.subject.hash=p.digest().toHex(),a.certExtensions?i.extensions=k.certificateExtensionsFromAsn1(a.certExtensions):i.extensions=[],i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i};k.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],n=0;n<r.value.length;++n)t.push(k.certificateExtensionFromAsn1(r.value[n]));return t};k.certificateExtensionFromAsn1=function(e){var t={};if(t.id=d.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===d.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in ae){if(t.name=ae[t.id],t.name==="keyUsage"){var a=d.fromDer(t.value),r=0,n=0;a.value.length>1&&(r=a.value.charCodeAt(1),n=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(n&128)===128}else if(t.name==="basicConstraints"){var a=d.fromDer(t.value);a.value.length>0&&a.value[0].type===d.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var s=null;a.value.length>0&&a.value[0].type===d.Type.INTEGER?s=a.value[0].value:a.value.length>1&&(s=a.value[1].value),s!==null&&(t.pathLenConstraint=d.derToInteger(s))}else if(t.name==="extKeyUsage")for(var a=d.fromDer(t.value),i=0;i<a.value.length;++i){var o=d.derToOid(a.value[i].value);o in ae?t[ae[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=d.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var u,a=d.fromDer(t.value),c=0;c<a.value.length;++c){u=a.value[c];var l={type:u.type,value:u.value};switch(t.altNames.push(l),u.type){case 1:case 2:case 6:break;case 7:l.ip=q.util.bytesToIP(u.value);break;case 8:l.oid=d.derToOid(u.value);break;default:}}}else if(t.name==="subjectKeyIdentifier"){var a=d.fromDer(t.value);t.subjectKeyIdentifier=q.util.bytesToHex(a.value)}}return t};k.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,Y0,a,r)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=r,n}var s=d.derToOid(a.publicKeyOid);if(s!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var i=k.createCertificationRequest();if(i.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,i.signatureOid=q.asn1.derToOid(a.csrSignatureOid),i.signatureParameters=ya(i.signatureOid,a.csrSignatureParams,!0),i.siginfo.algorithmOid=q.asn1.derToOid(a.csrSignatureOid),i.siginfo.parameters=ya(i.siginfo.algorithmOid,a.csrSignatureParams,!1),i.signature=a.csrSignature,i.certificationRequestInfo=a.certificationRequestInfo,t){i.md=va({signatureOid:i.signatureOid,type:"certification request"});var o=d.toDer(i.certificationRequestInfo);i.md.update(o.getBytes())}var u=q.md.sha1.create();return i.subject.getField=function(c){return Kt(i.subject,c)},i.subject.addField=function(c){lt([c]),i.subject.attributes.push(c)},i.subject.attributes=k.RDNAttributesAsArray(a.certificationRequestInfoSubject,u),i.subject.hash=u.digest().toHex(),i.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),i.getAttribute=function(c){return Kt(i,c)},i.addAttribute=function(c){lt([c]),i.attributes.push(c)},i.attributes=k.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),i};k.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Kt(e.subject,t)},e.subject.addField=function(t){lt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Kt(e,t)},e.addAttribute=function(t){lt([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){lt(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){lt(t),e.attributes=t},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=k.getCertificationRequestInfo(e);var s=d.toDer(e.certificationRequestInfo);e.md.update(s.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){a=va({signatureOid:e.signatureOid,type:"certification request"});var r=e.certificationRequestInfo||k.getCertificationRequestInfo(e),n=d.toDer(r);a.update(n.getBytes())}return a!==null&&(t=Ps({certificate:e,md:a,signature:e.signature})),t},e};function Cr(e){for(var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),a,r,n=e.attributes,s=0;s<n.length;++s){a=n[s];var i=a.value,o=d.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===d.Type.UTF8&&(i=q.util.encodeUtf8(i))),r=d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(a.type).getBytes()),d.create(d.Class.UNIVERSAL,o,!1,i)])]),t.value.push(r)}return t}function lt(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in k.oids?t.name=k.oids[t.type]:t.shortName&&t.shortName in Ce&&(t.name=k.oids[Ce[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in k.oids)t.type=k.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in Ce&&(t.shortName=Ce[t.name]),t.type===ae.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=d.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(k.certificateExtensionToAsn1(Os(t.extensions[n])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function Os(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in k.oids&&(e.name=k.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in k.oids)e.id=k.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,n=0,s=0;e.digitalSignature&&(n|=128,r=7),e.nonRepudiation&&(n|=64,r=6),e.keyEncipherment&&(n|=32,r=5),e.dataEncipherment&&(n|=16,r=4),e.keyAgreement&&(n|=8,r=3),e.keyCertSign&&(n|=4,r=2),e.cRLSign&&(n|=2,r=1),e.encipherOnly&&(n|=1,r=0),e.decipherOnly&&(s|=128,r=7);var i=String.fromCharCode(r);s!==0?i+=String.fromCharCode(n)+String.fromCharCode(s):n!==0&&(i+=String.fromCharCode(n)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,i)}else if(e.name==="basicConstraints")e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in e&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var u in e)e[u]===!0&&(u in ae?o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(ae[u]).getBytes())):u.indexOf(".")!==-1&&o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(u).getBytes())))}else if(e.name==="nsCertType"){var r=0,n=0;e.client&&(n|=128,r=7),e.server&&(n|=64,r=6),e.email&&(n|=32,r=5),e.objsign&&(n|=16,r=4),e.reserved&&(n|=8,r=3),e.sslCA&&(n|=4,r=2),e.emailCA&&(n|=2,r=1),e.objCA&&(n|=1,r=0);var i=String.fromCharCode(r);n!==0&&(i+=String.fromCharCode(n)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,i)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var i=c.value;if(c.type===7&&c.ip){if(i=q.util.bytesFromIP(c.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else c.type===8&&(c.oid?i=d.oidToDer(d.oidToDer(c.oid)):i=d.oidToDer(i));e.value.value.push(d.create(d.Class.CONTEXT_SPECIFIC,c.type,!1,i))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=d.create(d.Class.UNIVERSAL,d.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,f.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var p=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var v=[d.create(d.Class.CONTEXT_SPECIFIC,4,!0,[Cr(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,v))}if(e.serialNumber){var y=q.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var o=e.value.value,m=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),x=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]),c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var i=c.value;if(c.type===7&&c.ip){if(i=q.util.bytesFromIP(c.ip),i===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else c.type===8&&(c.oid?i=d.oidToDer(d.oidToDer(c.oid)):i=d.oidToDer(i));x.value.push(d.create(d.Class.CONTEXT_SPECIFIC,c.type,!1,i))}m.value.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[x])),o.push(m)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function vn(e,t){switch(e){case ae["RSASSA-PSS"]:var a=[];return t.hash.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(t.saltLength).getBytes())])),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,a);default:return d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")}}function W0(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var n=a[r],s=n.value,i=d.Type.UTF8;"valueTagClass"in n&&(i=n.valueTagClass),i===d.Type.UTF8&&(s=q.util.encodeUtf8(s));var o=!1;"valueConstructed"in n&&(o=n.valueConstructed);var u=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(n.type).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,i,o,s)])]);t.value.push(u)}return t}var X0=new Date("1950-01-01T00:00:00Z"),J0=new Date("2050-01-01T00:00:00Z");function Ds(e){return e>=X0&&e<J0?d.create(d.Class.UNIVERSAL,d.Type.UTCTIME,!1,d.dateToUtcTime(e)):d.create(d.Class.UNIVERSAL,d.Type.GENERALIZEDTIME,!1,d.dateToGeneralizedTime(e))}k.getTBSCertificate=function(e){var t=Ds(e.validity.notBefore),a=Ds(e.validity.notAfter),r=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes())]),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,q.util.hexToBytes(e.serialNumber)),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.siginfo.algorithmOid).getBytes()),vn(e.siginfo.algorithmOid,e.siginfo.parameters)]),Cr(e.issuer),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,a]),Cr(e.subject),k.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(k.certificateExtensionsToAsn1(e.extensions)),r};k.getCertificationRequestInfo=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes()),Cr(e.subject),k.publicKeyToAsn1(e.publicKey),W0(e)]);return t};k.distinguishedNameToAsn1=function(e){return Cr(e)};k.certificateToAsn1=function(e){var t=e.tbsCertificate||k.getTBSCertificate(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),vn(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};k.certificateExtensionsToAsn1=function(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,3,!0,[]),a=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(k.certificateExtensionToAsn1(e[r]));return t};k.certificateExtensionToAsn1=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.id).getBytes())),e.critical&&t.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF"));var a=e.value;return typeof e.value!="string"&&(a=d.toDer(a).getBytes()),t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,a)),t};k.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||k.getCertificationRequestInfo(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),vn(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};k.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(i){var o=a(i.issuer);return o},t.addCertificate=function(i){if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))if(i.subject.hash in t.certs){var o=t.certs[i.subject.hash];q.util.isArray(o)||(o=[o]),o.push(i),t.certs[i.subject.hash]=o}else t.certs[i.subject.hash]=i},t.hasCertificate=function(i){typeof i=="string"&&(i=q.pki.certificateFromPem(i));var o=a(i.subject);if(!o)return!1;q.util.isArray(o)||(o=[o]);for(var u=d.toDer(k.certificateToAsn1(i)).getBytes(),c=0;c<o.length;++c){var l=d.toDer(k.certificateToAsn1(o[c])).getBytes();if(u===l)return!0}return!1},t.listAllCertificates=function(){var i=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var u=t.certs[o];if(!q.util.isArray(u))i.push(u);else for(var c=0;c<u.length;++c)i.push(u[c])}return i},t.removeCertificate=function(i){var o;if(typeof i=="string"&&(i=q.pki.certificateFromPem(i)),r(i.subject),!t.hasCertificate(i))return null;var u=a(i.subject);if(!q.util.isArray(u))return o=t.certs[i.subject.hash],delete t.certs[i.subject.hash],o;for(var c=d.toDer(k.certificateToAsn1(i)).getBytes(),l=0;l<u.length;++l){var f=d.toDer(k.certificateToAsn1(u[l])).getBytes();c===f&&(o=u[l],u.splice(l,1))}return u.length===0&&delete t.certs[i.subject.hash],o};function a(i){return r(i),t.certs[i.hash]||null}function r(i){if(!i.hash){var o=q.md.sha1.create();i.attributes=k.RDNAttributesAsArray(Cr(i),o),i.hash=o.digest().toHex()}}if(e)for(var n=0;n<e.length;++n){var s=e[n];t.addCertificate(s)}return t};k.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};k.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),n=a.validityCheckDate;typeof n>"u"&&(n=new Date);var s=!0,i=null,o=0;do{var u=t.shift(),c=null,l=!1;if(n&&(n<u.validity.notBefore||n>u.validity.notAfter)&&(i={message:"Certificate is not valid yet or has expired.",error:k.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:n}),i===null){if(c=t[0]||e.getIssuer(u),c===null&&u.isIssuer(u)&&(l=!0,c=u),c){var f=c;q.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){c=f.shift();try{p=c.verify(u)}catch{}}p||(i={message:"Certificate signature is invalid.",error:k.certificateError.bad_certificate})}i===null&&(!c||l)&&!e.hasCertificate(u)&&(i={message:"Certificate is not trusted.",error:k.certificateError.unknown_ca})}if(i===null&&c&&!u.isIssuer(c)&&(i={message:"Certificate issuer is invalid.",error:k.certificateError.bad_certificate}),i===null)for(var v={keyUsage:!0,basicConstraints:!0},y=0;i===null&&y<u.extensions.length;++y){var m=u.extensions[y];m.critical&&!(m.name in v)&&(i={message:"Certificate has an unsupported critical extension.",error:k.certificateError.unsupported_certificate})}if(i===null&&(!s||t.length===0&&(!c||l))){var x=u.getExtension("basicConstraints"),T=u.getExtension("keyUsage");if(T!==null&&(!T.keyCertSign||x===null)&&(i={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:k.certificateError.bad_certificate}),i===null&&x===null&&(i={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:k.certificateError.bad_certificate}),i===null&&x!==null&&!x.cA&&(i={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:k.certificateError.bad_certificate}),i===null&&T!==null&&"pathLenConstraint"in x){var B=o-1;B>x.pathLenConstraint&&(i={message:"Certificate basicConstraints pathLenConstraint violated.",error:k.certificateError.bad_certificate})}}var b=i===null?!0:i.error,P=a.verify?a.verify(b,o,r):b;if(P===!0)i=null;else throw b===!0&&(i={message:"The application rejected the certificate.",error:k.certificateError.bad_certificate}),(P||P===0)&&(typeof P=="object"&&!q.util.isArray(P)?(P.message&&(i.message=P.message),P.error&&(i.error=P.error)):typeof P=="string"&&(i.error=P)),i;s=!1,++o}while(t.length>0);return!0}});var Cn=F((dg,Ms)=>{var pe=$();gt();dr();Vt();gn();pn();ot();Ur();yr();ne();ma();var C=pe.asn1,X=pe.pki,Or=Ms.exports=pe.pkcs12=pe.pkcs12||{},Fs={name:"ContentInfo",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},Z0={name:"PFX",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:C.Class.UNIVERSAL,type:C.Type.INTEGER,constructed:!1,capture:"version"},Fs,{name:"PFX.macData",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:C.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:C.Class.UNIVERSAL,type:C.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:C.Class.UNIVERSAL,type:C.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:C.Class.UNIVERSAL,type:C.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},ef={name:"SafeBag",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:C.Class.UNIVERSAL,type:C.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},tf={name:"Attribute",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:C.Class.UNIVERSAL,type:C.Type.SET,constructed:!0,capture:"values"}]},rf={name:"CertBag",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:C.Class.UNIVERSAL,type:C.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Pr(e,t,a,r){for(var n=[],s=0;s<e.length;s++)for(var i=0;i<e[s].safeBags.length;i++){var o=e[s].safeBags[i];if(!(r!==void 0&&o.type!==r)){if(t===null){n.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&n.push(o)}}return n}Or.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},n=[];if(!C.validate(e,Z0,r,n)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var i={version:r.version.charCodeAt(0),safeContents:[],getBags:function(x){var T={},B;return"localKeyId"in x?B=x.localKeyId:"localKeyIdHex"in x&&(B=pe.util.hexToBytes(x.localKeyIdHex)),B===void 0&&!("friendlyName"in x)&&"bagType"in x&&(T[x.bagType]=Pr(i.safeContents,null,null,x.bagType)),B!==void 0&&(T.localKeyId=Pr(i.safeContents,"localKeyId",B,x.bagType)),"friendlyName"in x&&(T.friendlyName=Pr(i.safeContents,"friendlyName",x.friendlyName,x.bagType)),T},getBagsByFriendlyName:function(x,T){return Pr(i.safeContents,"friendlyName",x,T)},getBagsByLocalKeyId:function(x,T){return Pr(i.safeContents,"localKeyId",x,T)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(C.derToOid(r.contentType)!==X.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=C.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==C.Class.UNIVERSAL||o.type!==C.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=mn(o),r.mac){var u=null,c=0,l=C.derToOid(r.macAlgorithm);switch(l){case X.oids.sha1:u=pe.md.sha1.create(),c=20;break;case X.oids.sha256:u=pe.md.sha256.create(),c=32;break;case X.oids.sha384:u=pe.md.sha384.create(),c=48;break;case X.oids.sha512:u=pe.md.sha512.create(),c=64;break;case X.oids.md5:u=pe.md.md5.create(),c=16;break}if(u===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+l);var f=new pe.util.ByteBuffer(r.macSalt),p="macIterations"in r?parseInt(pe.util.bytesToHex(r.macIterations),16):1,v=Or.generateKey(a,f,3,p,c,u),y=pe.hmac.create();y.start(u,v),y.update(o.value);var m=y.getMac();if(m.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(e.value)&&e.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return af(i,o.value,t,a),i};function mn(e){if(e.composed||e.constructed){for(var t=pe.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function af(e,t,a,r){if(t=C.fromDer(t,a),t.tagClass!==C.Class.UNIVERSAL||t.type!==C.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var n=0;n<t.value.length;n++){var s=t.value[n],i={},o=[];if(!C.validate(s,Fs,i,o)){var u=new Error("Cannot read ContentInfo.");throw u.errors=o,u}var c={encrypted:!1},l=null,f=i.content.value[0];switch(C.derToOid(i.contentType)){case X.oids.data:if(f.tagClass!==C.Class.UNIVERSAL||f.type!==C.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");l=mn(f).value;break;case X.oids.encryptedData:l=nf(f,r),c.encrypted=!0;break;default:var u=new Error("Unsupported PKCS#12 contentType.");throw u.contentType=C.derToOid(i.contentType),u}c.safeBags=sf(l,a,r),e.safeContents.push(c)}}function nf(e,t){var a={},r=[];if(!C.validate(e,pe.pkcs7.asn1.encryptedDataValidator,a,r)){var n=new Error("Cannot read EncryptedContentInfo.");throw n.errors=r,n}var s=C.derToOid(a.contentType);if(s!==X.oids.data){var n=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw n.oid=s,n}s=C.derToOid(a.encAlgorithm);var i=X.pbe.getCipher(s,a.encParameter,t),o=mn(a.encryptedContentAsn1),u=pe.util.createBuffer(o.value);if(i.update(u),!i.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return i.output.getBytes()}function sf(e,t,a){if(!t&&e.length===0)return[];if(e=C.fromDer(e,t),e.tagClass!==C.Class.UNIVERSAL||e.type!==C.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],n=0;n<e.value.length;n++){var s=e.value[n],i={},o=[];if(!C.validate(s,ef,i,o)){var u=new Error("Cannot read SafeBag.");throw u.errors=o,u}var c={type:C.derToOid(i.bagId),attributes:of(i.bagAttributes)};r.push(c);var l,f,p=i.bagValue.value[0];switch(c.type){case X.oids.pkcs8ShroudedKeyBag:if(p=X.decryptPrivateKeyInfo(p,a),p===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case X.oids.keyBag:try{c.key=X.privateKeyFromAsn1(p)}catch{c.key=null,c.asn1=p}continue;case X.oids.certBag:l=rf,f=function(){if(C.derToOid(i.certId)!==X.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=C.derToOid(i.certId),y}var m=C.fromDer(i.cert,t);try{c.cert=X.certificateFromAsn1(m,!0)}catch{c.cert=null,c.asn1=m}};break;default:var u=new Error("Unsupported PKCS#12 SafeBag type.");throw u.oid=c.type,u}if(l!==void 0&&!C.validate(p,l,i,o)){var u=new Error("Cannot read PKCS#12 "+l.name);throw u.errors=o,u}f()}return r}function of(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},n=[];if(!C.validate(e[a],tf,r,n)){var s=new Error("Cannot read PKCS#12 BagAttribute.");throw s.errors=n,s}var i=C.derToOid(r.oid);if(X.oids[i]!==void 0){t[X.oids[i]]=[];for(var o=0;o<r.values.length;++o)t[X.oids[i]].push(r.values[o].value)}}return t}Or.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var n=r.localKeyId,s;if(n!==null)n=pe.util.hexToBytes(n);else if(r.generateLocalKeyId)if(t){var i=pe.util.isArray(t)?t[0]:t;typeof i=="string"&&(i=X.certificateFromPem(i));var o=pe.md.sha1.create();o.update(C.toDer(X.certificateToAsn1(i)).getBytes()),n=o.digest().getBytes()}else n=pe.random.getBytes(20);var u=[];n!==null&&u.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.localKeyId).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n)])])),"friendlyName"in r&&u.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.friendlyName).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[C.create(C.Class.UNIVERSAL,C.Type.BMPSTRING,!1,r.friendlyName)])])),u.length>0&&(s=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,u));var c=[],l=[];t!==null&&(pe.util.isArray(t)?l=t:l=[t]);for(var f=[],p=0;p<l.length;++p){t=l[p],typeof t=="string"&&(t=X.certificateFromPem(t));var v=p===0?s:void 0,y=X.certificateToAsn1(t),m=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.certBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.x509Certificate).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(y).getBytes())])])]),v]);f.push(m)}if(f.length>0){var x=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,f),T=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(x).getBytes())])]);c.push(T)}var B=null;if(e!==null){var b=X.wrapRsaPrivateKey(X.privateKeyToAsn1(e));a===null?B=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.keyBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[b]),s]):B=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.pkcs8ShroudedKeyBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[X.encryptPrivateKeyInfo(b,a,r)]),s]);var P=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[B]),R=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(P).getBytes())])]);c.push(R)}var L=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,c),z;if(r.useMac){var o=pe.md.sha1.create(),j=new pe.util.ByteBuffer(pe.random.getBytes(r.saltSize)),oe=r.count,e=Or.generateKey(a,j,3,oe,20),ce=pe.hmac.create();ce.start(o,e),ce.update(C.toDer(L).getBytes());var de=ce.getMac();z=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.sha1).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,de.getBytes())]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,j.getBytes()),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(oe).getBytes())])}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(3).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(L).getBytes())])]),z])};Or.generateKey=pe.pbe.generatePkcs12Key});var xn=F((hg,Ks)=>{var qt=$();gt();Vt();pn();Xt();ua();Cn();ga();Ur();ne();ma();var En=qt.asn1,Er=Ks.exports=qt.pki=qt.pki||{};Er.pemToDer=function(e){var t=qt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return qt.util.createBuffer(t.body)};Er.privateKeyFromPem=function(e){var t=qt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=En.fromDer(t.body);return Er.privateKeyFromAsn1(r)};Er.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:En.toDer(Er.privateKeyToAsn1(e)).getBytes()};return qt.pem.encode(a,{maxline:t})};Er.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:En.toDer(e).getBytes()};return qt.pem.encode(a,{maxline:t})}});var bn=F((pg,Ys)=>{var _=$();gt();dr();na();Xt();xn();ot();yr();ne();var Sa=function(e,t,a,r){var n=_.util.createBuffer(),s=e.length>>1,i=s+(e.length&1),o=e.substr(0,i),u=e.substr(s,i),c=_.util.createBuffer(),l=_.hmac.create();a=t+a;var f=Math.ceil(r/16),p=Math.ceil(r/20);l.start("MD5",o);var v=_.util.createBuffer();c.putBytes(a);for(var y=0;y<f;++y)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+a),v.putBuffer(l.digest());l.start("SHA1",u);var m=_.util.createBuffer();c.clear(),c.putBytes(a);for(var y=0;y<p;++y)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+a),m.putBuffer(l.digest());return n.putBytes(_.util.xorBytes(v.getBytes(),m.getBytes(),r)),n},uf=function(e,t,a){var r=_.hmac.create();r.start("SHA1",e);var n=_.util.createBuffer();return n.putInt32(t[0]),n.putInt32(t[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),r.update(n.getBytes()),r.digest().getBytes()},cf=function(e,t,a){var r=!1;try{var n=e.deflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},lf=function(e,t,a){var r=!1;try{var n=e.inflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},tt=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return _.util.createBuffer(e.getBytes(a))},ft=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},g={};g.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};g.SupportedVersions=[g.Versions.TLS_1_1,g.Versions.TLS_1_0];g.Version=g.SupportedVersions[0];g.MaxFragment=15360;g.ConnectionEnd={server:0,client:1};g.PRFAlgorithm={tls_prf_sha256:0};g.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};g.CipherType={stream:0,block:1,aead:2};g.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};g.CompressionMethod={none:0,deflate:1};g.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};g.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};g.Alert={};g.Alert.Level={warning:1,fatal:2};g.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};g.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};g.CipherSuites={};g.getCipherSuite=function(e){var t=null;for(var a in g.CipherSuites){var r=g.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t};g.handleUnexpected=function(e,t){var a=!e.open&&e.entity===g.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unexpected_message}})};g.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(g.queue(e,g.createAlert(e,{level:g.Alert.Level.warning,description:g.Alert.Description.no_renegotiation})),g.flush(e)),e.process()};g.parseHelloMessage=function(e,t,a){var r=null,n=e.entity===g.ConnectionEnd.client;if(a<38)e.error(e,{message:n?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});else{var s=t.fragment,i=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:_.util.createBuffer(s.getBytes(32)),session_id:tt(s,1),extensions:[]},n?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=tt(s,2),r.compression_methods=tt(s,1)),i=a-(i-s.length()),i>0){for(var o=tt(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:tt(o,2)});if(!n)for(var u=0;u<r.extensions.length;++u){var c=r.extensions[u];if(c.type[0]===0&&c.type[1]===0)for(var l=tt(c.data,2);l.length()>0;){var f=l.getByte();if(f!==0)break;e.session.extensions.server_name.serverNameList.push(tt(l,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}});if(n)e.session.cipherSuite=g.getCipherSuite(r.cipher_suite);else for(var p=_.util.createBuffer(r.cipher_suites.bytes());p.length()>0&&(e.session.cipherSuite=g.getCipherSuite(p.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.handshake_failure},cipherSuite:_.util.bytesToHex(r.cipher_suite)});n?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=g.CompressionMethod.none}return r};g.createSecurityParameters=function(e,t){var a=e.entity===g.ConnectionEnd.client,r=t.random.bytes(),n=a?e.session.sp.client_random:r,s=a?r:g.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:g.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:s}};g.handleServerHello=function(e,t,a){var r=g.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}});e.session.version=e.version;var n=r.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=Gs,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=df,e.session.resuming=!1,g.createSecurityParameters(e,r)),e.session.id=n,e.process()}};g.handleClientHello=function(e,t,a){var r=g.parseHelloMessage(e,t,a);if(!e.fail){var n=r.session_id.bytes(),s=null;if(e.sessionCache&&(s=e.sessionCache.getSession(n),s===null?n="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,n="")),n.length===0&&(n=_.random.getBytes(32)),e.session.id=n,e.session.clientHelloVersion=r.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var i,o=1;o<g.SupportedVersions.length&&(i=g.SupportedVersions[o],!(i.minor<=r.version.minor));++o);e.version={major:i.major,minor:i.minor},e.session.version=e.version}s!==null?(e.expect=In,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?Cf:An,e.session.resuming=!1,g.createSecurityParameters(e,r)),e.open=!0,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerHello(e)})),e.session.resuming?(g.queue(e,g.createRecord(e,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),e.state.pending=g.createConnectionState(e),e.state.current.write=e.state.pending.write,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createFinished(e)}))):(g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificate(e)})),e.fail||(g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerKeyExchange(e)})),e.verifyClient!==!1&&g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificateRequest(e)})),g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerHelloDone(e)})))),g.flush(e),e.process()}};g.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_list:tt(r,3)},s,i,o=[];try{for(;n.certificate_list.length()>0;)s=tt(n.certificate_list,3),i=_.asn1.fromDer(s),s=_.pki.certificateFromAsn1(i,!0),o.push(s)}catch(c){return e.error(e,{message:"Could not parse certificate list.",cause:c,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate}})}var u=e.entity===g.ConnectionEnd.client;(u||e.verifyClient===!0)&&o.length===0?e.error(e,{message:u?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}}):o.length===0?e.expect=u?qs:An:(u?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],g.verifyCertificateChain(e,o)&&(e.expect=u?qs:An)),e.process()};g.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unsupported_certificate}});e.expect=hf,e.process()};g.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unsupported_certificate}});var r=t.fragment,n={enc_pre_master_secret:tt(r,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=_.pki.privateKeyFromPem(s)}catch(u){e.error(e,{message:"Could not get private key.",cause:u,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}})}if(s===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}});try{var i=e.session.sp;i.pre_master_secret=s.decrypt(n.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==i.pre_master_secret.charCodeAt(0)||o.minor!==i.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{i.pre_master_secret=_.random.getBytes(48)}e.expect=In,e.session.clientCertificate!==null&&(e.expect=Ef),e.process()};g.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_types:tt(r,1),certificate_authorities:tt(r,2)};e.session.certificateRequest=n,e.expect=pf,e.process()};g.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s={signature:tt(r,2).getBytes()},i=_.util.createBuffer();i.putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest()),i=i.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(i,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(n),e.session.sha1.update(n)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.handshake_failure}})}e.expect=In,e.process()};g.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.insufficient_security}},n=0,s=e.verify(e,r.alert.description,n,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!_.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),e.error(e,r)}e.session.certificateRequest!==null&&(t=g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificate(e)}),g.queue(e,t)),t=g.createRecord(e,{type:g.ContentType.handshake,data:g.createClientKeyExchange(e)}),g.queue(e,t),e.expect=vf;var i=function(o,u){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&g.queue(o,g.createRecord(o,{type:g.ContentType.handshake,data:g.createCertificateVerify(o,u)})),g.queue(o,g.createRecord(o,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),o.state.pending=g.createConnectionState(o),o.state.current.write=o.state.pending.write,g.queue(o,g.createRecord(o,{type:g.ContentType.handshake,data:g.createFinished(o)})),o.expect=Gs,g.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return i(e,null);g.getClientSignature(e,i)};g.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var a=e.entity===g.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=g.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?gf:xf,e.process()};g.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var s=t.fragment.getBytes();r=_.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var i=e.entity===g.ConnectionEnd.client,o=i?"server finished":"client finished",u=e.session.sp,c=12,l=Sa;if(r=l(u.master_secret,o,r.getBytes(),c),r.getBytes()!==s)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.decrypt_error}});e.session.md5.update(n),e.session.sha1.update(n),(e.session.resuming&&i||!e.session.resuming&&!i)&&(g.queue(e,g.createRecord(e,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createFinished(e)}))),e.expect=i?yf:Sf,e.handshaking=!1,++e.handshakes,e.peerCertificate=i?e.session.serverCertificate:e.session.clientCertificate,g.flush(e),e.isConnected=!0,e.connected(e),e.process()};g.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},n;switch(r.description){case g.Alert.Description.close_notify:n="Connection closed.";break;case g.Alert.Description.unexpected_message:n="Unexpected message.";break;case g.Alert.Description.bad_record_mac:n="Bad record MAC.";break;case g.Alert.Description.decryption_failed:n="Decryption failed.";break;case g.Alert.Description.record_overflow:n="Record overflow.";break;case g.Alert.Description.decompression_failure:n="Decompression failed.";break;case g.Alert.Description.handshake_failure:n="Handshake failure.";break;case g.Alert.Description.bad_certificate:n="Bad certificate.";break;case g.Alert.Description.unsupported_certificate:n="Unsupported certificate.";break;case g.Alert.Description.certificate_revoked:n="Certificate revoked.";break;case g.Alert.Description.certificate_expired:n="Certificate expired.";break;case g.Alert.Description.certificate_unknown:n="Certificate unknown.";break;case g.Alert.Description.illegal_parameter:n="Illegal parameter.";break;case g.Alert.Description.unknown_ca:n="Unknown certificate authority.";break;case g.Alert.Description.access_denied:n="Access denied.";break;case g.Alert.Description.decode_error:n="Decode error.";break;case g.Alert.Description.decrypt_error:n="Decrypt error.";break;case g.Alert.Description.export_restriction:n="Export restriction.";break;case g.Alert.Description.protocol_version:n="Unsupported protocol version.";break;case g.Alert.Description.insufficient_security:n="Insufficient security.";break;case g.Alert.Description.internal_error:n="Internal error.";break;case g.Alert.Description.user_canceled:n="User canceled.";break;case g.Alert.Description.no_renegotiation:n="Renegotiation not supported.";break;default:n="Unknown error.";break}if(r.description===g.Alert.Description.close_notify)return e.close();e.error(e,{message:n,send:!1,origin:e.entity===g.ConnectionEnd.client?"server":"client",alert:r}),e.process()};g.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt24();if(n>a.length())return e.fragmented=t,t.fragment=_.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var s=a.bytes(n+4);a.read+=4,r in xa[e.entity][e.expect]?(e.entity===g.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:_.md.md5.create(),sha1:_.md.sha1.create()}),r!==g.HandshakeType.hello_request&&r!==g.HandshakeType.certificate_verify&&r!==g.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),xa[e.entity][e.expect][r](e,t,n)):g.handleUnexpected(e,t)};g.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()};g.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt16(),s=a.getBytes(n);if(r===g.HeartbeatMessageType.heartbeat_request){if(e.handshaking||n>s.length)return e.process();g.queue(e,g.createRecord(e,{type:g.ContentType.heartbeat,data:g.createHeartbeat(g.HeartbeatMessageType.heartbeat_response,s)})),g.flush(e)}else if(r===g.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,_.util.createBuffer(s))}e.process()};var ff=0,df=1,qs=2,hf=3,pf=4,Gs=5,gf=6,yf=7,vf=8,mf=0,Cf=1,An=2,Ef=3,In=4,xf=5,Sf=6,h=g.handleUnexpected,zs=g.handleChangeCipherSpec,_e=g.handleAlert,We=g.handleHandshake,Qs=g.handleApplicationData,Ne=g.handleHeartbeat,Bn=[];Bn[g.ConnectionEnd.client]=[[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[zs,_e,h,h,Ne],[h,_e,We,h,Ne],[h,_e,We,Qs,Ne],[h,_e,We,h,Ne]];Bn[g.ConnectionEnd.server]=[[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[zs,_e,h,h,Ne],[h,_e,We,h,Ne],[h,_e,We,Qs,Ne],[h,_e,We,h,Ne]];var Ht=g.handleHelloRequest,Tf=g.handleServerHello,$s=g.handleCertificate,Hs=g.handleServerKeyExchange,Sn=g.handleCertificateRequest,Ca=g.handleServerHelloDone,js=g.handleFinished,xa=[];xa[g.ConnectionEnd.client]=[[h,h,Tf,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,$s,Hs,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,Hs,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,js],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h]];var Af=g.handleClientHello,If=g.handleClientKeyExchange,Bf=g.handleCertificateVerify;xa[g.ConnectionEnd.server]=[[h,Af,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,$s,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,If,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,Bf,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,js],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h]];g.generateKeys=function(e,t){var a=Sa,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var n=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===g.Versions.TLS_1_0.major&&e.version.minor===g.Versions.TLS_1_0.minor;s&&(n+=2*t.fixed_iv_length);var i=a(t.master_secret,"key expansion",r,n),o={client_write_MAC_key:i.getBytes(t.mac_key_length),server_write_MAC_key:i.getBytes(t.mac_key_length),client_write_key:i.getBytes(t.enc_key_length),server_write_key:i.getBytes(t.enc_key_length)};return s&&(o.client_write_IV=i.getBytes(t.fixed_iv_length),o.server_write_IV=i.getBytes(t.fixed_iv_length)),o};g.createConnectionState=function(e){var t=e.entity===g.ConnectionEnd.client,a=function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(i){return!0},compressionState:null,compressFunction:function(i){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},r={read:a(),write:a()};if(r.read.update=function(s,i){return r.read.cipherFunction(i,r.read)?r.read.compressFunction(s,i,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,i){return r.write.compressFunction(s,i,r.write)?r.write.cipherFunction(i,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}),!s.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=g.generateKeys(e,n),r.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,r.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,n),n.compression_algorithm){case g.CompressionMethod.none:break;case g.CompressionMethod.deflate:r.read.compressFunction=lf,r.write.compressFunction=cf;break;default:throw new Error("Unsupported compression algorithm.")}}return r};g.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=_.util.createBuffer();return a.putInt32(t),a.putBytes(_.random.getBytes(28)),a};g.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a};g.createAlert=function(e,t){var a=_.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),g.createRecord(e,{type:g.ContentType.alert,data:a})};g.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=_.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var n=t.length(),s=_.util.createBuffer();s.putByte(g.CompressionMethod.none);var i=s.length(),o=_.util.createBuffer();if(e.virtualHost){var u=_.util.createBuffer();u.putByte(0),u.putByte(0);var c=_.util.createBuffer();c.putByte(0),ft(c,2,_.util.createBuffer(e.virtualHost));var l=_.util.createBuffer();ft(l,2,c),ft(u,2,l),o.putBuffer(u)}var f=o.length();f>0&&(f+=2);var p=e.session.id,v=p.length+1+2+4+28+2+n+1+i+f,y=_.util.createBuffer();return y.putByte(g.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),ft(y,1,_.util.createBuffer(p)),ft(y,2,t),ft(y,1,s),f>0&&ft(y,2,o),y};g.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=_.util.createBuffer();return r.putByte(g.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),ft(r,1,_.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r};g.createCertificate=function(e){var t=e.entity===g.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var n=_.util.createBuffer();if(a!==null)try{_.util.isArray(a)||(a=[a]);for(var s=null,i=0;i<a.length;++i){var o=_.pem.decode(a[i])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var u=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw u.headerType=o.type,u}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=_.util.createBuffer(o.body);s===null&&(s=_.asn1.fromDer(c.bytes(),!1));var l=_.util.createBuffer();ft(l,3,c),n.putBuffer(l)}a=_.pki.certificateFromAsn1(s),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(v){return e.error(e,{message:"Could not send certificate list.",cause:v,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate}})}var f=3+n.length(),p=_.util.createBuffer();return p.putByte(g.HandshakeType.certificate),p.putInt24(f),ft(p,3,n),p};g.createClientKeyExchange=function(e){var t=_.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(_.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var n=t.length+2,s=_.util.createBuffer();return s.putByte(g.HandshakeType.client_key_exchange),s.putInt24(n),s.putInt16(t.length),s.putBytes(t),s};g.createServerKeyExchange=function(e){var t=0,a=_.util.createBuffer();return t>0&&(a.putByte(g.HandshakeType.server_key_exchange),a.putInt24(t)),a};g.getClientSignature=function(e,t){var a=_.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,n,s){var i=null;if(r.getPrivateKey)try{i=r.getPrivateKey(r,r.session.clientCertificate),i=_.pki.privateKeyFromPem(i)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}})}i===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}):n=i.sign(n,null),s(r,n)},e.getSignature(e,a,t)};g.createCertificateVerify=function(e,t){var a=t.length+2,r=_.util.createBuffer();return r.putByte(g.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r};g.createCertificateRequest=function(e){var t=_.util.createBuffer();t.putByte(1);var a=_.util.createBuffer();for(var r in e.caStore.certs){var n=e.caStore.certs[r],s=_.pki.distinguishedNameToAsn1(n.subject),i=_.asn1.toDer(s);a.putInt16(i.length()),a.putBuffer(i)}var o=1+t.length()+2+a.length(),u=_.util.createBuffer();return u.putByte(g.HandshakeType.certificate_request),u.putInt24(o),ft(u,1,t),ft(u,2,a),u};g.createServerHelloDone=function(e){var t=_.util.createBuffer();return t.putByte(g.HandshakeType.server_hello_done),t.putInt24(0),t};g.createChangeCipherSpec=function(){var e=_.util.createBuffer();return e.putByte(1),e};g.createFinished=function(e){var t=_.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===g.ConnectionEnd.client,r=e.session.sp,n=12,s=Sa,i=a?"client finished":"server finished";t=s(r.master_secret,i,t.getBytes(),n);var o=_.util.createBuffer();return o.putByte(g.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o};g.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=_.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var n=r.length(),s=Math.max(16,n-a-3);return r.putBytes(_.random.getBytes(s)),r};g.queue=function(e,t){if(t&&!(t.fragment.length()===0&&(t.type===g.ContentType.handshake||t.type===g.ContentType.alert||t.type===g.ContentType.change_cipher_spec))){if(t.type===g.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=g.MaxFragment)r=[t];else{r=[];for(var n=t.fragment.bytes();n.length>g.MaxFragment;)r.push(g.createRecord(e,{type:t.type,data:_.util.createBuffer(n.slice(0,g.MaxFragment))})),n=n.slice(g.MaxFragment);n.length>0&&r.push(g.createRecord(e,{type:t.type,data:_.util.createBuffer(n)}))}for(var s=0;s<r.length&&!e.fail;++s){var i=r[s],o=e.state.current.write;o.update(e,i)&&e.records.push(i)}}};g.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var Tn=function(e){switch(e){case!0:return!0;case _.pki.certificateError.bad_certificate:return g.Alert.Description.bad_certificate;case _.pki.certificateError.unsupported_certificate:return g.Alert.Description.unsupported_certificate;case _.pki.certificateError.certificate_revoked:return g.Alert.Description.certificate_revoked;case _.pki.certificateError.certificate_expired:return g.Alert.Description.certificate_expired;case _.pki.certificateError.certificate_unknown:return g.Alert.Description.certificate_unknown;case _.pki.certificateError.unknown_ca:return g.Alert.Description.unknown_ca;default:return g.Alert.Description.bad_certificate}},bf=function(e){switch(e){case!0:return!0;case g.Alert.Description.bad_certificate:return _.pki.certificateError.bad_certificate;case g.Alert.Description.unsupported_certificate:return _.pki.certificateError.unsupported_certificate;case g.Alert.Description.certificate_revoked:return _.pki.certificateError.certificate_revoked;case g.Alert.Description.certificate_expired:return _.pki.certificateError.certificate_expired;case g.Alert.Description.certificate_unknown:return _.pki.certificateError.certificate_unknown;case g.Alert.Description.unknown_ca:return _.pki.certificateError.unknown_ca;default:return _.pki.certificateError.bad_certificate}};g.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(s,i,o){var u=Tn(s),c=e.verify(e,s,i,o);if(c!==!0){if(typeof c=="object"&&!_.util.isArray(c)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate},c.message&&(l.message=c.message),c.alert&&(l.alert.description=c.alert),l}c!==s&&(c=bf(c))}return c},_.pki.verifyCertificateChain(e.caStore,t,a)}catch(s){var n=s;(typeof n!="object"||_.util.isArray(n))&&(n={send:!0,alert:{level:g.Alert.Level.fatal,description:Tn(s)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:g.Alert.Level.fatal,description:Tn(n.error)}),e.error(e,n)}return!e.fail};g.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(n){var s=null,i=null;if(n?i=_.util.bytesToHex(n):a.order.length>0&&(i=a.order[0]),i!==null&&i in a.cache){s=a.cache[i],delete a.cache[i];for(var o in a.order)if(a.order[o]===i){a.order.splice(o,1);break}}return s},a.setSession=function(n,s){if(a.order.length===a.capacity){var i=a.order.shift();delete a.cache[i]}var i=_.util.bytesToHex(n);a.order.push(i),a.cache[i]=s}}return a};g.createConnection=function(e){var t=null;e.caStore?_.util.isArray(e.caStore)?t=_.pki.createCaStore(e.caStore):t=e.caStore:t=_.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in g.CipherSuites)a.push(g.CipherSuites[r])}var n=e.server?g.ConnectionEnd.server:g.ConnectionEnd.client,s=e.sessionCache?g.createSessionCache(e.sessionCache):null,i={version:{major:g.Version.major,minor:g.Version.minor},entity:n,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(l,f,p,v){return f},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:_.util.createBuffer(),tlsData:_.util.createBuffer(),data:_.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(l,f){f.origin=f.origin||(l.entity===g.ConnectionEnd.client?"client":"server"),f.send&&(g.queue(l,g.createAlert(l,f.alert)),g.flush(l));var p=f.fatal!==!1;p&&(l.fail=!0),e.error(l,f),p&&l.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};i.reset=function(l){i.version={major:g.Version.major,minor:g.Version.minor},i.record=null,i.session=null,i.peerCertificate=null,i.state={pending:null,current:null},i.expect=i.entity===g.ConnectionEnd.client?ff:mf,i.fragmented=null,i.records=[],i.open=!1,i.handshakes=0,i.handshaking=!1,i.isConnected=!1,i.fail=!(l||typeof l>"u"),i.input.clear(),i.tlsData.clear(),i.data.clear(),i.state.current=g.createConnectionState(i)},i.reset();var o=function(l,f){var p=f.type-g.ContentType.change_cipher_spec,v=Bn[l.entity][l.expect];p in v?v[p](l,f):g.handleUnexpected(l,f)},u=function(l){var f=0,p=l.input,v=p.length();if(v<5)f=5-v;else{l.record={type:p.getByte(),version:{major:p.getByte(),minor:p.getByte()},length:p.getInt16(),fragment:_.util.createBuffer(),ready:!1};var y=l.record.version.major===l.version.major;y&&l.session&&l.session.version&&(y=l.record.version.minor===l.version.minor),y||l.error(l,{message:"Incompatible TLS version.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}})}return f},c=function(l){var f=0,p=l.input,v=p.length();if(v<l.record.length)f=l.record.length-v;else{l.record.fragment.putBytes(p.getBytes(l.record.length)),p.compact();var y=l.state.current.read;y.update(l,l.record)&&(l.fragmented!==null&&(l.fragmented.type===l.record.type?(l.fragmented.fragment.putBuffer(l.record.fragment),l.record=l.fragmented):l.error(l,{message:"Invalid fragmented record.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unexpected_message}})),l.record.ready=!0)}return f};return i.handshake=function(l){if(i.entity!==g.ConnectionEnd.client)i.error(i,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(i.handshaking)i.error(i,{message:"Handshake already in progress.",fatal:!1});else{i.fail&&!i.open&&i.handshakes===0&&(i.fail=!1),i.handshaking=!0,l=l||"";var f=null;l.length>0&&(i.sessionCache&&(f=i.sessionCache.getSession(l)),f===null&&(l="")),l.length===0&&i.sessionCache&&(f=i.sessionCache.getSession(),f!==null&&(l=f.id)),i.session={id:l,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:_.md.md5.create(),sha1:_.md.sha1.create()},f&&(i.version=f.version,i.session.sp=f.sp),i.session.sp.client_random=g.createRandom().getBytes(),i.open=!0,g.queue(i,g.createRecord(i,{type:g.ContentType.handshake,data:g.createClientHello(i)})),g.flush(i)}},i.process=function(l){var f=0;return l&&i.input.putBytes(l),i.fail||(i.record!==null&&i.record.ready&&i.record.fragment.isEmpty()&&(i.record=null),i.record===null&&(f=u(i)),!i.fail&&i.record!==null&&!i.record.ready&&(f=c(i)),!i.fail&&i.record!==null&&i.record.ready&&o(i,i.record)),f},i.prepare=function(l){return g.queue(i,g.createRecord(i,{type:g.ContentType.application_data,data:_.util.createBuffer(l)})),g.flush(i)},i.prepareHeartbeatRequest=function(l,f){return l instanceof _.util.ByteBuffer&&(l=l.bytes()),typeof f>"u"&&(f=l.length),i.expectedHeartbeatPayload=l,g.queue(i,g.createRecord(i,{type:g.ContentType.heartbeat,data:g.createHeartbeat(g.HeartbeatMessageType.heartbeat_request,l,f)})),g.flush(i)},i.close=function(l){if(!i.fail&&i.sessionCache&&i.session){var f={id:i.session.id,version:i.session.version,sp:i.session.sp};f.sp.keys=null,i.sessionCache.setSession(f.id,f)}i.open&&(i.open=!1,i.input.clear(),(i.isConnected||i.handshaking)&&(i.isConnected=i.handshaking=!1,g.queue(i,g.createAlert(i,{level:g.Alert.Level.warning,description:g.Alert.Description.close_notify})),g.flush(i)),i.closed(i)),i.reset(l)},i};Ys.exports=_.tls=_.tls||{};for(Ea in g)typeof g[Ea]!="function"&&(_.tls[Ea]=g[Ea]);var Ea;_.tls.prf_tls1=Sa;_.tls.hmac_sha1=uf;_.tls.createSessionCache=g.createSessionCache;_.tls.createConnection=g.createConnection});var Js=F((gg,Xs)=>{var Gt=$();Ot();bn();var dt=Xs.exports=Gt.tls;dt.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=dt.BulkCipherAlgorithm.aes,e.cipher_type=dt.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=dt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Ws};dt.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=dt.BulkCipherAlgorithm.aes,e.cipher_type=dt.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=dt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Ws};function Ws(e,t,a){var r=t.entity===Gt.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:Gt.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:Gt.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=Rf,e.write.cipherFunction=wf,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=dt.hmac_sha1}function wf(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var n;e.version.minor===dt.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=Gt.random.getBytesSync(16),t.cipherState.init=!0;var s=t.cipherState.cipher;return s.start({iv:n}),e.version.minor>=dt.Versions.TLS_1_1.minor&&s.output.putBytes(n),s.update(e.fragment),s.finish(_f)&&(e.fragment=s.output,e.length=e.fragment.length(),a=!0),a}function _f(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function Nf(e,t,a){var r=!0;if(a){for(var n=t.length(),s=t.last(),i=n-1-s;i<n-1;++i)r=r&&t.at(i)==s;r&&t.truncate(s+1)}return r}function Rf(e,t){var a=!1,r;e.version.minor===dt.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var n=t.cipherState.cipher;n.start({iv:r}),n.update(e.fragment),a=n.finish(Nf);var s=t.macLength,i=Gt.random.getBytesSync(s),o=n.output.length();o>=s?(e.fragment=n.output.getBytes(o-s),i=n.output.getBytes(s)):e.fragment=n.output.getBytes(),e.fragment=Gt.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=Lf(t.macKey,i,u)&&a,a}function Lf(e,t,a){var r=Gt.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}});var Nn=F((yg,ro)=>{var ve=$();vt();ne();var Vr=ro.exports=ve.sha512=ve.sha512||{};ve.md.sha512=ve.md.algorithms.sha512=Vr;var eo=ve.sha384=ve.sha512.sha384=ve.sha512.sha384||{};eo.create=function(){return Vr.create("SHA-384")};ve.md.sha384=ve.md.algorithms.sha384=eo;ve.sha512.sha256=ve.sha512.sha256||{create:function(){return Vr.create("SHA-512/256")}};ve.md["sha512/256"]=ve.md.algorithms["sha512/256"]=ve.sha512.sha256;ve.sha512.sha224=ve.sha512.sha224||{create:function(){return Vr.create("SHA-512/224")}};ve.md["sha512/224"]=ve.md.algorithms["sha512/224"]=ve.sha512.sha224;Vr.create=function(e){if(to||kf(),typeof e>"u"&&(e="SHA-512"),!(e in ar))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=ar[e],a=null,r=ve.util.createBuffer(),n=new Array(80),s=0;s<80;++s)n[s]=new Array(2);var i=64;switch(e){case"SHA-384":i=48;break;case"SHA-512/256":i=32;break;case"SHA-512/224":i=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:i,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var u=o.messageLengthSize/4,c=0;c<u;++c)o.fullMessageLength.push(0);r=ve.util.createBuffer(),a=new Array(t.length);for(var c=0;c<t.length;++c)a[c]=t[c].slice(0);return o},o.start(),o.update=function(u,c){c==="utf8"&&(u=ve.util.encodeUtf8(u));var l=u.length;o.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var f=o.fullMessageLength.length-1;f>=0;--f)o.fullMessageLength[f]+=l[1],l[1]=l[0]+(o.fullMessageLength[f]/4294967296>>>0),o.fullMessageLength[f]=o.fullMessageLength[f]>>>0,l[0]=l[1]/4294967296>>>0;return r.putBytes(u),Zs(a,n,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var u=ve.util.createBuffer();u.putBytes(r.bytes());var c=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,l=c&o.blockLength-1;u.putBytes(wn.substr(0,o.blockLength-l));for(var f,p,v=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)f=o.fullMessageLength[y+1]*8,p=f/4294967296>>>0,v+=p,u.putInt32(v>>>0),v=f>>>0;u.putInt32(v);for(var m=new Array(a.length),y=0;y<a.length;++y)m[y]=a[y].slice(0);Zs(m,n,u);var x=ve.util.createBuffer(),T;e==="SHA-512"?T=m.length:e==="SHA-384"?T=m.length-2:T=m.length-4;for(var y=0;y<T;++y)x.putInt32(m[y][0]),(y!==T-1||e!=="SHA-512/224")&&x.putInt32(m[y][1]);return x},o};var wn=null,to=!1,_n=null,ar=null;function kf(){wn="\x80",wn+=ve.util.fillString("\0",128),_n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],ar={},ar["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],ar["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],ar["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],ar["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],to=!0}function Zs(e,t,a){for(var r,n,s,i,o,u,c,l,f,p,v,y,m,x,T,B,b,P,R,L,z,j,oe,ce,de,ge,$e,st,le,Ee,M,jt,or,xe,Se,Ae=a.length();Ae>=128;){for(le=0;le<16;++le)t[le][0]=a.getInt32()>>>0,t[le][1]=a.getInt32()>>>0;for(;le<80;++le)jt=t[le-2],Ee=jt[0],M=jt[1],r=((Ee>>>19|M<<13)^(M>>>29|Ee<<3)^Ee>>>6)>>>0,n=((Ee<<13|M>>>19)^(M<<3|Ee>>>29)^(Ee<<26|M>>>6))>>>0,xe=t[le-15],Ee=xe[0],M=xe[1],s=((Ee>>>1|M<<31)^(Ee>>>8|M<<24)^Ee>>>7)>>>0,i=((Ee<<31|M>>>1)^(Ee<<24|M>>>8)^(Ee<<25|M>>>7))>>>0,or=t[le-7],Se=t[le-16],M=n+or[1]+i+Se[1],t[le][0]=r+or[0]+s+Se[0]+(M/4294967296>>>0)>>>0,t[le][1]=M>>>0;for(m=e[0][0],x=e[0][1],T=e[1][0],B=e[1][1],b=e[2][0],P=e[2][1],R=e[3][0],L=e[3][1],z=e[4][0],j=e[4][1],oe=e[5][0],ce=e[5][1],de=e[6][0],ge=e[6][1],$e=e[7][0],st=e[7][1],le=0;le<80;++le)c=((z>>>14|j<<18)^(z>>>18|j<<14)^(j>>>9|z<<23))>>>0,l=((z<<18|j>>>14)^(z<<14|j>>>18)^(j<<23|z>>>9))>>>0,f=(de^z&(oe^de))>>>0,p=(ge^j&(ce^ge))>>>0,o=((m>>>28|x<<4)^(x>>>2|m<<30)^(x>>>7|m<<25))>>>0,u=((m<<4|x>>>28)^(x<<30|m>>>2)^(x<<25|m>>>7))>>>0,v=(m&T|b&(m^T))>>>0,y=(x&B|P&(x^B))>>>0,M=st+l+p+_n[le][1]+t[le][1],r=$e+c+f+_n[le][0]+t[le][0]+(M/4294967296>>>0)>>>0,n=M>>>0,M=u+y,s=o+v+(M/4294967296>>>0)>>>0,i=M>>>0,$e=de,st=ge,de=oe,ge=ce,oe=z,ce=j,M=L+n,z=R+r+(M/4294967296>>>0)>>>0,j=M>>>0,R=b,L=P,b=T,P=B,T=m,B=x,M=n+i,m=r+s+(M/4294967296>>>0)>>>0,x=M>>>0;M=e[0][1]+x,e[0][0]=e[0][0]+m+(M/4294967296>>>0)>>>0,e[0][1]=M>>>0,M=e[1][1]+B,e[1][0]=e[1][0]+T+(M/4294967296>>>0)>>>0,e[1][1]=M>>>0,M=e[2][1]+P,e[2][0]=e[2][0]+b+(M/4294967296>>>0)>>>0,e[2][1]=M>>>0,M=e[3][1]+L,e[3][0]=e[3][0]+R+(M/4294967296>>>0)>>>0,e[3][1]=M>>>0,M=e[4][1]+j,e[4][0]=e[4][0]+z+(M/4294967296>>>0)>>>0,e[4][1]=M>>>0,M=e[5][1]+ce,e[5][0]=e[5][0]+oe+(M/4294967296>>>0)>>>0,e[5][1]=M>>>0,M=e[6][1]+ge,e[6][0]=e[6][0]+de+(M/4294967296>>>0)>>>0,e[6][1]=M>>>0,M=e[7][1]+st,e[7][0]=e[7][0]+$e+(M/4294967296>>>0)>>>0,e[7][1]=M>>>0,Ae-=128}}});var ao=F(Rn=>{var Df=$();gt();var we=Df.asn1;Rn.privateKeyValidator={name:"PrivateKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:we.Class.UNIVERSAL,type:we.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};Rn.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:we.Class.UNIVERSAL,type:we.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var vo=F((mg,yo)=>{var Re=$();Dr();ot();Nn();ne();var co=ao(),Uf=co.publicKeyValidator,Pf=co.privateKeyValidator;typeof no>"u"&&(no=Re.jsbn.BigInteger);var no,kn=Re.util.ByteBuffer,Ze=typeof Buffer>"u"?Uint8Array:Buffer;Re.pki=Re.pki||{};yo.exports=Re.pki.ed25519=Re.ed25519=Re.ed25519||{};var J=Re.ed25519;J.constants={};J.constants.PUBLIC_KEY_BYTE_LENGTH=32;J.constants.PRIVATE_KEY_BYTE_LENGTH=64;J.constants.SEED_BYTE_LENGTH=32;J.constants.SIGN_BYTE_LENGTH=64;J.constants.HASH_BYTE_LENGTH=64;J.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=Re.random.getBytesSync(J.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==J.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+J.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=Rt({message:t,encoding:"binary"});for(var a=new Ze(J.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Ze(J.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)r[n]=t[n];return Mf(a,r),{publicKey:a,privateKey:r}};J.privateKeyFromAsn1=function(e){var t={},a=[],r=Re.asn1.validate(e,Pf,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=Re.asn1.derToOid(t.privateKeyOid),i=Re.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.privateKey,u=Rt({message:Re.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:u}};J.publicKeyFromAsn1=function(e){var t={},a=[],r=Re.asn1.validate(e,Uf,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var s=Re.asn1.derToOid(t.publicKeyOid),i=Re.oids.EdDSA25519;if(s!==i)throw new Error('Invalid OID "'+s+'"; OID must be "'+i+'".');var o=t.ed25519PublicKey;if(o.length!==J.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Rt({message:o,encoding:"binary"})};J.publicKeyFromPrivateKey=function(e){e=e||{};var t=Rt({message:e.privateKey,encoding:"binary"});if(t.length!==J.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+J.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new Ze(J.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a};J.sign=function(e){e=e||{};var t=Rt(e),a=Rt({message:e.privateKey,encoding:"binary"});if(a.length===J.constants.SEED_BYTE_LENGTH){var r=J.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==J.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+J.constants.SEED_BYTE_LENGTH+" or "+J.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length);Kf(n,t,t.length,a);for(var s=new Ze(J.constants.SIGN_BYTE_LENGTH),i=0;i<s.length;++i)s[i]=n[i];return s};J.verify=function(e){e=e||{};var t=Rt(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=Rt({message:e.signature,encoding:"binary"});if(a.length!==J.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+J.constants.SIGN_BYTE_LENGTH);var r=Rt({message:e.publicKey,encoding:"binary"});if(r.length!==J.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+J.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length),s=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length),i;for(i=0;i<J.constants.SIGN_BYTE_LENGTH;++i)n[i]=a[i];for(i=0;i<t.length;++i)n[i+J.constants.SIGN_BYTE_LENGTH]=t[i];return qf(s,n,n.length,r)>=0};function Rt(e){var t=e.message;if(t instanceof Uint8Array||t instanceof Ze)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new kn(t,a)}else if(!(t instanceof kn))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var r=new Ze(t.length()),n=0;n<r.length;++n)r[n]=t.at(n);return r}var Dn=H(),Ta=H([1]),Of=H([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Vf=H([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),io=H([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),so=H([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Fr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Ff=H([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Mr(e,t){var a=Re.md.sha512.create(),r=new kn(e);a.update(r.getBytes(t),"binary");var n=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(n,"binary");for(var s=new Ze(J.constants.HASH_BYTE_LENGTH),i=0;i<64;++i)s[i]=n.charCodeAt(i);return s}function Mf(e,t){var a=[H(),H(),H(),H()],r,n=Mr(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,Vn(a,n),On(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function Kf(e,t,a,r){var n,s,i=new Float64Array(64),o=[H(),H(),H(),H()],u=Mr(r,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=a+64;for(n=0;n<a;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=u[32+n];var l=Mr(e.subarray(32),a+32);for(Un(l),Vn(o,l),On(e,o),n=32;n<64;++n)e[n]=r[n];var f=Mr(e,a+64);for(Un(f),n=32;n<64;++n)i[n]=0;for(n=0;n<32;++n)i[n]=l[n];for(n=0;n<32;++n)for(s=0;s<32;s++)i[n+s]+=f[n]*u[s];return lo(e.subarray(32),i),c}function qf(e,t,a,r){var n,s,i=new Ze(32),o=[H(),H(),H(),H()],u=[H(),H(),H(),H()];if(s=-1,a<64||Gf(u,r)||!Hf(t,32))return-1;for(n=0;n<a;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=r[n];var c=Mr(e,a);if(Un(c),po(o,u,c),Vn(u,t.subarray(32)),Pn(o,u),On(i,o),a-=64,fo(t,0,i,0)){for(n=0;n<a;++n)e[n]=0;return-1}for(n=0;n<a;++n)e[n]=t[n+64];return s=a,s}function Hf(e,t){var a;for(a=31;a>=0;--a){if(e[t+a]<Fr[a])return!0;if(e[t+a]>Fr[a])return!1}return!1}function lo(e,t){var a,r,n,s;for(r=63;r>=32;--r){for(a=0,n=r-32,s=r-12;n<s;++n)t[n]+=a-16*t[r]*Fr[n-(r-32)],a=t[n]+128>>8,t[n]-=a*256;t[n]+=a,t[r]=0}for(a=0,n=0;n<32;++n)t[n]+=a-(t[31]>>4)*Fr[n],a=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=a*Fr[n];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function Un(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;lo(e,t)}function Pn(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),u=H(),c=H(),l=H();Sr(a,e[1],e[0]),Sr(l,t[1],t[0]),fe(a,a,l),xr(r,e[0],e[1]),xr(l,t[0],t[1]),fe(r,r,l),fe(n,e[3],t[3]),fe(n,n,Vf),fe(s,e[2],t[2]),xr(s,s,s),Sr(i,r,a),Sr(o,s,n),xr(u,s,n),xr(c,r,a),fe(e[0],i,o),fe(e[1],c,u),fe(e[2],u,o),fe(e[3],i,c)}function oo(e,t,a){for(var r=0;r<4;++r)go(e[r],t[r],a)}function On(e,t){var a=H(),r=H(),n=H();jf(n,t[2]),fe(a,t[0],n),fe(r,t[1],n),Aa(e,r),e[31]^=ho(a)<<7}function Aa(e,t){var a,r,n,s=H(),i=H();for(a=0;a<16;++a)i[a]=t[a];for(Ln(i),Ln(i),Ln(i),r=0;r<2;++r){for(s[0]=i[0]-65517,a=1;a<15;++a)s[a]=i[a]-65535-(s[a-1]>>16&1),s[a-1]&=65535;s[15]=i[15]-32767-(s[14]>>16&1),n=s[15]>>16&1,s[14]&=65535,go(i,s,1-n)}for(a=0;a<16;a++)e[2*a]=i[a]&255,e[2*a+1]=i[a]>>8}function Gf(e,t){var a=H(),r=H(),n=H(),s=H(),i=H(),o=H(),u=H();return zt(e[2],Ta),zf(e[1],t),nr(n,e[1]),fe(s,n,Of),Sr(n,n,e[2]),xr(s,e[2],s),nr(i,s),nr(o,i),fe(u,o,i),fe(a,u,n),fe(a,a,s),Qf(a,a),fe(a,a,n),fe(a,a,s),fe(a,a,s),fe(e[0],a,s),nr(r,e[0]),fe(r,r,s),uo(r,n)&&fe(e[0],e[0],Ff),nr(r,e[0]),fe(r,r,s),uo(r,n)?-1:(ho(e[0])===t[31]>>7&&Sr(e[0],Dn,e[0]),fe(e[3],e[0],e[1]),0)}function zf(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function Qf(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)nr(a,a),r!==1&&fe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function uo(e,t){var a=new Ze(32),r=new Ze(32);return Aa(a,e),Aa(r,t),fo(a,0,r,0)}function fo(e,t,a,r){return $f(e,t,a,r,32)}function $f(e,t,a,r,n){var s,i=0;for(s=0;s<n;++s)i|=e[t+s]^a[r+s];return(1&i-1>>>8)-1}function ho(e){var t=new Ze(32);return Aa(t,e),t[0]&1}function po(e,t,a){var r,n;for(zt(e[0],Dn),zt(e[1],Ta),zt(e[2],Ta),zt(e[3],Dn),n=255;n>=0;--n)r=a[n/8|0]>>(n&7)&1,oo(e,t,r),Pn(t,e),Pn(e,e),oo(e,t,r)}function Vn(e,t){var a=[H(),H(),H(),H()];zt(a[0],io),zt(a[1],so),zt(a[2],Ta),fe(a[3],io,so),po(e,a,t)}function zt(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function jf(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)nr(a,a),r!==2&&r!==4&&fe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function Ln(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function go(e,t,a){for(var r,n=~(a-1),s=0;s<16;++s)r=n&(e[s]^t[s]),e[s]^=r,t[s]^=r}function H(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function xr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function Sr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function nr(e,t){fe(e,t,t)}function fe(e,t,a){var r,n,s=0,i=0,o=0,u=0,c=0,l=0,f=0,p=0,v=0,y=0,m=0,x=0,T=0,B=0,b=0,P=0,R=0,L=0,z=0,j=0,oe=0,ce=0,de=0,ge=0,$e=0,st=0,le=0,Ee=0,M=0,jt=0,or=0,xe=a[0],Se=a[1],Ae=a[2],ke=a[3],De=a[4],Ue=a[5],Pe=a[6],Oe=a[7],Ve=a[8],Fe=a[9],Me=a[10],Ke=a[11],qe=a[12],He=a[13],Ge=a[14],ze=a[15];r=t[0],s+=r*xe,i+=r*Se,o+=r*Ae,u+=r*ke,c+=r*De,l+=r*Ue,f+=r*Pe,p+=r*Oe,v+=r*Ve,y+=r*Fe,m+=r*Me,x+=r*Ke,T+=r*qe,B+=r*He,b+=r*Ge,P+=r*ze,r=t[1],i+=r*xe,o+=r*Se,u+=r*Ae,c+=r*ke,l+=r*De,f+=r*Ue,p+=r*Pe,v+=r*Oe,y+=r*Ve,m+=r*Fe,x+=r*Me,T+=r*Ke,B+=r*qe,b+=r*He,P+=r*Ge,R+=r*ze,r=t[2],o+=r*xe,u+=r*Se,c+=r*Ae,l+=r*ke,f+=r*De,p+=r*Ue,v+=r*Pe,y+=r*Oe,m+=r*Ve,x+=r*Fe,T+=r*Me,B+=r*Ke,b+=r*qe,P+=r*He,R+=r*Ge,L+=r*ze,r=t[3],u+=r*xe,c+=r*Se,l+=r*Ae,f+=r*ke,p+=r*De,v+=r*Ue,y+=r*Pe,m+=r*Oe,x+=r*Ve,T+=r*Fe,B+=r*Me,b+=r*Ke,P+=r*qe,R+=r*He,L+=r*Ge,z+=r*ze,r=t[4],c+=r*xe,l+=r*Se,f+=r*Ae,p+=r*ke,v+=r*De,y+=r*Ue,m+=r*Pe,x+=r*Oe,T+=r*Ve,B+=r*Fe,b+=r*Me,P+=r*Ke,R+=r*qe,L+=r*He,z+=r*Ge,j+=r*ze,r=t[5],l+=r*xe,f+=r*Se,p+=r*Ae,v+=r*ke,y+=r*De,m+=r*Ue,x+=r*Pe,T+=r*Oe,B+=r*Ve,b+=r*Fe,P+=r*Me,R+=r*Ke,L+=r*qe,z+=r*He,j+=r*Ge,oe+=r*ze,r=t[6],f+=r*xe,p+=r*Se,v+=r*Ae,y+=r*ke,m+=r*De,x+=r*Ue,T+=r*Pe,B+=r*Oe,b+=r*Ve,P+=r*Fe,R+=r*Me,L+=r*Ke,z+=r*qe,j+=r*He,oe+=r*Ge,ce+=r*ze,r=t[7],p+=r*xe,v+=r*Se,y+=r*Ae,m+=r*ke,x+=r*De,T+=r*Ue,B+=r*Pe,b+=r*Oe,P+=r*Ve,R+=r*Fe,L+=r*Me,z+=r*Ke,j+=r*qe,oe+=r*He,ce+=r*Ge,de+=r*ze,r=t[8],v+=r*xe,y+=r*Se,m+=r*Ae,x+=r*ke,T+=r*De,B+=r*Ue,b+=r*Pe,P+=r*Oe,R+=r*Ve,L+=r*Fe,z+=r*Me,j+=r*Ke,oe+=r*qe,ce+=r*He,de+=r*Ge,ge+=r*ze,r=t[9],y+=r*xe,m+=r*Se,x+=r*Ae,T+=r*ke,B+=r*De,b+=r*Ue,P+=r*Pe,R+=r*Oe,L+=r*Ve,z+=r*Fe,j+=r*Me,oe+=r*Ke,ce+=r*qe,de+=r*He,ge+=r*Ge,$e+=r*ze,r=t[10],m+=r*xe,x+=r*Se,T+=r*Ae,B+=r*ke,b+=r*De,P+=r*Ue,R+=r*Pe,L+=r*Oe,z+=r*Ve,j+=r*Fe,oe+=r*Me,ce+=r*Ke,de+=r*qe,ge+=r*He,$e+=r*Ge,st+=r*ze,r=t[11],x+=r*xe,T+=r*Se,B+=r*Ae,b+=r*ke,P+=r*De,R+=r*Ue,L+=r*Pe,z+=r*Oe,j+=r*Ve,oe+=r*Fe,ce+=r*Me,de+=r*Ke,ge+=r*qe,$e+=r*He,st+=r*Ge,le+=r*ze,r=t[12],T+=r*xe,B+=r*Se,b+=r*Ae,P+=r*ke,R+=r*De,L+=r*Ue,z+=r*Pe,j+=r*Oe,oe+=r*Ve,ce+=r*Fe,de+=r*Me,ge+=r*Ke,$e+=r*qe,st+=r*He,le+=r*Ge,Ee+=r*ze,r=t[13],B+=r*xe,b+=r*Se,P+=r*Ae,R+=r*ke,L+=r*De,z+=r*Ue,j+=r*Pe,oe+=r*Oe,ce+=r*Ve,de+=r*Fe,ge+=r*Me,$e+=r*Ke,st+=r*qe,le+=r*He,Ee+=r*Ge,M+=r*ze,r=t[14],b+=r*xe,P+=r*Se,R+=r*Ae,L+=r*ke,z+=r*De,j+=r*Ue,oe+=r*Pe,ce+=r*Oe,de+=r*Ve,ge+=r*Fe,$e+=r*Me,st+=r*Ke,le+=r*qe,Ee+=r*He,M+=r*Ge,jt+=r*ze,r=t[15],P+=r*xe,R+=r*Se,L+=r*Ae,z+=r*ke,j+=r*De,oe+=r*Ue,ce+=r*Pe,de+=r*Oe,ge+=r*Ve,$e+=r*Fe,st+=r*Me,le+=r*Ke,Ee+=r*qe,M+=r*He,jt+=r*Ge,or+=r*ze,s+=38*R,i+=38*L,o+=38*z,u+=38*j,c+=38*oe,l+=38*ce,f+=38*de,p+=38*ge,v+=38*$e,y+=38*st,m+=38*le,x+=38*Ee,T+=38*M,B+=38*jt,b+=38*or,n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=p+n+65535,n=Math.floor(r/65536),p=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=T+n+65535,n=Math.floor(r/65536),T=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=P+n+65535,n=Math.floor(r/65536),P=r-n*65536,s+=n-1+37*(n-1),n=1,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=p+n+65535,n=Math.floor(r/65536),p=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=T+n+65535,n=Math.floor(r/65536),T=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=P+n+65535,n=Math.floor(r/65536),P=r-n*65536,s+=n-1+37*(n-1),e[0]=s,e[1]=i,e[2]=o,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=p,e[8]=v,e[9]=y,e[10]=m,e[11]=x,e[12]=T,e[13]=B,e[14]=b,e[15]=P}});var xo=F((Cg,Eo)=>{var rt=$();ne();ot();Dr();Eo.exports=rt.kem=rt.kem||{};var mo=rt.jsbn.BigInteger;rt.kem.rsa={};rt.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||rt.random,r={};return r.encrypt=function(n,s){var i=Math.ceil(n.n.bitLength()/8),o;do o=new mo(rt.util.bytesToHex(a.getBytesSync(i)),16).mod(n.n);while(o.compareTo(mo.ONE)<=0);o=rt.util.hexToBytes(o.toString(16));var u=i-o.length;u>0&&(o=rt.util.fillString("\0",u)+o);var c=n.encrypt(o,"NONE"),l=e.generate(o,s);return{encapsulation:c,key:l}},r.decrypt=function(n,s,i){var o=n.decrypt(s,"NONE");return e.generate(o,i)},r};rt.kem.kdf1=function(e,t){Co(this,e,0,t||e.digestLength)};rt.kem.kdf2=function(e,t){Co(this,e,1,t||e.digestLength)};function Co(e,t,a,r){e.generate=function(n,s){for(var i=new rt.util.ByteBuffer,o=Math.ceil(s/r)+a,u=new rt.util.ByteBuffer,c=a;c<o;++c){u.putInt32(c),t.start(),t.update(n+u.getBytes());var l=t.digest();i.putBytes(l.getBytes(r))}return i.truncate(i.length()-s),i.getBytes()}}});var Io=F((Eg,Ao)=>{var Z=$();ne();Ao.exports=Z.log=Z.log||{};Z.log.levels=["none","error","warning","info","debug","verbose","max"];var Ia={},Kn=[],qr=null;Z.log.LEVEL_LOCKED=2;Z.log.NO_LEVEL_CHECK=4;Z.log.INTERPOLATE=8;for(It=0;It<Z.log.levels.length;++It)Fn=Z.log.levels[It],Ia[Fn]={index:It,name:Fn.toUpperCase()};var Fn,It;Z.log.logMessage=function(e){for(var t=Ia[e.level].index,a=0;a<Kn.length;++a){var r=Kn[a];if(r.flags&Z.log.NO_LEVEL_CHECK)r.f(e);else{var n=Ia[r.level].index;t<=n&&r.f(r,e)}}};Z.log.prepareStandard=function(e){"standard"in e||(e.standard=Ia[e.level].name+" ["+e.category+"] "+e.message)};Z.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=Z.util.format.apply(this,t)}};Z.log.prepareStandardFull=function(e){"standardFull"in e||(Z.log.prepareStandard(e),e.standardFull=e.standard)};for(Mn=["error","warning","info","debug","verbose"],It=0;It<Mn.length;++It)(function(t){Z.log[t]=function(a,r){var n=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:a,message:r,arguments:n};Z.log.logMessage(s)}})(Mn[It]);var Mn,It;Z.log.makeLogger=function(e){var t={flags:0,f:e};return Z.log.setLevel(t,"none"),t};Z.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&Z.log.LEVEL_LOCKED))for(var r=0;r<Z.log.levels.length;++r){var n=Z.log.levels[r];if(t==n){e.level=t,a=!0;break}}return a};Z.log.lock=function(e,t){typeof t>"u"||t?e.flags|=Z.log.LEVEL_LOCKED:e.flags&=~Z.log.LEVEL_LOCKED};Z.log.addLogger=function(e){Kn.push(e)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(So={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Hr=function(e,t){Z.log.prepareStandard(t);var a=So[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)},Tr=Z.log.makeLogger(Hr)):(Hr=function(t,a){Z.log.prepareStandardFull(a),console.log(a.standardFull)},Tr=Z.log.makeLogger(Hr)),Z.log.setLevel(Tr,"debug"),Z.log.addLogger(Tr),qr=Tr):console={log:function(){}};var Tr,So,Hr;qr!==null&&typeof window<"u"&&window.location&&(Kr=new URL(window.location.href).searchParams,Kr.has("console.level")&&Z.log.setLevel(qr,Kr.get("console.level").slice(-1)[0]),Kr.has("console.lock")&&(To=Kr.get("console.lock").slice(-1)[0],To=="true"&&Z.log.lock(qr)));var Kr,To;Z.log.consoleLogger=qr});var bo=F((xg,Bo)=>{Bo.exports=vt();na();yr();en();Nn()});var No=F((Sg,_o)=>{var D=$();Ot();gt();Lr();Vt();Xt();gn();ot();ne();ma();var E=D.asn1,Xe=_o.exports=D.pkcs7=D.pkcs7||{};Xe.messageFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=E.fromDer(t.body);return Xe.messageFromAsn1(r)};Xe.messageToPem=function(e,t){var a={type:"PKCS7",body:E.toDer(e.toAsn1()).getBytes()};return D.pem.encode(a,{maxline:t})};Xe.messageFromAsn1=function(e){var t={},a=[];if(!E.validate(e,Xe.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var n=E.derToOid(t.contentType),s;switch(n){case D.pki.oids.envelopedData:s=Xe.createEnvelopedData();break;case D.pki.oids.encryptedData:s=Xe.createEncryptedData();break;case D.pki.oids.signedData:s=Xe.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return s.fromAsn1(t.content.value[0]),s};Xe.createSignedData=function(){var e=null;return e={type:D.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(Hn(e,r,Xe.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,s=0;s<n.length;++s)e.certificates.push(D.pki.certificateFromAsn1(n[s]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(D.pki.certificateToAsn1(e.certificates[n]));var s=[],i=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&i.value[0].value.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&i.value[0].value.push(E.create(E.Class.CONTEXT_SPECIFIC,1,!0,s)),i.value[0].value.push(E.create(E.Class.UNIVERSAL,E.Type.SET,!0,e.signerInfos)),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),i])},addSigner:function(r){var n=r.issuer,s=r.serialNumber;if(r.certificate){var i=r.certificate;typeof i=="string"&&(i=D.pki.certificateFromPem(i)),n=i.issuer.attributes,s=i.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=D.pki.privateKeyFromPem(o));var u=r.digestAlgorithm||D.pki.oids.sha1;switch(u){case D.pki.oids.sha1:case D.pki.oids.sha256:case D.pki.oids.sha384:case D.pki.oids.sha512:case D.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+u)}var c=r.authenticatedAttributes||[];if(c.length>0){for(var l=!1,f=!1,p=0;p<c.length;++p){var v=c[p];if(!l&&v.type===D.pki.oids.contentType){if(l=!0,f)break;continue}if(!f&&v.type===D.pki.oids.messageDigest){if(f=!0,l)break;continue}}if(!l||!f)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:n,serialNumber:s,digestAlgorithm:u,signatureAlgorithm:D.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(D.pki.oids.data).getBytes())]),"content"in e)){var n;e.content instanceof D.util.ByteBuffer?n=e.content.bytes():typeof e.content=="string"&&(n=D.util.encodeUtf8(e.content)),r.detached?e.detachedContent=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,n)]))}if(e.signers.length!==0){var s=t();a(s)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=D.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},n=0;n<e.signers.length;++n){var s=e.signers[n],i=s.digestAlgorithm;i in r||(r[i]=D.md[D.pki.oids[i]].create()),s.authenticatedAttributes.length===0?s.md=r[i]:s.md=D.md[D.pki.oids[i]].create()}e.digestAlgorithmIdentifiers=[];for(var i in r)e.digestAlgorithmIdentifiers.push(E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(i).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")]));return r}function a(r){var n;if(e.detachedContent?n=e.detachedContent:(n=e.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=E.derToOid(e.contentInfo.value[0].value),i=E.toDer(n);i.getByte(),E.getBerValueLength(i),i=i.getBytes();for(var o in r)r[o].start().update(i);for(var u=new Date,c=0;c<e.signers.length;++c){var l=e.signers[c];if(l.authenticatedAttributes.length===0){if(s!==D.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=E.create(E.Class.UNIVERSAL,E.Type.SET,!0,[]),p=0;p<l.authenticatedAttributes.length;++p){var v=l.authenticatedAttributes[p];v.type===D.pki.oids.messageDigest?v.value=r[l.digestAlgorithm].digest():v.type===D.pki.oids.signingTime&&(v.value||(v.value=u)),f.value.push(qn(v)),l.authenticatedAttributesAsn1.value.push(qn(v))}i=E.toDer(f).getBytes(),l.md.start().update(i)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=ed(e.signers)}};Xe.createEncryptedData=function(){var e=null;return e={type:D.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){Hn(e,t,Xe.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),wo(e)}},e};Xe.createEnvelopedData=function(){var e=null;return e={type:D.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=Hn(e,t,Xe.asn1.envelopedDataValidator);e.recipients=Xf(a.recipientInfos.value)},toAsn1:function(){return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,Jf(e.recipients)),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,td(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var n=e.recipients[r],s=n.issuer;if(n.serialNumber===t.serialNumber&&s.length===a.length){for(var i=!0,o=0;o<a.length;++o)if(s[o].type!==a[o].type||s[o].value!==a[o].value){i=!1;break}if(i)return n}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:case D.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=D.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}wo(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:D.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,n,s;switch(a){case D.pki.oids["aes128-CBC"]:r=16,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes192-CBC"]:r=24,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["aes256-CBC"]:r=32,n=16,s=D.aes.createEncryptionCipher;break;case D.pki.oids["des-EDE3-CBC"]:r=24,n=8,s=D.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=D.util.createBuffer(D.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=D.util.createBuffer(D.random.getBytes(n));var i=s(t);if(i.start(e.encryptedContent.parameter.copy()),i.update(e.content),!i.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=i.output}for(var o=0;o<e.recipients.length;++o){var u=e.recipients[o];if(u.encryptedContent.content===void 0)switch(u.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}},e};function Yf(e){var t={},a=[];if(!E.validate(e,Xe.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:D.pki.RDNAttributesAsArray(t.issuer),serialNumber:D.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:E.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function Wf(e){return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.encryptedContent.algorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")]),E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function Xf(e){for(var t=[],a=0;a<e.length;++a)t.push(Yf(e[a]));return t}function Jf(e){for(var t=[],a=0;a<e.length;++a)t.push(Wf(e[a]));return t}function Zf(e){var t=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.digestAlgorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.signatureAlgorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])),t.value.push(E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=E.create(E.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var n=e.unauthenticatedAttributes[r];a.values.push(qn(n))}t.value.push(a)}return t}function ed(e){for(var t=[],a=0;a<e.length;++a)t.push(Zf(e[a]));return t}function qn(e){var t;if(e.type===D.pki.oids.contentType)t=E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.value).getBytes());else if(e.type===D.pki.oids.messageDigest)t=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===D.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),n=e.value;if(typeof n=="string"){var s=Date.parse(n);isNaN(s)?n.length===13?n=E.utcTimeToDate(n):n=E.generalizedTimeToDate(n):n=new Date(s)}n>=a&&n<r?t=E.create(E.Class.UNIVERSAL,E.Type.UTCTIME,!1,E.dateToUtcTime(n)):t=E.create(E.Class.UNIVERSAL,E.Type.GENERALIZEDTIME,!1,E.dateToGeneralizedTime(n))}return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,[t])])}function td(e){return[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(D.pki.oids.data).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.algorithm).getBytes()),e.parameter?E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.content.getBytes())])]}function Hn(e,t,a){var r={},n=[];if(!E.validate(t,a,r,n)){var s=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw s.errors=s,s}var i=E.derToOid(r.contentType);if(i!==D.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(D.util.isArray(r.encryptedContent))for(var u=0;u<r.encryptedContent.length;++u){if(r.encryptedContent[u].type!==E.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[u].value}else o=r.encryptedContent;e.encryptedContent={algorithm:E.derToOid(r.encAlgorithm),parameter:D.util.createBuffer(r.encParameter.value),content:D.util.createBuffer(o)}}if(r.content){var o="";if(D.util.isArray(r.content))for(var u=0;u<r.content.length;++u){if(r.content[u].type!==E.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[u].value}else o=r.content;e.content=D.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function wo(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case D.pki.oids["aes128-CBC"]:case D.pki.oids["aes192-CBC"]:case D.pki.oids["aes256-CBC"]:t=D.aes.createDecryptionCipher(e.encryptedContent.key);break;case D.pki.oids.desCBC:case D.pki.oids["des-EDE3-CBC"]:t=D.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}});var Lo=F((Tg,Ro)=>{var Te=$();Ot();dr();na();yr();ne();var ba=Ro.exports=Te.ssh=Te.ssh||{};ba.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",n=t===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r
|
|
18
|
-
`;
|
|
19
|
-
`,
|
|
20
|
-
`;var
|
|
21
|
-
`,
|
|
14
|
+
`,a};Ki.decode=function(e){for(var t=[],a=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,r=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,n=/\r?\n/,i;i=a.exec(e),!!i;){var s=i[1];s==="NEW CERTIFICATE REQUEST"&&(s="CERTIFICATE REQUEST");var o={type:s,procType:null,contentDomain:null,dekInfo:null,headers:[],body:sa.util.decode64(i[3])};if(t.push(o),!!i[2]){for(var u=i[2].split(n),c=0;i&&c<u.length;){for(var l=u[c].replace(/\s+$/,""),f=c+1;f<u.length;++f){var p=u[f];if(!/\s/.test(p[0]))break;l+=p,c=f}if(i=l.match(r),i){for(var v={name:i[1],values:[]},y=i[2].split(","),m=0;m<y.length;++m)v.values.push(bc(y[m]));if(o.procType)if(!o.contentDomain&&v.name==="Content-Domain")o.contentDomain=y[0]||"";else if(!o.dekInfo&&v.name==="DEK-Info"){if(v.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');o.dekInfo={algorithm:y[0],parameters:y[1]||null}}else o.headers.push(v);else{if(v.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(v.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');o.procType={version:y[0],type:y[1]}}}++c}if(o.procType==="ENCRYPTED"&&!o.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(t.length===0)throw new Error("Invalid PEM formatted message.");return t};function ia(e){for(var t=e.name+": ",a=[],r=function(u,c){return" "+c},n=0;n<e.values.length;++n)a.push(e.values[n].replace(/^(\S+\r\n)/,r));t+=a.join(",")+`\r
|
|
15
|
+
`;for(var i=0,s=-1,n=0;n<t.length;++n,++i)if(i>65&&s!==-1){var o=t[s];o===","?(++s,t=t.substr(0,s)+`\r
|
|
16
|
+
`+t.substr(s)):t=t.substr(0,s)+`\r
|
|
17
|
+
`+o+t.substr(s+1),i=n-s-1,s=-1,++n}else(t[n]===" "||t[n]===" "||t[n]===",")&&(s=n);return t}function bc(e){return e.replace(/^\s+/,"")}});var Lr=F((Yp,Gi)=>{var me=$();Xr();$a();ne();Gi.exports=me.des=me.des||{};me.des.startEncrypting=function(e,t,a,r){var n=oa({key:e,output:a,decrypt:!1,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};me.des.createEncryptionCipher=function(e,t){return oa({key:e,output:null,decrypt:!1,mode:t})};me.des.startDecrypting=function(e,t,a,r){var n=oa({key:e,output:a,decrypt:!0,mode:r||(t===null?"ECB":"CBC")});return n.start(t),n};me.des.createDecryptionCipher=function(e,t){return oa({key:e,output:null,decrypt:!0,mode:t})};me.des.Algorithm=function(e,t){var a=this;a.name=e,a.mode=new t({blockSize:8,cipher:{encrypt:function(r,n){return Hi(a._keys,r,n,!1)},decrypt:function(r,n){return Hi(a._keys,r,n,!0)}}}),a._init=!1};me.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=me.util.createBuffer(e.key);if(this.name.indexOf("3DES")===0&&t.length()!==24)throw new Error("Invalid Triple-DES key size: "+t.length()*8);this._keys=Pc(t),this._init=!0}};Ct("DES-ECB",me.cipher.modes.ecb);Ct("DES-CBC",me.cipher.modes.cbc);Ct("DES-CFB",me.cipher.modes.cfb);Ct("DES-OFB",me.cipher.modes.ofb);Ct("DES-CTR",me.cipher.modes.ctr);Ct("3DES-ECB",me.cipher.modes.ecb);Ct("3DES-CBC",me.cipher.modes.cbc);Ct("3DES-CFB",me.cipher.modes.cfb);Ct("3DES-OFB",me.cipher.modes.ofb);Ct("3DES-CTR",me.cipher.modes.ctr);function Ct(e,t){var a=function(){return new me.des.Algorithm(e,t)};me.cipher.registerAlgorithm(e,a)}var wc=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],_c=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],Nc=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],Rc=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],Lc=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],kc=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],Dc=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],Uc=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function Pc(e){for(var t=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],n=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],i=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],s=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],l=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],v=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=e.length()>8?3:1,x=[],T=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],B=0,b,P=0;P<m;P++){var R=e.getInt32(),L=e.getInt32();b=(R>>>4^L)&252645135,L^=b,R^=b<<4,b=(L>>>-16^R)&65535,R^=b,L^=b<<-16,b=(R>>>2^L)&858993459,L^=b,R^=b<<2,b=(L>>>-16^R)&65535,R^=b,L^=b<<-16,b=(R>>>1^L)&1431655765,L^=b,R^=b<<1,b=(L>>>8^R)&16711935,R^=b,L^=b<<8,b=(R>>>1^L)&1431655765,L^=b,R^=b<<1,b=R<<8|L>>>20&240,R=L<<24|L<<8&16711680|L>>>8&65280|L>>>24&240,L=b;for(var z=0;z<T.length;++z){T[z]?(R=R<<2|R>>>26,L=L<<2|L>>>26):(R=R<<1|R>>>27,L=L<<1|L>>>27),R&=-15,L&=-15;var j=t[R>>>28]|a[R>>>24&15]|r[R>>>20&15]|n[R>>>16&15]|i[R>>>12&15]|s[R>>>8&15]|o[R>>>4&15],oe=u[L>>>28]|c[L>>>24&15]|l[L>>>20&15]|f[L>>>16&15]|p[L>>>12&15]|v[L>>>8&15]|y[L>>>4&15];b=(oe>>>16^j)&65535,x[B++]=j^b,x[B++]=oe^b<<16}}return x}function Hi(e,t,a,r){var n=e.length===32?3:9,i;n===3?i=r?[30,-2,-2]:[0,32,2]:i=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var s,o=t[0],u=t[1];s=(o>>>4^u)&252645135,u^=s,o^=s<<4,s=(o>>>16^u)&65535,u^=s,o^=s<<16,s=(u>>>2^o)&858993459,o^=s,u^=s<<2,s=(u>>>8^o)&16711935,o^=s,u^=s<<8,s=(o>>>1^u)&1431655765,u^=s,o^=s<<1,o=o<<1|o>>>31,u=u<<1|u>>>31;for(var c=0;c<n;c+=3){for(var l=i[c+1],f=i[c+2],p=i[c];p!=l;p+=f){var v=u^e[p],y=(u>>>4|u<<28)^e[p+1];s=o,o=u,u=s^(_c[v>>>24&63]|Rc[v>>>16&63]|kc[v>>>8&63]|Uc[v&63]|wc[y>>>24&63]|Nc[y>>>16&63]|Lc[y>>>8&63]|Dc[y&63])}s=o,o=u,u=s}o=o>>>1|o<<31,u=u>>>1|u<<31,s=(o>>>1^u)&1431655765,u^=s,o^=s<<1,s=(u>>>8^o)&16711935,o^=s,u^=s<<8,s=(u>>>2^o)&858993459,o^=s,u^=s<<2,s=(o>>>16^u)&65535,u^=s,o^=s<<16,s=(o>>>4^u)&252645135,u^=s,o^=s<<4,a[0]=o,a[1]=u}function oa(e){e=e||{};var t=(e.mode||"CBC").toUpperCase(),a="DES-"+t,r;e.decrypt?r=me.cipher.createDecipher(a,e.key):r=me.cipher.createCipher(a,e.key);var n=r.start;return r.start=function(i,s){var o=null;s instanceof me.util.ByteBuffer&&(o=s,s={}),s=s||{},s.output=o,s.iv=i,n.call(r,s)},r}});var ua=F((Wp,zi)=>{var Ye=$();dr();vt();ne();var Oc=Ye.pkcs5=Ye.pkcs5||{},_t;Ye.util.isNodejs&&!Ye.options.usePureJavaScript&&(_t=require("crypto"));zi.exports=Ye.pbkdf2=Oc.pbkdf2=function(e,t,a,r,n,i){if(typeof n=="function"&&(i=n,n=null),Ye.util.isNodejs&&!Ye.options.usePureJavaScript&&_t.pbkdf2&&(n===null||typeof n!="object")&&(_t.pbkdf2Sync.length>4||!n||n==="sha1"))return typeof n!="string"&&(n="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),i?_t.pbkdf2Sync.length===4?_t.pbkdf2(e,t,a,r,function(b,P){if(b)return i(b);i(null,P.toString("binary"))}):_t.pbkdf2(e,t,a,r,n,function(b,P){if(b)return i(b);i(null,P.toString("binary"))}):_t.pbkdf2Sync.length===4?_t.pbkdf2Sync(e,t,a,r).toString("binary"):_t.pbkdf2Sync(e,t,a,r,n).toString("binary");if((typeof n>"u"||n===null)&&(n="sha1"),typeof n=="string"){if(!(n in Ye.md.algorithms))throw new Error("Unknown hash algorithm: "+n);n=Ye.md[n].create()}var s=n.digestLength;if(r>4294967295*s){var o=new Error("Derived key is too long.");if(i)return i(o);throw o}var u=Math.ceil(r/s),c=r-(u-1)*s,l=Ye.hmac.create();l.start(n,e);var f="",p,v,y;if(!i){for(var m=1;m<=u;++m){l.start(null,null),l.update(t),l.update(Ye.util.int32ToBytes(m)),p=y=l.digest().getBytes();for(var x=2;x<=a;++x)l.start(null,null),l.update(y),v=l.digest().getBytes(),p=Ye.util.xorBytes(p,v,s),y=v;f+=m<u?p:p.substr(0,c)}return f}var m=1,x;function T(){if(m>u)return i(null,f);l.start(null,null),l.update(t),l.update(Ye.util.int32ToBytes(m)),p=y=l.digest().getBytes(),x=2,B()}function B(){if(x<=a)return l.start(null,null),l.update(y),v=l.digest().getBytes(),p=Ye.util.xorBytes(p,v,s),y=v,++x,Ye.util.setImmediate(B);f+=m<u?p:p.substr(0,c),++m,T()}T()}});var en=F((Xp,Wi)=>{var Et=$();vt();ne();var $i=Wi.exports=Et.sha256=Et.sha256||{};Et.md.sha256=Et.md.algorithms.sha256=$i;$i.create=function(){ji||Vc();var e=null,t=Et.util.createBuffer(),a=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,i=0;i<n;++i)r.fullMessageLength.push(0);return t=Et.util.createBuffer(),e={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},r},r.start(),r.update=function(n,i){i==="utf8"&&(n=Et.util.encodeUtf8(n));var s=n.length;r.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=s[1],s[1]=s[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),Qi(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=Et.util.createBuffer();n.putBytes(t.bytes());var i=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,s=i&r.blockLength-1;n.putBytes(Za.substr(0,r.blockLength-s));for(var o,u,c=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,u=o/4294967296>>>0,c+=u,n.putInt32(c>>>0),c=o>>>0;n.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};Qi(f,a,n);var p=Et.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p.putInt32(f.h5),p.putInt32(f.h6),p.putInt32(f.h7),p},r};var Za=null,ji=!1,Yi=null;function Vc(){Za="\x80",Za+=Et.util.fillString("\0",64),Yi=[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],ji=!0}function Qi(e,t,a){for(var r,n,i,s,o,u,c,l,f,p,v,y,m,x,T,B=a.length();B>=64;){for(c=0;c<16;++c)t[c]=a.getInt32();for(;c<64;++c)r=t[c-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,n=t[c-15],n=(n>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=r+t[c-7]+n+t[c-16]|0;for(l=e.h0,f=e.h1,p=e.h2,v=e.h3,y=e.h4,m=e.h5,x=e.h6,T=e.h7,c=0;c<64;++c)s=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),o=x^y&(m^x),i=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),u=l&f|p&(l^f),r=T+s+o+Yi[c]+t[c],n=i+u,T=x,x=m,m=y,y=v+r>>>0,v=p,p=f,f=l,l=r+n>>>0;e.h0=e.h0+l|0,e.h1=e.h1+f|0,e.h2=e.h2+p|0,e.h3=e.h3+v|0,e.h4=e.h4+y|0,e.h5=e.h5+m|0,e.h6=e.h6+x|0,e.h7=e.h7+T|0,B-=64}}});var tn=F((Jp,Xi)=>{var xt=$();ne();var ca=null;xt.util.isNodejs&&!xt.options.usePureJavaScript&&!process.versions["node-webkit"]&&(ca=require("crypto"));var Fc=Xi.exports=xt.prng=xt.prng||{};Fc.create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},a=e.md,r=new Array(32),n=0;n<32;++n)r[n]=a.create();t.pools=r,t.pool=0,t.generate=function(c,l){if(!l)return t.generateSync(c);var f=t.plugin.cipher,p=t.plugin.increment,v=t.plugin.formatKey,y=t.plugin.formatSeed,m=xt.util.createBuffer();t.key=null,x();function x(T){if(T)return l(T);if(m.length()>=c)return l(null,m.getBytes(c));if(t.generated>1048575&&(t.key=null),t.key===null)return xt.util.nextTick(function(){i(x)});var B=f(t.key,t.seed);t.generated+=B.length,m.putBytes(B),t.key=v(f(t.key,p(t.seed))),t.seed=y(f(t.key,t.seed)),xt.util.setImmediate(x)}},t.generateSync=function(c){var l=t.plugin.cipher,f=t.plugin.increment,p=t.plugin.formatKey,v=t.plugin.formatSeed;t.key=null;for(var y=xt.util.createBuffer();y.length()<c;){t.generated>1048575&&(t.key=null),t.key===null&&s();var m=l(t.key,t.seed);t.generated+=m.length,y.putBytes(m),t.key=p(l(t.key,f(t.seed))),t.seed=v(l(t.key,t.seed))}return y.getBytes(c)};function i(c){if(t.pools[0].messageLength>=32)return o(),c();var l=32-t.pools[0].messageLength<<5;t.seedFile(l,function(f,p){if(f)return c(f);t.collect(p),o(),c()})}function s(){if(t.pools[0].messageLength>=32)return o();var c=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(c)),o()}function o(){t.reseeds=t.reseeds===4294967295?0:t.reseeds+1;var c=t.plugin.md.create();c.update(t.keyBytes);for(var l=1,f=0;f<32;++f)t.reseeds%l===0&&(c.update(t.pools[f].digest().getBytes()),t.pools[f].start()),l=l<<1;t.keyBytes=c.digest().getBytes(),c.start(),c.update(t.keyBytes);var p=c.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(p),t.generated=0}function u(c){var l=null,f=xt.util.globalScope,p=f.crypto||f.msCrypto;p&&p.getRandomValues&&(l=function(R){return p.getRandomValues(R)});var v=xt.util.createBuffer();if(l)for(;v.length()<c;){var y=Math.max(1,Math.min(c-v.length(),65536)/4),m=new Uint32Array(Math.floor(y));try{l(m);for(var x=0;x<m.length;++x)v.putInt32(m[x])}catch(R){if(!(typeof QuotaExceededError<"u"&&R instanceof QuotaExceededError))throw R}}if(v.length()<c)for(var T,B,b,P=Math.floor(Math.random()*65536);v.length()<c;){B=16807*(P&65535),T=16807*(P>>16),B+=(T&32767)<<16,B+=T>>15,B=(B&2147483647)+(B>>31),P=B&4294967295;for(var x=0;x<3;++x)b=P>>>(x<<3),b^=Math.floor(Math.random()*256),v.putByte(b&255)}return v.getBytes(c)}return ca?(t.seedFile=function(c,l){ca.randomBytes(c,function(f,p){if(f)return l(f);l(null,p.toString())})},t.seedFileSync=function(c){return ca.randomBytes(c).toString()}):(t.seedFile=function(c,l){try{l(null,u(c))}catch(f){l(f)}},t.seedFileSync=u),t.collect=function(c){for(var l=c.length,f=0;f<l;++f)t.pools[t.pool].update(c.substr(f,1)),t.pool=t.pool===31?0:t.pool+1},t.collectInt=function(c,l){for(var f="",p=0;p<l;p+=8)f+=String.fromCharCode(c>>p&255);t.collect(f)},t.registerWorker=function(c){if(c===self)t.seedFile=function(f,p){function v(y){var m=y.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",v),p(m.forge.prng.err,m.forge.prng.bytes))}self.addEventListener("message",v),self.postMessage({forge:{prng:{needed:f}}})};else{var l=function(f){var p=f.data;p.forge&&p.forge.prng&&t.seedFile(p.forge.prng.needed,function(v,y){c.postMessage({forge:{prng:{err:v,bytes:y}}})})};c.addEventListener("message",l)}},t}});var ot=F((Zp,rn)=>{var be=$();Ot();en();tn();ne();(function(){if(be.random&&be.random.getBytes){rn.exports=be.random;return}(function(e){var t={},a=new Array(4),r=be.util.createBuffer();t.formatKey=function(f){var p=be.util.createBuffer(f);return f=new Array(4),f[0]=p.getInt32(),f[1]=p.getInt32(),f[2]=p.getInt32(),f[3]=p.getInt32(),be.aes._expandKey(f,!1)},t.formatSeed=function(f){var p=be.util.createBuffer(f);return f=new Array(4),f[0]=p.getInt32(),f[1]=p.getInt32(),f[2]=p.getInt32(),f[3]=p.getInt32(),f},t.cipher=function(f,p){return be.aes._updateBlock(f,p,a,!1),r.putInt32(a[0]),r.putInt32(a[1]),r.putInt32(a[2]),r.putInt32(a[3]),r.getBytes()},t.increment=function(f){return++f[3],f},t.md=be.md.sha256;function n(){var f=be.prng.create(t);return f.getBytes=function(p,v){return f.generate(p,v)},f.getBytesSync=function(p){return f.generate(p)},f}var i=n(),s=null,o=be.util.globalScope,u=o.crypto||o.msCrypto;if(u&&u.getRandomValues&&(s=function(f){return u.getRandomValues(f)}),be.options.usePureJavaScript||!be.util.isNodejs&&!s){if(typeof window>"u"||window.document,i.collectInt(+new Date,32),typeof navigator<"u"){var c="";for(var l in navigator)try{typeof navigator[l]=="string"&&(c+=navigator[l])}catch{}i.collect(c),c=null}e&&(e().mousemove(function(f){i.collectInt(f.clientX,16),i.collectInt(f.clientY,16)}),e().keypress(function(f){i.collectInt(f.charCode,8)}))}if(!be.random)be.random=i;else for(var l in i)be.random[l]=i[l];be.random.createInstance=n,rn.exports=be.random})(typeof jQuery<"u"?jQuery:null)})()});var nn=F((eg,es)=>{var Je=$();ne();var an=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],Ji=[1,2,3,5],Mc=function(e,t){return e<<t&65535|(e&65535)>>16-t},Kc=function(e,t){return(e&65535)>>t|e<<16-t&65535};es.exports=Je.rc2=Je.rc2||{};Je.rc2.expandKey=function(e,t){typeof e=="string"&&(e=Je.util.createBuffer(e)),t=t||128;var a=e,r=e.length(),n=t,i=Math.ceil(n/8),s=255>>(n&7),o;for(o=r;o<128;o++)a.putByte(an[a.at(o-1)+a.at(o-r)&255]);for(a.setAt(128-i,an[a.at(128-i)&s]),o=127-i;o>=0;o--)a.setAt(o,an[a.at(o+1)^a.at(o+i)]);return a};var Zi=function(e,t,a){var r=!1,n=null,i=null,s=null,o,u,c,l,f=[];for(e=Je.rc2.expandKey(e,t),c=0;c<64;c++)f.push(e.getInt16Le());a?(o=function(y){for(c=0;c<4;c++)y[c]+=f[l]+(y[(c+3)%4]&y[(c+2)%4])+(~y[(c+3)%4]&y[(c+1)%4]),y[c]=Mc(y[c],Ji[c]),l++},u=function(y){for(c=0;c<4;c++)y[c]+=f[y[(c+3)%4]&63]}):(o=function(y){for(c=3;c>=0;c--)y[c]=Kc(y[c],Ji[c]),y[c]-=f[l]+(y[(c+3)%4]&y[(c+2)%4])+(~y[(c+3)%4]&y[(c+1)%4]),l--},u=function(y){for(c=3;c>=0;c--)y[c]-=f[y[(c+3)%4]&63]});var p=function(y){var m=[];for(c=0;c<4;c++){var x=n.getInt16Le();s!==null&&(a?x^=s.getInt16Le():s.putInt16Le(x)),m.push(x&65535)}l=a?0:63;for(var T=0;T<y.length;T++)for(var B=0;B<y[T][0];B++)y[T][1](m);for(c=0;c<4;c++)s!==null&&(a?s.putInt16Le(m[c]):m[c]^=s.getInt16Le()),i.putInt16Le(m[c])},v=null;return v={start:function(y,m){y&&typeof y=="string"&&(y=Je.util.createBuffer(y)),r=!1,n=Je.util.createBuffer(),i=m||new Je.util.createBuffer,s=y,v.output=i},update:function(y){for(r||n.putBuffer(y);n.length()>=8;)p([[5,o],[1,u],[6,o],[1,u],[5,o]])},finish:function(y){var m=!0;if(a)if(y)m=y(8,n,!a);else{var x=n.length()===8?8:8-n.length();n.fillWithByte(x,x)}if(m&&(r=!0,v.update()),!a&&(m=n.length()===0,m))if(y)m=y(8,i,!a);else{var T=i.length(),B=i.at(T-1);B>T?m=!1:i.truncate(B)}return m}},v};Je.rc2.startEncrypting=function(e,t,a){var r=Je.rc2.createEncryptionCipher(e,128);return r.start(t,a),r};Je.rc2.createEncryptionCipher=function(e,t){return Zi(e,t,!0)};Je.rc2.startDecrypting=function(e,t,a){var r=Je.rc2.createDecryptionCipher(e,128);return r.start(t,a),r};Je.rc2.createDecryptionCipher=function(e,t){return Zi(e,t,!1)}});var Dr=F((tg,us)=>{var sn=$();us.exports=sn.jsbn=sn.jsbn||{};var Nt,qc=0xdeadbeefcafe,ts=(qc&16777215)==15715070;function w(e,t,a){this.data=[],e!=null&&(typeof e=="number"?this.fromNumber(e,t,a):t==null&&typeof e!="string"?this.fromString(e,256):this.fromString(e,t))}sn.jsbn.BigInteger=w;function te(){return new w(null)}function Hc(e,t,a,r,n,i){for(;--i>=0;){var s=t*this.data[e++]+a.data[r]+n;n=Math.floor(s/67108864),a.data[r++]=s&67108863}return n}function Gc(e,t,a,r,n,i){for(var s=t&32767,o=t>>15;--i>=0;){var u=this.data[e]&32767,c=this.data[e++]>>15,l=o*u+c*s;u=s*u+((l&32767)<<15)+a.data[r]+(n&1073741823),n=(u>>>30)+(l>>>15)+o*c+(n>>>30),a.data[r++]=u&1073741823}return n}function rs(e,t,a,r,n,i){for(var s=t&16383,o=t>>14;--i>=0;){var u=this.data[e]&16383,c=this.data[e++]>>14,l=o*u+c*s;u=s*u+((l&16383)<<14)+a.data[r]+n,n=(u>>28)+(l>>14)+o*c,a.data[r++]=u&268435455}return n}typeof navigator>"u"?(w.prototype.am=rs,Nt=28):ts&&navigator.appName=="Microsoft Internet Explorer"?(w.prototype.am=Gc,Nt=30):ts&&navigator.appName!="Netscape"?(w.prototype.am=Hc,Nt=26):(w.prototype.am=rs,Nt=28);w.prototype.DB=Nt;w.prototype.DM=(1<<Nt)-1;w.prototype.DV=1<<Nt;var on=52;w.prototype.FV=Math.pow(2,on);w.prototype.F1=on-Nt;w.prototype.F2=2*Nt-on;var zc="0123456789abcdefghijklmnopqrstuvwxyz",la=new Array,pr,ut;pr=48;for(ut=0;ut<=9;++ut)la[pr++]=ut;pr=97;for(ut=10;ut<36;++ut)la[pr++]=ut;pr=65;for(ut=10;ut<36;++ut)la[pr++]=ut;function as(e){return zc.charAt(e)}function ns(e,t){var a=la[e.charCodeAt(t)];return a??-1}function Qc(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s}function $c(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0}function Ft(e){var t=te();return t.fromInt(e),t}function jc(e,t){var a;if(t==16)a=4;else if(t==8)a=3;else if(t==256)a=8;else if(t==2)a=1;else if(t==32)a=5;else if(t==4)a=2;else{this.fromRadix(e,t);return}this.t=0,this.s=0;for(var r=e.length,n=!1,i=0;--r>=0;){var s=a==8?e[r]&255:ns(e,r);if(s<0){e.charAt(r)=="-"&&(n=!0);continue}n=!1,i==0?this.data[this.t++]=s:i+a>this.DB?(this.data[this.t-1]|=(s&(1<<this.DB-i)-1)<<i,this.data[this.t++]=s>>this.DB-i):this.data[this.t-1]|=s<<i,i+=a,i>=this.DB&&(i-=this.DB)}a==8&&(e[0]&128)!=0&&(this.s=-1,i>0&&(this.data[this.t-1]|=(1<<this.DB-i)-1<<i)),this.clamp(),n&&w.ZERO.subTo(this,this)}function Yc(){for(var e=this.s&this.DM;this.t>0&&this.data[this.t-1]==e;)--this.t}function Wc(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(e==16)t=4;else if(e==8)t=3;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else return this.toRadix(e);var a=(1<<t)-1,r,n=!1,i="",s=this.t,o=this.DB-s*this.DB%t;if(s-- >0)for(o<this.DB&&(r=this.data[s]>>o)>0&&(n=!0,i=as(r));s>=0;)o<t?(r=(this.data[s]&(1<<o)-1)<<t-o,r|=this.data[--s]>>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&a,o<=0&&(o+=this.DB,--s)),r>0&&(n=!0),n&&(i+=as(r));return n?i:"0"}function Xc(){var e=te();return w.ZERO.subTo(this,e),e}function Jc(){return this.s<0?this.negate():this}function Zc(e){var t=this.s-e.s;if(t!=0)return t;var a=this.t;if(t=a-e.t,t!=0)return this.s<0?-t:t;for(;--a>=0;)if((t=this.data[a]-e.data[a])!=0)return t;return 0}function fa(e){var t=1,a;return(a=e>>>16)!=0&&(e=a,t+=16),(a=e>>8)!=0&&(e=a,t+=8),(a=e>>4)!=0&&(e=a,t+=4),(a=e>>2)!=0&&(e=a,t+=2),(a=e>>1)!=0&&(e=a,t+=1),t}function el(){return this.t<=0?0:this.DB*(this.t-1)+fa(this.data[this.t-1]^this.s&this.DM)}function tl(e,t){var a;for(a=this.t-1;a>=0;--a)t.data[a+e]=this.data[a];for(a=e-1;a>=0;--a)t.data[a]=0;t.t=this.t+e,t.s=this.s}function rl(e,t){for(var a=e;a<this.t;++a)t.data[a-e]=this.data[a];t.t=Math.max(this.t-e,0),t.s=this.s}function al(e,t){var a=e%this.DB,r=this.DB-a,n=(1<<r)-1,i=Math.floor(e/this.DB),s=this.s<<a&this.DM,o;for(o=this.t-1;o>=0;--o)t.data[o+i+1]=this.data[o]>>r|s,s=(this.data[o]&n)<<a;for(o=i-1;o>=0;--o)t.data[o]=0;t.data[i]=s,t.t=this.t+i+1,t.s=this.s,t.clamp()}function nl(e,t){t.s=this.s;var a=Math.floor(e/this.DB);if(a>=this.t){t.t=0;return}var r=e%this.DB,n=this.DB-r,i=(1<<r)-1;t.data[0]=this.data[a]>>r;for(var s=a+1;s<this.t;++s)t.data[s-a-1]|=(this.data[s]&i)<<n,t.data[s-a]=this.data[s]>>r;r>0&&(t.data[this.t-a-1]|=(this.s&i)<<n),t.t=this.t-a,t.clamp()}function il(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]-e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r-=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r-=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r-=e.s}t.s=r<0?-1:0,r<-1?t.data[a++]=this.DV+r:r>0&&(t.data[a++]=r),t.t=a,t.clamp()}function sl(e,t){var a=this.abs(),r=e.abs(),n=a.t;for(t.t=n+r.t;--n>=0;)t.data[n]=0;for(n=0;n<r.t;++n)t.data[n+a.t]=a.am(0,r.data[n],t,n,0,a.t);t.s=0,t.clamp(),this.s!=e.s&&w.ZERO.subTo(t,t)}function ol(e){for(var t=this.abs(),a=e.t=2*t.t;--a>=0;)e.data[a]=0;for(a=0;a<t.t-1;++a){var r=t.am(a,t.data[a],e,2*a,0,1);(e.data[a+t.t]+=t.am(a+1,2*t.data[a],e,2*a+1,r,t.t-a-1))>=t.DV&&(e.data[a+t.t]-=t.DV,e.data[a+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(a,t.data[a],e,2*a,0,1)),e.s=0,e.clamp()}function ul(e,t,a){var r=e.abs();if(!(r.t<=0)){var n=this.abs();if(n.t<r.t){t?.fromInt(0),a!=null&&this.copyTo(a);return}a==null&&(a=te());var i=te(),s=this.s,o=e.s,u=this.DB-fa(r.data[r.t-1]);u>0?(r.lShiftTo(u,i),n.lShiftTo(u,a)):(r.copyTo(i),n.copyTo(a));var c=i.t,l=i.data[c-1];if(l!=0){var f=l*(1<<this.F1)+(c>1?i.data[c-2]>>this.F2:0),p=this.FV/f,v=(1<<this.F1)/f,y=1<<this.F2,m=a.t,x=m-c,T=t??te();for(i.dlShiftTo(x,T),a.compareTo(T)>=0&&(a.data[a.t++]=1,a.subTo(T,a)),w.ONE.dlShiftTo(c,T),T.subTo(i,i);i.t<c;)i.data[i.t++]=0;for(;--x>=0;){var B=a.data[--m]==l?this.DM:Math.floor(a.data[m]*p+(a.data[m-1]+y)*v);if((a.data[m]+=i.am(0,B,a,x,0,c))<B)for(i.dlShiftTo(x,T),a.subTo(T,a);a.data[m]<--B;)a.subTo(T,a)}t!=null&&(a.drShiftTo(c,t),s!=o&&w.ZERO.subTo(t,t)),a.t=c,a.clamp(),u>0&&a.rShiftTo(u,a),s<0&&w.ZERO.subTo(a,a)}}}function cl(e){var t=te();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(w.ZERO)>0&&e.subTo(t,t),t}function Jt(e){this.m=e}function ll(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e}function fl(e){return e}function dl(e){e.divRemTo(this.m,null,e)}function hl(e,t,a){e.multiplyTo(t,a),this.reduce(a)}function pl(e,t){e.squareTo(t),this.reduce(t)}Jt.prototype.convert=ll;Jt.prototype.revert=fl;Jt.prototype.reduce=dl;Jt.prototype.mulTo=hl;Jt.prototype.sqrTo=pl;function gl(){if(this.t<1)return 0;var e=this.data[0];if((e&1)==0)return 0;var t=e&3;return t=t*(2-(e&15)*t)&15,t=t*(2-(e&255)*t)&255,t=t*(2-((e&65535)*t&65535))&65535,t=t*(2-e*t%this.DV)%this.DV,t>0?this.DV-t:-t}function Zt(e){this.m=e,this.mp=e.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}function yl(e){var t=te();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(w.ZERO)>0&&this.m.subTo(t,t),t}function vl(e){var t=te();return e.copyTo(t),this.reduce(t),t}function ml(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t<this.m.t;++t){var a=e.data[t]&32767,r=a*this.mpl+((a*this.mph+(e.data[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(a=t+this.m.t,e.data[a]+=this.m.am(0,r,e,t,0,this.m.t);e.data[a]>=e.DV;)e.data[a]-=e.DV,e.data[++a]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)}function Cl(e,t){e.squareTo(t),this.reduce(t)}function El(e,t,a){e.multiplyTo(t,a),this.reduce(a)}Zt.prototype.convert=yl;Zt.prototype.revert=vl;Zt.prototype.reduce=ml;Zt.prototype.mulTo=El;Zt.prototype.sqrTo=Cl;function xl(){return(this.t>0?this.data[0]&1:this.s)==0}function Sl(e,t){if(e>4294967295||e<1)return w.ONE;var a=te(),r=te(),n=t.convert(this),i=fa(e)-1;for(n.copyTo(a);--i>=0;)if(t.sqrTo(a,r),(e&1<<i)>0)t.mulTo(r,n,a);else{var s=a;a=r,r=s}return t.revert(a)}function Tl(e,t){var a;return e<256||t.isEven()?a=new Jt(t):a=new Zt(t),this.exp(e,a)}w.prototype.copyTo=Qc;w.prototype.fromInt=$c;w.prototype.fromString=jc;w.prototype.clamp=Yc;w.prototype.dlShiftTo=tl;w.prototype.drShiftTo=rl;w.prototype.lShiftTo=al;w.prototype.rShiftTo=nl;w.prototype.subTo=il;w.prototype.multiplyTo=sl;w.prototype.squareTo=ol;w.prototype.divRemTo=ul;w.prototype.invDigit=gl;w.prototype.isEven=xl;w.prototype.exp=Sl;w.prototype.toString=Wc;w.prototype.negate=Xc;w.prototype.abs=Jc;w.prototype.compareTo=Zc;w.prototype.bitLength=el;w.prototype.mod=cl;w.prototype.modPowInt=Tl;w.ZERO=Ft(0);w.ONE=Ft(1);function Al(){var e=te();return this.copyTo(e),e}function Il(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function Bl(){return this.t==0?this.s:this.data[0]<<24>>24}function bl(){return this.t==0?this.s:this.data[0]<<16>>16}function wl(e){return Math.floor(Math.LN2*this.DB/Math.log(e))}function _l(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function Nl(e){if(e==null&&(e=10),this.signum()==0||e<2||e>36)return"0";var t=this.chunkSize(e),a=Math.pow(e,t),r=Ft(a),n=te(),i=te(),s="";for(this.divRemTo(r,n,i);n.signum()>0;)s=(a+i.intValue()).toString(e).substr(1)+s,n.divRemTo(r,n,i);return i.intValue().toString(e)+s}function Rl(e,t){this.fromInt(0),t==null&&(t=10);for(var a=this.chunkSize(t),r=Math.pow(t,a),n=!1,i=0,s=0,o=0;o<e.length;++o){var u=ns(e,o);if(u<0){e.charAt(o)=="-"&&this.signum()==0&&(n=!0);continue}s=t*s+u,++i>=a&&(this.dMultiply(r),this.dAddOffset(s,0),i=0,s=0)}i>0&&(this.dMultiply(Math.pow(t,i)),this.dAddOffset(s,0)),n&&w.ZERO.subTo(this,this)}function Ll(e,t,a){if(typeof t=="number")if(e<2)this.fromInt(1);else for(this.fromNumber(e,a),this.testBit(e-1)||this.bitwiseTo(w.ONE.shiftLeft(e-1),un,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(w.ONE.shiftLeft(e-1),this);else{var r=new Array,n=e&7;r.length=(e>>3)+1,t.nextBytes(r),n>0?r[0]&=(1<<n)-1:r[0]=0,this.fromString(r,256)}}function kl(){var e=this.t,t=new Array;t[0]=this.s;var a=this.DB-e*this.DB%8,r,n=0;if(e-- >0)for(a<this.DB&&(r=this.data[e]>>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<<this.DB-a);e>=0;)a<8?(r=(this.data[e]&(1<<a)-1)<<8-a,r|=this.data[--e]>>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),(r&128)!=0&&(r|=-256),n==0&&(this.s&128)!=(r&128)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t}function Dl(e){return this.compareTo(e)==0}function Ul(e){return this.compareTo(e)<0?this:e}function Pl(e){return this.compareTo(e)>0?this:e}function Ol(e,t,a){var r,n,i=Math.min(e.t,this.t);for(r=0;r<i;++r)a.data[r]=t(this.data[r],e.data[r]);if(e.t<this.t){for(n=e.s&this.DM,r=i;r<this.t;++r)a.data[r]=t(this.data[r],n);a.t=this.t}else{for(n=this.s&this.DM,r=i;r<e.t;++r)a.data[r]=t(n,e.data[r]);a.t=e.t}a.s=t(this.s,e.s),a.clamp()}function Vl(e,t){return e&t}function Fl(e){var t=te();return this.bitwiseTo(e,Vl,t),t}function un(e,t){return e|t}function Ml(e){var t=te();return this.bitwiseTo(e,un,t),t}function is(e,t){return e^t}function Kl(e){var t=te();return this.bitwiseTo(e,is,t),t}function ss(e,t){return e&~t}function ql(e){var t=te();return this.bitwiseTo(e,ss,t),t}function Hl(){for(var e=te(),t=0;t<this.t;++t)e.data[t]=this.DM&~this.data[t];return e.t=this.t,e.s=~this.s,e}function Gl(e){var t=te();return e<0?this.rShiftTo(-e,t):this.lShiftTo(e,t),t}function zl(e){var t=te();return e<0?this.lShiftTo(-e,t):this.rShiftTo(e,t),t}function Ql(e){if(e==0)return-1;var t=0;return(e&65535)==0&&(e>>=16,t+=16),(e&255)==0&&(e>>=8,t+=8),(e&15)==0&&(e>>=4,t+=4),(e&3)==0&&(e>>=2,t+=2),(e&1)==0&&++t,t}function $l(){for(var e=0;e<this.t;++e)if(this.data[e]!=0)return e*this.DB+Ql(this.data[e]);return this.s<0?this.t*this.DB:-1}function jl(e){for(var t=0;e!=0;)e&=e-1,++t;return t}function Yl(){for(var e=0,t=this.s&this.DM,a=0;a<this.t;++a)e+=jl(this.data[a]^t);return e}function Wl(e){var t=Math.floor(e/this.DB);return t>=this.t?this.s!=0:(this.data[t]&1<<e%this.DB)!=0}function Xl(e,t){var a=w.ONE.shiftLeft(e);return this.bitwiseTo(a,t,a),a}function Jl(e){return this.changeBit(e,un)}function Zl(e){return this.changeBit(e,ss)}function e0(e){return this.changeBit(e,is)}function t0(e,t){for(var a=0,r=0,n=Math.min(e.t,this.t);a<n;)r+=this.data[a]+e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;if(e.t<this.t){for(r+=e.s;a<this.t;)r+=this.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;a<e.t;)r+=e.data[a],t.data[a++]=r&this.DM,r>>=this.DB;r+=e.s}t.s=r<0?-1:0,r>0?t.data[a++]=r:r<-1&&(t.data[a++]=this.DV+r),t.t=a,t.clamp()}function r0(e){var t=te();return this.addTo(e,t),t}function a0(e){var t=te();return this.subTo(e,t),t}function n0(e){var t=te();return this.multiplyTo(e,t),t}function i0(){var e=te();return this.squareTo(e),e}function s0(e){var t=te();return this.divRemTo(e,t,null),t}function o0(e){var t=te();return this.divRemTo(e,null,t),t}function u0(e){var t=te(),a=te();return this.divRemTo(e,t,a),new Array(t,a)}function c0(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()}function l0(e,t){if(e!=0){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}}function kr(){}function os(e){return e}function f0(e,t,a){e.multiplyTo(t,a)}function d0(e,t){e.squareTo(t)}kr.prototype.convert=os;kr.prototype.revert=os;kr.prototype.mulTo=f0;kr.prototype.sqrTo=d0;function h0(e){return this.exp(e,new kr)}function p0(e,t,a){var r=Math.min(this.t+e.t,t);for(a.s=0,a.t=r;r>0;)a.data[--r]=0;var n;for(n=a.t-this.t;r<n;++r)a.data[r+this.t]=this.am(0,e.data[r],a,r,0,this.t);for(n=Math.min(e.t,t);r<n;++r)this.am(0,e.data[r],a,r,0,t-r);a.clamp()}function g0(e,t,a){--t;var r=a.t=this.t+e.t-t;for(a.s=0;--r>=0;)a.data[r]=0;for(r=Math.max(t-this.t,0);r<e.t;++r)a.data[this.t+r-t]=this.am(t-r,e.data[r],a,0,0,this.t+r-t);a.clamp(),a.drShiftTo(1,a)}function gr(e){this.r2=te(),this.q3=te(),w.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}function y0(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=te();return e.copyTo(t),this.reduce(t),t}function v0(e){return e}function m0(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)}function C0(e,t){e.squareTo(t),this.reduce(t)}function E0(e,t,a){e.multiplyTo(t,a),this.reduce(a)}gr.prototype.convert=y0;gr.prototype.revert=v0;gr.prototype.reduce=m0;gr.prototype.mulTo=E0;gr.prototype.sqrTo=C0;function x0(e,t){var a=e.bitLength(),r,n=Ft(1),i;if(a<=0)return n;a<18?r=1:a<48?r=3:a<144?r=4:a<768?r=5:r=6,a<8?i=new Jt(t):t.isEven()?i=new gr(t):i=new Zt(t);var s=new Array,o=3,u=r-1,c=(1<<r)-1;if(s[1]=i.convert(this),r>1){var l=te();for(i.sqrTo(s[1],l);o<=c;)s[o]=te(),i.mulTo(l,s[o-2],s[o]),o+=2}var f=e.t-1,p,v=!0,y=te(),m;for(a=fa(e.data[f])-1;f>=0;){for(a>=u?p=e.data[f]>>a-u&c:(p=(e.data[f]&(1<<a+1)-1)<<u-a,f>0&&(p|=e.data[f-1]>>this.DB+a-u)),o=r;(p&1)==0;)p>>=1,--o;if((a-=o)<0&&(a+=this.DB,--f),v)s[p].copyTo(n),v=!1;else{for(;o>1;)i.sqrTo(n,y),i.sqrTo(y,n),o-=2;o>0?i.sqrTo(n,y):(m=n,n=y,y=m),i.mulTo(y,s[p],n)}for(;f>=0&&(e.data[f]&1<<a)==0;)i.sqrTo(n,y),m=n,n=y,y=m,--a<0&&(a=this.DB-1,--f)}return i.revert(n)}function S0(e){var t=this.s<0?this.negate():this.clone(),a=e.s<0?e.negate():e.clone();if(t.compareTo(a)<0){var r=t;t=a,a=r}var n=t.getLowestSetBit(),i=a.getLowestSetBit();if(i<0)return t;for(n<i&&(i=n),i>0&&(t.rShiftTo(i,t),a.rShiftTo(i,a));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=a.getLowestSetBit())>0&&a.rShiftTo(n,a),t.compareTo(a)>=0?(t.subTo(a,t),t.rShiftTo(1,t)):(a.subTo(t,a),a.rShiftTo(1,a));return i>0&&a.lShiftTo(i,a),a}function T0(e){if(e<=0)return 0;var t=this.DV%e,a=this.s<0?e-1:0;if(this.t>0)if(t==0)a=this.data[0]%e;else for(var r=this.t-1;r>=0;--r)a=(t*a+this.data[r])%e;return a}function A0(e){if(this.signum()==0)return w.ZERO;var t=e.isEven();if(this.isEven()&&t||e.signum()==0)return w.ZERO;for(var a=e.clone(),r=this.clone(),n=Ft(1),i=Ft(0),s=Ft(0),o=Ft(1);a.signum()!=0;){for(;a.isEven();)a.rShiftTo(1,a),t?((!n.isEven()||!i.isEven())&&(n.addTo(this,n),i.subTo(e,i)),n.rShiftTo(1,n)):i.isEven()||i.subTo(e,i),i.rShiftTo(1,i);for(;r.isEven();)r.rShiftTo(1,r),t?((!s.isEven()||!o.isEven())&&(s.addTo(this,s),o.subTo(e,o)),s.rShiftTo(1,s)):o.isEven()||o.subTo(e,o),o.rShiftTo(1,o);a.compareTo(r)>=0?(a.subTo(r,a),t&&n.subTo(s,n),i.subTo(o,i)):(r.subTo(a,r),t&&s.subTo(n,s),o.subTo(i,o))}if(r.compareTo(w.ONE)!=0)return w.ZERO;if(o.compareTo(e)>=0)return o.subtract(e);if(o.signum()<0)o.addTo(e,o);else return o;return o.signum()<0?o.add(e):o}var yt=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],I0=(1<<26)/yt[yt.length-1];function B0(e){var t,a=this.abs();if(a.t==1&&a.data[0]<=yt[yt.length-1]){for(t=0;t<yt.length;++t)if(a.data[0]==yt[t])return!0;return!1}if(a.isEven())return!1;for(t=1;t<yt.length;){for(var r=yt[t],n=t+1;n<yt.length&&r<I0;)r*=yt[n++];for(r=a.modInt(r);t<n;)if(r%yt[t++]==0)return!1}return a.millerRabin(e)}function b0(e){var t=this.subtract(w.ONE),a=t.getLowestSetBit();if(a<=0)return!1;for(var r=t.shiftRight(a),n=w0(),i,s=0;s<e;++s){do i=new w(this.bitLength(),n);while(i.compareTo(w.ONE)<=0||i.compareTo(t)>=0);var o=i.modPow(r,this);if(o.compareTo(w.ONE)!=0&&o.compareTo(t)!=0){for(var u=1;u++<a&&o.compareTo(t)!=0;)if(o=o.modPowInt(2,this),o.compareTo(w.ONE)==0)return!1;if(o.compareTo(t)!=0)return!1}}return!0}function w0(){return{nextBytes:function(e){for(var t=0;t<e.length;++t)e[t]=Math.floor(Math.random()*256)}}}w.prototype.chunkSize=wl;w.prototype.toRadix=Nl;w.prototype.fromRadix=Rl;w.prototype.fromNumber=Ll;w.prototype.bitwiseTo=Ol;w.prototype.changeBit=Xl;w.prototype.addTo=t0;w.prototype.dMultiply=c0;w.prototype.dAddOffset=l0;w.prototype.multiplyLowerTo=p0;w.prototype.multiplyUpperTo=g0;w.prototype.modInt=T0;w.prototype.millerRabin=b0;w.prototype.clone=Al;w.prototype.intValue=Il;w.prototype.byteValue=Bl;w.prototype.shortValue=bl;w.prototype.signum=_l;w.prototype.toByteArray=kl;w.prototype.equals=Dl;w.prototype.min=Ul;w.prototype.max=Pl;w.prototype.and=Fl;w.prototype.or=Ml;w.prototype.xor=Kl;w.prototype.andNot=ql;w.prototype.not=Hl;w.prototype.shiftLeft=Gl;w.prototype.shiftRight=zl;w.prototype.getLowestSetBit=$l;w.prototype.bitCount=Yl;w.prototype.testBit=Wl;w.prototype.setBit=Jl;w.prototype.clearBit=Zl;w.prototype.flipBit=e0;w.prototype.add=r0;w.prototype.subtract=a0;w.prototype.multiply=n0;w.prototype.divide=s0;w.prototype.remainder=o0;w.prototype.divideAndRemainder=u0;w.prototype.modPow=x0;w.prototype.modInverse=A0;w.prototype.pow=h0;w.prototype.gcd=S0;w.prototype.isProbablePrime=B0;w.prototype.square=i0});var yr=F((rg,ds)=>{var St=$();vt();ne();var ls=ds.exports=St.sha1=St.sha1||{};St.md.sha1=St.md.algorithms.sha1=ls;ls.create=function(){fs||_0();var e=null,t=St.util.createBuffer(),a=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var n=r.messageLengthSize/4,i=0;i<n;++i)r.fullMessageLength.push(0);return t=St.util.createBuffer(),e={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},r},r.start(),r.update=function(n,i){i==="utf8"&&(n=St.util.encodeUtf8(n));var s=n.length;r.messageLength+=s,s=[s/4294967296>>>0,s>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=s[1],s[1]=s[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return t.putBytes(n),cs(e,a,t),(t.read>2048||t.length()===0)&&t.compact(),r},r.digest=function(){var n=St.util.createBuffer();n.putBytes(t.bytes());var i=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,s=i&r.blockLength-1;n.putBytes(cn.substr(0,r.blockLength-s));for(var o,u,c=r.fullMessageLength[0]*8,l=0;l<r.fullMessageLength.length-1;++l)o=r.fullMessageLength[l+1]*8,u=o/4294967296>>>0,c+=u,n.putInt32(c>>>0),c=o>>>0;n.putInt32(c);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};cs(f,a,n);var p=St.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p},r};var cn=null,fs=!1;function _0(){cn="\x80",cn+=St.util.fillString("\0",64),fs=!0}function cs(e,t,a){for(var r,n,i,s,o,u,c,l,f=a.length();f>=64;){for(n=e.h0,i=e.h1,s=e.h2,o=e.h3,u=e.h4,l=0;l<16;++l)r=a.getInt32(),t[l]=r,c=o^i&(s^o),r=(n<<5|n>>>27)+c+u+1518500249+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;for(;l<20;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,c=o^i&(s^o),r=(n<<5|n>>>27)+c+u+1518500249+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;for(;l<32;++l)r=t[l-3]^t[l-8]^t[l-14]^t[l-16],r=r<<1|r>>>31,t[l]=r,c=i^s^o,r=(n<<5|n>>>27)+c+u+1859775393+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;for(;l<40;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=i^s^o,r=(n<<5|n>>>27)+c+u+1859775393+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;for(;l<60;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=i&s|o&(i^s),r=(n<<5|n>>>27)+c+u+2400959708+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;for(;l<80;++l)r=t[l-6]^t[l-16]^t[l-28]^t[l-32],r=r<<2|r>>>30,t[l]=r,c=i^s^o,r=(n<<5|n>>>27)+c+u+3395469782+r,u=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=r;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+u|0,f-=64}}});var ln=F((ag,ps)=>{var Tt=$();ne();ot();yr();var hs=ps.exports=Tt.pkcs1=Tt.pkcs1||{};hs.encode_rsa_oaep=function(e,t,a){var r,n,i,s;typeof a=="string"?(r=a,n=arguments[3]||void 0,i=arguments[4]||void 0):a&&(r=a.label||void 0,n=a.seed||void 0,i=a.md||void 0,a.mgf1&&a.mgf1.md&&(s=a.mgf1.md)),i?i.start():i=Tt.md.sha1.create(),s||(s=i);var o=Math.ceil(e.n.bitLength()/8),u=o-2*i.digestLength-2;if(t.length>u){var c=new Error("RSAES-OAEP input message length is too long.");throw c.length=t.length,c.maxLength=u,c}r||(r=""),i.update(r,"raw");for(var l=i.digest(),f="",p=u-t.length,v=0;v<p;v++)f+="\0";var y=l.getBytes()+f+""+t;if(!n)n=Tt.random.getBytes(i.digestLength);else if(n.length!==i.digestLength){var c=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw c.seedLength=n.length,c.digestLength=i.digestLength,c}var m=da(n,o-i.digestLength-1,s),x=Tt.util.xorBytes(y,m,y.length),T=da(x,i.digestLength,s),B=Tt.util.xorBytes(n,T,n.length);return"\0"+B+x};hs.decode_rsa_oaep=function(e,t,a){var r,n,i;typeof a=="string"?(r=a,n=arguments[3]||void 0):a&&(r=a.label||void 0,n=a.md||void 0,a.mgf1&&a.mgf1.md&&(i=a.mgf1.md));var s=Math.ceil(e.n.bitLength()/8);if(t.length!==s){var x=new Error("RSAES-OAEP encoded message length is invalid.");throw x.length=t.length,x.expectedLength=s,x}if(n===void 0?n=Tt.md.sha1.create():n.start(),i||(i=n),s<2*n.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");r||(r=""),n.update(r,"raw");for(var o=n.digest().getBytes(),u=t.charAt(0),c=t.substring(1,n.digestLength+1),l=t.substring(1+n.digestLength),f=da(l,n.digestLength,i),p=Tt.util.xorBytes(c,f,c.length),v=da(p,s-n.digestLength-1,i),y=Tt.util.xorBytes(l,v,l.length),m=y.substring(0,n.digestLength),x=u!=="\0",T=0;T<n.digestLength;++T)x|=o.charAt(T)!==m.charAt(T);for(var B=1,b=n.digestLength,P=n.digestLength;P<y.length;P++){var R=y.charCodeAt(P),L=R&1^1,z=B?65534:0;x|=R&z,B=B&L,b+=B}if(x||y.charCodeAt(b)!==1)throw new Error("Invalid RSAES-OAEP padding.");return y.substring(b+1)};function da(e,t,a){a||(a=Tt.md.sha1.create());for(var r="",n=Math.ceil(t/a.digestLength),i=0;i<n;++i){var s=String.fromCharCode(i>>24&255,i>>16&255,i>>8&255,i&255);a.start(),a.update(e+s),r+=a.digest().getBytes()}return r.substring(0,t)}});var dn=F((ng,fn)=>{var Mt=$();ne();Dr();ot();(function(){if(Mt.prime){fn.exports=Mt.prime;return}var e=fn.exports=Mt.prime=Mt.prime||{},t=Mt.jsbn.BigInteger,a=[6,4,2,4,2,4,6,2],r=new t(null);r.fromInt(30);var n=function(f,p){return f|p};e.generateProbablePrime=function(f,p,v){typeof p=="function"&&(v=p,p={}),p=p||{};var y=p.algorithm||"PRIMEINC";typeof y=="string"&&(y={name:y}),y.options=y.options||{};var m=p.prng||Mt.random,x={nextBytes:function(T){for(var B=m.getBytesSync(T.length),b=0;b<T.length;++b)T[b]=B.charCodeAt(b)}};if(y.name==="PRIMEINC")return i(f,x,y.options,v);throw new Error("Invalid prime generation algorithm: "+y.name)};function i(f,p,v,y){return"workers"in v?u(f,p,v,y):s(f,p,v,y)}function s(f,p,v,y){var m=c(f,p),x=0,T=l(m.bitLength());"millerRabinTests"in v&&(T=v.millerRabinTests);var B=10;"maxBlockTime"in v&&(B=v.maxBlockTime),o(m,f,p,x,T,B,y)}function o(f,p,v,y,m,x,T){var B=+new Date;do{if(f.bitLength()>p&&(f=c(p,v)),f.isProbablePrime(m))return T(null,f);f.dAddOffset(a[y++%8],0)}while(x<0||+new Date-B<x);Mt.util.setImmediate(function(){o(f,p,v,y,m,x,T)})}function u(f,p,v,y){if(typeof Worker>"u")return s(f,p,v,y);var m=c(f,p),x=v.workers,T=v.workLoad||100,B=T*30/8,b=v.workerScript||"forge/prime.worker.js";if(x===-1)return Mt.util.estimateCores(function(R,L){R&&(L=2),x=L-1,P()});P();function P(){x=Math.max(1,x);for(var R=[],L=0;L<x;++L)R[L]=new Worker(b);for(var z=x,L=0;L<x;++L)R[L].addEventListener("message",oe);var j=!1;function oe(ce){if(!j){--z;var de=ce.data;if(de.found){for(var ge=0;ge<R.length;++ge)R[ge].terminate();return j=!0,y(null,new t(de.prime,16))}m.bitLength()>f&&(m=c(f,p));var $e=m.toString(16);ce.target.postMessage({hex:$e,workLoad:T}),m.dAddOffset(B,0)}}}}function c(f,p){var v=new t(f,p),y=f-1;return v.testBit(y)||v.bitwiseTo(t.ONE.shiftLeft(y),n,v),v.dAddOffset(31-v.mod(r).byteValue(),0),v}function l(f){return f<=100?27:f<=150?18:f<=200?15:f<=250?12:f<=300?9:f<=350?8:f<=400?7:f<=500?6:f<=600?5:f<=800?4:f<=1250?3:2}})()});var Ur=F((ig,xs)=>{var K=$();gt();Dr();Vt();ln();dn();ot();ne();typeof re>"u"&&(re=K.jsbn.BigInteger);var re,hn=K.util.isNodejs?require("crypto"):null,A=K.asn1,ct=K.util;K.pki=K.pki||{};xs.exports=K.pki.rsa=K.rsa=K.rsa||{};var G=K.pki,N0=[6,4,2,4,2,4,6,2],R0={name:"PrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},L0={name:"RSAPrivateKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},k0={name:"RSAPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:A.Class.UNIVERSAL,type:A.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},D0=K.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},U0={name:"DigestInfo",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:A.Class.UNIVERSAL,type:A.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:A.Class.UNIVERSAL,type:A.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:A.Class.UNIVERSAL,type:A.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:A.Class.UNIVERSAL,type:A.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},P0=function(e){var t;if(e.algorithm in G.oids)t=G.oids[e.algorithm];else{var a=new Error("Unknown message digest algorithm.");throw a.algorithm=e.algorithm,a}var r=A.oidToDer(t).getBytes(),n=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[]),i=A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[]);i.value.push(A.create(A.Class.UNIVERSAL,A.Type.OID,!1,r)),i.value.push(A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,""));var s=A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(i),n.value.push(s),A.toDer(n).getBytes()},Cs=function(e,t,a){if(a)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);t.dP||(t.dP=t.d.mod(t.p.subtract(re.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(re.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));var r;do r=new re(K.util.bytesToHex(K.random.getBytes(t.n.bitLength()/8)),16);while(r.compareTo(t.n)>=0||!r.gcd(t.n).equals(re.ONE));e=e.multiply(r.modPow(t.e,t.n)).mod(t.n);for(var n=e.mod(t.p).modPow(t.dP,t.p),i=e.mod(t.q).modPow(t.dQ,t.q);n.compareTo(i)<0;)n=n.add(t.p);var s=n.subtract(i).multiply(t.qInv).mod(t.p).multiply(t.q).add(i);return s=s.multiply(r.modInverse(t.n)).mod(t.n),s};G.rsa.encrypt=function(e,t,a){var r=a,n,i=Math.ceil(t.n.bitLength()/8);a!==!1&&a!==!0?(r=a===2,n=Es(e,t,a)):(n=K.util.createBuffer(),n.putBytes(e));for(var s=new re(n.toHex(),16),o=Cs(s,t,r),u=o.toString(16),c=K.util.createBuffer(),l=i-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(K.util.hexToBytes(u)),c.getBytes()};G.rsa.decrypt=function(e,t,a,r){var n=Math.ceil(t.n.bitLength()/8);if(e.length!==n){var i=new Error("Encrypted message length is invalid.");throw i.length=e.length,i.expected=n,i}var s=new re(K.util.createBuffer(e).toHex(),16);if(s.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=Cs(s,t,a),u=o.toString(16),c=K.util.createBuffer(),l=n-Math.ceil(u.length/2);l>0;)c.putByte(0),--l;return c.putBytes(K.util.hexToBytes(u)),r!==!1?ha(c.getBytes(),t,a):c.getBytes()};G.rsa.createKeyPairGenerationState=function(e,t,a){typeof e=="string"&&(e=parseInt(e,10)),e=e||2048,a=a||{};var r=a.prng||K.random,n={nextBytes:function(o){for(var u=r.getBytesSync(o.length),c=0;c<o.length;++c)o[c]=u.charCodeAt(c)}},i=a.algorithm||"PRIMEINC",s;if(i==="PRIMEINC")s={algorithm:i,state:0,bits:e,rng:n,eInt:t||65537,e:new re(null),p:null,q:null,qBits:e>>1,pBits:e-(e>>1),pqState:0,num:null,keys:null},s.e.fromInt(s.eInt);else throw new Error("Invalid key generation algorithm: "+i);return s};G.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var a=new re(null);a.fromInt(30);for(var r=0,n=function(f,p){return f|p},i=+new Date,s,o=0;e.keys===null&&(t<=0||o<t);){if(e.state===0){var u=e.p===null?e.pBits:e.qBits,c=u-1;e.pqState===0?(e.num=new re(u,e.rng),e.num.testBit(c)||e.num.bitwiseTo(re.ONE.shiftLeft(c),n,e.num),e.num.dAddOffset(31-e.num.mod(a).byteValue(),0),r=0,++e.pqState):e.pqState===1?e.num.bitLength()>u?e.pqState=0:e.num.isProbablePrime(V0(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(N0[r++%8],0):e.pqState===2?e.pqState=e.num.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)===0?3:0:e.pqState===3&&(e.pqState=0,e.p===null?e.p=e.num:e.q=e.num,e.p!==null&&e.q!==null&&++e.state,e.num=null)}else if(e.state===1)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(e.state===2)e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(e.state===3)e.phi.gcd(e.e).compareTo(re.ONE)===0?++e.state:(e.p=null,e.q=null,e.state=0);else if(e.state===4)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(e.state===5){var l=e.e.modInverse(e.phi);e.keys={privateKey:G.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:G.rsa.setPublicKey(e.n,e.e)}}s=+new Date,o+=s-i,i=s}return e.keys!==null};G.rsa.generateKeyPair=function(e,t,a,r){if(arguments.length===1?typeof e=="object"?(a=e,e=void 0):typeof e=="function"&&(r=e,e=void 0):arguments.length===2?typeof e=="number"?typeof t=="function"?(r=t,t=void 0):typeof t!="number"&&(a=t,t=void 0):(a=e,r=t,e=void 0,t=void 0):arguments.length===3&&(typeof t=="number"?typeof a=="function"&&(r=a,a=void 0):(r=a,a=t,t=void 0)),a=a||{},e===void 0&&(e=a.bits||2048),t===void 0&&(t=a.e||65537),!K.options.usePureJavaScript&&!a.prng&&e>=256&&e<=16384&&(t===65537||t===3)){if(r){if(gs("generateKeyPair"))return hn.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,u,c){if(o)return r(o);r(null,{privateKey:G.privateKeyFromPem(c),publicKey:G.publicKeyFromPem(u)})});if(ys("generateKey")&&ys("exportKey"))return ct.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ms(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return ct.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var u=G.privateKeyFromAsn1(A.fromDer(K.util.createBuffer(o)));r(null,{privateKey:u,publicKey:G.setRsaPublicKey(u.n,u.e)})}});if(vs("generateKey")&&vs("exportKey")){var n=ct.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:ms(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);n.oncomplete=function(o){var u=o.target.result,c=ct.globalScope.msCrypto.subtle.exportKey("pkcs8",u.privateKey);c.oncomplete=function(l){var f=l.target.result,p=G.privateKeyFromAsn1(A.fromDer(K.util.createBuffer(f)));r(null,{privateKey:p,publicKey:G.setRsaPublicKey(p.n,p.e)})},c.onerror=function(l){r(l)}},n.onerror=function(o){r(o)};return}}else if(gs("generateKeyPairSync")){var i=hn.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:G.privateKeyFromPem(i.privateKey),publicKey:G.publicKeyFromPem(i.publicKey)}}}var s=G.rsa.createKeyPairGenerationState(e,t,a);if(!r)return G.rsa.stepKeyPairGenerationState(s,0),s.keys;O0(s,a,r)};G.setRsaPublicKey=G.rsa.setPublicKey=function(e,t){var a={n:e,e:t};return a.encrypt=function(r,n,i){if(typeof n=="string"?n=n.toUpperCase():n===void 0&&(n="RSAES-PKCS1-V1_5"),n==="RSAES-PKCS1-V1_5")n={encode:function(o,u,c){return Es(o,u,2).getBytes()}};else if(n==="RSA-OAEP"||n==="RSAES-OAEP")n={encode:function(o,u){return K.pkcs1.encode_rsa_oaep(u,o,i)}};else if(["RAW","NONE","NULL",null].indexOf(n)!==-1)n={encode:function(o){return o}};else if(typeof n=="string")throw new Error('Unsupported encryption scheme: "'+n+'".');var s=n.encode(r,a,!0);return G.rsa.encrypt(s,a,!0)},a.verify=function(r,n,i,s){typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSASSA-PKCS1-V1_5"),s===void 0&&(s={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),"_skipPaddingChecks"in s||(s._skipPaddingChecks=!1),i==="RSASSA-PKCS1-V1_5"?i={verify:function(u,c){c=ha(c,a,!0,void 0,s);var l=A.fromDer(c,{parseAllBytes:s._parseAllDigestBytes}),f={},p=[];if(!A.validate(l,U0,f,p)||l.value.length!==2){var v=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw v.errors=p,v}var y=A.derToOid(f.algorithmIdentifier);if(!(y===K.oids.md2||y===K.oids.md5||y===K.oids.sha1||y===K.oids.sha224||y===K.oids.sha256||y===K.oids.sha384||y===K.oids.sha512||y===K.oids["sha512-224"]||y===K.oids["sha512-256"])){var v=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw v.oid=y,v}if((y===K.oids.md2||y===K.oids.md5)&&!("parameters"in f))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return u===f.digest}}:(i==="NONE"||i==="NULL"||i===null)&&(i={verify:function(u,c){return c=ha(c,a,!0,void 0,s),u===c}});var o=G.rsa.decrypt(n,a,!0,!1);return i.verify(r,o,a.n.bitLength())},a};G.setRsaPrivateKey=G.rsa.setPrivateKey=function(e,t,a,r,n,i,s,o){var u={n:e,e:t,d:a,p:r,q:n,dP:i,dQ:s,qInv:o};return u.decrypt=function(c,l,f){typeof l=="string"?l=l.toUpperCase():l===void 0&&(l="RSAES-PKCS1-V1_5");var p=G.rsa.decrypt(c,u,!1,!1);if(l==="RSAES-PKCS1-V1_5")l={decode:ha};else if(l==="RSA-OAEP"||l==="RSAES-OAEP")l={decode:function(v,y){return K.pkcs1.decode_rsa_oaep(y,v,f)}};else if(["RAW","NONE","NULL",null].indexOf(l)!==-1)l={decode:function(v){return v}};else throw new Error('Unsupported encryption scheme: "'+l+'".');return l.decode(p,u,!1)},u.sign=function(c,l){var f=!1;typeof l=="string"&&(l=l.toUpperCase()),l===void 0||l==="RSASSA-PKCS1-V1_5"?(l={encode:P0},f=1):(l==="NONE"||l==="NULL"||l===null)&&(l={encode:function(){return c}},f=1);var p=l.encode(c,u.n.bitLength());return G.rsa.encrypt(p,u,f)},u};G.wrapRsaPrivateKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,A.integerToDer(0).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(G.oids.rsaEncryption).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")]),A.create(A.Class.UNIVERSAL,A.Type.OCTETSTRING,!1,A.toDer(e).getBytes())])};G.privateKeyFromAsn1=function(e){var t={},a=[];if(A.validate(e,R0,t,a)&&(e=A.fromDer(K.util.createBuffer(t.privateKey))),t={},a=[],!A.validate(e,L0,t,a)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=a,r}var n,i,s,o,u,c,l,f;return n=K.util.createBuffer(t.privateKeyModulus).toHex(),i=K.util.createBuffer(t.privateKeyPublicExponent).toHex(),s=K.util.createBuffer(t.privateKeyPrivateExponent).toHex(),o=K.util.createBuffer(t.privateKeyPrime1).toHex(),u=K.util.createBuffer(t.privateKeyPrime2).toHex(),c=K.util.createBuffer(t.privateKeyExponent1).toHex(),l=K.util.createBuffer(t.privateKeyExponent2).toHex(),f=K.util.createBuffer(t.privateKeyCoefficient).toHex(),G.setRsaPrivateKey(new re(n,16),new re(i,16),new re(s,16),new re(o,16),new re(u,16),new re(c,16),new re(l,16),new re(f,16))};G.privateKeyToAsn1=G.privateKeyToRSAPrivateKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,A.integerToDer(0).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.n)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.e)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.d)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.p)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.q)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.dP)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.dQ)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.qInv))])};G.publicKeyFromAsn1=function(e){var t={},a=[];if(A.validate(e,D0,t,a)){var r=A.derToOid(t.publicKeyOid);if(r!==G.oids.rsaEncryption){var n=new Error("Cannot read public key. Unknown OID.");throw n.oid=r,n}e=t.rsaPublicKey}if(a=[],!A.validate(e,k0,t,a)){var n=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw n.errors=a,n}var i=K.util.createBuffer(t.publicKeyModulus).toHex(),s=K.util.createBuffer(t.publicKeyExponent).toHex();return G.setRsaPublicKey(new re(i,16),new re(s,16))};G.publicKeyToAsn1=G.publicKeyToSubjectPublicKeyInfo=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.OID,!1,A.oidToDer(G.oids.rsaEncryption).getBytes()),A.create(A.Class.UNIVERSAL,A.Type.NULL,!1,"")]),A.create(A.Class.UNIVERSAL,A.Type.BITSTRING,!1,[G.publicKeyToRSAPublicKey(e)])])};G.publicKeyToRSAPublicKey=function(e){return A.create(A.Class.UNIVERSAL,A.Type.SEQUENCE,!0,[A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.n)),A.create(A.Class.UNIVERSAL,A.Type.INTEGER,!1,At(e.e))])};function Es(e,t,a){var r=K.util.createBuffer(),n=Math.ceil(t.n.bitLength()/8);if(e.length>n-11){var i=new Error("Message is too long for PKCS#1 v1.5 padding.");throw i.length=e.length,i.max=n-11,i}r.putByte(0),r.putByte(a);var s=n-3-e.length,o;if(a===0||a===1){o=a===0?0:255;for(var u=0;u<s;++u)r.putByte(o)}else for(;s>0;){for(var c=0,l=K.random.getBytes(s),u=0;u<s;++u)o=l.charCodeAt(u),o===0?++c:r.putByte(o);s=c}return r.putByte(0),r.putBytes(e),r}function ha(e,t,a,r,n){var i=Math.ceil(t.n.bitLength()/8),s=K.util.createBuffer(e),o=s.getByte(),u=s.getByte();if(o!==0||a&&u!==0&&u!==1||!a&&u!==2||a&&u===0&&typeof r>"u")throw new Error("Encryption block is invalid.");var c=0;if(u===0){c=i-3-r;for(var l=0;l<c;++l)if(s.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(u===1){for(c=0;s.length()>1;){if(s.getByte()!==255){--s.read;break}++c}if(c<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(u===2){for(c=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++c}if(c<8&&!(n&&n._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var f=s.getByte();if(f!==0||c!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function O0(e,t,a){typeof t=="function"&&(a=t,t={}),t=t||{};var r={algorithm:{name:t.algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};"prng"in t&&(r.prng=t.prng),n();function n(){i(e.pBits,function(o,u){if(o)return a(o);if(e.p=u,e.q!==null)return s(o,e.q);i(e.qBits,s)})}function i(o,u){K.prime.generateProbablePrime(o,r,u)}function s(o,u){if(o)return a(o);if(e.q=u,e.p.compareTo(e.q)<0){var c=e.p;e.p=e.q,e.q=c}if(e.p.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.p=null,n();return}if(e.q.subtract(re.ONE).gcd(e.e).compareTo(re.ONE)!==0){e.q=null,i(e.qBits,s);return}if(e.p1=e.p.subtract(re.ONE),e.q1=e.q.subtract(re.ONE),e.phi=e.p1.multiply(e.q1),e.phi.gcd(e.e).compareTo(re.ONE)!==0){e.p=e.q=null,n();return}if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits){e.q=null,i(e.qBits,s);return}var l=e.e.modInverse(e.phi);e.keys={privateKey:G.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:G.rsa.setPublicKey(e.n,e.e)},a(null,e.keys)}}function At(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var a=K.util.hexToBytes(t);return a.length>1&&(a.charCodeAt(0)===0&&(a.charCodeAt(1)&128)===0||a.charCodeAt(0)===255&&(a.charCodeAt(1)&128)===128)?a.substr(1):a}function V0(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function gs(e){return K.util.isNodejs&&typeof hn[e]=="function"}function ys(e){return typeof ct.globalScope<"u"&&typeof ct.globalScope.crypto=="object"&&typeof ct.globalScope.crypto.subtle=="object"&&typeof ct.globalScope.crypto.subtle[e]=="function"}function vs(e){return typeof ct.globalScope<"u"&&typeof ct.globalScope.msCrypto=="object"&&typeof ct.globalScope.msCrypto.subtle=="object"&&typeof ct.globalScope.msCrypto.subtle[e]=="function"}function ms(e){for(var t=K.util.hexToBytes(e.toString(16)),a=new Uint8Array(t.length),r=0;r<t.length;++r)a[r]=t.charCodeAt(r);return a}});var pn=F((sg,Bs)=>{var V=$();Ot();gt();Lr();vt();Vt();ua();Xt();ot();nn();Ur();ne();typeof Ss>"u"&&(Ss=V.jsbn.BigInteger);var Ss,I=V.asn1,Q=V.pki=V.pki||{};Bs.exports=Q.pbe=V.pbe=V.pbe||{};var er=Q.oids,F0={name:"EncryptedPrivateKeyInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},M0={name:"PBES2Algorithms",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},K0={name:"pkcs-12PbeParams",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"iterations"}]};Q.encryptPrivateKeyInfo=function(e,t,a){a=a||{},a.saltSize=a.saltSize||8,a.count=a.count||2048,a.algorithm=a.algorithm||"aes128",a.prfAlgorithm=a.prfAlgorithm||"sha1";var r=V.random.getBytesSync(a.saltSize),n=a.count,i=I.integerToDer(n),s,o,u;if(a.algorithm.indexOf("aes")===0||a.algorithm==="des"){var c,l,f;switch(a.algorithm){case"aes128":s=16,c=16,l=er["aes128-CBC"],f=V.aes.createEncryptionCipher;break;case"aes192":s=24,c=16,l=er["aes192-CBC"],f=V.aes.createEncryptionCipher;break;case"aes256":s=32,c=16,l=er["aes256-CBC"],f=V.aes.createEncryptionCipher;break;case"des":s=8,c=8,l=er.desCBC,f=V.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=a.algorithm,p}var v="hmacWith"+a.prfAlgorithm.toUpperCase(),y=Is(v),m=V.pkcs5.pbkdf2(t,r,n,s,y),x=V.random.getBytesSync(c),T=f(m);T.start(x),T.update(I.toDer(e)),T.finish(),u=T.output.getBytes();var B=q0(r,i,s,v);o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er.pkcs5PBES2).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er.pkcs5PBKDF2).getBytes()),B]),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(l).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,x)])])])}else if(a.algorithm==="3des"){s=24;var b=new V.util.ByteBuffer(r),m=Q.pbe.generatePkcs12Key(t,b,1,n,s),x=Q.pbe.generatePkcs12Key(t,b,2,n,s),T=V.des.createEncryptionCipher(m);T.start(x),T.update(I.toDer(e)),T.finish(),u=T.output.getBytes(),o=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(er["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,r),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,i.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=a.algorithm,p}var P=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[o,I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,u)]);return P};Q.decryptPrivateKeyInfo=function(e,t){var a=null,r={},n=[];if(!I.validate(e,F0,r,n)){var i=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=n,i}var s=I.derToOid(r.encryptionOid),o=Q.pbe.getCipher(s,r.encryptionParams,t),u=V.util.createBuffer(r.encryptedData);return o.update(u),o.finish()&&(a=I.fromDer(o.output)),a};Q.encryptedPrivateKeyToPem=function(e,t){var a={type:"ENCRYPTED PRIVATE KEY",body:I.toDer(e).getBytes()};return V.pem.encode(a,{maxline:t})};Q.encryptedPrivateKeyFromPem=function(e){var t=V.pem.decode(e)[0];if(t.type!=="ENCRYPTED PRIVATE KEY"){var a=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return I.fromDer(t.body)};Q.encryptRsaPrivateKey=function(e,t,a){if(a=a||{},!a.legacy){var r=Q.wrapRsaPrivateKey(Q.privateKeyToAsn1(e));return r=Q.encryptPrivateKeyInfo(r,t,a),Q.encryptedPrivateKeyToPem(r)}var n,i,s,o;switch(a.algorithm){case"aes128":n="AES-128-CBC",s=16,i=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"aes192":n="AES-192-CBC",s=24,i=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"aes256":n="AES-256-CBC",s=32,i=V.random.getBytesSync(16),o=V.aes.createEncryptionCipher;break;case"3des":n="DES-EDE3-CBC",s=24,i=V.random.getBytesSync(8),o=V.des.createEncryptionCipher;break;case"des":n="DES-CBC",s=8,i=V.random.getBytesSync(8),o=V.des.createEncryptionCipher;break;default:var u=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+a.algorithm+'".');throw u.algorithm=a.algorithm,u}var c=V.pbe.opensslDeriveBytes(t,i.substr(0,8),s),l=o(c);l.start(i),l.update(I.toDer(Q.privateKeyToAsn1(e))),l.finish();var f={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:n,parameters:V.util.bytesToHex(i).toUpperCase()},body:l.output.getBytes()};return V.pem.encode(f)};Q.decryptRsaPrivateKey=function(e,t){var a=null,r=V.pem.decode(e)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var n=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw n.headerType=n,n}if(r.procType&&r.procType.type==="ENCRYPTED"){var i,s;switch(r.dekInfo.algorithm){case"DES-CBC":i=8,s=V.des.createDecryptionCipher;break;case"DES-EDE3-CBC":i=24,s=V.des.createDecryptionCipher;break;case"AES-128-CBC":i=16,s=V.aes.createDecryptionCipher;break;case"AES-192-CBC":i=24,s=V.aes.createDecryptionCipher;break;case"AES-256-CBC":i=32,s=V.aes.createDecryptionCipher;break;case"RC2-40-CBC":i=5,s=function(f){return V.rc2.createDecryptionCipher(f,40)};break;case"RC2-64-CBC":i=8,s=function(f){return V.rc2.createDecryptionCipher(f,64)};break;case"RC2-128-CBC":i=16,s=function(f){return V.rc2.createDecryptionCipher(f,128)};break;default:var n=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw n.algorithm=r.dekInfo.algorithm,n}var o=V.util.hexToBytes(r.dekInfo.parameters),u=V.pbe.opensslDeriveBytes(t,o.substr(0,8),i),c=s(u);if(c.start(o),c.update(V.util.createBuffer(r.body)),c.finish())a=c.output.getBytes();else return a}else a=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?a=Q.decryptPrivateKeyInfo(I.fromDer(a),t):a=I.fromDer(a),a!==null&&(a=Q.privateKeyFromAsn1(a)),a};Q.pbe.generatePkcs12Key=function(e,t,a,r,n,i){var s,o;if(typeof i>"u"||i===null){if(!("sha1"in V.md))throw new Error('"sha1" hash algorithm unavailable.');i=V.md.sha1.create()}var u=i.digestLength,c=i.blockLength,l=new V.util.ByteBuffer,f=new V.util.ByteBuffer;if(e!=null){for(o=0;o<e.length;o++)f.putInt16(e.charCodeAt(o));f.putInt16(0)}var p=f.length(),v=t.length(),y=new V.util.ByteBuffer;y.fillWithByte(a,c);var m=c*Math.ceil(v/c),x=new V.util.ByteBuffer;for(o=0;o<m;o++)x.putByte(t.at(o%v));var T=c*Math.ceil(p/c),B=new V.util.ByteBuffer;for(o=0;o<T;o++)B.putByte(f.at(o%p));var b=x;b.putBuffer(B);for(var P=Math.ceil(n/u),R=1;R<=P;R++){var L=new V.util.ByteBuffer;L.putBytes(y.bytes()),L.putBytes(b.bytes());for(var z=0;z<r;z++)i.start(),i.update(L.getBytes()),L=i.digest();var j=new V.util.ByteBuffer;for(o=0;o<c;o++)j.putByte(L.at(o%u));var oe=Math.ceil(v/c)+Math.ceil(p/c),ce=new V.util.ByteBuffer;for(s=0;s<oe;s++){var de=new V.util.ByteBuffer(b.getBytes(c)),ge=511;for(o=j.length()-1;o>=0;o--)ge=ge>>8,ge+=j.at(o)+de.at(o),de.setAt(o,ge&255);ce.putBuffer(de)}b=ce,l.putBuffer(L)}return l.truncate(l.length()-n),l};Q.pbe.getCipher=function(e,t,a){switch(e){case Q.oids.pkcs5PBES2:return Q.pbe.getCipherForPBES2(e,t,a);case Q.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case Q.oids["pbewithSHAAnd40BitRC2-CBC"]:return Q.pbe.getCipherForPKCS12PBE(e,t,a);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=e,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};Q.pbe.getCipherForPBES2=function(e,t,a){var r={},n=[];if(!I.validate(t,M0,r,n)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=n,i}if(e=I.derToOid(r.kdfOid),e!==Q.oids.pkcs5PBKDF2){var i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw i.oid=e,i.supportedOids=["pkcs5PBKDF2"],i}if(e=I.derToOid(r.encOid),e!==Q.oids["aes128-CBC"]&&e!==Q.oids["aes192-CBC"]&&e!==Q.oids["aes256-CBC"]&&e!==Q.oids["des-EDE3-CBC"]&&e!==Q.oids.desCBC){var i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw i.oid=e,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i}var s=r.kdfSalt,o=V.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var u,c;switch(Q.oids[e]){case"aes128-CBC":u=16,c=V.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,c=V.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,c=V.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,c=V.des.createDecryptionCipher;break;case"desCBC":u=8,c=V.des.createDecryptionCipher;break}var l=As(r.prfOid),f=V.pkcs5.pbkdf2(a,s,o,u,l),p=r.encIv,v=c(f);return v.start(p),v};Q.pbe.getCipherForPKCS12PBE=function(e,t,a){var r={},n=[];if(!I.validate(t,K0,r,n)){var i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw i.errors=n,i}var s=V.util.createBuffer(r.salt),o=V.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var u,c,l;switch(e){case Q.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,l=V.des.startDecrypting;break;case Q.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,l=function(m,x){var T=V.rc2.createDecryptionCipher(m,40);return T.start(x,null),T};break;default:var i=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw i.oid=e,i}var f=As(r.prfOid),p=Q.pbe.generatePkcs12Key(a,s,1,o,u,f);f.start();var v=Q.pbe.generatePkcs12Key(a,s,2,o,c,f);return l(p,v)};Q.pbe.opensslDeriveBytes=function(e,t,a,r){if(typeof r>"u"||r===null){if(!("md5"in V.md))throw new Error('"md5" hash algorithm unavailable.');r=V.md.md5.create()}t===null&&(t="");for(var n=[Ts(r,e+t)],i=16,s=1;i<a;++s,i+=16)n.push(Ts(r,n[s-1]+e+t));return n.join("").substr(0,a)};function Ts(e,t){return e.start().update(t).digest().getBytes()}function As(e){var t;if(!e)t="hmacWithSHA1";else if(t=Q.oids[I.derToOid(e)],!t){var a=new Error("Unsupported PRF OID.");throw a.oid=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}return Is(t)}function Is(e){var t=V.md;switch(e){case"hmacWithSHA224":t=V.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":e=e.substr(8).toLowerCase();break;default:var a=new Error("Unsupported PRF algorithm.");throw a.algorithm=e,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a}if(!t||!(e in t))throw new Error("Unknown hash algorithm: "+e);return t[e].create()}function q0(e,t,a,r){var n=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,e),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,t.getBytes())]);return r!=="hmacWithSHA1"&&n.value.push(I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,V.util.hexToBytes(a.toString(16))),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(Q.oids[r]).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")])),n}});var gn=F((og,_s)=>{var vr=$();gt();ne();var O=vr.asn1,mr=_s.exports=vr.pkcs7asn1=vr.pkcs7asn1||{};vr.pkcs7=vr.pkcs7||{};vr.pkcs7.asn1=mr;var bs={name:"ContentInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};mr.contentInfoValidator=bs;var ws={name:"EncryptedContentInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};mr.envelopedDataValidator={name:"EnvelopedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(ws)};mr.encryptedDataValidator={name:"EncryptedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"}].concat(ws)};var H0={name:"SignerInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};mr.signedDataValidator={name:"SignedData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},bs,{name:"SignedData.Certificates",tagClass:O.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:O.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,capture:"signerInfos",optional:!0,value:[H0]}]};mr.recipientInfoValidator={name:"RecipientInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:O.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var yn=F((ug,Ns)=>{var tr=$();ne();tr.mgf=tr.mgf||{};var G0=Ns.exports=tr.mgf.mgf1=tr.mgf1=tr.mgf1||{};G0.create=function(e){var t={generate:function(a,r){for(var n=new tr.util.ByteBuffer,i=Math.ceil(r/e.digestLength),s=0;s<i;s++){var o=new tr.util.ByteBuffer;o.putInt32(s),e.start(),e.update(a+o.getBytes()),n.putBuffer(e.digest())}return n.truncate(n.length()-r),n.getBytes()}};return t}});var Ls=F((cg,Rs)=>{var pa=$();yn();Rs.exports=pa.mgf=pa.mgf||{};pa.mgf.mgf1=pa.mgf1});var ga=F((lg,ks)=>{var rr=$();ot();ne();var z0=ks.exports=rr.pss=rr.pss||{};z0.create=function(e){arguments.length===3&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t=e.md,a=e.mgf,r=t.digestLength,n=e.salt||null;typeof n=="string"&&(n=rr.util.createBuffer(n));var i;if("saltLength"in e)i=e.saltLength;else if(n!==null)i=n.length();else throw new Error("Salt length not specified or specific salt not given.");if(n!==null&&n.length()!==i)throw new Error("Given salt length does not match length of given salt.");var s=e.prng||rr.random,o={};return o.encode=function(u,c){var l,f=c-1,p=Math.ceil(f/8),v=u.digest().getBytes();if(p<r+i+2)throw new Error("Message is too long to encrypt.");var y;n===null?y=s.getBytesSync(i):y=n.bytes();var m=new rr.util.ByteBuffer;m.fillWithByte(0,8),m.putBytes(v),m.putBytes(y),t.start(),t.update(m.getBytes());var x=t.digest().getBytes(),T=new rr.util.ByteBuffer;T.fillWithByte(0,p-i-r-2),T.putByte(1),T.putBytes(y);var B=T.getBytes(),b=p-r-1,P=a.generate(x,b),R="";for(l=0;l<b;l++)R+=String.fromCharCode(B.charCodeAt(l)^P.charCodeAt(l));var L=65280>>8*p-f&255;return R=String.fromCharCode(R.charCodeAt(0)&~L)+R.substr(1),R+x+"\xBC"},o.verify=function(u,c,l){var f,p=l-1,v=Math.ceil(p/8);if(c=c.substr(-v),v<r+i+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(c.charCodeAt(v-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var y=v-r-1,m=c.substr(0,y),x=c.substr(y,r),T=65280>>8*v-p&255;if((m.charCodeAt(0)&T)!==0)throw new Error("Bits beyond keysize not zero as expected.");var B=a.generate(x,y),b="";for(f=0;f<y;f++)b+=String.fromCharCode(m.charCodeAt(f)^B.charCodeAt(f));b=String.fromCharCode(b.charCodeAt(0)&~T)+b.substr(1);var P=v-r-i-2;for(f=0;f<P;f++)if(b.charCodeAt(f)!==0)throw new Error("Leftmost octets not zero as expected");if(b.charCodeAt(P)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var R=b.substr(-i),L=new rr.util.ByteBuffer;L.fillWithByte(0,8),L.putBytes(u),L.putBytes(R),t.start(),t.update(L.getBytes());var z=t.digest().getBytes();return x===z},o}});var ma=F((fg,Vs)=>{var q=$();Ot();gt();Lr();vt();Ls();Vt();Xt();ga();Ur();ne();var d=q.asn1,k=Vs.exports=q.pki=q.pki||{},ae=k.oids,Ce={};Ce.CN=ae.commonName;Ce.commonName="CN";Ce.C=ae.countryName;Ce.countryName="C";Ce.L=ae.localityName;Ce.localityName="L";Ce.ST=ae.stateOrProvinceName;Ce.stateOrProvinceName="ST";Ce.O=ae.organizationName;Ce.organizationName="O";Ce.OU=ae.organizationalUnitName;Ce.organizationalUnitName="OU";Ce.E=ae.emailAddress;Ce.emailAddress="E";var Us=q.pki.rsa.publicKeyValidator,Q0={name:"Certificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:d.Class.UNIVERSAL,type:d.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:d.Class.UNIVERSAL,type:d.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},Us,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},$0={name:"rsapss",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:d.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:d.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:d.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:d.Class.UNIVERSAL,type:d.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},j0={name:"CertificationRequestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},Us,{name:"CertificationRequestInfo.attributes",tagClass:d.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:d.Class.UNIVERSAL,type:d.Type.SET,constructed:!0}]}]}]},Y0={name:"CertificationRequest",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[j0,{name:"CertificationRequest.signatureAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};k.RDNAttributesAsArray=function(e,t){for(var a=[],r,n,i,s=0;s<e.value.length;++s){r=e.value[s];for(var o=0;o<r.value.length;++o)i={},n=r.value[o],i.type=d.derToOid(n.value[0].value),i.value=n.value[1].value,i.valueTagClass=n.value[1].type,i.type in ae&&(i.name=ae[i.type],i.name in Ce&&(i.shortName=Ce[i.name])),t&&(t.update(i.type),t.update(i.value)),a.push(i)}return a};k.CRIAttributesAsArray=function(e){for(var t=[],a=0;a<e.length;++a)for(var r=e[a],n=d.derToOid(r.value[0].value),i=r.value[1].value,s=0;s<i.length;++s){var o={};if(o.type=n,o.value=i[s].value,o.valueTagClass=i[s].type,o.type in ae&&(o.name=ae[o.type],o.name in Ce&&(o.shortName=Ce[o.name])),o.type===ae.extensionRequest){o.extensions=[];for(var u=0;u<o.value.length;++u)o.extensions.push(k.certificateExtensionFromAsn1(o.value[u]))}t.push(o)}return t};function Kt(e,t){typeof t=="string"&&(t={shortName:t});for(var a=null,r,n=0;a===null&&n<e.attributes.length;++n)r=e.attributes[n],(t.type&&t.type===r.type||t.name&&t.name===r.name||t.shortName&&t.shortName===r.shortName)&&(a=r);return a}var ya=function(e,t,a){var r={};if(e!==ae["RSASSA-PSS"])return r;a&&(r={hash:{algorithmOid:ae.sha1},mgf:{algorithmOid:ae.mgf1,hash:{algorithmOid:ae.sha1}},saltLength:20});var n={},i=[];if(!d.validate(t,$0,n,i)){var s=new Error("Cannot read RSASSA-PSS parameter block.");throw s.errors=i,s}return n.hashOid!==void 0&&(r.hash=r.hash||{},r.hash.algorithmOid=d.derToOid(n.hashOid)),n.maskGenOid!==void 0&&(r.mgf=r.mgf||{},r.mgf.algorithmOid=d.derToOid(n.maskGenOid),r.mgf.hash=r.mgf.hash||{},r.mgf.hash.algorithmOid=d.derToOid(n.maskGenHashOid)),n.saltLength!==void 0&&(r.saltLength=n.saltLength.charCodeAt(0)),r},va=function(e){switch(ae[e.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return q.md.sha1.create();case"md5WithRSAEncryption":return q.md.md5.create();case"sha256WithRSAEncryption":return q.md.sha256.create();case"sha384WithRSAEncryption":return q.md.sha384.create();case"sha512WithRSAEncryption":return q.md.sha512.create();case"RSASSA-PSS":return q.md.sha256.create();default:var t=new Error("Could not compute "+e.type+" digest. Unknown signature OID.");throw t.signatureOid=e.signatureOid,t}},Ps=function(e){var t=e.certificate,a;switch(t.signatureOid){case ae.sha1WithRSAEncryption:case ae.sha1WithRSASignature:break;case ae["RSASSA-PSS"]:var r,n;if(r=ae[t.signatureParameters.mgf.hash.algorithmOid],r===void 0||q.md[r]===void 0){var i=new Error("Unsupported MGF hash function.");throw i.oid=t.signatureParameters.mgf.hash.algorithmOid,i.name=r,i}if(n=ae[t.signatureParameters.mgf.algorithmOid],n===void 0||q.mgf[n]===void 0){var i=new Error("Unsupported MGF function.");throw i.oid=t.signatureParameters.mgf.algorithmOid,i.name=n,i}if(n=q.mgf[n].create(q.md[r].create()),r=ae[t.signatureParameters.hash.algorithmOid],r===void 0||q.md[r]===void 0){var i=new Error("Unsupported RSASSA-PSS hash function.");throw i.oid=t.signatureParameters.hash.algorithmOid,i.name=r,i}a=q.pss.create(q.md[r].create(),n,t.signatureParameters.saltLength);break}return t.publicKey.verify(e.md.digest().getBytes(),e.signature,a)};k.certificateFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE"&&r.type!=="X509 CERTIFICATE"&&r.type!=="TRUSTED CERTIFICATE"){var n=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var i=d.fromDer(r.body,a);return k.certificateFromAsn1(i,t)};k.certificateToPem=function(e,t){var a={type:"CERTIFICATE",body:d.toDer(k.certificateToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyFromPem=function(e){var t=q.pem.decode(e)[0];if(t.type!=="PUBLIC KEY"&&t.type!=="RSA PUBLIC KEY"){var a=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var r=d.fromDer(t.body);return k.publicKeyFromAsn1(r)};k.publicKeyToPem=function(e,t){var a={type:"PUBLIC KEY",body:d.toDer(k.publicKeyToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.publicKeyToRSAPublicKeyPem=function(e,t){var a={type:"RSA PUBLIC KEY",body:d.toDer(k.publicKeyToRSAPublicKey(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||q.md.sha1.create(),r=t.type||"RSAPublicKey",n;switch(r){case"RSAPublicKey":n=d.toDer(k.publicKeyToRSAPublicKey(e)).getBytes();break;case"SubjectPublicKeyInfo":n=d.toDer(k.publicKeyToAsn1(e)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+t.type+'".')}a.start(),a.update(n);var i=a.digest();if(t.encoding==="hex"){var s=i.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}else{if(t.encoding==="binary")return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return i};k.certificationRequestFromPem=function(e,t,a){var r=q.pem.decode(e)[0];if(r.type!=="CERTIFICATE REQUEST"){var n=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw n.headerType=r.type,n}if(r.procType&&r.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var i=d.fromDer(r.body,a);return k.certificationRequestFromAsn1(i,t)};k.certificationRequestToPem=function(e,t){var a={type:"CERTIFICATE REQUEST",body:d.toDer(k.certificationRequestToAsn1(e)).getBytes()};return q.pem.encode(a,{maxline:t})};k.createCertificate=function(){var e={};return e.version=2,e.serialNumber="00",e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.validity={},e.validity.notBefore=new Date,e.validity.notAfter=new Date,e.issuer={},e.issuer.getField=function(t){return Kt(e.issuer,t)},e.issuer.addField=function(t){lt([t]),e.issuer.attributes.push(t)},e.issuer.attributes=[],e.issuer.hash=null,e.subject={},e.subject.getField=function(t){return Kt(e.subject,t)},e.subject.addField=function(t){lt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.extensions=[],e.publicKey=null,e.md=null,e.setSubject=function(t,a){lt(t),e.subject.attributes=t,delete e.subject.uniqueId,a&&(e.subject.uniqueId=a),e.subject.hash=null},e.setIssuer=function(t,a){lt(t),e.issuer.attributes=t,delete e.issuer.uniqueId,a&&(e.issuer.uniqueId=a),e.issuer.hash=null},e.setExtensions=function(t){for(var a=0;a<t.length;++a)Os(t[a],{cert:e});e.extensions=t},e.getExtension=function(t){typeof t=="string"&&(t={name:t});for(var a=null,r,n=0;a===null&&n<e.extensions.length;++n)r=e.extensions[n],(t.id&&r.id===t.id||t.name&&r.name===t.name)&&(a=r);return a},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.tbsCertificate=k.getTBSCertificate(e);var i=d.toDer(e.tbsCertificate);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(t){var a=!1;if(!e.issued(t)){var r=t.issuer,n=e.subject,i=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw i.expectedIssuer=n.attributes,i.actualIssuer=r.attributes,i}var s=t.md;if(s===null){s=va({signatureOid:t.signatureOid,type:"certificate"});var o=t.tbsCertificate||k.getTBSCertificate(t),u=d.toDer(o);s.update(u.getBytes())}return s!==null&&(a=Ps({certificate:e,md:s,signature:t.signature})),a},e.isIssuer=function(t){var a=!1,r=e.issuer,n=t.subject;if(r.hash&&n.hash)a=r.hash===n.hash;else if(r.attributes.length===n.attributes.length){a=!0;for(var i,s,o=0;a&&o<r.attributes.length;++o)i=r.attributes[o],s=n.attributes[o],(i.type!==s.type||i.value!==s.value)&&(a=!1)}return a},e.issued=function(t){return t.isIssuer(e)},e.generateSubjectKeyIdentifier=function(){return k.getPublicKeyFingerprint(e.publicKey,{type:"RSAPublicKey"})},e.verifySubjectKeyIdentifier=function(){for(var t=ae.subjectKeyIdentifier,a=0;a<e.extensions.length;++a){var r=e.extensions[a];if(r.id===t){var n=e.generateSubjectKeyIdentifier().getBytes();return q.util.hexToBytes(r.subjectKeyIdentifier)===n}}return!1},e};k.certificateFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,Q0,a,r)){var n=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw n.errors=r,n}var i=d.derToOid(a.publicKeyOid);if(i!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=k.createCertificate();s.version=a.certVersion?a.certVersion.charCodeAt(0):0;var o=q.util.createBuffer(a.certSerialNumber);s.serialNumber=o.toHex(),s.signatureOid=q.asn1.derToOid(a.certSignatureOid),s.signatureParameters=ya(s.signatureOid,a.certSignatureParams,!0),s.siginfo.algorithmOid=q.asn1.derToOid(a.certinfoSignatureOid),s.siginfo.parameters=ya(s.siginfo.algorithmOid,a.certinfoSignatureParams,!1),s.signature=a.certSignature;var u=[];if(a.certValidity1UTCTime!==void 0&&u.push(d.utcTimeToDate(a.certValidity1UTCTime)),a.certValidity2GeneralizedTime!==void 0&&u.push(d.generalizedTimeToDate(a.certValidity2GeneralizedTime)),a.certValidity3UTCTime!==void 0&&u.push(d.utcTimeToDate(a.certValidity3UTCTime)),a.certValidity4GeneralizedTime!==void 0&&u.push(d.generalizedTimeToDate(a.certValidity4GeneralizedTime)),u.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(u.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(s.validity.notBefore=u[0],s.validity.notAfter=u[1],s.tbsCertificate=a.tbsCertificate,t){s.md=va({signatureOid:s.signatureOid,type:"certificate"});var c=d.toDer(s.tbsCertificate);s.md.update(c.getBytes())}var l=q.md.sha1.create(),f=d.toDer(a.certIssuer);l.update(f.getBytes()),s.issuer.getField=function(y){return Kt(s.issuer,y)},s.issuer.addField=function(y){lt([y]),s.issuer.attributes.push(y)},s.issuer.attributes=k.RDNAttributesAsArray(a.certIssuer),a.certIssuerUniqueId&&(s.issuer.uniqueId=a.certIssuerUniqueId),s.issuer.hash=l.digest().toHex();var p=q.md.sha1.create(),v=d.toDer(a.certSubject);return p.update(v.getBytes()),s.subject.getField=function(y){return Kt(s.subject,y)},s.subject.addField=function(y){lt([y]),s.subject.attributes.push(y)},s.subject.attributes=k.RDNAttributesAsArray(a.certSubject),a.certSubjectUniqueId&&(s.subject.uniqueId=a.certSubjectUniqueId),s.subject.hash=p.digest().toHex(),a.certExtensions?s.extensions=k.certificateExtensionsFromAsn1(a.certExtensions):s.extensions=[],s.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),s};k.certificateExtensionsFromAsn1=function(e){for(var t=[],a=0;a<e.value.length;++a)for(var r=e.value[a],n=0;n<r.value.length;++n)t.push(k.certificateExtensionFromAsn1(r.value[n]));return t};k.certificateExtensionFromAsn1=function(e){var t={};if(t.id=d.derToOid(e.value[0].value),t.critical=!1,e.value[1].type===d.Type.BOOLEAN?(t.critical=e.value[1].value.charCodeAt(0)!==0,t.value=e.value[2].value):t.value=e.value[1].value,t.id in ae){if(t.name=ae[t.id],t.name==="keyUsage"){var a=d.fromDer(t.value),r=0,n=0;a.value.length>1&&(r=a.value.charCodeAt(1),n=a.value.length>2?a.value.charCodeAt(2):0),t.digitalSignature=(r&128)===128,t.nonRepudiation=(r&64)===64,t.keyEncipherment=(r&32)===32,t.dataEncipherment=(r&16)===16,t.keyAgreement=(r&8)===8,t.keyCertSign=(r&4)===4,t.cRLSign=(r&2)===2,t.encipherOnly=(r&1)===1,t.decipherOnly=(n&128)===128}else if(t.name==="basicConstraints"){var a=d.fromDer(t.value);a.value.length>0&&a.value[0].type===d.Type.BOOLEAN?t.cA=a.value[0].value.charCodeAt(0)!==0:t.cA=!1;var i=null;a.value.length>0&&a.value[0].type===d.Type.INTEGER?i=a.value[0].value:a.value.length>1&&(i=a.value[1].value),i!==null&&(t.pathLenConstraint=d.derToInteger(i))}else if(t.name==="extKeyUsage")for(var a=d.fromDer(t.value),s=0;s<a.value.length;++s){var o=d.derToOid(a.value[s].value);o in ae?t[ae[o]]=!0:t[o]=!0}else if(t.name==="nsCertType"){var a=d.fromDer(t.value),r=0;a.value.length>1&&(r=a.value.charCodeAt(1)),t.client=(r&128)===128,t.server=(r&64)===64,t.email=(r&32)===32,t.objsign=(r&16)===16,t.reserved=(r&8)===8,t.sslCA=(r&4)===4,t.emailCA=(r&2)===2,t.objCA=(r&1)===1}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.altNames=[];for(var u,a=d.fromDer(t.value),c=0;c<a.value.length;++c){u=a.value[c];var l={type:u.type,value:u.value};switch(t.altNames.push(l),u.type){case 1:case 2:case 6:break;case 7:l.ip=q.util.bytesToIP(u.value);break;case 8:l.oid=d.derToOid(u.value);break;default:}}}else if(t.name==="subjectKeyIdentifier"){var a=d.fromDer(t.value);t.subjectKeyIdentifier=q.util.bytesToHex(a.value)}}return t};k.certificationRequestFromAsn1=function(e,t){var a={},r=[];if(!d.validate(e,Y0,a,r)){var n=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw n.errors=r,n}var i=d.derToOid(a.publicKeyOid);if(i!==k.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var s=k.createCertificationRequest();if(s.version=a.csrVersion?a.csrVersion.charCodeAt(0):0,s.signatureOid=q.asn1.derToOid(a.csrSignatureOid),s.signatureParameters=ya(s.signatureOid,a.csrSignatureParams,!0),s.siginfo.algorithmOid=q.asn1.derToOid(a.csrSignatureOid),s.siginfo.parameters=ya(s.siginfo.algorithmOid,a.csrSignatureParams,!1),s.signature=a.csrSignature,s.certificationRequestInfo=a.certificationRequestInfo,t){s.md=va({signatureOid:s.signatureOid,type:"certification request"});var o=d.toDer(s.certificationRequestInfo);s.md.update(o.getBytes())}var u=q.md.sha1.create();return s.subject.getField=function(c){return Kt(s.subject,c)},s.subject.addField=function(c){lt([c]),s.subject.attributes.push(c)},s.subject.attributes=k.RDNAttributesAsArray(a.certificationRequestInfoSubject,u),s.subject.hash=u.digest().toHex(),s.publicKey=k.publicKeyFromAsn1(a.subjectPublicKeyInfo),s.getAttribute=function(c){return Kt(s,c)},s.addAttribute=function(c){lt([c]),s.attributes.push(c)},s.attributes=k.CRIAttributesAsArray(a.certificationRequestInfoAttributes||[]),s};k.createCertificationRequest=function(){var e={};return e.version=0,e.signatureOid=null,e.signature=null,e.siginfo={},e.siginfo.algorithmOid=null,e.subject={},e.subject.getField=function(t){return Kt(e.subject,t)},e.subject.addField=function(t){lt([t]),e.subject.attributes.push(t)},e.subject.attributes=[],e.subject.hash=null,e.publicKey=null,e.attributes=[],e.getAttribute=function(t){return Kt(e,t)},e.addAttribute=function(t){lt([t]),e.attributes.push(t)},e.md=null,e.setSubject=function(t){lt(t),e.subject.attributes=t,e.subject.hash=null},e.setAttributes=function(t){lt(t),e.attributes=t},e.sign=function(t,a){e.md=a||q.md.sha1.create();var r=ae[e.md.algorithm+"WithRSAEncryption"];if(!r){var n=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw n.algorithm=e.md.algorithm,n}e.signatureOid=e.siginfo.algorithmOid=r,e.certificationRequestInfo=k.getCertificationRequestInfo(e);var i=d.toDer(e.certificationRequestInfo);e.md.update(i.getBytes()),e.signature=t.sign(e.md)},e.verify=function(){var t=!1,a=e.md;if(a===null){a=va({signatureOid:e.signatureOid,type:"certification request"});var r=e.certificationRequestInfo||k.getCertificationRequestInfo(e),n=d.toDer(r);a.update(n.getBytes())}return a!==null&&(t=Ps({certificate:e,md:a,signature:e.signature})),t},e};function Cr(e){for(var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),a,r,n=e.attributes,i=0;i<n.length;++i){a=n[i];var s=a.value,o=d.Type.PRINTABLESTRING;"valueTagClass"in a&&(o=a.valueTagClass,o===d.Type.UTF8&&(s=q.util.encodeUtf8(s))),r=d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(a.type).getBytes()),d.create(d.Class.UNIVERSAL,o,!1,s)])]),t.value.push(r)}return t}function lt(e){for(var t,a=0;a<e.length;++a){if(t=e[a],typeof t.name>"u"&&(t.type&&t.type in k.oids?t.name=k.oids[t.type]:t.shortName&&t.shortName in Ce&&(t.name=k.oids[Ce[t.shortName]])),typeof t.type>"u")if(t.name&&t.name in k.oids)t.type=k.oids[t.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=t,r}if(typeof t.shortName>"u"&&t.name&&t.name in Ce&&(t.shortName=Ce[t.name]),t.type===ae.extensionRequest&&(t.valueConstructed=!0,t.valueTagClass=d.Type.SEQUENCE,!t.value&&t.extensions)){t.value=[];for(var n=0;n<t.extensions.length;++n)t.value.push(k.certificateExtensionToAsn1(Os(t.extensions[n])))}if(typeof t.value>"u"){var r=new Error("Attribute value not specified.");throw r.attribute=t,r}}}function Os(e,t){if(t=t||{},typeof e.name>"u"&&e.id&&e.id in k.oids&&(e.name=k.oids[e.id]),typeof e.id>"u")if(e.name&&e.name in k.oids)e.id=k.oids[e.name];else{var a=new Error("Extension ID not specified.");throw a.extension=e,a}if(typeof e.value<"u")return e;if(e.name==="keyUsage"){var r=0,n=0,i=0;e.digitalSignature&&(n|=128,r=7),e.nonRepudiation&&(n|=64,r=6),e.keyEncipherment&&(n|=32,r=5),e.dataEncipherment&&(n|=16,r=4),e.keyAgreement&&(n|=8,r=3),e.keyCertSign&&(n|=4,r=2),e.cRLSign&&(n|=2,r=1),e.encipherOnly&&(n|=1,r=0),e.decipherOnly&&(i|=128,r=7);var s=String.fromCharCode(r);i!==0?s+=String.fromCharCode(n)+String.fromCharCode(i):n!==0&&(s+=String.fromCharCode(n)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,s)}else if(e.name==="basicConstraints")e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),e.cA&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in e&&e.value.value.push(d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.pathLenConstraint).getBytes()));else if(e.name==="extKeyUsage"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;for(var u in e)e[u]===!0&&(u in ae?o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(ae[u]).getBytes())):u.indexOf(".")!==-1&&o.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(u).getBytes())))}else if(e.name==="nsCertType"){var r=0,n=0;e.client&&(n|=128,r=7),e.server&&(n|=64,r=6),e.email&&(n|=32,r=5),e.objsign&&(n|=16,r=4),e.reserved&&(n|=8,r=3),e.sslCA&&(n|=4,r=2),e.emailCA&&(n|=2,r=1),e.objCA&&(n|=1,r=0);var s=String.fromCharCode(r);n!==0&&(s+=String.fromCharCode(n)),e.value=d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,s)}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var s=c.value;if(c.type===7&&c.ip){if(s=q.util.bytesFromIP(c.ip),s===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else c.type===8&&(c.oid?s=d.oidToDer(d.oidToDer(c.oid)):s=d.oidToDer(s));e.value.value.push(d.create(d.Class.CONTEXT_SPECIFIC,c.type,!1,s))}}else if(e.name==="nsComment"&&t.cert){if(!/^[\x00-\x7F]*$/.test(e.comment)||e.comment.length<1||e.comment.length>128)throw new Error('Invalid "nsComment" content.');e.value=d.create(d.Class.UNIVERSAL,d.Type.IA5STRING,!1,e.comment)}else if(e.name==="subjectKeyIdentifier"&&t.cert){var f=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=f.toHex(),e.value=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,f.getBytes())}else if(e.name==="authorityKeyIdentifier"&&t.cert){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);var o=e.value.value;if(e.keyIdentifier){var p=e.keyIdentifier===!0?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;o.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!1,p))}if(e.authorityCertIssuer){var v=[d.create(d.Class.CONTEXT_SPECIFIC,4,!0,[Cr(e.authorityCertIssuer===!0?t.cert.issuer:e.authorityCertIssuer)])];o.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,v))}if(e.serialNumber){var y=q.util.hexToBytes(e.serialNumber===!0?t.cert.serialNumber:e.serialNumber);o.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if(e.name==="cRLDistributionPoints"){e.value=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);for(var o=e.value.value,m=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),x=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]),c,l=0;l<e.altNames.length;++l){c=e.altNames[l];var s=c.value;if(c.type===7&&c.ip){if(s=q.util.bytesFromIP(c.ip),s===null){var a=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw a.extension=e,a}}else c.type===8&&(c.oid?s=d.oidToDer(d.oidToDer(c.oid)):s=d.oidToDer(s));x.value.push(d.create(d.Class.CONTEXT_SPECIFIC,c.type,!1,s))}m.value.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[x])),o.push(m)}if(typeof e.value>"u"){var a=new Error("Extension value not specified.");throw a.extension=e,a}return e}function vn(e,t){switch(e){case ae["RSASSA-PSS"]:var a=[];return t.hash.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])),t.mgf.algorithmOid!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(t.mgf.hash.algorithmOid).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")])])])),t.saltLength!==void 0&&a.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(t.saltLength).getBytes())])),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,a);default:return d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")}}function W0(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[]);if(e.attributes.length===0)return t;for(var a=e.attributes,r=0;r<a.length;++r){var n=a[r],i=n.value,s=d.Type.UTF8;"valueTagClass"in n&&(s=n.valueTagClass),s===d.Type.UTF8&&(i=q.util.encodeUtf8(i));var o=!1;"valueConstructed"in n&&(o=n.valueConstructed);var u=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(n.type).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SET,!0,[d.create(d.Class.UNIVERSAL,s,o,i)])]);t.value.push(u)}return t}var X0=new Date("1950-01-01T00:00:00Z"),J0=new Date("2050-01-01T00:00:00Z");function Ds(e){return e>=X0&&e<J0?d.create(d.Class.UNIVERSAL,d.Type.UTCTIME,!1,d.dateToUtcTime(e)):d.create(d.Class.UNIVERSAL,d.Type.GENERALIZEDTIME,!1,d.dateToGeneralizedTime(e))}k.getTBSCertificate=function(e){var t=Ds(e.validity.notBefore),a=Ds(e.validity.notAfter),r=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.CONTEXT_SPECIFIC,0,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes())]),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,q.util.hexToBytes(e.serialNumber)),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.siginfo.algorithmOid).getBytes()),vn(e.siginfo.algorithmOid,e.siginfo.parameters)]),Cr(e.issuer),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,a]),Cr(e.subject),k.publicKeyToAsn1(e.publicKey)]);return e.issuer.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,1,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.issuer.uniqueId)])),e.subject.uniqueId&&r.value.push(d.create(d.Class.CONTEXT_SPECIFIC,2,!0,[d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.subject.uniqueId)])),e.extensions.length>0&&r.value.push(k.certificateExtensionsToAsn1(e.extensions)),r};k.getCertificationRequestInfo=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(e.version).getBytes()),Cr(e.subject),k.publicKeyToAsn1(e.publicKey),W0(e)]);return t};k.distinguishedNameToAsn1=function(e){return Cr(e)};k.certificateToAsn1=function(e){var t=e.tbsCertificate||k.getTBSCertificate(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),vn(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};k.certificateExtensionsToAsn1=function(e){var t=d.create(d.Class.CONTEXT_SPECIFIC,3,!0,[]),a=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(a);for(var r=0;r<e.length;++r)a.value.push(k.certificateExtensionToAsn1(e[r]));return t};k.certificateExtensionToAsn1=function(e){var t=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.id).getBytes())),e.critical&&t.value.push(d.create(d.Class.UNIVERSAL,d.Type.BOOLEAN,!1,"\xFF"));var a=e.value;return typeof e.value!="string"&&(a=d.toDer(a).getBytes()),t.value.push(d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,a)),t};k.certificationRequestToAsn1=function(e){var t=e.certificationRequestInfo||k.getCertificationRequestInfo(e);return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[t,d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(e.signatureOid).getBytes()),vn(e.signatureOid,e.signatureParameters)]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,"\0"+e.signature)])};k.createCaStore=function(e){var t={certs:{}};t.getIssuer=function(s){var o=a(s.issuer);return o},t.addCertificate=function(s){if(typeof s=="string"&&(s=q.pki.certificateFromPem(s)),r(s.subject),!t.hasCertificate(s))if(s.subject.hash in t.certs){var o=t.certs[s.subject.hash];q.util.isArray(o)||(o=[o]),o.push(s),t.certs[s.subject.hash]=o}else t.certs[s.subject.hash]=s},t.hasCertificate=function(s){typeof s=="string"&&(s=q.pki.certificateFromPem(s));var o=a(s.subject);if(!o)return!1;q.util.isArray(o)||(o=[o]);for(var u=d.toDer(k.certificateToAsn1(s)).getBytes(),c=0;c<o.length;++c){var l=d.toDer(k.certificateToAsn1(o[c])).getBytes();if(u===l)return!0}return!1},t.listAllCertificates=function(){var s=[];for(var o in t.certs)if(t.certs.hasOwnProperty(o)){var u=t.certs[o];if(!q.util.isArray(u))s.push(u);else for(var c=0;c<u.length;++c)s.push(u[c])}return s},t.removeCertificate=function(s){var o;if(typeof s=="string"&&(s=q.pki.certificateFromPem(s)),r(s.subject),!t.hasCertificate(s))return null;var u=a(s.subject);if(!q.util.isArray(u))return o=t.certs[s.subject.hash],delete t.certs[s.subject.hash],o;for(var c=d.toDer(k.certificateToAsn1(s)).getBytes(),l=0;l<u.length;++l){var f=d.toDer(k.certificateToAsn1(u[l])).getBytes();c===f&&(o=u[l],u.splice(l,1))}return u.length===0&&delete t.certs[s.subject.hash],o};function a(s){return r(s),t.certs[s.hash]||null}function r(s){if(!s.hash){var o=q.md.sha1.create();s.attributes=k.RDNAttributesAsArray(Cr(s),o),s.hash=o.digest().toHex()}}if(e)for(var n=0;n<e.length;++n){var i=e[n];t.addCertificate(i)}return t};k.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};k.verifyCertificateChain=function(e,t,a){typeof a=="function"&&(a={verify:a}),a=a||{},t=t.slice(0);var r=t.slice(0),n=a.validityCheckDate;typeof n>"u"&&(n=new Date);var i=!0,s=null,o=0;do{var u=t.shift(),c=null,l=!1;if(n&&(n<u.validity.notBefore||n>u.validity.notAfter)&&(s={message:"Certificate is not valid yet or has expired.",error:k.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:n}),s===null){if(c=t[0]||e.getIssuer(u),c===null&&u.isIssuer(u)&&(l=!0,c=u),c){var f=c;q.util.isArray(f)||(f=[f]);for(var p=!1;!p&&f.length>0;){c=f.shift();try{p=c.verify(u)}catch{}}p||(s={message:"Certificate signature is invalid.",error:k.certificateError.bad_certificate})}s===null&&(!c||l)&&!e.hasCertificate(u)&&(s={message:"Certificate is not trusted.",error:k.certificateError.unknown_ca})}if(s===null&&c&&!u.isIssuer(c)&&(s={message:"Certificate issuer is invalid.",error:k.certificateError.bad_certificate}),s===null)for(var v={keyUsage:!0,basicConstraints:!0},y=0;s===null&&y<u.extensions.length;++y){var m=u.extensions[y];m.critical&&!(m.name in v)&&(s={message:"Certificate has an unsupported critical extension.",error:k.certificateError.unsupported_certificate})}if(s===null&&(!i||t.length===0&&(!c||l))){var x=u.getExtension("basicConstraints"),T=u.getExtension("keyUsage");if(T!==null&&(!T.keyCertSign||x===null)&&(s={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:k.certificateError.bad_certificate}),s===null&&x===null&&(s={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:k.certificateError.bad_certificate}),s===null&&x!==null&&!x.cA&&(s={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:k.certificateError.bad_certificate}),s===null&&T!==null&&"pathLenConstraint"in x){var B=o-1;B>x.pathLenConstraint&&(s={message:"Certificate basicConstraints pathLenConstraint violated.",error:k.certificateError.bad_certificate})}}var b=s===null?!0:s.error,P=a.verify?a.verify(b,o,r):b;if(P===!0)s=null;else throw b===!0&&(s={message:"The application rejected the certificate.",error:k.certificateError.bad_certificate}),(P||P===0)&&(typeof P=="object"&&!q.util.isArray(P)?(P.message&&(s.message=P.message),P.error&&(s.error=P.error)):typeof P=="string"&&(s.error=P)),s;i=!1,++o}while(t.length>0);return!0}});var Cn=F((dg,Ms)=>{var pe=$();gt();dr();Vt();gn();pn();ot();Ur();yr();ne();ma();var C=pe.asn1,X=pe.pki,Or=Ms.exports=pe.pkcs12=pe.pkcs12||{},Fs={name:"ContentInfo",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},Z0={name:"PFX",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:C.Class.UNIVERSAL,type:C.Type.INTEGER,constructed:!1,capture:"version"},Fs,{name:"PFX.macData",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:C.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:C.Class.UNIVERSAL,type:C.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:C.Class.UNIVERSAL,type:C.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:C.Class.UNIVERSAL,type:C.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},ef={name:"SafeBag",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:C.Class.UNIVERSAL,type:C.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},tf={name:"Attribute",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:C.Class.UNIVERSAL,type:C.Type.SET,constructed:!0,capture:"values"}]},rf={name:"CertBag",tagClass:C.Class.UNIVERSAL,type:C.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:C.Class.UNIVERSAL,type:C.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:C.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:C.Class.UNIVERSAL,type:C.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Pr(e,t,a,r){for(var n=[],i=0;i<e.length;i++)for(var s=0;s<e[i].safeBags.length;s++){var o=e[i].safeBags[s];if(!(r!==void 0&&o.type!==r)){if(t===null){n.push(o);continue}o.attributes[t]!==void 0&&o.attributes[t].indexOf(a)>=0&&n.push(o)}}return n}Or.pkcs12FromAsn1=function(e,t,a){typeof t=="string"?(a=t,t=!0):t===void 0&&(t=!0);var r={},n=[];if(!C.validate(e,Z0,r,n)){var i=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw i.errors=i,i}var s={version:r.version.charCodeAt(0),safeContents:[],getBags:function(x){var T={},B;return"localKeyId"in x?B=x.localKeyId:"localKeyIdHex"in x&&(B=pe.util.hexToBytes(x.localKeyIdHex)),B===void 0&&!("friendlyName"in x)&&"bagType"in x&&(T[x.bagType]=Pr(s.safeContents,null,null,x.bagType)),B!==void 0&&(T.localKeyId=Pr(s.safeContents,"localKeyId",B,x.bagType)),"friendlyName"in x&&(T.friendlyName=Pr(s.safeContents,"friendlyName",x.friendlyName,x.bagType)),T},getBagsByFriendlyName:function(x,T){return Pr(s.safeContents,"friendlyName",x,T)},getBagsByLocalKeyId:function(x,T){return Pr(s.safeContents,"localKeyId",x,T)}};if(r.version.charCodeAt(0)!==3){var i=new Error("PKCS#12 PFX of version other than 3 not supported.");throw i.version=r.version.charCodeAt(0),i}if(C.derToOid(r.contentType)!==X.oids.data){var i=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw i.oid=C.derToOid(r.contentType),i}var o=r.content.value[0];if(o.tagClass!==C.Class.UNIVERSAL||o.type!==C.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=mn(o),r.mac){var u=null,c=0,l=C.derToOid(r.macAlgorithm);switch(l){case X.oids.sha1:u=pe.md.sha1.create(),c=20;break;case X.oids.sha256:u=pe.md.sha256.create(),c=32;break;case X.oids.sha384:u=pe.md.sha384.create(),c=48;break;case X.oids.sha512:u=pe.md.sha512.create(),c=64;break;case X.oids.md5:u=pe.md.md5.create(),c=16;break}if(u===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+l);var f=new pe.util.ByteBuffer(r.macSalt),p="macIterations"in r?parseInt(pe.util.bytesToHex(r.macIterations),16):1,v=Or.generateKey(a,f,3,p,c,u),y=pe.hmac.create();y.start(u,v),y.update(o.value);var m=y.getMac();if(m.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(e.value)&&e.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return af(s,o.value,t,a),s};function mn(e){if(e.composed||e.constructed){for(var t=pe.util.createBuffer(),a=0;a<e.value.length;++a)t.putBytes(e.value[a].value);e.composed=e.constructed=!1,e.value=t.getBytes()}return e}function af(e,t,a,r){if(t=C.fromDer(t,a),t.tagClass!==C.Class.UNIVERSAL||t.type!==C.Type.SEQUENCE||t.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var n=0;n<t.value.length;n++){var i=t.value[n],s={},o=[];if(!C.validate(i,Fs,s,o)){var u=new Error("Cannot read ContentInfo.");throw u.errors=o,u}var c={encrypted:!1},l=null,f=s.content.value[0];switch(C.derToOid(s.contentType)){case X.oids.data:if(f.tagClass!==C.Class.UNIVERSAL||f.type!==C.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");l=mn(f).value;break;case X.oids.encryptedData:l=nf(f,r),c.encrypted=!0;break;default:var u=new Error("Unsupported PKCS#12 contentType.");throw u.contentType=C.derToOid(s.contentType),u}c.safeBags=sf(l,a,r),e.safeContents.push(c)}}function nf(e,t){var a={},r=[];if(!C.validate(e,pe.pkcs7.asn1.encryptedDataValidator,a,r)){var n=new Error("Cannot read EncryptedContentInfo.");throw n.errors=r,n}var i=C.derToOid(a.contentType);if(i!==X.oids.data){var n=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw n.oid=i,n}i=C.derToOid(a.encAlgorithm);var s=X.pbe.getCipher(i,a.encParameter,t),o=mn(a.encryptedContentAsn1),u=pe.util.createBuffer(o.value);if(s.update(u),!s.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return s.output.getBytes()}function sf(e,t,a){if(!t&&e.length===0)return[];if(e=C.fromDer(e,t),e.tagClass!==C.Class.UNIVERSAL||e.type!==C.Type.SEQUENCE||e.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var r=[],n=0;n<e.value.length;n++){var i=e.value[n],s={},o=[];if(!C.validate(i,ef,s,o)){var u=new Error("Cannot read SafeBag.");throw u.errors=o,u}var c={type:C.derToOid(s.bagId),attributes:of(s.bagAttributes)};r.push(c);var l,f,p=s.bagValue.value[0];switch(c.type){case X.oids.pkcs8ShroudedKeyBag:if(p=X.decryptPrivateKeyInfo(p,a),p===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case X.oids.keyBag:try{c.key=X.privateKeyFromAsn1(p)}catch{c.key=null,c.asn1=p}continue;case X.oids.certBag:l=rf,f=function(){if(C.derToOid(s.certId)!==X.oids.x509Certificate){var y=new Error("Unsupported certificate type, only X.509 supported.");throw y.oid=C.derToOid(s.certId),y}var m=C.fromDer(s.cert,t);try{c.cert=X.certificateFromAsn1(m,!0)}catch{c.cert=null,c.asn1=m}};break;default:var u=new Error("Unsupported PKCS#12 SafeBag type.");throw u.oid=c.type,u}if(l!==void 0&&!C.validate(p,l,s,o)){var u=new Error("Cannot read PKCS#12 "+l.name);throw u.errors=o,u}f()}return r}function of(e){var t={};if(e!==void 0)for(var a=0;a<e.length;++a){var r={},n=[];if(!C.validate(e[a],tf,r,n)){var i=new Error("Cannot read PKCS#12 BagAttribute.");throw i.errors=n,i}var s=C.derToOid(r.oid);if(X.oids[s]!==void 0){t[X.oids[s]]=[];for(var o=0;o<r.values.length;++o)t[X.oids[s]].push(r.values[o].value)}}return t}Or.toPkcs12Asn1=function(e,t,a,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||r.encAlgorithm||"aes128","useMac"in r||(r.useMac=!0),"localKeyId"in r||(r.localKeyId=null),"generateLocalKeyId"in r||(r.generateLocalKeyId=!0);var n=r.localKeyId,i;if(n!==null)n=pe.util.hexToBytes(n);else if(r.generateLocalKeyId)if(t){var s=pe.util.isArray(t)?t[0]:t;typeof s=="string"&&(s=X.certificateFromPem(s));var o=pe.md.sha1.create();o.update(C.toDer(X.certificateToAsn1(s)).getBytes()),n=o.digest().getBytes()}else n=pe.random.getBytes(20);var u=[];n!==null&&u.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.localKeyId).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,n)])])),"friendlyName"in r&&u.push(C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.friendlyName).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SET,!0,[C.create(C.Class.UNIVERSAL,C.Type.BMPSTRING,!1,r.friendlyName)])])),u.length>0&&(i=C.create(C.Class.UNIVERSAL,C.Type.SET,!0,u));var c=[],l=[];t!==null&&(pe.util.isArray(t)?l=t:l=[t]);for(var f=[],p=0;p<l.length;++p){t=l[p],typeof t=="string"&&(t=X.certificateFromPem(t));var v=p===0?i:void 0,y=X.certificateToAsn1(t),m=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.certBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.x509Certificate).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(y).getBytes())])])]),v]);f.push(m)}if(f.length>0){var x=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,f),T=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(x).getBytes())])]);c.push(T)}var B=null;if(e!==null){var b=X.wrapRsaPrivateKey(X.privateKeyToAsn1(e));a===null?B=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.keyBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[b]),i]):B=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.pkcs8ShroudedKeyBag).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[X.encryptPrivateKeyInfo(b,a,r)]),i]);var P=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[B]),R=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(P).getBytes())])]);c.push(R)}var L=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,c),z;if(r.useMac){var o=pe.md.sha1.create(),j=new pe.util.ByteBuffer(pe.random.getBytes(r.saltSize)),oe=r.count,e=Or.generateKey(a,j,3,oe,20),ce=pe.hmac.create();ce.start(o,e),ce.update(C.toDer(L).getBytes());var de=ce.getMac();z=C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.sha1).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.NULL,!1,"")]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,de.getBytes())]),C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,j.getBytes()),C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(oe).getBytes())])}return C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.INTEGER,!1,C.integerToDer(3).getBytes()),C.create(C.Class.UNIVERSAL,C.Type.SEQUENCE,!0,[C.create(C.Class.UNIVERSAL,C.Type.OID,!1,C.oidToDer(X.oids.data).getBytes()),C.create(C.Class.CONTEXT_SPECIFIC,0,!0,[C.create(C.Class.UNIVERSAL,C.Type.OCTETSTRING,!1,C.toDer(L).getBytes())])]),z])};Or.generateKey=pe.pbe.generatePkcs12Key});var xn=F((hg,Ks)=>{var qt=$();gt();Vt();pn();Xt();ua();Cn();ga();Ur();ne();ma();var En=qt.asn1,Er=Ks.exports=qt.pki=qt.pki||{};Er.pemToDer=function(e){var t=qt.pem.decode(e)[0];if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return qt.util.createBuffer(t.body)};Er.privateKeyFromPem=function(e){var t=qt.pem.decode(e)[0];if(t.type!=="PRIVATE KEY"&&t.type!=="RSA PRIVATE KEY"){var a=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=En.fromDer(t.body);return Er.privateKeyFromAsn1(r)};Er.privateKeyToPem=function(e,t){var a={type:"RSA PRIVATE KEY",body:En.toDer(Er.privateKeyToAsn1(e)).getBytes()};return qt.pem.encode(a,{maxline:t})};Er.privateKeyInfoToPem=function(e,t){var a={type:"PRIVATE KEY",body:En.toDer(e).getBytes()};return qt.pem.encode(a,{maxline:t})}});var bn=F((pg,Ys)=>{var _=$();gt();dr();na();Xt();xn();ot();yr();ne();var Sa=function(e,t,a,r){var n=_.util.createBuffer(),i=e.length>>1,s=i+(e.length&1),o=e.substr(0,s),u=e.substr(i,s),c=_.util.createBuffer(),l=_.hmac.create();a=t+a;var f=Math.ceil(r/16),p=Math.ceil(r/20);l.start("MD5",o);var v=_.util.createBuffer();c.putBytes(a);for(var y=0;y<f;++y)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+a),v.putBuffer(l.digest());l.start("SHA1",u);var m=_.util.createBuffer();c.clear(),c.putBytes(a);for(var y=0;y<p;++y)l.start(null,null),l.update(c.getBytes()),c.putBuffer(l.digest()),l.start(null,null),l.update(c.bytes()+a),m.putBuffer(l.digest());return n.putBytes(_.util.xorBytes(v.getBytes(),m.getBytes(),r)),n},uf=function(e,t,a){var r=_.hmac.create();r.start("SHA1",e);var n=_.util.createBuffer();return n.putInt32(t[0]),n.putInt32(t[1]),n.putByte(a.type),n.putByte(a.version.major),n.putByte(a.version.minor),n.putInt16(a.length),n.putBytes(a.fragment.bytes()),r.update(n.getBytes()),r.digest().getBytes()},cf=function(e,t,a){var r=!1;try{var n=e.deflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},lf=function(e,t,a){var r=!1;try{var n=e.inflate(t.fragment.getBytes());t.fragment=_.util.createBuffer(n),t.length=n.length,r=!0}catch{}return r},tt=function(e,t){var a=0;switch(t){case 1:a=e.getByte();break;case 2:a=e.getInt16();break;case 3:a=e.getInt24();break;case 4:a=e.getInt32();break}return _.util.createBuffer(e.getBytes(a))},ft=function(e,t,a){e.putInt(a.length(),t<<3),e.putBuffer(a)},g={};g.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};g.SupportedVersions=[g.Versions.TLS_1_1,g.Versions.TLS_1_0];g.Version=g.SupportedVersions[0];g.MaxFragment=15360;g.ConnectionEnd={server:0,client:1};g.PRFAlgorithm={tls_prf_sha256:0};g.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};g.CipherType={stream:0,block:1,aead:2};g.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};g.CompressionMethod={none:0,deflate:1};g.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};g.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};g.Alert={};g.Alert.Level={warning:1,fatal:2};g.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};g.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};g.CipherSuites={};g.getCipherSuite=function(e){var t=null;for(var a in g.CipherSuites){var r=g.CipherSuites[a];if(r.id[0]===e.charCodeAt(0)&&r.id[1]===e.charCodeAt(1)){t=r;break}}return t};g.handleUnexpected=function(e,t){var a=!e.open&&e.entity===g.ConnectionEnd.client;a||e.error(e,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unexpected_message}})};g.handleHelloRequest=function(e,t,a){!e.handshaking&&e.handshakes>0&&(g.queue(e,g.createAlert(e,{level:g.Alert.Level.warning,description:g.Alert.Description.no_renegotiation})),g.flush(e)),e.process()};g.parseHelloMessage=function(e,t,a){var r=null,n=e.entity===g.ConnectionEnd.client;if(a<38)e.error(e,{message:n?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});else{var i=t.fragment,s=i.length();if(r={version:{major:i.getByte(),minor:i.getByte()},random:_.util.createBuffer(i.getBytes(32)),session_id:tt(i,1),extensions:[]},n?(r.cipher_suite=i.getBytes(2),r.compression_method=i.getByte()):(r.cipher_suites=tt(i,2),r.compression_methods=tt(i,1)),s=a-(s-i.length()),s>0){for(var o=tt(i,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:tt(o,2)});if(!n)for(var u=0;u<r.extensions.length;++u){var c=r.extensions[u];if(c.type[0]===0&&c.type[1]===0)for(var l=tt(c.data,2);l.length()>0;){var f=l.getByte();if(f!==0)break;e.session.extensions.server_name.serverNameList.push(tt(l,2).getBytes())}}}if(e.session.version&&(r.version.major!==e.session.version.major||r.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}});if(n)e.session.cipherSuite=g.getCipherSuite(r.cipher_suite);else for(var p=_.util.createBuffer(r.cipher_suites.bytes());p.length()>0&&(e.session.cipherSuite=g.getCipherSuite(p.getBytes(2)),e.session.cipherSuite===null););if(e.session.cipherSuite===null)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.handshake_failure},cipherSuite:_.util.bytesToHex(r.cipher_suite)});n?e.session.compressionMethod=r.compression_method:e.session.compressionMethod=g.CompressionMethod.none}return r};g.createSecurityParameters=function(e,t){var a=e.entity===g.ConnectionEnd.client,r=t.random.bytes(),n=a?e.session.sp.client_random:r,i=a?r:g.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:g.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:i}};g.handleServerHello=function(e,t,a){var r=g.parseHelloMessage(e,t,a);if(!e.fail){if(r.version.minor<=e.version.minor)e.version.minor=r.version.minor;else return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}});e.session.version=e.version;var n=r.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=Gs,e.session.resuming=!0,e.session.sp.server_random=r.random.bytes()):(e.expect=df,e.session.resuming=!1,g.createSecurityParameters(e,r)),e.session.id=n,e.process()}};g.handleClientHello=function(e,t,a){var r=g.parseHelloMessage(e,t,a);if(!e.fail){var n=r.session_id.bytes(),i=null;if(e.sessionCache&&(i=e.sessionCache.getSession(n),i===null?n="":(i.version.major!==r.version.major||i.version.minor>r.version.minor)&&(i=null,n="")),n.length===0&&(n=_.random.getBytes(32)),e.session.id=n,e.session.clientHelloVersion=r.version,e.session.sp={},i)e.version=e.session.version=i.version,e.session.sp=i.sp;else{for(var s,o=1;o<g.SupportedVersions.length&&(s=g.SupportedVersions[o],!(s.minor<=r.version.minor));++o);e.version={major:s.major,minor:s.minor},e.session.version=e.version}i!==null?(e.expect=In,e.session.resuming=!0,e.session.sp.client_random=r.random.bytes()):(e.expect=e.verifyClient!==!1?Cf:An,e.session.resuming=!1,g.createSecurityParameters(e,r)),e.open=!0,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerHello(e)})),e.session.resuming?(g.queue(e,g.createRecord(e,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),e.state.pending=g.createConnectionState(e),e.state.current.write=e.state.pending.write,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createFinished(e)}))):(g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificate(e)})),e.fail||(g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerKeyExchange(e)})),e.verifyClient!==!1&&g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificateRequest(e)})),g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createServerHelloDone(e)})))),g.flush(e),e.process()}};g.handleCertificate=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_list:tt(r,3)},i,s,o=[];try{for(;n.certificate_list.length()>0;)i=tt(n.certificate_list,3),s=_.asn1.fromDer(i),i=_.pki.certificateFromAsn1(s,!0),o.push(i)}catch(c){return e.error(e,{message:"Could not parse certificate list.",cause:c,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate}})}var u=e.entity===g.ConnectionEnd.client;(u||e.verifyClient===!0)&&o.length===0?e.error(e,{message:u?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}}):o.length===0?e.expect=u?qs:An:(u?e.session.serverCertificate=o[0]:e.session.clientCertificate=o[0],g.verifyCertificateChain(e,o)&&(e.expect=u?qs:An)),e.process()};g.handleServerKeyExchange=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unsupported_certificate}});e.expect=hf,e.process()};g.handleClientKeyExchange=function(e,t,a){if(a<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unsupported_certificate}});var r=t.fragment,n={enc_pre_master_secret:tt(r,2).getBytes()},i=null;if(e.getPrivateKey)try{i=e.getPrivateKey(e,e.session.serverCertificate),i=_.pki.privateKeyFromPem(i)}catch(u){e.error(e,{message:"Could not get private key.",cause:u,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}})}if(i===null)return e.error(e,{message:"No private key set.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}});try{var s=e.session.sp;s.pre_master_secret=i.decrypt(n.enc_pre_master_secret);var o=e.session.clientHelloVersion;if(o.major!==s.pre_master_secret.charCodeAt(0)||o.minor!==s.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{s.pre_master_secret=_.random.getBytes(48)}e.expect=In,e.session.clientCertificate!==null&&(e.expect=Ef),e.process()};g.handleCertificateRequest=function(e,t,a){if(a<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment,n={certificate_types:tt(r,1),certificate_authorities:tt(r,2)};e.session.certificateRequest=n,e.expect=pf,e.process()};g.handleCertificateVerify=function(e,t,a){if(a<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var i={signature:tt(r,2).getBytes()},s=_.util.createBuffer();s.putBuffer(e.session.md5.digest()),s.putBuffer(e.session.sha1.digest()),s=s.getBytes();try{var o=e.session.clientCertificate;if(!o.publicKey.verify(s,i.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(n),e.session.sha1.update(n)}catch{return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.handshake_failure}})}e.expect=In,e.process()};g.handleServerHelloDone=function(e,t,a){if(a>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.record_overflow}});if(e.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.insufficient_security}},n=0,i=e.verify(e,r.alert.description,n,[]);if(i!==!0)return(i||i===0)&&(typeof i=="object"&&!_.util.isArray(i)?(i.message&&(r.message=i.message),i.alert&&(r.alert.description=i.alert)):typeof i=="number"&&(r.alert.description=i)),e.error(e,r)}e.session.certificateRequest!==null&&(t=g.createRecord(e,{type:g.ContentType.handshake,data:g.createCertificate(e)}),g.queue(e,t)),t=g.createRecord(e,{type:g.ContentType.handshake,data:g.createClientKeyExchange(e)}),g.queue(e,t),e.expect=vf;var s=function(o,u){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&g.queue(o,g.createRecord(o,{type:g.ContentType.handshake,data:g.createCertificateVerify(o,u)})),g.queue(o,g.createRecord(o,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),o.state.pending=g.createConnectionState(o),o.state.current.write=o.state.pending.write,g.queue(o,g.createRecord(o,{type:g.ContentType.handshake,data:g.createFinished(o)})),o.expect=Gs,g.flush(o),o.process()};if(e.session.certificateRequest===null||e.session.clientCertificate===null)return s(e,null);g.getClientSignature(e,s)};g.handleChangeCipherSpec=function(e,t){if(t.fragment.getByte()!==1)return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.illegal_parameter}});var a=e.entity===g.ConnectionEnd.client;(e.session.resuming&&a||!e.session.resuming&&!a)&&(e.state.pending=g.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&a||e.session.resuming&&!a)&&(e.state.pending=null),e.expect=a?gf:xf,e.process()};g.handleFinished=function(e,t,a){var r=t.fragment;r.read-=4;var n=r.bytes();r.read+=4;var i=t.fragment.getBytes();r=_.util.createBuffer(),r.putBuffer(e.session.md5.digest()),r.putBuffer(e.session.sha1.digest());var s=e.entity===g.ConnectionEnd.client,o=s?"server finished":"client finished",u=e.session.sp,c=12,l=Sa;if(r=l(u.master_secret,o,r.getBytes(),c),r.getBytes()!==i)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.decrypt_error}});e.session.md5.update(n),e.session.sha1.update(n),(e.session.resuming&&s||!e.session.resuming&&!s)&&(g.queue(e,g.createRecord(e,{type:g.ContentType.change_cipher_spec,data:g.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,g.queue(e,g.createRecord(e,{type:g.ContentType.handshake,data:g.createFinished(e)}))),e.expect=s?yf:Sf,e.handshaking=!1,++e.handshakes,e.peerCertificate=s?e.session.serverCertificate:e.session.clientCertificate,g.flush(e),e.isConnected=!0,e.connected(e),e.process()};g.handleAlert=function(e,t){var a=t.fragment,r={level:a.getByte(),description:a.getByte()},n;switch(r.description){case g.Alert.Description.close_notify:n="Connection closed.";break;case g.Alert.Description.unexpected_message:n="Unexpected message.";break;case g.Alert.Description.bad_record_mac:n="Bad record MAC.";break;case g.Alert.Description.decryption_failed:n="Decryption failed.";break;case g.Alert.Description.record_overflow:n="Record overflow.";break;case g.Alert.Description.decompression_failure:n="Decompression failed.";break;case g.Alert.Description.handshake_failure:n="Handshake failure.";break;case g.Alert.Description.bad_certificate:n="Bad certificate.";break;case g.Alert.Description.unsupported_certificate:n="Unsupported certificate.";break;case g.Alert.Description.certificate_revoked:n="Certificate revoked.";break;case g.Alert.Description.certificate_expired:n="Certificate expired.";break;case g.Alert.Description.certificate_unknown:n="Certificate unknown.";break;case g.Alert.Description.illegal_parameter:n="Illegal parameter.";break;case g.Alert.Description.unknown_ca:n="Unknown certificate authority.";break;case g.Alert.Description.access_denied:n="Access denied.";break;case g.Alert.Description.decode_error:n="Decode error.";break;case g.Alert.Description.decrypt_error:n="Decrypt error.";break;case g.Alert.Description.export_restriction:n="Export restriction.";break;case g.Alert.Description.protocol_version:n="Unsupported protocol version.";break;case g.Alert.Description.insufficient_security:n="Insufficient security.";break;case g.Alert.Description.internal_error:n="Internal error.";break;case g.Alert.Description.user_canceled:n="User canceled.";break;case g.Alert.Description.no_renegotiation:n="Renegotiation not supported.";break;default:n="Unknown error.";break}if(r.description===g.Alert.Description.close_notify)return e.close();e.error(e,{message:n,send:!1,origin:e.entity===g.ConnectionEnd.client?"server":"client",alert:r}),e.process()};g.handleHandshake=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt24();if(n>a.length())return e.fragmented=t,t.fragment=_.util.createBuffer(),a.read-=4,e.process();e.fragmented=null,a.read-=4;var i=a.bytes(n+4);a.read+=4,r in xa[e.entity][e.expect]?(e.entity===g.ConnectionEnd.server&&!e.open&&!e.fail&&(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:_.md.md5.create(),sha1:_.md.sha1.create()}),r!==g.HandshakeType.hello_request&&r!==g.HandshakeType.certificate_verify&&r!==g.HandshakeType.finished&&(e.session.md5.update(i),e.session.sha1.update(i)),xa[e.entity][e.expect][r](e,t,n)):g.handleUnexpected(e,t)};g.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()};g.handleHeartbeat=function(e,t){var a=t.fragment,r=a.getByte(),n=a.getInt16(),i=a.getBytes(n);if(r===g.HeartbeatMessageType.heartbeat_request){if(e.handshaking||n>i.length)return e.process();g.queue(e,g.createRecord(e,{type:g.ContentType.heartbeat,data:g.createHeartbeat(g.HeartbeatMessageType.heartbeat_response,i)})),g.flush(e)}else if(r===g.HeartbeatMessageType.heartbeat_response){if(i!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,_.util.createBuffer(i))}e.process()};var ff=0,df=1,qs=2,hf=3,pf=4,Gs=5,gf=6,yf=7,vf=8,mf=0,Cf=1,An=2,Ef=3,In=4,xf=5,Sf=6,h=g.handleUnexpected,zs=g.handleChangeCipherSpec,_e=g.handleAlert,We=g.handleHandshake,Qs=g.handleApplicationData,Ne=g.handleHeartbeat,Bn=[];Bn[g.ConnectionEnd.client]=[[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[zs,_e,h,h,Ne],[h,_e,We,h,Ne],[h,_e,We,Qs,Ne],[h,_e,We,h,Ne]];Bn[g.ConnectionEnd.server]=[[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[h,_e,We,h,Ne],[zs,_e,h,h,Ne],[h,_e,We,h,Ne],[h,_e,We,Qs,Ne],[h,_e,We,h,Ne]];var Ht=g.handleHelloRequest,Tf=g.handleServerHello,$s=g.handleCertificate,Hs=g.handleServerKeyExchange,Sn=g.handleCertificateRequest,Ca=g.handleServerHelloDone,js=g.handleFinished,xa=[];xa[g.ConnectionEnd.client]=[[h,h,Tf,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,$s,Hs,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,Hs,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,Sn,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,Ca,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,js],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[Ht,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h]];var Af=g.handleClientHello,If=g.handleClientKeyExchange,Bf=g.handleCertificateVerify;xa[g.ConnectionEnd.server]=[[h,Af,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,$s,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,If,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,Bf,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,js],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h],[h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h,h]];g.generateKeys=function(e,t){var a=Sa,r=t.client_random+t.server_random;e.session.resuming||(t.master_secret=a(t.pre_master_secret,"master secret",r,48).bytes(),t.pre_master_secret=null),r=t.server_random+t.client_random;var n=2*t.mac_key_length+2*t.enc_key_length,i=e.version.major===g.Versions.TLS_1_0.major&&e.version.minor===g.Versions.TLS_1_0.minor;i&&(n+=2*t.fixed_iv_length);var s=a(t.master_secret,"key expansion",r,n),o={client_write_MAC_key:s.getBytes(t.mac_key_length),server_write_MAC_key:s.getBytes(t.mac_key_length),client_write_key:s.getBytes(t.enc_key_length),server_write_key:s.getBytes(t.enc_key_length)};return i&&(o.client_write_IV=s.getBytes(t.fixed_iv_length),o.server_write_IV=s.getBytes(t.fixed_iv_length)),o};g.createConnectionState=function(e){var t=e.entity===g.ConnectionEnd.client,a=function(){var i={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(s){return!0},compressionState:null,compressFunction:function(s){return!0},updateSequenceNumber:function(){i.sequenceNumber[1]===4294967295?(i.sequenceNumber[1]=0,++i.sequenceNumber[0]):++i.sequenceNumber[1]}};return i},r={read:a(),write:a()};if(r.read.update=function(i,s){return r.read.cipherFunction(s,r.read)?r.read.compressFunction(i,s,r.read)||i.error(i,{message:"Could not decompress record.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.decompression_failure}}):i.error(i,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_record_mac}}),!i.fail},r.write.update=function(i,s){return r.write.compressFunction(i,s,r.write)?r.write.cipherFunction(s,r.write)||i.error(i,{message:"Could not encrypt record.",send:!1,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}):i.error(i,{message:"Could not compress record.",send:!1,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}),!i.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=g.generateKeys(e,n),r.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,r.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(r,e,n),n.compression_algorithm){case g.CompressionMethod.none:break;case g.CompressionMethod.deflate:r.read.compressFunction=lf,r.write.compressFunction=cf;break;default:throw new Error("Unsupported compression algorithm.")}}return r};g.createRandom=function(){var e=new Date,t=+e+e.getTimezoneOffset()*6e4,a=_.util.createBuffer();return a.putInt32(t),a.putBytes(_.random.getBytes(28)),a};g.createRecord=function(e,t){if(!t.data)return null;var a={type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data};return a};g.createAlert=function(e,t){var a=_.util.createBuffer();return a.putByte(t.level),a.putByte(t.description),g.createRecord(e,{type:g.ContentType.alert,data:a})};g.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=_.util.createBuffer(),a=0;a<e.cipherSuites.length;++a){var r=e.cipherSuites[a];t.putByte(r.id[0]),t.putByte(r.id[1])}var n=t.length(),i=_.util.createBuffer();i.putByte(g.CompressionMethod.none);var s=i.length(),o=_.util.createBuffer();if(e.virtualHost){var u=_.util.createBuffer();u.putByte(0),u.putByte(0);var c=_.util.createBuffer();c.putByte(0),ft(c,2,_.util.createBuffer(e.virtualHost));var l=_.util.createBuffer();ft(l,2,c),ft(u,2,l),o.putBuffer(u)}var f=o.length();f>0&&(f+=2);var p=e.session.id,v=p.length+1+2+4+28+2+n+1+s+f,y=_.util.createBuffer();return y.putByte(g.HandshakeType.client_hello),y.putInt24(v),y.putByte(e.version.major),y.putByte(e.version.minor),y.putBytes(e.session.sp.client_random),ft(y,1,_.util.createBuffer(p)),ft(y,2,t),ft(y,1,i),f>0&&ft(y,2,o),y};g.createServerHello=function(e){var t=e.session.id,a=t.length+1+2+4+28+2+1,r=_.util.createBuffer();return r.putByte(g.HandshakeType.server_hello),r.putInt24(a),r.putByte(e.version.major),r.putByte(e.version.minor),r.putBytes(e.session.sp.server_random),ft(r,1,_.util.createBuffer(t)),r.putByte(e.session.cipherSuite.id[0]),r.putByte(e.session.cipherSuite.id[1]),r.putByte(e.session.compressionMethod),r};g.createCertificate=function(e){var t=e.entity===g.ConnectionEnd.client,a=null;if(e.getCertificate){var r;t?r=e.session.certificateRequest:r=e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,r)}var n=_.util.createBuffer();if(a!==null)try{_.util.isArray(a)||(a=[a]);for(var i=null,s=0;s<a.length;++s){var o=_.pem.decode(a[s])[0];if(o.type!=="CERTIFICATE"&&o.type!=="X509 CERTIFICATE"&&o.type!=="TRUSTED CERTIFICATE"){var u=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw u.headerType=o.type,u}if(o.procType&&o.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var c=_.util.createBuffer(o.body);i===null&&(i=_.asn1.fromDer(c.bytes(),!1));var l=_.util.createBuffer();ft(l,3,c),n.putBuffer(l)}a=_.pki.certificateFromAsn1(i),t?e.session.clientCertificate=a:e.session.serverCertificate=a}catch(v){return e.error(e,{message:"Could not send certificate list.",cause:v,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate}})}var f=3+n.length(),p=_.util.createBuffer();return p.putByte(g.HandshakeType.certificate),p.putInt24(f),ft(p,3,n),p};g.createClientKeyExchange=function(e){var t=_.util.createBuffer();t.putByte(e.session.clientHelloVersion.major),t.putByte(e.session.clientHelloVersion.minor),t.putBytes(_.random.getBytes(46));var a=e.session.sp;a.pre_master_secret=t.getBytes();var r=e.session.serverCertificate.publicKey;t=r.encrypt(a.pre_master_secret);var n=t.length+2,i=_.util.createBuffer();return i.putByte(g.HandshakeType.client_key_exchange),i.putInt24(n),i.putInt16(t.length),i.putBytes(t),i};g.createServerKeyExchange=function(e){var t=0,a=_.util.createBuffer();return t>0&&(a.putByte(g.HandshakeType.server_key_exchange),a.putInt24(t)),a};g.getClientSignature=function(e,t){var a=_.util.createBuffer();a.putBuffer(e.session.md5.digest()),a.putBuffer(e.session.sha1.digest()),a=a.getBytes(),e.getSignature=e.getSignature||function(r,n,i){var s=null;if(r.getPrivateKey)try{s=r.getPrivateKey(r,r.session.clientCertificate),s=_.pki.privateKeyFromPem(s)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}})}s===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.internal_error}}):n=s.sign(n,null),i(r,n)},e.getSignature(e,a,t)};g.createCertificateVerify=function(e,t){var a=t.length+2,r=_.util.createBuffer();return r.putByte(g.HandshakeType.certificate_verify),r.putInt24(a),r.putInt16(t.length),r.putBytes(t),r};g.createCertificateRequest=function(e){var t=_.util.createBuffer();t.putByte(1);var a=_.util.createBuffer();for(var r in e.caStore.certs){var n=e.caStore.certs[r],i=_.pki.distinguishedNameToAsn1(n.subject),s=_.asn1.toDer(i);a.putInt16(s.length()),a.putBuffer(s)}var o=1+t.length()+2+a.length(),u=_.util.createBuffer();return u.putByte(g.HandshakeType.certificate_request),u.putInt24(o),ft(u,1,t),ft(u,2,a),u};g.createServerHelloDone=function(e){var t=_.util.createBuffer();return t.putByte(g.HandshakeType.server_hello_done),t.putInt24(0),t};g.createChangeCipherSpec=function(){var e=_.util.createBuffer();return e.putByte(1),e};g.createFinished=function(e){var t=_.util.createBuffer();t.putBuffer(e.session.md5.digest()),t.putBuffer(e.session.sha1.digest());var a=e.entity===g.ConnectionEnd.client,r=e.session.sp,n=12,i=Sa,s=a?"client finished":"server finished";t=i(r.master_secret,s,t.getBytes(),n);var o=_.util.createBuffer();return o.putByte(g.HandshakeType.finished),o.putInt24(t.length()),o.putBuffer(t),o};g.createHeartbeat=function(e,t,a){typeof a>"u"&&(a=t.length);var r=_.util.createBuffer();r.putByte(e),r.putInt16(a),r.putBytes(t);var n=r.length(),i=Math.max(16,n-a-3);return r.putBytes(_.random.getBytes(i)),r};g.queue=function(e,t){if(t&&!(t.fragment.length()===0&&(t.type===g.ContentType.handshake||t.type===g.ContentType.alert||t.type===g.ContentType.change_cipher_spec))){if(t.type===g.ContentType.handshake){var a=t.fragment.bytes();e.session.md5.update(a),e.session.sha1.update(a),a=null}var r;if(t.fragment.length()<=g.MaxFragment)r=[t];else{r=[];for(var n=t.fragment.bytes();n.length>g.MaxFragment;)r.push(g.createRecord(e,{type:t.type,data:_.util.createBuffer(n.slice(0,g.MaxFragment))})),n=n.slice(g.MaxFragment);n.length>0&&r.push(g.createRecord(e,{type:t.type,data:_.util.createBuffer(n)}))}for(var i=0;i<r.length&&!e.fail;++i){var s=r[i],o=e.state.current.write;o.update(e,s)&&e.records.push(s)}}};g.flush=function(e){for(var t=0;t<e.records.length;++t){var a=e.records[t];e.tlsData.putByte(a.type),e.tlsData.putByte(a.version.major),e.tlsData.putByte(a.version.minor),e.tlsData.putInt16(a.fragment.length()),e.tlsData.putBuffer(e.records[t].fragment)}return e.records=[],e.tlsDataReady(e)};var Tn=function(e){switch(e){case!0:return!0;case _.pki.certificateError.bad_certificate:return g.Alert.Description.bad_certificate;case _.pki.certificateError.unsupported_certificate:return g.Alert.Description.unsupported_certificate;case _.pki.certificateError.certificate_revoked:return g.Alert.Description.certificate_revoked;case _.pki.certificateError.certificate_expired:return g.Alert.Description.certificate_expired;case _.pki.certificateError.certificate_unknown:return g.Alert.Description.certificate_unknown;case _.pki.certificateError.unknown_ca:return g.Alert.Description.unknown_ca;default:return g.Alert.Description.bad_certificate}},bf=function(e){switch(e){case!0:return!0;case g.Alert.Description.bad_certificate:return _.pki.certificateError.bad_certificate;case g.Alert.Description.unsupported_certificate:return _.pki.certificateError.unsupported_certificate;case g.Alert.Description.certificate_revoked:return _.pki.certificateError.certificate_revoked;case g.Alert.Description.certificate_expired:return _.pki.certificateError.certificate_expired;case g.Alert.Description.certificate_unknown:return _.pki.certificateError.certificate_unknown;case g.Alert.Description.unknown_ca:return _.pki.certificateError.unknown_ca;default:return _.pki.certificateError.bad_certificate}};g.verifyCertificateChain=function(e,t){try{var a={};for(var r in e.verifyOptions)a[r]=e.verifyOptions[r];a.verify=function(i,s,o){var u=Tn(i),c=e.verify(e,i,s,o);if(c!==!0){if(typeof c=="object"&&!_.util.isArray(c)){var l=new Error("The application rejected the certificate.");throw l.send=!0,l.alert={level:g.Alert.Level.fatal,description:g.Alert.Description.bad_certificate},c.message&&(l.message=c.message),c.alert&&(l.alert.description=c.alert),l}c!==i&&(c=bf(c))}return c},_.pki.verifyCertificateChain(e.caStore,t,a)}catch(i){var n=i;(typeof n!="object"||_.util.isArray(n))&&(n={send:!0,alert:{level:g.Alert.Level.fatal,description:Tn(i)}}),"send"in n||(n.send=!0),"alert"in n||(n.alert={level:g.Alert.Level.fatal,description:Tn(n.error)}),e.error(e,n)}return!e.fail};g.createSessionCache=function(e,t){var a=null;if(e&&e.getSession&&e.setSession&&e.order)a=e;else{a={},a.cache=e||{},a.capacity=Math.max(t||100,1),a.order=[];for(var r in e)a.order.length<=t?a.order.push(r):delete e[r];a.getSession=function(n){var i=null,s=null;if(n?s=_.util.bytesToHex(n):a.order.length>0&&(s=a.order[0]),s!==null&&s in a.cache){i=a.cache[s],delete a.cache[s];for(var o in a.order)if(a.order[o]===s){a.order.splice(o,1);break}}return i},a.setSession=function(n,i){if(a.order.length===a.capacity){var s=a.order.shift();delete a.cache[s]}var s=_.util.bytesToHex(n);a.order.push(s),a.cache[s]=i}}return a};g.createConnection=function(e){var t=null;e.caStore?_.util.isArray(e.caStore)?t=_.pki.createCaStore(e.caStore):t=e.caStore:t=_.pki.createCaStore();var a=e.cipherSuites||null;if(a===null){a=[];for(var r in g.CipherSuites)a.push(g.CipherSuites[r])}var n=e.server?g.ConnectionEnd.server:g.ConnectionEnd.client,i=e.sessionCache?g.createSessionCache(e.sessionCache):null,s={version:{major:g.Version.major,minor:g.Version.minor},entity:n,sessionId:e.sessionId,caStore:t,sessionCache:i,cipherSuites:a,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(l,f,p,v){return f},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:_.util.createBuffer(),tlsData:_.util.createBuffer(),data:_.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(l,f){f.origin=f.origin||(l.entity===g.ConnectionEnd.client?"client":"server"),f.send&&(g.queue(l,g.createAlert(l,f.alert)),g.flush(l));var p=f.fatal!==!1;p&&(l.fail=!0),e.error(l,f),p&&l.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null};s.reset=function(l){s.version={major:g.Version.major,minor:g.Version.minor},s.record=null,s.session=null,s.peerCertificate=null,s.state={pending:null,current:null},s.expect=s.entity===g.ConnectionEnd.client?ff:mf,s.fragmented=null,s.records=[],s.open=!1,s.handshakes=0,s.handshaking=!1,s.isConnected=!1,s.fail=!(l||typeof l>"u"),s.input.clear(),s.tlsData.clear(),s.data.clear(),s.state.current=g.createConnectionState(s)},s.reset();var o=function(l,f){var p=f.type-g.ContentType.change_cipher_spec,v=Bn[l.entity][l.expect];p in v?v[p](l,f):g.handleUnexpected(l,f)},u=function(l){var f=0,p=l.input,v=p.length();if(v<5)f=5-v;else{l.record={type:p.getByte(),version:{major:p.getByte(),minor:p.getByte()},length:p.getInt16(),fragment:_.util.createBuffer(),ready:!1};var y=l.record.version.major===l.version.major;y&&l.session&&l.session.version&&(y=l.record.version.minor===l.version.minor),y||l.error(l,{message:"Incompatible TLS version.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.protocol_version}})}return f},c=function(l){var f=0,p=l.input,v=p.length();if(v<l.record.length)f=l.record.length-v;else{l.record.fragment.putBytes(p.getBytes(l.record.length)),p.compact();var y=l.state.current.read;y.update(l,l.record)&&(l.fragmented!==null&&(l.fragmented.type===l.record.type?(l.fragmented.fragment.putBuffer(l.record.fragment),l.record=l.fragmented):l.error(l,{message:"Invalid fragmented record.",send:!0,alert:{level:g.Alert.Level.fatal,description:g.Alert.Description.unexpected_message}})),l.record.ready=!0)}return f};return s.handshake=function(l){if(s.entity!==g.ConnectionEnd.client)s.error(s,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(s.handshaking)s.error(s,{message:"Handshake already in progress.",fatal:!1});else{s.fail&&!s.open&&s.handshakes===0&&(s.fail=!1),s.handshaking=!0,l=l||"";var f=null;l.length>0&&(s.sessionCache&&(f=s.sessionCache.getSession(l)),f===null&&(l="")),l.length===0&&s.sessionCache&&(f=s.sessionCache.getSession(),f!==null&&(l=f.id)),s.session={id:l,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:_.md.md5.create(),sha1:_.md.sha1.create()},f&&(s.version=f.version,s.session.sp=f.sp),s.session.sp.client_random=g.createRandom().getBytes(),s.open=!0,g.queue(s,g.createRecord(s,{type:g.ContentType.handshake,data:g.createClientHello(s)})),g.flush(s)}},s.process=function(l){var f=0;return l&&s.input.putBytes(l),s.fail||(s.record!==null&&s.record.ready&&s.record.fragment.isEmpty()&&(s.record=null),s.record===null&&(f=u(s)),!s.fail&&s.record!==null&&!s.record.ready&&(f=c(s)),!s.fail&&s.record!==null&&s.record.ready&&o(s,s.record)),f},s.prepare=function(l){return g.queue(s,g.createRecord(s,{type:g.ContentType.application_data,data:_.util.createBuffer(l)})),g.flush(s)},s.prepareHeartbeatRequest=function(l,f){return l instanceof _.util.ByteBuffer&&(l=l.bytes()),typeof f>"u"&&(f=l.length),s.expectedHeartbeatPayload=l,g.queue(s,g.createRecord(s,{type:g.ContentType.heartbeat,data:g.createHeartbeat(g.HeartbeatMessageType.heartbeat_request,l,f)})),g.flush(s)},s.close=function(l){if(!s.fail&&s.sessionCache&&s.session){var f={id:s.session.id,version:s.session.version,sp:s.session.sp};f.sp.keys=null,s.sessionCache.setSession(f.id,f)}s.open&&(s.open=!1,s.input.clear(),(s.isConnected||s.handshaking)&&(s.isConnected=s.handshaking=!1,g.queue(s,g.createAlert(s,{level:g.Alert.Level.warning,description:g.Alert.Description.close_notify})),g.flush(s)),s.closed(s)),s.reset(l)},s};Ys.exports=_.tls=_.tls||{};for(Ea in g)typeof g[Ea]!="function"&&(_.tls[Ea]=g[Ea]);var Ea;_.tls.prf_tls1=Sa;_.tls.hmac_sha1=uf;_.tls.createSessionCache=g.createSessionCache;_.tls.createConnection=g.createConnection});var Js=F((gg,Xs)=>{var Gt=$();Ot();bn();var dt=Xs.exports=Gt.tls;dt.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=dt.BulkCipherAlgorithm.aes,e.cipher_type=dt.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=dt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Ws};dt.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=dt.BulkCipherAlgorithm.aes,e.cipher_type=dt.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=dt.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:Ws};function Ws(e,t,a){var r=t.entity===Gt.tls.ConnectionEnd.client;e.read.cipherState={init:!1,cipher:Gt.cipher.createDecipher("AES-CBC",r?a.keys.server_write_key:a.keys.client_write_key),iv:r?a.keys.server_write_IV:a.keys.client_write_IV},e.write.cipherState={init:!1,cipher:Gt.cipher.createCipher("AES-CBC",r?a.keys.client_write_key:a.keys.server_write_key),iv:r?a.keys.client_write_IV:a.keys.server_write_IV},e.read.cipherFunction=Rf,e.write.cipherFunction=wf,e.read.macLength=e.write.macLength=a.mac_length,e.read.macFunction=e.write.macFunction=dt.hmac_sha1}function wf(e,t){var a=!1,r=t.macFunction(t.macKey,t.sequenceNumber,e);e.fragment.putBytes(r),t.updateSequenceNumber();var n;e.version.minor===dt.Versions.TLS_1_0.minor?n=t.cipherState.init?null:t.cipherState.iv:n=Gt.random.getBytesSync(16),t.cipherState.init=!0;var i=t.cipherState.cipher;return i.start({iv:n}),e.version.minor>=dt.Versions.TLS_1_1.minor&&i.output.putBytes(n),i.update(e.fragment),i.finish(_f)&&(e.fragment=i.output,e.length=e.fragment.length(),a=!0),a}function _f(e,t,a){if(!a){var r=e-t.length()%e;t.fillWithByte(r-1,r)}return!0}function Nf(e,t,a){var r=!0;if(a){for(var n=t.length(),i=t.last(),s=n-1-i;s<n-1;++s)r=r&&t.at(s)==i;r&&t.truncate(i+1)}return r}function Rf(e,t){var a=!1,r;e.version.minor===dt.Versions.TLS_1_0.minor?r=t.cipherState.init?null:t.cipherState.iv:r=e.fragment.getBytes(16),t.cipherState.init=!0;var n=t.cipherState.cipher;n.start({iv:r}),n.update(e.fragment),a=n.finish(Nf);var i=t.macLength,s=Gt.random.getBytesSync(i),o=n.output.length();o>=i?(e.fragment=n.output.getBytes(o-i),s=n.output.getBytes(i)):e.fragment=n.output.getBytes(),e.fragment=Gt.util.createBuffer(e.fragment),e.length=e.fragment.length();var u=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),a=Lf(t.macKey,s,u)&&a,a}function Lf(e,t,a){var r=Gt.hmac.create();return r.start("SHA1",e),r.update(t),t=r.digest().getBytes(),r.start(null,null),r.update(a),a=r.digest().getBytes(),t===a}});var Nn=F((yg,ro)=>{var ve=$();vt();ne();var Vr=ro.exports=ve.sha512=ve.sha512||{};ve.md.sha512=ve.md.algorithms.sha512=Vr;var eo=ve.sha384=ve.sha512.sha384=ve.sha512.sha384||{};eo.create=function(){return Vr.create("SHA-384")};ve.md.sha384=ve.md.algorithms.sha384=eo;ve.sha512.sha256=ve.sha512.sha256||{create:function(){return Vr.create("SHA-512/256")}};ve.md["sha512/256"]=ve.md.algorithms["sha512/256"]=ve.sha512.sha256;ve.sha512.sha224=ve.sha512.sha224||{create:function(){return Vr.create("SHA-512/224")}};ve.md["sha512/224"]=ve.md.algorithms["sha512/224"]=ve.sha512.sha224;Vr.create=function(e){if(to||kf(),typeof e>"u"&&(e="SHA-512"),!(e in ar))throw new Error("Invalid SHA-512 algorithm: "+e);for(var t=ar[e],a=null,r=ve.util.createBuffer(),n=new Array(80),i=0;i<80;++i)n[i]=new Array(2);var s=64;switch(e){case"SHA-384":s=48;break;case"SHA-512/256":s=32;break;case"SHA-512/224":s=28;break}var o={algorithm:e.replace("-","").toLowerCase(),blockLength:128,digestLength:s,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var u=o.messageLengthSize/4,c=0;c<u;++c)o.fullMessageLength.push(0);r=ve.util.createBuffer(),a=new Array(t.length);for(var c=0;c<t.length;++c)a[c]=t[c].slice(0);return o},o.start(),o.update=function(u,c){c==="utf8"&&(u=ve.util.encodeUtf8(u));var l=u.length;o.messageLength+=l,l=[l/4294967296>>>0,l>>>0];for(var f=o.fullMessageLength.length-1;f>=0;--f)o.fullMessageLength[f]+=l[1],l[1]=l[0]+(o.fullMessageLength[f]/4294967296>>>0),o.fullMessageLength[f]=o.fullMessageLength[f]>>>0,l[0]=l[1]/4294967296>>>0;return r.putBytes(u),Zs(a,n,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var u=ve.util.createBuffer();u.putBytes(r.bytes());var c=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,l=c&o.blockLength-1;u.putBytes(wn.substr(0,o.blockLength-l));for(var f,p,v=o.fullMessageLength[0]*8,y=0;y<o.fullMessageLength.length-1;++y)f=o.fullMessageLength[y+1]*8,p=f/4294967296>>>0,v+=p,u.putInt32(v>>>0),v=f>>>0;u.putInt32(v);for(var m=new Array(a.length),y=0;y<a.length;++y)m[y]=a[y].slice(0);Zs(m,n,u);var x=ve.util.createBuffer(),T;e==="SHA-512"?T=m.length:e==="SHA-384"?T=m.length-2:T=m.length-4;for(var y=0;y<T;++y)x.putInt32(m[y][0]),(y!==T-1||e!=="SHA-512/224")&&x.putInt32(m[y][1]);return x},o};var wn=null,to=!1,_n=null,ar=null;function kf(){wn="\x80",wn+=ve.util.fillString("\0",128),_n=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],ar={},ar["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],ar["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],ar["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],ar["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],to=!0}function Zs(e,t,a){for(var r,n,i,s,o,u,c,l,f,p,v,y,m,x,T,B,b,P,R,L,z,j,oe,ce,de,ge,$e,st,le,Ee,M,jt,or,xe,Se,Ae=a.length();Ae>=128;){for(le=0;le<16;++le)t[le][0]=a.getInt32()>>>0,t[le][1]=a.getInt32()>>>0;for(;le<80;++le)jt=t[le-2],Ee=jt[0],M=jt[1],r=((Ee>>>19|M<<13)^(M>>>29|Ee<<3)^Ee>>>6)>>>0,n=((Ee<<13|M>>>19)^(M<<3|Ee>>>29)^(Ee<<26|M>>>6))>>>0,xe=t[le-15],Ee=xe[0],M=xe[1],i=((Ee>>>1|M<<31)^(Ee>>>8|M<<24)^Ee>>>7)>>>0,s=((Ee<<31|M>>>1)^(Ee<<24|M>>>8)^(Ee<<25|M>>>7))>>>0,or=t[le-7],Se=t[le-16],M=n+or[1]+s+Se[1],t[le][0]=r+or[0]+i+Se[0]+(M/4294967296>>>0)>>>0,t[le][1]=M>>>0;for(m=e[0][0],x=e[0][1],T=e[1][0],B=e[1][1],b=e[2][0],P=e[2][1],R=e[3][0],L=e[3][1],z=e[4][0],j=e[4][1],oe=e[5][0],ce=e[5][1],de=e[6][0],ge=e[6][1],$e=e[7][0],st=e[7][1],le=0;le<80;++le)c=((z>>>14|j<<18)^(z>>>18|j<<14)^(j>>>9|z<<23))>>>0,l=((z<<18|j>>>14)^(z<<14|j>>>18)^(j<<23|z>>>9))>>>0,f=(de^z&(oe^de))>>>0,p=(ge^j&(ce^ge))>>>0,o=((m>>>28|x<<4)^(x>>>2|m<<30)^(x>>>7|m<<25))>>>0,u=((m<<4|x>>>28)^(x<<30|m>>>2)^(x<<25|m>>>7))>>>0,v=(m&T|b&(m^T))>>>0,y=(x&B|P&(x^B))>>>0,M=st+l+p+_n[le][1]+t[le][1],r=$e+c+f+_n[le][0]+t[le][0]+(M/4294967296>>>0)>>>0,n=M>>>0,M=u+y,i=o+v+(M/4294967296>>>0)>>>0,s=M>>>0,$e=de,st=ge,de=oe,ge=ce,oe=z,ce=j,M=L+n,z=R+r+(M/4294967296>>>0)>>>0,j=M>>>0,R=b,L=P,b=T,P=B,T=m,B=x,M=n+s,m=r+i+(M/4294967296>>>0)>>>0,x=M>>>0;M=e[0][1]+x,e[0][0]=e[0][0]+m+(M/4294967296>>>0)>>>0,e[0][1]=M>>>0,M=e[1][1]+B,e[1][0]=e[1][0]+T+(M/4294967296>>>0)>>>0,e[1][1]=M>>>0,M=e[2][1]+P,e[2][0]=e[2][0]+b+(M/4294967296>>>0)>>>0,e[2][1]=M>>>0,M=e[3][1]+L,e[3][0]=e[3][0]+R+(M/4294967296>>>0)>>>0,e[3][1]=M>>>0,M=e[4][1]+j,e[4][0]=e[4][0]+z+(M/4294967296>>>0)>>>0,e[4][1]=M>>>0,M=e[5][1]+ce,e[5][0]=e[5][0]+oe+(M/4294967296>>>0)>>>0,e[5][1]=M>>>0,M=e[6][1]+ge,e[6][0]=e[6][0]+de+(M/4294967296>>>0)>>>0,e[6][1]=M>>>0,M=e[7][1]+st,e[7][0]=e[7][0]+$e+(M/4294967296>>>0)>>>0,e[7][1]=M>>>0,Ae-=128}}});var ao=F(Rn=>{var Df=$();gt();var we=Df.asn1;Rn.privateKeyValidator={name:"PrivateKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:we.Class.UNIVERSAL,type:we.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};Rn.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:we.Class.UNIVERSAL,type:we.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:we.Class.UNIVERSAL,type:we.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:we.Class.UNIVERSAL,type:we.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var vo=F((mg,yo)=>{var Re=$();Dr();ot();Nn();ne();var co=ao(),Uf=co.publicKeyValidator,Pf=co.privateKeyValidator;typeof no>"u"&&(no=Re.jsbn.BigInteger);var no,kn=Re.util.ByteBuffer,Ze=typeof Buffer>"u"?Uint8Array:Buffer;Re.pki=Re.pki||{};yo.exports=Re.pki.ed25519=Re.ed25519=Re.ed25519||{};var J=Re.ed25519;J.constants={};J.constants.PUBLIC_KEY_BYTE_LENGTH=32;J.constants.PRIVATE_KEY_BYTE_LENGTH=64;J.constants.SEED_BYTE_LENGTH=32;J.constants.SIGN_BYTE_LENGTH=64;J.constants.HASH_BYTE_LENGTH=64;J.generateKeyPair=function(e){e=e||{};var t=e.seed;if(t===void 0)t=Re.random.getBytesSync(J.constants.SEED_BYTE_LENGTH);else if(typeof t=="string"){if(t.length!==J.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+J.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(t instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');t=Rt({message:t,encoding:"binary"});for(var a=new Ze(J.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Ze(J.constants.PRIVATE_KEY_BYTE_LENGTH),n=0;n<32;++n)r[n]=t[n];return Mf(a,r),{publicKey:a,privateKey:r}};J.privateKeyFromAsn1=function(e){var t={},a=[],r=Re.asn1.validate(e,Pf,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var i=Re.asn1.derToOid(t.privateKeyOid),s=Re.oids.EdDSA25519;if(i!==s)throw new Error('Invalid OID "'+i+'"; OID must be "'+s+'".');var o=t.privateKey,u=Rt({message:Re.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:u}};J.publicKeyFromAsn1=function(e){var t={},a=[],r=Re.asn1.validate(e,Uf,t,a);if(!r){var n=new Error("Invalid Key.");throw n.errors=a,n}var i=Re.asn1.derToOid(t.publicKeyOid),s=Re.oids.EdDSA25519;if(i!==s)throw new Error('Invalid OID "'+i+'"; OID must be "'+s+'".');var o=t.ed25519PublicKey;if(o.length!==J.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Rt({message:o,encoding:"binary"})};J.publicKeyFromPrivateKey=function(e){e=e||{};var t=Rt({message:e.privateKey,encoding:"binary"});if(t.length!==J.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+J.constants.PRIVATE_KEY_BYTE_LENGTH);for(var a=new Ze(J.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r<a.length;++r)a[r]=t[32+r];return a};J.sign=function(e){e=e||{};var t=Rt(e),a=Rt({message:e.privateKey,encoding:"binary"});if(a.length===J.constants.SEED_BYTE_LENGTH){var r=J.generateKeyPair({seed:a});a=r.privateKey}else if(a.length!==J.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+J.constants.SEED_BYTE_LENGTH+" or "+J.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length);Kf(n,t,t.length,a);for(var i=new Ze(J.constants.SIGN_BYTE_LENGTH),s=0;s<i.length;++s)i[s]=n[s];return i};J.verify=function(e){e=e||{};var t=Rt(e);if(e.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var a=Rt({message:e.signature,encoding:"binary"});if(a.length!==J.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+J.constants.SIGN_BYTE_LENGTH);var r=Rt({message:e.publicKey,encoding:"binary"});if(r.length!==J.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+J.constants.PUBLIC_KEY_BYTE_LENGTH);var n=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length),i=new Ze(J.constants.SIGN_BYTE_LENGTH+t.length),s;for(s=0;s<J.constants.SIGN_BYTE_LENGTH;++s)n[s]=a[s];for(s=0;s<t.length;++s)n[s+J.constants.SIGN_BYTE_LENGTH]=t[s];return qf(i,n,n.length,r)>=0};function Rt(e){var t=e.message;if(t instanceof Uint8Array||t instanceof Ze)return t;var a=e.encoding;if(t===void 0)if(e.md)t=e.md.digest().getBytes(),a="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof t=="string"&&!a)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof t=="string"){if(typeof Buffer<"u")return Buffer.from(t,a);t=new kn(t,a)}else if(!(t instanceof kn))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var r=new Ze(t.length()),n=0;n<r.length;++n)r[n]=t.at(n);return r}var Dn=H(),Ta=H([1]),Of=H([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Vf=H([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),io=H([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),so=H([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),Fr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),Ff=H([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Mr(e,t){var a=Re.md.sha512.create(),r=new kn(e);a.update(r.getBytes(t),"binary");var n=a.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(n,"binary");for(var i=new Ze(J.constants.HASH_BYTE_LENGTH),s=0;s<64;++s)i[s]=n.charCodeAt(s);return i}function Mf(e,t){var a=[H(),H(),H(),H()],r,n=Mr(t,32);for(n[0]&=248,n[31]&=127,n[31]|=64,Vn(a,n),On(e,a),r=0;r<32;++r)t[r+32]=e[r];return 0}function Kf(e,t,a,r){var n,i,s=new Float64Array(64),o=[H(),H(),H(),H()],u=Mr(r,32);u[0]&=248,u[31]&=127,u[31]|=64;var c=a+64;for(n=0;n<a;++n)e[64+n]=t[n];for(n=0;n<32;++n)e[32+n]=u[32+n];var l=Mr(e.subarray(32),a+32);for(Un(l),Vn(o,l),On(e,o),n=32;n<64;++n)e[n]=r[n];var f=Mr(e,a+64);for(Un(f),n=32;n<64;++n)s[n]=0;for(n=0;n<32;++n)s[n]=l[n];for(n=0;n<32;++n)for(i=0;i<32;i++)s[n+i]+=f[n]*u[i];return lo(e.subarray(32),s),c}function qf(e,t,a,r){var n,i,s=new Ze(32),o=[H(),H(),H(),H()],u=[H(),H(),H(),H()];if(i=-1,a<64||Gf(u,r)||!Hf(t,32))return-1;for(n=0;n<a;++n)e[n]=t[n];for(n=0;n<32;++n)e[n+32]=r[n];var c=Mr(e,a);if(Un(c),po(o,u,c),Vn(u,t.subarray(32)),Pn(o,u),On(s,o),a-=64,fo(t,0,s,0)){for(n=0;n<a;++n)e[n]=0;return-1}for(n=0;n<a;++n)e[n]=t[n+64];return i=a,i}function Hf(e,t){var a;for(a=31;a>=0;--a){if(e[t+a]<Fr[a])return!0;if(e[t+a]>Fr[a])return!1}return!1}function lo(e,t){var a,r,n,i;for(r=63;r>=32;--r){for(a=0,n=r-32,i=r-12;n<i;++n)t[n]+=a-16*t[r]*Fr[n-(r-32)],a=t[n]+128>>8,t[n]-=a*256;t[n]+=a,t[r]=0}for(a=0,n=0;n<32;++n)t[n]+=a-(t[31]>>4)*Fr[n],a=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=a*Fr[n];for(r=0;r<32;++r)t[r+1]+=t[r]>>8,e[r]=t[r]&255}function Un(e){for(var t=new Float64Array(64),a=0;a<64;++a)t[a]=e[a],e[a]=0;lo(e,t)}function Pn(e,t){var a=H(),r=H(),n=H(),i=H(),s=H(),o=H(),u=H(),c=H(),l=H();Sr(a,e[1],e[0]),Sr(l,t[1],t[0]),fe(a,a,l),xr(r,e[0],e[1]),xr(l,t[0],t[1]),fe(r,r,l),fe(n,e[3],t[3]),fe(n,n,Vf),fe(i,e[2],t[2]),xr(i,i,i),Sr(s,r,a),Sr(o,i,n),xr(u,i,n),xr(c,r,a),fe(e[0],s,o),fe(e[1],c,u),fe(e[2],u,o),fe(e[3],s,c)}function oo(e,t,a){for(var r=0;r<4;++r)go(e[r],t[r],a)}function On(e,t){var a=H(),r=H(),n=H();jf(n,t[2]),fe(a,t[0],n),fe(r,t[1],n),Aa(e,r),e[31]^=ho(a)<<7}function Aa(e,t){var a,r,n,i=H(),s=H();for(a=0;a<16;++a)s[a]=t[a];for(Ln(s),Ln(s),Ln(s),r=0;r<2;++r){for(i[0]=s[0]-65517,a=1;a<15;++a)i[a]=s[a]-65535-(i[a-1]>>16&1),i[a-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),n=i[15]>>16&1,i[14]&=65535,go(s,i,1-n)}for(a=0;a<16;a++)e[2*a]=s[a]&255,e[2*a+1]=s[a]>>8}function Gf(e,t){var a=H(),r=H(),n=H(),i=H(),s=H(),o=H(),u=H();return zt(e[2],Ta),zf(e[1],t),nr(n,e[1]),fe(i,n,Of),Sr(n,n,e[2]),xr(i,e[2],i),nr(s,i),nr(o,s),fe(u,o,s),fe(a,u,n),fe(a,a,i),Qf(a,a),fe(a,a,n),fe(a,a,i),fe(a,a,i),fe(e[0],a,i),nr(r,e[0]),fe(r,r,i),uo(r,n)&&fe(e[0],e[0],Ff),nr(r,e[0]),fe(r,r,i),uo(r,n)?-1:(ho(e[0])===t[31]>>7&&Sr(e[0],Dn,e[0]),fe(e[3],e[0],e[1]),0)}function zf(e,t){var a;for(a=0;a<16;++a)e[a]=t[2*a]+(t[2*a+1]<<8);e[15]&=32767}function Qf(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=250;r>=0;--r)nr(a,a),r!==1&&fe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function uo(e,t){var a=new Ze(32),r=new Ze(32);return Aa(a,e),Aa(r,t),fo(a,0,r,0)}function fo(e,t,a,r){return $f(e,t,a,r,32)}function $f(e,t,a,r,n){var i,s=0;for(i=0;i<n;++i)s|=e[t+i]^a[r+i];return(1&s-1>>>8)-1}function ho(e){var t=new Ze(32);return Aa(t,e),t[0]&1}function po(e,t,a){var r,n;for(zt(e[0],Dn),zt(e[1],Ta),zt(e[2],Ta),zt(e[3],Dn),n=255;n>=0;--n)r=a[n/8|0]>>(n&7)&1,oo(e,t,r),Pn(t,e),Pn(e,e),oo(e,t,r)}function Vn(e,t){var a=[H(),H(),H(),H()];zt(a[0],io),zt(a[1],so),zt(a[2],Ta),fe(a[3],io,so),po(e,a,t)}function zt(e,t){var a;for(a=0;a<16;a++)e[a]=t[a]|0}function jf(e,t){var a=H(),r;for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)nr(a,a),r!==2&&r!==4&&fe(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}function Ln(e){var t,a,r=1;for(t=0;t<16;++t)a=e[t]+r+65535,r=Math.floor(a/65536),e[t]=a-r*65536;e[0]+=r-1+37*(r-1)}function go(e,t,a){for(var r,n=~(a-1),i=0;i<16;++i)r=n&(e[i]^t[i]),e[i]^=r,t[i]^=r}function H(e){var t,a=new Float64Array(16);if(e)for(t=0;t<e.length;++t)a[t]=e[t];return a}function xr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]+a[r]}function Sr(e,t,a){for(var r=0;r<16;++r)e[r]=t[r]-a[r]}function nr(e,t){fe(e,t,t)}function fe(e,t,a){var r,n,i=0,s=0,o=0,u=0,c=0,l=0,f=0,p=0,v=0,y=0,m=0,x=0,T=0,B=0,b=0,P=0,R=0,L=0,z=0,j=0,oe=0,ce=0,de=0,ge=0,$e=0,st=0,le=0,Ee=0,M=0,jt=0,or=0,xe=a[0],Se=a[1],Ae=a[2],ke=a[3],De=a[4],Ue=a[5],Pe=a[6],Oe=a[7],Ve=a[8],Fe=a[9],Me=a[10],Ke=a[11],qe=a[12],He=a[13],Ge=a[14],ze=a[15];r=t[0],i+=r*xe,s+=r*Se,o+=r*Ae,u+=r*ke,c+=r*De,l+=r*Ue,f+=r*Pe,p+=r*Oe,v+=r*Ve,y+=r*Fe,m+=r*Me,x+=r*Ke,T+=r*qe,B+=r*He,b+=r*Ge,P+=r*ze,r=t[1],s+=r*xe,o+=r*Se,u+=r*Ae,c+=r*ke,l+=r*De,f+=r*Ue,p+=r*Pe,v+=r*Oe,y+=r*Ve,m+=r*Fe,x+=r*Me,T+=r*Ke,B+=r*qe,b+=r*He,P+=r*Ge,R+=r*ze,r=t[2],o+=r*xe,u+=r*Se,c+=r*Ae,l+=r*ke,f+=r*De,p+=r*Ue,v+=r*Pe,y+=r*Oe,m+=r*Ve,x+=r*Fe,T+=r*Me,B+=r*Ke,b+=r*qe,P+=r*He,R+=r*Ge,L+=r*ze,r=t[3],u+=r*xe,c+=r*Se,l+=r*Ae,f+=r*ke,p+=r*De,v+=r*Ue,y+=r*Pe,m+=r*Oe,x+=r*Ve,T+=r*Fe,B+=r*Me,b+=r*Ke,P+=r*qe,R+=r*He,L+=r*Ge,z+=r*ze,r=t[4],c+=r*xe,l+=r*Se,f+=r*Ae,p+=r*ke,v+=r*De,y+=r*Ue,m+=r*Pe,x+=r*Oe,T+=r*Ve,B+=r*Fe,b+=r*Me,P+=r*Ke,R+=r*qe,L+=r*He,z+=r*Ge,j+=r*ze,r=t[5],l+=r*xe,f+=r*Se,p+=r*Ae,v+=r*ke,y+=r*De,m+=r*Ue,x+=r*Pe,T+=r*Oe,B+=r*Ve,b+=r*Fe,P+=r*Me,R+=r*Ke,L+=r*qe,z+=r*He,j+=r*Ge,oe+=r*ze,r=t[6],f+=r*xe,p+=r*Se,v+=r*Ae,y+=r*ke,m+=r*De,x+=r*Ue,T+=r*Pe,B+=r*Oe,b+=r*Ve,P+=r*Fe,R+=r*Me,L+=r*Ke,z+=r*qe,j+=r*He,oe+=r*Ge,ce+=r*ze,r=t[7],p+=r*xe,v+=r*Se,y+=r*Ae,m+=r*ke,x+=r*De,T+=r*Ue,B+=r*Pe,b+=r*Oe,P+=r*Ve,R+=r*Fe,L+=r*Me,z+=r*Ke,j+=r*qe,oe+=r*He,ce+=r*Ge,de+=r*ze,r=t[8],v+=r*xe,y+=r*Se,m+=r*Ae,x+=r*ke,T+=r*De,B+=r*Ue,b+=r*Pe,P+=r*Oe,R+=r*Ve,L+=r*Fe,z+=r*Me,j+=r*Ke,oe+=r*qe,ce+=r*He,de+=r*Ge,ge+=r*ze,r=t[9],y+=r*xe,m+=r*Se,x+=r*Ae,T+=r*ke,B+=r*De,b+=r*Ue,P+=r*Pe,R+=r*Oe,L+=r*Ve,z+=r*Fe,j+=r*Me,oe+=r*Ke,ce+=r*qe,de+=r*He,ge+=r*Ge,$e+=r*ze,r=t[10],m+=r*xe,x+=r*Se,T+=r*Ae,B+=r*ke,b+=r*De,P+=r*Ue,R+=r*Pe,L+=r*Oe,z+=r*Ve,j+=r*Fe,oe+=r*Me,ce+=r*Ke,de+=r*qe,ge+=r*He,$e+=r*Ge,st+=r*ze,r=t[11],x+=r*xe,T+=r*Se,B+=r*Ae,b+=r*ke,P+=r*De,R+=r*Ue,L+=r*Pe,z+=r*Oe,j+=r*Ve,oe+=r*Fe,ce+=r*Me,de+=r*Ke,ge+=r*qe,$e+=r*He,st+=r*Ge,le+=r*ze,r=t[12],T+=r*xe,B+=r*Se,b+=r*Ae,P+=r*ke,R+=r*De,L+=r*Ue,z+=r*Pe,j+=r*Oe,oe+=r*Ve,ce+=r*Fe,de+=r*Me,ge+=r*Ke,$e+=r*qe,st+=r*He,le+=r*Ge,Ee+=r*ze,r=t[13],B+=r*xe,b+=r*Se,P+=r*Ae,R+=r*ke,L+=r*De,z+=r*Ue,j+=r*Pe,oe+=r*Oe,ce+=r*Ve,de+=r*Fe,ge+=r*Me,$e+=r*Ke,st+=r*qe,le+=r*He,Ee+=r*Ge,M+=r*ze,r=t[14],b+=r*xe,P+=r*Se,R+=r*Ae,L+=r*ke,z+=r*De,j+=r*Ue,oe+=r*Pe,ce+=r*Oe,de+=r*Ve,ge+=r*Fe,$e+=r*Me,st+=r*Ke,le+=r*qe,Ee+=r*He,M+=r*Ge,jt+=r*ze,r=t[15],P+=r*xe,R+=r*Se,L+=r*Ae,z+=r*ke,j+=r*De,oe+=r*Ue,ce+=r*Pe,de+=r*Oe,ge+=r*Ve,$e+=r*Fe,st+=r*Me,le+=r*Ke,Ee+=r*qe,M+=r*He,jt+=r*Ge,or+=r*ze,i+=38*R,s+=38*L,o+=38*z,u+=38*j,c+=38*oe,l+=38*ce,f+=38*de,p+=38*ge,v+=38*$e,y+=38*st,m+=38*le,x+=38*Ee,T+=38*M,B+=38*jt,b+=38*or,n=1,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=p+n+65535,n=Math.floor(r/65536),p=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=T+n+65535,n=Math.floor(r/65536),T=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=P+n+65535,n=Math.floor(r/65536),P=r-n*65536,i+=n-1+37*(n-1),n=1,r=i+n+65535,n=Math.floor(r/65536),i=r-n*65536,r=s+n+65535,n=Math.floor(r/65536),s=r-n*65536,r=o+n+65535,n=Math.floor(r/65536),o=r-n*65536,r=u+n+65535,n=Math.floor(r/65536),u=r-n*65536,r=c+n+65535,n=Math.floor(r/65536),c=r-n*65536,r=l+n+65535,n=Math.floor(r/65536),l=r-n*65536,r=f+n+65535,n=Math.floor(r/65536),f=r-n*65536,r=p+n+65535,n=Math.floor(r/65536),p=r-n*65536,r=v+n+65535,n=Math.floor(r/65536),v=r-n*65536,r=y+n+65535,n=Math.floor(r/65536),y=r-n*65536,r=m+n+65535,n=Math.floor(r/65536),m=r-n*65536,r=x+n+65535,n=Math.floor(r/65536),x=r-n*65536,r=T+n+65535,n=Math.floor(r/65536),T=r-n*65536,r=B+n+65535,n=Math.floor(r/65536),B=r-n*65536,r=b+n+65535,n=Math.floor(r/65536),b=r-n*65536,r=P+n+65535,n=Math.floor(r/65536),P=r-n*65536,i+=n-1+37*(n-1),e[0]=i,e[1]=s,e[2]=o,e[3]=u,e[4]=c,e[5]=l,e[6]=f,e[7]=p,e[8]=v,e[9]=y,e[10]=m,e[11]=x,e[12]=T,e[13]=B,e[14]=b,e[15]=P}});var xo=F((Cg,Eo)=>{var rt=$();ne();ot();Dr();Eo.exports=rt.kem=rt.kem||{};var mo=rt.jsbn.BigInteger;rt.kem.rsa={};rt.kem.rsa.create=function(e,t){t=t||{};var a=t.prng||rt.random,r={};return r.encrypt=function(n,i){var s=Math.ceil(n.n.bitLength()/8),o;do o=new mo(rt.util.bytesToHex(a.getBytesSync(s)),16).mod(n.n);while(o.compareTo(mo.ONE)<=0);o=rt.util.hexToBytes(o.toString(16));var u=s-o.length;u>0&&(o=rt.util.fillString("\0",u)+o);var c=n.encrypt(o,"NONE"),l=e.generate(o,i);return{encapsulation:c,key:l}},r.decrypt=function(n,i,s){var o=n.decrypt(i,"NONE");return e.generate(o,s)},r};rt.kem.kdf1=function(e,t){Co(this,e,0,t||e.digestLength)};rt.kem.kdf2=function(e,t){Co(this,e,1,t||e.digestLength)};function Co(e,t,a,r){e.generate=function(n,i){for(var s=new rt.util.ByteBuffer,o=Math.ceil(i/r)+a,u=new rt.util.ByteBuffer,c=a;c<o;++c){u.putInt32(c),t.start(),t.update(n+u.getBytes());var l=t.digest();s.putBytes(l.getBytes(r))}return s.truncate(s.length()-i),s.getBytes()}}});var Io=F((Eg,Ao)=>{var Z=$();ne();Ao.exports=Z.log=Z.log||{};Z.log.levels=["none","error","warning","info","debug","verbose","max"];var Ia={},Kn=[],qr=null;Z.log.LEVEL_LOCKED=2;Z.log.NO_LEVEL_CHECK=4;Z.log.INTERPOLATE=8;for(It=0;It<Z.log.levels.length;++It)Fn=Z.log.levels[It],Ia[Fn]={index:It,name:Fn.toUpperCase()};var Fn,It;Z.log.logMessage=function(e){for(var t=Ia[e.level].index,a=0;a<Kn.length;++a){var r=Kn[a];if(r.flags&Z.log.NO_LEVEL_CHECK)r.f(e);else{var n=Ia[r.level].index;t<=n&&r.f(r,e)}}};Z.log.prepareStandard=function(e){"standard"in e||(e.standard=Ia[e.level].name+" ["+e.category+"] "+e.message)};Z.log.prepareFull=function(e){if(!("full"in e)){var t=[e.message];t=t.concat([]),e.full=Z.util.format.apply(this,t)}};Z.log.prepareStandardFull=function(e){"standardFull"in e||(Z.log.prepareStandard(e),e.standardFull=e.standard)};for(Mn=["error","warning","info","debug","verbose"],It=0;It<Mn.length;++It)(function(t){Z.log[t]=function(a,r){var n=Array.prototype.slice.call(arguments).slice(2),i={timestamp:new Date,level:t,category:a,message:r,arguments:n};Z.log.logMessage(i)}})(Mn[It]);var Mn,It;Z.log.makeLogger=function(e){var t={flags:0,f:e};return Z.log.setLevel(t,"none"),t};Z.log.setLevel=function(e,t){var a=!1;if(e&&!(e.flags&Z.log.LEVEL_LOCKED))for(var r=0;r<Z.log.levels.length;++r){var n=Z.log.levels[r];if(t==n){e.level=t,a=!0;break}}return a};Z.log.lock=function(e,t){typeof t>"u"||t?e.flags|=Z.log.LEVEL_LOCKED:e.flags&=~Z.log.LEVEL_LOCKED};Z.log.addLogger=function(e){Kn.push(e)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(So={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Hr=function(e,t){Z.log.prepareStandard(t);var a=So[t.level],r=[t.standard];r=r.concat(t.arguments.slice()),a.apply(console,r)},Tr=Z.log.makeLogger(Hr)):(Hr=function(t,a){Z.log.prepareStandardFull(a),console.log(a.standardFull)},Tr=Z.log.makeLogger(Hr)),Z.log.setLevel(Tr,"debug"),Z.log.addLogger(Tr),qr=Tr):console={log:function(){}};var Tr,So,Hr;qr!==null&&typeof window<"u"&&window.location&&(Kr=new URL(window.location.href).searchParams,Kr.has("console.level")&&Z.log.setLevel(qr,Kr.get("console.level").slice(-1)[0]),Kr.has("console.lock")&&(To=Kr.get("console.lock").slice(-1)[0],To=="true"&&Z.log.lock(qr)));var Kr,To;Z.log.consoleLogger=qr});var bo=F((xg,Bo)=>{Bo.exports=vt();na();yr();en();Nn()});var No=F((Sg,_o)=>{var D=$();Ot();gt();Lr();Vt();Xt();gn();ot();ne();ma();var E=D.asn1,Xe=_o.exports=D.pkcs7=D.pkcs7||{};Xe.messageFromPem=function(e){var t=D.pem.decode(e)[0];if(t.type!=="PKCS7"){var a=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw a.headerType=t.type,a}if(t.procType&&t.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=E.fromDer(t.body);return Xe.messageFromAsn1(r)};Xe.messageToPem=function(e,t){var a={type:"PKCS7",body:E.toDer(e.toAsn1()).getBytes()};return D.pem.encode(a,{maxline:t})};Xe.messageFromAsn1=function(e){var t={},a=[];if(!E.validate(e,Xe.asn1.contentInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=a,r}var n=E.derToOid(t.contentType),i;switch(n){case D.pki.oids.envelopedData:i=Xe.createEnvelopedData();break;case D.pki.oids.encryptedData:i=Xe.createEncryptedData();break;case D.pki.oids.signedData:i=Xe.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+n+" is not (yet) supported.")}return i.fromAsn1(t.content.value[0]),i};Xe.createSignedData=function(){var e=null;return e={type:D.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(Hn(e,r,Xe.asn1.signedDataValidator),e.certificates=[],e.crls=[],e.digestAlgorithmIdentifiers=[],e.contentInfo=null,e.signerInfos=[],e.rawCapture.certificates)for(var n=e.rawCapture.certificates.value,i=0;i<n.length;++i)e.certificates.push(D.pki.certificateFromAsn1(n[i]))},toAsn1:function(){e.contentInfo||e.sign();for(var r=[],n=0;n<e.certificates.length;++n)r.push(D.pki.certificateToAsn1(e.certificates[n]));var i=[],s=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,e.digestAlgorithmIdentifiers),e.contentInfo])]);return r.length>0&&s.value[0].value.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!0,r)),i.length>0&&s.value[0].value.push(E.create(E.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(E.create(E.Class.UNIVERSAL,E.Type.SET,!0,e.signerInfos)),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),s])},addSigner:function(r){var n=r.issuer,i=r.serialNumber;if(r.certificate){var s=r.certificate;typeof s=="string"&&(s=D.pki.certificateFromPem(s)),n=s.issuer.attributes,i=s.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=D.pki.privateKeyFromPem(o));var u=r.digestAlgorithm||D.pki.oids.sha1;switch(u){case D.pki.oids.sha1:case D.pki.oids.sha256:case D.pki.oids.sha384:case D.pki.oids.sha512:case D.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+u)}var c=r.authenticatedAttributes||[];if(c.length>0){for(var l=!1,f=!1,p=0;p<c.length;++p){var v=c[p];if(!l&&v.type===D.pki.oids.contentType){if(l=!0,f)break;continue}if(!f&&v.type===D.pki.oids.messageDigest){if(f=!0,l)break;continue}}if(!l||!f)throw new Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}e.signers.push({key:o,version:1,issuer:n,serialNumber:i,digestAlgorithm:u,signatureAlgorithm:D.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(r){if(r=r||{},(typeof e.content!="object"||e.contentInfo===null)&&(e.contentInfo=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(D.pki.oids.data).getBytes())]),"content"in e)){var n;e.content instanceof D.util.ByteBuffer?n=e.content.bytes():typeof e.content=="string"&&(n=D.util.encodeUtf8(e.content)),r.detached?e.detachedContent=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,n):e.contentInfo.value.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,n)]))}if(e.signers.length!==0){var i=t();a(i)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(r){typeof r=="string"&&(r=D.pki.certificateFromPem(r)),e.certificates.push(r)},addCertificateRevokationList:function(r){throw new Error("PKCS#7 CRL support not yet implemented.")}},e;function t(){for(var r={},n=0;n<e.signers.length;++n){var i=e.signers[n],s=i.digestAlgorithm;s in r||(r[s]=D.md[D.pki.oids[s]].create()),i.authenticatedAttributes.length===0?i.md=r[s]:i.md=D.md[D.pki.oids[s]].create()}e.digestAlgorithmIdentifiers=[];for(var s in r)e.digestAlgorithmIdentifiers.push(E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(s).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")]));return r}function a(r){var n;if(e.detachedContent?n=e.detachedContent:(n=e.contentInfo.value[1],n=n.value[0]),!n)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var i=E.derToOid(e.contentInfo.value[0].value),s=E.toDer(n);s.getByte(),E.getBerValueLength(s),s=s.getBytes();for(var o in r)r[o].start().update(s);for(var u=new Date,c=0;c<e.signers.length;++c){var l=e.signers[c];if(l.authenticatedAttributes.length===0){if(i!==D.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{l.authenticatedAttributesAsn1=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var f=E.create(E.Class.UNIVERSAL,E.Type.SET,!0,[]),p=0;p<l.authenticatedAttributes.length;++p){var v=l.authenticatedAttributes[p];v.type===D.pki.oids.messageDigest?v.value=r[l.digestAlgorithm].digest():v.type===D.pki.oids.signingTime&&(v.value||(v.value=u)),f.value.push(qn(v)),l.authenticatedAttributesAsn1.value.push(qn(v))}s=E.toDer(f).getBytes(),l.md.start().update(s)}l.signature=l.key.sign(l.md,"RSASSA-PKCS1-V1_5")}e.signerInfos=ed(e.signers)}};Xe.createEncryptedData=function(){var e=null;return e={type:D.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){Hn(e,t,Xe.asn1.encryptedDataValidator)},decrypt:function(t){t!==void 0&&(e.encryptedContent.key=t),wo(e)}},e};Xe.createEnvelopedData=function(){var e=null;return e={type:D.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:D.pki.oids["aes256-CBC"]},fromAsn1:function(t){var a=Hn(e,t,Xe.asn1.envelopedDataValidator);e.recipients=Xf(a.recipientInfos.value)},toAsn1:function(){return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,Jf(e.recipients)),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,td(e.encryptedContent))])])])},findRecipient:function(t){for(var a=t.issuer.attributes,r=0;r<e.recipients.length;++r){var n=e.recipients[r],i=n.issuer;if(n.serialNumber===t.serialNumber&&i.length===a.length){for(var s=!0,o=0;o<a.length;++o)if(i[o].type!==a[o].type||i[o].value!==a[o].value){s=!1;break}if(s)return n}}return null},decrypt:function(t,a){if(e.encryptedContent.key===void 0&&t!==void 0&&a!==void 0)switch(t.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:case D.pki.oids.desCBC:var r=a.decrypt(t.encryptedContent.content);e.encryptedContent.key=D.util.createBuffer(r);break;default:throw new Error("Unsupported asymmetric cipher, OID "+t.encryptedContent.algorithm)}wo(e)},addRecipient:function(t){e.recipients.push({version:0,issuer:t.issuer.attributes,serialNumber:t.serialNumber,encryptedContent:{algorithm:D.pki.oids.rsaEncryption,key:t.publicKey}})},encrypt:function(t,a){if(e.encryptedContent.content===void 0){a=a||e.encryptedContent.algorithm,t=t||e.encryptedContent.key;var r,n,i;switch(a){case D.pki.oids["aes128-CBC"]:r=16,n=16,i=D.aes.createEncryptionCipher;break;case D.pki.oids["aes192-CBC"]:r=24,n=16,i=D.aes.createEncryptionCipher;break;case D.pki.oids["aes256-CBC"]:r=32,n=16,i=D.aes.createEncryptionCipher;break;case D.pki.oids["des-EDE3-CBC"]:r=24,n=8,i=D.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+a)}if(t===void 0)t=D.util.createBuffer(D.random.getBytes(r));else if(t.length()!=r)throw new Error("Symmetric key has wrong length; got "+t.length()+" bytes, expected "+r+".");e.encryptedContent.algorithm=a,e.encryptedContent.key=t,e.encryptedContent.parameter=D.util.createBuffer(D.random.getBytes(n));var s=i(t);if(s.start(e.encryptedContent.parameter.copy()),s.update(e.content),!s.finish())throw new Error("Symmetric encryption failed.");e.encryptedContent.content=s.output}for(var o=0;o<e.recipients.length;++o){var u=e.recipients[o];if(u.encryptedContent.content===void 0)switch(u.encryptedContent.algorithm){case D.pki.oids.rsaEncryption:u.encryptedContent.content=u.encryptedContent.key.encrypt(e.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+u.encryptedContent.algorithm)}}}},e};function Yf(e){var t={},a=[];if(!E.validate(e,Xe.asn1.recipientInfoValidator,t,a)){var r=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw r.errors=a,r}return{version:t.version.charCodeAt(0),issuer:D.pki.RDNAttributesAsArray(t.issuer),serialNumber:D.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:E.derToOid(t.encAlgorithm),parameter:t.encParameter?t.encParameter.value:void 0,content:t.encKey}}}function Wf(e){return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.encryptedContent.algorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")]),E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.encryptedContent.content)])}function Xf(e){for(var t=[],a=0;a<e.length;++a)t.push(Yf(e[a]));return t}function Jf(e){for(var t=[],a=0;a<e.length;++a)t.push(Wf(e[a]));return t}function Zf(e){var t=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.version).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[D.pki.distinguishedNameToAsn1({attributes:e.issuer}),E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,D.util.hexToBytes(e.serialNumber))]),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.digestAlgorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])]);if(e.authenticatedAttributesAsn1&&t.value.push(e.authenticatedAttributesAsn1),t.value.push(E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.signatureAlgorithm).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])),t.value.push(E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.signature)),e.unauthenticatedAttributes.length>0){for(var a=E.create(E.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r<e.unauthenticatedAttributes.length;++r){var n=e.unauthenticatedAttributes[r];a.values.push(qn(n))}t.value.push(a)}return t}function ed(e){for(var t=[],a=0;a<e.length;++a)t.push(Zf(e[a]));return t}function qn(e){var t;if(e.type===D.pki.oids.contentType)t=E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.value).getBytes());else if(e.type===D.pki.oids.messageDigest)t=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.value.bytes());else if(e.type===D.pki.oids.signingTime){var a=new Date("1950-01-01T00:00:00Z"),r=new Date("2050-01-01T00:00:00Z"),n=e.value;if(typeof n=="string"){var i=Date.parse(n);isNaN(i)?n.length===13?n=E.utcTimeToDate(n):n=E.generalizedTimeToDate(n):n=new Date(i)}n>=a&&n<r?t=E.create(E.Class.UNIVERSAL,E.Type.UTCTIME,!1,E.dateToUtcTime(n)):t=E.create(E.Class.UNIVERSAL,E.Type.GENERALIZEDTIME,!1,E.dateToGeneralizedTime(n))}return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.type).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SET,!0,[t])])}function td(e){return[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(D.pki.oids.data).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.algorithm).getBytes()),e.parameter?E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,e.content.getBytes())])]}function Hn(e,t,a){var r={},n=[];if(!E.validate(t,a,r,n)){var i=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw i.errors=i,i}var s=E.derToOid(r.contentType);if(s!==D.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(r.encryptedContent){var o="";if(D.util.isArray(r.encryptedContent))for(var u=0;u<r.encryptedContent.length;++u){if(r.encryptedContent[u].type!==E.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=r.encryptedContent[u].value}else o=r.encryptedContent;e.encryptedContent={algorithm:E.derToOid(r.encAlgorithm),parameter:D.util.createBuffer(r.encParameter.value),content:D.util.createBuffer(o)}}if(r.content){var o="";if(D.util.isArray(r.content))for(var u=0;u<r.content.length;++u){if(r.content[u].type!==E.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=r.content[u].value}else o=r.content;e.content=D.util.createBuffer(o)}return e.version=r.version.charCodeAt(0),e.rawCapture=r,r}function wo(e){if(e.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(e.content===void 0){var t;switch(e.encryptedContent.algorithm){case D.pki.oids["aes128-CBC"]:case D.pki.oids["aes192-CBC"]:case D.pki.oids["aes256-CBC"]:t=D.aes.createDecryptionCipher(e.encryptedContent.key);break;case D.pki.oids.desCBC:case D.pki.oids["des-EDE3-CBC"]:t=D.des.createDecryptionCipher(e.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+e.encryptedContent.algorithm)}if(t.start(e.encryptedContent.parameter),t.update(e.encryptedContent.content),!t.finish())throw new Error("Symmetric decryption failed.");e.content=t.output}}});var Lo=F((Tg,Ro)=>{var Te=$();Ot();dr();na();yr();ne();var ba=Ro.exports=Te.ssh=Te.ssh||{};ba.privateKeyToPutty=function(e,t,a){a=a||"",t=t||"";var r="ssh-rsa",n=t===""?"none":"aes256-cbc",i="PuTTY-User-Key-File-2: "+r+`\r
|
|
18
|
+
`;i+="Encryption: "+n+`\r
|
|
19
|
+
`,i+="Comment: "+a+`\r
|
|
20
|
+
`;var s=Te.util.createBuffer();Ar(s,r),Bt(s,e.e),Bt(s,e.n);var o=Te.util.encode64(s.bytes(),64),u=Math.floor(o.length/66)+1;i+="Public-Lines: "+u+`\r
|
|
21
|
+
`,i+=o;var c=Te.util.createBuffer();Bt(c,e.d),Bt(c,e.p),Bt(c,e.q),Bt(c,e.qInv);var l;if(!t)l=Te.util.encode64(c.bytes(),64);else{var f=c.length()+16-1;f-=f%16;var p=Ba(c.bytes());p.truncate(p.length()-f+c.length()),c.putBuffer(p);var v=Te.util.createBuffer();v.putBuffer(Ba("\0\0\0\0",t)),v.putBuffer(Ba("\0\0\0",t));var y=Te.aes.createEncryptionCipher(v.truncate(8),"CBC");y.start(Te.util.createBuffer().fillWithByte(0,16)),y.update(c.copy()),y.finish();var m=y.output;m.truncate(16),l=Te.util.encode64(m.bytes(),64)}u=Math.floor(l.length/66)+1,i+=`\r
|
|
22
22
|
Private-Lines: `+u+`\r
|
|
23
|
-
`,
|
|
23
|
+
`,i+=l;var x=Ba("putty-private-key-file-mac-key",t),T=Te.util.createBuffer();Ar(T,r),Ar(T,n),Ar(T,a),T.putInt32(s.length()),T.putBuffer(s),T.putInt32(c.length()),T.putBuffer(c);var B=Te.hmac.create();return B.start("sha1",x),B.update(T.bytes()),i+=`\r
|
|
24
24
|
Private-MAC: `+B.digest().toHex()+`\r
|
|
25
|
-
`,
|
|
25
|
+
`,i};ba.publicKeyToOpenSSH=function(e,t){var a="ssh-rsa";t=t||"";var r=Te.util.createBuffer();return Ar(r,a),Bt(r,e.e),Bt(r,e.n),a+" "+Te.util.encode64(r.bytes())+" "+t};ba.privateKeyToOpenSSH=function(e,t){return t?Te.pki.encryptRsaPrivateKey(e,t,{legacy:!0,algorithm:"aes128"}):Te.pki.privateKeyToPem(e)};ba.getPublicKeyFingerprint=function(e,t){t=t||{};var a=t.md||Te.md.md5.create(),r="ssh-rsa",n=Te.util.createBuffer();Ar(n,r),Bt(n,e.e),Bt(n,e.n),a.start(),a.update(n.getBytes());var i=a.digest();if(t.encoding==="hex"){var s=i.toHex();return t.delimiter?s.match(/.{2}/g).join(t.delimiter):s}else{if(t.encoding==="binary")return i.getBytes();if(t.encoding)throw new Error('Unknown encoding "'+t.encoding+'".')}return i};function Bt(e,t){var a=t.toString(16);a[0]>="8"&&(a="00"+a);var r=Te.util.hexToBytes(a);e.putInt32(r.length),e.putBytes(r)}function Ar(e,t){e.putInt32(t.length),e.putString(t)}function Ba(){for(var e=Te.md.sha1.create(),t=arguments.length,a=0;a<t;++a)e.update(arguments[a]);return e.digest()}});var Do=F((Ag,ko)=>{ko.exports=$();Ot();Js();gt();Xr();Lr();vo();dr();xo();Io();bo();yn();ua();Xt();ln();Cn();No();xn();dn();tn();ga();ot();nn();Lo();bn();ne()});var Vo=F((Ig,Oo)=>{var Uo=require("path"),at=require("fs"),nt=Do(),{MITM_DIR:wa}=ur(),Qt=Uo.join(wa,"rootCA.key"),Lt=Uo.join(wa,"rootCA.crt");function Po(e){try{let t=nt.pki.certificateFromPem(at.readFileSync(e,"utf8")),a=new Date(Date.now()+720*60*60*1e3);return t.validity.notAfter<a}catch{return!0}}function rd(){let e=at.existsSync(Qt)&&at.existsSync(Lt);if(e&&!Po(Lt))return console.log("\u2705 Root CA already exists"),{key:Qt,cert:Lt};if(e){console.log("\u{1F510} Root CA expired or expiring soon \u2014 regenerating...");try{at.unlinkSync(Qt)}catch{}try{at.unlinkSync(Lt)}catch{}}at.existsSync(wa)||at.mkdirSync(wa,{recursive:!0}),console.log("\u{1F510} Generating Root CA certificate...");let t=nt.pki.rsa.generateKeyPair(2048),a=nt.pki.createCertificate();a.publicKey=t.publicKey,a.serialNumber="01",a.validity.notBefore=new Date,a.validity.notAfter=new Date,a.validity.notAfter.setFullYear(a.validity.notBefore.getFullYear()+10);let r=[{name:"commonName",value:"MiawRouter MITM Root CA"},{name:"organizationName",value:"MiawRouter"},{name:"countryName",value:"US"}];a.setSubject(r),a.setIssuer(r),a.setExtensions([{name:"basicConstraints",cA:!0,critical:!0},{name:"keyUsage",keyCertSign:!0,cRLSign:!0,critical:!0},{name:"subjectKeyIdentifier"}]),a.sign(t.privateKey,nt.md.sha256.create());let n=nt.pki.privateKeyToPem(t.privateKey),i=nt.pki.certificateToPem(a);return at.writeFileSync(Qt,n),at.writeFileSync(Lt,i),console.log("\u2705 Root CA generated successfully"),{key:Qt,cert:Lt}}function ad(){if(!at.existsSync(Qt)||!at.existsSync(Lt))throw new Error("Root CA not found. Generate it first.");let e=at.readFileSync(Qt,"utf8"),t=at.readFileSync(Lt,"utf8");return{key:nt.pki.privateKeyFromPem(e),cert:nt.pki.certificateFromPem(t)}}function nd(e,t){let a=nt.pki.rsa.generateKeyPair(2048),r=nt.pki.createCertificate();return r.publicKey=a.publicKey,r.serialNumber=Math.floor(Math.random()*1e6).toString(),r.validity.notBefore=new Date,r.validity.notAfter=new Date,r.validity.notAfter.setFullYear(r.validity.notBefore.getFullYear()+1),r.setSubject([{name:"commonName",value:e}]),r.setIssuer(t.cert.subject.attributes),r.setExtensions([{name:"basicConstraints",cA:!1},{name:"keyUsage",digitalSignature:!0,keyEncipherment:!0},{name:"extKeyUsage",serverAuth:!0,clientAuth:!0},{name:"subjectAltName",altNames:[{type:2,value:e},{type:2,value:`*.${e}`}]}]),r.sign(t.key,nt.md.sha256.create()),{key:nt.pki.privateKeyToPem(a.privateKey),cert:nt.pki.certificateToPem(r)}}Oo.exports={generateRootCA:rd,loadRootCA:ad,generateLeafCert:nd,isCertExpired:Po,ROOT_CA_CERT_PATH:Lt,ROOT_CA_KEY_PATH:Qt}});var Mo=F((_g,Fo)=>{var Bg=require("path"),bg=require("fs"),{MITM_DIR:wg}=ur(),{generateRootCA:id,loadRootCA:sd,generateLeafCert:od}=Vo();function ud(){return id()}function cd(e){try{let t=sd(),a=od(e,t);return{key:a.key,cert:a.cert}}catch(t){return console.error(`Failed to generate cert for ${e}:`,t.message),null}}Fo.exports={generateCert:ud,getCertForDomain:cd}});var Gn=F((Ng,Ho)=>{var Ko=require("fs"),ld=require("path"),{DATA_DIR:fd}=ur(),qo=ld.join(fd,"mitm","aliases.json");function dd(){try{return Ko.existsSync(qo)?JSON.parse(Ko.readFileSync(qo,"utf-8")):null}catch{return null}}function hd(e){return dd()?.[e]||null}Ho.exports={getMitmAlias:hd}});var Qo=F((Rg,zo)=>{"use strict";var Ir="2.8.1";function pd(e){return!e||typeof e!="object"||Array.isArray(e)?!1:String(e.ideName||"").toLowerCase()==="antigravity"||String(e.ideType||"").toUpperCase()==="ANTIGRAVITY"?!0:Object.prototype.hasOwnProperty.call(e,"ideVersion")}function Go(e,t){return typeof e!="string"||!e.includes("antigravity/")?e:e.replace(/antigravity\/[^\s]+/,`antigravity/${t}`)}function gd(e,t){let a={...t},r=Go(a["user-agent"],Ir),n=r!==a["user-agent"];n&&(a["user-agent"]=r);try{let i=JSON.parse(e.toString());return pd(i?.metadata)?(i.metadata.ideVersion=Ir,{bodyBuffer:Buffer.from(JSON.stringify(i)),headers:a,applied:!0,version:Ir}):{bodyBuffer:e,headers:a,applied:n,version:Ir}}catch{return{bodyBuffer:e,headers:a,applied:n,version:Ir}}}zo.exports={ANTIGRAVITY_IDE_VERSION:Ir,applyAntigravityIdeVersionOverride:gd,rewriteAntigravityUserAgent:Go}});var zr=F((kg,Yo)=>{var{log:Gr,err:Lg}=Dt(),$o="http://localhost:21128",yd=String(process.env.MITM_ROUTER_BASE||$o).trim().replace(/\/+$/,"")||$o,jo=process.env.ROUTER_API_KEY,vd=new Set(["host","content-length","connection","transfer-encoding","content-type","content-encoding","authorization","te","connect-content-encoding","connect-accept-encoding","connect-protocol-version"]);async function md(e,t="/v1/chat/completions",a={},r){let n={};for(let[s,o]of Object.entries(a))!s.startsWith(":")&&!vd.has(s.toLowerCase())&&(n[s]=o);return await fetch(`${yd}${t}`,{method:"POST",headers:{...n,"Content-Type":"application/json",...jo&&{Authorization:`Bearer ${jo}`}},body:JSON.stringify(e),signal:r})}async function Cd(e,t,a){let r=e.headers.get("content-type")||"application/json",n=e.status||200,i={"Content-Type":r,"Cache-Control":"no-cache",Connection:"keep-alive"};if(r.includes("text/event-stream")&&(i["X-Accel-Buffering"]="no"),t.writeHead(n,i),a&&a.writeHeader(e.status,Object.fromEntries(e.headers)),!e.body){let u=await e.text().catch(()=>"");a&&(a.writeChunk(u),a.end()),t.end(u);return}let s=e.body.getReader(),o=new TextDecoder;for(;;){let{done:u,value:c}=await s.read();if(u){a&&a.end(),t.end();break}a&&a.writeChunk(c),t.write(o.decode(c,{stream:!0}))}}async function Ed(e,t,a,r){let n=e.headers.get("content-type")||"application/json",i={"Content-Type":"text/event-stream","Cache-Control":"no-cache",Connection:"keep-alive"};i["X-Accel-Buffering"]="no";let s=e.status||200;if(t.writeHead(s,i),!e.body){t.end(await e.text().catch(()=>""));return}if(s<200||s>=300||!n.includes("text/event-stream")){t.end(await e.text().catch(()=>""));return}let o=e.body.getReader(),u=new TextDecoder("utf-8",{fatal:!1}),c="",l=p=>{typeof p=="string"||Buffer.isBuffer(p)||p instanceof Uint8Array?t.write(p):t.write(`data: ${JSON.stringify(p)}\r
|
|
26
26
|
\r
|
|
27
27
|
`)};for(;;){let{done:p,value:v}=await o.read();if(p)break;c+=u.decode(v,{stream:!0});let y=c.split(`
|
|
28
|
-
`);c=y.pop()||"";for(let m of y){let x=m.trim();if(!x||!x.startsWith("data:"))continue;let T=x.slice(5).trim();if(T!=="[DONE]"){process.env.DEBUG_MITM&&Gr(`[SSE in] ${T.slice(0,200)}`);try{let B=JSON.parse(T),b=a(B,r);if(b!=null){let P=Array.isArray(b)?b:[b];for(let R of P){if(process.env.DEBUG_MITM){let L=R.length||R.byteLength||0;Gr(`[write binary frame] (${L}B) first 20B: ${Array.from(R.slice(0,20)).join(",")}`)}l(R)}}}catch{}}}}let f=c.trim();if(f.startsWith("data:")&&f.slice(5).trim()!=="[DONE]")try{let p=a(JSON.parse(f.slice(5).trim()),r);if(p!=null)for(let v of Array.isArray(p)?p:[p])l(v)}catch(p){Gr(`[SSE transform] final chunk ignored: ${p.message}`)}try{let p=a(null,r);if(p!=null){let v=Array.isArray(p)?p:[p];for(let y of v)l(y)}}catch{}t.end()}async function xd(e,t,a,r){let n={"Content-Type":"application/vnd.amazon.eventstream","Cache-Control":"no-cache",Connection:"keep-alive"};if(t.writeHead(200,n),!e.body){t.end(await e.text().catch(()=>""));return}let
|
|
29
|
-
`);o=l.pop()||"";for(let f of l){let p=f.trim();if(!p||!p.startsWith("data:"))continue;let v=p.slice(5).trim();if(v!=="[DONE]"){process.env.DEBUG_MITM&&Gr(`[SSE in] ${v.slice(0,200)}`);try{let y=JSON.parse(v),m=a(y,r);if(m!=null){let x=Array.isArray(m)?m:[m];for(let T of x){if(process.env.DEBUG_MITM){let B=T.length||T.byteLength||0;Gr(`[write binary frame] (${B}B) first 20B: ${Array.from(T.slice(0,20)).join(",")}`)}t.write(Buffer.from(T))}}}catch{}}}}try{let u=a(null,r);if(u!=null){let c=Array.isArray(u)?u:[u];for(let l of c)t.write(l)}}catch{}t.end()}Yo.exports={fetchRouter:md,pipeSSE:Cd,pipeTransformedSSE:Ed,pipeTransformedEventStream:xd}});var Xo=F((Dg,Wo)=>{var{err:Sd}=Dt(),{fetchRouter:Td,pipeSSE:Ad}=zr(),Id={"/chat/completions":"/v1/chat/completions","/v1/messages":"/v1/messages","/responses":"/v1/responses"};function Bd(e){for(let[t,a]of Object.entries(Id))if(e.includes(t))return a;return"/v1/chat/completions"}async function bd(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let
|
|
30
|
-
[ERROR] ${
|
|
31
|
-
`),n.end()),
|
|
32
|
-
|
|
33
|
-
`)):(t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:
|
|
34
|
-
`)
|
|
35
|
-
`);
|
|
36
|
-
`)||"Tool completed successfully.",isError:!!ue(r,2),displayResult:e}}for(let r of[2,3,4,5,6]){let n=ue(t,r);if(!n)continue;let s=se(n),i=Qe(s,1)||"Cursor tool execution failed",o=r<=4?e:Y(2,ee,Y(1,ee,i));return{content:i,isError:!0,displayResult:o}}return{content:"Cursor tool returned an empty result.",isError:!1,displayResult:e}}function yh(e,t){try{let a=se(e),r=ue(a,2);if(!r)return null;let n=se(r);if(ue(n,1)!==t)return null;let s=ue(n,11);return s?gh(s):null}catch{return null}}function vh(){return ir(Y(2,ee,Y(10,ee,Buffer.alloc(0))))}function mh(e){try{let t=se(e),a=ue(t,2);return a?se(a).has(10):!1}catch{return!1}}function Ch(){return ir(Buffer.from("{}"),2)}function Eh(){return ir(Buffer.from(JSON.stringify({error:{code:"internal",message:"MiawRouter routing failed"}})),2)}cu.exports={parseFirstFrame:th,decodeRunRequest:uh,decodeAgentValue:Na,buildTextUpdate:ch,buildTurnEnd:lh,buildMcpToolStarted:dh,buildMcpToolCompleted:hh,buildMcpExecRequest:ph,decodeMcpExecResult:yh,buildRequestContextRequest:vh,isRequestContextResponse:mh,buildSuccessTrailer:Ch,buildErrorTrailer:Eh}});var Cu=F((Vg,mu)=>{var{getMitmAlias:xh}=Gn(),{fetchRouter:pu}=zr(),{log:fu,err:Sh}=Dt(),du=require("crypto"),{parseFirstFrame:gu,decodeRunRequest:Th,buildTextUpdate:Ah,buildTurnEnd:Ih,buildMcpToolStarted:Bh,buildMcpToolCompleted:bh,buildMcpExecRequest:wh,decodeMcpExecResult:_h,buildRequestContextRequest:Nh,isRequestContextResponse:Rh,buildSuccessTrailer:Lh,buildErrorTrailer:kh}=lu(),yu=1024*1024,Dh=1e4,Uh=3e3,Ph=300*1e3,hu=32;function Oh(e){return new Promise(t=>{let a=[],r=0,n=!1,s=()=>{n||(n=!0,clearTimeout(o),e.off("data",i),e.off("end",s),e.off("error",s),e.pause(),t(Buffer.concat(a)))},i=u=>{if(a.push(u),r+=u.length,r>=5){let l=5+Buffer.concat(a).readUInt32BE(1);(l>yu||r>=l)&&s()}},o=setTimeout(s,Dh);e.on("data",i),e.once("end",s),e.once("error",s)})}function Vh(e){try{let t=xh("cursor");return t?.[e]||(e==="composer-2.5"?t?.["composer-2.5-fast"]:null)||null}catch{return null}}function Fh(e){try{return JSON.parse(e)}catch{return null}}function Mh(e){e.headersSent||e.writeHead(200,{"Content-Type":"application/connect+proto","Cache-Control":"no-cache","connect-protocol-version":"1"})}function vu(e,t,a){return new Promise(r=>{let n=Buffer.alloc(0),s=!1,i=l=>{s||(s=!0,clearTimeout(c),e.off("data",u),e.off("end",o),e.off("error",o),r(l))},o=()=>i(!1),u=l=>{for(n=Buffer.concat([n,l]);n.length>=5;){let f=gu(n);if(!f)break;n=n.subarray(f.consumed);let p=t(f.payload);if(p)return i(p)}n.length>yu&&i(!1)},c=setTimeout(()=>i(null),a);e.on("data",u),e.once("end",o),e.once("error",o),e.resume()})}function Kh(e){return vu(e,Rh,Uh)}async function qh(e,t){if(!e.ok||!e.body)throw new Error(await e.text().catch(()=>"Cursor routing failed"));let a=e.body.getReader(),r=new TextDecoder,n="",s=new Map;for(;;){let{done:i,value:o}=await a.read();if(i)break;n+=r.decode(o,{stream:!0});let u=n.split(`
|
|
37
|
-
`);n=u.pop()||"";for(let c of u){let l=c.trim();if(!l.startsWith("data:"))continue;let f=l.slice(5).trim();if(!f||f==="[DONE]")continue;let p=Fh(f);if(p?.error)throw new Error(p.error.message||"Cursor routing failed");let v=p?.choices?.[0]?.delta?.content;v&&t.write(Ah(v));for(let y of p?.choices?.[0]?.delta?.tool_calls||[]){let m=y.index??s.size,x=s.get(m)||{id:y.id||"",type:"function",function:{name:"",arguments:""}};y.id&&(x.id=y.id),y.function?.name&&(x.function.name=y.function.name),y.function?.arguments&&(x.function.arguments+=y.function.arguments),s.set(m,x)}}}return[...s.values()]}function Hh(e){try{let t=JSON.parse(e.function.arguments||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}async function Gh(e,t,a,r,n){let s=[...a.system?[{role:"system",content:a.system}]:[],...a.history,{role:"user",content:a.text}],i=new Map(a.toolDefinitions.map(c=>[c.name,c])),o=n,u=1;for(let c=0;c<hu;c++){let l=await qh(o,t);if(l.length===0){t.write(Ih()),t.end(Lh());return}s.push({role:"assistant",content:null,tool_calls:l});for(let f of l){let p=i.get(f.function.name);if(!p)throw new Error(`Unknown Cursor tool: ${f.function.name}`);let v=f.id||du.randomUUID();f.id=v;let y=Hh(f),m=u++,x=du.randomUUID(),T=vu(e,b=>_h(b,m),Ph);t.write(Bh(p,v,y)),t.write(wh(m,x,p,v,y));let B=await T;if(!B)throw new Error(`Cursor tool timed out: ${f.function.name}`);t.write(bh(p,v,y,B.displayResult)),s.push({role:"tool",tool_call_id:v,name:f.function.name,content:B.content})}o=await pu({model:r,messages:s,tools:a.tools,stream:!0},"/v1/chat/completions",e.headers)}throw new Error(`Cursor tool loop exceeded ${hu} rounds`)}async function zh(e,t,a){let r=null;try{r=await Oh(e);let n=gu(r),s=n?Th(n.payload):null,i=s?Vh(s.model):null;if(!n||!s||!i||s.hasTools&&s.tools.length===0)return a(r);let o=[...s.system?[{role:"system",content:s.system}]:[],...s.history,{role:"user",content:s.text}],u=await pu({model:i,messages:o,...s.tools.length?{tools:s.tools}:{},stream:!0},"/v1/chat/completions",e.headers);return!u.ok||!u.body?a(r):(Mh(t),t.write(Nh()),await Kh(e)||fu("[cursor] request_context response timed out; continuing text route"),fu(`[cursor] routed ${s.model} -> ${i}`),Gh(e,t,s,i,u))}catch(n){if(Sh(`[cursor] routing failed: ${n.message}`),r&&!t.headersSent)return a(r);t.writableEnded||t.end(kh())}}async function Qh(e,t,a,r,n){return n(e,t,a)}mu.exports={intercept:Qh,interceptAgent:zh}});var xu=F((Fg,Eu)=>{var $h={antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh","agent.api5.cursor.sh","agentn.api5.cursor.sh","agent.us.api5.cursor.sh","agentn.us.api5.cursor.sh","agent.global.api5.cursor.sh","agentn.global.api5.cursor.sh"],"grok-cli":["cli-chat-proxy.grok.com"],iflow:["apis.iflow.cn"]};Eu.exports={TOOL_HOSTS:$h}});var bu=F((Mg,Bu)=>{var{exec:Su,execSync:jh}=require("child_process"),Tu=process.platform==="win32";function Au(){if(Tu)try{return jh("net session >nul 2>&1",{windowsHide:!0,stdio:"ignore"}),!0}catch{return!1}return typeof process.getuid=="function"&&process.getuid()===0}function Iu(e){return`'${String(e).replace(/'/g,"''")}'`}function Yh(e){if(!Tu)return Promise.reject(new Error("Windows-only"));let t=Buffer.from(e,"utf16le").toString("base64");if(Au())return new Promise((r,n)=>{Su(`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${t}`,{windowsHide:!0},(s,i,o)=>{s?n(new Error(o||s.message)):r(i)})});let a=`
|
|
28
|
+
`);c=y.pop()||"";for(let m of y){let x=m.trim();if(!x||!x.startsWith("data:"))continue;let T=x.slice(5).trim();if(T!=="[DONE]"){process.env.DEBUG_MITM&&Gr(`[SSE in] ${T.slice(0,200)}`);try{let B=JSON.parse(T),b=a(B,r);if(b!=null){let P=Array.isArray(b)?b:[b];for(let R of P){if(process.env.DEBUG_MITM){let L=R.length||R.byteLength||0;Gr(`[write binary frame] (${L}B) first 20B: ${Array.from(R.slice(0,20)).join(",")}`)}l(R)}}}catch{}}}}let f=c.trim();if(f.startsWith("data:")&&f.slice(5).trim()!=="[DONE]")try{let p=a(JSON.parse(f.slice(5).trim()),r);if(p!=null)for(let v of Array.isArray(p)?p:[p])l(v)}catch(p){Gr(`[SSE transform] final chunk ignored: ${p.message}`)}try{let p=a(null,r);if(p!=null){let v=Array.isArray(p)?p:[p];for(let y of v)l(y)}}catch{}t.end()}async function xd(e,t,a,r){let n={"Content-Type":"application/vnd.amazon.eventstream","Cache-Control":"no-cache",Connection:"keep-alive"};if(t.writeHead(200,n),!e.body){t.end(await e.text().catch(()=>""));return}let i=e.body.getReader(),s=new TextDecoder("utf-8",{fatal:!1}),o="";for(;;){let{done:u,value:c}=await i.read();if(u)break;o+=s.decode(c,{stream:!0});let l=o.split(`
|
|
29
|
+
`);o=l.pop()||"";for(let f of l){let p=f.trim();if(!p||!p.startsWith("data:"))continue;let v=p.slice(5).trim();if(v!=="[DONE]"){process.env.DEBUG_MITM&&Gr(`[SSE in] ${v.slice(0,200)}`);try{let y=JSON.parse(v),m=a(y,r);if(m!=null){let x=Array.isArray(m)?m:[m];for(let T of x){if(process.env.DEBUG_MITM){let B=T.length||T.byteLength||0;Gr(`[write binary frame] (${B}B) first 20B: ${Array.from(T.slice(0,20)).join(",")}`)}t.write(Buffer.from(T))}}}catch{}}}}try{let u=a(null,r);if(u!=null){let c=Array.isArray(u)?u:[u];for(let l of c)t.write(l)}}catch{}t.end()}Yo.exports={fetchRouter:md,pipeSSE:Cd,pipeTransformedSSE:Ed,pipeTransformedEventStream:xd}});var Xo=F((Dg,Wo)=>{var{err:Sd}=Dt(),{fetchRouter:Td,pipeSSE:Ad}=zr(),Id={"/chat/completions":"/v1/chat/completions","/v1/messages":"/v1/messages","/responses":"/v1/responses"};function Bd(e){for(let[t,a]of Object.entries(Id))if(e.includes(t))return a;return"/v1/chat/completions"}async function bd(e,t,a,r){try{let n=JSON.parse(a.toString());n.model=r;let i=Bd(e.url),s=await Td(n,i,e.headers);await Ad(s,t)}catch(n){Sd(`[mitm] ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error"}}))}}Wo.exports={intercept:bd}});var Zo=F((Ug,Jo)=>{var{err:wd,createResponseDumper:_d}=Dt(),{IS_DEV:Nd}=br(),{fetchRouter:Rd,pipeSSE:Ld}=zr();async function kd(e,t,a,r){let n=Nd?_d(e,"intercept-antigravity"):null,i=new AbortController,s=()=>{t.writableFinished||i.abort()};t.on?.("close",s);try{let o=JSON.parse(a.toString());o.model=r||o.model;let u=await Rd(o,"/v1/chat/completions",e.headers,i.signal);await Ld(u,t,n)}catch(o){if(i.signal.aborted)return;wd(`[antigravity] ${o.message}`),n&&(n.writeChunk(`
|
|
30
|
+
[ERROR] ${o.message}
|
|
31
|
+
`),n.end()),t.headersSent?t.destroy(o):(t.writeHead(502,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:o.message,type:"mitm_error"}})))}finally{t.off?.("close",s)}}Jo.exports={intercept:kd}});var iu=F((Pg,nu)=>{var{err:Dd}=Dt(),{IS_DEV:Ud}=br(),{fetchRouter:Pd,pipeTransformedEventStream:Od}=zr(),Vd=require("fs"),Fd=require("path"),Md=Fd.join(__dirname,"../../../data/logs/mitm/kiro-debug.log");function eu(e){if(Ud)try{Vd.appendFileSync(Md,`${new Date().toISOString()} ${e}
|
|
32
|
+
`)}catch{}}var Kd=(()=>{let e=new Uint32Array(256);for(let t=0;t<256;t++){let a=t;for(let r=0;r<8;r++)a=a&1?3988292384^a>>>1:a>>>1;e[t]=a}return e})();function tu(e){let t=4294967295;for(let a=0;a<e.length;a++)t=t>>>8^Kd[(t^e[a])&255];return(t^4294967295)>>>0}function qd(e){return{modelId:e||null,toolCallInit:{},hasToolCalls:!1,finishSent:!1,usage:null,inThink:!1,thinkBuf:""}}function au(e,t){if(!e)return{thinking:null,text:null};let a=e;t.inThink&&t.thinkBuf&&(a=t.thinkBuf+a,t.thinkBuf="",t.inThink=!1);let r=/<thinking>|<think>/i,n=a.match(r);if(!n)return{thinking:null,text:a};let i=n[0].toLowerCase(),s=i==="<think>"?"</think>":"</thinking>",o=n.index,u=a.indexOf(s,o+i.length);if(u===-1)return t.inThink=!0,t.thinkBuf=a.slice(o),{thinking:null,text:a.slice(0,o).trim()||null};let c=a.slice(o+i.length,u),l=a.slice(0,o).trim(),f=a.slice(u+s.length).trim(),p=[l,f].filter(Boolean).join(""),v=p?au(p,{inThink:!1,thinkBuf:""}):{thinking:null,text:null};return{thinking:c||null,text:v.text||null}}function zn(e,t){let a=Buffer.from(e,"utf8"),r=Buffer.from(t,"utf8"),n=Buffer.alloc(1+a.length+1+2+r.length),i=0;return n[i++]=a.length,a.copy(n,i),i+=a.length,n[i++]=7,n.writeUInt16BE(r.length,i),i+=2,r.copy(n,i),n}function bt(e,t){let a=Buffer.from(typeof t=="string"?t:JSON.stringify(t),"utf8"),r=Buffer.concat([zn(":message-type","event"),zn(":event-type",e),zn(":content-type","application/json")]),n=r.length,i=12+n+a.length+4,s=Buffer.alloc(i);return s.writeUInt32BE(i,0),s.writeUInt32BE(n,4),s.writeUInt32BE(tu(s.slice(0,8)),8),r.copy(s,12),a.copy(s,12+n),s.writeUInt32BE(tu(s.slice(0,i-4)),i-4),s}function Hd(e){if(typeof e=="string")return e;if(e==null)return"{}";try{return JSON.stringify(e)}catch{return"{}"}}function ru(e){let t=[],a=e.userInputMessageContext?.toolResults||[];for(let n of a){let i=(n.content||[]).map(s=>s.text||"").join(`
|
|
33
|
+
`);t.push({role:"tool",tool_call_id:n.toolUseId||"",content:i})}let r=(e.content||"").trim();return(r||a.length===0)&&t.push({role:"user",content:r}),t}function Gd(e){let t=e.toolUses||[];return t.length>0?{role:"assistant",content:e.content||null,tool_calls:t.map(a=>({id:a.toolUseId||`call_${Date.now()}`,type:"function",function:{name:a.name||"",arguments:Hd(a.input)}}))}:{role:"assistant",content:e.content||""}}function zd(e){let t=e.conversationState||{},a=t.history||[],r=t.currentMessage,n=[];for(let i of a)i.userInputMessage?n.push(...ru(i.userInputMessage)):i.assistantResponseMessage&&n.push(Gd(i.assistantResponseMessage));return r?.userInputMessage&&n.push(...ru(r.userInputMessage)),n}function Qd(e){let t=e.conversationState||{},a=t.currentMessage?.userInputMessage?.userInputMessageContext?.tools||[],r=t.history?.find(i=>i.userInputMessage?.userInputMessageContext?.tools)?.userInputMessage?.userInputMessageContext?.tools||[],n=a.length>0?a:r;return n.length?n.map(i=>{let s=i.toolSpecification||i;return{type:"function",function:{name:s.name||"",description:s.description||`Tool: ${s.name||"unknown"}`,parameters:s.inputSchema?.json||{type:"object",properties:{},required:[]}}}}):[]}function $d(e,t){if(!e){if(t.finishSent)return null;if(t.inThink&&t.thinkBuf){t.inThink=!1;let s=t.thinkBuf;return t.thinkBuf="",bt("reasoningContentEvent",{content:s,modelId:t.modelId||"kiro-unknown"})}return bt("messageStopEvent",{})}let a=[],r=e.choices?.[0],n=r?.delta||{};!t.modelId&&e.model&&(t.modelId=e.model);let i=t.modelId||"unknown";if(e.usage&&(t.usage=e.usage),n.tool_calls){t.hasToolCalls=!0;for(let s of n.tool_calls){let o=s.index??0;if(s.id&&s.function?.name&&!t.toolCallInit[o]&&(t.toolCallInit[o]={id:s.id,name:s.function.name},eu(`toolUseEvent init: ${s.function.name} (${s.id})`),a.push(bt("toolUseEvent",{name:s.function.name,toolUseId:s.id}))),s.function?.arguments){let u=t.toolCallInit[o];eu(`toolUseEvent fragment: ${s.function.arguments.slice(0,100)}`),a.push(bt("toolUseEvent",{input:s.function.arguments,name:u?.name||s.function?.name||"",toolUseId:u?.id||s.id||""}))}}}if(n.reasoning_content&&a.push(bt("reasoningContentEvent",{content:n.reasoning_content,modelId:i})),n.content){let{thinking:s,text:o}=au(n.content,t);s&&a.push(bt("reasoningContentEvent",{content:s,modelId:i})),o&&a.push(bt("assistantResponseEvent",{content:o,modelId:i}))}if(r?.finish_reason){let s=jd(t);s&&a.push(...Array.isArray(s)?s:[s])}return a.length===0?null:a.length===1?a[0]:a}function jd(e){let t=[];if(e.hasToolCalls)for(let a of Object.keys(e.toolCallInit).sort()){let r=e.toolCallInit[a];t.push(bt("toolUseEvent",{name:r.name,stop:!0,toolUseId:r.id}))}else t.push(bt("messageStopEvent",{}));return e.finishSent=!0,e.usage&&t.push(bt("usageEvent",{inputTokens:e.usage.prompt_tokens||0,outputTokens:e.usage.completion_tokens||0})),e.toolCallInit={},t.length>0?t:null}async function Yd(e,t,a,r){try{if(Wd(a))throw new Error(`Binary EventStream format detected (${a.length}B) - request should use passthrough instead of intercept`);let n=JSON.parse(a.toString()),i=zd(n);if(i.length===0)throw new Error("codeWhispererToMessages produced 0 messages \u2014 check request body");let s=Qd(n),o={model:r,messages:i,stream:!0,...s.length>0&&{tools:s,tool_choice:"auto"}},u=await Pd(o,"/v1/chat/completions",e.headers),c=qd(r);await Od(u,t,$d,c)}catch(n){Dd(`[Kiro MITM] Request processing failed: ${n.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:n.message,type:"mitm_error",handler:"kiro"}}))}}function Wd(e){if(!e||e.length<12)return!1;let t=e.readUInt32BE(0),a=e.readUInt32BE(4);return t>12&&t<1e6&&a<t-12}nu.exports={intercept:Yd}});var lu=F((Og,cu)=>{var Xd=require("zlib"),Qr=0,ee=2,Jd=new TextDecoder;function Qn(e,t){let a=0,r=0,n=t;for(;n<e.length&&r<35;){let i=e[n++];if(a|=(i&127)<<r,(i&128)===0)return[a>>>0,n];r+=7}throw new Error("Invalid protobuf varint")}function se(e){let t=new Map,a=0;for(;a<e.length;){let[r,n]=Qn(e,a),i=r>>>3,s=r&7,o,u=n;if(s===Qr)[o,u]=Qn(e,u);else if(s===ee){let[c,l]=Qn(e,u);if(u=l+c,u>e.length)throw new Error("Invalid protobuf length");o=e.subarray(l,u)}else if(s===1)u+=8,o=e.subarray(n,u);else if(s===5)u+=4,o=e.subarray(n,u);else throw new Error(`Unsupported protobuf wire type ${s}`);if(u>e.length||i===0)throw new Error("Invalid protobuf field");t.has(i)||t.set(i,[]),t.get(i).push({wire:s,value:o}),a=u}return t}function _a(e){let t=[],a=e>>>0;for(;a>=128;)t.push(a&127|128),a>>>=7;return t.push(a),Buffer.from(t)}function Y(e,t,a){let r=_a(e<<3|t);if(t===Qr)return Buffer.concat([r,_a(a)]);let n=Buffer.isBuffer(a)?a:Buffer.from(a||"");return Buffer.concat([r,_a(n.length),n])}function Zd(e,t){let a=Buffer.alloc(8);return a.writeDoubleLE(t),Buffer.concat([_a(e<<3|1),a])}function eh(e){return Buffer.concat(Object.entries(e).map(([t,a])=>{let r=Buffer.concat([Y(1,ee,t),Y(2,ee,$n(a))]);return Y(1,ee,r)}))}function $n(e){if(e==null)return Y(1,Qr,0);if(typeof e=="number")return Zd(2,e);if(typeof e=="string")return Y(3,ee,e);if(typeof e=="boolean")return Y(4,Qr,e?1:0);if(Array.isArray(e)){let t=Buffer.concat(e.map(a=>Y(1,ee,$n(a))));return Y(6,ee,t)}return Y(5,ee,eh(e))}function ir(e,t=0){let a=Buffer.from(e),r=Buffer.alloc(5+a.length);return r[0]=t,r.writeUInt32BE(a.length,1),a.copy(r,5),r}function th(e){if(!e||e.length<5)return null;let t=e[0],a=e.readUInt32BE(1);if(e.length<5+a)return null;let r=e.subarray(5,5+a);return t&1&&(r=Xd.gunzipSync(r)),{flags:t,payload:r,consumed:5+a}}function ue(e,t){return e.get(t)?.[0]?.value}function Qe(e,t){let a=ue(e,t);return a?Jd.decode(a):""}function su(e){let t={},a=se(e);for(let r of a.get(1)||[]){let n=se(r.value),i=Qe(n,1),s=ue(n,2);i&&s&&(t[i]=Na(s))}return t}function Na(e){let t=se(e);return t.has(1)?null:t.has(2)?Buffer.from(ue(t,2)).readDoubleLE():t.has(3)?Qe(t,3):t.has(4)?!!ue(t,4):t.has(5)?su(ue(t,5)):t.has(6)?(se(ue(t,6)).get(1)||[]).map(r=>Na(r.value)):null}function rh(e){let t=ue(e,7);if(!t)return[];let a=se(t),r=[];for(let n of a.get(1)||[]){let i=se(n.value),s=ue(i,2),o=ue(i,1),u=s||o;if(!u)continue;let c=se(u),l=ue(c,1);if(!l)continue;let f=se(l),p=Qe(f,1);p&&r.push({role:s?"assistant":"user",content:p})}return r}function ah(e){for(let t of e.get(3)||[])try{let a=se(t.value);if(Qe(a,1)==="fast"&&Qe(a,2)==="true")return!0}catch{continue}return!1}function nh(e){for(let t of e.get(4)||[])if(t.value?.length)try{if((se(t.value).get(1)||[]).length>0)return!0}catch{return!0}return!1}function ih(e){let t=se(e),a=Qe(t,1);if(!a)return null;let r={type:"object",properties:{}},n=ue(t,3);if(n){let i=Na(n);i&&typeof i=="object"&&!Array.isArray(i)&&(r=i)}else{let i=Qe(t,6);if(i)try{let s=JSON.parse(i);s&&typeof s=="object"&&!Array.isArray(s)&&(r=s)}catch{r={type:"object",properties:{}}}}return{name:a,description:Qe(t,2),parameters:r,providerIdentifier:Qe(t,4),toolName:Qe(t,5)||a}}function sh(e,t){let a=[],r=ue(e,4);if(r){let s=se(r);for(let o of s.get(1)||[])a.push(o.value)}let n=ue(t,2);if(n){let s=se(n);for(let o of s.get(7)||[])a.push(o.value)}let i=new Map;for(let s of a)try{let o=ih(s);o&&i.set(o.name,o)}catch{continue}return[...i.values()]}function oh(e,t){let a=String(e||"").replace(/^models\//,"");return a==="auto"?"default":a==="composer-2.5[fast=true]"||a==="composer-2.5"&&t?"composer-2.5-fast":a}function uh(e){try{let t=se(e),a=ue(t,1);if(!a)return null;let r=se(a),n=ue(r,9),i=ue(r,2);if(!n||!i)return null;let s=se(n),o=se(i),u=ue(o,1);if(!u)return null;let c=se(u),l=ue(c,1);if(!l)return null;let f=se(l),p=oh(Qe(s,1),ah(s)),v=Qe(f,1);if(!p||!v)return null;let y=sh(r,c);return{model:p,text:v,system:Qe(r,8),history:rh(c),hasTools:nh(r),tools:y.map(m=>({type:"function",function:{name:m.name,...m.description?{description:m.description}:{},parameters:m.parameters}})),toolDefinitions:y}}catch{return null}}function ch(e){let t=Y(1,ee,Buffer.from(e)),a=Y(1,ee,t);return ir(Y(1,ee,a))}function lh(){return ir(Y(1,ee,Y(14,ee,Buffer.alloc(0))))}function ou(e,t,a){let r=Object.entries(a||{}).map(([s,o])=>{let u=Buffer.concat([Y(1,ee,s),Y(2,ee,$n(o))]);return Y(2,ee,u)}),n=e.providerIdentifier||"",i=e.toolName||e.name;return Buffer.concat([Y(1,ee,n?`${n}-${i}`:i),...r,Y(3,ee,t),...n?[Y(4,ee,n)]:[],Y(5,ee,i),...n?[Y(9,ee,n)]:[]])}function fh(e,t,a,r){let n=Buffer.concat([Y(1,ee,ou(e,t,a)),...r?[Y(2,ee,r)]:[]]);return Buffer.concat([Y(15,ee,n),Y(57,ee,t)])}function uu(e,t,a,r,n){let i=Buffer.concat([Y(1,ee,a),Y(2,ee,fh(t,a,r,n))]);return ir(Y(1,ee,Y(e,ee,i)))}function dh(e,t,a){return uu(2,e,t,a)}function hh(e,t,a,r){return uu(3,e,t,a,r)}function ph(e,t,a,r,n){let i=Buffer.concat([Y(1,Qr,e),Y(15,ee,t),Y(11,ee,ou(a,r,n))]);return ir(Y(2,ee,i))}function gh(e){let t=se(e),a=ue(t,1);if(a){let r=se(a),n=[];for(let s of r.get(1)||[]){let o=se(s.value),u=ue(o,1);u&&n.push(Qe(se(u),1));let c=ue(o,2);if(c){let l=se(c);n.push(`[image: ${Qe(l,2)||"application/octet-stream"}]`)}}let i=ue(r,3);return i&&n.push(JSON.stringify(su(i))),{content:n.filter(Boolean).join(`
|
|
34
|
+
`)||"Tool completed successfully.",isError:!!ue(r,2),displayResult:e}}for(let r of[2,3,4,5,6]){let n=ue(t,r);if(!n)continue;let i=se(n),s=Qe(i,1)||"Cursor tool execution failed",o=r<=4?e:Y(2,ee,Y(1,ee,s));return{content:s,isError:!0,displayResult:o}}return{content:"Cursor tool returned an empty result.",isError:!1,displayResult:e}}function yh(e,t){try{let a=se(e),r=ue(a,2);if(!r)return null;let n=se(r);if(ue(n,1)!==t)return null;let i=ue(n,11);return i?gh(i):null}catch{return null}}function vh(){return ir(Y(2,ee,Y(10,ee,Buffer.alloc(0))))}function mh(e){try{let t=se(e),a=ue(t,2);return a?se(a).has(10):!1}catch{return!1}}function Ch(){return ir(Buffer.from("{}"),2)}function Eh(){return ir(Buffer.from(JSON.stringify({error:{code:"internal",message:"MiawRouter routing failed"}})),2)}cu.exports={parseFirstFrame:th,decodeRunRequest:uh,decodeAgentValue:Na,buildTextUpdate:ch,buildTurnEnd:lh,buildMcpToolStarted:dh,buildMcpToolCompleted:hh,buildMcpExecRequest:ph,decodeMcpExecResult:yh,buildRequestContextRequest:vh,isRequestContextResponse:mh,buildSuccessTrailer:Ch,buildErrorTrailer:Eh}});var Cu=F((Vg,mu)=>{var{getMitmAlias:xh}=Gn(),{fetchRouter:pu}=zr(),{log:fu,err:Sh}=Dt(),du=require("crypto"),{parseFirstFrame:gu,decodeRunRequest:Th,buildTextUpdate:Ah,buildTurnEnd:Ih,buildMcpToolStarted:Bh,buildMcpToolCompleted:bh,buildMcpExecRequest:wh,decodeMcpExecResult:_h,buildRequestContextRequest:Nh,isRequestContextResponse:Rh,buildSuccessTrailer:Lh,buildErrorTrailer:kh}=lu(),yu=1024*1024,Dh=1e4,Uh=3e3,Ph=300*1e3,hu=32;function Oh(e){return new Promise(t=>{let a=[],r=0,n=!1,i=()=>{n||(n=!0,clearTimeout(o),e.off("data",s),e.off("end",i),e.off("error",i),e.pause(),t(Buffer.concat(a)))},s=u=>{if(a.push(u),r+=u.length,r>=5){let l=5+Buffer.concat(a).readUInt32BE(1);(l>yu||r>=l)&&i()}},o=setTimeout(i,Dh);e.on("data",s),e.once("end",i),e.once("error",i)})}function Vh(e){try{let t=xh("cursor");return t?.[e]||(e==="composer-2.5"?t?.["composer-2.5-fast"]:null)||null}catch{return null}}function Fh(e){try{return JSON.parse(e)}catch{return null}}function Mh(e){e.headersSent||e.writeHead(200,{"Content-Type":"application/connect+proto","Cache-Control":"no-cache","connect-protocol-version":"1"})}function vu(e,t,a){return new Promise(r=>{let n=Buffer.alloc(0),i=!1,s=l=>{i||(i=!0,clearTimeout(c),e.off("data",u),e.off("end",o),e.off("error",o),r(l))},o=()=>s(!1),u=l=>{for(n=Buffer.concat([n,l]);n.length>=5;){let f=gu(n);if(!f)break;n=n.subarray(f.consumed);let p=t(f.payload);if(p)return s(p)}n.length>yu&&s(!1)},c=setTimeout(()=>s(null),a);e.on("data",u),e.once("end",o),e.once("error",o),e.resume()})}function Kh(e){return vu(e,Rh,Uh)}async function qh(e,t){if(!e.ok||!e.body)throw new Error(await e.text().catch(()=>"Cursor routing failed"));let a=e.body.getReader(),r=new TextDecoder,n="",i=new Map;for(;;){let{done:s,value:o}=await a.read();if(s)break;n+=r.decode(o,{stream:!0});let u=n.split(`
|
|
35
|
+
`);n=u.pop()||"";for(let c of u){let l=c.trim();if(!l.startsWith("data:"))continue;let f=l.slice(5).trim();if(!f||f==="[DONE]")continue;let p=Fh(f);if(p?.error)throw new Error(p.error.message||"Cursor routing failed");let v=p?.choices?.[0]?.delta?.content;v&&t.write(Ah(v));for(let y of p?.choices?.[0]?.delta?.tool_calls||[]){let m=y.index??i.size,x=i.get(m)||{id:y.id||"",type:"function",function:{name:"",arguments:""}};y.id&&(x.id=y.id),y.function?.name&&(x.function.name=y.function.name),y.function?.arguments&&(x.function.arguments+=y.function.arguments),i.set(m,x)}}}return[...i.values()]}function Hh(e){try{let t=JSON.parse(e.function.arguments||"{}");return t&&typeof t=="object"&&!Array.isArray(t)?t:{}}catch{return{}}}async function Gh(e,t,a,r,n){let i=[...a.system?[{role:"system",content:a.system}]:[],...a.history,{role:"user",content:a.text}],s=new Map(a.toolDefinitions.map(c=>[c.name,c])),o=n,u=1;for(let c=0;c<hu;c++){let l=await qh(o,t);if(l.length===0){t.write(Ih()),t.end(Lh());return}i.push({role:"assistant",content:null,tool_calls:l});for(let f of l){let p=s.get(f.function.name);if(!p)throw new Error(`Unknown Cursor tool: ${f.function.name}`);let v=f.id||du.randomUUID();f.id=v;let y=Hh(f),m=u++,x=du.randomUUID(),T=vu(e,b=>_h(b,m),Ph);t.write(Bh(p,v,y)),t.write(wh(m,x,p,v,y));let B=await T;if(!B)throw new Error(`Cursor tool timed out: ${f.function.name}`);t.write(bh(p,v,y,B.displayResult)),i.push({role:"tool",tool_call_id:v,name:f.function.name,content:B.content})}o=await pu({model:r,messages:i,tools:a.tools,stream:!0},"/v1/chat/completions",e.headers)}throw new Error(`Cursor tool loop exceeded ${hu} rounds`)}async function zh(e,t,a){let r=null;try{r=await Oh(e);let n=gu(r),i=n?Th(n.payload):null,s=i?Vh(i.model):null;if(!n||!i||!s||i.hasTools&&i.tools.length===0)return a(r);let o=[...i.system?[{role:"system",content:i.system}]:[],...i.history,{role:"user",content:i.text}],u=await pu({model:s,messages:o,...i.tools.length?{tools:i.tools}:{},stream:!0},"/v1/chat/completions",e.headers);return!u.ok||!u.body?a(r):(Mh(t),t.write(Nh()),await Kh(e)||fu("[cursor] request_context response timed out; continuing text route"),fu(`[cursor] routed ${i.model} -> ${s}`),Gh(e,t,i,s,u))}catch(n){if(Sh(`[cursor] routing failed: ${n.message}`),r&&!t.headersSent)return a(r);t.writableEnded||t.end(kh())}}async function Qh(e,t,a,r,n){return n(e,t,a)}mu.exports={intercept:Qh,interceptAgent:zh}});var xu=F((Fg,Eu)=>{var $h={antigravity:["daily-cloudcode-pa.googleapis.com","cloudcode-pa.googleapis.com"],copilot:["api.individual.githubcopilot.com"],kiro:["runtime.us-east-1.kiro.dev","q.us-east-1.amazonaws.com","codewhisperer.us-east-1.amazonaws.com"],cursor:["api2.cursor.sh","agent.api5.cursor.sh","agentn.api5.cursor.sh","agent.us.api5.cursor.sh","agentn.us.api5.cursor.sh","agent.global.api5.cursor.sh","agentn.global.api5.cursor.sh"],"grok-cli":["cli-chat-proxy.grok.com"],iflow:["apis.iflow.cn"]};Eu.exports={TOOL_HOSTS:$h}});var bu=F((Mg,Bu)=>{var{exec:Su,execSync:jh}=require("child_process"),Tu=process.platform==="win32";function Au(){if(Tu)try{return jh("net session >nul 2>&1",{windowsHide:!0,stdio:"ignore"}),!0}catch{return!1}return typeof process.getuid=="function"&&process.getuid()===0}function Iu(e){return`'${String(e).replace(/'/g,"''")}'`}function Yh(e){if(!Tu)return Promise.reject(new Error("Windows-only"));let t=Buffer.from(e,"utf16le").toString("base64");if(Au())return new Promise((r,n)=>{Su(`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${t}`,{windowsHide:!0},(i,s,o)=>{i?n(new Error(o||i.message)):r(s)})});let a=`
|
|
38
36
|
$proc = Start-Process powershell -ArgumentList @(
|
|
39
37
|
'-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass',
|
|
40
38
|
'-WindowStyle','Hidden','-EncodedCommand','${t}'
|
|
41
39
|
) -Verb RunAs -Wait -PassThru -WindowStyle Hidden;
|
|
42
40
|
if ($proc.ExitCode -ne 0) { throw "Elevated command exited with code $($proc.ExitCode)" }
|
|
43
|
-
`;return new Promise((r,n)=>{Su(`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ${Iu(a)}`,{windowsHide:!0},(s,
|
|
44
|
-
`),
|
|
45
|
-
`),o=`${
|
|
46
|
-
${
|
|
47
|
-
`;Nu(it,n,o),await _u("ipconfig /flushdns | Out-Null")}else{let
|
|
48
|
-
`),u=`${
|
|
49
|
-
${
|
|
50
|
-
`.replace(/'/g,"'\\''");await jr(`printf '%s' '${u}' | tee ${it} > /dev/null`,t),await ku(t)}Ra(`\u{1F310} DNS ${e}: \u2705 added ${r.join(", ")}`)}catch(n){let
|
|
41
|
+
`;return new Promise((r,n)=>{Su(`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ${Iu(a)}`,{windowsHide:!0},(i,s,o)=>{if(i){let u=o||i.message;u.includes("canceled by the user")||u.includes("operation was canceled")?n(new Error("User canceled UAC prompt")):n(new Error(u))}else r(s)})})}Bu.exports={isAdmin:Au,runElevatedPowerShell:Yh,quotePs:Iu}});var Pu=F((Gg,Uu)=>{var{exec:Kg,spawn:wu,execSync:$r}=require("child_process"),Le=require("fs"),Wh=require("path"),qg=require("os"),{log:Ra,err:Xh}=Dt(),{TOOL_HOSTS:$t}=xu(),{runElevatedPowerShell:_u,isAdmin:Hg}=bu();function Nu(e,t,a){let r=`${e}.miawrouter.new`,n=`${e}.miawrouter.bak`;try{Le.writeFileSync(r,a,"utf8");try{Le.unlinkSync(n)}catch{}Le.renameSync(e,n);try{Le.renameSync(r,e)}catch(i){try{Le.renameSync(n,e)}catch{Le.writeFileSync(e,t,"utf8")}throw i}try{Le.unlinkSync(n)}catch{}}finally{try{Le.unlinkSync(r)}catch{}}}var kt=process.platform==="win32",Ru=process.platform==="darwin",it=kt?Wh.join(process.env.SystemRoot||"C:\\Windows","System32","drivers","etc","hosts"):"/etc/hosts";function La(){if(kt)return!1;try{return $r("command -v sudo",{stdio:"ignore",windowsHide:!0}),!0}catch{return!1}}function Lu(){if(kt||!La())return!0;try{return $r("sudo -n true",{stdio:"ignore",windowsHide:!0}),!0}catch{return!1}}function Jh(){return!kt&&La()&&!Lu()}function jr(e,t){return new Promise((a,r)=>{let n=La(),i=n?wu("sudo",["-S","sh","-c",e],{stdio:["pipe","pipe","pipe"],windowsHide:!0}):wu("sh",["-c",e],{stdio:["ignore","pipe","pipe"],windowsHide:!0}),s="",o="";i.stdout.on("data",u=>{s+=u}),i.stderr.on("data",u=>{o+=u}),i.on("close",u=>{u===0?a(s):r(new Error(o||`Exit code ${u}`))}),n&&(i.stdin.write(`${t}
|
|
42
|
+
`),i.stdin.end())})}async function ku(e){kt||(Ru?await jr("dscacheutil -flushcache && killall -HUP mDNSResponder",e):await jr("resolvectl flush-caches 2>/dev/null || true",e))}function jn(e=null){try{let t=Le.readFileSync(it,"utf8");return e?t.includes(e):$t.antigravity.every(a=>t.includes(a))}catch{return!1}}function Zh(){try{let e=Le.readFileSync(it,"utf8"),t={};for(let[a,r]of Object.entries($t))t[a]=r.every(n=>e.includes(n));return t}catch{return Object.fromEntries(Object.keys($t).map(e=>[e,!1]))}}async function ep(e,t){let a=$t[e];if(!a)throw new Error(`Unknown tool: ${e}`);let r=a.filter(n=>!jn(n));if(r.length===0){Ra(`\u{1F310} DNS ${e}: already active`);return}try{if(kt){let n=Le.readFileSync(it,"utf8"),i=n.replace(/[\r\n\s]+$/g,""),s=r.map(u=>`127.0.0.1 ${u}`).join(`\r
|
|
43
|
+
`),o=`${i}\r
|
|
44
|
+
${s}\r
|
|
45
|
+
`;Nu(it,n,o),await _u("ipconfig /flushdns | Out-Null")}else{let i=Le.readFileSync(it,"utf8").replace(/[\r\n\s]+$/g,""),s=r.map(c=>`127.0.0.1 ${c}`).join(`
|
|
46
|
+
`),u=`${i}
|
|
47
|
+
${s}
|
|
48
|
+
`.replace(/'/g,"'\\''");await jr(`printf '%s' '${u}' | tee ${it} > /dev/null`,t),await ku(t)}Ra(`\u{1F310} DNS ${e}: \u2705 added ${r.join(", ")}`)}catch(n){let i=n.message?.includes("incorrect password")?"Wrong sudo password":`Failed to add DNS entry: ${n.message}`;throw new Error(i)}}async function Du(e,t){let a=$t[e];if(!a)throw new Error(`Unknown tool: ${e}`);let r=a.filter(n=>jn(n));if(r.length===0){Ra(`\u{1F310} DNS ${e}: already inactive`);return}try{if(kt){let n=Le.readFileSync(it,"utf8"),s=n.split(/\r?\n/).filter(o=>!r.some(u=>o.includes(u))).join(`\r
|
|
51
49
|
`).replace(/[\r\n\s]+$/g,"")+`\r
|
|
52
|
-
`;Nu(it,n,
|
|
50
|
+
`;Nu(it,n,s),await _u("ipconfig /flushdns | Out-Null")}else{let o=(Le.readFileSync(it,"utf8").split(/\r?\n/).filter(u=>!r.some(c=>u.includes(c))).join(`
|
|
53
51
|
`).replace(/[\r\n\s]+$/g,"")+`
|
|
54
|
-
`).replace(/'/g,"'\\''");await jr(`printf '%s' '${o}' | tee ${it} > /dev/null`,t),await ku(t)}Ra(`\u{1F310} DNS ${e}: \u2705 removed ${r.join(", ")}`)}catch(n){let
|
|
52
|
+
`).replace(/'/g,"'\\''");await jr(`printf '%s' '${o}' | tee ${it} > /dev/null`,t),await ku(t)}Ra(`\u{1F310} DNS ${e}: \u2705 removed ${r.join(", ")}`)}catch(n){let i=n.message?.includes("incorrect password")?"Wrong sudo password":`Failed to remove DNS entry: ${n.message}`;throw new Error(i)}}async function tp(e){for(let t of Object.keys($t))try{await Du(t,e)}catch(a){Xh(`DNS ${t}: failed to remove \u2014 ${a.message}`)}}function rp(){try{if(!Le.existsSync(it))return;let e=Object.values($t).flat(),t=Le.readFileSync(it,"utf8"),a=kt?`\r
|
|
55
53
|
`:`
|
|
56
|
-
`,n=t.split(/\r?\n/).filter(
|
|
57
|
-
${qu}`});Jn.set(e,r),t(null,r)}catch(a){et(`SNI error for ${e}: ${a.message}`),t(a)}}var Hu;try{(!ka.existsSync(Da.join(Ua,"rootCA.key"))||!ka.existsSync(Da.join(Ua,"rootCA.crt")))&&(Oa("Root CA missing, generating..."),mp());let e=ka.readFileSync(Da.join(Ua,"rootCA.key")),t=ka.readFileSync(Da.join(Ua,"rootCA.crt"));qu=t.toString("utf8"),Hu={key:e,cert:t,SNICallback:Tp}}catch(e){et(`Root CA not found: ${e.message}`),process.exit(1)}var Fu={},Ap=300*1e3;async function Va(e){let t=Fu[e];if(t&&Date.now()-t.ts<Ap)return t.ip;for(let a of["1.1.1.1","8.8.8.8","9.9.9.9","127.0.0.53"])try{let r=new np.Resolver;r.setServers([a]);let
|
|
54
|
+
`,n=t.split(/\r?\n/).filter(i=>!e.some(s=>i.includes(s))).join(a).replace(/[\r\n\s]+$/g,"")+a;if(n===t)return;if(Le.writeFileSync(it,n,"utf8"),kt)try{$r("ipconfig /flushdns",{windowsHide:!0,stdio:"ignore"})}catch{}else if(Ru)try{$r("dscacheutil -flushcache && killall -HUP mDNSResponder",{stdio:"ignore"})}catch{}else try{$r("resolvectl flush-caches 2>/dev/null || true",{stdio:"ignore"})}catch{}}catch{}}Uu.exports={TOOL_HOSTS:$t,addDNSEntry:ep,removeDNSEntry:Du,removeAllDNSEntries:tp,removeAllDNSEntriesSync:rp,execWithPassword:jr,isSudoAvailable:La,canRunSudoWithoutPassword:Lu,isSudoPasswordRequired:Jh,checkDNSEntry:jn,checkAllDNSStatus:Zh}});var ap=require("https"),Pa=require("http2"),ti=require("tls"),ka=require("fs"),Da=require("path"),np=require("dns"),{promisify:ip}=require("util"),{execSync:Yn}=require("child_process"),{log:Oa,err:et,dumpRequest:sp,createResponseDumper:op,clearDumpDir:up,createCursorCapture:cp}=Dt(),{IS_DEV:lp,LSOF_BIN:fp,TARGET_HOSTS:dp,URL_PATTERNS:hp,MODEL_SYNONYMS:pp,MODEL_PATTERNS:gp,MODEL_NO_MAP:yp,getToolForHost:ei,extractModel:vp}=br(),{DATA_DIR:zg,MITM_DIR:Ua}=ur(),{generateCert:mp,getCertForDomain:Cp}=Mo(),{getMitmAlias:Ep}=Gn(),{applyAntigravityIdeVersionOverride:xp}=Qo(),Br=443,Ou=process.platform==="win32",Ku=lp;up();var Vu={name:"x-request-source",value:"local"},Sp={"cloudcode-pa.googleapis.com":"daily-cloudcode-pa.googleapis.com"},Wn=Xo(),Xn={antigravity:Zo(),copilot:Wn,kiro:iu(),cursor:Cu(),"grok-cli":Wn,iflow:Wn},Jn=new Map,qu;function Tp(e,t){try{if(Jn.has(e))return t(null,Jn.get(e));let a=Cp(e);if(!a)return t(new Error(`Failed to generate cert for ${e}`));let r=require("tls").createSecureContext({key:a.key,cert:`${a.cert}
|
|
55
|
+
${qu}`});Jn.set(e,r),t(null,r)}catch(a){et(`SNI error for ${e}: ${a.message}`),t(a)}}var Hu;try{(!ka.existsSync(Da.join(Ua,"rootCA.key"))||!ka.existsSync(Da.join(Ua,"rootCA.crt")))&&(Oa("Root CA missing, generating..."),mp());let e=ka.readFileSync(Da.join(Ua,"rootCA.key")),t=ka.readFileSync(Da.join(Ua,"rootCA.crt"));qu=t.toString("utf8"),Hu={key:e,cert:t,SNICallback:Tp}}catch(e){et(`Root CA not found: ${e.message}`),process.exit(1)}var Fu={},Ap=300*1e3;async function Va(e){let t=Fu[e];if(t&&Date.now()-t.ts<Ap)return t.ip;for(let a of["1.1.1.1","8.8.8.8","9.9.9.9","127.0.0.53"])try{let r=new np.Resolver;r.setServers([a]);let i=(await ip(r.resolve4.bind(r))(e)).find(s=>s!=="127.0.0.1"&&s!=="0.0.0.0");if(i)return Fu[e]={ip:i,ts:Date.now()},i}catch{}throw new Error(`DNS resolution failed for ${e}`)}function Ip(e){return new Promise((t,a)=>{let r=[];e.on("data",n=>r.push(n)),e.on("end",()=>t(Buffer.concat(r))),e.on("error",a)})}function Bp(e,t){if(!t)return null;try{let a=Ep(e),r=String(t).replace(/^models\//,""),n=pp?.[e]?.[r]||r;if(a?.[n])return a[n];if(e==="antigravity"&&/^gemini-4-argon(?:-|$)/i.test(n))return null;let i=Object.keys(a||{}).find(o=>o&&a[o]&&(n.startsWith(o)||o.startsWith(n)));if(i)return a[i];let s=gp?.[e]||[];for(let{match:o,alias:u}of s)if(o.test(n)&&a?.[u])return a[u];return e==="antigravity"&&/^gemini-3\.(?:8|7|6)-flash-(high|medium|low)$/i.test(n)?n:null}catch{return null}}async function sr(e,t,a,r){let n=e.headers[":authority"]||e.headers.host,i=(n||dp[0]).split(":")[0],o=(e.url.includes(":generateContent")||e.url.includes(":streamGenerateContent"))&&Sp[i]||i,u=Ku?op(e,"passthrough"):null,l=ei(n)==="antigravity"?xp(a,e.headers):{bodyBuffer:a,headers:e.headers},f=l.bodyBuffer,p={...l.headers,host:o};f!==a&&(p["content-length"]=String(f.length));try{if(await bp(o)==="h2")return await wp(e,t,f,p,o,r,u)}catch(v){et(`[mitm] ALPN negotiate failed: ${v.message}, fallback to HTTP/1.1`)}return Np(e,t,f,p,o,r,u)}var Zn=new Map;async function bp(e){if(Zn.has(e))return Zn.get(e);let t=await Va(e);return new Promise((a,r)=>{let n=ti.connect({host:t,port:443,servername:e,ALPNProtocols:["h2","http/1.1"]},()=>{let i=n.alpnProtocol||"http/1.1";Zn.set(e,i),Oa(`\u{1F517} [mitm] ALPN ${e} \u2192 ${i}`),n.end(),a(i)});n.once("error",r),n.setTimeout(5e3,()=>{n.destroy(new Error("ALPN timeout"))})})}async function wp(e,t,a,r,n,i,s){let o=await Va(n),u={};for(let[c,l]of Object.entries(r)){let f=c.toLowerCase();f==="host"||f==="connection"||f==="keep-alive"||f==="transfer-encoding"||f==="upgrade"||f==="proxy-connection"||(u[f]=l)}return u[":method"]=e.method,u[":path"]=e.url,u[":scheme"]="https",u[":authority"]=n,new Promise(c=>{let l=Pa.connect(`https://${n}`,{createConnection:()=>ti.connect({host:o,port:443,servername:n,ALPNProtocols:["h2"]})});l.once("error",p=>{et(`[mitm] http2 client error: ${p.message}`),s&&(s.writeChunk(`
|
|
58
56
|
[ERROR h2] ${p.message}
|
|
59
|
-
`),
|
|
57
|
+
`),s.end()),t.headersSent||t.writeHead(502),t.writableEnded||t.end("Bad Gateway");try{l.close()}catch{}c()});let f=l.request(u,{endStream:a.length===0});a.length>0&&f.end(a),f.once("response",p=>{let v=p[":status"],y={};for(let[x,T]of Object.entries(p))x.startsWith(":")||x==="connection"||x==="keep-alive"||x==="transfer-encoding"||(y[x]=T);t.writeHead(v,y),s&&s.writeHeader(v,y);let m=[];f.on("data",x=>{s&&s.writeChunk(x),i&&m.push(x),t.write(x)}),f.on("end",()=>{if(s&&s.end(),t.writableEnded||t.end(),i)try{i(Buffer.concat(m),y)}catch{}try{l.close()}catch{}c()})}),f.once("error",p=>{et(`[mitm] http2 stream error: ${p.message}`),s&&(s.writeChunk(`
|
|
60
58
|
[ERROR h2-stream] ${p.message}
|
|
61
|
-
`),
|
|
59
|
+
`),s.end()),t.headersSent||t.writeHead(502),t.writableEnded||t.end();try{l.close()}catch{}c()})})}async function _p(e,t,a,r=null){let n=String(a).split(":")[0],i=cp(e),s;try{s=await Va(n)}catch(m){if(et(`[mitm] AgentService resolve failed: ${m.message}`),i)try{i.error(m&&m.message),i.end()}catch{}t.headersSent||t.writeHead(502),t.end("Bad Gateway");return}let o={};for(let[m,x]of Object.entries(e.headers))m.startsWith(":")||m==="host"||m==="connection"||m==="keep-alive"||m==="transfer-encoding"||m==="upgrade"||m==="proxy-connection"||m==="te"||(o[m]=x);o[":method"]=e.method,o[":path"]=e.url,o[":scheme"]="https",o[":authority"]=n;let u=Pa.connect(`https://${n}`,{createConnection:()=>ti.connect({host:s,port:443,servername:n,ALPNProtocols:["h2"]})}),c=null,l=!1,f=m=>{if(!l){if(l=!0,et(`[mitm] AgentService relay error: ${m&&m.message}`),i)try{i.error(m&&m.message),i.end()}catch{}e.unpipe(c);try{c?.close(Pa.constants.NGHTTP2_CANCEL)}catch{}if(t.headersSent||t.writeHead(502),!t.writableEnded)try{t.end()}catch{}try{u.destroy()}catch{}}};if(u.once("error",f),t.on("error",f),e.on("error",f),e.on("aborted",()=>f(new Error("client aborted"))),e.stream?.once("aborted",()=>f(new Error("client stream aborted"))),c=u.request(o,{endStream:!1}),c.once("error",f),i&&r?.length)try{i.writeRequestChunk(r)}catch{}i&&e.on("data",m=>{try{i.writeRequestChunk(m)}catch{}}),r?.length&&c.write(r),e.readableEnded?c.end():e.pipe(c);let p=!1,v=!1,y=()=>{if(p&&v)try{u.close()}catch{}};e.on("end",()=>{p=!0,y()}),c.on("end",()=>{if(i)try{i.end()}catch{}v=!0,y()}),c.once("response",m=>{if(l)return;let x=m[":status"],T={};for(let[B,b]of Object.entries(m))B.startsWith(":")||B==="connection"||B==="keep-alive"||B==="transfer-encoding"||(T[B]=b);if(t.writeHead(x,T),i)try{i.setResponse(x,Object.keys(T))}catch{}c.on("data",B=>{if(i)try{i.writeResponseChunk(B)}catch{}l||t.writableEnded||t.write(B)||(c.pause(),t.once("drain",()=>c.resume()))})}),c.on("trailers",m=>{let x={};for(let[T,B]of Object.entries(m))T.startsWith(":")||T==="connection"||T==="keep-alive"||T==="transfer-encoding"||(x[T]=B);try{t.writableEnded||t.addTrailers(x)}catch{}if(i)try{i.setTrailers(Object.keys(x))}catch{}}),c.on("end",()=>{!l&&!t.writableEnded&&t.end()})}async function Np(e,t,a,r,n,i,s){let o=await Va(n),u=ap.request({hostname:o,port:443,path:e.url,method:e.method,headers:r,servername:n},c=>{if(t.writeHead(c.statusCode,c.headers),s&&s.writeHeader(c.statusCode,c.headers),!i&&!s){c.pipe(t);return}let l=[];c.on("data",f=>{s&&s.writeChunk(f),i&&l.push(f),t.write(f)}),c.on("end",()=>{if(s&&s.end(),t.end(),i)try{i(Buffer.concat(l),c.headers)}catch{}})});u.on("error",c=>{et(`Passthrough error: ${c.message}`),s&&(s.writeChunk(`
|
|
62
60
|
[ERROR] ${c.message}
|
|
63
|
-
`),
|
|
61
|
+
`),s.end()),t.headersSent||t.writeHead(502),t.end("Bad Gateway")}),a.length>0&&u.write(a),u.end()}var ri=Pa.createSecureServer({...Hu,allowHTTP1:!0},async(e,t)=>{try{if(e.url==="/_mitm_health"){t.writeHead(200,{"Content-Type":"application/json"}),t.end(JSON.stringify({ok:!0,pid:process.pid}));return}let a=e.headers[":authority"]||e.headers.host;if(ei(a)==="cursor"&&e.url.includes("/agent.v1.AgentService/Run"))return await Xn.cursor.interceptAgent(e,t,c=>_p(e,t,a,c));let r=await Ip(e);if(Ku&&sp(e,r,"raw"),e.headers[Vu.name]===Vu.value)return sr(e,t,r);let n=ei(a);if(!n||!(hp[n]||[]).some(c=>e.url.includes(c)))return sr(e,t,r);if(n==="cursor")return Xn[n].intercept(e,t,r,null,sr);let o=vp(e.url,r);if(o&&(yp[n]||[]).some(c=>c.test(o)))return sr(e,t,r);let u=Bp(n,o);return u?Xn[n].intercept(e,t,r,u,sr):sr(e,t,r)}catch(a){et(`Unhandled error: ${a.message}`),t.headersSent||t.writeHead(500,{"Content-Type":"application/json"}),t.end(JSON.stringify({error:{message:a.message,type:"mitm_error"}}))}});function Rp(e){try{let t=[];if(Ou){let a=`powershell -NonInteractive -WindowStyle Hidden -Command "Get-NetTCPConnection -LocalPort ${e} -State Listen -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess"`,r=Yn(a,{encoding:"utf-8",windowsHide:!0}).trim();if(!r)return;t=r.split(/\r?\n/).map(n=>n.trim()).filter(n=>n&&Number(n)!==process.pid&&Number(n)>4)}else{let a=Yn(`${fp} -nP -iTCP:${e} -sTCP:LISTEN -t`,{encoding:"utf-8",windowsHide:!0}).trim();if(!a)return;t=a.split(`
|
|
64
62
|
`).filter(r=>r&&Number(r)!==process.pid)}if(t.length===0)return;t.forEach(a=>{try{Ou?Yn(`taskkill /F /PID ${a}`,{windowsHide:!0}):process.kill(Number(a),"SIGKILL")}catch(r){et(`Failed to kill PID ${a}: ${r.message}`)}}),Oa(`Killed ${t.length} process(es) on port ${e}`)}catch(t){if(t.status!==1)throw t}}try{Rp(Br)}catch(e){et(`Cannot kill process on port ${Br}: ${e.message}`),process.exit(1)}ri.listen(Br,()=>Oa(`\u{1F680} Server ready on :${Br}`));ri.on("error",e=>{e.code==="EADDRINUSE"?et(`Port ${Br} already in use`):e.code==="EACCES"?et(`Permission denied for port ${Br}`):et(e.message),process.exit(1)});var{removeAllDNSEntriesSync:Lp}=Pu(),Mu=!1,ai=()=>{if(Mu)return;Mu=!0,Lp();let e=setTimeout(()=>process.exit(0),1500);ri.close(()=>{clearTimeout(e),process.exit(0)})};process.on("SIGTERM",ai);process.on("SIGINT",ai);process.platform==="win32"&&process.on("SIGBREAK",ai);
|