Merge pull request #153 from yunyingk/docs/refine-developer-rules
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled

Refine developer guidelines in AGENTS.md and modular agent rules
This commit is contained in:
yunyingk authored and GitHub committed 2026-09-20 16:36:36 +08:00
commit f910ad4c8b
11 files changed
+398 -114

No files matched your search

+18 -11
View File
@@ -8,12 +8,15 @@ This directory (`.agents/`) maintains modular configuration, skills, and guideli
```
.agents/
├── README.md # This document: architecture & trigger policy
├── skills.json # Declarative skill path and exclusion filters
└── rules/ # Modular, domain-specific rule definitions
├── cli-protocol.md # CLI stdout/stderr stream contract & exit codes
├── testing.md # Unit/integration testing conventions (bun:test)
└── typescript-style.md # ESM, explicit .js imports, and TypeScript styles
├── README.md # This document: architecture & trigger policy
├── skills.json # Declarative skill path and exclusion filters
└── rules/ # Modular, domain-specific rule definitions
├── issue-pr-workflow.md # Issue triage, PR workflow & strictly no premature release
├── cli-protocol.md # CLI stdout/stderr dual-stream contract, exit codes & SWR
├── testing.md # Unit/integration testing conventions (bun:test) & test hygiene
├── typescript-style.md # ESM, explicit .js imports, and TypeScript styles
├── staging-simulation.md # Rule remediation lifecycle, test sync & sandbox regression
└── material-pack-policy.md # Webhook material pack structure, Excel injection & attachment policy
```
---
@@ -32,7 +35,7 @@ trigger: "manual"
---
```
1. **Token Economy**: If set to `trigger: "always_on"`, every turn of the conversation unconditionally injects all rules into the system prompt (`<user_rules>`), consuming ~800 tokens on every request regardless of task relevance.
1. **Token Economy**: If set to `trigger: "always_on"`, every turn of the conversation unconditionally injects all rules into the system prompt (`<user_rules>`), consuming substantial tokens on every request regardless of task relevance.
2. **On-Demand Activation**: Setting `trigger: "manual"` prevents automatic background injection into the prompt budget. The rules remain available on-demand when explicitly referenced or requested.
3. **Cross-Agent Neutrality**: Non-agy agents (e.g. OpenAI Codex, Claude Code, Cursor, generic LLMs) do not recognize `agy`'s private frontmatter triggers. Storing modular guidelines as plain Markdown with a manual trigger ensures they function as clean, standalone reference docs that any agent can read on demand via standard file reading tools without unexpected prompt pollution.
@@ -42,10 +45,12 @@ trigger: "manual"
| Rule File | Domain / Scope | Key Responsibilities |
| :--- | :--- | :--- |
| [`rules/issue-pr-workflow.md`](./rules/issue-pr-workflow.md) | Whole Repo / Workflow | GitHub Issue 调研、方案汇报、PR 提交流程,严格杜绝未授权提前发版。 |
| [`rules/cli-protocol.md`](./rules/cli-protocol.md) | `src/cli/**/*.ts` | Strict `stdout` JSON vs `stderr` diagnostics contract, exit code conventions (`0` vs `1`). |
| [`rules/testing.md`](./rules/testing.md) | `src/**/*.test.ts` | Test runner (`bun:test`), colocated `*.test.ts`, environment restoration in `afterEach()`. |
| [`rules/typescript-style.md`](./rules/typescript-style.md) | `src/**/*.ts` | ES modules, mandatory `.js` local extensions, Zod runtime validation, formatting rules. |
| [`rules/issue-pr-workflow.md`](./rules/issue-pr-workflow.md) | Whole Repo / Workflow | GitHub Issue 调研、方案汇报、PR 提交流程,Pre-Push 产物同步校验,严格杜绝未授权提前发版。 |
| [`rules/cli-protocol.md`](./rules/cli-protocol.md) | `src/cli/**/*.ts` | 严格 `stdout` JSON vs `stderr` 诊断指引协议、退出码规范(0, 1, 2, 10)、SWR 异步缓存与 `--dry-run` 预览防线。 |
| [`rules/testing.md`](./rules/testing.md) | `src/**/*.test.ts` | 测试运行器 (`bun:test`)、同目录就近原则、环境变量/临时目录彻底隔离与网络 Mock 规范。 |
| [`rules/typescript-style.md`](./rules/typescript-style.md) | `src/**/*.ts` | ES modules、强制本地 `.js` 扩展名、Zod 输入校验与领域类型安全。 |
| [`rules/staging-simulation.md`](./rules/staging-simulation.md) | `src/domains/seal/**` | 生产规则安全演进闭环(草稿 -> sync-test -> test regression -> 用户批准)、业务编号脱敏红线。 |
| [`rules/material-pack-policy.md`](./rules/material-pack-policy.md) | `src/domains/seal/material-pack/**` | Webhook 材料包结构、单据附件目录双向隔离匹配、附件尺寸/后缀安全策略与 HMAC 防重放校验。 |
---
@@ -55,3 +60,5 @@ trigger: "manual"
- **CLI Development**: When adding or refactoring CLI commands under `src/cli/`, read [`rules/cli-protocol.md`](./rules/cli-protocol.md) before writing output streams.
- **Writing Tests**: When creating or modifying tests, read [`rules/testing.md`](./rules/testing.md).
- **TypeScript & Modules**: When adding new TypeScript files or resolving local imports, refer to [`rules/typescript-style.md`](./rules/typescript-style.md).
- **Rule Remediation & Staging**: When modifying approval rules or syncing between production and test enterprises, refer to [`rules/staging-simulation.md`](./rules/staging-simulation.md).
- **Webhook Material Packs**: When exporting, previewing, or validating Webhook attachment bundles, refer to [`rules/material-pack-policy.md`](./rules/material-pack-policy.md).
+74 -14
View File
@@ -1,23 +1,83 @@
---
description: "CLI stdout/stderr stream contract and exit code conventions for seal-use commands"
description: "CLI stdout/stderr stream contract, exit codes, SWR caching, and preview safety for seal-use commands"
globs: "src/cli/**/*.ts"
trigger: "manual"
---
# CLI Stream & Exit Code Protocol
# CLI Stream, Performance & Exit Code Protocol
When working on CLI command implementations under `src/cli/`:
When developing or refactoring CLI commands under `src/cli/`:
1. **Machine Channel (`stdout`)**:
- Data commands MUST output pure, parseable JSON on `stdout`.
- NEVER output human text, logs, spinners, or progress banners to `stdout` (the Agent Harness parses `stdout` directly).
- Documented exceptions for Markdown output: `seal-use --help` / `seal-use help <area>` and `seal-use doctor guide`.
## 1. Dual Stream Protocol (stdout vs stderr)
2. **Diagnostics & Guidance Channel (`stderr`)**:
- Write runtime logs, warnings, probing status, and human tips to `stderr`.
- Format next-step guidance explicitly: `👉 Next action: seal-use ...`.
- **Machine Channel (`stdout`)**:
- Data commands **MUST** output pure, parseable JSON on `stdout`.
- **NEVER** output human text, logs, spinners, progress banners, or update notices to `stdout`. The Agent Harness parses `stdout` directly into typed payloads.
- **Documented exceptions**: `seal-use --help` / `seal-use help <area>` (`src/cli/printer.ts`) and `seal-use doctor guide` (`src/cli/commands/doctor.ts`) intentionally output Markdown documents on `stdout` because their output *is* the requested document payload. Never add new stdout-prose commands outside this list.
- **Diagnostics & Guidance Channel (`stderr`)**:
- Use `stderr` for runtime logs, network probing status, self-healing notifications, and human tips.
- Explicit **Next-Step Command Suggestions** MUST follow the format:
```text
👉 Next action: seal-use <command>
```
3. **Exit Code Contract**:
- Successful operations MUST exit with `0`.
- Any validation error, upstream API failure, or block MUST result in non-zero exit code (e.g. `1`).
- DO NOT call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
---
## 2. Performance Contract & SWR Architecture
- **Sub-10ms Local Execution**:
- Read-only discovery commands (e.g. `seal-use version`, `seal-use doctor paths`, `seal-use corps list`) MUST return instantaneously (<10ms).
- Never trigger synchronous external HTTP requests during routine discovery or inspection invocations.
- **Stale-While-Revalidate (SWR) Pattern**:
1. Synchronously read local cache from `~/.config/seal-use/*.json` (<0.2ms).
2. Return the local cached state immediately on `stdout`.
3. If cache is missing or older than TTL (e.g. 24 hours), trigger a background refresh:
```typescript
const child = spawn(launcher.command, [...launcher.args, "subcommand", "--bg-save"], {
detached: true,
stdio: "ignore"
});
child.unref(); // Detach completely so parent exits immediately
```
4. Always respect test/CI guards (`SEAL_DISABLE_BG_UPDATE=1`, `NODE_ENV=test`, `CI=true`) to keep automated test suites deterministic.
---
## 3. High-Risk Mutation & Preview Contract (`--dry-run`)
- All potentially destructive or state-mutating commands (e.g. `rules push`, `rules clear`, `corps sync-test`, `preference update`, `webhook add/update/delete`) **MUST** support `--dry-run`.
- **Preview Output**:
- When `--dry-run` is present, the command performs read-only discovery, simulates the mutation, and returns structured JSON with:
```json
{
"preview": true,
"targetUrl": "...",
"changesDiff": { "before": "...", "after": "..." },
"impactCount": 5
}
```
- Live execution requires explicit `--yes` or `--confirm`. If neither is provided on a live mutation, block execution with exit code `10`.
---
## 4. Semantic Exit Codes
| Exit Code | Meaning | Example Scenario |
| :--- | :--- | :--- |
| `0` | **Success** | Successful query, preview, or completed mutation |
| `1` | **Domain / Upstream Failure** | Upstream HTTP 500, business logic rejection, quota insufficient |
| `2` | **Usage / Syntax Error** | Unknown subcommand, invalid JSON payload, invalid argument format |
| `10` | **Confirmation Required** | Mutating command invoked without `--confirm` or `--yes` |
**Rule**: Never call `process.exit()` deep in domain functions. Throw structured errors and let `src/cli/runner.ts` handle error classification, stream routing, and exit code assignment.
---
## 5. Argument Parsing Conventions
- Use helpers from `src/cli/parser.ts`:
- `booleanOption(args.options.flag)`
- `stringOption(args.options.param)`
- `numberOption(args.options.limit)`
- Support kebab-case and camelCase options gracefully.
- Positional arguments should fall back to option flags when natural (e.g. `corps get <corpId>` and `corps get --corp <corpId>`).
+2 -1
View File
@@ -18,7 +18,8 @@ trigger: "manual"
- **全量无回归验证**:
1. 运行 `bun test` 确保全仓所有测试 100% 通过;
2. 运行 `bun run check` 确保 TypeScript 类型检查 0 错误;
3. 若修改涉及 MCP Server 或构建入口,运行 `bun run build:plugin` 保持 `dist/mcp/server.js` 产物同步。
3. 若修改涉及 `src/`,运行 `bun run build:plugin` 保持 `dist/mcp/server.js` 产物同步(CI 强制校验);
4. 若修改涉及 `openapi/`,运行 `bun run openapi:bundle` 保持 `dist/openapi.json` 产物同步。
## 3. 分支提交与 Pull Request (Commit & PR)
- **提交信息**:使用清晰的简短祈使句,关联对应 Issue(例如 `Fix #137: decouple auth hose-link from internal session cache`)。
+63
View File
@@ -0,0 +1,63 @@
---
description: "Webhook 资源包结构、Excel 字段注入契约、附件安全策略与重放规范"
globs: "src/domains/seal/material-pack/**,src/cli/commands/webhook*"
trigger: "manual"
---
# Webhook 资源包与附件策略规范
当开发或维护 Webhook Material Pack(材料包导出、预览、推送与校验)时,必须遵守以下格式契约与安全防线:
---
## 1. 资源包结构与命名约束
一个标准的 Webhook 资源包为 `.zip` 压缩包,其内部必须严格遵守目录隔离:
```text
资源包.zip
├── 业务单据汇总表.xlsx # 主工作簿,包含单据明细及 [附件] 列
├── DOC-2026-001/ # 与 Excel 中单据编号一一对应的附件目录
│ ├── hotel_invoice.pdf
│ └── itinerary.png
└── DOC-2026-002@已审核/ # 支持带有 @ 标注的单据目录名
└── train_ticket.pdf
```
### 目录与附件防线
1. **单据目录隔离**:单据声明的附件路径必须位于属于该单据自身的目录下。严禁跨单据目录引用或引用非本单据目录的文件。
2. **双向匹配校验**:
- Excel 中声明的每个附件文件必须真实存在于 ZIP 包中;
- ZIP 包中单据目录下的每个文件必须在 Excel 的 `[附件]` 列中被声明,严禁悬挂未声明孤儿附件。
3. **`@` 标注兼容**:单据目录名允许携带 `@annotation` 后缀(如 `DOC-001@重测`),系统在解析匹配时自动识别并映射至基准单据编号。
---
## 2. 附件安全策略 (`materialPackFilePolicy`)
每个 Webhook 均可配置可变的文件安全控制策略,用于在上传和重放前拦截异常附件:
- `minFileSizeBytes`: 默认最小文件尺寸(如 500 字节),防止空文件或零字节坏损文件。
- `maxFileSizeBytes`: 可选最大文件尺寸(以字节为单位),防止超大文件耗尽内存或网络带宽。若传 `null` 或使用 `--clear-max-file-size` 则清除上限。
- `allowedExtensions`: 允许的文件扩展名白名单(如 `[".pdf", ".xlsx", ".png", ".jpg"]`)。
- **重要规则**:更新该字段为全量覆盖,添加新后缀时必须保留原有合法后缀。
---
## 3. Webhook 签名与数据注入
- **HMAC 签名校验**:
- 标准签名结构为 `timestamp.nonce.payload` 的 HMAC-SHA256 计算。
- `timestamp` 允许在合理时间窗口内防重放。
- **动态字段注入**:
- 解析 Excel 中的 `[附件]` 列(如 `[附件] 住宿发票`),自动清洗为标准标识符注入至 `categoryFields` 与 `ATTACHMENT` 域。
---
## 4. 离线预览防线 (`preview`)
- 在任何资源包实际推送到线上环境(`webhook resource-pack push`)前,优先使用:
```bash
seal-use webhook resource-pack preview <资源包.zip>
```
- 预览校验在纯内存中完成,不产生网络请求,严格检验工作簿格式、目录对应关系及文件策略合规性。
+59
View File
@@ -0,0 +1,59 @@
---
description: "生产规则安全演进闭环、测试靶场回归矩阵与多环境同步规范"
globs: "src/domains/seal/**,src/cli/commands/rules*,src/cli/commands/corps*"
trigger: "manual"
---
# 生产规则演进闭环与测试靶场回归规范
当处理 Seal 租户规则修改、客诉修补或规则同步时,必须严格遵守生产环境安全变更演进闭环:
```text
生产改草稿 -> 同步测试企业 (sync-test) -> 靶场回归验证 (test regression) -> 用户明确批准 -> 生产确认发布
```
---
## 1. 规则编辑三大安全红线
1. **红线一:严禁生产直更**
- 在生产环境做任何规则修改,默认只保存为**草稿态**(Draft),绝对不能直接发布上线生效。
2. **红线二:严禁向用户暴露机器 UUID**
- 规则展示、修改报告、Diff 与确认对话中,必须使用用户与管理后台唯一认知的业务编号:`规则编号: #xxxx`。
- 隐藏底层机器字段(如 `id: "01a00f34..."`、`boundCorpRole: testTarget` 等)。
3. **红线三:生产发布必须经用户明确授权**
- 严禁 Agent 代替用户点击“确认发布”。在生产正式生效(`rules publish`)前,必须向用户展示 Diff 并获得显式批准。
---
## 2. 标准演进链路
### 步骤一:生产草稿修改与规范 Diff 呈现
- 客诉排查与规则修补后,向用户呈现标准的 Unified Diff,仅包含业务字段:
- **适用场景** (`scope`)
- **遵守程度** (`strictness`: `必须遵守` / `建议遵守` / `提示参考`)
- **规则内容 / 审核要求** (`description`)
- **规则编号** (`#xxxx`)
### 步骤二:一键同步测试企业 (`sync-test`)
- 执行 `seal-use corps sync-test <prodCorpId>`:
- 将生产企业的草稿规则克隆并同步到已绑定的测试企业。
- 自动将测试企业中的规则生成并发布为新版本(格式:`[Prod vN · #M -> Test vM]`)。
- 自动同步合思测试通道与风格偏好(`decisionPreferences`、`thinkingDepthPreference`)。
### 步骤三:测试靶场自动化回归矩阵 (`test regression`)
- 执行自动化历史单据重放回归:
```bash
seal-use test regression --corp <testCorpId> --samples 10
```
- 检验决策一致率(Concordance Rate)与决策翻转(Decision Flips):
- 确保修复的 Bad Case 如期翻转;
- 确保未修改的已有用例无误伤;
- 确认 `safeToPublish: true`。
### 步骤四:生产发布授权
- 回报回归测试报告与指标,请求用户批准。
- 获得明确许可后,执行发布:
```bash
seal-use rules publish --corp <prodCorpId> --version-name "<语义版本名>"
```
+79 -12
View File
@@ -1,21 +1,88 @@
---
description: "Testing conventions and runner guidelines using bun:test"
description: "Testing conventions, environment isolation, network mocking, and test hygiene using bun:test"
globs: "src/**/*.test.ts"
trigger: "manual"
---
# Testing Guidelines
# Testing Conventions & Test Hygiene
When writing or maintaining unit and integration tests:
When writing or modifying automated tests in `src/`:
1. **Test Runner & Colocation**:
- Use `bun:test` (`describe`, `test`, `expect`).
- Colocate tests directly alongside implementation code as `name.test.ts` (e.g. `src/core/config/loader.test.ts`).
## 1. Test Framework & Colocation
2. **State & Environment Hygiene**:
- Any test modifying `process.env` or `process.chdir()` MUST restore them in `afterEach()`.
- Never leave temporary files or mutation leaks between test cases.
- **Runner**: Use `bun:test` primitives (`describe`, `test`, `it`, `expect`, `beforeEach`, `afterEach`).
- **Colocation**: Place test files directly next to the code they cover using the `*.test.ts` naming convention:
```text
src/core/update-cache.ts
src/core/update-cache.test.ts
```
- Do not create isolated `tests/` directories unless testing full external integration fixtures.
3. **Execution**:
- Run tests using `bun test`.
- Ensure type check passes with `bun run check`.
---
## 2. Environment & State Isolation (Zero Leaks)
- **Environment Variables**:
Any test that overrides or adds `process.env` keys MUST restore them in `afterEach()` or a `finally` block:
```typescript
const prevEnv = process.env.MY_CUSTOM_VAR;
try {
process.env.MY_CUSTOM_VAR = "test-value";
// test logic
} finally {
if (prevEnv !== undefined) {
process.env.MY_CUSTOM_VAR = prevEnv;
} else {
delete process.env.MY_CUSTOM_VAR;
}
}
```
- **Temporary Files & Directories**:
Always create isolated temporary workspaces using `mkdtempSync`:
```typescript
const testDir = mkdtempSync(join(tmpdir(), "seal-use-test-"));
try {
// file operations
} finally {
rmSync(testDir, { recursive: true, force: true });
}
```
- **Working Directory (`process.chdir`)**:
If a test changes cwd, it MUST capture `const cwd = process.cwd();` and restore it in `afterEach()`.
---
## 3. Network Mocking & Background Child Processes
- **HTTP Requests (`fetch`)**:
- Mock `globalThis.fetch` to isolate tests from live external networks.
- Wrap mocked fetch cleanly to satisfy Bun/TypeScript types:
```typescript
const originalFetch = globalThis.fetch;
globalThis.fetch = (async () =>
new Response(JSON.stringify({ ok: true }), {
status: 200,
headers: { "Content-Type": "application/json" }
})
) as any;
try {
// test logic
} finally {
globalThis.fetch = originalFetch;
}
```
- **Background Processes**:
- Ensure background asynchronous tasks or detached worker spawns are suppressed in tests:
```typescript
process.env.SEAL_DISABLE_BG_UPDATE = "1";
```
- This ensures test suites run fast and deterministically without hanging detached workers.
---
## 4. Test Execution & Quality Verification
Before committing changes or opening a PR:
1. `bun test`: Run all tests (must achieve 100% pass rate).
2. `bun test <specific.test.ts>`: Target specific files during active development.
3. `bun run check`: Confirm TypeScript type-checker reports 0 errors.
+16 -5
View File
@@ -19,10 +19,11 @@ Tests are colocated as `*.test.ts` files in `src/`. OpenAPI source YAML lives in
- `bun test`: run all colocated Bun tests.
- `bun run bump <version | patch | minor>`: bump version across all manifest/skill/openapi files and bundle.
- `bun run openapi:bundle`: rebuild `dist/openapi.json`.
- `bun run build:binary`: compile the standalone `seal-use` binary to `dist/bin/seal-use` (gitignored).
- `bun run build:plugin`: bundle the MCP server to `dist/mcp/server.js` (tracked, used by `.mcp.json`).
- `bun run dev:override`: compile the host binary with Git dev version metadata, macOS sign, atomically override the Mac global command (`/opt/homebrew/bin/seal-use`), and sync the local Agent Skill.
> **Pre-Push Bundle Gates**: Modifying `src/` files imported by the MCP server requires running `bun run build:plugin` to keep `dist/mcp/server.js` in sync; modifying `openapi/` requires `bun run openapi:bundle` to keep `dist/openapi.json` in sync. CI strictly checks for zero diff on both tracked bundles.
## Coding Style & Naming Conventions
Use TypeScript ES modules with explicit `.js` import extensions for local files. Validate external data with Zod or narrow types before use. Follow existing style: two-space indentation, double quotes, omitted trailing semicolons, `camelCase` variables/functions, `PascalCase` classes/types, and lowercase hyphenated filenames such as `token-store.ts`.
@@ -34,18 +35,28 @@ Prefer small domain functions over broad utility modules.
- **Machine Channel (`stdout`)**: Data commands MUST output clean, parseable JSON on `stdout`. Never dump human prose, raw logs, or progress banners into `stdout`. The Agent Harness parses `stdout` directly into typed payloads.
- **Documented exception — document-output commands**: `seal-use --help` / `seal-use help <area>` (`src/cli/printer.ts`) and `seal-use doctor guide` (`src/cli/commands/doctor.ts`) intentionally write Markdown to `stdout`, because their output *is* the payload the caller redirects or reads (e.g. `seal-use doctor guide > guide.md`). Never add a new prose-on-stdout command outside this list: return structured JSON and put the readable rendering on `stderr` instead. `src/probe.ts` is a local developer probe script rather than a `bin` entry point, so its `[probe] …` lines are outside this contract.
- **Guidance & Diagnostic Channel (`stderr`)**: Use `stderr` for runtime logs, network probing status, self-healing notifications, and explicit **Next-Step Command Suggestions** (e.g. `👉 Next action: seal-use deploy hosecloud sync <signKey>`).
- **Performance Contract & SWR Architecture**: Read-only discovery and version commands (`seal-use version`, `seal-use doctor`, `seal-use corps list`) MUST execute instantaneously (<10ms). Never block on external network I/O during routine invocations. Use the Stale-While-Revalidate (SWR) pattern: read local cache from `~/.config/seal-use/*.json` synchronously (<0.2ms), and refresh stale/missing data via detached, unref'd child processes (`triggerBackgroundUpdateCheck`, `unref()`).
- **Safety Guardrail & Mutation Preview (`--dry-run`)**: All potentially destructive or state-mutating commands (e.g. `rules push/clear`, `corps sync-test`, `preference update`, `webhook add/update`) MUST support `--dry-run` returning structured JSON previews with `preview: true` and a clean diff, without executing mutations. Live execution requires explicit `--yes` or `--confirm`.
- **Exit Code Contract**:
- Successful executions MUST terminate with exit code `0`.
- Any parameter validation failure, upstream API error, or business block MUST result in a non-zero exit code (e.g. `1`), allowing the Agent Harness to reliably detect failures and trigger automated error remediation.
- `0`: Successful execution.
- `1`: Upstream API failure or domain business block.
- `2`: Parameter validation failure, unknown subcommand, or invalid JSON.
- `10`: Safety gate block requiring user confirmation (`--confirm` / `--yes`).
- Never call `process.exit()` deep in domain functions; throw structured errors and let `src/cli/runner.ts` handle stream routing and exit code assignment.
## Testing Guidelines
Use `bun:test` with `describe`, `test`, and `expect`. Place tests next to covered code using `name.test.ts`, for example `src/core/config/loader.test.ts`. Tests that change environment variables or working directories must restore them in `afterEach`.
Use `bun:test` with `describe`, `test`, and `expect`. Place tests next to covered code using `name.test.ts`, for example `src/core/config/loader.test.ts`. Tests that change environment variables or working directories must restore them in `afterEach`. Ensure background tasks are guarded with `SEAL_DISABLE_BG_UPDATE=1` or `NODE_ENV=test` during tests. Detailed test hygiene guidelines are in `.agents/rules/testing.md`.
## Commit & Pull Request Guidelines
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters. Specific workflows and domain guidelines are maintained in `.agents/rules/`.
Recent commits use concise imperative subjects, often `Add ...` or `Refine ...`, such as `Add compact approval rule listing`. Keep subjects under roughly 72 characters. Specific workflows and domain guidelines are maintained in `.agents/rules/`:
- Issue triage & PR workflow (No premature release): `.agents/rules/issue-pr-workflow.md`
- CLI stream & exit code protocol: `.agents/rules/cli-protocol.md`
- Testing conventions & isolation: `.agents/rules/testing.md`
- TypeScript & ESM conventions: `.agents/rules/typescript-style.md`
- Staging & test sandbox regression: `.agents/rules/staging-simulation.md`
- Webhook material pack & attachment policy: `.agents/rules/material-pack-policy.md`
## Release & Publishing Guidelines
+61 -61
View File
@@ -1,7 +1,7 @@
import{createRequire as Ly0}from"node:module";var Iy0=Object.create;var{getPrototypeOf:Ky0,defineProperty:oT,getOwnPropertyNames:Gy0}=Object;var Hy0=Object.prototype.hasOwnProperty;function Wy0($){return this[$]}var Xy0,Zy0,J6=($,Y,U)=>{var z=$!=null&&typeof $==="object";if(z){var Q=Y?Xy0??=new WeakMap:Zy0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?Iy0(Ky0($)):{};let I=Y||!$||!$.__esModule?oT(U,"default",{value:$,enumerable:!0}):U;for(let K of Gy0($))if(!Hy0.call(I,K))oT(I,K,{get:Wy0.bind($,K),enumerable:!0});if(z)Q.set($,I);return I};var E=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var qy0=($)=>$;function Vy0($,Y){this[$]=qy0.bind(null,Y)}var x8=($,Y)=>{for(var U in Y)oT($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Vy0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var I0=Ly0(import.meta.url);var Fy0,cq,wy0,My0,Oy0,Ny0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),uo=($,Y)=>{let U={};for(var z in $)cq(U,z,{get:$[z],enumerable:!0});if(Y)cq(U,Symbol.toStringTag,{value:"Module"});return U},Dy0=($,Y,U,z)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=My0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Ny0.call($,K)&&K!==U)cq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(z=wy0(Y,K))||z.enumerable})}return $},nq=($,Y,U)=>(U=$!=null?Fy0(Oy0($)):{},Dy0(Y||!$||!$.__esModule?cq(U,"default",{value:$,enumerable:!0}):U,$));var rT=m(()=>{Fy0=Object.create,cq=Object.defineProperty,wy0=Object.getOwnPropertyDescriptor,My0=Object.getOwnPropertyNames,Oy0=Object.getPrototypeOf,Ny0=Object.prototype.hasOwnProperty});function io($){return typeof $==="string"&&bo.has($.replace(/#$/,""))}function co($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Ay0.has(U))return"2020-12";if(bo.has(U))return"2019-09";if(By0.has(U)||Py0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var Ay0,bo,By0,Py0;var sT=m(()=>{Ay0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),bo=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),By0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Py0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function H0($,Y,U){function z(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:new Set},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);let H=I.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in K))K[Z]=H[Z].bind(K)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function I(K){var G;let H=U?.Parent?new J:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(U?.Parent&&K instanceof U.Parent)return!0;return K?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}function a4($){if($)Object.assign(AY,$);return AY}var no,oK,aT,f5,BY,AY;var PY=m(()=>{oK=Object.freeze({status:"aborted"});aT=Symbol("zod_brand");f5=class f5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};BY=class BY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(no=globalThis).__zod_globalConfig??(no.__zod_globalConfig={});AY=globalThis.__zod_globalConfig});var y0={};x8(y0,{unwrapMessage:()=>rK,uint8ArrayToHex:()=>ry0,uint8ArrayToBase64url:()=>ly0,uint8ArrayToBase64:()=>lo,stringifyPrimitive:()=>v0,slugify:()=>$j,shallowClone:()=>Uj,safeExtend:()=>iy0,required:()=>py0,randomString:()=>gy0,propertyKeyTypes:()=>tK,promiseAllObject:()=>Sy0,primitiveTypes:()=>zj,prefixIssues:()=>f8,pick:()=>fy0,partial:()=>ny0,parsedType:()=>S0,optionalKeys:()=>Qj,omit:()=>uy0,objectClone:()=>_y0,numKeys:()=>yy0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>c9,merge:()=>cy0,jsonStringifyReplacer:()=>iz,joinValues:()=>O0,issue:()=>nz,isPlainObject:()=>G7,isObject:()=>TY,hexToUint8Array:()=>oy0,getSizableOrigin:()=>eK,getParsedType:()=>ky0,getLengthableOrigin:()=>$G,getEnumValues:()=>sK,getElementAtPath:()=>hy0,floatSafeRemainder:()=>eT,finalizeIssue:()=>A8,extend:()=>by0,explicitlyAborted:()=>Kj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>E1,createTransparentProxy:()=>xy0,cloneDef:()=>vy0,clone:()=>D8,cleanRegex:()=>aK,cleanEnum:()=>dy0,captureStackTrace:()=>dq,cached:()=>cz,base64urlToUint8Array:()=>my0,base64ToUint8Array:()=>mo,assignProp:()=>K7,assertNotEqual:()=>jy0,assertNever:()=>Cy0,assertIs:()=>Ey0,assertEqual:()=>Ty0,assert:()=>Ry0,allowsEval:()=>Yj,aborted:()=>H7,NUMBER_FORMAT_RANGES:()=>Jj,Class:()=>ooLine truncated
`)}var ro=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,iz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},YG,u8;var Wj=m(()=>{PY();$1();YG=H0("$ZodError",ro),u8=H0("$ZodError",ro,{Parent:Error})});var pz=($)=>(Y,U,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)throw new f5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},mq,dz=($)=>async(Y,U,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},lq,mz=($)=>(Y,U,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new f5;return J.issues.length?{success:!1,error:new($??YG)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Xj,lz=($)=>async(Y,U,z)=>{let Q=z?{...z,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Zj,oq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return pz($)(Y,U,Q)},ay0,rq=($)=>(Y,U,z)=>{return pz($)(Y,U,z)},ty0,sq=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return dz($)(Y,U,Q)},ey0,aq=($)=>async(Y,U,z)=>{return dz($)(Y,U,z)},$k0,tq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return mz($)(Y,U,Q)},Yk0,eq=($)=>(Y,U,z)=>{return mz($)(Y,U,z)},Uk0,$V=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return lz($)(Y,U,Q)},zk0,YV=($)=>async(Y,U,z)=>{return lz($)(Y,U,z)},Qk0;var qj=m(()=>{PY();Wj();$1();mq=pz(u8),lq=dz(u8),Xj=mz(u8),Zj=lz(u8),ay0=oq(u8),ty0=rq(u8),ey0=sq(u8),$k0=aq(u8),Yk0=tq(u8),Uk0=eq(u8),zk0=$V(u8),Qk0=YV(u8)});var Y$={};x8(Y$,{xid:()=>wj,uuid7:()=>Gk0,uuid6:()=>Kk0,uuid4:()=>Ik0,uuid:()=>jY,uppercase:()=>cj,unicodeEmail:()=>ao,undefined:()=>bj,ulid:()=>Fj,time:()=>Sj,string:()=>yj,sha512_hex:()=>Rk0,sha512_base64url:()=>vk0,sha512_base64:()=>_k0,sha384_hex:()=>jk0,sha384_base64url:()=>Ck0,sha384_base64:()=>Ek0,sha256_hex:()=>Bk0,sha256_base64url:()=>Tk0,sha256_base64:()=>Pk0,sha1_hex:()=>Nk0,sha1_base64url:()=>Ak0,sha1_base64:()=>Dk0,rfc5322Email:()=>Wk0,number:()=>QG,null:()=>uj,nanoid:()=>Oj,md5_hex:()=>wk0,md5_base64url:()=>Ok0,md5_base64:()=>Mk0,mac:()=>jj,lowercase:()=>ij,ksuid:()=>Mj,ipv6:()=>Tj,ipv4:()=>Pj,integer:()=>xj,idnEmail:()=>Xk0,httpProtocol:()=>_j,html5Email:()=>Hk0,hostname:()=>Vk0,hex:()=>Fk0,guid:()=>Dj,extendedDuration:()=>Jk0,emoji:()=>Bj,email:()=>Aj,e164:()=>vj,duration:()=>Nj,domain:()=>Lk0,datetime:()=>gj,date:()=>hj,cuid2:()=>Lj,cuid:()=>Vj,cidrv6:()=>Cj,cidrv4:()=>Ej,browserEmail:()=>Zk0,boolean:()=>fj,bigint:()=>kj,base64url:()=>UV,base64:()=>Rj});function Bj(){return new RegExp(qk0,"u")}function eo($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Sj($){return new RegExp(`^${eo($)}$`)}function gj($){let Y=eo({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${Y}(?:${U.join("|")})`;return new RegExp(`^${to}T(?:${z})$`)}function JG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Vj,Lj,Fj,wj,Mj,Oj,Nj,Jk0,Dj,jY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Ik0,Kk0,Gk0,Aj,Hk0,Wk0,ao,Xk0,Zk0,qk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pj,Tj,jj=($)=>{let Y=N$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Ej,Cj,Rj,UV,Vk0,Lk0,_j,vj,to="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",hj,yj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},kj,xj,QG,fj,uj,bj,ij,cj,Fk0,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Bk0,Pk0,Tk0,jk0,Ek0,Ck0,Rk0,_k0,vk0;var zV=m(()=>{$1();Vj=/^[cC][0-9a-z]{6,}$/,Lj=/^[0-9a-z]+$/,Fj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wj=/^[0-9a-vA-V]{20}$/,Mj=/^[A-Za-z0-9]{27}$/,Oj=/^[a-zA-Z0-9_-]{21}$/,Nj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
import{createRequire as Ly0}from"node:module";var Iy0=Object.create;var{getPrototypeOf:Ky0,defineProperty:oT,getOwnPropertyNames:Gy0}=Object;var Hy0=Object.prototype.hasOwnProperty;function Wy0($){return this[$]}var Xy0,Zy0,J6=($,Y,U)=>{var z=$!=null&&typeof $==="object";if(z){var Q=Y?Xy0??=new WeakMap:Zy0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?Iy0(Ky0($)):{};let I=Y||!$||!$.__esModule?oT(U,"default",{value:$,enumerable:!0}):U;for(let K of Gy0($))if(!Hy0.call(I,K))oT(I,K,{get:Wy0.bind($,K),enumerable:!0});if(z)Q.set($,I);return I};var E=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var qy0=($)=>$;function Vy0($,Y){this[$]=qy0.bind(null,Y)}var x8=($,Y)=>{for(var U in Y)oT($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Vy0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var I0=Ly0(import.meta.url);var Fy0,cq,wy0,My0,Oy0,Ny0,R0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),uo=($,Y)=>{let U={};for(var z in $)cq(U,z,{get:$[z],enumerable:!0});if(Y)cq(U,Symbol.toStringTag,{value:"Module"});return U},Dy0=($,Y,U,z)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=My0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Ny0.call($,K)&&K!==U)cq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(z=wy0(Y,K))||z.enumerable})}return $},nq=($,Y,U)=>(U=$!=null?Fy0(Oy0($)):{},Dy0(Y||!$||!$.__esModule?cq(U,"default",{value:$,enumerable:!0}):U,$));var rT=m(()=>{Fy0=Object.create,cq=Object.defineProperty,wy0=Object.getOwnPropertyDescriptor,My0=Object.getOwnPropertyNames,Oy0=Object.getPrototypeOf,Ny0=Object.prototype.hasOwnProperty});function io($){return typeof $==="string"&&bo.has($.replace(/#$/,""))}function co($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Ay0.has(U))return"2020-12";if(bo.has(U))return"2019-09";if(By0.has(U)||Py0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var Ay0,bo,By0,Py0;var sT=m(()=>{Ay0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),bo=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),By0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Py0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function H0($,Y,U){function z(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:new Set},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);let H=I.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in K))K[Z]=H[Z].bind(K)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function I(K){var G;let H=U?.Parent?new J:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(U?.Parent&&K instanceof U.Parent)return!0;return K?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}function a4($){if($)Object.assign(AY,$);return AY}var no,oK,aT,u5,BY,AY;var PY=m(()=>{oK=Object.freeze({status:"aborted"});aT=Symbol("zod_brand");u5=class u5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};BY=class BY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(no=globalThis).__zod_globalConfig??(no.__zod_globalConfig={});AY=globalThis.__zod_globalConfig});var y0={};x8(y0,{unwrapMessage:()=>rK,uint8ArrayToHex:()=>ry0,uint8ArrayToBase64url:()=>ly0,uint8ArrayToBase64:()=>lo,stringifyPrimitive:()=>v0,slugify:()=>$j,shallowClone:()=>Uj,safeExtend:()=>iy0,required:()=>py0,randomString:()=>gy0,propertyKeyTypes:()=>tK,promiseAllObject:()=>Sy0,primitiveTypes:()=>zj,prefixIssues:()=>f8,pick:()=>fy0,partial:()=>ny0,parsedType:()=>S0,optionalKeys:()=>Qj,omit:()=>uy0,objectClone:()=>_y0,numKeys:()=>yy0,nullish:()=>I7,normalizeParams:()=>x0,mergeDefs:()=>c9,merge:()=>cy0,jsonStringifyReplacer:()=>iz,joinValues:()=>O0,issue:()=>nz,isPlainObject:()=>G7,isObject:()=>TY,hexToUint8Array:()=>oy0,getSizableOrigin:()=>eK,getParsedType:()=>ky0,getLengthableOrigin:()=>$G,getEnumValues:()=>sK,getElementAtPath:()=>hy0,floatSafeRemainder:()=>eT,finalizeIssue:()=>A8,extend:()=>by0,explicitlyAborted:()=>Kj,escapeRegex:()=>N$,esc:()=>pq,defineLazy:()=>E1,createTransparentProxy:()=>xy0,cloneDef:()=>vy0,clone:()=>D8,cleanRegex:()=>aK,cleanEnum:()=>dy0,captureStackTrace:()=>dq,cached:()=>cz,base64urlToUint8Array:()=>my0,base64ToUint8Array:()=>mo,assignProp:()=>K7,assertNotEqual:()=>jy0,assertNever:()=>Cy0,assertIs:()=>Ey0,assertEqual:()=>Ty0,assert:()=>Ry0,allowsEval:()=>Yj,aborted:()=>H7,NUMBER_FORMAT_RANGES:()=>Jj,Class:()=>ooLine truncated
`)}var ro=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,iz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},YG,u8;var Wj=m(()=>{PY();$1();YG=H0("$ZodError",ro),u8=H0("$ZodError",ro,{Parent:Error})});var pz=($)=>(Y,U,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)throw new u5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},mq,dz=($)=>async(Y,U,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>A8(G,J,a4())));throw dq(K,Q?.callee),K}return I.value},lq,mz=($)=>(Y,U,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new u5;return J.issues.length?{success:!1,error:new($??YG)(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Xj,lz=($)=>async(Y,U,z)=>{let Q=z?{...z,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((I)=>A8(I,Q,a4())))}:{success:!0,data:J.value}},Zj,oq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return pz($)(Y,U,Q)},ay0,rq=($)=>(Y,U,z)=>{return pz($)(Y,U,z)},ty0,sq=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return dz($)(Y,U,Q)},ey0,aq=($)=>async(Y,U,z)=>{return dz($)(Y,U,z)},$k0,tq=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return mz($)(Y,U,Q)},Yk0,eq=($)=>(Y,U,z)=>{return mz($)(Y,U,z)},Uk0,$V=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return lz($)(Y,U,Q)},zk0,YV=($)=>async(Y,U,z)=>{return lz($)(Y,U,z)},Qk0;var qj=m(()=>{PY();Wj();$1();mq=pz(u8),lq=dz(u8),Xj=mz(u8),Zj=lz(u8),ay0=oq(u8),ty0=rq(u8),ey0=sq(u8),$k0=aq(u8),Yk0=tq(u8),Uk0=eq(u8),zk0=$V(u8),Qk0=YV(u8)});var Y$={};x8(Y$,{xid:()=>wj,uuid7:()=>Gk0,uuid6:()=>Kk0,uuid4:()=>Ik0,uuid:()=>jY,uppercase:()=>cj,unicodeEmail:()=>ao,undefined:()=>bj,ulid:()=>Fj,time:()=>Sj,string:()=>yj,sha512_hex:()=>Rk0,sha512_base64url:()=>vk0,sha512_base64:()=>_k0,sha384_hex:()=>jk0,sha384_base64url:()=>Ck0,sha384_base64:()=>Ek0,sha256_hex:()=>Bk0,sha256_base64url:()=>Tk0,sha256_base64:()=>Pk0,sha1_hex:()=>Nk0,sha1_base64url:()=>Ak0,sha1_base64:()=>Dk0,rfc5322Email:()=>Wk0,number:()=>QG,null:()=>uj,nanoid:()=>Oj,md5_hex:()=>wk0,md5_base64url:()=>Ok0,md5_base64:()=>Mk0,mac:()=>jj,lowercase:()=>ij,ksuid:()=>Mj,ipv6:()=>Tj,ipv4:()=>Pj,integer:()=>xj,idnEmail:()=>Xk0,httpProtocol:()=>_j,html5Email:()=>Hk0,hostname:()=>Vk0,hex:()=>Fk0,guid:()=>Dj,extendedDuration:()=>Jk0,emoji:()=>Bj,email:()=>Aj,e164:()=>vj,duration:()=>Nj,domain:()=>Lk0,datetime:()=>gj,date:()=>hj,cuid2:()=>Lj,cuid:()=>Vj,cidrv6:()=>Cj,cidrv4:()=>Ej,browserEmail:()=>Zk0,boolean:()=>fj,bigint:()=>kj,base64url:()=>UV,base64:()=>Rj});function Bj(){return new RegExp(qk0,"u")}function eo($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Sj($){return new RegExp(`^${eo($)}$`)}function gj($){let Y=eo({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${Y}(?:${U.join("|")})`;return new RegExp(`^${to}T(?:${z})$`)}function JG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function IG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var Vj,Lj,Fj,wj,Mj,Oj,Nj,Jk0,Dj,jY=($)=>{if(!$)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${$}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},Ik0,Kk0,Gk0,Aj,Hk0,Wk0,ao,Xk0,Zk0,qk0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Pj,Tj,jj=($)=>{let Y=N$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Ej,Cj,Rj,UV,Vk0,Lk0,_j,vj,to="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",hj,yj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},kj,xj,QG,fj,uj,bj,ij,cj,Fk0,wk0,Mk0,Ok0,Nk0,Dk0,Ak0,Bk0,Pk0,Tk0,jk0,Ek0,Ck0,Rk0,_k0,vk0;var zV=m(()=>{$1();Vj=/^[cC][0-9a-z]{6,}$/,Lj=/^[0-9a-z]+$/,Fj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wj=/^[0-9a-vA-V]{20}$/,Mj=/^[A-Za-z0-9]{27}$/,Oj=/^[a-zA-Z0-9_-]{21}$/,Nj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),z=Math.min(...U.map((J)=>J.length-J.trimStart().length)),Q=U.map((J)=>J.slice(z)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,z=[...(this?.content??[""]).map((Q)=>` ${Q}`)];return new $(...Y,z.join(`
`))}}var KE;var GE=m(()=>{KE={major:4,minor:4,patch:3}});function _E($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function wr($){if(!UV.test($))return!1;let Y=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return _E(U)}function Mr($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[z]=U;if(!z)return!1;let Q=JSON.parse(atob(z));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function zr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function XV($,Y,U,z,Q,J){let I=U in z;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...f8(U,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(I)Y.value[U]=void 0}else Y.value[U]=$.value}function Or($){let Y=Object.keys($.shape);for(let z of Y)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${z}": expected a Zod schema`);let U=Qj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Nr($,Y,U,z,Q,J){let I=[],K=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>XV(V,U,Z,Y,W,X)));else XV(q,U,Z,Y,W,X)}if(I.length)U.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Qr($,Y,U,z){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!H7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))}),Y}function Jr($,Y,U,z){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function HE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(G7($)&&G7(Y)){let U=Object.keys(Y),z=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of z){let I=HE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let z=0;z<$.length;z++){let Q=$[z],J=Y[z],I=HE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};U.push(I.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ir($,Y,U){let z=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of U.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(H7($))return $;let I=HE(Y.value,U.value);if(!I.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Kr($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Gr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function Hr($,Y,U,z,Q){for(let J=0;J<U.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...f8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=z.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Wr($,Y,U,z,Q,J,I){if($.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(Y.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:Y.issues.map((K)=>A8(K,I,a4()))});U.value.set($.value,Y.value)}function Xr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Zr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function qr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Vr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function GV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa Line truncated
`))}}var KE;var GE=m(()=>{KE={major:4,minor:4,patch:3}});function _E($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function wr($){if(!UV.test($))return!1;let Y=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return _E(U)}function Mr($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[z]=U;if(!z)return!1;let Q=JSON.parse(atob(z));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function zr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function XV($,Y,U,z,Q,J){let I=U in z;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...f8(U,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(I)Y.value[U]=void 0}else Y.value[U]=$.value}function Or($){let Y=Object.keys($.shape);for(let z of Y)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${z}": expected a Zod schema`);let U=Qj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Nr($,Y,U,z,Q,J){let I=[],K=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>XV(V,U,Z,Y,W,X)));else XV(q,U,Z,Y,W,X)}if(I.length)U.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Qr($,Y,U,z){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!H7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))}),Y}function Jr($,Y,U,z){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((I)=>A8(I,z,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function HE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(G7($)&&G7(Y)){let U=Object.keys(Y),z=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of z){let I=HE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let z=0;z<$.length;z++){let Q=$[z],J=Y[z],I=HE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};U.push(I.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ir($,Y,U){let z=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of U.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(H7($))return $;let I=HE(Y.value,U.value);if(!I.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function Kr($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Gr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function Hr($,Y,U,z,Q){for(let J=0;J<U.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...f8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=z.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Wr($,Y,U,z,Q,J,I){if($.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>A8(K,I,a4()))});if(Y.issues.length)if(tK.has(typeof z))U.issues.push(...f8(z,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:Y.issues.map((K)=>A8(K,I,a4()))});U.value.set($.value,Y.value)}function Xr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function Zr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function qr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Vr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function GV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa Line truncated
if (${D}.issues.length) {
if (${P} in input) {
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
@@ -60,9 +60,9 @@ import{createRequire as Ly0}from"node:module";var Iy0=Object.create;var{getProto
newResult[${P}] = ${D}.value;
}
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,I=TY,K=!AY.jitless,H=K&&Yj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Nr([],V,Z,q,X,$)}return U(Z,q)}});GG=H0("$ZodUnion",($,Y)=>{q1.init($,Y),E1($._zod,"optin",()=>Y.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((z)=>z._zod.values))return new Set(Y.options.flatMap((z)=>Array.from(z._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((z)=>z._zod.pattern)){let z=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>aK(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return Qr(I,z,$,Q);return Promise.all(I).then((K)=>{return Qr(K,z,$,Q)})}});oE=H0("$ZodXor",($,Y)=>{GG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return Jr(I,z,$,Q);return Promise.all(I).then((K)=>{return Jr(K,z,$,Q)})}}),rE=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,GG.init($,Y);let U=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=cz(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!TY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[Y.discriminator]);if(K)return K._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(z.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),sE=H0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},z),I=Y.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Ir(U,G,H)});return Ir(U,J,I)}});VV=H0("$ZodTuple",($,Y)=>{q1.init($,Y);let U=Y.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=Kr(U,"optin"),G=Kr(U,"optout");if(!Y.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>U.length)z.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)I.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Gr(V,z,W)));else Gr(q,z,W)}}if(I.length)return Promise.all(I).then(()=>Hr(H,z,U,J,G));return Hr(H,z,U,J,G)}});aE=H0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value;if(!G7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],I=Y.keyType._zod.values;if(I){U.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},z);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...f8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...f8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,I=TY,K=!AY.jitless,H=K&&Yj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Nr([],V,Z,q,X,$)}return U(Z,q)}});GG=H0("$ZodUnion",($,Y)=>{q1.init($,Y),E1($._zod,"optin",()=>Y.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((z)=>z._zod.values))return new Set(Y.options.flatMap((z)=>Array.from(z._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((z)=>z._zod.pattern)){let z=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>aK(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return Qr(I,z,$,Q);return Promise.all(I).then((K)=>{return Qr(K,z,$,Q)})}});oE=H0("$ZodXor",($,Y)=>{GG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return Jr(I,z,$,Q);return Promise.all(I).then((K)=>{return Jr(K,z,$,Q)})}}),rE=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,GG.init($,Y);let U=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=cz(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!TY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[Y.discriminator]);if(K)return K._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(z.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),sE=H0("$ZodIntersection",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},z),I=Y.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Ir(U,G,H)});return Ir(U,J,I)}});VV=H0("$ZodTuple",($,Y)=>{q1.init($,Y);let U=Y.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=Kr(U,"optin"),G=Kr(U,"optout");if(!Y.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>U.length)z.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)I.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)I.push(q.then((V)=>Gr(V,z,W)));else Gr(q,z,W)}}if(I.length)return Promise.all(I).then(()=>Hr(H,z,U,J,G));return Hr(H,z,U,J,G)}});aE=H0("$ZodRecord",($,Y)=>{q1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value;if(!G7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],I=Y.keyType._zod.values;if(I){U.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},z);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>A8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...f8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...f8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!K.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let I of $.seen.entries()){let K=I[1];if(Y===I[0]){J(I);continue}if($.external){let H=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}function V7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let z=(K)=>{let G=$.seen.get(K);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);else Object.assign(H,V);if(Object.assign(H,W),K._zod.parent===X)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete H[M]}if(V.$ref&&q.def)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))delete H[M]}}let Z=K._zod.parent;if(Z&&Z!==X){z(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(let V in H){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))delete H[V]}}}$.override({zodSchema:K,jsonSchema:H,path:G.path??[]})};for(let K of[...$.seen.entries()].reverse())z(K[0]);let Q={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let K=$.external.registry.get(Y)?.id;if(!K)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let I=$.external?.defs??{};for(let K of $.seen.entries()){let G=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;I[G.defId]=G.def}}if($.external);else if(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;else Q.definitions=I;try{let K=JSON.parse(JSON.stringify(Q));return Object.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:HQ(Y,"input",$.processors),output:HQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function P8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let z=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")return P8(z.element,U);if(z.type==="set")return P8(z.valueType,U);if(z.type==="lazy")return P8(z.getter(),U);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")return P8(z.innerType,U);if(z.type==="intersection")return P8(z.left,U)||P8(z.right,U);if(z.type==="record"||z.type==="map")return P8(z.keyType,U)||P8(z.valueType,U);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return P8(z.in,U)||P8(z.out,U)}if(z.type==="object"){for(let Q in z.shape)if(P8(z.shape[Q],U))return!0;return!1}if(z.type==="union"){for(let Q of z.options)if(P8(Q,U))return!0;return!1}if(z.type==="tuple"){for(let Q of z.items)if(P8(Q,U))return!0;if(z.rest&&P8(z.rest,U))return!0;return!1}return!1}var K_=($,Y={})=>(U)=>{let z=Z7({...U,processors:Y});return I4($,z),q7(z,$),V7(z,$)},HQ=($,Y,U={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=Z7({...Q??{},target:J,io:Y,processors:U});return I4($,I),q7(I,$),V7(I,$)};var MG=m(()=>{LG()});function vY($,Y){if("_idmap"in $){let z=$,Q=Z7({...Y,processors:nV}),J={};for(let G of z._idmap.entries()){let[H,W]=G;I4(W,Q)}let I={},K={registry:z,uri:Y?.uri,defs:J};Q.external=K;for(let G of z._idmap.entries()){let[H,W]=G;q7(Q,W),I[H]=V7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}let U=Z7({...Y,processors:nV});return I4($,U),q7(U,$),V7(U,$)}var ex0,G_=($,Y,U,z)=>{let Q=U;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof I==="number")Q.maxLength=I;if(K){if(Q.format=ex0[K]??K,Q.format==="")delete Q.format;if(K==="time")delete Q.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)Q.pattern=W[0].source;else if(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},H_=($,Y,U,z)=>{let Q=U,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof K==="string"&&K.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(I??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;else Q.exclusiveMinimuLine truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let I of $.seen.entries()){let K=I[1];if(Y===I[0]){J(I);continue}if($.external){let H=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}function V7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let z=(K)=>{let G=$.seen.get(K);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);else Object.assign(H,V);if(Object.assign(H,W),K._zod.parent===X)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete H[M]}if(V.$ref&&q.def)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))delete H[M]}}let Z=K._zod.parent;if(Z&&Z!==X){z(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(let V in H){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))delete H[V]}}}$.override({zodSchema:K,jsonSchema:H,path:G.path??[]})};for(let K of[...$.seen.entries()].reverse())z(K[0]);let Q={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let K=$.external.registry.get(Y)?.id;if(!K)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let I=$.external?.defs??{};for(let K of $.seen.entries()){let G=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;I[G.defId]=G.def}}if($.external);else if(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;else Q.definitions=I;try{let K=JSON.parse(JSON.stringify(Q));return Object.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:HQ(Y,"input",$.processors),output:HQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function P8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let z=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")return P8(z.element,U);if(z.type==="set")return P8(z.valueType,U);if(z.type==="lazy")return P8(z.getter(),U);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")return P8(z.innerType,U);if(z.type==="intersection")return P8(z.left,U)||P8(z.right,U);if(z.type==="record"||z.type==="map")return P8(z.keyType,U)||P8(z.valueType,U);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return P8(z.in,U)||P8(z.out,U)}if(z.type==="object"){for(let Q in z.shape)if(P8(z.shape[Q],U))return!0;return!1}if(z.type==="union"){for(let Q of z.options)if(P8(Q,U))return!0;return!1}if(z.type==="tuple"){for(let Q of z.items)if(P8(Q,U))return!0;if(z.rest&&P8(z.rest,U))return!0;return!1}return!1}var K_=($,Y={})=>(U)=>{let z=Z7({...U,processors:Y});return I4($,z),q7(z,$),V7(z,$)},HQ=($,Y,U={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=Z7({...Q??{},target:J,io:Y,processors:U});return I4($,I),q7(I,$),V7(I,$)};var MG=m(()=>{LG()});function vY($,Y){if("_idmap"in $){let z=$,Q=Z7({...Y,processors:nV}),J={};for(let G of z._idmap.entries()){let[H,W]=G;I4(W,Q)}let I={},K={registry:z,uri:Y?.uri,defs:J};Q.external=K;for(let G of z._idmap.entries()){let[H,W]=G;q7(Q,W),I[H]=V7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}let U=Z7({...Y,processors:nV});return I4($,U),q7(U,$),V7(U,$)}var ex0,G_=($,Y,U,z)=>{let Q=U;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof I==="number")Q.maxLength=I;if(K){if(Q.format=ex0[K]??K,Q.format==="")delete Q.format;if(K==="time")delete Q.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)Q.pattern=W[0].source;else if(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},H_=($,Y,U,z)=>{let Q=U,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof K==="string"&&K.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(I??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;else Q.exclusiveMinimuLine truncated
`}function Su0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!hu0.test($)){let U=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return Y.push(`Tool name contains invalid characters: ${U.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function gu0($,Y){if(Y.length>0){console.warn(`Tool name validation warning for "${$}":`);for(let U of Y)console.warn(` - ${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function QS($){let Y=Su0($);return gu0($,Y.warnings),Y.isValid}function yu0($){return typeof $==="object"&&$!==null&&"_zod"in $}function ku0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function xu0($){if(typeof $!=="object"||$===null)return!1;if(hQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>yu0(U))}function Rw($){if($===void 0)return;if(xu0($))return U0($);if(typeof $==="object"&&$!==null&&!hQ($)&&Object.values($).some((Y)=>ku0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!hQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var hh,Lf0,A1,V1,Ff0,Vt="2026-07-28",E7,wt,Of0,Nf0,Df0,Nt,Dt,Bf0,qw,Yu1,Uu1,Ut,bh,Rf0,_f0,_Q,n0,J1,Aw,Pt,gQ,Bw,Sf0=0,gf0="private",yf0,nf0,Lw,ph,Et,zu1,Qu1,rf0,sf0,dh,Fw,qH="2026-07-28",_t,ef0,D$=($)=>uG.safeParse($).success,C7=($)=>bG.safeParse($).success,XH=($)=>OQ.safeParse($).success,Ew=($)=>NQ.safeParse($).success,s9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Kt="x-mcp-header",$u0,Yu0,Uu0,zu0,Ow=-32020,Ju1,Qu0,Gt=!1,gh="draft-2020-12",Ku0,Zu0,qu0,Ht,Vu0,Nu0,St=250,Du0,Au0,xt,ft,Bu0,Pu0,bt=60000,ju0,Eu0,Cu0,it,$S,vu0,Iu1,ct=10485760,US=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??ct}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return nt(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},hu0;var _w=m(()=>{rT();sT();ea();av();hh=Symbol.for("mcp.sdk.errorBrands");Lf0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return vQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return vQ(this,Y)}constructor(Y,U,z){super(U);this.code=Y,this.errorUri=z,this.name="OAuthError",kh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},A1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),V1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return vQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return vQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",kh(this,new.target)}},Ff0=class extends V1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};E7=[Vt];wt=["task","inputRequests","requestState"];Nf0=new Set(["const","enum","default","examples"]),Df0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Nt={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Dt={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Bf0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Yu1=Object.keys(Nt),Uu1=Object.keys(Dt);Ut={ok:!1,reason:"not-in-era"};bh={era:"2025-11-25",hasRequestMethod:At,hasNotificationMethod:Bt,validateRequest:($,Y)=>Vw(jf0($),Y),validateResult:($,Y)=>Vw(Tf0($),Y),validateNotification:($,Y)=>Vw(Ef0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ut,validateInputResponse:()=>Ut,samplingResultVariant:($,Y)=>{let U=Mt();return Vw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Ft($),z=U.structuredContent;if(z===void 0)return U;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=Y!==void 0&&Ot(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:z}}},decodeResult($,Y){if(Sh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:Qt(U)}}return{kind:"complete",result:Qt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l Line truncated
* content-type
@@ -72,41 +72,41 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
`:""},this._extScope=y,this._scope=new U.Scope({parent:y}),this._nodes=[new F]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,s){let Y0=this._extScope.value(y,s);return(this._values[Y0.prefix]||(this._values[Y0.prefix]=new Set)).add(Y0),Y0}getScopeValue(y,s){return this._extScope.getValue(y,s)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,s,Y0,N0){let E0=this._scope.toName(s);if(Y0!==void 0&&N0)this._constants[E0.str]=Y0;return this._leafNode(new I(y,E0,Y0)),E0}const(y,s,Y0){return this._def(U.varKinds.const,y,s,Y0)}let(y,s,Y0){return this._def(U.varKinds.let,y,s,Y0)}var(y,s,Y0){return this._def(U.varKinds.var,y,s,Y0)}assign(y,s,Y0){return this._leafNode(new K(y,s,Y0))}add(y,s){return this._leafNode(new G(y,$.operators.ADD,s))}code(y){if(typeof y=="function")y();else if(y!==Y.nil)this._leafNode(new Z(y));return this}object(...y){let s=["{"];for(let[Y0,N0]of y){if(s.length>1)s.push(",");if(s.push(Y0),Y0!==N0||this.opts.es5)s.push(":"),(0,Y.addCodeArg)(s,N0)}return s.push("}"),new Y._Code(s)}if(y,s,Y0){if(this._blockNode(new w(y)),s&&Y0)this.code(s).else().code(Y0).endIf();else if(s)this.code(s).endIf();else if(Y0)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new w(y))}else(){return this._elseNode(new M)}endIf(){return this._endBlockNode(w,M)}_for(y,s){if(this._blockNode(y),s)this.code(s).endFor();return this}for(y,s){return this._for(new O(y),s)}forRange(y,s,Y0,N0,E0=this.opts.es5?U.varKinds.var:U.varKinds.let){let G0=this._scope.toName(y);return this._for(new D(E0,G0,s,Y0),()=>N0(G0))}forOf(y,s,Y0,N0=U.varKinds.const){let E0=this._scope.toName(y);if(this.opts.es5){let G0=s instanceof Y.Name?s:this.var("_arr",s);return this.forRange("_i",0,Y._`${G0}.length`,(T0)=>{this.var(E0,Y._`${G0}[${T0}]`),Y0(E0)})}return this._for(new P("of",N0,E0,s),()=>Y0(E0))}forIn(y,s,Y0,N0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,Y._`Object.keys(${s})`,Y0);let E0=this._scope.toName(y);return this._for(new P("in",N0,E0,s),()=>Y0(E0))}endFor(){return this._endBlockNode(N)}label(y){return this._leafNode(new H(y))}break(y){return this._leafNode(new W(y))}return(y){let s=new A;if(this._blockNode(s),this.code(y),s.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(y,s,Y0){if(!s&&!Y0)throw Error('CodeGen: "try" without "catch" and "finally"');let N0=new j;if(this._blockNode(N0),this.code(y),s){let E0=this.name("e");this._currNode=N0.catch=new C(E0),s(E0)}if(Y0)this._currNode=N0.finally=new b,this.code(Y0);return this._endBlockNode(C,b)}throw(y){return this._leafNode(new X(y))}block(y,s){if(this._blockStarts.push(this._nodes.length),y)this.code(y).endBlock(s);return this}endBlock(y){let s=this._blockStarts.pop();if(s===void 0)throw Error("CodeGen: not in self-balancing block");let Y0=this._nodes.length-s;if(Y0<0||y!==void 0&&Y0!==y)throw Error(`CodeGen: wrong number of nodes: ${Y0} vs ${y} expected`);return this._nodes.length=s,this}func(y,s=Y.nil,Y0,N0){if(this._blockNode(new T(y,s,Y0)),N0)this.code(N0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(y=1){while(y-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,s){let Y0=this._currNode;if(Y0 instanceof y||s&&Y0 instanceof s)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${s?`${y.kind}/${s.kind}`:y.kind}"`)}_elseNode(y){let s=this._currNode;if(!(s instanceof w))throw Error('CodeGen: "else" without "if"');return this._currNode=s.else=y,this}get _root(){return this._nodes[0]}get _currNode(){let y=this._nodes;return y[y.length-1]}set _currNode(y){let s=this._nodes;s[s.length-1]=y}};$.CodeGen=x;function S(y,s){for(let Y0 in s)y[Y0]=(y[Y0]||0)+(s[Y0]||0);return y}function i(y,s){return s instanceof Y._CodeOrName?S(y,s.names):y}function c(y,s,Y0){if(y instanceof Y.Name)return N0(y);if(!E0(y))return y;return new Y._Code(y._items.reduce((G0,T0)=>{if(T0 instanceof Y.Name)T0=N0(T0);if(T0 instanceof Y._Code)G0.push(...T0._items);else G0.push(T0);return G0},[]));function N0(G0){let T0=Y0[G0.str];if(T0===void 0||s[G0.str]!==1)return G0;return delete s[G0.str],T0}function E0(G0){return G0 instanceof Y._Code&&G0._items.some((T0)=>T0 instanceof Y.Name&&s[T0.str]===1&&Y0[T0.str]!==void 0)}}function z0(y,s){for(let Y0 in s)y[Y0]=(y[Y0]||0)-(s[Y0]||0)}function k(y){return typeof y=="boolean"||typeof y=="number"||y===null?!y:Y._`!${e(y)}`}$.not=k;let d=p($.operators.AND);function t(...y){return y.reduce(d)}$.and=t;let $0=p($.operators.OR);function g(...y){return y.reduce($0)}$.or=g;function p(y){return(s,Y0)=>s===Y.nil?Y0:Y0===Y.nil?s:Y._`${e(s)} ${y} ${e(Y0)}`}function Line truncated
|| (${C} == "string" && ${A} && ${A} == +${A})`).assign(b,Q._`+${A}`);return;case"integer":T.elseIf(Q._`${C} === "boolean" || ${A} === null
|| (${C} === "string" && ${A} && ${A} == +${A} && !(${A} % 1))`).assign(b,Q._`+${A}`);return;case"boolean":T.elseIf(Q._`${A} === "false" || ${A} === 0 || ${A} === null`).assign(b,!1).elseIf(Q._`${A} === "true" || ${A} === 1`).assign(b,!0);return;case"null":T.elseIf(Q._`${A} === "" || ${A} === 0 || ${A} === false`),T.assign(b,null);return;case"array":T.elseIf(Q._`${C} === "string" || ${C} === "number"
|| ${C} === "boolean" || ${A} === null`).assign(b,Q._`[${A}]`)}}}function q({gen:O,parentData:D,parentDataProperty:P},T){O.if(Q._`${D} !== undefined`,()=>O.assign(Q._`${D}[${P}]`,T))}function V(O,D,P,T=I.Correct){let A=T===I.Correct?Q.operators.EQ:Q.operators.NEQ,j;switch(O){case"null":return Q._`${D} ${A} null`;case"array":j=Q._`Array.isArray(${D})`;break;case"object":j=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":j=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":j=C();break;default:return Q._`typeof ${D} ${A} ${O}`}return T===I.Correct?j:(0,Q.not)(j);function C(b=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,b,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function F(O,D,P,T){if(O.length===1)return V(O[0],D,P,T);let A,j=(0,J.toHash)(O);if(j.array&&j.object){let C=Q._`typeof ${D} != "object"`;A=j.null?C:Q._`!${D} || ${C}`,delete j.null,delete j.array,delete j.object}else A=Q.nil;if(j.number)delete j.integer;for(let C in j)A=(0,Q.and)(A,V(C,D,P,T));return A}$.checkDataTypes=F;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:D})=>typeof O=="string"?Q._`{type: ${O}}`:Q._`{type: ${D}}`};function w(O){let D=N(O);(0,z.reportError)(D,M)}$.reportTypeError=w;function N(O){let{gen:D,data:P,schema:T}=O,A=(0,J.schemaRefOrVal)(O,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:A,schemaValue:A,parentSchema:T,params:{},it:O}}}),uu0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=L1(),U=v1();function z(J,I){let{properties:K,items:G}=J.schema;if(I==="object"&&K)for(let H in K)Q(J,H,K[H].default);else if(I==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=z;function Q(J,I,K){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(K===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(I)}`;if(H){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;G.if(q,Y._`${Z} = ${(0,Y.stringify)(K)}`)}}),Q5=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=L1(),U=v1(),z=z5(),Q=v1();function J(O,D){let{gen:P,data:T,it:A}=O;P.if(X(P,T,D,A.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${D}`},!0),O.error()})}$.checkReportMissingProp=J;function I({gen:O,data:D,it:{opts:P}},T,A){return(0,Y.or)(...T.map((j)=>(0,Y.and)(X(O,D,j,P.ownProperties),Y._`${A} = ${j}`)))}$.checkMissingProp=I;function K(O,D){O.setParams({missingProperty:D},!0),O.error()}$.reportMissingProp=K;function G(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(O,D,P){return Y._`${G(O)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${A} && ${H(O,D,P)}`:A}$.propertyInData=W;function X(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(A,(0,Y.not)(H(O,D,P))):A}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(O,D[P]))}$.schemaProperties=q;function V({schemaCode:O,data:D,it:{gen:P,topSchemaRef:T,schemaPath:A,errorPath:j},it:C},b,x,S){let i=S?Y._`${O}, ${D}, ${T}${A}`:D,c=[[z.default.instancePath,(0,Y.strConcat)(z.default.instancePath,j)],[z.default.parentData,C.parentData],[z.default.parentDataProperty,C.parentDataProperty],[z.default.rootData,z.default.rootData]];if(C.opts.dynamicRef)c.push([z.default.dynamicAnchors,z.default.dynamicAnchors]);let z0=Y._`${i}, ${P.object(...c)}`;return x!==Y.nil?Y._`${b}.call(${x}, ${z0})`:Y._`${b}(${z0})`}$.callValidateCode=V;let F=Y._`new RegExp`;function M({gen:O,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:A}=D.code,j=A(P,T);return O.scopeValue("pattern",{key:j.toString(),ref:j,code:Y._`${A.code==="new RegExp"?F:(0,Q.useFunc)(O,A)}(${P}, ${T})`})}$.usePattern=M;function w(O){let{gen:D,data:P,keyword:T,it:A}=O,j=D.name("valid");if(A.allErrors){let b=D.let("valid",!0);return C(()=>D.assign(b,!1)),b}return D.var(j,!0),C(()=>D.break()),j;function C(b){let x=D.const("len",Y._`${P}.length`);D.forRange("i",0,x,(S)=>{O.subschema({keyword:T,dataProp:S,dataPropType:U.Type.Num},j),D.if((0,Y.not)(j),b)})}}$.validateArray=w;function N(O){let{gen:D,schema:P,keyword:T,it:A}=O;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((b)=>(0,U.alwaysValidSchema)(A,b))&&!A.opts.unevaluated)return;let j=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((b,x)=>{let S=O.subschema({keyword:T,schemaProp:x,compositeRule:!0},C);if(D.assign(j,Y._`${j} || ${C}`),!O.mergeValidEvaluated(S,C) Line truncated
|| ${C} === "boolean" || ${A} === null`).assign(b,Q._`[${A}]`)}}}function q({gen:O,parentData:D,parentDataProperty:P},T){O.if(Q._`${D} !== undefined`,()=>O.assign(Q._`${D}[${P}]`,T))}function V(O,D,P,T=I.Correct){let A=T===I.Correct?Q.operators.EQ:Q.operators.NEQ,j;switch(O){case"null":return Q._`${D} ${A} null`;case"array":j=Q._`Array.isArray(${D})`;break;case"object":j=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":j=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":j=C();break;default:return Q._`typeof ${D} ${A} ${O}`}return T===I.Correct?j:(0,Q.not)(j);function C(b=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,b,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function F(O,D,P,T){if(O.length===1)return V(O[0],D,P,T);let A,j=(0,J.toHash)(O);if(j.array&&j.object){let C=Q._`typeof ${D} != "object"`;A=j.null?C:Q._`!${D} || ${C}`,delete j.null,delete j.array,delete j.object}else A=Q.nil;if(j.number)delete j.integer;for(let C in j)A=(0,Q.and)(A,V(C,D,P,T));return A}$.checkDataTypes=F;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:D})=>typeof O=="string"?Q._`{type: ${O}}`:Q._`{type: ${D}}`};function w(O){let D=N(O);(0,z.reportError)(D,M)}$.reportTypeError=w;function N(O){let{gen:D,data:P,schema:T}=O,A=(0,J.schemaRefOrVal)(O,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:A,schemaValue:A,parentSchema:T,params:{},it:O}}}),uu0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=L1(),U=v1();function z(J,I){let{properties:K,items:G}=J.schema;if(I==="object"&&K)for(let H in K)Q(J,H,K[H].default);else if(I==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=z;function Q(J,I,K){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(K===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(I)}`;if(H){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;G.if(q,Y._`${Z} = ${(0,Y.stringify)(K)}`)}}),Q5=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=L1(),U=v1(),z=z5(),Q=v1();function J(O,D){let{gen:P,data:T,it:A}=O;P.if(X(P,T,D,A.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${D}`},!0),O.error()})}$.checkReportMissingProp=J;function I({gen:O,data:D,it:{opts:P}},T,A){return(0,Y.or)(...T.map((j)=>(0,Y.and)(X(O,D,j,P.ownProperties),Y._`${A} = ${j}`)))}$.checkMissingProp=I;function K(O,D){O.setParams({missingProperty:D},!0),O.error()}$.reportMissingProp=K;function G(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(O,D,P){return Y._`${G(O)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${A} && ${H(O,D,P)}`:A}$.propertyInData=W;function X(O,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(A,(0,Y.not)(H(O,D,P))):A}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(O,D[P]))}$.schemaProperties=q;function V({schemaCode:O,data:D,it:{gen:P,topSchemaRef:T,schemaPath:A,errorPath:j},it:C},b,x,S){let i=S?Y._`${O}, ${D}, ${T}${A}`:D,c=[[z.default.instancePath,(0,Y.strConcat)(z.default.instancePath,j)],[z.default.parentData,C.parentData],[z.default.parentDataProperty,C.parentDataProperty],[z.default.rootData,z.default.rootData]];if(C.opts.dynamicRef)c.push([z.default.dynamicAnchors,z.default.dynamicAnchors]);let z0=Y._`${i}, ${P.object(...c)}`;return x!==Y.nil?Y._`${b}.call(${x}, ${z0})`:Y._`${b}(${z0})`}$.callValidateCode=V;let F=Y._`new RegExp`;function M({gen:O,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:A}=D.code,j=A(P,T);return O.scopeValue("pattern",{key:j.toString(),ref:j,code:Y._`${A.code==="new RegExp"?F:(0,Q.useFunc)(O,A)}(${P}, ${T})`})}$.usePattern=M;function w(O){let{gen:D,data:P,keyword:T,it:A}=O,j=D.name("valid");if(A.allErrors){let b=D.let("valid",!0);return C(()=>D.assign(b,!1)),b}return D.var(j,!0),C(()=>D.break()),j;function C(b){let x=D.const("len",Y._`${P}.length`);D.forRange("i",0,x,(S)=>{O.subschema({keyword:T,dataProp:S,dataPropType:U.Type.Num},j),D.if((0,Y.not)(j),b)})}}$.validateArray=w;function N(O){let{gen:D,schema:P,keyword:T,it:A}=O;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((b)=>(0,U.alwaysValidSchema)(A,b))&&!A.opts.unevaluated)return;let j=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((b,x)=>{let S=O.subschema({keyword:T,schemaProp:x,compositeRule:!0},C);if(D.assign(j,Y._`${j} || ${C}`),!O.mergeValidEvaluated(S,C) Line truncated
missingProperty: ${X},
depsCount: ${H},
deps: ${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);I(G,H),K(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function I(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let F=H[V];if(F.length===0)continue;let M=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(M,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(Y._`${M} && (${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,U.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),Gb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),U=v1(),z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName: ${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,U.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=z}),et=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=z5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>U._`{additionalProperty: ${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let F=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);w(),I.ok(U._`${X} === ${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!M.length)D(T);else K.if(N(T),()=>D(T))})}function N(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,U.or)(...F.map((j)=>U._`${T} === ${j}`));else A=U.nil;if(M.length)A=(0,U.or)(A,...M.map((j)=>U._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,U.not)(A)}function O(T){K.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),K.if((0,U.not)(A),()=>{I.reset(),O(T)});else if(P(T,A),!q)K.if((0,U.not)(A),()=>K.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),Hb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=yQ(),U=Q5(),z=v1(),Q=et(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,z.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,U.propertyInData)(K,W,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Wb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,z.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)O(P);if(X.allErrors) Line truncated
\x00`,x+=O4(j,2),x+=K.magic,x+=O4(M,2),x+=O4(w,2),x+=O4(A.crc32,4),x+=O4(A.compressedSize,4),x+=O4(A.uncompressedSize,4),x+=O4(H.length,2),x+=O4(N.length,2);var S=OO.LOCAL_FILE_HEADER+x+H+N,i=OO.CENTRAL_FILE_HEADER+O4(b,2)+x+O4(Z.length,2)+"\x00\x00\x00\x00"+O4(C,4)+O4(z,4)+H+N+Z;return{fileRecord:S,dirRecord:i}},qr0=function($,Y,U,z,Q){var J="",I=FJ.transformTo("string",Q(z));return J=OO.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+O4($,2)+O4($,2)+O4(Y,4)+O4(U,4)+O4(I.length,2)+I,J},Vr0=function($){var Y="";return Y=OO.DATA_DESCRIPTOR+O4($.crc32,4)+O4($.compressedSize,4)+O4($.uncompressedSize,4),Y};function X5($,Y,U,z){wJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=z,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}FJ.inherits(X5,wJ);X5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,z=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,wJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-z-1))/U:100}})};X5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=v50($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};X5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=v50($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:Vr0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};X5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,z=qr0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:z,meta:{percent:100}})};X5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};X5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};X5.prototype.resume=function(){if(!wJ.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};X5.prototype.error=function($){var Y=this._sources;if(!wJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(z){}return!0};X5.prototype.lock=function(){wJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};h50.exports=X5});var g50=E((Mr0)=>{var Lr0=by(),Fr0=S50(),wr0=function($,Y){var U=$||Y,z=Lr0[U];if(!z)throw Error(U+" is not a valid compression method !");return z};Mr0.generateWorker=function($,Y,U){var z=new Fr0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,I){Q++;var K=wr0(I.options.compression,Y.compression),G=I.options.compressionOptions||Y.compressionOptions||{},H=I.dir,W=I.date;I._compressWorker(K,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:I.comment||"",unixPermissions:I.unixPermissions,dosPermissions:I.dosPermissions}).pipe(z)}),z.entriesCount=Q}catch(J){z.error(J)}return z}});var k50=E((Gd1,y50)=>{var Nr0=n4(),NO=I$();function wW($,Y){NO.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Nr0.inherits(wW,NO);wW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};wW.prototype.pause=function(){if(!NO.prototype.pause.call(this))return!1;return this._stream.pause(),!0};wW.prototype.resume=function(){if(!NO.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};y50.exports=wW});var m50=E((Hd1,d50)=>{var Dr0=IJ(),MW=n4(),b50=I$(),Ar0=mg(),i50=lg(),x50=YO(),Br0=f80(),Pr0=g50(),f50=sH(),Tr0=k50(),c50=function($,Y,U){var z=MW.getTypeOf(Y),Q,J=MW.extend(U||{},i50);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission Line truncated
deps: ${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);I(G,H),K(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function I(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let F=H[V];if(F.length===0)continue;let M=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(M,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(Y._`${M} && (${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,U.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),Gb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L1(),U=v1(),z={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName: ${Q.propertyName}}`},code(Q){let{gen:J,schema:I,data:K,it:G}=Q;if((0,U.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=z}),et=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=z5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>U._`{additionalProperty: ${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let F=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);w(),I.ok(U._`${X} === ${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!M.length)D(T);else K.if(N(T),()=>D(T))})}function N(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,U.or)(...F.map((j)=>U._`${T} === ${j}`));else A=U.nil;if(M.length)A=(0,U.or)(A,...M.map((j)=>U._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,U.not)(A)}function O(T){K.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),K.if((0,U.not)(A),()=>{I.reset(),O(T)});else if(P(T,A),!q)K.if((0,U.not)(A),()=>K.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),Hb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=yQ(),U=Q5(),z=v1(),Q=et(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,z.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))M(w);else{if(K.if((0,U.propertyInData)(K,W,w,X.opts.ownProperties)),M(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function M(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Wb0=R0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=Q5(),U=L1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,z.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=K.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)O(P);if(X.allErrors) Line truncated
\x00`,x+=O4(j,2),x+=K.magic,x+=O4(M,2),x+=O4(w,2),x+=O4(A.crc32,4),x+=O4(A.compressedSize,4),x+=O4(A.uncompressedSize,4),x+=O4(H.length,2),x+=O4(N.length,2);var S=OO.LOCAL_FILE_HEADER+x+H+N,i=OO.CENTRAL_FILE_HEADER+O4(b,2)+x+O4(Z.length,2)+"\x00\x00\x00\x00"+O4(C,4)+O4(z,4)+H+N+Z;return{fileRecord:S,dirRecord:i}},qr0=function($,Y,U,z,Q){var J="",I=FJ.transformTo("string",Q(z));return J=OO.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+O4($,2)+O4($,2)+O4(Y,4)+O4(U,4)+O4(I.length,2)+I,J},Vr0=function($){var Y="";return Y=OO.DATA_DESCRIPTOR+O4($.crc32,4)+O4($.compressedSize,4)+O4($.uncompressedSize,4),Y};function X5($,Y,U,z){wJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=z,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}FJ.inherits(X5,wJ);X5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,z=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,wJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-z-1))/U:100}})};X5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=v50($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};X5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=v50($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:Vr0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};X5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,z=qr0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:z,meta:{percent:100}})};X5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};X5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};X5.prototype.resume=function(){if(!wJ.prototype.resume.call(this))return!1;if(!this.previous&&this._sources.length)return this.prepareNextSource(),!0;if(!this.previous&&!this._sources.length&&!this.generatedError)return this.end(),!0};X5.prototype.error=function($){var Y=this._sources;if(!wJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(z){}return!0};X5.prototype.lock=function(){wJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};h50.exports=X5});var g50=E((Mr0)=>{var Lr0=by(),Fr0=S50(),wr0=function($,Y){var U=$||Y,z=Lr0[U];if(!z)throw Error(U+" is not a valid compression method !");return z};Mr0.generateWorker=function($,Y,U){var z=new Fr0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,I){Q++;var K=wr0(I.options.compression,Y.compression),G=I.options.compressionOptions||Y.compressionOptions||{},H=I.dir,W=I.date;I._compressWorker(K,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:I.comment||"",unixPermissions:I.unixPermissions,dosPermissions:I.dosPermissions}).pipe(z)}),z.entriesCount=Q}catch(J){z.error(J)}return z}});var k50=E((Gd1,y50)=>{var Nr0=n4(),NO=I$();function wW($,Y){NO.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Nr0.inherits(wW,NO);wW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};wW.prototype.pause=function(){if(!NO.prototype.pause.call(this))return!1;return this._stream.pause(),!0};wW.prototype.resume=function(){if(!NO.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};y50.exports=wW});var m50=E((Hd1,d50)=>{var Dr0=IJ(),MW=n4(),b50=I$(),Ar0=mg(),i50=lg(),x50=YO(),Br0=f80(),Pr0=g50(),f50=sH(),Tr0=k50(),c50=function($,Y,U){var z=MW.getTypeOf(Y),Q,J=MW.extend(U||{},i50);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission Line truncated
`)}openNode($,Y){let U=this.tos,z=this._xml;if(U&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),Bk(z,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)k30(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Bk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(y30.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),U!==void 0)this.writeText(U);this.closeNode()}closeAll(){while(this._stack.length)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let $=this._rollbacks.pop();if(this._xml.length>$.xml)this._xml.splice($.xml,this._xml.length-$.xml);if(this._stack.length>$.stack)this._stack.splice($.stack,this._stack.length-$.stack);this.leaf=$.leaf,this.open=$.open}get xml(){return this.closeAll(),this._xml.join("")}}Pk.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x30.exports=Pk});var Tk=E((Ft0)=>{var f30=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Lt0($){if(typeof $==="string")return $;if(f30)return f30.decode($);return $.toString()}Ft0.bufferToString=Lt0});var n30=E((b30)=>{Object.defineProperty(b30,"__esModule",{value:!0});b30.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;b30.S=` \r
`;b30.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";b30.NAME_CHAR="-"+b30.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";b30.CHAR_RE=new RegExp("^["+b30.CHAR+"]$","u");b30.S_RE=new RegExp("^["+b30.S+"]+$","u");b30.NAME_START_CHAR_RE=new RegExp("^["+b30.NAME_START_CHAR+"]$","u");b30.NAME_CHAR_RE=new RegExp("^["+b30.NAME_CHAR+"]$","u");b30.NAME_RE=new RegExp("^["+b30.NAME_START_CHAR+"]["+b30.NAME_CHAR+"]*$","u");b30.NMTOKEN_RE=new RegExp("^["+b30.NAME_CHAR+"]+$","u");var jk=9,Ek=10,Ck=13,Rk=32;b30.S_LIST=[Rk,Ek,Ck,jk];function Mt0($){return $>=Rk&&$<=55295||$===Ek||$===Ck||$===jk||$>=57344&&$<=65533||$>=65536&&$<=1114111}b30.isChar=Mt0;function Ot0($){return $===Rk||$===Ek||$===Ck||$===jk}b30.isS=Ot0;function u30($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}b30.isNameStartChar=u30;function Nt0($){return u30($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}b30.isNameChar=Nt0});var e30=E((r30)=>{Object.defineProperty(r30,"__esModule",{value:!0});r30.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";r30.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";r30.S=` \r
`;r30.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r30.NAME_CHAR="-"+r30.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r30.CHAR_RE=new RegExp("^["+r30.CHAR+"]$","u");r30.RESTRICTED_CHAR_RE=new RegExp("^["+r30.RESTRICTED_CHAR+"]$","u");r30.S_RE=new RegExp("^["+r30.S+"]+$","u");r30.NAME_START_CHAR_RE=new RegExp("^["+r30.NAME_START_CHAR+"]$","u");r30.NAME_CHAR_RE=new RegExp("^["+r30.NAME_CHAR+"]$","u");r30.NAME_RE=new RegExp("^["+r30.NAME_START_CHAR+"]["+r30.NAME_CHAR+"]*$","u");r30.NMTOKEN_RE=new RegExp("^["+r30.NAME_CHAR+"]+$","u");var p30=9,d30=10,m30=13,l30=32;r30.S_LIST=[l30,d30,m30,p30];function ht0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r30.isChar=ht0;function St0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}r30.isRestrictedChar=St0;function gt0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r30.isCharAndNotRestricted=gt0;function yt0($){return $===l30||$===d30||$===m30||$===p30}r30.isS=yt0;function o30($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}r30.isNameStartChar=o30;function kt0($){return o30($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}r30.isNameChar=kt0});var U70=E((Y70)=>{Object.defineProperty(Y70,"__esModule",{value:!0});Y70.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";Y70.NC_NAME_CHAR="-"+Y70.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";Y70.NC_NAME_START_CHAR_RE=new RegExp("^["+Y70.NC_NAME_START_CHAR+"]$","u");Y70.NC_NAME_CHAR_RE=new RegExp("^["+Y70.NC_NAME_CHAR+"]$","u");Y70.NC_NAME_RE=new RegExp("^["+Y70.NC_NAME_START_CHAR+"]["+Y70.NC_NAME_CHAR+"]*$","u");function $70($){return $>=65&&$<=90||$===95||$>=97&&$<=122||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8204&&$<=8205||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}Y70.isNCNameStartChar=$70;function at0($){return $70($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}Y70.isNCNameChar=at0});var P70=E((B70)=>{Object.defineProperty(B70,"__esModule",{value:!0});var RJ=n30(),ze0=e30(),nk=U70(),p8=RJ.isS,Qe0=RJ.isChar,vW=RJ.isNameStartChar,z70=RJ.isNameChar,w70=RJ.S_LIST,Je0=RJ.NAME_RE,Ie0=ze0.isChar,Ke0=nk.isNCNameStartChar,Ge0=nk.isNCNameChar,He0=nk.NC_NAME_RE,rO="http://www.w3.org/XML/1998/namespace",CJ="http://www.w3.org/2000/xmlns/",We0={__proto__:null,xml:rO,xmlns:CJ},Xe0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},k4=-1,J9=-2,Q70=0,Ze0=1,vk=2,qe0=3,TJ=4,Ve0=5,Le0=6,Fe0=7,hk=8,we0=9,Me0=10,Oe0=11,Ne0=12,C8=13,pO=14,Sk=15,De0=16,gk=17,Ae0=18,Be0=19,yk=20,Pe0=21,Te0=22,je0=23,J70=24,kk=25,dO=26,I70=27,Ee0=28,Ce0=29,K70=30,Re0=31,_e0=32,HU=33,ve0=34,xk=35,hW=36,fk=37,he0=38,G70=39,H70=40,Se0=41,W70=42,ge0=43,ye0=44,uk=9,q5=10,bk=13,X70=32,Z70=33,M70=34,SW=38,O70=39,mO=45,lO=47,ke0=59,a7=60,jJ=61,P6=62,o6=63,N70=91,EJ=93,q70=133,V70=8232,oO=($)=>$===M70||$===O70,D70=[M70,O70],xe0=[...D70,N70,P6],fe0=[...D70,a7,EJ],ue0=[jJ,o6,...w70],be0=[...w70,P6,SW,a7];function ck($,Y,U){switch(Y){case"xml":if(U!==rO)$.fail(`xml prefix must be bound to ${rO}.`);break;case"xmlns":if(U!==CJ)$.fail(`xmlns prefix must be bound to ${CJ}.`);break;default:}switch(U){case CJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${CJ}.`);break;case rO:switch(Y){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function ie0($,Y){for(let U of Object.keys(Y))ck($,U,Y[U])}var ce0=($)=>He0.test($),ne0=($)=>Je0.test($),WU=0,L70=1,ik=2;B70.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var F70={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class A70{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=Ke0,this.nameCheck=Ge0,this.isName=ce0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},We0);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let z=this.getCode();switch(z){case J9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,z=q5;break;case k4:return this.text+=U.slice(Y),!1;default:}if(z===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===k4)return this.name+=$.slice(Y),k4;if(!z70(U))return this.name+=$.slice(Y,this.prevI),U===J9?q5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===k4||!p8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=Qe0,this.getCode=this.getCode10;else this.isChar=Ie0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=Ze0}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case a7:if(this.state=Sk,this.text.length!==0)throw Error("no-empty text at start");break;case k4:break;default:this.unget(),this.state=C8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(xe0);switch(Y){case P6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8,this.doctype=!0;break}case k4:break;default:if(this.text+=String.fromCodePoint(Y),Y===N70)this.state=TJ;else if(oO(Y))this.state=qe0,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=vk}sDTD(){let $=this.captureTo(fe0);if($===k4)return;if(this.text+=String.fromCodePoint($),$===EJ)this.state=vk;else if($===a7)this.state=Le0;else if(oO($))this.state=Ve0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=TJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Z70:this.state=Fe0,this.openWakaBang="";break;case o6:this.state=Oe0;break;default:this.state=TJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?hk:TJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(mO))this.text+="-",this.state=we0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===mO?Me0:hk}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===P6)this.state=TJ;else this.fail("malformed comment."),this.state=hk}sDTDPI(){if(this.captureToChar(o6))this.text+="?",this.state=Ne0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===P6)this.state=TJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case J9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case ke0:{let{entityReturnState:U}=this,z=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(U!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=ve0,this.unget(),this.xmlDeclPossible=!1;else switch($){case lO:this.state=ge0,this.xmlDeclPossible=!1;break;case Z70:this.state=De0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=je0;break;default:this.fail("disallowed character in tag name"),this.state=C8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=yk,this.openWakaBang="";break;case"--":this.state=gk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=vk,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(mO))this.state=Ae0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===mO)this.state=Be0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=gk}sCommentEnded(){let $=this.getCodeNorm();if($!==P6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=gk;else this.state=C8}sCData(){if(this.captureToChar(EJ))this.state=Pe0}sCDataEnding(){let $=this.getCodeNorm();if($===EJ)this.state=Te0;else this.text+=`]${String.fromCodePoint($)}`,this.state=yk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case P6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case EJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=yk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let z=U===o6;if(z||p8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?HU:I70}else this.state=z?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=dO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=dO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===P6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=kk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=HU;return}if($!==k4)this.state=Ee0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ue0);if($===o6){this.state=HU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===jJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=$===jJ?K70:Ce0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==jJ)this.fail("value required.");this.state=K70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!oO($))this.fail("value must be quoted."),this.q=X70;else this.q=$;this.state=Re0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=HU,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,Y=WU;break;case k4:if(z!==void 0)this.text+=U.slice($);break $;default:Y=WU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,z=!1;$:while(!0){let Q=this.getCode();switch(Q){case a7:{if(this.state=Sk,U!==void 0){let{text:J}=this,I=Y.slice($,this.prevI);if(J.length!==0)U(J+I),this.text="";else if(I.length!==0)U(I)}break $}case SW:if(this.state=pO,this.entityReturnState=C8,U!==void 0)this.text+=Y.slice($,this.prevI);z=!0;break $;case J9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;r30.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r30.NAME_CHAR="-"+r30.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r30.CHAR_RE=new RegExp("^["+r30.CHAR+"]$","u");r30.RESTRICTED_CHAR_RE=new RegExp("^["+r30.RESTRICTED_CHAR+"]$","u");r30.S_RE=new RegExp("^["+r30.S+"]+$","u");r30.NAME_START_CHAR_RE=new RegExp("^["+r30.NAME_START_CHAR+"]$","u");r30.NAME_CHAR_RE=new RegExp("^["+r30.NAME_CHAR+"]$","u");r30.NAME_RE=new RegExp("^["+r30.NAME_START_CHAR+"]["+r30.NAME_CHAR+"]*$","u");r30.NMTOKEN_RE=new RegExp("^["+r30.NAME_CHAR+"]+$","u");var p30=9,d30=10,m30=13,l30=32;r30.S_LIST=[l30,d30,m30,p30];function ht0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r30.isChar=ht0;function St0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}r30.isRestrictedChar=St0;function gt0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r30.isCharAndNotRestricted=gt0;function yt0($){return $===l30||$===d30||$===m30||$===p30}r30.isS=yt0;function o30($){return $>=65&&$<=90||$>=97&&$<=122||$===58||$===95||$===8204||$===8205||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}r30.isNameStartChar=o30;function kt0($){return o30($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}r30.isNameChar=kt0});var U70=E((Y70)=>{Object.defineProperty(Y70,"__esModule",{value:!0});Y70.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";Y70.NC_NAME_CHAR="-"+Y70.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";Y70.NC_NAME_START_CHAR_RE=new RegExp("^["+Y70.NC_NAME_START_CHAR+"]$","u");Y70.NC_NAME_CHAR_RE=new RegExp("^["+Y70.NC_NAME_CHAR+"]$","u");Y70.NC_NAME_RE=new RegExp("^["+Y70.NC_NAME_START_CHAR+"]["+Y70.NC_NAME_CHAR+"]*$","u");function $70($){return $>=65&&$<=90||$===95||$>=97&&$<=122||$>=192&&$<=214||$>=216&&$<=246||$>=248&&$<=767||$>=880&&$<=893||$>=895&&$<=8191||$>=8204&&$<=8205||$>=8304&&$<=8591||$>=11264&&$<=12271||$>=12289&&$<=55295||$>=63744&&$<=64975||$>=65008&&$<=65533||$>=65536&&$<=983039}Y70.isNCNameStartChar=$70;function at0($){return $70($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}Y70.isNCNameChar=at0});var P70=E((B70)=>{Object.defineProperty(B70,"__esModule",{value:!0});var RJ=n30(),ze0=e30(),nk=U70(),p8=RJ.isS,Qe0=RJ.isChar,vW=RJ.isNameStartChar,z70=RJ.isNameChar,w70=RJ.S_LIST,Je0=RJ.NAME_RE,Ie0=ze0.isChar,Ke0=nk.isNCNameStartChar,Ge0=nk.isNCNameChar,He0=nk.NC_NAME_RE,rO="http://www.w3.org/XML/1998/namespace",CJ="http://www.w3.org/2000/xmlns/",We0={__proto__:null,xml:rO,xmlns:CJ},Xe0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},k4=-1,I9=-2,Q70=0,Ze0=1,vk=2,qe0=3,TJ=4,Ve0=5,Le0=6,Fe0=7,hk=8,we0=9,Me0=10,Oe0=11,Ne0=12,C8=13,pO=14,Sk=15,De0=16,gk=17,Ae0=18,Be0=19,yk=20,Pe0=21,Te0=22,je0=23,J70=24,kk=25,dO=26,I70=27,Ee0=28,Ce0=29,K70=30,Re0=31,_e0=32,HU=33,ve0=34,xk=35,hW=36,fk=37,he0=38,G70=39,H70=40,Se0=41,W70=42,ge0=43,ye0=44,uk=9,q5=10,bk=13,X70=32,Z70=33,M70=34,SW=38,O70=39,mO=45,lO=47,ke0=59,a7=60,jJ=61,P6=62,o6=63,N70=91,EJ=93,q70=133,V70=8232,oO=($)=>$===M70||$===O70,D70=[M70,O70],xe0=[...D70,N70,P6],fe0=[...D70,a7,EJ],ue0=[jJ,o6,...w70],be0=[...w70,P6,SW,a7];function ck($,Y,U){switch(Y){case"xml":if(U!==rO)$.fail(`xml prefix must be bound to ${rO}.`);break;case"xmlns":if(U!==CJ)$.fail(`xmlns prefix must be bound to ${CJ}.`);break;default:}switch(U){case CJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${CJ}.`);break;case rO:switch(Y){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function ie0($,Y){for(let U of Object.keys(Y))ck($,U,Y[U])}var ce0=($)=>He0.test($),ne0=($)=>Je0.test($),WU=0,L70=1,ik=2;B70.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var F70={xmldecl:"xmldeclHandler",text:"textHandler",processinginstruction:"piHandler",doctype:"doctypeHandler",comment:"commentHandler",opentagstart:"openTagStartHandler",attribute:"attributeHandler",opentag:"openTagHandler",closetag:"closeTagHandler",cdata:"cdataHandler",error:"errorHandler",end:"endHandler",ready:"readyHandler"};class A70{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=Ke0,this.nameCheck=Ge0,this.isName=ce0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},We0);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let z=this.getCode();switch(z){case I9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,z=q5;break;case k4:return this.text+=U.slice(Y),!1;default:}if(z===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===k4)return this.name+=$.slice(Y),k4;if(!z70(U))return this.name+=$.slice(Y,this.prevI),U===I9?q5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===k4||!p8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=Qe0,this.getCode=this.getCode10;else this.isChar=Ie0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=Ze0}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case a7:if(this.state=Sk,this.text.length!==0)throw Error("no-empty text at start");break;case k4:break;default:this.unget(),this.state=C8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(xe0);switch(Y){case P6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8,this.doctype=!0;break}case k4:break;default:if(this.text+=String.fromCodePoint(Y),Y===N70)this.state=TJ;else if(oO(Y))this.state=qe0,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=vk}sDTD(){let $=this.captureTo(fe0);if($===k4)return;if(this.text+=String.fromCodePoint($),$===EJ)this.state=vk;else if($===a7)this.state=Le0;else if(oO($))this.state=Ve0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=TJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Z70:this.state=Fe0,this.openWakaBang="";break;case o6:this.state=Oe0;break;default:this.state=TJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?hk:TJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(mO))this.text+="-",this.state=we0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===mO?Me0:hk}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===P6)this.state=TJ;else this.fail("malformed comment."),this.state=hk}sDTDPI(){if(this.captureToChar(o6))this.text+="?",this.state=Ne0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===P6)this.state=TJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case I9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case ke0:{let{entityReturnState:U}=this,z=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(U!==C8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(vW($))this.state=ve0,this.unget(),this.xmlDeclPossible=!1;else switch($){case lO:this.state=ge0,this.xmlDeclPossible=!1;break;case Z70:this.state=De0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case o6:this.state=je0;break;default:this.fail("disallowed character in tag name"),this.state=C8,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case"[CDATA[":if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0;this.state=yk,this.openWakaBang="";break;case"--":this.state=gk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=vk,this.doctype||this.sawRoot)this.fail("inappropriately located doctype declaration.");this.openWakaBang="";break;default:if(this.openWakaBang.length>=7)this.fail("incorrect syntax.")}}sComment(){if(this.captureToChar(mO))this.state=Ae0}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===mO)this.state=Be0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=gk}sCommentEnded(){let $=this.getCodeNorm();if($!==P6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=gk;else this.state=C8}sCData(){if(this.captureToChar(EJ))this.state=Pe0}sCDataEnding(){let $=this.getCodeNorm();if($===EJ)this.state=Te0;else this.text+=`]${String.fromCodePoint($)}`,this.state=yk}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case P6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C8;break}case EJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=yk}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J70;else if($===o6||p8($))this.fail("processing instruction without a target."),this.state=$===o6?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let z=U===o6;if(z||p8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?HU:I70}else this.state=z?dO:kk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===o6)this.state=dO;else if(!p8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(o6))this.state=dO}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===P6){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=C8}else if(Y===o6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=kk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===o6){this.state=HU;return}if($!==k4)this.state=Ee0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(ue0);if($===o6){this.state=HU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(p8($)||$===jJ))return;if(this.name+=this.text,this.text="",!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail("did not expect any more name/value pairs.");break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`)}this.state=$===jJ?K70:Ce0}sXMLDeclEq(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if($!==jJ)this.fail("value required.");this.state=K70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===o6){this.state=HU,this.fail("XML declaration is incomplete.");return}if(p8($))return;if(!oO($))this.fail("value must be quoted."),this.q=X70;else this.q=$;this.state=Re0}sXMLDeclValue(){let $=this.captureTo([this.q,o6]);if($===o6){this.state=HU,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,Y=WU;break;case k4:if(z!==void 0)this.text+=U.slice($);break $;default:Y=WU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,z=!1;$:while(!0){let Q=this.getCode();switch(Q){case a7:{if(this.state=Sk,U!==void 0){let{text:J}=this,I=Y.slice($,this.prevI);if(J.length!==0)U(J+I),this.text="";else if(I.length!==0)U(I)}break $}case SW:if(this.state=pO,this.entityReturnState=C8,U!==void 0)this.text+=Y.slice($,this.prevI);z=!0;break $;case I9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;$=this.i;break;case k4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!p8(Q))z=!0}}if(!z)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,Y){var U;let{prefix:z,local:Q}=this.qname($),J={name:$,prefix:z,local:Q,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),z==="xmlns"){let I=Y.trim();if(this.currentXMLVersion==="1.0"&&I==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Q]=I,ck(this,Q,I)}else if($==="xmlns"){let I=Y.trim();this.topNS[""]=I,ck(this,"",I)}}pushAttribPlain($,Y){var U;let z={name:$,value:Y};this.attribList.push(z),(U=this.attributeHandler)===null||U===void 0||U.call(this,z)}end(){var $,Y;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let Q=U.pop();this.fail(`unclosed tag: ${Q.name}`)}if(this.state!==Q70&&this.state!==C8)this.fail("unexpected end.");let{text:z}=this;if(z.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,z),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let z=this.topNS[$];if(z!==void 0)return z;let{tags:Q}=this;for(let J=Q.length-1;J>=0;J--)if(z=Q[J].ns[$],z!==void 0)return z;if(z=this.ns[$],z!==void 0)return z;return(U=(Y=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(Y,$)}qname($){let Y=$.indexOf(":");if(Y===-1)return{prefix:"",local:$};let U=$.slice(Y+1),z=$.slice(0,Y);if(z===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:z,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:I}=this.qname(U.name);U.prefix=J,U.local=I;let K=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(K==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:z}=U,Q=new Set;for(let J of Y){let{name:I,prefix:K,local:G}=J,H,W;if(K==="")H=I==="xmlns"?CJ:"",W=I;else{if(H=this.resolve(K),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(K)}.`),H=K;W=`{${H}}${G}`}if(Q.has(W))this.fail(`duplicate attribute: ${W}.`);Q.add(W),J.uri=H,z[I]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:z}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=z}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:Y}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),Y.push(U),this.state=C8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:z}=this,Q=this.tag;if(Q.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,Q),(Y=this.closeTagHandler)===null||Y===void 0||Y.call(this,Q),(this.tag=(U=z[z.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=C8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=C8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,z=$.length;while(z-- >0){let Q=this.tag=$.pop();if(this.topNS=Q.ns,U===null||U===void 0||U(Q),Q.name===Y)break;this.fail("unexpected close tag.")}if(z===0)this.closedRoot=!0;else if(z<0)this.fail(`unmatched closing tag: ${Y}.`),this.text+=`</${Y}>`}parseEntity($){if($[0]!=="#"){let U=this.ENTITIES[$];if(U!==void 0)return U;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let Y=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))Y=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))Y=parseInt($.slice(1),10);if(!this.isChar(Y))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(Y)}}B70.SaxesParser=A70});var gW=E((md1,T70)=>{var{SaxesParser:me0}=P70(),{PassThrough:le0}=E8(),{bufferToString:oe0}=Tk();T70.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new le0);let Y=new me0,U;Y.on("error",(Q)=>{U=Q});let z=[];Y.on("opentag",(Q)=>z.push({eventType:"opentag",value:Q})),Y.on("text",(Q)=>z.push({eventType:"text",value:Q})),Y.on("closetag",(Q)=>z.push({eventType:"closetag",value:Q}));for await(let Q of $){if(Y.write(oe0(Q)),U)throw U;yield z,z=[]}}});var g0=E((ld1,j70)=>{var re0=gW(),se0=l6();class _J{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof _J)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let Y of $)for(let{eventType:U,value:z}of Y)if(U==="opentag")this.parseOpen(z);else if(U==="text")this.parseText(z);else if(U==="closetag"){if(!this.parseClose(z.name))return thLine truncated
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:Line truncated
`,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,$||{}),typeof($===null||$===void 0?void 0:$.quoteHeaders)>"u")this.quoteHeaders=this.quoteColumns;if(($===null||$===void 0?void 0:$.quote)===!0)this.quote='"';else if(($===null||$===void 0?void 0:$.quote)===!1)this.quote="";if(typeof($===null||$===void 0?void 0:$.escape)!=="string")this.escape=this.quote;this.shouldWriteHeaders=!!this.headers&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}UI0.FormatterOptions=YI0});var CN=E((Mo1,KI0)=>{var I51="[object AsyncFunction]",K51="[object Function]",G51="[object GeneratorFunction]",H51="[object Null]",W51="[object Proxy]",X51="[object Undefined]",Z51=typeof global=="object"&&global&&global.Object===Object&&global,q51=typeof self=="object"&&self&&self.Object===Object&&self,V51=Z51||q51||Function("return this")(),JI0=Object.prototype,L51=JI0.hasOwnProperty,II0=JI0.toString,QI0=V51.Symbol,wU=QI0?QI0.toStringTag:void 0;function F51($){if($==null)return $===void 0?X51:H51;return wU&&wU in Object($)?w51($):M51($)}function w51($){var Y=L51.call($,wU),U=$[wU];try{$[wU]=void 0;var z=!0}catch(J){}var Q=II0.call($);if(z)if(Y)$[wU]=U;else delete $[wU];return Q}function M51($){return II0.call($)}function O51($){if(!N51($))return!1;var Y=F51($);return Y==K51||Y==G51||Y==I51||Y==W51}function N51($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}KI0.exports=O51});var cI0=E((RN,bJ)=>{var D51=200,Zf="__lodash_hash_undefined__",xN=1,OI0=2,NI0=9007199254740991,_N="[object Arguments]",Jf="[object Array]",A51="[object AsyncFunction]",DI0="[object Boolean]",AI0="[object Date]",BI0="[object Error]",PI0="[object Function]",B51="[object GeneratorFunction]",vN="[object Map]",TI0="[object Number]",P51="[object Null]",uJ="[object Object]",GI0="[object Promise]",T51="[object Proxy]",jI0="[object RegExp]",hN="[object Set]",EI0="[object String]",j51="[object Symbol]",E51="[object Undefined]",If="[object WeakMap]",CI0="[object ArrayBuffer]",SN="[object DataView]",C51="[object Float32Array]",R51="[object Float64Array]",_51="[object Int8Array]",v51="[object Int16Array]",h51="[object Int32Array]",S51="[object Uint8Array]",g51="[object Uint8ClampedArray]",y51="[object Uint16Array]",k51="[object Uint32Array]",x51=/[\\^$.*+?()[\]{}|]/g,f51=/^\[object .+?Constructor\]$/,u51=/^(?:0|[1-9]\d*)$/,P4={};P4[C51]=P4[R51]=P4[_51]=P4[v51]=P4[h51]=P4[S51]=P4[g51]=P4[y51]=P4[k51]=!0;P4[_N]=P4[Jf]=P4[CI0]=P4[DI0]=P4[SN]=P4[AI0]=P4[BI0]=P4[PI0]=P4[vN]=P4[TI0]=P4[uJ]=P4[jI0]=P4[hN]=P4[EI0]=P4[If]=!1;var RI0=typeof global=="object"&&global&&global.Object===Object&&global,b51=typeof self=="object"&&self&&self.Object===Object&&self,q3=RI0||b51||Function("return this")(),_I0=typeof RN=="object"&&RN&&!RN.nodeType&&RN,HI0=_I0&&typeof bJ=="object"&&bJ&&!bJ.nodeType&&bJ,vI0=HI0&&HI0.exports===_I0,Uf=vI0&&RI0.process,WI0=function(){try{return Uf&&Uf.binding&&Uf.binding("util")}catch($){}}(),XI0=WI0&&WI0.isTypedArray;function i51($,Y){var U=-1,z=$==null?0:$.length,Q=0,J=[];while(++U<z){var I=$[U];if(Y(I,U,$))J[Q++]=I}return J}function c51($,Y){var U=-1,z=Y.length,Q=$.length;while(++U<z)$[Q+U]=Y[U];return $}function n51($,Y){var U=-1,z=$==null?0:$.length;while(++U<z)if(Y($[U],U,$))return!0;return!1}function p51($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}function d51($){return function(Y){return $(Y)}}function m51($,Y){return $.has(Y)}function l51($,Y){return $==null?void 0:$[Y]}function o51($){var Y=-1,U=Array($.size);return $.forEach(function(z,Q){U[++Y]=[Q,z]}),U}function r51($,Y){return function(U){return $(Y(U))}}function s51($){var Y=-1,U=Array($.size);return $.forEach(function(z){U[++Y]=z}),U}var a51=Array.prototype,t51=Function.prototype,fN=Object.prototype,zf=q3["__core-js_shared__"],hI0=t51.toString,K9=fN.hasOwnProperty,ZI0=function(){var $=/[^.]+$/.exec(zf&&zf.keys&&zf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),SI0=fN.toString,e51=RegExp("^"+hI0.call(K9).replace(x51,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qI0=vI0?q3.Buffer:void 0,gN=q3.Symbol,VI0=q3.Uint8Array,gI0=fN.propertyIsEnumerable,$91=a51.splice,MU=gN?gN.toStringTag:void 0,LI0=Object.getOwnPropertySymbols,Y91=qI0?qI0.isBuffer:void 0,U91=r51(Object.keys,Object),Kf=iJ(q3,"DataView"),iW=iJ(q3,"Map"),Gf=iJ(q3,"Promise"),Hf=iJ(q3,"Set"),Wf=iJ(q3,"WeakMap"),cW=iJ(Object,"create"),z91=DU(Kf),Q91=DU(iW),J91=DU(Gf),I91=DU(Hf),K91=DU(Wf),FI0=gN?gN.prototype:void 0,Qf=FI0?FI0.valueOf:void 0;function OU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var z=$[Y];this.set(z[0],z[1])}}function G91(){this.__data__=cW?cW(null):{},this.size=0}function H91($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function W91($){var Y=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(F31.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let z=`${w31.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(z.indexOf(Q.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(z);return z}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}cJ.FieldFormatter=aI0});var wf=E((tI0)=>{Object.defineProperty(tI0,"__esModule",{value:!0});tI0.isSyncTransform=void 0;tI0.isSyncTransform=($)=>$.length===1});var YK0=E((nJ)=>{var $K0=nJ&&nJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(nJ,"__esModule",{value:!0});nJ.RowFormatter=void 0;var O31=$K0(CN()),N31=$K0(cI0()),D31=Ff(),A31=wf();class AU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new D31.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(AU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(A31.isSyncTransform($))return(Y,U)=>{let z=null;try{z=$(Y)}catch(Q){return U(Q)}return U(null,z)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!O31.default($))throw TypeError("The transform should be a function");this._rowTransform=AU.createTransform($)}format($,Y){this.callTransformer($,(U,z)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(z){let{shouldFormatColumns:J,headers:I}=this.checkHeaders(z);if(this.shouldWriteHeaders&&I&&!this.hasWrittenHeaders)Q.push(this.formatColumns(I,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(z);Q.push(this.formatColumns(K,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=AU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!N31.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(AU.isRowHashArray($))return this.headers.map((Y,U)=>{let z=$[U];if(z)return z[1];return""});if(AU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,U].join("");return U}}nJ.RowFormatter=AU});var UK0=E((iN)=>{Object.defineProperty(iN,"__esModule",{value:!0});iN.FieldFormatter=iN.RowFormatter=void 0;var B31=YK0();Object.defineProperty(iN,"RowFormatter",{enumerable:!0,get:function(){return B31.RowFormatter}});var P31=Ff();Object.defineProperty(iN,"FieldFormatter",{enumerable:!0,get:function(){return P31.FieldFormatter}})});var Mf=E((QK0)=>{Object.defineProperty(QK0,"__esModule",{value:!0});QK0.CsvFormatterStream=void 0;var j31=I0("stream"),E31=UK0();class zK0 extends j31.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new E31.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return z=!0,U(Q);if(J)J.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return z=!0,U()})}catch(Q){if(z)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}QK0.CsvFormatterStream=zK0});var KK0=E((s1)=>{var IK0=s1&&s1.__createBinding||(Object.create?function($,Y,U,z){if(z===void 0)z=U;Object.defineProperty($,z,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,z){if(z===void 0)z=U;$[z]=Y[U]}),C31=s1&&s1.__setModuleDefault||(Object.create?function($,Y){O Line truncated
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:Line truncated
`,this.quote='"',this.escape=this.quote,this.quoteColumns=!1,this.quoteHeaders=this.quoteColumns,this.headers=null,this.includeEndRowDelimiter=!1,this.writeBOM=!1,this.BOM="\uFEFF",this.alwaysWriteHeaders=!1,Object.assign(this,$||{}),typeof($===null||$===void 0?void 0:$.quoteHeaders)>"u")this.quoteHeaders=this.quoteColumns;if(($===null||$===void 0?void 0:$.quote)===!0)this.quote='"';else if(($===null||$===void 0?void 0:$.quote)===!1)this.quote="";if(typeof($===null||$===void 0?void 0:$.escape)!=="string")this.escape=this.quote;this.shouldWriteHeaders=!!this.headers&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}UI0.FormatterOptions=YI0});var CN=E((Mo1,KI0)=>{var I51="[object AsyncFunction]",K51="[object Function]",G51="[object GeneratorFunction]",H51="[object Null]",W51="[object Proxy]",X51="[object Undefined]",Z51=typeof global=="object"&&global&&global.Object===Object&&global,q51=typeof self=="object"&&self&&self.Object===Object&&self,V51=Z51||q51||Function("return this")(),JI0=Object.prototype,L51=JI0.hasOwnProperty,II0=JI0.toString,QI0=V51.Symbol,wU=QI0?QI0.toStringTag:void 0;function F51($){if($==null)return $===void 0?X51:H51;return wU&&wU in Object($)?w51($):M51($)}function w51($){var Y=L51.call($,wU),U=$[wU];try{$[wU]=void 0;var z=!0}catch(J){}var Q=II0.call($);if(z)if(Y)$[wU]=U;else delete $[wU];return Q}function M51($){return II0.call($)}function O51($){if(!N51($))return!1;var Y=F51($);return Y==K51||Y==G51||Y==I51||Y==W51}function N51($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}KI0.exports=O51});var cI0=E((RN,bJ)=>{var D51=200,Zf="__lodash_hash_undefined__",xN=1,OI0=2,NI0=9007199254740991,_N="[object Arguments]",Jf="[object Array]",A51="[object AsyncFunction]",DI0="[object Boolean]",AI0="[object Date]",BI0="[object Error]",PI0="[object Function]",B51="[object GeneratorFunction]",vN="[object Map]",TI0="[object Number]",P51="[object Null]",uJ="[object Object]",GI0="[object Promise]",T51="[object Proxy]",jI0="[object RegExp]",hN="[object Set]",EI0="[object String]",j51="[object Symbol]",E51="[object Undefined]",If="[object WeakMap]",CI0="[object ArrayBuffer]",SN="[object DataView]",C51="[object Float32Array]",R51="[object Float64Array]",_51="[object Int8Array]",v51="[object Int16Array]",h51="[object Int32Array]",S51="[object Uint8Array]",g51="[object Uint8ClampedArray]",y51="[object Uint16Array]",k51="[object Uint32Array]",x51=/[\\^$.*+?()[\]{}|]/g,f51=/^\[object .+?Constructor\]$/,u51=/^(?:0|[1-9]\d*)$/,P4={};P4[C51]=P4[R51]=P4[_51]=P4[v51]=P4[h51]=P4[S51]=P4[g51]=P4[y51]=P4[k51]=!0;P4[_N]=P4[Jf]=P4[CI0]=P4[DI0]=P4[SN]=P4[AI0]=P4[BI0]=P4[PI0]=P4[vN]=P4[TI0]=P4[uJ]=P4[jI0]=P4[hN]=P4[EI0]=P4[If]=!1;var RI0=typeof global=="object"&&global&&global.Object===Object&&global,b51=typeof self=="object"&&self&&self.Object===Object&&self,q3=RI0||b51||Function("return this")(),_I0=typeof RN=="object"&&RN&&!RN.nodeType&&RN,HI0=_I0&&typeof bJ=="object"&&bJ&&!bJ.nodeType&&bJ,vI0=HI0&&HI0.exports===_I0,Uf=vI0&&RI0.process,WI0=function(){try{return Uf&&Uf.binding&&Uf.binding("util")}catch($){}}(),XI0=WI0&&WI0.isTypedArray;function i51($,Y){var U=-1,z=$==null?0:$.length,Q=0,J=[];while(++U<z){var I=$[U];if(Y(I,U,$))J[Q++]=I}return J}function c51($,Y){var U=-1,z=Y.length,Q=$.length;while(++U<z)$[Q+U]=Y[U];return $}function n51($,Y){var U=-1,z=$==null?0:$.length;while(++U<z)if(Y($[U],U,$))return!0;return!1}function p51($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}function d51($){return function(Y){return $(Y)}}function m51($,Y){return $.has(Y)}function l51($,Y){return $==null?void 0:$[Y]}function o51($){var Y=-1,U=Array($.size);return $.forEach(function(z,Q){U[++Y]=[Q,z]}),U}function r51($,Y){return function(U){return $(Y(U))}}function s51($){var Y=-1,U=Array($.size);return $.forEach(function(z){U[++Y]=z}),U}var a51=Array.prototype,t51=Function.prototype,fN=Object.prototype,zf=q3["__core-js_shared__"],hI0=t51.toString,G9=fN.hasOwnProperty,ZI0=function(){var $=/[^.]+$/.exec(zf&&zf.keys&&zf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),SI0=fN.toString,e51=RegExp("^"+hI0.call(G9).replace(x51,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qI0=vI0?q3.Buffer:void 0,gN=q3.Symbol,VI0=q3.Uint8Array,gI0=fN.propertyIsEnumerable,$91=a51.splice,MU=gN?gN.toStringTag:void 0,LI0=Object.getOwnPropertySymbols,Y91=qI0?qI0.isBuffer:void 0,U91=r51(Object.keys,Object),Kf=iJ(q3,"DataView"),iW=iJ(q3,"Map"),Gf=iJ(q3,"Promise"),Hf=iJ(q3,"Set"),Wf=iJ(q3,"WeakMap"),cW=iJ(Object,"create"),z91=DU(Kf),Q91=DU(iW),J91=DU(Gf),I91=DU(Hf),K91=DU(Wf),FI0=gN?gN.prototype:void 0,Qf=FI0?FI0.valueOf:void 0;function OU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var z=$[Y];this.set(z[0],z[1])}}function G91(){this.__data__=cW?cW(null):{},this.size=0}function H91($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function W91($){var Y=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(F31.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let z=`${w31.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(z.indexOf(Q.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(z);return z}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}cJ.FieldFormatter=aI0});var wf=E((tI0)=>{Object.defineProperty(tI0,"__esModule",{value:!0});tI0.isSyncTransform=void 0;tI0.isSyncTransform=($)=>$.length===1});var YK0=E((nJ)=>{var $K0=nJ&&nJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(nJ,"__esModule",{value:!0});nJ.RowFormatter=void 0;var O31=$K0(CN()),N31=$K0(cI0()),D31=Ff(),A31=wf();class AU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new D31.FieldFormatter($),this.headers=$.headers,this.shouldWriteHeaders=$.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null)this.fieldFormatter.headers=this.headers;if($.transform)this.rowTransform=$.transform}static isRowHashArray($){if(Array.isArray($))return Array.isArray($[0])&&$[0].length===2;return!1}static isRowArray($){return Array.isArray($)&&!this.isRowHashArray($)}static gatherHeaders($){if(AU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(A31.isSyncTransform($))return(Y,U)=>{let z=null;try{z=$(Y)}catch(Q){return U(Q)}return U(null,z)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!O31.default($))throw TypeError("The transform should be a function");this._rowTransform=AU.createTransform($)}format($,Y){this.callTransformer($,(U,z)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(z){let{shouldFormatColumns:J,headers:I}=this.checkHeaders(z);if(this.shouldWriteHeaders&&I&&!this.hasWrittenHeaders)Q.push(this.formatColumns(I,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(z);Q.push(this.formatColumns(K,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=AU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!N31.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(AU.isRowHashArray($))return this.headers.map((Y,U)=>{let z=$[U];if(z)return z[1];return""});if(AU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,U].join("");return U}}nJ.RowFormatter=AU});var UK0=E((iN)=>{Object.defineProperty(iN,"__esModule",{value:!0});iN.FieldFormatter=iN.RowFormatter=void 0;var B31=YK0();Object.defineProperty(iN,"RowFormatter",{enumerable:!0,get:function(){return B31.RowFormatter}});var P31=Ff();Object.defineProperty(iN,"FieldFormatter",{enumerable:!0,get:function(){return P31.FieldFormatter}})});var Mf=E((QK0)=>{Object.defineProperty(QK0,"__esModule",{value:!0});QK0.CsvFormatterStream=void 0;var j31=I0("stream"),E31=UK0();class zK0 extends j31.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new E31.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return z=!0,U(Q);if(J)J.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return z=!0,U()})}catch(Q){if(z)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}QK0.CsvFormatterStream=zK0});var KK0=E((s1)=>{var IK0=s1&&s1.__createBinding||(Object.create?function($,Y,U,z){if(z===void 0)z=U;Object.defineProperty($,z,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,z){if(z===void 0)z=U;$[z]=Y[U]}),C31=s1&&s1.__setModuleDefault||(Object.create?function($,Y){O Line truncated
`||Y===`\r
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}GG0.Token=KG0});var nf=E((ZG0)=>{Object.defineProperty(ZG0,"__esModule",{value:!0});ZG0.Scanner=void 0;var WG0=G2(),kY1=/((?:\r\n)|\n|\r)/;class XG0{constructor($){this.cursor=0,this.line=$.line,this.lineLength=this.line.length,this.parserOptions=$.parserOptions,this.hasMoreData=$.hasMoreData,this.cursor=$.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:$}=this,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let z=U[1],Q=this.cursor+(U.index||0);return new WG0.Token({token:z,startCursor:Q,endCursor:Q+z.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new WG0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=kY1.exec(this.lineFromCursor);if(!$){if(this.hasMoreData)return null;return this.cursor=this.lineLength,this}return this.cursor+=($.index||0)+$[0].length,this}advanceTo($){return this.cursor=$,this}advanceToToken($){return this.cursor=$.startCursor,this}advancePastToken($){return this.cursor=$.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}ZG0.Scanner=XG0});var WD=E((LG0)=>{Object.defineProperty(LG0,"__esModule",{value:!0});LG0.ColumnFormatter=void 0;class VG0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}LG0.ColumnFormatter=VG0});var pf=E((OG0)=>{Object.defineProperty(OG0,"__esModule",{value:!0});OG0.NonQuotedColumnParser=void 0;var xY1=WD(),wG0=G2();class MG0{constructor($){this.parserOptions=$,this.columnFormatter=new xY1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],z=$.nextCharacterToken;for(;z;z=$.nextCharacterToken){if(wG0.Token.isTokenDelimiter(z,Y)||wG0.Token.isTokenRowDelimiter(z))break;U.push(z.token),$.advancePastToken(z)}return this.columnFormatter.format(U.join(""))}}OG0.NonQuotedColumnParser=MG0});var df=E((AG0)=>{Object.defineProperty(AG0,"__esModule",{value:!0});AG0.QuotedColumnParser=void 0;var fY1=WD(),$I=G2();class DG0{constructor($){this.parserOptions=$,this.columnFormatter=new fY1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:z}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),z}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,z=!1,Q=[],J=$.nextCharacterToken;for(;!z&&J!==null;J=$.nextCharacterToken){let I=$I.Token.isTokenQuote(J,Y);if(!U&&I)U=!0;else if(U)if($I.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let K=$.nextCharacterToken;if(K!==null&&($I.Token.isTokenQuote(K,Y)||$I.Token.isTokenEscapeCharacter(K,Y)))Q.push(K.token),J=K;else if(I)z=!0;else Q.push(J.token)}else if(I)z=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:z}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let z=$I.Token.isTokenDelimiter(U,Y),Q=$I.Token.isTokenRowDelimiter(U);if(!(z||Q)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}AG0.QuotedColumnParser=DG0});var EG0=E((TG0)=>{Object.defineProperty(TG0,"__esModule",{value:!0});TG0.ColumnParser=void 0;var uY1=pf(),bY1=df(),iY1=G2();class PG0{constructor($){this.parserOptions=$,this.quotedColumnParser=new bY1.QuotedColumnParser($),this.nonQuotedColumnParser=new uY1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&iY1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}TG0.ColumnParser=PG0});var mf=E((YI)=>{Object.defineProperty(YI,"__esModule",{value:!0});YI.ColumnFormatter=YI.QuotedColumnParser=YI.NonQuotedColumnParser=YI.ColumnParser=void 0;var cY1=EG0();Object.defineProperty(YI,"ColumnParser",{enumerable:!0,get:function(){return cY1.ColumnParser}});var nY1=pf();Object.defineProperty(YI,"NonQuotedColumnParser",{enumerable:!0,get:function(){return nY1.NonQuotedColumnParser}});var pY1=df();Object.defineProperty(YI,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,z);let A=q.type==="*"?Ku:q.type==="?"?Wu:"\\"+q.type;Q=!0,z=z.slice(0,q.reStart)+A+"\\("+T}if(O(),J)z+="\\\\";let D=yU1[z.charAt(0)];for(let T=K.length-1;T>-1;T--){let A=K[T],j=z.slice(0,A.reStart),C=z.slice(A.reStart,A.reEnd-8),b=z.slice(A.reEnd),x=z.slice(A.reEnd-8,A.reEnd)+b,S=j.split(")").length,i=j.split("(").length-S,c=b;for(let k=0;k<i;k++)c=c.replace(/\)[+*?]?/,"");b=c;let z0=b===""&&Y!==Gu?"(?:$|\\/)":"";z=j+C+b+z0+x}if(z!==""&&Q)z="(?=.)"+z;if(D)z=w()+z;if(Y===Gu)return[z,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return xU1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+z+"$",P),{_glob:$,_src:z})}catch(T){return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let $=this.set;if(!$.length)return this.regexp=!1,this.regexp;let Y=this.options,U=Y.noglobstar?Ku:Y.dot?SU1:gU1,z=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((I)=>typeof I==="string"?uU1(I):I===R8?R8:I._src).reduce((I,K)=>{if(!(I[I.length-1]===R8&&K===R8))I.push(K);return I},[]),J.forEach((I,K)=>{if(I!==R8||J[K-1]===R8)return;if(K===0)if(J.length>1)J[K+1]="(?:\\/|"+U+"\\/)?"+J[K+1];else J[K]=U;else if(K===J.length-1)J[K-1]+="(?:\\/|"+U+")?";else J[K-1]+="(?:\\/|\\/"+U+"\\/)"+J[K+1],J[K+1]=R8}),J.filter((I)=>I!==R8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(Hu.sep!=="/")$=$.split(Hu.sep).join("/");$=$.split(NH0),this.debug(this.pattern,"split",$);let z=this.set;this.debug(this.pattern,"set",z);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<z.length;J++){let I=z[J],K=$;if(U.matchBase&&I.length===1)K=[Q];if(this.matchOne(K,I,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return H$.defaults($).Minimatch}}H$.Minimatch=sW});var CH0=E((Er1,EH0)=>{EH0.exports=jH0;var qu=I0("fs"),{EventEmitter:iU1}=I0("events"),{Minimatch:Zu}=BH0(),{resolve:cU1}=I0("path");function nU1($,Y){return new Promise((U,z)=>{qu.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)z(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:z(Q);break}else U(J)})})}function PH0($,Y){return new Promise((U,z)=>{(Y?qu.stat:qu.lstat)($,(J,I)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(PH0($,!1));else U(null);break;default:U(null);break}else U(I)})})}async function*TH0($,Y,U,z,Q,J){let I=await nU1(Y+$,J);for(let K of I){let G=K.name;if(G===void 0)G=K,z=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(z||U)Z=await PH0(X,U);if(!Z&&K.name!==void 0)Z=K;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*TH0(H,Y,U,z,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*pU1($,Y,U,z){yield*TH0("",$,Y,U,z,!0)}function dU1($){return{pattern:$.pattern,dot:!!$.dot,noglobstar:!!$.noglobstar,matchBase:!!$.matchBase,nocase:!!$.nocase,ignore:$.ignore,skip:$.skip,follow:!!$.follow,stat:!!$.stat,nodir:!!$.nodir,mark:!!$.mark,silent:!!$.silent,absolute:!!$.absolute}}class Vu extends iU1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=dU1(Y||{}),this.matchers=[],this.options.pattern){let z=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=z.map((Q)=>new Zu(Q,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let z=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=z.map((Q)=>new Zu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let z=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=z.map((Q)=>new Zu(Q,{dot:!0}))}if(this.iterator=pU1(cU1($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(z)=>this._matches.push(this.options.absolute?z.absolute:z.relative)),this.on("error",(z)=>U(z)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((z)=>z.match(U)))&&!this.ignoreMatchers.some((z)=>z.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,z=$.value.absolute;if(this.options.mark&&Y)U+="/",z+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:z,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,o);o=w0===-1?f.length:w0}else if(K0!==-1&&f[o]==="/"&&f[o+1]==="*"){let w0=f.indexOf("*/",o);if(w0!==-1)o=w0+2,K0=f.indexOf("*/",o);else n+=f[o],o++}else n+=f[o],o++;return n}function c0(f){let n=u0(f.toString()),o=n.match(a);if(!o)o=n.match(W0);if(!o)throw Error(`could not parse args in autoInject
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}GG0.Token=KG0});var nf=E((ZG0)=>{Object.defineProperty(ZG0,"__esModule",{value:!0});ZG0.Scanner=void 0;var WG0=G2(),kY1=/((?:\r\n)|\n|\r)/;class XG0{constructor($){this.cursor=0,this.line=$.line,this.lineLength=this.line.length,this.parserOptions=$.parserOptions,this.hasMoreData=$.hasMoreData,this.cursor=$.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:$}=this,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let z=U[1],Q=this.cursor+(U.index||0);return new WG0.Token({token:z,startCursor:Q,endCursor:Q+z.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new WG0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=kY1.exec(this.lineFromCursor);if(!$){if(this.hasMoreData)return null;return this.cursor=this.lineLength,this}return this.cursor+=($.index||0)+$[0].length,this}advanceTo($){return this.cursor=$,this}advanceToToken($){return this.cursor=$.startCursor,this}advancePastToken($){return this.cursor=$.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}ZG0.Scanner=XG0});var WD=E((LG0)=>{Object.defineProperty(LG0,"__esModule",{value:!0});LG0.ColumnFormatter=void 0;class VG0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}LG0.ColumnFormatter=VG0});var pf=E((OG0)=>{Object.defineProperty(OG0,"__esModule",{value:!0});OG0.NonQuotedColumnParser=void 0;var xY1=WD(),wG0=G2();class MG0{constructor($){this.parserOptions=$,this.columnFormatter=new xY1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],z=$.nextCharacterToken;for(;z;z=$.nextCharacterToken){if(wG0.Token.isTokenDelimiter(z,Y)||wG0.Token.isTokenRowDelimiter(z))break;U.push(z.token),$.advancePastToken(z)}return this.columnFormatter.format(U.join(""))}}OG0.NonQuotedColumnParser=MG0});var df=E((AG0)=>{Object.defineProperty(AG0,"__esModule",{value:!0});AG0.QuotedColumnParser=void 0;var fY1=WD(),$I=G2();class DG0{constructor($){this.parserOptions=$,this.columnFormatter=new fY1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:z}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),z}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,z=!1,Q=[],J=$.nextCharacterToken;for(;!z&&J!==null;J=$.nextCharacterToken){let I=$I.Token.isTokenQuote(J,Y);if(!U&&I)U=!0;else if(U)if($I.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let K=$.nextCharacterToken;if(K!==null&&($I.Token.isTokenQuote(K,Y)||$I.Token.isTokenEscapeCharacter(K,Y)))Q.push(K.token),J=K;else if(I)z=!0;else Q.push(J.token)}else if(I)z=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:z}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let z=$I.Token.isTokenDelimiter(U,Y),Q=$I.Token.isTokenRowDelimiter(U);if(!(z||Q)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}AG0.QuotedColumnParser=DG0});var EG0=E((TG0)=>{Object.defineProperty(TG0,"__esModule",{value:!0});TG0.ColumnParser=void 0;var uY1=pf(),bY1=df(),iY1=G2();class PG0{constructor($){this.parserOptions=$,this.quotedColumnParser=new bY1.QuotedColumnParser($),this.nonQuotedColumnParser=new uY1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&iY1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}TG0.ColumnParser=PG0});var mf=E((YI)=>{Object.defineProperty(YI,"__esModule",{value:!0});YI.ColumnFormatter=YI.QuotedColumnParser=YI.NonQuotedColumnParser=YI.ColumnParser=void 0;var cY1=EG0();Object.defineProperty(YI,"ColumnParser",{enumerable:!0,get:function(){return cY1.ColumnParser}});var nY1=pf();Object.defineProperty(YI,"NonQuotedColumnParser",{enumerable:!0,get:function(){return nY1.NonQuotedColumnParser}});var pY1=df();Object.defineProperty(YI,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,z);let A=q.type==="*"?Ku:q.type==="?"?Wu:"\\"+q.type;Q=!0,z=z.slice(0,q.reStart)+A+"\\("+T}if(O(),J)z+="\\\\";let D=yU1[z.charAt(0)];for(let T=K.length-1;T>-1;T--){let A=K[T],j=z.slice(0,A.reStart),C=z.slice(A.reStart,A.reEnd-8),b=z.slice(A.reEnd),x=z.slice(A.reEnd-8,A.reEnd)+b,S=j.split(")").length,i=j.split("(").length-S,c=b;for(let k=0;k<i;k++)c=c.replace(/\)[+*?]?/,"");b=c;let z0=b===""&&Y!==Gu?"(?:$|\\/)":"";z=j+C+b+z0+x}if(z!==""&&Q)z="(?=.)"+z;if(D)z=w()+z;if(Y===Gu)return[z,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return xU1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+z+"$",P),{_glob:$,_src:z})}catch(T){return new RegExp("$.")}}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let $=this.set;if(!$.length)return this.regexp=!1,this.regexp;let Y=this.options,U=Y.noglobstar?Ku:Y.dot?SU1:gU1,z=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((I)=>typeof I==="string"?uU1(I):I===R8?R8:I._src).reduce((I,K)=>{if(!(I[I.length-1]===R8&&K===R8))I.push(K);return I},[]),J.forEach((I,K)=>{if(I!==R8||J[K-1]===R8)return;if(K===0)if(J.length>1)J[K+1]="(?:\\/|"+U+"\\/)?"+J[K+1];else J[K]=U;else if(K===J.length-1)J[K-1]+="(?:\\/|"+U+")?";else J[K-1]+="(?:\\/|\\/"+U+"\\/)"+J[K+1],J[K+1]=R8}),J.filter((I)=>I!==R8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(Hu.sep!=="/")$=$.split(Hu.sep).join("/");$=$.split(NH0),this.debug(this.pattern,"split",$);let z=this.set;this.debug(this.pattern,"set",z);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<z.length;J++){let I=z[J],K=$;if(U.matchBase&&I.length===1)K=[Q];if(this.matchOne(K,I,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return H$.defaults($).Minimatch}}H$.Minimatch=sW});var CH0=E((Er1,EH0)=>{EH0.exports=jH0;var qu=I0("fs"),{EventEmitter:iU1}=I0("events"),{Minimatch:Zu}=BH0(),{resolve:cU1}=I0("path");function nU1($,Y){return new Promise((U,z)=>{qu.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)z(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:z(Q);break}else U(J)})})}function PH0($,Y){return new Promise((U,z)=>{(Y?qu.stat:qu.lstat)($,(J,I)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(PH0($,!1));else U(null);break;default:U(null);break}else U(I)})})}async function*TH0($,Y,U,z,Q,J){let I=await nU1(Y+$,J);for(let K of I){let G=K.name;if(G===void 0)G=K,z=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(z||U)Z=await PH0(X,U);if(!Z&&K.name!==void 0)Z=K;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*TH0(H,Y,U,z,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*pU1($,Y,U,z){yield*TH0("",$,Y,U,z,!0)}function dU1($){return{pattern:$.pattern,dot:!!$.dot,noglobstar:!!$.noglobstar,matchBase:!!$.matchBase,nocase:!!$.nocase,ignore:$.ignore,skip:$.skip,follow:!!$.follow,stat:!!$.stat,nodir:!!$.nodir,mark:!!$.mark,silent:!!$.silent,absolute:!!$.absolute}}class Vu extends iU1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=dU1(Y||{}),this.matchers=[],this.options.pattern){let z=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=z.map((Q)=>new Zu(Q,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let z=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=z.map((Q)=>new Zu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let z=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=z.map((Q)=>new Zu(Q,{dot:!0}))}if(this.iterator=pU1(cU1($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(z)=>this._matches.push(this.options.absolute?z.absolute:z.relative)),this.on("error",(z)=>U(z)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((z)=>z.match(U)))&&!this.ignoreMatchers.some((z)=>z.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,z=$.value.absolute;if(this.options.mark&&Y)U+="/",z+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:z,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,o);o=w0===-1?f.length:w0}else if(K0!==-1&&f[o]==="/"&&f[o+1]==="*"){let w0=f.indexOf("*/",o);if(w0!==-1)o=w0+2,K0=f.indexOf("*/",o);else n+=f[o],o++}else n+=f[o],o++;return n}function c0(f){let n=b0(f.toString()),o=n.match(a);if(!o)o=n.match(W0);if(!o)throw Error(`could not parse args in autoInject
Source:
`+n);let[,K0]=o;return K0.replace(/\s/g,"").split(F0).map((w0)=>w0.replace(f0,"").trim())}function D1(f,n){var o={};return Object.keys(f).forEach((K0)=>{var w0=f[K0],D0,P0=q(w0),j0=!P0&&w0.length===1||P0&&w0.length===0;if(Array.isArray(w0))D0=[...w0],w0=D0.pop(),o[K0]=D0.concat(D0.length>0?h0:w0);else if(j0)o[K0]=w0;else{if(D0=c0(w0),w0.length===0&&!P0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)D0.pop();o[K0]=D0.concat(h0)}function h0(U1,x1){var m1=D0.map((i1)=>U1[i1]);m1.push(x1),M(w0)(...m1)}}),Y1(o,n)}class k1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,n){if(n.prev=f,n.next=f.next,f.next)f.next.prev=n;else this.tail=n;f.next=n,this.length+=1}insertBefore(f,n){if(n.prev=f.prev,n.next=f,f.prev)f.prev.next=n;else this.head=n;f.prev=n,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else u1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else u1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var n=this.head;while(n){var{next:o}=n;if(f(n))this.removeLink(n);n=o}return this}}function u1(f,n){f.length=1,f.head=f.tail=n}function b1(f,n,o){if(n==null)n=1;else if(n===0)throw RangeError("Concurrency must not be zero");var K0=M(f),w0=0,D0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function j0(G1,e0){P0[G1].push(e0)}function h0(G1,e0){let H1=(...c1)=>{U1(G1,H1),e0(...c1)};P0[G1].push(H1)}function U1(G1,e0){if(!G1)return Object.keys(P0).forEach((H1)=>P0[H1]=[]);if(!e0)return P0[G1]=[];P0[G1]=P0[G1].filter((H1)=>H1!==e0)}function x1(G1,...e0){P0[G1].forEach((H1)=>H1(...e0))}var m1=!1;function i1(G1,e0,H1,c1){if(c1!=null&&typeof c1!=="function")throw Error("task callback must be a function");l1.started=!0;var g4,v6;function O$(DY,...lK){if(DY)return H1?v6(DY):g4();if(lK.length<=1)return g4(lK[0]);g4(lK)}var bz=l1._createTaskItem(G1,H1?O$:c1||O$);if(e0)l1._tasks.unshift(bz);else l1._tasks.push(bz);if(!m1)m1=!0,H(()=>{m1=!1,l1.process()});if(H1||!c1)return new Promise((DY,lK)=>{g4=DY,v6=lK})}function M$(G1){return function(e0,...H1){w0-=1;for(var c1=0,g4=G1.length;c1<g4;c1++){var v6=G1[c1],O$=D0.indexOf(v6);if(O$===0)D0.shift();else if(O$>0)D0.splice(O$,1);if(v6.callback(e0,...H1),e0!=null)x1("error",e0,v6.data)}if(w0<=l1.concurrency-l1.buffer)x1("unsaturated");if(l1.idle())x1("drain");l1.process()}}function uz(G1){if(G1.length===0&&l1.idle())return H(()=>x1("drain")),!0;return!1}let NY=(G1)=>(e0)=>{if(!e0)return new Promise((H1,c1)=>{h0(G1,(g4,v6)=>{if(g4)return c1(g4);H1(v6)})});U1(G1),j0(G1,e0)};var mK=!1,l1={_tasks:new k1,_createTaskItem(G1,e0){return{data:G1,callback:e0}},*[Symbol.iterator](){yield*l1._tasks[Symbol.iterator]()},concurrency:n,payload:o,buffer:n/4,started:!1,paused:!1,push(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!1,!1,e0))}return i1(G1,!1,!1,e0)},pushAsync(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!1,!0,e0))}return i1(G1,!1,!0,e0)},kill(){U1(),l1._tasks.empty()},unshift(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!0,!1,e0))}return i1(G1,!0,!1,e0)},unshiftAsync(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!0,!0,e0))}return i1(G1,!0,!0,e0)},remove(G1){l1._tasks.remove(G1)},process(){if(mK)return;mK=!0;while(!l1.paused&&w0<l1.concurrency&&l1._tasks.length){var G1=[],e0=[],H1=l1._tasks.length;if(l1.payload)H1=Math.min(H1,l1.payload);for(var c1=0;c1<H1;c1++){var g4=l1._tasks.shift();G1.push(g4),D0.push(g4),e0.push(g4.data)}if(w0+=1,l1._tasks.length===0)x1("empty");if(w0===l1.concurrency)x1("saturated");var v6=S(M$(G1));K0(e0,v6)}mK=!1},length(){return l1._tasks.length},running(){return w0},workersList(){return D0},idle(){return l1._tasks.length+w0===0},pause(){l1.paused=!0},resume(){if(l1.paused===!1)return;l1.paused=!1,H(l1.process)}};return Object.defineProperties(l1,{saturated:{writable:!1,value:NY("saturated")},unsaturated:{writable:!1,value:NY("unsaturated")},empty:{writable:!1,value:NY("empty")},drain:{writable:!1,value:NY("drain")},error:{writable:!1,value:NY("error")}}),l1}function A0(f,n){return b1(f,1,n)}function Q0(f,n,o){return b1(f,n,o)}function B(f,n,o,K0){K0=T(K0);var w0=M(o);return Y0(f,(D0,P0,j0)=>{w0(n,D0,(h0,U1)=>{n=U1,j0(h0)})},(D0)=>K0(D0,n))}var v=w(B,4);function u(...f){var n=f.map(M);return function(...o){var K0=this,w0=o[o.length-1];if(typeof w0=="function")o.pop();else w0=i0();return v(n,o,(D0,P0,j0)=>{P0.apply(K0,D0.concat((h0,...U1)=>{j0(h0,U1)}))},(D0,P0)=>w0(D0,...P0)),w0[T0]}}function r(...f){return u(...f.reverse())}function X0(f,n,o,K0){return O(c(n),f,o,K0)}var J Line truncated
GFS4: `),console.error($)};if(!d4[s6]){if(Fu=global[s6]||[],fH0(d4,Fu),d4.close=function($){function Y(U,z){return $.call(d4,U,function(Q){if(!Q)xH0();if(typeof z==="function")z.apply(this,arguments)})}return Object.defineProperty(Y,ND,{value:$}),Y}(d4.close),d4.closeSync=function($){function Y(U){$.apply(d4,arguments),xH0()}return Object.defineProperty(Y,ND,{value:$}),Y}(d4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){jU(d4[s6]),I0("assert").equal(d4[s6].length,0)})}var Fu;if(!global[s6])fH0(global,d4[s6]);Ou.exports=wu($z1(d4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!d4.__patched)Ou.exports=wu(d4),d4.__patched=!0;function wu($){tU1($),$.gracefulify=wu,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,b,x){if(typeof b==="function")x=b,b=null;return S(C,b,x);function S(i,c,z0,k){return Y(i,c,function(d){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))QI([S,[i,c,z0],d,k||Date.now(),Date.now()]);else if(typeof z0==="function")z0.apply(this,arguments)})}}var z=$.writeFile;$.writeFile=Q;function Q(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return z(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=I;function I(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return J(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var K=$.copyFile;if(K)$.copyFile=G;function G(C,b,x,S){if(typeof x==="function")S=x,x=0;return i(C,b,x,S);function i(c,z0,k,d,t){return K(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,b,x){if(typeof b==="function")x=b,b=null;var S=W.test(process.version)?function(z0,k,d,t){return H(z0,i(z0,k,d,t))}:function(z0,k,d,t){return H(z0,k,i(z0,k,d,t))};return S(C,b,x);function i(c,z0,k,d){return function(t,$0){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))QI([S,[c,z0,k],t,d||Date.now(),Date.now()]);else{if($0&&$0.sort)$0.sort();if(typeof k==="function")k.call(this,t,$0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=eU1($);w=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)w.prototype=Object.create(q.prototype),w.prototype.open=N;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var F=w;Object.defineProperty($,"FileReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function w(C,b){if(this instanceof w)return q.apply(this,arguments),this;else return w.apply(Object.create(w.prototype),arguments)}function N(){var C=this;j(C.path,C.flags,C.mode,function(b,x){if(b){if(C.autoClose)C.destroy();C.emit("error",b)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,b){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function D(){var C=this;j(C.path,C.flags,C.mode,function(b,x){if(b)C.destroy(),C.emit("error",b);else C.fd=x,C.emit("open",x)})}function P(C,b){return new $.ReadStream(C,b)}function T(C,b){return new $.WriteStream(C,b)}var A=$.open;$.open=j;function j(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return A(c,z0,k,function($0,g){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}return $}function QI($){jU("ENQUEUE",$[0].name,$[1]),d4[s6].push($),Mu()}var OD;function xH0(){var $=Date.now();for(var Y=0;Y<d4[s6].length;++Y)if(d4[s6][Y].length>2)d4[s6][Y][3]=$,d4[s6][Y][4]=$;Mu()}function Mu(){if(clearTimeout(OD),OD=void 0,d4[s6].length===0)return;var $=d4[s6].shift(),Y=$[0],U=$[1],z=$[2],Q=$[3],J=$[4];if(Q===void 0)jU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){jU("TIMEOUT",Y.name,U);var I=U.pop();if(typeof I==="function")I.call(null,z)}else{var K=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(K>=H)jU("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else d4[s6].push($)}if(OD===void 0)OD=setTimeout(Mu,0)}});var bH0=E((hr1,Nu)=>{function Uz1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var uH0=K6().Buffer,aW=I0("util");function zz1($,Y,U){$.copy(Y,U)}Nu.exports=function(){function $(){Uz1(this,$),this.h Line truncated
`+n);let[,K0]=o;return K0.replace(/\s/g,"").split(F0).map((w0)=>w0.replace(u0,"").trim())}function D1(f,n){var o={};return Object.keys(f).forEach((K0)=>{var w0=f[K0],D0,P0=q(w0),j0=!P0&&w0.length===1||P0&&w0.length===0;if(Array.isArray(w0))D0=[...w0],w0=D0.pop(),o[K0]=D0.concat(D0.length>0?h0:w0);else if(j0)o[K0]=w0;else{if(D0=c0(w0),w0.length===0&&!P0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)D0.pop();o[K0]=D0.concat(h0)}function h0(U1,x1){var m1=D0.map((i1)=>U1[i1]);m1.push(x1),M(w0)(...m1)}}),Y1(o,n)}class k1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,n){if(n.prev=f,n.next=f.next,f.next)f.next.prev=n;else this.tail=n;f.next=n,this.length+=1}insertBefore(f,n){if(n.prev=f.prev,n.next=f,f.prev)f.prev.next=n;else this.head=n;f.prev=n,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else u1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else u1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var n=this.head;while(n){var{next:o}=n;if(f(n))this.removeLink(n);n=o}return this}}function u1(f,n){f.length=1,f.head=f.tail=n}function b1(f,n,o){if(n==null)n=1;else if(n===0)throw RangeError("Concurrency must not be zero");var K0=M(f),w0=0,D0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function j0(G1,e0){P0[G1].push(e0)}function h0(G1,e0){let H1=(...c1)=>{U1(G1,H1),e0(...c1)};P0[G1].push(H1)}function U1(G1,e0){if(!G1)return Object.keys(P0).forEach((H1)=>P0[H1]=[]);if(!e0)return P0[G1]=[];P0[G1]=P0[G1].filter((H1)=>H1!==e0)}function x1(G1,...e0){P0[G1].forEach((H1)=>H1(...e0))}var m1=!1;function i1(G1,e0,H1,c1){if(c1!=null&&typeof c1!=="function")throw Error("task callback must be a function");l1.started=!0;var g4,v6;function O$(DY,...lK){if(DY)return H1?v6(DY):g4();if(lK.length<=1)return g4(lK[0]);g4(lK)}var bz=l1._createTaskItem(G1,H1?O$:c1||O$);if(e0)l1._tasks.unshift(bz);else l1._tasks.push(bz);if(!m1)m1=!0,H(()=>{m1=!1,l1.process()});if(H1||!c1)return new Promise((DY,lK)=>{g4=DY,v6=lK})}function M$(G1){return function(e0,...H1){w0-=1;for(var c1=0,g4=G1.length;c1<g4;c1++){var v6=G1[c1],O$=D0.indexOf(v6);if(O$===0)D0.shift();else if(O$>0)D0.splice(O$,1);if(v6.callback(e0,...H1),e0!=null)x1("error",e0,v6.data)}if(w0<=l1.concurrency-l1.buffer)x1("unsaturated");if(l1.idle())x1("drain");l1.process()}}function uz(G1){if(G1.length===0&&l1.idle())return H(()=>x1("drain")),!0;return!1}let NY=(G1)=>(e0)=>{if(!e0)return new Promise((H1,c1)=>{h0(G1,(g4,v6)=>{if(g4)return c1(g4);H1(v6)})});U1(G1),j0(G1,e0)};var mK=!1,l1={_tasks:new k1,_createTaskItem(G1,e0){return{data:G1,callback:e0}},*[Symbol.iterator](){yield*l1._tasks[Symbol.iterator]()},concurrency:n,payload:o,buffer:n/4,started:!1,paused:!1,push(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!1,!1,e0))}return i1(G1,!1,!1,e0)},pushAsync(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!1,!0,e0))}return i1(G1,!1,!0,e0)},kill(){U1(),l1._tasks.empty()},unshift(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!0,!1,e0))}return i1(G1,!0,!1,e0)},unshiftAsync(G1,e0){if(Array.isArray(G1)){if(uz(G1))return;return G1.map((H1)=>i1(H1,!0,!0,e0))}return i1(G1,!0,!0,e0)},remove(G1){l1._tasks.remove(G1)},process(){if(mK)return;mK=!0;while(!l1.paused&&w0<l1.concurrency&&l1._tasks.length){var G1=[],e0=[],H1=l1._tasks.length;if(l1.payload)H1=Math.min(H1,l1.payload);for(var c1=0;c1<H1;c1++){var g4=l1._tasks.shift();G1.push(g4),D0.push(g4),e0.push(g4.data)}if(w0+=1,l1._tasks.length===0)x1("empty");if(w0===l1.concurrency)x1("saturated");var v6=S(M$(G1));K0(e0,v6)}mK=!1},length(){return l1._tasks.length},running(){return w0},workersList(){return D0},idle(){return l1._tasks.length+w0===0},pause(){l1.paused=!0},resume(){if(l1.paused===!1)return;l1.paused=!1,H(l1.process)}};return Object.defineProperties(l1,{saturated:{writable:!1,value:NY("saturated")},unsaturated:{writable:!1,value:NY("unsaturated")},empty:{writable:!1,value:NY("empty")},drain:{writable:!1,value:NY("drain")},error:{writable:!1,value:NY("error")}}),l1}function A0(f,n){return b1(f,1,n)}function Q0(f,n,o){return b1(f,n,o)}function B(f,n,o,K0){K0=T(K0);var w0=M(o);return Y0(f,(D0,P0,j0)=>{w0(n,D0,(h0,U1)=>{n=U1,j0(h0)})},(D0)=>K0(D0,n))}var v=w(B,4);function u(...f){var n=f.map(M);return function(...o){var K0=this,w0=o[o.length-1];if(typeof w0=="function")o.pop();else w0=i0();return v(n,o,(D0,P0,j0)=>{P0.apply(K0,D0.concat((h0,...U1)=>{j0(h0,U1)}))},(D0,P0)=>w0(D0,...P0)),w0[T0]}}function r(...f){return u(...f.reverse())}function X0(f,n,o,K0){return O(c(n),f,o,K0)}var J Line truncated
GFS4: `),console.error($)};if(!d4[s6]){if(Fu=global[s6]||[],fH0(d4,Fu),d4.close=function($){function Y(U,z){return $.call(d4,U,function(Q){if(!Q)xH0();if(typeof z==="function")z.apply(this,arguments)})}return Object.defineProperty(Y,ND,{value:$}),Y}(d4.close),d4.closeSync=function($){function Y(U){$.apply(d4,arguments),xH0()}return Object.defineProperty(Y,ND,{value:$}),Y}(d4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){jU(d4[s6]),I0("assert").equal(d4[s6].length,0)})}var Fu;if(!global[s6])fH0(global,d4[s6]);Ou.exports=wu($z1(d4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!d4.__patched)Ou.exports=wu(d4),d4.__patched=!0;function wu($){tU1($),$.gracefulify=wu,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,b,x){if(typeof b==="function")x=b,b=null;return S(C,b,x);function S(i,c,z0,k){return Y(i,c,function(d){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))QI([S,[i,c,z0],d,k||Date.now(),Date.now()]);else if(typeof z0==="function")z0.apply(this,arguments)})}}var z=$.writeFile;$.writeFile=Q;function Q(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return z(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=I;function I(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return J(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var K=$.copyFile;if(K)$.copyFile=G;function G(C,b,x,S){if(typeof x==="function")S=x,x=0;return i(C,b,x,S);function i(c,z0,k,d,t){return K(c,z0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,b,x){if(typeof b==="function")x=b,b=null;var S=W.test(process.version)?function(z0,k,d,t){return H(z0,i(z0,k,d,t))}:function(z0,k,d,t){return H(z0,k,i(z0,k,d,t))};return S(C,b,x);function i(c,z0,k,d){return function(t,$0){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))QI([S,[c,z0,k],t,d||Date.now(),Date.now()]);else{if($0&&$0.sort)$0.sort();if(typeof k==="function")k.call(this,t,$0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=eU1($);w=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)w.prototype=Object.create(q.prototype),w.prototype.open=N;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var F=w;Object.defineProperty($,"FileReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function w(C,b){if(this instanceof w)return q.apply(this,arguments),this;else return w.apply(Object.create(w.prototype),arguments)}function N(){var C=this;j(C.path,C.flags,C.mode,function(b,x){if(b){if(C.autoClose)C.destroy();C.emit("error",b)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,b){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function D(){var C=this;j(C.path,C.flags,C.mode,function(b,x){if(b)C.destroy(),C.emit("error",b);else C.fd=x,C.emit("open",x)})}function P(C,b){return new $.ReadStream(C,b)}function T(C,b){return new $.WriteStream(C,b)}var A=$.open;$.open=j;function j(C,b,x,S){if(typeof x==="function")S=x,x=null;return i(C,b,x,S);function i(c,z0,k,d,t){return A(c,z0,k,function($0,g){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))QI([i,[c,z0,k,d],$0,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}return $}function QI($){jU("ENQUEUE",$[0].name,$[1]),d4[s6].push($),Mu()}var OD;function xH0(){var $=Date.now();for(var Y=0;Y<d4[s6].length;++Y)if(d4[s6][Y].length>2)d4[s6][Y][3]=$,d4[s6][Y][4]=$;Mu()}function Mu(){if(clearTimeout(OD),OD=void 0,d4[s6].length===0)return;var $=d4[s6].shift(),Y=$[0],U=$[1],z=$[2],Q=$[3],J=$[4];if(Q===void 0)jU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){jU("TIMEOUT",Y.name,U);var I=U.pop();if(typeof I==="function")I.call(null,z)}else{var K=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(K>=H)jU("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else d4[s6].push($)}if(OD===void 0)OD=setTimeout(Mu,0)}});var bH0=E((hr1,Nu)=>{function Uz1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var uH0=K6().Buffer,aW=I0("util");function zz1($,Y,U){$.copy(Y,U)}Nu.exports=function(){function $(){Uz1(this,$),this.h Line truncated
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/jW0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var z="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),z="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return z+J.join("/")}});var uu=E((pr1,SW0)=>{var CW0=9007199254740991,HQ1="[object Arguments]",WQ1="[object Function]",XQ1="[object GeneratorFunction]",ZQ1=/^(?:0|[1-9]\d*)$/;function RW0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function qQ1($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}var IX=Object.prototype,KX=IX.hasOwnProperty,_W0=IX.toString,VQ1=IX.propertyIsEnumerable,EW0=Math.max;function LQ1($,Y){var U=TQ1($)||PQ1($)?qQ1($.length,String):[],z=U.length,Q=!!z;for(var J in $)if((Y||KX.call($,J))&&!(Q&&(J=="length"||hW0(J,z))))U.push(J);return U}function FQ1($,Y,U,z){if($===void 0||ku($,IX[U])&&!KX.call(z,U))return Y;return $}function wQ1($,Y,U){var z=$[Y];if(!(KX.call($,Y)&&ku(z,U))||U===void 0&&!(Y in $))$[Y]=U}function MQ1($){if(!fu($))return BQ1($);var Y=AQ1($),U=[];for(var z in $)if(!(z=="constructor"&&(Y||!KX.call($,z))))U.push(z);return U}function vW0($,Y){return Y=EW0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,z=-1,Q=EW0(U.length-Y,0),J=Array(Q);while(++z<Q)J[z]=U[Y+z];z=-1;var I=Array(Y+1);while(++z<Y)I[z]=U[z];return I[Y]=J,RW0($,this,I)}}function OQ1($,Y,U,z){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var I=Y[Q],K=z?z(U[I],$[I],I,U,$):void 0;wQ1(U,I,K===void 0?$[I]:K)}return U}function NQ1($){return vW0(function(Y,U){var z=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,I=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,I&&DQ1(U[0],U[1],I))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++z<Q){var K=U[z];if(K)$(Y,K,z,J)}return Y})}function hW0($,Y){return Y=Y==null?CW0:Y,!!Y&&(typeof $=="number"||ZQ1.test($))&&($>-1&&$%1==0&&$<Y)}function DQ1($,Y,U){if(!fu(U))return!1;var z=typeof Y;if(z=="number"?xu(U)&&hW0(Y,U.length):z=="string"&&(Y in U))return ku(U[Y],$);return!1}function AQ1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||IX;return $===U}function BQ1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function ku($,Y){return $===Y||$!==$&&Y!==Y}function PQ1($){return jQ1($)&&KX.call($,"callee")&&(!VQ1.call($,"callee")||_W0.call($)==HQ1)}var TQ1=Array.isArray;function xu($){return $!=null&&CQ1($.length)&&!EQ1($)}function jQ1($){return RQ1($)&&xu($)}function EQ1($){var Y=fu($)?_W0.call($):"";return Y==WQ1||Y==XQ1}function CQ1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=CW0}function fu($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function RQ1($){return!!$&&typeof $=="object"}var _Q1=NQ1(function($,Y,U,z){OQ1(Y,hQ1(Y),$,z)}),vQ1=vW0(function($){return $.push(void 0,FQ1),RW0(_Q1,void 0,$)});function hQ1($){return xu($)?LQ1($,!0):MQ1($)}SW0.exports=vQ1});var yW0=E((dr1,bu)=>{function SQ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var gW0=K6().Buffer,GX=I0("util");function gQ1($,Y,U){$.copy(Y,U)}bu.exports=function(){function $(){SQ1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var z={data:U,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length},$.prototype.unshift=function(U){var z={data:U,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var z=this.head,Q=""+z.data;while(z=z.next)Q+=U+z.data;return Q},$.prototype.concat=function(U){if(this.length===0)return gW0.alloc(0);var z=gW0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)gQ1(Q.data,z,J),J+=Q.data.length,Q=Q.next;return z},$}();if(GX&&GX.inspect&&GX.inspect.custom)bu.exports.prototype[GX.inspect.custom]=function(){var $=GX.inspect({length:this.length});return this.constructor.name+" "+$}});var iu=E((mr1,kW0)=>{var SD=I6();function yQ1($,Y){var U=this,z=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(z||Q){if(Y)Y($);else if($){if(!this._writableState)SD.nextTick(gD,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,SD.nextTick(gD,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)SD.nextTick(gD,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,SD.nextTick(gD,U,J)}else if(Y)Y(J)}),this}function kQ1(){if(this._readableState)this._readabl Line truncated
*/jW0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var z="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),z="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return z+J.join("/")}});var uu=E((pr1,SW0)=>{var CW0=9007199254740991,HQ1="[object Arguments]",WQ1="[object Function]",XQ1="[object GeneratorFunction]",ZQ1=/^(?:0|[1-9]\d*)$/;function RW0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function qQ1($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}var IX=Object.prototype,KX=IX.hasOwnProperty,_W0=IX.toString,VQ1=IX.propertyIsEnumerable,EW0=Math.max;function LQ1($,Y){var U=TQ1($)||PQ1($)?qQ1($.length,String):[],z=U.length,Q=!!z;for(var J in $)if((Y||KX.call($,J))&&!(Q&&(J=="length"||hW0(J,z))))U.push(J);return U}function FQ1($,Y,U,z){if($===void 0||ku($,IX[U])&&!KX.call(z,U))return Y;return $}function wQ1($,Y,U){var z=$[Y];if(!(KX.call($,Y)&&ku(z,U))||U===void 0&&!(Y in $))$[Y]=U}function MQ1($){if(!fu($))return BQ1($);var Y=AQ1($),U=[];for(var z in $)if(!(z=="constructor"&&(Y||!KX.call($,z))))U.push(z);return U}function vW0($,Y){return Y=EW0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,z=-1,Q=EW0(U.length-Y,0),J=Array(Q);while(++z<Q)J[z]=U[Y+z];z=-1;var I=Array(Y+1);while(++z<Y)I[z]=U[z];return I[Y]=J,RW0($,this,I)}}function OQ1($,Y,U,z){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var I=Y[Q],K=z?z(U[I],$[I],I,U,$):void 0;wQ1(U,I,K===void 0?$[I]:K)}return U}function NQ1($){return vW0(function(Y,U){var z=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,I=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,I&&DQ1(U[0],U[1],I))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++z<Q){var K=U[z];if(K)$(Y,K,z,J)}return Y})}function hW0($,Y){return Y=Y==null?CW0:Y,!!Y&&(typeof $=="number"||ZQ1.test($))&&($>-1&&$%1==0&&$<Y)}function DQ1($,Y,U){if(!fu(U))return!1;var z=typeof Y;if(z=="number"?xu(U)&&hW0(Y,U.length):z=="string"&&(Y in U))return ku(U[Y],$);return!1}function AQ1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||IX;return $===U}function BQ1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function ku($,Y){return $===Y||$!==$&&Y!==Y}function PQ1($){return jQ1($)&&KX.call($,"callee")&&(!VQ1.call($,"callee")||_W0.call($)==HQ1)}var TQ1=Array.isArray;function xu($){return $!=null&&CQ1($.length)&&!EQ1($)}function jQ1($){return RQ1($)&&xu($)}function EQ1($){var Y=fu($)?_W0.call($):"";return Y==WQ1||Y==XQ1}function CQ1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=CW0}function fu($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function RQ1($){return!!$&&typeof $=="object"}var _Q1=NQ1(function($,Y,U,z){OQ1(Y,hQ1(Y),$,z)}),vQ1=vW0(function($){return $.push(void 0,FQ1),RW0(_Q1,void 0,$)});function hQ1($){return xu($)?LQ1($,!0):MQ1($)}SW0.exports=vQ1});var yW0=E((dr1,bu)=>{function SQ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var gW0=K6().Buffer,GX=I0("util");function gQ1($,Y,U){$.copy(Y,U)}bu.exports=function(){function $(){SQ1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var z={data:U,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length},$.prototype.unshift=function(U){var z={data:U,next:this.head};if(this.length===0)this.tail=z;this.head=z,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var z=this.head,Q=""+z.data;while(z=z.next)Q+=U+z.data;return Q},$.prototype.concat=function(U){if(this.length===0)return gW0.alloc(0);var z=gW0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)gQ1(Q.data,z,J),J+=Q.data.length,Q=Q.next;return z},$}();if(GX&&GX.inspect&&GX.inspect.custom)bu.exports.prototype[GX.inspect.custom]=function(){var $=GX.inspect({length:this.length});return this.constructor.name+" "+$}});var iu=E((mr1,kW0)=>{var SD=I6();function yQ1($,Y){var U=this,z=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(z||Q){if(Y)Y($);else if($){if(!this._writableState)SD.nextTick(gD,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,SD.nextTick(gD,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)SD.nextTick(gD,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,SD.nextTick(gD,U,J)}else if(Y)Y(J)}),this}function kQ1(){if(this._readableState)this._readabl Line truncated
%s`,P,P,N,z);var T=N.type==="*"?Tb:N.type==="?"?Pb:"\\"+N.type;Q=!0,z=z.slice(0,N.reStart)+T+"\\("+P}if(V(),J)z+="\\\\";var A=!1;switch(z.charAt(0)){case"[":case".":case"(":A=!0}for(var j=K.length-1;j>-1;j--){var C=K[j],b=z.slice(0,C.reStart),x=z.slice(C.reStart,C.reEnd-8),S=z.slice(C.reEnd-8,C.reEnd),i=z.slice(C.reEnd);S+=i;var c=b.split("(").length-1,z0=i;for(F=0;F<c;F++)z0=z0.replace(/\)[+*?]?/,"");i=z0;var k="";if(i===""&&Y!==sD)k="$";var d=b+x+i+k+S;z=d}if(z!==""&&Q)z="(?=.)"+z;if(A)z=Z+z;if(Y===sD)return[z,Q];if(!Q)return YH1($);var t=U.nocase?"i":"";try{var $0=new RegExp("^"+z+"$",t)}catch(g){return new RegExp("$.")}return $0._glob=$,$0._src=z,$0}W$.makeRe=function($,Y){return new L6($,Y||{}).makeRe()};L6.prototype.makeRe=$H1;function $H1(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var Y=this.options,U=Y.noglobstar?Tb:Y.dot?mG1:lG1,z=Y.nocase?"i":"",Q=$.map(function(J){return J.map(function(I){return I===yU?U:typeof I==="string"?UH1(I):I._src}).join("\\/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}catch(J){this.regexp=!1}return this.regexp}W$.match=function($,Y,U){U=U||{};var z=new L6(Y,U);if($=$.filter(function(Q){return z.match(Q)}),z.options.nonull&&!$.length)$.push(Y);return $};L6.prototype.match=function(Y,U){if(typeof U>"u")U=this.partial;if(this.debug("match",Y,this.pattern),this.comment)return!1;if(this.empty)return Y==="";if(Y==="/"&&U)return!0;var z=this.options;if(NX.sep!=="/")Y=Y.split(NX.sep).join("/");Y=Y.split(LZ0),this.debug(this.pattern,"split",Y);var Q=this.set;this.debug(this.pattern,"set",Q);var J,I;for(I=Y.length-1;I>=0;I--)if(J=Y[I],J)break;for(I=0;I<Q.length;I++){var K=Q[I],G=Y;if(z.matchBase&&K.length===1)G=[J];var H=this.matchOne(G,K,U);if(H){if(z.flipNegate)return!0;return!this.negate}}if(z.flipNegate)return!1;return this.negate};L6.prototype.matchOne=function($,Y,U){if(Y.indexOf(yU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};L6.prototype._matchGlobstar=function($,Y,U,z,Q){var J,I=-1;for(J=Q;J<Y.length;J++)if(Y[J]===yU){I=J;break}var K=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===yU){K=J;break}var G=Y.slice(Q,I),H=U?Y.slice(I+1):Y.slice(I+1,K),W=U?[]:Y.slice(K+1);if(G.length){var X=$.slice(z,z+G.length);if(!this._matchOne(X,G,U,0,0))return!1;z+=G.length}var Z=0;if(W.length){if(W.length+z>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||z+W.length===$.length)return!1;if(q--,!this._matchOne($,W,U,q,0))return!1;Z=W.length+1}}if(!H.length){var V=!!Z;for(J=z;J<$.length-Z;J++){var F=String($[J]);if(V=!0,F==="."||F===".."||!this.options.dot&&F.charAt(0)===".")return!1}return U||V}var M=[[[],0]],w=M[0],N=0,O=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===yU)O.push(N),w=[[],0],M.push(w);else w[0].push(P),N++}var T=M.length-1,A=$.length-Z;for(var j=0;j<M.length;j++)M[j][1]=A-(O[T--]+M[j][0].length);return!!this._matchGlobStarBodySections($,M,z,0,U,0,!!Z)};L6.prototype._matchGlobStarBodySections=function($,Y,U,z,Q,J,I){var K=Y[z];if(!K){for(var G=U;G<$.length;G++){I=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return I}var W=K[0],X=K[1];while(U<=X){var Z=this._matchOne($.slice(0,U+W.length),W,Q,U,0);if(Z&&J<this.maxGlobstarRecursion){var q=this._matchGlobStarBodySections($,Y,U+W.length,z+1,Q,J+1,I);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return Q||null};L6.prototype._matchOne=function($,Y,U,z,Q){var J,I,K,G;for(J=z,I=Q,K=$.length,G=Y.length;J<K&&I<G;J++,I++){this.debug("matchOne loop");var H=Y[I],W=$[J];if(this.debug(Y,H,W),H===!1||H===yU)return!1;var X;if(typeof H==="string")X=W===H,this.debug("string match",H,W,X);else X=W.match(H),this.debug("pattern match",H,W,X);if(!X)return!1}if(J===K&&I===G)return!0;else if(J===K)return U;else if(I===G)return J===K-1&&$[J]==="";throw Error("wtf?")};function YH1($){return $.replace(/\\(.)/g,"$1")}function UH1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var $A=E((Zs1,eD)=>{function MZ0($){return $.charAt(0)==="/"}function OZ0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),z=U[1]||"",Q=Boolean(z&&z.charAt(1)!==":");return Boolean(U[2]||Q)}eD.exports=process.platform==="win32"?OZ0:MZ0;eD.exports.posix=MZ0;eD.exports.win32=OZ0});var Eb=E((ZH1)=>{ZH1.setopts=GH1;ZH1.ownProp=NZ0;ZH1.makeAbs=DX;ZH1.finish=HH1;ZH1.mark=WH1;ZH1.isIgnored=AZ0;ZH1.childrenIgnored=XH1;function NZ0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var zH1=I0("fs"),wI=I0("path"),QH1=tD(),DZ0=$A(),jb=QH1.Minimatch;function JH1($,Y){return $.localeCompare(Y,"en")}function IH1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(KH1)}function KH1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new jb(U,{dot:!0})}return{ma Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new T6($,Y).found}function T6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof T6))return new T6($,Y);if(DH1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var z=0;z<U;z++)this._process(this.minimatch.set[z],z,!1);this._finish()}T6.prototype._finish=function(){if(PZ0.ok(this instanceof T6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var z=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=NH1.realpathSync(Q,$.realpathCache);z[J]=!0}catch(I){if(I.syscall==="stat")z[$._makeAbs(Q)]=!0;else throw I}})}kU.finish(this)};T6.prototype._process=function($,Y,U){PZ0.ok(this instanceof T6);var z=0;while(typeof $[z]==="string")z++;var Q;switch(z){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,z).join("/");break}var J=$.slice(z),I;if(Q===null)I=".";else if(YA(Q)||YA($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!YA(Q))Q="/"+Q;I=Q}else I=Q;var K=this._makeAbs(I);if(AH1(this,I))return;var G=J[0]===BZ0.GLOBSTAR;if(G)this._processGlobStar(Q,I,K,J,Y,U);else this._processReaddir(Q,I,K,J,Y,U)};T6.prototype._processReaddir=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z[0],G=!!this.minimatch.negate,H=K._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<I.length;Z++){var q=I[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(K);else V=q.match(K);if(V)X.push(q)}}var F=X.length;if(F===0)return;if(z.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<F;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=Cb.join(this.root,q);this._emitMatch(Q,q)}return}z.shift();for(var Z=0;Z<F;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(z),Q,J)}};T6.prototype._emitMatch=function($,Y){if(BH1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var z=this.cache[U];if(z==="DIR"||Array.isArray(z))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};T6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,z;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var Q=U&&U.isSymbolicLink();if(this.symlinks[$]=Q,!Q&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};T6.prototype._readdir=function($,Y){var U;if(Y&&!Rb(this.symlinks,$))return this._readdirInGlobStar($);if(Rb(this.cache,$)){var z=this.cache[$];if(!z||z==="FILE")return null;if(Array.isArray(z))return z}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};T6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var z=Y[U];if($==="/")z=$+z;else z=$+"/"+z;this.cache[z]=!0}return this.cache[$]=Y,Y};T6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var z=Error(Y.code+" invalid cwd "+this.cwd);throw z.path=this.cwd,z.code=Y.code,z}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs($)]=!1;break;default:if(this.cache[this._makeAbs($)]=!1,this.strict)throw Y;if(!this.silent)console.error("glob error",Y);break}};T6.prototype._processGlobStar=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z.slice(1),G=$?[$]:[],H=G.concat(K);this._process(H,Q,!1);var W=I.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=I[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(I[Z],K);this._process(V,Q,!0);var F=G.concat(I[Z],z);this._process(F,Q,!0)}};T6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&YA($)&&!this.nomount){var z=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Cb.join(this.root,$);else if($=Cb.resolve(this.root,$),z)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};T6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Rb(this.cache,Y)){var I=this.cache[Y];if(Array.isArray(I))I="DIR";if(!U||I==="DIR")return I;if(U&&I==="FILE")return!1}var z,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(K){if(K&&(K.code==="ENOENT"||K.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(K){Q=J}else Q=J}this.statCache[Y]=Q;var I=!0;if(Q)I=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||I,U&&I==="FILE")return!1;return I};T6.prototype._mark=function($){return kU.mark(this,$)};T6.prototype._makeAbs=function($){return kU.makeAbs(this,$)}});var _b=E((Ms1,RZ0)=>{RZ0.exports=CZ0;function CZ0($,Y){if($&&Y)return CZ0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(z){U[z]=$[z]}),U;f Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof T6))return new T6($,Y);if(DH1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var z=0;z<U;z++)this._process(this.minimatch.set[z],z,!1);this._finish()}T6.prototype._finish=function(){if(PZ0.ok(this instanceof T6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var z=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=NH1.realpathSync(Q,$.realpathCache);z[J]=!0}catch(I){if(I.syscall==="stat")z[$._makeAbs(Q)]=!0;else throw I}})}kU.finish(this)};T6.prototype._process=function($,Y,U){PZ0.ok(this instanceof T6);var z=0;while(typeof $[z]==="string")z++;var Q;switch(z){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,z).join("/");break}var J=$.slice(z),I;if(Q===null)I=".";else if(YA(Q)||YA($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!YA(Q))Q="/"+Q;I=Q}else I=Q;var K=this._makeAbs(I);if(AH1(this,I))return;var G=J[0]===BZ0.GLOBSTAR;if(G)this._processGlobStar(Q,I,K,J,Y,U);else this._processReaddir(Q,I,K,J,Y,U)};T6.prototype._processReaddir=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z[0],G=!!this.minimatch.negate,H=K._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<I.length;Z++){var q=I[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(K);else V=q.match(K);if(V)X.push(q)}}var F=X.length;if(F===0)return;if(z.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<F;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=Cb.join(this.root,q);this._emitMatch(Q,q)}return}z.shift();for(var Z=0;Z<F;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(z),Q,J)}};T6.prototype._emitMatch=function($,Y){if(BH1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var z=this.cache[U];if(z==="DIR"||Array.isArray(z))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};T6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,z;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var Q=U&&U.isSymbolicLink();if(this.symlinks[$]=Q,!Q&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};T6.prototype._readdir=function($,Y){var U;if(Y&&!Rb(this.symlinks,$))return this._readdirInGlobStar($);if(Rb(this.cache,$)){var z=this.cache[$];if(!z||z==="FILE")return null;if(Array.isArray(z))return z}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};T6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var z=Y[U];if($==="/")z=$+z;else z=$+"/"+z;this.cache[z]=!0}return this.cache[$]=Y,Y};T6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var z=Error(Y.code+" invalid cwd "+this.cwd);throw z.path=this.cwd,z.code=Y.code,z}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs($)]=!1;break;default:if(this.cache[this._makeAbs($)]=!1,this.strict)throw Y;if(!this.silent)console.error("glob error",Y);break}};T6.prototype._processGlobStar=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z.slice(1),G=$?[$]:[],H=G.concat(K);this._process(H,Q,!1);var W=I.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=I[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(I[Z],K);this._process(V,Q,!0);var F=G.concat(I[Z],z);this._process(F,Q,!0)}};T6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&YA($)&&!this.nomount){var z=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Cb.join(this.root,$);else if($=Cb.resolve(this.root,$),z)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};T6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Rb(this.cache,Y)){var I=this.cache[Y];if(Array.isArray(I))I="DIR";if(!U||I==="DIR")return I;if(U&&I==="FILE")return!1}var z,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(K){if(K&&(K.code==="ENOENT"||K.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(K){Q=J}else Q=J}this.statCache[Y]=Q;var I=!0;if(Q)I=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||I,U&&I==="FILE")return!1;return I};T6.prototype._mark=function($){return kU.mark(this,$)};T6.prototype._makeAbs=function($){return kU.makeAbs(this,$)}});var _b=E((Ms1,RZ0)=>{RZ0.exports=CZ0;function CZ0($,Y){if($&&Y)return CZ0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(z){U[z]=$[z]}),U;f Line truncated
`);if($.linkname)Y+=Ci(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var z in U)Y+=Ci(" "+z+"="+U[z]+`
`);return Buffer.from(Y)};SZ1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var z=parseInt($.slice(0,U).toString(),10);if(!z)return Y;var Q=$.slice(U+1,z-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(z)}return Y};SZ1.encode=function($){var Y=AZ1(512),U=$.name,z="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var Q=U.indexOf("/");if(Q===-1)return null;z+=z?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(z)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(B2($.mode&CZ1,6),100),Y.write(B2($.uid,6),108),Y.write(B2($.gid,6),116),Y.write(B2($.size,11),124),Y.write(B2($.mtime.getTime()/1000|0,11),136),Y[156]=nV0+vZ1($.type),$.linkname)Y.write($.linkname,157);if(pV0.copy(Y,xX),TZ1.copy(Y,Ri),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(B2($.devmajor||0,6),329),Y.write(B2($.devminor||0,6),337),z)Y.write(z,345);return Y.write(B2(mV0(Y),6),148),Y};SZ1.decode=function($,Y,U){var z=$[156]===0?0:$[156]-nV0,Q=jI($,0,100,Y),J=P2($,100,8),I=P2($,108,8),K=P2($,116,8),G=P2($,124,12),H=P2($,136,12),W=_Z1(z),X=$[157]===0?null:jI($,157,100,Y),Z=jI($,265,32),q=jI($,297,32),V=P2($,329,8),F=P2($,337,8),M=mV0($);if(M===256)return null;if(M!==P2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(pV0.compare($,xX,xX+6)===0){if($[345])Q=jI($,345,155,Y)+"/"+Q}else if(jZ1.compare($,xX,xX+6)===0&&EZ1.compare($,Ri,Ri+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(z===0&&Q&&Q[Q.length-1]==="/")z=5;return{name:Q,mode:J,uid:I,gid:K,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:F}}});var eV0=E((Za1,tV0)=>{var oV0=I0("util"),uZ1=cV0(),fX=_i(),rV0=E8().Writable,sV0=E8().PassThrough,aV0=function(){},lV0=function($){return $&=511,$&&512-$},bZ1=function($,Y){var U=new DA($,Y);return U.end(),U},iZ1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},DA=function($,Y){this._parent=$,this.offset=Y,sV0.call(this,{autoDestroy:!1})};oV0.inherits(DA,sV0);DA.prototype.destroy=function($){this._parent.destroy($)};var P3=function($){if(!(this instanceof P3))return new P3($);rV0.call(this,$),$=$||{},this._offset=0,this._buffer=uZ1(),this._missing=0,this._partial=!1,this._onparse=aV0,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var Y=this,U=Y._buffer,z=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)z()},J=function(){Y._stream=null;var Z=lV0(Y._header.size);if(Z)Y._parse(Z,I);else Y._parse(512,X);if(!Y._locked)z()},I=function(){Y._buffer.consume(lV0(Y._header.size)),Y._parse(512,X),z()},K=function(){var Z=Y._header.size;Y._paxGlobal=fX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=fX.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},H=function(){var Z=Y._header.size;this._gnuLongPath=fX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=fX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=fX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),z();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),z();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),z();return}if(q.type==="pax-global-header"){Y._parse(q.size,K),z();return}if(q.type==="pax-header"){Y._parse(q.size,G),z();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=iZ1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,bZ1(Y,Z),Q);return}Y._stream=new DA(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),z()};this._onheader=X,this._parse(512,X)};oV0.inherits(P3,rV0);P3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};P3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};P3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aV0,this._overflow)this._write(this._overflow,void 0,$);else $()};P3.prototype._write=function($,Y,U){if(this._destroyed)return;var z=this._stream,Q=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J) Line truncated
`);return Buffer.from(Y)};SZ1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var z=parseInt($.slice(0,U).toString(),10);if(!z)return Y;var Q=$.slice(U+1,z-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(z)}return Y};SZ1.encode=function($){var Y=AZ1(512),U=$.name,z="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var Q=U.indexOf("/");if(Q===-1)return null;z+=z?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(z)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(B2($.mode&CZ1,6),100),Y.write(B2($.uid,6),108),Y.write(B2($.gid,6),116),Y.write(B2($.size,11),124),Y.write(B2($.mtime.getTime()/1000|0,11),136),Y[156]=nV0+vZ1($.type),$.linkname)Y.write($.linkname,157);if(pV0.copy(Y,xX),TZ1.copy(Y,Ri),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(B2($.devmajor||0,6),329),Y.write(B2($.devminor||0,6),337),z)Y.write(z,345);return Y.write(B2(mV0(Y),6),148),Y};SZ1.decode=function($,Y,U){var z=$[156]===0?0:$[156]-nV0,Q=jI($,0,100,Y),J=P2($,100,8),I=P2($,108,8),K=P2($,116,8),G=P2($,124,12),H=P2($,136,12),W=_Z1(z),X=$[157]===0?null:jI($,157,100,Y),Z=jI($,265,32),q=jI($,297,32),V=P2($,329,8),F=P2($,337,8),M=mV0($);if(M===256)return null;if(M!==P2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(pV0.compare($,xX,xX+6)===0){if($[345])Q=jI($,345,155,Y)+"/"+Q}else if(jZ1.compare($,xX,xX+6)===0&&EZ1.compare($,Ri,Ri+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(z===0&&Q&&Q[Q.length-1]==="/")z=5;return{name:Q,mode:J,uid:I,gid:K,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:F}}});var eV0=E((Za1,tV0)=>{var oV0=I0("util"),uZ1=cV0(),fX=_i(),rV0=E8().Writable,sV0=E8().PassThrough,aV0=function(){},lV0=function($){return $&=511,$&&512-$},bZ1=function($,Y){var U=new DA($,Y);return U.end(),U},iZ1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},DA=function($,Y){this._parent=$,this.offset=Y,sV0.call(this,{autoDestroy:!1})};oV0.inherits(DA,sV0);DA.prototype.destroy=function($){this._parent.destroy($)};var P3=function($){if(!(this instanceof P3))return new P3($);rV0.call(this,$),$=$||{},this._offset=0,this._buffer=uZ1(),this._missing=0,this._partial=!1,this._onparse=aV0,this._header=null,this._stream=null,this._overflow=null,this._cb=null,this._locked=!1,this._destroyed=!1,this._pax=null,this._paxGlobal=null,this._gnuLongPath=null,this._gnuLongLinkPath=null;var Y=this,U=Y._buffer,z=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)z()},J=function(){Y._stream=null;var Z=lV0(Y._header.size);if(Z)Y._parse(Z,I);else Y._parse(512,X);if(!Y._locked)z()},I=function(){Y._buffer.consume(lV0(Y._header.size)),Y._parse(512,X),z()},K=function(){var Z=Y._header.size;Y._paxGlobal=fX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=fX.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},H=function(){var Z=Y._header.size;this._gnuLongPath=fX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=fX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=fX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),z();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),z();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),z();return}if(q.type==="pax-global-header"){Y._parse(q.size,K),z();return}if(q.type==="pax-header"){Y._parse(q.size,G),z();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=iZ1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,bZ1(Y,Z),Q);return}Y._stream=new DA(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),z()};this._onheader=X,this._parse(512,X)};oV0.inherits(P3,rV0);P3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};P3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};P3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aV0,this._overflow)this._write(this._overflow,void 0,$);else $()};P3.prototype._write=function($,Y,U){if(this._destroyed)return;var z=this._stream,Q=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J) Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let Y=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${Iq1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}TL0.exports=PL0});var vL0=E((Aa1,_L0)=>{var EL0=l6(),CL0=Y2(),Gq1=c4(),Hq1=nx(),Wq1=dx();class RL0{constructor($,Y,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=Y}get commentsStream(){if(!this._commentsStream)this._commentsStream=this._workbook._openStream(`/xl/comments${this.id}.xml`);return this._commentsStream}get vmlStream(){if(!this._vmlStream)this._vmlStream=this._workbook._openStream(`xl/drawings/vmlDrawing${this.id}.vml`);return this._vmlStream}_addRelationships(){let $={Type:CL0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:CL0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(Y)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>'),this.vmlStream.write('<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter" /><v:path gradientshapeok="t" o:connecttype="rect" /></v:shapetype>')}_writeComment($,Y){let U=new Hq1,z=new EL0;U.render(z,$),this.commentsStream.write(z.xml);let Q=new Wq1,J=new EL0;Q.render(J,$,Y),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((Y)=>{Y.refAddress=Gq1.decodeAddress(Y.ref)}),$.forEach((Y)=>{this._writeComment(Y,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}_L0.exports=RL0});var xL0=E((Ba1,kL0)=>{var Xq1=Y6(),Zq1=Y2(),Si=c4(),hL0=Gg(),SL0=Y3(),qq1=Ak(),gL0=jM(),gi=CM(),Vq1=jL0(),Lq1=vL0(),Fq1=Ig(),y6=new qq1,yi=t7(),wq1=wx(),Mq1=Mx(),Oq1=Ox(),Nq1=qx(),Dq1=Xx(),Aq1=Vx(),Bq1=Nx(),Pq1=Dx(),Tq1=Ax(),jq1=Bx(),Eq1=Px(),Cq1=Tx(),Rq1=_x(),_q1=Ex(),vq1=jx(),k6={dataValidations:new wq1,sheetProperties:new Mq1,sheetFormatProperties:new Oq1,columns:new yi({tag:"cols",length:!1,childXform:new Nq1}),row:new Dq1,hyperlinks:new yi({tag:"hyperlinks",length:!1,childXform:new Aq1}),sheetViews:new yi({tag:"sheetViews",length:!1,childXform:new Bq1}),sheetProtection:new Pq1,pageMargins:new Tq1,pageSeteup:new jq1,autoFilter:new Eq1,picture:new Cq1,conditionalFormattings:new Rq1,headerFooter:new _q1,rowBreaks:new vq1};class yL0{constructor($){this.id=$.id,this.name=$.name||`Sheet${this.id}`,this.state=$.state||"visible",this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new Vq1($),this._sheetCommentsWriter=new Lq1(this,this._sheetRelsWriter,$),this._dimensions=new SL0,this._rowZero=1,this.committed=!1,this.dataValidations=new Fq1,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},$.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},$.headerFooter),this.pageSetup=Object.assign({},{margins:{left:0.7,right:0.7,top:0.75,bottom:0.75,header:0.3,footer:0.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!($.pageSetup&&($.pageSetup.fitToWidth||$.pageSetup.fitToHeight)&&!$.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},$.pageSetup),this.useSharedStrings=$.useSharedStrings||!1,this._workbook=$.workbook,this.hasComments=!1,this._views=$.views||[],this.autoFilter=$.autoFilter||null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get Line truncated
See http://goo.gl/MqrFmX
@@ -122,10 +122,10 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof T6))r
`}return vA--,Y};function nX($){if(!(this instanceof nX))return new nX($);if(vI(this,"name","OperationalError"),vI(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)vI(this,"message",$.message),vI(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}CF0(nX,Error);var sU=Error.__BluebirdErrorTypes__;if(!sU)sU=TV1({CancellationError:EV1,TimeoutError:CV1,OperationalError:nX,RejectionError:nX,AggregateError:pX}),Kc.defineProperty(Error,"__BluebirdErrorTypes__",{value:sU,writable:!1,enumerable:!1,configurable:!1});RF0.exports={Error,TypeError:Jc,RangeError:Ic,CancellationError:sU.CancellationError,OperationalError:sU.OperationalError,TimeoutError:sU.TimeoutError,AggregateError:sU.AggregateError,Warning:jV1}});var vF0=E((fa1,_F0)=>{_F0.exports=function($,Y){var U=F4(),z=U.errorObj,Q=U.isObject;function J(X,Z){if(Q(X)){if(X instanceof $)return X;var q=K(X);if(q===z){if(Z)Z._pushContext();var V=$.reject(q.e);if(Z)Z._popContext();return V}else if(typeof q==="function"){if(H(X)){var V=new $(Y);return X._then(V._fulfill,V._reject,void 0,V,null),V}return W(X,q,Z)}}return X}function I(X){return X.then}function K(X){try{return I(X)}catch(Z){return z.e=Z,z}}var G={}.hasOwnProperty;function H(X){try{return G.call(X,"_promise0")}catch(Z){return!1}}function W(X,Z,q){var V=new $(Y),F=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var M=!0,w=U.tryCatch(Z).call(X,N,O);if(M=!1,V&&w===z)V._rejectCallback(w.e,!0,!0),V=null;function N(D){if(!V)return;V._resolveCallback(D),V=null}function O(D){if(!V)return;V._rejectCallback(D,M,!0),V=null}return F}return J}});var SF0=E((ua1,hF0)=>{hF0.exports=function($,Y,U,z,Q){var J=F4(),I=J.isArray;function K(H){switch(H){case-2:return[];case-3:return{}}}function G(H){var W=this._promise=new $(Y);if(H instanceof $)W._propagateFrom(H,3);W._setOnCancel(this),this._values=H,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(G,Q),G.prototype.length=function(){return this._length},G.prototype.promise=function(){return this._promise},G.prototype._init=function H(W,X){var Z=U(this._values,this._promise);if(Z instanceof $){Z=Z._target();var q=Z._bitField;if(this._values=Z,(q&50397184)===0)return this._promise._setAsyncGuaranteed(),Z._then(H,this._reject,void 0,this,X);else if((q&33554432)!==0)Z=Z._value();else if((q&16777216)!==0)return this._reject(Z._reason());else return this._cancel()}if(Z=J.asArray(Z),Z===null){var V=z("expecting an array or an iterable object but got "+J.classString(Z)).reason();this._promise._rejectCallback(V,!1);return}if(Z.length===0){if(X===-5)this._resolveEmptyArray();else this._resolve(K(X));return}this._iterate(Z)},G.prototype._iterate=function(H){var W=this.getActualLength(H.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var X=this._promise,Z=!1,q=null;for(var V=0;V<W;++V){var F=U(H[V],X);if(F instanceof $)F=F._target(),q=F._bitField;else q=null;if(Z){if(q!==null)F.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)F._proxy(this,V),this._values[V]=F;else if((q&33554432)!==0)Z=this._promiseFulfilled(F._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(F._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(F,V)}if(!Z)X._setAsyncGuaranteed()},G.prototype._isResolved=function(){return this._values===null},G.prototype._resolve=function(H){this._values=null,this._promise._fulfill(H)},G.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},G.prototype._reject=function(H){this._values=null,this._promise._rejectCallback(H,!1)},G.prototype._promiseFulfilled=function(H,W){this._values[W]=H;var X=++this._totalResolved;if(X>=this._length)return this._resolve(this._values),!0;return!1},G.prototype._promiseCancelled=function(){return this._cancel(),!0},G.prototype._promiseRejected=function(H){return this._totalResolved++,this._reject(H),!0},G.prototype._resultCancelled=function(){if(this._isResolved())return;var H=this._values;if(this._cancel(),H instanceof $)H.cancel();else for(var W=0;W<H.length;++W)if(H[W]instanceof $)H[W].cancel()},G.prototype.shouldCopyValues=function(){return!0},G.prototype.getActualLength=function(H){return H},G}});var yF0=E((ba1,gF0)=>{gF0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function z(){this._trace=new z.CapturedTrace(J())}z.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},z.prototype._popContext=function(){if(this._trace!==void 0){var I=U.pop(),K=I._promiseCreated;return I._promiseCreated=null,K}return null};function Q(){if(Y)return new z}function J(){var I=U.length-1;if(I>=0)return U[I];return}return z.CapturedTrace=null,z.create=Q,z.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!A0.longStackTraces&&f0()){var Q0=$.prototype._captureStackTrace,B=$.prototype._attachExtraTrace;A0.longStackTraces=!0,D=function(){if(z.haveItemsQueued()&&!A0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
`);if(!A0.longStackTraces&&u0()){var Q0=$.prototype._captureStackTrace,B=$.prototype._attachExtraTrace;A0.longStackTraces=!0,D=function(){if(z.haveItemsQueued()&&!A0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
See http://goo.gl/MqrFmX
`);$.prototype._captureStackTrace=Q0,$.prototype._attachExtraTrace=B,Y.deactivateLongStackTraces(),z.enableTrampoline(),A0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=p,Y.activateLongStackTraces(),z.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return A0.longStackTraces&&f0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(B,v){var u=new CustomEvent(B.toLowerCase(),{detail:v,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(v,u){var r=new Event(v.toLowerCase(),{cancelable:!0});return r.detail=u,!J.global.dispatchEvent(r)}}else{var Q0=document.createEvent("CustomEvent");return Q0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(Q0),function(v,u){var r=document.createEvent("CustomEvent");return r.initCustomEvent(v.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(r)}}}catch(B){}return function(){return!1}}(),T=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(Q0){var B="on"+Q0.toLowerCase(),v=J.global[B];if(!v)return!1;return v.apply(J.global,[].slice.call(arguments,1)),!0}}}();function A(Q0,B){return{promise:B}}var j={promiseCreated:A,promiseFulfilled:A,promiseRejected:A,promiseResolved:A,promiseCancelled:A,promiseChained:function(Q0,B,v){return{promise:B,child:v}},warning:function(Q0,B){return{warning:B}},unhandledRejection:function(Q0,B,v){return{reason:B,promise:v}},rejectionHandled:A},C=function(Q0){var B=!1;try{B=T.apply(null,arguments)}catch(u){z.throwLater(u),B=!0}var v=!1;try{v=P(Q0,j[Q0].apply(null,arguments))}catch(u){z.throwLater(u),v=!0}return v||B};$.config=function(Q0){if(Q0=Object(Q0),"longStackTraces"in Q0){if(Q0.longStackTraces)$.longStackTraces();else if(!Q0.longStackTraces&&$.hasLongStackTraces())D()}if("warnings"in Q0){var B=Q0.warnings;if(A0.warnings=!!B,O=A0.warnings,J.isObject(B)){if("wForgottenReturn"in B)O=!!B.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!A0.cancellation){if(z.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=z0,$.prototype._propagateFrom=k,$.prototype._onCancel=i,$.prototype._setOnCancel=c,$.prototype._attachCancellationCallback=S,$.prototype._execute=x,t=k,A0.cancellation=!0}if("monitoring"in Q0){if(Q0.monitoring&&!A0.monitoring)A0.monitoring=!0,$.prototype._fireEvent=C;else if(!Q0.monitoring&&A0.monitoring)A0.monitoring=!1,$.prototype._fireEvent=b}return $};function b(){return!1}$.prototype._fireEvent=b,$.prototype._execute=function(Q0,B,v){try{Q0(B,v)}catch(u){return u}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(Q0){},$.prototype._attachCancellationCallback=function(Q0){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(Q0,B){};function x(Q0,B,v){var u=this;try{Q0(B,v,function(r){if(typeof r!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(r));u._attachCancellationCallback(r)})}catch(r){return r}}function S(Q0){if(!this._isCancellable())return this;var B=this._onCancel();if(B!==void 0)if(J.isArray(B))B.push(Q0);else this._setOnCancel([B,Q0]);else this._setOnCancel(Q0)}function i(){return this._onCancelField}function c(Q0){this._onCancelField=Q0}function z0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(Q0,B){if((B&1)!==0){this._cancellationParent=Q0;var v=Q0._branchesRemainingToCancel;if(v===void 0)v=0;Q0._branchesRemainingToCancel=v+1}if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}function d(Q0,B){if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}var t=d;function $0(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function g(){this._trace=new u1(this._peekContext())}function p(Q0,B){if(I(Q0)){var v=this._trace;if(v!==void 0){if(B)v=v._parent}if(v!==void 0)v.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=i0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`);$.prototype._captureStackTrace=Q0,$.prototype._attachExtraTrace=B,Y.deactivateLongStackTraces(),z.enableTrampoline(),A0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=p,Y.activateLongStackTraces(),z.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return A0.longStackTraces&&u0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(B,v){var u=new CustomEvent(B.toLowerCase(),{detail:v,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(v,u){var r=new Event(v.toLowerCase(),{cancelable:!0});return r.detail=u,!J.global.dispatchEvent(r)}}else{var Q0=document.createEvent("CustomEvent");return Q0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(Q0),function(v,u){var r=document.createEvent("CustomEvent");return r.initCustomEvent(v.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(r)}}}catch(B){}return function(){return!1}}(),T=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(Q0){var B="on"+Q0.toLowerCase(),v=J.global[B];if(!v)return!1;return v.apply(J.global,[].slice.call(arguments,1)),!0}}}();function A(Q0,B){return{promise:B}}var j={promiseCreated:A,promiseFulfilled:A,promiseRejected:A,promiseResolved:A,promiseCancelled:A,promiseChained:function(Q0,B,v){return{promise:B,child:v}},warning:function(Q0,B){return{warning:B}},unhandledRejection:function(Q0,B,v){return{reason:B,promise:v}},rejectionHandled:A},C=function(Q0){var B=!1;try{B=T.apply(null,arguments)}catch(u){z.throwLater(u),B=!0}var v=!1;try{v=P(Q0,j[Q0].apply(null,arguments))}catch(u){z.throwLater(u),v=!0}return v||B};$.config=function(Q0){if(Q0=Object(Q0),"longStackTraces"in Q0){if(Q0.longStackTraces)$.longStackTraces();else if(!Q0.longStackTraces&&$.hasLongStackTraces())D()}if("warnings"in Q0){var B=Q0.warnings;if(A0.warnings=!!B,O=A0.warnings,J.isObject(B)){if("wForgottenReturn"in B)O=!!B.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!A0.cancellation){if(z.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=z0,$.prototype._propagateFrom=k,$.prototype._onCancel=i,$.prototype._setOnCancel=c,$.prototype._attachCancellationCallback=S,$.prototype._execute=x,t=k,A0.cancellation=!0}if("monitoring"in Q0){if(Q0.monitoring&&!A0.monitoring)A0.monitoring=!0,$.prototype._fireEvent=C;else if(!Q0.monitoring&&A0.monitoring)A0.monitoring=!1,$.prototype._fireEvent=b}return $};function b(){return!1}$.prototype._fireEvent=b,$.prototype._execute=function(Q0,B,v){try{Q0(B,v)}catch(u){return u}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(Q0){},$.prototype._attachCancellationCallback=function(Q0){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(Q0,B){};function x(Q0,B,v){var u=this;try{Q0(B,v,function(r){if(typeof r!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(r));u._attachCancellationCallback(r)})}catch(r){return r}}function S(Q0){if(!this._isCancellable())return this;var B=this._onCancel();if(B!==void 0)if(J.isArray(B))B.push(Q0);else this._setOnCancel([B,Q0]);else this._setOnCancel(Q0)}function i(){return this._onCancelField}function c(Q0){this._onCancelField=Q0}function z0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(Q0,B){if((B&1)!==0){this._cancellationParent=Q0;var v=Q0._branchesRemainingToCancel;if(v===void 0)v=0;Q0._branchesRemainingToCancel=v+1}if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}function d(Q0,B){if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}var t=d;function $0(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function g(){this._trace=new u1(this._peekContext())}function p(Q0,B){if(I(Q0)){var v=this._trace;if(v!==void 0){if(B)v=v._parent}if(v!==void 0)v.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=i0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`+u.stack.join(`
`)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)}}}function e(Q0,B,v,u,r){if(Q0===void 0&&B!==null&&O){if(r!==void 0&&r._returnedNonUndefined())return;if((u._bitField&65535)===0)return;if(v)v=v+" ";var X0="",J0="";if(B._trace){var q0=B._trace.stack.split(`
`),M0=G0(q0);for(var B0=M0.length-1;B0>=0;--B0){var r0=M0[B0];if(!W.test(r0)){var I1=r0.match(X);if(I1)X0="at "+I1[1]+":"+I1[2]+":"+I1[3]+" ";break}}if(M0.length>0){var z1=M0[0];for(var B0=0;B0<q0.length;++B0)if(q0[B0]===z1){if(B0>0)J0=`
@@ -135,11 +135,11 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof T6))r
`);if(v<B.length)B[v]=B[v].join(`
`);return Q0+`
`+B.join(`
`)}function N0(Q0){for(var B=0;B<Q0.length;++B)if(Q0[B].length===0||B+1<Q0.length&&Q0[B][0]===Q0[B+1][0])Q0.splice(B,1),B--}function E0(Q0){var B=Q0[0];for(var v=1;v<Q0.length;++v){var u=Q0[v],r=B.length-1,X0=B[r],J0=-1;for(var q0=u.length-1;q0>=0;--q0)if(u[q0]===X0){J0=q0;break}for(var q0=J0;q0>=0;--q0){var M0=u[q0];if(B[r]===M0)B.pop(),r--;else break}B=u}}function G0(Q0){var B=[];for(var v=0;v<Q0.length;++v){var u=Q0[v],r=u===" (No stack trace)"||Z.test(u),X0=r&&u0(u);if(r&&!X0){if(V&&u.charAt(0)!==" ")u=" "+u;B.push(u)}}return B}function T0(Q0){var B=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var v=0;v<B.length;++v){var u=B[v];if(u===" (No stack trace)"||Z.test(u))break}if(v>0&&Q0.name!="SyntaxError")B=B.slice(v);return B}function i0(Q0){var B=Q0.stack,v=Q0.toString();return B=typeof B==="string"&&B.length>0?T0(Q0):[" (No stack trace)"],{message:v,stack:Q0.name=="SyntaxError"?B:G0(B)}}function Y1(Q0,B,v){if(typeof console<"u"){var u;if(J.isObject(Q0)){var r=Q0.stack;u=B+q(r,Q0)}else u=B+String(Q0);if(typeof F==="function")F(u,v);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function a(Q0,B,v,u){var r=!1;try{if(typeof B==="function")if(r=!0,Q0==="rejectionHandled")B(u);else B(v,u)}catch(X0){z.throwLater(X0)}if(Q0==="unhandledRejection"){if(!C(Q0,v,u)&&!r)Y1(v,"Unhandled rejection ")}else C(Q0,u)}function W0(Q0){var B;if(typeof Q0==="function")B="[function "+(Q0.name||"anonymous")+"]";else{B=Q0&&typeof Q0.toString==="function"?Q0.toString():J.toString(Q0);var v=/\[object [a-zA-Z0-9$_]+\]/;if(v.test(B))try{var u=JSON.stringify(Q0);B=u}catch(r){}if(B.length===0)B="(empty array)"}return"(<"+F0(B)+">, no stack trace)"}function F0(Q0){var B=41;if(Q0.length<B)return Q0;return Q0.substr(0,B-3)+"..."}function f0(){return typeof b1==="function"}var u0=function(){return!1},c0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function D1(Q0){var B=Q0.match(c0);if(B)return{fileName:B[1],line:parseInt(B[2],10)}}function k1(Q0,B){if(!f0())return;var v=Q0.stack.split(`
`)}function N0(Q0){for(var B=0;B<Q0.length;++B)if(Q0[B].length===0||B+1<Q0.length&&Q0[B][0]===Q0[B+1][0])Q0.splice(B,1),B--}function E0(Q0){var B=Q0[0];for(var v=1;v<Q0.length;++v){var u=Q0[v],r=B.length-1,X0=B[r],J0=-1;for(var q0=u.length-1;q0>=0;--q0)if(u[q0]===X0){J0=q0;break}for(var q0=J0;q0>=0;--q0){var M0=u[q0];if(B[r]===M0)B.pop(),r--;else break}B=u}}function G0(Q0){var B=[];for(var v=0;v<Q0.length;++v){var u=Q0[v],r=u===" (No stack trace)"||Z.test(u),X0=r&&b0(u);if(r&&!X0){if(V&&u.charAt(0)!==" ")u=" "+u;B.push(u)}}return B}function T0(Q0){var B=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var v=0;v<B.length;++v){var u=B[v];if(u===" (No stack trace)"||Z.test(u))break}if(v>0&&Q0.name!="SyntaxError")B=B.slice(v);return B}function i0(Q0){var B=Q0.stack,v=Q0.toString();return B=typeof B==="string"&&B.length>0?T0(Q0):[" (No stack trace)"],{message:v,stack:Q0.name=="SyntaxError"?B:G0(B)}}function Y1(Q0,B,v){if(typeof console<"u"){var u;if(J.isObject(Q0)){var r=Q0.stack;u=B+q(r,Q0)}else u=B+String(Q0);if(typeof F==="function")F(u,v);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function a(Q0,B,v,u){var r=!1;try{if(typeof B==="function")if(r=!0,Q0==="rejectionHandled")B(u);else B(v,u)}catch(X0){z.throwLater(X0)}if(Q0==="unhandledRejection"){if(!C(Q0,v,u)&&!r)Y1(v,"Unhandled rejection ")}else C(Q0,u)}function W0(Q0){var B;if(typeof Q0==="function")B="[function "+(Q0.name||"anonymous")+"]";else{B=Q0&&typeof Q0.toString==="function"?Q0.toString():J.toString(Q0);var v=/\[object [a-zA-Z0-9$_]+\]/;if(v.test(B))try{var u=JSON.stringify(Q0);B=u}catch(r){}if(B.length===0)B="(empty array)"}return"(<"+F0(B)+">, no stack trace)"}function F0(Q0){var B=41;if(Q0.length<B)return Q0;return Q0.substr(0,B-3)+"..."}function u0(){return typeof b1==="function"}var b0=function(){return!1},c0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function D1(Q0){var B=Q0.match(c0);if(B)return{fileName:B[1],line:parseInt(B[2],10)}}function k1(Q0,B){if(!u0())return;var v=Q0.stack.split(`
`),u=B.stack.split(`
`),r=-1,X0=-1,J0,q0;for(var M0=0;M0<v.length;++M0){var B0=D1(v[M0]);if(B0){J0=B0.fileName,r=B0.line;break}}for(var M0=0;M0<u.length;++M0){var B0=D1(u[M0]);if(B0){q0=B0.fileName,X0=B0.line;break}}if(r<0||X0<0||!J0||!q0||J0!==q0||r>=X0)return;u0=function(r0){if(H.test(r0))return!0;var I1=D1(r0);if(I1){if(I1.fileName===J0&&(r<=I1.line&&I1.line<=X0))return!0}return!1}}function u1(Q0){this._parent=Q0,this._promisesCreated=0;var B=this._length=1+(Q0===void 0?0:Q0._length);if(b1(this,u1),B>32)this.uncycle()}J.inherits(u1,Error),Y.CapturedTrace=u1,u1.prototype.uncycle=function(){var Q0=this._length;if(Q0<2)return;var B=[],v={};for(var u=0,r=this;r!==void 0;++u)B.push(r),r=r._parent;Q0=this._length=u;for(var u=Q0-1;u>=0;--u){var X0=B[u].stack;if(v[X0]===void 0)v[X0]=u}for(var u=0;u<Q0;++u){var J0=B[u].stack,q0=v[J0];if(q0!==void 0&&q0!==u){if(q0>0)B[q0-1]._parent=void 0,B[q0-1]._length=1;B[u]._parent=void 0,B[u]._length=1;var M0=u>0?B[u-1]:this;if(q0<Q0-1)M0._parent=B[q0+1],M0._parent.uncycle(),M0._length=M0._parent._length+1;else M0._parent=void 0,M0._length=1;var B0=M0._length+1;for(var r0=u-2;r0>=0;--r0)B[r0]._length=B0,B0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var B=i0(Q0),v=B.message,u=[B.stack],r=this;while(r!==void 0)u.push(G0(r.stack.split(`
`))),r=r._parent;E0(u),N0(u),J.notEnumerableProp(Q0,"stack",Y0(v,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var B=/^\s*at\s*/,v=function(J0,q0){if(typeof J0==="string")return J0;if(q0.name!==void 0&&q0.message!==void 0)return q0.toString();return W0(q0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=B,q=v;var u=Error.captureStackTrace;return u0=function(J0){return H.test(J0)},function(J0,q0){Error.stackTraceLimit+=6,u(J0,q0),Error.stackTraceLimit-=6}}var r=Error();if(typeof r.stack==="string"&&r.stack.split(`
`),r=-1,X0=-1,J0,q0;for(var M0=0;M0<v.length;++M0){var B0=D1(v[M0]);if(B0){J0=B0.fileName,r=B0.line;break}}for(var M0=0;M0<u.length;++M0){var B0=D1(u[M0]);if(B0){q0=B0.fileName,X0=B0.line;break}}if(r<0||X0<0||!J0||!q0||J0!==q0||r>=X0)return;b0=function(r0){if(H.test(r0))return!0;var I1=D1(r0);if(I1){if(I1.fileName===J0&&(r<=I1.line&&I1.line<=X0))return!0}return!1}}function u1(Q0){this._parent=Q0,this._promisesCreated=0;var B=this._length=1+(Q0===void 0?0:Q0._length);if(b1(this,u1),B>32)this.uncycle()}J.inherits(u1,Error),Y.CapturedTrace=u1,u1.prototype.uncycle=function(){var Q0=this._length;if(Q0<2)return;var B=[],v={};for(var u=0,r=this;r!==void 0;++u)B.push(r),r=r._parent;Q0=this._length=u;for(var u=Q0-1;u>=0;--u){var X0=B[u].stack;if(v[X0]===void 0)v[X0]=u}for(var u=0;u<Q0;++u){var J0=B[u].stack,q0=v[J0];if(q0!==void 0&&q0!==u){if(q0>0)B[q0-1]._parent=void 0,B[q0-1]._length=1;B[u]._parent=void 0,B[u]._length=1;var M0=u>0?B[u-1]:this;if(q0<Q0-1)M0._parent=B[q0+1],M0._parent.uncycle(),M0._length=M0._parent._length+1;else M0._parent=void 0,M0._length=1;var B0=M0._length+1;for(var r0=u-2;r0>=0;--r0)B[r0]._length=B0,B0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var B=i0(Q0),v=B.message,u=[B.stack],r=this;while(r!==void 0)u.push(G0(r.stack.split(`
`))),r=r._parent;E0(u),N0(u),J.notEnumerableProp(Q0,"stack",Y0(v,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var B=/^\s*at\s*/,v=function(J0,q0){if(typeof J0==="string")return J0;if(q0.name!==void 0&&q0.message!==void 0)return q0.toString();return W0(q0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=B,q=v;var u=Error.captureStackTrace;return b0=function(J0){return H.test(J0)},function(J0,q0){Error.stackTraceLimit+=6,u(J0,q0),Error.stackTraceLimit-=6}}var r=Error();if(typeof r.stack==="string"&&r.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=v,V=!0,function(q0){q0.stack=Error().stack};var X0;try{throw Error()}catch(J0){X0="stack"in J0}if(!("stack"in r)&&X0&&typeof Error.stackTraceLimit==="number")return Z=B,q=v,function(q0){Error.stackTraceLimit+=6;try{throw Error()}catch(M0){q0.stack=M0.stack}Error.stackTraceLimit-=6};return q=function(J0,q0){if(typeof J0==="string")return J0;if((typeof q0==="object"||typeof q0==="function")&&q0.name!==void 0&&q0.message!==void 0)return q0.toString();return W0(q0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(F=function(Q0){console.warn(Q0)},J.isNode&&process.stderr.isTTY)F=function(Q0,B){var v=B?"\x1B[33m":"\x1B[31m";console.warn(v+Q0+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")F=function(Q0,B){console.warn("%c"+Q0,B?"color: darkorange":"color: red")}}var A0={warnings:w,longStackTraces:!1,cancellation:!1,monitoring:!1};if(N)$.longStackTraces();return{longStackTraces:function(){return A0.longStackTraces},warnings:function(){return A0.warnings},cancellation:function(){return A0.cancellation},monitoring:function(){return A0.monitoring},propagateFromFunction:function(){return t},boundValueFunction:function(){return $0},checkForgottenReturns:e,setBounds:k1,warn:s,deprecated:y,CapturedTrace:u1,fireDomEvent:P,fireGlobalEvent:T}}});var uF0=E((ca1,fF0)=>{fF0.exports=function($,Y){var U=F4(),z=$.CancellationError,Q=U.errorObj;function J(X,Z,q){this.promise=X,this.type=Z,this.handler=q,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function I(X){this.finallyHandler=X}I.prototype._resultCancelled=function(){K(this.finallyHandler)};function K(X,Z){if(X.cancelPromise!=null){if(arguments.length>1)X.cancelPromise._reject(Z);else X.cancelPromise._cancel();return X.cancelPromise=null,!0}return!1}function G(){return W.call(this,this.promise._target()._settledValue())}function H(X){if(K(this,X))return;return Q.e=X,Q}function W(X){var Z=this.promise,q=this.handler;if(!this.called){this.called=!0;var V=this.isFinallyHandler()?q.call(Z._boundValue()):q.call(Z._boundValue(),X);if(V!==void 0){Z._setReturnedNonUndefined();var F=Y(V,Z);if(F instanceof $){if(this.cancelPromise!=null){if(F._isCancelled()){var M=new z("late cancellation observer");return Z._attachExtraTrace(M),Q.e=M,Q}else if(F.isPending())F._attachCancellationCallback(new I(this))}return F._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return K(this),Q.e=X,Q;else return K(this),X}return $.prototype._passThrough=function(X,Z,q,V){if(typeof X!=="function")return this.then();return this._then(q,V,void 0,new J(this,Z,X),void 0)},$.prototype.lastly=$.prototype.finally=function(X){return this._passThrough(X,0,W,W)},$.prototype.tap=function(X){return this._passThrough(X,1,W)},J}});var iF0=E((na1,bF0)=>{bF0.exports=function($){var Y=F4(),U=lU().keys,z=Y.tryCatch,Q=Y.errorObj;function J(I,K,G){return function(H){var W=G._boundValue();$:for(var X=0;X<I.length;++X){var Z=I[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return z(K).call(W,H)}else if(typeof Z==="function"){var q=z(Z).call(W,H);if(q===Q)return q;else if(q)return z(K).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var F=0;F<V.length;++F){var M=V[F];if(Z[M]!=H[M])continue $}return z(K).call(W,H)}}return $}}return J}});var Gc=E((pa1,pF0)=>{var cF0=F4(),RV1=cF0.maybeWrapAsError,_V1=j3(),vV1=_V1.OperationalError,nF0=lU();function hV1($){return $ instanceof Error&&nF0.getPrototypeOf($)===Error.prototype}var SV1=/^(?:name|message|stack|cause)$/;function gV1($){var Y;if(hV1($)){Y=new vV1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=nF0.keys($);for(var z=0;z<U.length;++z){var Q=U[z];if(!SV1.test(Q))Y[Q]=$[Q]}return Y}return cF0.markAsOriginatingFromRejection($),$}function yV1($,Y){return function(U,z){if($===null)return;if(U){var Q=gV1(RV1(U));$._attachExtraTrace(Q),$._reject(Q)}else if(!Y)$._fulfill(z);else{var J=arguments.length,I=Array(Math.max(J-1,0));for(var K=1;K<J;++K)I[K-1]=arguments[K];$._fulfill(I)}$=null}}pF0.exports=yV1});var mF0=E((da1,dF0)=>{dF0.exports=function($,Y,U,z,Q){var J=F4(),I=J.tryCatch;$.method=function(K){if(typeof K!=="function")throw new $.TypeError("expecting a function but got "+J.classString(K));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=I(K).apply(this,arguments),W=G._popContext();return Q.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(K){if(typeof K!=="function")return z("expecting a function but got "+J.classString(K));var G=new $(Y);G._captureStackTrace(),G._pushContext();var H;if(arguments.length>1){Q.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],X=arguments[2];H=J.isArray(W)?I(K).apply(X,W):I(K).call(X,W)}else H=I(K)();var Z=G._popContext();return Q.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(K){if(K===J.errorObj)this._rejectCallback(K.e,!1);else this._resolveCallback(K,!0)}}});var oF0=E((ma1,lF0)=>{lF0.exports=function($,Y,U,z){var Q=!1,J=function(H,W){this._reject(W)},I=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},K=function(H,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},G=function(H,W){if(!W.promiseRejectionQueued)this._reject(H)};$.prototype.bind=function(H){if(!Q)Q=!0,$.prototype._propagateFrom=z.propagateFromFunction(),$.prototype._boundValue=z.boundValueFunction();var W=U(H),X=new $(Y);X._propagateFrom(this,1);var Z=this._target();if(X._setBoundTo(W),W instanceof $){var q={promiseRejectionQueued:!1,promise:X,target:Z,bindingPromise:W};Z._then(Y,I,voi Line truncated
@@ -285,7 +285,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof T6))r
`)},Y=function(){return new S.PromiseInspection(this._target())},U=function(k){return S.reject(new X(k))};function z(){}var Q={},J=F4(),I;if(J.isNode)I=function(){var k=process.domain;if(k===void 0)k=null;return k};else I=function(){return null};J.notEnumerableProp(S,"_getDomain",I);var K=lU(),G=jF0(),H=new G;K.defineProperty(S,"_async",{value:H});var W=j3(),X=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var Z=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var q=function(){},V={},F={},M=vF0()(S,q),w=SF0()(S,q,M,U,z),N=yF0()(S),O=N.create,D=xF0()(S,N),P=D.CapturedTrace,T=uF0()(S,M),A=iF0()(F),j=Gc(),C=J.errorObj,b=J.tryCatch;function x(k,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(k.constructor!==S)throw new X(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function S(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},S.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=Wc.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(k){return new w(k).promise()},S.cast=function(k){var d=M(k);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},S.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new S(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=I();if((s&50397184)!==0){var N0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,N0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),N0=d;H.invoke(G0,y,{handler:Y0===null?N0:typeof N0==="function"&&J.domainBind(Y0,N0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,Y0);return e},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler Line truncated
`)}function S(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(k){var d=arguments.length;if(d>1){var t=Array(d-1),$0=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[$0++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=$0,k=arguments[g],this.then(void 0,A(t,k,this))}return this.then(void 0,k)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(k,d){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(k,d,void 0,void 0,void 0)},S.prototype.done=function(k,d){var t=this._then(k,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(k){return this.caught(J.originatesFromRejection,k)},S.getNewLibraryCopy=Wc.exports,S.is=function(k){return k instanceof S},S.fromNode=S.fromCallback=function(k){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=b(k)(j(d,t));if($0===C)d._rejectCallback($0.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(k){return new w(k).promise()},S.cast=function(k){var d=M(k);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=k;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(k){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(k,!0),d},S.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},S.prototype._then=function(k,d,t,$0,g){var p=g!==void 0,e=p?g:new S(q),y=this._target(),s=y._bitField;if(!p){if(e._propagateFrom(this,3),e._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((s&50397184)!==0)$0=this._boundValue();else $0=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,e)}var Y0=I();if((s&50397184)!==0){var N0,E0,G0=y._settlePromiseCtx;if((s&33554432)!==0)E0=y._rejectionHandler0,N0=k;else if((s&16777216)!==0)E0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else G0=y._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),y._attachExtraTrace(E0),N0=d;H.invoke(G0,y,{handler:Y0===null?N0:typeof N0==="function"&&J.domainBind(Y0,N0),promise:e,receiver:$0,value:E0})}else y._addCallbacks(k,d,e,$0,Y0);return e},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(k){this._bitField=this._bitField&-65536|k&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(k){var d=k===0?this._receiver0:this[k*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(k){return this[k*4-4+2]},S.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},S.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(k){var{_bitField:d,_fulfillmentHandler Line truncated
path = %s
syscall = %s
fstream_type = %s
@@ -295,24 +295,24 @@ fstream_class = %s
fstream_stack =
%s
`,Y||"UNKNOWN",z.stack,z.path,z.syscall,z.fstream_type,z.fstream_path,z.fstream_unc_path,z.fstream_class,z.fstream_stack.join(`
`));else U.emit("warn",z)};_2.prototype.info=function($,Y){this.emit("info",$,Y)};_2.prototype.error=function($,Y,U){var z=ZO0($,Y,this);if(U)throw z;else this.emit("error",z)};function ZO0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(z){return z.replace(/^ {4}at /,"")}),$}});var qZ=E((ct1,VO0)=>{VO0.exports=Vw1;function Vw1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var z=0,Q=Y.length;z<Q;z++){U=Y[z];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var sc=E((nt1,LO0)=>{LO0.exports=VZ;var Lw1=l8(),Fw1=X1(),rc=Uz();Fw1(VZ,rc);function VZ($){var Y=this;if(!(Y instanceof VZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);rc.call(Y,$)}VZ.prototype._stat=function($){var Y=this;Lw1.readlink(Y._path,function(U,z){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=z,Y.emit("linkpath",z),rc.prototype._stat.call(Y,$)})};VZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var tc=E((pt1,MO0)=>{MO0.exports=w9;var wO0=l8(),ww1=X1(),LZ=I0("path"),ac=Uz(),FO0=I0("assert").ok;ww1(w9,ac);function w9($){var Y=this;if(!(Y instanceof w9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;ac.call(this,$)}w9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,wO0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",z);else z();function z(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};w9.prototype._read=function(){var $=this;if(!$.entries)return $._getEntries();if($._paused||$._currentEntry||$._aborted)return;if($._index++,$._index>=$.entries.length){if(!$._ended)$._ended=!0,$.emit("end"),$.emit("close");return}var Y=LZ.resolve($._path,$.entries[$._index]);FO0(Y!==$._path),FO0($.entries[$._index]),$._currentEntry=Y,wO0[$.props.follow?"stat":"lstat"](Y,function(U,z){if(U)return $.error(U);var Q=$._proxy||$;z.path=Y,z.basename=LZ.basename(Y),z.dirname=LZ.dirname(Y);var J=$.getChildProps.call(Q,z);J.path=Y,J.basename=LZ.basename(Y),J.dirname=LZ.dirname(Y);var I=ac(J,z);$._currentEntry=I,I.on("pause",function(H){if(!$._paused&&!I._disowned)$.pause(H)}),I.on("resume",function(H){if($._paused&&!I._disowned)$.resume(H)}),I.on("stat",function(H){if($.emit("_entryStat",I,H),I._aborted)return;if(I._paused)I.once("resume",function(){$.emit("entryStat",I,H)});else $.emit("entryStat",I,H)}),I.on("ready",function H(){if($._paused)return I.pause($),$.once("resume",H);if(I.type==="Socket")$.emit("socket",I);else $.emitEntry(I)});var K=!1;I.on("close",G),I.on("disown",G);function G(){if(K)return;if(K=!0,$.emit("childEnd",I),$.emit("entryEnd",I),$._currentEntry=null,!$._paused)$._read()}I.on("error",function(H){if(I._swallowErrors)$.warn(H),I.emit("end"),I.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){I.on(H,$.emit.bind($,H))})})};w9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};w9.prototype.getChildProps=function(){return{depth:this.depth+1,root:this.root||this,parent:this,follow:this.follow,filter:this.filter,sort:this.props.sort,hardlinks:this.props.hardlinks}};w9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};w9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};w9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var ec=E((dt1,AO0)=>{AO0.exports=zz;var Mw1=l8(),Ow1=X1(),OO0=Uz(),NO0={EOF:!0},DO0={CLOSE:!0};Ow1(zz,OO0);function zz($){var Y=this;if(!(Y instanceof zz))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,OO0.call(Y,$)}zz.prototype._getStream=function(){var $=this,Y=$._stream=Mw1.createReadStream($._path,$.p Line truncated
`));else U.emit("warn",z)};_2.prototype.info=function($,Y){this.emit("info",$,Y)};_2.prototype.error=function($,Y,U){var z=ZO0($,Y,this);if(U)throw z;else this.emit("error",z)};function ZO0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(z){return z.replace(/^ {4}at /,"")}),$}});var qZ=E((ct1,VO0)=>{VO0.exports=Vw1;function Vw1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var z=0,Q=Y.length;z<Q;z++){U=Y[z];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var sc=E((nt1,LO0)=>{LO0.exports=VZ;var Lw1=l8(),Fw1=X1(),rc=Uz();Fw1(VZ,rc);function VZ($){var Y=this;if(!(Y instanceof VZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);rc.call(Y,$)}VZ.prototype._stat=function($){var Y=this;Lw1.readlink(Y._path,function(U,z){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=z,Y.emit("linkpath",z),rc.prototype._stat.call(Y,$)})};VZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var tc=E((pt1,MO0)=>{MO0.exports=M9;var wO0=l8(),ww1=X1(),LZ=I0("path"),ac=Uz(),FO0=I0("assert").ok;ww1(M9,ac);function M9($){var Y=this;if(!(Y instanceof M9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;ac.call(this,$)}M9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,wO0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",z);else z();function z(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};M9.prototype._read=function(){var $=this;if(!$.entries)return $._getEntries();if($._paused||$._currentEntry||$._aborted)return;if($._index++,$._index>=$.entries.length){if(!$._ended)$._ended=!0,$.emit("end"),$.emit("close");return}var Y=LZ.resolve($._path,$.entries[$._index]);FO0(Y!==$._path),FO0($.entries[$._index]),$._currentEntry=Y,wO0[$.props.follow?"stat":"lstat"](Y,function(U,z){if(U)return $.error(U);var Q=$._proxy||$;z.path=Y,z.basename=LZ.basename(Y),z.dirname=LZ.dirname(Y);var J=$.getChildProps.call(Q,z);J.path=Y,J.basename=LZ.basename(Y),J.dirname=LZ.dirname(Y);var I=ac(J,z);$._currentEntry=I,I.on("pause",function(H){if(!$._paused&&!I._disowned)$.pause(H)}),I.on("resume",function(H){if($._paused&&!I._disowned)$.resume(H)}),I.on("stat",function(H){if($.emit("_entryStat",I,H),I._aborted)return;if(I._paused)I.once("resume",function(){$.emit("entryStat",I,H)});else $.emit("entryStat",I,H)}),I.on("ready",function H(){if($._paused)return I.pause($),$.once("resume",H);if(I.type==="Socket")$.emit("socket",I);else $.emitEntry(I)});var K=!1;I.on("close",G),I.on("disown",G);function G(){if(K)return;if(K=!0,$.emit("childEnd",I),$.emit("entryEnd",I),$._currentEntry=null,!$._paused)$._read()}I.on("error",function(H){if(I._swallowErrors)$.warn(H),I.emit("end"),I.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){I.on(H,$.emit.bind($,H))})})};M9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};M9.prototype.getChildProps=function(){return{depth:this.depth+1,root:this.root||this,parent:this,follow:this.follow,filter:this.filter,sort:this.props.sort,hardlinks:this.props.hardlinks}};M9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};M9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};M9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var ec=E((dt1,AO0)=>{AO0.exports=zz;var Mw1=l8(),Ow1=X1(),OO0=Uz(),NO0={EOF:!0},DO0={CLOSE:!0};Ow1(zz,OO0);function zz($){var Y=this;if(!(Y instanceof zz))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,OO0.call(Y,$)}zz.prototype._getStream=function(){var $=this,Y=$._stream=Mw1.createReadStream($._path,$.p Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(DO0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};zz.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,z=Y.length;U<z;U++){var Q=Y[U];if(Q===NO0)$.emit("end");else if(Q===DO0)$.emit("close");else $.emit("data",Q);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};zz.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};zz.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y.emit("resume",$),Y._paused=!1,Y._stream)Y._stream.resume();Y._read()}});var TO0=E((mt1,PO0)=>{PO0.exports=JB;var Nw1=X1(),BO0=Uz();Nw1(JB,BO0);function JB($){var Y=this;if(!(Y instanceof JB))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);BO0.call(Y,$)}JB.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Yn=E((lt1,jO0)=>{jO0.exports=Qz;var $n=Uz(),Dw1=qZ(),Aw1=X1(),Bw1=l8();Aw1(Qz,$n);function Qz($){var Y=this;if(!(Y instanceof Qz))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,$n.call(Y,$)}Qz.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";Bw1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=Dw1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy($n(Y,Q))})};Qz.prototype._addProxy=function($){var Y=this;if(Y._proxyTarget)return Y.error("proxy already set");Y._proxyTarget=$,$._proxy=Y,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(z){$[z[0]].apply($,z[1])})};Qz.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};Qz.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var Uz=E((ot1,RO0)=>{RO0.exports=O5;var Pw1=l8(),Tw1=I0("stream").Stream,jw1=X1(),Un=I0("path"),zn=qZ(),IB=O5.hardLinks={},EO0=QB();jw1(O5,EO0);var CO0=sc();function O5($,Y){var U=this;if(!(U instanceof O5))return new O5($,Y);if(typeof $==="string")$={path:$};var z,Q;if($.type&&typeof $.type==="function")z=$.type,Q=z;else z=zn($),Q=O5;if(Y&&!z)z=zn(Y),$[z]=!0,$.type=z;switch(z){case"Directory":Q=tc();break;case"Link":case"File":Q=ec();break;case"SymbolicLink":Q=CO0;break;case"Socket":Q=TO0();break;case null:Q=Yn();break}if(!(U instanceof Q))return new Q($);if(EO0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=z,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Un.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=$.basename=Un.basename(U.path),U.dirname=$.dirname=Un.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=Ew1;U._stat(Y)}function Ew1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}O5.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat";if($)process.nextTick(Q.bind(null,null,$));else Pw1[z](Y._path,Q);function Q(J,I){if(J)return Y.error(J);if(Object.keys(I).forEach(function(q){U[q]=I[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var K=zn(U),G=U.hardlinks!==!1;if(G&&K!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(IB[H]===Y._path||!IB[H])IB[H]=Y._path;else K=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=IB[H],Y._stat=Y._read=CO0.prototype._read}if(Y.type&&Y.type!==K)Y.error("Unexpected type: "+K);if(Y.filter){var W=Y._proxy||Y;if(!Y.filter.call(W,W,U)){if(!Y._disowned)Y.abort(),Y.emit("end"),Y.emit("close");return}}var X=["_stat","stat","ready"],Z=0;(function q(){if(Y._aborted){Y.emit("end"),Y.emit("close");return}if(Y._paused&&Y.type!=="Directory"){Y.once("resume",q);return}var V=X[Z++];if(!V)return Y._read();Y.emit(V,U),q()})()}};O5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var z=$.add(U);if(z===!1)Y.pause()});return Tw1.prototype.pipe.apply(this,arguments)};O5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};O5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};O5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Kn=E((rt1,xO0)=> Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);wB.prototype._finish.call($)}});var Mn=E((qe1,jN0)=>{jN0.exports=y2;var wn=pI(),$M1=qZ(),YM1=X1(),UM1=LB(),zM1=I0("fs");YM1(y2,wn);function y2($){var Y=this;if(!(Y instanceof y2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,wn.call(Y,$)}y2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";zM1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=$M1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(wn(Y,Q))})};y2.prototype._addProxy=function($){var Y=this;if(Y._proxy)return Y.error("proxy already set");Y._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(z){$[z[0]].apply($,z[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};y2.prototype.add=function($){if(UM1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};y2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};y2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var pI=E((Ve1,yN0)=>{yN0.exports=f$;var x$=l8(),QM1=X1(),JM1=Kn(),IM1=Zn(),OZ=I0("path"),CN0=process.platform==="win32"?0:process.umask(),RN0=qZ(),_N0=QB();QM1(f$,_N0);f$.dirmode=parseInt("0777",8)&~CN0;f$.filemode=parseInt("0666",8)&~CN0;var KM1=Vn(),GM1=Ln(),HM1=Fn(),WM1=Mn();function f$($,Y){var U=this;if(typeof $==="string")$={path:$};var z=RN0($),Q=f$;switch(z){case"Directory":Q=KM1;break;case"File":Q=HM1;break;case"Link":case"SymbolicLink":Q=GM1;break;case null:default:Q=WM1;break}if(!(U instanceof Q))return new Q($);if(_N0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.type=$.type,U.props=$,U.depth=$.depth||0,U.clobber=$.clobber===!1?$.clobber:!0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=OZ.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=OZ.basename($.path),U.dirname=OZ.dirname($.path),U.linkpath=$.linkpath||null,$.parent=$.root=null,U.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);U.readable=!1,U.writable=!0,U._buffer=[],U.ready=!1,U.filter=typeof $.filter==="function"?$.filter:null,U._stat(Y)}f$.prototype._create=function(){var $=this;x$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};f$.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else x$[z](Y._path,J);function J(I,K){if(Y.filter&&!Y.filter.call(Q,Q,K)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(I||!K)return On(Y);Y._old=K;var G=RN0(K);if(G!==Y.type||Y.type==="File"&&K.nlink>1)return JM1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,On(Y)});On(Y)}};function On($){IM1(OZ.dirname($._path),f$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function vN0($,Y,U,z,Q){var J=Y.mode,I=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!x$[I])return Q();if(typeof J!=="number")return Q();var K=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===K)return Q();x$[I](z,J,Q)}function hN0($,Y,U,z,Q){if(process.platform==="win32")return Q();if(!process.getuid||process.getuid()!==0)return Q();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return Q();if(U.uid===Y.uid&&U.gid===Y.gid)return Q();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!x$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;x$[J](z,Y.uid,Y.gid,Q)}function SN0($,Y,U,z,Q){if(!x$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!x$[J])J="utimes";if(!x$[J])return Q();var{atime:I,mtime:K}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=I;if(H===void 0)H=K;if(!EN0(G))G=new Date(G);if(!EN0(H))G=new Date(H);if(G.getTime()===I.getTime()&&H.getTime()===K.getTime())return Q();x$[J](z,G,H,Q)}f$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,z=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";x$[Q]($._path,function(K,G){if(K)if(K.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(K);J($._old=G)})}return;function J(K){Y+=3,vN0($,$.props,K,$._path,I("chmod")),hN0($,$.props,K,$._path,I("chown")),SN0($,$.props,K,$._path,I("utimes"))}function I(K){return function(G){if(U)return;if(G)return G.fstream_finish_call=K,$.error(U=G);if(--Y>0)return;if(z)return;if(z=!0,!$._madeDir)return H();else gN0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function gN0($,Y,U){var z=$._madeDir,Q=OZ.dirname(Y);XM1($,Q,function(J){if(J)return U(J);if(Q===z)return U();gN0($,Q,U)})}function XM1($,Y,U){var z={};Object.keys($.props).forEach(function(K){if(z[K]=$.props[K],K==="mode"&&$.type!=="Directory")z[K]=z[K]|parseInt("0111",8)});var Q=3,J=null;x$.stat(Y,function(K,G){if(K)return U(J=K);vN0($,z,G,Y,I),hN0($,z,G,Y,I),SN0($,z,G,Y,I)});function I(K){if(J)return;if(K)return U(J=K);if(--Q===0)return U()}}f$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};f$.prototype.add=function(){this.error("Can't add to non-Directory type")};f$.prototype.write=function(){return!0};function ZM1($){return Object.prototype.toString.call($)}function EN0($){return typeof $==="object"&&ZM1($)==="[object Date]"}});var Pn=E((qM1)=>{qM1.Abstract=QB();qM1.Reader=Uz();qM1.Writer=pI();qM1.File={Reader:ec(),Writer:Fn()};qM1.Dir={Reader:tc(),Writer:Vn()};qM1.Link={Reader:sc(),Writer:Ln()};qM1.Proxy={Reader:Yn(),Writer:Mn()};qM1.Reader.Dir=qM1.DirReader=qM1.Dir.Reader;qM1.Reader.File=qM1.FileReader=qM1.File.Reader;qM1.Reader.Link=qM1.LinkReader=qM1.Link.Reader;qM1.Reader.Proxy=qM1.ProxyReader=qM1.Proxy.Reader;qM1.Writer.Dir=qM1.DirWriter=qM1.Dir.Writer;qM1.Writer.File=qM1.FileWriter=qM1.File.Writer;qM1.Writer.Link=qM1.LinkWriter=qM1.Link.Writer;qM1.Writer.Proxy=qM1.ProxyWriter=qM1.Proxy.Writer;qM1.collect=LB()});var xN0=E((Pe1,kN0)=>{kN0.exports=DM1;var FM1=rA(),wM1=Pn().Writer,Tn=I0("path"),MM1=I0("stream"),OM1=lc(),NM1=C2();function DM1($){$.path=Tn.resolve(Tn.normalize($.path));var Y=new FM1($),U=new MM1.Writable({objectMode:!0});U._write=function(Q,J,I){if(Q.type=="Directory")return I();var K=Tn.join($.path,Q.path);if(K.indexOf($.path)!=0)return I();let G=$.getWriter?$.getWriter({path:K}):wM1({path:K});Q.pipe(G).on("error",I).on("close",I)};var z=OM1(Y,U);return Y.once("crx-header",function(Q){z.crxHeader=Q}),Y.pipe(U).on("finish",function(){z.emit("close")}),z.promise=function(){return new NM1(function(Q,J){z.on("close",Q),z.on("error",J)})},z}});var fN0=E((Te1,MB)=>{var j6=function($){var Y=1e7,U=7,z=9007199254740992,Q=Z(z),J="0123456789abcdefghijklmnopqrstuvwxyz",I=typeof BigInt==="function";function K(B,v,u,r){if(typeof B>"u")return K[0];if(typeof v<"u")return+v===10&&!u?A0(B):f0(B,v,u,r);return A0(B)}function G(B,v){this.value=B,this.sign=v,this.isSmall=!1}G.prototype=Object.create(K.prototype);function H(B){this.value=B,this.sign=B<0,this.isSmall=!0}H.prototype=Object.create(K.prototype);function W(B){ Line truncated
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};f$.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else x$[z](Y._path,J);function J(I,K){if(Y.filter&&!Y.filter.call(Q,Q,K)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(I||!K)return On(Y);Y._old=K;var G=RN0(K);if(G!==Y.type||Y.type==="File"&&K.nlink>1)return JM1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,On(Y)});On(Y)}};function On($){IM1(OZ.dirname($._path),f$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function vN0($,Y,U,z,Q){var J=Y.mode,I=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!x$[I])return Q();if(typeof J!=="number")return Q();var K=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===K)return Q();x$[I](z,J,Q)}function hN0($,Y,U,z,Q){if(process.platform==="win32")return Q();if(!process.getuid||process.getuid()!==0)return Q();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return Q();if(U.uid===Y.uid&&U.gid===Y.gid)return Q();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!x$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;x$[J](z,Y.uid,Y.gid,Q)}function SN0($,Y,U,z,Q){if(!x$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!x$[J])J="utimes";if(!x$[J])return Q();var{atime:I,mtime:K}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=I;if(H===void 0)H=K;if(!EN0(G))G=new Date(G);if(!EN0(H))G=new Date(H);if(G.getTime()===I.getTime()&&H.getTime()===K.getTime())return Q();x$[J](z,G,H,Q)}f$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,z=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";x$[Q]($._path,function(K,G){if(K)if(K.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(K);J($._old=G)})}return;function J(K){Y+=3,vN0($,$.props,K,$._path,I("chmod")),hN0($,$.props,K,$._path,I("chown")),SN0($,$.props,K,$._path,I("utimes"))}function I(K){return function(G){if(U)return;if(G)return G.fstream_finish_call=K,$.error(U=G);if(--Y>0)return;if(z)return;if(z=!0,!$._madeDir)return H();else gN0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function gN0($,Y,U){var z=$._madeDir,Q=OZ.dirname(Y);XM1($,Q,function(J){if(J)return U(J);if(Q===z)return U();gN0($,Q,U)})}function XM1($,Y,U){var z={};Object.keys($.props).forEach(function(K){if(z[K]=$.props[K],K==="mode"&&$.type!=="Directory")z[K]=z[K]|parseInt("0111",8)});var Q=3,J=null;x$.stat(Y,function(K,G){if(K)return U(J=K);vN0($,z,G,Y,I),hN0($,z,G,Y,I),SN0($,z,G,Y,I)});function I(K){if(J)return;if(K)return U(J=K);if(--Q===0)return U()}}f$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};f$.prototype.add=function(){this.error("Can't add to non-Directory type")};f$.prototype.write=function(){return!0};function ZM1($){return Object.prototype.toString.call($)}function EN0($){return typeof $==="object"&&ZM1($)==="[object Date]"}});var Pn=E((qM1)=>{qM1.Abstract=QB();qM1.Reader=Uz();qM1.Writer=pI();qM1.File={Reader:ec(),Writer:Fn()};qM1.Dir={Reader:tc(),Writer:Vn()};qM1.Link={Reader:sc(),Writer:Ln()};qM1.Proxy={Reader:Yn(),Writer:Mn()};qM1.Reader.Dir=qM1.DirReader=qM1.Dir.Reader;qM1.Reader.File=qM1.FileReader=qM1.File.Reader;qM1.Reader.Link=qM1.LinkReader=qM1.Link.Reader;qM1.Reader.Proxy=qM1.ProxyReader=qM1.Proxy.Reader;qM1.Writer.Dir=qM1.DirWriter=qM1.Dir.Writer;qM1.Writer.File=qM1.FileWriter=qM1.File.Writer;qM1.Writer.Link=qM1.LinkWriter=qM1.Link.Writer;qM1.Writer.Proxy=qM1.ProxyWriter=qM1.Proxy.Writer;qM1.collect=LB()});var xN0=E((Pe1,kN0)=>{kN0.exports=DM1;var FM1=rA(),wM1=Pn().Writer,Tn=I0("path"),MM1=I0("stream"),OM1=lc(),NM1=C2();function DM1($){$.path=Tn.resolve(Tn.normalize($.path));var Y=new FM1($),U=new MM1.Writable({objectMode:!0});U._write=function(Q,J,I){if(Q.type=="Directory")return I();var K=Tn.join($.path,Q.path);if(K.indexOf($.path)!=0)return I();let G=$.getWriter?$.getWriter({path:K}):wM1({path:K});Q.pipe(G).on("error",I).on("close",I)};var z=OM1(Y,U);return Y.once("crx-header",function(Q){z.crxHeader=Q}),Y.pipe(U).on("finish",function(){z.emit("close")}),z.promise=function(){return new NM1(function(Q,J){z.on("close",Q),z.on("error",J)})},z}});var fN0=E((Te1,MB)=>{var j6=function($){var Y=1e7,U=7,z=9007199254740992,Q=Z(z),J="0123456789abcdefghijklmnopqrstuvwxyz",I=typeof BigInt==="function";function K(B,v,u,r){if(typeof B>"u")return K[0];if(typeof v<"u")return+v===10&&!u?A0(B):u0(B,v,u,r);return A0(B)}function G(B,v){this.value=B,this.sign=v,this.isSmall=!1}G.prototype=Object.create(K.prototype);function H(B){this.value=B,this.sign=B<0,this.isSmall=!0}H.prototype=Object.create(K.prototype);function W(B){ Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var V4=I0("fs"),PB=I0("os"),E6=I0("path"),aN0=I0("crypto"),M9={fs:V4.constants,os:PB.constants},YD0=/XXXXXX/,UD0=(M9.O_CREAT||M9.fs.O_CREAT)|(M9.O_EXCL||M9.fs.O_EXCL)|(M9.O_RDWR||M9.fs.O_RDWR),dM1=PB.platform()==="win32",mM1=M9.EBADF||M9.os.errno.EBADF,lM1=M9.ENOENT||M9.os.errno.ENOENT,mI=[],zD0=V4.rmdirSync.bind(V4),QD0=!1;function oM1($,Y){return V4.rm($,{recursive:!0},Y)}function JD0($){return V4.rmSync($,{recursive:!0})}function _n($,Y){let U=lI($,Y),z=U[0],Q=U[1];QO1(z,function(J,I){if(J)return Q(J);let K=I.tries;(function G(){try{let H=KD0(I);V4.stat(H,function(W){if(!W){if(K-- >0)return G();return Q(Error("Could not get a unique tmp filename, max tries reached "+H))}Q(null,H)})}catch(H){Q(H)}})()})}function vn($){let Y=lI($),U=Y[0],z=JO1(U),Q=z.tries;do{let J=KD0(z);try{V4.statSync(J)}catch(I){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function rM1($,Y){let U=lI($,Y),z=U[0],Q=U[1];_n(z,function(I,K){if(I)return Q(I);V4.open(K,UD0,z.mode||384,function(H,W){if(H)return Q(H);if(z.discardDescriptor)return V4.close(W,function(Z){return Q(Z,K,void 0,Cn(K,-1,z,!1))});else{let X=z.discardDescriptor||z.detachDescriptor;Q(null,K,W,Cn(K,X?-1:W,z,!1))}})})}function sM1($){let Y=lI($),U=Y[0],z=U.discardDescriptor||U.detachDescriptor,Q=vn(U),J=V4.openSync(Q,UD0,U.mode||384);if(U.discardDescriptor)V4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:Cn(Q,z?-1:J,U,!0)}}function aM1($,Y){let U=lI($,Y),z=U[0],Q=U[1];_n(z,function(I,K){if(I)return Q(I);V4.mkdir(K,z.mode||448,function(H){if(H)return Q(H);Q(null,K,ID0(K,z,!1))})})}function tM1($){let Y=lI($),U=Y[0],z=vn(U);return V4.mkdirSync(z,U.mode||448),{name:z,removeCallback:ID0(z,U,!0)}}function eM1($,Y){let U=function(z){if(z&&!Rn(z))return Y(z);Y()};if(0<=$[0])V4.close($[0],function(){V4.unlink($[1],U)});else V4.unlink($[1],U)}function $O1($){let Y=null;try{if(0<=$[0])V4.closeSync($[0])}catch(U){if(!IO1(U)&&!Rn(U))throw U}finally{try{V4.unlinkSync($[1])}catch(U){if(!Rn(U))Y=U}}if(Y!==null)throw Y}function Cn($,Y,U,z){let Q=BB($O1,[Y,$],z),J=BB(eM1,[Y,$],z,Q);if(!U.keep)mI.unshift(Q);return z?Q:J}function ID0($,Y,U){let z=Y.unsafeCleanup?oM1:V4.rmdir.bind(V4),Q=Y.unsafeCleanup?JD0:zD0,J=BB(Q,$,U),I=BB(z,$,U,J);if(!Y.keep)mI.unshift(J);return U?J:I}function BB($,Y,U,z){let Q=!1;return function J(I){if(!Q){let K=z||J,G=mI.indexOf(K);if(G>=0)mI.splice(G,1);if(Q=!0,U||$===zD0||$===JD0)return $(Y);else return $(Y,I||function(){})}}}function YO1(){if(!QD0)return;while(mI.length)try{mI[0]()}catch($){}}function tN0($){let Y=[],U=null;try{U=aN0.randomBytes($)}catch(z){U=aN0.pseudoRandomBytes($)}for(let z=0;z<$;z++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[z]%62]);return Y.join("")}function r8($){return typeof $>"u"}function lI($,Y){if(typeof $==="function")return[{},$];if(r8($))return[{},Y];let U={};for(let z of Object.getOwnPropertyNames($))U[z]=$[z];return[U,Y]}function UO1($,Y,U){let z=E6.isAbsolute($)?$:E6.join(Y,$);V4.stat(z,function(Q){if(Q)V4.realpath(E6.dirname(z),function(J,I){if(J)return U(J);U(null,E6.join(I,E6.basename(z)))});else V4.realpath(z,U)})}function zO1($,Y){let U=E6.isAbsolute($)?$:E6.join(Y,$);try{return V4.statSync(U),V4.realpathSync(U)}catch(z){let Q=V4.realpathSync(E6.dirname(U));return E6.join(Q,E6.basename(U))}}function KD0($){let Y=$.tmpdir;if(!r8($.name))return E6.join(Y,$.dir,$.name);if(!r8($.template))return E6.join(Y,$.dir,$.template).replace(YD0,tN0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",tN0(12),$.postfix?"-"+$.postfix:""].join("");return E6.join(Y,$.dir,U)}function En($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function GD0($){if(!r8($.name)){let Y=$.name;if(E6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=E6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!r8($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(YD0))throw Error(`Invalid template, found "${$.template}".`)}if(!r8($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=r8($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=r8($.prefix)?"":En("prefix",$.prefix),$.postfix=r8($.postfix)?"":En("postfix",$.postfix),$.template=r8($.template)?void 0:En("template",$.template)}function eN0($,Y,U,z){if(r8(Y))return z(null);UO1(Y,U,function(Q,J){if(Q)return z(Q);let I=E6.relative(U,J);if(I.startsWith("..")||E6.isAbsolute(I))return z(Error(`${$} option must be relative to "${U}", found "${I}".`));z(null,I)})}function $D0($,Y,U){if(r8(Y))return;let z=zO1(Y,U),Q=E6.relative(U,z);if(Q.startsWith("..")||E6.isAbsolute(Q))thrLine truncated
*/var V4=I0("fs"),PB=I0("os"),E6=I0("path"),aN0=I0("crypto"),O9={fs:V4.constants,os:PB.constants},YD0=/XXXXXX/,UD0=(O9.O_CREAT||O9.fs.O_CREAT)|(O9.O_EXCL||O9.fs.O_EXCL)|(O9.O_RDWR||O9.fs.O_RDWR),dM1=PB.platform()==="win32",mM1=O9.EBADF||O9.os.errno.EBADF,lM1=O9.ENOENT||O9.os.errno.ENOENT,mI=[],zD0=V4.rmdirSync.bind(V4),QD0=!1;function oM1($,Y){return V4.rm($,{recursive:!0},Y)}function JD0($){return V4.rmSync($,{recursive:!0})}function _n($,Y){let U=lI($,Y),z=U[0],Q=U[1];QO1(z,function(J,I){if(J)return Q(J);let K=I.tries;(function G(){try{let H=KD0(I);V4.stat(H,function(W){if(!W){if(K-- >0)return G();return Q(Error("Could not get a unique tmp filename, max tries reached "+H))}Q(null,H)})}catch(H){Q(H)}})()})}function vn($){let Y=lI($),U=Y[0],z=JO1(U),Q=z.tries;do{let J=KD0(z);try{V4.statSync(J)}catch(I){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function rM1($,Y){let U=lI($,Y),z=U[0],Q=U[1];_n(z,function(I,K){if(I)return Q(I);V4.open(K,UD0,z.mode||384,function(H,W){if(H)return Q(H);if(z.discardDescriptor)return V4.close(W,function(Z){return Q(Z,K,void 0,Cn(K,-1,z,!1))});else{let X=z.discardDescriptor||z.detachDescriptor;Q(null,K,W,Cn(K,X?-1:W,z,!1))}})})}function sM1($){let Y=lI($),U=Y[0],z=U.discardDescriptor||U.detachDescriptor,Q=vn(U),J=V4.openSync(Q,UD0,U.mode||384);if(U.discardDescriptor)V4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:Cn(Q,z?-1:J,U,!0)}}function aM1($,Y){let U=lI($,Y),z=U[0],Q=U[1];_n(z,function(I,K){if(I)return Q(I);V4.mkdir(K,z.mode||448,function(H){if(H)return Q(H);Q(null,K,ID0(K,z,!1))})})}function tM1($){let Y=lI($),U=Y[0],z=vn(U);return V4.mkdirSync(z,U.mode||448),{name:z,removeCallback:ID0(z,U,!0)}}function eM1($,Y){let U=function(z){if(z&&!Rn(z))return Y(z);Y()};if(0<=$[0])V4.close($[0],function(){V4.unlink($[1],U)});else V4.unlink($[1],U)}function $O1($){let Y=null;try{if(0<=$[0])V4.closeSync($[0])}catch(U){if(!IO1(U)&&!Rn(U))throw U}finally{try{V4.unlinkSync($[1])}catch(U){if(!Rn(U))Y=U}}if(Y!==null)throw Y}function Cn($,Y,U,z){let Q=BB($O1,[Y,$],z),J=BB(eM1,[Y,$],z,Q);if(!U.keep)mI.unshift(Q);return z?Q:J}function ID0($,Y,U){let z=Y.unsafeCleanup?oM1:V4.rmdir.bind(V4),Q=Y.unsafeCleanup?JD0:zD0,J=BB(Q,$,U),I=BB(z,$,U,J);if(!Y.keep)mI.unshift(J);return U?J:I}function BB($,Y,U,z){let Q=!1;return function J(I){if(!Q){let K=z||J,G=mI.indexOf(K);if(G>=0)mI.splice(G,1);if(Q=!0,U||$===zD0||$===JD0)return $(Y);else return $(Y,I||function(){})}}}function YO1(){if(!QD0)return;while(mI.length)try{mI[0]()}catch($){}}function tN0($){let Y=[],U=null;try{U=aN0.randomBytes($)}catch(z){U=aN0.pseudoRandomBytes($)}for(let z=0;z<$;z++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[z]%62]);return Y.join("")}function r8($){return typeof $>"u"}function lI($,Y){if(typeof $==="function")return[{},$];if(r8($))return[{},Y];let U={};for(let z of Object.getOwnPropertyNames($))U[z]=$[z];return[U,Y]}function UO1($,Y,U){let z=E6.isAbsolute($)?$:E6.join(Y,$);V4.stat(z,function(Q){if(Q)V4.realpath(E6.dirname(z),function(J,I){if(J)return U(J);U(null,E6.join(I,E6.basename(z)))});else V4.realpath(z,U)})}function zO1($,Y){let U=E6.isAbsolute($)?$:E6.join(Y,$);try{return V4.statSync(U),V4.realpathSync(U)}catch(z){let Q=V4.realpathSync(E6.dirname(U));return E6.join(Q,E6.basename(U))}}function KD0($){let Y=$.tmpdir;if(!r8($.name))return E6.join(Y,$.dir,$.name);if(!r8($.template))return E6.join(Y,$.dir,$.template).replace(YD0,tN0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",tN0(12),$.postfix?"-"+$.postfix:""].join("");return E6.join(Y,$.dir,U)}function En($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function GD0($){if(!r8($.name)){let Y=$.name;if(E6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=E6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!r8($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(YD0))throw Error(`Invalid template, found "${$.template}".`)}if(!r8($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=r8($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=r8($.prefix)?"":En("prefix",$.prefix),$.postfix=r8($.postfix)?"":En("postfix",$.postfix),$.template=r8($.template)?void 0:En("template",$.template)}function eN0($,Y,U,z){if(r8(Y))return z(null);UO1(Y,U,function(Q,J){if(Q)return z(Q);let I=E6.relative(U,J);if(I.startsWith("..")||E6.isAbsolute(I))return z(Error(`${$} option must be relative to "${U}", found "${I}".`));z(null,I)})}function $D0($,Y,U){if(r8(Y))return;let z=zO1(Y,U),Q=E6.relative(U,z);if(Q.startsWith("..")||E6.isAbsolute(Q))thrLine truncated
`)}let z=[];Y.forEach((Q,J)=>{let I=$.length+J+1,K=J===0?"⏳ ":"";z.push(`${K}${I}. ${Q}`)});for(let Q=$.length-1;Q>=0;Q--){let J=Q+1;z.push(`${J}. ${$[Q]}`)}return z.join(`
`)}function nn($,Y,U,z,Q){let J=$?.operator||Y?.operator||U?.operator,I=J?.name||J?.id||U?.operatorName||"",K=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(K==="合思审批节点"||K==="外部审批节点"||K.includes("合思审批")||K.includes("外部审批"))K="";if((!K||K==="提交人"||K==="审批节点")&&I&&z){let M=z.find((w)=>w.operator?.name===I&&w.nodeName&&w.nodeName.trim()!=="提交人"&&!w.isEbot&&w.rawAction!=="freeflow.reject");if(M?.nodeName)K=M.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let M=H.split(":");if(M.length>1)H=M.slice(1).join(":").trim()}let W=H;if(K&&I)W=`${K}(${I}) ❌: ${H}`;else if(I)W=`${I} ❌: ${H}`;else if(K)W=`${K} ❌: ${H}`;else W=H;let X=$?.rejectTargetNodeName||Y?.targetNodeName||"提交人",Z=$?.rejectTargetOperator?.name||Y?.targetOperator?.name||Q?.submitter?.name,q=Z?`${X}(${Z})`:X,V=$?.resubmitRuleText||Y?.resubmitRuleText||(I?`重新提交后由${I}继续审批`:"重新提交后继续审批");return{comment:`${W}
↳ 驳回至: ${q}
↳ ${V}`,operator:J}}function dD0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),z=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let I=J.approver?.name||J.approver?.id||"待定",K=(J.name||$.currentNode||"").trim(),G=K?`${K}(${I})`:I,W=J.type?.toUpperCase()==="PAYING"||K.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let I=$.currentNode.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${I}`)}return Q}function Kz($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let F=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:pD0(typeof F==="string"?F:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let z=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),I=String(Y.state||"").toUpperCase(),K=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||I==="草稿"||I==="已撤回"||I==="已取消",G=J==="REJECTED"||J==="TERMINATED"||I==="审批驳回"||I==="已驳回",H=!K&&!G&&(J==="PAID"||I==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!K&&!G&&!H&&(J==="PAYING"||I==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!K&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||I==="已完成"||I==="审批通过");for(let q=0;q<z.length;q++){let V=z[q];if(!V)continue;let F=Number(V.createdAt)||0,M=V.document||{},w=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof w.nodeId==="string"?String(w.nodeId):void 0,D=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=N||D,T=P?Q.find((A0)=>A0.nodeId&&(A0.nodeId===P||P.includes(A0.nodeId))):void 0,A=T?.time??F,j=z[q+1],C=j?Number(j.createdAt)||1/0:1/0,b=q===z.length-1,x=Q.find((A0)=>(A0.time??0)>A+5000&&A0.isEbot&&(A0.nodeName?.includes("智能")||A0.nodeName?.includes("AI")||A0.action?.includes("智能")||A0.comment?.includes("AI")||A0.comment?.includes("approval-result"))&&!A0.nodeName?.includes("费用标准检查")&&!A0.nodeName?.includes("标准检查")&&!A0.nodeName?.includes("预算"));if(x){if(b=!1,(x.time??1/0)<C)C=x.time}let S=V.result||{},i=S.decision||V.aiDecision||"-",c=typeof i==="string"?i:"-",z0=c.toUpperCase(),k=z0==="REJECT"||z0==="驳回",d=z0==="APPROVE"||z0==="通过",t=z0==="EXEMPT_APPROVE"||z0==="免审通过"||z0==="备注通过",$0=V.taskMode||V.finalExecutionMode||"",p=String($0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||$0==="automatic"||$0==="fully_automatic",e="-";if(d||t)e="添加评论";else if(k)e=p?"驳回":"添加评论";else if(z0==="REVIEW"||z0==="转交复核")e="转交复核";let y=typeof w.status==="object"&&w.status!==null?String(w.status.type||w.status.label||"").toUpperCase():"",s=typeof w.status==="object"&&w.status!==null?String(w.status.sourceStatus||""):"",Y0=M.manualApprovalStatus||S.manualApprovalStatus||V.manualApprovalStatus,N0=typeof Y0==="string"?Y0.toUpperCase():"",E0=N0==="CANCELLED"||N0==="CANCELED"||N0==="已取消"||N0==="已撤回"||N0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||s.includes("撤回")||s.includes("取消"),G0=N0==="APPROVED"||N0==="已支付/审批完成"||N0==="已通过"||N0==="已完成"||N0==="已支付"||y==="APPROVED",i0=!(s.includes("补偿")||s.includes("已支付"))&&(N0==="TERMINATED"||N0==="REJECTED"||N0==="REJECT"||N0==="已驳回"||N0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),Y1=T?1000:60000,a=Q.filter((A0)=>{let Q0=A0.time??0;return Q0>=A-Y1&&Q0<C}),W0="-",F0="-",f0=!1,u0,c0,D1=d||t,k1=Q.filter((A0)=>(A0.time??0)>A+5000),u1=k1.some((A0)=>A0.rawAction==="freeflow.retract"||A0.action==="单据撤回"),b1=k1.some((A0)=>A0.rawAction==="freeflow.submit"||A0.action==="提交送审");if(D1&&b&&(u1||b1))f0=!0,u0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(p&&k)W0="无操作",F0="-";else{let A0=a.filter((v)=>(v.time??0)>=A-1000&&!v.isEbot&&v.rawAction!=="freeflow.submit"&&v.action!=="提交送审"&&!((v.rawAction==="freeflow.comment"||v.action==="发表评论")&&!v.comment)&&!((v.rawAction==="freeflow.print"||v.action==="打印提醒")&&!v.comment)&&!(v.rawAction==="freeflow.carbonCopy"||v.rawAction==="freeflow.cc"||v.action==="抄送通知")),Q0=A0.find((v)=>v.rawAction==="freeflow.retract"||v.action==="单据撤回"),B=A0.find((v)=>v.rawAction==="freeflow.reject"||v.action==="审批驳回");if(!b)if(B||!Y&&i0){W0="审批驳回",f0=!1,u0=void 0;let v=nn(B,void 0,w,Q,Y);F0=v.commen Line truncated
`,{mode:384}),Y}function zp($){let Y=WA0();for(let U of Y){if(!V$(U))continue;for(let z of xB(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=N9(U,z);try{let J=uB(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function g3($,Y){let U=zp($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(uB(U,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=en.parse(Q);return QA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Yp="SEAL_USE_ENTERPRISES_DIR",JA0="SEAL_HOME_ENTERPRISES_DIR",IA0="SEAL_USE_USER_ENTERPRISES_DIR",KA0="SEAL_HOME_USER_ENTERPRISES_DIR",GA0="SEAL_USE_CONFIG_FILE",HA0="SEAL_HOME_CONFIG_FILE",aI,fB,kB,UA0;var y3=m(()=>{$p();aI=N9(bB(),".config","seal-use","enterprises"),fB=N9(bB(),".config","seal-home","enterprises"),kB=N9(bB(),".config","seal-use","config.json"),UA0=N9(bB(),".config","seal-home","config.json")});function u2($,Y,U=[]){let z=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-home config mode stateful` to enable a default enterprise.");let I=$[0];if(I)return I;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as Qp,mkdirSync as bN1,readFileSync as iN1,renameSync as cN1,unlinkSync as nN1,writeFileSync as pN1}from"node:fs";import{homedir as dN1}from"node:os";import{dirname as mN1,join as lN1}from"node:path";function _Z(){let $=process.env[oN1]?.trim();if($)return $;return rN1}function XA0($=new Date){return $.toISOString().slice(0,10)}function ZA0($=Jp,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function qA0($=_Z()){if(!Qp($))return{};try{let Y=iN1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function sN1($,Y){let U={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)U[z]=J}return U}function aN1($,Y=_Z()){let U=mN1(Y);if(!Qp(U))bN1(U,{recursive:!0,mode:448});let z=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{pN1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),cN1(z,Y)}catch(Q){try{if(Qp(z))nN1(z)}catch{}throw Q}}function VA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=_Z(),z=qA0(U),Q=XA0(Y),J=ZA0(Jp,Y),I=sN1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,aN1(I,U)}catch{}}function tN1($,Y=Jp,U=new Date){let z=new Map;try{let Q=qA0(),J=ZA0(Y,U),I=XA0(U),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function LA0($,Y,U){let z=U??tN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var oN1="SEAL_USE_USAGE_FILE",rN1,Jp=7;var iB=m(()=>{rN1=lN1(dN1(),".config","seal-use","usage.json")});function eN1($,Y){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>Y?U:U.toLowerCase())}function $D1($,Y){return Y?$:$.toLowerCase()}function YD1($,Y,U,z){let Q=$D1($,z),J=Y.filter((I)=>Q.includes(I));if(U==="all"&&J.length!==Y.length)return[];return J}function UD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function zD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let U=UD1($.value),z=[];return U.forEach((Q,J)=>{let I=YD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(U.length,J+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:cB(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:U.slice(K,J).map((W)=>cB(W,Y.maxChars)),line:cB(Q,Y.maxChars),after:Y.snippetOnly?[]:U.slice(J+1,G).map((W)=>cB(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function cB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function QD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function wA0($){return $.rules.flatMap((Y,U)=>{let z=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName} / ${Y.scope}`,field:"h Line truncated
↳ ${V}`,operator:J}}function dD0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),z=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let I=J.approver?.name||J.approver?.id||"待定",K=(J.name||$.currentNode||"").trim(),G=K?`${K}(${I})`:I,W=J.type?.toUpperCase()==="PAYING"||K.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let I=$.currentNode.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${I}`)}return Q}function Kz($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let F=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:pD0(typeof F==="string"?F:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let z=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),I=String(Y.state||"").toUpperCase(),K=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||I==="草稿"||I==="已撤回"||I==="已取消",G=J==="REJECTED"||J==="TERMINATED"||I==="审批驳回"||I==="已驳回",H=!K&&!G&&(J==="PAID"||I==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!K&&!G&&!H&&(J==="PAYING"||I==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!K&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||I==="已完成"||I==="审批通过");for(let q=0;q<z.length;q++){let V=z[q];if(!V)continue;let F=Number(V.createdAt)||0,M=V.document||{},w=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof w.nodeId==="string"?String(w.nodeId):void 0,D=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=N||D,T=P?Q.find((A0)=>A0.nodeId&&(A0.nodeId===P||P.includes(A0.nodeId))):void 0,A=T?.time??F,j=z[q+1],C=j?Number(j.createdAt)||1/0:1/0,b=q===z.length-1,x=Q.find((A0)=>(A0.time??0)>A+5000&&A0.isEbot&&(A0.nodeName?.includes("智能")||A0.nodeName?.includes("AI")||A0.action?.includes("智能")||A0.comment?.includes("AI")||A0.comment?.includes("approval-result"))&&!A0.nodeName?.includes("费用标准检查")&&!A0.nodeName?.includes("标准检查")&&!A0.nodeName?.includes("预算"));if(x){if(b=!1,(x.time??1/0)<C)C=x.time}let S=V.result||{},i=S.decision||V.aiDecision||"-",c=typeof i==="string"?i:"-",z0=c.toUpperCase(),k=z0==="REJECT"||z0==="驳回",d=z0==="APPROVE"||z0==="通过",t=z0==="EXEMPT_APPROVE"||z0==="免审通过"||z0==="备注通过",$0=V.taskMode||V.finalExecutionMode||"",p=String($0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||$0==="automatic"||$0==="fully_automatic",e="-";if(d||t)e="添加评论";else if(k)e=p?"驳回":"添加评论";else if(z0==="REVIEW"||z0==="转交复核")e="转交复核";let y=typeof w.status==="object"&&w.status!==null?String(w.status.type||w.status.label||"").toUpperCase():"",s=typeof w.status==="object"&&w.status!==null?String(w.status.sourceStatus||""):"",Y0=M.manualApprovalStatus||S.manualApprovalStatus||V.manualApprovalStatus,N0=typeof Y0==="string"?Y0.toUpperCase():"",E0=N0==="CANCELLED"||N0==="CANCELED"||N0==="已取消"||N0==="已撤回"||N0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||s.includes("撤回")||s.includes("取消"),G0=N0==="APPROVED"||N0==="已支付/审批完成"||N0==="已通过"||N0==="已完成"||N0==="已支付"||y==="APPROVED",i0=!(s.includes("补偿")||s.includes("已支付"))&&(N0==="TERMINATED"||N0==="REJECTED"||N0==="REJECT"||N0==="已驳回"||N0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),Y1=T?1000:60000,a=Q.filter((A0)=>{let Q0=A0.time??0;return Q0>=A-Y1&&Q0<C}),W0="-",F0="-",u0=!1,b0,c0,D1=d||t,k1=Q.filter((A0)=>(A0.time??0)>A+5000),u1=k1.some((A0)=>A0.rawAction==="freeflow.retract"||A0.action==="单据撤回"),b1=k1.some((A0)=>A0.rawAction==="freeflow.submit"||A0.action==="提交送审");if(D1&&b&&(u1||b1))u0=!0,b0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(p&&k)W0="无操作",F0="-";else{let A0=a.filter((v)=>(v.time??0)>=A-1000&&!v.isEbot&&v.rawAction!=="freeflow.submit"&&v.action!=="提交送审"&&!((v.rawAction==="freeflow.comment"||v.action==="发表评论")&&!v.comment)&&!((v.rawAction==="freeflow.print"||v.action==="打印提醒")&&!v.comment)&&!(v.rawAction==="freeflow.carbonCopy"||v.rawAction==="freeflow.cc"||v.action==="抄送通知")),Q0=A0.find((v)=>v.rawAction==="freeflow.retract"||v.action==="单据撤回"),B=A0.find((v)=>v.rawAction==="freeflow.reject"||v.action==="审批驳回");if(!b)if(B||!Y&&i0){W0="审批驳回",u0=!1,b0=void 0;let v=nn(B,void 0,w,Q,Y);F0=v.commen Line truncated
`,{mode:384}),Y}function zp($){let Y=WA0();for(let U of Y){if(!V$(U))continue;for(let z of xB(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=D9(U,z);try{let J=uB(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function g3($,Y){let U=zp($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(uB(U,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=en.parse(Q);return QA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Yp="SEAL_USE_ENTERPRISES_DIR",JA0="SEAL_HOME_ENTERPRISES_DIR",IA0="SEAL_USE_USER_ENTERPRISES_DIR",KA0="SEAL_HOME_USER_ENTERPRISES_DIR",GA0="SEAL_USE_CONFIG_FILE",HA0="SEAL_HOME_CONFIG_FILE",aI,fB,kB,UA0;var y3=m(()=>{$p();aI=D9(bB(),".config","seal-use","enterprises"),fB=D9(bB(),".config","seal-home","enterprises"),kB=D9(bB(),".config","seal-use","config.json"),UA0=D9(bB(),".config","seal-home","config.json")});function u2($,Y,U=[]){let z=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-home config mode stateful` to enable a default enterprise.");let I=$[0];if(I)return I;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{existsSync as Qp,mkdirSync as bN1,readFileSync as iN1,renameSync as cN1,unlinkSync as nN1,writeFileSync as pN1}from"node:fs";import{homedir as dN1}from"node:os";import{dirname as mN1,join as lN1}from"node:path";function _Z(){let $=process.env[oN1]?.trim();if($)return $;return rN1}function XA0($=new Date){return $.toISOString().slice(0,10)}function ZA0($=Jp,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function qA0($=_Z()){if(!Qp($))return{};try{let Y=iN1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function sN1($,Y){let U={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)U[z]=J}return U}function aN1($,Y=_Z()){let U=mN1(Y);if(!Qp(U))bN1(U,{recursive:!0,mode:448});let z=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{pN1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),cN1(z,Y)}catch(Q){try{if(Qp(z))nN1(z)}catch{}throw Q}}function VA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=_Z(),z=qA0(U),Q=XA0(Y),J=ZA0(Jp,Y),I=sN1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,aN1(I,U)}catch{}}function tN1($,Y=Jp,U=new Date){let z=new Map;try{let Q=qA0(),J=ZA0(Y,U),I=XA0(U),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function LA0($,Y,U){let z=U??tN1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var oN1="SEAL_USE_USAGE_FILE",rN1,Jp=7;var iB=m(()=>{rN1=lN1(dN1(),".config","seal-use","usage.json")});function eN1($,Y){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>Y?U:U.toLowerCase())}function $D1($,Y){return Y?$:$.toLowerCase()}function YD1($,Y,U,z){let Q=$D1($,z),J=Y.filter((I)=>Q.includes(I));if(U==="all"&&J.length!==Y.length)return[];return J}function UD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function zD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let U=UD1($.value),z=[];return U.forEach((Q,J)=>{let I=YD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(U.length,J+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:cB(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:U.slice(K,J).map((W)=>cB(W,Y.maxChars)),line:cB(Q,Y.maxChars),after:Y.snippetOnly?[]:U.slice(J+1,G).map((W)=>cB(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function cB($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function QD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function wA0($){return $.rules.flatMap((Y,U)=>{let z=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName} / ${Y.scope}`,field:"h Line truncated
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==z.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:z}}async function Gp($,Y,U){let z=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",Q=await J$($,z);if(U||Q.length>0)return AA0(Q,U,Y.id);if(Y.environment==="test"||Y.id.toLowerCase().includes("test")){console.error(`[webhook-replay] 测试企业「${Y.name}」未配置 Webhook 通道,正在自动创建「(Seal测-回放通道)」...`);let J=(Y.seal.url??Y.source?.sealUrl??`https://${Y.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,"");return await FM($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new w4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function tI($){let{query:Y,sourceClient:U,targetClient:z,sourceCorp:Q,targetCorp:J,webhookSelector:I,snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await H4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await H4(U,P));else if(Y.sn){let T=(await i4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((A)=>A.sourceDocumentSN===Y.sn||A.sourceDocumentId===Y.sn||A.document?.sourceDocumentSN===Y.sn||A.document?.sn===Y.sn);if(!T)throw Error(`在企业「${Q.name}」中未找到单据编号为「${Y.sn}」的审批记录。`);q.push(T)}else if(Y.sns&&Y.sns.length>0)for(let P of Y.sns){let A=(await i4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((j)=>j.sourceDocumentSN===P||j.sourceDocumentId===P||j.document?.sourceDocumentSN===P||j.document?.sn===P);if(!A)throw Error(`在企业「${Q.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(A)}else if(Y.limit!==void 0){let P=await i4(U,{limit:Y.limit,status:Y.status,startDate:Y.startDate,endDate:Y.endDate});if(!P.records.length)throw Error(`在企业「${Q.name}」中未检索到符合条件的审批记录。`);q=P.records}else throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let V=q.map((P)=>({run:P,doc:Ip(P,{snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:I??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let j=await J$(z,J.seal.endpoints.approvalStylePreferences);if(j.length>0){let C=AA0(j,I,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:j,doc:C})=>({originalRecord:{id:j.id,sourceSystem:j.sourceSystem,sourceDocumentSN:j.sourceDocumentSN,sourceDocumentId:j.sourceDocumentId},document:C,success:!0})),A=T.length===1;return{dryRun:!0,success:!0,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:P,totalCount:T.length,successCount:T.length,failureCount:0,originalRecord:A?T[0].originalRecord:void 0,document:A?T[0].document:void 0,records:T}}let F=await Gp(z,J,I),M={id:F.id,name:F.name,mode:F.mode,incomingDocumentWebhookUrl:F.incomingDocumentWebhook.url},w=[],N=0,O=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${F.name}」推送单据: ${T.documentSN}...`);try{let A=await Kp(F.incomingDocumentWebhook.url,F.secret,T,Z,A6(J.seal));w.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},pushResult:A,success:!0}),N+=1}catch(A){let j=A instanceof Error?A.message:String(A);w.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},error:j,success:!1}),O+=1}}let D=w.length===1;return{success:O===0,dryRun:!1,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:M,totalCount:w.length,successCount:N,failureCount:O,originalRecord:D?w[0].originalRecord:void 0,replayedDocument:D?w[0].replayedDocument:void 0,pushResult:D?w[0].pushResult:void 0,records:w}}var VD1;var SZ=m(()=>{nB();L$();X6();VD1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var BA0,Z14,FD1,q14;var PA0=m(()=>{A$();BA0=L.object({level:L.enum(["error","warning" Line truncated
* ==============================================================================
* Seal 官方标准规则校验器 (Official Standard Rule Linter)
@@ -878,13 +878,13 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
export default lintRule;
`}});import{existsSync as Wz,mkdirSync as _D1,readFileSync as vD1,readdirSync as RA0,rmSync as hD1,unlinkSync as SD1,writeFileSync as gD1}from"node:fs";import{homedir as yD1}from"node:os";import{isAbsolute as kD1,join as f6,resolve as xD1}from"node:path";import{pathToFileURL as EA0}from"node:url";function _A0($=i$){let Y=[],U=[];try{if(!Wz($))_D1($,{recursive:!0});let z=Object.keys(Zp);for(let[J,I]of Object.entries(Zp)){let K=f6($,J),G=!0;if(Wz(K))try{if(vD1(K,"utf8")===I)G=!1}catch{G=!0}if(G)gD1(K,I,"utf8");Y.push(J)}let Q=RA0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=f6($,J.name);try{if(J.isDirectory())hD1(I,{recursive:!0,force:!0});else SD1(I);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function vA0($={syncOfficial:!0}){if($.syncOfficial!==!1)_A0();let Y=[{name:"builtin",type:"builtin",path:f6(i$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:f6(i$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:f6(i$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[b$,mB];for(let z of U)if(Wz(z))try{let Q=RA0(z,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:f6(z,I),description:`用户自定义规则校验器 (${I})`})}}}catch{}return Y}function uD1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:f6(i$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:f6(i$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:f6(i$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(kD1(Y)||Y.startsWith("./")||Y.startsWith("../")){let z=xD1(Y);if(Wz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Wz(`${z}${Q}`))return{path:`${z}${Q}`}}let U=[f6(b$,`${Y}.ts`),f6(b$,`${Y}.js`),f6(b$,`${Y}.mjs`),f6(mB,`${Y}.ts`),f6(mB,`${Y}.js`),f6(mB,`${Y}.mjs`)];for(let z of U)if(Wz(z))return{path:z};return{}}async function Vp($){_A0();let Y=uD1($??"builtin");if(Y.isOfficial){let z=Y.officialKind==="strict"?TA0:Y.officialKind==="hlab"?jA0:eI,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&Wz(J))try{let K=await import(EA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:CA0(G,z)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:z}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI};try{let Q=await import(EA0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️ [linter] 自定义校验器 "${U}" 未导出标准函数 (default / lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI};return{name:$??"custom",type:"custom",filePath:U,linter:CA0(J,eI)}}catch(z){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:eI}}}function CA0($,Y){return async(U,z)=>{try{let Q=await $(U,z);if(Q&&typeof Q==="object"&&typeof Q.score==="number"&&Array.isArray(Q.issues))return Q;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,z)}catch(Q){return console.error("⚠️ [linter] 自定义校验器执行异常:",Q),Y(U,z)}}}var b$,fD1="official",i$,mB;var Lp=m(()=>{Hp();Xp();qp();Wp();b$=f6(yD1(),".config","seal-use","linters"),i$=f6(b$,fD1),mB=f6(process.cwd(),"linters")});async function Fp($,Y,U){let z=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}async function hA0($,Y,U,z){let Q=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(let q of $){let V=await Fp(q,Y,U);K+=V.score;let F=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");else if(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");let M=F.every((w)=>w.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:M,issues:F})}else I.push({...V,passed:M,issues:F})}let G=$.length,H=G===0?100:Math.round(K/G),W=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`,"utf8"),U}function kA0($){return $.map((Y,U)=>{let z;if(typeof Y.code==="number")z=`#${String(Y.code).padStart(4,"0")}`;else if(typeof Y.code==="string")z=Y.code.startsWith("#")?Y.code:`#${Y.code}`;else z=`#${String(U+1).padStart(4,"0")}`;return{id:Y.id,code:z,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var xA0=()=>{};var fA0,D5;var $K=m(()=>{fA0=class fA0 extends Error{errors;warnings;constructor($,Y=[]){super([`webhook 资源包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};D5=fA0});var cA0=E((i14,iA0)=>{iA0.exports=lB;function lB(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}lB.prototype.go=function($){if(this.pending<this.max)bA0(this,$);else this.waiting.push($)};lB.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};lB.prototype.hold=function(){return uA0(this)};function uA0($){$.pending+=1;var Y=!1;return U;function U(Q){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||Q,$.pending-=1,$.waiting.length>0&&$.pending<$.max)bA0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(z)}}function z(Q){Q($.error)}}function bA0($,Y){Y(uA0($))}});var dA0=E((oD1)=>{var Op=I0("fs"),Np=I0("util"),nA0=I0("stream"),pA0=nA0.Readable,mD1=nA0.PassThrough,lD1=cA0(),oB=I0("events").EventEmitter;oD1.BufferSlicer=UK;oD1.FdSlicer=YK;Np.inherits(YK,oB);function YK($){oB.call(this),this.fd=$,this.pend=new lD1,this.pend.max=1,this.refCount=0}YK.prototype.read=function($,Y,U,z,Q){var J=this;J.pend.go(function(I){Op.read(J.fd,$,Y,U,z,function(K,G,H){I(),Q(K,G,H)})})};YK.prototype.createReadStream=function($){return new gZ(this,$)};YK.prototype.ref=function(){this.refCount+=1};YK.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;Op.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};Np.inherits(gZ,pA0);function gZ($,Y){Y=Y||{},pA0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}gZ.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(z){var Q=Buffer.allocUnsafe(U);Op.read(Y.context.fd,Q,0,U,Y.pos,function(J,I){if(J)Y.destroy(J);else if(I===0)Y.push(null),Y._cleanup();else Y.pos+=I,Y.push(Q.slice(0,I));z()})})};gZ.prototype._destroy=function($,Y){this._cleanup(),Y($)};gZ.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};Np.inherits(UK,oB);function UK($){oB.call(this),this.refCount=0,this.buffer=$}UK.prototype.read=function($,Y,U,z,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(z<0)throw RangeError("position is negative: "+z);if(Y+U>$.length)U=$.length-Y;if(z+U>this.buffer.length)U=this.buffer.length-z;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,z,z+U),setImmediate(function(){Q(null,U)})};UK.prototype.createReadStream=function($){$=$||{};var Y=new mD1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),z=65536,Q=0;while(!0){var J=Q+z;if(J>=U.length){if(Q<U.length)Y.write(U.slice(Q,U.length));break}Y.write(U.slice(Q,J)),Q=J}return Y.end(),Y};UK.prototype.ref=function(){this.refCount+=1};UK.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var lA0=E((n14,mA0)=>{var aD1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462, Line truncated
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};D5=fA0});var cA0=E((i14,iA0)=>{iA0.exports=lB;function lB(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}lB.prototype.go=function($){if(this.pending<this.max)bA0(this,$);else this.waiting.push($)};lB.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};lB.prototype.hold=function(){return uA0(this)};function uA0($){$.pending+=1;var Y=!1;return U;function U(Q){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||Q,$.pending-=1,$.waiting.length>0&&$.pending<$.max)bA0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(z)}}function z(Q){Q($.error)}}function bA0($,Y){Y(uA0($))}});var dA0=E((oD1)=>{var Op=I0("fs"),Np=I0("util"),nA0=I0("stream"),pA0=nA0.Readable,mD1=nA0.PassThrough,lD1=cA0(),oB=I0("events").EventEmitter;oD1.BufferSlicer=UK;oD1.FdSlicer=YK;Np.inherits(YK,oB);function YK($){oB.call(this),this.fd=$,this.pend=new lD1,this.pend.max=1,this.refCount=0}YK.prototype.read=function($,Y,U,z,Q){var J=this;J.pend.go(function(I){Op.read(J.fd,$,Y,U,z,function(K,G,H){I(),Q(K,G,H)})})};YK.prototype.createReadStream=function($){return new gZ(this,$)};YK.prototype.ref=function(){this.refCount+=1};YK.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;Op.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};Np.inherits(gZ,pA0);function gZ($,Y){Y=Y||{},pA0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}gZ.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(z){var Q=Buffer.allocUnsafe(U);Op.read(Y.context.fd,Q,0,U,Y.pos,function(J,I){if(J)Y.destroy(J);else if(I===0)Y.push(null),Y._cleanup();else Y.pos+=I,Y.push(Q.slice(0,I));z()})})};gZ.prototype._destroy=function($,Y){this._cleanup(),Y($)};gZ.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};Np.inherits(UK,oB);function UK($){oB.call(this),this.refCount=0,this.buffer=$}UK.prototype.read=function($,Y,U,z,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(z<0)throw RangeError("position is negative: "+z);if(Y+U>$.length)U=$.length-Y;if(z+U>this.buffer.length)U=this.buffer.length-z;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,z,z+U),setImmediate(function(){Q(null,U)})};UK.prototype.createReadStream=function($){$=$||{};var Y=new mD1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),z=65536,Q=0;while(!0){var J=Q+z;if(J>=U.length){if(Q<U.length)Y.write(U.slice(Q,U.length));break}Y.write(U.slice(Q,J)),Q=J}return Y.end(),Y};UK.prototype.ref=function(){this.refCount+=1};UK.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var lA0=E((n14,mA0)=>{var aD1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462, Line truncated
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ "},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "},ibm1161:"cp1161",csibm1161:"cp1161",cp1162:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"},ibm1162:"cp1162",csibm1162:"cp1162",cp1163:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1163:"cp1163",csiLine truncated
\v\f\r\x0E\x0F\x10ỨỰỲỶỸÝỴ\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ`},georgianacademy:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},georgianps:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},pt154:{type:"_sbcs",chars:"ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"},viscii:{type:"_sbcs",chars:`\x00\x01Ẳ\x03\x04ẴẪ\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13Ỷ\x15\x16\x17\x18Ỹ\x1A\x1B\x1C\x1DỴ\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ`},iso646cn:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},iso646jp:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var TB0=E((rA1)=>{var Ud=x3().Buffer;rA1._dbcs=u3;var U8=-1,PB0=-2,p$=-10,h8=-1000,HK=Array(256),xZ=-1;for(kZ=0;kZ<256;kZ++)HK[kZ]=U8;var kZ;function u3($,Y){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var U=$.table();this.decodeTables=[],this.decodeTables[0]=HK.slice(0),this.decodeTableSeq=[];for(var z=0;z<U.length;z++)this._addDecodeChunk(U[z]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Q=this.decodeTables.length;this.decodeTables.push(HK.slice(0));var J=this.decodeTables.length;this.decodeTables.push(HK.slice(0));var I=this.decodeTables[0];for(var z=129;z<=254;z++){var K=this.decodeTables[h8-I[z]];for(var G=48;G<=57;G++){if(K[G]===U8)K[G]=h8-Q;else if(K[G]>h8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[h8-K[G]];for(var W=129;W<=254;W++){if(H[W]===U8)H[W]=h8-J;else if(H[W]===h8-J)continue;else if(H[W]>h8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[h8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===U8)X[Z]=PB0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var z=0;z<$.encodeSkipVals.length;z++){var V=$.encodeSkipVals[z];if(typeof V==="number")q[V]=!0;else for(var G=V.from;G<=V.to;G++)q[G]=!0}if(this._fillEncodeTable(0,0,q),$.encodeAdd){for(var F in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,F))this._setEncodeChar(F.charCodeAt(0),$.encodeAdd[F])}if(this.defCharSB=this.encodeTable[0][Y.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===U8)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===U8)this.defCharSB=63}u3.prototype.encoder=KP;u3.prototype.decoder=zd;u3.prototype._getDecodeTrieNode=function($){var Y=[];for(;$>0;$>>>=8)Y.push($&255);if(Y.length==0)Y.push(0);var U=this.decodeTables[0];for(var z=Y.length-1;z>0;z--){var Q=U[Y[z]];if(Q==U8)U[Y[z]]=h8-this.decodeTables.length,this.decodeTables.push(U=HK.slice(0));else if(Q<=h8)U=this.decodeTables[h8-Q];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};u3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var z=1;z<$.length;z++){var Q=$[z];if(typeof Q==="string")for(var J=0;J<Q.length;){var I=Q.charCodeAt(J++);if(I>=55296&&I<56320){var K=Q.charCodeAt(J++);if(K>=56320&&K<57344)U[Y++]=65536+(I-55296)*1024+(K-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(I>4080&&I<=4095){var G=4095-I+2,H=[];for(var W=0;W<G;W++)H.push(Q.charCodeAt(J++));U[Y++]=p$-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=I}else if(typeof Q==="number"){var X=U[Y-1]+1;for(var J=0;J<Q;J++)U[Y++]=X++}else throw Error("Incorrect type '"+typeof Q+"' given in "+this.encodingName+" at chunk "+$[0])}if(Y>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`;super(Y);this.name="AggregateError",this.errors=$}}gP0.exports={AggregateError:SP0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var jd=E((l44,yP0)=>{yP0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,z]){let Q=Y.shift();if(z==="f")return Q.toFixed(6);else if(z==="j")return JSON.stringify(Q);else if(z==="s"&&typeof Q==="object")return`${Q.constructor!==Object?Q.constructor.name:""} {}`.trim();else return Q.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var M8=E((o44,uP0)=>{var{format:cP1,inspect:qP}=jd(),{AggregateError:nP1}=x4(),pP1=globalThis.AggregateError||nP1,dP1=Symbol("kIsNodeError"),mP1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],lP1=/^([A-Z][a-z0-9]*)+$/,VP={};function qz($,Y){if(!$)throw new VP.ERR_INTERNAL_ASSERTION(Y)}function kP0($){let Y="",U=$.length,z=$[0]==="-"?1:0;for(;U>=z+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function oP1($,Y,U){if(typeof Y==="function")return qz(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let z=(Y.match(/%[dfijoOs]/g)||[]).length;if(qz(z===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${z}).`),U.length===0)return Y;return cP1(Y,...U)}function z8($,Y,U){if(!U)U=Error;class z extends U{constructor(...Q){super(oP1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(z.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),z.prototype.code=$,z.prototype[dP1]=!0,VP[$]=z}function xP0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function rP1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new pP1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class fP0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new VP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}z8("ERR_ASSERTION","%s",Error);z8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(qz(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let z="The ";if($.endsWith(" argument"))z+=`${$} `;else z+=`"${$}" ${$.includes(".")?"property":"argument"} `;z+="must be ";let Q=[],J=[],I=[];for(let G of Y)if(qz(typeof G==="string","All expected entries have to be of type string"),mP1.includes(G))Q.push(G.toLowerCase());else if(lP1.test(G))J.push(G);else qz(G!=="object",'The value "object" should be written as "Object"'),I.push(G);if(J.length>0){let G=Q.indexOf("object");if(G!==-1)Q.splice(Q,G,1),J.push("Object")}if(Q.length>0){switch(Q.length){case 1:z+=`of type ${Q[Line truncated
`;super(Y);this.name="AggregateError",this.errors=$}}gP0.exports={AggregateError:SP0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var jd=E((l44,yP0)=>{yP0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,z]){let Q=Y.shift();if(z==="f")return Q.toFixed(6);else if(z==="j")return JSON.stringify(Q);else if(z==="s"&&typeof Q==="object")return`${Q.constructor!==Object?Q.constructor.name:""} {}`.trim();else return Q.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var M8=E((o44,uP0)=>{var{format:cP1,inspect:qP}=jd(),{AggregateError:nP1}=x4(),pP1=globalThis.AggregateError||nP1,dP1=Symbol("kIsNodeError"),mP1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],lP1=/^([A-Z][a-z0-9]*)+$/,VP={};function qz($,Y){if(!$)throw new VP.ERR_INTERNAL_ASSERTION(Y)}function kP0($){let Y="",U=$.length,z=$[0]==="-"?1:0;for(;U>=z+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function oP1($,Y,U){if(typeof Y==="function")return qz(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let z=(Y.match(/%[dfijoOs]/g)||[]).length;if(qz(z===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${z}).`),U.length===0)return Y;return cP1(Y,...U)}function z8($,Y,U){if(!U)U=Error;class z extends U{constructor(...Q){super(oP1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(z.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),z.prototype.code=$,z.prototype[dP1]=!0,VP[$]=z}function xP0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function rP1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new pP1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class fP0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new VP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}z8("ERR_ASSERTION","%s",Error);z8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(qz(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let z="The ";if($.endsWith(" argument"))z+=`${$} `;else z+=`"${$}" ${$.includes(".")?"property":"argument"} `;z+="must be ";let Q=[],J=[],I=[];for(let G of Y)if(qz(typeof G==="string","All expected entries have to be of type string"),mP1.includes(G))Q.push(G.toLowerCase());else if(lP1.test(G))J.push(G);else qz(G!=="object",'The value "object" should be written as "Object"'),I.push(G);if(J.length>0){let G=Q.indexOf("object");if(G!==-1)Q.splice(Q,G,1),J.push("Object")}if(Q.length>0){switch(Q.length){case 1:z+=`of type ${Q[Line truncated
`);if(Y.linkname)U+=Ul(" linkpath="+Y.linkname+`
`);let z=Y.pax;if(z)for(let Q in z)U+=Ul(" "+Q+"="+z[Q]+`
`);return n1.from(U)};mv1.decodePax=function(Y){let U={};while(Y.length){let z=0;while(z<Y.length&&Y[z]!==32)z++;let Q=parseInt(n1.toString(Y.subarray(0,z)),10);if(!Q)return U;let J=n1.toString(Y.subarray(z+1,Q-1)),I=J.indexOf("=");if(I===-1)return U;U[J.slice(0,I)]=J.slice(I+1),Y=Y.subarray(Q)}return U};mv1.encode=function(Y){let U=n1.alloc(512),z=Y.name,Q="";if(Y.typeflag===5&&z[z.length-1]!=="/")z+="/";if(n1.byteLength(z)!==z.length)return null;while(n1.byteLength(z)>100){let J=z.indexOf("/");if(J===-1)return null;Q+=Q?"/"+z.slice(0,J):z.slice(0,J),z=z.slice(J+1)}if(n1.byteLength(z)>100||n1.byteLength(Q)>155)return null;if(Y.linkname&&n1.byteLength(Y.linkname)>100)return null;if(n1.write(U,z),n1.write(U,l2(Y.mode&4095,6),100),n1.write(U,l2(Y.uid,6),108),n1.write(U,l2(Y.gid,6),116),pv1(Y.size,U,124),n1.write(U,l2(Y.mtime.getTime()/1000|0,11),136),U[156]=48+cv1(Y.type),Y.linkname)n1.write(U,Y.linkname,157);if(n1.copy(HR0,U,257),n1.copy(yv1,U,263),Y.uname)n1.write(U,Y.uname,265);if(Y.gname)n1.write(U,Y.gname,297);if(n1.write(U,l2(Y.devmajor||0,6),329),n1.write(U,l2(Y.devminor||0,6),337),Q)n1.write(U,Q,345);return n1.write(U,l2(XR0(U),6),148),U};mv1.decode=function(Y,U,z){let Q=Y[156]===0?0:Y[156]-48,J=RK(Y,0,100,U),I=m2(Y,100,8),K=m2(Y,108,8),G=m2(Y,116,8),H=m2(Y,124,12),W=m2(Y,136,12),X=iv1(Q),Z=Y[157]===0?null:RK(Y,157,100,U),q=RK(Y,265,32),V=RK(Y,297,32),F=m2(Y,329,8),M=m2(Y,337,8),w=XR0(Y);if(w===256)return null;if(w!==m2(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(fv1(Y)){if(Y[345])J=RK(Y,345,155,U)+"/"+J}else if(uv1(Y));else if(!z)throw Error("Invalid tar header: unknown format.");if(Q===0&&J&&J[J.length-1]==="/")Q=5;return{name:J,mode:I,uid:K,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:F,devminor:M,pax:null}};function fv1($){return n1.equals(HR0,$.subarray(257,263))}function uv1($){return n1.equals(kv1,$.subarray(257,263))&&n1.equals(xv1,$.subarray(263,265))}function bv1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function iv1($){switch($){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function cv1($){switch($){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function WR0($,Y,U,z){for(;U<z;U++)if($[U]===Y)return U;return z}function XR0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function l2($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function nv1($,Y,U){Y[U]=128;for(let z=11;z>0;z--)Y[U+z]=$&255,$=Math.floor($/256)}function pv1($,Y,U){if($.toString(8).length>11)nv1($,Y,U);else n1.write(Y,l2($,11),U)}function dv1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],z;for(z=$.length-1;z>0;z--){let I=$[z];if(Y)U.push(I);else U.push(255-I)}let Q=0,J=U.length;for(z=0;z<J;z++)Q+=U[z]*Math.pow(256,z);return Y?Q:-1*Q}function m2($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return dv1($);else{while(Y<$.length&&$[Y]===32)Y++;let z=bv1(WR0($,32,Y,$.length),$.length,$.length);while(Y<z&&$[Y]===0)Y++;if(z===Y)return 0;return parseInt(n1.toString($.subarray(Y,z)),8)}}function RK($,Y,U,z){return n1.toString($.subarray(Y,WR0($,0,Y,Y+U)),z)}function Ul($){let Y=n1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var OR0=E((f84,MR0)=>{var{Writable:tv1,Readable:ev1,getStreamError:ZR0}=Yl(),$h1=lm(),qR0=CK(),_K=zl(),Yh1=qR0.alloc(0);class VR0{constructor(){this.buffered=0,this.shifted=0,this.queue=new $h1,this._offset=0}push($){this.buffered+=$.byteLength,this.queue.push($)}shiftFirst($){return this.buffered===0?null:this._next($)}shift($){if($>this.buffered)return null;if($===0)return Yh1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return qR0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let z=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,z}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class LR0 extends ev1{constructor($,Y,U){super();this.header=Y,this.offset=U,this._parent=$}_read($){if(this.header.size===0)this.push(null);if(this._parent._stream===this)this._parent._update();$(null)}_predestroy(){this._parent.destroy(ZR0(this))}_detach(){if(this._parent._stream= Line truncated
@@ -899,24 +899,24 @@ export default lintRule;
`);let w=new FormData,N=await Hd(z.fileBuffer,M),O=F.split("/").pop()??F;w.append("files",new File([new Uint8Array(N)],O));let D=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...vZ({},U.secret)},body:w});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(F,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${F}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${G.document.documentId}
`);let Z=Ld(G.document,H,W),q=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...vZ({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);I.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
`)}return{warnings:[],results:I}}function hz($){return{fileBuffer:Dh1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var Wl=m(()=>{nB();Fd();Vd();Wd();$K();Hl()});import{existsSync as Th1}from"node:fs";async function QT($,Y,U={}){let Q=_4().stateful?"stateful":"stateless",J="ok",I,K,G;try{let D=await W8($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},K={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",I=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await J$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",I=`读取 Webhook 配置失败: ${D instanceof Error?D.message:String(D)}`}let W=H.length===1,X=H.map((D)=>({id:D.id,name:D.name,mode:D.mode,incomingDocumentWebhookUrl:D.incomingDocumentWebhook.url,outgoingResultWebhookUrl:D.outgoingResultWebhook,autoApprovalRate:D.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,q=U.webhook?S7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!Th1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=hz(U.filePath),P=await vz(D.fileBuffer,D.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:D.fileName,documentCount:P.documents.length,warnings:P.warnings}}catch(D){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[D instanceof Error?D.message:String(D)]}}let F=V?V.valid:!0,M=J==="ok"&&X.length>0&&F,w=Q==="stateful"?"":` --corp ${Y.id}`,N="",O="";if(J!=="ok")O=`凭证鉴权异常: ${I}`,N=`seal-use auth diagnose${w}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${w}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${w}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;N=`seal-use webhook resource-pack push ${D}${P}${w}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:K,user:G},stateMode:Q,authStatus:J,authError:I,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:N}}var uR0=m(()=>{y3();X6();Wl()});var Xl=m(()=>{$K();mQ();nB();Wd();Vd();Fd();Wl();uR0();Hl()});import{existsSync as bR0,mkdirSync as iR0,statSync as jh1}from"node:fs";import{homedir as Eh1}from"node:os";import{dirname as Ch1,resolve as JT}from"node:path";function Rh1($){if($.outputFile){let I=JT($.outputFile),K=Ch1(I);if(!bR0(K))iR0(K,{recursive:!0});return I}let U=($.corpName||$.corpId||"企业").replace(/[/\\?%*:|"<>]/g,"_").trim()||"企业",z=$.dateTag||new Date().toISOString().slice(0,10),Q=`${U}_智能洞察报告_${z}.xlsx`,J;if($.toDownloads)J=JT(Eh1(),"Downloads");else J=JT(process.cwd(),"exports");if(!bR0(J))iR0(J,{recursive:!0});return JT(J,Q)}async function IT($,Y,U={}){let z=Y.name||Y.id,Q=ln({startDate:U.startDate,endDate:U.endDate,force:U.force}),J=new Date().toISOString(),[I,K]=await Promise.all([DM($,{startDate:Q.startDateStr,endDate:Q.endDateStr,limit:U.limit??100}),BM($,{startDate:Q.startDateStr,endDate:Q.endDateStr}).catch(()=>({metrics:{},sankeyData:{nodes:[],links:[]}}))]),G=I.tagStats||[],H=[],W=Math.min(G.length,U.limit??50);for(let C=0;C<W;C++){let b=G[C];if(!b?.tagId)continue;try{let x=await AM($,{tagId:b.tagId,startDate:Q.startDateStr,endDate:Q.endDateStr});for(let S of x.risks||[])H.push({tagId:b.tagId,tagName:b.tagName||b.tagId,documentSN:S.documentSN||"-",documentType:S.documentType||"-",riskLevel:S.riskLevel||"warning",confidence:S.confidence??0,riskDetails:S.riskDetails||"-",reasoning:S.reasoning||"-",sourceDocumentURL:S.sourceDocumentURL,createdAt:S.createdAt})}catch{}}let X=new cR0.default.Workbook;X.creator="seal-use",X.lastModifiedBy="seal-use",X.created=new Date,X.modified=new Date;let Z={type:"pattern",pattern:"solid",fgColor:{argb:"FF1E293B"}},q={name:"Microsoft YaHei",size:11,bold:!0,color:{argb:"FFFFFFFF"}},V={top:{style:"thin",color:{argb:"FFE2E8F0"}},bottom:{style:"thin",color:{argb:"FFE2E8F0"}},left:{style:"thin",color:{argb:"FFE2E8F0"}},right:{style:"thin",color:{argb:"FFE2E8F0"}}},F=X.addWorksheet("审核效能与决策流向",{views:[{showGridLines:!0}]});F.columns=[{header:"分类",key:"category",width:20},{header:"指标名称",key:"name",width:28},{header:"数值",key:"val",width:22},{header:"环比/趋势",key:"trend",width:18},{header:"说明",key:"desc",width:36}],F.getRow(1).height=28,F.getRow(1).font=q,F.getRow(1).fill=Z,F.getRow(1).alignment={vertical:"middle",horizontal:"center"};let M=K.metrics||{},w=[{c Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:hK({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:ZT(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:GT(U,["金额","报销金额","付款金额","合计","价税合计"])??ZT(Y,["amount","totalAmount","expenseAmount"]),expenseType:GT(U,["费用类型","费用类别","报销类型"]),costCompany:GT(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:GT(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:lh1($),attachments:f2($,{summary:!0}).attachments,aiResult:VT($),manualResult:gz($)?.value,hints:hK({amountMentions:mR0(z,["金额","合计","税率"],8),partyMentions:mR0(z,["买方","卖方","甲方","乙方","收款"],8)})}}function nh1($){let Y=[["result.citedRules",d3($,"result.citedRules")],["result.matchedRules",d3($,"result.matchedRules")],["result.ruleResults",d3($,"result.ruleResults")],["result.rules",d3($,"result.rules")],["pipelineData.citedRules",d3($,"pipelineData.citedRules")],["pipelineData.matchedRules",d3($,"pipelineData.matchedRules")]],U=[],z=new Set;for(let[Q,J]of Y)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((K,G)=>{let H=Fq(K);if(!H)return;let W=S4(H.runtimeRuleId)??S4(H.runtimeId)??S4(H.id)??S4(H.ruleId),X=S4(H.ruleCode)??S4(H.code)??(W?sh1(W):void 0),Z=hK({runtimeRuleId:W,ruleCode:X,versionNumber:dh1(H.versionNumber)??$.ruleSetVersionNumber,scope:S4(H.scope),strictness:S4(H.strictness),appliedAnalysis:H.appliedAnalysis??H.analysis??H.reasoning,checkResult:H.checkResult??H.result??H.decision,findings:H.findings??H.riskPoints??H.evidence,sourcePath:`${Q}.${G}`}),q=JSON.stringify(Z);if(!z.has(q))z.add(q),U.push(Z)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function ZT($,Y){if(!$)return;for(let U of Y){let z=d3($,U);if(z!==void 0)return z}return}function dR0($,Y){if(!$)return 0;for(let U of Y){let z=d3($,U);if(Array.isArray(z))return z.length;if(z&&typeof z==="object")return Object.keys(z).length;if(typeof z==="number")return z}return 0}function d3($,Y){return Y.split(".").reduce((U,z)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(z);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[z];return},$)}function ph1($,Y,U){let z=Y.split("."),Q=$;for(let J of z.slice(0,-1)){let I=Q[J];if(!I||typeof I!=="object"||Array.isArray(I))Q[J]={};Q=Q[J]}Q[z[z.length-1]??Y]=U}function hK($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Fq($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function dh1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function mh1($){let Y=[];return Ll($,"document",Y),Y}function Ll($,Y,U){if(Array.isArray($)){$.forEach((I,K)=>Ll(I,`${Y}.${K}`,U));return}let z=Fq($);if(!z)return;let Q=S4(z.label)??S4(z.name)??S4(z.title)??S4(z.fieldName),J=z.value??z.displayValue??z.text??z.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(hK({path:Y,label:Q,value:J,type:S4(z.type)??S4(z.fieldType)}));for(let[I,K]of Object.entries(z)){if(I==="attachments")continue;Ll(K,`${Y}.${I}`,U)}}function GT($,Y){return $.find((z)=>{let Q=S4(z.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function lh1($){let Y=[];return qT($.result,"result",Y),qT($.document,"document",Y),Y.slice(0,20)}function qT($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>qT(Q,`${Y}.${J}`,U));return}let z=Fq($);if(!z)return;if(/invoice|发票/i.test(Y))U.push(hK({path:Y,fileName:S4(z.fileName)??S4(z.filename)??S4(z.name),buyer:z.buyer??z.buyerName??z.purchaserName,seller:z.seller??z.sellerName,amount:z.amount??z.totalAmount??z.total,taxRate:z.taxRate,category:z.category??z.type}));for(let[Q,J]of Object.entries(z))qT(J,`${Y}.${Q}`,U)}function mR0($,Y,U){return $.split(/\r?\n/).filter((z)=>Y.some((Q)=>z.includes(Q))).slice(0,U)}function HT($){return $.map((Y)=>{let U=Sz(Y);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback":"unresolved"}})}function ql($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function oh1($,Y){if(Y.recordId&&!Y.versionId&&!Y.versionNumber&&!Y.latest){let U=await H4($,Y.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)}return{warnings:[],results:I}}function hz($){return{fileBuffer:Dh1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var Wl=m(()=>{nB();Fd();Vd();Wd();$K();Hl()});import{existsSync as Th1}from"node:fs";async function QT($,Y,U={}){let Q=_4().stateful?"stateful":"stateless",J="ok",I,K,G;try{let D=await W8($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},K={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",I=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await J$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",I=`读取 Webhook 配置失败: ${D instanceof Error?D.message:String(D)}`}let W=H.length===1,X=H.map((D)=>({id:D.id,name:D.name,mode:D.mode,incomingDocumentWebhookUrl:D.incomingDocumentWebhook.url,outgoingResultWebhookUrl:D.outgoingResultWebhook,autoApprovalRate:D.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,q=U.webhook?S7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!Th1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=hz(U.filePath),P=await vz(D.fileBuffer,D.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:D.fileName,documentCount:P.documents.length,warnings:P.warnings}}catch(D){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[D instanceof Error?D.message:String(D)]}}let F=V?V.valid:!0,M=J==="ok"&&X.length>0&&F,w=Q==="stateful"?"":` --corp ${Y.id}`,N="",O="";if(J!=="ok")O=`凭证鉴权异常: ${I}`,N=`seal-use auth diagnose${w}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${w}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${w}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;N=`seal-use webhook resource-pack push ${D}${P}${w}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:K,user:G},stateMode:Q,authStatus:J,authError:I,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:N}}var uR0=m(()=>{y3();X6();Wl()});var Xl=m(()=>{$K();mQ();nB();Wd();Vd();Fd();Wl();uR0();Hl()});import{existsSync as bR0,mkdirSync as iR0,statSync as jh1}from"node:fs";import{homedir as Eh1}from"node:os";import{dirname as Ch1,resolve as JT}from"node:path";function Rh1($){if($.outputFile){let I=JT($.outputFile),K=Ch1(I);if(!bR0(K))iR0(K,{recursive:!0});return I}let U=($.corpName||$.corpId||"企业").replace(/[/\\?%*:|"<>]/g,"_").trim()||"企业",z=$.dateTag||new Date().toISOString().slice(0,10),Q=`${U}_智能洞察报告_${z}.xlsx`,J;if($.toDownloads)J=JT(Eh1(),"Downloads");else J=JT(process.cwd(),"exports");if(!bR0(J))iR0(J,{recursive:!0});return JT(J,Q)}async function IT($,Y,U={}){let z=Y.name||Y.id,Q=ln({startDate:U.startDate,endDate:U.endDate,force:U.force}),J=new Date().toISOString(),[I,K]=await Promise.all([DM($,{startDate:Q.startDateStr,endDate:Q.endDateStr,limit:U.limit??100}),BM($,{startDate:Q.startDateStr,endDate:Q.endDateStr}).catch(()=>({metrics:{},sankeyData:{nodes:[],links:[]}}))]),G=I.tagStats||[],H=[],W=Math.min(G.length,U.limit??50);for(let C=0;C<W;C++){let b=G[C];if(!b?.tagId)continue;try{let x=await AM($,{tagId:b.tagId,startDate:Q.startDateStr,endDate:Q.endDateStr});for(let S of x.risks||[])H.push({tagId:b.tagId,tagName:b.tagName||b.tagId,documentSN:S.documentSN||"-",documentType:S.documentType||"-",riskLevel:S.riskLevel||"warning",confidence:S.confidence??0,riskDetails:S.riskDetails||"-",reasoning:S.reasoning||"-",sourceDocumentURL:S.sourceDocumentURL,createdAt:S.createdAt})}catch{}}let X=new cR0.default.Workbook;X.creator="seal-use",X.lastModifiedBy="seal-use",X.created=new Date,X.modified=new Date;let Z={type:"pattern",pattern:"solid",fgColor:{argb:"FF1E293B"}},q={name:"Microsoft YaHei",size:11,bold:!0,color:{argb:"FFFFFFFF"}},V={top:{style:"thin",color:{argb:"FFE2E8F0"}},bottom:{style:"thin",color:{argb:"FFE2E8F0"}},left:{style:"thin",color:{argb:"FFE2E8F0"}},right:{style:"thin",color:{argb:"FFE2E8F0"}}},F=X.addWorksheet("审核效能与决策流向",{views:[{showGridLines:!0}]});F.columns=[{header:"分类",key:"category",width:20},{header:"指标名称",key:"name",width:28},{header:"数值",key:"val",width:22},{header:"环比/趋势",key:"trend",width:18},{header:"说明",key:"desc",width:36}],F.getRow(1).height=28,F.getRow(1).font=q,F.getRow(1).fill=Z,F.getRow(1).alignment={vertical:"middle",horizontal:"center"};let M=K.metrics||{},w=[{c Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:hK({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:ZT(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:GT(U,["金额","报销金额","付款金额","合计","价税合计"])??ZT(Y,["amount","totalAmount","expenseAmount"]),expenseType:GT(U,["费用类型","费用类别","报销类型"]),costCompany:GT(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:GT(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:lh1($),attachments:f2($,{summary:!0}).attachments,aiResult:VT($),manualResult:gz($)?.value,hints:hK({amountMentions:mR0(z,["金额","合计","税率"],8),partyMentions:mR0(z,["买方","卖方","甲方","乙方","收款"],8)})}}function nh1($){let Y=[["result.citedRules",d3($,"result.citedRules")],["result.matchedRules",d3($,"result.matchedRules")],["result.ruleResults",d3($,"result.ruleResults")],["result.rules",d3($,"result.rules")],["pipelineData.citedRules",d3($,"pipelineData.citedRules")],["pipelineData.matchedRules",d3($,"pipelineData.matchedRules")]],U=[],z=new Set;for(let[Q,J]of Y)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((K,G)=>{let H=Fq(K);if(!H)return;let W=S4(H.runtimeRuleId)??S4(H.runtimeId)??S4(H.id)??S4(H.ruleId),X=S4(H.ruleCode)??S4(H.code)??(W?sh1(W):void 0),Z=hK({runtimeRuleId:W,ruleCode:X,versionNumber:dh1(H.versionNumber)??$.ruleSetVersionNumber,scope:S4(H.scope),strictness:S4(H.strictness),appliedAnalysis:H.appliedAnalysis??H.analysis??H.reasoning,checkResult:H.checkResult??H.result??H.decision,findings:H.findings??H.riskPoints??H.evidence,sourcePath:`${Q}.${G}`}),q=JSON.stringify(Z);if(!z.has(q))z.add(q),U.push(Z)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function ZT($,Y){if(!$)return;for(let U of Y){let z=d3($,U);if(z!==void 0)return z}return}function dR0($,Y){if(!$)return 0;for(let U of Y){let z=d3($,U);if(Array.isArray(z))return z.length;if(z&&typeof z==="object")return Object.keys(z).length;if(typeof z==="number")return z}return 0}function d3($,Y){return Y.split(".").reduce((U,z)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(z);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[z];return},$)}function ph1($,Y,U){let z=Y.split("."),Q=$;for(let J of z.slice(0,-1)){let I=Q[J];if(!I||typeof I!=="object"||Array.isArray(I))Q[J]={};Q=Q[J]}Q[z[z.length-1]??Y]=U}function hK($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Fq($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function dh1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function mh1($){let Y=[];return Ll($,"document",Y),Y}function Ll($,Y,U){if(Array.isArray($)){$.forEach((I,K)=>Ll(I,`${Y}.${K}`,U));return}let z=Fq($);if(!z)return;let Q=S4(z.label)??S4(z.name)??S4(z.title)??S4(z.fieldName),J=z.value??z.displayValue??z.text??z.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(hK({path:Y,label:Q,value:J,type:S4(z.type)??S4(z.fieldType)}));for(let[I,K]of Object.entries(z)){if(I==="attachments")continue;Ll(K,`${Y}.${I}`,U)}}function GT($,Y){return $.find((z)=>{let Q=S4(z.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function lh1($){let Y=[];return qT($.result,"result",Y),qT($.document,"document",Y),Y.slice(0,20)}function qT($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>qT(Q,`${Y}.${J}`,U));return}let z=Fq($);if(!z)return;if(/invoice|发票/i.test(Y))U.push(hK({path:Y,fileName:S4(z.fileName)??S4(z.filename)??S4(z.name),buyer:z.buyer??z.buyerName??z.purchaserName,seller:z.seller??z.sellerName,amount:z.amount??z.totalAmount??z.total,taxRate:z.taxRate,category:z.category??z.type}));for(let[Q,J]of Object.entries(z))qT(J,`${Y}.${Q}`,U)}function mR0($,Y,U){return $.split(/\r?\n/).filter((z)=>Y.some((Q)=>z.includes(Q))).slice(0,U)}function HT($){return $.map((Y)=>{let U=Sz(Y);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback":"unresolved"}})}function ql($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function oh1($,Y){if(Y.recordId&&!Y.versionId&&!Y.versionNumber&&!Y.latest){let U=await H4($,Y.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`+`• 身份主体:${T}${A}
`+`• 权限范围:持有该链接者在 Seal AI 中拥有该用户的完整操作权限(含系统设置与规则编辑)
`+`• 时效性:换票凭证有效时间 ${q} 秒(${Math.round(q/60)} 分钟),在浏览器打开后将保留 30 天会话
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:M,hoseDomain:J.type==="hose"?$S1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y)=>{let U=Y.sn??Y.query;if(!U)throw Error("query or sn is required");let z=await YS1($,{query:U,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),Q=await Promise.all(z.records.map((K)=>H4($,K.id))),J=pR0(Y.fields),I=Q.map((K)=>ah1(K,J));return{query:U,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:z.total,scanned:z.scanned,matched:I.length,records:I,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-home tool seal_approval_search --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-home tool seal_approval_context_get --json '{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:HT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let U=Nl(await eS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:U.length,records:U.map(Sz),bridge:HT(U)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let U=Y.mode??"hosecloud",z=Y.signKey;if(U==="hosecloud"&&!z){if(z=(await Yg($)).find((K)=>K.signKey)?.signKey,!z)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let Q=uh1({mode:U,flowIds:Y.flowIds,rejectNodeName:Y.rejectNodeName,thinkingDepthOverride:Y.thinkingDepthOverride,skipInvoiceGene Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:M,hoseDomain:J.type==="hose"?$S1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y)=>{let U=Y.sn??Y.query;if(!U)throw Error("query or sn is required");let z=await YS1($,{query:U,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),Q=await Promise.all(z.records.map((K)=>H4($,K.id))),J=pR0(Y.fields),I=Q.map((K)=>ah1(K,J));return{query:U,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:z.total,scanned:z.scanned,matched:I.length,records:I,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-home tool seal_approval_search --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-home tool seal_approval_context_get --json '{"ruleVersionNumber":14}'`},...Y.includeBridge?{bridge:HT(Q)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let U=Nl(await eS($,Y.batchId),Y.query);return{batchId:Y.batchId,count:U.length,records:U.map(Sz),bridge:HT(U)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let U=Y.mode??"hosecloud",z=Y.signKey;if(U==="hosecloud"&&!z){if(z=(await Yg($)).find((K)=>K.signKey)?.signKey,!z)throw Error("未找到合思集成 signKey, 请通过 signKey 参数提供")}let Q=uh1({mode:U,flowIds:Y.flowIds,rejectNodeName:Y.rejectNodeName,thinkingDepthOverride:Y.thinkingDepthOverride,skipInvoiceGene Line truncated
`)}function XS1($){let Y=[];if(Y.push(`seal-use ${$.area} - ${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");for(let U of $.commands)for(let z of U.usage)Y.push(` ${z}`);if($.commands.some((U)=>U.name))Y.push(""),Y.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return Y.join(`
`)}function W_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of X_0)for(let U of Y.commands)for(let z of U.usage)$.push(` ${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var X_0;var jl=m(()=>{L$();X_0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",commands:[{name:"list",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new version on the test enterprise. Production rules remain safe in draft state."},{name:"replay-test",summary:"Replay approval records from production enterprise to bound test enterprise via Webhook",usage:["seal-use corps replay-test [<prodCorpId>] [--record-id <id>] [--sn <sn>] [--limit <n>] [--webhook <idOrName>] [--dry-run]"],options:[{flag:"<prodCorpId>",des Line truncated
`)}
`}function Nq($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function b0($,Y={}){FS1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){ZS1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function FS1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>LS1)throw new pB(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function L_0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},z=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),I=z??Q??0;if(I>qS1||J>VS1)throw new pB(`Rule list is large (${I} rules, ${J} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function C0($){return{allowFull:Z0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function F_0($=[]){console.log(q_0($))}var qS1=100,VS1=120000,V_0,LS1=200000;var J4=m(()=>{D4();L$();jl();V_0=["code","status","strictness","scope","updatedAt"]});var w_0={};x8(w_0,{selectCorp:()=>j1,runToolResult:()=>_9,runTool:()=>k0,globalConfigSummary:()=>o2});function j1($){let Y=s8(),U=_4(),z=u2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},S3());return VA0(z.id),z}function o2($=_4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:Gz()}}async function k0($,Y,U,z,Q={}){b0(await _9($,Y,U,z),Q)}async function _9($,Y,U,z){let Q=Lq.find((K)=>K.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(z).filter(([,K])=>K!==void 0)),I=Q.handler;return I(Y,J,{corp:U})}var f4=m(()=>{y3();iB();wq();J4()});import{existsSync as M_0}from"node:fs";async function O_0($,Y){if(!M_0($))throw Error(`File not found: ${$}`);let U=hz($);console.log(JSON.stringify(await vz(U.fileBuffer,U.fileName,Y),null,2))}async function OT($,Y,U,z,Q){if($==="ready"||$==="status"){let J=Y??h(Q.options.file)??h(Q.options.input),I=await QT(U,z,{filePath:J,webhook:h(Q.options.webhook)??h(Q.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${I.corp.name} (${I.corp.id}) [${I.stateMode}]`),I.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${I.corp.tenant.name} (${I.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${I.authStatus==="ok"?"OK":`异常 (${I.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${I.activeWebhooks.length} 个可用`);for(let K of I.activeWebhooks){let G=K.isDefault?" [默认通道]":"";console.error(` - ${K.name} (${K.id}) mode=${K.mode}${G}`)}if(I.materialPack)console.error(`[webhook-ready] 材料包预检: ${I.materialPack.valid?`通过 (${I.materialPack.documentCount} 单)`:`失败 (${I.materialPack.errors?.join("; ")})`}`);if(I.ready)console.error(`\uD83D\uDFE2 ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);console.log(JSON.stringify(I,null,2));return}if($==="replay"){let J=Y??h(Q.options.recordId)??h(Q.options["record-id"])??h(Q.options.id),I=h(Q.options.recordIds)??h(Q.options["record-ids"]),K=I?I.split(",").map((c)=>c.trim()).filter(Boolean):void 0,G=h(Q.options.sn)??h(Q.options.documentSn)??h(Q.options["document-sn"]),H=h(Q.options.sns)??h(Q.options["document-sns"]),W=H?H.split(",").map((c)=>c.trim()).filter(Boolean):void 0,X=s0(Q.options.limit),Z=h(Q.options.status),q=h(Q.options.startDate)??h(Q.options["start-date"]),V=h(Q.options.endDate)??h(Q.options["end-date"]);if(!J&&!K&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let F=h(Q.options.sourceCorp)??h(Q.options["source-corp"])??h(Q.options.prodCorp)??h(Q.options["prod-corp"]),M=h(Q.options.targetCorp)??h(Q.options["target-corp"])??h(Q.options.testCorp)??h(Q.options["test-corp"]),w=Z0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=dB({sourceCorpId:F,targetCorpId:M,activeCorp:z,force:w},j1),D=N.id===z.id?U:await B1(N),P=O.id===z.id?U:await B1(O),T=h(Q.options.webhook)??h(Q.options.selector),A=h(Q.options.snSuffix)??h(Q.options["sn-suffix"]),j=h(Q.options.snPrefix)??h(Q.options["sn-prefix"]),C=h(Q.options.docIdSuffix)??h(Q.options["doc-id-suffix"]),b=h(Q.options.docIdPrefix)??h(Q.options["doc-id-prefix"]),x=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"]),i=await tI({query:{recordId:J,recordIds:K,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:j,snSuffix:A,docIdPrefix:b,docIdSuffix:C,dryRun:x});if(x) Line truncated
`}function Nq($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function f0($,Y={}){FS1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){ZS1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function FS1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>LS1)throw new pB(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function L_0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},z=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),I=z??Q??0;if(I>qS1||J>VS1)throw new pB(`Rule list is large (${I} rules, ${J} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function C0($){return{allowFull:Z0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function F_0($=[]){console.log(q_0($))}var qS1=100,VS1=120000,V_0,LS1=200000;var J4=m(()=>{D4();L$();jl();V_0=["code","status","strictness","scope","updatedAt"]});var w_0={};x8(w_0,{selectCorp:()=>j1,runToolResult:()=>T5,runTool:()=>k0,globalConfigSummary:()=>o2});function j1($){let Y=s8(),U=_4(),z=u2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},S3());return VA0(z.id),z}function o2($=_4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:Gz()}}async function k0($,Y,U,z,Q={}){f0(await T5($,Y,U,z),Q)}async function T5($,Y,U,z){let Q=Lq.find((K)=>K.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(z).filter(([,K])=>K!==void 0)),I=Q.handler;return I(Y,J,{corp:U})}var f4=m(()=>{y3();iB();wq();J4()});import{existsSync as M_0}from"node:fs";async function O_0($,Y){if(!M_0($))throw Error(`File not found: ${$}`);let U=hz($);console.log(JSON.stringify(await vz(U.fileBuffer,U.fileName,Y),null,2))}async function OT($,Y,U,z,Q){if($==="ready"||$==="status"){let J=Y??h(Q.options.file)??h(Q.options.input),I=await QT(U,z,{filePath:J,webhook:h(Q.options.webhook)??h(Q.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${I.corp.name} (${I.corp.id}) [${I.stateMode}]`),I.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${I.corp.tenant.name} (${I.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${I.authStatus==="ok"?"OK":`异常 (${I.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${I.activeWebhooks.length} 个可用`);for(let K of I.activeWebhooks){let G=K.isDefault?" [默认通道]":"";console.error(` - ${K.name} (${K.id}) mode=${K.mode}${G}`)}if(I.materialPack)console.error(`[webhook-ready] 材料包预检: ${I.materialPack.valid?`通过 (${I.materialPack.documentCount} 单)`:`失败 (${I.materialPack.errors?.join("; ")})`}`);if(I.ready)console.error(`\uD83D\uDFE2 ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);console.log(JSON.stringify(I,null,2));return}if($==="replay"){let J=Y??h(Q.options.recordId)??h(Q.options["record-id"])??h(Q.options.id),I=h(Q.options.recordIds)??h(Q.options["record-ids"]),K=I?I.split(",").map((c)=>c.trim()).filter(Boolean):void 0,G=h(Q.options.sn)??h(Q.options.documentSn)??h(Q.options["document-sn"]),H=h(Q.options.sns)??h(Q.options["document-sns"]),W=H?H.split(",").map((c)=>c.trim()).filter(Boolean):void 0,X=s0(Q.options.limit),Z=h(Q.options.status),q=h(Q.options.startDate)??h(Q.options["start-date"]),V=h(Q.options.endDate)??h(Q.options["end-date"]);if(!J&&!K&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let F=h(Q.options.sourceCorp)??h(Q.options["source-corp"])??h(Q.options.prodCorp)??h(Q.options["prod-corp"]),M=h(Q.options.targetCorp)??h(Q.options["target-corp"])??h(Q.options.testCorp)??h(Q.options["test-corp"]),w=Z0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=dB({sourceCorpId:F,targetCorpId:M,activeCorp:z,force:w},j1),D=N.id===z.id?U:await B1(N),P=O.id===z.id?U:await B1(O),T=h(Q.options.webhook)??h(Q.options.selector),A=h(Q.options.snSuffix)??h(Q.options["sn-suffix"]),j=h(Q.options.snPrefix)??h(Q.options["sn-prefix"]),C=h(Q.options.docIdSuffix)??h(Q.options["doc-id-suffix"]),b=h(Q.options.docIdPrefix)??h(Q.options["doc-id-prefix"]),x=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"]),i=await tI({query:{recordId:J,recordIds:K,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:j,snSuffix:A,docIdPrefix:b,docIdSuffix:C,dryRun:x});if(x) Line truncated
`+`\uD83D\uDC49 查看全部请添加: seal-use corps list --all
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}b0(w.map((N)=>({id:N.id,name:N.name,environment:N.environment??"production",sourceType:N.source.type,provider:N.source.provider??N.source.type,staffId:N.source.staffId,testCorpId:N.testCorpId,prodCorpId:N.prodCorpId,current:N.id===H})));return}if($==="get"||$==="show"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps get <corpId>");let Q=j1(z),J=zp(Q.id),I=pS1(Q);b0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:I,tenantSlug:Q.seal.tenantSlug??Q.source.tenantSlug,customHeaderNames:Q.seal.headers?Object.keys(Q.seal.headers):[],customCookieNames:Q.seal.cookies?Object.keys(Q.seal.cookies):[],endpoints:Q.seal.endpoints},source:dS1(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}});return}if($==="current"){let z=j1(h(U.options.corp));b0({id:z.id,name:z.name,environment:z.environment??"production",sourceType:z.source.type,provider:z.source.provider??z.source.type,staffId:z.source.staffId,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId});return}if($==="mark"||$==="mark-test"||$==="mark-prod"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=j1(z),J=$==="mark-test"?"test":$==="mark-prod"?"production":h(U.options.env)??h(U.options.environment);if(J!=="production"&&J!=="test")throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0))throw D9(`Refusing to change environment tag of enterprise '${Q.name}' (${Q.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${Q.id} --env ${J} --confirm`);let K=g3(Q.id,{environment:J});b0({id:K.id,name:K.name,environment:K.environment,testCorpId:K.testCorpId,prodCorpId:K.prodCorpId});return}if($==="rename"){let z=Y??h(U.options.corp)??h(U.options.id),Q=h(U.options.name)??h(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!z||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=j1(z),I=g3(J.id,{name:Q});b0({success:!0,id:I.id,name:I.name,previousName:J.name});return}if($==="bind-test"){let z,Q;if(Y&&U.command[3])z=Y,Q=U.command[3];else if(Y){let X=h(U.options.corp),Z=h(U.options["test-corp"])??h(U.options.testCorp);if(X)z=X,Q=Y;else if(Z)z=Y,Q=Z}if(!z||!Q)throw m4(`Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=j1(z),I=j1(Q);if(J.id===I.id)throw m4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==I.id)throw m4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(I.testCorpId&&I.testCorpId!==J.id)throw m4(`Cannot bind '${I.id}' as a test enterprise because it already has a bound test enterprise '${I.testCorpId}'. Multi-tier chaining is not permitted.`);let K=Z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==I.id||I.prodCorpId&&I.prodCorpId!==J.id){if(!K)throw D9(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${I.id}' is bound to '${I.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm --force`)}if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0)){let X=K?" --force":"";throw D9(`Refusing to bind test enterprise '${I.name}' (${I.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${I.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==I.id)try{g3(J.testCorpId,{prodCorpId:void 0})}catch{}if(I.prodCorpId&&I.prodCorpId!==J.id)try{g3(I.prodCorpId,{testCorpId:void 0})}catch{}let H=g3(J.id,{environment:"production",testCorpId:I.id}),W=g3(I.id,{environment:"test",prodCorpId:J.id});b0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}});return}if($==="unbind-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId&&!Q.prodCorpId){b0({unbound:!1,message:`Enterprise '${Q.name}' (${Q.id}) does not have an active test enterprise binding.`});return}let J=Q.testCorpId?Q.id:Q.prodCorpId,I=Q.testCorpId?Q.testCorpId:Q.id;if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0))throw D9(`Refusing to unbind production enterprise '${J}' and test enterprise '${I}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);g3(J,{testCorpId:void 0});try{g3(I,{prodCorpId:void 0})}catch{}b0({success:!0,unboundProduction:J,unboundTest:I});return}if($==="sync-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId)throw m4(`Production enterprise '${Q.name}' (${Q.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=j1(Q.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let I=await B1(Q),K=await B1(J),[G,H,W,X,Z,q,V,F]=await Promise.all([o1(I,Q.seal.endpoints.approvalStylePreferences).catch(()=>({})),o1(K,J.seal.endpoints.approvalStylePreferences).catch(()=>({})),p6(I),p6(K),P$(I).catch(()=>[]),P$(K).catch(()=>[]),h7(I,{limit:100}).catch(()=>({articles:[]})),h7(K,{limit:100}).catch(()=>({articles:[]}))]),M=(V.articles||[]).filter((G0)=>!G0.isDeleted),w=(F.articles||[]).filter((G0)=>!G0.isDeleted),N=new Map(w.map((G0)=>[G0.title.trim(),G0])),O=[],D=[],P=new Set(M.map((G0)=>G0.title.trim()));for(let G0 of M){let T0=G0.title.trim(),i0=N.get(T0);if(!i0)O.push(G0);else{let Y1=i0.content!==G0.content,a=(i0.purpose??"")!==(G0.purpose??""),W0=i0.enabled!==G0.enabled,F0=i0.contentType!==G0.contentType,f0=(i0.status??"")!==(G0.status??""),u0=JSON.stringify([...i0.scenarios??[]].sort())!==JSON.stringify([...G0.scenarios??[]].sort()),c0=JSON.stringify([...i0.tags??[]].sort())!==JSON.stringify([...G0.tags??[]].sort());if(Y1||a||W0||F0||f0||u0||c0)D.push({testId:i0.id,prodDoc:G0,reasons:[...Y1?["content"]:[],...a?["purpose"]:[],...W0?["enabled"]:[],...F0?["contentType"]:[],...f0?["status"]:[],...u0?["scenarios"]:[],...c0?["tags"]:[]]})}}let T=w.filter((G0)=>!P.has(G0.title.trim())),j=[...Z].sort((G0,T0)=>T0.versionNumber-G0.versionNumber)[0],C=j?.versionNumber,x=([...q].sort((G0,T0)=>T0.versionNumber-G0.versionNumber)[0]?.versionNumber??0)+1,S=dv0(Q.name,C,q),c=h(U.options["version-name"])??h(U.options.versionName)??mv0(Q.name,C,S,x),z0={...H,tone:G.tone,language:G.language,detailLevel:G.detailLevel,outputFormat:G.outputFormat,examples:G.examples??[],prohibitedPhrases:G.prohibitedPhrases??[],customInstructions:G.customInstructions,decisionPreferences:G.decisionPreferences,thinkingDepthPreference:G.thinkingDepthPreference};if(Z0(U.options["dry-run"])===!0||Z0(U.options.dryRun)===!0){b0({dryRun:!0,source:{id:Q.id,name:Q.name,environment:Q.environment,latestPublishedVersion:j?{versionNumber:j.versionNumber,versionName:j.versionName}:null,documentsCount:M.length},target:{id:J.id,name:J.name,environment:J.environment},versionMappingPlan:{sourceProdVersionNumber:C??null,sourceProdVersionName:j?.versionName??null,targetTestExpectedVersionNumber:x,targetTestPublishVersionName:c,iteration:S},preferencesDiff:{decisionPreferences:{before:H.decisionPreferences,after:G.decisionPreferences},thinkingDepthPreference:{before:H.thinkingDepthPreference,after:G.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:X.rules.length,toDeleteCount:X.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((G0,T0)=>({index:T0+1,sourceRuleId:G0.id,sourceRuleCode:G0.code??T0+1,expectedTargetCode:`rule-${T0+1}`,description:G0.description,scope:G0.scope,strictness:G0.strictness}))},documentsPlan:{sourceDocumentCount:M.length,targetExistingDocumentCount:w.length,toCreateCount:O.length,toCreate:O.map((G0)=>({title:G0.title,purpose:G0.purpose,contentType:G0.contentType,scenarios:G0.scenarios})),toUpdateCount:D.length,toUpdate:D.map((G0)=>({targetDocumentId:G0.testId,title:G0.prodDoc.title,reasons:G0.reasons})),toDeleteCount:T.length,toDelete:T.map((G0)=>({targetDocumentId:G0.id,title:G0.title}))},publishingPlan:{targetCorpId:J.id,publishVersionName:c,publishTarget:"test"},hosecloudSyncPlan:(()=>{if(Q.source.type!=="hose")return{sourceType:Q.source.type,skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let G0=(G.integrations??[]).filter((Y1)=>Y1.type==="hosecloud"),T0=new Set,i0=G0.filter((Y1)=>{let a=Y1.corporationId??Q.id;if(T0.has(a))return!1;return T0.add(a),!0});return{sourceType:"hose",outboundName:tv0(Q.name),targetMode:"assisted",integrationsCount:i0.length,integrations:i0.map((Y1)=>({corporationId:Y1.corporationId,apiOrigin:Y1.apiOrigin,customApiUrl:Y1.customApiUrl}))}})(),productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(Z0(U.options.yes)===!0||Z0(U.options.confirm)===!0))throw D9(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${W.rules.length} draft rules, and ${M.length} knowledge documents from production enterprise '${Q.name}' (${Q.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,`seal-use corps sync-test ${Q.id} --yes`);await m5(K,z0,J.seal.endpoints.approvalStylePreferences);let t=[];for(let G0 of T)await LM(K,G0.id),t.push({id:G0.id,title:G0.title});let $0=[];for(let G0 of D)await VM(K,G0.testId,{title:G0.prodDoc.title,purpose:G0.prodDoc.purpose,content:G0.prodDoc.content,contentType:G0.prodDoc.contentType,status:G0.prodDoc.status,enabled:G0.prodDoc.enabled, Line truncated
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}f0(w.map((N)=>({id:N.id,name:N.name,environment:N.environment??"production",sourceType:N.source.type,provider:N.source.provider??N.source.type,staffId:N.source.staffId,testCorpId:N.testCorpId,prodCorpId:N.prodCorpId,current:N.id===H})));return}if($==="get"||$==="show"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps get <corpId>");let Q=j1(z),J=zp(Q.id),I=pS1(Q);f0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:I,tenantSlug:Q.seal.tenantSlug??Q.source.tenantSlug,customHeaderNames:Q.seal.headers?Object.keys(Q.seal.headers):[],customCookieNames:Q.seal.cookies?Object.keys(Q.seal.cookies):[],endpoints:Q.seal.endpoints},source:dS1(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}});return}if($==="current"){let z=j1(h(U.options.corp));f0({id:z.id,name:z.name,environment:z.environment??"production",sourceType:z.source.type,provider:z.source.provider??z.source.type,staffId:z.source.staffId,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId});return}if($==="mark"||$==="mark-test"||$==="mark-prod"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=j1(z),J=$==="mark-test"?"test":$==="mark-prod"?"production":h(U.options.env)??h(U.options.environment);if(J!=="production"&&J!=="test")throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0))throw A9(`Refusing to change environment tag of enterprise '${Q.name}' (${Q.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${Q.id} --env ${J} --confirm`);let K=g3(Q.id,{environment:J});f0({id:K.id,name:K.name,environment:K.environment,testCorpId:K.testCorpId,prodCorpId:K.prodCorpId});return}if($==="rename"){let z=Y??h(U.options.corp)??h(U.options.id),Q=h(U.options.name)??h(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!z||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=j1(z),I=g3(J.id,{name:Q});f0({success:!0,id:I.id,name:I.name,previousName:J.name});return}if($==="bind-test"){let z,Q;if(Y&&U.command[3])z=Y,Q=U.command[3];else if(Y){let X=h(U.options.corp),Z=h(U.options["test-corp"])??h(U.options.testCorp);if(X)z=X,Q=Y;else if(Z)z=Y,Q=Z}if(!z||!Q)throw m4(`Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=j1(z),I=j1(Q);if(J.id===I.id)throw m4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==I.id)throw m4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(I.testCorpId&&I.testCorpId!==J.id)throw m4(`Cannot bind '${I.id}' as a test enterprise because it already has a bound test enterprise '${I.testCorpId}'. Multi-tier chaining is not permitted.`);let K=Z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==I.id||I.prodCorpId&&I.prodCorpId!==J.id){if(!K)throw A9(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${I.id}' is bound to '${I.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm --force`)}if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0)){let X=K?" --force":"";throw A9(`Refusing to bind test enterprise '${I.name}' (${I.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${I.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==I.id)try{g3(J.testCorpId,{prodCorpId:void 0})}catch{}if(I.prodCorpId&&I.prodCorpId!==J.id)try{g3(I.prodCorpId,{testCorpId:void 0})}catch{}let H=g3(J.id,{environment:"production",testCorpId:I.id}),W=g3(I.id,{environment:"test",prodCorpId:J.id});f0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}});return}if($==="unbind-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId&&!Q.prodCorpId){f0({unbound:!1,message:`Enterprise '${Q.name}' (${Q.id}) does not have an active test enterprise binding.`});return}let J=Q.testCorpId?Q.id:Q.prodCorpId,I=Q.testCorpId?Q.testCorpId:Q.id;if(!(Z0(U.options.confirm)===!0||Z0(U.options.yes)===!0))throw A9(`Refusing to unbind production enterprise '${J}' and test enterprise '${I}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);g3(J,{testCorpId:void 0});try{g3(I,{prodCorpId:void 0})}catch{}f0({success:!0,unboundProduction:J,unboundTest:I});return}if($==="sync-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId)throw m4(`Production enterprise '${Q.name}' (${Q.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=j1(Q.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let I=await B1(Q),K=await B1(J),[G,H,W,X,Z,q,V,F]=await Promise.all([o1(I,Q.seal.endpoints.approvalStylePreferences).catch(()=>({})),o1(K,J.seal.endpoints.approvalStylePreferences).catch(()=>({})),p6(I),p6(K),P$(I).catch(()=>[]),P$(K).catch(()=>[]),h7(I,{limit:100}).catch(()=>({articles:[]})),h7(K,{limit:100}).catch(()=>({articles:[]}))]),M=(V.articles||[]).filter((G0)=>!G0.isDeleted),w=(F.articles||[]).filter((G0)=>!G0.isDeleted),N=new Map(w.map((G0)=>[G0.title.trim(),G0])),O=[],D=[],P=new Set(M.map((G0)=>G0.title.trim()));for(let G0 of M){let T0=G0.title.trim(),i0=N.get(T0);if(!i0)O.push(G0);else{let Y1=i0.content!==G0.content,a=(i0.purpose??"")!==(G0.purpose??""),W0=i0.enabled!==G0.enabled,F0=i0.contentType!==G0.contentType,u0=(i0.status??"")!==(G0.status??""),b0=JSON.stringify([...i0.scenarios??[]].sort())!==JSON.stringify([...G0.scenarios??[]].sort()),c0=JSON.stringify([...i0.tags??[]].sort())!==JSON.stringify([...G0.tags??[]].sort());if(Y1||a||W0||F0||u0||b0||c0)D.push({testId:i0.id,prodDoc:G0,reasons:[...Y1?["content"]:[],...a?["purpose"]:[],...W0?["enabled"]:[],...F0?["contentType"]:[],...u0?["status"]:[],...b0?["scenarios"]:[],...c0?["tags"]:[]]})}}let T=w.filter((G0)=>!P.has(G0.title.trim())),j=[...Z].sort((G0,T0)=>T0.versionNumber-G0.versionNumber)[0],C=j?.versionNumber,x=([...q].sort((G0,T0)=>T0.versionNumber-G0.versionNumber)[0]?.versionNumber??0)+1,S=dv0(Q.name,C,q),c=h(U.options["version-name"])??h(U.options.versionName)??mv0(Q.name,C,S,x),z0={...H,tone:G.tone,language:G.language,detailLevel:G.detailLevel,outputFormat:G.outputFormat,examples:G.examples??[],prohibitedPhrases:G.prohibitedPhrases??[],customInstructions:G.customInstructions,decisionPreferences:G.decisionPreferences,thinkingDepthPreference:G.thinkingDepthPreference};if(Z0(U.options["dry-run"])===!0||Z0(U.options.dryRun)===!0){f0({dryRun:!0,source:{id:Q.id,name:Q.name,environment:Q.environment,latestPublishedVersion:j?{versionNumber:j.versionNumber,versionName:j.versionName}:null,documentsCount:M.length},target:{id:J.id,name:J.name,environment:J.environment},versionMappingPlan:{sourceProdVersionNumber:C??null,sourceProdVersionName:j?.versionName??null,targetTestExpectedVersionNumber:x,targetTestPublishVersionName:c,iteration:S},preferencesDiff:{decisionPreferences:{before:H.decisionPreferences,after:G.decisionPreferences},thinkingDepthPreference:{before:H.thinkingDepthPreference,after:G.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:X.rules.length,toDeleteCount:X.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((G0,T0)=>({index:T0+1,sourceRuleId:G0.id,sourceRuleCode:G0.code??T0+1,expectedTargetCode:`rule-${T0+1}`,description:G0.description,scope:G0.scope,strictness:G0.strictness}))},documentsPlan:{sourceDocumentCount:M.length,targetExistingDocumentCount:w.length,toCreateCount:O.length,toCreate:O.map((G0)=>({title:G0.title,purpose:G0.purpose,contentType:G0.contentType,scenarios:G0.scenarios})),toUpdateCount:D.length,toUpdate:D.map((G0)=>({targetDocumentId:G0.testId,title:G0.prodDoc.title,reasons:G0.reasons})),toDeleteCount:T.length,toDelete:T.map((G0)=>({targetDocumentId:G0.id,title:G0.title}))},publishingPlan:{targetCorpId:J.id,publishVersionName:c,publishTarget:"test"},hosecloudSyncPlan:(()=>{if(Q.source.type!=="hose")return{sourceType:Q.source.type,skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let G0=(G.integrations??[]).filter((Y1)=>Y1.type==="hosecloud"),T0=new Set,i0=G0.filter((Y1)=>{let a=Y1.corporationId??Q.id;if(T0.has(a))return!1;return T0.add(a),!0});return{sourceType:"hose",outboundName:tv0(Q.name),targetMode:"assisted",integrationsCount:i0.length,integrations:i0.map((Y1)=>({corporationId:Y1.corporationId,apiOrigin:Y1.apiOrigin,customApiUrl:Y1.customApiUrl}))}})(),productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(Z0(U.options.yes)===!0||Z0(U.options.confirm)===!0))throw A9(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${W.rules.length} draft rules, and ${M.length} knowledge documents from production enterprise '${Q.name}' (${Q.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,`seal-use corps sync-test ${Q.id} --yes`);await l5(K,z0,J.seal.endpoints.approvalStylePreferences);let t=[];for(let G0 of T)await LM(K,G0.id),t.push({id:G0.id,title:G0.title});let $0=[];for(let G0 of D)await VM(K,G0.testId,{title:G0.prodDoc.title,purpose:G0.prodDoc.purpose,content:G0.prodDoc.content,contentType:G0.prodDoc.contentType,status:G0.prodDoc.status,enabled:G0.prodDoc.enabled, Line truncated
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);I=Q}else if(I=j1(Q.testCorpId),I.environment!=="test"&&!J)throw Error(`Target enterprise '${I.name}' (${I.id}) is marked as '${I.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);let K=h(U.options.recordId)??h(U.options["record-id"])??h(U.options.id),G=h(U.options.recordIds)??h(U.options["record-ids"]),H=G?G.split(",").map((x)=>x.trim()).filter(Boolean):void 0,W=h(U.options.sn)??h(U.options.documentSn)??h(U.options["document-sn"]),X=h(U.options.sns)??h(U.options["document-sns"]),Z=X?X.split(",").map((x)=>x.trim()).filter(Boolean):void 0,q=s0(U.options.limit)??(!K&&!H&&!W&&!Z?1:void 0),V=h(U.options.status),F=h(U.options.startDate)??h(U.options["start-date"]),M=h(U.options.endDate)??h(U.options["end-date"]),w=await B1(Q),N=Q.id===I.id?w:await B1(I),O=h(U.options.webhook)??h(U.options.selector),D=h(U.options.snSuffix)??h(U.options["sn-suffix"]),P=h(U.options.snPrefix)??h(U.options["sn-prefix"]),T=h(U.options.docIdSuffix)??h(U.options["doc-id-suffix"]),A=h(U.options.docIdPrefix)??h(U.options["doc-id-prefix"]),j=Z0(U.options.dryRun)??Z0(U.options["dry-run"]),C={recordId:K,recordIds:H,sn:W,sns:Z,limit:q,status:V,startDate:F,endDate:M};console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${I.name}」(${I.id})`);let b=await tI({query:C,sourceClient:w,targetClient:N,sourceCorp:Q,targetCorp:I,webhookSelector:O,snPrefix:P,snSuffix:D,docIdPrefix:A,docIdSuffix:T,dryRun:j});if(j){console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),console.log(JSON.stringify(b,null,2));return}if(b.success)if(b.totalCount===1&&b.replayedDocument)console.error(`\uD83D\uDFE2 成功重放单据「${b.replayedDocument.documentSN}」至 ${I.name} (${b.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDFE2 成功重放 ${b.successCount} 条单据(来自「${Q.name}」)至「${I.name}」(${b.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${b.successCount} 条,失败 ${b.failureCount} 条)至「${I.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${I.id} --limit ${b.totalCount}`),console.log(JSON.stringify(b,null,2)),!b.success)process.exitCode=1;return}if($==="switch"){let z=Y;if(!z)throw Error("Usage: seal-use corps switch <corpId>");let Q=_4();if(!Q.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=j1(z);Hz({...Q,stateful:!0,defaultCorpId:J.id}),b0({current:!0,id:J.id,name:J.name});return}if($==="probe-hose"){await oS1(y8(U.json));return}if($==="hose-staffs"){await rS1(y8(U.json));return}if($==="add-hose"){let Q={...y8(U.json),...U.options.staffName?{staffName:h(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:h(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:h(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:h(U.options["staff-phone"])}:{},...U.options.name?{name:h(U.options.name)}:{},...U.options.domain?{domain:h(U.options.domain)}:{},...U.options.corpId?{corpId:h(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:h(U.options["corp-id"])}:{},...U.options.appKey?{appKey:h(U.options.appKey)}:{},...U.options["app-key"]?{appKey:h(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:h(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:h(U.options["app-security"])}:{},...U.options.force!==void 0?{force:Z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:Z0(U.options.overwrite)}:{}};await cl(Q);return}if($==="add-seal"){let Q={...y8(U.json),...U.options.name?{name:h(U.options.name)}:{},...U.options.token?{token:h(U.options.token)}:{},...U.options.sealUrl?{sealUrl:h(U.options.sealUrl)}:{},...U.options.url?{sealUrl:h(U.options.url)}:{},...U.options.force!==void 0?{force:Z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:Z0(U.options.overwrite)}:{}};await sS1(Q);return}if($==="add-link"){let z=Y??h(U.options.link)??h(U.options.url);if(!z)throw Error("Usage: seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--as-hose] [--overwrite]");if(Z0(U.options["as-hose"])===!0||Z0(U.options.hose)===!0){await tS1(z,h(U.options.name),Z0(U.options.overwrite)===!0,Z0(U.options.force)===!0,{appKey:h(U.options["app-key"])??h(U.options.appKey),keyId:h(U.options["key-id"])??h(U.options.keyId)});return}await aS1(z,h(U.options.name),Z0(U.options.overwrite)===!0);return}if($==="extract-keys"||$==="extract-key"){let z=Y??h(U.options.link)??h(U.options.url);if(!z)throw Error("Usage: seal-use corps extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--app-key <key>] [--key-i Line truncated
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);I=Q}else if(I=j1(Q.testCorpId),I.environment!=="test"&&!J)throw Error(`Target enterprise '${I.name}' (${I.id}) is marked as '${I.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);let K=h(U.options.recordId)??h(U.options["record-id"])??h(U.options.id),G=h(U.options.recordIds)??h(U.options["record-ids"]),H=G?G.split(",").map((x)=>x.trim()).filter(Boolean):void 0,W=h(U.options.sn)??h(U.options.documentSn)??h(U.options["document-sn"]),X=h(U.options.sns)??h(U.options["document-sns"]),Z=X?X.split(",").map((x)=>x.trim()).filter(Boolean):void 0,q=s0(U.options.limit)??(!K&&!H&&!W&&!Z?1:void 0),V=h(U.options.status),F=h(U.options.startDate)??h(U.options["start-date"]),M=h(U.options.endDate)??h(U.options["end-date"]),w=await B1(Q),N=Q.id===I.id?w:await B1(I),O=h(U.options.webhook)??h(U.options.selector),D=h(U.options.snSuffix)??h(U.options["sn-suffix"]),P=h(U.options.snPrefix)??h(U.options["sn-prefix"]),T=h(U.options.docIdSuffix)??h(U.options["doc-id-suffix"]),A=h(U.options.docIdPrefix)??h(U.options["doc-id-prefix"]),j=Z0(U.options.dryRun)??Z0(U.options["dry-run"]),C={recordId:K,recordIds:H,sn:W,sns:Z,limit:q,status:V,startDate:F,endDate:M};console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${I.name}」(${I.id})`);let b=await tI({query:C,sourceClient:w,targetClient:N,sourceCorp:Q,targetCorp:I,webhookSelector:O,snPrefix:P,snSuffix:D,docIdPrefix:A,docIdSuffix:T,dryRun:j});if(j){console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),console.log(JSON.stringify(b,null,2));return}if(b.success)if(b.totalCount===1&&b.replayedDocument)console.error(`\uD83D\uDFE2 成功重放单据「${b.replayedDocument.documentSN}」至 ${I.name} (${b.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDFE2 成功重放 ${b.successCount} 条单据(来自「${Q.name}」)至「${I.name}」(${b.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${b.successCount} 条,失败 ${b.failureCount} 条)至「${I.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${I.id} --limit ${b.totalCount}`),console.log(JSON.stringify(b,null,2)),!b.success)process.exitCode=1;return}if($==="switch"){let z=Y;if(!z)throw Error("Usage: seal-use corps switch <corpId>");let Q=_4();if(!Q.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=j1(z);Hz({...Q,stateful:!0,defaultCorpId:J.id}),f0({current:!0,id:J.id,name:J.name});return}if($==="probe-hose"){await oS1(y8(U.json));return}if($==="hose-staffs"){await rS1(y8(U.json));return}if($==="add-hose"){let Q={...y8(U.json),...U.options.staffName?{staffName:h(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:h(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:h(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:h(U.options["staff-phone"])}:{},...U.options.name?{name:h(U.options.name)}:{},...U.options.domain?{domain:h(U.options.domain)}:{},...U.options.corpId?{corpId:h(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:h(U.options["corp-id"])}:{},...U.options.appKey?{appKey:h(U.options.appKey)}:{},...U.options["app-key"]?{appKey:h(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:h(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:h(U.options["app-security"])}:{},...U.options.force!==void 0?{force:Z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:Z0(U.options.overwrite)}:{}};await cl(Q);return}if($==="add-seal"){let Q={...y8(U.json),...U.options.name?{name:h(U.options.name)}:{},...U.options.token?{token:h(U.options.token)}:{},...U.options.sealUrl?{sealUrl:h(U.options.sealUrl)}:{},...U.options.url?{sealUrl:h(U.options.url)}:{},...U.options.force!==void 0?{force:Z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:Z0(U.options.overwrite)}:{}};await sS1(Q);return}if($==="add-link"){let z=Y??h(U.options.link)??h(U.options.url);if(!z)throw Error("Usage: seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--as-hose] [--overwrite]");if(Z0(U.options["as-hose"])===!0||Z0(U.options.hose)===!0){await tS1(z,h(U.options.name),Z0(U.options.overwrite)===!0,Z0(U.options.force)===!0,{appKey:h(U.options["app-key"])??h(U.options.appKey),keyId:h(U.options["key-id"])??h(U.options.keyId)});return}await aS1(z,h(U.options.name),Z0(U.options.overwrite)===!0);return}if($==="extract-keys"||$==="extract-key"){let z=Y??h(U.options.link)??h(U.options.url);if(!z)throw Error("Usage: seal-use corps extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--app-key <key>] [--key-i Line truncated
`);throw Error(`Missing required parameter: staffId. 当前企业共配置了 ${C.length} 位管理员账号(手机号已脱敏):
`+`${b}
@@ -925,18 +925,18 @@ or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you ex
`+` • 按姓名选择:追加 --staffName <姓名>(支持关键字,如: --staffName 谢子豪)
`+` • 按手机选择:追加 --staffPhone <手机号>(支持手机后4位,如: --staffPhone 5678)
`+" • 或传 force:true / --force 自动使用默认首位管理员。")}}}if(!F)if(!W&&J)F=J;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let M=X4($,"id")??Z,w=Y??q??Z,N=X4($,"sealUrl")??`https://${Z.toLowerCase()}.sealai.cc`,O={id:M,name:w,environment:"production",seal:{url:N,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:X,appKey:U,appSecurity:z,corpId:Z,staffId:F},auth:{refreshTtl:300}};if(W){aw(M);let T=await xK(O);if((!Y||Y===Z)&&T.tenantName&&T.tenantName!==Z)w=T.tenantName,O.name=T.tenantName}let D=Up();ov0(D,{recursive:!0,mode:448});let P=sv0(D,`${LT(M)}.json`);if(lv0(P)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${P}。如需覆盖已有配置,请在命令行追加 --overwrite 或在 JSON 参数中添加 "overwrite": true。`);rv0(P,`${JSON.stringify(O,null,2)}
`,{mode:384}),b0({id:M,name:w,corpId:Z,domain:X,staffId:F,verified:W,path:P})}async function sS1($){let Y=m3($,"token"),U=(X4($,"sealUrl")??X4($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let z=Dl($,"expiresIn")??2592000,Q=$.force===!0||$.verify===!1?!1:!0,J=ev0($),I=Q?await eS1(U,Y,A6(J)):void 0;Yh0($,{token:Y,sealUrl:U,expiresIn:z,verify:Q,remote:I,custom:J})}function ev0($){return{headers:an.parse($.headers),cookies:tn.parse($.cookies)}}async function aS1($,Y,U){let z=await tw($),Q=T8(z.sealUrl,z.token),J=await W8(Q),I={user:J.user,tenant:J.tenant};ew(z.corpId,I.tenant),Yh0({id:z.corpId,corpId:z.corpId,name:Y,provider:"hosecloud",overwrite:U},{token:z.token,sealUrl:z.sealUrl,expiresIn:z.expiresIn,verify:!0,remote:I})}function $h0($,Y,U,z){if($.length===0)throw Error(`[合思子域提权] 未能从协助链接中提取到合思企业 [${Y}] 的 OpenAPI 密钥凭据。
`,{mode:384}),f0({id:M,name:w,corpId:Z,domain:X,staffId:F,verified:W,path:P})}async function sS1($){let Y=m3($,"token"),U=(X4($,"sealUrl")??X4($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let z=Dl($,"expiresIn")??2592000,Q=$.force===!0||$.verify===!1?!1:!0,J=ev0($),I=Q?await eS1(U,Y,A6(J)):void 0;Yh0($,{token:Y,sealUrl:U,expiresIn:z,verify:Q,remote:I,custom:J})}function ev0($){return{headers:an.parse($.headers),cookies:tn.parse($.cookies)}}async function aS1($,Y,U){let z=await tw($),Q=T8(z.sealUrl,z.token),J=await W8(Q),I={user:J.user,tenant:J.tenant};ew(z.corpId,I.tenant),Yh0({id:z.corpId,corpId:z.corpId,name:Y,provider:"hosecloud",overwrite:U},{token:z.token,sealUrl:z.sealUrl,expiresIn:z.expiresIn,verify:!0,remote:I})}function $h0($,Y,U,z){if($.length===0)throw Error(`[合思子域提权] 未能从协助链接中提取到合思企业 [${Y}] 的 OpenAPI 密钥凭据。
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。");if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q){console.error(`
❌ 未找到指定的合思 OpenAPI 密钥 (${U.appKey??U.keyId})。`),console.error(`ℹ️ 该合思企业当前存在以下 ${$.length} 套候选密钥:`);for(let J of $){let I=J.active?"\uD83D\uDFE2 启用":"⚪ 停用";console.error(` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${I})`)}throw new w4("指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。",2,`${z} --app-key ${$[0].appKey}`)}return Q}if($.length===1)return $[0];console.error(`
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:`);for(let Q=0;Q<$.length;Q++){let J=$[Q],I=J.active?"\uD83D\uDFE2 启用":"⚪ 停用",K=J.name||"未命名应用";console.error(` [${Q+1}] "${K}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${I})`)}throw console.error(`
\uD83D\uDC49 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:`),console.error(` 在命令后追加 --app-key <key> 或 --key-id <id> 参数。
`),new w4(`合思企业 [${Y}] 存在多套 OpenAPI 密钥,必须指定 --app-key 或 --key-id 明确选择要绑定的密钥。`,2,`${z} --app-key ${$[0].appKey}`)}async function tS1($,Y,U,z=!1,Q){console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");let J=await kS($),I=$h0(J.keys,J.corpId,Q??{},'seal-use corps add-link "<url>" --as-hose');console.error(`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${I.appKey}, 应用: "${I.name||"未命名应用"}"),正在初始化为长期合思标准配置...`),await cl({domain:J.baseUrl,appKey:I.appKey,appSecurity:I.appSecurity,corpId:J.corpId,name:Y??J.corpName,staffId:J.staffId,overwrite:U,force:z})}async function RT($,Y){let U=await kS($),z=Y.reveal===!0;if(Y.save){let Q=$h0(U.keys,U.corpId,{appKey:Y.appKey,keyId:Y.keyId},'seal-use corps extract-keys "<url>" --save');console.error(`ℹ️ [合思子域提权] 正在将选定的合思 OpenAPI 密钥 (appKey: ${Q.appKey}, 应用: "${Q.name||"未命名应用"}") 保存为标准合思企业配置...`),await cl({domain:U.baseUrl,appKey:Q.appKey,appSecurity:Q.appSecurity,corpId:U.corpId,name:Y.name??U.corpName,staffId:U.staffId,overwrite:Y.overwrite,force:Y.force});return}if(!z)console.error(`ℹ️ [合思子域提权] 成功提取合思 (Hose) OpenAPI 密钥。接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文;附加 --save 可将临时会话提权并持久化为标准合思企业。
`);else console.error(`⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。
`);b0({provider:"hose",capability:"privilege-elevation",corpId:U.corpId,corpName:U.corpName??U.corpId,baseUrl:U.baseUrl,staffId:U.staffId,keyCount:U.keys.length,keys:U.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:yS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function nl($,Y){let U=j1($),z=Y.reveal===!0;if(U.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
`);f0({provider:"hose",capability:"privilege-elevation",corpId:U.corpId,corpName:U.corpName??U.corpId,baseUrl:U.baseUrl,staffId:U.staffId,keyCount:U.keys.length,keys:U.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:yS(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function nl($,Y){let U=j1($),z=Y.reveal===!0;if(U.source.type!=="hose")throw new w4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
`+"OpenAPI 密钥查询与提权能力专属于合思生态租户(用于从合思协助链接或合思凭据中提取开发者密钥提升权限等级),非合思渠道企业不支持此能力。",2);let Q=U.source.appKey??U.source.key,J=U.source.appSecurity??U.source.password;if(!z)console.error(`\uD83D\uDCA1 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。
`);else console.error(`⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。
`);b0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?z?J:yS(J):"-",active:!0})}function Yh0($,Y){let{token:U,sealUrl:z,expiresIn:Q,verify:J,remote:I}=Y,K=Y.custom??ev0($),G=I?.user,H=I?.tenant,W=X4($,"tenantSlug")??s2(H?.tenantSlug),X=X4($,"tenantId")??s2(H?.id),Z=X4($,"tenantName")??s2(H?.name),q=X4($,"id")??W??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=X4($,"provider")??s2(G?.provider)??s2(H?.providerConfig?.provider),M=X4($,"corpId")??W??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:z,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:z,expiresIn:Q,staffId:V,corpId:M,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},N=Up();ov0(N,{recursive:!0,mode:448});let O=sv0(N,`${LT(q)}.json`);if(lv0(O)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${O}. Pass "overwrite": true to replace it.`);rv0(O,`${JSON.stringify(w,null,2)}
`,{mode:384}),b0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:J,path:O})}async function eS1($,Y,U={}){let z=T8($,Y,U),Q=await W8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var pl=m(()=>{t9();jH();i8();y3();uv0();iB();$p();X6();X6();bl();SZ();CT();f4();L$();D4();J4()});async function zh0($,Y){let U=$??h(Y.options.link)??h(Y.options.url);if(!U)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let z=Z0(Y.options.reveal)===!0||Z0(Y.options.r)===!0||Z0(Y.options.plain)===!0,Q=Z0(Y.options.save)===!0||Z0(Y.options.add)===!0;await RT(U,{reveal:z,save:Q,name:h(Y.options.name),overwrite:Z0(Y.options.overwrite)===!0,force:Z0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function Qh0($,Y,U){if($==="diagnose"){b0(await $g1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source.type==="seal"){let z=await B1(Y),Q=h(U.options.note)??"CLI generated provisional access link",J=await _9("seal_delegation_create",z,Y,{note:Q});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);b0(J);return}if($==="hose-link"){let z=U.options.expire,Q=z!==void 0?s0(z):7200;if(Q===void 0||Q<=0)throw Error(`Invalid --expire: ${String(z)}. Must be a positive number of seconds (e.g. --expire 7200 or --expire 86400).`);let J=Z0(U.options.force)===!0||Z0(U.options.refresh)===!0||Z0(U.options.f)===!0;b0(await P00(Y,Q,{force:J}));return}if($==="keys"){let z=Z0(U.options.reveal)===!0||Z0(U.options.r)===!0||Z0(U.options.plain)===!0;await nl(Y.id,{reveal:z});return}throw Error(`Unknown auth command: ${$??""}. Run 'seal-use help' for available commands.`)}async function $g1($){if($.source.type!=="hose"){let F=await B1($),M=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}aw($.id);let Y=$.source,U=Y.appKey??Y.key,z=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,I=[];if(!U||!z)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await _T("hose.openapi",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:U,appSecurity:z}),M=l3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(l3(M.corporation).id),expireTime:Tq(M.expireTime)}}});I.push(K.public);let G=K.private?.token,H=G?await _T("hose.provisional",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),M=b6(l3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Nq(M)}}}):dl("hose.provisional");I.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await _T("seal.sso",async()=>{let M=await T8(Q,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=l3(M.data),N=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!N)throw Error("Seal SSO did not return a bearer token");return{token:N,public:{sealUrl:Q,expiresIn:Tq(M.expiresIn)??Tq(M.expires_in)??Tq(w.expiresIn)??Tq(w.expires_in)}}}):dl("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await _T("seal.whoami",async()=>{let M=await T8(Q,q,W).get("api/v1/auth/me").json(),w=l3(M.data),N=l3(w.user??M.user),O=l3(w.tenant??M.tenant);return{public:{user:{id:b6(N.id),name:b6(N.name),isAdmin:Ug1(N.isAdmin),providerUserId:b6(N.providerUserId)},tenant:{id:b6(O.id),name:b6(O.name),tenantSlug:b6(O.tenantSlug),hoseCorpConfig:zg1(O.hoseCorpConfig)}}}}):dl("seal.whoami");return I.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:I.every((F)=>F.ok===!0),stages:I}}async function _T($,Y){try{let U=await Y();return{public:{name:$,ok:!0,...Jh0(U.public)},private:U.token?{token:U.token}:void 0}}catch(U){return{public:{name:$,ok:!1,error:Nq(U instanceof Error?U.message:String(U))}}}}function dl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,Y){let U=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return Yg1(U)}async function Yg1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let U=JSON.par Line truncated
`);f0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?z?J:yS(J):"-",active:!0})}function Yh0($,Y){let{token:U,sealUrl:z,expiresIn:Q,verify:J,remote:I}=Y,K=Y.custom??ev0($),G=I?.user,H=I?.tenant,W=X4($,"tenantSlug")??s2(H?.tenantSlug),X=X4($,"tenantId")??s2(H?.id),Z=X4($,"tenantName")??s2(H?.name),q=X4($,"id")??W??X;if(!q)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let V=X4($,"staffId")??s2(G?.providerUserId)??s2(G?.id)??"seal",F=X4($,"provider")??s2(G?.provider)??s2(H?.providerConfig?.provider),M=X4($,"corpId")??W??X??q,w={id:q,name:X4($,"name")??Z??q,environment:"production",seal:{url:z,tenantSlug:W,headers:K.headers,cookies:K.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:z,expiresIn:Q,staffId:V,corpId:M,tenantId:X,tenantSlug:W,tenantName:Z,providerUserId:s2(G?.providerUserId),provider:F},auth:{refreshTtl:300}},N=Up();ov0(N,{recursive:!0,mode:448});let O=sv0(N,`${LT(q)}.json`);if(lv0(O)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${O}. Pass "overwrite": true to replace it.`);rv0(O,`${JSON.stringify(w,null,2)}
`,{mode:384}),f0({id:q,name:w.name,tenantId:X,tenantSlug:W,verified:J,path:O})}async function eS1($,Y,U={}){let z=T8($,Y,U),Q=await W8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function s2($){return typeof $==="string"&&$?$:void 0}var pl=m(()=>{t9();jH();i8();y3();uv0();iB();$p();X6();X6();bl();SZ();CT();f4();L$();D4();J4()});async function zh0($,Y){let U=$??h(Y.options.link)??h(Y.options.url);if(!U)throw Error("Usage: seal-use auth extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let z=Z0(Y.options.reveal)===!0||Z0(Y.options.r)===!0||Z0(Y.options.plain)===!0,Q=Z0(Y.options.save)===!0||Z0(Y.options.add)===!0;await RT(U,{reveal:z,save:Q,name:h(Y.options.name),overwrite:Z0(Y.options.overwrite)===!0,force:Z0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function Qh0($,Y,U){if($==="diagnose"){f0(await $g1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source.type==="seal"){let z=await B1(Y),Q=h(U.options.note)??"CLI generated provisional access link",J=await T5("seal_delegation_create",z,Y,{note:Q});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);f0(J);return}if($==="hose-link"){let z=U.options.expire,Q=z!==void 0?s0(z):7200;if(Q===void 0||Q<=0)throw Error(`Invalid --expire: ${String(z)}. Must be a positive number of seconds (e.g. --expire 7200 or --expire 86400).`);let J=Z0(U.options.force)===!0||Z0(U.options.refresh)===!0||Z0(U.options.f)===!0;f0(await P00(Y,Q,{force:J}));return}if($==="keys"){let z=Z0(U.options.reveal)===!0||Z0(U.options.r)===!0||Z0(U.options.plain)===!0;await nl(Y.id,{reveal:z});return}throw Error(`Unknown auth command: ${$??""}. Run 'seal-use help' for available commands.`)}async function $g1($){if($.source.type!=="hose"){let F=await B1($),M=await W8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:M.user,tenant:M.tenant}]}}aw($.id);let Y=$.source,U=Y.appKey??Y.key,z=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,I=[];if(!U||!z)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=await _T("hose.openapi",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:U,appSecurity:z}),M=l3(F.value),w=b6(M.accessToken)??b6(F.accessToken)??b6(F.token);if(!w)throw Error("Hose login did not return an access token");return{token:w,public:{corporationId:b6(M.corporationId)??b6(l3(M.corporation).id),expireTime:Tq(M.expireTime)}}});I.push(K.public);let G=K.private?.token,H=G?await _T("hose.provisional",async()=>{let F=await Uh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),M=b6(l3(F.value).message);if(!M)throw Error("Hose CloseAPI did not return a provisional auth URL");let w=new URL(M).searchParams.get("accessToken");if(!w)throw Error("Hose provisional auth URL did not include accessToken");return{token:w,public:{uid:J,enterpriseUrl:Nq(M)}}}):dl("hose.provisional");I.push(H.public);let W=A6($.seal),X=H.private?.token,Z=X?await _T("seal.sso",async()=>{let M=await T8(Q,void 0,W).get(`api/auth/oauth2/session/oem-hosecloud?token=${encodeURIComponent(X)}&returnToken=1`).json(),w=l3(M.data),N=b6(M.token)??b6(M.accessToken)??b6(w.token)??b6(w.accessToken);if(!N)throw Error("Seal SSO did not return a bearer token");return{token:N,public:{sealUrl:Q,expiresIn:Tq(M.expiresIn)??Tq(M.expires_in)??Tq(w.expiresIn)??Tq(w.expires_in)}}}):dl("seal.sso");I.push(Z.public);let q=Z.private?.token,V=q?await _T("seal.whoami",async()=>{let M=await T8(Q,q,W).get("api/v1/auth/me").json(),w=l3(M.data),N=l3(w.user??M.user),O=l3(w.tenant??M.tenant);return{public:{user:{id:b6(N.id),name:b6(N.name),isAdmin:Ug1(N.isAdmin),providerUserId:b6(N.providerUserId)},tenant:{id:b6(O.id),name:b6(O.name),tenantSlug:b6(O.tenantSlug),hoseCorpConfig:zg1(O.hoseCorpConfig)}}}}):dl("seal.whoami");return I.push(V.public),{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:I.every((F)=>F.ok===!0),stages:I}}async function _T($,Y){try{let U=await Y();return{public:{name:$,ok:!0,...Jh0(U.public)},private:U.token?{token:U.token}:void 0}}catch(U){return{public:{name:$,ok:!1,error:Nq(U instanceof Error?U.message:String(U))}}}}function dl($){return{public:{name:$,ok:!1,skipped:!0}}}async function Uh0($,Y){let U=await fetch($,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(Y)});return Yg1(U)}async function Yg1($){let Y=await $.text();if(!$.ok)throw Error(`${$.status} ${Y}`);let U=JSON.par Line truncated
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -2550,10 +2550,10 @@ ${Io.map(($)=>`### \`seal-use ${$.domain}\`
- **环境自检**:运行 \`seal-use doctor\`,一键检查当前运行时版本、本地目录健康度、企业资产接入数量以及守护服务状态。
- **查看企业配置源文件**:运行 \`seal-use corps get <corpId>\`,可直接查看指定企业的本地 JSON 存储绝对路径。
- **查阅完整操作手册**:运行 \`seal-use doctor guide\` 随时在离线状态下查看本文档。
`}var Qo,Jo,Io;var Ko=m(()=>{Qo=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;附带软链接 seal-home -> seal-use 兼容旧指令。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Jo=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Io=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合思单据指定、 Line truncated
`)}var DS0=m(()=>{Lp();e9();y3();Rq();iB();Ko()});var AS0={};x8(AS0,{formatTenantDoctorDashboard:()=>mg1,diagnoseTenantContract:()=>dg1});async function dg1($,Y){let U=[],z=Y.environment==="test"?"test":"production",Q=z==="test"?Y.prodCorpId:Y.testCorpId,J=z==="test"?"prodParent":"testTarget",I=Q?z==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,K=null,G=null;try{let w=await W8($);if(K=w.user,G=w.tenant,Boolean(K?.isAdmin||K?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${K.name??"未知"}」(${K.id??""}),具备完整操作权限`,details:{userId:K.id,userName:K.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:K.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${K.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:K.id,userName:K.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:K.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(w){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)},recommendation:`请执行 seal-use auth login --corp ${Y.id} 重新登录或更新 Token`})}let H={featureCode:"ai-approval",balance:0,deductionAmount:120,estimatedRuns:0,status:"exhausted"},W={used:0,remaining:0};try{let w=await nY($),N=Array.isArray(w.features)?w.features:[],O=N.find((P)=>P?.code==="ai-approval");if(O){let P=typeof O.balance==="number"?O.balance:0,T=typeof O.deductionAmount==="number"&&O.deductionAmount>0?O.deductionAmount:120,A=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=A,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:"请联系管理员为企业充值 AI 审批额度"});else if(A<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${A} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:"建议在发起大规模自动化回归前充值补充额度"});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${A} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:A}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:N.map((P)=>P?.code)}});let D=N.find((P)=>P?.code==="approval-rules");if(D)W.used=typeof D.used==="number"?D.used:0,W.remaining=typeof D.remaining==="number"?D.remaining:0}catch(w){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let w=await p6($),N=Array.isArray(w.rules)?w.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((O)=>O.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:z==="test"&&Q?`可运行 seal-use corps sync-test --corp ${Q} 从生产企业同步规则`:"可运行 seal-use rules add 创建基础规则"});else U.push({id:"rules_status",name:"审核规则状态",status:"pass",summary:`审核规则健康:共 ${X.totalCount} 条规则,其中生效活跃 ${X.activeCount} 条`,details:{totalCount:X.totalCount,activeCount:X.activeCount,quotaUsed:W.used,quotaRemaining:W.remaining}})}catch(w){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let w=await J$($);Z.integrationCount=w.length;let N=w.find((O)=>O.name.includes("回放")||O.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??w[0]?.id,w.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"warn",summary:"未配置任何 Webhook 集成通道,执行重放测试时将自动创建临时回放通道",details:{integrationCount:0},recommendation:"可运行 seal-use webhook Line truncated
`}var Qo,Jo,Io;var Ko=m(()=>{Qo=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;附带软链接 seal-home -> seal-use 兼容旧指令。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Jo=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Io=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合思单据指定、 Line truncated
`)}var DS0=m(()=>{Lp();e9();y3();Rq();iB();Ko()});var AS0={};x8(AS0,{formatTenantDoctorDashboard:()=>mg1,diagnoseTenantContract:()=>dg1});async function dg1($,Y){let U=[],z=Y.environment==="test"?"test":"production",Q=z==="test"?Y.prodCorpId:Y.testCorpId,J=z==="test"?"prodParent":"testTarget",I=Q?z==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,K=null,G=null;try{let w=await W8($);if(K=w.user,G=w.tenant,Boolean(K?.isAdmin||K?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${K.name??"未知"}」(${K.id??""}),具备完整操作权限`,details:{userId:K.id,userName:K.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:K.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${K.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:K.id,userName:K.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:K.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(w){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)},recommendation:`请执行 seal-use auth login --corp ${Y.id} 重新登录或更新 Token`})}let H={featureCode:"ai-approval",balance:0,deductionAmount:120,estimatedRuns:0,status:"exhausted"},W={used:0,remaining:0};try{let w=await nY($),N=Array.isArray(w.features)?w.features:[],O=N.find((P)=>P?.code==="ai-approval");if(O){let P=typeof O.balance==="number"?O.balance:0,T=typeof O.deductionAmount==="number"&&O.deductionAmount>0?O.deductionAmount:120,A=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=A,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`请前往后台充值补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else if(A<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${A} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`建议补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${A} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:A}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:N.map((P)=>P?.code)}});let D=N.find((P)=>P?.code==="approval-rules");if(D)W.used=typeof D.used==="number"?D.used:0,W.remaining=typeof D.remaining==="number"?D.remaining:0}catch(w){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let w=await p6($),N=Array.isArray(w.rules)?w.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((O)=>O.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:z==="test"&&Q?`可运行 seal-use corps sync-test --corp ${Q} 从生产企业同步规则`:"可运行 seal-use rules add 创建基础规则"});else U.push({id:"rules_status",name:"审核规则状态",status:"pass",summary:`审核规则健康:共 ${X.totalCount} 条规则,其中生效活跃 ${X.activeCount} 条`,details:{totalCount:X.totalCount,activeCount:X.activeCount,quotaUsed:W.used,quotaRemaining:W.remaining}})}catch(w){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let w=await J$($);Z.integrationCount=w.length;let N=w.find((O)=>O.name.includes("回放")||O.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??w[0]?.id,w.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将 Line truncated
`)}var BS0=m(()=>{X6()});async function PS0($,Y,U){let z=($??Y??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(FS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=Go();b0(I.directories);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),w_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),_00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),H_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (BS0(),AS0)),X=G(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(W(V));b0(V);return}let Q=Go();if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(NS0(Q));b0(Q)}var TS0=m(()=>{DS0();Ko();D4();J4()});var ES0;var jS0=m(()=>{ES0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.32",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-use http`, or the `seal-use service start` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local Line truncated
`),console.log(FS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=Go();f0(I.directories);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),w_0)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),_00)),{stringOption:G}=await Promise.resolve().then(() => (D4(),H_0)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (BS0(),AS0)),X=G(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(W(V));f0(V);return}let Q=Go();if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(NS0(Q));f0(Q)}var TS0=m(()=>{DS0();Ko();D4();J4()});var ES0;var jS0=m(()=>{ES0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.32",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-use http`, or the `seal-use service start` daemon). Loopback-only by default."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps","x-implementation-status":"implemented",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig","x-implementation-status":"planned",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local Line truncated
the credentials already stored on this machine for the selected enterprise. Keep it bound
to loopback (\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
do not control.
@@ -2583,21 +2583,21 @@ do not control.
</body>
</html>`}var _S0=m(()=>{e9()});import{URL as og1}from"node:url";async function _6($,Y,U,z){let Q=$.handler;return Q(Y,U,{corp:z})}async function vS0($,Y){if(Y.setHeader("Access-Control-Allow-Origin","*"),Y.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),Y.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){Y.writeHead(204),Y.end();return}let U=$.headers.host||"localhost",z=$.headers["x-forwarded-proto"]||"http",Q=new og1($.url||"/",`${z}://${U}`),J=Q.pathname.replace(/\/+$/,"")||"/",I=($.method||"GET").toUpperCase();try{if(I==="GET"&&J==="/"){A4(Y,200,{name:"seal-use",version:P1,description:"Seal tenant operations and approval automation HTTP API",docs:"/docs",openapi:"/openapi.json",health:"/health",endpoints:{cli:"POST /api/cli",tools:"GET /api/tools",toolInvoke:"POST /api/tool/:name",restV1:"GET/POST /v1/*"}});return}if(I==="GET"&&J==="/docs"){sg1(Y,200,RS0());return}if(I==="GET"&&J==="/openapi.json"){A4(Y,200,hT());return}if(I==="GET"&&J==="/health"){A4(Y,200,{status:"ok",version:P1,name:"seal-use",timestamp:new Date().toISOString()});return}if(I==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){A4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(I==="POST"&&J==="/api/cli"){let K=await gT($),G=(typeof K?.command==="string"?K.command:"").trim();if(!G){ST(Y,400,"Missing 'command' property in request body");return}let H=_q(G),W=H[0]==="seal-use"||H[0]==="seal-home"||H[0]?.endsWith("/seal-use")||H[0]?.endsWith("/seal-home")?H.slice(1):H,X=await vq(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}A4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(I==="POST"&&J.startsWith("/api/tool/")){let K=J.slice(10).trim(),G=M6(K);if(!G){ST(Y,404,`Tool not found: '${K}'`);return}let H=await gT($)||{},W=k8($,Q,H),X=j1(W),Z=await B1(X),q={...H};delete q.corp;let V=await _6(G,Z,q,X);A4(Y,200,V);return}if(J.startsWith("/v1/")){if(await rg1($,Y,I,J,Q))return}ST(Y,404,`Cannot ${I} ${J}. Visit /docs for available endpoints.`)}catch(K){let G=K instanceof Error?K.message:String(K);ST(Y,500,G)}}async function rg1($,Y,U,z,Q){let J=Object.fromEntries(Q.searchParams.entries());if(U==="GET"&&z==="/v1/corps"){let I=s8(),K=_4();return A4(Y,200,{count:I.length,mode:K.stateful?"stateful":"stateless",defaultCorpId:K.defaultCorpId,corps:I.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&z==="/v1/whoami"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_whoami"),W=await _6(H,G,{},K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/session"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_session_get"),W=await _6(H,G,{},K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/summary"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_runs_summary"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/stats"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_runs_stats"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/pick"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_run_pick"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/url"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_run_url_get"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(z.startsWith("/v1/approval-runs/")){let I=z.slice(18).split("/"),K=I[0],G=I[1];if(K&&!["summary","pick","stats","url","bridge"].includes(K)){let H=k8($,Q,J),W=j1(H),X=await B1(W);if(!G){let Z=M6("seal_approval_run_get"),q=await _6(Z,X,{recordId:K,...J},W);return A4(Y,200,q),!0}if(G==="attachments"){let Z=M6("seal_approval_run_attachments_get"),q=await _6(Z,X,{recordId:K,...J},W);return A4(Y,200,q),!0}if(G==="cited-rules"){let Z=M6("seal_approval_run_cited_rules_get"),q=await _6(Z,X,{recordId:K,...J},W);return A4(Y,200,q),!0}if(G==="document-summary"){let Z=M6("seal_approval_run_document_summary_get"),q=await _6(Z,X,{recordId:K,...J},W);return A4(Y,200,q),!0}if(G==="result"){let Z=M6("seal_approval_run_result_get"),q=await _6(Z,X,{recordId:K,...J},W);return A4(Y,200,q),!0}}}if(U==="GET"&&z==="/v1/approval-runs"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_runs_search"),W=await _6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval/rules"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_approval_rules_list"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(U==="GET"&&z==="/v1/simulation/batches"){let I=k8($,Q,J),K=j1(I),G=await B1(K),H=M6("seal_simulation_batches_list"),W=await _6(H,G,J,K);return A4(Y,200,W),!0}if(U==="POST"&&z==="/v1/simulation/create-batchLine truncated
\uD83D\uDE80 seal-use HTTP Server (v${P1}) started`),console.error(` URL: http://${U}:${Y}`),console.error(` Docs: http://${U}:${Y}/docs`),console.error(` OpenAPI: http://${U}:${Y}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${Y}/api/cli`),console.error(` REST API: http://${U}:${Y}/v1/...
`);Q(z)})})}var yT=8787,kT="127.0.0.1";var Xo=m(()=>{hS0();e9()});async function SS0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),z=await xT({port:Y,host:U}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var gS0=m(()=>{D4();Xo()});async function yS0($,Y,U,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,U,{},C0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,U,{},C0(z.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var kS0=m(()=>{f4();J4()});async function xS0($,Y){if($==="config"||$==="json"){Zo();return}let{startServer:U}=await bS0().then(() => uS0);U()}function Zo(){b0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var fS0=m(()=>{J4()});function iS0($){let Y=hT();b0(Y,{...C0($.options),allowFull:!0})}var cS0=m(()=>{Ho();J4()});async function nS0($,Y,U,z){if($==="available"){await k0("seal_permissions_available_list",Y,U,{},C0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,U,{},C0(z.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var pS0=m(()=>{f4();J4()});import{readFileSync as dS0}from"node:fs";async function mS0($,Y,U,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(Y==="policies"){if(U==="list"||!U){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(U==="upsert"){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(U==="remove"||U==="delete"){let K=z??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var lS0=m(()=>{f4();D4();J4()});async function oS0($={}){let Y=s8(),U=_4(),z=u2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},S3());console.log(`[probe] corp=${z.id} source=${z.source.type}`);let Q=await xK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await B1(z),I=await OM(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error: ${I.stylePreferences.error}`},null,2))}var rS0=m(()=>{y3();i8();CT();X6()});async function sS0($,Y,U){let z=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await oS0({corpId:z})}var aS0=m(()=>{rS0();D4()});async function qo($,Y,U,z,Q){if($==="count"){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}if($==="list"){if(Z0(Q.options.count)){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(Z0(Q.options.summary)){await k0("seal_approval_rules_list",U,z,{fields:V_0,limit:J,offset:I},C0(Q.options));return}let K=await _9("seal_approval_rules_list",U,z,{limit:J,offset:I});L_0(K,Z0(Q.options.full)===!0),b0(K);return}if($==="clear"){let J=Z0(Q.options.yes)===!0,I=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"])??!J;if(!J&&!I)throw D9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${z.id} --dry-run`);let K=await _9("seal_approval_rules_clear",U,z,{dryRun:I,recode:Z0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){b0({...K, Line truncated
`);Q(z)})})}var yT=8787,kT="127.0.0.1";var Xo=m(()=>{hS0();e9()});async function SS0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),z=await xT({port:Y,host:U}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var gS0=m(()=>{D4();Xo()});async function yS0($,Y,U,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,U,{},C0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,U,{},C0(z.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var kS0=m(()=>{f4();J4()});async function xS0($,Y){if($==="config"||$==="json"){Zo();return}let{startServer:U}=await bS0().then(() => uS0);U()}function Zo(){f0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var fS0=m(()=>{J4()});function iS0($){let Y=hT();f0(Y,{...C0($.options),allowFull:!0})}var cS0=m(()=>{Ho();J4()});async function nS0($,Y,U,z){if($==="available"){await k0("seal_permissions_available_list",Y,U,{},C0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,U,{},C0(z.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var pS0=m(()=>{f4();J4()});import{readFileSync as dS0}from"node:fs";async function mS0($,Y,U,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},C0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(Y==="policies"){if(U==="list"||!U){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},C0(I.options));return}if(U==="upsert"){let K=h(I.options.input),G=K?JSON.parse(dS0(K,"utf8")):y8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}if(U==="remove"||U==="delete"){let K=z??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:Z0(I.options.dryRun)??Z0(I.options["dry-run"])},C0(I.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var lS0=m(()=>{f4();D4();J4()});async function oS0($={}){let Y=s8(),U=_4(),z=u2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},S3());console.log(`[probe] corp=${z.id} source=${z.source.type}`);let Q=await xK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await B1(z),I=await OM(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error: ${I.stylePreferences.error}`},null,2))}var rS0=m(()=>{y3();i8();CT();X6()});async function sS0($,Y,U){let z=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await oS0({corpId:z})}var aS0=m(()=>{rS0();D4()});async function qo($,Y,U,z,Q){if($==="count"){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}if($==="list"){if(Z0(Q.options.count)){await k0("seal_approval_rules_list",U,z,{countOnly:!0},C0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(Z0(Q.options.summary)){await k0("seal_approval_rules_list",U,z,{fields:V_0,limit:J,offset:I},C0(Q.options));return}let K=await T5("seal_approval_rules_list",U,z,{limit:J,offset:I});L_0(K,Z0(Q.options.full)===!0),f0(K);return}if($==="clear"){let J=Z0(Q.options.yes)===!0,I=Z0(Q.options.dryRun)??Z0(Q.options["dry-run"])??!J;if(!J&&!I)throw A9("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${z.id} --dry-run`);let K=await T5("seal_approval_rules_clear",U,z,{dryRun:I,recode:Z0(Q.options.recode)});if(!J&&I&&K&&typeof K==="object"){f0({...K, Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function Uy1($){let Y=iT($),U=Fo($),z=hq($);Ug0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):yT),J=$.host??(process.env.HOST?process.env.HOST:kT);uT(Y,`${process.pid}
`,{mode:384}),uT(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),uK(z,`service starting on http://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await xT({port:Q,host:J,silent:!0}),uK(z,`service listening pid=${process.pid}`)}catch(G){if(uK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),bT(Y)===process.pid)h9(Y,{force:!0}),h9(U,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(bT(Y)===process.pid)h9(Y,{force:!0}),h9(U,{force:!0});uK(z,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function eS0($){Ug0($.stateDir);let Y=bK($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...U.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=tg1(U.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=iT($);return uT(J,`${Q.pid}
`,{mode:384}),uK(hq($),`started pid=${Q.pid}`),{started:!0,...bK($)}}function $g0($,Y={}){let U=iT($),z=Fo($),Q=bT(U);if(!Q||!Yg0(Q,$.appRoot))return h9(U,{force:!0}),h9(z,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Q,"SIGTERM"),h9(U,{force:!0}),h9(z,{force:!0}),uK(hq($),`stop requested pid=${Q}`),Y.quiet?void 0:{stopped:!0,pid:Q}}function Yg0($,Y){if(!zy1($))return!1;try{let U=eg1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),z=U.trim().split(/\s+/).filter(Boolean),Q=z.indexOf("service"),J=Q!==-1&&z[Q+1]==="run",I=U.includes(Y)||z.some((K)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(K));return J&&I}catch{return!1}}function zy1($){try{return process.kill($,0),!0}catch{return!1}}function iT($){return Lo($.stateDir,"service.pid")}function Fo($){return Lo($.stateDir,"service.json")}function hq($){return Lo($.stateDir,"service.log")}function bT($){if(!fT($))return;let Y=Number(Vo($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function Ug0($){$y1($,{recursive:!0,mode:448})}function uK($,Y){uT($,`${new Date().toISOString()} ${Y}
`,{flag:"a",mode:384})}var wo=m(()=>{Xo()});import{homedir as Qy1}from"node:os";import{join as Jy1}from"node:path";async function Oo($,Y,U){let z=U?s0(U.options.port)??s0(U.options.p):void 0,Q=U?h(U.options.host)??h(U.options.h):void 0,J=U?s0(U.options.lines)??s0(U.options.n):void 0,I=await kz($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Mo,version:P1,launcher:Y.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)b0(I)}var Mo;var No=m(()=>{e9();wo();J4();D4();Mo=Jy1(Qy1(),".config","seal-use")});import{existsSync as Iy1,readFileSync as zg0}from"node:fs";async function Qg0($,Y,U,z,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",U,z,{batchId:J,query:h(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(zg0(K,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(zg0(H,"utf8")):y8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=Z0(Q.options.noWait)??Z0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",U,z,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(Q.options["thinking-depth"]),skipInvoiceGeneration:Z0(Q.options.skipInvoiceGeneration)??Z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:Z0(Q.options.skipExpenseExtraction)??Z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:Z0(Q.options.disableAttachmentCache)??Z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:W},C0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",U,z,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",U,z,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",U,z,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",U,z,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",U,z,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",U,z,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",U,z,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",U,z,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",U,z,{},C0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Iy1(J))throw Error(`File not found: ${J}`);await k0("seal_simulation_material_package_upload",U,z,{filePath:J},C0(Q.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}var Jg0=m(()=>{f4();D4();J4()});import{existsSync as Ig0}from"node:fs";import{join as cT}from"node:path";function Kg0($,Y,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${zoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=Z0(U.options.local)||Z0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:z?cT(process.cwd(),".agents","skills","seal-use"):yz(),I=LS0(J),K=!z&&!Q,G=K?rl():void 0,H=K?tl():void 0;b0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=yz(),Q=cT(process.cwd(),".agents","skills","seal-use"),J=sl(),I=el();b0({global:{dir:z,installed:Ig0(cT(z,"SKILL.md"))},local:{dir:Q,installed:Ig0(cT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Gg0=m(()=>{Yo();Rq();D4();J4()});async function Hg0($,Y){if($==="config"){b0(await xK(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var Wg0=m(()=>{CT();J4()});function Do($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Xg0($){let{sourceCorp:Y,targetCorp:U,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new w4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`,{flag:"a",mode:384})}var wo=m(()=>{Xo()});import{homedir as Qy1}from"node:os";import{join as Jy1}from"node:path";async function Oo($,Y,U){let z=U?s0(U.options.port)??s0(U.options.p):void 0,Q=U?h(U.options.host)??h(U.options.h):void 0,J=U?s0(U.options.lines)??s0(U.options.n):void 0,I=await kz($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Mo,version:P1,launcher:Y.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)f0(I)}var Mo;var No=m(()=>{e9();wo();J4();D4();Mo=Jy1(Qy1(),".config","seal-use")});import{existsSync as Iy1,readFileSync as zg0}from"node:fs";async function Qg0($,Y,U,z,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await k0("seal_simulation_batch_records_get",U,z,{batchId:J,query:h(Q.options.query)},C0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(zg0(K,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(zg0(H,"utf8")):y8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=u6(Q.options.packageIds)??u6(Q.options["package-ids"])??(X?[X]:void 0),q=u6(Q.options.flowIds)??u6(Q.options["flow-ids"])??u6(Q.options.documentSn)??u6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=Z0(Q.options.noWait)??Z0(Q.options["no-wait"]);await k0("seal_simulation_batch_create",U,z,{mode:I,sourceSystem:I,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(Q.options["thinking-depth"]),skipInvoiceGeneration:Z0(Q.options.skipInvoiceGeneration)??Z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:Z0(Q.options.skipExpenseExtraction)??Z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:Z0(Q.options.disableAttachmentCache)??Z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:u6(Q.options.requestIds)??u6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:u6(Q.options.flowStatusList)?.map(Number)??u6(Q.options["flow-status-list"])?.map(Number),businessCodes:u6(Q.options.businessCodes)??u6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:u6(Q.options.status),limit:s0(Q.options.limit),noWait:F,rawParams:W},C0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await k0("seal_simulation_batch_wait",U,z,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},C0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await k0("seal_simulation_batch_status",U,z,{batchId:J},C0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await k0("seal_simulation_batch_clean",U,z,{batchId:J},C0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",U,z,{signKey:J},C0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",U,z,{},C0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",U,z,{limit:s0(Q.options.limit)},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await k0("seal_simulation_batch_get",U,z,{batchId:J},C0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",U,z,{},C0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",U,z,{},C0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Iy1(J))throw Error(`File not found: ${J}`);await k0("seal_simulation_material_package_upload",U,z,{filePath:J},C0(Q.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}var Jg0=m(()=>{f4();D4();J4()});import{existsSync as Ig0}from"node:fs";import{join as cT}from"node:path";function Kg0($,Y,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${zoLine truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=Z0(U.options.local)||Z0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:z?cT(process.cwd(),".agents","skills","seal-use"):yz(),I=LS0(J),K=!z&&!Q,G=K?rl():void 0,H=K?tl():void 0;f0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=yz(),Q=cT(process.cwd(),".agents","skills","seal-use"),J=sl(),I=el();f0({global:{dir:z,installed:Ig0(cT(z,"SKILL.md"))},local:{dir:Q,installed:Ig0(cT(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Gg0=m(()=>{Yo();Rq();D4();J4()});async function Hg0($,Y){if($==="config"){f0(await xK(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var Wg0=m(()=>{CT();J4()});function Do($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Xg0($){let{sourceCorp:Y,targetCorp:U,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new w4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await nY(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*F;if(V<M)throw new w4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${M} 点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/F))})`);let w=await i4(z,{limit:J,status:"completed"}),N=Array.isArray(w.records)?w.records:[];if(N.length===0){let d=await i4(z,{limit:J});N=Array.isArray(d.records)?d.records:[]}if(N.length===0)throw new w4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),I){let d=N.map((t)=>{let $0=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=Do(g),e=t?.result?.summary??t.aiSummary;return{sn:$0,sourceRecordId:t.id,prodDecision:p,prodSummary:e,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let O=await Gp(Q,U,$.webhookSelector),D=[];for(let d of N){let t=Date.now(),$0=d.sourceDocumentSN??d.id,g=Do(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let e=await H4(z,d.id),y=`${H}${$0}`,s=Ip(e,{snPrefix:H,docIdPrefix:H});await Kp(O.incomingDocumentWebhook.url,O.secret,s,W,A6(U.seal));let Y0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((W0)=>setTimeout(W0,K));let a=await i4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let W0=a.records[0];if(W0.status==="completed"||W0.status==="failed"){Y0=W0;break}}}if(!Y0){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-t});continue}let E0=Do(Y0?.result?.decision??Y0.aiDecision??Y0?.decision??(Y0.status==="completed"?"APPROVE":"ERROR")),G0=Y0?.result?.summary??Y0.aiSummary,T0=g===E0,i0=T0?"MATCHED":"FLIPPED",Y1={sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:Y0.id,testDecision:E0,testSummary:G0,status:i0,durationMs:Date.now()-t};if(!T0)Y1.diff={from:g,to:E0,reasonDiff:G0&&p&&G0!==p?`生产: ${p.slice(0,60)}... -> 测试: ${G0.slice(0,60)}...`:void 0};D.push(Y1)}catch(e){D.push({sn:$0,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:e instanceof Error?e.message:String(e),durationMs:Date.now()-t})}}let P=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,x=C+b,S=x>0?C/x:0,i=b>0,c=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,k;try{let d=await nY(Q),$0=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!i&&j===0,verdict:c,safeToPublish:z0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:F,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:A,records:D}}function Zg0($){let{sourceCorp:Y,targetCorp:U,verdict:z,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,H=z==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":z==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA [Seal Use Test] 规则回归测试矩阵: 生产「${Y.name}」-> 测试靶场「${U.name}」`,` 判定: ${H} · 准许发布: ${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),` 样本总数: ${J.sampleCount} | 一致通过: ${J.matchCount} | 决策翻转: ${J.flipCount} | 异常失败: ${J.failureCount}`,` 一致率: ${(J.concordanceRate*100).toFixed(1)}% | 消耗预估: ${I.estimatedRequired} 点 (余量: ${I.balanceBefore}${I.balanceAfter!==void 0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(` ⚠️ 决策翻转清单 (${K.length} 笔单据在新规则下结果改变):`);for(let X of K)if(W.push(` • 单据 [${X.sn}]: 原生产判定「${X.prodDecision}」 ➔ 测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(` 理由差异: ${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(z==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100 Line truncated
`)}var qg0=m(()=>{L$();X6();SZ()});async function Ao($,Y,U){let z=($??Y??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=h(U.options.corp)??(Y&&Y!==z?Y:void 0),J=j1(Q),I=J,K=J;if(J.environment==="test"){K=J;let O=h(U.options["prod-corp"])??h(U.options.prod)??J.prodCorpId;if(!O)throw new w4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);I=j1(O)}else{I=J;let O=h(U.options["test-corp"])??h(U.options.test)??J.testCorpId;if(!O)throw new w4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);K=j1(O)}let G=await B1(I),H=await B1(K),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=Z0(U.options["dry-run"]),Z=Z0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,F=h(U.options["sn-prefix"])??"REG_",M=h(U.options.webhook)??h(U.options.selector),w=await Xg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:M});if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(Zg0(w));if(b0(w),Z&&!w.ok)throw new w4(`回归测试发现 ${w.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new w4(`未知的 test 子命令: "${z}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Vg0=m(()=>{L$();f4();D4();J4();i8();qg0()});async function Lg0($,Y,U,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,U,y8(z.json),C0(z.options))}var Fg0=m(()=>{f4();D4();J4()});function wg0(){b0(Lq.map(($)=>({name:$.name,description:$.description})))}var Mg0=m(()=>{wq();J4()});function nT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Og0=m(()=>{Rq()});import{existsSync as Ky1,mkdirSync as Gy1,readFileSync as Hy1,renameSync as Wy1,writeFileSync as Xy1}from"node:fs";import{homedir as Zy1}from"node:os";import{dirname as qy1,join as Vy1}from"node:path";import{spawn as Ly1}from"node:child_process";function Ng0(){let $=process.env[Fy1]?.trim();if($)return $;return My1}function Dg0($=Ng0()){if(!Ky1($))return null;try{let Y=Hy1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return U;return null}catch{return null}}function pT($,Y=Ng0()){try{let U=qy1(Y);Gy1(U,{recursive:!0,mode:448});let z={checkedAt:$.checkedAt??new Date().toISOString(),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Xy1(Q,JSON.stringify(z,null,2),{mode:384}),Wy1(Q,Y)}catch{}}function Ag0($,Y=wy1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Bg0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Ly1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Fy1="SEAL_USE_UPDATE_CACHE_FILE",wy1=86400000,My1;var Bo=m(()=>{My1=Vy1(Zy1(),".config","seal-use","update-cache.json")});import{chmodSync as Oy1,mkdirSync as Ny1,readdirSync as Dy1,renameSync as Po,rmSync as Ay1,unlinkSync as Eg0,writeFileSync as Pg0}from"node:fs";import{basename as By1,dirname as Py1,join as mT}from"node:path";import{spawnSync as iK}from"node:child_process";async function Rg0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Mo,version:P1,launcher:$.launcher},z=Y.repo||process.env[Ty1]?.trim()||process.env[jy1]?.trim()||Cg0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Sg0(D,P1);if(P<0)if(!uS&&Y.force);else{b0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:!uS?`Cannot downgrade seal-use from dev build v${P1} to release v${D}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${P1} to older version v${D}. Updates must be forward-only.`});return}if(P===0&&!Y.force){b0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:`seal-use is already at version v${P1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await To(z,Y.limit??10);b0({currentVersion:P1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===P1,isNewer:xz(P.version,P1)}))});return}if(!nT()){if(Y.checkOnly){let P=await To(z,30),T=P[0],A=T?.version??P1,j=P.find((x)=>x.version===P1),C=xz(A,P1),b=P.filter((x)=>xz(x.version,P1));if(T?.version)pT({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;b0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let D=bK(U).running;if(D)await kz("stop",U);try{jg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`git pull skipped: ${P instanceof Error?P.message:String(P)}`)}if(jg0("bun",["install"],{cwd:$.appRoot}),D)await kz("start",U);b0({updated:!0,serviceRestarted:D,version:P1,mode:"source"});return}let I=Cy1(),K=Ry1(),G=await To(z,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await Tg0(z,J):G[0]??await Tg0(z);if(!H){b0({updated:!1,currentVersion:P1,mode:"binary",message:`Failed to query releases from repository '${z}'`});return}let W=H.version,X=G.find((D)=>D.version===P1),Z=xz(W,P1),q=Z||Boolean(Y.force),V=G.filter((D)=>xz(D.version,P1));if(H?.version)pT({latestVersion:H.version,publishedAt:H.publishedAt Line truncated
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);K=j1(O)}let G=await B1(I),H=await B1(K),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=Z0(U.options["dry-run"]),Z=Z0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,F=h(U.options["sn-prefix"])??"REG_",M=h(U.options.webhook)??h(U.options.selector),w=await Xg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:M});if(!(Z0(U.options.quiet)||Z0(U.options.silent)))console.error(Zg0(w));if(f0(w),Z&&!w.ok)throw new w4(`回归测试发现 ${w.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new w4(`未知的 test 子命令: "${z}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Vg0=m(()=>{L$();f4();D4();J4();i8();qg0()});async function Lg0($,Y,U,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,U,y8(z.json),C0(z.options))}var Fg0=m(()=>{f4();D4();J4()});function wg0(){f0(Lq.map(($)=>({name:$.name,description:$.description})))}var Mg0=m(()=>{wq();J4()});function nT($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var Og0=m(()=>{Rq()});import{existsSync as Ky1,mkdirSync as Gy1,readFileSync as Hy1,renameSync as Wy1,writeFileSync as Xy1}from"node:fs";import{homedir as Zy1}from"node:os";import{dirname as qy1,join as Vy1}from"node:path";import{spawn as Ly1}from"node:child_process";function Ng0(){let $=process.env[Fy1]?.trim();if($)return $;return My1}function Dg0($=Ng0()){if(!Ky1($))return null;try{let Y=Hy1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return U;return null}catch{return null}}function pT($,Y=Ng0()){try{let U=qy1(Y);Gy1(U,{recursive:!0,mode:448});let z={checkedAt:$.checkedAt??new Date().toISOString(),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Xy1(Q,JSON.stringify(z,null,2),{mode:384}),Wy1(Q,Y)}catch{}}function Ag0($,Y=wy1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Bg0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Ly1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Fy1="SEAL_USE_UPDATE_CACHE_FILE",wy1=86400000,My1;var Bo=m(()=>{My1=Vy1(Zy1(),".config","seal-use","update-cache.json")});import{chmodSync as Oy1,mkdirSync as Ny1,readdirSync as Dy1,renameSync as Po,rmSync as Ay1,unlinkSync as Eg0,writeFileSync as Pg0}from"node:fs";import{basename as By1,dirname as Py1,join as mT}from"node:path";import{spawnSync as iK}from"node:child_process";async function Rg0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Mo,version:P1,launcher:$.launcher},z=Y.repo||process.env[Ty1]?.trim()||process.env[jy1]?.trim()||Cg0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Sg0(D,P1);if(P<0)if(!uS&&Y.force);else{f0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:!uS?`Cannot downgrade seal-use from dev build v${P1} to release v${D}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${P1} to older version v${D}. Updates must be forward-only.`});return}if(P===0&&!Y.force){f0({updated:!1,currentVersion:P1,targetVersion:D,mode:nT()?"binary":"source",message:`seal-use is already at version v${P1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await To(z,Y.limit??10);f0({currentVersion:P1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===P1,isNewer:xz(P.version,P1)}))});return}if(!nT()){if(Y.checkOnly){let P=await To(z,30),T=P[0],A=T?.version??P1,j=P.find((x)=>x.version===P1),C=xz(A,P1),b=P.filter((x)=>xz(x.version,P1));if(T?.version)pT({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;f0({updated:!1,updateAvailable:C,currentVersion:P1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let D=bK(U).running;if(D)await kz("stop",U);try{jg0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`git pull skipped: ${P instanceof Error?P.message:String(P)}`)}if(jg0("bun",["install"],{cwd:$.appRoot}),D)await kz("start",U);f0({updated:!0,serviceRestarted:D,version:P1,mode:"source"});return}let I=Cy1(),K=Ry1(),G=await To(z,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await Tg0(z,J):G[0]??await Tg0(z);if(!H){f0({updated:!1,currentVersion:P1,mode:"binary",message:`Failed to query releases from repository '${z}'`});return}let W=H.version,X=G.find((D)=>D.version===P1),Z=xz(W,P1),q=Z||Boolean(Y.force),V=G.filter((D)=>xz(D.version,P1));if(H?.version)pT({latestVersion:H.version,publishedAt:H.publishedAt Line truncated
`)}catch{}}async function hy1($,Y,U,z){let Q=jo(),J=[],I=U?U.startsWith("v")?U:`v${U}`:void 0,K=z||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Cg0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let F=0;F<G.length;F++){let M=G[F],w=new AbortController,N="",O=(A)=>{N=A;try{w.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{dT(`==> [${F+1}/${G.length}] Downloading via: ${M}`);let A=await fetch(M,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let c=Buffer.from(await A.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Pg0(Y,c),dT(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let b=[],x=0,S=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),z0,k=new Promise((g,p)=>{z0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([c,k])}finally{if(z0)clearTimeout(z0)}let{done:t,value:$0}=d;if(t)break;if($0){if(b.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let p=j?Math.round(x/j*100):0,e=(x/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${e} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let i=Buffer.concat(b);if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);Pg0(Y,i),dT(`✓ Download completed successfully (${(i.length/1024/1024).toFixed(1)} MB)`);return}catch(A){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let j=N||(A instanceof Error?A.message:String(A));H=Error(j),dT(`
↳ Mirror failed: ${H.message}`)}finally{if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P)}}throw Error(`Failed to download asset from all mirrors: ${H?.message}`)}function vg0($){let Y;try{Y=Dy1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let z of Y){let Q=mT($,z.name);if(z.isDirectory())U.push(...vg0(Q));else if(z.isFile())U.push(Q)}return U}function hg0($,Y,U){let z=Y==="windows"?"seal-use.exe":"seal-use",Q=vg0($);return Q.find((J)=>By1(J)===z)??Q[0]??U}function Sy1($,Y,U){let z=iK("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract tar archive: ${z.stderr.toString()}`);return Eg0($),hg0(Y,U,$)}function gy1($,Y,U){let z=iK("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract zip archive: ${z.stderr.toString()}`);return Eg0($),hg0(Y,U,$)}function Sg0($,Y){let U=$.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0),z=Y.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0);for(let Q=0;Q<Math.max(U.length,z.length);Q++){let J=U[Q]??0,I=z[Q]??0;if(J>I)return 1;if(J<I)return-1}return 0}function xz($,Y){return Sg0($,Y)>0}function jg0($,Y,U={}){let z=iK($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(z.stdout)console.error(z.stdout.trimEnd());if(z.stderr)console.error(z.stderr.trimEnd());if(z.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${z.status}`)}var Cg0="yunyingk/seal-use",Sq="yunyingk/seal-home",Ty1="SEAL_USE_GITHUB_REPO",jy1="SEAL_HOME_GITHUB_REPO";var gg0=m(()=>{Og0();Rq();Bo();e9();wo();J4();No()});async function yg0($,Y,U,z,Q){if($==="create"){let J=h(Q.options.name)??Y,I=h(Q.options.phone);if(!J||!I)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let K=h(Q.options.dept)??h(Q.options.departmentId);await k0("seal_user_create",U,z,{name:J,phone:I,departmentIds:K?[K]:void 0},C0(Q.options));return}if($==="reset-password"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users reset-password <userId>");await k0("seal_user_reset_password",U,z,{userId:J},C0(Q.options));return}if($==="search"||$==="list"){let J=Y??h(Q.options.keyword)??h(Q.options.query)??"";await k0("seal_user_search",U,z,{keyword:J},C0(Q.options));return}if($==="get"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await k0("seal_user_get",U,z,{userId:J},C0(Q.options));return}if($==="delete"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await k0("seal_user_delete",U,z,{userId:J},C0(Q.options));return}if($==="activate"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await k0("seal_user_activate",U,z,{userId:J},C0(Q.options));return}if($==="delegation"||$==="impersonate"){let J=Y??h(Q.options.userId)??h(Q.options.phone);if(!J)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let I=h(Q.options.note);await k0("seal_user_delegation_create",U,z,{userIdOrPhone:J,note:I},C0(Q.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var kg0=m(()=>{f4();D4();J4()});import{dirname as Eo,join as yy1}from"node:path";import{fileURLToPath as ky1}from"node:url";function by1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&uy1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function vq($,Y={}){if(by1($))return ug0($,Y);let U=fg0.then(()=>ug0($,Y));return fg0=U.then(()=>{return},()=>{return}),U}async function ug0($,Y){let U=[],z=[],Q=console.log,J=console.error,I={appRoot:Y.appRoot??xg0,entryFile:Y.entryFile??yy1(Y.appRoot??xg0,"src","cli.ts"),launcher:Y.launcher};console.log=(...K)=>{U.push(El(K))},console.error=(...K)=>{z.push(El(K))};try{return await iy1($,I),{stdout:Oq(U),stderr:Oq(z),isError:!1,exitCode:0}}catch(K){let G=Nq(K instanceof Error?K.message:String(K)),H=hZ(K);if(z.push(G),H.nextAction&&!G.includes("Next action:"))z.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:Oq(U),stderr:Oq(z),isError:!0,exitCode:H.exitCode}}finally{console.log=Q,console.error=J}}async function iy1($,Y){let U=Mq($),[z,Q,J]=U.command,I=z?.toLowerCase(),K=I?xy1.has(I):!1,G=K?"update":I;if(G==="version"||G==="v"||Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V)){let Z=Dg0(),q=Z?.latestVersion?xz(Z.latestVersion,cY.version):!1,V={...cY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${cY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
`);if(b0(V),Ag0(Z))Bg0(Y.launcher);return}let H=Z_0(U);if(H.isHelp){F_0(H.target);return}if(!G||!fy1.has(G))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(G==="webhook"&&(Q==="resource-pack"||Q==="pack"||Q==="material-pack")&&J==="preview"){let Z=U.command[3]??h(U.options.file)??h(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await O_0(Z,gK(U.options));return}if(G==="openapi"){iS0(U);return}if(G==="mcp-config"){Zo();return}if(G==="skill"){Kg0(Q,J,U);return}if(G==="mcp"||G==="server"){await xS0(Q,U);return}if(G==="probe"){await sS0(Q,J,U);return}if(G==="doctor"){await PS0(Q,J,U);return}if(G==="test"){await Ao(Q,J,U);return}if(G==="config"){Hh0(Q,J,U);return}if(G==="service"){await Oo(Q,Y,U);return}if(G==="stop"){await Oo("stop",Y,U);return}if(G==="http"||G==="serve"){await SS0(U);return}if(K||G==="changelog"){if(K&&z!=="update")console.error(`⚠️ Notice: '${z}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=Q?.toLowerCase(),q=G==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||Z0(U.options.changelog)===!0,V=Z==="check"||Z0(U.options.check)===!0||Z0(U.options["check-only"])===!0,F=Z0(U.options["bg-save"])===!0||Z0(U.options["silent-save"])===!0,M=h(U.options.version)??h(U.options.tag)??(!q&&!V&&!F&&Q&&!Q.startsWith("-")?Q:void 0);await Rg0(Y,{checkOnly:V||F,changelogOnly:q,limit:s0(U.options.limit),force:Z0(U.options.force),targetVersion:M,repo:h(U.options.repo),bgSave:F});return}if(G==="tools"&&Q==="list"){wg0();return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await Ao("regression",J,U);return}await av0(Q,J,U);return}if(G==="delegation"&&Q==="create"&&(("from-link"in U.options)||("link"in U.options))){let Z=h(U.options["from-link"])??h(U.options.link);if(!Z)throw Error("Usage: seal-use delegation create --from-link <url> [--note <note>]");await wh0(Z,h(U.options.note));return}if(G==="rules"&&Q==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=j1(h(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await qo(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key")){await zh0(J,U);return}let W=j1(h(U.options.corp));if(G==="source"){await Hg0(Q,W);return}if(G==="auth"){await Qh0(Q,W,U);return}let X=await B1(W);if(G==="delegation"){await Mh0(Q,J,X,W,U);return}if(G==="users"){await yg0(Q,J,X,W,U);return}if(G==="contacts"){await Xh0(Q,J,X,W,U);return}if(G==="data"){await qh0(Q,X,W,U);return}if(G==="llm"){await yS0(Q,X,W,U);return}if(G==="permissions"){await nS0(Q,X,W,U);return}if(G==="billing"){await Kh0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await OT(Q,J,X,W,U);return}if(G==="context"){await Lh0(X,W,U);return}if(G==="rules"){await qo(Q,J,X,W,U);return}if(G==="approval-runs"){await N_0(Q,J,X,W,U);return}if(G==="analytics"){await A_0(Q,J,X,W,U);return}if(G==="simulation"){await Qg0(Q,J,X,W,U);return}if(G==="deploy"){await Nh0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await mS0(Q,J,U.command[3],U.command[4],X,W,U);return}if(G==="tool"){await Lg0(Q,X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var xg0,xy1,fy1,uy1,fg0;var Wo=m(()=>{i8();e9();D_0();B_0();Ih0();Gh0();Wh0();Zh0();Vh0();Fh0();pl();Oh0();Dh0();TS0();gS0();kS0();fS0();cS0();pS0();lS0();aS0();tS0();No();Jg0();Gg0();Wg0();Vg0();Fg0();Mg0();gg0();Bo();kg0();Cl();L$();f4();D4();jl();J4();xg0=Eo(Eo(Eo(ky1(import.meta.url)))),xy1=new Set(["update","upgrade","up","self-update","selfupdate"]),fy1=new Set(["config","service","stop","http","serve","update","tools","corps","corp","tool","source","auth","delegation","users","contacts","data","llm","permissions","billing","webhook","webhooks","context","rules","approval-runs","analytics","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","doctor","changelog","test"]),uy1=new Set(["http","server","web","mcp"]);fg0=Promise.resolve()});function dy1($){let{command:Y}=Mq($),U=(Y[0]??"").toLowerCase();return{area:cy1[U]??U,actionTokens:Y.slice(1).map((z)=>z.toLowerCase())}}function bg0($){let Y,U;try{({area:Y,actionTokens:U}=dy1($))}catch{return!1}if(U.length===0&&py1.has(Y))return!0;if(Y==="tool"){let Q=U[0];return Q!==void 0&&eR0(Q)}let z=ny1[Y];if(!z)return!1;return z.some((Q)=>{let J=Q.split(" ").filter(Boolean);if(J.length===0)return U.length===0;if(J.length>U.length)return!1;return J.every((I,K)=>I===U[K])})}var cy1,ny1,py1;var ig0=m(()=>{wq();D4();cy1={corp:"corps",webhooks:"webhook",preferences:"preference"},ny1={corps:["list","search","get","current"],rules:["count","list","versions","version","get","search","lint","linters","pull"],webhook:["ready","status","list","get","resource-pack export","resource-pack preview"],"approval-runs":["summary","stats","count","export","flow","list","search","pick","bridge","get" Line truncated
`);if(f0(V),Ag0(Z))Bg0(Y.launcher);return}let H=Z_0(U);if(H.isHelp){F_0(H.target);return}if(!G||!fy1.has(G))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(G==="webhook"&&(Q==="resource-pack"||Q==="pack"||Q==="material-pack")&&J==="preview"){let Z=U.command[3]??h(U.options.file)??h(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await O_0(Z,gK(U.options));return}if(G==="openapi"){iS0(U);return}if(G==="mcp-config"){Zo();return}if(G==="skill"){Kg0(Q,J,U);return}if(G==="mcp"||G==="server"){await xS0(Q,U);return}if(G==="probe"){await sS0(Q,J,U);return}if(G==="doctor"){await PS0(Q,J,U);return}if(G==="test"){await Ao(Q,J,U);return}if(G==="config"){Hh0(Q,J,U);return}if(G==="service"){await Oo(Q,Y,U);return}if(G==="stop"){await Oo("stop",Y,U);return}if(G==="http"||G==="serve"){await SS0(U);return}if(K||G==="changelog"){if(K&&z!=="update")console.error(`⚠️ Notice: '${z}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=Q?.toLowerCase(),q=G==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||Z0(U.options.changelog)===!0,V=Z==="check"||Z0(U.options.check)===!0||Z0(U.options["check-only"])===!0,F=Z0(U.options["bg-save"])===!0||Z0(U.options["silent-save"])===!0,M=h(U.options.version)??h(U.options.tag)??(!q&&!V&&!F&&Q&&!Q.startsWith("-")?Q:void 0);await Rg0(Y,{checkOnly:V||F,changelogOnly:q,limit:s0(U.options.limit),force:Z0(U.options.force),targetVersion:M,repo:h(U.options.repo),bgSave:F});return}if(G==="tools"&&Q==="list"){wg0();return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await Ao("regression",J,U);return}await av0(Q,J,U);return}if(G==="delegation"&&Q==="create"&&(("from-link"in U.options)||("link"in U.options))){let Z=h(U.options["from-link"])??h(U.options.link);if(!Z)throw Error("Usage: seal-use delegation create --from-link <url> [--note <note>]");await wh0(Z,h(U.options.note));return}if(G==="rules"&&Q==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=j1(h(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await qo(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key")){await zh0(J,U);return}let W=j1(h(U.options.corp));if(G==="source"){await Hg0(Q,W);return}if(G==="auth"){await Qh0(Q,W,U);return}let X=await B1(W);if(G==="delegation"){await Mh0(Q,J,X,W,U);return}if(G==="users"){await yg0(Q,J,X,W,U);return}if(G==="contacts"){await Xh0(Q,J,X,W,U);return}if(G==="data"){await qh0(Q,X,W,U);return}if(G==="llm"){await yS0(Q,X,W,U);return}if(G==="permissions"){await nS0(Q,X,W,U);return}if(G==="billing"){await Kh0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await OT(Q,J,X,W,U);return}if(G==="context"){await Lh0(X,W,U);return}if(G==="rules"){await qo(Q,J,X,W,U);return}if(G==="approval-runs"){await N_0(Q,J,X,W,U);return}if(G==="analytics"){await A_0(Q,J,X,W,U);return}if(G==="simulation"){await Qg0(Q,J,X,W,U);return}if(G==="deploy"){await Nh0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await mS0(Q,J,U.command[3],U.command[4],X,W,U);return}if(G==="tool"){await Lg0(Q,X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var xg0,xy1,fy1,uy1,fg0;var Wo=m(()=>{i8();e9();D_0();B_0();Ih0();Gh0();Wh0();Zh0();Vh0();Fh0();pl();Oh0();Dh0();TS0();gS0();kS0();fS0();cS0();pS0();lS0();aS0();tS0();No();Jg0();Gg0();Wg0();Vg0();Fg0();Mg0();gg0();Bo();kg0();Cl();L$();f4();D4();jl();J4();xg0=Eo(Eo(Eo(ky1(import.meta.url)))),xy1=new Set(["update","upgrade","up","self-update","selfupdate"]),fy1=new Set(["config","service","stop","http","serve","update","tools","corps","corp","tool","source","auth","delegation","users","contacts","data","llm","permissions","billing","webhook","webhooks","context","rules","approval-runs","analytics","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","doctor","changelog","test"]),uy1=new Set(["http","server","web","mcp"]);fg0=Promise.resolve()});function dy1($){let{command:Y}=Mq($),U=(Y[0]??"").toLowerCase();return{area:cy1[U]??U,actionTokens:Y.slice(1).map((z)=>z.toLowerCase())}}function bg0($){let Y,U;try{({area:Y,actionTokens:U}=dy1($))}catch{return!1}if(U.length===0&&py1.has(Y))return!0;if(Y==="tool"){let Q=U[0];return Q!==void 0&&eR0(Q)}let z=ny1[Y];if(!z)return!1;return z.some((Q)=>{let J=Q.split(" ").filter(Boolean);if(J.length===0)return U.length===0;if(J.length>U.length)return!1;return J.every((I,K)=>I===U[K])})}var cy1,ny1,py1;var ig0=m(()=>{wq();D4();cy1={corp:"corps",webhooks:"webhook",preferences:"preference"},ny1={corps:["list","search","get","current"],rules:["count","list","versions","version","get","search","lint","linters","pull"],webhook:["ready","status","list","get","resource-pack export","resource-pack preview"],"approval-runs":["summary","stats","count","export","flow","list","search","pick","bridge","get" Line truncated
`)?"":`
`}`);process.exitCode=$.exitCode}var o3,pg0,lT="seal_cli",kq="seal_cli_write",dg0="SEAL_USE_MCP_ENABLED",mg0="SEAL_HOME_MCP_ENABLED",oy1;var bS0=m(async()=>{je();Re();A$();Wo();ig0();L$();e9();o3=my1(import.meta.url),pg0=o3.includes("/dist/mcp/")||o3.includes("\\dist\\mcp\\")?gq(gq(gq(o3))):gq(gq(o3));oy1=Boolean(I0.main==I0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&cg0(process.argv[1])===cg0(o3));if(oy1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await ly1();else try{rg0()}catch($){console.error($),process.exitCode=1}});await bS0();export{_q as tokenizeCommand,rg0 as startServer,lg0 as resolveMcpEnabled,og0 as createServer,dg0 as SEAL_MCP_ENABLED_ENV,kq as SEAL_CLI_WRITE_TOOL_NAME,lT as SEAL_CLI_TOOL_NAME,mg0 as LEGACY_SEAL_MCP_ENABLED_ENV};
+11 -4
View File
@@ -54,7 +54,7 @@ export async function handleApprovalRunsCommand(
}
if (action === "stats") {
await runTool(
const result = (await runToolResult(
"seal_approval_runs_stats",
client,
corp,
@@ -64,9 +64,16 @@ export async function handleApprovalRunsCommand(
status: stringOption(args.options.status),
sourceSystem: stringOption(args.options.sourceSystem) ?? stringOption(args.options["source-system"]),
taskMode: stringOption(args.options.taskMode) ?? stringOption(args.options["task-mode"])
},
outputOptions(args.options)
);
}
)) as any;
if (result && typeof result.duplicateRuns === "number" && result.duplicateRuns > 0) {
console.error(
`ℹ️ 单据去重提示: 总记录 ${result.total} 笔,涵盖 ${result.unique} 笔独立单据 (含 ${result.duplicateRuns} 笔修改重推/重跑记录)`
);
}
printJson(result, outputOptions(args.options));
return;
}
+8 -6
View File
@@ -157,7 +157,7 @@ export async function diagnoseTenantContract(
status: "fail",
summary: `当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试`,
details: { balance, deductionAmount, estimatedRuns },
recommendation: "请联系管理员为企业充值 AI 审批额度"
recommendation: `请前往后台充值补充额度 (可通过 seal-use auth link --corp ${corp.id} 免密直达)`
});
} else if (estimatedRuns < 10) {
quotaInfo.status = "low";
@@ -167,7 +167,7 @@ export async function diagnoseTenantContract(
status: "warn",
summary: `额度偏低:剩余 ${balance} 点 (单笔扣除 ${deductionAmount} 点),仅可支持约 ${estimatedRuns} 笔审核`,
details: { balance, deductionAmount, estimatedRuns },
recommendation: "建议在发起大规模自动化回归前充值补充额度"
recommendation: `建议补充额度 (可通过 seal-use auth link --corp ${corp.id} 免密直达)`
});
} else {
quotaInfo.status = "sufficient";
@@ -275,10 +275,9 @@ export async function diagnoseTenantContract(
checks.push({
id: "webhook_integrations",
name: "单据推送 Webhook 通道",
status: "warn",
summary: "未配置任何 Webhook 集成通道,执行重放测试时将自动创建临时回放通道",
details: { integrationCount: 0 },
recommendation: "可运行 seal-use webhook add --name (回放通道) 手动注册专属通道"
status: "pass",
summary: "未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将自动创建)",
details: { integrationCount: 0 }
});
} else {
checks.push({
@@ -418,6 +417,9 @@ export function formatTenantDoctorDashboard(diagnosis: TenantDoctorDiagnosis): s
lines.push(" " + "─".repeat(60));
lines.push(` 检查汇总: 通过 ${summary.passedChecks} · 告警 ${summary.warningChecks} · 失败 ${summary.failedChecks}`);
if (quota.status === "exhausted" || quota.status === "low") {
lines.push(` 👉 Next action: seal-use auth link --corp ${corp.id}`);
}
lines.push("");
return lines.join("\n");
+7
View File
@@ -2652,10 +2652,17 @@ export const sealTools = [
if (key) uniqueKeys.add(String(key));
}
const duplicateRuns = Math.max(0, records.length - uniqueKeys.size);
return {
total: records.length,
dedupeBy,
unique: uniqueKeys.size,
duplicateRuns,
dedupeNote:
duplicateRuns > 0
? `存在 ${duplicateRuns} 笔重复运行记录 (同一单据重跑或修改重推)`
: "全部单据唯一,无重复记录",
byStatus,
bySourceSystem
};