pi-codex-auto-review 0.1.0
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/LICENSE +201 -0
- package/NOTICE +10 -0
- package/README.md +77 -0
- package/dist/approvals.d.ts +72 -0
- package/dist/approvals.js +167 -0
- package/dist/approvals.js.map +1 -0
- package/dist/audit.d.ts +28 -0
- package/dist/audit.js +40 -0
- package/dist/audit.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +70 -0
- package/dist/cli.js.map +1 -0
- package/dist/context-files.d.ts +14 -0
- package/dist/context-files.js +113 -0
- package/dist/context-files.js.map +1 -0
- package/dist/contracts.d.ts +258 -0
- package/dist/contracts.js +102 -0
- package/dist/contracts.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/native/darwin-arm64/artifact.json +5 -0
- package/dist/native/darwin-arm64/pi-guard-execpolicy +0 -0
- package/dist/native/linux-x64/artifact.json +5 -0
- package/dist/native/linux-x64/pi-guard-execpolicy +0 -0
- package/dist/policy/domains.d.ts +5 -0
- package/dist/policy/domains.js +18 -0
- package/dist/policy/domains.js.map +1 -0
- package/dist/policy/index.d.ts +56 -0
- package/dist/policy/index.js +304 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/paths.d.ts +5 -0
- package/dist/policy/paths.js +54 -0
- package/dist/policy/paths.js.map +1 -0
- package/dist/policy/rules.d.ts +36 -0
- package/dist/policy/rules.js +61 -0
- package/dist/policy/rules.js.map +1 -0
- package/dist/policy/shell.d.ts +14 -0
- package/dist/policy/shell.js +122 -0
- package/dist/policy/shell.js.map +1 -0
- package/dist/reports.d.ts +21 -0
- package/dist/reports.js +42 -0
- package/dist/reports.js.map +1 -0
- package/dist/review/context.d.ts +25 -0
- package/dist/review/context.js +108 -0
- package/dist/review/context.js.map +1 -0
- package/dist/review/investigation.d.ts +39 -0
- package/dist/review/investigation.js +36 -0
- package/dist/review/investigation.js.map +1 -0
- package/dist/review/lifecycle.d.ts +29 -0
- package/dist/review/lifecycle.js +71 -0
- package/dist/review/lifecycle.js.map +1 -0
- package/dist/review/policy.d.ts +4 -0
- package/dist/review/policy.js +15 -0
- package/dist/review/policy.js.map +1 -0
- package/dist/review/upstream-policy.d.ts +2 -0
- package/dist/review/upstream-policy.js +210 -0
- package/dist/review/upstream-policy.js.map +1 -0
- package/dist/reviewer.d.ts +45 -0
- package/dist/reviewer.js +148 -0
- package/dist/reviewer.js.map +1 -0
- package/dist/sandbox/broker.d.ts +1 -0
- package/dist/sandbox/broker.js +135 -0
- package/dist/sandbox/broker.js.map +1 -0
- package/dist/sandbox/config.d.ts +5 -0
- package/dist/sandbox/config.js +91 -0
- package/dist/sandbox/config.js.map +1 -0
- package/dist/sandbox/executor.d.ts +20 -0
- package/dist/sandbox/executor.js +144 -0
- package/dist/sandbox/executor.js.map +1 -0
- package/dist/sandbox/hard-links.d.ts +4 -0
- package/dist/sandbox/hard-links.js +145 -0
- package/dist/sandbox/hard-links.js.map +1 -0
- package/dist/sandbox/linux-read-paths.d.ts +7 -0
- package/dist/sandbox/linux-read-paths.js +47 -0
- package/dist/sandbox/linux-read-paths.js.map +1 -0
- package/dist/sandbox/paths.d.ts +3 -0
- package/dist/sandbox/paths.js +10 -0
- package/dist/sandbox/paths.js.map +1 -0
- package/dist/sandbox/runtime-write-paths.d.ts +2 -0
- package/dist/sandbox/runtime-write-paths.js +8 -0
- package/dist/sandbox/runtime-write-paths.js.map +1 -0
- package/dist/sandbox/seccomp.d.ts +5 -0
- package/dist/sandbox/seccomp.js +16 -0
- package/dist/sandbox/seccomp.js.map +1 -0
- package/dist/sandbox/worker.d.ts +1 -0
- package/dist/sandbox/worker.js +73 -0
- package/dist/sandbox/worker.js.map +1 -0
- package/dist/signals.d.ts +10 -0
- package/dist/signals.js +21 -0
- package/dist/signals.js.map +1 -0
- package/dist/startup.d.ts +22 -0
- package/dist/startup.js +100 -0
- package/dist/startup.js.map +1 -0
- package/dist/tools/controller.d.ts +63 -0
- package/dist/tools/controller.js +286 -0
- package/dist/tools/controller.js.map +1 -0
- package/dist/tools/external.d.ts +30 -0
- package/dist/tools/external.js +24 -0
- package/dist/tools/external.js.map +1 -0
- package/dist/tools/mcp.d.ts +17 -0
- package/dist/tools/mcp.js +186 -0
- package/dist/tools/mcp.js.map +1 -0
- package/docs/publishing.md +73 -0
- package/docs/security/dependencies.md +43 -0
- package/docs/testing/auto-review-protection.md +130 -0
- package/docs/usage.md +217 -0
- package/native/execpolicy/LICENSE +201 -0
- package/native/execpolicy/NOTICE +6 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/LICENSE +201 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/README.md +901 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts +3 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js +472 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/cli.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts +19 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js +17 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/index.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts +52 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js +153 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/address.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts +164 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js +246 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/aws-sigv4.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts +58 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js +128 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/body-substitution.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts +124 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js +258 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-aws-pairs.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts +87 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js +138 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-decode.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts +67 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js +113 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-extract.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts +70 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js +171 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-env.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts +120 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js +281 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-mask-files.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts +108 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js +208 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/credential-sentinel.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts +82 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js +155 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/domain-pattern.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts +44 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js +220 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/generate-seccomp-filter.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts +150 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js +678 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/http-proxy.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts +32 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js +111 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/java-proxy-agent.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts +305 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js +2605 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-sandbox-utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts +55 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js +152 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/linux-violation-monitor.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts +12 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js +43 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/listen-in-range.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts +116 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js +1195 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/macos-sandbox-utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts +200 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js +443 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-ca.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts +28 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js +114 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mitm-leaf.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts +59 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js +159 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/mux-proxy.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts +147 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js +445 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/parent-proxy.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts +17 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js +163 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/read-deny-glob.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts +83 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js +212 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/request-filter.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts +76 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js +221 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/resolved-address-guard.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts +1691 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js +1233 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-config.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts +97 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js +1937 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-manager.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts +113 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js +3 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-schemas.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts +411 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js +1408 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts +37 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js +125 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/sandbox-violation-store.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts +57 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js +332 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/socks-proxy.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts +100 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js +546 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/tls-terminate-proxy.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts +923 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js +1419 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/sandbox/windows-sandbox-utils.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts +31 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js +69 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/config-loader.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts +7 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js +25 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/debug.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts +15 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js +49 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/platform.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts +17 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js +37 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/ripgrep.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts +27 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js +47 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/shell-quote.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts +9 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.d.ts.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js +25 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/dist/utils/which.js.map +1 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/package.json +88 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/build.ts +95 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/java-proxy-agent/srt-proxy-agent.jar +0 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/arm64/apply-seccomp +0 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/build.ts +69 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/seccomp/x64/apply-seccomp +0 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/arm64/srt-win.exe +0 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/build.ts +28 -0
- package/node_modules/@anthropic-ai/sandbox-runtime/vendor/srt-win/x64/srt-win.exe +0 -0
- package/node_modules/@pondwader/socks5-server/.github/workflows/ci.yml +27 -0
- package/node_modules/@pondwader/socks5-server/LICENSE +20 -0
- package/node_modules/@pondwader/socks5-server/README.md +151 -0
- package/node_modules/@pondwader/socks5-server/dist/index.d.mts +87 -0
- package/node_modules/@pondwader/socks5-server/dist/index.d.ts +87 -0
- package/node_modules/@pondwader/socks5-server/dist/index.js +346 -0
- package/node_modules/@pondwader/socks5-server/dist/index.mjs +307 -0
- package/node_modules/@pondwader/socks5-server/package.json +31 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1157 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2509 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +520 -0
- package/node_modules/commander/lib/option.js +330 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +84 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +969 -0
- package/node_modules/node-forge/.editorconfig +17 -0
- package/node_modules/node-forge/.eslintrc.js +24 -0
- package/node_modules/node-forge/.github/workflows/main.yaml +96 -0
- package/node_modules/node-forge/.istanbul.yml +2 -0
- package/node_modules/node-forge/.npmignore +15 -0
- package/node_modules/node-forge/CHANGELOG.md +555 -0
- package/node_modules/node-forge/CONTRIBUTING.md +18 -0
- package/node_modules/node-forge/LICENSE +331 -0
- package/node_modules/node-forge/README.md +2071 -0
- package/node_modules/node-forge/RELEASE.md +19 -0
- package/node_modules/node-forge/SECURITY.md +5 -0
- package/node_modules/node-forge/examples/create-cert.js +110 -0
- package/node_modules/node-forge/examples/create-csr.js +66 -0
- package/node_modules/node-forge/examples/create-pkcs12.js +160 -0
- package/node_modules/node-forge/examples/imap.js +46 -0
- package/node_modules/node-forge/examples/sign-p7.js +115 -0
- package/node_modules/node-forge/examples/tls.js +189 -0
- package/node_modules/node-forge/flash/PooledSocket.as +18 -0
- package/node_modules/node-forge/flash/README.md +48 -0
- package/node_modules/node-forge/flash/SocketEvent.as +36 -0
- package/node_modules/node-forge/flash/SocketPool.as +754 -0
- package/node_modules/node-forge/flash/mod_fsp/README +135 -0
- package/node_modules/node-forge/flash/mod_fsp/mod_fsp.c +415 -0
- package/node_modules/node-forge/flash/package.json +28 -0
- package/node_modules/node-forge/flash/policyserver.js +65 -0
- package/node_modules/node-forge/flash/policyserver.py +112 -0
- package/node_modules/node-forge/flash/swf/SocketPool.swf +0 -0
- package/node_modules/node-forge/karma-sauce.conf.js +79 -0
- package/node_modules/node-forge/karma.conf.js +133 -0
- package/node_modules/node-forge/lib/aes.js +1091 -0
- package/node_modules/node-forge/lib/aesCipherSuites.js +282 -0
- package/node_modules/node-forge/lib/asn1-validator.js +91 -0
- package/node_modules/node-forge/lib/asn1.js +1503 -0
- package/node_modules/node-forge/lib/baseN.js +186 -0
- package/node_modules/node-forge/lib/cipher.js +230 -0
- package/node_modules/node-forge/lib/cipherModes.js +999 -0
- package/node_modules/node-forge/lib/des.js +496 -0
- package/node_modules/node-forge/lib/ed25519.js +1091 -0
- package/node_modules/node-forge/lib/forge.js +13 -0
- package/node_modules/node-forge/lib/form.js +149 -0
- package/node_modules/node-forge/lib/hmac.js +146 -0
- package/node_modules/node-forge/lib/http.js +1346 -0
- package/node_modules/node-forge/lib/index.all.js +16 -0
- package/node_modules/node-forge/lib/index.js +33 -0
- package/node_modules/node-forge/lib/jsbn.js +1294 -0
- package/node_modules/node-forge/lib/kem.js +168 -0
- package/node_modules/node-forge/lib/log.js +319 -0
- package/node_modules/node-forge/lib/md.all.js +13 -0
- package/node_modules/node-forge/lib/md.js +11 -0
- package/node_modules/node-forge/lib/md5.js +289 -0
- package/node_modules/node-forge/lib/mgf.js +12 -0
- package/node_modules/node-forge/lib/mgf1.js +57 -0
- package/node_modules/node-forge/lib/oids.js +180 -0
- package/node_modules/node-forge/lib/pbe.js +1023 -0
- package/node_modules/node-forge/lib/pbkdf2.js +211 -0
- package/node_modules/node-forge/lib/pem.js +237 -0
- package/node_modules/node-forge/lib/pkcs1.js +276 -0
- package/node_modules/node-forge/lib/pkcs12.js +1078 -0
- package/node_modules/node-forge/lib/pkcs7.js +1260 -0
- package/node_modules/node-forge/lib/pkcs7asn1.js +410 -0
- package/node_modules/node-forge/lib/pki.js +102 -0
- package/node_modules/node-forge/lib/prime.js +297 -0
- package/node_modules/node-forge/lib/prime.worker.js +168 -0
- package/node_modules/node-forge/lib/prng.js +419 -0
- package/node_modules/node-forge/lib/pss.js +241 -0
- package/node_modules/node-forge/lib/random.js +191 -0
- package/node_modules/node-forge/lib/rc2.js +410 -0
- package/node_modules/node-forge/lib/rsa.js +1973 -0
- package/node_modules/node-forge/lib/sha1.js +319 -0
- package/node_modules/node-forge/lib/sha256.js +327 -0
- package/node_modules/node-forge/lib/sha512.js +561 -0
- package/node_modules/node-forge/lib/socket.js +287 -0
- package/node_modules/node-forge/lib/ssh.js +236 -0
- package/node_modules/node-forge/lib/tls.js +4282 -0
- package/node_modules/node-forge/lib/tlssocket.js +249 -0
- package/node_modules/node-forge/lib/util.js +2652 -0
- package/node_modules/node-forge/lib/x509.js +3251 -0
- package/node_modules/node-forge/lib/xhr.js +738 -0
- package/node_modules/node-forge/package.json +123 -0
- package/node_modules/node-forge/tests/.eslintrc.js +5 -0
- package/node_modules/node-forge/tests/README.md +4 -0
- package/node_modules/node-forge/tests/benchmarks/aes-speed.js +62 -0
- package/node_modules/node-forge/tests/benchmarks/so-44303784.js +246 -0
- package/node_modules/node-forge/tests/flash/README.md +7 -0
- package/node_modules/node-forge/tests/flash/Test.as +96 -0
- package/node_modules/node-forge/tests/flash/build-flash.xml +7 -0
- package/node_modules/node-forge/tests/flash/index.html +28 -0
- package/node_modules/node-forge/tests/index.html +33 -0
- package/node_modules/node-forge/tests/issues/heartbleed.js +55 -0
- package/node_modules/node-forge/tests/issues/issue-428.html +95 -0
- package/node_modules/node-forge/tests/issues/issue-428.js +375 -0
- package/node_modules/node-forge/tests/karma/index.js +8 -0
- package/node_modules/node-forge/tests/karma/testWorker.js +65 -0
- package/node_modules/node-forge/tests/karma/web-worker-rsa.js +55 -0
- package/node_modules/node-forge/tests/legacy/common.html +65 -0
- package/node_modules/node-forge/tests/legacy/common.js +2199 -0
- package/node_modules/node-forge/tests/legacy/form.html +148 -0
- package/node_modules/node-forge/tests/legacy/form.js +40 -0
- package/node_modules/node-forge/tests/legacy/http.html +235 -0
- package/node_modules/node-forge/tests/legacy/index.html +70 -0
- package/node_modules/node-forge/tests/legacy/keygen.html +113 -0
- package/node_modules/node-forge/tests/legacy/login.css +26 -0
- package/node_modules/node-forge/tests/legacy/loginDemo.html +32 -0
- package/node_modules/node-forge/tests/legacy/loginDemo.js +149 -0
- package/node_modules/node-forge/tests/legacy/performance.html +533 -0
- package/node_modules/node-forge/tests/legacy/result.txt +1 -0
- package/node_modules/node-forge/tests/legacy/socketPool.html +302 -0
- package/node_modules/node-forge/tests/legacy/tasks.html +54 -0
- package/node_modules/node-forge/tests/legacy/tasks.js +378 -0
- package/node_modules/node-forge/tests/legacy/tls.html +389 -0
- package/node_modules/node-forge/tests/legacy/webid.html +89 -0
- package/node_modules/node-forge/tests/legacy/webid.js +313 -0
- package/node_modules/node-forge/tests/legacy/ws-webid.js +120 -0
- package/node_modules/node-forge/tests/legacy/xhr.html +67 -0
- package/node_modules/node-forge/tests/legacy/xhr.js +590 -0
- package/node_modules/node-forge/tests/pocs/ghsa-2328-f5f3-gj25.js +85 -0
- package/node_modules/node-forge/tests/pocs/ghsa-ppp5-5v6c-4jwp.js +166 -0
- package/node_modules/node-forge/tests/pocs/ghsa-q67f-28xg-22rw.js +103 -0
- package/node_modules/node-forge/tests/security/cve-2025-12816.js +75 -0
- package/node_modules/node-forge/tests/security/ghsa-554w-wpv2-vw27.js +81 -0
- package/node_modules/node-forge/tests/security/index.js +3 -0
- package/node_modules/node-forge/tests/server.crt +26 -0
- package/node_modules/node-forge/tests/server.js +87 -0
- package/node_modules/node-forge/tests/server.key +27 -0
- package/node_modules/node-forge/tests/support/task.js +718 -0
- package/node_modules/node-forge/tests/tests.css +61 -0
- package/node_modules/node-forge/tests/unit/aes.js +1498 -0
- package/node_modules/node-forge/tests/unit/asn1.js +1337 -0
- package/node_modules/node-forge/tests/unit/csr.js +129 -0
- package/node_modules/node-forge/tests/unit/des.js +231 -0
- package/node_modules/node-forge/tests/unit/ed25519.js +395 -0
- package/node_modules/node-forge/tests/unit/forge.js +2 -0
- package/node_modules/node-forge/tests/unit/hmac.js +64 -0
- package/node_modules/node-forge/tests/unit/index.html +20 -0
- package/node_modules/node-forge/tests/unit/index.js +27 -0
- package/node_modules/node-forge/tests/unit/jsbn.js +40 -0
- package/node_modules/node-forge/tests/unit/kem.js +167 -0
- package/node_modules/node-forge/tests/unit/md5.js +114 -0
- package/node_modules/node-forge/tests/unit/mgf1.js +16 -0
- package/node_modules/node-forge/tests/unit/pbkdf2.js +182 -0
- package/node_modules/node-forge/tests/unit/pem.js +159 -0
- package/node_modules/node-forge/tests/unit/pkcs1.js +1077 -0
- package/node_modules/node-forge/tests/unit/pkcs12.js +739 -0
- package/node_modules/node-forge/tests/unit/pkcs7.js +792 -0
- package/node_modules/node-forge/tests/unit/random.js +48 -0
- package/node_modules/node-forge/tests/unit/rc2.js +88 -0
- package/node_modules/node-forge/tests/unit/rsa.js +1278 -0
- package/node_modules/node-forge/tests/unit/sha1.js +72 -0
- package/node_modules/node-forge/tests/unit/sha256.js +79 -0
- package/node_modules/node-forge/tests/unit/sha512.js +200 -0
- package/node_modules/node-forge/tests/unit/ssh.js +175 -0
- package/node_modules/node-forge/tests/unit/tls.js +175 -0
- package/node_modules/node-forge/tests/unit/util.js +595 -0
- package/node_modules/node-forge/tests/unit/x509.js +1986 -0
- package/node_modules/node-forge/tests/websockets/server-webid.js +495 -0
- package/node_modules/node-forge/tests/websockets/server-ws.js +158 -0
- package/node_modules/node-forge/webpack-tests.config.js +26 -0
- package/node_modules/node-forge/webpack.config.js +130 -0
- package/node_modules/zod/LICENSE +21 -0
- package/node_modules/zod/README.md +208 -0
- package/node_modules/zod/index.cjs +33 -0
- package/node_modules/zod/index.d.cts +4 -0
- package/node_modules/zod/index.d.ts +4 -0
- package/node_modules/zod/index.js +4 -0
- package/node_modules/zod/package.json +118 -0
- package/node_modules/zod/src/index.ts +4 -0
- package/node_modules/zod/src/v3/ZodError.ts +330 -0
- package/node_modules/zod/src/v3/benchmarks/datetime.ts +58 -0
- package/node_modules/zod/src/v3/benchmarks/discriminatedUnion.ts +80 -0
- package/node_modules/zod/src/v3/benchmarks/index.ts +59 -0
- package/node_modules/zod/src/v3/benchmarks/ipv4.ts +57 -0
- package/node_modules/zod/src/v3/benchmarks/object.ts +69 -0
- package/node_modules/zod/src/v3/benchmarks/primitives.ts +162 -0
- package/node_modules/zod/src/v3/benchmarks/realworld.ts +63 -0
- package/node_modules/zod/src/v3/benchmarks/string.ts +55 -0
- package/node_modules/zod/src/v3/benchmarks/union.ts +80 -0
- package/node_modules/zod/src/v3/errors.ts +13 -0
- package/node_modules/zod/src/v3/external.ts +6 -0
- package/node_modules/zod/src/v3/helpers/enumUtil.ts +17 -0
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +8 -0
- package/node_modules/zod/src/v3/helpers/parseUtil.ts +176 -0
- package/node_modules/zod/src/v3/helpers/partialUtil.ts +34 -0
- package/node_modules/zod/src/v3/helpers/typeAliases.ts +2 -0
- package/node_modules/zod/src/v3/helpers/util.ts +224 -0
- package/node_modules/zod/src/v3/index.ts +4 -0
- package/node_modules/zod/src/v3/locales/en.ts +124 -0
- package/node_modules/zod/src/v3/standard-schema.ts +113 -0
- package/node_modules/zod/src/v3/tests/Mocker.ts +54 -0
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +157 -0
- package/node_modules/zod/src/v3/tests/anyunknown.test.ts +28 -0
- package/node_modules/zod/src/v3/tests/array.test.ts +71 -0
- package/node_modules/zod/src/v3/tests/async-parsing.test.ts +388 -0
- package/node_modules/zod/src/v3/tests/async-refinements.test.ts +46 -0
- package/node_modules/zod/src/v3/tests/base.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/bigint.test.ts +55 -0
- package/node_modules/zod/src/v3/tests/branded.test.ts +53 -0
- package/node_modules/zod/src/v3/tests/catch.test.ts +220 -0
- package/node_modules/zod/src/v3/tests/coerce.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/complex.test.ts +56 -0
- package/node_modules/zod/src/v3/tests/custom.test.ts +31 -0
- package/node_modules/zod/src/v3/tests/date.test.ts +32 -0
- package/node_modules/zod/src/v3/tests/deepmasking.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/default.test.ts +112 -0
- package/node_modules/zod/src/v3/tests/description.test.ts +33 -0
- package/node_modules/zod/src/v3/tests/discriminated-unions.test.ts +315 -0
- package/node_modules/zod/src/v3/tests/enum.test.ts +80 -0
- package/node_modules/zod/src/v3/tests/error.test.ts +551 -0
- package/node_modules/zod/src/v3/tests/firstparty.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/firstpartyschematypes.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/function.test.ts +257 -0
- package/node_modules/zod/src/v3/tests/generics.test.ts +48 -0
- package/node_modules/zod/src/v3/tests/instanceof.test.ts +37 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/language-server.source.ts +76 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +207 -0
- package/node_modules/zod/src/v3/tests/literal.test.ts +36 -0
- package/node_modules/zod/src/v3/tests/map.test.ts +110 -0
- package/node_modules/zod/src/v3/tests/masking.test.ts +4 -0
- package/node_modules/zod/src/v3/tests/mocker.test.ts +19 -0
- package/node_modules/zod/src/v3/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v3/tests/nativeEnum.test.ts +87 -0
- package/node_modules/zod/src/v3/tests/nullable.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/number.test.ts +176 -0
- package/node_modules/zod/src/v3/tests/object-augmentation.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object-in-es5-env.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/object.test.ts +434 -0
- package/node_modules/zod/src/v3/tests/optional.test.ts +42 -0
- package/node_modules/zod/src/v3/tests/parseUtil.test.ts +23 -0
- package/node_modules/zod/src/v3/tests/parser.test.ts +41 -0
- package/node_modules/zod/src/v3/tests/partials.test.ts +243 -0
- package/node_modules/zod/src/v3/tests/pickomit.test.ts +111 -0
- package/node_modules/zod/src/v3/tests/pipeline.test.ts +29 -0
- package/node_modules/zod/src/v3/tests/preprocess.test.ts +186 -0
- package/node_modules/zod/src/v3/tests/primitive.test.ts +440 -0
- package/node_modules/zod/src/v3/tests/promise.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/readonly.test.ts +194 -0
- package/node_modules/zod/src/v3/tests/record.test.ts +171 -0
- package/node_modules/zod/src/v3/tests/recursive.test.ts +197 -0
- package/node_modules/zod/src/v3/tests/refine.test.ts +313 -0
- package/node_modules/zod/src/v3/tests/safeparse.test.ts +27 -0
- package/node_modules/zod/src/v3/tests/set.test.ts +142 -0
- package/node_modules/zod/src/v3/tests/standard-schema.test.ts +83 -0
- package/node_modules/zod/src/v3/tests/string.test.ts +916 -0
- package/node_modules/zod/src/v3/tests/transformer.test.ts +233 -0
- package/node_modules/zod/src/v3/tests/tuple.test.ts +90 -0
- package/node_modules/zod/src/v3/tests/unions.test.ts +57 -0
- package/node_modules/zod/src/v3/tests/validations.test.ts +133 -0
- package/node_modules/zod/src/v3/tests/void.test.ts +15 -0
- package/node_modules/zod/src/v3/types.ts +5136 -0
- package/node_modules/zod/src/v4/classic/checks.ts +30 -0
- package/node_modules/zod/src/v4/classic/coerce.ts +27 -0
- package/node_modules/zod/src/v4/classic/compat.ts +66 -0
- package/node_modules/zod/src/v4/classic/errors.ts +75 -0
- package/node_modules/zod/src/v4/classic/external.ts +50 -0
- package/node_modules/zod/src/v4/classic/index.ts +5 -0
- package/node_modules/zod/src/v4/classic/iso.ts +90 -0
- package/node_modules/zod/src/v4/classic/parse.ts +33 -0
- package/node_modules/zod/src/v4/classic/schemas.ts +2054 -0
- package/node_modules/zod/src/v4/classic/tests/anyunknown.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +264 -0
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +210 -0
- package/node_modules/zod/src/v4/classic/tests/async-parsing.test.ts +381 -0
- package/node_modules/zod/src/v4/classic/tests/async-refinements.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/base.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +54 -0
- package/node_modules/zod/src/v4/classic/tests/brand.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/coalesce.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/coerce.test.ts +160 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +352 -0
- package/node_modules/zod/src/v4/classic/tests/custom.test.ts +40 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +296 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +313 -0
- package/node_modules/zod/src/v4/classic/tests/description.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +619 -0
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +285 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +527 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +711 -0
- package/node_modules/zod/src/v4/classic/tests/file.test.ts +91 -0
- package/node_modules/zod/src/v4/classic/tests/firstparty.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +268 -0
- package/node_modules/zod/src/v4/classic/tests/generics.test.ts +72 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +829 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +34 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +171 -0
- package/node_modules/zod/src/v4/classic/tests/json.test.ts +108 -0
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +227 -0
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +92 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +196 -0
- package/node_modules/zod/src/v4/classic/tests/nan.test.ts +21 -0
- package/node_modules/zod/src/v4/classic/tests/nested-refine.test.ts +168 -0
- package/node_modules/zod/src/v4/classic/tests/nonoptional.test.ts +86 -0
- package/node_modules/zod/src/v4/classic/tests/nullable.test.ts +22 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +247 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +563 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +123 -0
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +147 -0
- package/node_modules/zod/src/v4/classic/tests/pickomit.test.ts +127 -0
- package/node_modules/zod/src/v4/classic/tests/pipe.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +37 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +298 -0
- package/node_modules/zod/src/v4/classic/tests/primitive.test.ts +175 -0
- package/node_modules/zod/src/v4/classic/tests/promise.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/prototypes.test.ts +23 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +252 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +342 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +356 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +532 -0
- package/node_modules/zod/src/v4/classic/tests/registries.test.ts +204 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +179 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +57 -0
- package/node_modules/zod/src/v4/classic/tests/string-formats.test.ts +109 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +881 -0
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +66 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +758 -0
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +2314 -0
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +250 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +163 -0
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +94 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +283 -0
- package/node_modules/zod/src/v4/classic/tests/void.test.ts +12 -0
- package/node_modules/zod/src/v4/core/api.ts +1594 -0
- package/node_modules/zod/src/v4/core/checks.ts +1283 -0
- package/node_modules/zod/src/v4/core/config.ts +15 -0
- package/node_modules/zod/src/v4/core/core.ts +134 -0
- package/node_modules/zod/src/v4/core/doc.ts +44 -0
- package/node_modules/zod/src/v4/core/errors.ts +424 -0
- package/node_modules/zod/src/v4/core/function.ts +176 -0
- package/node_modules/zod/src/v4/core/index.ts +15 -0
- package/node_modules/zod/src/v4/core/json-schema.ts +143 -0
- package/node_modules/zod/src/v4/core/parse.ts +94 -0
- package/node_modules/zod/src/v4/core/regexes.ts +135 -0
- package/node_modules/zod/src/v4/core/registries.ts +96 -0
- package/node_modules/zod/src/v4/core/schemas.ts +3842 -0
- package/node_modules/zod/src/v4/core/standard-schema.ts +64 -0
- package/node_modules/zod/src/v4/core/tests/index.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/locales/be.test.ts +124 -0
- package/node_modules/zod/src/v4/core/tests/locales/en.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/locales/ru.test.ts +128 -0
- package/node_modules/zod/src/v4/core/tests/locales/tr.test.ts +69 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +977 -0
- package/node_modules/zod/src/v4/core/util.ts +775 -0
- package/node_modules/zod/src/v4/core/versions.ts +5 -0
- package/node_modules/zod/src/v4/core/zsf.ts +323 -0
- package/node_modules/zod/src/v4/index.ts +4 -0
- package/node_modules/zod/src/v4/locales/ar.ts +125 -0
- package/node_modules/zod/src/v4/locales/az.ts +121 -0
- package/node_modules/zod/src/v4/locales/be.ts +184 -0
- package/node_modules/zod/src/v4/locales/ca.ts +127 -0
- package/node_modules/zod/src/v4/locales/cs.ts +142 -0
- package/node_modules/zod/src/v4/locales/de.ts +124 -0
- package/node_modules/zod/src/v4/locales/en.ts +127 -0
- package/node_modules/zod/src/v4/locales/eo.ts +125 -0
- package/node_modules/zod/src/v4/locales/es.ts +125 -0
- package/node_modules/zod/src/v4/locales/fa.ts +134 -0
- package/node_modules/zod/src/v4/locales/fi.ts +131 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +126 -0
- package/node_modules/zod/src/v4/locales/fr.ts +124 -0
- package/node_modules/zod/src/v4/locales/he.ts +125 -0
- package/node_modules/zod/src/v4/locales/hu.ts +126 -0
- package/node_modules/zod/src/v4/locales/id.ts +125 -0
- package/node_modules/zod/src/v4/locales/index.ts +39 -0
- package/node_modules/zod/src/v4/locales/it.ts +125 -0
- package/node_modules/zod/src/v4/locales/ja.ts +122 -0
- package/node_modules/zod/src/v4/locales/kh.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +131 -0
- package/node_modules/zod/src/v4/locales/mk.ts +127 -0
- package/node_modules/zod/src/v4/locales/ms.ts +124 -0
- package/node_modules/zod/src/v4/locales/nl.ts +126 -0
- package/node_modules/zod/src/v4/locales/no.ts +124 -0
- package/node_modules/zod/src/v4/locales/ota.ts +125 -0
- package/node_modules/zod/src/v4/locales/pl.ts +126 -0
- package/node_modules/zod/src/v4/locales/ps.ts +133 -0
- package/node_modules/zod/src/v4/locales/pt.ts +123 -0
- package/node_modules/zod/src/v4/locales/ru.ts +184 -0
- package/node_modules/zod/src/v4/locales/sl.ts +126 -0
- package/node_modules/zod/src/v4/locales/sv.ts +127 -0
- package/node_modules/zod/src/v4/locales/ta.ts +125 -0
- package/node_modules/zod/src/v4/locales/th.ts +126 -0
- package/node_modules/zod/src/v4/locales/tr.ts +121 -0
- package/node_modules/zod/src/v4/locales/ua.ts +126 -0
- package/node_modules/zod/src/v4/locales/ur.ts +126 -0
- package/node_modules/zod/src/v4/locales/vi.ts +125 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +123 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +125 -0
- package/node_modules/zod/src/v4/mini/checks.ts +32 -0
- package/node_modules/zod/src/v4/mini/coerce.ts +22 -0
- package/node_modules/zod/src/v4/mini/external.ts +40 -0
- package/node_modules/zod/src/v4/mini/index.ts +3 -0
- package/node_modules/zod/src/v4/mini/iso.ts +62 -0
- package/node_modules/zod/src/v4/mini/parse.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +1579 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +129 -0
- package/node_modules/zod/src/v4/mini/tests/brand.test.ts +51 -0
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +144 -0
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +36 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +22 -0
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +871 -0
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +95 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +185 -0
- package/node_modules/zod/src/v4/mini/tests/prototypes.test.ts +43 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +275 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +299 -0
- package/node_modules/zod/src/v4-mini/index.ts +1 -0
- package/node_modules/zod/v3/ZodError.cjs +138 -0
- package/node_modules/zod/v3/ZodError.d.cts +164 -0
- package/node_modules/zod/v3/ZodError.d.ts +164 -0
- package/node_modules/zod/v3/ZodError.js +133 -0
- package/node_modules/zod/v3/errors.cjs +17 -0
- package/node_modules/zod/v3/errors.d.cts +5 -0
- package/node_modules/zod/v3/errors.d.ts +5 -0
- package/node_modules/zod/v3/errors.js +9 -0
- package/node_modules/zod/v3/external.cjs +22 -0
- package/node_modules/zod/v3/external.d.cts +6 -0
- package/node_modules/zod/v3/external.d.ts +6 -0
- package/node_modules/zod/v3/external.js +6 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/enumUtil.js +1 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.cts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.d.ts +9 -0
- package/node_modules/zod/v3/helpers/errorUtil.js +6 -0
- package/node_modules/zod/v3/helpers/parseUtil.cjs +124 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.cts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.d.ts +78 -0
- package/node_modules/zod/v3/helpers/parseUtil.js +109 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +2 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.cts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.d.ts +8 -0
- package/node_modules/zod/v3/helpers/partialUtil.js +1 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.cts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.d.ts +2 -0
- package/node_modules/zod/v3/helpers/typeAliases.js +1 -0
- package/node_modules/zod/v3/helpers/util.cjs +137 -0
- package/node_modules/zod/v3/helpers/util.d.cts +85 -0
- package/node_modules/zod/v3/helpers/util.d.ts +85 -0
- package/node_modules/zod/v3/helpers/util.js +133 -0
- package/node_modules/zod/v3/index.cjs +33 -0
- package/node_modules/zod/v3/index.d.cts +4 -0
- package/node_modules/zod/v3/index.d.ts +4 -0
- package/node_modules/zod/v3/index.js +4 -0
- package/node_modules/zod/v3/locales/en.cjs +111 -0
- package/node_modules/zod/v3/locales/en.d.cts +3 -0
- package/node_modules/zod/v3/locales/en.d.ts +3 -0
- package/node_modules/zod/v3/locales/en.js +109 -0
- package/node_modules/zod/v3/standard-schema.cjs +2 -0
- package/node_modules/zod/v3/standard-schema.d.cts +102 -0
- package/node_modules/zod/v3/standard-schema.d.ts +102 -0
- package/node_modules/zod/v3/standard-schema.js +1 -0
- package/node_modules/zod/v3/types.cjs +3775 -0
- package/node_modules/zod/v3/types.d.cts +1031 -0
- package/node_modules/zod/v3/types.d.ts +1031 -0
- package/node_modules/zod/v3/types.js +3693 -0
- package/node_modules/zod/v4/classic/checks.cjs +32 -0
- package/node_modules/zod/v4/classic/checks.d.cts +1 -0
- package/node_modules/zod/v4/classic/checks.d.ts +1 -0
- package/node_modules/zod/v4/classic/checks.js +1 -0
- package/node_modules/zod/v4/classic/coerce.cjs +47 -0
- package/node_modules/zod/v4/classic/coerce.d.cts +17 -0
- package/node_modules/zod/v4/classic/coerce.d.ts +17 -0
- package/node_modules/zod/v4/classic/coerce.js +17 -0
- package/node_modules/zod/v4/classic/compat.cjs +57 -0
- package/node_modules/zod/v4/classic/compat.d.cts +46 -0
- package/node_modules/zod/v4/classic/compat.d.ts +46 -0
- package/node_modules/zod/v4/classic/compat.js +27 -0
- package/node_modules/zod/v4/classic/errors.cjs +67 -0
- package/node_modules/zod/v4/classic/errors.d.cts +30 -0
- package/node_modules/zod/v4/classic/errors.d.ts +30 -0
- package/node_modules/zod/v4/classic/errors.js +41 -0
- package/node_modules/zod/v4/classic/external.cjs +70 -0
- package/node_modules/zod/v4/classic/external.d.cts +13 -0
- package/node_modules/zod/v4/classic/external.d.ts +13 -0
- package/node_modules/zod/v4/classic/external.js +18 -0
- package/node_modules/zod/v4/classic/index.cjs +33 -0
- package/node_modules/zod/v4/classic/index.d.cts +4 -0
- package/node_modules/zod/v4/classic/index.d.ts +4 -0
- package/node_modules/zod/v4/classic/index.js +4 -0
- package/node_modules/zod/v4/classic/iso.cjs +60 -0
- package/node_modules/zod/v4/classic/iso.d.cts +22 -0
- package/node_modules/zod/v4/classic/iso.d.ts +22 -0
- package/node_modules/zod/v4/classic/iso.js +30 -0
- package/node_modules/zod/v4/classic/parse.cjs +32 -0
- package/node_modules/zod/v4/classic/parse.d.cts +23 -0
- package/node_modules/zod/v4/classic/parse.d.ts +23 -0
- package/node_modules/zod/v4/classic/parse.js +6 -0
- package/node_modules/zod/v4/classic/schemas.cjs +1109 -0
- package/node_modules/zod/v4/classic/schemas.d.cts +630 -0
- package/node_modules/zod/v4/classic/schemas.d.ts +630 -0
- package/node_modules/zod/v4/classic/schemas.js +1006 -0
- package/node_modules/zod/v4/core/api.cjs +1039 -0
- package/node_modules/zod/v4/core/api.d.cts +284 -0
- package/node_modules/zod/v4/core/api.d.ts +284 -0
- package/node_modules/zod/v4/core/api.js +906 -0
- package/node_modules/zod/v4/core/checks.cjs +591 -0
- package/node_modules/zod/v4/core/checks.d.cts +278 -0
- package/node_modules/zod/v4/core/checks.d.ts +278 -0
- package/node_modules/zod/v4/core/checks.js +565 -0
- package/node_modules/zod/v4/core/core.cjs +67 -0
- package/node_modules/zod/v4/core/core.d.cts +49 -0
- package/node_modules/zod/v4/core/core.d.ts +49 -0
- package/node_modules/zod/v4/core/core.js +61 -0
- package/node_modules/zod/v4/core/doc.cjs +39 -0
- package/node_modules/zod/v4/core/doc.d.cts +14 -0
- package/node_modules/zod/v4/core/doc.d.ts +14 -0
- package/node_modules/zod/v4/core/doc.js +35 -0
- package/node_modules/zod/v4/core/errors.cjs +226 -0
- package/node_modules/zod/v4/core/errors.d.cts +208 -0
- package/node_modules/zod/v4/core/errors.d.ts +208 -0
- package/node_modules/zod/v4/core/errors.js +195 -0
- package/node_modules/zod/v4/core/function.cjs +102 -0
- package/node_modules/zod/v4/core/function.d.cts +52 -0
- package/node_modules/zod/v4/core/function.d.ts +52 -0
- package/node_modules/zod/v4/core/function.js +75 -0
- package/node_modules/zod/v4/core/index.cjs +44 -0
- package/node_modules/zod/v4/core/index.d.cts +15 -0
- package/node_modules/zod/v4/core/index.d.ts +15 -0
- package/node_modules/zod/v4/core/index.js +15 -0
- package/node_modules/zod/v4/core/json-schema.cjs +2 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +87 -0
- package/node_modules/zod/v4/core/json-schema.d.ts +87 -0
- package/node_modules/zod/v4/core/json-schema.js +1 -0
- package/node_modules/zod/v4/core/parse.cjs +87 -0
- package/node_modules/zod/v4/core/parse.d.cts +25 -0
- package/node_modules/zod/v4/core/parse.d.ts +25 -0
- package/node_modules/zod/v4/core/parse.js +57 -0
- package/node_modules/zod/v4/core/regexes.cjs +103 -0
- package/node_modules/zod/v4/core/regexes.d.cts +62 -0
- package/node_modules/zod/v4/core/regexes.d.ts +62 -0
- package/node_modules/zod/v4/core/regexes.js +95 -0
- package/node_modules/zod/v4/core/registries.cjs +56 -0
- package/node_modules/zod/v4/core/registries.d.cts +35 -0
- package/node_modules/zod/v4/core/registries.d.ts +35 -0
- package/node_modules/zod/v4/core/registries.js +51 -0
- package/node_modules/zod/v4/core/schemas.cjs +1748 -0
- package/node_modules/zod/v4/core/schemas.d.cts +1041 -0
- package/node_modules/zod/v4/core/schemas.d.ts +1041 -0
- package/node_modules/zod/v4/core/schemas.js +1717 -0
- package/node_modules/zod/v4/core/standard-schema.cjs +2 -0
- package/node_modules/zod/v4/core/standard-schema.d.cts +55 -0
- package/node_modules/zod/v4/core/standard-schema.d.ts +55 -0
- package/node_modules/zod/v4/core/standard-schema.js +1 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +854 -0
- package/node_modules/zod/v4/core/to-json-schema.d.cts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.d.ts +88 -0
- package/node_modules/zod/v4/core/to-json-schema.js +849 -0
- package/node_modules/zod/v4/core/util.cjs +539 -0
- package/node_modules/zod/v4/core/util.d.cts +183 -0
- package/node_modules/zod/v4/core/util.d.ts +183 -0
- package/node_modules/zod/v4/core/util.js +493 -0
- package/node_modules/zod/v4/core/versions.cjs +8 -0
- package/node_modules/zod/v4/core/versions.d.cts +5 -0
- package/node_modules/zod/v4/core/versions.d.ts +5 -0
- package/node_modules/zod/v4/core/versions.js +5 -0
- package/node_modules/zod/v4/index.cjs +22 -0
- package/node_modules/zod/v4/index.d.cts +3 -0
- package/node_modules/zod/v4/index.d.ts +3 -0
- package/node_modules/zod/v4/index.js +3 -0
- package/node_modules/zod/v4/locales/ar.cjs +142 -0
- package/node_modules/zod/v4/locales/ar.d.cts +4 -0
- package/node_modules/zod/v4/locales/ar.d.ts +4 -0
- package/node_modules/zod/v4/locales/ar.js +116 -0
- package/node_modules/zod/v4/locales/az.cjs +141 -0
- package/node_modules/zod/v4/locales/az.d.cts +4 -0
- package/node_modules/zod/v4/locales/az.d.ts +4 -0
- package/node_modules/zod/v4/locales/az.js +115 -0
- package/node_modules/zod/v4/locales/be.cjs +190 -0
- package/node_modules/zod/v4/locales/be.d.cts +4 -0
- package/node_modules/zod/v4/locales/be.d.ts +4 -0
- package/node_modules/zod/v4/locales/be.js +164 -0
- package/node_modules/zod/v4/locales/ca.cjs +144 -0
- package/node_modules/zod/v4/locales/ca.d.cts +4 -0
- package/node_modules/zod/v4/locales/ca.d.ts +4 -0
- package/node_modules/zod/v4/locales/ca.js +118 -0
- package/node_modules/zod/v4/locales/cs.cjs +161 -0
- package/node_modules/zod/v4/locales/cs.d.cts +4 -0
- package/node_modules/zod/v4/locales/cs.d.ts +4 -0
- package/node_modules/zod/v4/locales/cs.js +135 -0
- package/node_modules/zod/v4/locales/de.cjs +142 -0
- package/node_modules/zod/v4/locales/de.d.cts +4 -0
- package/node_modules/zod/v4/locales/de.d.ts +4 -0
- package/node_modules/zod/v4/locales/de.js +116 -0
- package/node_modules/zod/v4/locales/en.cjs +145 -0
- package/node_modules/zod/v4/locales/en.d.cts +5 -0
- package/node_modules/zod/v4/locales/en.d.ts +5 -0
- package/node_modules/zod/v4/locales/en.js +117 -0
- package/node_modules/zod/v4/locales/eo.cjs +144 -0
- package/node_modules/zod/v4/locales/eo.d.cts +5 -0
- package/node_modules/zod/v4/locales/eo.d.ts +5 -0
- package/node_modules/zod/v4/locales/eo.js +116 -0
- package/node_modules/zod/v4/locales/es.cjs +143 -0
- package/node_modules/zod/v4/locales/es.d.cts +4 -0
- package/node_modules/zod/v4/locales/es.d.ts +4 -0
- package/node_modules/zod/v4/locales/es.js +117 -0
- package/node_modules/zod/v4/locales/fa.cjs +148 -0
- package/node_modules/zod/v4/locales/fa.d.cts +4 -0
- package/node_modules/zod/v4/locales/fa.d.ts +4 -0
- package/node_modules/zod/v4/locales/fa.js +122 -0
- package/node_modules/zod/v4/locales/fi.cjs +148 -0
- package/node_modules/zod/v4/locales/fi.d.cts +4 -0
- package/node_modules/zod/v4/locales/fi.d.ts +4 -0
- package/node_modules/zod/v4/locales/fi.js +122 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +143 -0
- package/node_modules/zod/v4/locales/fr-CA.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr-CA.js +117 -0
- package/node_modules/zod/v4/locales/fr.cjs +142 -0
- package/node_modules/zod/v4/locales/fr.d.cts +4 -0
- package/node_modules/zod/v4/locales/fr.d.ts +4 -0
- package/node_modules/zod/v4/locales/fr.js +116 -0
- package/node_modules/zod/v4/locales/he.cjs +143 -0
- package/node_modules/zod/v4/locales/he.d.cts +4 -0
- package/node_modules/zod/v4/locales/he.d.ts +4 -0
- package/node_modules/zod/v4/locales/he.js +117 -0
- package/node_modules/zod/v4/locales/hu.cjs +143 -0
- package/node_modules/zod/v4/locales/hu.d.cts +4 -0
- package/node_modules/zod/v4/locales/hu.d.ts +4 -0
- package/node_modules/zod/v4/locales/hu.js +117 -0
- package/node_modules/zod/v4/locales/id.cjs +142 -0
- package/node_modules/zod/v4/locales/id.d.cts +4 -0
- package/node_modules/zod/v4/locales/id.d.ts +4 -0
- package/node_modules/zod/v4/locales/id.js +116 -0
- package/node_modules/zod/v4/locales/index.cjs +84 -0
- package/node_modules/zod/v4/locales/index.d.cts +39 -0
- package/node_modules/zod/v4/locales/index.d.ts +39 -0
- package/node_modules/zod/v4/locales/index.js +39 -0
- package/node_modules/zod/v4/locales/it.cjs +143 -0
- package/node_modules/zod/v4/locales/it.d.cts +4 -0
- package/node_modules/zod/v4/locales/it.d.ts +4 -0
- package/node_modules/zod/v4/locales/it.js +117 -0
- package/node_modules/zod/v4/locales/ja.cjs +141 -0
- package/node_modules/zod/v4/locales/ja.d.cts +4 -0
- package/node_modules/zod/v4/locales/ja.d.ts +4 -0
- package/node_modules/zod/v4/locales/ja.js +115 -0
- package/node_modules/zod/v4/locales/kh.cjs +143 -0
- package/node_modules/zod/v4/locales/kh.d.cts +4 -0
- package/node_modules/zod/v4/locales/kh.d.ts +4 -0
- package/node_modules/zod/v4/locales/kh.js +117 -0
- package/node_modules/zod/v4/locales/ko.cjs +147 -0
- package/node_modules/zod/v4/locales/ko.d.cts +4 -0
- package/node_modules/zod/v4/locales/ko.d.ts +4 -0
- package/node_modules/zod/v4/locales/ko.js +121 -0
- package/node_modules/zod/v4/locales/mk.cjs +144 -0
- package/node_modules/zod/v4/locales/mk.d.cts +4 -0
- package/node_modules/zod/v4/locales/mk.d.ts +4 -0
- package/node_modules/zod/v4/locales/mk.js +118 -0
- package/node_modules/zod/v4/locales/ms.cjs +142 -0
- package/node_modules/zod/v4/locales/ms.d.cts +4 -0
- package/node_modules/zod/v4/locales/ms.d.ts +4 -0
- package/node_modules/zod/v4/locales/ms.js +116 -0
- package/node_modules/zod/v4/locales/nl.cjs +143 -0
- package/node_modules/zod/v4/locales/nl.d.cts +4 -0
- package/node_modules/zod/v4/locales/nl.d.ts +4 -0
- package/node_modules/zod/v4/locales/nl.js +117 -0
- package/node_modules/zod/v4/locales/no.cjs +142 -0
- package/node_modules/zod/v4/locales/no.d.cts +4 -0
- package/node_modules/zod/v4/locales/no.d.ts +4 -0
- package/node_modules/zod/v4/locales/no.js +116 -0
- package/node_modules/zod/v4/locales/ota.cjs +143 -0
- package/node_modules/zod/v4/locales/ota.d.cts +4 -0
- package/node_modules/zod/v4/locales/ota.d.ts +4 -0
- package/node_modules/zod/v4/locales/ota.js +117 -0
- package/node_modules/zod/v4/locales/pl.cjs +143 -0
- package/node_modules/zod/v4/locales/pl.d.cts +4 -0
- package/node_modules/zod/v4/locales/pl.d.ts +4 -0
- package/node_modules/zod/v4/locales/pl.js +117 -0
- package/node_modules/zod/v4/locales/ps.cjs +148 -0
- package/node_modules/zod/v4/locales/ps.d.cts +4 -0
- package/node_modules/zod/v4/locales/ps.d.ts +4 -0
- package/node_modules/zod/v4/locales/ps.js +122 -0
- package/node_modules/zod/v4/locales/pt.cjs +142 -0
- package/node_modules/zod/v4/locales/pt.d.cts +4 -0
- package/node_modules/zod/v4/locales/pt.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt.js +116 -0
- package/node_modules/zod/v4/locales/ru.cjs +190 -0
- package/node_modules/zod/v4/locales/ru.d.cts +4 -0
- package/node_modules/zod/v4/locales/ru.d.ts +4 -0
- package/node_modules/zod/v4/locales/ru.js +164 -0
- package/node_modules/zod/v4/locales/sl.cjs +143 -0
- package/node_modules/zod/v4/locales/sl.d.cts +4 -0
- package/node_modules/zod/v4/locales/sl.d.ts +4 -0
- package/node_modules/zod/v4/locales/sl.js +117 -0
- package/node_modules/zod/v4/locales/sv.cjs +144 -0
- package/node_modules/zod/v4/locales/sv.d.cts +4 -0
- package/node_modules/zod/v4/locales/sv.d.ts +4 -0
- package/node_modules/zod/v4/locales/sv.js +118 -0
- package/node_modules/zod/v4/locales/ta.cjs +143 -0
- package/node_modules/zod/v4/locales/ta.d.cts +4 -0
- package/node_modules/zod/v4/locales/ta.d.ts +4 -0
- package/node_modules/zod/v4/locales/ta.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +143 -0
- package/node_modules/zod/v4/locales/th.d.cts +4 -0
- package/node_modules/zod/v4/locales/th.d.ts +4 -0
- package/node_modules/zod/v4/locales/th.js +117 -0
- package/node_modules/zod/v4/locales/tr.cjs +143 -0
- package/node_modules/zod/v4/locales/tr.d.cts +5 -0
- package/node_modules/zod/v4/locales/tr.d.ts +5 -0
- package/node_modules/zod/v4/locales/tr.js +115 -0
- package/node_modules/zod/v4/locales/ua.cjs +143 -0
- package/node_modules/zod/v4/locales/ua.d.cts +4 -0
- package/node_modules/zod/v4/locales/ua.d.ts +4 -0
- package/node_modules/zod/v4/locales/ua.js +117 -0
- package/node_modules/zod/v4/locales/ur.cjs +143 -0
- package/node_modules/zod/v4/locales/ur.d.cts +4 -0
- package/node_modules/zod/v4/locales/ur.d.ts +4 -0
- package/node_modules/zod/v4/locales/ur.js +117 -0
- package/node_modules/zod/v4/locales/vi.cjs +142 -0
- package/node_modules/zod/v4/locales/vi.d.cts +4 -0
- package/node_modules/zod/v4/locales/vi.d.ts +4 -0
- package/node_modules/zod/v4/locales/vi.js +116 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +142 -0
- package/node_modules/zod/v4/locales/zh-CN.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-CN.js +116 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +143 -0
- package/node_modules/zod/v4/locales/zh-TW.d.cts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.d.ts +4 -0
- package/node_modules/zod/v4/locales/zh-TW.js +117 -0
- package/node_modules/zod/v4/mini/checks.cjs +34 -0
- package/node_modules/zod/v4/mini/checks.d.cts +1 -0
- package/node_modules/zod/v4/mini/checks.d.ts +1 -0
- package/node_modules/zod/v4/mini/checks.js +1 -0
- package/node_modules/zod/v4/mini/coerce.cjs +47 -0
- package/node_modules/zod/v4/mini/coerce.d.cts +7 -0
- package/node_modules/zod/v4/mini/coerce.d.ts +7 -0
- package/node_modules/zod/v4/mini/coerce.js +17 -0
- package/node_modules/zod/v4/mini/external.cjs +62 -0
- package/node_modules/zod/v4/mini/external.d.cts +11 -0
- package/node_modules/zod/v4/mini/external.d.ts +11 -0
- package/node_modules/zod/v4/mini/external.js +13 -0
- package/node_modules/zod/v4/mini/index.cjs +32 -0
- package/node_modules/zod/v4/mini/index.d.cts +3 -0
- package/node_modules/zod/v4/mini/index.d.ts +3 -0
- package/node_modules/zod/v4/mini/index.js +3 -0
- package/node_modules/zod/v4/mini/iso.cjs +60 -0
- package/node_modules/zod/v4/mini/iso.d.cts +22 -0
- package/node_modules/zod/v4/mini/iso.d.ts +22 -0
- package/node_modules/zod/v4/mini/iso.js +30 -0
- package/node_modules/zod/v4/mini/parse.cjs +8 -0
- package/node_modules/zod/v4/mini/parse.d.cts +1 -0
- package/node_modules/zod/v4/mini/parse.d.ts +1 -0
- package/node_modules/zod/v4/mini/parse.js +1 -0
- package/node_modules/zod/v4/mini/schemas.cjs +839 -0
- package/node_modules/zod/v4/mini/schemas.d.cts +356 -0
- package/node_modules/zod/v4/mini/schemas.d.ts +356 -0
- package/node_modules/zod/v4/mini/schemas.js +732 -0
- package/node_modules/zod/v4-mini/index.cjs +17 -0
- package/node_modules/zod/v4-mini/index.d.cts +1 -0
- package/node_modules/zod/v4-mini/index.d.ts +1 -0
- package/node_modules/zod/v4-mini/index.js +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1,1294 @@
|
|
|
1
|
+
// Copyright (c) 2005 Tom Wu
|
|
2
|
+
// All Rights Reserved.
|
|
3
|
+
// See "LICENSE" for details.
|
|
4
|
+
|
|
5
|
+
// Basic JavaScript BN library - subset useful for RSA encryption.
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
Licensing (LICENSE)
|
|
9
|
+
-------------------
|
|
10
|
+
|
|
11
|
+
This software is covered under the following copyright:
|
|
12
|
+
*/
|
|
13
|
+
/*
|
|
14
|
+
* Copyright (c) 2003-2005 Tom Wu
|
|
15
|
+
* All Rights Reserved.
|
|
16
|
+
*
|
|
17
|
+
* Permission is hereby granted, free of charge, to any person obtaining
|
|
18
|
+
* a copy of this software and associated documentation files (the
|
|
19
|
+
* "Software"), to deal in the Software without restriction, including
|
|
20
|
+
* without limitation the rights to use, copy, modify, merge, publish,
|
|
21
|
+
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
22
|
+
* permit persons to whom the Software is furnished to do so, subject to
|
|
23
|
+
* the following conditions:
|
|
24
|
+
*
|
|
25
|
+
* The above copyright notice and this permission notice shall be
|
|
26
|
+
* included in all copies or substantial portions of the Software.
|
|
27
|
+
*
|
|
28
|
+
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
|
29
|
+
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
|
30
|
+
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
|
31
|
+
*
|
|
32
|
+
* IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
|
33
|
+
* INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
|
34
|
+
* RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
|
35
|
+
* THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
|
36
|
+
* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
37
|
+
*
|
|
38
|
+
* In addition, the following condition applies:
|
|
39
|
+
*
|
|
40
|
+
* All redistributions must retain an intact copy of this copyright notice
|
|
41
|
+
* and disclaimer.
|
|
42
|
+
*/
|
|
43
|
+
/*
|
|
44
|
+
Address all questions regarding this license to:
|
|
45
|
+
|
|
46
|
+
Tom Wu
|
|
47
|
+
tjw@cs.Stanford.EDU
|
|
48
|
+
*/
|
|
49
|
+
var forge = require('./forge');
|
|
50
|
+
|
|
51
|
+
module.exports = forge.jsbn = forge.jsbn || {};
|
|
52
|
+
|
|
53
|
+
// Bits per digit
|
|
54
|
+
var dbits;
|
|
55
|
+
|
|
56
|
+
// JavaScript engine analysis
|
|
57
|
+
var canary = 0xdeadbeefcafe;
|
|
58
|
+
var j_lm = ((canary&0xffffff)==0xefcafe);
|
|
59
|
+
|
|
60
|
+
// (public) Constructor
|
|
61
|
+
function BigInteger(a,b,c) {
|
|
62
|
+
this.data = [];
|
|
63
|
+
if(a != null)
|
|
64
|
+
if("number" == typeof a) this.fromNumber(a,b,c);
|
|
65
|
+
else if(b == null && "string" != typeof a) this.fromString(a,256);
|
|
66
|
+
else this.fromString(a,b);
|
|
67
|
+
}
|
|
68
|
+
forge.jsbn.BigInteger = BigInteger;
|
|
69
|
+
|
|
70
|
+
// return new, unset BigInteger
|
|
71
|
+
function nbi() { return new BigInteger(null); }
|
|
72
|
+
|
|
73
|
+
// am: Compute w_j += (x*this_i), propagate carries,
|
|
74
|
+
// c is initial carry, returns final carry.
|
|
75
|
+
// c < 3*dvalue, x < 2*dvalue, this_i < dvalue
|
|
76
|
+
// We need to select the fastest one that works in this environment.
|
|
77
|
+
|
|
78
|
+
// am1: use a single mult and divide to get the high bits,
|
|
79
|
+
// max digit bits should be 26 because
|
|
80
|
+
// max internal value = 2*dvalue^2-2*dvalue (< 2^53)
|
|
81
|
+
function am1(i,x,w,j,c,n) {
|
|
82
|
+
while(--n >= 0) {
|
|
83
|
+
var v = x*this.data[i++]+w.data[j]+c;
|
|
84
|
+
c = Math.floor(v/0x4000000);
|
|
85
|
+
w.data[j++] = v&0x3ffffff;
|
|
86
|
+
}
|
|
87
|
+
return c;
|
|
88
|
+
}
|
|
89
|
+
// am2 avoids a big mult-and-extract completely.
|
|
90
|
+
// Max digit bits should be <= 30 because we do bitwise ops
|
|
91
|
+
// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31)
|
|
92
|
+
function am2(i,x,w,j,c,n) {
|
|
93
|
+
var xl = x&0x7fff, xh = x>>15;
|
|
94
|
+
while(--n >= 0) {
|
|
95
|
+
var l = this.data[i]&0x7fff;
|
|
96
|
+
var h = this.data[i++]>>15;
|
|
97
|
+
var m = xh*l+h*xl;
|
|
98
|
+
l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff);
|
|
99
|
+
c = (l>>>30)+(m>>>15)+xh*h+(c>>>30);
|
|
100
|
+
w.data[j++] = l&0x3fffffff;
|
|
101
|
+
}
|
|
102
|
+
return c;
|
|
103
|
+
}
|
|
104
|
+
// Alternately, set max digit bits to 28 since some
|
|
105
|
+
// browsers slow down when dealing with 32-bit numbers.
|
|
106
|
+
function am3(i,x,w,j,c,n) {
|
|
107
|
+
var xl = x&0x3fff, xh = x>>14;
|
|
108
|
+
while(--n >= 0) {
|
|
109
|
+
var l = this.data[i]&0x3fff;
|
|
110
|
+
var h = this.data[i++]>>14;
|
|
111
|
+
var m = xh*l+h*xl;
|
|
112
|
+
l = xl*l+((m&0x3fff)<<14)+w.data[j]+c;
|
|
113
|
+
c = (l>>28)+(m>>14)+xh*h;
|
|
114
|
+
w.data[j++] = l&0xfffffff;
|
|
115
|
+
}
|
|
116
|
+
return c;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// node.js (no browser)
|
|
120
|
+
if(typeof(navigator) === 'undefined')
|
|
121
|
+
{
|
|
122
|
+
BigInteger.prototype.am = am3;
|
|
123
|
+
dbits = 28;
|
|
124
|
+
} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) {
|
|
125
|
+
BigInteger.prototype.am = am2;
|
|
126
|
+
dbits = 30;
|
|
127
|
+
}
|
|
128
|
+
else if(j_lm && (navigator.appName != "Netscape")) {
|
|
129
|
+
BigInteger.prototype.am = am1;
|
|
130
|
+
dbits = 26;
|
|
131
|
+
}
|
|
132
|
+
else { // Mozilla/Netscape seems to prefer am3
|
|
133
|
+
BigInteger.prototype.am = am3;
|
|
134
|
+
dbits = 28;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
BigInteger.prototype.DB = dbits;
|
|
138
|
+
BigInteger.prototype.DM = ((1<<dbits)-1);
|
|
139
|
+
BigInteger.prototype.DV = (1<<dbits);
|
|
140
|
+
|
|
141
|
+
var BI_FP = 52;
|
|
142
|
+
BigInteger.prototype.FV = Math.pow(2,BI_FP);
|
|
143
|
+
BigInteger.prototype.F1 = BI_FP-dbits;
|
|
144
|
+
BigInteger.prototype.F2 = 2*dbits-BI_FP;
|
|
145
|
+
|
|
146
|
+
// Digit conversions
|
|
147
|
+
var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz";
|
|
148
|
+
var BI_RC = new Array();
|
|
149
|
+
var rr,vv;
|
|
150
|
+
rr = "0".charCodeAt(0);
|
|
151
|
+
for(vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv;
|
|
152
|
+
rr = "a".charCodeAt(0);
|
|
153
|
+
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
154
|
+
rr = "A".charCodeAt(0);
|
|
155
|
+
for(vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv;
|
|
156
|
+
|
|
157
|
+
function int2char(n) { return BI_RM.charAt(n); }
|
|
158
|
+
function intAt(s,i) {
|
|
159
|
+
var c = BI_RC[s.charCodeAt(i)];
|
|
160
|
+
return (c==null)?-1:c;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// (protected) copy this to r
|
|
164
|
+
function bnpCopyTo(r) {
|
|
165
|
+
for(var i = this.t-1; i >= 0; --i) r.data[i] = this.data[i];
|
|
166
|
+
r.t = this.t;
|
|
167
|
+
r.s = this.s;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// (protected) set from integer value x, -DV <= x < DV
|
|
171
|
+
function bnpFromInt(x) {
|
|
172
|
+
this.t = 1;
|
|
173
|
+
this.s = (x<0)?-1:0;
|
|
174
|
+
if(x > 0) this.data[0] = x;
|
|
175
|
+
else if(x < -1) this.data[0] = x+this.DV;
|
|
176
|
+
else this.t = 0;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// return bigint initialized to value
|
|
180
|
+
function nbv(i) { var r = nbi(); r.fromInt(i); return r; }
|
|
181
|
+
|
|
182
|
+
// (protected) set from string and radix
|
|
183
|
+
function bnpFromString(s,b) {
|
|
184
|
+
var k;
|
|
185
|
+
if(b == 16) k = 4;
|
|
186
|
+
else if(b == 8) k = 3;
|
|
187
|
+
else if(b == 256) k = 8; // byte array
|
|
188
|
+
else if(b == 2) k = 1;
|
|
189
|
+
else if(b == 32) k = 5;
|
|
190
|
+
else if(b == 4) k = 2;
|
|
191
|
+
else { this.fromRadix(s,b); return; }
|
|
192
|
+
this.t = 0;
|
|
193
|
+
this.s = 0;
|
|
194
|
+
var i = s.length, mi = false, sh = 0;
|
|
195
|
+
while(--i >= 0) {
|
|
196
|
+
var x = (k==8)?s[i]&0xff:intAt(s,i);
|
|
197
|
+
if(x < 0) {
|
|
198
|
+
if(s.charAt(i) == "-") mi = true;
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
mi = false;
|
|
202
|
+
if(sh == 0)
|
|
203
|
+
this.data[this.t++] = x;
|
|
204
|
+
else if(sh+k > this.DB) {
|
|
205
|
+
this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<<sh;
|
|
206
|
+
this.data[this.t++] = (x>>(this.DB-sh));
|
|
207
|
+
}
|
|
208
|
+
else
|
|
209
|
+
this.data[this.t-1] |= x<<sh;
|
|
210
|
+
sh += k;
|
|
211
|
+
if(sh >= this.DB) sh -= this.DB;
|
|
212
|
+
}
|
|
213
|
+
if(k == 8 && (s[0]&0x80) != 0) {
|
|
214
|
+
this.s = -1;
|
|
215
|
+
if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)<<sh;
|
|
216
|
+
}
|
|
217
|
+
this.clamp();
|
|
218
|
+
if(mi) BigInteger.ZERO.subTo(this,this);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// (protected) clamp off excess high words
|
|
222
|
+
function bnpClamp() {
|
|
223
|
+
var c = this.s&this.DM;
|
|
224
|
+
while(this.t > 0 && this.data[this.t-1] == c) --this.t;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// (public) return string representation in given radix
|
|
228
|
+
function bnToString(b) {
|
|
229
|
+
if(this.s < 0) return "-"+this.negate().toString(b);
|
|
230
|
+
var k;
|
|
231
|
+
if(b == 16) k = 4;
|
|
232
|
+
else if(b == 8) k = 3;
|
|
233
|
+
else if(b == 2) k = 1;
|
|
234
|
+
else if(b == 32) k = 5;
|
|
235
|
+
else if(b == 4) k = 2;
|
|
236
|
+
else return this.toRadix(b);
|
|
237
|
+
var km = (1<<k)-1, d, m = false, r = "", i = this.t;
|
|
238
|
+
var p = this.DB-(i*this.DB)%k;
|
|
239
|
+
if(i-- > 0) {
|
|
240
|
+
if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); }
|
|
241
|
+
while(i >= 0) {
|
|
242
|
+
if(p < k) {
|
|
243
|
+
d = (this.data[i]&((1<<p)-1))<<(k-p);
|
|
244
|
+
d |= this.data[--i]>>(p+=this.DB-k);
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
d = (this.data[i]>>(p-=k))&km;
|
|
248
|
+
if(p <= 0) { p += this.DB; --i; }
|
|
249
|
+
}
|
|
250
|
+
if(d > 0) m = true;
|
|
251
|
+
if(m) r += int2char(d);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return m?r:"0";
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// (public) -this
|
|
258
|
+
function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; }
|
|
259
|
+
|
|
260
|
+
// (public) |this|
|
|
261
|
+
function bnAbs() { return (this.s<0)?this.negate():this; }
|
|
262
|
+
|
|
263
|
+
// (public) return + if this > a, - if this < a, 0 if equal
|
|
264
|
+
function bnCompareTo(a) {
|
|
265
|
+
var r = this.s-a.s;
|
|
266
|
+
if(r != 0) return r;
|
|
267
|
+
var i = this.t;
|
|
268
|
+
r = i-a.t;
|
|
269
|
+
if(r != 0) return (this.s<0)?-r:r;
|
|
270
|
+
while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r;
|
|
271
|
+
return 0;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// returns bit length of the integer x
|
|
275
|
+
function nbits(x) {
|
|
276
|
+
var r = 1, t;
|
|
277
|
+
if((t=x>>>16) != 0) { x = t; r += 16; }
|
|
278
|
+
if((t=x>>8) != 0) { x = t; r += 8; }
|
|
279
|
+
if((t=x>>4) != 0) { x = t; r += 4; }
|
|
280
|
+
if((t=x>>2) != 0) { x = t; r += 2; }
|
|
281
|
+
if((t=x>>1) != 0) { x = t; r += 1; }
|
|
282
|
+
return r;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// (public) return the number of bits in "this"
|
|
286
|
+
function bnBitLength() {
|
|
287
|
+
if(this.t <= 0) return 0;
|
|
288
|
+
return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM));
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// (protected) r = this << n*DB
|
|
292
|
+
function bnpDLShiftTo(n,r) {
|
|
293
|
+
var i;
|
|
294
|
+
for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i];
|
|
295
|
+
for(i = n-1; i >= 0; --i) r.data[i] = 0;
|
|
296
|
+
r.t = this.t+n;
|
|
297
|
+
r.s = this.s;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
// (protected) r = this >> n*DB
|
|
301
|
+
function bnpDRShiftTo(n,r) {
|
|
302
|
+
for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i];
|
|
303
|
+
r.t = Math.max(this.t-n,0);
|
|
304
|
+
r.s = this.s;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// (protected) r = this << n
|
|
308
|
+
function bnpLShiftTo(n,r) {
|
|
309
|
+
var bs = n%this.DB;
|
|
310
|
+
var cbs = this.DB-bs;
|
|
311
|
+
var bm = (1<<cbs)-1;
|
|
312
|
+
var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i;
|
|
313
|
+
for(i = this.t-1; i >= 0; --i) {
|
|
314
|
+
r.data[i+ds+1] = (this.data[i]>>cbs)|c;
|
|
315
|
+
c = (this.data[i]&bm)<<bs;
|
|
316
|
+
}
|
|
317
|
+
for(i = ds-1; i >= 0; --i) r.data[i] = 0;
|
|
318
|
+
r.data[ds] = c;
|
|
319
|
+
r.t = this.t+ds+1;
|
|
320
|
+
r.s = this.s;
|
|
321
|
+
r.clamp();
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// (protected) r = this >> n
|
|
325
|
+
function bnpRShiftTo(n,r) {
|
|
326
|
+
r.s = this.s;
|
|
327
|
+
var ds = Math.floor(n/this.DB);
|
|
328
|
+
if(ds >= this.t) { r.t = 0; return; }
|
|
329
|
+
var bs = n%this.DB;
|
|
330
|
+
var cbs = this.DB-bs;
|
|
331
|
+
var bm = (1<<bs)-1;
|
|
332
|
+
r.data[0] = this.data[ds]>>bs;
|
|
333
|
+
for(var i = ds+1; i < this.t; ++i) {
|
|
334
|
+
r.data[i-ds-1] |= (this.data[i]&bm)<<cbs;
|
|
335
|
+
r.data[i-ds] = this.data[i]>>bs;
|
|
336
|
+
}
|
|
337
|
+
if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<<cbs;
|
|
338
|
+
r.t = this.t-ds;
|
|
339
|
+
r.clamp();
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// (protected) r = this - a
|
|
343
|
+
function bnpSubTo(a,r) {
|
|
344
|
+
var i = 0, c = 0, m = Math.min(a.t,this.t);
|
|
345
|
+
while(i < m) {
|
|
346
|
+
c += this.data[i]-a.data[i];
|
|
347
|
+
r.data[i++] = c&this.DM;
|
|
348
|
+
c >>= this.DB;
|
|
349
|
+
}
|
|
350
|
+
if(a.t < this.t) {
|
|
351
|
+
c -= a.s;
|
|
352
|
+
while(i < this.t) {
|
|
353
|
+
c += this.data[i];
|
|
354
|
+
r.data[i++] = c&this.DM;
|
|
355
|
+
c >>= this.DB;
|
|
356
|
+
}
|
|
357
|
+
c += this.s;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
c += this.s;
|
|
361
|
+
while(i < a.t) {
|
|
362
|
+
c -= a.data[i];
|
|
363
|
+
r.data[i++] = c&this.DM;
|
|
364
|
+
c >>= this.DB;
|
|
365
|
+
}
|
|
366
|
+
c -= a.s;
|
|
367
|
+
}
|
|
368
|
+
r.s = (c<0)?-1:0;
|
|
369
|
+
if(c < -1) r.data[i++] = this.DV+c;
|
|
370
|
+
else if(c > 0) r.data[i++] = c;
|
|
371
|
+
r.t = i;
|
|
372
|
+
r.clamp();
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// (protected) r = this * a, r != this,a (HAC 14.12)
|
|
376
|
+
// "this" should be the larger one if appropriate.
|
|
377
|
+
function bnpMultiplyTo(a,r) {
|
|
378
|
+
var x = this.abs(), y = a.abs();
|
|
379
|
+
var i = x.t;
|
|
380
|
+
r.t = i+y.t;
|
|
381
|
+
while(--i >= 0) r.data[i] = 0;
|
|
382
|
+
for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t);
|
|
383
|
+
r.s = 0;
|
|
384
|
+
r.clamp();
|
|
385
|
+
if(this.s != a.s) BigInteger.ZERO.subTo(r,r);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// (protected) r = this^2, r != this (HAC 14.16)
|
|
389
|
+
function bnpSquareTo(r) {
|
|
390
|
+
var x = this.abs();
|
|
391
|
+
var i = r.t = 2*x.t;
|
|
392
|
+
while(--i >= 0) r.data[i] = 0;
|
|
393
|
+
for(i = 0; i < x.t-1; ++i) {
|
|
394
|
+
var c = x.am(i,x.data[i],r,2*i,0,1);
|
|
395
|
+
if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) {
|
|
396
|
+
r.data[i+x.t] -= x.DV;
|
|
397
|
+
r.data[i+x.t+1] = 1;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1);
|
|
401
|
+
r.s = 0;
|
|
402
|
+
r.clamp();
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20)
|
|
406
|
+
// r != q, this != m. q or r may be null.
|
|
407
|
+
function bnpDivRemTo(m,q,r) {
|
|
408
|
+
var pm = m.abs();
|
|
409
|
+
if(pm.t <= 0) return;
|
|
410
|
+
var pt = this.abs();
|
|
411
|
+
if(pt.t < pm.t) {
|
|
412
|
+
if(q != null) q.fromInt(0);
|
|
413
|
+
if(r != null) this.copyTo(r);
|
|
414
|
+
return;
|
|
415
|
+
}
|
|
416
|
+
if(r == null) r = nbi();
|
|
417
|
+
var y = nbi(), ts = this.s, ms = m.s;
|
|
418
|
+
var nsh = this.DB-nbits(pm.data[pm.t-1]); // normalize modulus
|
|
419
|
+
if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); }
|
|
420
|
+
else { pm.copyTo(y); pt.copyTo(r); }
|
|
421
|
+
var ys = y.t;
|
|
422
|
+
var y0 = y.data[ys-1];
|
|
423
|
+
if(y0 == 0) return;
|
|
424
|
+
var yt = y0*(1<<this.F1)+((ys>1)?y.data[ys-2]>>this.F2:0);
|
|
425
|
+
var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2;
|
|
426
|
+
var i = r.t, j = i-ys, t = (q==null)?nbi():q;
|
|
427
|
+
y.dlShiftTo(j,t);
|
|
428
|
+
if(r.compareTo(t) >= 0) {
|
|
429
|
+
r.data[r.t++] = 1;
|
|
430
|
+
r.subTo(t,r);
|
|
431
|
+
}
|
|
432
|
+
BigInteger.ONE.dlShiftTo(ys,t);
|
|
433
|
+
t.subTo(y,y); // "negative" y so we can replace sub with am later
|
|
434
|
+
while(y.t < ys) y.data[y.t++] = 0;
|
|
435
|
+
while(--j >= 0) {
|
|
436
|
+
// Estimate quotient digit
|
|
437
|
+
var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2);
|
|
438
|
+
if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out
|
|
439
|
+
y.dlShiftTo(j,t);
|
|
440
|
+
r.subTo(t,r);
|
|
441
|
+
while(r.data[i] < --qd) r.subTo(t,r);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
if(q != null) {
|
|
445
|
+
r.drShiftTo(ys,q);
|
|
446
|
+
if(ts != ms) BigInteger.ZERO.subTo(q,q);
|
|
447
|
+
}
|
|
448
|
+
r.t = ys;
|
|
449
|
+
r.clamp();
|
|
450
|
+
if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder
|
|
451
|
+
if(ts < 0) BigInteger.ZERO.subTo(r,r);
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// (public) this mod a
|
|
455
|
+
function bnMod(a) {
|
|
456
|
+
var r = nbi();
|
|
457
|
+
this.abs().divRemTo(a,null,r);
|
|
458
|
+
if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r);
|
|
459
|
+
return r;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// Modular reduction using "classic" algorithm
|
|
463
|
+
function Classic(m) { this.m = m; }
|
|
464
|
+
function cConvert(x) {
|
|
465
|
+
if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m);
|
|
466
|
+
else return x;
|
|
467
|
+
}
|
|
468
|
+
function cRevert(x) { return x; }
|
|
469
|
+
function cReduce(x) { x.divRemTo(this.m,null,x); }
|
|
470
|
+
function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
|
|
471
|
+
function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
|
|
472
|
+
|
|
473
|
+
Classic.prototype.convert = cConvert;
|
|
474
|
+
Classic.prototype.revert = cRevert;
|
|
475
|
+
Classic.prototype.reduce = cReduce;
|
|
476
|
+
Classic.prototype.mulTo = cMulTo;
|
|
477
|
+
Classic.prototype.sqrTo = cSqrTo;
|
|
478
|
+
|
|
479
|
+
// (protected) return "-1/this % 2^DB"; useful for Mont. reduction
|
|
480
|
+
// justification:
|
|
481
|
+
// xy == 1 (mod m)
|
|
482
|
+
// xy = 1+km
|
|
483
|
+
// xy(2-xy) = (1+km)(1-km)
|
|
484
|
+
// x[y(2-xy)] = 1-k^2m^2
|
|
485
|
+
// x[y(2-xy)] == 1 (mod m^2)
|
|
486
|
+
// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2
|
|
487
|
+
// should reduce x and y(2-xy) by m^2 at each step to keep size bounded.
|
|
488
|
+
// JS multiply "overflows" differently from C/C++, so care is needed here.
|
|
489
|
+
function bnpInvDigit() {
|
|
490
|
+
if(this.t < 1) return 0;
|
|
491
|
+
var x = this.data[0];
|
|
492
|
+
if((x&1) == 0) return 0;
|
|
493
|
+
var y = x&3; // y == 1/x mod 2^2
|
|
494
|
+
y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4
|
|
495
|
+
y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8
|
|
496
|
+
y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16
|
|
497
|
+
// last step - calculate inverse mod DV directly;
|
|
498
|
+
// assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints
|
|
499
|
+
y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits
|
|
500
|
+
// we really want the negative inverse, and -DV < y < DV
|
|
501
|
+
return (y>0)?this.DV-y:-y;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// Montgomery reduction
|
|
505
|
+
function Montgomery(m) {
|
|
506
|
+
this.m = m;
|
|
507
|
+
this.mp = m.invDigit();
|
|
508
|
+
this.mpl = this.mp&0x7fff;
|
|
509
|
+
this.mph = this.mp>>15;
|
|
510
|
+
this.um = (1<<(m.DB-15))-1;
|
|
511
|
+
this.mt2 = 2*m.t;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
// xR mod m
|
|
515
|
+
function montConvert(x) {
|
|
516
|
+
var r = nbi();
|
|
517
|
+
x.abs().dlShiftTo(this.m.t,r);
|
|
518
|
+
r.divRemTo(this.m,null,r);
|
|
519
|
+
if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r);
|
|
520
|
+
return r;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// x/R mod m
|
|
524
|
+
function montRevert(x) {
|
|
525
|
+
var r = nbi();
|
|
526
|
+
x.copyTo(r);
|
|
527
|
+
this.reduce(r);
|
|
528
|
+
return r;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
// x = x/R mod m (HAC 14.32)
|
|
532
|
+
function montReduce(x) {
|
|
533
|
+
while(x.t <= this.mt2) // pad x so am has enough room later
|
|
534
|
+
x.data[x.t++] = 0;
|
|
535
|
+
for(var i = 0; i < this.m.t; ++i) {
|
|
536
|
+
// faster way of calculating u0 = x.data[i]*mp mod DV
|
|
537
|
+
var j = x.data[i]&0x7fff;
|
|
538
|
+
var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM;
|
|
539
|
+
// use am to combine the multiply-shift-add into one call
|
|
540
|
+
j = i+this.m.t;
|
|
541
|
+
x.data[j] += this.m.am(0,u0,x,i,0,this.m.t);
|
|
542
|
+
// propagate carry
|
|
543
|
+
while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; }
|
|
544
|
+
}
|
|
545
|
+
x.clamp();
|
|
546
|
+
x.drShiftTo(this.m.t,x);
|
|
547
|
+
if(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// r = "x^2/R mod m"; x != r
|
|
551
|
+
function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
|
|
552
|
+
|
|
553
|
+
// r = "xy/R mod m"; x,y != r
|
|
554
|
+
function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
|
|
555
|
+
|
|
556
|
+
Montgomery.prototype.convert = montConvert;
|
|
557
|
+
Montgomery.prototype.revert = montRevert;
|
|
558
|
+
Montgomery.prototype.reduce = montReduce;
|
|
559
|
+
Montgomery.prototype.mulTo = montMulTo;
|
|
560
|
+
Montgomery.prototype.sqrTo = montSqrTo;
|
|
561
|
+
|
|
562
|
+
// (protected) true iff this is even
|
|
563
|
+
function bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; }
|
|
564
|
+
|
|
565
|
+
// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
|
|
566
|
+
function bnpExp(e,z) {
|
|
567
|
+
if(e > 0xffffffff || e < 1) return BigInteger.ONE;
|
|
568
|
+
var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1;
|
|
569
|
+
g.copyTo(r);
|
|
570
|
+
while(--i >= 0) {
|
|
571
|
+
z.sqrTo(r,r2);
|
|
572
|
+
if((e&(1<<i)) > 0) z.mulTo(r2,g,r);
|
|
573
|
+
else { var t = r; r = r2; r2 = t; }
|
|
574
|
+
}
|
|
575
|
+
return z.revert(r);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
// (public) this^e % m, 0 <= e < 2^32
|
|
579
|
+
function bnModPowInt(e,m) {
|
|
580
|
+
var z;
|
|
581
|
+
if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m);
|
|
582
|
+
return this.exp(e,z);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// protected
|
|
586
|
+
BigInteger.prototype.copyTo = bnpCopyTo;
|
|
587
|
+
BigInteger.prototype.fromInt = bnpFromInt;
|
|
588
|
+
BigInteger.prototype.fromString = bnpFromString;
|
|
589
|
+
BigInteger.prototype.clamp = bnpClamp;
|
|
590
|
+
BigInteger.prototype.dlShiftTo = bnpDLShiftTo;
|
|
591
|
+
BigInteger.prototype.drShiftTo = bnpDRShiftTo;
|
|
592
|
+
BigInteger.prototype.lShiftTo = bnpLShiftTo;
|
|
593
|
+
BigInteger.prototype.rShiftTo = bnpRShiftTo;
|
|
594
|
+
BigInteger.prototype.subTo = bnpSubTo;
|
|
595
|
+
BigInteger.prototype.multiplyTo = bnpMultiplyTo;
|
|
596
|
+
BigInteger.prototype.squareTo = bnpSquareTo;
|
|
597
|
+
BigInteger.prototype.divRemTo = bnpDivRemTo;
|
|
598
|
+
BigInteger.prototype.invDigit = bnpInvDigit;
|
|
599
|
+
BigInteger.prototype.isEven = bnpIsEven;
|
|
600
|
+
BigInteger.prototype.exp = bnpExp;
|
|
601
|
+
|
|
602
|
+
// public
|
|
603
|
+
BigInteger.prototype.toString = bnToString;
|
|
604
|
+
BigInteger.prototype.negate = bnNegate;
|
|
605
|
+
BigInteger.prototype.abs = bnAbs;
|
|
606
|
+
BigInteger.prototype.compareTo = bnCompareTo;
|
|
607
|
+
BigInteger.prototype.bitLength = bnBitLength;
|
|
608
|
+
BigInteger.prototype.mod = bnMod;
|
|
609
|
+
BigInteger.prototype.modPowInt = bnModPowInt;
|
|
610
|
+
|
|
611
|
+
// "constants"
|
|
612
|
+
BigInteger.ZERO = nbv(0);
|
|
613
|
+
BigInteger.ONE = nbv(1);
|
|
614
|
+
|
|
615
|
+
// jsbn2 lib
|
|
616
|
+
|
|
617
|
+
// Copyright (c) 2005-2009 Tom Wu
|
|
618
|
+
// All Rights Reserved.
|
|
619
|
+
// See "LICENSE" for details (See jsbn.js for LICENSE).
|
|
620
|
+
|
|
621
|
+
// Extended JavaScript BN functions, required for RSA private ops.
|
|
622
|
+
|
|
623
|
+
// Version 1.1: new BigInteger("0", 10) returns "proper" zero
|
|
624
|
+
// Version 1.2: square() API, isProbablePrime fix
|
|
625
|
+
|
|
626
|
+
// (public)
|
|
627
|
+
function bnClone() { var r = nbi(); this.copyTo(r); return r; }
|
|
628
|
+
|
|
629
|
+
// (public) return value as integer
|
|
630
|
+
function bnIntValue() {
|
|
631
|
+
if(this.s < 0) {
|
|
632
|
+
if(this.t == 1) return this.data[0]-this.DV;
|
|
633
|
+
else if(this.t == 0) return -1;
|
|
634
|
+
}
|
|
635
|
+
else if(this.t == 1) return this.data[0];
|
|
636
|
+
else if(this.t == 0) return 0;
|
|
637
|
+
// assumes 16 < DB < 32
|
|
638
|
+
return ((this.data[1]&((1<<(32-this.DB))-1))<<this.DB)|this.data[0];
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// (public) return value as byte
|
|
642
|
+
function bnByteValue() { return (this.t==0)?this.s:(this.data[0]<<24)>>24; }
|
|
643
|
+
|
|
644
|
+
// (public) return value as short (assumes DB>=16)
|
|
645
|
+
function bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; }
|
|
646
|
+
|
|
647
|
+
// (protected) return x s.t. r^x < DV
|
|
648
|
+
function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
|
|
649
|
+
|
|
650
|
+
// (public) 0 if this == 0, 1 if this > 0
|
|
651
|
+
function bnSigNum() {
|
|
652
|
+
if(this.s < 0) return -1;
|
|
653
|
+
else if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0;
|
|
654
|
+
else return 1;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// (protected) convert to radix string
|
|
658
|
+
function bnpToRadix(b) {
|
|
659
|
+
if(b == null) b = 10;
|
|
660
|
+
if(this.signum() == 0 || b < 2 || b > 36) return "0";
|
|
661
|
+
var cs = this.chunkSize(b);
|
|
662
|
+
var a = Math.pow(b,cs);
|
|
663
|
+
var d = nbv(a), y = nbi(), z = nbi(), r = "";
|
|
664
|
+
this.divRemTo(d,y,z);
|
|
665
|
+
while(y.signum() > 0) {
|
|
666
|
+
r = (a+z.intValue()).toString(b).substr(1) + r;
|
|
667
|
+
y.divRemTo(d,y,z);
|
|
668
|
+
}
|
|
669
|
+
return z.intValue().toString(b) + r;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// (protected) convert from radix string
|
|
673
|
+
function bnpFromRadix(s,b) {
|
|
674
|
+
this.fromInt(0);
|
|
675
|
+
if(b == null) b = 10;
|
|
676
|
+
var cs = this.chunkSize(b);
|
|
677
|
+
var d = Math.pow(b,cs), mi = false, j = 0, w = 0;
|
|
678
|
+
for(var i = 0; i < s.length; ++i) {
|
|
679
|
+
var x = intAt(s,i);
|
|
680
|
+
if(x < 0) {
|
|
681
|
+
if(s.charAt(i) == "-" && this.signum() == 0) mi = true;
|
|
682
|
+
continue;
|
|
683
|
+
}
|
|
684
|
+
w = b*w+x;
|
|
685
|
+
if(++j >= cs) {
|
|
686
|
+
this.dMultiply(d);
|
|
687
|
+
this.dAddOffset(w,0);
|
|
688
|
+
j = 0;
|
|
689
|
+
w = 0;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
if(j > 0) {
|
|
693
|
+
this.dMultiply(Math.pow(b,j));
|
|
694
|
+
this.dAddOffset(w,0);
|
|
695
|
+
}
|
|
696
|
+
if(mi) BigInteger.ZERO.subTo(this,this);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
// (protected) alternate constructor
|
|
700
|
+
function bnpFromNumber(a,b,c) {
|
|
701
|
+
if("number" == typeof b) {
|
|
702
|
+
// new BigInteger(int,int,RNG)
|
|
703
|
+
if(a < 2) this.fromInt(1);
|
|
704
|
+
else {
|
|
705
|
+
this.fromNumber(a,c);
|
|
706
|
+
if(!this.testBit(a-1)) // force MSB set
|
|
707
|
+
this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this);
|
|
708
|
+
if(this.isEven()) this.dAddOffset(1,0); // force odd
|
|
709
|
+
while(!this.isProbablePrime(b)) {
|
|
710
|
+
this.dAddOffset(2,0);
|
|
711
|
+
if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this);
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
else {
|
|
716
|
+
// new BigInteger(int,RNG)
|
|
717
|
+
var x = new Array(), t = a&7;
|
|
718
|
+
x.length = (a>>3)+1;
|
|
719
|
+
b.nextBytes(x);
|
|
720
|
+
if(t > 0) x[0] &= ((1<<t)-1); else x[0] = 0;
|
|
721
|
+
this.fromString(x,256);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
// (public) convert to bigendian byte array
|
|
726
|
+
function bnToByteArray() {
|
|
727
|
+
var i = this.t, r = new Array();
|
|
728
|
+
r[0] = this.s;
|
|
729
|
+
var p = this.DB-(i*this.DB)%8, d, k = 0;
|
|
730
|
+
if(i-- > 0) {
|
|
731
|
+
if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p)
|
|
732
|
+
r[k++] = d|(this.s<<(this.DB-p));
|
|
733
|
+
while(i >= 0) {
|
|
734
|
+
if(p < 8) {
|
|
735
|
+
d = (this.data[i]&((1<<p)-1))<<(8-p);
|
|
736
|
+
d |= this.data[--i]>>(p+=this.DB-8);
|
|
737
|
+
}
|
|
738
|
+
else {
|
|
739
|
+
d = (this.data[i]>>(p-=8))&0xff;
|
|
740
|
+
if(p <= 0) { p += this.DB; --i; }
|
|
741
|
+
}
|
|
742
|
+
if((d&0x80) != 0) d |= -256;
|
|
743
|
+
if(k == 0 && (this.s&0x80) != (d&0x80)) ++k;
|
|
744
|
+
if(k > 0 || d != this.s) r[k++] = d;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
return r;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function bnEquals(a) { return(this.compareTo(a)==0); }
|
|
751
|
+
function bnMin(a) { return(this.compareTo(a)<0)?this:a; }
|
|
752
|
+
function bnMax(a) { return(this.compareTo(a)>0)?this:a; }
|
|
753
|
+
|
|
754
|
+
// (protected) r = this op a (bitwise)
|
|
755
|
+
function bnpBitwiseTo(a,op,r) {
|
|
756
|
+
var i, f, m = Math.min(a.t,this.t);
|
|
757
|
+
for(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]);
|
|
758
|
+
if(a.t < this.t) {
|
|
759
|
+
f = a.s&this.DM;
|
|
760
|
+
for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f);
|
|
761
|
+
r.t = this.t;
|
|
762
|
+
}
|
|
763
|
+
else {
|
|
764
|
+
f = this.s&this.DM;
|
|
765
|
+
for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]);
|
|
766
|
+
r.t = a.t;
|
|
767
|
+
}
|
|
768
|
+
r.s = op(this.s,a.s);
|
|
769
|
+
r.clamp();
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
// (public) this & a
|
|
773
|
+
function op_and(x,y) { return x&y; }
|
|
774
|
+
function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; }
|
|
775
|
+
|
|
776
|
+
// (public) this | a
|
|
777
|
+
function op_or(x,y) { return x|y; }
|
|
778
|
+
function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; }
|
|
779
|
+
|
|
780
|
+
// (public) this ^ a
|
|
781
|
+
function op_xor(x,y) { return x^y; }
|
|
782
|
+
function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; }
|
|
783
|
+
|
|
784
|
+
// (public) this & ~a
|
|
785
|
+
function op_andnot(x,y) { return x&~y; }
|
|
786
|
+
function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; }
|
|
787
|
+
|
|
788
|
+
// (public) ~this
|
|
789
|
+
function bnNot() {
|
|
790
|
+
var r = nbi();
|
|
791
|
+
for(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i];
|
|
792
|
+
r.t = this.t;
|
|
793
|
+
r.s = ~this.s;
|
|
794
|
+
return r;
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// (public) this << n
|
|
798
|
+
function bnShiftLeft(n) {
|
|
799
|
+
var r = nbi();
|
|
800
|
+
if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r);
|
|
801
|
+
return r;
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
// (public) this >> n
|
|
805
|
+
function bnShiftRight(n) {
|
|
806
|
+
var r = nbi();
|
|
807
|
+
if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r);
|
|
808
|
+
return r;
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// return index of lowest 1-bit in x, x < 2^31
|
|
812
|
+
function lbit(x) {
|
|
813
|
+
if(x == 0) return -1;
|
|
814
|
+
var r = 0;
|
|
815
|
+
if((x&0xffff) == 0) { x >>= 16; r += 16; }
|
|
816
|
+
if((x&0xff) == 0) { x >>= 8; r += 8; }
|
|
817
|
+
if((x&0xf) == 0) { x >>= 4; r += 4; }
|
|
818
|
+
if((x&3) == 0) { x >>= 2; r += 2; }
|
|
819
|
+
if((x&1) == 0) ++r;
|
|
820
|
+
return r;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// (public) returns index of lowest 1-bit (or -1 if none)
|
|
824
|
+
function bnGetLowestSetBit() {
|
|
825
|
+
for(var i = 0; i < this.t; ++i)
|
|
826
|
+
if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]);
|
|
827
|
+
if(this.s < 0) return this.t*this.DB;
|
|
828
|
+
return -1;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// return number of 1 bits in x
|
|
832
|
+
function cbit(x) {
|
|
833
|
+
var r = 0;
|
|
834
|
+
while(x != 0) { x &= x-1; ++r; }
|
|
835
|
+
return r;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// (public) return number of set bits
|
|
839
|
+
function bnBitCount() {
|
|
840
|
+
var r = 0, x = this.s&this.DM;
|
|
841
|
+
for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x);
|
|
842
|
+
return r;
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
// (public) true iff nth bit is set
|
|
846
|
+
function bnTestBit(n) {
|
|
847
|
+
var j = Math.floor(n/this.DB);
|
|
848
|
+
if(j >= this.t) return(this.s!=0);
|
|
849
|
+
return((this.data[j]&(1<<(n%this.DB)))!=0);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// (protected) this op (1<<n)
|
|
853
|
+
function bnpChangeBit(n,op) {
|
|
854
|
+
var r = BigInteger.ONE.shiftLeft(n);
|
|
855
|
+
this.bitwiseTo(r,op,r);
|
|
856
|
+
return r;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
// (public) this | (1<<n)
|
|
860
|
+
function bnSetBit(n) { return this.changeBit(n,op_or); }
|
|
861
|
+
|
|
862
|
+
// (public) this & ~(1<<n)
|
|
863
|
+
function bnClearBit(n) { return this.changeBit(n,op_andnot); }
|
|
864
|
+
|
|
865
|
+
// (public) this ^ (1<<n)
|
|
866
|
+
function bnFlipBit(n) { return this.changeBit(n,op_xor); }
|
|
867
|
+
|
|
868
|
+
// (protected) r = this + a
|
|
869
|
+
function bnpAddTo(a,r) {
|
|
870
|
+
var i = 0, c = 0, m = Math.min(a.t,this.t);
|
|
871
|
+
while(i < m) {
|
|
872
|
+
c += this.data[i]+a.data[i];
|
|
873
|
+
r.data[i++] = c&this.DM;
|
|
874
|
+
c >>= this.DB;
|
|
875
|
+
}
|
|
876
|
+
if(a.t < this.t) {
|
|
877
|
+
c += a.s;
|
|
878
|
+
while(i < this.t) {
|
|
879
|
+
c += this.data[i];
|
|
880
|
+
r.data[i++] = c&this.DM;
|
|
881
|
+
c >>= this.DB;
|
|
882
|
+
}
|
|
883
|
+
c += this.s;
|
|
884
|
+
}
|
|
885
|
+
else {
|
|
886
|
+
c += this.s;
|
|
887
|
+
while(i < a.t) {
|
|
888
|
+
c += a.data[i];
|
|
889
|
+
r.data[i++] = c&this.DM;
|
|
890
|
+
c >>= this.DB;
|
|
891
|
+
}
|
|
892
|
+
c += a.s;
|
|
893
|
+
}
|
|
894
|
+
r.s = (c<0)?-1:0;
|
|
895
|
+
if(c > 0) r.data[i++] = c;
|
|
896
|
+
else if(c < -1) r.data[i++] = this.DV+c;
|
|
897
|
+
r.t = i;
|
|
898
|
+
r.clamp();
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
// (public) this + a
|
|
902
|
+
function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; }
|
|
903
|
+
|
|
904
|
+
// (public) this - a
|
|
905
|
+
function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; }
|
|
906
|
+
|
|
907
|
+
// (public) this * a
|
|
908
|
+
function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; }
|
|
909
|
+
|
|
910
|
+
// (public) this^2
|
|
911
|
+
function bnSquare() { var r = nbi(); this.squareTo(r); return r; }
|
|
912
|
+
|
|
913
|
+
// (public) this / a
|
|
914
|
+
function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; }
|
|
915
|
+
|
|
916
|
+
// (public) this % a
|
|
917
|
+
function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; }
|
|
918
|
+
|
|
919
|
+
// (public) [this/a,this%a]
|
|
920
|
+
function bnDivideAndRemainder(a) {
|
|
921
|
+
var q = nbi(), r = nbi();
|
|
922
|
+
this.divRemTo(a,q,r);
|
|
923
|
+
return new Array(q,r);
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// (protected) this *= n, this >= 0, 1 < n < DV
|
|
927
|
+
function bnpDMultiply(n) {
|
|
928
|
+
this.data[this.t] = this.am(0,n-1,this,0,0,this.t);
|
|
929
|
+
++this.t;
|
|
930
|
+
this.clamp();
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
// (protected) this += n << w words, this >= 0
|
|
934
|
+
function bnpDAddOffset(n,w) {
|
|
935
|
+
if(n == 0) return;
|
|
936
|
+
while(this.t <= w) this.data[this.t++] = 0;
|
|
937
|
+
this.data[w] += n;
|
|
938
|
+
while(this.data[w] >= this.DV) {
|
|
939
|
+
this.data[w] -= this.DV;
|
|
940
|
+
if(++w >= this.t) this.data[this.t++] = 0;
|
|
941
|
+
++this.data[w];
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// A "null" reducer
|
|
946
|
+
function NullExp() {}
|
|
947
|
+
function nNop(x) { return x; }
|
|
948
|
+
function nMulTo(x,y,r) { x.multiplyTo(y,r); }
|
|
949
|
+
function nSqrTo(x,r) { x.squareTo(r); }
|
|
950
|
+
|
|
951
|
+
NullExp.prototype.convert = nNop;
|
|
952
|
+
NullExp.prototype.revert = nNop;
|
|
953
|
+
NullExp.prototype.mulTo = nMulTo;
|
|
954
|
+
NullExp.prototype.sqrTo = nSqrTo;
|
|
955
|
+
|
|
956
|
+
// (public) this^e
|
|
957
|
+
function bnPow(e) { return this.exp(e,new NullExp()); }
|
|
958
|
+
|
|
959
|
+
// (protected) r = lower n words of "this * a", a.t <= n
|
|
960
|
+
// "this" should be the larger one if appropriate.
|
|
961
|
+
function bnpMultiplyLowerTo(a,n,r) {
|
|
962
|
+
var i = Math.min(this.t+a.t,n);
|
|
963
|
+
r.s = 0; // assumes a,this >= 0
|
|
964
|
+
r.t = i;
|
|
965
|
+
while(i > 0) r.data[--i] = 0;
|
|
966
|
+
var j;
|
|
967
|
+
for(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t);
|
|
968
|
+
for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i);
|
|
969
|
+
r.clamp();
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
// (protected) r = "this * a" without lower n words, n > 0
|
|
973
|
+
// "this" should be the larger one if appropriate.
|
|
974
|
+
function bnpMultiplyUpperTo(a,n,r) {
|
|
975
|
+
--n;
|
|
976
|
+
var i = r.t = this.t+a.t-n;
|
|
977
|
+
r.s = 0; // assumes a,this >= 0
|
|
978
|
+
while(--i >= 0) r.data[i] = 0;
|
|
979
|
+
for(i = Math.max(n-this.t,0); i < a.t; ++i)
|
|
980
|
+
r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n);
|
|
981
|
+
r.clamp();
|
|
982
|
+
r.drShiftTo(1,r);
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
// Barrett modular reduction
|
|
986
|
+
function Barrett(m) {
|
|
987
|
+
// setup Barrett
|
|
988
|
+
this.r2 = nbi();
|
|
989
|
+
this.q3 = nbi();
|
|
990
|
+
BigInteger.ONE.dlShiftTo(2*m.t,this.r2);
|
|
991
|
+
this.mu = this.r2.divide(m);
|
|
992
|
+
this.m = m;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
function barrettConvert(x) {
|
|
996
|
+
if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m);
|
|
997
|
+
else if(x.compareTo(this.m) < 0) return x;
|
|
998
|
+
else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; }
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
function barrettRevert(x) { return x; }
|
|
1002
|
+
|
|
1003
|
+
// x = x mod m (HAC 14.42)
|
|
1004
|
+
function barrettReduce(x) {
|
|
1005
|
+
x.drShiftTo(this.m.t-1,this.r2);
|
|
1006
|
+
if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); }
|
|
1007
|
+
this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);
|
|
1008
|
+
this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);
|
|
1009
|
+
while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1);
|
|
1010
|
+
x.subTo(this.r2,x);
|
|
1011
|
+
while(x.compareTo(this.m) >= 0) x.subTo(this.m,x);
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
// r = x^2 mod m; x != r
|
|
1015
|
+
function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
|
|
1016
|
+
|
|
1017
|
+
// r = x*y mod m; x,y != r
|
|
1018
|
+
function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
|
|
1019
|
+
|
|
1020
|
+
Barrett.prototype.convert = barrettConvert;
|
|
1021
|
+
Barrett.prototype.revert = barrettRevert;
|
|
1022
|
+
Barrett.prototype.reduce = barrettReduce;
|
|
1023
|
+
Barrett.prototype.mulTo = barrettMulTo;
|
|
1024
|
+
Barrett.prototype.sqrTo = barrettSqrTo;
|
|
1025
|
+
|
|
1026
|
+
// (public) this^e % m (HAC 14.85)
|
|
1027
|
+
function bnModPow(e,m) {
|
|
1028
|
+
var i = e.bitLength(), k, r = nbv(1), z;
|
|
1029
|
+
if(i <= 0) return r;
|
|
1030
|
+
else if(i < 18) k = 1;
|
|
1031
|
+
else if(i < 48) k = 3;
|
|
1032
|
+
else if(i < 144) k = 4;
|
|
1033
|
+
else if(i < 768) k = 5;
|
|
1034
|
+
else k = 6;
|
|
1035
|
+
if(i < 8)
|
|
1036
|
+
z = new Classic(m);
|
|
1037
|
+
else if(m.isEven())
|
|
1038
|
+
z = new Barrett(m);
|
|
1039
|
+
else
|
|
1040
|
+
z = new Montgomery(m);
|
|
1041
|
+
|
|
1042
|
+
// precomputation
|
|
1043
|
+
var g = new Array(), n = 3, k1 = k-1, km = (1<<k)-1;
|
|
1044
|
+
g[1] = z.convert(this);
|
|
1045
|
+
if(k > 1) {
|
|
1046
|
+
var g2 = nbi();
|
|
1047
|
+
z.sqrTo(g[1],g2);
|
|
1048
|
+
while(n <= km) {
|
|
1049
|
+
g[n] = nbi();
|
|
1050
|
+
z.mulTo(g2,g[n-2],g[n]);
|
|
1051
|
+
n += 2;
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
var j = e.t-1, w, is1 = true, r2 = nbi(), t;
|
|
1056
|
+
i = nbits(e.data[j])-1;
|
|
1057
|
+
while(j >= 0) {
|
|
1058
|
+
if(i >= k1) w = (e.data[j]>>(i-k1))&km;
|
|
1059
|
+
else {
|
|
1060
|
+
w = (e.data[j]&((1<<(i+1))-1))<<(k1-i);
|
|
1061
|
+
if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
n = k;
|
|
1065
|
+
while((w&1) == 0) { w >>= 1; --n; }
|
|
1066
|
+
if((i -= n) < 0) { i += this.DB; --j; }
|
|
1067
|
+
if(is1) { // ret == 1, don't bother squaring or multiplying it
|
|
1068
|
+
g[w].copyTo(r);
|
|
1069
|
+
is1 = false;
|
|
1070
|
+
}
|
|
1071
|
+
else {
|
|
1072
|
+
while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; }
|
|
1073
|
+
if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; }
|
|
1074
|
+
z.mulTo(r2,g[w],r);
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
while(j >= 0 && (e.data[j]&(1<<i)) == 0) {
|
|
1078
|
+
z.sqrTo(r,r2); t = r; r = r2; r2 = t;
|
|
1079
|
+
if(--i < 0) { i = this.DB-1; --j; }
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return z.revert(r);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// (public) gcd(this,a) (HAC 14.54)
|
|
1086
|
+
function bnGCD(a) {
|
|
1087
|
+
var x = (this.s<0)?this.negate():this.clone();
|
|
1088
|
+
var y = (a.s<0)?a.negate():a.clone();
|
|
1089
|
+
if(x.compareTo(y) < 0) { var t = x; x = y; y = t; }
|
|
1090
|
+
var i = x.getLowestSetBit(), g = y.getLowestSetBit();
|
|
1091
|
+
if(g < 0) return x;
|
|
1092
|
+
if(i < g) g = i;
|
|
1093
|
+
if(g > 0) {
|
|
1094
|
+
x.rShiftTo(g,x);
|
|
1095
|
+
y.rShiftTo(g,y);
|
|
1096
|
+
}
|
|
1097
|
+
while(x.signum() > 0) {
|
|
1098
|
+
if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x);
|
|
1099
|
+
if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y);
|
|
1100
|
+
if(x.compareTo(y) >= 0) {
|
|
1101
|
+
x.subTo(y,x);
|
|
1102
|
+
x.rShiftTo(1,x);
|
|
1103
|
+
}
|
|
1104
|
+
else {
|
|
1105
|
+
y.subTo(x,y);
|
|
1106
|
+
y.rShiftTo(1,y);
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1109
|
+
if(g > 0) y.lShiftTo(g,y);
|
|
1110
|
+
return y;
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// (protected) this % n, n < 2^26
|
|
1114
|
+
function bnpModInt(n) {
|
|
1115
|
+
if(n <= 0) return 0;
|
|
1116
|
+
var d = this.DV%n, r = (this.s<0)?n-1:0;
|
|
1117
|
+
if(this.t > 0)
|
|
1118
|
+
if(d == 0) r = this.data[0]%n;
|
|
1119
|
+
else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n;
|
|
1120
|
+
return r;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
// (public) 1/this % m (HAC 14.61)
|
|
1124
|
+
function bnModInverse(m) {
|
|
1125
|
+
// FORGE: jsbn fix
|
|
1126
|
+
// avoid infinite loop
|
|
1127
|
+
if(this.signum() == 0) {
|
|
1128
|
+
// returning zero to align with similar behavior when no multiplicative
|
|
1129
|
+
// inverse module m is found.
|
|
1130
|
+
return BigInteger.ZERO;
|
|
1131
|
+
}
|
|
1132
|
+
var ac = m.isEven();
|
|
1133
|
+
if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO;
|
|
1134
|
+
var u = m.clone(), v = this.clone();
|
|
1135
|
+
var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1);
|
|
1136
|
+
while(u.signum() != 0) {
|
|
1137
|
+
while(u.isEven()) {
|
|
1138
|
+
u.rShiftTo(1,u);
|
|
1139
|
+
if(ac) {
|
|
1140
|
+
if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); }
|
|
1141
|
+
a.rShiftTo(1,a);
|
|
1142
|
+
}
|
|
1143
|
+
else if(!b.isEven()) b.subTo(m,b);
|
|
1144
|
+
b.rShiftTo(1,b);
|
|
1145
|
+
}
|
|
1146
|
+
while(v.isEven()) {
|
|
1147
|
+
v.rShiftTo(1,v);
|
|
1148
|
+
if(ac) {
|
|
1149
|
+
if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); }
|
|
1150
|
+
c.rShiftTo(1,c);
|
|
1151
|
+
}
|
|
1152
|
+
else if(!d.isEven()) d.subTo(m,d);
|
|
1153
|
+
d.rShiftTo(1,d);
|
|
1154
|
+
}
|
|
1155
|
+
if(u.compareTo(v) >= 0) {
|
|
1156
|
+
u.subTo(v,u);
|
|
1157
|
+
if(ac) a.subTo(c,a);
|
|
1158
|
+
b.subTo(d,b);
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
v.subTo(u,v);
|
|
1162
|
+
if(ac) c.subTo(a,c);
|
|
1163
|
+
d.subTo(b,d);
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO;
|
|
1167
|
+
if(d.compareTo(m) >= 0) return d.subtract(m);
|
|
1168
|
+
if(d.signum() < 0) d.addTo(m,d); else return d;
|
|
1169
|
+
if(d.signum() < 0) return d.add(m); else return d;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
var lowprimes = [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];
|
|
1173
|
+
var lplim = (1<<26)/lowprimes[lowprimes.length-1];
|
|
1174
|
+
|
|
1175
|
+
// (public) test primality with certainty >= 1-.5^t
|
|
1176
|
+
function bnIsProbablePrime(t) {
|
|
1177
|
+
var i, x = this.abs();
|
|
1178
|
+
if(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) {
|
|
1179
|
+
for(i = 0; i < lowprimes.length; ++i)
|
|
1180
|
+
if(x.data[0] == lowprimes[i]) return true;
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
if(x.isEven()) return false;
|
|
1184
|
+
i = 1;
|
|
1185
|
+
while(i < lowprimes.length) {
|
|
1186
|
+
var m = lowprimes[i], j = i+1;
|
|
1187
|
+
while(j < lowprimes.length && m < lplim) m *= lowprimes[j++];
|
|
1188
|
+
m = x.modInt(m);
|
|
1189
|
+
while(i < j) if(m%lowprimes[i++] == 0) return false;
|
|
1190
|
+
}
|
|
1191
|
+
return x.millerRabin(t);
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
// (protected) true if probably prime (HAC 4.24, Miller-Rabin)
|
|
1195
|
+
function bnpMillerRabin(t) {
|
|
1196
|
+
var n1 = this.subtract(BigInteger.ONE);
|
|
1197
|
+
var k = n1.getLowestSetBit();
|
|
1198
|
+
if(k <= 0) return false;
|
|
1199
|
+
var r = n1.shiftRight(k);
|
|
1200
|
+
var prng = bnGetPrng();
|
|
1201
|
+
var a;
|
|
1202
|
+
for(var i = 0; i < t; ++i) {
|
|
1203
|
+
// select witness 'a' at random from between 1 and n1
|
|
1204
|
+
do {
|
|
1205
|
+
a = new BigInteger(this.bitLength(), prng);
|
|
1206
|
+
}
|
|
1207
|
+
while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0);
|
|
1208
|
+
var y = a.modPow(r,this);
|
|
1209
|
+
if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) {
|
|
1210
|
+
var j = 1;
|
|
1211
|
+
while(j++ < k && y.compareTo(n1) != 0) {
|
|
1212
|
+
y = y.modPowInt(2,this);
|
|
1213
|
+
if(y.compareTo(BigInteger.ONE) == 0) return false;
|
|
1214
|
+
}
|
|
1215
|
+
if(y.compareTo(n1) != 0) return false;
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
return true;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
// get pseudo random number generator
|
|
1222
|
+
function bnGetPrng() {
|
|
1223
|
+
// create prng with api that matches BigInteger secure random
|
|
1224
|
+
return {
|
|
1225
|
+
// x is an array to fill with bytes
|
|
1226
|
+
nextBytes: function(x) {
|
|
1227
|
+
for(var i = 0; i < x.length; ++i) {
|
|
1228
|
+
x[i] = Math.floor(Math.random() * 0x0100);
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
};
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// protected
|
|
1235
|
+
BigInteger.prototype.chunkSize = bnpChunkSize;
|
|
1236
|
+
BigInteger.prototype.toRadix = bnpToRadix;
|
|
1237
|
+
BigInteger.prototype.fromRadix = bnpFromRadix;
|
|
1238
|
+
BigInteger.prototype.fromNumber = bnpFromNumber;
|
|
1239
|
+
BigInteger.prototype.bitwiseTo = bnpBitwiseTo;
|
|
1240
|
+
BigInteger.prototype.changeBit = bnpChangeBit;
|
|
1241
|
+
BigInteger.prototype.addTo = bnpAddTo;
|
|
1242
|
+
BigInteger.prototype.dMultiply = bnpDMultiply;
|
|
1243
|
+
BigInteger.prototype.dAddOffset = bnpDAddOffset;
|
|
1244
|
+
BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo;
|
|
1245
|
+
BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo;
|
|
1246
|
+
BigInteger.prototype.modInt = bnpModInt;
|
|
1247
|
+
BigInteger.prototype.millerRabin = bnpMillerRabin;
|
|
1248
|
+
|
|
1249
|
+
// public
|
|
1250
|
+
BigInteger.prototype.clone = bnClone;
|
|
1251
|
+
BigInteger.prototype.intValue = bnIntValue;
|
|
1252
|
+
BigInteger.prototype.byteValue = bnByteValue;
|
|
1253
|
+
BigInteger.prototype.shortValue = bnShortValue;
|
|
1254
|
+
BigInteger.prototype.signum = bnSigNum;
|
|
1255
|
+
BigInteger.prototype.toByteArray = bnToByteArray;
|
|
1256
|
+
BigInteger.prototype.equals = bnEquals;
|
|
1257
|
+
BigInteger.prototype.min = bnMin;
|
|
1258
|
+
BigInteger.prototype.max = bnMax;
|
|
1259
|
+
BigInteger.prototype.and = bnAnd;
|
|
1260
|
+
BigInteger.prototype.or = bnOr;
|
|
1261
|
+
BigInteger.prototype.xor = bnXor;
|
|
1262
|
+
BigInteger.prototype.andNot = bnAndNot;
|
|
1263
|
+
BigInteger.prototype.not = bnNot;
|
|
1264
|
+
BigInteger.prototype.shiftLeft = bnShiftLeft;
|
|
1265
|
+
BigInteger.prototype.shiftRight = bnShiftRight;
|
|
1266
|
+
BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit;
|
|
1267
|
+
BigInteger.prototype.bitCount = bnBitCount;
|
|
1268
|
+
BigInteger.prototype.testBit = bnTestBit;
|
|
1269
|
+
BigInteger.prototype.setBit = bnSetBit;
|
|
1270
|
+
BigInteger.prototype.clearBit = bnClearBit;
|
|
1271
|
+
BigInteger.prototype.flipBit = bnFlipBit;
|
|
1272
|
+
BigInteger.prototype.add = bnAdd;
|
|
1273
|
+
BigInteger.prototype.subtract = bnSubtract;
|
|
1274
|
+
BigInteger.prototype.multiply = bnMultiply;
|
|
1275
|
+
BigInteger.prototype.divide = bnDivide;
|
|
1276
|
+
BigInteger.prototype.remainder = bnRemainder;
|
|
1277
|
+
BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder;
|
|
1278
|
+
BigInteger.prototype.modPow = bnModPow;
|
|
1279
|
+
BigInteger.prototype.modInverse = bnModInverse;
|
|
1280
|
+
BigInteger.prototype.pow = bnPow;
|
|
1281
|
+
BigInteger.prototype.gcd = bnGCD;
|
|
1282
|
+
BigInteger.prototype.isProbablePrime = bnIsProbablePrime;
|
|
1283
|
+
|
|
1284
|
+
// JSBN-specific extension
|
|
1285
|
+
BigInteger.prototype.square = bnSquare;
|
|
1286
|
+
|
|
1287
|
+
// BigInteger interfaces not implemented in jsbn:
|
|
1288
|
+
|
|
1289
|
+
// BigInteger(int signum, byte[] magnitude)
|
|
1290
|
+
// double doubleValue()
|
|
1291
|
+
// float floatValue()
|
|
1292
|
+
// int hashCode()
|
|
1293
|
+
// long longValue()
|
|
1294
|
+
// static BigInteger valueOf(long val)
|