Compare commits

...
49 Commits
Author SHA1 Message Date
yunyingk 83ade4dbf9 Merge pull request #71 from yunyingk/codex/release-v0.10.15
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Release v0.10.15: Contextual help, test enterprise pairing & sync, and directory normalization
2026-09-11 11:07:13 +08:00
gitea 8fa0016d89 Release v0.10.15: Contextual help, test enterprise pairing & sync, and directory normalization 2026-09-11 11:06:16 +08:00
yunyingk a521a24fe3 Merge pull request #70 from yunyingk/codex/contextual-command-help
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add contextual subcommand help to avoid context pollution
2026-09-11 11:03:36 +08:00
gitea 9a7be16d3b Add contextual subcommand help to avoid context pollution 2026-09-11 11:02:17 +08:00
yunyingk 9d6d11628e Merge pull request #69 from yunyingk/codex/cleanup-legacy-enterprise-dir
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Auto-migrate legacy enterprise directory and drop legacy reads
2026-09-11 10:49:45 +08:00
gitea 3d16857aeb Auto-migrate legacy enterprise directory and drop legacy reads 2026-09-11 10:47:59 +08:00
yunyingk ae5387e9aa Merge PR #68: Fix Gitea release fallback when artifact quota is full
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Fix Gitea release fallback when artifact quota is full
2026-09-11 10:47:55 +08:00
gitea bc6209749b Fix Gitea release fallback when artifact quota is full 2026-09-11 10:42:56 +08:00
yunyingk 08cbc541b4 Merge pull request #67 from yunyingk/codex/test-corp-binding-and-sync
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add test enterprise marking, binding, and staging sync commands
2026-09-11 10:30:20 +08:00
gitea a56606af9c Add test enterprise marking, binding, and staging sync commands 2026-09-11 10:28:52 +08:00
yunyingk f2595bb275 Merge pull request #66 from yunyingk/codex/unify-unknown-command-exit-codes
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Unify unknown command and subcommand exit code classification
2026-09-11 10:06:12 +08:00
gitea 0534651e0a Refine runner test for domain unknown subcommands 2026-09-11 10:05:19 +08:00
gitea 225321f34a Unify unknown command and subcommand exit code classification 2026-09-11 10:02:50 +08:00
yunyingk bda8b82157 Merge pull request #65 from yunyingk/codex/release-v0.10.14
Release v0.10.14
2026-09-11 09:45:43 +08:00
gitea 0e1f744c53 Release v0.10.14: unify staging capability coverage 2026-09-11 09:44:38 +08:00
yunyingk 6df9c817d4 Merge pull request #64 from yunyingk/codex/simulation-approval-definitions
Add simulation approval definition lookup
2026-09-11 01:57:08 +08:00
gitea 2a82017e50 Add simulation approval definition lookup 2026-09-11 01:55:56 +08:00
yunyingk bffd3998a3 Merge pull request #63 from yunyingk/codex/insight-default-range
Default insight stats to current month
2026-09-11 01:53:18 +08:00
gitea 41e31774ee Default insight stats to current month 2026-09-11 01:52:02 +08:00
yunyingk 83c11b7588 Merge pull request #62 from yunyingk/codex/financial-data-query
Add financial data list queries
2026-09-11 01:49:34 +08:00
gitea b94d6d11d5 Add financial data list queries 2026-09-11 01:47:47 +08:00
yunyingk a9f5e2d3ef Merge pull request #61 from yunyingk/codex/insight-stats
Add insight stats query
2026-09-11 01:43:35 +08:00
gitea a946cf45c9 Add insight stats query 2026-09-11 01:42:41 +08:00
yunyingk d3c9302c14 Merge pull request #60 from yunyingk/codex/contacts-read-api
Add read-only contacts directory APIs
2026-09-11 01:38:31 +08:00
gitea 17a31042a1 Add read-only contacts directory APIs 2026-09-11 01:37:10 +08:00
yunyingk 42403130e0 Add universal mutation preview mode
Merge reviewed fix for #46 after rebasing onto main.
2026-09-11 01:19:48 +08:00
gitea 690ee604f1 Merge main into mutation preview 2026-09-11 01:18:41 +08:00
yunyingk 5eb7c87e8d Standardize semantic CLI error handling
Merge reviewed fixes for #43 and #44 after CI validation.
2026-09-11 01:15:40 +08:00
gitea 370435bef9 Merge main into semantic CLI errors 2026-09-11 01:13:47 +08:00
yunyingk 8623f1ab64 Add non-blocking simulation status checks
Merge reviewed fix for #45.
2026-09-11 01:09:48 +08:00
yunyingk 5912d22ce4 Apply approval rule pushes incrementally
Merge reviewed fix for #50.
2026-09-11 01:08:59 +08:00
yunyingk 9f559ad94e Document draft and published rule code spaces
Merge reviewed fix for #51.
2026-09-11 01:08:43 +08:00
yunyingk fa72a53d61 Clarify knowledge document creation constraints
Merge reviewed fixes for #49 and #52.
2026-09-11 01:08:31 +08:00
yunyingk eac331922c Fix HTTP error response body reporting
Merge reviewed fix for #48.
2026-09-11 01:06:33 +08:00
gitea 5242df2392 Update semantic exit code test 2026-09-11 01:05:25 +08:00
gitea 138a4a9498 Add universal mutation preview mode 2026-09-11 00:45:27 +08:00
gitea 7bf40dd726 Standardize semantic CLI error handling 2026-09-11 00:28:09 +08:00
gitea 995b9fa81e Add non-blocking simulation status checks 2026-09-11 00:15:35 +08:00
gitea 1910faa8ea Apply approval rule pushes incrementally 2026-09-11 00:10:10 +08:00
gitea 73c0b24b48 Document draft and published rule code spaces 2026-09-11 00:06:16 +08:00
gitea cc7da4f421 Clarify knowledge document creation constraints 2026-09-11 00:04:06 +08:00
gitea 64692fecba Fix HTTP error response body reporting 2026-09-10 23:58:28 +08:00
yunyingk 0b10a70924 Merge pull request #47 from yunyingk/codex/custom-http-headers
Add per-enterprise custom HTTP headers and cookies
2026-09-10 17:17:44 +08:00
gitea bb8b5edec6 Add per-enterprise custom HTTP headers and cookies
Some Seal tenants sit behind a gateway that only forwards requests
carrying its own session cookie. Corp configs can now set
seal.headers/seal.cookies, which the client merges into every request;
cookies are rendered into one Cookie header and the session bearer
token still wins over any configured Authorization.

corps add-seal accepts both fields and applies them when verifying the
tenant, so a gated enterprise can be registered in one step.
2026-09-10 16:25:11 +08:00
yunyingk fc06434813 Merge pull request #42 from yunyingk/codex/material-pack-file-policy
Add configurable material pack attachment file policy
2026-09-08 15:17:18 +08:00
gitea 799cdd1b17 Refine material pack policy recovery guidance 2026-09-08 15:10:39 +08:00
gitea 79c9420e4e Add material pack attachment file policy 2026-09-08 14:54:51 +08:00
yunyingk e512ee68dc Merge pull request #41 from yunyingk/codex/release-v0.10.13
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled
🚀 Release / 📦 Sync Gitea Mirror (push) Has been cancelled
Release v0.10.13: Enforce material-pack scope isolation and strict path uniqueness
2026-09-08 10:01:04 +08:00
gitea 80e0dea178 Release v0.10.13: Enforce material-pack scope isolation and strict path uniqueness 2026-09-08 10:00:10 +08:00
59 changed files with 4894 additions and 517 deletions

No files matched your search

+16 -5
View File
@@ -83,6 +83,7 @@ jobs:
publish-gitea:
name: 📦 Sync Gitea Mirror
needs: build-and-publish-github
if: ${{ always() }}
runs-on: ubuntu-latest
continue-on-error: true
steps:
@@ -91,11 +92,21 @@ jobs:
with:
fetch-depth: 0
- name: Download binaries artifact
uses: actions/download-artifact@v4
with:
name: release-binaries
path: dist/bin/
# The GitHub artifact service can be unavailable or quota-limited even
# after the release upload succeeds. Download from the release itself so
# Gitea mirroring remains independent of ephemeral workflow artifacts.
- name: Download release assets from GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG_NAME="${{ github.event.inputs.tag || github.ref_name }}"
mkdir -p dist/bin
gh release download "${TAG_NAME}" \
--repo "${GITHUB_REPOSITORY}" \
--pattern 'seal-use-*' \
--pattern 'checksums.txt' \
--dir dist/bin \
--clobber
- name: Sync to Gitea Release
env:
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.12",
"version": "0.10.15",
"description": "Seal Use tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
"author": {
"name": "yingqing"
+65
View File
@@ -5,6 +5,71 @@ All notable changes to `seal-use` will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
## [0.10.15] - 2026-09-11
### Added & Enhanced
- **Contextual & Subcommand-Scoped CLI Help System**:
- Implemented structured help registry in `src/cli/help.ts` supporting hierarchical command lookups.
- Subcommands (e.g. `seal-use corps bind-test --help`) now show only targeted usage, options, and descriptions instead of dumping all 120+ top-level commands across unrelated domains.
- Domains (e.g. `seal-use corps --help`) now show only relevant domain commands.
- Eliminates context window pollution for AI agent harnesses and human operators while preserving backwards-compatible global `help`.
- **Production to Test Enterprise Association & Staging Rule Sync**:
- Added `seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]` establishing a strict 1-to-1 association.
- Added anti-chaining validation preventing test enterprises from being nested or looped as production parents.
- Added `seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]` to synchronize production draft rules and decision preferences to the bound test enterprise.
- Automatically publishes a new rule version on the test enterprise while guaranteeing production rules remain safely in draft state.
- Added `seal-use corps unbind-test [<corpId>] [--confirm]` and `corps mark <corpId> --env <production|test> [--confirm]`.
- **Configuration Directory Normalization & Migration**:
- Automatically syncs legacy enterprise configs (`~/.config/seal-home/enterprises`) into primary directory (`~/.config/seal-use/enterprises`).
- Restricts runtime enterprise loading strictly to the primary directory once present, preventing stale legacy reads.
- Safely deletes the legacy directory when all files are synchronized and unmodified for more than 7 days.
- **Release Pipeline & Exit Code Standardization**:
- Fixed Gitea release asset fallback when artifact quota is full.
- Standardized unknown command and subcommand error classifications to exit code 2.
## [0.10.14] - 2026-09-11
### Added
- **Material Pack Webhook Attachment File Policy**:
- Added per-Webhook minimum file size (default 500 bytes), optional maximum file size, and configurable file-extension whitelist.
- Added unified configuration fields for creating and updating Webhook policies.
- Enforced the policy before attachment upload and document push, with detailed validation errors and no partial push on failure.
- Added default support for common PDF, Office, text, email, and image formats.
- **Unified CLI coverage for staging frontend capabilities**:
- Added read-only contacts queries for department trees, department details, department users, and last synchronization time.
- Added `analytics insight` for risk-tag statistics with date-range filtering and current-month defaults.
- Added paginated `data expenses` and `data invoices` queries with frontend-compatible filters.
- Added `simulation approval-definitions` to discover Feishu approval codes before creating a test batch.
### Fixed & Enhanced
- Added non-blocking simulation status checks and `simulation create --no-wait`.
- Added semantic CLI exit codes and actionable next-command guidance.
- Added universal `--dry-run` previews for supported configuration and destructive operations.
- Changed approval-rule pushes to apply incrementally while preserving existing rule IDs.
- Preserved HTTP error response bodies for actionable upstream diagnostics.
- Documented draft versus published rule code spaces and knowledge-document creation constraints.
## [0.10.13] - 2026-09-08
### Fixed & Enhanced
- **Material Pack Scope Isolation & Strict Path Uniqueness**:
- Enforced per-document directory scope isolation: all attachments declared for a document must strictly reside in its own folder (`<documentId>/` or `<documentId>@annotation/`), preventing cross-document file borrowing or path confusion.
- Enforced global declaration uniqueness: identical attachment file paths can no longer be declared more than once across the entire material pack (even within the same document or different line-items). Multiple uses require placing distinct physical files in independent paths.
- Added comprehensive unit tests covering cross-document directory violations, intra-document duplicate paths, and multi-document path collisions.
- Updated documentation in `cli.md` detailing the strict scope isolation and declaration uniqueness rules.
## [0.10.12] - 2026-09-07
### Added & Refactored
- **Material Pack Pure Path Declaration & Validation Refactor**:
- Replaced ambiguous filename heuristics with explicit `[附件]` Excel column headers and full ZIP-relative file paths.
- Added `@` annotation suffix support for ZIP root directories (`<documentId>@annotation/`) to bypass document idempotency blocks safely.
- Enforced bidirectional validation between Excel declarations and ZIP entries without fail-fast, collecting all errors together.
- Added automatic key collision deduplication with numeric suffixes (`-2`, `-3`).
## [0.10.11] - 2026-09-07
### Added & Enhanced
+225 -180
View File
@@ -1,97 +1,97 @@
import{createRequire as qD0}from"node:module";var sL0=Object.create;var{getPrototypeOf:eL0,defineProperty:PO,getOwnPropertyNames:$D0}=Object;var ID0=Object.prototype.hasOwnProperty;function UD0($){return this[$]}var YD0,JD0,WI=($,I,U)=>{var Y=$!=null&&typeof $==="object";if(Y){var J=I?YD0??=new WeakMap:JD0??=new WeakMap,Q=J.get($);if(Q)return Q}U=$!=null?sL0(eL0($)):{};let K=I||!$||!$.__esModule?PO(U,"default",{value:$,enumerable:!0}):U;for(let q of $D0($))if(!ID0.call(K,q))PO(K,q,{get:UD0.bind($,q),enumerable:!0});if(Y)J.set($,K);return K};var N=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);var QD0=($)=>$;function KD0($,I){this[$]=QD0.bind(null,I)}var m8=($,I)=>{for(var U in I)PO($,U,{get:I[U],enumerable:!0,configurable:!0,set:KD0.bind(I,U)})};var r=qD0(import.meta.url);var vQ=N((Rf)=>{Object.defineProperty(Rf,"__esModule",{value:!0});Rf.regexpCode=Rf.getEsmExportName=Rf.getProperty=Rf.safeStringify=Rf.stringify=Rf.strConcat=Rf.addCodeArg=Rf.str=Rf._=Rf.nil=Rf._Code=Rf.Name=Rf.IDENTIFIER=Rf._CodeOrName=void 0;class EW{}Rf._CodeOrName=EW;Rf.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class oI extends EW{constructor($){super();if(!Rf.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Rf.Name=oI;class u$ extends EW{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((I,U)=>`${I}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((I,U)=>{if(U instanceof oI)I[U.str]=(I[U.str]||0)+1;return I},{})}}Rf._Code=u$;Rf.nil=new u$("");function Ef($,...I){let U=[$[0]],Y=0;while(Y<I.length)xP(U,I[Y]),U.push($[++Y]);return new u$(U)}Rf._=Ef;var hP=new u$("+");function Bf($,...I){let U=[CQ($[0])],Y=0;while(Y<I.length)U.push(hP),xP(U,I[Y]),U.push(hP,CQ($[++Y]));return CF0(U),new u$(U)}Rf.str=Bf;function xP($,I){if(I instanceof u$)$.push(...I._items);else if(I instanceof oI)$.push(I);else $.push(_F0(I))}Rf.addCodeArg=xP;function CF0($){let I=1;while(I<$.length-1){if($[I]===hP){let U=vF0($[I-1],$[I+1]);if(U!==void 0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}function vF0($,I){if(I==='""')return $;if($==='""')return I;if(typeof $=="string"){if(I instanceof oI||$[$.length-1]!=='"')return;if(typeof I!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return $.slice(0,-1)+I.slice(1);return}if(typeof I=="string"&&I[0]==='"'&&!($ instanceof oI))return`"${$}${I.slice(1)}`;return}function jF0($,I){return I.emptyStr()?$:$.emptyStr()?I:Bf`${$}${I}`}Rf.strConcat=jF0;function _F0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:CQ(Array.isArray($)?$.join(","):$)}function SF0($){return new u$(CQ($))}Rf.stringify=SF0;function CQ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Rf.safeStringify=CQ;function gF0($){return typeof $=="string"&&Rf.IDENTIFIER.test($)?new u$(`.${$}`):Ef`[${$}]`}Rf.getProperty=gF0;function yF0($){if(typeof $=="string"&&Rf.IDENTIFIER.test($))return new u$(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Rf.getEsmExportName=yF0;function hF0($){return new u$($.toString())}Rf.regexpCode=hF0});var bP=N((_f)=>{Object.defineProperty(_f,"__esModule",{value:!0});_f.ValueScope=_f.ValueScopeName=_f.Scope=_f.varKinds=_f.UsedValueState=void 0;var k6=vQ();class vf extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var RW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(RW||(_f.UsedValueState=RW={}));_f.varKinds={const:new k6.Name("const"),let:new k6.Name("let"),var:new k6.Name("var")};class uP{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return $ instanceof k6.Name?$:this.name($)}name($){return new k6.Name(this._newName($))}_newName($){let I=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){var I,U;if(((U=(I=this._parent)===null||I===void 0?void 0:I._prefixes)===null||U===void 0?void 0:U.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}_f.Scope=uP;class fP extends k6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=k6._`.${new k6.Name(I)}[${U}]`}}_f.ValueScopeName=fP;var oF0=k6._`\n`;class jf extends uP{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?oF0:k6.nil}}get(){return this._scope}name($){return new fP($,this._newName($))}value($,I){var U;if(I.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void 0?U:I.ref,K=this._values[J];if(K){let H=K.get(Q);if(Line truncated
`:""},this._extScope=$,this._scope=new f$.Scope({parent:$}),this._nodes=[new ff]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,I){let U=this._extScope.value($,I);return(this._values[U.prefix]||(this._values[U.prefix]=new Set)).add(U),U}getScopeValue($,I){return this._extScope.getValue($,I)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,I,U,Y){let J=this._scope.toName(I);if(U!==void 0&&Y)this._constants[J.str]=U;return this._leafNode(new gf($,J,U)),J}const($,I,U){return this._def(f$.varKinds.const,$,I,U)}let($,I,U){return this._def(f$.varKinds.let,$,I,U)}var($,I,U){return this._def(f$.varKinds.var,$,I,U)}assign($,I,U){return this._leafNode(new nP($,I,U))}add($,I){return this._leafNode(new yf($,u6.operators.ADD,I))}code($){if(typeof $=="function")$();else if($!==K1.nil)this._leafNode(new uf($));return this}object(...$){let I=["{"];for(let[U,Y]of $){if(I.length>1)I.push(",");if(I.push(U),U!==Y||this.opts.es5)I.push(":"),(0,K1.addCodeArg)(I,Y)}return I.push("}"),new K1._Code(I)}if($,I,U){if(this._blockNode(new a8($)),I&&U)this.code(I).else().code(U).endIf();else if(I)this.code(I).endIf();else if(U)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new a8($))}else(){return this._elseNode(new jQ)}endIf(){return this._endBlockNode(a8,jQ)}_for($,I){if(this._blockNode($),I)this.code(I).endFor();return this}for($,I){return this._for(new bf($),I)}forRange($,I,U,Y,J=this.opts.es5?f$.varKinds.var:f$.varKinds.let){let Q=this._scope.toName($);return this._for(new pf(J,Q,I,U),()=>Y(Q))}forOf($,I,U,Y=f$.varKinds.const){let J=this._scope.toName($);if(this.opts.es5){let Q=I instanceof K1.Name?I:this.var("_arr",I);return this.forRange("_i",0,K1._`${Q}.length`,(K)=>{this.var(J,K1._`${Q}[${K}]`),U(J)})}return this._for(new iP("of",Y,J,I),()=>U(J))}forIn($,I,U,Y=this.opts.es5?f$.varKinds.var:f$.varKinds.const){if(this.opts.ownProperties)return this.forOf($,K1._`Object.keys(${I})`,U);let J=this._scope.toName($);return this._for(new iP("in",Y,J,I),()=>U(J))}endFor(){return this._endBlockNode(rI)}label($){return this._leafNode(new hf($))}break($){return this._leafNode(new xf($))}return($){let I=new vW;if(this._blockNode(I),this.code($),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(vW)}try($,I,U){if(!I&&!U)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new nf;if(this._blockNode(Y),this.code($),I){let J=this.name("e");this._currNode=Y.catch=new jW(J),I(J)}if(U)this._currNode=Y.finally=new _W,this.code(U);return this._endBlockNode(jW,_W)}throw($){return this._leafNode(new kf($))}block($,I){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(I);return this}endBlock($){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let U=this._nodes.length-I;if(U<0||$!==void 0&&U!==$)throw Error(`CodeGen: wrong number of nodes: ${U} vs ${$} expected`);return this._nodes.length=I,this}func($,I=K1.nil,U,Y){if(this._blockNode(new CW($,I,U)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(CW)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,I){let U=this._currNode;if(U instanceof $||I&&U instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${$.kind}/${I.kind}`:$.kind}"`)}_elseNode($){let I=this._currNode;if(!(I instanceof a8))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let I=this._nodes;I[I.length-1]=$}}u6.CodeGen=cf;function B7($,I){for(let U in I)$[U]=($[U]||0)+(I[U]||0);return $}function SW($,I){return I instanceof K1._CodeOrName?B7($,I.names):$}function tI($,I,U){if($ instanceof K1.Name)return Y($);if(!J($))return $;return new K1._Code($._items.reduce((Q,K)=>{if(K instanceof K1.Name)K=Y(K);if(K instanceof K1._Code)Q.push(...K._items);else Q.push(K);return Q},[]));function Y(Q){let K=U[Q.str];if(K===void 0||I[Q.str]!==1)return Q;return delete I[Q.str],K}function J(Q){return Q instanceof K1._Code&&Q._items.some((K)=>K instanceof K1.Name&&I[K.str]===1&&U[K.str]!==void 0)}}function sF0($,I){for(let U in I)$[U]=($[U]||0)-(I[U]||0)}function df($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:K1._`!${pP($)}`}u6.not=df;var eF0=mf(u6.operators.AND);function $M0(...$){return $.reduce(eF0)}u6.and=$M0;var IM0=mf(u6.operators.OR);function UM0(...$){return $.reduce(IM0)}u6.or=UM0;function mf($){return(I,U)=>I===K1.nil?U:U===K1.nil?I:K1._`${pP(I)} ${$} ${pP(U)}`}function pP($){return $ instanceof K1.Name?$:K1._`(${Line truncated
|| (${K} == "string" && ${J} && ${J} == +${J})`).assign(q,r0._`+${J}`);return;case"integer":Y.elseIf(r0._`${K} === "boolean" || ${J} === null
|| (${K} === "string" && ${J} && ${J} == +${J} && !(${J} % 1))`).assign(q,r0._`+${J}`);return;case"boolean":Y.elseIf(r0._`${J} === "false" || ${J} === 0 || ${J} === null`).assign(q,!1).elseIf(r0._`${J} === "true" || ${J} === 1`).assign(q,!0);return;case"null":Y.elseIf(r0._`${J} === "" || ${J} === 0 || ${J} === false`),Y.assign(q,null);return;case"array":Y.elseIf(r0._`${K} === "string" || ${K} === "number"
|| ${K} === "boolean" || ${J} === null`).assign(q,r0._`[${J}]`)}}}function Dz0({gen:$,parentData:I,parentDataProperty:U},Y){$.if(r0._`${I} !== undefined`,()=>$.assign(r0._`${I}[${U}]`,Y))}function tP($,I,U,Y=aI.Correct){let J=Y===aI.Correct?r0.operators.EQ:r0.operators.NEQ,Q;switch($){case"null":return r0._`${I} ${J} null`;case"array":Q=r0._`Array.isArray(${I})`;break;case"object":Q=r0._`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":Q=K(r0._`!(${I} % 1) && !isNaN(${I})`);break;case"number":Q=K();break;default:return r0._`typeof ${I} ${J} ${$}`}return Y===aI.Correct?Q:(0,r0.not)(Q);function K(q=r0.nil){return(0,r0.and)(r0._`typeof ${I} == "number"`,q,U?r0._`isFinite(${I})`:r0.nil)}}Ab.checkDataType=tP;function aP($,I,U,Y){if($.length===1)return tP($[0],I,U,Y);let J,Q=(0,Fb.toHash)($);if(Q.array&&Q.object){let K=r0._`typeof ${I} != "object"`;J=Q.null?K:r0._`!${I} || ${K}`,delete Q.null,delete Q.array,delete Q.object}else J=r0.nil;if(Q.number)delete Q.integer;for(let K in Q)J=(0,r0.and)(J,tP(K,I,U,Y));return J}Ab.checkDataTypes=aP;var wz0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:I})=>typeof $=="string"?r0._`{type: ${$}}`:r0._`{type: ${I}}`};function sP($){let I=Oz0($);(0,Wz0.reportError)(I,wz0)}Ab.reportTypeError=sP;function Oz0($){let{gen:I,data:U,schema:Y}=$,J=(0,Fb.schemaRefOrVal)($,Y,"type");return{gen:I,keyword:"type",data:U,schema:Y.type,schemaCode:J,schemaValue:J,parentSchema:Y,params:{},it:$}}});var Rb=N((Eb)=>{Object.defineProperty(Eb,"__esModule",{value:!0});Eb.assignDefaults=void 0;var sI=t0(),Tz0=V1();function Ez0($,I){let{properties:U,items:Y}=$.schema;if(I==="object"&&U)for(let J in U)Tb($,J,U[J].default);else if(I==="array"&&Array.isArray(Y))Y.forEach((J,Q)=>Tb($,Q,J.default))}Eb.assignDefaults=Ez0;function Tb($,I,U){let{gen:Y,compositeRule:J,data:Q,opts:K}=$;if(U===void 0)return;let q=sI._`${Q}${(0,sI.getProperty)(I)}`;if(J){(0,Tz0.checkStrictMode)($,`default is ignored for: ${q}`);return}let G=sI._`${q} === undefined`;if(K.useDefaults==="empty")G=sI._`${G} || ${q} === null || ${q} === ""`;Y.if(G,sI._`${q} = ${(0,sI.stringify)(U)}`)}});var O$=N((jb)=>{Object.defineProperty(jb,"__esModule",{value:!0});jb.validateUnion=jb.validateArray=jb.usePattern=jb.callValidateCode=jb.schemaProperties=jb.allSchemaProperties=jb.noPropertyInData=jb.propertyInData=jb.isOwnProperty=jb.hasPropFunc=jb.reportMissingProp=jb.checkMissingProp=jb.checkReportMissingProp=void 0;var m1=t0(),eP=V1(),q9=s8(),Bz0=V1();function Rz0($,I){let{gen:U,data:Y,it:J}=$;U.if(IT(U,Y,I,J.opts.ownProperties),()=>{$.setParams({missingProperty:m1._`${I}`},!0),$.error()})}jb.checkReportMissingProp=Rz0;function Cz0({gen:$,data:I,it:{opts:U}},Y,J){return(0,m1.or)(...Y.map((Q)=>(0,m1.and)(IT($,I,Q,U.ownProperties),m1._`${J} = ${Q}`)))}jb.checkMissingProp=Cz0;function vz0($,I){$.setParams({missingProperty:I},!0),$.error()}jb.reportMissingProp=vz0;function Cb($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:m1._`Object.prototype.hasOwnProperty`})}jb.hasPropFunc=Cb;function $T($,I,U){return m1._`${Cb($)}.call(${I}, ${U})`}jb.isOwnProperty=$T;function jz0($,I,U,Y){let J=m1._`${I}${(0,m1.getProperty)(U)} !== undefined`;return Y?m1._`${J} && ${$T($,I,U)}`:J}jb.propertyInData=jz0;function IT($,I,U,Y){let J=m1._`${I}${(0,m1.getProperty)(U)} === undefined`;return Y?(0,m1.or)(J,(0,m1.not)($T($,I,U))):J}jb.noPropertyInData=IT;function vb($){return $?Object.keys($).filter((I)=>I!=="__proto__"):[]}jb.allSchemaProperties=vb;function _z0($,I){return vb(I).filter((U)=>!(0,eP.alwaysValidSchema)($,I[U]))}jb.schemaProperties=_z0;function Sz0({schemaCode:$,data:I,it:{gen:U,topSchemaRef:Y,schemaPath:J,errorPath:Q},it:K},q,G,H){let W=H?m1._`${$}, ${I}, ${Y}${J}`:I,V=[[q9.default.instancePath,(0,m1.strConcat)(q9.default.instancePath,Q)],[q9.default.parentData,K.parentData],[q9.default.parentDataProperty,K.parentDataProperty],[q9.default.rootData,q9.default.rootData]];if(K.opts.dynamicRef)V.push([q9.default.dynamicAnchors,q9.default.dynamicAnchors]);let X=m1._`${W}, ${U.object(...V)}`;return G!==m1.nil?m1._`${q}.call(${G}, ${X})`:m1._`${q}(${X})`}jb.callValidateCode=Sz0;var gz0=m1._`new RegExp`;function yz0({gen:$,it:{opts:I}},U){let Y=I.unicodeRegExp?"u":"",{regExp:J}=I.code,Q=J(U,Y);return $.scopeValue("pattern",{key:Q.toString(),ref:Q,code:m1._`${J.code==="new RegExp"?gz0:(0,Bz0.useFunc)($,J)}(${U}, ${Y})`})}jb.usePattern=yz0;function hz0($){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");if(J.allErrors){let q=I.let("valid",!0);return K(()=>I.assign(q,!1)),q}return I.var(Q,!0),K(()=>I.break()),Q;function K(q){let G=I.const("len",m1._`${U}.length`);I.forRange("i",0,G,(H)=>{$.subschema({keyword:Y,dataProp:H,dataPropType:eP.Type.Num},Q),I.if((0,m1.not)(Q),q)})}}jb.validateArray=hz0;function xz0($){let{gen:I,schema:U,keyword:Y,it:J}=$;if(!Array.isArray(U))throw Error("ajv implementation error");if(U.some((G)=>(0,eP.alwaysValidSchema)(J,G))&&!J.opts.unevaluated)return;le Line truncated
import{createRequire as ZL0}from"node:module";var JL0=Object.create;var{getPrototypeOf:QL0,defineProperty:lD,getOwnPropertyNames:KL0}=Object;var qL0=Object.prototype.hasOwnProperty;function HL0($){return this[$]}var GL0,WL0,OI=($,I,U)=>{var Y=$!=null&&typeof $==="object";if(Y){var J=I?GL0??=new WeakMap:WL0??=new WeakMap,Q=J.get($);if(Q)return Q}U=$!=null?JL0(QL0($)):{};let K=I||!$||!$.__esModule?lD(U,"default",{value:$,enumerable:!0}):U;for(let q of KL0($))if(!qL0.call(K,q))lD(K,q,{get:HL0.bind($,q),enumerable:!0});if(Y)J.set($,K);return K};var O=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);var wL0=($)=>$;function VL0($,I){this[$]=wL0.bind(null,I)}var s8=($,I)=>{for(var U in I)lD($,U,{get:I[U],enumerable:!0,configurable:!0,set:VL0.bind(I,U)})};var r=ZL0(import.meta.url);var kQ=O((Ui)=>{Object.defineProperty(Ui,"__esModule",{value:!0});Ui.regexpCode=Ui.getEsmExportName=Ui.getProperty=Ui.safeStringify=Ui.stringify=Ui.strConcat=Ui.addCodeArg=Ui.str=Ui._=Ui.nil=Ui._Code=Ui.Name=Ui.IDENTIFIER=Ui._CodeOrName=void 0;class kW{}Ui._CodeOrName=kW;Ui.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class UU extends kW{constructor($){super();if(!Ui.IDENTIFIER.test($))throw Error("CodeGen: name must be a valid identifier");this.str=$}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}Ui.Name=UU;class n$ extends kW{constructor($){super();this._items=typeof $==="string"?[$]:$}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let $=this._items[0];return $===""||$==='""'}get str(){var $;return($=this._str)!==null&&$!==void 0?$:this._str=this._items.reduce((I,U)=>`${I}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((I,U)=>{if(U instanceof UU)I[U.str]=(I[U.str]||0)+1;return I},{})}}Ui._Code=n$;Ui.nil=new n$("");function $i($,...I){let U=[$[0]],Y=0;while(Y<I.length)KT(U,I[Y]),U.push($[++Y]);return new n$(U)}Ui._=$i;var QT=new n$("+");function Ii($,...I){let U=[xQ($[0])],Y=0;while(Y<I.length)U.push(QT),KT(U,I[Y]),U.push(QT,xQ($[++Y]));return yN0(U),new n$(U)}Ui.str=Ii;function KT($,I){if(I instanceof n$)$.push(...I._items);else if(I instanceof UU)$.push(I);else $.push(xN0(I))}Ui.addCodeArg=KT;function yN0($){let I=1;while(I<$.length-1){if($[I]===QT){let U=hN0($[I-1],$[I+1]);if(U!==void 0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}function hN0($,I){if(I==='""')return $;if($==='""')return I;if(typeof $=="string"){if(I instanceof UU||$[$.length-1]!=='"')return;if(typeof I!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return $.slice(0,-1)+I.slice(1);return}if(typeof I=="string"&&I[0]==='"'&&!($ instanceof UU))return`"${$}${I.slice(1)}`;return}function uN0($,I){return I.emptyStr()?$:$.emptyStr()?I:Ii`${$}${I}`}Ui.strConcat=uN0;function xN0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:xQ(Array.isArray($)?$.join(","):$)}function kN0($){return new n$(xQ($))}Ui.stringify=kN0;function xQ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ui.safeStringify=xQ;function fN0($){return typeof $=="string"&&Ui.IDENTIFIER.test($)?new n$(`.${$}`):$i`[${$}]`}Ui.getProperty=fN0;function iN0($){if(typeof $=="string"&&Ui.IDENTIFIER.test($))return new n$(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Ui.getEsmExportName=iN0;function bN0($){return new n$($.toString())}Ui.regexpCode=bN0});var WT=O((Ki)=>{Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ValueScope=Ki.ValueScopeName=Ki.Scope=Ki.varKinds=Ki.UsedValueState=void 0;var i6=kQ();class Ji extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var iW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(iW||(Ki.UsedValueState=iW={}));Ki.varKinds={const:new i6.Name("const"),let:new i6.Name("let"),var:new i6.Name("var")};class HT{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return $ instanceof i6.Name?$:this.name($)}name($){return new i6.Name(this._newName($))}_newName($){let I=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){var I,U;if(((U=(I=this._parent)===null||I===void 0?void 0:I._prefixes)===null||U===void 0?void 0:U.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}Ki.Scope=HT;class GT extends i6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=i6._`.${new i6.Name(I)}[${U}]`}}Ki.ValueScopeName=GT;var $M0=i6._`\n`;class Qi extends HT{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?$M0:i6.nil}}get(){return this._scope}name($){return new GT($,this._newName($))}value($,I){var U;if(I.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void 0?U:I.ref,K=this._values[J];if(K){let G=K.get(Q);if(Line truncated
`:""},this._extScope=$,this._scope=new p$.Scope({parent:$}),this._nodes=[new zi]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,I){let U=this._extScope.value($,I);return(this._values[U.prefix]||(this._values[U.prefix]=new Set)).add(U),U}getScopeValue($,I){return this._extScope.getValue($,I)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,I,U,Y){let J=this._scope.toName(I);if(U!==void 0&&Y)this._constants[J.str]=U;return this._leafNode(new Hi($,J,U)),J}const($,I,U){return this._def(p$.varKinds.const,$,I,U)}let($,I,U){return this._def(p$.varKinds.let,$,I,U)}var($,I,U){return this._def(p$.varKinds.var,$,I,U)}assign($,I,U){return this._leafNode(new ZT($,I,U))}add($,I){return this._leafNode(new Gi($,b6.operators.ADD,I))}code($){if(typeof $=="function")$();else if($!==q1.nil)this._leafNode(new Zi($));return this}object(...$){let I=["{"];for(let[U,Y]of $){if(I.length>1)I.push(",");if(I.push(U),U!==Y||this.opts.es5)I.push(":"),(0,q1.addCodeArg)(I,Y)}return I.push("}"),new q1._Code(I)}if($,I,U){if(this._blockNode(new Y5($)),I&&U)this.code(I).else().code(U).endIf();else if(I)this.code(I).endIf();else if(U)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new Y5($))}else(){return this._elseNode(new fQ)}endIf(){return this._endBlockNode(Y5,fQ)}_for($,I){if(this._blockNode($),I)this.code(I).endFor();return this}for($,I){return this._for(new Xi($),I)}forRange($,I,U,Y,J=this.opts.es5?p$.varKinds.var:p$.varKinds.let){let Q=this._scope.toName($);return this._for(new Li(J,Q,I,U),()=>Y(Q))}forOf($,I,U,Y=p$.varKinds.const){let J=this._scope.toName($);if(this.opts.es5){let Q=I instanceof q1.Name?I:this.var("_arr",I);return this.forRange("_i",0,q1._`${Q}.length`,(K)=>{this.var(J,q1._`${Q}[${K}]`),U(J)})}return this._for(new wT("of",Y,J,I),()=>U(J))}forIn($,I,U,Y=this.opts.es5?p$.varKinds.var:p$.varKinds.const){if(this.opts.ownProperties)return this.forOf($,q1._`Object.keys(${I})`,U);let J=this._scope.toName($);return this._for(new wT("in",Y,J,I),()=>U(J))}endFor(){return this._endBlockNode(YU)}label($){return this._leafNode(new Wi($))}break($){return this._leafNode(new wi($))}return($){let I=new nW;if(this._blockNode(I),this.code($),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(nW)}try($,I,U){if(!I&&!U)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new Di;if(this._blockNode(Y),this.code($),I){let J=this.name("e");this._currNode=Y.catch=new pW(J),I(J)}if(U)this._currNode=Y.finally=new cW,this.code(U);return this._endBlockNode(pW,cW)}throw($){return this._leafNode(new Vi($))}block($,I){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(I);return this}endBlock($){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let U=this._nodes.length-I;if(U<0||$!==void 0&&U!==$)throw Error(`CodeGen: wrong number of nodes: ${U} vs ${$} expected`);return this._nodes.length=I,this}func($,I=q1.nil,U,Y){if(this._blockNode(new bW($,I,U)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(bW)}optimize($=1){while($-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode($){return this._currNode.nodes.push($),this}_blockNode($){this._currNode.nodes.push($),this._nodes.push($)}_endBlockNode($,I){let U=this._currNode;if(U instanceof $||I&&U instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${$.kind}/${I.kind}`:$.kind}"`)}_elseNode($){let I=this._currNode;if(!(I instanceof Y5))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let I=this._nodes;I[I.length-1]=$}}b6.CodeGen=Oi;function h7($,I){for(let U in I)$[U]=($[U]||0)+(I[U]||0);return $}function dW($,I){return I instanceof q1._CodeOrName?h7($,I.names):$}function JU($,I,U){if($ instanceof q1.Name)return Y($);if(!J($))return $;return new q1._Code($._items.reduce((Q,K)=>{if(K instanceof q1.Name)K=Y(K);if(K instanceof q1._Code)Q.push(...K._items);else Q.push(K);return Q},[]));function Y(Q){let K=U[Q.str];if(K===void 0||I[Q.str]!==1)return Q;return delete I[Q.str],K}function J(Q){return Q instanceof q1._Code&&Q._items.some((K)=>K instanceof q1.Name&&I[K.str]===1&&U[K.str]!==void 0)}}function JM0($,I){for(let U in I)$[U]=($[U]||0)-(I[U]||0)}function Fi($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:q1._`!${VT($)}`}b6.not=Fi;var QM0=Ni(b6.operators.AND);function KM0(...$){return $.reduce(QM0)}b6.and=KM0;var qM0=Ni(b6.operators.OR);function HM0(...$){return $.reduce(qM0)}b6.or=HM0;function Ni($){return(I,U)=>I===q1.nil?U:U===q1.nil?I:q1._`${VT(I)} ${$} ${VT(U)}`}function VT($){return $ instanceof q1.Name?$:q1._`(${Line truncated
|| (${K} == "string" && ${J} && ${J} == +${J})`).assign(q,t0._`+${J}`);return;case"integer":Y.elseIf(t0._`${K} === "boolean" || ${J} === null
|| (${K} === "string" && ${J} && ${J} == +${J} && !(${J} % 1))`).assign(q,t0._`+${J}`);return;case"boolean":Y.elseIf(t0._`${J} === "false" || ${J} === 0 || ${J} === null`).assign(q,!1).elseIf(t0._`${J} === "true" || ${J} === 1`).assign(q,!0);return;case"null":Y.elseIf(t0._`${J} === "" || ${J} === 0 || ${J} === false`),Y.assign(q,null);return;case"array":Y.elseIf(t0._`${K} === "string" || ${K} === "number"
|| ${K} === "boolean" || ${J} === null`).assign(q,t0._`[${J}]`)}}}function MA0({gen:$,parentData:I,parentDataProperty:U},Y){$.if(t0._`${I} !== undefined`,()=>$.assign(t0._`${I}[${U}]`,Y))}function NT($,I,U,Y=QU.Correct){let J=Y===QU.Correct?t0.operators.EQ:t0.operators.NEQ,Q;switch($){case"null":return t0._`${I} ${J} null`;case"array":Q=t0._`Array.isArray(${I})`;break;case"object":Q=t0._`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":Q=K(t0._`!(${I} % 1) && !isNaN(${I})`);break;case"number":Q=K();break;default:return t0._`typeof ${I} ${J} ${$}`}return Y===QU.Correct?Q:(0,t0.not)(Q);function K(q=t0.nil){return(0,t0.and)(t0._`typeof ${I} == "number"`,q,U?t0._`isFinite(${I})`:t0.nil)}}ti.checkDataType=NT;function MT($,I,U,Y){if($.length===1)return NT($[0],I,U,Y);let J,Q=(0,li.toHash)($);if(Q.array&&Q.object){let K=t0._`typeof ${I} != "object"`;J=Q.null?K:t0._`!${I} || ${K}`,delete Q.null,delete Q.array,delete Q.object}else J=t0.nil;if(Q.number)delete Q.integer;for(let K in Q)J=(0,t0.and)(J,NT(K,I,U,Y));return J}ti.checkDataTypes=MT;var AA0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:I})=>typeof $=="string"?t0._`{type: ${$}}`:t0._`{type: ${I}}`};function AT($){let I=PA0($);(0,LA0.reportError)(I,AA0)}ti.reportTypeError=AT;function PA0($){let{gen:I,data:U,schema:Y}=$,J=(0,li.schemaRefOrVal)($,Y,"type");return{gen:I,keyword:"type",data:U,schema:Y.type,schemaCode:J,schemaValue:J,parentSchema:Y,params:{},it:$}}});var Ib=O((ei)=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.assignDefaults=void 0;var KU=s0(),jA0=V1();function _A0($,I){let{properties:U,items:Y}=$.schema;if(I==="object"&&U)for(let J in U)si($,J,U[J].default);else if(I==="array"&&Array.isArray(Y))Y.forEach((J,Q)=>si($,Q,J.default))}ei.assignDefaults=_A0;function si($,I,U){let{gen:Y,compositeRule:J,data:Q,opts:K}=$;if(U===void 0)return;let q=KU._`${Q}${(0,KU.getProperty)(I)}`;if(J){(0,jA0.checkStrictMode)($,`default is ignored for: ${q}`);return}let H=KU._`${q} === undefined`;if(K.useDefaults==="empty")H=KU._`${H} || ${q} === null || ${q} === ""`;Y.if(H,KU._`${q} = ${(0,KU.stringify)(U)}`)}});var M$=O((Jb)=>{Object.defineProperty(Jb,"__esModule",{value:!0});Jb.validateUnion=Jb.validateArray=Jb.usePattern=Jb.callValidateCode=Jb.schemaProperties=Jb.allSchemaProperties=Jb.noPropertyInData=Jb.propertyInData=Jb.isOwnProperty=Jb.hasPropFunc=Jb.reportMissingProp=Jb.checkMissingProp=Jb.checkReportMissingProp=void 0;var r1=s0(),PT=V1(),z9=J5(),gA0=V1();function SA0($,I){let{gen:U,data:Y,it:J}=$;U.if(ET(U,Y,I,J.opts.ownProperties),()=>{$.setParams({missingProperty:r1._`${I}`},!0),$.error()})}Jb.checkReportMissingProp=SA0;function yA0({gen:$,data:I,it:{opts:U}},Y,J){return(0,r1.or)(...Y.map((Q)=>(0,r1.and)(ET($,I,Q,U.ownProperties),r1._`${J} = ${Q}`)))}Jb.checkMissingProp=yA0;function hA0($,I){$.setParams({missingProperty:I},!0),$.error()}Jb.reportMissingProp=hA0;function Ub($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r1._`Object.prototype.hasOwnProperty`})}Jb.hasPropFunc=Ub;function TT($,I,U){return r1._`${Ub($)}.call(${I}, ${U})`}Jb.isOwnProperty=TT;function uA0($,I,U,Y){let J=r1._`${I}${(0,r1.getProperty)(U)} !== undefined`;return Y?r1._`${J} && ${TT($,I,U)}`:J}Jb.propertyInData=uA0;function ET($,I,U,Y){let J=r1._`${I}${(0,r1.getProperty)(U)} === undefined`;return Y?(0,r1.or)(J,(0,r1.not)(TT($,I,U))):J}Jb.noPropertyInData=ET;function Yb($){return $?Object.keys($).filter((I)=>I!=="__proto__"):[]}Jb.allSchemaProperties=Yb;function xA0($,I){return Yb(I).filter((U)=>!(0,PT.alwaysValidSchema)($,I[U]))}Jb.schemaProperties=xA0;function kA0({schemaCode:$,data:I,it:{gen:U,topSchemaRef:Y,schemaPath:J,errorPath:Q},it:K},q,H,G){let W=G?r1._`${$}, ${I}, ${Y}${J}`:I,w=[[z9.default.instancePath,(0,r1.strConcat)(z9.default.instancePath,Q)],[z9.default.parentData,K.parentData],[z9.default.parentDataProperty,K.parentDataProperty],[z9.default.rootData,z9.default.rootData]];if(K.opts.dynamicRef)w.push([z9.default.dynamicAnchors,z9.default.dynamicAnchors]);let V=r1._`${W}, ${U.object(...w)}`;return H!==r1.nil?r1._`${q}.call(${H}, ${V})`:r1._`${q}(${V})`}Jb.callValidateCode=kA0;var fA0=r1._`new RegExp`;function iA0({gen:$,it:{opts:I}},U){let Y=I.unicodeRegExp?"u":"",{regExp:J}=I.code,Q=J(U,Y);return $.scopeValue("pattern",{key:Q.toString(),ref:Q,code:r1._`${J.code==="new RegExp"?fA0:(0,gA0.useFunc)($,J)}(${U}, ${Y})`})}Jb.usePattern=iA0;function bA0($){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");if(J.allErrors){let q=I.let("valid",!0);return K(()=>I.assign(q,!1)),q}return I.var(Q,!0),K(()=>I.break()),Q;function K(q){let H=I.const("len",r1._`${U}.length`);I.forRange("i",0,H,(G)=>{$.subschema({keyword:Y,dataProp:G,dataPropType:PT.Type.Num},Q),I.if((0,r1.not)(Q),q)})}}Jb.validateArray=bA0;function nA0($){let{gen:I,schema:U,keyword:Y,it:J}=$;if(!Array.isArray(U))throw Error("ajv implementation error");if(U.some((H)=>(0,PT.alwaysValidSchema)(J,H))&&!J.opts.unevaluated)return;le Line truncated
missingProperty: ${Y},
depsCount: ${I},
deps: ${U}}`};var IB0={keyword:"dependencies",type:"object",schemaType:"object",error:lp.error,code($){let[I,U]=UB0($);dp($,I),mp($,U)}};function UB0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function dp($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let G=(0,oQ.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(G,()=>{for(let H of q)(0,oQ.checkReportMissingProp)($,H)});else U.if(TT._`${G} && (${(0,oQ.checkMissingProp)($,q,Q)})`),(0,oQ.reportMissingProp)($,Q),U.else()}}lp.validatePropertyDeps=dp;function mp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,$B0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,oQ.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let G=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(G,K)},()=>U.var(K,!0)),$.ok(K)}}lp.validateSchemaDeps=mp;lp.default=IB0});var ep=N((sp)=>{Object.defineProperty(sp,"__esModule",{value:!0});var ap=t0(),QB0=V1(),KB0={message:"property name must be valid",params:({params:$})=>ap._`{propertyName: ${$.propertyName}}`},qB0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:KB0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,QB0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,ap.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};sp.default=qB0});var ET=N(($n)=>{Object.defineProperty($n,"__esModule",{value:!0});var $V=O$(),p$=t0(),HB0=s8(),IV=V1(),WB0={message:"must NOT have additional properties",params:({params:$})=>p$._`{additionalProperty: ${$.additionalProperty}}`},VB0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:WB0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:G}=K;if(K.props=!0,G.removeAdditional!=="all"&&(0,IV.alwaysValidSchema)(K,U))return;let H=(0,$V.allSchemaProperties)(Y.properties),W=(0,$V.allSchemaProperties)(Y.patternProperties);V(),$.ok(p$._`${Q} === ${HB0.default.errors}`);function V(){I.forIn("key",J,(O)=>{if(!H.length&&!W.length)D(O);else I.if(X(O),()=>D(O))})}function X(O){let F;if(H.length>8){let E=(0,IV.schemaRefOrVal)(K,Y.properties,"properties");F=(0,$V.isOwnProperty)(I,E,O)}else if(H.length)F=(0,p$.or)(...H.map((E)=>p$._`${O} === ${E}`));else F=p$.nil;if(W.length)F=(0,p$.or)(F,...W.map((E)=>p$._`${(0,$V.usePattern)($,E)}.test(${O})`));return(0,p$.not)(F)}function Z(O){I.code(p$._`delete ${J}[${O}]`)}function D(O){if(G.removeAdditional==="all"||G.removeAdditional&&U===!1){Z(O);return}if(U===!1){if($.setParams({additionalProperty:O}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,IV.alwaysValidSchema)(K,U)){let F=I.name("valid");if(G.removeAdditional==="failing")w(O,F,!1),I.if((0,p$.not)(F),()=>{$.reset(),Z(O)});else if(w(O,F),!q)I.if((0,p$.not)(F),()=>I.break())}}function w(O,F,E){let A={keyword:"additionalProperties",dataProp:O,dataPropType:IV.Type.Str};if(E===!1)Object.assign(A,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(A,F)}}};$n.default=VB0});var Jn=N((Yn)=>{Object.defineProperty(Yn,"__esModule",{value:!0});var XB0=xQ(),In=O$(),BT=V1(),Un=ET(),LB0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)Un.default.code(new XB0.KeywordCxt(Q,Un.default,"additionalProperties"));let K=(0,In.allSchemaProperties)(U);for(let V of K)Q.definedProperties.add(V);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=BT.mergeEvaluated.props(I,(0,BT.toHash)(K),Q.props);let q=K.filter((V)=>!(0,BT.alwaysValidSchema)(Q,U[V]));if(q.length===0)return;let G=I.name("valid");for(let V of q){if(H(V))W(V);else{if(I.if((0,In.propertyInData)(I,J,V,Q.opts.ownProperties)),W(V),!Q.allErrors)I.else().var(G,!0);I.endIf()}$.it.definedProperties.add(V),$.ok(G)}function H(V){return Q.opts.useDefaults&&!Q.compositeRule&&U[V].default!==void 0}function W(V){$.subschema({keyword:"properties",schemaProp:V,dataProp:V},G)}}};Yn.default=LB0});var Hn=N((Gn)=>{Object.defineProperty(Gn,"__esModule",{value:!0});var Qn=O$(),UV=t0(),Kn=V1(),qn=V1(),wB0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,Qn.allSchemaProperties)(U),G=q.filter((w)=>(0,Kn.alwaysValidSchema)(Q,U[w]));if(q.length===0||G.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let H=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo Line truncated
\x00`,p+=n1(b,2),p+=q.magic,p+=n1(O,2),p+=n1(F,2),p+=n1(g.crc32,4),p+=n1(g.compressedSize,4),p+=n1(g.uncompressedSize,4),p+=n1(H.length,2),p+=n1(E.length,2);var S=RZ.LOCAL_FILE_HEADER+p+H+E,f=RZ.CENTRAL_FILE_HEADER+n1(n,2)+p+n1(X.length,2)+"\x00\x00\x00\x00"+n1(v,4)+n1(Y,4)+H+E+X;return{fileRecord:S,dirRecord:f}},bh0=function($,I,U,Y,J){var Q="",K=kU.transformTo("string",J(Y));return Q=RZ.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+n1($,2)+n1($,2)+n1(I,4)+n1(U,4)+n1(K.length,2)+K,Q},ih0=function($){var I="";return I=RZ.DATA_DESCRIPTOR+n1($.crc32,4)+n1($.compressedSize,4)+n1($.uncompressedSize,4),I};function r$($,I,U,Y){uU.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=I,this.zipPlatform=U,this.encodeFileName=Y,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}kU.inherits(r$,uU);r$.prototype.push=function($){var I=$.meta.percent||0,U=this.entriesCount,Y=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,uU.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(I+100*(U-Y-1))/U:100}})};r$.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var I=this.streamFiles&&!$.file.dir;if(I){var U=xt($,I,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};r$.prototype.closedSource=function($){this.accumulate=!1;var I=this.streamFiles&&!$.file.dir,U=xt($,I,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),I)this.push({data:ih0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};r$.prototype.flush=function(){var $=this.bytesWritten;for(var I=0;I<this.dirRecords.length;I++)this.push({data:this.dirRecords[I],meta:{percent:100}});var U=this.bytesWritten-$,Y=bh0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Y,meta:{percent:100}})};r$.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};r$.prototype.registerPrevious=function($){this._sources.push($);var I=this;return $.on("data",function(U){I.processChunk(U)}),$.on("end",function(){if(I.closedSource(I.previous.streamInfo),I._sources.length)I.prepareNextSource();else I.end()}),$.on("error",function(U){I.error(U)}),this};r$.prototype.resume=function(){if(!uU.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};r$.prototype.error=function($){var I=this._sources;if(!uU.prototype.error.call(this,$))return!1;for(var U=0;U<I.length;U++)try{I[U].error($)}catch(Y){}return!0};r$.prototype.lock=function(){uU.prototype.lock.call(this);var $=this._sources;for(var I=0;I<$.length;I++)$[I].lock()};kt.exports=r$});var ft=N((dh0)=>{var ph0=YR(),nh0=ut(),ch0=function($,I){var U=$||I,Y=ph0[U];if(!Y)throw Error(U+" is not a valid compression method !");return Y};dh0.generateWorker=function($,I,U){var Y=new nh0(I.streamFiles,U,I.platform,I.encodeFileName),J=0;try{$.forEach(function(Q,K){J++;var q=ch0(K.options.compression,I.compression),G=K.options.compressionOptions||I.compressionOptions||{},H=K.dir,W=K.date;K._compressWorker(q,G).withStreamInfo("file",{name:Q,dir:H,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Y)}),Y.entriesCount=J}catch(Q){Y.error(Q)}return Y}});var it=N((zz1,bt)=>{var lh0=H4(),CZ=U$();function l2($,I){CZ.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(I)}lh0.inherits(l2,CZ);l2.prototype._bindStream=function($){var I=this;this._stream=$,$.pause(),$.on("data",function(U){I.push({data:U,meta:{percent:0}})}).on("error",function(U){if(I.isPaused)this.generatedError=U;else I.error(U)}).on("end",function(){if(I.isPaused)I._upstreamEnded=!0;else I.end()})};l2.prototype.pause=function(){if(!CZ.prototype.pause.call(this))return!1;return this._stream.pause(),!0};l2.prototype.resume=function(){if(!CZ.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};bt.exports=l2});var at=N((Az1,tt)=>{var oh0=RU(),o2=H4(),dt=U$(),rh0=HB(),mt=WB(),pt=HZ(),th0=po(),ah0=ft(),nt=B2(),sh0=it(),lt=function($,I,U){var Y=o2.getTypeOf(I),J,Q=o2.extend(U||{},mt);if(Q.date=Q.date||new Date,Q.compression!==null)Q.compression=Q.compression.toUpperCase();if(typeof Q.unixPermissions==="string")Q.unixPermissions=parseInt(Q.unixPermissions,8);if(Q.unixPermissions&&Q.unixPermissions&16384)Q.dir=!0;if(Q.dosPermissions&&Q.dosPermissions&16)Q.dir=!0;if(Q. Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),iR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)is(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");iR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(bs.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),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("")}}pR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};ps.exports=pR});var nR=N((nu0)=>{var ns=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function pu0($){if(typeof $==="string")return $;if(ns)return ns.decode($);return $.toString()}nu0.bufferToString=pu0});var os=N((ds)=>{Object.defineProperty(ds,"__esModule",{value:!0});ds.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;ds.S=` \r
`;ds.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";ds.NAME_CHAR="-"+ds.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";ds.CHAR_RE=new RegExp("^["+ds.CHAR+"]$","u");ds.S_RE=new RegExp("^["+ds.S+"]+$","u");ds.NAME_START_CHAR_RE=new RegExp("^["+ds.NAME_START_CHAR+"]$","u");ds.NAME_CHAR_RE=new RegExp("^["+ds.NAME_CHAR+"]$","u");ds.NAME_RE=new RegExp("^["+ds.NAME_START_CHAR+"]["+ds.NAME_CHAR+"]*$","u");ds.NMTOKEN_RE=new RegExp("^["+ds.NAME_CHAR+"]+$","u");var cR=9,dR=10,mR=13,lR=32;ds.S_LIST=[lR,dR,mR,cR];function du0($){return $>=lR&&$<=55295||$===dR||$===mR||$===cR||$>=57344&&$<=65533||$>=65536&&$<=1114111}ds.isChar=du0;function mu0($){return $===lR||$===dR||$===mR||$===cR}ds.isS=mu0;function cs($){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}ds.isNameStartChar=cs;function lu0($){return cs($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}ds.isNameChar=lu0});var Je=N(($e)=>{Object.defineProperty($e,"__esModule",{value:!0});$e.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";$e.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";$e.S=` \r
`;$e.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";$e.NAME_CHAR="-"+$e.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";$e.CHAR_RE=new RegExp("^["+$e.CHAR+"]$","u");$e.RESTRICTED_CHAR_RE=new RegExp("^["+$e.RESTRICTED_CHAR+"]$","u");$e.S_RE=new RegExp("^["+$e.S+"]+$","u");$e.NAME_START_CHAR_RE=new RegExp("^["+$e.NAME_START_CHAR+"]$","u");$e.NAME_CHAR_RE=new RegExp("^["+$e.NAME_CHAR+"]$","u");$e.NAME_RE=new RegExp("^["+$e.NAME_START_CHAR+"]["+$e.NAME_CHAR+"]*$","u");$e.NMTOKEN_RE=new RegExp("^["+$e.NAME_CHAR+"]+$","u");var rs=9,ts=10,as=13,ss=32;$e.S_LIST=[ss,ts,as,rs];function Qf0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}$e.isChar=Qf0;function Kf0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}$e.isRestrictedChar=Kf0;function qf0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}$e.isCharAndNotRestricted=qf0;function Gf0($){return $===ss||$===ts||$===as||$===rs}$e.isS=Gf0;function es($){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}$e.isNameStartChar=es;function Hf0($){return es($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}$e.isNameChar=Hf0});var qe=N((Ke)=>{Object.defineProperty(Ke,"__esModule",{value:!0});Ke.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";Ke.NC_NAME_CHAR="-"+Ke.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";Ke.NC_NAME_START_CHAR_RE=new RegExp("^["+Ke.NC_NAME_START_CHAR+"]$","u");Ke.NC_NAME_CHAR_RE=new RegExp("^["+Ke.NC_NAME_CHAR+"]$","u");Ke.NC_NAME_RE=new RegExp("^["+Ke.NC_NAME_START_CHAR+"]["+Ke.NC_NAME_CHAR+"]*$","u");function Qe($){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}Ke.isNCNameStartChar=Qe;function Tf0($){return Qe($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}Ke.isNCNameChar=Tf0});var ve=N((Ce)=>{Object.defineProperty(Ce,"__esModule",{value:!0});var rU=os(),jf0=Je(),qC=qe(),n6=rU.isS,_f0=rU.isChar,qK=rU.isNameStartChar,Ge=rU.isNameChar,Ae=rU.S_LIST,Sf0=rU.NAME_RE,gf0=jf0.isChar,yf0=qC.isNCNameStartChar,hf0=qC.isNCNameChar,xf0=qC.NC_NAME_RE,YX="http://www.w3.org/XML/1998/namespace",oU="http://www.w3.org/2000/xmlns/",kf0={__proto__:null,xml:YX,xmlns:oU},uf0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},J4=-1,R8=-2,He=0,ff0=1,rR=2,bf0=3,dU=4,if0=5,pf0=6,nf0=7,tR=8,cf0=9,df0=10,mf0=11,lf0=12,C6=13,sZ=14,aR=15,of0=16,sR=17,rf0=18,tf0=19,eR=20,af0=21,sf0=22,ef0=23,We=24,$C=25,eZ=26,Ve=27,$b0=28,Ib0=29,Ze=30,Ub0=31,Yb0=32,$3=33,Jb0=34,IC=35,GK=36,UC=37,Qb0=38,Xe=39,Le=40,Kb0=41,De=42,qb0=43,Gb0=44,YC=9,a$=10,JC=13,we=32,Oe=33,Pe=34,HK=38,Te=39,$X=45,IX=47,Hb0=59,v9=60,mU=61,g4=62,I6=63,Ee=91,lU=93,Ne=133,Fe=8232,UX=($)=>$===Pe||$===Te,Be=[Pe,Te],Wb0=[...Be,Ee,g4],Vb0=[...Be,v9,lU],Zb0=[mU,I6,...Ae],Xb0=[...Ae,g4,HK,v9];function KC($,I,U){switch(I){case"xml":if(U!==YX)$.fail(`xml prefix must be bound to ${YX}.`);break;case"xmlns":if(U!==oU)$.fail(`xmlns prefix must be bound to ${oU}.`);break;default:}switch(U){case oU:$.fail(I===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${oU}.`);break;case YX:switch(I){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 Lb0($,I){for(let U of Object.keys(I))KC($,U,I[U])}var Db0=($)=>xf0.test($),wb0=($)=>Sf0.test($),I3=0,Me=1,QC=2;Ce.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var ze={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 Re{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let I=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,I){this.nameStartCheck=yf0,this.nameCheck=hf0,this.isName=Db0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},kf0);let U=this.opt.additionalNamespaces;if(U!=null)Lb0(this,U),Object.assign(this.ns,U)}else this.nameStartCheck=qK,this.nameChec Line truncated
`,I=this.i}}captureToChar($){let{i:I}=this,{chunk:U}=this;while(!0){let Y=this.getCode();switch(Y){case R8:this.text+=`${U.slice(I,this.prevI)}
`,I=this.i,Y=a$;break;case J4:return this.text+=U.slice(I),!1;default:}if(Y===$)return this.text+=U.slice(I,this.prevI),!0}}captureNameChars(){let{chunk:$,i:I}=this;while(!0){let U=this.getCode();if(U===J4)return this.name+=$.slice(I),J4;if(!Ge(U))return this.name+=$.slice(I,this.prevI),U===R8?a$:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===J4||!n6($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=_f0,this.getCode=this.getCode10;else this.isChar=gf0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=ff0}sBeginWhitespace(){let $=this.i,I=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(I){case v9:if(this.state=aR,this.text.length!==0)throw Error("no-empty text at start");break;case J4:break;default:this.unget(),this.state=C6,this.xmlDeclPossible=!1}}sDoctype(){var $;let I=this.captureTo(Wb0);switch(I){case g4:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C6,this.doctype=!0;break}case J4:break;default:if(this.text+=String.fromCodePoint(I),I===Ee)this.state=dU;else if(UX(I))this.state=bf0,this.q=I}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=rR}sDTD(){let $=this.captureTo(Vb0);if($===J4)return;if(this.text+=String.fromCodePoint($),$===lU)this.state=rR;else if($===v9)this.state=pf0;else if(UX($))this.state=if0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=dU,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Oe:this.state=nf0,this.openWakaBang="";break;case I6:this.state=mf0;break;default:this.state=dU}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),I=this.openWakaBang+=$;if(this.text+=$,I!=="-")this.state=I==="--"?tR:dU,this.openWakaBang=""}sDTDComment(){if(this.captureToChar($X))this.text+="-",this.state=cf0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===$X?df0:tR}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===g4)this.state=dU;else this.fail("malformed comment."),this.state=tR}sDTDPI(){if(this.captureToChar(I6))this.text+="?",this.state=lf0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===g4)this.state=dU}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:I}=this;$:while(!0)switch(this.getCode()){case R8:this.entity+=`${I.slice($,this.prevI)}
`,$=this.i;break;case Hb0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==C6||this.textHandler!==void 0)this.text+=J;break $}case J4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(qK($))this.state=Jb0,this.unget(),this.xmlDeclPossible=!1;else switch($){case IX:this.state=qb0,this.xmlDeclPossible=!1;break;case Oe:this.state=of0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case I6:this.state=ef0;break;default:this.fail("disallowed character in tag name"),this.state=C6,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=eR,this.openWakaBang="";break;case"--":this.state=sR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=rR,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($X))this.state=rf0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===$X)this.state=tf0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=sR}sCommentEnded(){let $=this.getCodeNorm();if($!==g4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=sR;else this.state=C6}sCData(){if(this.captureToChar(lU))this.state=af0}sCDataEnding(){let $=this.getCodeNorm();if($===lU)this.state=sf0;else this.text+=`]${String.fromCodePoint($)}`,this.state=eR}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case g4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=C6;break}case lU:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=eR}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=We;else if($===I6||n6($))this.fail("processing instruction without a target."),this.state=$===I6?eZ:$C;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=We}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===J4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===I6;if(Y||n6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?$3:Ve}else this.state=Y?eZ:$C;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($===I6)this.state=eZ;else if(!n6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(I6))this.state=eZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===g4){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=C6}else if(I===I6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=$C;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===I6){this.state=$3;return}if($!==J4)this.state=$b0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Zb0);if($===I6){this.state=$3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(n6($)||$===mU))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=$===mU?Ze:Ib0}sXMLDeclEq(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if($!==mU)this.fail("value required.");this.state=Ze}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===I6){this.state=$3,this.fail("XML declaration is incomplete.");return}if(n6($))return;if(!UX($))this.fail("value must be quoted."),this.q=we;else this.q=$;this.state=Ub0}sXMLDeclValue(){let $=this.captureTo([this.q,I6]);if($===I6){this.state=$3,this.text="",this.fail("XML declaration is incomplete.");return}if($===J4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("version nu Line truncated
`;$=this.i,I=I3;break;case J4:if(Y!==void 0)this.text+=U.slice($);break $;default:I=I3}this.forbiddenState=I}handleTextOutsideRoot(){let{i:$}=this,{chunk:I,textHandler:U}=this,Y=!1;$:while(!0){let J=this.getCode();switch(J){case v9:{if(this.state=aR,U!==void 0){let{text:Q}=this,K=I.slice($,this.prevI);if(Q.length!==0)U(Q+K),this.text="";else if(K.length!==0)U(K)}break $}case HK:if(this.state=sZ,this.entityReturnState=C6,U!==void 0)this.text+=I.slice($,this.prevI);Y=!0;break $;case R8:if(U!==void 0)this.text+=`${I.slice($,this.prevI)}
`;$=this.i;break;case J4:if(U!==void 0)this.text+=I.slice($);break $;default:if(!n6(J))Y=!0}}if(!Y)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($,I){var U;let{prefix:Y,local:J}=this.qname($),Q={name:$,prefix:Y,local:J,value:I};if(this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q),Y==="xmlns"){let K=I.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[J]=K,KC(this,J,K)}else if($==="xmlns"){let K=I.trim();this.topNS[""]=K,KC(this,"",K)}}pushAttribPlain($,I){var U;let Y={name:$,value:I};this.attribList.push(Y),(U=this.attributeHandler)===null||U===void 0||U.call(this,Y)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let J=U.pop();this.fail(`unclosed tag: ${J.name}`)}if(this.state!==He&&this.state!==C6)this.fail("unexpected end.");let{text:Y}=this;if(Y.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Y),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,U;let Y=this.topNS[$];if(Y!==void 0)return Y;let{tags:J}=this;for(let Q=J.length-1;Q>=0;Q--)if(Y=J[Q].ns[$],Y!==void 0)return Y;if(Y=this.ns[$],Y!==void 0)return Y;return(U=(I=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let U=$.slice(I+1),Y=$.slice(0,I);if(Y===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Y,local:U}}processAttribsNS(){var $;let{attribList:I}=this,U=this.tag;{let{prefix:Q,local:K}=this.qname(U.name);U.prefix=Q,U.local=K;let q=U.uri=($=this.resolve(Q))!==null&&$!==void 0?$:"";if(Q!==""){if(Q==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(q==="")this.fail(`unbound namespace prefix: ${JSON.stringify(Q)}.`),U.uri=Q}}if(I.length===0)return;let{attributes:Y}=U,J=new Set;for(let Q of I){let{name:K,prefix:q,local:G}=Q,H,W;if(q==="")H=K==="xmlns"?oU:"",W=K;else{if(H=this.resolve(q),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(q)}.`),H=q;W=`{${H}}${G}`}if(J.has(W))this.fail(`duplicate attribute: ${W}.`);J.add(W),Q.uri=H,Y[K]=Q}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:U,value:Y}of $){if(I[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);I[U]=Y}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),I.push(U),this.state=C6,this.name=""}openSelfClosingTag(){var $,I,U;this.processAttribs();let{tags:Y}=this,J=this.tag;if(J.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,J),(I=this.closeTagHandler)===null||I===void 0||I.call(this,J),(this.tag=(U=Y[Y.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=C6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=C6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Y=$.length;while(Y-- >0){let J=this.tag=$.pop();if(this.topNS=J.ns,U===null||U===void 0||U(J),J.name===I)break;this.fail("unexpected close tag.")}if(Y===0)this.closedRoot=!0;else if(Y<0)this.fail(`unmatched closing tag: ${I}.`),this.text+=`</${I}>`}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 I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(I)}}Ce.SaxesParser=Re});var WK=N((QA1,je)=>{var{SaxesParser:Fb0}=ve(),{PassThrough:Mb0}=L6(),{bufferToString:zb0}=nR();je.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new Mb0);let I=new Fb0,U;I.on("error",(J)=>{U=J});let Y=[];I.on("opentag",(J)=>Y.push({eventType:"opentag",value:J})),I.on("text",(J)=>Y.push({eventType:"text",value:J})),I.on("closetag",(J)=>Y.push({eventType:"closetag",value:J}));for await(let J of $){if(I.write(zb0(J)),U)throw U;yield Y,Y=[]}}});var L0=N((KA1,_e)=>{var Ab0=WK(),Pb0=$6();class tU{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof tU)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let I of $)for(let{eventType:U,value:Y}of I)if(U==="opentag")this.parseOpen(Y);else if(U==="text")this.parseText(Y);else if(U==="closetag"){if(!this.parseClose(Y.name))return this.modeLine 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&&((I=$.writeHeaders)!==null&&I!==void 0?I:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}q50.FormatterOptions=K50});var xX=N((_T1,Z50)=>{var gm0="[object AsyncFunction]",ym0="[object Function]",hm0="[object GeneratorFunction]",xm0="[object Null]",km0="[object Proxy]",um0="[object Undefined]",fm0=typeof global=="object"&&global&&global.Object===Object&&global,bm0=typeof self=="object"&&self&&self.Object===Object&&self,im0=fm0||bm0||Function("return this")(),W50=Object.prototype,pm0=W50.hasOwnProperty,V50=W50.toString,H50=im0.Symbol,G3=H50?H50.toStringTag:void 0;function nm0($){if($==null)return $===void 0?um0:xm0;return G3&&G3 in Object($)?cm0($):dm0($)}function cm0($){var I=pm0.call($,G3),U=$[G3];try{$[G3]=void 0;var Y=!0}catch(Q){}var J=V50.call($);if(Y)if(I)$[G3]=U;else delete $[G3];return J}function dm0($){return V50.call($)}function mm0($){if(!lm0($))return!1;var I=nm0($);return I==ym0||I==hm0||I==gm0||I==km0}function lm0($){var I=typeof $;return $!=null&&(I=="object"||I=="function")}Z50.exports=mm0});var l50=N((kX,KY)=>{var om0=200,jv="__lodash_hash_undefined__",dX=1,T50=2,E50=9007199254740991,uX="[object Arguments]",Pv="[object Array]",rm0="[object AsyncFunction]",B50="[object Boolean]",R50="[object Date]",C50="[object Error]",v50="[object Function]",tm0="[object GeneratorFunction]",fX="[object Map]",j50="[object Number]",am0="[object Null]",QY="[object Object]",X50="[object Promise]",sm0="[object Proxy]",_50="[object RegExp]",bX="[object Set]",S50="[object String]",em0="[object Symbol]",$l0="[object Undefined]",Tv="[object WeakMap]",g50="[object ArrayBuffer]",iX="[object DataView]",Il0="[object Float32Array]",Ul0="[object Float64Array]",Yl0="[object Int8Array]",Jl0="[object Int16Array]",Ql0="[object Int32Array]",Kl0="[object Uint8Array]",ql0="[object Uint8ClampedArray]",Gl0="[object Uint16Array]",Hl0="[object Uint32Array]",Wl0=/[\\^$.*+?()[\]{}|]/g,Vl0=/^\[object .+?Constructor\]$/,Zl0=/^(?:0|[1-9]\d*)$/,o1={};o1[Il0]=o1[Ul0]=o1[Yl0]=o1[Jl0]=o1[Ql0]=o1[Kl0]=o1[ql0]=o1[Gl0]=o1[Hl0]=!0;o1[uX]=o1[Pv]=o1[g50]=o1[B50]=o1[iX]=o1[R50]=o1[C50]=o1[v50]=o1[fX]=o1[j50]=o1[QY]=o1[_50]=o1[bX]=o1[S50]=o1[Tv]=!1;var y50=typeof global=="object"&&global&&global.Object===Object&&global,Xl0=typeof self=="object"&&self&&self.Object===Object&&self,O5=y50||Xl0||Function("return this")(),h50=typeof kX=="object"&&kX&&!kX.nodeType&&kX,L50=h50&&typeof KY=="object"&&KY&&!KY.nodeType&&KY,x50=L50&&L50.exports===h50,Mv=x50&&y50.process,D50=function(){try{return Mv&&Mv.binding&&Mv.binding("util")}catch($){}}(),w50=D50&&D50.isTypedArray;function Ll0($,I){var U=-1,Y=$==null?0:$.length,J=0,Q=[];while(++U<Y){var K=$[U];if(I(K,U,$))Q[J++]=K}return Q}function Dl0($,I){var U=-1,Y=I.length,J=$.length;while(++U<Y)$[J+U]=I[U];return $}function wl0($,I){var U=-1,Y=$==null?0:$.length;while(++U<Y)if(I($[U],U,$))return!0;return!1}function Ol0($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}function Nl0($){return function(I){return $(I)}}function Fl0($,I){return $.has(I)}function Ml0($,I){return $==null?void 0:$[I]}function zl0($){var I=-1,U=Array($.size);return $.forEach(function(Y,J){U[++I]=[J,Y]}),U}function Al0($,I){return function(U){return $(I(U))}}function Pl0($){var I=-1,U=Array($.size);return $.forEach(function(Y){U[++I]=Y}),U}var Tl0=Array.prototype,El0=Function.prototype,mX=Object.prototype,zv=O5["__core-js_shared__"],k50=El0.toString,v8=mX.hasOwnProperty,O50=function(){var $=/[^.]+$/.exec(zv&&zv.keys&&zv.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),u50=mX.toString,Bl0=RegExp("^"+k50.call(v8).replace(Wl0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),N50=x50?O5.Buffer:void 0,pX=O5.Symbol,F50=O5.Uint8Array,f50=mX.propertyIsEnumerable,Rl0=Tl0.splice,H3=pX?pX.toStringTag:void 0,M50=Object.getOwnPropertySymbols,Cl0=N50?N50.isBuffer:void 0,vl0=Al0(Object.keys,Object),Ev=qY(O5,"DataView"),OK=qY(O5,"Map"),Bv=qY(O5,"Promise"),Rv=qY(O5,"Set"),Cv=qY(O5,"WeakMap"),NK=qY(Object,"create"),jl0=Z3(Ev),_l0=Z3(OK),Sl0=Z3(Bv),gl0=Z3(Rv),yl0=Z3(Cv),z50=pX?pX.prototype:void 0,Av=z50?z50.valueOf:void 0;function W3($){var I=-1,U=$==null?0:$.length;this.clear();while(++I<U){var Y=$[I];this.set(Y[0],Y[1])}}function hl0(){this.__data__=NK?NK(null):{},this.size=0}function xl0($){var I=this.has($)&&delete this.__data__[$];return this.size-=I?1:0,I}function kl0($){var I=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let U=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(no0.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,I,U){let Y=`${co0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:J}=this;if(J.quote!==""){if(Y.indexOf(J.quote)!==-1)return this.quoteField(Y.replace(this.REPLACE_REGEXP,J.escapedQuote))}if(Y.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,U))return this.quoteField(Y);return Y}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}GY.FieldFormatter=U90});var hv=N((Y90)=>{Object.defineProperty(Y90,"__esModule",{value:!0});Y90.isSyncTransform=void 0;Y90.isSyncTransform=($)=>$.length===1});var K90=N((HY)=>{var Q90=HY&&HY.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(HY,"__esModule",{value:!0});HY.RowFormatter=void 0;var mo0=Q90(xX()),lo0=Q90(l50()),oo0=yv(),ro0=hv();class X3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new oo0.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(X3.isRowHashArray($))return $.map((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(ro0.isSyncTransform($))return(I,U)=>{let Y=null;try{Y=$(I)}catch(J){return U(J)}return U(null,Y)};return(I,U)=>{$(I,U)}}set rowTransform($){if(!mo0.default($))throw TypeError("The transform should be a function");this._rowTransform=X3.createTransform($)}format($,I){this.callTransformer($,(U,Y)=>{if(U)return I(U);if(!$)return I(null);let J=[];if(Y){let{shouldFormatColumns:Q,headers:K}=this.checkHeaders(Y);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)J.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(Q){let q=this.gatherColumns(Y);J.push(this.formatColumns(q,!1))}}return I(null,J)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=X3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!lo0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(X3.isRowHashArray($))return this.headers.map((I,U)=>{let Y=$[U];if(Y)return Y[1];return""});if(X3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,U)=>$[U])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let U=$.map((J,Q)=>this.fieldFormatter.format(J,Q,I)).join(this.formatterOptions.delimiter),{rowCount:Y}=this;if(this.rowCount+=1,Y)return[this.formatterOptions.rowDelimiter,U].join("");return U}}HY.RowFormatter=X3});var q90=N((rX)=>{Object.defineProperty(rX,"__esModule",{value:!0});rX.FieldFormatter=rX.RowFormatter=void 0;var to0=K90();Object.defineProperty(rX,"RowFormatter",{enumerable:!0,get:function(){return to0.RowFormatter}});var ao0=yv();Object.defineProperty(rX,"FieldFormatter",{enumerable:!0,get:function(){return ao0.FieldFormatter}})});var xv=N((H90)=>{Object.defineProperty(H90,"__esModule",{value:!0});H90.CsvFormatterStream=void 0;var eo0=r("stream"),$r0=q90();class G90 extends eo0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new $r0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,U){let Y=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(J,Q)=>{if(J)return Y=!0,U(J);if(Q)Q.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Y=!0,U()})}catch(J){if(Y)throw J;U(J)}}_flush($){this.rowFormatter.finish((I,U)=>{if(I)return $(I);if(U)U.forEach((Y)=>{this.push(Buffer.from(Y,"utf8"))});return $()})}}H90.CsvFormatterStream=G90});var Z90=N((M1)=>{var V90=M1&&M1.__createBinding||(Object.create?function($,I,U,Y){if(Y===void 0)Y=U;Object.defineProperty($,Y,{enumerable:!0,get:function(){return I[U]}})}:function($,I,U,Y){if(Y===void 0)Y=U;$[Y]=I[U]}),Ir0=M1&&M1.__setModuleDefault||(Object.create?function($,I){Ob Line truncated
deps: ${U}}`};var qv0={keyword:"dependencies",type:"object",schemaType:"object",error:Ap.error,code($){let[I,U]=Hv0($);Np($,I),Mp($,U)}};function Hv0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function Np($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let H=(0,Y2.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(H,()=>{for(let G of q)(0,Y2.checkReportMissingProp)($,G)});else U.if(oT._`${H} && (${(0,Y2.checkMissingProp)($,q,Q)})`),(0,Y2.reportMissingProp)($,Q),U.else()}}Ap.validatePropertyDeps=Np;function Mp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,Kv0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,Y2.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let H=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(H,K)},()=>U.var(K,!0)),$.ok(K)}}Ap.validateSchemaDeps=Mp;Ap.default=qv0});var Rp=O((vp)=>{Object.defineProperty(vp,"__esModule",{value:!0});var Bp=s0(),wv0=V1(),Vv0={message:"property name must be valid",params:({params:$})=>Bp._`{propertyName: ${$.propertyName}}`},Zv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vv0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,wv0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,Bp.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};vp.default=Zv0});var rT=O((Cp)=>{Object.defineProperty(Cp,"__esModule",{value:!0});var Zw=M$(),m$=s0(),Xv0=J5(),zw=V1(),Lv0={message:"must NOT have additional properties",params:({params:$})=>m$._`{additionalProperty: ${$.additionalProperty}}`},Dv0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lv0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:H}=K;if(K.props=!0,H.removeAdditional!=="all"&&(0,zw.alwaysValidSchema)(K,U))return;let G=(0,Zw.allSchemaProperties)(Y.properties),W=(0,Zw.allSchemaProperties)(Y.patternProperties);w(),$.ok(m$._`${Q} === ${Xv0.default.errors}`);function w(){I.forIn("key",J,(D)=>{if(!G.length&&!W.length)X(D);else I.if(V(D),()=>X(D))})}function V(D){let F;if(G.length>8){let E=(0,zw.schemaRefOrVal)(K,Y.properties,"properties");F=(0,Zw.isOwnProperty)(I,E,D)}else if(G.length)F=(0,m$.or)(...G.map((E)=>m$._`${D} === ${E}`));else F=m$.nil;if(W.length)F=(0,m$.or)(F,...W.map((E)=>m$._`${(0,Zw.usePattern)($,E)}.test(${D})`));return(0,m$.not)(F)}function Z(D){I.code(m$._`delete ${J}[${D}]`)}function X(D){if(H.removeAdditional==="all"||H.removeAdditional&&U===!1){Z(D);return}if(U===!1){if($.setParams({additionalProperty:D}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,zw.alwaysValidSchema)(K,U)){let F=I.name("valid");if(H.removeAdditional==="failing")L(D,F,!1),I.if((0,m$.not)(F),()=>{$.reset(),Z(D)});else if(L(D,F),!q)I.if((0,m$.not)(F),()=>I.break())}}function L(D,F,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:zw.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,F)}}};Cp.default=Dv0});var Sp=O((gp)=>{Object.defineProperty(gp,"__esModule",{value:!0});var Fv0=dQ(),jp=M$(),tT=V1(),_p=rT(),Nv0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)_p.default.code(new Fv0.KeywordCxt(Q,_p.default,"additionalProperties"));let K=(0,jp.allSchemaProperties)(U);for(let w of K)Q.definedProperties.add(w);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=tT.mergeEvaluated.props(I,(0,tT.toHash)(K),Q.props);let q=K.filter((w)=>!(0,tT.alwaysValidSchema)(Q,U[w]));if(q.length===0)return;let H=I.name("valid");for(let w of q){if(G(w))W(w);else{if(I.if((0,jp.propertyInData)(I,J,w,Q.opts.ownProperties)),W(w),!Q.allErrors)I.else().var(H,!0);I.endIf()}$.it.definedProperties.add(w),$.ok(H)}function G(w){return Q.opts.useDefaults&&!Q.compositeRule&&U[w].default!==void 0}function W(w){$.subschema({keyword:"properties",schemaProp:w,dataProp:w},H)}}};gp.default=Nv0});var kp=O((xp)=>{Object.defineProperty(xp,"__esModule",{value:!0});var yp=M$(),Xw=s0(),hp=V1(),up=V1(),Av0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,yp.allSchemaProperties)(U),H=q.filter((L)=>(0,hp.alwaysValidSchema)(Q,U[L]));if(q.length===0||H.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let G=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo Line truncated
\x00`,n+=m1(i,2),n+=q.magic,n+=m1(D,2),n+=m1(F,2),n+=m1(S.crc32,4),n+=m1(S.compressedSize,4),n+=m1(S.uncompressedSize,4),n+=m1(G.length,2),n+=m1(E.length,2);var g=cV.LOCAL_FILE_HEADER+n+G+E,f=cV.CENTRAL_FILE_HEADER+m1(p,2)+n+m1(V.length,2)+"\x00\x00\x00\x00"+m1(C,4)+m1(Y,4)+G+E+V;return{fileRecord:g,dirRecord:f}},tu0=function($,I,U,Y,J){var Q="",K=dU.transformTo("string",J(Y));return Q=cV.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+m1($,2)+m1($,2)+m1(I,4)+m1(U,4)+m1(K.length,2)+K,Q},au0=function($){var I="";return I=cV.DATA_DESCRIPTOR+m1($.crc32,4)+m1($.compressedSize,4)+m1($.uncompressedSize,4),I};function e$($,I,U,Y){mU.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=I,this.zipPlatform=U,this.encodeFileName=Y,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}dU.inherits(e$,mU);e$.prototype.push=function($){var I=$.meta.percent||0,U=this.entriesCount,Y=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,mU.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(I+100*(U-Y-1))/U:100}})};e$.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var I=this.streamFiles&&!$.file.dir;if(I){var U=ga($,I,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};e$.prototype.closedSource=function($){this.accumulate=!1;var I=this.streamFiles&&!$.file.dir,U=ga($,I,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),I)this.push({data:au0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};e$.prototype.flush=function(){var $=this.bytesWritten;for(var I=0;I<this.dirRecords.length;I++)this.push({data:this.dirRecords[I],meta:{percent:100}});var U=this.bytesWritten-$,Y=tu0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Y,meta:{percent:100}})};e$.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};e$.prototype.registerPrevious=function($){this._sources.push($);var I=this;return $.on("data",function(U){I.processChunk(U)}),$.on("end",function(){if(I.closedSource(I.previous.streamInfo),I._sources.length)I.prepareNextSource();else I.end()}),$.on("error",function(U){I.error(U)}),this};e$.prototype.resume=function(){if(!mU.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};e$.prototype.error=function($){var I=this._sources;if(!mU.prototype.error.call(this,$))return!1;for(var U=0;U<I.length;U++)try{I[U].error($)}catch(Y){}return!0};e$.prototype.lock=function(){mU.prototype.lock.call(this);var $=this._sources;for(var I=0;I<$.length;I++)$[I].lock()};Sa.exports=e$});var ha=O((Ix0)=>{var su0=Cv(),eu0=ya(),$x0=function($,I){var U=$||I,Y=su0[U];if(!Y)throw Error(U+" is not a valid compression method !");return Y};Ix0.generateWorker=function($,I,U){var Y=new eu0(I.streamFiles,U,I.platform,I.encodeFileName),J=0;try{$.forEach(function(Q,K){J++;var q=$x0(K.options.compression,I.compression),H=K.options.compressionOptions||I.compressionOptions||{},G=K.dir,W=K.date;K._compressWorker(q,H).withStreamInfo("file",{name:Q,dir:G,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Y)}),Y.entriesCount=J}catch(Q){Y.error(Q)}return Y}});var xa=O((IP1,ua)=>{var Yx0=W4(),dV=Q$();function QK($,I){dV.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(I)}Yx0.inherits(QK,dV);QK.prototype._bindStream=function($){var I=this;this._stream=$,$.pause(),$.on("data",function(U){I.push({data:U,meta:{percent:0}})}).on("error",function(U){if(I.isPaused)this.generatedError=U;else I.error(U)}).on("end",function(){if(I.isPaused)I._upstreamEnded=!0;else I.end()})};QK.prototype.pause=function(){if(!dV.prototype.pause.call(this))return!1;return this._stream.pause(),!0};QK.prototype.resume=function(){if(!dV.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};ua.exports=QK});var la=O((UP1,ma)=>{var Jx0=hU(),KK=W4(),ba=Q$(),Qx0=hB(),na=uB(),ka=BV(),Kx0=fr(),qx0=ha(),fa=k2(),Hx0=xa(),pa=function($,I,U){var Y=KK.getTypeOf(I),J,Q=KK.extend(U||{},na);if(Q.date=Q.date||new Date,Q.compression!==null)Q.compression=Q.compression.toUpperCase();if(typeof Q.unixPermissions==="string")Q.unixPermissions=parseInt(Q.unixPermissions,8);if(Q.unixPermissions&&Q.unixPermissions&16384)Q.dir=!0;if(Q.dosPermissions&&Q.dosPermissions&16)Q.dir=!0;if(Q. Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),ZR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)xe(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");ZR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(ue.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),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("")}}zR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};ke.exports=zR});var XR=O((ef0)=>{var fe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function sf0($){if(typeof $==="string")return $;if(fe)return fe.decode($);return $.toString()}ef0.bufferToString=sf0});var ce=O((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;be.S=` \r
`;be.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";be.NAME_CHAR="-"+be.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";be.CHAR_RE=new RegExp("^["+be.CHAR+"]$","u");be.S_RE=new RegExp("^["+be.S+"]+$","u");be.NAME_START_CHAR_RE=new RegExp("^["+be.NAME_START_CHAR+"]$","u");be.NAME_CHAR_RE=new RegExp("^["+be.NAME_CHAR+"]$","u");be.NAME_RE=new RegExp("^["+be.NAME_START_CHAR+"]["+be.NAME_CHAR+"]*$","u");be.NMTOKEN_RE=new RegExp("^["+be.NAME_CHAR+"]+$","u");var LR=9,DR=10,OR=13,FR=32;be.S_LIST=[FR,DR,OR,LR];function Ii0($){return $>=FR&&$<=55295||$===DR||$===OR||$===LR||$>=57344&&$<=65533||$>=65536&&$<=1114111}be.isChar=Ii0;function Ui0($){return $===FR||$===DR||$===OR||$===LR}be.isS=Ui0;function ie($){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}be.isNameStartChar=ie;function Yi0($){return ie($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}be.isNameChar=Yi0});var $00=O((te)=>{Object.defineProperty(te,"__esModule",{value:!0});te.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";te.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";te.S=` \r
`;te.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";te.NAME_CHAR="-"+te.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";te.CHAR_RE=new RegExp("^["+te.CHAR+"]$","u");te.RESTRICTED_CHAR_RE=new RegExp("^["+te.RESTRICTED_CHAR+"]$","u");te.S_RE=new RegExp("^["+te.S+"]+$","u");te.NAME_START_CHAR_RE=new RegExp("^["+te.NAME_START_CHAR+"]$","u");te.NAME_CHAR_RE=new RegExp("^["+te.NAME_CHAR+"]$","u");te.NAME_RE=new RegExp("^["+te.NAME_START_CHAR+"]["+te.NAME_CHAR+"]*$","u");te.NMTOKEN_RE=new RegExp("^["+te.NAME_CHAR+"]+$","u");var de=9,me=10,le=13,oe=32;te.S_LIST=[oe,me,le,de];function Xi0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}te.isChar=Xi0;function Li0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}te.isRestrictedChar=Li0;function Di0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}te.isCharAndNotRestricted=Di0;function Oi0($){return $===oe||$===me||$===le||$===de}te.isS=Oi0;function re($){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}te.isNameStartChar=re;function Fi0($){return re($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}te.isNameChar=Fi0});var Y00=O((U00)=>{Object.defineProperty(U00,"__esModule",{value:!0});U00.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";U00.NC_NAME_CHAR="-"+U00.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";U00.NC_NAME_START_CHAR_RE=new RegExp("^["+U00.NC_NAME_START_CHAR+"]$","u");U00.NC_NAME_CHAR_RE=new RegExp("^["+U00.NC_NAME_CHAR+"]$","u");U00.NC_NAME_RE=new RegExp("^["+U00.NC_NAME_START_CHAR+"]["+U00.NC_NAME_CHAR+"]*$","u");function I00($){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}U00.isNCNameStartChar=I00;function yi0($){return I00($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}U00.isNCNameChar=yi0});var E00=O((T00)=>{Object.defineProperty(T00,"__esModule",{value:!0});var YY=ce(),ii0=$00(),SR=Y00(),d6=YY.isS,bi0=YY.isChar,FK=YY.isNameStartChar,J00=YY.isNameChar,O00=YY.S_LIST,ni0=YY.NAME_RE,pi0=ii0.isChar,ci0=SR.isNCNameStartChar,di0=SR.isNCNameChar,mi0=SR.NC_NAME_RE,NZ="http://www.w3.org/XML/1998/namespace",UY="http://www.w3.org/2000/xmlns/",li0={__proto__:null,xml:NZ,xmlns:UY},oi0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},K4=-1,C8=-2,Q00=0,ri0=1,MR=2,ti0=3,eU=4,ai0=5,si0=6,ei0=7,AR=8,$b0=9,Ib0=10,Ub0=11,Yb0=12,_6=13,XZ=14,PR=15,Jb0=16,TR=17,Qb0=18,Kb0=19,ER=20,qb0=21,Hb0=22,Gb0=23,K00=24,BR=25,LZ=26,q00=27,Wb0=28,wb0=29,H00=30,Vb0=31,Zb0=32,G3=33,zb0=34,vR=35,NK=36,RR=37,Xb0=38,G00=39,W00=40,Lb0=41,w00=42,Db0=43,Ob0=44,CR=9,I8=10,jR=13,V00=32,Z00=33,F00=34,MK=38,N00=39,DZ=45,OZ=47,Fb0=59,x9=60,$Y=61,y4=62,U6=63,M00=91,IY=93,z00=133,X00=8232,FZ=($)=>$===F00||$===N00,A00=[F00,N00],Nb0=[...A00,M00,y4],Mb0=[...A00,x9,IY],Ab0=[$Y,U6,...O00],Pb0=[...O00,y4,MK,x9];function gR($,I,U){switch(I){case"xml":if(U!==NZ)$.fail(`xml prefix must be bound to ${NZ}.`);break;case"xmlns":if(U!==UY)$.fail(`xmlns prefix must be bound to ${UY}.`);break;default:}switch(U){case UY:$.fail(I===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${UY}.`);break;case NZ:switch(I){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 Tb0($,I){for(let U of Object.keys(I))gR($,U,I[U])}var Eb0=($)=>mi0.test($),Bb0=($)=>ni0.test($),W3=0,L00=1,_R=2;T00.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var D00={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 P00{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let I=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,I){this.nameStartCheck=ci0,this.nameCheck=di0,this.isName=Eb0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},li0);let U=this.opt.additionalNamespaces;if(U!=null)Tb0(this,U),Object.assign Line truncated
`,I=this.i}}captureToChar($){let{i:I}=this,{chunk:U}=this;while(!0){let Y=this.getCode();switch(Y){case C8:this.text+=`${U.slice(I,this.prevI)}
`,I=this.i,Y=I8;break;case K4:return this.text+=U.slice(I),!1;default:}if(Y===$)return this.text+=U.slice(I,this.prevI),!0}}captureNameChars(){let{chunk:$,i:I}=this;while(!0){let U=this.getCode();if(U===K4)return this.name+=$.slice(I),K4;if(!J00(U))return this.name+=$.slice(I,this.prevI),U===C8?I8:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===K4||!d6($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=bi0,this.getCode=this.getCode10;else this.isChar=pi0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=ri0}sBeginWhitespace(){let $=this.i,I=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(I){case x9:if(this.state=PR,this.text.length!==0)throw Error("no-empty text at start");break;case K4:break;default:this.unget(),this.state=_6,this.xmlDeclPossible=!1}}sDoctype(){var $;let I=this.captureTo(Nb0);switch(I){case y4:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_6,this.doctype=!0;break}case K4:break;default:if(this.text+=String.fromCodePoint(I),I===M00)this.state=eU;else if(FZ(I))this.state=ti0,this.q=I}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=MR}sDTD(){let $=this.captureTo(Mb0);if($===K4)return;if(this.text+=String.fromCodePoint($),$===IY)this.state=MR;else if($===x9)this.state=si0;else if(FZ($))this.state=ai0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=eU,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Z00:this.state=ei0,this.openWakaBang="";break;case U6:this.state=Ub0;break;default:this.state=eU}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),I=this.openWakaBang+=$;if(this.text+=$,I!=="-")this.state=I==="--"?AR:eU,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(DZ))this.text+="-",this.state=$b0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===DZ?Ib0:AR}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=eU;else this.fail("malformed comment."),this.state=AR}sDTDPI(){if(this.captureToChar(U6))this.text+="?",this.state=Yb0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=eU}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:I}=this;$:while(!0)switch(this.getCode()){case C8:this.entity+=`${I.slice($,this.prevI)}
`,$=this.i;break;case Fb0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==_6||this.textHandler!==void 0)this.text+=J;break $}case K4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(FK($))this.state=zb0,this.unget(),this.xmlDeclPossible=!1;else switch($){case OZ:this.state=Db0,this.xmlDeclPossible=!1;break;case Z00:this.state=Jb0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Gb0;break;default:this.fail("disallowed character in tag name"),this.state=_6,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=ER,this.openWakaBang="";break;case"--":this.state=TR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=MR,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(DZ))this.state=Qb0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===DZ)this.state=Kb0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=TR}sCommentEnded(){let $=this.getCodeNorm();if($!==y4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=TR;else this.state=_6}sCData(){if(this.captureToChar(IY))this.state=qb0}sCDataEnding(){let $=this.getCodeNorm();if($===IY)this.state=Hb0;else this.text+=`]${String.fromCodePoint($)}`,this.state=ER}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case y4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_6;break}case IY:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=ER}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=K00;else if($===U6||d6($))this.fail("processing instruction without a target."),this.state=$===U6?LZ:BR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=K00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===K4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===U6;if(Y||d6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?G3:q00}else this.state=Y?LZ:BR;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($===U6)this.state=LZ;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=LZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===y4){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=_6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=BR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=G3;return}if($!==K4)this.state=Wb0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Ab0);if($===U6){this.state=G3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===$Y))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=$===$Y?H00:wb0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=G3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==$Y)this.fail("value required.");this.state=H00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=G3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!FZ($))this.fail("value must be quoted."),this.q=V00;else this.q=$;this.state=Vb0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=G3,this.text="",this.fail("XML declaration is incomplete.");return}if($===K4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,I=W3;break;case K4:if(Y!==void 0)this.text+=U.slice($);break $;default:I=W3}this.forbiddenState=I}handleTextOutsideRoot(){let{i:$}=this,{chunk:I,textHandler:U}=this,Y=!1;$:while(!0){let J=this.getCode();switch(J){case x9:{if(this.state=PR,U!==void 0){let{text:Q}=this,K=I.slice($,this.prevI);if(Q.length!==0)U(Q+K),this.text="";else if(K.length!==0)U(K)}break $}case MK:if(this.state=XZ,this.entityReturnState=_6,U!==void 0)this.text+=I.slice($,this.prevI);Y=!0;break $;case C8:if(U!==void 0)this.text+=`${I.slice($,this.prevI)}
`;$=this.i;break;case K4:if(U!==void 0)this.text+=I.slice($);break $;default:if(!d6(J))Y=!0}}if(!Y)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($,I){var U;let{prefix:Y,local:J}=this.qname($),Q={name:$,prefix:Y,local:J,value:I};if(this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q),Y==="xmlns"){let K=I.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[J]=K,gR(this,J,K)}else if($==="xmlns"){let K=I.trim();this.topNS[""]=K,gR(this,"",K)}}pushAttribPlain($,I){var U;let Y={name:$,value:I};this.attribList.push(Y),(U=this.attributeHandler)===null||U===void 0||U.call(this,Y)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let J=U.pop();this.fail(`unclosed tag: ${J.name}`)}if(this.state!==Q00&&this.state!==_6)this.fail("unexpected end.");let{text:Y}=this;if(Y.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Y),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,U;let Y=this.topNS[$];if(Y!==void 0)return Y;let{tags:J}=this;for(let Q=J.length-1;Q>=0;Q--)if(Y=J[Q].ns[$],Y!==void 0)return Y;if(Y=this.ns[$],Y!==void 0)return Y;return(U=(I=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let U=$.slice(I+1),Y=$.slice(0,I);if(Y===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Y,local:U}}processAttribsNS(){var $;let{attribList:I}=this,U=this.tag;{let{prefix:Q,local:K}=this.qname(U.name);U.prefix=Q,U.local=K;let q=U.uri=($=this.resolve(Q))!==null&&$!==void 0?$:"";if(Q!==""){if(Q==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(q==="")this.fail(`unbound namespace prefix: ${JSON.stringify(Q)}.`),U.uri=Q}}if(I.length===0)return;let{attributes:Y}=U,J=new Set;for(let Q of I){let{name:K,prefix:q,local:H}=Q,G,W;if(q==="")G=K==="xmlns"?UY:"",W=K;else{if(G=this.resolve(q),G===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(q)}.`),G=q;W=`{${G}}${H}`}if(J.has(W))this.fail(`duplicate attribute: ${W}.`);J.add(W),Q.uri=G,Y[K]=Q}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:U,value:Y}of $){if(I[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);I[U]=Y}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),I.push(U),this.state=_6,this.name=""}openSelfClosingTag(){var $,I,U;this.processAttribs();let{tags:Y}=this,J=this.tag;if(J.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,J),(I=this.closeTagHandler)===null||I===void 0||I.call(this,J),(this.tag=(U=Y[Y.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=_6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=_6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Y=$.length;while(Y-- >0){let J=this.tag=$.pop();if(this.topNS=J.ns,U===null||U===void 0||U(J),J.name===I)break;this.fail("unexpected close tag.")}if(Y===0)this.closedRoot=!0;else if(Y<0)this.fail(`unmatched closing tag: ${I}.`),this.text+=`</${I}>`}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 I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(I)}}T00.SaxesParser=P00});var AK=O((fP1,B00)=>{var{SaxesParser:Cb0}=E00(),{PassThrough:jb0}=L6(),{bufferToString:_b0}=XR();B00.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new jb0);let I=new Cb0,U;I.on("error",(J)=>{U=J});let Y=[];I.on("opentag",(J)=>Y.push({eventType:"opentag",value:J})),I.on("text",(J)=>Y.push({eventType:"text",value:J})),I.on("closetag",(J)=>Y.push({eventType:"closetag",value:J}));for await(let J of $){if(I.write(_b0(J)),U)throw U;yield Y,Y=[]}}});var X0=O((iP1,v00)=>{var gb0=AK(),Sb0=I6();class JY{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof JY)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let I of $)for(let{eventType:U,value:Y}of I)if(U==="opentag")this.parseOpen(Y);else if(U==="text")this.parseText(Y);else if(U==="closetag"){if(!this.parseClose(Y.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&&((I=$.writeHeaders)!==null&&I!==void 0?I:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}Y90.FormatterOptions=U90});var eZ=O((wB1,H90)=>{var pl0="[object AsyncFunction]",cl0="[object Function]",dl0="[object GeneratorFunction]",ml0="[object Null]",ll0="[object Proxy]",ol0="[object Undefined]",rl0=typeof global=="object"&&global&&global.Object===Object&&global,tl0=typeof self=="object"&&self&&self.Object===Object&&self,al0=rl0||tl0||Function("return this")(),K90=Object.prototype,sl0=K90.hasOwnProperty,q90=K90.toString,Q90=al0.Symbol,D3=Q90?Q90.toStringTag:void 0;function el0($){if($==null)return $===void 0?ol0:ml0;return D3&&D3 in Object($)?$o0($):Io0($)}function $o0($){var I=sl0.call($,D3),U=$[D3];try{$[D3]=void 0;var Y=!0}catch(Q){}var J=q90.call($);if(Y)if(I)$[D3]=U;else delete $[D3];return J}function Io0($){return q90.call($)}function Uo0($){if(!Yo0($))return!1;var I=el0($);return I==cl0||I==dl0||I==pl0||I==ll0}function Yo0($){var I=typeof $;return $!=null&&(I=="object"||I=="function")}H90.exports=Uo0});var p90=O(($z,zY)=>{var Jo0=200,Uj="__lodash_hash_undefined__",Hz=1,N90=2,M90=9007199254740991,Iz="[object Arguments]",rC="[object Array]",Qo0="[object AsyncFunction]",A90="[object Boolean]",P90="[object Date]",T90="[object Error]",E90="[object Function]",Ko0="[object GeneratorFunction]",Uz="[object Map]",B90="[object Number]",qo0="[object Null]",ZY="[object Object]",G90="[object Promise]",Ho0="[object Proxy]",v90="[object RegExp]",Yz="[object Set]",R90="[object String]",Go0="[object Symbol]",Wo0="[object Undefined]",tC="[object WeakMap]",C90="[object ArrayBuffer]",Jz="[object DataView]",wo0="[object Float32Array]",Vo0="[object Float64Array]",Zo0="[object Int8Array]",zo0="[object Int16Array]",Xo0="[object Int32Array]",Lo0="[object Uint8Array]",Do0="[object Uint8ClampedArray]",Oo0="[object Uint16Array]",Fo0="[object Uint32Array]",No0=/[\\^$.*+?()[\]{}|]/g,Mo0=/^\[object .+?Constructor\]$/,Ao0=/^(?:0|[1-9]\d*)$/,a1={};a1[wo0]=a1[Vo0]=a1[Zo0]=a1[zo0]=a1[Xo0]=a1[Lo0]=a1[Do0]=a1[Oo0]=a1[Fo0]=!0;a1[Iz]=a1[rC]=a1[C90]=a1[A90]=a1[Jz]=a1[P90]=a1[T90]=a1[E90]=a1[Uz]=a1[B90]=a1[ZY]=a1[v90]=a1[Yz]=a1[R90]=a1[tC]=!1;var j90=typeof global=="object"&&global&&global.Object===Object&&global,Po0=typeof self=="object"&&self&&self.Object===Object&&self,T5=j90||Po0||Function("return this")(),_90=typeof $z=="object"&&$z&&!$z.nodeType&&$z,W90=_90&&typeof zY=="object"&&zY&&!zY.nodeType&&zY,g90=W90&&W90.exports===_90,mC=g90&&j90.process,w90=function(){try{return mC&&mC.binding&&mC.binding("util")}catch($){}}(),V90=w90&&w90.isTypedArray;function To0($,I){var U=-1,Y=$==null?0:$.length,J=0,Q=[];while(++U<Y){var K=$[U];if(I(K,U,$))Q[J++]=K}return Q}function Eo0($,I){var U=-1,Y=I.length,J=$.length;while(++U<Y)$[J+U]=I[U];return $}function Bo0($,I){var U=-1,Y=$==null?0:$.length;while(++U<Y)if(I($[U],U,$))return!0;return!1}function vo0($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}function Ro0($){return function(I){return $(I)}}function Co0($,I){return $.has(I)}function jo0($,I){return $==null?void 0:$[I]}function _o0($){var I=-1,U=Array($.size);return $.forEach(function(Y,J){U[++I]=[J,Y]}),U}function go0($,I){return function(U){return $(I(U))}}function So0($){var I=-1,U=Array($.size);return $.forEach(function(Y){U[++I]=Y}),U}var yo0=Array.prototype,ho0=Function.prototype,Gz=Object.prototype,lC=T5["__core-js_shared__"],S90=ho0.toString,_8=Gz.hasOwnProperty,Z90=function(){var $=/[^.]+$/.exec(lC&&lC.keys&&lC.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),y90=Gz.toString,uo0=RegExp("^"+S90.call(_8).replace(No0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z90=g90?T5.Buffer:void 0,Qz=T5.Symbol,X90=T5.Uint8Array,h90=Gz.propertyIsEnumerable,xo0=yo0.splice,O3=Qz?Qz.toStringTag:void 0,L90=Object.getOwnPropertySymbols,ko0=z90?z90.isBuffer:void 0,fo0=go0(Object.keys,Object),aC=XY(T5,"DataView"),CK=XY(T5,"Map"),sC=XY(T5,"Promise"),eC=XY(T5,"Set"),$j=XY(T5,"WeakMap"),jK=XY(Object,"create"),io0=M3(aC),bo0=M3(CK),no0=M3(sC),po0=M3(eC),co0=M3($j),D90=Qz?Qz.prototype:void 0,oC=D90?D90.valueOf:void 0;function F3($){var I=-1,U=$==null?0:$.length;this.clear();while(++I<U){var Y=$[I];this.set(Y[0],Y[1])}}function do0(){this.__data__=jK?jK(null):{},this.size=0}function mo0($){var I=this.has($)&&delete this.__data__[$];return this.size-=I?1:0,I}function lo0($){var I=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let U=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(er0.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,I,U){let Y=`${$t0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:J}=this;if(J.quote!==""){if(Y.indexOf(J.quote)!==-1)return this.quoteField(Y.replace(this.REPLACE_REGEXP,J.escapedQuote))}if(Y.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,U))return this.quoteField(Y);return Y}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}LY.FieldFormatter=s90});var qj=O((e90)=>{Object.defineProperty(e90,"__esModule",{value:!0});e90.isSyncTransform=void 0;e90.isSyncTransform=($)=>$.length===1});var U70=O((DY)=>{var I70=DY&&DY.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(DY,"__esModule",{value:!0});DY.RowFormatter=void 0;var Ut0=I70(eZ()),Yt0=I70(p90()),Jt0=Kj(),Qt0=qj();class A3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new Jt0.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(A3.isRowHashArray($))return $.map((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(Qt0.isSyncTransform($))return(I,U)=>{let Y=null;try{Y=$(I)}catch(J){return U(J)}return U(null,Y)};return(I,U)=>{$(I,U)}}set rowTransform($){if(!Ut0.default($))throw TypeError("The transform should be a function");this._rowTransform=A3.createTransform($)}format($,I){this.callTransformer($,(U,Y)=>{if(U)return I(U);if(!$)return I(null);let J=[];if(Y){let{shouldFormatColumns:Q,headers:K}=this.checkHeaders(Y);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)J.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(Q){let q=this.gatherColumns(Y);J.push(this.formatColumns(q,!1))}}return I(null,J)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=A3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!Yt0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(A3.isRowHashArray($))return this.headers.map((I,U)=>{let Y=$[U];if(Y)return Y[1];return""});if(A3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,U)=>$[U])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let U=$.map((J,Q)=>this.fieldFormatter.format(J,Q,I)).join(this.formatterOptions.delimiter),{rowCount:Y}=this;if(this.rowCount+=1,Y)return[this.formatterOptions.rowDelimiter,U].join("");return U}}DY.RowFormatter=A3});var Y70=O((Vz)=>{Object.defineProperty(Vz,"__esModule",{value:!0});Vz.FieldFormatter=Vz.RowFormatter=void 0;var Kt0=U70();Object.defineProperty(Vz,"RowFormatter",{enumerable:!0,get:function(){return Kt0.RowFormatter}});var qt0=Kj();Object.defineProperty(Vz,"FieldFormatter",{enumerable:!0,get:function(){return qt0.FieldFormatter}})});var Hj=O((Q70)=>{Object.defineProperty(Q70,"__esModule",{value:!0});Q70.CsvFormatterStream=void 0;var Gt0=r("stream"),Wt0=Y70();class J70 extends Gt0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new Wt0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,U){let Y=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(J,Q)=>{if(J)return Y=!0,U(J);if(Q)Q.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Y=!0,U()})}catch(J){if(Y)throw J;U(J)}}_flush($){this.rowFormatter.finish((I,U)=>{if(I)return $(I);if(U)U.forEach((Y)=>{this.push(Buffer.from(Y,"utf8"))});return $()})}}Q70.CsvFormatterStream=J70});var H70=O((N1)=>{var q70=N1&&N1.__createBinding||(Object.create?function($,I,U,Y){if(Y===void 0)Y=U;Object.defineProperty($,Y,{enumerable:!0,get:function(){return I[U]}})}:function($,I,U,Y){if(Y===void 0)Y=U;$[Y]=I[U]}),wt0=N1&&N1.__setModuleDefault||(Object.create?function($,I){Ob Line truncated
`||I===`\r
`}static isTokenCarriageReturn($,I){return $.token===I.carriageReturn}static isTokenComment($,I){return I.supportsComments&&!!$&&$.token===I.comment}static isTokenEscapeCharacter($,I){return $.token===I.escapeChar}static isTokenQuote($,I){return $.token===I.quote}static isTokenDelimiter($,I){return $.token===I.delimiter}}X70.Token=Z70});var Kj=N((O70)=>{Object.defineProperty(O70,"__esModule",{value:!0});O70.Scanner=void 0;var D70=b9(),Hs0=/((?:\r\n)|\n|\r)/;class w70{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,I=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(I)===-1)return null;let U=I.exec($);if(U==null)return null;let Y=U[1],J=this.cursor+(U.index||0);return new D70.Token({token:Y,startCursor:J,endCursor:J+Y.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:I}=this;if(I<=$)return null;return new D70.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=Hs0.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}}O70.Scanner=w70});var NL=N((M70)=>{Object.defineProperty(M70,"__esModule",{value:!0});M70.ColumnFormatter=void 0;class F70{constructor($){if($.trim)this.format=(I)=>I.trim();else if($.ltrim)this.format=(I)=>I.trimLeft();else if($.rtrim)this.format=(I)=>I.trimRight();else this.format=(I)=>I}}M70.ColumnFormatter=F70});var qj=N((T70)=>{Object.defineProperty(T70,"__esModule",{value:!0});T70.NonQuotedColumnParser=void 0;var Ws0=NL(),A70=b9();class P70{constructor($){this.parserOptions=$,this.columnFormatter=new Ws0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:I}=this,U=[],Y=$.nextCharacterToken;for(;Y;Y=$.nextCharacterToken){if(A70.Token.isTokenDelimiter(Y,I)||A70.Token.isTokenRowDelimiter(Y))break;U.push(Y.token),$.advancePastToken(Y)}return this.columnFormatter.format(U.join(""))}}T70.NonQuotedColumnParser=P70});var Gj=N((R70)=>{Object.defineProperty(R70,"__esModule",{value:!0});R70.QuotedColumnParser=void 0;var Vs0=NL(),MY=b9();class B70{constructor($){this.parserOptions=$,this.columnFormatter=new Vs0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let I=$.cursor,{foundClosingQuote:U,col:Y}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(I),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Y}gatherDataBetweenQuotes($){let{parserOptions:I}=this,U=!1,Y=!1,J=[],Q=$.nextCharacterToken;for(;!Y&&Q!==null;Q=$.nextCharacterToken){let K=MY.Token.isTokenQuote(Q,I);if(!U&&K)U=!0;else if(U)if(MY.Token.isTokenEscapeCharacter(Q,I)){$.advancePastToken(Q);let q=$.nextCharacterToken;if(q!==null&&(MY.Token.isTokenQuote(q,I)||MY.Token.isTokenEscapeCharacter(q,I)))J.push(q.token),Q=q;else if(K)Y=!0;else J.push(Q.token)}else if(K)Y=!0;else J.push(Q.token);$.advancePastToken(Q)}return{col:this.columnFormatter.format(J.join("")),foundClosingQuote:Y}}checkForMalformedColumn($){let{parserOptions:I}=this,{nextNonSpaceToken:U}=$;if(U){let Y=MY.Token.isTokenDelimiter(U,I),J=MY.Token.isTokenRowDelimiter(U);if(!(Y||J)){let Q=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${I.escapedDelimiter}' OR new line got: '${U.token}'. at '${Q}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}R70.QuotedColumnParser=B70});var S70=N((j70)=>{Object.defineProperty(j70,"__esModule",{value:!0});j70.ColumnParser=void 0;var Zs0=qj(),Xs0=Gj(),Ls0=b9();class v70{constructor($){this.parserOptions=$,this.quotedColumnParser=new Xs0.QuotedColumnParser($),this.nonQuotedColumnParser=new Zs0.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:I}=$;if(I!==null&&Ls0.Token.isTokenQuote(I,this.parserOptions))return $.advanceToToken(I),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}j70.ColumnParser=v70});var Hj=N((zY)=>{Object.defineProperty(zY,"__esModule",{value:!0});zY.ColumnFormatter=zY.QuotedColumnParser=zY.NonQuotedColumnParser=zY.ColumnParser=void 0;var Ds0=S70();Object.defineProperty(zY,"ColumnParser",{enumerable:!0,get:function(){return Ds0.ColumnParser}});var ws0=qj();Object.defineProperty(zY,"NonQuotedColumnParser",{enumerable:!0,get:function(){return ws0.NonQuotedColumnParser}});var Os0=Gj();Object.defineProperty(zY,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,u,u,Z,Y);let g=Z.type==="*"?Ej:Z.type==="?"?Cj:"\\"+Z.type;J=!0,Y=Y.slice(0,Z.reStart)+g+"\\("+u}if(A(),Q)Y+="\\\\";let T=Ge0[Y.charAt(0)];for(let u=q.length-1;u>-1;u--){let g=q[u],b=Y.slice(0,g.reStart),v=Y.slice(g.reStart,g.reEnd-8),n=Y.slice(g.reEnd),p=Y.slice(g.reEnd-8,g.reEnd)+n,S=b.split(")").length,f=b.split("(").length-S,i=n;for(let B=0;B<f;B++)i=i.replace(/\)[+*?]?/,"");n=i;let Y0=n===""&&I!==Bj?"(?:$|\\/)":"";Y=b+v+n+Y0+p}if(Y!==""&&J)Y="(?=.)"+Y;if(T)Y=F()+Y;if(I===Bj)return[Y,J];if(U.nocase&&!J)J=$.toUpperCase()!==$.toLowerCase();if(!J)return We0($);let C=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Y+"$",C),{_glob:$,_src:Y})}catch(u){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 I=this.options,U=I.noglobstar?Ej:I.dot?Ke0:qe0,Y=I.nocase?"i":"",J=$.map((Q)=>{return Q=Q.map((K)=>typeof K==="string"?Ze0(K):K===v6?v6:K._src).reduce((K,q)=>{if(!(K[K.length-1]===v6&&q===v6))K.push(q);return K},[]),Q.forEach((K,q)=>{if(K!==v6||Q[q-1]===v6)return;if(q===0)if(Q.length>1)Q[q+1]="(?:\\/|"+U+"\\/)?"+Q[q+1];else Q[q]=U;else if(q===Q.length-1)Q[q-1]+="(?:\\/|"+U+")?";else Q[q-1]+="(?:\\/|\\/"+U+"\\/)"+Q[q+1],Q[q+1]=v6}),Q.filter((K)=>K!==v6).join("/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}match($,I=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&I)return!0;let U=this.options;if(Rj.sep!=="/")$=$.split(Rj.sep).join("/");$=$.split(T30),this.debug(this.pattern,"split",$);let Y=this.set;this.debug(this.pattern,"set",Y);let J;for(let Q=$.length-1;Q>=0;Q--)if(J=$[Q],J)break;for(let Q=0;Q<Y.length;Q++){let K=Y[Q],q=$;if(U.matchBase&&K.length===1)q=[J];if(this.matchOne(q,K,I)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return Q$.defaults($).Minimatch}}Q$.Minimatch=BK});var S30=N((bE1,_30)=>{_30.exports=j30;var _j=r("fs"),{EventEmitter:Le0}=r("events"),{Minimatch:jj}=R30(),{resolve:De0}=r("path");function we0($,I){return new Promise((U,Y)=>{_j.readdir($,{withFileTypes:!0},(J,Q)=>{if(J)switch(J.code){case"ENOTDIR":if(I)Y(J);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Y(J);break}else U(Q)})})}function C30($,I){return new Promise((U,Y)=>{(I?_j.stat:_j.lstat)($,(Q,K)=>{if(Q)switch(Q.code){case"ENOENT":if(I)U(C30($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*v30($,I,U,Y,J,Q){let K=await we0(I+$,Q);for(let q of K){let G=q.name;if(G===void 0)G=q,Y=!0;let H=$+"/"+G,W=H.slice(1),V=I+"/"+W,X=null;if(Y||U)X=await C30(V,U);if(!X&&q.name!==void 0)X=q;if(X===null)X={isDirectory:()=>!1};if(X.isDirectory()){if(!J(W))yield{relative:W,absolute:V,stats:X},yield*v30(H,I,U,Y,J,!1)}else yield{relative:W,absolute:V,stats:X}}}async function*Oe0($,I,U,Y){yield*v30("",$,I,U,Y,!0)}function Ne0($){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 Sj extends Le0{constructor($,I,U){super();if(typeof I==="function")U=I,I=null;if(this.options=Ne0(I||{}),this.matchers=[],this.options.pattern){let Y=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Y.map((J)=>new jj(J,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Y=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Y.map((J)=>new jj(J,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Y=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Y.map((J)=>new jj(J,{dot:!0}))}if(this.iterator=Oe0(De0($||"."),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",(Y)=>this._matches.push(this.options.absolute?Y.absolute:Y.relative)),this.on("error",(Y)=>U(Y)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((I)=>I.match($))}_fileMatches($,I){let U=$+(I?"/":"");return(this.matchers.length===0||this.matchers.some((Y)=>Y.match(U)))&&!this.ignoreMatchers.some((Y)=>Y.match(U))&&(!this.options.nodir||!I)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let I=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,I)){let U=$.value.relative,Y=$.value.absolute;if(this.options.mark&&I)U+="/",Y+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Y,stat:$.value.stats});else this.emit("match",{relative:U,ab Line truncated
`,y);y=$0===-1?P.length:$0}else if(c!==-1&&P[y]==="/"&&P[y+1]==="*"){let $0=P.indexOf("*/",y);if($0!==-1)y=$0+2,c=P.indexOf("*/",y);else R+=P[y],y++}else R+=P[y],y++;return R}function d8(P){let R=V$(P.toString()),y=R.match(W$);if(!y)y=R.match(h$);if(!y)throw Error(`could not parse args in autoInject
`}static isTokenCarriageReturn($,I){return $.token===I.carriageReturn}static isTokenComment($,I){return I.supportsComments&&!!$&&$.token===I.comment}static isTokenEscapeCharacter($,I){return $.token===I.escapeChar}static isTokenQuote($,I){return $.token===I.quote}static isTokenDelimiter($,I){return $.token===I.delimiter}}G30.Token=H30});var gj=O((Z30)=>{Object.defineProperty(Z30,"__esModule",{value:!0});Z30.Scanner=void 0;var w30=o9(),Fe0=/((?:\r\n)|\n|\r)/;class V30{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,I=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(I)===-1)return null;let U=I.exec($);if(U==null)return null;let Y=U[1],J=this.cursor+(U.index||0);return new w30.Token({token:Y,startCursor:J,endCursor:J+Y.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:I}=this;if(I<=$)return null;return new w30.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=Fe0.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}}Z30.Scanner=V30});var hz=O((L30)=>{Object.defineProperty(L30,"__esModule",{value:!0});L30.ColumnFormatter=void 0;class X30{constructor($){if($.trim)this.format=(I)=>I.trim();else if($.ltrim)this.format=(I)=>I.trimLeft();else if($.rtrim)this.format=(I)=>I.trimRight();else this.format=(I)=>I}}L30.ColumnFormatter=X30});var Sj=O((N30)=>{Object.defineProperty(N30,"__esModule",{value:!0});N30.NonQuotedColumnParser=void 0;var Ne0=hz(),O30=o9();class F30{constructor($){this.parserOptions=$,this.columnFormatter=new Ne0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:I}=this,U=[],Y=$.nextCharacterToken;for(;Y;Y=$.nextCharacterToken){if(O30.Token.isTokenDelimiter(Y,I)||O30.Token.isTokenRowDelimiter(Y))break;U.push(Y.token),$.advancePastToken(Y)}return this.columnFormatter.format(U.join(""))}}N30.NonQuotedColumnParser=F30});var yj=O((P30)=>{Object.defineProperty(P30,"__esModule",{value:!0});P30.QuotedColumnParser=void 0;var Me0=hz(),RY=o9();class A30{constructor($){this.parserOptions=$,this.columnFormatter=new Me0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let I=$.cursor,{foundClosingQuote:U,col:Y}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(I),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Y}gatherDataBetweenQuotes($){let{parserOptions:I}=this,U=!1,Y=!1,J=[],Q=$.nextCharacterToken;for(;!Y&&Q!==null;Q=$.nextCharacterToken){let K=RY.Token.isTokenQuote(Q,I);if(!U&&K)U=!0;else if(U)if(RY.Token.isTokenEscapeCharacter(Q,I)){$.advancePastToken(Q);let q=$.nextCharacterToken;if(q!==null&&(RY.Token.isTokenQuote(q,I)||RY.Token.isTokenEscapeCharacter(q,I)))J.push(q.token),Q=q;else if(K)Y=!0;else J.push(Q.token)}else if(K)Y=!0;else J.push(Q.token);$.advancePastToken(Q)}return{col:this.columnFormatter.format(J.join("")),foundClosingQuote:Y}}checkForMalformedColumn($){let{parserOptions:I}=this,{nextNonSpaceToken:U}=$;if(U){let Y=RY.Token.isTokenDelimiter(U,I),J=RY.Token.isTokenRowDelimiter(U);if(!(Y||J)){let Q=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${I.escapedDelimiter}' OR new line got: '${U.token}'. at '${Q}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}P30.QuotedColumnParser=A30});var R30=O((B30)=>{Object.defineProperty(B30,"__esModule",{value:!0});B30.ColumnParser=void 0;var Ae0=Sj(),Pe0=yj(),Te0=o9();class E30{constructor($){this.parserOptions=$,this.quotedColumnParser=new Pe0.QuotedColumnParser($),this.nonQuotedColumnParser=new Ae0.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:I}=$;if(I!==null&&Te0.Token.isTokenQuote(I,this.parserOptions))return $.advanceToToken(I),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}B30.ColumnParser=E30});var hj=O((CY)=>{Object.defineProperty(CY,"__esModule",{value:!0});CY.ColumnFormatter=CY.QuotedColumnParser=CY.NonQuotedColumnParser=CY.ColumnParser=void 0;var Ee0=R30();Object.defineProperty(CY,"ColumnParser",{enumerable:!0,get:function(){return Ee0.ColumnParser}});var Be0=Sj();Object.defineProperty(CY,"NonQuotedColumnParser",{enumerable:!0,get:function(){return Be0.NonQuotedColumnParser}});var ve0=yj();Object.defineProperty(CY,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,k,k,Z,Y);let S=Z.type==="*"?aj:Z.type==="?"?$_:"\\"+Z.type;J=!0,Y=Y.slice(0,Z.reStart)+S+"\\("+k}if(T(),Q)Y+="\\\\";let A=O01[Y.charAt(0)];for(let k=q.length-1;k>-1;k--){let S=q[k],i=Y.slice(0,S.reStart),C=Y.slice(S.reStart,S.reEnd-8),p=Y.slice(S.reEnd),n=Y.slice(S.reEnd-8,S.reEnd)+p,g=i.split(")").length,f=i.split("(").length-g,b=p;for(let B=0;B<f;B++)b=b.replace(/\)[+*?]?/,"");p=b;let Y0=p===""&&I!==sj?"(?:$|\\/)":"";Y=i+C+p+Y0+n}if(Y!==""&&J)Y="(?=.)"+Y;if(A)Y=F()+Y;if(I===sj)return[Y,J];if(U.nocase&&!J)J=$.toUpperCase()!==$.toLowerCase();if(!J)return N01($);let R=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Y+"$",R),{_glob:$,_src:Y})}catch(k){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 I=this.options,U=I.noglobstar?aj:I.dot?L01:D01,Y=I.nocase?"i":"",J=$.map((Q)=>{return Q=Q.map((K)=>typeof K==="string"?A01(K):K===g6?g6:K._src).reduce((K,q)=>{if(!(K[K.length-1]===g6&&q===g6))K.push(q);return K},[]),Q.forEach((K,q)=>{if(K!==g6||Q[q-1]===g6)return;if(q===0)if(Q.length>1)Q[q+1]="(?:\\/|"+U+"\\/)?"+Q[q+1];else Q[q]=U;else if(q===Q.length-1)Q[q-1]+="(?:\\/|"+U+")?";else Q[q-1]+="(?:\\/|\\/"+U+"\\/)"+Q[q+1],Q[q+1]=g6}),Q.filter((K)=>K!==g6).join("/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}match($,I=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&I)return!0;let U=this.options;if(ej.sep!=="/")$=$.split(ej.sep).join("/");$=$.split(NI0),this.debug(this.pattern,"split",$);let Y=this.set;this.debug(this.pattern,"set",Y);let J;for(let Q=$.length-1;Q>=0;Q--)if(J=$[Q],J)break;for(let Q=0;Q<Y.length;Q++){let K=Y[Q],q=$;if(U.matchBase&&K.length===1)q=[J];if(this.matchOne(q,K,I)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return H$.defaults($).Minimatch}}H$.Minimatch=kK});var RI0=O((Nv1,vI0)=>{vI0.exports=BI0;var Y_=r("fs"),{EventEmitter:T01}=r("events"),{Minimatch:U_}=PI0(),{resolve:E01}=r("path");function B01($,I){return new Promise((U,Y)=>{Y_.readdir($,{withFileTypes:!0},(J,Q)=>{if(J)switch(J.code){case"ENOTDIR":if(I)Y(J);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Y(J);break}else U(Q)})})}function TI0($,I){return new Promise((U,Y)=>{(I?Y_.stat:Y_.lstat)($,(Q,K)=>{if(Q)switch(Q.code){case"ENOENT":if(I)U(TI0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*EI0($,I,U,Y,J,Q){let K=await B01(I+$,Q);for(let q of K){let H=q.name;if(H===void 0)H=q,Y=!0;let G=$+"/"+H,W=G.slice(1),w=I+"/"+W,V=null;if(Y||U)V=await TI0(w,U);if(!V&&q.name!==void 0)V=q;if(V===null)V={isDirectory:()=>!1};if(V.isDirectory()){if(!J(W))yield{relative:W,absolute:w,stats:V},yield*EI0(G,I,U,Y,J,!1)}else yield{relative:W,absolute:w,stats:V}}}async function*v01($,I,U,Y){yield*EI0("",$,I,U,Y,!0)}function R01($){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 J_ extends T01{constructor($,I,U){super();if(typeof I==="function")U=I,I=null;if(this.options=R01(I||{}),this.matchers=[],this.options.pattern){let Y=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Y.map((J)=>new U_(J,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Y=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Y.map((J)=>new U_(J,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Y=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Y.map((J)=>new U_(J,{dot:!0}))}if(this.iterator=v01(E01($||"."),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",(Y)=>this._matches.push(this.options.absolute?Y.absolute:Y.relative)),this.on("error",(Y)=>U(Y)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((I)=>I.match($))}_fileMatches($,I){let U=$+(I?"/":"");return(this.matchers.length===0||this.matchers.some((Y)=>Y.match(U)))&&!this.ignoreMatchers.some((Y)=>Y.match(U))&&(!this.options.nodir||!I)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let I=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,I)){let U=$.value.relative,Y=$.value.absolute;if(this.options.mark&&I)U+="/",Y+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Y,stat:$.value.stats});else this.emit("match",{relative:U,ab Line truncated
`,y);y=$0===-1?P.length:$0}else if(c!==-1&&P[y]==="/"&&P[y+1]==="*"){let $0=P.indexOf("*/",y);if($0!==-1)y=$0+2,c=P.indexOf("*/",y);else v+=P[y],y++}else v+=P[y],y++;return v}function a8(P){let v=X$(P.toString()),y=v.match(z$);if(!y)y=v.match(f$);if(!y)throw Error(`could not parse args in autoInject
Source:
`+R);let[,c]=y;return c.replace(/\s/g,"").split(c8).map(($0)=>$0.replace(x$,"").trim())}function a6(P,R){var y={};return Object.keys(P).forEach((c)=>{var $0=P[c],U0,q0=Z($0),G0=!q0&&$0.length===1||q0&&$0.length===0;if(Array.isArray($0))U0=[...$0],$0=U0.pop(),y[c]=U0.concat(U0.length>0?Z0:$0);else if(G0)y[c]=$0;else{if(U0=d8($0),$0.length===0&&!q0&&U0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!q0)U0.pop();y[c]=U0.concat(Z0)}function Z0(v0,Q1){var w1=U0.map((H1)=>v0[H1]);w1.push(Q1),O($0)(...w1)}}),j4(y,R)}class L7{constructor(){this.head=this.tail=null,this.length=0}removeLink(P){if(P.prev)P.prev.next=P.next;else this.head=P.next;if(P.next)P.next.prev=P.prev;else this.tail=P.prev;return P.prev=P.next=null,this.length-=1,P}empty(){while(this.head)this.shift();return this}insertAfter(P,R){if(R.prev=P,R.next=P.next,P.next)P.next.prev=R;else this.tail=R;P.next=R,this.length+=1}insertBefore(P,R){if(R.prev=P.prev,R.next=P,P.prev)P.prev.next=R;else this.head=R;P.prev=R,this.length+=1}unshift(P){if(this.head)this.insertBefore(this.head,P);else s6(this,P)}push(P){if(this.tail)this.insertAfter(this.tail,P);else s6(this,P)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var P=this.head;while(P)yield P.data,P=P.next}remove(P){var R=this.head;while(R){var{next:y}=R;if(P(R))this.removeLink(R);R=y}return this}}function s6(P,R){P.length=1,P.head=P.tail=R}function n5(P,R,y){if(R==null)R=1;else if(R===0)throw RangeError("Concurrency must not be zero");var c=O(P),$0=0,U0=[];let q0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function G0(h0,R0){q0[h0].push(R0)}function Z0(h0,R0){let x0=(...W1)=>{v0(h0,x0),R0(...W1)};q0[h0].push(x0)}function v0(h0,R0){if(!h0)return Object.keys(q0).forEach((x0)=>q0[x0]=[]);if(!R0)return q0[h0]=[];q0[h0]=q0[h0].filter((x0)=>x0!==R0)}function Q1(h0,...R0){q0[h0].forEach((x0)=>x0(...R0))}var w1=!1;function H1(h0,R0,x0,W1){if(W1!=null&&typeof W1!=="function")throw Error("task callback must be a function");O1.started=!0;var I4,u4;function X$(w7,...jJ){if(w7)return x0?u4(w7):I4();if(jJ.length<=1)return I4(jJ[0]);I4(jJ)}var HI=O1._createTaskItem(h0,x0?X$:W1||X$);if(R0)O1._tasks.unshift(HI);else O1._tasks.push(HI);if(!w1)w1=!0,H(()=>{w1=!1,O1.process()});if(x0||!W1)return new Promise((w7,jJ)=>{I4=w7,u4=jJ})}function Z$(h0){return function(R0,...x0){$0-=1;for(var W1=0,I4=h0.length;W1<I4;W1++){var u4=h0[W1],X$=U0.indexOf(u4);if(X$===0)U0.shift();else if(X$>0)U0.splice(X$,1);if(u4.callback(R0,...x0),R0!=null)Q1("error",R0,u4.data)}if($0<=O1.concurrency-O1.buffer)Q1("unsaturated");if(O1.idle())Q1("drain");O1.process()}}function GI(h0){if(h0.length===0&&O1.idle())return H(()=>Q1("drain")),!0;return!1}let D7=(h0)=>(R0)=>{if(!R0)return new Promise((x0,W1)=>{Z0(h0,(I4,u4)=>{if(I4)return W1(I4);x0(u4)})});v0(h0),G0(h0,R0)};var vJ=!1,O1={_tasks:new L7,_createTaskItem(h0,R0){return{data:h0,callback:R0}},*[Symbol.iterator](){yield*O1._tasks[Symbol.iterator]()},concurrency:R,payload:y,buffer:R/4,started:!1,paused:!1,push(h0,R0){if(Array.isArray(h0)){if(GI(h0))return;return h0.map((x0)=>H1(x0,!1,!1,R0))}return H1(h0,!1,!1,R0)},pushAsync(h0,R0){if(Array.isArray(h0)){if(GI(h0))return;return h0.map((x0)=>H1(x0,!1,!0,R0))}return H1(h0,!1,!0,R0)},kill(){v0(),O1._tasks.empty()},unshift(h0,R0){if(Array.isArray(h0)){if(GI(h0))return;return h0.map((x0)=>H1(x0,!0,!1,R0))}return H1(h0,!0,!1,R0)},unshiftAsync(h0,R0){if(Array.isArray(h0)){if(GI(h0))return;return h0.map((x0)=>H1(x0,!0,!0,R0))}return H1(h0,!0,!0,R0)},remove(h0){O1._tasks.remove(h0)},process(){if(vJ)return;vJ=!0;while(!O1.paused&&$0<O1.concurrency&&O1._tasks.length){var h0=[],R0=[],x0=O1._tasks.length;if(O1.payload)x0=Math.min(x0,O1.payload);for(var W1=0;W1<x0;W1++){var I4=O1._tasks.shift();h0.push(I4),U0.push(I4),R0.push(I4.data)}if($0+=1,O1._tasks.length===0)Q1("empty");if($0===O1.concurrency)Q1("saturated");var u4=S(Z$(h0));c(R0,u4)}vJ=!1},length(){return O1._tasks.length},running(){return $0},workersList(){return U0},idle(){return O1._tasks.length+$0===0},pause(){O1.paused=!0},resume(){if(O1.paused===!1)return;O1.paused=!1,H(O1.process)}};return Object.defineProperties(O1,{saturated:{writable:!1,value:D7("saturated")},unsaturated:{writable:!1,value:D7("unsaturated")},empty:{writable:!1,value:D7("empty")},drain:{writable:!1,value:D7("drain")},error:{writable:!1,value:D7("error")}}),O1}function T0(P,R){return n5(P,1,R)}function a(P,R,y){return n5(P,R,y)}function M(P,R,y,c){c=u(c);var $0=O(y);return f0(P,(U0,q0,G0)=>{$0(R,U0,(Z0,v0)=>{R=v0,G0(Z0)})},(U0)=>c(U0,R))}var z=F(M,4);function j(...P){var R=P.map(O);return function(...y){var c=this,$0=y[y.length-1];if(typeof $0=="function")y.pop();else $0=Q4();return z(R,y,(U0,q0,G0)=>{q0.apply(c,U0.concat((Z0,...v0)=>{G0(Z0,v0)}))},(U0,q0)=>$0(U0,...q0)),$0[d0]}}function x(...P){return j(...P.reverse())}function s(P,R,y,c){return A(i(R),P,y,c)}var m=F(s,4);function e( Line truncated
GFS4: `),console.error($)};if(!V4[Y6]){if(gj=global[Y6]||[],n30(V4,gj),V4.close=function($){function I(U,Y){return $.call(V4,U,function(J){if(!J)p30();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty(I,CL,{value:$}),I}(V4.close),V4.closeSync=function($){function I(U){$.apply(V4,arguments),p30()}return Object.defineProperty(I,CL,{value:$}),I}(V4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){O3(V4[Y6]),r("assert").equal(V4[Y6].length,0)})}var gj;if(!global[Y6])n30(global,V4[Y6]);xj.exports=yj(Re0(V4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!V4.__patched)xj.exports=yj(V4),V4.__patched=!0;function yj($){Ee0($),$.gracefulify=yj,$.createReadStream=C,$.createWriteStream=u;var I=$.readFile;$.readFile=U;function U(v,n,p){if(typeof n==="function")p=n,n=null;return S(v,n,p);function S(f,i,Y0,B){return I(f,i,function(k){if(k&&(k.code==="EMFILE"||k.code==="ENFILE"))TY([S,[f,i,Y0],k,B||Date.now(),Date.now()]);else if(typeof Y0==="function")Y0.apply(this,arguments)})}}var Y=$.writeFile;$.writeFile=J;function J(v,n,p,S){if(typeof p==="function")S=p,p=null;return f(v,n,p,S);function f(i,Y0,B,k,d){return Y(i,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))TY([f,[i,Y0,B,k],t,d||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var Q=$.appendFile;if(Q)$.appendFile=K;function K(v,n,p,S){if(typeof p==="function")S=p,p=null;return f(v,n,p,S);function f(i,Y0,B,k,d){return Q(i,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))TY([f,[i,Y0,B,k],t,d||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var q=$.copyFile;if(q)$.copyFile=G;function G(v,n,p,S){if(typeof p==="function")S=p,p=0;return f(v,n,p,S);function f(i,Y0,B,k,d){return q(i,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))TY([f,[i,Y0,B,k],t,d||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var H=$.readdir;$.readdir=V;var W=/^v[0-5]\./;function V(v,n,p){if(typeof n==="function")p=n,n=null;var S=W.test(process.version)?function(Y0,B,k,d){return H(Y0,f(Y0,B,k,d))}:function(Y0,B,k,d){return H(Y0,B,f(Y0,B,k,d))};return S(v,n,p);function f(i,Y0,B,k){return function(d,t){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))TY([S,[i,Y0,B],d,k||Date.now(),Date.now()]);else{if(t&&t.sort)t.sort();if(typeof B==="function")B.call(this,d,t)}}}}if(process.version.substr(0,4)==="v0.8"){var X=Be0($);F=X.ReadStream,A=X.WriteStream}var Z=$.ReadStream;if(Z)F.prototype=Object.create(Z.prototype),F.prototype.open=E;var D=$.WriteStream;if(D)A.prototype=Object.create(D.prototype),A.prototype.open=T;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(v){F=v},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return A},set:function(v){A=v},enumerable:!0,configurable:!0});var w=F;Object.defineProperty($,"FileReadStream",{get:function(){return w},set:function(v){w=v},enumerable:!0,configurable:!0});var O=A;Object.defineProperty($,"FileWriteStream",{get:function(){return O},set:function(v){O=v},enumerable:!0,configurable:!0});function F(v,n){if(this instanceof F)return Z.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function E(){var v=this;b(v.path,v.flags,v.mode,function(n,p){if(n){if(v.autoClose)v.destroy();v.emit("error",n)}else v.fd=p,v.emit("open",p),v.read()})}function A(v,n){if(this instanceof A)return D.apply(this,arguments),this;else return A.apply(Object.create(A.prototype),arguments)}function T(){var v=this;b(v.path,v.flags,v.mode,function(n,p){if(n)v.destroy(),v.emit("error",n);else v.fd=p,v.emit("open",p)})}function C(v,n){return new $.ReadStream(v,n)}function u(v,n){return new $.WriteStream(v,n)}var g=$.open;$.open=b;function b(v,n,p,S){if(typeof p==="function")S=p,p=null;return f(v,n,p,S);function f(i,Y0,B,k,d){return g(i,Y0,B,function(t,K0){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))TY([f,[i,Y0,B,k],t,d||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}return $}function TY($){O3("ENQUEUE",$[0].name,$[1]),V4[Y6].push($),hj()}var RL;function p30(){var $=Date.now();for(var I=0;I<V4[Y6].length;++I)if(V4[Y6][I].length>2)V4[Y6][I][3]=$,V4[Y6][I][4]=$;hj()}function hj(){if(clearTimeout(RL),RL=void 0,V4[Y6].length===0)return;var $=V4[Y6].shift(),I=$[0],U=$[1],Y=$[2],J=$[3],Q=$[4];if(J===void 0)O3("RETRY",I.name,U),I.apply(null,U);else if(Date.now()-J>=60000){O3("TIMEOUT",I.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Y)}else{var q=Date.now()-Q,G=Math.max(Q-J,1),H=Math.min(G*1.2,100);if(q>=H)O3("RETRY",I.name,U),I.apply(null,U.concat([J]));else V4[Y6].push($)}if(RL===void 0)RL=setTimeout(hj,0)}});var d30=N((dE1,kj)=>{function ve0($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var c30=z4().Buffer,RK=r("util");function je0($,I,U){$.copy(I,U)}kj.exports=function(){function $(){ve0(this,$),this.head=null,this.tail=null,th Line truncated
`+v);let[,c]=y;return c.replace(/\s/g,"").split(t8).map(($0)=>$0.replace(i$,"").trim())}function e6(P,v){var y={};return Object.keys(P).forEach((c)=>{var $0=P[c],U0,q0=Z($0),H0=!q0&&$0.length===1||q0&&$0.length===0;if(Array.isArray($0))U0=[...$0],$0=U0.pop(),y[c]=U0.concat(U0.length>0?Z0:$0);else if(H0)y[c]=$0;else{if(U0=a8($0),$0.length===0&&!q0&&U0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!q0)U0.pop();y[c]=U0.concat(Z0)}function Z0(j0,K1){var D1=U0.map((W1)=>j0[W1]);D1.push(K1),D($0)(...D1)}}),_4(y,v)}class P7{constructor(){this.head=this.tail=null,this.length=0}removeLink(P){if(P.prev)P.prev.next=P.next;else this.head=P.next;if(P.next)P.next.prev=P.prev;else this.tail=P.prev;return P.prev=P.next=null,this.length-=1,P}empty(){while(this.head)this.shift();return this}insertAfter(P,v){if(v.prev=P,v.next=P.next,P.next)P.next.prev=v;else this.tail=v;P.next=v,this.length+=1}insertBefore(P,v){if(v.prev=P.prev,v.next=P,P.prev)P.prev.next=v;else this.head=v;P.prev=v,this.length+=1}unshift(P){if(this.head)this.insertBefore(this.head,P);else $$(this,P)}push(P){if(this.tail)this.insertAfter(this.tail,P);else $$(this,P)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var P=this.head;while(P)yield P.data,P=P.next}remove(P){var v=this.head;while(v){var{next:y}=v;if(P(v))this.removeLink(v);v=y}return this}}function $$(P,v){P.length=1,P.head=P.tail=v}function t5(P,v,y){if(v==null)v=1;else if(v===0)throw RangeError("Concurrency must not be zero");var c=D(P),$0=0,U0=[];let q0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function H0(h0,R0){q0[h0].push(R0)}function Z0(h0,R0){let u0=(...w1)=>{j0(h0,u0),R0(...w1)};q0[h0].push(u0)}function j0(h0,R0){if(!h0)return Object.keys(q0).forEach((u0)=>q0[u0]=[]);if(!R0)return q0[h0]=[];q0[h0]=q0[h0].filter((u0)=>u0!==R0)}function K1(h0,...R0){q0[h0].forEach((u0)=>u0(...R0))}var D1=!1;function W1(h0,R0,u0,w1){if(w1!=null&&typeof w1!=="function")throw Error("task callback must be a function");O1.started=!0;var J4,f4;function D$(E7,...fJ){if(E7)return u0?f4(E7):J4();if(fJ.length<=1)return J4(fJ[0]);J4(fJ)}var DI=O1._createTaskItem(h0,u0?D$:w1||D$);if(R0)O1._tasks.unshift(DI);else O1._tasks.push(DI);if(!D1)D1=!0,G(()=>{D1=!1,O1.process()});if(u0||!w1)return new Promise((E7,fJ)=>{J4=E7,f4=fJ})}function L$(h0){return function(R0,...u0){$0-=1;for(var w1=0,J4=h0.length;w1<J4;w1++){var f4=h0[w1],D$=U0.indexOf(f4);if(D$===0)U0.shift();else if(D$>0)U0.splice(D$,1);if(f4.callback(R0,...u0),R0!=null)K1("error",R0,f4.data)}if($0<=O1.concurrency-O1.buffer)K1("unsaturated");if(O1.idle())K1("drain");O1.process()}}function LI(h0){if(h0.length===0&&O1.idle())return G(()=>K1("drain")),!0;return!1}let T7=(h0)=>(R0)=>{if(!R0)return new Promise((u0,w1)=>{Z0(h0,(J4,f4)=>{if(J4)return w1(J4);u0(f4)})});j0(h0),H0(h0,R0)};var kJ=!1,O1={_tasks:new P7,_createTaskItem(h0,R0){return{data:h0,callback:R0}},*[Symbol.iterator](){yield*O1._tasks[Symbol.iterator]()},concurrency:v,payload:y,buffer:v/4,started:!1,paused:!1,push(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!1,!1,R0))}return W1(h0,!1,!1,R0)},pushAsync(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!1,!0,R0))}return W1(h0,!1,!0,R0)},kill(){j0(),O1._tasks.empty()},unshift(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!0,!1,R0))}return W1(h0,!0,!1,R0)},unshiftAsync(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!0,!0,R0))}return W1(h0,!0,!0,R0)},remove(h0){O1._tasks.remove(h0)},process(){if(kJ)return;kJ=!0;while(!O1.paused&&$0<O1.concurrency&&O1._tasks.length){var h0=[],R0=[],u0=O1._tasks.length;if(O1.payload)u0=Math.min(u0,O1.payload);for(var w1=0;w1<u0;w1++){var J4=O1._tasks.shift();h0.push(J4),U0.push(J4),R0.push(J4.data)}if($0+=1,O1._tasks.length===0)K1("empty");if($0===O1.concurrency)K1("saturated");var f4=g(L$(h0));c(R0,f4)}kJ=!1},length(){return O1._tasks.length},running(){return $0},workersList(){return U0},idle(){return O1._tasks.length+$0===0},pause(){O1.paused=!0},resume(){if(O1.paused===!1)return;O1.paused=!1,G(O1.process)}};return Object.defineProperties(O1,{saturated:{writable:!1,value:T7("saturated")},unsaturated:{writable:!1,value:T7("unsaturated")},empty:{writable:!1,value:T7("empty")},drain:{writable:!1,value:T7("drain")},error:{writable:!1,value:T7("error")}}),O1}function E0(P,v){return t5(P,1,v)}function a(P,v,y){return t5(P,v,y)}function N(P,v,y,c){c=k(c);var $0=D(y);return f0(P,(U0,q0,H0)=>{$0(v,U0,(Z0,j0)=>{v=j0,H0(Z0)})},(U0)=>c(U0,v))}var M=F(N,4);function j(...P){var v=P.map(D);return function(...y){var c=this,$0=y[y.length-1];if(typeof $0=="function")y.pop();else $0=q4();return M(v,y,(U0,q0,H0)=>{q0.apply(c,U0.concat((Z0,...j0)=>{H0(Z0,j0)}))},(U0,q0)=>$0(U0,...q0)),$0[m0]}}function u(...P){return j(...P.reverse())}function s(P,v,y,c){return T(b(v),P,y,c)}var m=F(s,4);function e( Line truncated
GFS4: `),console.error($)};if(!V4[J6]){if(Q_=global[J6]||[],fI0(V4,Q_),V4.close=function($){function I(U,Y){return $.call(V4,U,function(J){if(!J)kI0();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty(I,dz,{value:$}),I}(V4.close),V4.closeSync=function($){function I(U){$.apply(V4,arguments),kI0()}return Object.defineProperty(I,dz,{value:$}),I}(V4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){B3(V4[J6]),r("assert").equal(V4[J6].length,0)})}var Q_;if(!global[J6])fI0(global,V4[J6]);H_.exports=K_(x01(V4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!V4.__patched)H_.exports=K_(V4),V4.__patched=!0;function K_($){h01($),$.gracefulify=K_,$.createReadStream=R,$.createWriteStream=k;var I=$.readFile;$.readFile=U;function U(C,p,n){if(typeof p==="function")n=p,p=null;return g(C,p,n);function g(f,b,Y0,B){return I(f,b,function(x){if(x&&(x.code==="EMFILE"||x.code==="ENFILE"))gY([g,[f,b,Y0],x,B||Date.now(),Date.now()]);else if(typeof Y0==="function")Y0.apply(this,arguments)})}}var Y=$.writeFile;$.writeFile=J;function J(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return Y(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var Q=$.appendFile;if(Q)$.appendFile=K;function K(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return Q(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var q=$.copyFile;if(q)$.copyFile=H;function H(C,p,n,g){if(typeof n==="function")g=n,n=0;return f(C,p,n,g);function f(b,Y0,B,x,d){return q(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var G=$.readdir;$.readdir=w;var W=/^v[0-5]\./;function w(C,p,n){if(typeof p==="function")n=p,p=null;var g=W.test(process.version)?function(Y0,B,x,d){return G(Y0,f(Y0,B,x,d))}:function(Y0,B,x,d){return G(Y0,B,f(Y0,B,x,d))};return g(C,p,n);function f(b,Y0,B,x){return function(d,t){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))gY([g,[b,Y0,B],d,x||Date.now(),Date.now()]);else{if(t&&t.sort)t.sort();if(typeof B==="function")B.call(this,d,t)}}}}if(process.version.substr(0,4)==="v0.8"){var V=u01($);F=V.ReadStream,T=V.WriteStream}var Z=$.ReadStream;if(Z)F.prototype=Object.create(Z.prototype),F.prototype.open=E;var X=$.WriteStream;if(X)T.prototype=Object.create(X.prototype),T.prototype.open=A;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return T},set:function(C){T=C},enumerable:!0,configurable:!0});var L=F;Object.defineProperty($,"FileReadStream",{get:function(){return L},set:function(C){L=C},enumerable:!0,configurable:!0});var D=T;Object.defineProperty($,"FileWriteStream",{get:function(){return D},set:function(C){D=C},enumerable:!0,configurable:!0});function F(C,p){if(this instanceof F)return Z.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function E(){var C=this;i(C.path,C.flags,C.mode,function(p,n){if(p){if(C.autoClose)C.destroy();C.emit("error",p)}else C.fd=n,C.emit("open",n),C.read()})}function T(C,p){if(this instanceof T)return X.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function A(){var C=this;i(C.path,C.flags,C.mode,function(p,n){if(p)C.destroy(),C.emit("error",p);else C.fd=n,C.emit("open",n)})}function R(C,p){return new $.ReadStream(C,p)}function k(C,p){return new $.WriteStream(C,p)}var S=$.open;$.open=i;function i(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return S(b,Y0,B,function(t,K0){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}return $}function gY($){B3("ENQUEUE",$[0].name,$[1]),V4[J6].push($),q_()}var cz;function kI0(){var $=Date.now();for(var I=0;I<V4[J6].length;++I)if(V4[J6][I].length>2)V4[J6][I][3]=$,V4[J6][I][4]=$;q_()}function q_(){if(clearTimeout(cz),cz=void 0,V4[J6].length===0)return;var $=V4[J6].shift(),I=$[0],U=$[1],Y=$[2],J=$[3],Q=$[4];if(J===void 0)B3("RETRY",I.name,U),I.apply(null,U);else if(Date.now()-J>=60000){B3("TIMEOUT",I.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Y)}else{var q=Date.now()-Q,H=Math.max(Q-J,1),G=Math.min(H*1.2,100);if(q>=G)B3("RETRY",I.name,U),I.apply(null,U.concat([J]));else V4[J6].push($)}if(cz===void 0)cz=setTimeout(q_,0)}});var bI0=O((Ev1,G_)=>{function f01($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var iI0=M4().Buffer,fK=r("util");function i01($,I,U){$.copy(I,U)}G_.exports=function(){function $(){f01(this,$),this.head=null,this.tail=null,th Line truncated
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/_I0.exports=function($,I){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Y="";if(U>4&&$[3]==="\\"){var J=$[2];if((J==="?"||J===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Y="//"}var Q=$.split(/[/\\]+/);if(I!==!1&&Q[Q.length-1]==="")Q.pop();return Y+Q.join("/")}});var Y_=N((YB1,uI0)=>{var gI0=9007199254740991,x01="[object Arguments]",k01="[object Function]",u01="[object GeneratorFunction]",f01=/^(?:0|[1-9]\d*)$/;function yI0($,I,U){switch(U.length){case 0:return $.call(I);case 1:return $.call(I,U[0]);case 2:return $.call(I,U[0],U[1]);case 3:return $.call(I,U[0],U[1],U[2])}return $.apply(I,U)}function b01($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}var xK=Object.prototype,kK=xK.hasOwnProperty,hI0=xK.toString,i01=xK.propertyIsEnumerable,SI0=Math.max;function p01($,I){var U=s01($)||a01($)?b01($.length,String):[],Y=U.length,J=!!Y;for(var Q in $)if((I||kK.call($,Q))&&!(J&&(Q=="length"||kI0(Q,Y))))U.push(Q);return U}function n01($,I,U,Y){if($===void 0||$_($,xK[U])&&!kK.call(Y,U))return I;return $}function c01($,I,U){var Y=$[I];if(!(kK.call($,I)&&$_(Y,U))||U===void 0&&!(I in $))$[I]=U}function d01($){if(!U_($))return t01($);var I=r01($),U=[];for(var Y in $)if(!(Y=="constructor"&&(I||!kK.call($,Y))))U.push(Y);return U}function xI0($,I){return I=SI0(I===void 0?$.length-1:I,0),function(){var U=arguments,Y=-1,J=SI0(U.length-I,0),Q=Array(J);while(++Y<J)Q[Y]=U[I+Y];Y=-1;var K=Array(I+1);while(++Y<I)K[Y]=U[Y];return K[I]=Q,yI0($,this,K)}}function m01($,I,U,Y){U||(U={});var J=-1,Q=I.length;while(++J<Q){var K=I[J],q=Y?Y(U[K],$[K],K,U,$):void 0;c01(U,K,q===void 0?$[K]:q)}return U}function l01($){return xI0(function(I,U){var Y=-1,J=U.length,Q=J>1?U[J-1]:void 0,K=J>2?U[2]:void 0;if(Q=$.length>3&&typeof Q=="function"?(J--,Q):void 0,K&&o01(U[0],U[1],K))Q=J<3?void 0:Q,J=1;I=Object(I);while(++Y<J){var q=U[Y];if(q)$(I,q,Y,Q)}return I})}function kI0($,I){return I=I==null?gI0:I,!!I&&(typeof $=="number"||f01.test($))&&($>-1&&$%1==0&&$<I)}function o01($,I,U){if(!U_(U))return!1;var Y=typeof I;if(Y=="number"?I_(U)&&kI0(I,U.length):Y=="string"&&(I in U))return $_(U[I],$);return!1}function r01($){var I=$&&$.constructor,U=typeof I=="function"&&I.prototype||xK;return $===U}function t01($){var I=[];if($!=null)for(var U in Object($))I.push(U);return I}function $_($,I){return $===I||$!==$&&I!==I}function a01($){return e01($)&&kK.call($,"callee")&&(!i01.call($,"callee")||hI0.call($)==x01)}var s01=Array.isArray;function I_($){return $!=null&&I11($.length)&&!$11($)}function e01($){return U11($)&&I_($)}function $11($){var I=U_($)?hI0.call($):"";return I==k01||I==u01}function I11($){return typeof $=="number"&&$>-1&&$%1==0&&$<=gI0}function U_($){var I=typeof $;return!!$&&(I=="object"||I=="function")}function U11($){return!!$&&typeof $=="object"}var Y11=l01(function($,I,U,Y){m01(I,Q11(I),$,Y)}),J11=xI0(function($){return $.push(void 0,n01),yI0(Y11,void 0,$)});function Q11($){return I_($)?p01($,!0):d01($)}uI0.exports=J11});var bI0=N((JB1,J_)=>{function K11($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var fI0=z4().Buffer,uK=r("util");function q11($,I,U){$.copy(I,U)}J_.exports=function(){function $(){K11(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Y={data:U,next:null};if(this.length>0)this.tail.next=Y;else this.head=Y;this.tail=Y,++this.length},$.prototype.unshift=function(U){var Y={data:U,next:this.head};if(this.length===0)this.tail=Y;this.head=Y,++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 Y=this.head,J=""+Y.data;while(Y=Y.next)J+=U+Y.data;return J},$.prototype.concat=function(U){if(this.length===0)return fI0.alloc(0);var Y=fI0.allocUnsafe(U>>>0),J=this.head,Q=0;while(J)q11(J.data,Y,Q),Q+=J.data.length,J=J.next;return Y},$}();if(uK&&uK.inspect&&uK.inspect.custom)J_.exports.prototype[uK.inspect.custom]=function(){var $=uK.inspect({length:this.length});return this.constructor.name+" "+$}});var Q_=N((QB1,iI0)=>{var iL=M4();function G11($,I){var U=this,Y=this._readableState&&this._readableState.destroyed,J=this._writableState&&this._writableState.destroyed;if(Y||J){if(I)I($);else if($){if(!this._writableState)iL.nextTick(pL,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,iL.nextTick(pL,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(Q){if(!I&&Q){if(!U._writableState)iL.nextTick(pL,U,Q);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,iL.nextTick(pL,U,Q)}else if(I)I(Q)}),this}function H11(){if(this._readableState)this._readable Line truncated
%s`,C,C,E,Y);var u=E.type==="*"?n_:E.type==="?"?p_:"\\"+E.type;J=!0,Y=Y.slice(0,E.reStart)+u+"\\("+C}if(D(),Q)Y+="\\\\";var g=!1;switch(Y.charAt(0)){case"[":case".":case"(":g=!0}for(var b=q.length-1;b>-1;b--){var v=q[b],n=Y.slice(0,v.reStart),p=Y.slice(v.reStart,v.reEnd-8),S=Y.slice(v.reEnd-8,v.reEnd),f=Y.slice(v.reEnd);S+=f;var i=n.split("(").length-1,Y0=f;for(w=0;w<i;w++)Y0=Y0.replace(/\)[+*?]?/,"");f=Y0;var B="";if(f===""&&I!==JD)B="$";var k=n+p+f+B+S;Y=k}if(Y!==""&&J)Y="(?=.)"+Y;if(g)Y=X+Y;if(I===JD)return[Y,J];if(!J)return C81($);var d=U.nocase?"i":"";try{var t=new RegExp("^"+Y+"$",d)}catch(K0){return new RegExp("$.")}return t._glob=$,t._src=Y,t}K$.makeRe=function($,I){return new B4($,I||{}).makeRe()};B4.prototype.makeRe=R81;function R81(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var I=this.options,U=I.noglobstar?n_:I.dot?F81:M81,Y=I.nocase?"i":"",J=$.map(function(Q){return Q.map(function(K){return K===E3?U:typeof K==="string"?v81(K):K._src}).join("\\/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}K$.match=function($,I,U){U=U||{};var Y=new B4(I,U);if($=$.filter(function(J){return Y.match(J)}),Y.options.nonull&&!$.length)$.push(I);return $};B4.prototype.match=function(I,U){if(typeof U>"u")U=this.partial;if(this.debug("match",I,this.pattern),this.comment)return!1;if(this.empty)return I==="";if(I==="/"&&U)return!0;var Y=this.options;if(tK.sep!=="/")I=I.split(tK.sep).join("/");I=I.split(DY0),this.debug(this.pattern,"split",I);var J=this.set;this.debug(this.pattern,"set",J);var Q,K;for(K=I.length-1;K>=0;K--)if(Q=I[K],Q)break;for(K=0;K<J.length;K++){var q=J[K],G=I;if(Y.matchBase&&q.length===1)G=[Q];var H=this.matchOne(G,q,U);if(H){if(Y.flipNegate)return!0;return!this.negate}}if(Y.flipNegate)return!1;return this.negate};B4.prototype.matchOne=function($,I,U){if(I.indexOf(E3)!==-1)return this._matchGlobstar($,I,U,0,0);return this._matchOne($,I,U,0,0)};B4.prototype._matchGlobstar=function($,I,U,Y,J){var Q,K=-1;for(Q=J;Q<I.length;Q++)if(I[Q]===E3){K=Q;break}var q=-1;for(Q=I.length-1;Q>=0;Q--)if(I[Q]===E3){q=Q;break}var G=I.slice(J,K),H=U?I.slice(K+1):I.slice(K+1,q),W=U?[]:I.slice(q+1);if(G.length){var V=$.slice(Y,Y+G.length);if(!this._matchOne(V,G,U,0,0))return!1;Y+=G.length}var X=0;if(W.length){if(W.length+Y>$.length)return!1;var Z=$.length-W.length;if(this._matchOne($,W,U,Z,0))X=W.length;else{if($[$.length-1]!==""||Y+W.length===$.length)return!1;if(Z--,!this._matchOne($,W,U,Z,0))return!1;X=W.length+1}}if(!H.length){var D=!!X;for(Q=Y;Q<$.length-X;Q++){var w=String($[Q]);if(D=!0,w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return U||D}var O=[[[],0]],F=O[0],E=0,A=[0];for(var T=0;T<H.length;T++){var C=H[T];if(C===E3)A.push(E),F=[[],0],O.push(F);else F[0].push(C),E++}var u=O.length-1,g=$.length-X;for(var b=0;b<O.length;b++)O[b][1]=g-(A[u--]+O[b][0].length);return!!this._matchGlobStarBodySections($,O,Y,0,U,0,!!X)};B4.prototype._matchGlobStarBodySections=function($,I,U,Y,J,Q,K){var q=I[Y];if(!q){for(var G=U;G<$.length;G++){K=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return K}var W=q[0],V=q[1];while(U<=V){var X=this._matchOne($.slice(0,U+W.length),W,J,U,0);if(X&&Q<this.maxGlobstarRecursion){var Z=this._matchGlobStarBodySections($,I,U+W.length,Y+1,J,Q+1,K);if(Z!==!1)return Z}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return J||null};B4.prototype._matchOne=function($,I,U,Y,J){var Q,K,q,G;for(Q=Y,K=J,q=$.length,G=I.length;Q<q&&K<G;Q++,K++){this.debug("matchOne loop");var H=I[K],W=$[Q];if(this.debug(I,H,W),H===!1||H===E3)return!1;var V;if(typeof H==="string")V=W===H,this.debug("string match",H,W,V);else V=W.match(H),this.debug("pattern match",H,W,V);if(!V)return!1}if(Q===q&&K===G)return!0;else if(Q===q)return U;else if(K===G)return Q===q-1&&$[Q]==="";throw Error("wtf?")};function C81($){return $.replace(/\\(.)/g,"$1")}function v81($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var GD=N((TB1,qD)=>{function NY0($){return $.charAt(0)==="/"}function FY0($){var I=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=I.exec($),Y=U[1]||"",J=Boolean(Y&&Y.charAt(1)!==":");return Boolean(U[2]||J)}qD.exports=process.platform==="win32"?FY0:NY0;qD.exports.posix=NY0;qD.exports.win32=FY0});var d_=N((f81)=>{f81.setopts=h81;f81.ownProp=MY0;f81.makeAbs=aK;f81.finish=x81;f81.mark=k81;f81.isIgnored=AY0;f81.childrenIgnored=u81;function MY0($,I){return Object.prototype.hasOwnProperty.call($,I)}var j81=r("fs"),kY=r("path"),_81=KD(),zY0=GD(),c_=_81.Minimatch;function S81($,I){return $.localeCompare(I,"en")}function g81($,I){if($.ignore=I.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(y81)}function y81($){var I=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");I=new c_(U,{dot:!0})}return{matcher Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new y4($,I).found}function y4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))return new y4($,I);if(o81(this,$,I),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Y=0;Y<U;Y++)this._process(this.minimatch.set[Y],Y,!1);this._finish()}y4.prototype._finish=function(){if(TY0.ok(this instanceof y4),this.realpath){var $=this;this.matches.forEach(function(I,U){var Y=$.matches[U]=Object.create(null);for(var J in I)try{J=$._makeAbs(J);var Q=l81.realpathSync(J,$.realpathCache);Y[Q]=!0}catch(K){if(K.syscall==="stat")Y[$._makeAbs(J)]=!0;else throw K}})}B3.finish(this)};y4.prototype._process=function($,I,U){TY0.ok(this instanceof y4);var Y=0;while(typeof $[Y]==="string")Y++;var J;switch(Y){case $.length:this._processSimple($.join("/"),I);return;case 0:J=null;break;default:J=$.slice(0,Y).join("/");break}var Q=$.slice(Y),K;if(J===null)K=".";else if(HD(J)||HD($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!J||!HD(J))J="/"+J;K=J}else K=J;var q=this._makeAbs(K);if(r81(this,K))return;var G=Q[0]===PY0.GLOBSTAR;if(G)this._processGlobStar(J,K,q,Q,I,U);else this._processReaddir(J,K,q,Q,I,U)};y4.prototype._processReaddir=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y[0],G=!!this.minimatch.negate,H=q._glob,W=this.dot||H.charAt(0)===".",V=[];for(var X=0;X<K.length;X++){var Z=K[X];if(Z.charAt(0)!=="."||W){var D;if(G&&!$)D=!Z.match(q);else D=Z.match(q);if(D)V.push(Z)}}var w=V.length;if(w===0)return;if(Y.length===1&&!this.mark&&!this.stat){if(!this.matches[J])this.matches[J]=Object.create(null);for(var X=0;X<w;X++){var Z=V[X];if($)if($.slice(-1)!=="/")Z=$+"/"+Z;else Z=$+Z;if(Z.charAt(0)==="/"&&!this.nomount)Z=m_.join(this.root,Z);this._emitMatch(J,Z)}return}Y.shift();for(var X=0;X<w;X++){var Z=V[X],O;if($)O=[$,Z];else O=[Z];this._process(O.concat(Y),J,Q)}};y4.prototype._emitMatch=function($,I){if(t81(this,I))return;var U=this._makeAbs(I);if(this.mark)I=this._mark(I);if(this.absolute)I=U;if(this.matches[$][I])return;if(this.nodir){var Y=this.cache[U];if(Y==="DIR"||Array.isArray(Y))return}if(this.matches[$][I]=!0,this.stat)this._stat(I)};y4.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var I,U,Y;try{U=this.fs.lstatSync($)}catch(Q){if(Q.code==="ENOENT")return null}var J=U&&U.isSymbolicLink();if(this.symlinks[$]=J,!J&&U&&!U.isDirectory())this.cache[$]="FILE";else I=this._readdir($,!1);return I};y4.prototype._readdir=function($,I){var U;if(I&&!l_(this.symlinks,$))return this._readdirInGlobStar($);if(l_(this.cache,$)){var Y=this.cache[$];if(!Y||Y==="FILE")return null;if(Array.isArray(Y))return Y}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(J){return this._readdirError($,J),null}};y4.prototype._readdirEntries=function($,I){if(!this.mark&&!this.stat)for(var U=0;U<I.length;U++){var Y=I[U];if($==="/")Y=$+Y;else Y=$+"/"+Y;this.cache[Y]=!0}return this.cache[$]=I,I};y4.prototype._readdirError=function($,I){switch(I.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Y=Error(I.code+" invalid cwd "+this.cwd);throw Y.path=this.cwd,Y.code=I.code,Y}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 I;if(!this.silent)console.error("glob error",I);break}};y4.prototype._processGlobStar=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y.slice(1),G=$?[$]:[],H=G.concat(q);this._process(H,J,!1);var W=K.length,V=this.symlinks[U];if(V&&Q)return;for(var X=0;X<W;X++){var Z=K[X];if(Z.charAt(0)==="."&&!this.dot)continue;var D=G.concat(K[X],q);this._process(D,J,!0);var w=G.concat(K[X],Y);this._process(w,J,!0)}};y4.prototype._processSimple=function($,I){var U=this._stat($);if(!this.matches[I])this.matches[I]=Object.create(null);if(!U)return;if($&&HD($)&&!this.nomount){var Y=/[\/\\]$/.test($);if($.charAt(0)==="/")$=m_.join(this.root,$);else if($=m_.resolve(this.root,$),Y)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(I,$)};y4.prototype._stat=function($){var I=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&l_(this.cache,I)){var K=this.cache[I];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Y,J=this.statCache[I];if(!J){var Q;try{Q=this.fs.lstatSync(I)}catch(q){if(q&&(q.code==="ENOENT"||q.code==="ENOTDIR"))return this.statCache[I]=!1,!1}if(Q&&Q.isSymbolicLink())try{J=this.fs.statSync(I)}catch(q){J=Q}else J=Q}this.statCache[I]=J;var K=!0;if(J)K=J.isDirectory()?"DIR":"FILE";if(this.cache[I]=this.cache[I]||K,U&&K==="FILE")return!1;return K};y4.prototype._mark=function($){return B3.mark(this,$)};y4.prototype._makeAbs=function($){return B3.makeAbs(this,$)}});var o_=N((jB1,vY0)=>{vY0.exports=CY0;function CY0($,I){if($&&I)return CY0($)(I);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Y){U[Y]=$[Y]}),U;f Line truncated
`);if($.linkname)I+=BS(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var Y in U)I+=BS(" "+Y+"="+U[Y]+`
`);return Buffer.from(I)};Z91.decodePax=function($){var I={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Y=parseInt($.slice(0,U).toString(),10);if(!Y)return I;var J=$.slice(U+1,Y-1).toString(),Q=J.indexOf("=");if(Q===-1)return I;I[J.slice(0,Q)]=J.slice(Q+1),$=$.slice(Y)}return I};Z91.encode=function($){var I=I91(512),U=$.name,Y="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var J=U.indexOf("/");if(J===-1)return null;Y+=Y?"/"+U.slice(0,J):U.slice(0,J),U=U.slice(J+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Y)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(I.write(U),I.write(t9($.mode&q91,6),100),I.write(t9($.uid,6),108),I.write(t9($.gid,6),116),I.write(t9($.size,11),124),I.write(t9($.mtime.getTime()/1000|0,11),136),I[156]=lJ0+W91($.type),$.linkname)I.write($.linkname,157);if(oJ0.copy(I,Yq),J91.copy(I,RS),$.uname)I.write($.uname,265);if($.gname)I.write($.gname,297);if(I.write(t9($.devmajor||0,6),329),I.write(t9($.devminor||0,6),337),Y)I.write(Y,345);return I.write(t9(tJ0(I),6),148),I};Z91.decode=function($,I,U){var Y=$[156]===0?0:$[156]-lJ0,J=iY($,0,100,I),Q=a9($,100,8),K=a9($,108,8),q=a9($,116,8),G=a9($,124,12),H=a9($,136,12),W=H91(Y),V=$[157]===0?null:iY($,157,100,I),X=iY($,265,32),Z=iY($,297,32),D=a9($,329,8),w=a9($,337,8),O=tJ0($);if(O===256)return null;if(O!==a9($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(oJ0.compare($,Yq,Yq+6)===0){if($[345])J=iY($,345,155,I)+"/"+J}else if(Q91.compare($,Yq,Yq+6)===0&&K91.compare($,RS,RS+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Y===0&&J&&J[J.length-1]==="/")Y=5;return{name:J,mode:Q,uid:K,gid:q,size:G,mtime:new Date(1000*H),type:W,linkname:V,uname:X,gname:Z,devmajor:D,devminor:w}}});var YQ0=N((VR1,UQ0)=>{var sJ0=r("util"),N91=mJ0(),Jq=CS(),eJ0=L6().Writable,$Q0=L6().PassThrough,IQ0=function(){},aJ0=function($){return $&=511,$&&512-$},F91=function($,I){var U=new wD($,I);return U.end(),U},M91=function($,I){if(I.path)$.name=I.path;if(I.linkpath)$.linkname=I.linkpath;if(I.size)$.size=parseInt(I.size,10);return $.pax=I,$},wD=function($,I){this._parent=$,this.offset=I,$Q0.call(this,{autoDestroy:!1})};sJ0.inherits(wD,$Q0);wD.prototype.destroy=function($){this._parent.destroy($)};var R5=function($){if(!(this instanceof R5))return new R5($);eJ0.call(this,$),$=$||{},this._offset=0,this._buffer=N91(),this._missing=0,this._partial=!1,this._onparse=IQ0,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 I=this,U=I._buffer,Y=function(){I._continue()},J=function(X){if(I._locked=!1,X)return I.destroy(X);if(!I._stream)Y()},Q=function(){I._stream=null;var X=aJ0(I._header.size);if(X)I._parse(X,K);else I._parse(512,V);if(!I._locked)Y()},K=function(){I._buffer.consume(aJ0(I._header.size)),I._parse(512,V),Y()},q=function(){var X=I._header.size;I._paxGlobal=Jq.decodePax(U.slice(0,X)),U.consume(X),Q()},G=function(){var X=I._header.size;if(I._pax=Jq.decodePax(U.slice(0,X)),I._paxGlobal)I._pax=Object.assign({},I._paxGlobal,I._pax);U.consume(X),Q()},H=function(){var X=I._header.size;this._gnuLongPath=Jq.decodeLongPath(U.slice(0,X),$.filenameEncoding),U.consume(X),Q()},W=function(){var X=I._header.size;this._gnuLongLinkPath=Jq.decodeLongPath(U.slice(0,X),$.filenameEncoding),U.consume(X),Q()},V=function(){var X=I._offset,Z;try{Z=I._header=Jq.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(D){I.emit("error",D)}if(U.consume(512),!Z){I._parse(512,V),Y();return}if(Z.type==="gnu-long-path"){I._parse(Z.size,H),Y();return}if(Z.type==="gnu-long-link-path"){I._parse(Z.size,W),Y();return}if(Z.type==="pax-global-header"){I._parse(Z.size,q),Y();return}if(Z.type==="pax-header"){I._parse(Z.size,G),Y();return}if(I._gnuLongPath)Z.name=I._gnuLongPath,I._gnuLongPath=null;if(I._gnuLongLinkPath)Z.linkname=I._gnuLongLinkPath,I._gnuLongLinkPath=null;if(I._pax)I._header=Z=M91(Z,I._pax),I._pax=null;if(I._locked=!0,!Z.size||Z.type==="directory"){I._parse(512,V),I.emit("entry",Z,F91(I,X),J);return}I._stream=new wD(I,X),I.emit("entry",Z,I._stream,J),I._parse(Z.size,Q),Y()};this._onheader=V,this._parse(512,V)};sJ0.inherits(R5,eJ0);R5.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};R5.prototype._parse=function($,I){if(this._destroyed)return;if(this._offset+=$,this._missing=$,I===this._onheader)this._partial=!1;this._onparse=I};R5.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=IQ0,this._overflow)this._write(this._overflow,void 0,$);else $()};R5.prototype._write=function($,I,U){if(this._destroyed)return;var Y=this._stream,J=this._buffer,Q=this._missing;if($.length)this._partial=!0;if($.length<Q){ Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let I=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${f91.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${$.Target}"/>`);return I}_writeClose(){this.stream.write("</Relationships>")}}vQ0.exports=CQ0});var hQ0=N((zR1,yQ0)=>{var _Q0=$6(),SQ0=g9(),i91=G4(),p91=qv(),n91=Hv();class gQ0{constructor($,I,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=I}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:SQ0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let I={Type:SQ0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(I)}_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($,I){let U=new p91,Y=new _Q0;U.render(Y,$),this.commentsStream.write(Y.xml);let J=new n91,Q=new _Q0;J.render(Q,$,I),this.vmlStream.write(Q.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((I)=>{I.refAddress=i91.decodeAddress(I.ref)}),$.forEach((I)=>{this._writeComment(I,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}yQ0.exports=gQ0});var iQ0=N((AR1,bQ0)=>{var c91=X4(),d91=g9(),_S=G4(),xQ0=EE(),kQ0=Q5(),m91=bR(),uQ0=yV(),SS=xV(),l91=jQ0(),o91=hQ0(),r91=PE(),i4=new m91,gS=j9(),t91=hC(),a91=xC(),s91=kC(),e91=_C(),$71=vC(),I71=SC(),U71=uC(),Y71=fC(),J71=bC(),Q71=iC(),K71=pC(),q71=nC(),G71=oC(),H71=dC(),W71=cC(),p4={dataValidations:new t91,sheetProperties:new a91,sheetFormatProperties:new s91,columns:new gS({tag:"cols",length:!1,childXform:new e91}),row:new $71,hyperlinks:new gS({tag:"hyperlinks",length:!1,childXform:new I71}),sheetViews:new gS({tag:"sheetViews",length:!1,childXform:new U71}),sheetProtection:new Y71,pageMargins:new J71,pageSeteup:new Q71,autoFilter:new K71,picture:new q71,conditionalFormattings:new G71,headerFooter:new H71,rowBreaks:new W71};class fQ0{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 l91($),this._sheetCommentsWriter=new o91(this,this._sheetRelsWriter,$),this._dimensions=new kQ0,this._rowZero=1,this.committed=!1,this.dataValidations=new r91,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
*/vU0.exports=function($,I){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Y="";if(U>4&&$[3]==="\\"){var J=$[2];if((J==="?"||J===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Y="//"}var Q=$.split(/[/\\]+/);if(I!==!1&&Q[Q.length-1]==="")Q.pop();return Y+Q.join("/")}});var C_=O((xv1,yU0)=>{var CU0=9007199254740991,m11="[object Arguments]",l11="[object Function]",o11="[object GeneratorFunction]",r11=/^(?:0|[1-9]\d*)$/;function jU0($,I,U){switch(U.length){case 0:return $.call(I);case 1:return $.call(I,U[0]);case 2:return $.call(I,U[0],U[1]);case 3:return $.call(I,U[0],U[1],U[2])}return $.apply(I,U)}function t11($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}var oK=Object.prototype,rK=oK.hasOwnProperty,_U0=oK.toString,a11=oK.propertyIsEnumerable,RU0=Math.max;function s11($,I){var U=H41($)||q41($)?t11($.length,String):[],Y=U.length,J=!!Y;for(var Q in $)if((I||rK.call($,Q))&&!(J&&(Q=="length"||SU0(Q,Y))))U.push(Q);return U}function e11($,I,U,Y){if($===void 0||B_($,oK[U])&&!rK.call(Y,U))return I;return $}function $41($,I,U){var Y=$[I];if(!(rK.call($,I)&&B_(Y,U))||U===void 0&&!(I in $))$[I]=U}function I41($){if(!R_($))return K41($);var I=Q41($),U=[];for(var Y in $)if(!(Y=="constructor"&&(I||!rK.call($,Y))))U.push(Y);return U}function gU0($,I){return I=RU0(I===void 0?$.length-1:I,0),function(){var U=arguments,Y=-1,J=RU0(U.length-I,0),Q=Array(J);while(++Y<J)Q[Y]=U[I+Y];Y=-1;var K=Array(I+1);while(++Y<I)K[Y]=U[Y];return K[I]=Q,jU0($,this,K)}}function U41($,I,U,Y){U||(U={});var J=-1,Q=I.length;while(++J<Q){var K=I[J],q=Y?Y(U[K],$[K],K,U,$):void 0;$41(U,K,q===void 0?$[K]:q)}return U}function Y41($){return gU0(function(I,U){var Y=-1,J=U.length,Q=J>1?U[J-1]:void 0,K=J>2?U[2]:void 0;if(Q=$.length>3&&typeof Q=="function"?(J--,Q):void 0,K&&J41(U[0],U[1],K))Q=J<3?void 0:Q,J=1;I=Object(I);while(++Y<J){var q=U[Y];if(q)$(I,q,Y,Q)}return I})}function SU0($,I){return I=I==null?CU0:I,!!I&&(typeof $=="number"||r11.test($))&&($>-1&&$%1==0&&$<I)}function J41($,I,U){if(!R_(U))return!1;var Y=typeof I;if(Y=="number"?v_(U)&&SU0(I,U.length):Y=="string"&&(I in U))return B_(U[I],$);return!1}function Q41($){var I=$&&$.constructor,U=typeof I=="function"&&I.prototype||oK;return $===U}function K41($){var I=[];if($!=null)for(var U in Object($))I.push(U);return I}function B_($,I){return $===I||$!==$&&I!==I}function q41($){return G41($)&&rK.call($,"callee")&&(!a11.call($,"callee")||_U0.call($)==m11)}var H41=Array.isArray;function v_($){return $!=null&&w41($.length)&&!W41($)}function G41($){return V41($)&&v_($)}function W41($){var I=R_($)?_U0.call($):"";return I==l11||I==o11}function w41($){return typeof $=="number"&&$>-1&&$%1==0&&$<=CU0}function R_($){var I=typeof $;return!!$&&(I=="object"||I=="function")}function V41($){return!!$&&typeof $=="object"}var Z41=Y41(function($,I,U,Y){U41(I,X41(I),$,Y)}),z41=gU0(function($){return $.push(void 0,e11),jU0(Z41,void 0,$)});function X41($){return v_($)?s11($,!0):I41($)}yU0.exports=z41});var uU0=O((kv1,j_)=>{function L41($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var hU0=M4().Buffer,tK=r("util");function D41($,I,U){$.copy(I,U)}j_.exports=function(){function $(){L41(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Y={data:U,next:null};if(this.length>0)this.tail.next=Y;else this.head=Y;this.tail=Y,++this.length},$.prototype.unshift=function(U){var Y={data:U,next:this.head};if(this.length===0)this.tail=Y;this.head=Y,++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 Y=this.head,J=""+Y.data;while(Y=Y.next)J+=U+Y.data;return J},$.prototype.concat=function(U){if(this.length===0)return hU0.alloc(0);var Y=hU0.allocUnsafe(U>>>0),J=this.head,Q=0;while(J)D41(J.data,Y,Q),Q+=J.data.length,J=J.next;return Y},$}();if(tK&&tK.inspect&&tK.inspect.custom)j_.exports.prototype[tK.inspect.custom]=function(){var $=tK.inspect({length:this.length});return this.constructor.name+" "+$}});var __=O((fv1,xU0)=>{var JX=N4();function O41($,I){var U=this,Y=this._readableState&&this._readableState.destroyed,J=this._writableState&&this._writableState.destroyed;if(Y||J){if(I)I($);else if($){if(!this._writableState)JX.nextTick(QX,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,JX.nextTick(QX,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(Q){if(!I&&Q){if(!U._writableState)JX.nextTick(QX,U,Q);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,JX.nextTick(QX,U,Q)}else if(I)I(Q)}),this}function F41(){if(this._readableState)this._readable Line truncated
%s`,R,R,E,Y);var k=E.type==="*"?Xg:E.type==="?"?zg:"\\"+E.type;J=!0,Y=Y.slice(0,E.reStart)+k+"\\("+R}if(X(),Q)Y+="\\\\";var S=!1;switch(Y.charAt(0)){case"[":case".":case"(":S=!0}for(var i=q.length-1;i>-1;i--){var C=q[i],p=Y.slice(0,C.reStart),n=Y.slice(C.reStart,C.reEnd-8),g=Y.slice(C.reEnd-8,C.reEnd),f=Y.slice(C.reEnd);g+=f;var b=p.split("(").length-1,Y0=f;for(L=0;L<b;L++)Y0=Y0.replace(/\)[+*?]?/,"");f=Y0;var B="";if(f===""&&I!==MX)B="$";var x=p+n+f+B+g;Y=x}if(Y!==""&&J)Y="(?=.)"+Y;if(S)Y=V+Y;if(I===MX)return[Y,J];if(!J)return k51($);var d=U.nocase?"i":"";try{var t=new RegExp("^"+Y+"$",d)}catch(K0){return new RegExp("$.")}return t._glob=$,t._src=Y,t}G$.makeRe=function($,I){return new B4($,I||{}).makeRe()};B4.prototype.makeRe=x51;function x51(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var I=this.options,U=I.noglobstar?Xg:I.dot?C51:j51,Y=I.nocase?"i":"",J=$.map(function(Q){return Q.map(function(K){return K===y3?U:typeof K==="string"?f51(K):K._src}).join("\\/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}G$.match=function($,I,U){U=U||{};var Y=new B4(I,U);if($=$.filter(function(J){return Y.match(J)}),Y.options.nonull&&!$.length)$.push(I);return $};B4.prototype.match=function(I,U){if(typeof U>"u")U=this.partial;if(this.debug("match",I,this.pattern),this.comment)return!1;if(this.empty)return I==="";if(I==="/"&&U)return!0;var Y=this.options;if(Hq.sep!=="/")I=I.split(Hq.sep).join("/");I=I.split(wJ0),this.debug(this.pattern,"split",I);var J=this.set;this.debug(this.pattern,"set",J);var Q,K;for(K=I.length-1;K>=0;K--)if(Q=I[K],Q)break;for(K=0;K<J.length;K++){var q=J[K],H=I;if(Y.matchBase&&q.length===1)H=[Q];var G=this.matchOne(H,q,U);if(G){if(Y.flipNegate)return!0;return!this.negate}}if(Y.flipNegate)return!1;return this.negate};B4.prototype.matchOne=function($,I,U){if(I.indexOf(y3)!==-1)return this._matchGlobstar($,I,U,0,0);return this._matchOne($,I,U,0,0)};B4.prototype._matchGlobstar=function($,I,U,Y,J){var Q,K=-1;for(Q=J;Q<I.length;Q++)if(I[Q]===y3){K=Q;break}var q=-1;for(Q=I.length-1;Q>=0;Q--)if(I[Q]===y3){q=Q;break}var H=I.slice(J,K),G=U?I.slice(K+1):I.slice(K+1,q),W=U?[]:I.slice(q+1);if(H.length){var w=$.slice(Y,Y+H.length);if(!this._matchOne(w,H,U,0,0))return!1;Y+=H.length}var V=0;if(W.length){if(W.length+Y>$.length)return!1;var Z=$.length-W.length;if(this._matchOne($,W,U,Z,0))V=W.length;else{if($[$.length-1]!==""||Y+W.length===$.length)return!1;if(Z--,!this._matchOne($,W,U,Z,0))return!1;V=W.length+1}}if(!G.length){var X=!!V;for(Q=Y;Q<$.length-V;Q++){var L=String($[Q]);if(X=!0,L==="."||L===".."||!this.options.dot&&L.charAt(0)===".")return!1}return U||X}var D=[[[],0]],F=D[0],E=0,T=[0];for(var A=0;A<G.length;A++){var R=G[A];if(R===y3)T.push(E),F=[[],0],D.push(F);else F[0].push(R),E++}var k=D.length-1,S=$.length-V;for(var i=0;i<D.length;i++)D[i][1]=S-(T[k--]+D[i][0].length);return!!this._matchGlobStarBodySections($,D,Y,0,U,0,!!V)};B4.prototype._matchGlobStarBodySections=function($,I,U,Y,J,Q,K){var q=I[Y];if(!q){for(var H=U;H<$.length;H++){K=!0;var G=$[H];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1}return K}var W=q[0],w=q[1];while(U<=w){var V=this._matchOne($.slice(0,U+W.length),W,J,U,0);if(V&&Q<this.maxGlobstarRecursion){var Z=this._matchGlobStarBodySections($,I,U+W.length,Y+1,J,Q+1,K);if(Z!==!1)return Z}var G=$[U];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1;U++}return J||null};B4.prototype._matchOne=function($,I,U,Y,J){var Q,K,q,H;for(Q=Y,K=J,q=$.length,H=I.length;Q<q&&K<H;Q++,K++){this.debug("matchOne loop");var G=I[K],W=$[Q];if(this.debug(I,G,W),G===!1||G===y3)return!1;var w;if(typeof G==="string")w=W===G,this.debug("string match",G,W,w);else w=W.match(G),this.debug("pattern match",G,W,w);if(!w)return!1}if(Q===q&&K===H)return!0;else if(Q===q)return U;else if(K===H)return Q===q-1&&$[Q]==="";throw Error("wtf?")};function k51($){return $.replace(/\\(.)/g,"$1")}function f51($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var EX=O((JR1,TX)=>{function zJ0($){return $.charAt(0)==="/"}function XJ0($){var I=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=I.exec($),Y=U[1]||"",J=Boolean(Y&&Y.charAt(1)!==":");return Boolean(U[2]||J)}TX.exports=process.platform==="win32"?XJ0:zJ0;TX.exports.posix=zJ0;TX.exports.win32=XJ0});var Dg=O((r51)=>{r51.setopts=d51;r51.ownProp=LJ0;r51.makeAbs=Gq;r51.finish=m51;r51.mark=l51;r51.isIgnored=OJ0;r51.childrenIgnored=o51;function LJ0($,I){return Object.prototype.hasOwnProperty.call($,I)}var i51=r("fs"),dY=r("path"),b51=PX(),DJ0=EX(),Lg=b51.Minimatch;function n51($,I){return $.localeCompare(I,"en")}function p51($,I){if($.ignore=I.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(c51)}function c51($){var I=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");I=new Lg(U,{dot:!0})}return{matcher Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new h4($,I).found}function h4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))return new h4($,I);if(J91(this,$,I),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Y=0;Y<U;Y++)this._process(this.minimatch.set[Y],Y,!1);this._finish()}h4.prototype._finish=function(){if(NJ0.ok(this instanceof h4),this.realpath){var $=this;this.matches.forEach(function(I,U){var Y=$.matches[U]=Object.create(null);for(var J in I)try{J=$._makeAbs(J);var Q=Y91.realpathSync(J,$.realpathCache);Y[Q]=!0}catch(K){if(K.syscall==="stat")Y[$._makeAbs(J)]=!0;else throw K}})}h3.finish(this)};h4.prototype._process=function($,I,U){NJ0.ok(this instanceof h4);var Y=0;while(typeof $[Y]==="string")Y++;var J;switch(Y){case $.length:this._processSimple($.join("/"),I);return;case 0:J=null;break;default:J=$.slice(0,Y).join("/");break}var Q=$.slice(Y),K;if(J===null)K=".";else if(BX(J)||BX($.map(function(G){return typeof G==="string"?G:"[*]"}).join("/"))){if(!J||!BX(J))J="/"+J;K=J}else K=J;var q=this._makeAbs(K);if(Q91(this,K))return;var H=Q[0]===FJ0.GLOBSTAR;if(H)this._processGlobStar(J,K,q,Q,I,U);else this._processReaddir(J,K,q,Q,I,U)};h4.prototype._processReaddir=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y[0],H=!!this.minimatch.negate,G=q._glob,W=this.dot||G.charAt(0)===".",w=[];for(var V=0;V<K.length;V++){var Z=K[V];if(Z.charAt(0)!=="."||W){var X;if(H&&!$)X=!Z.match(q);else X=Z.match(q);if(X)w.push(Z)}}var L=w.length;if(L===0)return;if(Y.length===1&&!this.mark&&!this.stat){if(!this.matches[J])this.matches[J]=Object.create(null);for(var V=0;V<L;V++){var Z=w[V];if($)if($.slice(-1)!=="/")Z=$+"/"+Z;else Z=$+Z;if(Z.charAt(0)==="/"&&!this.nomount)Z=Og.join(this.root,Z);this._emitMatch(J,Z)}return}Y.shift();for(var V=0;V<L;V++){var Z=w[V],D;if($)D=[$,Z];else D=[Z];this._process(D.concat(Y),J,Q)}};h4.prototype._emitMatch=function($,I){if(K91(this,I))return;var U=this._makeAbs(I);if(this.mark)I=this._mark(I);if(this.absolute)I=U;if(this.matches[$][I])return;if(this.nodir){var Y=this.cache[U];if(Y==="DIR"||Array.isArray(Y))return}if(this.matches[$][I]=!0,this.stat)this._stat(I)};h4.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var I,U,Y;try{U=this.fs.lstatSync($)}catch(Q){if(Q.code==="ENOENT")return null}var J=U&&U.isSymbolicLink();if(this.symlinks[$]=J,!J&&U&&!U.isDirectory())this.cache[$]="FILE";else I=this._readdir($,!1);return I};h4.prototype._readdir=function($,I){var U;if(I&&!Fg(this.symlinks,$))return this._readdirInGlobStar($);if(Fg(this.cache,$)){var Y=this.cache[$];if(!Y||Y==="FILE")return null;if(Array.isArray(Y))return Y}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(J){return this._readdirError($,J),null}};h4.prototype._readdirEntries=function($,I){if(!this.mark&&!this.stat)for(var U=0;U<I.length;U++){var Y=I[U];if($==="/")Y=$+Y;else Y=$+"/"+Y;this.cache[Y]=!0}return this.cache[$]=I,I};h4.prototype._readdirError=function($,I){switch(I.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Y=Error(I.code+" invalid cwd "+this.cwd);throw Y.path=this.cwd,Y.code=I.code,Y}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 I;if(!this.silent)console.error("glob error",I);break}};h4.prototype._processGlobStar=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y.slice(1),H=$?[$]:[],G=H.concat(q);this._process(G,J,!1);var W=K.length,w=this.symlinks[U];if(w&&Q)return;for(var V=0;V<W;V++){var Z=K[V];if(Z.charAt(0)==="."&&!this.dot)continue;var X=H.concat(K[V],q);this._process(X,J,!0);var L=H.concat(K[V],Y);this._process(L,J,!0)}};h4.prototype._processSimple=function($,I){var U=this._stat($);if(!this.matches[I])this.matches[I]=Object.create(null);if(!U)return;if($&&BX($)&&!this.nomount){var Y=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Og.join(this.root,$);else if($=Og.resolve(this.root,$),Y)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(I,$)};h4.prototype._stat=function($){var I=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Fg(this.cache,I)){var K=this.cache[I];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Y,J=this.statCache[I];if(!J){var Q;try{Q=this.fs.lstatSync(I)}catch(q){if(q&&(q.code==="ENOENT"||q.code==="ENOTDIR"))return this.statCache[I]=!1,!1}if(Q&&Q.isSymbolicLink())try{J=this.fs.statSync(I)}catch(q){J=Q}else J=Q}this.statCache[I]=J;var K=!0;if(J)K=J.isDirectory()?"DIR":"FILE";if(this.cache[I]=this.cache[I]||K,U&&K==="FILE")return!1;return K};h4.prototype._mark=function($){return h3.mark(this,$)};h4.prototype._makeAbs=function($){return h3.makeAbs(this,$)}});var Ng=O((WR1,EJ0)=>{EJ0.exports=TJ0;function TJ0($,I){if($&&I)return TJ0($)(I);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Y){U[Y]=$[Y]}),U;f Line truncated
`);if($.linkname)I+=sg(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var Y in U)I+=sg(" "+Y+"="+U[Y]+`
`);return Buffer.from(I)};A71.decodePax=function($){var I={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Y=parseInt($.slice(0,U).toString(),10);if(!Y)return I;var J=$.slice(U+1,Y-1).toString(),Q=J.indexOf("=");if(Q===-1)return I;I[J.slice(0,Q)]=J.slice(Q+1),$=$.slice(Y)}return I};A71.encode=function($){var I=w71(512),U=$.name,Y="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var J=U.indexOf("/");if(J===-1)return null;Y+=Y?"/"+U.slice(0,J):U.slice(0,J),U=U.slice(J+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Y)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(I.write(U),I.write(J7($.mode&D71,6),100),I.write(J7($.uid,6),108),I.write(J7($.gid,6),116),I.write(J7($.size,11),124),I.write(J7($.mtime.getTime()/1000|0,11),136),I[156]=pQ0+N71($.type),$.linkname)I.write($.linkname,157);if(cQ0.copy(I,Xq),z71.copy(I,eg),$.uname)I.write($.uname,265);if($.gname)I.write($.gname,297);if(I.write(J7($.devmajor||0,6),329),I.write(J7($.devminor||0,6),337),Y)I.write(Y,345);return I.write(J7(mQ0(I),6),148),I};A71.decode=function($,I,U){var Y=$[156]===0?0:$[156]-pQ0,J=rY($,0,100,I),Q=Q7($,100,8),K=Q7($,108,8),q=Q7($,116,8),H=Q7($,124,12),G=Q7($,136,12),W=F71(Y),w=$[157]===0?null:rY($,157,100,I),V=rY($,265,32),Z=rY($,297,32),X=Q7($,329,8),L=Q7($,337,8),D=mQ0($);if(D===256)return null;if(D!==Q7($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(cQ0.compare($,Xq,Xq+6)===0){if($[345])J=rY($,345,155,I)+"/"+J}else if(X71.compare($,Xq,Xq+6)===0&&L71.compare($,eg,eg+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Y===0&&J&&J[J.length-1]==="/")Y=5;return{name:J,mode:Q,uid:K,gid:q,size:H,mtime:new Date(1000*G),type:W,linkname:w,uname:V,gname:Z,devmajor:X,devminor:L}}});var eQ0=O((dR1,sQ0)=>{var oQ0=r("util"),R71=nQ0(),Lq=$S(),rQ0=L6().Writable,tQ0=L6().PassThrough,aQ0=function(){},lQ0=function($){return $&=511,$&&512-$},C71=function($,I){var U=new SX($,I);return U.end(),U},j71=function($,I){if(I.path)$.name=I.path;if(I.linkpath)$.linkname=I.linkpath;if(I.size)$.size=parseInt(I.size,10);return $.pax=I,$},SX=function($,I){this._parent=$,this.offset=I,tQ0.call(this,{autoDestroy:!1})};oQ0.inherits(SX,tQ0);SX.prototype.destroy=function($){this._parent.destroy($)};var y5=function($){if(!(this instanceof y5))return new y5($);rQ0.call(this,$),$=$||{},this._offset=0,this._buffer=R71(),this._missing=0,this._partial=!1,this._onparse=aQ0,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 I=this,U=I._buffer,Y=function(){I._continue()},J=function(V){if(I._locked=!1,V)return I.destroy(V);if(!I._stream)Y()},Q=function(){I._stream=null;var V=lQ0(I._header.size);if(V)I._parse(V,K);else I._parse(512,w);if(!I._locked)Y()},K=function(){I._buffer.consume(lQ0(I._header.size)),I._parse(512,w),Y()},q=function(){var V=I._header.size;I._paxGlobal=Lq.decodePax(U.slice(0,V)),U.consume(V),Q()},H=function(){var V=I._header.size;if(I._pax=Lq.decodePax(U.slice(0,V)),I._paxGlobal)I._pax=Object.assign({},I._paxGlobal,I._pax);U.consume(V),Q()},G=function(){var V=I._header.size;this._gnuLongPath=Lq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},W=function(){var V=I._header.size;this._gnuLongLinkPath=Lq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},w=function(){var V=I._offset,Z;try{Z=I._header=Lq.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(X){I.emit("error",X)}if(U.consume(512),!Z){I._parse(512,w),Y();return}if(Z.type==="gnu-long-path"){I._parse(Z.size,G),Y();return}if(Z.type==="gnu-long-link-path"){I._parse(Z.size,W),Y();return}if(Z.type==="pax-global-header"){I._parse(Z.size,q),Y();return}if(Z.type==="pax-header"){I._parse(Z.size,H),Y();return}if(I._gnuLongPath)Z.name=I._gnuLongPath,I._gnuLongPath=null;if(I._gnuLongLinkPath)Z.linkname=I._gnuLongLinkPath,I._gnuLongLinkPath=null;if(I._pax)I._header=Z=j71(Z,I._pax),I._pax=null;if(I._locked=!0,!Z.size||Z.type==="directory"){I._parse(512,w),I.emit("entry",Z,C71(I,V),J);return}I._stream=new SX(I,V),I.emit("entry",Z,I._stream,J),I._parse(Z.size,Q),Y()};this._onheader=w,this._parse(512,w)};oQ0.inherits(y5,rQ0);y5.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};y5.prototype._parse=function($,I){if(this._destroyed)return;if(this._offset+=$,this._missing=$,I===this._onheader)this._partial=!1;this._onparse=I};y5.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aQ0,this._overflow)this._write(this._overflow,void 0,$);else $()};y5.prototype._write=function($,I,U){if(this._destroyed)return;var Y=this._stream,J=this._buffer,Q=this._missing;if($.length)this._partial=!0;if($.length<Q){ Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let I=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${r71.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${$.Target}"/>`);return I}_writeClose(){this.stream.write("</Relationships>")}}E20.exports=T20});var _20=O((IC1,j20)=>{var v20=I6(),R20=b9(),a71=G4(),s71=SC(),e71=hC();class C20{constructor($,I,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=I}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:R20.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let I={Type:R20.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(I)}_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($,I){let U=new s71,Y=new v20;U.render(Y,$),this.commentsStream.write(Y.xml);let J=new e71,Q=new v20;J.render(Q,$,I),this.vmlStream.write(Q.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((I)=>{I.refAddress=a71.decodeAddress(I.ref)}),$.forEach((I)=>{this._writeComment(I,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}j20.exports=C20});var x20=O((UC1,u20)=>{var $31=z4(),I31=b9(),YS=G4(),g20=aE(),S20=V5(),U31=VR(),y20=aw(),JS=ew(),Y31=B20(),J31=_20(),Q31=rE(),n4=new U31,QS=k9(),K31=qC(),q31=HC(),H31=GC(),G31=YC(),W31=IC(),w31=JC(),V31=WC(),Z31=wC(),z31=VC(),X31=ZC(),L31=zC(),D31=XC(),O31=NC(),F31=DC(),N31=LC(),p4={dataValidations:new K31,sheetProperties:new q31,sheetFormatProperties:new H31,columns:new QS({tag:"cols",length:!1,childXform:new G31}),row:new W31,hyperlinks:new QS({tag:"hyperlinks",length:!1,childXform:new w31}),sheetViews:new QS({tag:"sheetViews",length:!1,childXform:new V31}),sheetProtection:new Z31,pageMargins:new z31,pageSeteup:new X31,autoFilter:new L31,picture:new D31,conditionalFormattings:new O31,headerFooter:new F31,rowBreaks:new N31};class h20{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 Y31($),this._sheetCommentsWriter=new J31(this,this._sheetRelsWriter,$),this._dimensions=new S20,this._rowZero=1,this.committed=!1,this.dataValidations=new Q31,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
`)},aS=sS.getNativePromise();if(sS.isNode&&typeof MutationObserver>"u")eS=global.setImmediate,$g=process.nextTick,y3=sS.isRecentNode?function($){eS.call(global,$)}:function($){$g.call(process,$)};else if(typeof aS==="function"&&typeof aS.resolve==="function")Ig=aS.resolve(),y3=function($){Ig.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))y3=function(){var $=document.createElement("div"),I={attributes:!0},U=!1,Y=document.createElement("div"),J=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});J.observe(Y,I);var Q=function(){if(U)return;U=!0,Y.classList.toggle("foo")};return function(q){var G=new MutationObserver(function(){G.disconnect(),q()});G.observe($,I),Q()}}();else if(typeof setImmediate<"u")y3=function($){setImmediate($)};else if(typeof setTimeout<"u")y3=function($){setTimeout($,0)};else y3=I31;var eS,$g,Ig;M20.exports=y3});var P20=N((yR1,A20)=>{function U31($,I,U,Y,J){for(var Q=0;Q<J;++Q)U[Q+Y]=$[Q+I],$[Q+I]=void 0}function $7($){this._capacity=$,this._length=0,this._front=0}$7.prototype._willBeOverCapacity=function($){return this._capacity<$};$7.prototype._pushOne=function($){var I=this.length();this._checkCapacity(I+1);var U=this._front+I&this._capacity-1;this[U]=$,this._length=I+1};$7.prototype.push=function($,I,U){var Y=this.length()+3;if(this._willBeOverCapacity(Y)){this._pushOne($),this._pushOne(I),this._pushOne(U);return}var J=this._front+Y-3;this._checkCapacity(Y);var Q=this._capacity-1;this[J+0&Q]=$,this[J+1&Q]=I,this[J+2&Q]=U,this._length=Y};$7.prototype.shift=function(){var $=this._front,I=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,I};$7.prototype.length=function(){return this._length};$7.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};$7.prototype._resizeTo=function($){var I=this._capacity;this._capacity=$;var U=this._front,Y=this._length,J=U+Y&I-1;U31(this,0,this,I,J)};A20.exports=$7});var j20=N((hR1,Ug)=>{var C20;try{throw Error()}catch($){C20=$}var Y31=z20(),T20=P20(),v20=b1();function n4(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new T20(16),this._normalQueue=new T20(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=Y31}n4.prototype.setScheduler=function($){var I=this._schedule;return this._schedule=$,this._customScheduler=!0,I};n4.prototype.hasCustomScheduler=function(){return this._customScheduler};n4.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};n4.prototype.disableTrampolineIfNecessary=function(){if(v20.hasDevTools)this._trampolineEnabled=!1};n4.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};n4.prototype.fatalError=function($,I){if(I)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};n4.prototype.throwLater=function($,I){if(arguments.length===1)I=$,$=function(){throw I};if(typeof setTimeout<"u")setTimeout(function(){$(I)},0);else try{this._schedule(function(){$(I)})}catch(U){throw Error(`No async scheduler available
`)},PS=TS.getNativePromise();if(TS.isNode&&typeof MutationObserver>"u")ES=global.setImmediate,BS=process.nextTick,p3=TS.isRecentNode?function($){ES.call(global,$)}:function($){BS.call(process,$)};else if(typeof PS==="function"&&typeof PS.resolve==="function")vS=PS.resolve(),p3=function($){vS.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))p3=function(){var $=document.createElement("div"),I={attributes:!0},U=!1,Y=document.createElement("div"),J=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});J.observe(Y,I);var Q=function(){if(U)return;U=!0,Y.classList.toggle("foo")};return function(q){var H=new MutationObserver(function(){H.disconnect(),q()});H.observe($,I),Q()}}();else if(typeof setImmediate<"u")p3=function($){setImmediate($)};else if(typeof setTimeout<"u")p3=function($){setTimeout($,0)};else p3=wI1;var ES,BS,vS;LK0.exports=p3});var FK0=O((zC1,OK0)=>{function VI1($,I,U,Y,J){for(var Q=0;Q<J;++Q)U[Q+Y]=$[Q+I],$[Q+I]=void 0}function H7($){this._capacity=$,this._length=0,this._front=0}H7.prototype._willBeOverCapacity=function($){return this._capacity<$};H7.prototype._pushOne=function($){var I=this.length();this._checkCapacity(I+1);var U=this._front+I&this._capacity-1;this[U]=$,this._length=I+1};H7.prototype.push=function($,I,U){var Y=this.length()+3;if(this._willBeOverCapacity(Y)){this._pushOne($),this._pushOne(I),this._pushOne(U);return}var J=this._front+Y-3;this._checkCapacity(Y);var Q=this._capacity-1;this[J+0&Q]=$,this[J+1&Q]=I,this[J+2&Q]=U,this._length=Y};H7.prototype.shift=function(){var $=this._front,I=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,I};H7.prototype.length=function(){return this._length};H7.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};H7.prototype._resizeTo=function($){var I=this._capacity;this._capacity=$;var U=this._front,Y=this._length,J=U+Y&I-1;VI1(this,0,this,I,J)};OK0.exports=H7});var BK0=O((XC1,RS)=>{var TK0;try{throw Error()}catch($){TK0=$}var ZI1=DK0(),NK0=FK0(),EK0=p1();function c4(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new NK0(16),this._normalQueue=new NK0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=ZI1}c4.prototype.setScheduler=function($){var I=this._schedule;return this._schedule=$,this._customScheduler=!0,I};c4.prototype.hasCustomScheduler=function(){return this._customScheduler};c4.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};c4.prototype.disableTrampolineIfNecessary=function(){if(EK0.hasDevTools)this._trampolineEnabled=!1};c4.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};c4.prototype.fatalError=function($,I){if(I)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};c4.prototype.throwLater=function($,I){if(arguments.length===1)I=$,$=function(){throw I};if(typeof setTimeout<"u")setTimeout(function(){$(I)},0);else try{this._schedule(function(){$(I)})}catch(U){throw Error(`No async scheduler available
See http://goo.gl/MqrFmX
`)}};function E20($,I,U){this._lateQueue.push($,I,U),this._queueTick()}function B20($,I,U){this._normalQueue.push($,I,U),this._queueTick()}function R20($){this._normalQueue._pushOne($),this._queueTick()}if(!v20.hasDevTools)n4.prototype.invokeLater=E20,n4.prototype.invoke=B20,n4.prototype.settlePromises=R20;else n4.prototype.invokeLater=function($,I,U){if(this._trampolineEnabled)E20.call(this,$,I,U);else this._schedule(function(){setTimeout(function(){$.call(I,U)},100)})},n4.prototype.invoke=function($,I,U){if(this._trampolineEnabled)B20.call(this,$,I,U);else this._schedule(function(){$.call(I,U)})},n4.prototype.settlePromises=function($){if(this._trampolineEnabled)R20.call(this,$);else this._schedule(function(){$._settlePromises()})};n4.prototype._drainQueue=function($){while($.length()>0){var I=$.shift();if(typeof I!=="function"){I._settlePromises();continue}var U=$.shift(),Y=$.shift();I.call(U,Y)}};n4.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};n4.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};n4.prototype._reset=function(){this._isTickUsed=!1};Ug.exports=n4;Ug.exports.firstLineError=C20});var v5=N((xR1,g20)=>{var Qg=g3(),J31=Qg.freeze,_20=b1(),S20=_20.inherits,mY=_20.notEnumerableProp;function lY($,I){function U(Y){if(!(this instanceof U))return new U(Y);if(mY(this,"message",typeof Y==="string"?Y:I),mY(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return S20(U,Error),U}var Yg,Jg,Q31=lY("Warning","warning"),K31=lY("CancellationError","cancellation error"),q31=lY("TimeoutError","timeout error"),Wq=lY("AggregateError","aggregate error");try{Yg=TypeError,Jg=RangeError}catch($){Yg=lY("TypeError","type error"),Jg=lY("RangeError","range error")}var ED="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(h3=0;h3<ED.length;++h3)if(typeof Array.prototype[ED[h3]]==="function")Wq.prototype[ED[h3]]=Array.prototype[ED[h3]];var h3;Qg.defineProperty(Wq.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});Wq.prototype.isOperational=!0;var BD=0;Wq.prototype.toString=function(){var $=Array(BD*4+1).join(" "),I=`
`)}};function MK0($,I,U){this._lateQueue.push($,I,U),this._queueTick()}function AK0($,I,U){this._normalQueue.push($,I,U),this._queueTick()}function PK0($){this._normalQueue._pushOne($),this._queueTick()}if(!EK0.hasDevTools)c4.prototype.invokeLater=MK0,c4.prototype.invoke=AK0,c4.prototype.settlePromises=PK0;else c4.prototype.invokeLater=function($,I,U){if(this._trampolineEnabled)MK0.call(this,$,I,U);else this._schedule(function(){setTimeout(function(){$.call(I,U)},100)})},c4.prototype.invoke=function($,I,U){if(this._trampolineEnabled)AK0.call(this,$,I,U);else this._schedule(function(){$.call(I,U)})},c4.prototype.settlePromises=function($){if(this._trampolineEnabled)PK0.call(this,$);else this._schedule(function(){$._settlePromises()})};c4.prototype._drainQueue=function($){while($.length()>0){var I=$.shift();if(typeof I!=="function"){I._settlePromises();continue}var U=$.shift(),Y=$.shift();I.call(U,Y)}};c4.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};c4.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};c4.prototype._reset=function(){this._isTickUsed=!1};RS.exports=c4;RS.exports.firstLineError=TK0});var u5=O((LC1,CK0)=>{var _S=n3(),zI1=_S.freeze,vK0=p1(),RK0=vK0.inherits,$J=vK0.notEnumerableProp;function IJ($,I){function U(Y){if(!(this instanceof U))return new U(Y);if($J(this,"message",typeof Y==="string"?Y:I),$J(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return RK0(U,Error),U}var CS,jS,XI1=IJ("Warning","warning"),LI1=IJ("CancellationError","cancellation error"),DI1=IJ("TimeoutError","timeout error"),Aq=IJ("AggregateError","aggregate error");try{CS=TypeError,jS=RangeError}catch($){CS=IJ("TypeError","type error"),jS=IJ("RangeError","range error")}var nX="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(c3=0;c3<nX.length;++c3)if(typeof Array.prototype[nX[c3]]==="function")Aq.prototype[nX[c3]]=Array.prototype[nX[c3]];var c3;_S.defineProperty(Aq.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});Aq.prototype.isOperational=!0;var pX=0;Aq.prototype.toString=function(){var $=Array(pX*4+1).join(" "),I=`
`+$+`AggregateError of:
`;BD++,$=Array(BD*4+1).join(" ");for(var U=0;U<this.length;++U){var Y=this[U]===this?"[Circular AggregateError]":this[U]+"",J=Y.split(`
`;pX++,$=Array(pX*4+1).join(" ");for(var U=0;U<this.length;++U){var Y=this[U]===this?"[Circular AggregateError]":this[U]+"",J=Y.split(`
`);for(var Q=0;Q<J.length;++Q)J[Q]=$+J[Q];Y=J.join(`
`),I+=Y+`
`}return BD--,I};function Hq($){if(!(this instanceof Hq))return new Hq($);if(mY(this,"name","OperationalError"),mY(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)mY(this,"message",$.message),mY(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}S20(Hq,Error);var x3=Error.__BluebirdErrorTypes__;if(!x3)x3=J31({CancellationError:K31,TimeoutError:q31,OperationalError:Hq,RejectionError:Hq,AggregateError:Wq}),Qg.defineProperty(Error,"__BluebirdErrorTypes__",{value:x3,writable:!1,enumerable:!1,configurable:!1});g20.exports={Error,TypeError:Yg,RangeError:Jg,CancellationError:x3.CancellationError,OperationalError:x3.OperationalError,TimeoutError:x3.TimeoutError,AggregateError:x3.AggregateError,Warning:Q31}});var h20=N((kR1,y20)=>{y20.exports=function($,I){var U=b1(),Y=U.errorObj,J=U.isObject;function Q(V,X){if(J(V)){if(V instanceof $)return V;var Z=q(V);if(Z===Y){if(X)X._pushContext();var D=$.reject(Z.e);if(X)X._popContext();return D}else if(typeof Z==="function"){if(H(V)){var D=new $(I);return V._then(D._fulfill,D._reject,void 0,D,null),D}return W(V,Z,X)}}return V}function K(V){return V.then}function q(V){try{return K(V)}catch(X){return Y.e=X,Y}}var G={}.hasOwnProperty;function H(V){try{return G.call(V,"_promise0")}catch(X){return!1}}function W(V,X,Z){var D=new $(I),w=D;if(Z)Z._pushContext();if(D._captureStackTrace(),Z)Z._popContext();var O=!0,F=U.tryCatch(X).call(V,E,A);if(O=!1,D&&F===Y)D._rejectCallback(F.e,!0,!0),D=null;function E(T){if(!D)return;D._resolveCallback(T),D=null}function A(T){if(!D)return;D._rejectCallback(T,O,!0),D=null}return w}return Q}});var k20=N((uR1,x20)=>{x20.exports=function($,I,U,Y,J){var Q=b1(),K=Q.isArray;function q(H){switch(H){case-2:return[];case-3:return{}}}function G(H){var W=this._promise=new $(I);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 Q.inherits(G,J),G.prototype.length=function(){return this._length},G.prototype.promise=function(){return this._promise},G.prototype._init=function H(W,V){var X=U(this._values,this._promise);if(X instanceof $){X=X._target();var Z=X._bitField;if(this._values=X,(Z&50397184)===0)return this._promise._setAsyncGuaranteed(),X._then(H,this._reject,void 0,this,V);else if((Z&33554432)!==0)X=X._value();else if((Z&16777216)!==0)return this._reject(X._reason());else return this._cancel()}if(X=Q.asArray(X),X===null){var D=Y("expecting an array or an iterable object but got "+Q.classString(X)).reason();this._promise._rejectCallback(D,!1);return}if(X.length===0){if(V===-5)this._resolveEmptyArray();else this._resolve(q(V));return}this._iterate(X)},G.prototype._iterate=function(H){var W=this.getActualLength(H.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var V=this._promise,X=!1,Z=null;for(var D=0;D<W;++D){var w=U(H[D],V);if(w instanceof $)w=w._target(),Z=w._bitField;else Z=null;if(X){if(Z!==null)w.suppressUnhandledRejections()}else if(Z!==null)if((Z&50397184)===0)w._proxy(this,D),this._values[D]=w;else if((Z&33554432)!==0)X=this._promiseFulfilled(w._value(),D);else if((Z&16777216)!==0)X=this._promiseRejected(w._reason(),D);else X=this._promiseCancelled(D);else X=this._promiseFulfilled(w,D)}if(!X)V._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 V=++this._totalResolved;if(V>=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 f20=N((fR1,u20)=>{u20.exports=function($){var I=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Y(){this._trace=new Y.CapturedTrace(Q())}Y.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Y.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),q=K._promiseCreated;return K._promiseCreated=null,q}return null};function J(){if(I)return new Y}function Q(){var K=U.length-1;if(K>=0)return U[K];return}return Y.CapturedTrace=null,Y.create=J,Y.deactivateLong Line truncated
`}return pX--,I};function Mq($){if(!(this instanceof Mq))return new Mq($);if($J(this,"name","OperationalError"),$J(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)$J(this,"message",$.message),$J(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}RK0(Mq,Error);var d3=Error.__BluebirdErrorTypes__;if(!d3)d3=zI1({CancellationError:LI1,TimeoutError:DI1,OperationalError:Mq,RejectionError:Mq,AggregateError:Aq}),_S.defineProperty(Error,"__BluebirdErrorTypes__",{value:d3,writable:!1,enumerable:!1,configurable:!1});CK0.exports={Error,TypeError:CS,RangeError:jS,CancellationError:d3.CancellationError,OperationalError:d3.OperationalError,TimeoutError:d3.TimeoutError,AggregateError:d3.AggregateError,Warning:XI1}});var _K0=O((DC1,jK0)=>{jK0.exports=function($,I){var U=p1(),Y=U.errorObj,J=U.isObject;function Q(w,V){if(J(w)){if(w instanceof $)return w;var Z=q(w);if(Z===Y){if(V)V._pushContext();var X=$.reject(Z.e);if(V)V._popContext();return X}else if(typeof Z==="function"){if(G(w)){var X=new $(I);return w._then(X._fulfill,X._reject,void 0,X,null),X}return W(w,Z,V)}}return w}function K(w){return w.then}function q(w){try{return K(w)}catch(V){return Y.e=V,Y}}var H={}.hasOwnProperty;function G(w){try{return H.call(w,"_promise0")}catch(V){return!1}}function W(w,V,Z){var X=new $(I),L=X;if(Z)Z._pushContext();if(X._captureStackTrace(),Z)Z._popContext();var D=!0,F=U.tryCatch(V).call(w,E,T);if(D=!1,X&&F===Y)X._rejectCallback(F.e,!0,!0),X=null;function E(A){if(!X)return;X._resolveCallback(A),X=null}function T(A){if(!X)return;X._rejectCallback(A,D,!0),X=null}return L}return Q}});var SK0=O((OC1,gK0)=>{gK0.exports=function($,I,U,Y,J){var Q=p1(),K=Q.isArray;function q(G){switch(G){case-2:return[];case-3:return{}}}function H(G){var W=this._promise=new $(I);if(G instanceof $)W._propagateFrom(G,3);W._setOnCancel(this),this._values=G,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return Q.inherits(H,J),H.prototype.length=function(){return this._length},H.prototype.promise=function(){return this._promise},H.prototype._init=function G(W,w){var V=U(this._values,this._promise);if(V instanceof $){V=V._target();var Z=V._bitField;if(this._values=V,(Z&50397184)===0)return this._promise._setAsyncGuaranteed(),V._then(G,this._reject,void 0,this,w);else if((Z&33554432)!==0)V=V._value();else if((Z&16777216)!==0)return this._reject(V._reason());else return this._cancel()}if(V=Q.asArray(V),V===null){var X=Y("expecting an array or an iterable object but got "+Q.classString(V)).reason();this._promise._rejectCallback(X,!1);return}if(V.length===0){if(w===-5)this._resolveEmptyArray();else this._resolve(q(w));return}this._iterate(V)},H.prototype._iterate=function(G){var W=this.getActualLength(G.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var w=this._promise,V=!1,Z=null;for(var X=0;X<W;++X){var L=U(G[X],w);if(L instanceof $)L=L._target(),Z=L._bitField;else Z=null;if(V){if(Z!==null)L.suppressUnhandledRejections()}else if(Z!==null)if((Z&50397184)===0)L._proxy(this,X),this._values[X]=L;else if((Z&33554432)!==0)V=this._promiseFulfilled(L._value(),X);else if((Z&16777216)!==0)V=this._promiseRejected(L._reason(),X);else V=this._promiseCancelled(X);else V=this._promiseFulfilled(L,X)}if(!V)w._setAsyncGuaranteed()},H.prototype._isResolved=function(){return this._values===null},H.prototype._resolve=function(G){this._values=null,this._promise._fulfill(G)},H.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},H.prototype._reject=function(G){this._values=null,this._promise._rejectCallback(G,!1)},H.prototype._promiseFulfilled=function(G,W){this._values[W]=G;var w=++this._totalResolved;if(w>=this._length)return this._resolve(this._values),!0;return!1},H.prototype._promiseCancelled=function(){return this._cancel(),!0},H.prototype._promiseRejected=function(G){return this._totalResolved++,this._reject(G),!0},H.prototype._resultCancelled=function(){if(this._isResolved())return;var G=this._values;if(this._cancel(),G instanceof $)G.cancel();else for(var W=0;W<G.length;++W)if(G[W]instanceof $)G[W].cancel()},H.prototype.shouldCopyValues=function(){return!0},H.prototype.getActualLength=function(G){return G},H}});var hK0=O((FC1,yK0)=>{yK0.exports=function($){var I=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Y(){this._trace=new Y.CapturedTrace(Q())}Y.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Y.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),q=K._promiseCreated;return K._promiseCreated=null,q}return null};function J(){if(I)return new Y}function Q(){var K=U.length-1;if(K>=0)return U[K];return}return Y.CapturedTrace=null,Y.create=J,Y.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!T0.longStackTraces&&x$()){var a=$.prototype._captureStackTrace,M=$.prototype._attachExtraTrace;T0.longStackTraces=!0,T=function(){if(Y.haveItemsQueued()&&!T0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
`);if(!E0.longStackTraces&&i$()){var a=$.prototype._captureStackTrace,N=$.prototype._attachExtraTrace;E0.longStackTraces=!0,A=function(){if(Y.haveItemsQueued()&&!E0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
See http://goo.gl/MqrFmX
`);$.prototype._captureStackTrace=a,$.prototype._attachExtraTrace=M,I.deactivateLongStackTraces(),Y.enableTrampoline(),T0.longStackTraces=!1},$.prototype._captureStackTrace=K0,$.prototype._attachExtraTrace=W0,I.activateLongStackTraces(),Y.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return T0.longStackTraces&&x$()};var C=function(){try{if(typeof CustomEvent==="function"){var a=new CustomEvent("CustomEvent");return Q.global.dispatchEvent(a),function(M,z){var j=new CustomEvent(M.toLowerCase(),{detail:z,cancelable:!0});return!Q.global.dispatchEvent(j)}}else if(typeof Event==="function"){var a=new Event("CustomEvent");return Q.global.dispatchEvent(a),function(z,j){var x=new Event(z.toLowerCase(),{cancelable:!0});return x.detail=j,!Q.global.dispatchEvent(x)}}else{var a=document.createEvent("CustomEvent");return a.initCustomEvent("testingtheevent",!1,!0,{}),Q.global.dispatchEvent(a),function(z,j){var x=document.createEvent("CustomEvent");return x.initCustomEvent(z.toLowerCase(),!1,!0,j),!Q.global.dispatchEvent(x)}}}catch(M){}return function(){return!1}}(),u=function(){if(Q.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!Q.global)return function(){return!1};return function(a){var M="on"+a.toLowerCase(),z=Q.global[M];if(!z)return!1;return z.apply(Q.global,[].slice.call(arguments,1)),!0}}}();function g(a,M){return{promise:M}}var b={promiseCreated:g,promiseFulfilled:g,promiseRejected:g,promiseResolved:g,promiseCancelled:g,promiseChained:function(a,M,z){return{promise:M,child:z}},warning:function(a,M){return{warning:M}},unhandledRejection:function(a,M,z){return{reason:M,promise:z}},rejectionHandled:g},v=function(a){var M=!1;try{M=u.apply(null,arguments)}catch(j){Y.throwLater(j),M=!0}var z=!1;try{z=C(a,b[a].apply(null,arguments))}catch(j){Y.throwLater(j),z=!0}return z||M};$.config=function(a){if(a=Object(a),"longStackTraces"in a){if(a.longStackTraces)$.longStackTraces();else if(!a.longStackTraces&&$.hasLongStackTraces())T()}if("warnings"in a){var M=a.warnings;if(T0.warnings=!!M,A=T0.warnings,Q.isObject(M)){if("wForgottenReturn"in M)A=!!M.wForgottenReturn}}if("cancellation"in a&&a.cancellation&&!T0.cancellation){if(Y.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=Y0,$.prototype._propagateFrom=B,$.prototype._onCancel=f,$.prototype._setOnCancel=i,$.prototype._attachCancellationCallback=S,$.prototype._execute=p,d=B,T0.cancellation=!0}if("monitoring"in a){if(a.monitoring&&!T0.monitoring)T0.monitoring=!0,$.prototype._fireEvent=v;else if(!a.monitoring&&T0.monitoring)T0.monitoring=!1,$.prototype._fireEvent=n}return $};function n(){return!1}$.prototype._fireEvent=n,$.prototype._execute=function(a,M,z){try{a(M,z)}catch(j){return j}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(a){},$.prototype._attachCancellationCallback=function(a){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(a,M){};function p(a,M,z){var j=this;try{a(M,z,function(x){if(typeof x!=="function")throw TypeError("onCancel must be a function, got: "+Q.toString(x));j._attachCancellationCallback(x)})}catch(x){return x}}function S(a){if(!this._isCancellable())return this;var M=this._onCancel();if(M!==void 0)if(Q.isArray(M))M.push(a);else this._setOnCancel([M,a]);else this._setOnCancel(a)}function f(){return this._onCancelField}function i(a){this._onCancelField=a}function Y0(){this._cancellationParent=void 0,this._onCancelField=void 0}function B(a,M){if((M&1)!==0){this._cancellationParent=a;var z=a._branchesRemainingToCancel;if(z===void 0)z=0;a._branchesRemainingToCancel=z+1}if((M&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}function k(a,M){if((M&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}var d=k;function t(){var a=this._boundTo;if(a!==void 0){if(a instanceof $)if(a.isFulfilled())return a.value();else return}return a}function K0(){this._trace=new s6(this._peekContext())}function W0(a,M){if(K(a)){var z=this._trace;if(z!==void 0){if(M)z=z._parent}if(z!==void 0)z.attachExtraTrace(a);else if(!a.__stackCleaned__){var j=Q4(a);Q.notEnumerableProp(a,"stack",j.message+`
`);$.prototype._captureStackTrace=a,$.prototype._attachExtraTrace=N,I.deactivateLongStackTraces(),Y.enableTrampoline(),E0.longStackTraces=!1},$.prototype._captureStackTrace=K0,$.prototype._attachExtraTrace=W0,I.activateLongStackTraces(),Y.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return E0.longStackTraces&&i$()};var R=function(){try{if(typeof CustomEvent==="function"){var a=new CustomEvent("CustomEvent");return Q.global.dispatchEvent(a),function(N,M){var j=new CustomEvent(N.toLowerCase(),{detail:M,cancelable:!0});return!Q.global.dispatchEvent(j)}}else if(typeof Event==="function"){var a=new Event("CustomEvent");return Q.global.dispatchEvent(a),function(M,j){var u=new Event(M.toLowerCase(),{cancelable:!0});return u.detail=j,!Q.global.dispatchEvent(u)}}else{var a=document.createEvent("CustomEvent");return a.initCustomEvent("testingtheevent",!1,!0,{}),Q.global.dispatchEvent(a),function(M,j){var u=document.createEvent("CustomEvent");return u.initCustomEvent(M.toLowerCase(),!1,!0,j),!Q.global.dispatchEvent(u)}}}catch(N){}return function(){return!1}}(),k=function(){if(Q.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!Q.global)return function(){return!1};return function(a){var N="on"+a.toLowerCase(),M=Q.global[N];if(!M)return!1;return M.apply(Q.global,[].slice.call(arguments,1)),!0}}}();function S(a,N){return{promise:N}}var i={promiseCreated:S,promiseFulfilled:S,promiseRejected:S,promiseResolved:S,promiseCancelled:S,promiseChained:function(a,N,M){return{promise:N,child:M}},warning:function(a,N){return{warning:N}},unhandledRejection:function(a,N,M){return{reason:N,promise:M}},rejectionHandled:S},C=function(a){var N=!1;try{N=k.apply(null,arguments)}catch(j){Y.throwLater(j),N=!0}var M=!1;try{M=R(a,i[a].apply(null,arguments))}catch(j){Y.throwLater(j),M=!0}return M||N};$.config=function(a){if(a=Object(a),"longStackTraces"in a){if(a.longStackTraces)$.longStackTraces();else if(!a.longStackTraces&&$.hasLongStackTraces())A()}if("warnings"in a){var N=a.warnings;if(E0.warnings=!!N,T=E0.warnings,Q.isObject(N)){if("wForgottenReturn"in N)T=!!N.wForgottenReturn}}if("cancellation"in a&&a.cancellation&&!E0.cancellation){if(Y.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=Y0,$.prototype._propagateFrom=B,$.prototype._onCancel=f,$.prototype._setOnCancel=b,$.prototype._attachCancellationCallback=g,$.prototype._execute=n,d=B,E0.cancellation=!0}if("monitoring"in a){if(a.monitoring&&!E0.monitoring)E0.monitoring=!0,$.prototype._fireEvent=C;else if(!a.monitoring&&E0.monitoring)E0.monitoring=!1,$.prototype._fireEvent=p}return $};function p(){return!1}$.prototype._fireEvent=p,$.prototype._execute=function(a,N,M){try{a(N,M)}catch(j){return j}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(a){},$.prototype._attachCancellationCallback=function(a){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(a,N){};function n(a,N,M){var j=this;try{a(N,M,function(u){if(typeof u!=="function")throw TypeError("onCancel must be a function, got: "+Q.toString(u));j._attachCancellationCallback(u)})}catch(u){return u}}function g(a){if(!this._isCancellable())return this;var N=this._onCancel();if(N!==void 0)if(Q.isArray(N))N.push(a);else this._setOnCancel([N,a]);else this._setOnCancel(a)}function f(){return this._onCancelField}function b(a){this._onCancelField=a}function Y0(){this._cancellationParent=void 0,this._onCancelField=void 0}function B(a,N){if((N&1)!==0){this._cancellationParent=a;var M=a._branchesRemainingToCancel;if(M===void 0)M=0;a._branchesRemainingToCancel=M+1}if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}function x(a,N){if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}var d=x;function t(){var a=this._boundTo;if(a!==void 0){if(a instanceof $)if(a.isFulfilled())return a.value();else return}return a}function K0(){this._trace=new $$(this._peekContext())}function W0(a,N){if(K(a)){var M=this._trace;if(M!==void 0){if(N)M=M._parent}if(M!==void 0)M.attachExtraTrace(a);else if(!a.__stackCleaned__){var j=q4(a);Q.notEnumerableProp(a,"stack",j.message+`
`+j.stack.join(`
`)),Q.notEnumerableProp(a,"__stackCleaned__",!0)}}}function z0(a,M,z,j,x){if(a===void 0&&M!==null&&A){if(x!==void 0&&x._returnedNonUndefined())return;if((j._bitField&65535)===0)return;if(z)z=z+" ";var s="",m="";if(M._trace){var e=M._trace.stack.split(`
`),J0=g0(e);for(var H0=J0.length-1;H0>=0;--H0){var C0=J0[H0];if(!W.test(C0)){var b0=C0.match(V);if(b0)s="at "+b0[1]+":"+b0[2]+":"+b0[3]+" ";break}}if(J0.length>0){var k0=J0[0];for(var H0=0;H0<e.length;++H0)if(e[H0]===k0){if(H0>0)m=`
`+e[H0-1];break}}}var J1="a promise was created in a "+z+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(J1,!0,M)}}function B0(a,M){var z=a+" is deprecated and will be removed in a future version.";if(M)z+=" Use "+M+" instead.";return D1(z)}function D1(a,M,z){if(!T0.warnings)return;var j=new J(a),x;if(M)z._attachExtraTrace(j);else if(T0.longStackTraces&&(x=$._peekContext()))x.attachExtraTrace(j);else{var s=Q4(j);j.stack=s.message+`
`)),Q.notEnumerableProp(a,"__stackCleaned__",!0)}}}function A0(a,N,M,j,u){if(a===void 0&&N!==null&&T){if(u!==void 0&&u._returnedNonUndefined())return;if((j._bitField&65535)===0)return;if(M)M=M+" ";var s="",m="";if(N._trace){var e=N._trace.stack.split(`
`),J0=S0(e);for(var G0=J0.length-1;G0>=0;--G0){var C0=J0[G0];if(!W.test(C0)){var i0=C0.match(w);if(i0)s="at "+i0[1]+":"+i0[2]+":"+i0[3]+" ";break}}if(J0.length>0){var x0=J0[0];for(var G0=0;G0<e.length;++G0)if(e[G0]===x0){if(G0>0)m=`
`+e[G0-1];break}}}var Q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(Q1,!0,N)}}function v0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return L1(M)}function L1(a,N,M){if(!E0.warnings)return;var j=new J(a),u;if(N)M._attachExtraTrace(j);else if(E0.longStackTraces&&(u=$._peekContext()))u.attachExtraTrace(j);else{var s=q4(j);j.stack=s.message+`
`+s.stack.join(`
`)}if(!v("warning",j))j4(j,"",!0)}function f0(a,M){for(var z=0;z<M.length-1;++z)M[z].push("From previous event:"),M[z]=M[z].join(`
`);if(z<M.length)M[z]=M[z].join(`
`)}if(!C("warning",j))_4(j,"",!0)}function f0(a,N){for(var M=0;M<N.length-1;++M)N[M].push("From previous event:"),N[M]=N[M].join(`
`);if(M<N.length)N[M]=N[M].join(`
`);return a+`
`+M.join(`
`)}function G1(a){for(var M=0;M<a.length;++M)if(a[M].length===0||M+1<a.length&&a[M][0]===a[M+1][0])a.splice(M,1),M--}function N0(a){var M=a[0];for(var z=1;z<a.length;++z){var j=a[z],x=M.length-1,s=M[x],m=-1;for(var e=j.length-1;e>=0;--e)if(j[e]===s){m=e;break}for(var e=m;e>=0;--e){var J0=j[e];if(M[x]===J0)M.pop(),x--;else break}M=j}}function g0(a){var M=[];for(var z=0;z<a.length;++z){var j=a[z],x=j===" (No stack trace)"||X.test(j),s=x&&V$(j);if(x&&!s){if(D&&j.charAt(0)!==" ")j=" "+j;M.push(j)}}return M}function d0(a){var M=a.stack.replace(/\s+$/g,"").split(`
`);for(var z=0;z<M.length;++z){var j=M[z];if(j===" (No stack trace)"||X.test(j))break}if(z>0&&a.name!="SyntaxError")M=M.slice(z);return M}function Q4(a){var M=a.stack,z=a.toString();return M=typeof M==="string"&&M.length>0?d0(a):[" (No stack trace)"],{message:z,stack:a.name=="SyntaxError"?M:g0(M)}}function j4(a,M,z){if(typeof console<"u"){var j;if(Q.isObject(a)){var x=a.stack;j=M+Z(x,a)}else j=M+String(a);if(typeof w==="function")w(j,z);else if(typeof console.log==="function"||typeof console.log==="object")console.log(j)}}function W$(a,M,z,j){var x=!1;try{if(typeof M==="function")if(x=!0,a==="rejectionHandled")M(j);else M(z,j)}catch(s){Y.throwLater(s)}if(a==="unhandledRejection"){if(!v(a,z,j)&&!x)j4(z,"Unhandled rejection ")}else v(a,j)}function h$(a){var M;if(typeof a==="function")M="[function "+(a.name||"anonymous")+"]";else{M=a&&typeof a.toString==="function"?a.toString():Q.toString(a);var z=/\[object [a-zA-Z0-9$_]+\]/;if(z.test(M))try{var j=JSON.stringify(a);M=j}catch(x){}if(M.length===0)M="(empty array)"}return"(<"+c8(M)+">, no stack trace)"}function c8(a){var M=41;if(a.length<M)return a;return a.substr(0,M-3)+"..."}function x$(){return typeof n5==="function"}var V$=function(){return!1},d8=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function a6(a){var M=a.match(d8);if(M)return{fileName:M[1],line:parseInt(M[2],10)}}function L7(a,M){if(!x$())return;var z=a.stack.split(`
`),j=M.stack.split(`
`),x=-1,s=-1,m,e;for(var J0=0;J0<z.length;++J0){var H0=a6(z[J0]);if(H0){m=H0.fileName,x=H0.line;break}}for(var J0=0;J0<j.length;++J0){var H0=a6(j[J0]);if(H0){e=H0.fileName,s=H0.line;break}}if(x<0||s<0||!m||!e||m!==e||x>=s)return;V$=function(C0){if(H.test(C0))return!0;var b0=a6(C0);if(b0){if(b0.fileName===m&&(x<=b0.line&&b0.line<=s))return!0}return!1}}function s6(a){this._parent=a,this._promisesCreated=0;var M=this._length=1+(a===void 0?0:a._length);if(n5(this,s6),M>32)this.uncycle()}Q.inherits(s6,Error),I.CapturedTrace=s6,s6.prototype.uncycle=function(){var a=this._length;if(a<2)return;var M=[],z={};for(var j=0,x=this;x!==void 0;++j)M.push(x),x=x._parent;a=this._length=j;for(var j=a-1;j>=0;--j){var s=M[j].stack;if(z[s]===void 0)z[s]=j}for(var j=0;j<a;++j){var m=M[j].stack,e=z[m];if(e!==void 0&&e!==j){if(e>0)M[e-1]._parent=void 0,M[e-1]._length=1;M[j]._parent=void 0,M[j]._length=1;var J0=j>0?M[j-1]:this;if(e<a-1)J0._parent=M[e+1],J0._parent.uncycle(),J0._length=J0._parent._length+1;else J0._parent=void 0,J0._length=1;var H0=J0._length+1;for(var C0=j-2;C0>=0;--C0)M[C0]._length=H0,H0++;return}}},s6.prototype.attachExtraTrace=function(a){if(a.__stackCleaned__)return;this.uncycle();var M=Q4(a),z=M.message,j=[M.stack],x=this;while(x!==void 0)j.push(g0(x.stack.split(`
`))),x=x._parent;N0(j),G1(j),Q.notEnumerableProp(a,"stack",f0(z,j)),Q.notEnumerableProp(a,"__stackCleaned__",!0)};var n5=function(){var M=/^\s*at\s*/,z=function(m,e){if(typeof m==="string")return m;if(e.name!==void 0&&e.message!==void 0)return e.toString();return h$(e)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,X=M,Z=z;var j=Error.captureStackTrace;return V$=function(m){return H.test(m)},function(m,e){Error.stackTraceLimit+=6,j(m,e),Error.stackTraceLimit-=6}}var x=Error();if(typeof x.stack==="string"&&x.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return X=/@/,Z=z,D=!0,function(e){e.stack=Error().stack};var s;try{throw Error()}catch(m){s="stack"in m}if(!("stack"in x)&&s&&typeof Error.stackTraceLimit==="number")return X=M,Z=z,function(e){Error.stackTraceLimit+=6;try{throw Error()}catch(J0){e.stack=J0.stack}Error.stackTraceLimit-=6};return Z=function(m,e){if(typeof m==="string")return m;if((typeof e==="object"||typeof e==="function")&&e.name!==void 0&&e.message!==void 0)return e.toString();return h$(e)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(w=function(a){console.warn(a)},Q.isNode&&process.stderr.isTTY)w=function(a,M){var z=M?"\x1B[33m":"\x1B[31m";console.warn(z+a+`\x1B[0m
`)};else if(!Q.isNode&&typeof Error().stack==="string")w=function(a,M){console.warn("%c"+a,M?"color: darkorange":"color: red")}}var T0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(E)$.longStackTraces();return{longStackTraces:function(){return T0.longStackTraces},warnings:function(){return T0.warnings},cancellation:function(){return T0.cancellation},monitoring:function(){return T0.monitoring},propagateFromFunction:function(){return d},boundValueFunction:function(){return t},checkForgottenReturns:z0,setBounds:L7,warn:D1,deprecated:B0,CapturedTrace:s6,fireDomEvent:C,fireGlobalEvent:u}}});var n20=N((iR1,p20)=>{p20.exports=function($,I){var U=b1(),Y=$.CancellationError,J=U.errorObj;function Q(V,X,Z){this.promise=V,this.type=X,this.handler=Z,this.called=!1,this.cancelPromise=null}Q.prototype.isFinallyHandler=function(){return this.type===0};function K(V){this.finallyHandler=V}K.prototype._resultCancelled=function(){q(this.finallyHandler)};function q(V,X){if(V.cancelPromise!=null){if(arguments.length>1)V.cancelPromise._reject(X);else V.cancelPromise._cancel();return V.cancelPromise=null,!0}return!1}function G(){return W.call(this,this.promise._target()._settledValue())}function H(V){if(q(this,V))return;return J.e=V,J}function W(V){var X=this.promise,Z=this.handler;if(!this.called){this.called=!0;var D=this.isFinallyHandler()?Z.call(X._boundValue()):Z.call(X._boundValue(),V);if(D!==void 0){X._setReturnedNonUndefined();var w=I(D,X);if(w instanceof $){if(this.cancelPromise!=null){if(w._isCancelled()){var O=new Y("late cancellation observer");return X._attachExtraTrace(O),J.e=O,J}else if(w.isPending())w._attachCancellationCallback(new K(this))}return w._then(G,H,void 0,this,void 0)}}}if(X.isRejected())return q(this),J.e=V,J;else return q(this),V}return $.prototype._passThrough=function(V,X,Z,D){if(typeof V!=="function")return this.then();return this._then(Z,D,void 0,new Q(this,X,V),void 0)},$.prototype.lastly=$.prototype.finally=function(V){return this._passThrough(V,0,W,W)},$.prototype.tap=function(V){return this._passThrough(V,1,W)},Q}});var d20=N((pR1,c20)=>{c20.exports=function($){var I=b1(),U=g3().keys,Y=I.tryCatch,J=I.errorObj;function Q(K,q,G){return function(H){var W=G._boundValue();$:for(var V=0;V<K.length;++V){var X=K[V];if(X===Error||X!=null&&X.prototype instanceof Error){if(H instanceof X)return Y(q).call(W,H)}else if(typeof X==="function"){var Z=Y(X).call(W,H);if(Z===J)return Z;else if(Z)return Y(q).call(W,H)}else if(I.isObject(H)){var D=U(X);for(var w=0;w<D.length;++w){var O=D[w];if(X[O]!=H[O])continue $}return Y(q).call(W,H)}}return $}}return Q}});var Kg=N((nR1,o20)=>{var m20=b1(),G31=m20.maybeWrapAsError,H31=v5(),W31=H31.OperationalError,l20=g3();function V31($){return $ instanceof Error&&l20.getPrototypeOf($)===Error.prototype}var Z31=/^(?:name|message|stack|cause)$/;function X31($){var I;if(V31($)){I=new W31($),I.name=$.name,I.message=$.message,I.stack=$.stack;var U=l20.keys($);for(var Y=0;Y<U.length;++Y){var J=U[Y];if(!Z31.test(J))I[J]=$[J]}return I}return m20.markAsOriginatingFromRejection($),$}function L31($,I){return function(U,Y){if($===null)return;if(U){var J=X31(G31(U));$._attachExtraTrace(J),$._reject(J)}else if(!I)$._fulfill(Y);else{var Q=arguments.length,K=Array(Math.max(Q-1,0));for(var q=1;q<Q;++q)K[q-1]=arguments[q];$._fulfill(K)}$=null}}o20.exports=L31});var t20=N((cR1,r20)=>{r20.exports=function($,I,U,Y,J){var Q=b1(),K=Q.tryCatch;$.method=function(q){if(typeof q!=="function")throw new $.TypeError("expecting a function but got "+Q.classString(q));return function(){var G=new $(I);G._captureStackTrace(),G._pushContext();var H=K(q).apply(this,arguments),W=G._popContext();return J.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(q){if(typeof q!=="function")return Y("expecting a function but got "+Q.classString(q));var G=new $(I);G._captureStackTrace(),G._pushContext();var H;if(arguments.length>1){J.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],V=arguments[2];H=Q.isArray(W)?K(q).apply(V,W):K(q).call(V,W)}else H=K(q)();var X=G._popContext();return J.checkForgottenReturns(H,X,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(q){if(q===Q.errorObj)this._rejectCallback(q.e,!1);else this._resolveCallback(q,!0)}}});var s20=N((dR1,a20)=>{a20.exports=function($,I,U,Y){var J=!1,Q=function(H,W){this._reject(W)},K=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(Q,Q,null,this,H)},q=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(!J)J=!0,$.prototype._propagateFrom=Y.propagateFromFunction(),$.prototype._boundValue=Y.boundValueFunction();var W=U(H),V=new $(I);V._propagateFrom(this,1);var X=this._target();if(V._setBoundTo(W),W instanceof $){var Z={promiseRejectionQueued:!1,promise:V,target:X,bindingPromise:W};X._then(I,K,voi Line truncated
`+N.join(`
`)}function G1(a){for(var N=0;N<a.length;++N)if(a[N].length===0||N+1<a.length&&a[N][0]===a[N+1][0])a.splice(N,1),N--}function N0(a){var N=a[0];for(var M=1;M<a.length;++M){var j=a[M],u=N.length-1,s=N[u],m=-1;for(var e=j.length-1;e>=0;--e)if(j[e]===s){m=e;break}for(var e=m;e>=0;--e){var J0=j[e];if(N[u]===J0)N.pop(),u--;else break}N=j}}function S0(a){var N=[];for(var M=0;M<a.length;++M){var j=a[M],u=j===" (No stack trace)"||V.test(j),s=u&&X$(j);if(u&&!s){if(X&&j.charAt(0)!==" ")j=" "+j;N.push(j)}}return N}function m0(a){var N=a.stack.replace(/\s+$/g,"").split(`
`);for(var M=0;M<N.length;++M){var j=N[M];if(j===" (No stack trace)"||V.test(j))break}if(M>0&&a.name!="SyntaxError")N=N.slice(M);return N}function q4(a){var N=a.stack,M=a.toString();return N=typeof N==="string"&&N.length>0?m0(a):[" (No stack trace)"],{message:M,stack:a.name=="SyntaxError"?N:S0(N)}}function _4(a,N,M){if(typeof console<"u"){var j;if(Q.isObject(a)){var u=a.stack;j=N+Z(u,a)}else j=N+String(a);if(typeof L==="function")L(j,M);else if(typeof console.log==="function"||typeof console.log==="object")console.log(j)}}function z$(a,N,M,j){var u=!1;try{if(typeof N==="function")if(u=!0,a==="rejectionHandled")N(j);else N(M,j)}catch(s){Y.throwLater(s)}if(a==="unhandledRejection"){if(!C(a,M,j)&&!u)_4(M,"Unhandled rejection ")}else C(a,j)}function f$(a){var N;if(typeof a==="function")N="[function "+(a.name||"anonymous")+"]";else{N=a&&typeof a.toString==="function"?a.toString():Q.toString(a);var M=/\[object [a-zA-Z0-9$_]+\]/;if(M.test(N))try{var j=JSON.stringify(a);N=j}catch(u){}if(N.length===0)N="(empty array)"}return"(<"+t8(N)+">, no stack trace)"}function t8(a){var N=41;if(a.length<N)return a;return a.substr(0,N-3)+"..."}function i$(){return typeof t5==="function"}var X$=function(){return!1},a8=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function e6(a){var N=a.match(a8);if(N)return{fileName:N[1],line:parseInt(N[2],10)}}function P7(a,N){if(!i$())return;var M=a.stack.split(`
`),j=N.stack.split(`
`),u=-1,s=-1,m,e;for(var J0=0;J0<M.length;++J0){var G0=e6(M[J0]);if(G0){m=G0.fileName,u=G0.line;break}}for(var J0=0;J0<j.length;++J0){var G0=e6(j[J0]);if(G0){e=G0.fileName,s=G0.line;break}}if(u<0||s<0||!m||!e||m!==e||u>=s)return;X$=function(C0){if(G.test(C0))return!0;var i0=e6(C0);if(i0){if(i0.fileName===m&&(u<=i0.line&&i0.line<=s))return!0}return!1}}function $$(a){this._parent=a,this._promisesCreated=0;var N=this._length=1+(a===void 0?0:a._length);if(t5(this,$$),N>32)this.uncycle()}Q.inherits($$,Error),I.CapturedTrace=$$,$$.prototype.uncycle=function(){var a=this._length;if(a<2)return;var N=[],M={};for(var j=0,u=this;u!==void 0;++j)N.push(u),u=u._parent;a=this._length=j;for(var j=a-1;j>=0;--j){var s=N[j].stack;if(M[s]===void 0)M[s]=j}for(var j=0;j<a;++j){var m=N[j].stack,e=M[m];if(e!==void 0&&e!==j){if(e>0)N[e-1]._parent=void 0,N[e-1]._length=1;N[j]._parent=void 0,N[j]._length=1;var J0=j>0?N[j-1]:this;if(e<a-1)J0._parent=N[e+1],J0._parent.uncycle(),J0._length=J0._parent._length+1;else J0._parent=void 0,J0._length=1;var G0=J0._length+1;for(var C0=j-2;C0>=0;--C0)N[C0]._length=G0,G0++;return}}},$$.prototype.attachExtraTrace=function(a){if(a.__stackCleaned__)return;this.uncycle();var N=q4(a),M=N.message,j=[N.stack],u=this;while(u!==void 0)j.push(S0(u.stack.split(`
`))),u=u._parent;N0(j),G1(j),Q.notEnumerableProp(a,"stack",f0(M,j)),Q.notEnumerableProp(a,"__stackCleaned__",!0)};var t5=function(){var N=/^\s*at\s*/,M=function(m,e){if(typeof m==="string")return m;if(e.name!==void 0&&e.message!==void 0)return e.toString();return f$(e)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,V=N,Z=M;var j=Error.captureStackTrace;return X$=function(m){return G.test(m)},function(m,e){Error.stackTraceLimit+=6,j(m,e),Error.stackTraceLimit-=6}}var u=Error();if(typeof u.stack==="string"&&u.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return V=/@/,Z=M,X=!0,function(e){e.stack=Error().stack};var s;try{throw Error()}catch(m){s="stack"in m}if(!("stack"in u)&&s&&typeof Error.stackTraceLimit==="number")return V=N,Z=M,function(e){Error.stackTraceLimit+=6;try{throw Error()}catch(J0){e.stack=J0.stack}Error.stackTraceLimit-=6};return Z=function(m,e){if(typeof m==="string")return m;if((typeof e==="object"||typeof e==="function")&&e.name!==void 0&&e.message!==void 0)return e.toString();return f$(e)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(L=function(a){console.warn(a)},Q.isNode&&process.stderr.isTTY)L=function(a,N){var M=N?"\x1B[33m":"\x1B[31m";console.warn(M+a+`\x1B[0m
`)};else if(!Q.isNode&&typeof Error().stack==="string")L=function(a,N){console.warn("%c"+a,N?"color: darkorange":"color: red")}}var E0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(E)$.longStackTraces();return{longStackTraces:function(){return E0.longStackTraces},warnings:function(){return E0.warnings},cancellation:function(){return E0.cancellation},monitoring:function(){return E0.monitoring},propagateFromFunction:function(){return d},boundValueFunction:function(){return t},checkForgottenReturns:A0,setBounds:P7,warn:L1,deprecated:v0,CapturedTrace:$$,fireDomEvent:R,fireGlobalEvent:k}}});var fK0=O((MC1,kK0)=>{kK0.exports=function($,I){var U=p1(),Y=$.CancellationError,J=U.errorObj;function Q(w,V,Z){this.promise=w,this.type=V,this.handler=Z,this.called=!1,this.cancelPromise=null}Q.prototype.isFinallyHandler=function(){return this.type===0};function K(w){this.finallyHandler=w}K.prototype._resultCancelled=function(){q(this.finallyHandler)};function q(w,V){if(w.cancelPromise!=null){if(arguments.length>1)w.cancelPromise._reject(V);else w.cancelPromise._cancel();return w.cancelPromise=null,!0}return!1}function H(){return W.call(this,this.promise._target()._settledValue())}function G(w){if(q(this,w))return;return J.e=w,J}function W(w){var V=this.promise,Z=this.handler;if(!this.called){this.called=!0;var X=this.isFinallyHandler()?Z.call(V._boundValue()):Z.call(V._boundValue(),w);if(X!==void 0){V._setReturnedNonUndefined();var L=I(X,V);if(L instanceof $){if(this.cancelPromise!=null){if(L._isCancelled()){var D=new Y("late cancellation observer");return V._attachExtraTrace(D),J.e=D,J}else if(L.isPending())L._attachCancellationCallback(new K(this))}return L._then(H,G,void 0,this,void 0)}}}if(V.isRejected())return q(this),J.e=w,J;else return q(this),w}return $.prototype._passThrough=function(w,V,Z,X){if(typeof w!=="function")return this.then();return this._then(Z,X,void 0,new Q(this,V,w),void 0)},$.prototype.lastly=$.prototype.finally=function(w){return this._passThrough(w,0,W,W)},$.prototype.tap=function(w){return this._passThrough(w,1,W)},Q}});var bK0=O((AC1,iK0)=>{iK0.exports=function($){var I=p1(),U=n3().keys,Y=I.tryCatch,J=I.errorObj;function Q(K,q,H){return function(G){var W=H._boundValue();$:for(var w=0;w<K.length;++w){var V=K[w];if(V===Error||V!=null&&V.prototype instanceof Error){if(G instanceof V)return Y(q).call(W,G)}else if(typeof V==="function"){var Z=Y(V).call(W,G);if(Z===J)return Z;else if(Z)return Y(q).call(W,G)}else if(I.isObject(G)){var X=U(V);for(var L=0;L<X.length;++L){var D=X[L];if(V[D]!=G[D])continue $}return Y(q).call(W,G)}}return $}}return Q}});var gS=O((PC1,cK0)=>{var nK0=p1(),OI1=nK0.maybeWrapAsError,FI1=u5(),NI1=FI1.OperationalError,pK0=n3();function MI1($){return $ instanceof Error&&pK0.getPrototypeOf($)===Error.prototype}var AI1=/^(?:name|message|stack|cause)$/;function PI1($){var I;if(MI1($)){I=new NI1($),I.name=$.name,I.message=$.message,I.stack=$.stack;var U=pK0.keys($);for(var Y=0;Y<U.length;++Y){var J=U[Y];if(!AI1.test(J))I[J]=$[J]}return I}return nK0.markAsOriginatingFromRejection($),$}function TI1($,I){return function(U,Y){if($===null)return;if(U){var J=PI1(OI1(U));$._attachExtraTrace(J),$._reject(J)}else if(!I)$._fulfill(Y);else{var Q=arguments.length,K=Array(Math.max(Q-1,0));for(var q=1;q<Q;++q)K[q-1]=arguments[q];$._fulfill(K)}$=null}}cK0.exports=TI1});var mK0=O((TC1,dK0)=>{dK0.exports=function($,I,U,Y,J){var Q=p1(),K=Q.tryCatch;$.method=function(q){if(typeof q!=="function")throw new $.TypeError("expecting a function but got "+Q.classString(q));return function(){var H=new $(I);H._captureStackTrace(),H._pushContext();var G=K(q).apply(this,arguments),W=H._popContext();return J.checkForgottenReturns(G,W,"Promise.method",H),H._resolveFromSyncValue(G),H}},$.attempt=$.try=function(q){if(typeof q!=="function")return Y("expecting a function but got "+Q.classString(q));var H=new $(I);H._captureStackTrace(),H._pushContext();var G;if(arguments.length>1){J.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],w=arguments[2];G=Q.isArray(W)?K(q).apply(w,W):K(q).call(w,W)}else G=K(q)();var V=H._popContext();return J.checkForgottenReturns(G,V,"Promise.try",H),H._resolveFromSyncValue(G),H},$.prototype._resolveFromSyncValue=function(q){if(q===Q.errorObj)this._rejectCallback(q.e,!1);else this._resolveCallback(q,!0)}}});var oK0=O((EC1,lK0)=>{lK0.exports=function($,I,U,Y){var J=!1,Q=function(G,W){this._reject(W)},K=function(G,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(Q,Q,null,this,G)},q=function(G,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},H=function(G,W){if(!W.promiseRejectionQueued)this._reject(G)};$.prototype.bind=function(G){if(!J)J=!0,$.prototype._propagateFrom=Y.propagateFromFunction(),$.prototype._boundValue=Y.boundValueFunction();var W=U(G),w=new $(I);w._propagateFrom(this,1);var V=this._target();if(w._setBoundTo(W),W instanceof $){var Z={promiseRejectionQueued:!1,promise:w,target:V,bindingPromise:W};V._then(I,K,voi Line truncated
See http://goo.gl/MqrFmX
`);return this._settledValue()},Y=I.prototype.error=I.prototype.reason=function(){if(!this.isRejected())throw TypeError(`cannot get rejection reason of a non-rejected promise
See http://goo.gl/MqrFmX
`);return this._settledValue()},J=I.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},Q=I.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=I.prototype.isPending=function(){return(this._bitField&50397184)===0},q=I.prototype.isResolved=function(){return(this._bitField&50331648)!==0};I.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},$.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},$.prototype._isCancelled=function(){return this._target().__isCancelled()},$.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},$.prototype.isPending=function(){return K.call(this._target())},$.prototype.isRejected=function(){return Q.call(this._target())},$.prototype.isFulfilled=function(){return J.call(this._target())},$.prototype.isResolved=function(){return q.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),Y.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=I}});var KK0=N((rR1,QK0)=>{QK0.exports=function($,I,U,Y,J,Q){var K=b1(),q=K.canEvaluate,G=K.tryCatch,H=K.errorObj,W;if(q){var V=function(E){return Function("value","holder",`
`);return this._settledValue()},J=I.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},Q=I.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=I.prototype.isPending=function(){return(this._bitField&50397184)===0},q=I.prototype.isResolved=function(){return(this._bitField&50331648)!==0};I.prototype.isCancelled=function(){return(this._bitField&8454144)!==0},$.prototype.__isCancelled=function(){return(this._bitField&65536)===65536},$.prototype._isCancelled=function(){return this._target().__isCancelled()},$.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0},$.prototype.isPending=function(){return K.call(this._target())},$.prototype.isRejected=function(){return Q.call(this._target())},$.prototype.isFulfilled=function(){return J.call(this._target())},$.prototype.isResolved=function(){return q.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var H=this._target();return H._unsetRejectionIsUnhandled(),Y.call(H)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=I}});var Uq0=O((CC1,Iq0)=>{Iq0.exports=function($,I,U,Y,J,Q){var K=p1(),q=K.canEvaluate,H=K.tryCatch,G=K.errorObj,W;if(q){var w=function(E){return Function("value","holder",`
'use strict';
holder.pIndex = value;
holder.checkFulfillment(this);
`.replace(/Index/g,E))},X=function(E){return Function("promise","holder",`
`.replace(/Index/g,E))},V=function(E){return Function("promise","holder",`
'use strict';
holder.pIndex = promise;
`.replace(/Index/g,E))},Z=function(E){var A=Array(E);for(var T=0;T<A.length;++T)A[T]="this.p"+(T+1);var C=A.join(" = ")+" = null;",u=`var promise;
`+A.map(function(n){return`
promise = `+n+`;
`.replace(/Index/g,E))},Z=function(E){var T=Array(E);for(var A=0;A<T.length;++A)T[A]="this.p"+(A+1);var R=T.join(" = ")+" = null;",k=`var promise;
`+T.map(function(p){return`
promise = `+p+`;
if (promise instanceof Promise) {
promise.cancel();
}
`}).join(`
`),g=A.join(", "),b="Holder$"+E,v=`return function(tryCatch, errorObj, Promise, async) {
`),S=T.join(", "),i="Holder$"+E,C=`return function(tryCatch, errorObj, Promise, async) {
'use strict';
function [TheName](fn) {
[TheProperties]
@@ -129,7 +129,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))r
return [TheName];
}(tryCatch, errorObj, Promise, async);
`;return v=v.replace(/\[TheName\]/g,b).replace(/\[TheTotal\]/g,E).replace(/\[ThePassedArguments\]/g,g).replace(/\[TheProperties\]/g,C).replace(/\[CancellationCode\]/g,u),Function("tryCatch","errorObj","Promise","async",v)(G,H,$,J)},D=[],w=[],O=[];for(var F=0;F<8;++F)D.push(Z(F+1)),w.push(V(F+1)),O.push(X(F+1));W=function(E){this._reject(E)}}$.join=function(){var E=arguments.length-1,A;if(E>0&&typeof arguments[E]==="function"){if(A=arguments[E],E<=8&&q){var i=new $(Y);i._captureStackTrace();var T=D[E-1],C=new T(A),u=w;for(var g=0;g<E;++g){var b=U(arguments[g],i);if(b instanceof $){b=b._target();var v=b._bitField;if((v&50397184)===0)b._then(u[g],W,void 0,i,C),O[g](b,C),C.asyncNeeded=!1;else if((v&33554432)!==0)u[g].call(i,b._value(),C);else if((v&16777216)!==0)i._reject(b._reason());else i._cancel()}else u[g].call(i,b,C)}if(!i._isFateSealed()){if(C.asyncNeeded){var n=Q();if(n!==null)C.fn=K.domainBind(n,C.fn)}i._setAsyncGuaranteed(),i._setOnCancel(C)}return i}}var p=arguments.length,S=Array(p);for(var f=0;f<p;++f)S[f]=arguments[f];if(A)S.pop();var i=new I(S).promise();return A!==void 0?i.spread(A):i}}});var GK0=N((tR1,qK0)=>{qK0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=b1(),G=q.tryCatch,H=q.errorObj,W=$._async;function V(Z,D,w,O){this.constructor$(Z),this._promise._captureStackTrace();var F=K();this._callback=F===null?D:q.domainBind(F,D),this._preservedValues=O===J?Array(this.length()):null,this._limit=w,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}q.inherits(V,I),V.prototype._asyncInit=function(){this._init$(void 0,-2)},V.prototype._init=function(){},V.prototype._promiseFulfilled=function(Z,D){var w=this._values,O=this.length(),F=this._preservedValues,E=this._limit;if(D<0){if(D=D*-1-1,w[D]=Z,E>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(E>=1&&this._inFlight>=E)return w[D]=Z,this._queue.push(D),!1;if(F!==null)F[D]=Z;var A=this._promise,T=this._callback,C=A._boundValue();A._pushContext();var u=G(T).call(C,Z,D,O),g=A._popContext();if(Q.checkForgottenReturns(u,g,F!==null?"Promise.filter":"Promise.map",A),u===H)return this._reject(u.e),!0;var b=Y(u,this._promise);if(b instanceof $){b=b._target();var v=b._bitField;if((v&50397184)===0){if(E>=1)this._inFlight++;return w[D]=b,b._proxy(this,(D+1)*-1),!1}else if((v&33554432)!==0)u=b._value();else if((v&16777216)!==0)return this._reject(b._reason()),!0;else return this._cancel(),!0}w[D]=u}var n=++this._totalResolved;if(n>=O){if(F!==null)this._filter(w,F);else this._resolve(w);return!0}return!1},V.prototype._drainQueue=function(){var Z=this._queue,D=this._limit,w=this._values;while(Z.length>0&&this._inFlight<D){if(this._isResolved())return;var O=Z.pop();this._promiseFulfilled(w[O],O)}},V.prototype._filter=function(Z,D){var w=D.length,O=Array(w),F=0;for(var E=0;E<w;++E)if(Z[E])O[F++]=D[E];O.length=F,this._resolve(O)},V.prototype.preservedValues=function(){return this._preservedValues};function X(Z,D,w,O){if(typeof D!=="function")return U("expecting a function but got "+q.classString(D));var F=0;if(w!==void 0)if(typeof w==="object"&&w!==null){if(typeof w.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+q.classString(w.concurrency)));F=w.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+q.classString(w)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new V(Z,D,F,O).promise()}$.prototype.map=function(Z,D){return X(this,Z,D,null)},$.map=function(Z,D,w,O){return X(Z,D,w,O)}}});var WK0=N((aR1,HK0)=>{var qg=Object.create;if(qg)RD=qg(null),CD=qg(null),RD[" size"]=CD[" size"]=0;var RD,CD;HK0.exports=function($){var I=b1(),U=I.canEvaluate,Y=I.isIdentifier,J,Q,K=function(Z){return Function("ensureMethod",`
`;return C=C.replace(/\[TheName\]/g,i).replace(/\[TheTotal\]/g,E).replace(/\[ThePassedArguments\]/g,S).replace(/\[TheProperties\]/g,R).replace(/\[CancellationCode\]/g,k),Function("tryCatch","errorObj","Promise","async",C)(H,G,$,J)},X=[],L=[],D=[];for(var F=0;F<8;++F)X.push(Z(F+1)),L.push(w(F+1)),D.push(V(F+1));W=function(E){this._reject(E)}}$.join=function(){var E=arguments.length-1,T;if(E>0&&typeof arguments[E]==="function"){if(T=arguments[E],E<=8&&q){var b=new $(Y);b._captureStackTrace();var A=X[E-1],R=new A(T),k=L;for(var S=0;S<E;++S){var i=U(arguments[S],b);if(i instanceof $){i=i._target();var C=i._bitField;if((C&50397184)===0)i._then(k[S],W,void 0,b,R),D[S](i,R),R.asyncNeeded=!1;else if((C&33554432)!==0)k[S].call(b,i._value(),R);else if((C&16777216)!==0)b._reject(i._reason());else b._cancel()}else k[S].call(b,i,R)}if(!b._isFateSealed()){if(R.asyncNeeded){var p=Q();if(p!==null)R.fn=K.domainBind(p,R.fn)}b._setAsyncGuaranteed(),b._setOnCancel(R)}return b}}var n=arguments.length,g=Array(n);for(var f=0;f<n;++f)g[f]=arguments[f];if(T)g.pop();var b=new I(g).promise();return T!==void 0?b.spread(T):b}}});var Jq0=O((jC1,Yq0)=>{Yq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=p1(),H=q.tryCatch,G=q.errorObj,W=$._async;function w(Z,X,L,D){this.constructor$(Z),this._promise._captureStackTrace();var F=K();this._callback=F===null?X:q.domainBind(F,X),this._preservedValues=D===J?Array(this.length()):null,this._limit=L,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}q.inherits(w,I),w.prototype._asyncInit=function(){this._init$(void 0,-2)},w.prototype._init=function(){},w.prototype._promiseFulfilled=function(Z,X){var L=this._values,D=this.length(),F=this._preservedValues,E=this._limit;if(X<0){if(X=X*-1-1,L[X]=Z,E>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(E>=1&&this._inFlight>=E)return L[X]=Z,this._queue.push(X),!1;if(F!==null)F[X]=Z;var T=this._promise,A=this._callback,R=T._boundValue();T._pushContext();var k=H(A).call(R,Z,X,D),S=T._popContext();if(Q.checkForgottenReturns(k,S,F!==null?"Promise.filter":"Promise.map",T),k===G)return this._reject(k.e),!0;var i=Y(k,this._promise);if(i instanceof $){i=i._target();var C=i._bitField;if((C&50397184)===0){if(E>=1)this._inFlight++;return L[X]=i,i._proxy(this,(X+1)*-1),!1}else if((C&33554432)!==0)k=i._value();else if((C&16777216)!==0)return this._reject(i._reason()),!0;else return this._cancel(),!0}L[X]=k}var p=++this._totalResolved;if(p>=D){if(F!==null)this._filter(L,F);else this._resolve(L);return!0}return!1},w.prototype._drainQueue=function(){var Z=this._queue,X=this._limit,L=this._values;while(Z.length>0&&this._inFlight<X){if(this._isResolved())return;var D=Z.pop();this._promiseFulfilled(L[D],D)}},w.prototype._filter=function(Z,X){var L=X.length,D=Array(L),F=0;for(var E=0;E<L;++E)if(Z[E])D[F++]=X[E];D.length=F,this._resolve(D)},w.prototype.preservedValues=function(){return this._preservedValues};function V(Z,X,L,D){if(typeof X!=="function")return U("expecting a function but got "+q.classString(X));var F=0;if(L!==void 0)if(typeof L==="object"&&L!==null){if(typeof L.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+q.classString(L.concurrency)));F=L.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+q.classString(L)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new w(Z,X,F,D).promise()}$.prototype.map=function(Z,X){return V(this,Z,X,null)},$.map=function(Z,X,L,D){return V(Z,X,L,D)}}});var Kq0=O((_C1,Qq0)=>{var SS=Object.create;if(SS)cX=SS(null),dX=SS(null),cX[" size"]=dX[" size"]=0;var cX,dX;Qq0.exports=function($){var I=p1(),U=I.canEvaluate,Y=I.isIdentifier,J,Q,K=function(Z){return Function("ensureMethod",`
return function(obj) {
'use strict'
var len = this.length;
@@ -143,29 +143,29 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))r
return obj.methodName.apply(obj, this);
}
};
`.replace(/methodName/g,Z))(H)},q=function(Z){return Function("obj",`
`.replace(/methodName/g,Z))(G)},q=function(Z){return Function("obj",`
'use strict';
return obj.propertyName;
`.replace("propertyName",Z))},G=function(Z,D,w){var O=w[Z];if(typeof O!=="function"){if(!Y(Z))return null;if(O=D(Z),w[Z]=O,w[" size"]++,w[" size"]>512){var F=Object.keys(w);for(var E=0;E<256;++E)delete w[F[E]];w[" size"]=F.length-256}}return O};J=function(Z){return G(Z,K,RD)},Q=function(Z){return G(Z,q,CD)};function H(Z,D){var w;if(Z!=null)w=Z[D];if(typeof w!=="function"){var O="Object "+I.classString(Z)+" has no method '"+I.toString(D)+"'";throw new $.TypeError(O)}return w}function W(Z){var D=this.pop(),w=H(Z,D);return w.apply(Z,this)}$.prototype.call=function(Z){var D=arguments.length,w=Array(Math.max(D-1,0));for(var O=1;O<D;++O)w[O-1]=arguments[O];if(U){var F=J(Z);if(F!==null)return this._then(F,void 0,void 0,w,void 0)}return w.push(Z),this._then(W,void 0,void 0,w,void 0)};function V(Z){return Z[this]}function X(Z){var D=+this;if(D<0)D=Math.max(0,D+Z.length);return Z[D]}$.prototype.get=function(Z){var D=typeof Z==="number",w;if(!D)if(U){var O=Q(Z);w=O!==null?O:V}else w=V;else w=X;return this._then(w,void 0,void 0,Z,void 0)}}});var ZK0=N((sR1,VK0)=>{VK0.exports=function($,I,U,Y,J,Q){var K=b1(),q=v5().TypeError,G=b1().inherits,H=K.errorObj,W=K.tryCatch,V={};function X(A){setTimeout(function(){throw A},0)}function Z(A){var T=U(A);if(T!==A&&typeof A._isDisposable==="function"&&typeof A._getDisposer==="function"&&A._isDisposable())T._setDisposable(A._getDisposer());return T}function D(A,T){var C=0,u=A.length,g=new $(J);function b(){if(C>=u)return g._fulfill();var v=Z(A[C++]);if(v instanceof $&&v._isDisposable()){try{v=U(v._getDisposer().tryDispose(T),A.promise)}catch(n){return X(n)}if(v instanceof $)return v._then(b,X,null,null,null)}b()}return b(),g}function w(A,T,C){this._data=A,this._promise=T,this._context=C}w.prototype.data=function(){return this._data},w.prototype.promise=function(){return this._promise},w.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return V},w.prototype.tryDispose=function(A){var T=this.resource(),C=this._context;if(C!==void 0)C._pushContext();var u=T!==V?this.doDispose(T,A):null;if(C!==void 0)C._popContext();return this._promise._unsetDisposable(),this._data=null,u},w.isDisposer=function(A){return A!=null&&typeof A.resource==="function"&&typeof A.tryDispose==="function"};function O(A,T,C){this.constructor$(A,T,C)}G(O,w),O.prototype.doDispose=function(A,T){var C=this.data();return C.call(A,A,T)};function F(A){if(w.isDisposer(A))return this.resources[this.index]._setDisposable(A),A.promise();return A}function E(A){this.length=A,this.promise=null,this[A-1]=null}E.prototype._resultCancelled=function(){var A=this.length;for(var T=0;T<A;++T){var C=this[T];if(C instanceof $)C.cancel()}},$.using=function(){var A=arguments.length;if(A<2)return I("you must pass at least 2 arguments to Promise.using");var T=arguments[A-1];if(typeof T!=="function")return I("expecting a function but got "+K.classString(T));var C,u=!0;if(A===2&&Array.isArray(arguments[0]))C=arguments[0],A=C.length,u=!1;else C=arguments,A--;var g=new E(A);for(var b=0;b<A;++b){var v=C[b];if(w.isDisposer(v)){var n=v;v=v.promise(),v._setDisposable(n)}else{var p=U(v);if(p instanceof $)v=p._then(F,null,null,{resources:g,index:b},void 0)}g[b]=v}var S=Array(g.length);for(var b=0;b<S.length;++b)S[b]=$.resolve(g[b]).reflect();var f=$.all(S).then(function(Y0){for(var B=0;B<Y0.length;++B){var k=Y0[B];if(k.isRejected())return H.e=k.error(),H;else if(!k.isFulfilled()){f.cancel();return}Y0[B]=k.value()}i._pushContext(),T=W(T);var d=u?T.apply(void 0,Y0):T(Y0),t=i._popContext();return Q.checkForgottenReturns(d,t,"Promise.using",i),d}),i=f.lastly(function(){var Y0=new $.PromiseInspection(f);return D(g,Y0)});return g.promise=i,i._setOnCancel(g),i},$.prototype._setDisposable=function(A){this._bitField=this._bitField|131072,this._disposer=A},$.prototype._isDisposable=function(){return(this._bitField&131072)>0},$.prototype._getDisposer=function(){return this._disposer},$.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},$.prototype.disposer=function(A){if(typeof A==="function")return new O(A,this,Y());throw new q}}});var LK0=N((eR1,XK0)=>{XK0.exports=function($,I,U){var Y=b1(),J=$.TimeoutError;function Q(V){this.handle=V}Q.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(V){return q(+this).thenReturn(V)},q=$.delay=function(V,X){var Z,D;if(X!==void 0){if(Z=$.resolve(X)._then(K,null,null,V,void 0),U.cancellation()&&X instanceof $)Z._setOnCancel(X)}else{if(Z=new $(I),D=setTimeout(function(){Z._fulfill()},+V),U.cancellation())Z._setOnCancel(new Q(D));Z._captureStackTrace()}return Z._setAsyncGuaranteed(),Z};$.prototype.delay=function(V){return q(V,this)};var G=function(V,X,Z){var D;if(typeof X!=="string")if(X instanceof Error)D=X;else D=new J("operation timed out");else D=new J(X);if(Y.markAsOriginatingFromRejection(D),V._attachExtraTrace(D),V._reject(D),Z!=null)Z.cancel()};function H(V){return clearTimeout(this.handle),V}f Line truncated
`.replace("propertyName",Z))},H=function(Z,X,L){var D=L[Z];if(typeof D!=="function"){if(!Y(Z))return null;if(D=X(Z),L[Z]=D,L[" size"]++,L[" size"]>512){var F=Object.keys(L);for(var E=0;E<256;++E)delete L[F[E]];L[" size"]=F.length-256}}return D};J=function(Z){return H(Z,K,cX)},Q=function(Z){return H(Z,q,dX)};function G(Z,X){var L;if(Z!=null)L=Z[X];if(typeof L!=="function"){var D="Object "+I.classString(Z)+" has no method '"+I.toString(X)+"'";throw new $.TypeError(D)}return L}function W(Z){var X=this.pop(),L=G(Z,X);return L.apply(Z,this)}$.prototype.call=function(Z){var X=arguments.length,L=Array(Math.max(X-1,0));for(var D=1;D<X;++D)L[D-1]=arguments[D];if(U){var F=J(Z);if(F!==null)return this._then(F,void 0,void 0,L,void 0)}return L.push(Z),this._then(W,void 0,void 0,L,void 0)};function w(Z){return Z[this]}function V(Z){var X=+this;if(X<0)X=Math.max(0,X+Z.length);return Z[X]}$.prototype.get=function(Z){var X=typeof Z==="number",L;if(!X)if(U){var D=Q(Z);L=D!==null?D:w}else L=w;else L=V;return this._then(L,void 0,void 0,Z,void 0)}}});var Hq0=O((gC1,qq0)=>{qq0.exports=function($,I,U,Y,J,Q){var K=p1(),q=u5().TypeError,H=p1().inherits,G=K.errorObj,W=K.tryCatch,w={};function V(T){setTimeout(function(){throw T},0)}function Z(T){var A=U(T);if(A!==T&&typeof T._isDisposable==="function"&&typeof T._getDisposer==="function"&&T._isDisposable())A._setDisposable(T._getDisposer());return A}function X(T,A){var R=0,k=T.length,S=new $(J);function i(){if(R>=k)return S._fulfill();var C=Z(T[R++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(A),T.promise)}catch(p){return V(p)}if(C instanceof $)return C._then(i,V,null,null,null)}i()}return i(),S}function L(T,A,R){this._data=T,this._promise=A,this._context=R}L.prototype.data=function(){return this._data},L.prototype.promise=function(){return this._promise},L.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return w},L.prototype.tryDispose=function(T){var A=this.resource(),R=this._context;if(R!==void 0)R._pushContext();var k=A!==w?this.doDispose(A,T):null;if(R!==void 0)R._popContext();return this._promise._unsetDisposable(),this._data=null,k},L.isDisposer=function(T){return T!=null&&typeof T.resource==="function"&&typeof T.tryDispose==="function"};function D(T,A,R){this.constructor$(T,A,R)}H(D,L),D.prototype.doDispose=function(T,A){var R=this.data();return R.call(T,T,A)};function F(T){if(L.isDisposer(T))return this.resources[this.index]._setDisposable(T),T.promise();return T}function E(T){this.length=T,this.promise=null,this[T-1]=null}E.prototype._resultCancelled=function(){var T=this.length;for(var A=0;A<T;++A){var R=this[A];if(R instanceof $)R.cancel()}},$.using=function(){var T=arguments.length;if(T<2)return I("you must pass at least 2 arguments to Promise.using");var A=arguments[T-1];if(typeof A!=="function")return I("expecting a function but got "+K.classString(A));var R,k=!0;if(T===2&&Array.isArray(arguments[0]))R=arguments[0],T=R.length,k=!1;else R=arguments,T--;var S=new E(T);for(var i=0;i<T;++i){var C=R[i];if(L.isDisposer(C)){var p=C;C=C.promise(),C._setDisposable(p)}else{var n=U(C);if(n instanceof $)C=n._then(F,null,null,{resources:S,index:i},void 0)}S[i]=C}var g=Array(S.length);for(var i=0;i<g.length;++i)g[i]=$.resolve(S[i]).reflect();var f=$.all(g).then(function(Y0){for(var B=0;B<Y0.length;++B){var x=Y0[B];if(x.isRejected())return G.e=x.error(),G;else if(!x.isFulfilled()){f.cancel();return}Y0[B]=x.value()}b._pushContext(),A=W(A);var d=k?A.apply(void 0,Y0):A(Y0),t=b._popContext();return Q.checkForgottenReturns(d,t,"Promise.using",b),d}),b=f.lastly(function(){var Y0=new $.PromiseInspection(f);return X(S,Y0)});return S.promise=b,b._setOnCancel(S),b},$.prototype._setDisposable=function(T){this._bitField=this._bitField|131072,this._disposer=T},$.prototype._isDisposable=function(){return(this._bitField&131072)>0},$.prototype._getDisposer=function(){return this._disposer},$.prototype._unsetDisposable=function(){this._bitField=this._bitField&-131073,this._disposer=void 0},$.prototype.disposer=function(T){if(typeof T==="function")return new D(T,this,Y());throw new q}}});var Wq0=O((SC1,Gq0)=>{Gq0.exports=function($,I,U){var Y=p1(),J=$.TimeoutError;function Q(w){this.handle=w}Q.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(w){return q(+this).thenReturn(w)},q=$.delay=function(w,V){var Z,X;if(V!==void 0){if(Z=$.resolve(V)._then(K,null,null,w,void 0),U.cancellation()&&V instanceof $)Z._setOnCancel(V)}else{if(Z=new $(I),X=setTimeout(function(){Z._fulfill()},+w),U.cancellation())Z._setOnCancel(new Q(X));Z._captureStackTrace()}return Z._setAsyncGuaranteed(),Z};$.prototype.delay=function(w){return q(w,this)};var H=function(w,V,Z){var X;if(typeof V!=="string")if(V instanceof Error)X=V;else X=new J("operation timed out");else X=new J(V);if(Y.markAsOriginatingFromRejection(X),w._attachExtraTrace(X),w._reject(X),Z!=null)Z.cancel()};function G(w){return clearTimeout(this.handle),w}f Line truncated
See http://goo.gl/MqrFmX
`.replace("%s",O)+`From coroutine:
`.replace("%s",D)+`From coroutine:
`+this._stack.split(`
`).slice(1,-7).join(`
`)));return}}F=F._target();var E=F._bitField;if((E&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(D,w){if(typeof D!=="function")throw new q(`generatorFunction must be a function
`)));return}}F=F._target();var E=F._bitField;if((E&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new q(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var O=Object(w).yieldHandler,F=Z,E=Error().stack;return function(){var A=D.apply(this,arguments),T=new F(void 0,void 0,O,E),C=T.promise();return T._generator=A,T._promiseFulfilled(void 0),C}},$.coroutine.addYieldHandler=function(D){if(typeof D!=="function")throw new q("expecting a function but got "+G.classString(D));V.push(D)},$.spawn=function(D){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof D!=="function")return I(`generatorFunction must be a function
`);var D=Object(L).yieldHandler,F=Z,E=Error().stack;return function(){var T=X.apply(this,arguments),A=new F(void 0,void 0,D,E),R=A.promise();return A._generator=T,A._promiseFulfilled(void 0),R}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new q("expecting a function but got "+H.classString(X));w.push(X)},$.spawn=function(X){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var w=new Z(D,this),O=w.promise();return w._run($.spawn),O}}});var NK0=N((IC1,OK0)=>{OK0.exports=function($){var I=b1(),U=$._async,Y=I.tryCatch,J=I.errorObj;function Q(G,H){var W=this;if(!I.isArray(G))return K.call(W,G,H);var V=Y(H).apply(W._boundValue(),[null].concat(G));if(V===J)U.throwLater(V.e)}function K(G,H){var W=this,V=W._boundValue(),X=G===void 0?Y(H).call(V,null):Y(H).call(V,null,G);if(X===J)U.throwLater(X.e)}function q(G,H){var W=this;if(!G){var V=Error(G+"");V.cause=G,G=V}var X=Y(H).call(W._boundValue(),G);if(X===J)U.throwLater(X.e)}$.prototype.asCallback=$.prototype.nodeify=function(G,H){if(typeof G=="function"){var W=K;if(H!==void 0&&Object(H).spread)W=Q;this._then(W,q,void 0,this,G)}return this}}});var MK0=N((UC1,FK0)=>{FK0.exports=function($,I){var U={},Y=b1(),J=Kg(),Q=Y.withAppended,K=Y.maybeWrapAsError,q=Y.canEvaluate,G=v5().TypeError,H="Async",W={__isPromisified__:!0},V=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],X=new RegExp("^(?:"+V.join("|")+")$"),Z=function(f){return Y.isIdentifier(f)&&f.charAt(0)!=="_"&&f!=="constructor"};function D(f){return!X.test(f)}function w(f){try{return f.__isPromisified__===!0}catch(i){return!1}}function O(f,i,Y0){var B=Y.getDataPropertyOrDefault(f,i+Y0,W);return B?w(B):!1}function F(f,i,Y0){for(var B=0;B<f.length;B+=2){var k=f[B];if(Y0.test(k)){var d=k.replace(Y0,"");for(var t=0;t<f.length;t+=2)if(f[t]===d)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
`);var L=new Z(X,this),D=L.promise();return L._run($.spawn),D}}});var zq0=O((hC1,Zq0)=>{Zq0.exports=function($){var I=p1(),U=$._async,Y=I.tryCatch,J=I.errorObj;function Q(H,G){var W=this;if(!I.isArray(H))return K.call(W,H,G);var w=Y(G).apply(W._boundValue(),[null].concat(H));if(w===J)U.throwLater(w.e)}function K(H,G){var W=this,w=W._boundValue(),V=H===void 0?Y(G).call(w,null):Y(G).call(w,null,H);if(V===J)U.throwLater(V.e)}function q(H,G){var W=this;if(!H){var w=Error(H+"");w.cause=H,H=w}var V=Y(G).call(W._boundValue(),H);if(V===J)U.throwLater(V.e)}$.prototype.asCallback=$.prototype.nodeify=function(H,G){if(typeof H=="function"){var W=K;if(G!==void 0&&Object(G).spread)W=Q;this._then(W,q,void 0,this,H)}return this}}});var Lq0=O((uC1,Xq0)=>{Xq0.exports=function($,I){var U={},Y=p1(),J=gS(),Q=Y.withAppended,K=Y.maybeWrapAsError,q=Y.canEvaluate,H=u5().TypeError,G="Async",W={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],V=new RegExp("^(?:"+w.join("|")+")$"),Z=function(f){return Y.isIdentifier(f)&&f.charAt(0)!=="_"&&f!=="constructor"};function X(f){return!V.test(f)}function L(f){try{return f.__isPromisified__===!0}catch(b){return!1}}function D(f,b,Y0){var B=Y.getDataPropertyOrDefault(f,b+Y0,W);return B?L(B):!1}function F(f,b,Y0){for(var B=0;B<f.length;B+=2){var x=f[B];if(Y0.test(x)){var d=x.replace(Y0,"");for(var t=0;t<f.length;t+=2)if(f[t]===d)throw new H(`Cannot promisify an API that has normal methods with '%s'-suffix
See http://goo.gl/MqrFmX
`.replace("%s",i))}}}function E(f,i,Y0,B){var k=Y.inheritedDataKeys(f),d=[];for(var t=0;t<k.length;++t){var K0=k[t],W0=f[K0],z0=B===Z?!0:Z(K0,W0,f);if(typeof W0==="function"&&!w(W0)&&!O(f,K0,i)&&B(K0,W0,f,z0))d.push(K0,W0)}return F(d,i,Y0),d}var A=function(f){return f.replace(/([$])/,"\\$")},T,C=function(f){var i=[f],Y0=Math.max(0,f-1-3);for(var B=f-1;B>=Y0;--B)i.push(B);for(var B=f+1;B<=3;++B)i.push(B);return i},u=function(f){return Y.filledRange(f,"_arg","")},g=function(f){return Y.filledRange(Math.max(f,3),"_arg","")},b=function(f){if(typeof f.length==="number")return Math.max(Math.min(f.length,1024),0);return 0};T=function(f,i,Y0,B,k,d){var t=Math.max(0,b(B)-1),K0=C(t),W0=typeof f==="string"||i===U;function z0(G1){var N0=u(G1).join(", "),g0=G1>0?", ":"",d0;if(W0)d0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else d0=i===void 0?`ret = callback({{args}}, nodeback); break;
`.replace("%s",b))}}}function E(f,b,Y0,B){var x=Y.inheritedDataKeys(f),d=[];for(var t=0;t<x.length;++t){var K0=x[t],W0=f[K0],A0=B===Z?!0:Z(K0,W0,f);if(typeof W0==="function"&&!L(W0)&&!D(f,K0,b)&&B(K0,W0,f,A0))d.push(K0,W0)}return F(d,b,Y0),d}var T=function(f){return f.replace(/([$])/,"\\$")},A,R=function(f){var b=[f],Y0=Math.max(0,f-1-3);for(var B=f-1;B>=Y0;--B)b.push(B);for(var B=f+1;B<=3;++B)b.push(B);return b},k=function(f){return Y.filledRange(f,"_arg","")},S=function(f){return Y.filledRange(Math.max(f,3),"_arg","")},i=function(f){if(typeof f.length==="number")return Math.max(Math.min(f.length,1024),0);return 0};A=function(f,b,Y0,B,x,d){var t=Math.max(0,i(B)-1),K0=R(t),W0=typeof f==="string"||b===U;function A0(G1){var N0=k(G1).join(", "),S0=G1>0?", ":"",m0;if(W0)m0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else m0=b===void 0?`ret = callback({{args}}, nodeback); break;
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
`;return d0.replace("{{args}}",N0).replace(", ",g0)}function B0(){var G1="";for(var N0=0;N0<K0.length;++N0)G1+="case "+K0[N0]+":"+z0(K0[N0]);return G1+=`
`;return m0.replace("{{args}}",N0).replace(", ",S0)}function v0(){var G1="";for(var N0=0;N0<K0.length;++N0)G1+="case "+K0[N0]+":"+A0(K0[N0]);return G1+=`
default:
var args = new Array(len + 1);
var i = 0;
@@ -177,7 +177,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))r
break;
`.replace("[CodeForCall]",W0?`ret = callback.apply(this, args);
`:`ret = callback.apply(receiver, args);
`),G1}var D1=typeof f==="string"?"this != null ? this['"+f+"'] : fn":"fn",f0=`'use strict';
`),G1}var L1=typeof f==="string"?"this != null ? this['"+f+"'] : fn":"fn",f0=`'use strict';
var ret = function (Parameters) {
'use strict';
var len = arguments.length;
@@ -197,25 +197,25 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof y4))r
};
notEnumerableProp(ret, '__isPromisified__', true);
return ret;
`.replace("[CodeForSwitchCase]",B0()).replace("[GetFunctionCode]",D1);return f0=f0.replace("Parameters",g(t)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",f0)($,B,i,Q,K,J,Y.tryCatch,Y.errorObj,Y.notEnumerableProp,I)};function v(f,i,Y0,B,k,d){var t=function(){return this}(),K0=f;if(typeof K0==="string")f=B;function W0(){var z0=i;if(i===U)z0=this;var B0=new $(I);B0._captureStackTrace();var D1=typeof K0==="string"&&this!==t?this[K0]:f,f0=J(B0,d);try{D1.apply(z0,Q(arguments,f0))}catch(G1){B0._rejectCallback(K(G1),!0,!0)}if(!B0._isFateSealed())B0._setAsyncGuaranteed();return B0}return Y.notEnumerableProp(W0,"__isPromisified__",!0),W0}var n=q?T:v;function p(f,i,Y0,B,k){var d=new RegExp(A(i)+"$"),t=E(f,i,d,Y0);for(var K0=0,W0=t.length;K0<W0;K0+=2){var z0=t[K0],B0=t[K0+1],D1=z0+i;if(B===n)f[D1]=n(z0,U,z0,B0,i,k);else{var f0=B(B0,function(){return n(z0,U,z0,B0,i,k)});Y.notEnumerableProp(f0,"__isPromisified__",!0),f[D1]=f0}}return Y.toFastProperties(f),f}function S(f,i,Y0){return n(f,i,void 0,f,null,Y0)}$.promisify=function(f,i){if(typeof f!=="function")throw new G("expecting a function but got "+Y.classString(f));if(w(f))return f;i=Object(i);var Y0=i.context===void 0?U:i.context,B=!!i.multiArgs,k=S(f,Y0,B);return Y.copyDescriptors(f,k,D),k},$.promisifyAll=function(f,i){if(typeof f!=="function"&&typeof f!=="object")throw new G(`the target of promisifyAll must be an object or a function
`.replace("[CodeForSwitchCase]",v0()).replace("[GetFunctionCode]",L1);return f0=f0.replace("Parameters",S(t)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",f0)($,B,b,Q,K,J,Y.tryCatch,Y.errorObj,Y.notEnumerableProp,I)};function C(f,b,Y0,B,x,d){var t=function(){return this}(),K0=f;if(typeof K0==="string")f=B;function W0(){var A0=b;if(b===U)A0=this;var v0=new $(I);v0._captureStackTrace();var L1=typeof K0==="string"&&this!==t?this[K0]:f,f0=J(v0,d);try{L1.apply(A0,Q(arguments,f0))}catch(G1){v0._rejectCallback(K(G1),!0,!0)}if(!v0._isFateSealed())v0._setAsyncGuaranteed();return v0}return Y.notEnumerableProp(W0,"__isPromisified__",!0),W0}var p=q?A:C;function n(f,b,Y0,B,x){var d=new RegExp(T(b)+"$"),t=E(f,b,d,Y0);for(var K0=0,W0=t.length;K0<W0;K0+=2){var A0=t[K0],v0=t[K0+1],L1=A0+b;if(B===p)f[L1]=p(A0,U,A0,v0,b,x);else{var f0=B(v0,function(){return p(A0,U,A0,v0,b,x)});Y.notEnumerableProp(f0,"__isPromisified__",!0),f[L1]=f0}}return Y.toFastProperties(f),f}function g(f,b,Y0){return p(f,b,void 0,f,null,Y0)}$.promisify=function(f,b){if(typeof f!=="function")throw new H("expecting a function but got "+Y.classString(f));if(L(f))return f;b=Object(b);var Y0=b.context===void 0?U:b.context,B=!!b.multiArgs,x=g(f,Y0,B);return Y.copyDescriptors(f,x,X),x},$.promisifyAll=function(f,b){if(typeof f!=="function"&&typeof f!=="object")throw new H(`the target of promisifyAll must be an object or a function
See http://goo.gl/MqrFmX
`);i=Object(i);var Y0=!!i.multiArgs,B=i.suffix;if(typeof B!=="string")B=H;var k=i.filter;if(typeof k!=="function")k=Z;var d=i.promisifier;if(typeof d!=="function")d=n;if(!Y.isIdentifier(B))throw RangeError(`suffix must be a valid identifier
`);b=Object(b);var Y0=!!b.multiArgs,B=b.suffix;if(typeof B!=="string")B=G;var x=b.filter;if(typeof x!=="function")x=Z;var d=b.promisifier;if(typeof d!=="function")d=p;if(!Y.isIdentifier(B))throw RangeError(`suffix must be a valid identifier
See http://goo.gl/MqrFmX
`);var t=Y.inheritedDataKeys(f);for(var K0=0;K0<t.length;++K0){var W0=f[t[K0]];if(t[K0]!=="constructor"&&Y.isClass(W0))p(W0.prototype,B,k,d,Y0),p(W0,B,k,d,Y0)}return p(f,B,k,d,Y0)}}});var AK0=N((YC1,zK0)=>{zK0.exports=function($,I,U,Y){var J=b1(),Q=J.isObject,K=g3(),q;if(typeof Map==="function")q=Map;var G=function(){var X=0,Z=0;function D(w,O){this[X]=w,this[X+Z]=O,X++}return function(O){Z=O.size,X=0;var F=Array(O.size*2);return O.forEach(D,F),F}}(),H=function(X){var Z=new q,D=X.length/2|0;for(var w=0;w<D;++w){var O=X[D+w],F=X[w];Z.set(O,F)}return Z};function W(X){var Z=!1,D;if(q!==void 0&&X instanceof q)D=G(X),Z=!0;else{var w=K.keys(X),O=w.length;D=Array(O*2);for(var F=0;F<O;++F){var E=w[F];D[F]=X[E],D[F+O]=E}}this.constructor$(D),this._isMap=Z,this._init$(void 0,-3)}J.inherits(W,I),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(X,Z){this._values[Z]=X;var D=++this._totalResolved;if(D>=this._length){var w;if(this._isMap)w=H(this._values);else{w={};var O=this.length();for(var F=0,E=this.length();F<E;++F)w[this._values[F+O]]=this._values[F]}return this._resolve(w),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(X){return X>>1};function V(X){var Z,D=U(X);if(!Q(D))return Y(`cannot await properties of a non-object
`);var t=Y.inheritedDataKeys(f);for(var K0=0;K0<t.length;++K0){var W0=f[t[K0]];if(t[K0]!=="constructor"&&Y.isClass(W0))n(W0.prototype,B,x,d,Y0),n(W0,B,x,d,Y0)}return n(f,B,x,d,Y0)}}});var Oq0=O((xC1,Dq0)=>{Dq0.exports=function($,I,U,Y){var J=p1(),Q=J.isObject,K=n3(),q;if(typeof Map==="function")q=Map;var H=function(){var V=0,Z=0;function X(L,D){this[V]=L,this[V+Z]=D,V++}return function(D){Z=D.size,V=0;var F=Array(D.size*2);return D.forEach(X,F),F}}(),G=function(V){var Z=new q,X=V.length/2|0;for(var L=0;L<X;++L){var D=V[X+L],F=V[L];Z.set(D,F)}return Z};function W(V){var Z=!1,X;if(q!==void 0&&V instanceof q)X=H(V),Z=!0;else{var L=K.keys(V),D=L.length;X=Array(D*2);for(var F=0;F<D;++F){var E=L[F];X[F]=V[E],X[F+D]=E}}this.constructor$(X),this._isMap=Z,this._init$(void 0,-3)}J.inherits(W,I),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(V,Z){this._values[Z]=V;var X=++this._totalResolved;if(X>=this._length){var L;if(this._isMap)L=G(this._values);else{L={};var D=this.length();for(var F=0,E=this.length();F<E;++F)L[this._values[F+D]]=this._values[F]}return this._resolve(L),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(V){return V>>1};function w(V){var Z,X=U(V);if(!Q(X))return Y(`cannot await properties of a non-object
See http://goo.gl/MqrFmX
`);else if(D instanceof $)Z=D._then($.props,void 0,void 0,void 0,void 0);else Z=new W(D).promise();if(D instanceof $)Z._propagateFrom(D,2);return Z}$.prototype.props=function(){return V(this)},$.props=function(X){return V(X)}}});var TK0=N((JC1,PK0)=>{PK0.exports=function($,I,U,Y){var J=b1(),Q=function(q){return q.then(function(G){return K(G,q)})};function K(q,G){var H=U(q);if(H instanceof $)return Q(H);else if(q=J.asArray(q),q===null)return Y("expecting an array or an iterable object but got "+J.classString(q));var W=new $(I);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:V,_reject:X}=W;for(var Z=0,D=q.length;Z<D;++Z){var w=q[Z];if(w===void 0&&!(Z in q))continue;$.cast(w)._then(V,X,void 0,W,null)}return W}$.race=function(q){return K(q,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var BK0=N((QC1,EK0)=>{EK0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=b1(),G=q.tryCatch;function H(D,w,O,F){this.constructor$(D);var E=K();if(this._fn=E===null?w:q.domainBind(E,w),O!==void 0)O=$.resolve(O),O._attachCancellationCallback(this);if(this._initialValue=O,this._currentCancellable=null,F===J)this._eachValues=Array(this._length);else if(F===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}q.inherits(H,I),H.prototype._gotAccum=function(D){if(this._eachValues!==void 0&&this._eachValues!==null&&D!==J)this._eachValues.push(D)},H.prototype._eachComplete=function(D){if(this._eachValues!==null)this._eachValues.push(D);return this._eachValues},H.prototype._init=function(){},H.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},H.prototype.shouldCopyValues=function(){return!1},H.prototype._resolve=function(D){this._promise._resolveCallback(D),this._values=null},H.prototype._resultCancelled=function(D){if(D===this._initialValue)return this._cancel();if(this._isResolved())return;if(this._resultCancelled$(),this._currentCancellable instanceof $)this._currentCancellable.cancel();if(this._initialValue instanceof $)this._initialValue.cancel()},H.prototype._iterate=function(D){this._values=D;var w,O,F=D.length;if(this._initialValue!==void 0)w=this._initialValue,O=0;else w=$.resolve(D[0]),O=1;if(this._currentCancellable=w,!w.isRejected())for(;O<F;++O){var E={accum:null,value:D[O],index:O,length:F,array:this};w=w._then(X,void 0,void 0,E,void 0)}if(this._eachValues!==void 0)w=w._then(this._eachComplete,void 0,void 0,this,void 0);w._then(W,W,void 0,w,this)},$.prototype.reduce=function(D,w){return V(this,D,w,null)},$.reduce=function(D,w,O,F){return V(D,w,O,F)};function W(D,w){if(this.isFulfilled())w._resolve(D);else w._reject(D)}function V(D,w,O,F){if(typeof w!=="function")return U("expecting a function but got "+q.classString(w));var E=new H(D,w,O,F);return E.promise()}function X(D){this.accum=D,this.array._gotAccum(D);var w=Y(this.value,this.array._promise);if(w instanceof $)return this.array._currentCancellable=w,w._then(Z,void 0,void 0,this,void 0);else return Z.call(this,w)}function Z(D){var w=this.array,O=w._promise,F=G(w._fn);O._pushContext();var E;if(w._eachValues!==void 0)E=F.call(O._boundValue(),D,this.index,this.length);else E=F.call(O._boundValue(),this.accum,D,this.index,this.length);if(E instanceof $)w._currentCancellable=E;var A=O._popContext();return Q.checkForgottenReturns(E,A,w._eachValues!==void 0?"Promise.each":"Promise.reduce",O),E}}});var CK0=N((KC1,RK0)=>{RK0.exports=function($,I,U){var Y=$.PromiseInspection,J=b1();function Q(K){this.constructor$(K)}J.inherits(Q,I),Q.prototype._promiseResolved=function(K,q){this._values[K]=q;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},Q.prototype._promiseFulfilled=function(K,q){var G=new Y;return G._bitField=33554432,G._settledValueField=K,this._promiseResolved(q,G)},Q.prototype._promiseRejected=function(K,q){var G=new Y;return G._bitField=16777216,G._settledValueField=K,this._promiseResolved(q,G)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new Q(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var jK0=N((qC1,vK0)=>{vK0.exports=function($,I,U){var Y=b1(),J=v5().RangeError,Q=v5().AggregateError,K=Y.isArray,q={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Y.inherits(G,I),G.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},G.prototype.init=function(){this._initialized=!0,this._init()},G.prototype.setUnwrap=function(){this._unwrap=!0},G.prototype.howMany=function(){return this._howMany},G.prototype.setHowMany=function(W){this._howMany=W},G.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
`);else if(X instanceof $)Z=X._then($.props,void 0,void 0,void 0,void 0);else Z=new W(X).promise();if(X instanceof $)Z._propagateFrom(X,2);return Z}$.prototype.props=function(){return w(this)},$.props=function(V){return w(V)}}});var Nq0=O((kC1,Fq0)=>{Fq0.exports=function($,I,U,Y){var J=p1(),Q=function(q){return q.then(function(H){return K(H,q)})};function K(q,H){var G=U(q);if(G instanceof $)return Q(G);else if(q=J.asArray(q),q===null)return Y("expecting an array or an iterable object but got "+J.classString(q));var W=new $(I);if(H!==void 0)W._propagateFrom(H,3);var{_fulfill:w,_reject:V}=W;for(var Z=0,X=q.length;Z<X;++Z){var L=q[Z];if(L===void 0&&!(Z in q))continue;$.cast(L)._then(w,V,void 0,W,null)}return W}$.race=function(q){return K(q,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var Aq0=O((fC1,Mq0)=>{Mq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=p1(),H=q.tryCatch;function G(X,L,D,F){this.constructor$(X);var E=K();if(this._fn=E===null?L:q.domainBind(E,L),D!==void 0)D=$.resolve(D),D._attachCancellationCallback(this);if(this._initialValue=D,this._currentCancellable=null,F===J)this._eachValues=Array(this._length);else if(F===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}q.inherits(G,I),G.prototype._gotAccum=function(X){if(this._eachValues!==void 0&&this._eachValues!==null&&X!==J)this._eachValues.push(X)},G.prototype._eachComplete=function(X){if(this._eachValues!==null)this._eachValues.push(X);return this._eachValues},G.prototype._init=function(){},G.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},G.prototype.shouldCopyValues=function(){return!1},G.prototype._resolve=function(X){this._promise._resolveCallback(X),this._values=null},G.prototype._resultCancelled=function(X){if(X===this._initialValue)return this._cancel();if(this._isResolved())return;if(this._resultCancelled$(),this._currentCancellable instanceof $)this._currentCancellable.cancel();if(this._initialValue instanceof $)this._initialValue.cancel()},G.prototype._iterate=function(X){this._values=X;var L,D,F=X.length;if(this._initialValue!==void 0)L=this._initialValue,D=0;else L=$.resolve(X[0]),D=1;if(this._currentCancellable=L,!L.isRejected())for(;D<F;++D){var E={accum:null,value:X[D],index:D,length:F,array:this};L=L._then(V,void 0,void 0,E,void 0)}if(this._eachValues!==void 0)L=L._then(this._eachComplete,void 0,void 0,this,void 0);L._then(W,W,void 0,L,this)},$.prototype.reduce=function(X,L){return w(this,X,L,null)},$.reduce=function(X,L,D,F){return w(X,L,D,F)};function W(X,L){if(this.isFulfilled())L._resolve(X);else L._reject(X)}function w(X,L,D,F){if(typeof L!=="function")return U("expecting a function but got "+q.classString(L));var E=new G(X,L,D,F);return E.promise()}function V(X){this.accum=X,this.array._gotAccum(X);var L=Y(this.value,this.array._promise);if(L instanceof $)return this.array._currentCancellable=L,L._then(Z,void 0,void 0,this,void 0);else return Z.call(this,L)}function Z(X){var L=this.array,D=L._promise,F=H(L._fn);D._pushContext();var E;if(L._eachValues!==void 0)E=F.call(D._boundValue(),X,this.index,this.length);else E=F.call(D._boundValue(),this.accum,X,this.index,this.length);if(E instanceof $)L._currentCancellable=E;var T=D._popContext();return Q.checkForgottenReturns(E,T,L._eachValues!==void 0?"Promise.each":"Promise.reduce",D),E}}});var Tq0=O((iC1,Pq0)=>{Pq0.exports=function($,I,U){var Y=$.PromiseInspection,J=p1();function Q(K){this.constructor$(K)}J.inherits(Q,I),Q.prototype._promiseResolved=function(K,q){this._values[K]=q;var H=++this._totalResolved;if(H>=this._length)return this._resolve(this._values),!0;return!1},Q.prototype._promiseFulfilled=function(K,q){var H=new Y;return H._bitField=33554432,H._settledValueField=K,this._promiseResolved(q,H)},Q.prototype._promiseRejected=function(K,q){var H=new Y;return H._bitField=16777216,H._settledValueField=K,this._promiseResolved(q,H)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new Q(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var Bq0=O((bC1,Eq0)=>{Eq0.exports=function($,I,U){var Y=p1(),J=u5().RangeError,Q=u5().AggregateError,K=Y.isArray,q={};function H(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Y.inherits(H,I),H.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},H.prototype.init=function(){this._initialized=!0,this._init()},H.prototype.setUnwrap=function(){this._unwrap=!0},H.prototype.howMany=function(){return this._howMany},H.prototype.setHowMany=function(W){this._howMany=W},H.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
See http://goo.gl/MqrFmX
`);var X=new G(W),Z=X.promise();return X.setHowMany(V),X.init(),Z}$.some=function(W,V){return H(W,V)},$.prototype.some=function(W){return H(this,W)},$._SomePromiseArray=G}});var SK0=N((GC1,_K0)=>{_K0.exports=function($,I){var U=$.map;$.prototype.filter=function(Y,J){return U(this,Y,J,I)},$.filter=function(Y,J,Q){return U(Y,J,Q,I)}}});var yK0=N((HC1,gK0)=>{gK0.exports=function($,I){var{reduce:U,all:Y}=$;function J(){return Y(this)}function Q(K,q){return U(K,q,I,I)}$.prototype.each=function(K){return U(this,K,I,0)._then(J,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,I,I)},$.each=function(K,q){return U(K,q,I,0)._then(J,void 0,void 0,K,void 0)},$.mapSeries=Q}});var xK0=N((WC1,hK0)=>{hK0.exports=function($){var I=$._SomePromiseArray;function U(Y){var J=new I(Y),Q=J.promise();return J.setHowMany(1),J.setUnwrap(),J.init(),Q}$.any=function(Y){return U(Y)},$.prototype.any=function(){return U(this)}}});var kK0=N((VC1,Gg)=>{Gg.exports=function(){var $=function(){return new V(`circular promise resolution chain
`);var V=new H(W),Z=V.promise();return V.setHowMany(w),V.init(),Z}$.some=function(W,w){return G(W,w)},$.prototype.some=function(W){return G(this,W)},$._SomePromiseArray=H}});var Rq0=O((nC1,vq0)=>{vq0.exports=function($,I){var U=$.map;$.prototype.filter=function(Y,J){return U(this,Y,J,I)},$.filter=function(Y,J,Q){return U(Y,J,Q,I)}}});var jq0=O((pC1,Cq0)=>{Cq0.exports=function($,I){var{reduce:U,all:Y}=$;function J(){return Y(this)}function Q(K,q){return U(K,q,I,I)}$.prototype.each=function(K){return U(this,K,I,0)._then(J,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,I,I)},$.each=function(K,q){return U(K,q,I,0)._then(J,void 0,void 0,K,void 0)},$.mapSeries=Q}});var gq0=O((cC1,_q0)=>{_q0.exports=function($){var I=$._SomePromiseArray;function U(Y){var J=new I(Y),Q=J.promise();return J.setHowMany(1),J.setUnwrap(),J.init(),Q}$.any=function(Y){return U(Y)},$.prototype.any=function(){return U(this)}}});var Sq0=O((dC1,yS)=>{yS.exports=function(){var $=function(){return new w(`circular promise resolution chain
See http://goo.gl/MqrFmX
`)},I=function(){return new S.PromiseInspection(this._target())},U=function(B){return S.reject(new V(B))};function Y(){}var J={},Q=b1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(S,"_getDomain",K);var q=g3(),G=j20(),H=new G;q.defineProperty(S,"_async",{value:H});var W=v5(),V=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var X=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var Z=function(){},D={},w={},O=h20()(S,Z),F=k20()(S,Z,O,U,Y),E=f20()(S),A=E.create,T=i20()(S,E),C=T.CapturedTrace,u=n20()(S,O),g=d20()(w),b=Kg(),v=Q.errorObj,n=Q.tryCatch;function p(B,k){if(typeof k!=="function")throw new V("expecting a function but got "+Q.classString(k));if(B.constructor!==S)throw new V(`the promise constructor cannot be invoked directly
`)},I=function(){return new g.PromiseInspection(this._target())},U=function(B){return g.reject(new w(B))};function Y(){}var J={},Q=p1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(g,"_getDomain",K);var q=n3(),H=BK0(),G=new H;q.defineProperty(g,"_async",{value:G});var W=u5(),w=g.TypeError=W.TypeError;g.RangeError=W.RangeError;var V=g.CancellationError=W.CancellationError;g.TimeoutError=W.TimeoutError,g.OperationalError=W.OperationalError,g.RejectionError=W.OperationalError,g.AggregateError=W.AggregateError;var Z=function(){},X={},L={},D=_K0()(g,Z),F=SK0()(g,Z,D,U,Y),E=hK0()(g),T=E.create,A=xK0()(g,E),R=A.CapturedTrace,k=fK0()(g,D),S=bK0()(L),i=gS(),C=Q.errorObj,p=Q.tryCatch;function n(B,x){if(typeof x!=="function")throw new w("expecting a function but got "+Q.classString(x));if(B.constructor!==g)throw new w(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function S(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)p(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(B){var k=arguments.length;if(k>1){var d=Array(k-1),t=0,K0;for(K0=0;K0<k-1;++K0){var W0=arguments[K0];if(Q.isObject(W0))d[t++]=W0;else return U("expecting an object but got A catch statement predicate "+Q.classString(W0))}return d.length=t,B=arguments[K0],this.then(void 0,g(d,B,this))}return this.then(void 0,B)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(B,k){if(T.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof k!=="function"){var d=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)d+=", "+Q.classString(k);this._warn(d)}return this._then(B,k,void 0,void 0,void 0)},S.prototype.done=function(B,k){var d=this._then(B,k,void 0,void 0,void 0);d._setIsFinal()},S.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,D,void 0)},S.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},S.getNewLibraryCopy=Gg.exports,S.is=function(B){return B instanceof S},S.fromNode=S.fromCallback=function(B){var k=new S(Z);k._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=n(B)(b(k,d));if(t===v)k._rejectCallback(t.e,!0);if(!k._isFateSealed())k._setAsyncGuaranteed();return k},S.all=function(B){return new F(B).promise()},S.cast=function(B){var k=O(B);if(!(k instanceof S))k=new S(Z),k._captureStackTrace(),k._setFulfilled(),k._rejectionHandler0=B;return k},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(B){var k=new S(Z);return k._captureStackTrace(),k._rejectCallback(B,!0),k},S.setScheduler=function(B){if(typeof B!=="function")throw new V("expecting a function but got "+Q.classString(B));return H.setScheduler(B)},S.prototype._then=function(B,k,d,t,K0){var W0=K0!==void 0,z0=W0?K0:new S(Z),B0=this._target(),D1=B0._bitField;if(!W0){if(z0._propagateFrom(this,3),z0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((D1&50397184)!==0)t=this._boundValue();else t=B0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,z0)}var f0=K();if((D1&50397184)!==0){var G1,N0,g0=B0._settlePromiseCtx;if((D1&33554432)!==0)N0=B0._rejectionHandler0,G1=B;else if((D1&16777216)!==0)N0=B0._fulfillmentHandler0,G1=k,B0._unsetRejectionIsUnhandled();else g0=B0._settlePromiseLateCancellationObserver,N0=new X("late cancellation observer"),B0._attachExtraTrace(N0),G1=k;H.invoke(g0,B0,{handler:f0===null?G1:typeof G1==="function"&&Q.domainBind(f0,G1),promise:z0,receiver:t,value:N0})}else B0._addCallbacks(B,k,z0,t,f0);return z0},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(B){this._bitField=this._bitField&-65536|B&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(B){var k=B===0?this._receiver0:this[B*4-4+3];if(k===J)return;else if(k===void 0&&this._isBound())return this._boundValue();return k},S.prototype._promiseAt=function(B){return this[B*4-4+2]},S.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},S.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(B){var{_bit Line truncated
`)}function g(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)n(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}g.prototype.toString=function(){return"[object Promise]"},g.prototype.caught=g.prototype.catch=function(B){var x=arguments.length;if(x>1){var d=Array(x-1),t=0,K0;for(K0=0;K0<x-1;++K0){var W0=arguments[K0];if(Q.isObject(W0))d[t++]=W0;else return U("expecting an object but got A catch statement predicate "+Q.classString(W0))}return d.length=t,B=arguments[K0],this.then(void 0,S(d,B,this))}return this.then(void 0,B)},g.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},g.prototype.then=function(B,x){if(A.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof x!=="function"){var d=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)d+=", "+Q.classString(x);this._warn(d)}return this._then(B,x,void 0,void 0,void 0)},g.prototype.done=function(B,x){var d=this._then(B,x,void 0,void 0,void 0);d._setIsFinal()},g.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,X,void 0)},g.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},g.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},g.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},g.getNewLibraryCopy=yS.exports,g.is=function(B){return B instanceof g},g.fromNode=g.fromCallback=function(B){var x=new g(Z);x._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=p(B)(i(x,d));if(t===C)x._rejectCallback(t.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},g.all=function(B){return new F(B).promise()},g.cast=function(B){var x=D(B);if(!(x instanceof g))x=new g(Z),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=B;return x},g.resolve=g.fulfilled=g.cast,g.reject=g.rejected=function(B){var x=new g(Z);return x._captureStackTrace(),x._rejectCallback(B,!0),x},g.setScheduler=function(B){if(typeof B!=="function")throw new w("expecting a function but got "+Q.classString(B));return G.setScheduler(B)},g.prototype._then=function(B,x,d,t,K0){var W0=K0!==void 0,A0=W0?K0:new g(Z),v0=this._target(),L1=v0._bitField;if(!W0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((L1&50397184)!==0)t=this._boundValue();else t=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var f0=K();if((L1&50397184)!==0){var G1,N0,S0=v0._settlePromiseCtx;if((L1&33554432)!==0)N0=v0._rejectionHandler0,G1=B;else if((L1&16777216)!==0)N0=v0._fulfillmentHandler0,G1=x,v0._unsetRejectionIsUnhandled();else S0=v0._settlePromiseLateCancellationObserver,N0=new V("late cancellation observer"),v0._attachExtraTrace(N0),G1=x;G.invoke(S0,v0,{handler:f0===null?G1:typeof G1==="function"&&Q.domainBind(f0,G1),promise:A0,receiver:t,value:N0})}else v0._addCallbacks(B,x,A0,t,f0);return A0},g.prototype._length=function(){return this._bitField&65535},g.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},g.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},g.prototype._setLength=function(B){this._bitField=this._bitField&-65536|B&65535},g.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},g.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},g.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},g.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},g.prototype._isFinal=function(){return(this._bitField&4194304)>0},g.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},g.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},g.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},g.prototype._setAsyncGuaranteed=function(){if(G.hasCustomScheduler())return;this._bitField=this._bitField|134217728},g.prototype._receiverAt=function(B){var x=B===0?this._receiver0:this[B*4-4+3];if(x===J)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},g.prototype._promiseAt=function(B){return this[B*4-4+2]},g.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},g.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},g.prototype._boundValue=function(){},g.prototype._migrateCallback0=function(B){var{_bit Line truncated
path = %s
syscall = %s
fstream_type = %s
@@ -225,99 +225,100 @@ fstream_class = %s
fstream_stack =
%s
`,I||"UNKNOWN",Y.stack,Y.path,Y.syscall,Y.fstream_type,Y.fstream_path,Y.fstream_unc_path,Y.fstream_class,Y.fstream_stack.join(`
`));else U.emit("warn",Y)};Y7.prototype.info=function($,I){this.emit("info",$,I)};Y7.prototype.error=function($,I,U){var Y=wG0($,I,this);if(U)throw Y;else this.emit("error",Y)};function wG0($,I,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||I,$.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(Y){return Y.replace(/^ {4}at /,"")}),$}});var gq=N((iC1,NG0)=>{NG0.exports=lU1;function lU1($){var I=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&I.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Y=0,J=I.length;Y<J;Y++){U=I[Y];var Q=$[U]||$["is"+U];if(typeof Q==="function")Q=Q.call($);if(Q)return $[U]=!0,$.type=U,U}return null}});var og=N((pC1,FG0)=>{FG0.exports=yq;var oU1=m6(),rU1=n0(),lg=p3();rU1(yq,lg);function yq($){var I=this;if(!(I instanceof yq))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);lg.call(I,$)}yq.prototype._stat=function($){var I=this;oU1.readlink(I._path,function(U,Y){if(U)return I.error(U);I.linkpath=I.props.linkpath=Y,I.emit("linkpath",Y),lg.prototype._stat.call(I,$)})};yq.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var tg=N((nC1,AG0)=>{AG0.exports=u8;var zG0=m6(),tU1=n0(),hq=r("path"),rg=p3(),MG0=r("assert").ok;tU1(u8,rg);function u8($){var I=this;if(!(I instanceof u8))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(I.entries=null,I._index=-1,I._paused=!1,I._length=-1,$.sort)this.sort=$.sort;rg.call(this,$)}u8.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,zG0.readdir($._path,function(I,U){if(I)return $.error(I);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Y);else Y();function Y(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};u8.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 I=hq.resolve($._path,$.entries[$._index]);MG0(I!==$._path),MG0($.entries[$._index]),$._currentEntry=I,zG0[$.props.follow?"stat":"lstat"](I,function(U,Y){if(U)return $.error(U);var J=$._proxy||$;Y.path=I,Y.basename=hq.basename(I),Y.dirname=hq.dirname(I);var Q=$.getChildProps.call(J,Y);Q.path=I,Q.basename=hq.basename(I),Q.dirname=hq.dirname(I);var K=rg(Q,Y);$._currentEntry=K,K.on("pause",function(H){if(!$._paused&&!K._disowned)$.pause(H)}),K.on("resume",function(H){if($._paused&&!K._disowned)$.resume(H)}),K.on("stat",function(H){if($.emit("_entryStat",K,H),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,H)});else $.emit("entryStat",K,H)}),K.on("ready",function H(){if($._paused)return K.pause($),$.once("resume",H);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var q=!1;K.on("close",G),K.on("disown",G);function G(){if(q)return;if(q=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(H){if(K._swallowErrors)$.warn(H),K.emit("end"),K.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){K.on(H,$.emit.bind($,H))})})};u8.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};u8.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}};u8.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._currentEntry&&I._currentEntry.pause)I._currentEntry.pause($);I.emit("pause",$)};u8.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I._paused=!1,I.emit("resume",$),I._paused)return;if(I._currentEntry){if(I._currentEntry.resume)I._currentEntry.resume($)}else I._read()};u8.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var ag=N((cC1,BG0)=>{BG0.exports=n3;var aU1=m6(),sU1=n0(),PG0=p3(),TG0={EOF:!0},EG0={CLOSE:!0};sU1(n3,PG0);function n3($){var I=this;if(!(I instanceof n3))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);I._buffer=[],I._bytesEmitted=0,PG0.call(I,$)}n3.prototype._getStream=function(){var $=this,I=$._stream=aU1.createReadStream($._path,$.pro Line truncated
`));else U.emit("warn",Y)};w7.prototype.info=function($,I){this.emit("info",$,I)};w7.prototype.error=function($,I,U){var Y=VG0($,I,this);if(U)throw Y;else this.emit("error",Y)};function VG0($,I,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||I,$.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(Y){return Y.replace(/^ {4}at /,"")}),$}});var dq=O((Mj1,zG0)=>{zG0.exports=YJ1;function YJ1($){var I=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&I.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Y=0,J=I.length;Y<J;Y++){U=I[Y];var Q=$[U]||$["is"+U];if(typeof Q==="function")Q=Q.call($);if(Q)return $[U]=!0,$.type=U,U}return null}});var Ny=O((Aj1,XG0)=>{XG0.exports=mq;var JJ1=o6(),QJ1=p0(),Fy=a3();QJ1(mq,Fy);function mq($){var I=this;if(!(I instanceof mq))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Fy.call(I,$)}mq.prototype._stat=function($){var I=this;JJ1.readlink(I._path,function(U,Y){if(U)return I.error(U);I.linkpath=I.props.linkpath=Y,I.emit("linkpath",Y),Fy.prototype._stat.call(I,$)})};mq.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Ay=O((Pj1,OG0)=>{OG0.exports=i8;var DG0=o6(),KJ1=p0(),lq=r("path"),My=a3(),LG0=r("assert").ok;KJ1(i8,My);function i8($){var I=this;if(!(I instanceof i8))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(I.entries=null,I._index=-1,I._paused=!1,I._length=-1,$.sort)this.sort=$.sort;My.call(this,$)}i8.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,DG0.readdir($._path,function(I,U){if(I)return $.error(I);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Y);else Y();function Y(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};i8.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 I=lq.resolve($._path,$.entries[$._index]);LG0(I!==$._path),LG0($.entries[$._index]),$._currentEntry=I,DG0[$.props.follow?"stat":"lstat"](I,function(U,Y){if(U)return $.error(U);var J=$._proxy||$;Y.path=I,Y.basename=lq.basename(I),Y.dirname=lq.dirname(I);var Q=$.getChildProps.call(J,Y);Q.path=I,Q.basename=lq.basename(I),Q.dirname=lq.dirname(I);var K=My(Q,Y);$._currentEntry=K,K.on("pause",function(G){if(!$._paused&&!K._disowned)$.pause(G)}),K.on("resume",function(G){if($._paused&&!K._disowned)$.resume(G)}),K.on("stat",function(G){if($.emit("_entryStat",K,G),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,G)});else $.emit("entryStat",K,G)}),K.on("ready",function G(){if($._paused)return K.pause($),$.once("resume",G);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var q=!1;K.on("close",H),K.on("disown",H);function H(){if(q)return;if(q=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(G){if(K._swallowErrors)$.warn(G),K.emit("end"),K.emit("close");else $.emit("error",G)}),["child","childEnd","warn"].forEach(function(G){K.on(G,$.emit.bind($,G))})})};i8.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};i8.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}};i8.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._currentEntry&&I._currentEntry.pause)I._currentEntry.pause($);I.emit("pause",$)};i8.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I._paused=!1,I.emit("resume",$),I._paused)return;if(I._currentEntry){if(I._currentEntry.resume)I._currentEntry.resume($)}else I._read()};i8.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Py=O((Tj1,AG0)=>{AG0.exports=s3;var qJ1=o6(),HJ1=p0(),FG0=a3(),NG0={EOF:!0},MG0={CLOSE:!0};HJ1(s3,FG0);function s3($){var I=this;if(!(I instanceof s3))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);I._buffer=[],I._bytesEmitted=0,FG0.call(I,$)}s3.prototype._getStream=function(){var $=this,I=$._stream=qJ1.createReadStream($._path,$.pro Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),I.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(EG0),$._read();else $.emit("close")}),I.on("error",function(U){$.emit("error",U)}),$._read()};n3.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var I=$._buffer;for(var U=0,Y=I.length;U<Y;U++){var J=I[U];if(J===TG0)$.emit("end");else if(J===EG0)$.emit("close");else $.emit("data",J);if($._paused){$._buffer=I.slice(U);return}}$._buffer.length=0}};n3.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._stream)I._stream.pause();I.emit("pause",$)};n3.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I.emit("resume",$),I._paused=!1,I._stream)I._stream.resume();I._read()}});var vG0=N((dC1,CG0)=>{CG0.exports=$w;var eU1=n0(),RG0=p3();eU1($w,RG0);function $w($){var I=this;if(!(I instanceof $w))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);RG0.call(I,$)}$w.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var eg=N((mC1,jG0)=>{jG0.exports=c3;var sg=p3(),$Y1=gq(),IY1=n0(),UY1=m6();IY1(c3,sg);function c3($){var I=this;if(!(I instanceof c3))throw Error("ProxyReader must be called as constructor.");I.props=$,I._buffer=[],I.ready=!1,sg.call(I,$)}c3.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";UY1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=$Y1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(sg(I,J))})};c3.prototype._addProxy=function($){var I=this;if(I._proxyTarget)return I.error("proxy already set");I._proxyTarget=$,$._proxy=I,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$),$.on("ready",function(){I.ready=!0,I.emit("ready")});var U=I._buffer;I._buffer.length=0,U.forEach(function(Y){$[Y[0]].apply($,Y[1])})};c3.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};c3.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var p3=N((lC1,gG0)=>{gG0.exports=Y8;var YY1=m6(),JY1=r("stream").Stream,QY1=n0(),$y=r("path"),Iy=gq(),Iw=Y8.hardLinks={},_G0=eD();QY1(Y8,_G0);var SG0=og();function Y8($,I){var U=this;if(!(U instanceof Y8))return new Y8($,I);if(typeof $==="string")$={path:$};var Y,J;if($.type&&typeof $.type==="function")Y=$.type,J=Y;else Y=Iy($),J=Y8;if(I&&!Y)Y=Iy(I),$[Y]=!0,$.type=Y;switch(Y){case"Directory":J=tg();break;case"Link":case"File":J=ag();break;case"SymbolicLink":J=SG0;break;case"Socket":J=vG0();break;case null:J=eg();break}if(!(U instanceof J))return new J($);if(_G0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Y,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=$y.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=$y.basename(U.path),U.dirname=$.dirname=$y.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=KY1;U._stat(I)}function KY1($,I){return $===I?0:$.toLowerCase()>I.toLowerCase()?1:$.toLowerCase()<I.toLowerCase()?-1:$>I?1:-1}Y8.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat";if($)process.nextTick(J.bind(null,null,$));else YY1[Y](I._path,J);function J(Q,K){if(Q)return I.error(Q);if(Object.keys(K).forEach(function(Z){U[Z]=K[Z]}),I.size!==void 0&&U.size!==I.size)return I.error("incorrect size");I.size=U.size;var q=Iy(U),G=U.hardlinks!==!1;if(G&&q!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(Iw[H]===I._path||!Iw[H])Iw[H]=I._path;else q=I.type=I.props.type="Link",I.Link=I.props.Link=!0,I.linkpath=I.props.linkpath=Iw[H],I._stat=I._read=SG0.prototype._read}if(I.type&&I.type!==q)I.error("Unexpected type: "+q);if(I.filter){var W=I._proxy||I;if(!I.filter.call(W,W,U)){if(!I._disowned)I.abort(),I.emit("end"),I.emit("close");return}}var V=["_stat","stat","ready"],X=0;(function Z(){if(I._aborted){I.emit("end"),I.emit("close");return}if(I._paused&&I.type!=="Directory"){I.once("resume",Z);return}var D=V[X++];if(!D)return I._read();I.emit(D,U),Z()})()}};Y8.prototype.pipe=function($){var I=this;if(typeof $.add==="function")I.on("entry",function(U){var Y=$.add(U);if(Y===!1)I.pause()});return JY1.prototype.pipe.apply(this,arguments)};Y8.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};Y8.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};Y8.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Qy=N((oC1,iG0)=>{i Line truncated
actual: `+$._bytesEmitted)}),I.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(MG0),$._read();else $.emit("close")}),I.on("error",function(U){$.emit("error",U)}),$._read()};s3.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var I=$._buffer;for(var U=0,Y=I.length;U<Y;U++){var J=I[U];if(J===NG0)$.emit("end");else if(J===MG0)$.emit("close");else $.emit("data",J);if($._paused){$._buffer=I.slice(U);return}}$._buffer.length=0}};s3.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._stream)I._stream.pause();I.emit("pause",$)};s3.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I.emit("resume",$),I._paused=!1,I._stream)I._stream.resume();I._read()}});var EG0=O((Ej1,TG0)=>{TG0.exports=DL;var GJ1=p0(),PG0=a3();GJ1(DL,PG0);function DL($){var I=this;if(!(I instanceof DL))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);PG0.call(I,$)}DL.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Ey=O((Bj1,BG0)=>{BG0.exports=e3;var Ty=a3(),WJ1=dq(),wJ1=p0(),VJ1=o6();wJ1(e3,Ty);function e3($){var I=this;if(!(I instanceof e3))throw Error("ProxyReader must be called as constructor.");I.props=$,I._buffer=[],I.ready=!1,Ty.call(I,$)}e3.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";VJ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=WJ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(Ty(I,J))})};e3.prototype._addProxy=function($){var I=this;if(I._proxyTarget)return I.error("proxy already set");I._proxyTarget=$,$._proxy=I,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$),$.on("ready",function(){I.ready=!0,I.emit("ready")});var U=I._buffer;I._buffer.length=0,U.forEach(function(Y){$[Y[0]].apply($,Y[1])})};e3.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};e3.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var a3=O((vj1,CG0)=>{CG0.exports=q8;var ZJ1=o6(),zJ1=r("stream").Stream,XJ1=p0(),By=r("path"),vy=dq(),OL=q8.hardLinks={},vG0=LL();XJ1(q8,vG0);var RG0=Ny();function q8($,I){var U=this;if(!(U instanceof q8))return new q8($,I);if(typeof $==="string")$={path:$};var Y,J;if($.type&&typeof $.type==="function")Y=$.type,J=Y;else Y=vy($),J=q8;if(I&&!Y)Y=vy(I),$[Y]=!0,$.type=Y;switch(Y){case"Directory":J=Ay();break;case"Link":case"File":J=Py();break;case"SymbolicLink":J=RG0;break;case"Socket":J=EG0();break;case null:J=Ey();break}if(!(U instanceof J))return new J($);if(vG0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Y,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=By.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=By.basename(U.path),U.dirname=$.dirname=By.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=LJ1;U._stat(I)}function LJ1($,I){return $===I?0:$.toLowerCase()>I.toLowerCase()?1:$.toLowerCase()<I.toLowerCase()?-1:$>I?1:-1}q8.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat";if($)process.nextTick(J.bind(null,null,$));else ZJ1[Y](I._path,J);function J(Q,K){if(Q)return I.error(Q);if(Object.keys(K).forEach(function(Z){U[Z]=K[Z]}),I.size!==void 0&&U.size!==I.size)return I.error("incorrect size");I.size=U.size;var q=vy(U),H=U.hardlinks!==!1;if(H&&q!=="Directory"&&U.nlink&&U.nlink>1){var G=U.dev+":"+U.ino;if(OL[G]===I._path||!OL[G])OL[G]=I._path;else q=I.type=I.props.type="Link",I.Link=I.props.Link=!0,I.linkpath=I.props.linkpath=OL[G],I._stat=I._read=RG0.prototype._read}if(I.type&&I.type!==q)I.error("Unexpected type: "+q);if(I.filter){var W=I._proxy||I;if(!I.filter.call(W,W,U)){if(!I._disowned)I.abort(),I.emit("end"),I.emit("close");return}}var w=["_stat","stat","ready"],V=0;(function Z(){if(I._aborted){I.emit("end"),I.emit("close");return}if(I._paused&&I.type!=="Directory"){I.once("resume",Z);return}var X=w[V++];if(!X)return I._read();I.emit(X,U),Z()})()}};q8.prototype.pipe=function($){var I=this;if(typeof $.add==="function")I.on("entry",function(U){var Y=$.add(U);if(Y===!1)I.pause()});return zJ1.prototype.pipe.apply(this,arguments)};q8.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};q8.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};q8.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var _y=O((Rj1,xG0)=>{x Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);Zw.prototype._finish.call($)}});var wy=N((Zv1,jH0)=>{jH0.exports=G7;var Dy=QJ(),gY1=gq(),yY1=n0(),hY1=Ww(),xY1=r("fs");yY1(G7,Dy);function G7($){var I=this;if(!(I instanceof G7))throw Error("ProxyWriter must be called as constructor.");I.props=$,I._needDrain=!1,Dy.call(I,$)}G7.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";xY1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=gY1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(Dy(I,J))})};G7.prototype._addProxy=function($){var I=this;if(I._proxy)return I.error("proxy already set");I._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$);var U=I._buffer;if(U.forEach(function(Y){$[Y[0]].apply($,Y[1])}),I._buffer.length=0,I._needsDrain)I.emit("drain")};G7.prototype.add=function($){if(hY1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};G7.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};G7.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var QJ=N((Xv1,fH0)=>{fH0.exports=_$;var j$=m6(),kY1=n0(),uY1=Qy(),fY1=Wy(),fq=r("path"),SH0=process.platform==="win32"?0:process.umask(),gH0=gq(),yH0=eD();kY1(_$,yH0);_$.dirmode=parseInt("0777",8)&~SH0;_$.filemode=parseInt("0666",8)&~SH0;var bY1=Zy(),iY1=Xy(),pY1=Ly(),nY1=wy();function _$($,I){var U=this;if(typeof $==="string")$={path:$};var Y=gH0($),J=_$;switch(Y){case"Directory":J=bY1;break;case"File":J=pY1;break;case"Link":case"SymbolicLink":J=iY1;break;case null:default:J=nY1;break}if(!(U instanceof J))return new J($);if(yH0.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=fq.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=fq.basename($.path),U.dirname=fq.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(I)}_$.prototype._create=function(){var $=this;j$[$.props.follow?"stat":"lstat"]($._path,function(I){if(I)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};_$.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat",J=I._proxy||I;if($)Q(null,$);else j$[Y](I._path,Q);function Q(K,q){if(I.filter&&!I.filter.call(J,J,q)){I._aborted=!0,I.emit("end"),I.emit("close");return}if(K||!q)return Oy(I);I._old=q;var G=gH0(q);if(G!==I.type||I.type==="File"&&q.nlink>1)return uY1(I._path,function(H){if(H)return I.error(H);I._old=null,Oy(I)});Oy(I)}};function Oy($){fY1(fq.dirname($._path),_$.dirmode,function(I,U){if(I)return $.error(I);return $._madeDir=U,$._create()})}function hH0($,I,U,Y,J){var Q=I.mode,K=I.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!j$[K])return J();if(typeof Q!=="number")return J();var q=U.mode&parseInt("0777",8);if(Q=Q&parseInt("0777",8),Q===q)return J();j$[K](Y,Q,J)}function xH0($,I,U,Y,J){if(process.platform==="win32")return J();if(!process.getuid||process.getuid()!==0)return J();if(typeof I.uid!=="number"&&typeof I.gid!=="number")return J();if(U.uid===I.uid&&U.gid===I.gid)return J();var Q=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!j$[Q])return J();if(typeof I.uid!=="number")I.uid=U.uid;if(typeof I.gid!=="number")I.gid=U.gid;j$[Q](Y,I.uid,I.gid,J)}function kH0($,I,U,Y,J){if(!j$.utimes||process.platform==="win32")return J();var Q=I.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(Q==="lutimes"&&!j$[Q])Q="utimes";if(!j$[Q])return J();var{atime:K,mtime:q}=U,G=I.atime,H=I.mtime;if(G===void 0)G=K;if(H===void 0)H=q;if(!_H0(G))G=new Date(G);if(!_H0(H))G=new Date(H);if(G.getTime()===K.getTime()&&H.getTime()===q.getTime())return J();j$[Q](Y,G,H,J)}_$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var I=0,U=null,Y=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),Q($._old);else{var J=$.props.follow?"stat":"lstat";j$[J]($._path,function(q,G){if(q)if(q.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(q);Q($._old=G)})}return;function Q(q){I+=3,hH0($,$.props,q,$._path,K("chmod")),xH0($,$.props,q,$._path,K("chown")),kH0($,$.props,q,$._path,K("utimes"))}function K(q){return function(G){if(U)return;if(G)return G.fstream_finish_call=q,$.error(U=G);if(--I>0)return;if(Y)return;if(Y=!0,!$._madeDir)return H();else uH0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function uH0($,I,U){var Y=$._madeDir,J=fq.dirname(I);cY1($,J,function(Q){if(Q)return U(Q);if(J===Y)return U();uH0($,J,U)})}function cY1($,I,U){var Y={};Object.keys($.props).forEach(function(q){if(Y[q]=$.props[q],q==="mode"&&$.type!=="Directory")Y[q]=Y[q]|parseInt("0111",8)});var J=3,Q=null;j$.stat(I,function(q,G){if(q)return U(Q=q);hH0($,Y,G,I,K),xH0($,Y,G,I,K),kH0($,Y,G,I,K)});function K(q){if(Q)return;if(q)return U(Q=q);if(--J===0)return U()}}_$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};_$.prototype.add=function(){this.error("Can't add to non-Directory type")};_$.prototype.write=function(){return!0};function dY1($){return Object.prototype.toString.call($)}function _H0($){return typeof $==="object"&&dY1($)==="[object Date]"}});var Ay=N((mY1)=>{mY1.Abstract=eD();mY1.Reader=p3();mY1.Writer=QJ();mY1.File={Reader:ag(),Writer:Ly()};mY1.Dir={Reader:tg(),Writer:Zy()};mY1.Link={Reader:og(),Writer:Xy()};mY1.Proxy={Reader:eg(),Writer:wy()};mY1.Reader.Dir=mY1.DirReader=mY1.Dir.Reader;mY1.Reader.File=mY1.FileReader=mY1.File.Reader;mY1.Reader.Link=mY1.LinkReader=mY1.Link.Reader;mY1.Reader.Proxy=mY1.ProxyReader=mY1.Proxy.Reader;mY1.Writer.Dir=mY1.DirWriter=mY1.Dir.Writer;mY1.Writer.File=mY1.FileWriter=mY1.File.Writer;mY1.Writer.Link=mY1.LinkWriter=mY1.Link.Writer;mY1.Writer.Proxy=mY1.ProxyWriter=mY1.Proxy.Writer;mY1.collect=Ww()});var iH0=N((Pv1,bH0)=>{bH0.exports=$J1;var rY1=cD(),tY1=Ay().Writer,Py=r("path"),aY1=r("stream"),sY1=dg(),eY1=I7();function $J1($){$.path=Py.resolve(Py.normalize($.path));var I=new rY1($),U=new aY1.Writable({objectMode:!0});U._write=function(J,Q,K){if(J.type=="Directory")return K();var q=Py.join($.path,J.path);if(q.indexOf($.path)!=0)return K();let G=$.getWriter?$.getWriter({path:q}):tY1({path:q});J.pipe(G).on("error",K).on("close",K)};var Y=sY1(I,U);return I.once("crx-header",function(J){Y.crxHeader=J}),I.pipe(U).on("finish",function(){Y.emit("close")}),Y.promise=function(){return new eY1(function(J,Q){Y.on("close",J),Y.on("error",Q)})},Y}});var pH0=N((Tv1,Xw)=>{var h4=function($){var I=1e7,U=7,Y=9007199254740992,J=X(Y),Q="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function q(M,z,j,x){if(typeof M>"u")return q[0];if(typeof z<"u")return+z===10&&!j?T0(M):x$(M,z,j,x);return T0(M)}function G(M,z){this.value=M,this.sign=z,this.isSmall=!1}G.prototype=Object.create(q.prototype);function H(M){this.value=M,this.sign=M<0,this.isSmall=!0}H.prototype=Object.create(q.prototype);function W(M){th Line truncated
actual: `+$._bytesWritten);CL.prototype._finish.call($)}});var ny=O((mj1,BW0)=>{BW0.exports=L7;var by=ZJ(),pJ1=dq(),cJ1=p0(),dJ1=vL(),mJ1=r("fs");cJ1(L7,by);function L7($){var I=this;if(!(I instanceof L7))throw Error("ProxyWriter must be called as constructor.");I.props=$,I._needDrain=!1,by.call(I,$)}L7.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";mJ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=pJ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(by(I,J))})};L7.prototype._addProxy=function($){var I=this;if(I._proxy)return I.error("proxy already set");I._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$);var U=I._buffer;if(U.forEach(function(Y){$[Y[0]].apply($,Y[1])}),I._buffer.length=0,I._needsDrain)I.emit("drain")};L7.prototype.add=function($){if(dJ1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};L7.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};L7.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var ZJ=O((lj1,hW0)=>{hW0.exports=y$;var S$=o6(),lJ1=p0(),oJ1=_y(),rJ1=uy(),aq=r("path"),RW0=process.platform==="win32"?0:process.umask(),CW0=dq(),jW0=LL();lJ1(y$,jW0);y$.dirmode=parseInt("0777",8)&~RW0;y$.filemode=parseInt("0666",8)&~RW0;var tJ1=ky(),aJ1=fy(),sJ1=iy(),eJ1=ny();function y$($,I){var U=this;if(typeof $==="string")$={path:$};var Y=CW0($),J=y$;switch(Y){case"Directory":J=tJ1;break;case"File":J=sJ1;break;case"Link":case"SymbolicLink":J=aJ1;break;case null:default:J=eJ1;break}if(!(U instanceof J))return new J($);if(jW0.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=aq.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=aq.basename($.path),U.dirname=aq.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(I)}y$.prototype._create=function(){var $=this;S$[$.props.follow?"stat":"lstat"]($._path,function(I){if(I)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};y$.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat",J=I._proxy||I;if($)Q(null,$);else S$[Y](I._path,Q);function Q(K,q){if(I.filter&&!I.filter.call(J,J,q)){I._aborted=!0,I.emit("end"),I.emit("close");return}if(K||!q)return py(I);I._old=q;var H=CW0(q);if(H!==I.type||I.type==="File"&&q.nlink>1)return oJ1(I._path,function(G){if(G)return I.error(G);I._old=null,py(I)});py(I)}};function py($){rJ1(aq.dirname($._path),y$.dirmode,function(I,U){if(I)return $.error(I);return $._madeDir=U,$._create()})}function _W0($,I,U,Y,J){var Q=I.mode,K=I.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!S$[K])return J();if(typeof Q!=="number")return J();var q=U.mode&parseInt("0777",8);if(Q=Q&parseInt("0777",8),Q===q)return J();S$[K](Y,Q,J)}function gW0($,I,U,Y,J){if(process.platform==="win32")return J();if(!process.getuid||process.getuid()!==0)return J();if(typeof I.uid!=="number"&&typeof I.gid!=="number")return J();if(U.uid===I.uid&&U.gid===I.gid)return J();var Q=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!S$[Q])return J();if(typeof I.uid!=="number")I.uid=U.uid;if(typeof I.gid!=="number")I.gid=U.gid;S$[Q](Y,I.uid,I.gid,J)}function SW0($,I,U,Y,J){if(!S$.utimes||process.platform==="win32")return J();var Q=I.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(Q==="lutimes"&&!S$[Q])Q="utimes";if(!S$[Q])return J();var{atime:K,mtime:q}=U,H=I.atime,G=I.mtime;if(H===void 0)H=K;if(G===void 0)G=q;if(!vW0(H))H=new Date(H);if(!vW0(G))H=new Date(G);if(H.getTime()===K.getTime()&&G.getTime()===q.getTime())return J();S$[Q](Y,H,G,J)}y$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var I=0,U=null,Y=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),Q($._old);else{var J=$.props.follow?"stat":"lstat";S$[J]($._path,function(q,H){if(q)if(q.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(q);Q($._old=H)})}return;function Q(q){I+=3,_W0($,$.props,q,$._path,K("chmod")),gW0($,$.props,q,$._path,K("chown")),SW0($,$.props,q,$._path,K("utimes"))}function K(q){return function(H){if(U)return;if(H)return H.fstream_finish_call=q,$.error(U=H);if(--I>0)return;if(Y)return;if(Y=!0,!$._madeDir)return G();else yW0($,$._path,G);function G(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function yW0($,I,U){var Y=$._madeDir,J=aq.dirname(I);$Q1($,J,function(Q){if(Q)return U(Q);if(J===Y)return U();yW0($,J,U)})}function $Q1($,I,U){var Y={};Object.keys($.props).forEach(function(q){if(Y[q]=$.props[q],q==="mode"&&$.type!=="Directory")Y[q]=Y[q]|parseInt("0111",8)});var J=3,Q=null;S$.stat(I,function(q,H){if(q)return U(Q=q);_W0($,Y,H,I,K),gW0($,Y,H,I,K),SW0($,Y,H,I,K)});function K(q){if(Q)return;if(q)return U(Q=q);if(--J===0)return U()}}y$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};y$.prototype.add=function(){this.error("Can't add to non-Directory type")};y$.prototype.write=function(){return!0};function IQ1($){return Object.prototype.toString.call($)}function vW0($){return typeof $==="object"&&IQ1($)==="[object Date]"}});var oy=O((UQ1)=>{UQ1.Abstract=LL();UQ1.Reader=a3();UQ1.Writer=ZJ();UQ1.File={Reader:Py(),Writer:iy()};UQ1.Dir={Reader:Ay(),Writer:ky()};UQ1.Link={Reader:Ny(),Writer:fy()};UQ1.Proxy={Reader:Ey(),Writer:ny()};UQ1.Reader.Dir=UQ1.DirReader=UQ1.Dir.Reader;UQ1.Reader.File=UQ1.FileReader=UQ1.File.Reader;UQ1.Reader.Link=UQ1.LinkReader=UQ1.Link.Reader;UQ1.Reader.Proxy=UQ1.ProxyReader=UQ1.Proxy.Reader;UQ1.Writer.Dir=UQ1.DirWriter=UQ1.Dir.Writer;UQ1.Writer.File=UQ1.FileWriter=UQ1.File.Writer;UQ1.Writer.Link=UQ1.LinkWriter=UQ1.Link.Writer;UQ1.Writer.Proxy=UQ1.ProxyWriter=UQ1.Proxy.Writer;UQ1.collect=vL()});var xW0=O((Y_1,uW0)=>{uW0.exports=WQ1;var QQ1=qL(),KQ1=oy().Writer,ry=r("path"),qQ1=r("stream"),HQ1=Dy(),GQ1=G7();function WQ1($){$.path=ry.resolve(ry.normalize($.path));var I=new QQ1($),U=new qQ1.Writable({objectMode:!0});U._write=function(J,Q,K){if(J.type=="Directory")return K();var q=ry.join($.path,J.path);if(q.indexOf($.path)!=0)return K();let H=$.getWriter?$.getWriter({path:q}):KQ1({path:q});J.pipe(H).on("error",K).on("close",K)};var Y=HQ1(I,U);return I.once("crx-header",function(J){Y.crxHeader=J}),I.pipe(U).on("finish",function(){Y.emit("close")}),Y.promise=function(){return new GQ1(function(J,Q){Y.on("close",J),Y.on("error",Q)})},Y}});var kW0=O((J_1,jL)=>{var u4=function($){var I=1e7,U=7,Y=9007199254740992,J=V(Y),Q="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function q(N,M,j,u){if(typeof N>"u")return q[0];if(typeof M<"u")return+M===10&&!j?E0(N):i$(N,M,j,u);return E0(N)}function H(N,M){this.value=N,this.sign=M,this.isSmall=!1}H.prototype=Object.create(q.prototype);function G(N){this.value=N,this.sign=N<0,this.isSmall=!0}G.prototype=Object.create(q.prototype);function W(N){th Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var x1=r("fs"),Fw=r("os"),x4=r("path"),IW0=r("crypto"),f8={fs:x1.constants,os:Fw.constants},QW0=/XXXXXX/,KW0=(f8.O_CREAT||f8.fs.O_CREAT)|(f8.O_EXCL||f8.fs.O_EXCL)|(f8.O_RDWR||f8.fs.O_RDWR),TJ1=Fw.platform()==="win32",EJ1=f8.EBADF||f8.os.errno.EBADF,BJ1=f8.ENOENT||f8.os.errno.ENOENT,qJ=[],qW0=x1.rmdirSync.bind(x1),GW0=!1;function RJ1($,I){return x1.rm($,{recursive:!0},I)}function HW0($){return x1.rmSync($,{recursive:!0})}function Cy($,I){let U=GJ($,I),Y=U[0],J=U[1];kJ1(Y,function(Q,K){if(Q)return J(Q);let q=K.tries;(function G(){try{let H=VW0(K);x1.stat(H,function(W){if(!W){if(q-- >0)return G();return J(Error("Could not get a unique tmp filename, max tries reached "+H))}J(null,H)})}catch(H){J(H)}})()})}function vy($){let I=GJ($),U=I[0],Y=uJ1(U),J=Y.tries;do{let Q=VW0(Y);try{x1.statSync(Q)}catch(K){return Q}}while(J-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function CJ1($,I){let U=GJ($,I),Y=U[0],J=U[1];Cy(Y,function(K,q){if(K)return J(K);x1.open(q,KW0,Y.mode||384,function(H,W){if(H)return J(H);if(Y.discardDescriptor)return x1.close(W,function(X){return J(X,q,void 0,By(q,-1,Y,!1))});else{let V=Y.discardDescriptor||Y.detachDescriptor;J(null,q,W,By(q,V?-1:W,Y,!1))}})})}function vJ1($){let I=GJ($),U=I[0],Y=U.discardDescriptor||U.detachDescriptor,J=vy(U),Q=x1.openSync(J,KW0,U.mode||384);if(U.discardDescriptor)x1.closeSync(Q),Q=void 0;return{name:J,fd:Q,removeCallback:By(J,Y?-1:Q,U,!0)}}function jJ1($,I){let U=GJ($,I),Y=U[0],J=U[1];Cy(Y,function(K,q){if(K)return J(K);x1.mkdir(q,Y.mode||448,function(H){if(H)return J(H);J(null,q,WW0(q,Y,!1))})})}function _J1($){let I=GJ($),U=I[0],Y=vy(U);return x1.mkdirSync(Y,U.mode||448),{name:Y,removeCallback:WW0(Y,U,!0)}}function SJ1($,I){let U=function(Y){if(Y&&!Ry(Y))return I(Y);I()};if(0<=$[0])x1.close($[0],function(){x1.unlink($[1],U)});else x1.unlink($[1],U)}function gJ1($){let I=null;try{if(0<=$[0])x1.closeSync($[0])}catch(U){if(!fJ1(U)&&!Ry(U))throw U}finally{try{x1.unlinkSync($[1])}catch(U){if(!Ry(U))I=U}}if(I!==null)throw I}function By($,I,U,Y){let J=Nw(gJ1,[I,$],Y),Q=Nw(SJ1,[I,$],Y,J);if(!U.keep)qJ.unshift(J);return Y?J:Q}function WW0($,I,U){let Y=I.unsafeCleanup?RJ1:x1.rmdir.bind(x1),J=I.unsafeCleanup?HW0:qW0,Q=Nw(J,$,U),K=Nw(Y,$,U,Q);if(!I.keep)qJ.unshift(Q);return U?Q:K}function Nw($,I,U,Y){let J=!1;return function Q(K){if(!J){let q=Y||Q,G=qJ.indexOf(q);if(G>=0)qJ.splice(G,1);if(J=!0,U||$===qW0||$===HW0)return $(I);else return $(I,K||function(){})}}}function yJ1(){if(!GW0)return;while(qJ.length)try{qJ[0]()}catch($){}}function UW0($){let I=[],U=null;try{U=IW0.randomBytes($)}catch(Y){U=IW0.pseudoRandomBytes($)}for(let Y=0;Y<$;Y++)I.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Y]%62]);return I.join("")}function o6($){return typeof $>"u"}function GJ($,I){if(typeof $==="function")return[{},$];if(o6($))return[{},I];let U={};for(let Y of Object.getOwnPropertyNames($))U[Y]=$[Y];return[U,I]}function hJ1($,I,U){let Y=x4.isAbsolute($)?$:x4.join(I,$);x1.stat(Y,function(J){if(J)x1.realpath(x4.dirname(Y),function(Q,K){if(Q)return U(Q);U(null,x4.join(K,x4.basename(Y)))});else x1.realpath(Y,U)})}function xJ1($,I){let U=x4.isAbsolute($)?$:x4.join(I,$);try{return x1.statSync(U),x1.realpathSync(U)}catch(Y){let J=x1.realpathSync(x4.dirname(U));return x4.join(J,x4.basename(U))}}function VW0($){let I=$.tmpdir;if(!o6($.name))return x4.join(I,$.dir,$.name);if(!o6($.template))return x4.join(I,$.dir,$.template).replace(QW0,UW0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",UW0(12),$.postfix?"-"+$.postfix:""].join("");return x4.join(I,$.dir,U)}function Ey($,I){if(typeof I!=="string")throw Error(`${$} option must be a string, got "${typeof I}".`);if(I.includes(".."))throw Error("Relative value not allowed");return I}function ZW0($){if(!o6($.name)){let I=$.name;if(x4.isAbsolute(I))throw Error(`name option must not contain an absolute path, found "${I}".`);let U=x4.basename(I);if(U===".."||U==="."||U!==I)throw Error(`name option must not contain a path, found "${I}".`)}if(!o6($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(QW0))throw Error(`Invalid template, found "${$.template}".`)}if(!o6($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=o6($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=o6($.prefix)?"":Ey("prefix",$.prefix),$.postfix=o6($.postfix)?"":Ey("postfix",$.postfix),$.template=o6($.template)?void 0:Ey("template",$.template)}function YW0($,I,U,Y){if(o6(I))return Y(null);hJ1(I,U,function(J,Q){if(J)return Y(J);let K=x4.relative(U,Q);if(K.startsWith("..")||x4.isAbsolute(K))return Y(Error(`${$} option must be relative to "${U}", found "${K}".`));Y(null,K)})}function JW0($,I,U){if(o6(I))return;let Y=xJ1(I,U),J=x4.relative(U,Y);if(J.startsWith("..")||x4.isAbsolute(J))throw ELine truncated
*/var x1=r("fs"),uL=r("os"),x4=r("path"),aW0=r("crypto"),b8={fs:x1.constants,os:uL.constants},Iw0=/XXXXXX/,Uw0=(b8.O_CREAT||b8.fs.O_CREAT)|(b8.O_EXCL||b8.fs.O_EXCL)|(b8.O_RDWR||b8.fs.O_RDWR),yQ1=uL.platform()==="win32",hQ1=b8.EBADF||b8.os.errno.EBADF,uQ1=b8.ENOENT||b8.os.errno.ENOENT,XJ=[],Yw0=x1.rmdirSync.bind(x1),Jw0=!1;function xQ1($,I){return x1.rm($,{recursive:!0},I)}function Qw0($){return x1.rmSync($,{recursive:!0})}function $h($,I){let U=LJ($,I),Y=U[0],J=U[1];lQ1(Y,function(Q,K){if(Q)return J(Q);let q=K.tries;(function H(){try{let G=qw0(K);x1.stat(G,function(W){if(!W){if(q-- >0)return H();return J(Error("Could not get a unique tmp filename, max tries reached "+G))}J(null,G)})}catch(G){J(G)}})()})}function Ih($){let I=LJ($),U=I[0],Y=oQ1(U),J=Y.tries;do{let Q=qw0(Y);try{x1.statSync(Q)}catch(K){return Q}}while(J-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function kQ1($,I){let U=LJ($,I),Y=U[0],J=U[1];$h(Y,function(K,q){if(K)return J(K);x1.open(q,Uw0,Y.mode||384,function(G,W){if(G)return J(G);if(Y.discardDescriptor)return x1.close(W,function(V){return J(V,q,void 0,sy(q,-1,Y,!1))});else{let w=Y.discardDescriptor||Y.detachDescriptor;J(null,q,W,sy(q,w?-1:W,Y,!1))}})})}function fQ1($){let I=LJ($),U=I[0],Y=U.discardDescriptor||U.detachDescriptor,J=Ih(U),Q=x1.openSync(J,Uw0,U.mode||384);if(U.discardDescriptor)x1.closeSync(Q),Q=void 0;return{name:J,fd:Q,removeCallback:sy(J,Y?-1:Q,U,!0)}}function iQ1($,I){let U=LJ($,I),Y=U[0],J=U[1];$h(Y,function(K,q){if(K)return J(K);x1.mkdir(q,Y.mode||448,function(G){if(G)return J(G);J(null,q,Kw0(q,Y,!1))})})}function bQ1($){let I=LJ($),U=I[0],Y=Ih(U);return x1.mkdirSync(Y,U.mode||448),{name:Y,removeCallback:Kw0(Y,U,!0)}}function nQ1($,I){let U=function(Y){if(Y&&!ey(Y))return I(Y);I()};if(0<=$[0])x1.close($[0],function(){x1.unlink($[1],U)});else x1.unlink($[1],U)}function pQ1($){let I=null;try{if(0<=$[0])x1.closeSync($[0])}catch(U){if(!rQ1(U)&&!ey(U))throw U}finally{try{x1.unlinkSync($[1])}catch(U){if(!ey(U))I=U}}if(I!==null)throw I}function sy($,I,U,Y){let J=hL(pQ1,[I,$],Y),Q=hL(nQ1,[I,$],Y,J);if(!U.keep)XJ.unshift(J);return Y?J:Q}function Kw0($,I,U){let Y=I.unsafeCleanup?xQ1:x1.rmdir.bind(x1),J=I.unsafeCleanup?Qw0:Yw0,Q=hL(J,$,U),K=hL(Y,$,U,Q);if(!I.keep)XJ.unshift(Q);return U?Q:K}function hL($,I,U,Y){let J=!1;return function Q(K){if(!J){let q=Y||Q,H=XJ.indexOf(q);if(H>=0)XJ.splice(H,1);if(J=!0,U||$===Yw0||$===Qw0)return $(I);else return $(I,K||function(){})}}}function cQ1(){if(!Jw0)return;while(XJ.length)try{XJ[0]()}catch($){}}function sW0($){let I=[],U=null;try{U=aW0.randomBytes($)}catch(Y){U=aW0.pseudoRandomBytes($)}for(let Y=0;Y<$;Y++)I.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Y]%62]);return I.join("")}function t6($){return typeof $>"u"}function LJ($,I){if(typeof $==="function")return[{},$];if(t6($))return[{},I];let U={};for(let Y of Object.getOwnPropertyNames($))U[Y]=$[Y];return[U,I]}function dQ1($,I,U){let Y=x4.isAbsolute($)?$:x4.join(I,$);x1.stat(Y,function(J){if(J)x1.realpath(x4.dirname(Y),function(Q,K){if(Q)return U(Q);U(null,x4.join(K,x4.basename(Y)))});else x1.realpath(Y,U)})}function mQ1($,I){let U=x4.isAbsolute($)?$:x4.join(I,$);try{return x1.statSync(U),x1.realpathSync(U)}catch(Y){let J=x1.realpathSync(x4.dirname(U));return x4.join(J,x4.basename(U))}}function qw0($){let I=$.tmpdir;if(!t6($.name))return x4.join(I,$.dir,$.name);if(!t6($.template))return x4.join(I,$.dir,$.template).replace(Iw0,sW0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",sW0(12),$.postfix?"-"+$.postfix:""].join("");return x4.join(I,$.dir,U)}function ay($,I){if(typeof I!=="string")throw Error(`${$} option must be a string, got "${typeof I}".`);if(I.includes(".."))throw Error("Relative value not allowed");return I}function Hw0($){if(!t6($.name)){let I=$.name;if(x4.isAbsolute(I))throw Error(`name option must not contain an absolute path, found "${I}".`);let U=x4.basename(I);if(U===".."||U==="."||U!==I)throw Error(`name option must not contain a path, found "${I}".`)}if(!t6($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(Iw0))throw Error(`Invalid template, found "${$.template}".`)}if(!t6($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=t6($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=t6($.prefix)?"":ay("prefix",$.prefix),$.postfix=t6($.postfix)?"":ay("postfix",$.postfix),$.template=t6($.template)?void 0:ay("template",$.template)}function eW0($,I,U,Y){if(t6(I))return Y(null);dQ1(I,U,function(J,Q){if(J)return Y(J);let K=x4.relative(U,Q);if(K.startsWith("..")||x4.isAbsolute(K))return Y(Error(`${$} option must be relative to "${U}", found "${K}".`));Y(null,K)})}function $w0($,I,U){if(t6(I))return;let Y=mQ1(I,U),J=x4.relative(U,Y);if(J.startsWith("..")||x4.isAbsolute(J))throw ELine 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 mV0=N((NK1)=>{var Ch=k5().Buffer;NK1._dbcs=f5;var H6=-1,dV0=-2,y$=-10,S6=-1000,FJ=Array(256),aq=-1;for(tq=0;tq<256;tq++)FJ[tq]=H6;var tq;function f5($,I){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]=FJ.slice(0),this.decodeTableSeq=[];for(var Y=0;Y<U.length;Y++)this._addDecodeChunk(U[Y]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var J=this.decodeTables.length;this.decodeTables.push(FJ.slice(0));var Q=this.decodeTables.length;this.decodeTables.push(FJ.slice(0));var K=this.decodeTables[0];for(var Y=129;Y<=254;Y++){var q=this.decodeTables[S6-K[Y]];for(var G=48;G<=57;G++){if(q[G]===H6)q[G]=S6-J;else if(q[G]>S6)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[S6-q[G]];for(var W=129;W<=254;W++){if(H[W]===H6)H[W]=S6-Q;else if(H[W]===S6-Q)continue;else if(H[W]>S6)throw Error("gb18030 decode tables conflict at byte 3");var V=this.decodeTables[S6-H[W]];for(var X=48;X<=57;X++)if(V[X]===H6)V[X]=dV0}}}}this.defaultCharUnicode=I.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var Z={};if($.encodeSkipVals)for(var Y=0;Y<$.encodeSkipVals.length;Y++){var D=$.encodeSkipVals[Y];if(typeof D==="number")Z[D]=!0;else for(var G=D.from;G<=D.to;G++)Z[G]=!0}if(this._fillEncodeTable(0,0,Z),$.encodeAdd){for(var w in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,w))this._setEncodeChar(w.charCodeAt(0),$.encodeAdd[w])}if(this.defCharSB=this.encodeTable[0][I.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===H6)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===H6)this.defCharSB=63}f5.prototype.encoder=pw;f5.prototype.decoder=vh;f5.prototype._getDecodeTrieNode=function($){var I=[];for(;$>0;$>>>=8)I.push($&255);if(I.length==0)I.push(0);var U=this.decodeTables[0];for(var Y=I.length-1;Y>0;Y--){var J=U[I[Y]];if(J==H6)U[I[Y]]=S6-this.decodeTables.length,this.decodeTables.push(U=FJ.slice(0));else if(J<=S6)U=this.decodeTables[S6-J];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};f5.prototype._addDecodeChunk=function($){var I=parseInt($[0],16),U=this._getDecodeTrieNode(I);I=I&255;for(var Y=1;Y<$.length;Y++){var J=$[Y];if(typeof J==="string")for(var Q=0;Q<J.length;){var K=J.charCodeAt(Q++);if(K>=55296&&K<56320){var q=J.charCodeAt(Q++);if(q>=56320&&q<57344)U[I++]=65536+(K-55296)*1024+(q-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var G=4095-K+2,H=[];for(var W=0;W<G;W++)H.push(J.charCodeAt(Q++));U[I++]=y$-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[I++]=K}else if(typeof J==="number"){var V=U[I-1]+1;for(var Q=0;Q<J;Q++)U[I++]=V++}else throw Error("Incorrect type '"+typeof J+"' given in "+this.encodingName+" at chunk "+$[0])}if(I>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`)}var LI=($)=>(I,U,Y,J)=>{let Q=Y?{...Y,async:!1}:{async:!1},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)throw new Q8;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((G)=>A6(G,Q,Z4())));throw xG(q,J?.callee),q}return K.value},bJ=LI(h6),DI=($)=>async(I,U,Y,J)=>{let Q=Y?{...Y,async:!0}:{async:!0},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)K=await K;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((G)=>A6(G,Q,Z4())));throw xG(q,J?.callee),q}return K.value},iJ=DI(h6),wI=($)=>(I,U,Y)=>{let J=Y?{...Y,async:!1}:{async:!1},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)throw new Q8;return Q.issues.length?{success:!1,error:new($??kJ)(Q.issues.map((K)=>A6(K,J,Z4())))}:{success:!0,data:Q.value}},OI=wI(h6),NI=($)=>async(I,U,Y)=>{let J=Y?{...Y,async:!0}:{async:!0},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((K)=>A6(K,J,Z4())))}:{success:!0,data:Q.value}},pJ=NI(h6),kG=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return LI($)(I,U,J)},Kk=kG(h6),uG=($)=>(I,U,Y)=>{return LI($)(I,U,Y)},qk=uG(h6),fG=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return DI($)(I,U,J)},Gk=fG(h6),bG=($)=>async(I,U,Y)=>{return DI($)(I,U,Y)},Hk=bG(h6),iG=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return wI($)(I,U,J)},Wk=iG(h6),pG=($)=>(I,U,Y)=>{return wI($)(I,U,Y)},Vk=pG(h6),nG=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return NI($)(I,U,J)},Zk=nG(h6),cG=($)=>async(I,U,Y)=>{return NI($)(I,U,Y)},Xk=cG(h6);var e6={};m8(e6,{xid:()=>iO,uuid7:()=>kD0,uuid6:()=>xD0,uuid4:()=>hD0,uuid:()=>M7,uppercase:()=>ZN,unicodeEmail:()=>Lk,undefined:()=>WN,ulid:()=>bO,time:()=>YN,string:()=>QN,sha512_hex:()=>Jw0,sha512_base64url:()=>Kw0,sha512_base64:()=>Qw0,sha384_hex:()=>Iw0,sha384_base64url:()=>Yw0,sha384_base64:()=>Uw0,sha256_hex:()=>sD0,sha256_base64url:()=>$w0,sha256_base64:()=>eD0,sha1_hex:()=>rD0,sha1_base64url:()=>aD0,sha1_base64:()=>tD0,rfc5322Email:()=>fD0,number:()=>nJ,null:()=>HN,nanoid:()=>nO,md5_hex:()=>mD0,md5_base64url:()=>oD0,md5_base64:()=>lD0,mac:()=>tO,lowercase:()=>VN,ksuid:()=>pO,ipv6:()=>rO,ipv4:()=>oO,integer:()=>qN,idnEmail:()=>bD0,httpProtocol:()=>$N,html5Email:()=>uD0,hostname:()=>nD0,hex:()=>dD0,guid:()=>dO,extendedDuration:()=>yD0,emoji:()=>lO,email:()=>mO,e164:()=>IN,duration:()=>cO,domain:()=>cD0,datetime:()=>JN,date:()=>UN,cuid2:()=>fO,cuid:()=>uO,cidrv6:()=>sO,cidrv4:()=>aO,browserEmail:()=>iD0,boolean:()=>GN,bigint:()=>KN,base64url:()=>dG,base64:()=>eO});var uO=/^[cC][0-9a-z]{6,}$/,fO=/^[0-9a-z]+$/,bO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,iO=/^[0-9a-vA-V]{20}$/,pO=/^[A-Za-z0-9]{27}$/,nO=/^[a-zA-Z0-9_-]{21}$/,cO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yD0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,dO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,M7=($)=>{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})$`)},hD0=M7(4),xD0=M7(6),kD0=M7(7),mO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,uD0=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,fD0=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,Lk=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,bD0=Lk,iD0=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,pD0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function lO(){return new RegExp(pD0,"u")}var oO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tO=($)=>{let I=L$($??":");return new RegExp(`^(?:[0-9A-F]{2}${I}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${I}){5}[0-9a-f]{2}$`)},aO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0Line 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{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var cV0=O((Rq1)=>{var Uu=c5().Buffer;Rq1._dbcs=m5;var W6=-1,pV0=-2,k$=-10,h6=-1000,RJ=Array(256),GH=-1;for(HH=0;HH<256;HH++)RJ[HH]=W6;var HH;function m5($,I){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]=RJ.slice(0),this.decodeTableSeq=[];for(var Y=0;Y<U.length;Y++)this._addDecodeChunk(U[Y]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var J=this.decodeTables.length;this.decodeTables.push(RJ.slice(0));var Q=this.decodeTables.length;this.decodeTables.push(RJ.slice(0));var K=this.decodeTables[0];for(var Y=129;Y<=254;Y++){var q=this.decodeTables[h6-K[Y]];for(var H=48;H<=57;H++){if(q[H]===W6)q[H]=h6-J;else if(q[H]>h6)throw Error("gb18030 decode tables conflict at byte 2");var G=this.decodeTables[h6-q[H]];for(var W=129;W<=254;W++){if(G[W]===W6)G[W]=h6-Q;else if(G[W]===h6-Q)continue;else if(G[W]>h6)throw Error("gb18030 decode tables conflict at byte 3");var w=this.decodeTables[h6-G[W]];for(var V=48;V<=57;V++)if(w[V]===W6)w[V]=pV0}}}}this.defaultCharUnicode=I.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var Z={};if($.encodeSkipVals)for(var Y=0;Y<$.encodeSkipVals.length;Y++){var X=$.encodeSkipVals[Y];if(typeof X==="number")Z[X]=!0;else for(var H=X.from;H<=X.to;H++)Z[H]=!0}if(this._fillEncodeTable(0,0,Z),$.encodeAdd){for(var L in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,L))this._setEncodeChar(L.charCodeAt(0),$.encodeAdd[L])}if(this.defCharSB=this.encodeTable[0][I.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===W6)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===W6)this.defCharSB=63}m5.prototype.encoder=HD;m5.prototype.decoder=Yu;m5.prototype._getDecodeTrieNode=function($){var I=[];for(;$>0;$>>>=8)I.push($&255);if(I.length==0)I.push(0);var U=this.decodeTables[0];for(var Y=I.length-1;Y>0;Y--){var J=U[I[Y]];if(J==W6)U[I[Y]]=h6-this.decodeTables.length,this.decodeTables.push(U=RJ.slice(0));else if(J<=h6)U=this.decodeTables[h6-J];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};m5.prototype._addDecodeChunk=function($){var I=parseInt($[0],16),U=this._getDecodeTrieNode(I);I=I&255;for(var Y=1;Y<$.length;Y++){var J=$[Y];if(typeof J==="string")for(var Q=0;Q<J.length;){var K=J.charCodeAt(Q++);if(K>=55296&&K<56320){var q=J.charCodeAt(Q++);if(q>=56320&&q<57344)U[I++]=65536+(K-55296)*1024+(q-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var H=4095-K+2,G=[];for(var W=0;W<H;W++)G.push(J.charCodeAt(Q++));U[I++]=k$-this.decodeTableSeq.length,this.decodeTableSeq.push(G)}else U[I++]=K}else if(typeof J==="number"){var w=U[I-1]+1;for(var Q=0;Q<J;Q++)U[I++]=w++}else throw Error("Incorrect type '"+typeof J+"' given in "+this.encodingName+" at chunk "+$[0])}if(I>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`)}var AI=($)=>(I,U,Y,J)=>{let Q=Y?{...Y,async:!1}:{async:!1},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)throw new H8;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>P6(H,Q,Z4())));throw rH(q,J?.callee),q}return K.value},rJ=AI(k6),PI=($)=>async(I,U,Y,J)=>{let Q=Y?{...Y,async:!0}:{async:!0},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)K=await K;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>P6(H,Q,Z4())));throw rH(q,J?.callee),q}return K.value},tJ=PI(k6),TI=($)=>(I,U,Y)=>{let J=Y?{...Y,async:!1}:{async:!1},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)throw new H8;return Q.issues.length?{success:!1,error:new($??mJ)(Q.issues.map((K)=>P6(K,J,Z4())))}:{success:!0,data:Q.value}},EI=TI(k6),BI=($)=>async(I,U,Y)=>{let J=Y?{...Y,async:!0}:{async:!0},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((K)=>P6(K,J,Z4())))}:{success:!0,data:Q.value}},aJ=BI(k6),tH=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return AI($)(I,U,J)},yx=tH(k6),aH=($)=>(I,U,Y)=>{return AI($)(I,U,Y)},hx=aH(k6),sH=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return PI($)(I,U,J)},ux=sH(k6),eH=($)=>async(I,U,Y)=>{return PI($)(I,U,Y)},xx=eH(k6),$G=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return TI($)(I,U,J)},kx=$G(k6),IG=($)=>(I,U,Y)=>{return TI($)(I,U,Y)},fx=IG(k6),UG=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return BI($)(I,U,J)},ix=UG(k6),YG=($)=>async(I,U,Y)=>{return BI($)(I,U,Y)},bx=YG(k6);var I$={};s8(I$,{xid:()=>wO,uuid7:()=>pL0,uuid6:()=>nL0,uuid4:()=>bL0,uuid:()=>C7,uppercase:()=>uO,unicodeEmail:()=>nx,undefined:()=>yO,ulid:()=>WO,time:()=>vO,string:()=>CO,sha512_hex:()=>WD0,sha512_base64url:()=>VD0,sha512_base64:()=>wD0,sha384_hex:()=>qD0,sha384_base64url:()=>GD0,sha384_base64:()=>HD0,sha256_hex:()=>JD0,sha256_base64url:()=>KD0,sha256_base64:()=>QD0,sha1_hex:()=>ID0,sha1_base64url:()=>YD0,sha1_base64:()=>UD0,rfc5322Email:()=>dL0,number:()=>sJ,null:()=>SO,nanoid:()=>ZO,md5_hex:()=>sL0,md5_base64url:()=>$D0,md5_base64:()=>eL0,mac:()=>NO,lowercase:()=>hO,ksuid:()=>VO,ipv6:()=>FO,ipv4:()=>OO,integer:()=>_O,idnEmail:()=>mL0,httpProtocol:()=>TO,html5Email:()=>cL0,hostname:()=>rL0,hex:()=>aL0,guid:()=>XO,extendedDuration:()=>iL0,emoji:()=>DO,email:()=>LO,e164:()=>EO,duration:()=>zO,domain:()=>tL0,datetime:()=>RO,date:()=>BO,cuid2:()=>GO,cuid:()=>HO,cidrv6:()=>AO,cidrv4:()=>MO,browserEmail:()=>lL0,boolean:()=>gO,bigint:()=>jO,base64url:()=>JG,base64:()=>PO});var HO=/^[cC][0-9a-z]{6,}$/,GO=/^[0-9a-z]+$/,WO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wO=/^[0-9a-vA-V]{20}$/,VO=/^[A-Za-z0-9]{27}$/,ZO=/^[a-zA-Z0-9_-]{21}$/,zO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iL0=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,XO=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,C7=($)=>{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})$`)},bL0=C7(4),nL0=C7(6),pL0=C7(7),LO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cL0=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,dL0=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,nx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mL0=nx,lL0=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,oL0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function DO(){return new RegExp(oL0,"u")}var OO=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,FO=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,NO=($)=>{let I=O$($??":");return new RegExp(`^(?:[0-9A-F]{2}${I}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${I}){5}[0-9a-f]{2}$`)},MO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0Line truncated
`).filter((Q)=>Q),Y=Math.min(...U.map((Q)=>Q.length-Q.trimStart().length)),J=U.map((Q)=>Q.slice(Y)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of J)this.content.push(Q)}compile(){let $=Function,I=this?.args,Y=[...(this?.content??[""]).map((J)=>` ${J}`)];return new $(...I,Y.join(`
`))}}var _N={major:4,minor:4,patch:3};var i0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_N;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,G)=>{let H=o5(K),W;for(let V of q){if(V._zod.def.when){if(hO(K))continue;if(!V._zod.def.when(K))continue}else if(H)continue;let X=K.issues.length,Z=V._zod.check(K);if(Z instanceof Promise&&G?.async===!1)throw new Q8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===X)return;if(!H)H=o5(K,X)});else{if(K.issues.length===X)continue;if(!H)H=o5(K,X)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,G)=>{if(o5(K))return K.aborted=!0,K;let H=J(q,Y,G);if(H instanceof Promise){if(G.async===!1)throw new Q8;return H.then((W)=>$._zod.parse(W,G))}return $._zod.parse(H,G)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let H=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(H instanceof Promise)return H.then((W)=>{return Q(W,K,q)});return Q(H,K,q)}let G=$._zod.parse(K,q);if(G instanceof Promise){if(q.async===!1)throw new Q8;return G.then((H)=>J(H,Y,q))}return J(G,Y,q)}}a0($,"~standard",()=>({validate:(J)=>{try{let Q=OI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return pJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),z7=o("$ZodString",($,I)=>{i0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??QN($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),S1=o("$ZodStringFormat",($,I)=>{FI.init($,I),z7.init($,I)}),gN=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=dO),S1.init($,I)}),yN=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`Invalid UUID version: "${I.version}"`);I.pattern??(I.pattern=M7(Y))}else I.pattern??(I.pattern=M7());S1.init($,I)}),hN=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mO),S1.init($,I)}),xN=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===$N.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),kN=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=lO()),S1.init($,I)}),uN=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=nO),S1.init($,I)}),fN=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=uO),S1.init($,I)}),bN=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=fO),S1.init($,I)}),iN=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=bO),S1.init($,I)}),pN=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=iO),S1.init($,I)}),nN=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=pO),S1.init($,I)}),cN=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=JN(I)),S1.init($,I)}),dN=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=UN),S1.init($,I)}),mN=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=YN(I)),S1.init($,I)}),lN=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=cO),S1.init($,I)}),oN=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=oO),S1.init($,I),$._zod.bag.format="ipv4"}),rN=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=rO),S1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),tN=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=tO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),aN=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=aO),S1.init($,I)}),sN=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=sO),S1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function eN($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}} Line truncated
if (${T}.issues.length) {
if (${C} in input) {
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
`))}}var IF={major:4,minor:4,patch:3};var b0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=IF;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,H)=>{let G=I9(K),W;for(let w of q){if(w._zod.def.when){if(QO(K))continue;if(!w._zod.def.when(K))continue}else if(G)continue;let V=K.issues.length,Z=w._zod.check(K);if(Z instanceof Promise&&H?.async===!1)throw new H8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===V)return;if(!G)G=I9(K,V)});else{if(K.issues.length===V)continue;if(!G)G=I9(K,V)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,H)=>{if(I9(K))return K.aborted=!0,K;let G=J(q,Y,H);if(G instanceof Promise){if(H.async===!1)throw new H8;return G.then((W)=>$._zod.parse(W,H))}return $._zod.parse(G,H)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let G=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(G instanceof Promise)return G.then((W)=>{return Q(W,K,q)});return Q(G,K,q)}let H=$._zod.parse(K,q);if(H instanceof Promise){if(q.async===!1)throw new H8;return H.then((G)=>J(G,Y,q))}return J(H,Y,q)}}e0($,"~standard",()=>({validate:(J)=>{try{let Q=EI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return aJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),j7=o("$ZodString",($,I)=>{b0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??CO($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),S1=o("$ZodStringFormat",($,I)=>{vI.init($,I),j7.init($,I)}),YF=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=XO),S1.init($,I)}),JF=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`Invalid UUID version: "${I.version}"`);I.pattern??(I.pattern=C7(Y))}else I.pattern??(I.pattern=C7());S1.init($,I)}),QF=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=LO),S1.init($,I)}),KF=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===TO.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),qF=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=DO()),S1.init($,I)}),HF=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=ZO),S1.init($,I)}),GF=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=HO),S1.init($,I)}),WF=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=GO),S1.init($,I)}),wF=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=WO),S1.init($,I)}),VF=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=wO),S1.init($,I)}),ZF=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=VO),S1.init($,I)}),zF=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=RO(I)),S1.init($,I)}),XF=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=BO),S1.init($,I)}),LF=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=vO(I)),S1.init($,I)}),DF=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=zO),S1.init($,I)}),OF=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=OO),S1.init($,I),$._zod.bag.format="ipv4"}),FF=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=FO),S1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),NF=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=NO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),MF=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=MO),S1.init($,I)}),AF=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=AO),S1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function PF($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}} Line truncated
if (${A}.issues.length) {
if (${R} in input) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
...iss,
path: iss.path ? [${C}, ...iss.path] : [${C}]
path: iss.path ? [${R}, ...iss.path] : [${R}]
})));
}
}
if (${T}.value === undefined) {
if (${C} in input) {
newResult[${C}] = undefined;
if (${A}.value === undefined) {
if (${R} in input) {
newResult[${R}] = undefined;
}
} else {
newResult[${C}] = ${T}.value;
newResult[${R}] = ${A}.value;
}
`);else if(!g)Z.write(`
const ${T}_present = ${C} in input;
if (${T}.issues.length) {
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
`);else if(!S)Z.write(`
const ${A}_present = ${R} in input;
if (${A}.issues.length) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
...iss,
path: iss.path ? [${C}, ...iss.path] : [${C}]
path: iss.path ? [${R}, ...iss.path] : [${R}]
})));
}
if (!${T}_present && !${T}.issues.length) {
if (!${A}_present && !${A}.issues.length) {
payload.issues.push({
code: "invalid_type",
expected: "nonoptional",
input: undefined,
path: [${C}]
path: [${R}]
});
}
if (${T}_present) {
if (${T}.value === undefined) {
newResult[${C}] = undefined;
if (${A}_present) {
if (${A}.value === undefined) {
newResult[${R}] = undefined;
} else {
newResult[${C}] = ${T}.value;
newResult[${R}] = ${A}.value;
}
}
`);else Z.write(`
if (${T}.issues.length) {
payload.issues = payload.issues.concat(${T}.issues.map(iss => ({
if (${A}.issues.length) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
...iss,
path: iss.path ? [${C}, ...iss.path] : [${C}]
path: iss.path ? [${R}, ...iss.path] : [${R}]
})));
}
if (${T}.value === undefined) {
if (${C} in input) {
newResult[${C}] = undefined;
if (${A}.value === undefined) {
if (${R} in input) {
newResult[${R}] = undefined;
}
} else {
newResult[${C}] = ${T}.value;
newResult[${R}] = ${A}.value;
}
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(A,T)=>E(X,A,T)},Q,K=F7,q=!O7.jitless,H=q&&vO.value,W=I.catchall,V;$._zod.parse=(X,Z)=>{V??(V=Y.value);let D=X.value;if(!K(D))return X.issues.push({expected:"object",code:"invalid_type",input:D,inst:$}),X;if(q&&H&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(X=Q(X,Z),!W)return X;return kk([],D,X,Z,V,$)}return U(X,Z)}});function zk($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!o5(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))}),I}var lJ=o("$ZodUnion",($,I)=>{i0.init($,I),a0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),a0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),a0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),a0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>gJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!Q)return zk(K,Y,$,J);return Promise.all(K).then((q)=>{return zk(q,Y,$,J)})}});function Ak($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>A6(K,Y,Z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var OF=o("$ZodXor",($,I)=>{lJ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let G=q._zod.run({value:Y.value,issues:[]},J);if(G instanceof Promise)K.push(G),Q=!0;else K.push(G)}if(!Q)return Ak(K,Y,$,J);return Promise.all(K).then((q)=>{return Ak(q,Y,$,J)})}}),NF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,lJ.init($,I);let U=$._zod.parse;a0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(Q)}"`);for(let[q,G]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let H of G)J[q].add(H)}}return J});let Y=ZI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(K)}"`);for(let G of q){if(Q.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);Q.set(G,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!F7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),FF=o("$ZodIntersection",($,I)=>{i0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([G,H])=>{return Pk(U,G,H)});return Pk(U,Q,K)}});function SN($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(l5($)&&l5(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=SN($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=SN(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Pk($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let G of q.keys){if(!Y.has(G))Y.set(G,{});Y.get(G).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(o5($))return $;let K=SN(I.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var IH=o("$ZodTuple",($,I)=>{i0. Line truncated
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(T,A)=>E(V,T,A)},Q,K=R7,q=!B7.jitless,G=q&&eD.value,W=I.catchall,w;$._zod.parse=(V,Z)=>{w??(w=Y.value);let X=V.value;if(!K(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(q&&G&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(V=Q(V,Z),!W)return V;return wk([],X,V,Z,w,$)}return U(V,Z)}});function rx($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!I9(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>P6(K,Y,Z4())))}),I}var UQ=o("$ZodUnion",($,I)=>{b0.init($,I),e0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),e0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),e0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),e0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>nJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else{if(H.issues.length===0)return H;K.push(H)}}if(!Q)return rx(K,Y,$,J);return Promise.all(K).then((q)=>{return rx(q,Y,$,J)})}});function tx($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>P6(K,Y,Z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var bF=o("$ZodXor",($,I)=>{UQ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else K.push(H)}if(!Q)return tx(K,Y,$,J);return Promise.all(K).then((q)=>{return tx(q,Y,$,J)})}}),nF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,UQ.init($,I);let U=$._zod.parse;e0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(Q)}"`);for(let[q,H]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let G of H)J[q].add(G)}}return J});let Y=NI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(K)}"`);for(let H of q){if(Q.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);Q.set(H,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!R7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),pF=o("$ZodIntersection",($,I)=>{b0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([H,G])=>{return ax(U,H,G)});return ax(U,Q,K)}});function UF($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if($9($)&&$9(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=UF($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=UF(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function ax($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(I9($))return $;let K=UF(I.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var zG=o("$ZodTuple",($,I)=>{b0. Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let q=K[1];if(I===K[0]){Q(K);continue}if($.external){let H=$.external.registry.get(K[0])?.id;if(I!==K[0]&&H){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}function e5($,I){let U=$.seen.get(I);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let G=$.seen.get(q);if(G.ref===null)return;let H=G.def??G.schema,W={...H},V=G.ref;if(G.ref=null,V){Y(V);let Z=$.seen.get(V),D=Z.schema;if(D.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(D);else Object.assign(H,D);if(Object.assign(H,W),q._zod.parent===V)for(let O in H){if(O==="$ref"||O==="allOf")continue;if(!(O in W))delete H[O]}if(D.$ref&&Z.def)for(let O in H){if(O==="$ref"||O==="allOf")continue;if(O in Z.def&&JSON.stringify(H[O])===JSON.stringify(Z.def[O]))delete H[O]}}let X=q._zod.parent;if(X&&X!==V){Y(X);let Z=$.seen.get(X);if(Z?.schema.$ref){if(H.$ref=Z.schema.$ref,Z.def)for(let D in H){if(D==="$ref"||D==="allOf")continue;if(D in Z.def&&JSON.stringify(H[D])===JSON.stringify(Z.def[D]))delete H[D]}}}$.override({zodSchema:q,jsonSchema:H,path:G.path??[]})};for(let q of[...$.seen.entries()].reverse())Y(q[0]);let J={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let q=$.external.registry.get(I)?.id;if(!q)throw Error("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);let Q=$.metadataRegistry.get(I)?.id;if(Q!==void 0&&J.id===Q)delete J.id;let K=$.external?.defs??{};for(let q of $.seen.entries()){let G=q[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;K[G.defId]=G.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;else J.definitions=K;try{let q=JSON.parse(JSON.stringify(J));return Object.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:yI(I,"input",$.processors),output:yI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function T6($,I){let U=I??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Y=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return T6(Y.element,U);if(Y.type==="set")return T6(Y.valueType,U);if(Y.type==="lazy")return T6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return T6(Y.innerType,U);if(Y.type==="intersection")return T6(Y.left,U)||T6(Y.right,U);if(Y.type==="record"||Y.type==="map")return T6(Y.keyType,U)||T6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return T6(Y.in,U)||T6(Y.out,U)}if(Y.type==="object"){for(let J in Y.shape)if(T6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(let J of Y.options)if(T6(J,U))return!0;return!1}if(Y.type==="tuple"){for(let J of Y.items)if(T6(J,U))return!0;if(Y.rest&&T6(Y.rest,U))return!0;return!1}return!1}var Ez=($,I={})=>(U)=>{let Y=a5({...U,processors:I});return v1($,Y),s5(Y,$),e5(Y,$)},yI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=a5({...J??{},target:Q,io:I,processors:U});return v1($,K),s5(K,$),e5(K,$)};var CO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Bz=($,I,U,Y)=>{let J=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof Q==="number")J.minLength=Q;if(typeof K==="number")J.maxLength=K;if(q){if(J.format=CO0[q]??q,J.format==="")delete J.format;if(q==="time")delete J.format}if(H)J.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)J.pattern=W[0].source;else if(W.length>1)J.allOf=[...W.map((V)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:V.source}))]}},Rz=($,I,U,Y)=>{let J=U,{minimum:Q,maximum:K,format:q,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof q==="string"&&q.includes("int"))J.type="integer";else J.type="number";let V=typeof W==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),X=typeof H==="number"&&H<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(V)if(Z)J.minimum=W,J.exclusiveMinimum=!0;else J.exclusiveMinimum=W;else if(typeof Q==="number")J.minimum=Q;if(X)if(Z)J.maximum=H,J.exclusiveMaximum=!0;else J.exclusiveMaximum=H;else if(typeof K==="number")J.maximum=K;if(typeof G==="number")J.multipleOf=G},Cz=($,I,U,Y)=>{U.type="boolean"},vz=($,I,U,Y)=>{if(I.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},jz=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`);if($===-1)return null;let I=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),tR0(I)}clear(){this._buffer=void 0}}function tR0($){return Lf.parse(JSON.parse($))}function Zc($){return JSON.stringify($)+`
`}class nT{constructor($=Xc.stdin,I=Xc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new pT,this._started=!1,this._ondata=(U)=>{this._readBuffer.append(U),this.processReadBuffer()},this._onerror=(U)=>{this.onerror?.(U)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((I)=>{let U=Zc($);if(this._stdout.write(U))I();else this._stdout.once("drain",I)})}}import{dirname as wx,join as jG1}from"node:path";import{fileURLToPath as _G1}from"node:url";class I5 extends Error{name="KyError";get isKyError(){return!0}}class i6 extends I5{name="HTTPError";response;request;options;data;constructor($,I,U){let Y=$.status||$.status===0?$.status:"",J=$.statusText??"",Q=`${Y} ${J}`.trim(),K=Q?`status code ${Q}`:"an unknown error";super(`Request failed with ${K}: ${I.method} ${I.url}`);this.response=$,this.request=I,this.options=U}}class aQ extends I5{name="NetworkError";request;constructor($,I){super(`Request failed due to a network error: ${$.method} ${$.url}`,I);this.request=$}}class sQ extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class qU extends I5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new sQ($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class cT extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class c$ extends I5{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}var dT=(()=>{let $=!1,I=!1,U=typeof globalThis.ReadableStream==="function",Y=typeof globalThis.Request==="function";if(U&&Y)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(J){if(J instanceof Error&&J.message==="unsupported BodyInit type")return!1;throw J}return $&&!I})(),Lc=typeof globalThis.AbortController==="function",qV=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",Dc=typeof globalThis.ReadableStream==="function",wc=typeof globalThis.FormData==="function",GV=["get","post","put","patch","head","delete"],aR0=()=>{return};aR0();var Oc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},GU=2147483647,Nc=40,HV=Symbol("stop");class WV{options;constructor($){this.options=$}}var Fc=($)=>new WV($),Mc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},zc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var VV=new TextEncoder,sR0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[U,Y]of $)I+=Nc,I+=VV.encode(`Content-Disposition: form-data; name="${U}"`).byteLength,I+=typeof Y==="string"?VV.encode(Y).byteLength:Y.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return VV.encode($).byteLength;if($ instanceof URLSearchParams)return VV.encode($.toString()).byteLength;return 0},Ac=($,I,U)=>{let Y,J=0;return $.pipeThrough(new TransformStream({transform(Q,K){if(K.enqueue(Q),Y){J+=Y.byteLength;let q=I===0?0:J/I;if(q>=1)q=1-Number.EPSILON;U?.({percent:q,totalBytes:Math.max(I,J),transferredBytes:J},Y)}Y=Q},flush(){if(Y)J+=Y.byteLength,U?.({percent:1,totalBytes:Math.max(I,J),transferredBytes:J},Y)}}))},Pc=($,I)=>{if(!$.body)return $;let U={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,U);let Y=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(Ac($.body,Y,I),U)},Tc=($,I,U)=>{if(!$.body)return $;let Y=sR0(U??$.body);return new Request($,{duplex:"half",body:Ac($.body,Y,I)})};var Z8=($)=>$!==null&&typeof $==="object";var eR0=Symbol("replaceOption"),mT=($)=>Z8($)&&$[eR0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var $2=(...$)=>{for(let I of $)if( Line truncated
`,{mode:384}),I}function WJ($,I,U=[]){let Y=I.corpId?.trim()||void 0,J=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,Q=Y??J;if(Q){let q=$.find((G)=>G.id===Q);if(q)return q;throw Error(`No enterprise config found for ${Q}`)}if(!I.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 K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{readFileSync as Uq1}from"node:fs";import{randomBytes as Yq1}from"node:crypto";var sW0=300000,tW0=new Map;function bQ1($,I){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>I?U:U.toLowerCase())}function iQ1($,I){return I?$:$.toLowerCase()}function pQ1($,I,U,Y){let J=iQ1($,Y),Q=I.filter((K)=>J.includes(K));if(U==="all"&&Q.length!==I.length)return[];return Q}function nQ1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function cQ1($,I){if(I.fields&&!I.fields.has($.field))return[];let U=nQ1($.value),Y=[];return U.forEach((J,Q)=>{let K=pQ1(J,I.keywords,I.matchMode,I.caseSensitive);if(K.length===0)return;let q=Math.max(0,Q-I.contextLines),G=Math.min(U.length,Q+I.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:K,matchedText:Rw(J,I.maxChars),context:{before:I.snippetOnly?[]:U.slice(q,Q).map((W)=>Rw(W,I.maxChars)),line:Rw(J,I.maxChars),after:I.snippetOnly?[]:U.slice(Q+1,G).map((W)=>Rw(W,I.maxChars))},metadata:$.metadata};if(I.snippetOnly)H.context={before:[],line:H.context.line,after:[]};Y.push(H)}),Y}function Rw($,I){if(!I||$.length<=I)return $;return`${$.slice(0,Math.max(0,I))}...`}function dQ1($){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 aW0($){return $.rules.flatMap((I,U)=>{let Y=`${$.id}:${I.description.slice(0,32)}`,J={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:I.scope,strictness:I.strictness,code:"code"in I?I.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.description",value:I.description,metadata:J},{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.scope",value:I.scope,metadata:J}]})}function mQ1($){return[{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"title",value:$.title,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"purpose",value:$.purpose,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"content",value:$.content,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}}]}function lQ1($){let I=[];if($.decisionPreferences)for(let[U,Y]of Object.entries($.decisionPreferences))I.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${U}`,value:Y,metadata:{integrationSystem:$.integrationSystem}});return $.integrations.forEach((U,Y)=>{I.push({area:"preferences",entityType:"integration",title:U.outboundName,field:`integrations[${Y}]`,value:U,metadata:{type:U.type,outboundName:U.outboundName,mode:U.mode,corporationId:U.corporationId}})}),I}async function oQ1($,I,U){let Y=U.ruleVersionScope??"current",J=[I.id,`ruleVersionScope=${Y}`,`ruleVersionId=${U.ruleVersionId??""}`,`ruleVersionNumber=${U.ruleVersionNumber??""}`,`latestRuleVersion=${U.latestRuleVersion??!1}`,`documentLimit=${U.documentLimit??100}`].join("|"),Q=tW0.get(J);if(!U.refresh&&Q&&Date.now()<Q.expiresAt)return Q;let[K,q,G]=await Promise.all([rQ1($,{scope:Y,versionId:U.ruleVersionId,versionNumber:U.ruleVersionNumber,latest:U.latestRuleVersion}),W2($,{limit:U.documentLimit??100}),q4($,I.seal.endpoints.approvalStylePreferences)]),H=Date.now(),W={entries:[...K,...q.articles.flatMap(mQ1),...lQ1(G)],fetchedAt:H,expiresAt:H+sW0};return tW0.set(J,W),W}async function rQ1($,I){if(I.scope==="current")return(await M$($)).rules.flatMap(dQ1);if(I.scope==="version"){let Y=await tQ1($,I);return aW0(Y)}return(await Y5($)).flatMap(aW0)}async function tQ1($,I){if(I.versionId)return H2($,I.versionId);let U=await Y5($),Y=I.versionNumber?U.find((J)=>J.versionNumber===I.versionNumber):U[0];if(!Y)throw Error(I.versionNumber?`Rule version not found: ${I.versionNumber}`:"No rule versions found");return Y}async function eW0($,I,U){let Y=U.matchMode??"any",J=U.caseSensitive??!1,Q=U.contextLines??3,K=new Set(U.areas??["rules","documents","preferences"]), Line truncated
`,"utf8"),U}function QV0($){return $.map((I,U)=>{let Y;if(typeof I.code==="number")Y=`#${String(I.code).padStart(4,"0")}`;else if(typeof I.code==="string")Y=I.code.startsWith("#")?I.code:`#${I.code}`;else Y=`#${String(U+1).padStart(4,"0")}`;return{id:I.id,code:Y,name:I.name,description:I.description,scope:I.scope,strictness:I.strictness}})}class J8 extends Error{errors;warnings;constructor($,I=[]){super(`材料包校验失败:${$.length} 个错误`);this.errors=$;this.warnings=I;this.name="MaterialPackValidationError"}}import{createHmac as Z21,randomBytes as X21}from"node:crypto";function L21($,I,U,Y){return Z21("sha256",Y).update(`${$}.${I}.${JSON.stringify(U)}`).digest("hex")}function cy($,I){let U=Math.floor(Date.now()/1000),Y=X21(16).toString("hex");return{Authorization:`Bearer ${I}`,"x-webhook-signature":L21(U,Y,$,I),"x-webhook-timestamp":String(U),"x-webhook-nonce":Y}}var yh=WI(EV0(),1),LZ0=WI(XZ0(),1);var mw={maxEntries:1000,maxTotalSize:524288000,maxCompressionRatio:150};async function DZ0($){return new Promise((I,U)=>{yh.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(Y,J)=>{if(Y||!J)return U(Y??Error("无法打开 ZIP"));let Q=[];J.readEntry(),J.on("entry",(K)=>{let q=wZ0(K);if(!q.endsWith("/")&&!nK1(q))Q.push({fileName:q,uncompressedSize:K.uncompressedSize,compressedSize:K.compressedSize,raw:K});J.readEntry()}),J.on("end",()=>I(Q)),J.on("error",U)})})}function wZ0($){let I=Buffer.isBuffer($.fileName)?$.fileName:Buffer.from(String($.fileName),"binary"),U=I.toString("utf8");if(!U.includes("�"))return U;let Y=LZ0.default.decode(I,"gbk");if(!Y.includes("�"))return Y;return U}function nK1($){let I=$.split("/").pop()??"";return $.split("/").includes("__MACOSX")||I===".DS_Store"||I.startsWith("._")||I.startsWith(".~")||I.startsWith("~$")}function OZ0($){let I=[];if($.length>mw.maxEntries)I.push(`文件数超过 ${mw.maxEntries}`);if($.reduce((J,Q)=>J+Q.uncompressedSize,0)>mw.maxTotalSize)I.push("解压后总大小超过 500MB");for(let J of $){if(J.fileName.startsWith("/")||J.fileName.split("/").includes(".."))I.push(`存在不安全路径: ${J.fileName}`);if(J.compressedSize>0&&J.uncompressedSize/J.compressedSize>mw.maxCompressionRatio)I.push(`压缩比超过 150: ${J.fileName}`)}if(!$.find((J)=>J.fileName==="信息表.xlsx"))I.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");if($.some((J)=>J.fileName.toLowerCase().endsWith(".zip")))I.push("不允许嵌套 ZIP");if(I.length)throw new J8(I)}function hh($,I){return new Promise((U,Y)=>{yh.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(J,Q)=>{if(J||!Q)return Y(J??Error("无法打开 ZIP"));Q.readEntry(),Q.on("entry",(K)=>{if(wZ0(K)!==I.fileName)return Q.readEntry();Q.openReadStream(K,(q,G)=>{if(q||!G)return Y(q??Error(`无法读取 ${I.fileName}`));let H=[];G.on("data",(W)=>H.push(W)),G.on("end",()=>U(Buffer.concat(H))),G.on("error",Y)})}),Q.on("error",Y)})})}var FZ0=WI(Sy(),1);function cK1($){return $.startsWith("[附件]")}function MZ0($){return $.startsWith("[附件]")?$.slice(4):$}function dK1($){return MZ0($).toLowerCase().replace(/\s+/g,"_")||"attachment"}function mK1($){if($==null||$==="")return[];return String($).split(/[\n,;,;]/).map((I)=>I.trim()).filter(Boolean)}function xh($,I){let U=[];for(let[Y,J]of I.entries()){if(!cK1(Y))continue;let Q=$.getCell(J).value,K=mK1(Q);if(!K.length)continue;U.push({key:dK1(Y),label:MZ0(Y),paths:K})}return U}function kh($){let I=new Map;return $.map((U)=>{let Y=(I.get(U.key)??0)+1;return I.set(U.key,Y),Y===1?U:{...U,key:`${U.key}-${Y}`}})}function lw($,I,U,Y){return{key:$,label:I,type:U,value:Y}}function zZ0($,I,U){return lw($,I,"TEXT",U==null?"":String(U))}function AZ0($,I,U){return lw($,I,"AMOUNT",typeof U==="number"?{amount:U,currency:"CNY"}:null)}function PZ0($){if($ instanceof Date)return $.toISOString();if(typeof $==="string"&&$.trim())return $.trim();return null}function lK1($){if($ instanceof Date)return Math.floor($.getTime()/1000);if(typeof $==="string"&&$.trim()){let I=Date.parse($.trim().replace(" ","T"));if(Number.isFinite(I))return Math.floor(I/1000)}return null}function IG($){let I=new Map;return $.getRow(1).eachCell((U,Y)=>I.set(String(U.value??"").trim(),Y)),I}function e3($,I,U){let Y=I.get(U);return Y?$.getCell(Y).value:void 0}function oK1($,I){return[["会议编号","meeting_id","TEXT"],["会议名称","meeting_name","TEXT"],["状态","status","TEXT"],["总金额","total_amount","AMOUNT"],["税前劳务总额","pretax_labor_total","AMOUNT"],["报销事由","reimbursement_reason","TEXT"],["po码","po_code","TEXT"],["快递单号","tracking_number","TEXT"],["申请日期","application_date","DATE"],["更新日期","updated_date","DATE"]].flatMap(([Y,J,Q])=>{let K=e3($,I,Y);if(K==null||K==="")return[];return[Q==="TEXT"?zZ0(J,Y,K):Q==="AMOUNT"?AZ0(J,Y,K):lw(J,Y,Q,PZ0(K))]})}function NZ0($,I,U){return U.flatMap(([Y,J,Q])=>{let K=e3($,I,Y);if(K==null||K==="")return[];return[Q==="TEXT"?zZ0(J,Y,K):Q==="AM Line truncated
`);let F=new FormData,E=await hh(Y.fileBuffer,O),A=w.split("/").pop()??w;F.append("files",new File([new Uint8Array(E)],A));let T=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/attachments`,{method:"POST",headers:cy({},U.secret),body:F});if(!T.ok)throw Error(`附件上传失败 ${T.status}: ${await T.text()}`);let C=await T.json();W.set(w,C.attachments?.map((u)=>u.data)??(C.data===void 0?[]:[C.data])),process.stderr.write(`✓ 附件上传成功: ${w}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${G.document.documentId}
`);let X=uh(G.document,H,W),Z=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/document`,{method:"POST",headers:{"Content-Type":"application/json",...cy({webhookId:Q,...X},U.secret)},body:JSON.stringify(X)});if(!Z.ok)throw Error(`Webhook 单据推送失败 ${Z.status}: ${await Z.text()}`);K.push({documentId:X.documentId,document:X,pushResult:await Z.json()}),process.stderr.write(`✓ 单据推送成功: ${X.documentId}
`)}return{warnings:[],results:K}}function II($){return{fileBuffer:aK1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as Iq1}from"node:fs";async function rw($,I,U={}){let J=w4().stateful?"stateful":"stateless",Q="ok",K,q,G;try{let A=await F$($);G={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let H=[];if(Q==="ok")try{H=await Z9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取 Webhook 配置失败: ${A instanceof Error?A.message:String(A)}`}let W=H.length===1,V=H.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),X=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,Z;if(U.filePath)if(!Iq1(U.filePath))Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let A=II(U.filePath),T=await $I(A.fileBuffer,A.fileName);Z={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:T.documents.length,warnings:T.warnings}}catch(A){Z={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let D=Z?Z.valid:!0,w=Q==="ok"&&V.length>0&&D,O=J==="stateful"?"":` --corp ${I.id}`,F="",E="";if(Q!=="ok")E=`凭证鉴权异常: ${K}`,F=`seal-use auth diagnose${O}`;else if(V.length===0)E="当前企业尚未配置任何 Webhook 集成通道",F=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${O}`;else if(Z&&!Z.valid)E=`材料包预检失败: ${Z.errors?.join("; ")}`,F=`seal-use webhook material-pack preview ${Z.filePath}${O}`;else{E=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${V.length} 个 Webhook 通道,等待载入`;let A=Z?.filePath??"<材料包.zip>",T=W?"":` --webhook ${X?X.id:"<webhookIdOrName>"}`;F=`seal-use webhook material-pack push ${A}${T}${O}`}return{ready:w,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:G},stateMode:J,authStatus:Q,authError:K,activeWebhooks:V,defaultWebhook:X,materialPack:Z,statusMessage:E,nextAction:F}}var YG=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:L.object({}),handler:async($)=>F$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:L.object({}),handler:async($)=>jd($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:L.object({}),handler:async($)=>$m($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:L.object({note:L.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>XU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:L.object({tokenId:L.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>Im($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:L.object({name:L.string().describe("用户姓名"),phone:L.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:L.array(L.string()).optional().describe("权限列表,默认为 []"),departmentIds:L.array(L.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>Um($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>ME($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>RV($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:L.object({keyword:L.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>CV($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>Ym($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:L.object({userId:L.string().describe("用户 ID (_id)")}),handler:async($,I)=>zE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 Seal 用户(按用户ID、手机号或姓名)重置密码登录 Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:MJ({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:ew(I,["template.name","templateName","form.name","formName","formTitle"]),amount:aw(U,["金额","报销金额","付款金额","合计","价税合计"])??ew(I,["amount","totalAmount","expenseAmount"]),expenseType:aw(U,["费用类型","费用类别","报销类型"]),costCompany:aw(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:aw(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:wq1($),attachments:HJ($,{summary:!0}).attachments,aiResult:IO($),manualResult:YI($)?.value,hints:MJ({amountMentions:jZ0(Y,["金额","合计","税率"],8),partyMentions:jZ0(Y,["买方","卖方","甲方","乙方","收款"],8)})}}function Zq1($){let I=[["result.citedRules",b5($,"result.citedRules")],["result.matchedRules",b5($,"result.matchedRules")],["result.ruleResults",b5($,"result.ruleResults")],["result.rules",b5($,"result.rules")],["pipelineData.citedRules",b5($,"pipelineData.citedRules")],["pipelineData.matchedRules",b5($,"pipelineData.matchedRules")]],U=[],Y=new Set;for(let[J,Q]of I)(Array.isArray(Q)?Q:Q&&typeof Q==="object"?Object.values(Q):[]).forEach((q,G)=>{let H=JG(q);if(!H)return;let W=$4(H.runtimeRuleId)??$4(H.runtimeId)??$4(H.id)??$4(H.ruleId),V=$4(H.ruleCode)??$4(H.code)??(W?Fq1(W):void 0),X=MJ({runtimeRuleId:W,ruleCode:V,versionNumber:Lq1(H.versionNumber)??$.ruleSetVersionNumber,scope:$4(H.scope),strictness:$4(H.strictness),appliedAnalysis:H.appliedAnalysis??H.analysis??H.reasoning,checkResult:H.checkResult??H.result??H.decision,findings:H.findings??H.riskPoints??H.evidence,sourcePath:`${J}.${G}`}),Z=JSON.stringify(X);if(!Y.has(Z))Y.add(Z),U.push(X)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function ew($,I){if(!$)return;for(let U of I){let Y=b5($,U);if(Y!==void 0)return Y}return}function vZ0($,I){if(!$)return 0;for(let U of I){let Y=b5($,U);if(Array.isArray(Y))return Y.length;if(Y&&typeof Y==="object")return Object.keys(Y).length;if(typeof Y==="number")return Y}return 0}function b5($,I){return I.split(".").reduce((U,Y)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let J=Number(Y);return Number.isInteger(J)?U[J]:void 0}if(typeof U==="object")return U[Y];return},$)}function Xq1($,I,U){let Y=I.split("."),J=$;for(let Q of Y.slice(0,-1)){let K=J[Q];if(!K||typeof K!=="object"||Array.isArray(K))J[Q]={};J=J[Q]}J[Y[Y.length-1]??I]=U}function MJ($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function JG($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function Lq1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function Dq1($){let I=[];return ih($,"document",I),I}function ih($,I,U){if(Array.isArray($)){$.forEach((K,q)=>ih(K,`${I}.${q}`,U));return}let Y=JG($);if(!Y)return;let J=$4(Y.label)??$4(Y.name)??$4(Y.title)??$4(Y.fieldName),Q=Y.value??Y.displayValue??Y.text??Y.content;if(J&&Q!==void 0&&typeof Q!=="object")U.push(MJ({path:I,label:J,value:Q,type:$4(Y.type)??$4(Y.fieldType)}));for(let[K,q]of Object.entries(Y)){if(K==="attachments")continue;ih(q,`${I}.${K}`,U)}}function aw($,I){return $.find((Y)=>{let J=$4(Y.label)??"";return I.some((Q)=>J.includes(Q))})?.value}function wq1($){let I=[];return $O($.result,"result",I),$O($.document,"document",I),I.slice(0,20)}function $O($,I,U){if(Array.isArray($)){$.forEach((J,Q)=>$O(J,`${I}.${Q}`,U));return}let Y=JG($);if(!Y)return;if(/invoice|发票/i.test(I))U.push(MJ({path:I,fileName:$4(Y.fileName)??$4(Y.filename)??$4(Y.name),buyer:Y.buyer??Y.buyerName??Y.purchaserName,seller:Y.seller??Y.sellerName,amount:Y.amount??Y.totalAmount??Y.total,taxRate:Y.taxRate,category:Y.category??Y.type}));for(let[J,Q]of Object.entries(Y))$O(Q,`${I}.${J}`,U)}function jZ0($,I,U){return $.split(/\r?\n/).filter((Y)=>I.some((J)=>Y.includes(J))).slice(0,U)}function sw($){return $.map((I)=>{let U=UI(I);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 fh($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function Oq1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let U=await f4($,I.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)}
`}function qG($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function E0($,I={}){Sq1($,I);let U=`${JSON.stringify($,null,2)}
`;if(I.outputFile){Cq1(I.outputFile,U),console.log(JSON.stringify({outputFile:I.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Sq1($,I={}){if(I.allowFull||I.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>_q1)throw Error(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function sZ0($,I){if(I)return;let U=$&&typeof $==="object"?$:{},Y=typeof U.count==="number"?U.count:void 0,J=Array.isArray(U.rules)?U.rules.length:void 0,Q=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Y??J??0;if(K>vq1||Q>jq1)throw Error(`Rule list is large (${K} rules, ${Q} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`)}function O0($){return{allowFull:_0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function eZ0(){console.log(`seal-use CLI
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let q=K[1];if(I===K[0]){Q(K);continue}if($.external){let G=$.external.registry.get(K[0])?.id;if(I!==K[0]&&G){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}function K9($,I){let U=$.seen.get(I);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let H=$.seen.get(q);if(H.ref===null)return;let G=H.def??H.schema,W={...G},w=H.ref;if(H.ref=null,w){Y(w);let Z=$.seen.get(w),X=Z.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(X);else Object.assign(G,X);if(Object.assign(G,W),q._zod.parent===w)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(!(D in W))delete G[D]}if(X.$ref&&Z.def)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(D in Z.def&&JSON.stringify(G[D])===JSON.stringify(Z.def[D]))delete G[D]}}let V=q._zod.parent;if(V&&V!==w){Y(V);let Z=$.seen.get(V);if(Z?.schema.$ref){if(G.$ref=Z.schema.$ref,Z.def)for(let X in G){if(X==="$ref"||X==="allOf")continue;if(X in Z.def&&JSON.stringify(G[X])===JSON.stringify(Z.def[X]))delete G[X]}}}$.override({zodSchema:q,jsonSchema:G,path:H.path??[]})};for(let q of[...$.seen.entries()].reverse())Y(q[0]);let J={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let q=$.external.registry.get(I)?.id;if(!q)throw Error("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);let Q=$.metadataRegistry.get(I)?.id;if(Q!==void 0&&J.id===Q)delete J.id;let K=$.external?.defs??{};for(let q of $.seen.entries()){let H=q[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;K[H.defId]=H.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;else J.definitions=K;try{let q=JSON.parse(JSON.stringify(J));return Object.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:nI(I,"input",$.processors),output:nI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function E6($,I){let U=I??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Y=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return E6(Y.element,U);if(Y.type==="set")return E6(Y.valueType,U);if(Y.type==="lazy")return E6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return E6(Y.innerType,U);if(Y.type==="intersection")return E6(Y.left,U)||E6(Y.right,U);if(Y.type==="record"||Y.type==="map")return E6(Y.keyType,U)||E6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return E6(Y.in,U)||E6(Y.out,U)}if(Y.type==="object"){for(let J in Y.shape)if(E6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(let J of Y.options)if(E6(J,U))return!0;return!1}if(Y.type==="tuple"){for(let J of Y.items)if(E6(J,U))return!0;if(Y.rest&&E6(Y.rest,U))return!0;return!1}return!1}var rM=($,I={})=>(U)=>{let Y=J9({...U,processors:I});return C1($,Y),Q9(Y,$),K9(Y,$)},nI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=J9({...J??{},target:Q,io:I,processors:U});return C1($,K),Q9(K,$),K9(K,$)};var yO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tM=($,I,U,Y)=>{let J=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:H,contentEncoding:G}=$._zod.bag;if(typeof Q==="number")J.minLength=Q;if(typeof K==="number")J.maxLength=K;if(q){if(J.format=yO0[q]??q,J.format==="")delete J.format;if(q==="time")delete J.format}if(G)J.contentEncoding=G;if(H&&H.size>0){let W=[...H];if(W.length===1)J.pattern=W[0].source;else if(W.length>1)J.allOf=[...W.map((w)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},aM=($,I,U,Y)=>{let J=U,{minimum:Q,maximum:K,format:q,multipleOf:H,exclusiveMaximum:G,exclusiveMinimum:W}=$._zod.bag;if(typeof q==="string"&&q.includes("int"))J.type="integer";else J.type="number";let w=typeof W==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),V=typeof G==="number"&&G<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(w)if(Z)J.minimum=W,J.exclusiveMinimum=!0;else J.exclusiveMinimum=W;else if(typeof Q==="number")J.minimum=Q;if(V)if(Z)J.maximum=G,J.exclusiveMaximum=!0;else J.exclusiveMaximum=G;else if(typeof K==="number")J.maximum=K;if(typeof H==="number")J.multipleOf=H},sM=($,I,U,Y)=>{U.type="boolean"},eM=($,I,U,Y)=>{if(I.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},$A=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`);if($===-1)return null;let I=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),UC0(I)}clear(){this._buffer=void 0}}function UC0($){return pf.parse(JSON.parse($))}function ic($){return JSON.stringify($)+`
`}class ZE{constructor($=bc.stdin,I=bc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new VE,this._started=!1,this._ondata=(U)=>{this._readBuffer.append(U),this.processReadBuffer()},this._onerror=(U)=>{this.onerror?.(U)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let $=this._readBuffer.readMessage();if($===null)break;this.onmessage?.($)}catch($){this.onerror?.($)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send($){return new Promise((I)=>{let U=ic($);if(this._stdout.write(U))I();else this._stdout.once("drain",I)})}}import{dirname as cu,join as tG1}from"node:path";import{fileURLToPath as aG1}from"node:url";class q5 extends Error{name="KyError";get isKyError(){return!0}}class J$ extends q5{name="HTTPError";response;request;options;data;constructor($,I,U){let Y=$.status||$.status===0?$.status:"",J=$.statusText??"",Q=`${Y} ${J}`.trim(),K=Q?`status code ${Q}`:"an unknown error";super(`Request failed with ${K}: ${I.method} ${I.url}`);this.response=$,this.request=I,this.options=U}}class K2 extends q5{name="NetworkError";request;constructor($,I){super(`Request failed due to a network error: ${$.method} ${$.url}`,I);this.request=$}}class q2 extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class XU extends q5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new q2($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class zE extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class o$ extends q5{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}var XE=(()=>{let $=!1,I=!1,U=typeof globalThis.ReadableStream==="function",Y=typeof globalThis.Request==="function";if(U&&Y)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(J){if(J instanceof Error&&J.message==="unsupported BodyInit type")return!1;throw J}return $&&!I})(),nc=typeof globalThis.AbortController==="function",Nw=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",pc=typeof globalThis.ReadableStream==="function",cc=typeof globalThis.FormData==="function",Mw=["get","post","put","patch","head","delete"],YC0=()=>{return};YC0();var dc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},LU=2147483647,mc=40,Aw=Symbol("stop");class Pw{options;constructor($){this.options=$}}var lc=($)=>new Pw($),oc={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,baseUrl:!0,prefix:!0,retry:!0,timeout:!0,totalTimeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,onUploadProgress:!0,fetch:!0,context:!0},rc={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,duplex:!0};var Tw=new TextEncoder,JC0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[U,Y]of $)I+=mc,I+=Tw.encode(`Content-Disposition: form-data; name="${U}"`).byteLength,I+=typeof Y==="string"?Tw.encode(Y).byteLength:Y.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return Tw.encode($).byteLength;if($ instanceof URLSearchParams)return Tw.encode($.toString()).byteLength;return 0},tc=($,I,U)=>{let Y,J=0;return $.pipeThrough(new TransformStream({transform(Q,K){if(K.enqueue(Q),Y){J+=Y.byteLength;let q=I===0?0:J/I;if(q>=1)q=1-Number.EPSILON;U?.({percent:q,totalBytes:Math.max(I,J),transferredBytes:J},Y)}Y=Q},flush(){if(Y)J+=Y.byteLength,U?.({percent:1,totalBytes:Math.max(I,J),transferredBytes:J},Y)}}))},ac=($,I)=>{if(!$.body)return $;let U={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,U);let Y=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(tc($.body,Y,I),U)},sc=($,I,U)=>{if(!$.body)return $;let Y=JC0(U??$.body);return new Request($,{duplex:"half",body:tc($.body,Y,I)})};var X8=($)=>$!==null&&typeof $==="object";var QC0=Symbol("replaceOption"),LE=($)=>X8($)&&$[QC0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var G2=(...$)=>{for(let I of $)if( Line truncated
`,{mode:384}),I}function r21($){let I=lw0();for(let U of I){if(!Z$(U))continue;for(let Y of pL(U).filter((J)=>J.endsWith(".json")).filter((J)=>!J.startsWith("example."))){let J=n8(U,Y);try{let Q=dL(J,"utf-8"),K=JSON.parse(Q);if(K&&typeof K==="object"&&K.id===$)return J}catch{}}}return}function O7($,I){let U=r21($);if(!U)throw Error(`Enterprise config not found: ${$}`);let J={...JSON.parse(dL(U,"utf-8")),...I};for(let K of Object.keys(I))if(I[K]===void 0)delete J[K];let Q=Gh.parse(J);return bw0(U,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}function FJ($,I,U=[]){let Y=I.corpId?.trim()||void 0,J=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,Q=Y??J;if(Q){let q=$.find((H)=>H.id===Q);if(q)return q;throw Error(`No enterprise config found for ${Q}`)}if(!I.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 K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{readFileSync as zH1}from"node:fs";import{randomBytes as XH1}from"node:crypto";var tw0=300000,ow0=new Map;function t21($,I){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>I?U:U.toLowerCase())}function a21($,I){return I?$:$.toLowerCase()}function s21($,I,U,Y){let J=a21($,Y),Q=I.filter((K)=>J.includes(K));if(U==="all"&&Q.length!==I.length)return[];return Q}function e21($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function $K1($,I){if(I.fields&&!I.fields.has($.field))return[];let U=e21($.value),Y=[];return U.forEach((J,Q)=>{let K=s21(J,I.keywords,I.matchMode,I.caseSensitive);if(K.length===0)return;let q=Math.max(0,Q-I.contextLines),H=Math.min(U.length,Q+I.contextLines+1),G={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:K,matchedText:lL(J,I.maxChars),context:{before:I.snippetOnly?[]:U.slice(q,Q).map((W)=>lL(W,I.maxChars)),line:lL(J,I.maxChars),after:I.snippetOnly?[]:U.slice(Q+1,H).map((W)=>lL(W,I.maxChars))},metadata:$.metadata};if(I.snippetOnly)G.context={before:[],line:G.context.line,after:[]};Y.push(G)}),Y}function lL($,I){if(!I||$.length<=I)return $;return`${$.slice(0,Math.max(0,I))}...`}function IK1($){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 rw0($){return $.rules.flatMap((I,U)=>{let Y=`${$.id}:${I.description.slice(0,32)}`,J={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:I.scope,strictness:I.strictness,code:"code"in I?I.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.description",value:I.description,metadata:J},{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.scope",value:I.scope,metadata:J}]})}function UK1($){return[{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"title",value:$.title,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"purpose",value:$.purpose,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}},{area:"documents",entityType:"document",entityId:$.id,title:$.title,field:"content",value:$.content,metadata:{status:$.status,scenarios:$.scenarios,tags:$.tags}}]}function YK1($){let I=[];if($.decisionPreferences)for(let[U,Y]of Object.entries($.decisionPreferences))I.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${U}`,value:Y,metadata:{integrationSystem:$.integrationSystem}});return $.integrations.forEach((U,Y)=>{I.push({area:"preferences",entityType:"integration",title:U.outboundName,field:`integrations[${Y}]`,value:U,metadata:{type:U.type,outboundName:U.outboundName,mode:U.mode,corporationId:U.corporationId}})}),I}async function JK1($,I,U){let Y=U.ruleVersionScope??"current",J=[I.id,`ruleVersionScope=${Y}`,`ruleVersionId=${U.ruleVersionId??""}`,`ruleVersionNumber=${U.ruleVersionNumber??""}`,`latestRuleVersion=${U.latestRuleVersion??!1}`,`documentLimit=${U.documentLimit??100}`].join("|"),Q=ow0.get(J);if(!U.refresh&&Q&&Date.now()<Q.expiresAt)return Q;let[K,q,H]=await Promise.all([QK1($,{scope:Y,versionId:U.ruleVersionId,versionNumber:U.ruleVersionNumber,latest:U.latestRuleVersion}),A2($,{limit:U.documentLimit??100}),g1($,I.seal.endpoints.approvalStylePreferences)]),G=Date.now(),W={entries:[...K,...q.articles.flatMap(UK1),...YK1(H)],fetchedAt:G,expiresAt:G+tw0};return ow0.set(J,W),W}async function QK1($,I){if(I.scope==="current")return(await C6($)).rules.flatMap(IK1);if(I.scope==="version"){let Y=await KK1($,I);return rw0(Y)}return(await G5($)).flatMap(rw0)}async function KK1($,I){if(I.versionId)return N2($,I.versionId);let U=await G5($),Y=I.versionNumber?U.find((J)=>J.versionNumber===I.versionNumber):U[0];if(!Y)throw Error(I.versionNumber?`Rule version not found: ${I.versionNumber}`:"No rule versions found");return Y}async function aw0($,I,U){let Y=U.matchMode??"any",J=U.caseSensitive??!1,Q=U.contextLines??3,K=new Set(U.areas??["rules","documents","preferences"]),q=U Line truncated
`,"utf8"),U}function YV0($){return $.map((I,U)=>{let Y;if(typeof I.code==="number")Y=`#${String(I.code).padStart(4,"0")}`;else if(typeof I.code==="string")Y=I.code.startsWith("#")?I.code:`#${I.code}`;else Y=`#${String(U+1).padStart(4,"0")}`;return{id:I.id,code:Y,name:I.name,description:I.description,scope:I.scope,strictness:I.strictness}})}class h$ extends Error{errors;warnings;constructor($,I=[]){super([`材料包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=I;this.name="MaterialPackValidationError"}}import{createHmac as AK1,randomBytes as PK1}from"node:crypto";function TK1($,I,U,Y){return AK1("sha256",Y).update(`${$}.${I}.${JSON.stringify(U)}`).digest("hex")}function Oh($,I){let U=Math.floor(Date.now()/1000),Y=PK1(16).toString("hex");return{Authorization:`Bearer ${I}`,"x-webhook-signature":TK1(U,Y,$,I),"x-webhook-timestamp":String(U),"x-webhook-nonce":Y}}var Hu=OI(PV0(),1),VZ0=OI(wZ0(),1);var VD={maxEntries:1000,maxTotalSize:524288000,maxCompressionRatio:150};async function ZZ0($){return new Promise((I,U)=>{Hu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(Y,J)=>{if(Y||!J)return U(Y??Error("无法打开 ZIP"));let Q=[];J.readEntry(),J.on("entry",(K)=>{let q=zZ0(K);if(!q.endsWith("/")&&!eq1(q))Q.push({fileName:q,uncompressedSize:K.uncompressedSize,compressedSize:K.compressedSize,raw:K});J.readEntry()}),J.on("end",()=>I(Q)),J.on("error",U)})})}function zZ0($){let I=Buffer.isBuffer($.fileName)?$.fileName:Buffer.from(String($.fileName),"binary"),U=I.toString("utf8");if(!U.includes("�"))return U;let Y=VZ0.default.decode(I,"gbk");if(!Y.includes("�"))return Y;return U}function eq1($){let I=$.split("/").pop()??"";return $.split("/").includes("__MACOSX")||I===".DS_Store"||I.startsWith("._")||I.startsWith(".~")||I.startsWith("~$")}function XZ0($,I){let U=[],Y=MU(I);if($.length>VD.maxEntries)U.push(`文件数超过 ${VD.maxEntries}`);if($.reduce((K,q)=>K+q.uncompressedSize,0)>VD.maxTotalSize)U.push("解压后总大小超过 500MB");for(let K of $){if(K.fileName.startsWith("/")||K.fileName.split("/").includes(".."))U.push(`存在不安全路径: ${K.fileName}`);if(K.compressedSize>0&&K.uncompressedSize/K.compressedSize>VD.maxCompressionRatio)U.push(`压缩比超过 150: ${K.fileName}`);if(K.fileName==="信息表.xlsx")continue;$H1(K,Y,U)}if(!$.find((K)=>K.fileName==="信息表.xlsx"))U.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");if($.some((K)=>K.fileName.toLowerCase().endsWith(".zip")))U.push("不允许嵌套 ZIP");if(U.length)throw new h$(U)}function $H1($,I,U){let Y=IH1($.fileName);if(!Y||!I.allowedExtensions.includes(Y))U.push(`附件后缀不在白名单中: ${$.fileName}(允许: ${I.allowedExtensions.join(", ")})`);if($.uncompressedSize<I.minFileSizeBytes)U.push(`附件文件过小: ${$.fileName}(${$.uncompressedSize} B,小于最小值 ${I.minFileSizeBytes} B)`);if(I.maxFileSizeBytes!==void 0&&I.maxFileSizeBytes!==null&&$.uncompressedSize>I.maxFileSizeBytes)U.push(`附件文件过大: ${$.fileName}(${$.uncompressedSize} B,大于最大值 ${I.maxFileSizeBytes} B)`)}function IH1($){let I=$.split("/").pop()??$,U=I.lastIndexOf(".");return U>0?I.slice(U).toLowerCase():""}function Gu($,I){return new Promise((U,Y)=>{Hu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(J,Q)=>{if(J||!Q)return Y(J??Error("无法打开 ZIP"));Q.readEntry(),Q.on("entry",(K)=>{if(zZ0(K)!==I.fileName)return Q.readEntry();Q.openReadStream(K,(q,H)=>{if(q||!H)return Y(q??Error(`无法读取 ${I.fileName}`));let G=[];H.on("data",(W)=>G.push(W)),H.on("end",()=>U(Buffer.concat(G))),H.on("error",Y)})}),Q.on("error",Y)})})}var DZ0=OI(Jh(),1);function UH1($){return $.startsWith("[附件]")}function OZ0($){return $.startsWith("[附件]")?$.slice(4):$}function YH1($){return OZ0($).toLowerCase().replace(/\s+/g,"_")||"attachment"}function JH1($){if($==null||$==="")return[];return String($).split(/[\n,;,;]/).map((I)=>I.trim()).filter(Boolean)}function Wu($,I){let U=[];for(let[Y,J]of I.entries()){if(!UH1(Y))continue;let Q=$.getCell(J).value,K=JH1(Q);if(!K.length)continue;U.push({key:YH1(Y),label:OZ0(Y),paths:K})}return U}function wu($){let I=new Map;return $.map((U)=>{let Y=(I.get(U.key)??0)+1;return I.set(U.key,Y),Y===1?U:{...U,key:`${U.key}-${Y}`}})}function ZD($,I,U,Y){return{key:$,label:I,type:U,value:Y}}function FZ0($,I,U){return ZD($,I,"TEXT",U==null?"":String(U))}function NZ0($,I,U){return ZD($,I,"AMOUNT",typeof U==="number"?{amount:U,currency:"CNY"}:null)}function MZ0($){if($ instanceof Date)return $.toISOString();if(typeof $==="string"&&$.trim())return $.trim();return null}function QH1($){if($ instanceof Date)return Math.floor($.getTime()/1000);if(typeof $==="string"&&$.trim()){let I=Date.parse($.trim().replace(" ","T"));if(Number.isFinite(I))return Math.floor(I/1000)}return null}function ZH($){let I=new Map;return $.getRow(1).eachCell((U,Y)=>I.set(String(U.value??"").trim(),Y)),I}function qI($,I,U){let Y=I.get(U);return Y?$.getCell(Y).value:void 0}function KH1($,I){return[["会议编号","meeting_id","TEXT"],["会议名称","meeting_name","TEXT"],["状态","status","TEXT"],["总金额","total_amount","AMOUNT"],["税前劳务总额","pretax_labor_total","AMOUNT"],["报销事由","reimbursement_reason","TEXT"],["po码","po_code","TEXT"],["快递单号","tracking_number","TEXT"],["申请日期","application_date","DATE"],["更新日期","updated_date","DATE"] Line truncated
`);let F=new FormData,E=await Gu(Y.fileBuffer,D),T=L.split("/").pop()??L;F.append("files",new File([new Uint8Array(E)],T));let A=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/attachments`,{method:"POST",headers:Oh({},U.secret),body:F});if(!A.ok)throw Error(`附件上传失败 ${A.status}: ${await A.text()}`);let R=await A.json();W.set(L,R.attachments?.map((k)=>k.data)??(R.data===void 0?[]:[R.data])),process.stderr.write(`✓ 附件上传成功: ${L}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${H.document.documentId}
`);let V=Vu(H.document,G,W),Z=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/document`,{method:"POST",headers:{"Content-Type":"application/json",...Oh({webhookId:Q,...V},U.secret)},body:JSON.stringify(V)});if(!Z.ok)throw Error(`Webhook 单据推送失败 ${Z.status}: ${await Z.text()}`);K.push({documentId:V.documentId,document:V,pushResult:await Z.json()}),process.stderr.write(`✓ 单据推送成功: ${V.documentId}
`)}return{warnings:[],results:K}}function GI($){return{fileBuffer:GH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as ZH1}from"node:fs";async function XD($,I,U={}){let J=D4().stateful?"stateful":"stateless",Q="ok",K,q,H;try{let A=await P$($);H={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let G=[];if(Q==="ok")try{G=await F9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取 Webhook 配置失败: ${A instanceof Error?A.message:String(A)}`}let W=G.length===1,w=G.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),V=W?{id:G[0].id,name:G[0].name,mode:G[0].mode}:null,Z=U.webhook?N9(G,U.webhook):W?G[0]:void 0,X;if(U.filePath)if(!ZH1(U.filePath))X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let A=GI(U.filePath),R=await HI(A.fileBuffer,A.fileName,Z?.materialPackFilePolicy);X={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:R.documents.length,warnings:R.warnings}}catch(A){X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let L=X?X.valid:!0,D=Q==="ok"&&w.length>0&&L,F=J==="stateful"?"":` --corp ${I.id}`,E="",T="";if(Q!=="ok")T=`凭证鉴权异常: ${K}`,E=`seal-use auth diagnose${F}`;else if(w.length===0)T="当前企业尚未配置任何 Webhook 集成通道",E=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(X&&!X.valid)T=`材料包预检失败: ${X.errors?.join("; ")}`,E=`seal-use webhook material-pack preview ${X.filePath}${F}`;else{T=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${w.length} 个 Webhook 通道,等待载入`;let A=X?.filePath??"<材料包.zip>",R=W?"":` --webhook ${V?V.id:"<webhookIdOrName>"}`;E=`seal-use webhook material-pack push ${A}${R}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:H},stateMode:J,authStatus:Q,authError:K,activeWebhooks:w,defaultWebhook:V,materialPack:X,statusMessage:T,nextAction:E}}var XH=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:z.object({}),handler:async($)=>P$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:z.object({}),handler:async($)=>Xm($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:z.object({}),handler:async($)=>im($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:z.object({note:z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>AU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:z.object({tokenId:z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>bm($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:z.object({name:z.string().describe("用户姓名"),phone:z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:z.array(z.string()).optional().describe("权限列表,默认为 []"),departmentIds:z.array(z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>nm($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>mE($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>bw($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:z.object({keyword:z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>nw($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>em($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>lE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:CJ({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:MD(I,["template.name","templateName","form.name","formName","formTitle"]),amount:DD(U,["金额","报销金额","付款金额","合计","价税合计"])??MD(I,["amount","totalAmount","expenseAmount"]),expenseType:DD(U,["费用类型","费用类别","报销类型"]),costCompany:DD(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:DD(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:jH1($),attachments:DJ($,{summary:!0}).attachments,aiResult:PD($),manualResult:wI($)?.value,hints:CJ({amountMentions:RZ0(Y,["金额","合计","税率"],8),partyMentions:RZ0(Y,["买方","卖方","甲方","乙方","收款"],8)})}}function BH1($){let I=[["result.citedRules",l5($,"result.citedRules")],["result.matchedRules",l5($,"result.matchedRules")],["result.ruleResults",l5($,"result.ruleResults")],["result.rules",l5($,"result.rules")],["pipelineData.citedRules",l5($,"pipelineData.citedRules")],["pipelineData.matchedRules",l5($,"pipelineData.matchedRules")]],U=[],Y=new Set;for(let[J,Q]of I)(Array.isArray(Q)?Q:Q&&typeof Q==="object"?Object.values(Q):[]).forEach((q,H)=>{let G=LH(q);if(!G)return;let W=Y4(G.runtimeRuleId)??Y4(G.runtimeId)??Y4(G.id)??Y4(G.ruleId),w=Y4(G.ruleCode)??Y4(G.code)??(W?SH1(W):void 0),V=CJ({runtimeRuleId:W,ruleCode:w,versionNumber:RH1(G.versionNumber)??$.ruleSetVersionNumber,scope:Y4(G.scope),strictness:Y4(G.strictness),appliedAnalysis:G.appliedAnalysis??G.analysis??G.reasoning,checkResult:G.checkResult??G.result??G.decision,findings:G.findings??G.riskPoints??G.evidence,sourcePath:`${J}.${H}`}),Z=JSON.stringify(V);if(!Y.has(Z))Y.add(Z),U.push(V)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function MD($,I){if(!$)return;for(let U of I){let Y=l5($,U);if(Y!==void 0)return Y}return}function vZ0($,I){if(!$)return 0;for(let U of I){let Y=l5($,U);if(Array.isArray(Y))return Y.length;if(Y&&typeof Y==="object")return Object.keys(Y).length;if(typeof Y==="number")return Y}return 0}function l5($,I){return I.split(".").reduce((U,Y)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let J=Number(Y);return Number.isInteger(J)?U[J]:void 0}if(typeof U==="object")return U[Y];return},$)}function vH1($,I,U){let Y=I.split("."),J=$;for(let Q of Y.slice(0,-1)){let K=J[Q];if(!K||typeof K!=="object"||Array.isArray(K))J[Q]={};J=J[Q]}J[Y[Y.length-1]??I]=U}function CJ($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function LH($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function RH1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function CH1($){let I=[];return Xu($,"document",I),I}function Xu($,I,U){if(Array.isArray($)){$.forEach((K,q)=>Xu(K,`${I}.${q}`,U));return}let Y=LH($);if(!Y)return;let J=Y4(Y.label)??Y4(Y.name)??Y4(Y.title)??Y4(Y.fieldName),Q=Y.value??Y.displayValue??Y.text??Y.content;if(J&&Q!==void 0&&typeof Q!=="object")U.push(CJ({path:I,label:J,value:Q,type:Y4(Y.type)??Y4(Y.fieldType)}));for(let[K,q]of Object.entries(Y)){if(K==="attachments")continue;Xu(q,`${I}.${K}`,U)}}function DD($,I){return $.find((Y)=>{let J=Y4(Y.label)??"";return I.some((Q)=>J.includes(Q))})?.value}function jH1($){let I=[];return AD($.result,"result",I),AD($.document,"document",I),I.slice(0,20)}function AD($,I,U){if(Array.isArray($)){$.forEach((J,Q)=>AD(J,`${I}.${Q}`,U));return}let Y=LH($);if(!Y)return;if(/invoice|发票/i.test(I))U.push(CJ({path:I,fileName:Y4(Y.fileName)??Y4(Y.filename)??Y4(Y.name),buyer:Y.buyer??Y.buyerName??Y.purchaserName,seller:Y.seller??Y.sellerName,amount:Y.amount??Y.totalAmount??Y.total,taxRate:Y.taxRate,category:Y.category??Y.type}));for(let[J,Q]of Object.entries(Y))AD(Q,`${I}.${J}`,U)}function RZ0($,I,U){return $.split(/\r?\n/).filter((Y)=>I.some((J)=>Y.includes(J))).slice(0,U)}function OD($){return $.map((I)=>{let U=WI(I);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 Zu($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function _H1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let U=await i4($,I.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)}function lH1($){let I=[];if(I.push(`seal-use ${$.area} - ${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let U of $.commands)for(let Y of U.usage)I.push(` ${Y}`);return I.push(""),I.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`),I.join(`
`)}function tZ0(){return`seal-use CLI
Usage:
seal-use version
@@ -344,6 +345,10 @@ Usage:
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
@@ -358,6 +363,12 @@ Usage:
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use data invoices [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
@@ -365,27 +376,27 @@ Usage:
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook status [<材料包.zip>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size 500] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--corp <corpId>]
seal-use webhook material-pack push <材料包.zip|信息表.xlsx> [--webhook <idOrName>] [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync <sign-key> [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use rules count [--corp <corpId>]
@@ -409,28 +420,36 @@ Usage:
seal-use approval-runs attachments <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] [--corp <corpId>]
seal-use approval-runs result <recordId> [--summary] [--corp <corpId>]
seal-use analytics insight [--start-date <ISO>] [--end-date <ISO>] [--limit <n>] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
seal-use approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
seal-use approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
seal-use simulation batch-records <batchId> [--corp <corpId>]
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--corp <corpId>]
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] [--corp <corpId>]
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" [--corp <corpId>]
seal-use simulation status <batchId> [--corp <corpId>]
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
seal-use simulation clean <batchId> [--corp <corpId>]
seal-use simulation specifications [--integration <sign-key>] [--corp <corpId>]
seal-use simulation approval-definitions [--corp <corpId>]
seal-use simulation list [--limit 50] [--corp <corpId>]
seal-use simulation get <batchId> [--corp <corpId>]
seal-use simulation templates [--corp <corpId>]
seal-use simulation integrations [--corp <corpId>]
seal-use simulation package-upload <材料包.zip> [--corp <corpId>]
`)}function O4($){let I=b8(),U=w4();return WJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},o3())}function JI($=w4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:r3()}}async function F0($,I,U,Y,J={}){E0(await QI($,I,U,Y),J)}async function QI($,I,U,Y){let J=YG.find((q)=>q.name===$);if(!J)throw Error(`Unknown Seal tool: ${$}`);let Q=Object.fromEntries(Object.entries(Y).filter(([,q])=>q!==void 0)),K=J.handler;return K(I,Q,{corp:U})}async function $X0($,I,U,Y,J){if($==="summary"){let Q=await QI("seal_approval_runs_summary",U,Y,{date:h(J.options.date),timezone:h(J.options.timezone),limit:U1(J.options.limit),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query)});if(Q?.matched===0&&Q?.total>0)console.error(`提示:在 ${Q.date} 未匹配到记录(该企业共有 ${Q.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);E0(Q,O0(J.options));return}if($==="stats"){await F0("seal_approval_runs_stats",U,Y,{since:h(J.options.since),dedupeBy:h(J.options.dedupeBy)??h(J.options["dedupe-by"]),status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"])},O0(J.options));return}if($==="count"){await F0("seal_approval_runs_count",U,Y,{status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"]),search:h(J.options.search)??h(J.options.query)},O0(J.options));return}if($==="search"||$==="list"){await F0("seal_approval_runs_search",U,Y,{limit:U1(J.options.limit),offset:U1(J.options.offset),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query),includeBridge:_0(J.options.includeBridge)},O0(J.options));return}if($==="bridge"){await F0("seal_approval_run_langfuse_bridge_get",U,Y,{recordId:h(J.options.recordId),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),simulationBatchId:h(J.options.simulationBatchId),limit:U1(J.options.limit)},O0(J.options));return}if($==="pick"){let Q=I??h(J.options.query)??h(J.options.sn);if(!Q)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await F0("seal_approval_run_pick",U,Y,{query:Q,sn:h(J.options.sn),batchId:h(J.options.batch)??h(J.options.batchId),latest:_0(J.options.latest),fields:h(J.options.fields),limit:U1(J.options.limit),includeBridge:_0(J.options.includeBridge)},O0(J.options));return}if($==="get"){let Q=J.command[2];if(!Q)throw Error("Missing approval run recordId");await F0("seal_approval_run_get",U,Y,{recordId:Q,fields:h(J.options.fields),summary:_0(J.options.summary)},O0(J.options));return}if($==="cited-rules"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await F0("seal_approval_run_cited_rules_get",U,Y,{recordId:Q},O0(J.options));return}if($==="document-summary"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await F0("seal_approval_run_document_summary_get",U,Y,{recordId:Q},O0(J.options));return}if($==="attachments"){if(J.command[2]==="download"){let H=J.command[3];if(!H)throw Error("Usage: seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>]");let W=await f4(U,H),V=await Pw({record:W,all:_0(J.options.all),name:h(J.options.name),outDir:h(J.options["out-dir"])??h(J.options.outDir)??h(J.options.dir)});if(E0(V,O0(J.options)),V.total>0&&V.downloaded===0)throw Error(`所有 ${V.total} 个附件下载均失败。`);return}let K=J.command[2];if(!K)throw Error("Usage: seal-use approval-runs attachments <recordId> | seal-use approval-runs attachments download <recordId>");if(_0(J.options.download)){let H=await f4(U,K),W=await Pw({record:H,all:_0(J.options.all)??!0,name:h(J.options.name),outDir:h(J.options["out-dir"])??h(J.options.outDir)??h(J.options.dir)});if(E0(W,O0(J.options)),W.total>0&&W.downloaded===0)throw Error(`所有 ${W.total} 个附件下载均失败。`);return}let q=await f4(U,K),G=HJ(q,{summary:_0(J.options.summary)});E0(G,O0(J.options));return}if($==="download"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs download <recordId> [--all] [--name <n Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${v.length} candidate administrators:
- ${n}
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!w)if(!W&&Q)w=Q;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let O=i1($,"id")??X,F=Z??X,E=i1($,"sealUrl")??`https://${X.toLowerCase()}.sealai.cc`,A={id:O,name:F,seal:{url:E,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:V,appKey:U,appSecurity:Y,corpId:X,staffId:w},auth:{refreshTtl:300}};if(W)wV(O),await zJ(A);let T=ky();WX0(T,{recursive:!0,mode:448});let C=ZX0(T,`${oh(O)}.json`);if(HX0(C)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${C}. Pass "overwrite": true to replace it.`);VX0(C,`${JSON.stringify(A,null,2)}
`,{mode:384}),E0({id:O,name:F,corpId:X,domain:V,staffId:w,verified:W,path:C})}async function fq1($){let I=Z7($,"token"),U=(i1($,"sealUrl")??i1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let Y=mZ0($,"expiresIn")??2592000,J=$.force===!0||$.verify===!1?!1:!0,Q=J?await iq1(U,I):void 0;LX0($,{token:I,sealUrl:U,expiresIn:Y,verify:J,remote:Q})}async function bq1($,I,U){let Y=await OV($),J=Q2(Y.sealUrl,Y.token),Q=await F$(J),K={user:Q.user,tenant:Q.tenant};NV(Y.corpId,K.tenant),LX0({id:Y.corpId,corpId:Y.corpId,name:I,provider:"hosecloud",overwrite:U},{token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,verify:!0,remote:K})}function LX0($,I){let{token:U,sealUrl:Y,expiresIn:J,verify:Q,remote:K}=I,q=K?.user,G=K?.tenant,H=i1($,"tenantSlug")??X7(G?.tenantSlug),W=i1($,"tenantId")??X7(G?.id),V=i1($,"tenantName")??X7(G?.name),X=i1($,"id")??H??W;if(!X)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let Z=i1($,"staffId")??X7(q?.providerUserId)??X7(q?.id)??"seal",D=i1($,"provider")??X7(q?.provider)??X7(G?.providerConfig?.provider),w=i1($,"corpId")??H??W??X,O={id:X,name:i1($,"name")??V??X,seal:{url:Y,tenantSlug:H,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:Y,expiresIn:J,staffId:Z,corpId:w,tenantId:W,tenantSlug:H,tenantName:V,providerUserId:X7(q?.providerUserId),provider:D},auth:{refreshTtl:300}},F=ky();WX0(F,{recursive:!0,mode:448});let E=ZX0(F,`${oh(X)}.json`);if(HX0(E)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${E}. Pass "overwrite": true to replace it.`);VX0(E,`${JSON.stringify(O,null,2)}
`,{mode:384}),E0({id:X,name:O.name,tenantId:W,tenantSlug:H,verified:Q,path:E})}async function iq1($,I){let U=await pq1(`${$}/api/v1/auth/me`,{authorization:`Bearer ${I}`}),Y=YO(U.data);return{user:YO(Y.user??U.user),tenant:YO(Y.tenant??U.tenant)}}async function pq1($,I={}){let U=await fetch($,{headers:I}),Y=await U.text();if(!U.ok)throw Error(`${U.status} ${Y}`);let J=JSON.parse(Y);return YO(J)}function YO($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function X7($){return typeof $==="string"&&$?$:void 0}async function DX0($,I){let U=await OV($),Y=Q2(U.sealUrl,U.token),J=await F$(Y);NV(U.corpId,J.tenant);let Q=await XU(Y,{note:I});E0({tenant:{id:J.tenant.id,name:J.tenant.name,tenantSlug:J.tenant.tenantSlug,corpId:U.corpId},user:{id:J.user.id,name:J.user.name,providerUserId:J.user.providerUserId,isAdmin:J.user.isAdmin},delegation:Q,expiresIn:U.expiresIn})}async function wX0($,I,U,Y,J){if($==="list"){await F0("seal_delegation_list",U,Y,{},O0(J.options));return}if($==="create"){let Q=h(J.options.note)??(I?[I,...J.command.slice(2)].join(" "):void 0);await F0("seal_delegation_create",U,Y,{note:Q},O0(J.options));return}if($==="revoke"){let Q=I??h(J.options.tokenId);if(!Q)throw Error("Usage: seal-use delegation revoke <tokenId>");await F0("seal_delegation_revoke",U,Y,{tokenId:Q},O0(J.options));return}throw Error(`Unknown delegation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as nq1}from"node:fs";async function OX0($,I,U,Y,J,Q){if(!$||$==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
`}var rH1=100,tH1=120000,eZ0=["id","code","status","strictness","scope","createdAt","updatedAt"],aH1=200000;function Bu($){return $.map((I)=>typeof I==="string"?I:String(I)).join(" ")}function FH($){if(!$.length)return"";return`${$.join(`
`)}
`}function NH($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function B0($,I={}){sH1($,I);let U=`${JSON.stringify($,null,2)}
`;if(I.outputFile){oH1(I.outputFile,U),console.log(JSON.stringify({outputFile:I.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function sH1($,I={}){if(I.allowFull||I.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>aH1)throw new TD(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function $z0($,I){if(I)return;let U=$&&typeof $==="object"?$:{},Y=typeof U.count==="number"?U.count:void 0,J=Array.isArray(U.rules)?U.rules.length:void 0,Q=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Y??J??0;if(K>rH1||Q>tH1)throw new TD(`Rule list is large (${K} rules, ${Q} 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 w0($){return{allowFull:F0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function Iz0($=[]){console.log(sZ0($))}function k1($){let I=p8(),U=D4();return FJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},UI())}function VI($=D4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:YI()}}async function D0($,I,U,Y,J={}){B0(await ZI($,I,U,Y),J)}async function ZI($,I,U,Y){let J=XH.find((q)=>q.name===$);if(!J)throw Error(`Unknown Seal tool: ${$}`);let Q=Object.fromEntries(Object.entries(Y).filter(([,q])=>q!==void 0)),K=J.handler;return K(I,Q,{corp:U})}async function Uz0($,I,U,Y,J){if($==="summary"){let Q=await ZI("seal_approval_runs_summary",U,Y,{date:h(J.options.date),timezone:h(J.options.timezone),limit:d0(J.options.limit),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query)});if(Q?.matched===0&&Q?.total>0)console.error(`提示:在 ${Q.date} 未匹配到记录(该企业共有 ${Q.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);B0(Q,w0(J.options));return}if($==="stats"){await D0("seal_approval_runs_stats",U,Y,{since:h(J.options.since),dedupeBy:h(J.options.dedupeBy)??h(J.options["dedupe-by"]),status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"])},w0(J.options));return}if($==="count"){await D0("seal_approval_runs_count",U,Y,{status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"]),search:h(J.options.search)??h(J.options.query)},w0(J.options));return}if($==="search"||$==="list"){await D0("seal_approval_runs_search",U,Y,{limit:d0(J.options.limit),offset:d0(J.options.offset),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query),includeBridge:F0(J.options.includeBridge)},w0(J.options));return}if($==="bridge"){await D0("seal_approval_run_langfuse_bridge_get",U,Y,{recordId:h(J.options.recordId),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),simulationBatchId:h(J.options.simulationBatchId),limit:d0(J.options.limit)},w0(J.options));return}if($==="pick"){let Q=I??h(J.options.query)??h(J.options.sn);if(!Q)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await D0("seal_approval_run_pick",U,Y,{query:Q,sn:h(J.options.sn),batchId:h(J.options.batch)??h(J.options.batchId),latest:F0(J.options.latest),fields:h(J.options.fields),limit:d0(J.options.limit),includeBridge:F0(J.options.includeBridge)},w0(J.options));return}if($==="get"){let Q=J.command[2];if(!Q)throw Error("Missing approval run recordId");await D0("seal_approval_run_get",U,Y,{recordId:Q,fields:h(J.options.fields),summary:F0(J.options.summary)},w0(J.options));return}if($==="cited-rules"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await D0("seal_approval_run_cited_rules_get",U,Y,{recordId:Q},w0(J.options));return}if($==="document-summary"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await D0("seal_approval_run_document_summary_get",U,Y,{recordId:Q},w0(J.options));return}if($==="attachments"){if(J.command[2]==="download"){let G=J.command[3];if(!G)throw Error("Usage: seal-use approval-runs attachment Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let Q=k1(Y),K=k1(J);if(Q.id===K.id)throw j4(`Cannot bind enterprise '${Q.id}' to itself.`);if(Q.prodCorpId&&Q.prodCorpId!==K.id)throw j4(`Cannot use '${Q.id}' as a production enterprise because it is already registered as a test enterprise for '${Q.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==Q.id)throw j4(`Cannot bind '${K.id}' as a test enterprise because it already has a bound test enterprise '${K.testCorpId}'. Multi-tier chaining is not permitted.`);let q=F0(U.options.force)===!0;if(Q.testCorpId&&Q.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==Q.id){if(!q)throw o8(`Enterprise binding conflict: production enterprise '${Q.id}' is bound to '${Q.testCorpId??"none"}', and test enterprise '${K.id}' is bound to '${K.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm --force`)}if(!(F0(U.options.confirm)===!0||F0(U.options.yes)===!0)){let w=q?" --force":"";throw o8(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${Q.name}' (${Q.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm${w}`)}if(Q.testCorpId&&Q.testCorpId!==K.id)try{O7(Q.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==Q.id)try{O7(K.prodCorpId,{testCorpId:void 0})}catch{}let G=O7(Q.id,{environment:"production",testCorpId:K.id}),W=O7(K.id,{environment:"test",prodCorpId:Q.id});B0({success:!0,productionEnterprise:{id:G.id,name:G.name,environment:G.environment,testCorpId:G.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}});return}if($==="unbind-test"){let Y=I??h(U.options.corp),J=k1(Y);if(!J.testCorpId&&!J.prodCorpId){B0({unbound:!1,message:`Enterprise '${J.name}' (${J.id}) does not have an active test enterprise binding.`});return}let Q=J.testCorpId?J.id:J.prodCorpId,K=J.testCorpId?J.testCorpId:J.id;if(!(F0(U.options.confirm)===!0||F0(U.options.yes)===!0))throw o8(`Refusing to unbind production enterprise '${Q}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${J.id} --confirm`);O7(Q,{testCorpId:void 0});try{O7(K,{prodCorpId:void 0})}catch{}B0({success:!0,unboundProduction:Q,unboundTest:K});return}if($==="sync-test"){let Y=I??h(U.options.corp),J=k1(Y);if(!J.testCorpId)throw j4(`Production enterprise '${J.name}' (${J.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${J.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let Q=k1(J.testCorpId);if(Q.environment!=="test")throw Error(`Target enterprise '${Q.name}' (${Q.id}) is marked as '${Q.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=await n1(J),q=await n1(Q),H=await g1(K,J.seal.endpoints.approvalStylePreferences),G=await g1(q,Q.seal.endpoints.approvalStylePreferences),W=await C6(K),w=await C6(q),V={...G,tone:H.tone,language:H.language,detailLevel:H.detailLevel,outputFormat:H.outputFormat,examples:H.examples??[],prohibitedPhrases:H.prohibitedPhrases??[],customInstructions:H.customInstructions,decisionPreferences:H.decisionPreferences,thinkingDepthPreference:H.thinkingDepthPreference},Z=h(U.options["version-name"])??h(U.options.versionName),X=new Date().toISOString().slice(0,10),L=Z??`Sync from ${J.name} (${X})`;if(F0(U.options["dry-run"])===!0||F0(U.options.dryRun)===!0){B0({dryRun:!0,source:{id:J.id,name:J.name,environment:J.environment},target:{id:Q.id,name:Q.name,environment:Q.environment},preferencesDiff:{decisionPreferences:{before:G.decisionPreferences,after:H.decisionPreferences},thinkingDepthPreference:{before:G.thinkingDepthPreference,after:H.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:w.rules.length,toDeleteCount:w.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((A,R)=>({index:R+1,description:A.description,scope:A.scope,strictness:A.strictness}))},publishingPlan:{targetCorpId:Q.id,publishVersionName:L,publishTarget:"test"},productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(F0(U.options.yes)===!0||F0(U.options.confirm)===!0))throw o8(`Refusing to overwrite test enterprise '${Q.name}' (${Q.id}) with preferences and ${W.rules.length} draft rules from production enterprise '${J.name}' (${J.id}) without --yes. This will replace test draft rules and publish a new version on the test enterprise.`,`seal-use corps sync-test ${J.id} --yes`);await W5(q,V,Q.seal.endpoints.approvalStylePreferences);for(let A of w.rules)await PU(q,A.id);let E=[];for(let A of W.rules){let R=await F2(q,{description:A.description,scope:A.scope,strictness:A.strictness});E.push(R)}await cw(q).catch(()=>{return});let T=await M2(q,L);B0({success:!0,syncedAt:new Date().toISOString(),source:{id:J.id,name:J.name,environment:J.environment,draftRulesCount:W.rules.length},target:{id:Q.id,name:Q.name,environment:Q.environment,deletedDraftRulesCount:w.rules.length,createdDraftRulesCount:E.length,publishedVersion:{id:T.version.id,versionNumber:T.version.versionNumber,versionName:T.version.versionName,rulesCount:T.rulesCount}},productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if($==="switch"){let Y=I;if(!Y)throw Error("Usage: seal-use corps switch <corpId>");let J=D4();if(!J.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let Q=k1(Y);JI({...J,stateful:!0,defaultCorpId:Q.id}),B0({current:!0,id:Q.id,name:Q.name});return}if($==="probe-hose"){await UG1(s6(U.json));return}if($==="hose-staffs"){await YG1(s6(U.json));return}if($==="add-hose"){await JG1(s6(U.json));return}if($==="add-seal"){await QG1(s6(U.json));return}if($==="add-link"){let Y=I??h(U.options.link)??h(U.options.url);if(!Y)throw Error("Usage: seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]");await KG1(Y,h(U.options.name),F0(U.options.overwrite)===!0);return}throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}async function UG1($){let I=M7($,"appKey"),U=M7($,"appSecurity"),Y=c1($,"domain"),J=await NU(I,U,Y),Q=await yw(J.domain,J.openapiToken).catch(()=>[]),K=Q.reduce((q,H)=>q+H.roleDefs.length,0);B0({domain:J.domain,corpId:J.corpId,name:J.corpName??J.corpId,roleCount:K,roleGroups:Q.map((q)=>({id:q.id,name:q.name,roleDefs:q.roleDefs.map((H)=>({id:H.id,name:H.name,sourceType:H.sourceType}))}))})}async function YG1($){let I=M7($,"appKey"),U=M7($,"appSecurity"),Y=c1($,"domain"),J=c1($,"role")??c1($,"roleDefId")??"admin",Q=await NU(I,U,Y),K=await yw(Q.domain,Q.openapiToken),q,H;for(let w of K){for(let V of w.roleDefs)if(V.id===J||V.id===`${Q.corpId}:${J}`){q=V.id,H=V.name;break}if(q)break}if(!q&&(J==="admin"||J==="主管理员"))for(let w of K){for(let V of w.roleDefs)if(V.id.endsWith(":admin")||V.name==="主管理员"){q=V.id,H=V.name;break}if(q)break}if(!q)for(let w of K){for(let V of w.roleDefs)if(V.name.toLowerCase().includes(J.toLowerCase())){q=V.id,H=V.name;break}if(q)break}if(!q)throw Error(`Role not found matching query: '${J}'. Run 'seal-use corps probe-hose' to view all available roles.`);let G=await RE(Q.domain,Q.openapiToken,q),W=await CE(Q.domain,Q.openapiToken,G.staffs);B0({domain:Q.domain,corpId:Q.corpId,corpName:Q.corpName??Q.corpId,roleId:q,roleName:H,count:W.length,staffs:W.map((w)=>( Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${C.length} candidate administrators:
- ${p}
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!L)if(!W&&Q)L=Q;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let D=c1($,"id")??V,F=Z??V,E=c1($,"sealUrl")??`https://${V.toLowerCase()}.sealai.cc`,T={id:D,name:F,environment:"production",seal:{url:E,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:w,appKey:U,appSecurity:Y,corpId:V,staffId:L},auth:{refreshTtl:300}};if(W)Cw(D),await jJ(T);let A=wh();Xz0(A,{recursive:!0,mode:448});let R=Dz0(A,`${Au(D)}.json`);if(zz0(R)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${R}. Pass "overwrite": true to replace it.`);Lz0(R,`${JSON.stringify(T,null,2)}
`,{mode:384}),B0({id:D,name:F,corpId:V,domain:w,staffId:L,verified:W,path:R})}async function QG1($){let I=M7($,"token"),U=(c1($,"sealUrl")??c1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let Y=dZ0($,"expiresIn")??2592000,J=$.force===!0||$.verify===!1?!1:!0,Q=Fz0($),K=J?await qG1(U,I,z2(Q)):void 0;Nz0($,{token:I,sealUrl:U,expiresIn:Y,verify:J,remote:K,custom:Q})}function Fz0($){return{headers:qh.parse($.headers),cookies:Hh.parse($.cookies)}}async function KG1($,I,U){let Y=await jw($),J=X2(Y.sealUrl,Y.token),Q=await P$(J),K={user:Q.user,tenant:Q.tenant};_w(Y.corpId,K.tenant),Nz0({id:Y.corpId,corpId:Y.corpId,name:I,provider:"hosecloud",overwrite:U},{token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,verify:!0,remote:K})}function Nz0($,I){let{token:U,sealUrl:Y,expiresIn:J,verify:Q,remote:K}=I,q=I.custom??Fz0($),H=K?.user,G=K?.tenant,W=c1($,"tenantSlug")??A7(G?.tenantSlug),w=c1($,"tenantId")??A7(G?.id),V=c1($,"tenantName")??A7(G?.name),Z=c1($,"id")??W??w;if(!Z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let X=c1($,"staffId")??A7(H?.providerUserId)??A7(H?.id)??"seal",L=c1($,"provider")??A7(H?.provider)??A7(G?.providerConfig?.provider),D=c1($,"corpId")??W??w??Z,F={id:Z,name:c1($,"name")??V??Z,environment:"production",seal:{url:Y,tenantSlug:W,headers:q.headers,cookies:q.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:Y,expiresIn:J,staffId:X,corpId:D,tenantId:w,tenantSlug:W,tenantName:V,providerUserId:A7(H?.providerUserId),provider:L},auth:{refreshTtl:300}},E=wh();Xz0(E,{recursive:!0,mode:448});let T=Dz0(E,`${Au(Z)}.json`);if(zz0(T)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${T}. Pass "overwrite": true to replace it.`);Lz0(T,`${JSON.stringify(F,null,2)}
`,{mode:384}),B0({id:Z,name:F.name,tenantId:w,tenantSlug:W,verified:Q,path:T})}async function qG1($,I,U={}){let Y=await HG1(`${$}/api/v1/auth/me`,{...U,authorization:`Bearer ${I}`}),J=vD(Y.data);return{user:vD(J.user??Y.user),tenant:vD(J.tenant??Y.tenant)}}async function HG1($,I={}){let U=await fetch($,{headers:I}),Y=await U.text();if(!U.ok)throw Error(`${U.status} ${Y}`);let J=JSON.parse(Y);return vD(J)}function vD($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function A7($){return typeof $==="string"&&$?$:void 0}async function Mz0($,I){let U=await jw($),Y=X2(U.sealUrl,U.token),J=await P$(Y);_w(U.corpId,J.tenant);let Q=await AU(Y,{note:I});B0({tenant:{id:J.tenant.id,name:J.tenant.name,tenantSlug:J.tenant.tenantSlug,corpId:U.corpId},user:{id:J.user.id,name:J.user.name,providerUserId:J.user.providerUserId,isAdmin:J.user.isAdmin},delegation:Q,expiresIn:U.expiresIn})}async function Az0($,I,U,Y,J){if($==="list"){await D0("seal_delegation_list",U,Y,{},w0(J.options));return}if($==="create"){let Q=h(J.options.note)??(I?[I,...J.command.slice(2)].join(" "):void 0);await D0("seal_delegation_create",U,Y,{note:Q},w0(J.options));return}if($==="revoke"){let Q=I??h(J.options.tokenId);if(!Q)throw Error("Usage: seal-use delegation revoke <tokenId>");await D0("seal_delegation_revoke",U,Y,{tokenId:Q},w0(J.options));return}throw Error(`Unknown delegation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as GG1}from"node:fs";async function Pz0($,I,U,Y,J,Q){if(!$||$==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -438,25 +457,25 @@ Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an a
`+` • feishu (飞书审批): 建议使用 Webhook 模式对接
`+` • weaver (泛微 OA): 建议使用 Webhook 模式对接
`+` • helios (汇联易): 建议使用 Webhook 模式对接
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if($==="webhook"||$==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if($==="feishu"||$==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if($==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if($==="maycur"||$==="helios"){let H=$==="maycur"?"每刻报销":"汇联易";throw Error(`${H}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${H}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",q=$==="hosecloud"?I:$,G=$==="hosecloud"?U:I;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(q==="requirements"){await F0("seal_deploy_hosecloud_requirements",Y,J,{},O0(Q.options));return}if(q==="list"){await F0("seal_deploy_hosecloud_list",Y,J,{},O0(Q.options));return}if(q==="get"){let H=G??h(Q.options.signKey)??h(Q.options["sign-key"]);if(!H){let V=((await q4(Y)).integrations??[]).filter((X)=>X.type==="hosecloud");if(V.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+" • maycur (每刻报销): 建议使用 Webhook 模式对接");if($==="webhook"||$==="webhooks")throw Error("Webhook 审批流发布请直接使用专有命令:seal-use webhook <list|get|add|update|delete> --corp <corpId>");if($==="feishu"||$==="lark")throw Error("飞书审批发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '飞书审批' --result-url <url> --corp <corpId>");if($==="weaver")throw Error("泛微 OA 发布:建议使用 Webhook 通用发布模式对接。命令:seal-use webhook add --name '泛微OA' --result-url <url> --corp <corpId>");if($==="maycur"||$==="helios"){let G=$==="maycur"?"每刻报销":"汇联易";throw Error(`${G}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${G}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",q=$==="hosecloud"?I:$,H=$==="hosecloud"?U:I;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(q==="requirements"){await D0("seal_deploy_hosecloud_requirements",Y,J,{},w0(Q.options));return}if(q==="list"){await D0("seal_deploy_hosecloud_list",Y,J,{},w0(Q.options));return}if(q==="get"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]);if(!G){let w=((await g1(Y)).integrations??[]).filter((V)=>V.type==="hosecloud");if(w.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let Z=X.outboundName??"SealAI 审批",D=X.signKey,w=X.apiOrigin??"production";console.error(` • "${Z}" (signKey: ${D}, 环境: ${w})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${D} --corp ${J.id}
`)}throw Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。")}await F0("seal_deploy_hosecloud_get",Y,J,{signKey:H},O0(Q.options));return}if(q==="status"){await F0("seal_deploy_hosecloud_status",Y,J,{},O0(Q.options));return}if(q==="configure"){let H=h(Q.options.input),W=H?JSON.parse(nq1(H,"utf8")):t6(Q.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await F0("seal_deploy_hosecloud_configure",Y,J,W,O0(Q.options));return}if(q==="sync"){let H=G??h(Q.options.signKey)??h(Q.options["sign-key"]),W=_0(Q.options.auto)??_0(Q.options.yes);if(!H){let X=((await q4(Y)).integrations??[]).filter((D)=>D.type==="hosecloud");if(X.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);let Z=X[0];if(Z&&X.length===1&&W){let D=Z.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${D})`),await F0("seal_deploy_hosecloud_sync",Y,J,{signKey:D},O0(Q.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let D of X){let w=D.outboundName??"SealAI 审批",O=D.signKey,F=D.apiOrigin??"production";console.error(` • "${w}" (signKey: ${O}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${O} --corp ${J.id}
`)}if(X.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${J.id}
`);throw Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。")}await F0("seal_deploy_hosecloud_sync",Y,J,{signKey:H},O0(Q.options));return}throw Error(`Unknown deploy hosecloud action: ${q??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as oq1}from"node:http";import{URL as dq1}from"node:url";var NX0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.12",description:`Planned HTTP contract for the seal-use wrapped backend API.
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of w){let Z=V.outboundName??"SealAI 审批",X=V.signKey,L=V.apiOrigin??"production";console.error(` • "${Z}" (signKey: ${X}, 环境: ${L})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${X} --corp ${J.id}
`)}throw new l8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,w.length===1?`seal-use deploy hosecloud get ${w[0].signKey} --corp ${J.id}`:void 0)}await D0("seal_deploy_hosecloud_get",Y,J,{signKey:G},w0(Q.options));return}if(q==="status"){await D0("seal_deploy_hosecloud_status",Y,J,{},w0(Q.options));return}if(q==="configure"){let G=h(Q.options.input),W=G?JSON.parse(GG1(G,"utf8")):s6(Q.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await D0("seal_deploy_hosecloud_configure",Y,J,{...W,dryRun:F0(Q.options.dryRun)??F0(Q.options["dry-run"])},w0(Q.options));return}if(q==="sync"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]),W=F0(Q.options.auto)??F0(Q.options.yes);if(!G){let V=((await g1(Y)).integrations??[]).filter((X)=>X.type==="hosecloud");if(V.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);let Z=V[0];if(Z&&V.length===1&&W){let X=Z.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${X})`),await D0("seal_deploy_hosecloud_sync",Y,J,{signKey:X},w0(Q.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let L=X.outboundName??"SealAI 审批",D=X.signKey,F=X.apiOrigin??"production";console.error(` • "${L}" (signKey: ${D}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${D} --corp ${J.id}
`)}if(V.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${J.id}
`);throw new l8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,V.length===1?`seal-use deploy hosecloud sync ${V[0].signKey} --corp ${J.id}`:void 0)}await D0("seal_deploy_hosecloud_sync",Y,J,{signKey:G},w0(Q.options));return}throw Error(`Unknown deploy hosecloud action: ${q??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as zG1}from"node:http";import{URL as wG1}from"node:url";var Tz0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.15",description:`Planned HTTP contract for the seal-use wrapped backend API.
These endpoints describe the intended stable API for frontend developers and agents once
the HTTP adapter is implemented.
They are not the raw downstream Seal endpoints. seal-use is responsible for enterprise
selection, source authentication, response compaction, and diagnostics-friendly fields.
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2 Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],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",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",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",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",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 service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",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:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",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:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",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:{"2 Line truncated
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Seal Home API Docs (v${e0})</title>
<title>Seal Home API Docs (v${I1})</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>\uD83E\uDDAD</text></svg>" />
<style>
body {
@@ -475,21 +494,21 @@ selection, source authentication, response compaction, and diagnostics-friendly
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
></script>
</body>
</html>`}async function k4($,I,U,Y){let J=$.handler;return J(I,U,{corp:Y})}async function MX0($,I){if(I.setHeader("Access-Control-Allow-Origin","*"),I.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),I.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){I.writeHead(204),I.end();return}let U=$.headers.host||"localhost",Y=$.headers["x-forwarded-proto"]||"http",J=new dq1($.url||"/",`${Y}://${U}`),Q=J.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&Q==="/"){d1(I,200,{name:"seal-use",version:e0,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(K==="GET"&&Q==="/docs"){lq1(I,200,FX0());return}if(K==="GET"&&Q==="/openapi.json"){d1(I,200,JO());return}if(K==="GET"&&Q==="/health"){d1(I,200,{status:"ok",version:e0,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(Q==="/shutdown"||Q==="/api/shutdown")){d1(I,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&Q==="/api/cli"){let q=await KO($),G=(typeof q?.command==="string"?q.command:"").trim();if(!G){QO(I,400,"Missing 'command' property in request body");return}let H=$x(G),W=H[0]==="seal-use"||H[0]==="seal-home"||H[0]?.endsWith("/seal-use")||H[0]?.endsWith("/seal-home")?H.slice(1):H,V=await HG(W),X=void 0;try{if(V.stdout.trim().startsWith("{")||V.stdout.trim().startsWith("["))X=JSON.parse(V.stdout)}catch{}d1(I,V.isError?400:200,{success:!V.isError,stdout:V.stdout,stderr:V.stderr,exitCode:V.exitCode,data:X});return}if(K==="POST"&&Q.startsWith("/api/tool/")){let q=Q.slice(10).trim(),G=v4(q);if(!G){QO(I,404,`Tool not found: '${q}'`);return}let H=await KO($)||{},W=g6($,J,H),V=O4(W),X=await U4(V),Z={...H};delete Z.corp;let D=await k4(G,X,Z,V);d1(I,200,D);return}if(Q.startsWith("/v1/")){if(await mq1($,I,K,Q,J))return}QO(I,404,`Cannot ${K} ${Q}. Visit /docs for available endpoints.`)}catch(q){let G=q instanceof Error?q.message:String(q);QO(I,500,G)}}async function mq1($,I,U,Y,J){let Q=Object.fromEntries(J.searchParams.entries());if(U==="GET"&&Y==="/v1/corps"){let K=b8(),q=w4();return d1(I,200,{count:K.length,mode:q.stateful?"stateful":"stateless",defaultCorpId:q.defaultCorpId,corps:K.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&Y==="/v1/whoami"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_whoami"),W=await k4(H,G,{},q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/session"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_session_get"),W=await k4(H,G,{},q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/summary"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_runs_summary"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/stats"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_runs_stats"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/pick"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_run_pick"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/url"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_run_url_get"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(Y.startsWith("/v1/approval-runs/")){let K=Y.slice(18).split("/"),q=K[0],G=K[1];if(q&&!["summary","pick","stats","url","bridge"].includes(q)){let H=g6($,J,Q),W=O4(H),V=await U4(W);if(!G){let X=v4("seal_approval_run_get"),Z=await k4(X,V,{recordId:q,...Q},W);return d1(I,200,Z),!0}if(G==="attachments"){let X=v4("seal_approval_run_attachments_get"),Z=await k4(X,V,{recordId:q,...Q},W);return d1(I,200,Z),!0}if(G==="cited-rules"){let X=v4("seal_approval_run_cited_rules_get"),Z=await k4(X,V,{recordId:q,...Q},W);return d1(I,200,Z),!0}if(G==="document-summary"){let X=v4("seal_approval_run_document_summary_get"),Z=await k4(X,V,{recordId:q,...Q},W);return d1(I,200,Z),!0}if(G==="result"){let X=v4("seal_approval_run_result_get"),Z=await k4(X,V,{recordId:q,...Q},W);return d1(I,200,Z),!0}}}if(U==="GET"&&Y==="/v1/approval-runs"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_runs_search"),W=await k4(H,G,{...Q,limit:Q.limit?Number(Q.limit):void 0,offset:Q.offset?Number(Q.offset):void 0,includeBridge:Q.includeBridge==="true"},q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval/rules"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_approval_rules_list"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(U==="GET"&&Y==="/v1/simulation/batches"){let K=g6($,J,Q),q=O4(K),G=await U4(q),H=v4("seal_simulation_batches_list"),W=await k4(H,G,Q,q);return d1(I,200,W),!0}if(U==="POST"&&Y==="/v1/simulation/create-batch"){let K=await KO($)||{},q=g6($,J,K),G=O4(q),H=await U4Line truncated
\uD83D\uDE80 seal-use HTTP Server (v${e0}) started`),console.error(` URL: http://${U}:${I}`),console.error(` Docs: http://${U}:${I}/docs`),console.error(` OpenAPI: http://${U}:${I}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${I}/api/cli`),console.error(` REST API: http://${U}:${I}/v1/...
`);J(Y)})})}async function zX0($){let I=U1($.options.port)??U1($.options.p),U=h($.options.host)??h($.options.h),Y=await HO({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function AX0($,I,U,Y){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,U,{},O0(Y.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,U,{},O0(Y.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}async function PX0($,I){if($==="config"||$==="json"){Ix();return}await Ux()}function Ix(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function TX0($){let I=JO();E0(I,{...O0($.options),allowFull:!0})}async function EX0($,I,U,Y){if($==="available"){await F0("seal_permissions_available_list",I,U,{},O0(Y.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,U,{},O0(Y.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as BX0}from"node:fs";async function RX0($,I,U,Y,J,Q,K){if(!$||$==="get"){await F0("seal_preference_get",J,Q,{},O0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",J,Q,G,O0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q},O0(K.options));return}if(I==="policies"){if(U==="list"||!U){await F0("seal_preference_thinking_depth_policies_list",J,Q,{},O0(K.options));return}if(U==="upsert"){let q=h(K.options.input),G=q?JSON.parse(BX0(q,"utf8")):t6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",J,Q,G,O0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q},O0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function CX0($={}){let I=b8(),U=w4(),Y=WJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},o3());console.log(`[probe] corp=${Y.id} source=${Y.source.type}`);let J=await zJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await U4(Y),K=await _V(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}async function vX0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await CX0({corpId:Y})}async function Yx($,I,U,Y,J){if($==="count"){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}if($==="list"){if(_0(J.options.count)){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},O0(J.options));return}let Q=U1(J.options.limit),K=U1(J.options.offset);if(_0(J.options.summary)){await F0("seal_approval_rules_list",U,Y,{fields:aZ0,limit:Q,offset:K},O0(J.options));return}let q=await QI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});sZ0(q,_0(J.options.full)===!0),E0(q);return}if($==="clear"){let Q=_0(J.options.yes)===!0,K=_0(J.options.dryRun)??_0(J.options["dry-run"])??!Q;if(!Q&&!K)throw Error("Refusing to clear rules without --yes. Use --dry-run to preview.");let q=await QI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:_0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){E0({...q,nextCommand:`seal-use rules clear --corp ${Y.id} --yes`},O0(J.options));return}E0(q,O0(J.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",U,Y,{},O0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|latest>");await F0("seal_approval_rule_version_get",U,Y,QG(Q),O0(J.options));return}if($==="get"){await F0("seal_approval_rule_get",U,Y,{...tZ0(h(J.options.version)),code:h(J.options.code),runtimeId:h(J.options.runtimeId)??h(J.options["runtime-id"]),recordId:h(J.options.r Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function eq1($){let I=XO($),U=Kx($),Y=WG($);gX0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):qO),Q=$.host??(process.env.HOST?process.env.HOST:GO);VO(I,`${process.pid}
`,{mode:384}),VO(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),AJ(Y,`service starting on http://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await HO({port:J,host:Q,silent:!0}),AJ(Y,`service listening pid=${process.pid}`)}catch(G){if(AJ(Y,`service failed to bind port ${J}: ${G instanceof Error?G.message:String(G)}`),ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});throw G}let q=()=>{if(K)K.close(),K=null;if(ZO(I)===process.pid)n8(I,{force:!0}),n8(U,{force:!0});AJ(Y,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function jX0($){gX0($.stateDir);let I=PJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=rq1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=XO($);return VO(Q,`${J.pid}
`,{mode:384}),AJ(WG($),`started pid=${J.pid}`),{started:!0,...PJ($)}}function _X0($,I={}){let U=XO($),Y=Kx($),J=ZO(U);if(!J||!SX0(J,$.appRoot))return n8(U,{force:!0}),n8(Y,{force:!0}),I.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(J,"SIGTERM"),n8(U,{force:!0}),n8(Y,{force:!0}),AJ(WG($),`stop requested pid=${J}`),I.quiet?void 0:{stopped:!0,pid:J}}function SX0($,I){if(!$G1($))return!1;try{let U=tq1("ps",["-p",String($),"-o","command="],{encoding:"utf8"});return(U.includes(I)||U.includes("seal-use")||U.includes("src/cli.ts"))&&U.includes("service")&&U.includes("run")}catch{return!1}}function $G1($){try{return process.kill($,0),!0}catch{return!1}}function XO($){return Qx($.stateDir,"service.pid")}function Kx($){return Qx($.stateDir,"service.json")}function WG($){return Qx($.stateDir,"service.log")}function ZO($){if(!WO($))return;let I=Number(Jx($,"utf8").trim());return Number.isInteger(I)&&I>0?I:void 0}function gX0($){aq1($,{recursive:!0,mode:448})}function AJ($,I){VO($,`${new Date().toISOString()} ${I}
`,{flag:"a",mode:384})}var qx=UG1(IG1(),".config","seal-use");async function Gx($,I,U){let Y=U?U1(U.options.port)??U1(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?U1(U.options.lines)??U1(U.options.n):void 0,K=await KI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:qx,version:e0,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)E0(K)}import{existsSync as YG1,readFileSync as yX0}from"node:fs";async function hX0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},O0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),G=q?JSON.parse(yX0(q,"utf8")):void 0,H=h(J.options.input),W=H?JSON.parse(yX0(H,"utf8")):t6(J.json),V=h(J.options.packageId)??h(J.options["package-id"]),X=M6(J.options.packageIds)??M6(J.options["package-ids"])??(V?[V]:void 0),Z=M6(J.options.flowIds)??M6(J.options["flow-ids"])??M6(J.options.documentSn)??M6(J.options["document-sn"]),D=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration);await F0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:_0(J.options.skipInvoiceGeneration)??_0(J.options["skip-invoice-generation"]),skipExpenseExtraction:_0(J.options.skipExpenseExtraction)??_0(J.options["skip-expense-extraction"]),disableAttachmentCache:_0(J.options.disableAttachmentCache)??_0(J.options["disable-attachment-cache"]),signKey:D,packageIds:X,packageId:V,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:G,requestIds:M6(J.options.requestIds)??M6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:M6(J.options.flowStatusList)?.map(Number)??M6(J.options["flow-status-list"])?.map(Number),businessCodes:M6(J.options.businessCodes)??M6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:U1(J.options.startTime)??U1(J.options["start-time"]),endTime:U1(J.options.endTime)??U1(J.options["end-time"]),status:M6(J.options.status),limit:U1(J.options.limit),rawParams:W},O0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},O0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",U,Y,{batchId:Q},O0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await F0("seal_simulation_specifications_list",U,Y,{signKey:Q},O0(J.options));return}if($==="list"){await F0("seal_simulation_batches_list",U,Y,{limit:U1(J.options.limit)},O0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",U,Y,{batchId:Q},O0(J.options));return}if($==="templates"){await F0("seal_simulation_templates_get",U,Y,{},O0(J.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",U,Y,{},O0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!YG1(Q))throw Error(`File not found: ${Q}`);await F0("seal_simulation_material_package_upload",U,Y,{filePath:Q},O0(J.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as eX0}from"node:fs";import{join as LO}from"node:path";import{existsSync as Hx,mkdirSync as lX0,rmSync as DG1,writeFileSync as wG1}from"node:fs";import{homedir as oX0}from"node:os";import{dirname as OG1,join as Wx}from"node:path";var xX0=`---
</html>`}async function k4($,I,U,Y){let J=$.handler;return J(I,U,{corp:Y})}async function Bz0($,I){if(I.setHeader("Access-Control-Allow-Origin","*"),I.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),I.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){I.writeHead(204),I.end();return}let U=$.headers.host||"localhost",Y=$.headers["x-forwarded-proto"]||"http",J=new wG1($.url||"/",`${Y}://${U}`),Q=J.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&Q==="/"){o1(I,200,{name:"seal-use",version:I1,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(K==="GET"&&Q==="/docs"){ZG1(I,200,Ez0());return}if(K==="GET"&&Q==="/openapi.json"){o1(I,200,RD());return}if(K==="GET"&&Q==="/health"){o1(I,200,{status:"ok",version:I1,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(Q==="/shutdown"||Q==="/api/shutdown")){o1(I,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&Q==="/api/cli"){let q=await jD($),H=(typeof q?.command==="string"?q.command:"").trim();if(!H){CD(I,400,"Missing 'command' property in request body");return}let G=Ru(H),W=G[0]==="seal-use"||G[0]==="seal-home"||G[0]?.endsWith("/seal-use")||G[0]?.endsWith("/seal-home")?G.slice(1):G,w=await AH(W),V=void 0;try{if(w.stdout.trim().startsWith("{")||w.stdout.trim().startsWith("["))V=JSON.parse(w.stdout)}catch{}o1(I,w.isError?400:200,{success:!w.isError,stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,data:V});return}if(K==="POST"&&Q.startsWith("/api/tool/")){let q=Q.slice(10).trim(),H=C4(q);if(!H){CD(I,404,`Tool not found: '${q}'`);return}let G=await jD($)||{},W=u6($,J,G),w=k1(W),V=await n1(w),Z={...G};delete Z.corp;let X=await k4(H,V,Z,w);o1(I,200,X);return}if(Q.startsWith("/v1/")){if(await VG1($,I,K,Q,J))return}CD(I,404,`Cannot ${K} ${Q}. Visit /docs for available endpoints.`)}catch(q){let H=q instanceof Error?q.message:String(q);CD(I,500,H)}}async function VG1($,I,U,Y,J){let Q=Object.fromEntries(J.searchParams.entries());if(U==="GET"&&Y==="/v1/corps"){let K=p8(),q=D4();return o1(I,200,{count:K.length,mode:q.stateful?"stateful":"stateless",defaultCorpId:q.defaultCorpId,corps:K.map((H)=>({id:H.id,name:H.name,sourceType:H.source.type,sealUrl:H.seal?.url}))}),!0}if(U==="GET"&&Y==="/v1/whoami"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_whoami"),W=await k4(G,H,{},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/session"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_session_get"),W=await k4(G,H,{},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/summary"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_summary"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/stats"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_stats"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/pick"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_run_pick"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/url"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_run_url_get"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(Y.startsWith("/v1/approval-runs/")){let K=Y.slice(18).split("/"),q=K[0],H=K[1];if(q&&!["summary","pick","stats","url","bridge"].includes(q)){let G=u6($,J,Q),W=k1(G),w=await n1(W);if(!H){let V=C4("seal_approval_run_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="attachments"){let V=C4("seal_approval_run_attachments_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="cited-rules"){let V=C4("seal_approval_run_cited_rules_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="document-summary"){let V=C4("seal_approval_run_document_summary_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="result"){let V=C4("seal_approval_run_result_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}}}if(U==="GET"&&Y==="/v1/approval-runs"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_search"),W=await k4(G,H,{...Q,limit:Q.limit?Number(Q.limit):void 0,offset:Q.offset?Number(Q.offset):void 0,includeBridge:Q.includeBridge==="true"},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval/rules"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_rules_list"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/simulation/batches"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_simulation_batches_list"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="POST"&&Y==="/v1/simulation/create-batch"){let K=await jD($)||{},q=u6($,J,K),H=k1(q),G=await n1Line truncated
\uD83D\uDE80 seal-use HTTP Server (v${I1}) started`),console.error(` URL: http://${U}:${I}`),console.error(` Docs: http://${U}:${I}/docs`),console.error(` OpenAPI: http://${U}:${I}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${I}/api/cli`),console.error(` REST API: http://${U}:${I}/v1/...
`);J(Y)})})}async function vz0($){let I=d0($.options.port)??d0($.options.p),U=h($.options.host)??h($.options.h),Y=await SD({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function Rz0($,I,U,Y){if($==="config"||$==="get"){await D0("seal_llm_config_get",I,U,{},w0(Y.options));return}if($==="providers"||$==="list"){await D0("seal_llm_providers_list",I,U,{},w0(Y.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}async function Cz0($,I){if($==="config"||$==="json"){Cu();return}await ju()}function Cu(){B0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function jz0($){let I=RD();B0(I,{...w0($.options),allowFull:!0})}async function _z0($,I,U,Y){if($==="available"){await D0("seal_permissions_available_list",I,U,{},w0(Y.options));return}if($==="configs"||$==="list"){await D0("seal_permissions_configs_list",I,U,{},w0(Y.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as gz0}from"node:fs";async function Sz0($,I,U,Y,J,Q,K){if(!$||$==="get"){await D0("seal_preference_get",J,Q,{},w0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),H=q?JSON.parse(gz0(q,"utf8")):s6(K.json);if(!H||Object.keys(H).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await D0("seal_preference_decision_update",J,Q,{...H,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await D0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}if(I==="policies"){if(U==="list"||!U){await D0("seal_preference_thinking_depth_policies_list",J,Q,{},w0(K.options));return}if(U==="upsert"){let q=h(K.options.input),H=q?JSON.parse(gz0(q,"utf8")):s6(K.json);if(!H||!H.id||!H.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await D0("seal_preference_thinking_depth_policies_upsert",J,Q,{...H,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await D0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function yz0($={}){let I=p8(),U=D4(),Y=FJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},UI());console.log(`[probe] corp=${Y.id} source=${Y.source.type}`);let J=await jJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await n1(Y),K=await lw(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}async function hz0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await yz0({corpId:Y})}async function _u($,I,U,Y,J){if($==="count"){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},w0(J.options));return}if($==="list"){if(F0(J.options.count)){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},w0(J.options));return}let Q=d0(J.options.limit),K=d0(J.options.offset);if(F0(J.options.summary)){await D0("seal_approval_rules_list",U,Y,{fields:eZ0,limit:Q,offset:K},w0(J.options));return}let q=await ZI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});$z0(q,F0(J.options.full)===!0),B0(q);return}if($==="clear"){let Q=F0(J.options.yes)===!0,K=F0(J.options.dryRun)??F0(J.options["dry-run"])??!Q;if(!Q&&!K)throw o8("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${Y.id} --dry-run`);let q=await ZI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:F0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){B0({...q,nextCommand:`seal-use rules clear --corp ${Y.id} --yes`},w0(J.options));return}B0(q,w0(J.options));return}if($==="versions"){await D0("seal_approval_rule_versions_list",U,Y,{},w0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|l Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function FG1($){let I=xD($),U=yu($),Y=PH($);fz0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):_D),Q=$.host??(process.env.HOST?process.env.HOST:gD);hD(I,`${process.pid}
`,{mode:384}),hD(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),_J(Y,`service starting on http://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await SD({port:J,host:Q,silent:!0}),_J(Y,`service listening pid=${process.pid}`)}catch(H){if(_J(Y,`service failed to bind port ${J}: ${H instanceof Error?H.message:String(H)}`),uD(I)===process.pid)r8(I,{force:!0}),r8(U,{force:!0});throw H}let q=()=>{if(K)K.close(),K=null;if(uD(I)===process.pid)r8(I,{force:!0}),r8(U,{force:!0});_J(Y,`stopped pid=${process.pid}`)};await new Promise((H)=>{let G=!1,W=()=>{if(G)return;G=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),H()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function uz0($){fz0($.stateDir);let I=gJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=XG1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=xD($);return hD(Q,`${J.pid}
`,{mode:384}),_J(PH($),`started pid=${J.pid}`),{started:!0,...gJ($)}}function xz0($,I={}){let U=xD($),Y=yu($),J=uD(U);if(!J||!kz0(J,$.appRoot))return r8(U,{force:!0}),r8(Y,{force:!0}),I.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(J,"SIGTERM"),r8(U,{force:!0}),r8(Y,{force:!0}),_J(PH($),`stop requested pid=${J}`),I.quiet?void 0:{stopped:!0,pid:J}}function kz0($,I){if(!NG1($))return!1;try{let U=LG1("ps",["-p",String($),"-o","command="],{encoding:"utf8"});return(U.includes(I)||U.includes("seal-use")||U.includes("src/cli.ts"))&&U.includes("service")&&U.includes("run")}catch{return!1}}function NG1($){try{return process.kill($,0),!0}catch{return!1}}function xD($){return Su($.stateDir,"service.pid")}function yu($){return Su($.stateDir,"service.json")}function PH($){return Su($.stateDir,"service.log")}function uD($){if(!yD($))return;let I=Number(gu($,"utf8").trim());return Number.isInteger(I)&&I>0?I:void 0}function fz0($){DG1($,{recursive:!0,mode:448})}function _J($,I){hD($,`${new Date().toISOString()} ${I}
`,{flag:"a",mode:384})}var hu=AG1(MG1(),".config","seal-use");async function uu($,I,U){let Y=U?d0(U.options.port)??d0(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?d0(U.options.lines)??d0(U.options.n):void 0,K=await zI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:hu,version:I1,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)B0(K)}import{existsSync as PG1,readFileSync as iz0}from"node:fs";async function bz0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await D0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},w0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),H=q?JSON.parse(iz0(q,"utf8")):void 0,G=h(J.options.input),W=G?JSON.parse(iz0(G,"utf8")):s6(J.json),w=h(J.options.packageId)??h(J.options["package-id"]),V=w6(J.options.packageIds)??w6(J.options["package-ids"])??(w?[w]:void 0),Z=w6(J.options.flowIds)??w6(J.options["flow-ids"])??w6(J.options.documentSn)??w6(J.options["document-sn"]),X=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration),L=F0(J.options.noWait)??F0(J.options["no-wait"]);await D0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:F0(J.options.skipInvoiceGeneration)??F0(J.options["skip-invoice-generation"]),skipExpenseExtraction:F0(J.options.skipExpenseExtraction)??F0(J.options["skip-expense-extraction"]),disableAttachmentCache:F0(J.options.disableAttachmentCache)??F0(J.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:w,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:H,requestIds:w6(J.options.requestIds)??w6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:w6(J.options.flowStatusList)?.map(Number)??w6(J.options["flow-status-list"])?.map(Number),businessCodes:w6(J.options.businessCodes)??w6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:d0(J.options.startTime)??d0(J.options["start-time"]),endTime:d0(J.options.endTime)??d0(J.options["end-time"]),status:w6(J.options.status),limit:d0(J.options.limit),noWait:L,rawParams:W},w0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await D0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},w0(J.options));return}if($==="status"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await D0("seal_simulation_batch_status",U,Y,{batchId:Q},w0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await D0("seal_simulation_batch_clean",U,Y,{batchId:Q},w0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await D0("seal_simulation_specifications_list",U,Y,{signKey:Q},w0(J.options));return}if($==="approval-definitions"||$==="definitions"){await D0("seal_simulation_feishu_approval_definitions_list",U,Y,{},w0(J.options));return}if($==="list"){await D0("seal_simulation_batches_list",U,Y,{limit:d0(J.options.limit)},w0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await D0("seal_simulation_batch_get",U,Y,{batchId:Q},w0(J.options));return}if($==="templates"){await D0("seal_simulation_templates_get",U,Y,{},w0(J.options));return}if($==="integrations"){await D0("seal_simulation_integrations_get",U,Y,{},w0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!PG1(Q))throw Error(`File not found: ${Q}`);await D0("seal_simulation_material_package_upload",U,Y,{filePath:Q},w0(J.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as QX0}from"node:fs";import{join as kD}from"node:path";import{existsSync as xu,mkdirSync as ez0,rmSync as hG1,writeFileSync as uG1}from"node:fs";import{homedir as $X0}from"node:os";import{dirname as xG1,join as ku}from"node:path";var nz0=`---
name: seal-use
description: "v0.10.12: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description: "v0.10.15: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version: 0.10.12
short-description: Seal tenant and Hose approval automation (v0.10.12)
version: 0.10.15
short-description: Seal tenant and Hose approval automation (v0.10.15)
---
# Seal Use (v0.10.12)
# Seal Use (v0.10.15)
Use the \`seal_cli\` MCP tool when it is available; pass the command string as its \`command\` argument. If MCP is unavailable, fall back to the global \`seal-use\` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -522,7 +541,8 @@ seal-use corps list
- Prefer compact commands first: \`pick\`, \`--summary\`, \`--fields\`, \`attachments --summary\`, \`rules count\`, and \`rules list --summary\`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use \`seal-use corps ...\`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For repeat test-environment rule resets, prefer \`rules clear --dry-run\` followed by \`rules clear --yes\`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal \`--dry-run\` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use \`--yes\` only after reviewing its redacted \`changesDiff\`.
- Knowledge document creation is currently irreversible: the upstream API exposes no delete operation. Validate \`contentType\` and \`scenarios\` before creating, and use \`enabled: false\` when the document should be withdrawn.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of \`description\`; preserve \`scope\`, \`strictness\`, and unrelated clauses unless the user explicitly approves otherwise.
- Resolve and lock the target enterprise \`corpId\` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and \`--timezone Asia/Shanghai\`.
@@ -538,7 +558,8 @@ seal-use corps list
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read \`references/enterprise-onboarding.md\`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run \`seal-use delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read \`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- 模拟测试发布闭环: \`seal-use simulation create --mode hosecloud --flow-ids ... --corp <corpId>\` (合思指定单号) 或 \`--mode material_pack --package-ids ... --schema-config file.json\` (材料包导入), 支持多源系统 \`--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>\`, \`simulation wait <batchId>\` 轮询等待完成, \`simulation clean <batchId>\` 清理数据, \`simulation specifications\` 列出单据模板, \`simulation list\`/\`get\`/\`batch-records\` 查看批次与记录。创建前确认目标环境为测试环境。
- 模拟测试发布闭环: \`seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>\` (合思指定单号) 或 \`--mode material_pack --package-ids ... --schema-config file.json\` (材料包导入), 支持多源系统 \`--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>\`, \`simulation status <batchId>\` 单次查询状态, \`simulation wait <batchId>\` 轮询等待完成, \`simulation clean <batchId>\` 清理数据, \`simulation specifications\` 列出单据模板, \`simulation list\`/\`get\`/\`batch-records\` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: \`seal-use corps mark <corpId> --env <production|test> --confirm\` (严格标记环境), \`seal-use corps bind-test <prodCorpId> <testCorpId> --confirm\` (严格1对1下挂,禁止多层级串联), \`seal-use corps unbind-test <corpId> --confirm\`, \`seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]\` (将正式企业的偏好和草稿规则覆盖同步到测试企业并直接发布成新版本,正式企业规则保持草稿态不发布)。
- Seal AI 智能审核发布到合思费控: \`seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>\`; read \`references/hose-enterprise-deploy.md\`.
- 审核决策偏好与思考深度: \`seal-use preference get --corp <corpId>\`, \`preference decision update --json '...' --corp <corpId>\`, \`preference thinking-depth set --default <medium|high> --corp <corpId>\`, \`preference thinking-depth policies <list|upsert|remove> --corp <corpId>\`.
- 审核大盘统计与去重分析: \`seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|id] --corp <corpId>\`, \`seal-use approval-runs count --corp <corpId>\`.
@@ -548,12 +569,28 @@ seal-use corps list
- LLM Model Config & Providers: \`seal-use llm config --corp <corpId>\`, \`seal-use llm providers --corp <corpId>\`.
- System Permissions Config: \`seal-use permissions available --corp <corpId>\`, \`seal-use permissions configs --corp <corpId>\`.
- Billing & Feature Quotas: \`seal-use billing status --corp <corpId>\`, \`seal-use billing plans --corp <corpId>\`, \`seal-use billing features --corp <corpId>\`.
- Webhook 准备看板与审批回调管理: \`seal-use webhook ready [<材料包.zip>] --corp <corpId>\` (别名 \`status\`) 检查企业环境、租户连通性、已激活通道与材料包预检;\`seal-use webhook <list|get|add|update|delete> --corp <corpId>\`.
- Webhook 材料包导入: \`seal-use webhook material-pack preview <材料包.zip> --corp <corpId>\` 只做本地校验和解析;\`... push <材料包.zip> [--webhook <idOrName>] --corp <corpId>\` 上传附件并通过入站 Webhook 触发 AI 审批(租户仅有 1 个通道时自动锁定无需指定 \`--webhook\`)。它与 \`simulation material_pack\` 的官方服务端导入流程相互独立。
- Webhook 准备看板与审批回调管理: \`seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] --corp <corpId>\` (别名 \`status\`) 检查企业环境、租户连通性、已激活通道与材料包预检;\`seal-use webhook <list|get|add|update|delete> --corp <corpId>\`.
- Webhook 材料包导入: \`seal-use webhook material-pack preview <材料包.zip> --corp <corpId>\` 只做本地校验和解析(无网络请求);\`... push <材料包.zip> [--webhook <idOrName>] --corp <corpId>\` 上传附件并通过入站 Webhook 触发 AI 审批(租户仅有 1 个通道时自动锁定无需指定 \`--webhook\`)。每个 Webhook 可配置材料包附件的最小字节数、可选最大字节数和文件后缀白名单;这是可修改的持久化策略,不是不可绕过的硬编码。校验不通过时不会上传附件或推送单据。材料包格式:ZIP 根目录名 = \`documentId\`(或 \`documentId@annotation\`),Excel 附件列以 \`[附件]\` 为前缀(如 \`[附件]合同协议\`),单元格值为 ZIP 相对路径(支持多行/逗号/分号分隔);系统执行严格双向验证(Excel 声明的路径必须在 ZIP 中存在,ZIP 中的文件必须在某个 \`[附件]\` 列中声明)。详见 \`references/cli.md\` 中 "Material Pack Workflow" 一节。它与 \`simulation material_pack\` 的官方服务端导入流程相互独立。
- HTTP REST API & Docs Server: \`seal-use http [--port 8787] [--host 127.0.0.1]\` (提供 \`/docs\` 交互文档、\`/openapi.json\`、\`POST /api/cli\` 与 \`/v1/*\` REST API)。
- 审批规则质量校验 (Linter): \`seal-use rules lint [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary] --corp <corpId>\`; read \`references/rule-lint.md\`. 全局配置默认关闭 (\`config lint <enable|disable>\`)。
- Full CLI inventory: read \`references/cli.md\`.
## Material-pack Webhook policy and recovery
材料包附件策略保存在目标入站 Webhook 的 \`materialPackFilePolicy\` 下,按 Webhook 生效。新建 Webhook 的默认策略是:最小文件大小 \`500\` 字节、最大文件大小不限制、后缀白名单为常见 PDF/Office/文本/邮件/图片格式。\`信息表.xlsx\` 是材料包根清单,不属于普通附件,不受这三个附件策略限制。完整默认后缀和边界规则见 \`references/cli.md\`。
这套策略允许人工或助手修改。错误处理有两条通道:先通过错误通道明确告诉助手是哪一个文件、哪一条规则失败;再通过配置或文件处置通道完成恢复。遇到附件被拦截时按以下闭环处理:
1. 从错误中识别被拦截的文件、实际大小、失败规则和目标 Webhook。
2. 向用户说明可选处置:替换/压缩文件,或在确认允许该格式/大小后修改 Webhook 策略。
3. 用户或业务负责人明确确认放宽策略后,读取目标 Webhook 当前配置(CLI 使用 \`webhook get\`/\`webhook list\`,MCP 使用 \`seal_webhook_get\`/\`seal_webhook_list\`)。
4. 调用 \`seal_webhook_update\` 或 \`seal-use webhook update\` 修改最小值、最大值或完整后缀白名单,写入后重新读取核对,再重试原来的材料包 push。
push 会重新读取最新 Webhook 配置;校验通过后才会开始上传附件。CLI 以非零退出码和 \`stderr\` 返回可恢复的业务错误,MCP 以工具错误返回。没有用户授权或没有修改权限时,不能擅自放宽策略,也不能绕过校验。
注意:直接执行本地 \`material-pack preview\` 只使用默认策略或命令行临时覆盖,不会自动读取某个 Webhook 的持久化策略;\`webhook ready --file\`(指定 Webhook 时)和 \`material-pack push\` 才使用保存的 Webhook 策略。需要验证实际入站通道策略时,优先使用 \`ready --file --webhook ...\`,或直接重试 push。
## High-Value Commands
\`\`\`bash
@@ -609,14 +646,20 @@ seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅"
## Safety
Rule, document, style preference, and publish actions mutate Seal configuration. Make the target enterprise explicit, show the intended payload, and verify after the write. Never send real \`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var kX0=`interface:
`;var pz0=`interface:
display_name: "Seal Use"
short_description: "Diagnose approval feedback and publish minimal rule fixes"
default_prompt: "Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
`;var uX0=`# Rule Lightweight Queries
`;var cz0=`# Rule Lightweight Queries
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
## Draft and Published Rule Codes
\`rules list\` and \`rules pull\` operate on the current draft and therefore return draft \`code\` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as \`#0038\` is only meaningful together with its version context.
Use the draft \`id\` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
## Count Rules
Use count when only scale or existence matters.
@@ -718,7 +761,7 @@ Use current search only when the question is about current draft/current knowled
## Output Discipline
If a rule command would return many descriptions or more than about 20 rules, use \`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var fX0=`# Approval Bad Case Catalog
`;var dz0=`# Approval Bad Case Catalog
Use this file only as a comparison catalog after inspecting the current trace. Do not treat any case below as a default diagnosis.
@@ -768,7 +811,7 @@ Important nuance:
- This is a bad-case pattern, not a general rule that every amount-total dispute is caused by \`pre_analysis\`.
- Use it when the current trace shows recognized amounts being excluded downstream or duplicate attachments producing inconsistent conclusions.
`;var bX0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use <command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises` are merged.\n- User-level configs override same-ID local configs.\n\nEnterprise selection is stateless by default. Commands that access an enterprise require\n`--corp <corpId>` unless stateful mode is explicitly enabled:\n\n```bash\nseal-use config mode stateful --corp <corpId>\nseal-use corps switch <corpId>\nseal-use config mode stateless\n```\n\nThe global mode is stored in `~/.config/seal-use/config.json`; set `SEAL_USE_CONFIG_FILE` to\noverride that path. The legacy `current-corp` file is not read.\n\n## Stream & Exit Code Contract\n\n- **`stdout`**: Pure, deterministic JSON for machine/Agent parsing.\n- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** (e.g. `👉 Next action: ...`).\n- **`Exit Code`**: `0` on success, non-zero (e.g. `1`) on failure to trigger Agent error self-remediation.\n\n## Top-Level Commands\n\n```bash\nseal-use version\nseal-use config paths\nseal-use config get\nseal-use config mode <stateful|stateless> [--corp <corpId>]\nseal-use config test-dir [<path>|--clear]\nseal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]\nseal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]\nseal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]\nseal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]\nseal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]\nseal-use http [--port 8787] [--host 127.0.0.1]\nseal-use serve [--port 8787]\nseal-use update\nseal-use tools list\nseal-use corps list [--corp <corpId>]\nseal-use corps current [--corp <corpId>]\nseal-use corps switch <corpId>\nseal-use corps add-hose --json '{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]\nseal-use auth diagnose [--corp <corpId>]\nseal-use auth hose-link [--corp <corpId>] [--expire 7200]\nseal-use delegation list [--corp <corpId>]\nseal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]\nseal-use delegation revoke <tokenId> [--corp <corpId>]\nseal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]\nseal-use users reset-password <userId> [--corp <corpId>]\nseal-use users get <userId> [--corp <corpId>]\nseal-use users delete <userId> [--corp <corpId>]\nseal-use llm config [--corp <corpId>]\nseal-use llm providers [--corp <corpId>]\nseal-use permissions available [--corp <corpId>]\nseal-use permissions configs [--corp <corpId>]\nseal-use billing status [--corp <corpId>]\nseal-use billing plans [--corp <corpId>]\nseal-use billing features [--corp <corpId>]\nseal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]\nseal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]\nseal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]\nseal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]\nseal-use webhook delete <idOrName> --yes [--corp <corpId>]\nseal-use deploy hosecloud requirements [--corp <corpId>]\nseal-use deploy hosecloud list [--corp <corpId>]\nseal-use deploy hosecloud get [<sign-key>] [--corp <corpId>]\nseal-use deploy hosecloud status [--corp <corpId>]\nseal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]\nseal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]\nseal-use preference get [--corp <corpId>]\nseal-use preference decision update --json '{\"explicitApprove\":\"...\"}' [--corp <corpId>]\nseal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]\nseal-use preference thinking-depth policies list [--corp <corpId>]\nseal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]\nseal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]\nseal-use source config [--corp <corpId>]\nseal-use tool <toolName> [--corp <corpId>] [--json '{\"key\":\"value\"}']\nseal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]\nseal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by soLine truncated
`;var mz0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use <command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise `./enterprises` and `~/.config/seal-use/enterprises` are merged.\n- User-level configs override same-ID local configs.\n\nEnterprise selection is stateless by default. Commands that access an enterprise require\n`--corp <corpId>` unless stateful mode is explicitly enabled:\n\n```bash\nseal-use config mode stateful --corp <corpId>\nseal-use corps switch <corpId>\nseal-use config mode stateless\n```\n\nThe global mode is stored in `~/.config/seal-use/config.json`; set `SEAL_USE_CONFIG_FILE` to\noverride that path. The legacy `current-corp` file is not read.\n\n## Stream & Exit Code Contract\n\n- **`stdout`**: Pure, deterministic JSON for machine/Agent parsing.\n- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** with the stable prefix `👉 Next action: seal-use ...`.\n- **`Exit Code`**: `0` on success; `1` runtime/upstream failure, `2` usage/argument error, `10` explicit destructive-operation confirmation required, `11` missing/invalid authentication, and `12` output protection requiring a compact/file/query alternative.\n\n## Top-Level Commands\n\n```bash\nseal-use version\nseal-use config paths\nseal-use config get\nseal-use config mode <stateful|stateless> [--corp <corpId>]\nseal-use config test-dir [<path>|--clear]\nseal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]\nseal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]\nseal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]\nseal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]\nseal-use service <start|stop|restart|status|logs> [--port 8787] [--host 127.0.0.1] [--lines 50]\nseal-use http [--port 8787] [--host 127.0.0.1]\nseal-use serve [--port 8787]\nseal-use update\nseal-use tools list\nseal-use corps list [--corp <corpId>]\nseal-use corps current [--corp <corpId>]\nseal-use corps switch <corpId>\nseal-use corps mark <corpId> --env <production|test> [--confirm]\nseal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]\nseal-use corps unbind-test [<corpId>] [--confirm]\nseal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]\nseal-use corps add-hose --json '{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-use corps add-seal --json '{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]\nseal-use auth diagnose [--corp <corpId>]\nseal-use auth hose-link [--corp <corpId>] [--expire 7200]\nseal-use delegation list [--corp <corpId>]\nseal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]\nseal-use delegation revoke <tokenId> [--corp <corpId>]\nseal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]\nseal-use users reset-password <userId> [--corp <corpId>]\nseal-use users get <userId> [--corp <corpId>]\nseal-use users delete <userId> [--corp <corpId>]\nseal-use contacts departments [<departmentId>] [--corp <corpId>]\nseal-use contacts children <departmentId> [--corp <corpId>]\nseal-use contacts users <departmentId> [--corp <corpId>]\nseal-use contacts sync-time [--corp <corpId>]\nseal-use data expenses --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]\nseal-use data invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]\nseal-use llm config [--corp <corpId>]\nseal-use llm providers [--corp <corpId>]\nseal-use permissions available [--corp <corpId>]\nseal-use permissions configs [--corp <corpId>]\nseal-use billing status [--corp <corpId>]\nseal-use billing plans [--corp <corpId>]\nseal-use billing features [--corp <corpId>]\nseal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]\nseal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]\nseal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]\nseal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--cLine truncated
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
@@ -989,7 +1032,7 @@ Manual image check:
- The customer's objection that they were receipts rather than invoices was reasonable.
However, the final rejection also had an independent rule-37 reason: payment screenshots totaled 699.48 while reimbursement was 700.00.
`;var nX0=`# Customer Feedback Rule Remediation
`;var rz0=`# Customer Feedback Rule Remediation
Use this low-freedom workflow when the user provides packaged customer feedback from WeChat, screenshots, rejection notifications, a document number, or expected business behavior and wants diagnosis or an approval-rule change.
@@ -1124,6 +1167,8 @@ seal-use tool seal_approval_rule_update --corp <corpId> \\
Do not send \`scope\` or \`strictness\` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
For a complete local rule-set sync, \`rules push\` is incremental: it matches pulled rules by stable \`id\`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with \`rules push --dry-run\` before applying.
## 9. Publish and verify
Publish only when explicitly authorized:
@@ -1153,7 +1198,7 @@ Return a compact report containing:
- New version number and version name, if published
- Verification result
- Whether a regression rerun was performed
`;var cX0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat Line truncated
`;var tz0="# Enterprise Onboarding\n\nRead this reference for first installation, zero configured enterprises, incoming credentials or assistance links, and browser-copied cURL. The goal is to identify the enterprise with the least user effort while keeping authentication material confidential.\n\n## Start With Discovery\n\nRun this before asking for setup parameters (if `seal-use` is not installed, first run `curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash`):\n\n```bash\nseal-use version\nseal-use corps list\n```\n\n- If `seal-use` is not installed on the system, run the curl install script above to install it.\n- If the target enterprise is listed, match the user's human enterprise name to its returned `id` and use that value as `--corp` on every command. Do not ask the user for `corpId`.\n- If multiple configured enterprises plausibly match, show their human names and let the user choose. Keep their IDs as implementation details.\n- If none are configured, ask one plain-language question: “你现在手上有哪一种接入材料:合思开放平台 appKey/appSecurity、合思授权/协助链接、Seal 协助链接,还是从已登录的合思或 Seal 网页复制的 cURL?”\n\nDo not open with a JSON template or a list of internal fields.\n\nAll command examples in this reference are for the Agent to run. Do not hand them to the user as setup instructions. Communicate with the user in natural language and translate their answer into CLI/MCP parameters yourself.\n\n## Keep Two Concepts Separate\n\nClassify both the enterprise identity origin and how the current credential was acquired:\n\n| Enterprise identity origin | Credential material the user may have | Meaning |\n| --- | --- | --- |\n| Hose/合思-sourced Seal tenant | Hose `appKey` + `appSecurity` | Stable, refreshable standard integration |\n| Hose/合思-sourced Seal tenant | Hose authorization/assistance link | Temporary Hose authorization that can lead into the Seal SSO session |\n| Hose/合思-sourced Seal tenant | cURL copied from an authenticated Hose or Seal page | Snapshot of a signed-in browser session; it may expire |\n| Seal-native tenant | Seal assistance/delegation link | Temporary delegated access to a Seal tenant |\n| Seal-native tenant | cURL copied from an authenticated Seal page | Snapshot containing the Seal host and session authentication |\n\nCredential shape alone does not define identity origin. In particular, a Hose-sourced user eventually receives a Seal Bearer session after SSO. When `whoami` returns provider metadata, preserve it and use it to describe the tenant accurately.\n\n## Parameter Ownership\n\nAsk the user only for information that cannot be discovered safely:\n\n| Field | Owner and behavior |\n| --- | --- |\n| `appKey`, `appSecurity` | User supplies these for standard Hose OpenAPI onboarding. Explain that they come from the enterprise's 合思开放平台 application credentials. Treat both as secrets. |\n| `domain` | Probe the standard Hose SaaS domains automatically. Ask only when probing fails and the enterprise uses a private or dedicated deployment. |\n| Enterprise name and `corpId` | Discover from the credential response or Seal `whoami`. Do not ask the user to invent or locate them first. |\n| Administrator and `staffId` | Discover administrator candidates. If more than one is eligible, present name and masked phone for the user to choose; pass the selected ID internally. |\n| Seal URL, tenant ID, tenant slug | Discover from the assistance link, cURL host, and Seal `whoami`. |\n| Bearer token, cookies, signed query tokens | Extract only from user-supplied authentication material. Never print them back or include them in summaries. |\n\n## Route 1: Standard Hose Credentials\n\nThis is the preferred durable route for a Hose-sourced tenant. Read `hose-enterprise-init.md`, then use:\n\n```bash\nseal-use corps add-hose --json '{\"appKey\":\"...\",\"appSecurity\":\"...\"}'\n```\n\nThe CLI probes the standard domains, discovers the corporation, and discovers administrator candidates. If it returns multiple candidates, show only useful identifying information and ask which person should be used; retry with `staffName`, `staffPhone`, or the selected `staffId` internally. After creation, run:\n\n```bash\nseal-use auth diagnose --corp <discovered-id>\n```\n\nDo not ask for `domain`, `corpId`, or `proxyStaffBizId` up front. For a dedicated/private Hose deployment, add `domain` only after standard probing reports that it cannot find the enterprise.\n\n## Route 2: Incoming Assistance Link\n\nFirst distinguish the link by its host and purpose:\n\n- A Hose authorization/provisional link opens a Hose session and may continue through Seal SSO. It is not a Seal delegation link.\n- A Seal assistance/delegation link grants temporary delegated access on a Seal tenant. It is not a Hose OpenAPI credential.\n- `seal-use auth hose-link` and `seal-use delegation create` generat Line truncated
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
@@ -1218,7 +1263,7 @@ Important:
- \`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
- **Formatting Requirement**: When returning a Hose authorization link to the user, ALWAYS provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- If the CLI later provides a dedicated command for this, prefer that command.
`;var mX0=`# Hose Enterprise Initialization & Automated Discovery
`;var sz0=`# Hose Enterprise Initialization & Automated Discovery
Use this reference for automated Hose/合思 enterprise onboarding, multi-domain probing (including dedicated private cloud domains like 美年大健康), OpenAPI role and staff discovery, and non-TUI safe administrator selection.
@@ -1324,12 +1369,12 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
* 直接使用指定 ID 完成接入并进行连通性验证。
`;var rX0={"SKILL.md":xX0,"agents/openai.yaml":kX0,"references/rule-lightweight.md":uX0,"references/approval-bad-cases.md":fX0,"references/cli.md":bX0,"references/approval-run-lightweight.md":iX0,"references/approval-attachment-trace.md":pX0,"references/customer-feedback-rule-remediation.md":nX0,"references/enterprise-onboarding.md":cX0,"references/hose-enterprise-auth.md":dX0,"references/hose-enterprise-init.md":mX0};function tX0(){return rX0["SKILL.md"]||""}function VG(){return Wx(oX0(),".agents","skills","seal-use")}function aX0(){return Wx(oX0(),".agents","skills","seal-home")}function sX0(){let $=aX0();if(Hx($))try{return DG1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Vx($=VG()){sX0(),lX0($,{recursive:!0});let I=[];for(let[U,Y]of Object.entries(rX0)){let J=Wx($,U);lX0(OG1(J),{recursive:!0}),wG1(J,Y,"utf8"),I.push(U)}return{targetDir:$,files:I}}function Zx(){let $=aX0(),I=VG(),U=Hx($),Y=Hx(I);if(U||Y)return sX0(),Vx(I),{synced:!0,targetDir:I};return{synced:!1}}function $L0($,I,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${tX0()}
`);return}if($==="install"||$==="init"||$==="sync"){let Y=_0(U.options.local)||_0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?LO(process.cwd(),".agents","skills","seal-use"):VG(),K=Vx(Q);E0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=VG(),J=LO(process.cwd(),".agents","skills","seal-use");E0({global:{dir:Y,installed:eX0(LO(Y,"SKILL.md"))},local:{dir:J,installed:eX0(LO(J,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}async function IL0($,I){if($==="config"){E0(await zJ(I));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}async function UL0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,U,t6(Y.json),O0(Y.options))}function YL0(){E0(YG.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as NG1,mkdirSync as FG1,renameSync as Xx,rmSync as MG1,unlinkSync as GL0,writeFileSync as JL0}from"node:fs";import{dirname as zG1,join as QL0}from"node:path";import{spawnSync as qI}from"node:child_process";function DO($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.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 HL0="yunyingk/seal-use",XG="yunyingk/seal-home";var AG1="SEAL_USE_GITHUB_REPO",PG1="SEAL_HOME_GITHUB_REPO";async function WL0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:qx,version:e0,launcher:$.launcher},Y=I.repo||process.env[AG1]?.trim()||process.env[PG1]?.trim()||HL0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let T=Q.replace(/^v/,""),C=VL0(T,e0);if(C<0){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:DO()?"binary":"source",message:`Cannot downgrade seal-use from v${e0} to older version v${T}. Updates must be forward-only.`});return}if(C===0&&!I.force){E0({updated:!1,currentVersion:e0,targetVersion:T,mode:DO()?"binary":"source",message:`seal-use is already at version v${e0}. Use --force to reinstall.`});return}}if(I.changelogOnly){let T=await Lx(Y,I.limit??10);E0({currentVersion:e0,totalQueried:T.length,releases:T.map((C)=>({version:C.version,tagName:C.tagName,publishedAt:C.publishedAt,author:C.author,releaseNotes:C.notes,releaseUrl:C.htmlUrl,isCurrent:C.version===e0,isNewer:ZG(C.version,e0)}))});return}if(!DO()){if(I.checkOnly){let C=await Lx(Y,30),u=C[0],g=u?.version??e0,b=C.find((p)=>p.version===e0),v=ZG(g,e0),n=C.filter((p)=>ZG(p.version,e0));E0({updated:!1,updateAvailable:v,currentVersion:e0,currentVersionPublishedAt:b?.publishedAt,latestVersion:g,latestVersionPublishedAt:u?.publishedAt,behindCount:n.length,pendingReleases:n.map((p)=>({version:p.version,tagName:p.tagName,publishedAt:p.publishedAt,author:p.author,releaseNotes:p.notes,releaseUrl:p.htmlUrl})),releaseNotes:u?.notes??"",releaseUrl:u?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let T=PJ(U).running;if(T)await KI("stop",U);try{qL0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(C){console.error(`git pull skipped: ${C instanceof Error?C.message:String(C)}`)}if(qL0("bun",["install"],{cwd:$.appRoot}),T)await KI("start",U);E0({updated:!0,serviceRestarted:T,version:e0,mode:"source"});return}let K=TG1(),q=EG1(),G=await Lx(Y,30),H=Q?G.find((T)=>T.version===Q||T.tagName===Q||T.tagName===`v${Q}`)??await KL0(Y,Q):G[0]??await KL0(Y);if(!H){E0({updated:!1,currentVersion:e0,mode:"binary",message:`Failed to query releases from repository '${Y}'`});return}let W=H.version,V=G.find((T)=>T.version===e0),X=ZG(W,e0),Z=X||Boolean(I.force),D=G.filter((T)=>ZG(T.version,e0));if(I.checkOnly){E0({updated:!1,updateAvailable:X,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,behindCount:D.length,pendingReleases:D.map((T)=>({version:T.version,tagName:T.tagName,publishedAt:T.publishedAt,author:T.author,releaseNotes:T.notes,releaseUrl:T.htmlUrl})),releaseNotes:H.notes,releaseUrl:H.htmlUrl,mode:"binary"});return}if(!Z){E0({updated:!1,currentVersion:e0,currentVersionPublishedAt:V?.publishedAt,latestVersion:W,latestVersionPublishedAt:H.publishedAt,mode:"binary",message:`seal-use is already up to date (v${e0})`});return}let w=BG1(H.assets,K,q);if(!w)throw Error(`No compatible binary found for ${K}-${q} in release v${W}. Available assets: ${H.assets.map((T)=>T.name).join(", ")}`);let O=PJ(U).running;if(O)await KI("stop",U);let F=process.execPath,E=zG1(F),A=QL0(E,`.tmp-update-${Date.now()}`);FG1(A,{recursive:!0});try{let T=QL0(A,w.name);await RG1(w.downloadUrl,T,H.tagName,w.name);let C=T;if(w.name.endsWith(".tar.gz")||w.name.endsWith(".tgz"))C=CG1(T,A,K);else if(w.name.endsWith(".zip"))C=vG1(T,A,K);if(NG1(C,493),process.platform==="darwin")try{qI("/usr/bin/codesig Line truncated
`)}catch{}}async function RG1($,I,U,Y){let J=Dx(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let w=`https://github.com/${HL0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);Q.push(w)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let G=Array.from(new Set(Q)),H,W=6000,V=6000,X=307200,Z=1e4,D=180000;for(let w=0;w<G.length;w++){let O=G[w],F=new AbortController,E="",A=(g)=>{E=g;try{F.abort()}catch{}},T=setTimeout(()=>{A("Connection timed out (no response headers within 6s)")},W),C,u;try{wO(`==> [${w+1}/${G.length}] Downloading via: ${O}`);let g=await fetch(O,{signal:F.signal});if(T)clearTimeout(T),T=void 0;if(!g.ok)throw Error(`HTTP ${g.status} ${g.statusText}`);C=setTimeout(()=>{A("Overall download time exceeded 3 minutes")},D);let b=Number(g.headers.get("content-length"))||0,v=g.body?.getReader();if(!v){let i=Buffer.from(await g.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);JL0(I,i),wO(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let n=[],p=0,S=0;u=setTimeout(()=>{if(p<X){let i=(p/1024).toFixed(1);A(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},V);while(!0){let i=v.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),k;try{k=await Promise.race([i,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=k;if(d)break;if(t){if(n.push(t),p+=t.length,u&&p>=X)clearTimeout(u),u=void 0;let K0=Date.now();if(K0-S>200){S=K0;let W0=b?Math.round(p/b*100):0,z0=(p/1048576).toFixed(1),B0=b?(b/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${z0} / ${B0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let f=Buffer.concat(n);if(f.length<1000)throw Error(`Downloaded content is suspiciously small (${f.length} bytes)`);JL0(I,f),wO(`✓ Download completed successfully (${(f.length/1024/1024).toFixed(1)} MB)`);return}catch(g){if(T)clearTimeout(T);if(u)clearTimeout(u);if(C)clearTimeout(C);let b=E||(g instanceof Error?g.message:String(g));H=Error(b),wO(`
↳ Mirror failed: ${H.message}`)}finally{if(T)clearTimeout(T);if(u)clearTimeout(u);if(C)clearTimeout(C)}}throw Error(`Failed to download asset from all mirrors: ${H?.message}`)}function CG1($,I,U){let Y=qI("tar",["-xzf",$,"-C",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract tar archive: ${Y.stderr.toString()}`);GL0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=qI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function vG1($,I,U){let Y=qI("unzip",["-q","-o",$,"-d",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract zip archive: ${Y.stderr.toString()}`);GL0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=qI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function VL0($,I){let U=$.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0),Y=I.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0);for(let J=0;J<Math.max(U.length,Y.length);J++){let Q=U[J]??0,K=Y[J]??0;if(Q>K)return 1;if(Q<K)return-1}return 0}function ZG($,I){return VL0($,I)>0}function qL0($,I,U={}){let Y=qI($,I,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Y.stdout)console.error(Y.stdout.trimEnd());if(Y.stderr)console.error(Y.stderr.trimEnd());if(Y.status!==0)throw Error(`${$} ${I.join(" ")} failed with status ${Y.status}`)}async function ZL0($,I,U,Y,J){if($==="create"){let Q=h(J.options.name)??I,K=h(J.options.phone);if(!Q||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let q=h(J.options.dept)??h(J.options.departmentId);await F0("seal_user_create",U,Y,{name:Q,phone:K,departmentIds:q?[q]:void 0},O0(J.options));return}if($==="reset-password"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users reset-password <userId>");await F0("seal_user_reset_password",U,Y,{userId:Q},O0(J.options));return}if($==="search"||$==="list"){let Q=I??h(J.options.keyword)??h(J.options.query)??"";await F0("seal_user_search",U,Y,{keyword:Q},O0(J.options));return}if($==="get"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users get <userId>");await F0("seal_user_get",U,Y,{userId:Q},O0(J.options));return}if($==="delete"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users delete <userId>");await F0("seal_user_delete",U,Y,{userId:Q},O0(J.options));return}if($==="activate"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users activate <userId>");await F0("seal_user_activate",U,Y,{userId:Q},O0(J.options));return}if($==="delegation"||$==="impersonate"){let Q=I??h(J.options.userId)??h(J.options.phone);if(!Q)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=h(J.options.note);await F0("seal_user_delegation_create",U,Y,{userIdOrPhone:Q,note:K},O0(J.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as XL0}from"node:fs";async function LL0($){if(!XL0($))throw Error(`File not found: ${$}`);let I=II($);console.log(JSON.stringify(await $I(I.fileBuffer,I.fileName),null,2))}async function DL0($,I,U,Y,J){if($==="ready"||$==="status"){let Q=I??h(J.options.file)??h(J.options.input),K=await rw(U,Y,{filePath:Q});if(console.error(`[webhook-ready] 企业环境: ${K.corp.name} (${K.corp.id}) [${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${K.corp.tenant.name} (${K.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${K.activeWebhooks.length} 个可用`);for(let q of K.activeWebhooks){let G=q.isDefault?" [默认通道]":"";console.error(` - ${q.name} (${q.id}) mode=${q.mode}${G}`)}if(K.materialPack)console.error(`[webhook-ready] 材料包预检: ${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2 ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);console.log(JSON.stringify(K,null,2));return}if($==="material-pack"||$==="material-pack-push"){let Q=$==="material-pack-push"?"push":I,K=$==="material-pack-push"?h(J.options.file)??h(J.options.input):J.command[3]??h(J.options.file)??h(J.options.input);if(!K)throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");if(!XL0(K))throw Error(`File not found: ${K}`);let q=II(K);if(Q==="preview"){console.log(JSON.stringify(await $I(q.fileBuffer,q.fileName),null,2));return}if(Q!=="push")throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");let G=h(J.options.webhook)??h(J.options.selector),H=await Z9(U,Y.seal.endpoints.approvalStylePreferences),W;if(G)W=LU(H,G);else if(H.length===1)W=H[0],console.error(`\uD83D\uDC49 自动锁定唯一可用 Webhook 通道: ${W.name} (${W.id})`);else if(H.length>1){let X=H.map((Z)=>`"${Z.name}" (${Z.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${X}],请通过 --webhook <idOrName> 指定目标通道。`)}else throw Error("当前租户未配置任何 Webhook 集成通道。请先运行 'seal-use webhook add --name ... --result-url ...' 创建通道。");let V=await ow(q.fileBuffer,q.fileName,{webhookUrl:W.incomingDocumentWebhook.url,secret:W.secret});console.log(JSON.stringify(V,null,2));return}if($==="list"){await F0("seal_webhook_list",U,Y,{query:h(J.options.query)??h(J.options.keyword),includeSecret:ah(J.options)},O0(J.options Line truncated
`;var IX0={"SKILL.md":nz0,"agents/openai.yaml":pz0,"references/rule-lightweight.md":cz0,"references/approval-bad-cases.md":dz0,"references/cli.md":mz0,"references/approval-run-lightweight.md":lz0,"references/approval-attachment-trace.md":oz0,"references/customer-feedback-rule-remediation.md":rz0,"references/enterprise-onboarding.md":tz0,"references/hose-enterprise-auth.md":az0,"references/hose-enterprise-init.md":sz0};function UX0(){return IX0["SKILL.md"]||""}function TH(){return ku($X0(),".agents","skills","seal-use")}function YX0(){return ku($X0(),".agents","skills","seal-home")}function JX0(){let $=YX0();if(xu($))try{return hG1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function fu($=TH()){JX0(),ez0($,{recursive:!0});let I=[];for(let[U,Y]of Object.entries(IX0)){let J=ku($,U);ez0(xG1(J),{recursive:!0}),uG1(J,Y,"utf8"),I.push(U)}return{targetDir:$,files:I}}function iu(){let $=YX0(),I=TH(),U=xu($),Y=xu(I);if(U||Y)return JX0(),fu(I),{synced:!0,targetDir:I};return{synced:!1}}function KX0($,I,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${UX0()}
`);return}if($==="install"||$==="init"||$==="sync"){let Y=F0(U.options.local)||F0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?kD(process.cwd(),".agents","skills","seal-use"):TH(),K=fu(Q);B0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=TH(),J=kD(process.cwd(),".agents","skills","seal-use");B0({global:{dir:Y,installed:QX0(kD(Y,"SKILL.md"))},local:{dir:J,installed:QX0(kD(J,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}async function qX0($,I){if($==="config"){B0(await jJ(I));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}async function HX0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await D0($,I,U,s6(Y.json),w0(Y.options))}function GX0(){B0(XH.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as kG1,mkdirSync as fG1,renameSync as bu,rmSync as iG1,unlinkSync as zX0,writeFileSync as WX0}from"node:fs";import{dirname as bG1,join as wX0}from"node:path";import{spawnSync as XI}from"node:child_process";function fD($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.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 XX0="yunyingk/seal-use",BH="yunyingk/seal-home";var nG1="SEAL_USE_GITHUB_REPO",pG1="SEAL_HOME_GITHUB_REPO";async function LX0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:hu,version:I1,launcher:$.launcher},Y=I.repo||process.env[nG1]?.trim()||process.env[pG1]?.trim()||XX0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let A=Q.replace(/^v/,""),R=DX0(A,I1);if(R<0){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:fD()?"binary":"source",message:`Cannot downgrade seal-use from v${I1} to older version v${A}. Updates must be forward-only.`});return}if(R===0&&!I.force){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:fD()?"binary":"source",message:`seal-use is already at version v${I1}. Use --force to reinstall.`});return}}if(I.changelogOnly){let A=await nu(Y,I.limit??10);B0({currentVersion:I1,totalQueried:A.length,releases:A.map((R)=>({version:R.version,tagName:R.tagName,publishedAt:R.publishedAt,author:R.author,releaseNotes:R.notes,releaseUrl:R.htmlUrl,isCurrent:R.version===I1,isNewer:EH(R.version,I1)}))});return}if(!fD()){if(I.checkOnly){let R=await nu(Y,30),k=R[0],S=k?.version??I1,i=R.find((n)=>n.version===I1),C=EH(S,I1),p=R.filter((n)=>EH(n.version,I1));B0({updated:!1,updateAvailable:C,currentVersion:I1,currentVersionPublishedAt:i?.publishedAt,latestVersion:S,latestVersionPublishedAt:k?.publishedAt,behindCount:p.length,pendingReleases:p.map((n)=>({version:n.version,tagName:n.tagName,publishedAt:n.publishedAt,author:n.author,releaseNotes:n.notes,releaseUrl:n.htmlUrl})),releaseNotes:k?.notes??"",releaseUrl:k?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let A=gJ(U).running;if(A)await zI("stop",U);try{ZX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(R){console.error(`git pull skipped: ${R instanceof Error?R.message:String(R)}`)}if(ZX0("bun",["install"],{cwd:$.appRoot}),A)await zI("start",U);B0({updated:!0,serviceRestarted:A,version:I1,mode:"source"});return}let K=cG1(),q=dG1(),H=await nu(Y,30),G=Q?H.find((A)=>A.version===Q||A.tagName===Q||A.tagName===`v${Q}`)??await VX0(Y,Q):H[0]??await VX0(Y);if(!G){B0({updated:!1,currentVersion:I1,mode:"binary",message:`Failed to query releases from repository '${Y}'`});return}let W=G.version,w=H.find((A)=>A.version===I1),V=EH(W,I1),Z=V||Boolean(I.force),X=H.filter((A)=>EH(A.version,I1));if(I.checkOnly){B0({updated:!1,updateAvailable:V,currentVersion:I1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,behindCount:X.length,pendingReleases:X.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:G.notes,releaseUrl:G.htmlUrl,mode:"binary"});return}if(!Z){B0({updated:!1,currentVersion:I1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,mode:"binary",message:`seal-use is already up to date (v${I1})`});return}let L=mG1(G.assets,K,q);if(!L)throw Error(`No compatible binary found for ${K}-${q} in release v${W}. Available assets: ${G.assets.map((A)=>A.name).join(", ")}`);let D=gJ(U).running;if(D)await zI("stop",U);let F=process.execPath,E=bG1(F),T=wX0(E,`.tmp-update-${Date.now()}`);fG1(T,{recursive:!0});try{let A=wX0(T,L.name);await lG1(L.downloadUrl,A,G.tagName,L.name);let R=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))R=oG1(A,T,K);else if(L.name.endsWith(".zip"))R=rG1(A,T,K);if(kG1(R,493),process.platform==="darwin")try{XI("/usr/bin/codesig Line truncated
`)}catch{}}async function lG1($,I,U,Y){let J=pu(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let L=`https://github.com/${XX0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Q.push(L)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let H=Array.from(new Set(Q)),G,W=6000,w=6000,V=307200,Z=1e4,X=180000;for(let L=0;L<H.length;L++){let D=H[L],F=new AbortController,E="",T=(S)=>{E=S;try{F.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},W),R,k;try{iD(`==> [${L+1}/${H.length}] Downloading via: ${D}`);let S=await fetch(D,{signal:F.signal});if(A)clearTimeout(A),A=void 0;if(!S.ok)throw Error(`HTTP ${S.status} ${S.statusText}`);R=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let i=Number(S.headers.get("content-length"))||0,C=S.body?.getReader();if(!C){let b=Buffer.from(await S.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);WX0(I,b),iD(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],n=0,g=0;k=setTimeout(()=>{if(n<V){let b=(n/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},w);while(!0){let b=C.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),x;try{x=await Promise.race([b,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=x;if(d)break;if(t){if(p.push(t),n+=t.length,k&&n>=V)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-g>200){g=K0;let W0=i?Math.round(n/i*100):0,A0=(n/1048576).toFixed(1),v0=i?(i/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${A0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let f=Buffer.concat(p);if(f.length<1000)throw Error(`Downloaded content is suspiciously small (${f.length} bytes)`);WX0(I,f),iD(`✓ Download completed successfully (${(f.length/1024/1024).toFixed(1)} MB)`);return}catch(S){if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R);let i=E||(S instanceof Error?S.message:String(S));G=Error(i),iD(`
↳ Mirror failed: ${G.message}`)}finally{if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R)}}throw Error(`Failed to download asset from all mirrors: ${G?.message}`)}function oG1($,I,U){let Y=XI("tar",["-xzf",$,"-C",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract tar archive: ${Y.stderr.toString()}`);zX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=XI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function rG1($,I,U){let Y=XI("unzip",["-q","-o",$,"-d",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract zip archive: ${Y.stderr.toString()}`);zX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=XI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function DX0($,I){let U=$.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0),Y=I.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0);for(let J=0;J<Math.max(U.length,Y.length);J++){let Q=U[J]??0,K=Y[J]??0;if(Q>K)return 1;if(Q<K)return-1}return 0}function EH($,I){return DX0($,I)>0}function ZX0($,I,U={}){let Y=XI($,I,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Y.stdout)console.error(Y.stdout.trimEnd());if(Y.stderr)console.error(Y.stderr.trimEnd());if(Y.status!==0)throw Error(`${$} ${I.join(" ")} failed with status ${Y.status}`)}async function OX0($,I,U,Y,J){if($==="create"){let Q=h(J.options.name)??I,K=h(J.options.phone);if(!Q||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let q=h(J.options.dept)??h(J.options.departmentId);await D0("seal_user_create",U,Y,{name:Q,phone:K,departmentIds:q?[q]:void 0},w0(J.options));return}if($==="reset-password"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users reset-password <userId>");await D0("seal_user_reset_password",U,Y,{userId:Q},w0(J.options));return}if($==="search"||$==="list"){let Q=I??h(J.options.keyword)??h(J.options.query)??"";await D0("seal_user_search",U,Y,{keyword:Q},w0(J.options));return}if($==="get"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users get <userId>");await D0("seal_user_get",U,Y,{userId:Q},w0(J.options));return}if($==="delete"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users delete <userId>");await D0("seal_user_delete",U,Y,{userId:Q},w0(J.options));return}if($==="activate"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users activate <userId>");await D0("seal_user_activate",U,Y,{userId:Q},w0(J.options));return}if($==="delegation"||$==="impersonate"){let Q=I??h(J.options.userId)??h(J.options.phone);if(!Q)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=h(J.options.note);await D0("seal_user_delegation_create",U,Y,{userIdOrPhone:Q,note:K},w0(J.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as FX0}from"node:fs";async function NX0($,I){if(!FX0($))throw Error(`File not found: ${$}`);let U=GI($);console.log(JSON.stringify(await HI(U.fileBuffer,U.fileName,I),null,2))}async function MX0($,I,U,Y,J){if($==="ready"||$==="status"){let Q=I??h(J.options.file)??h(J.options.input),K=await XD(U,Y,{filePath:Q,webhook:h(J.options.webhook)??h(J.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${K.corp.name} (${K.corp.id}) [${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${K.corp.tenant.name} (${K.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${K.activeWebhooks.length} 个可用`);for(let q of K.activeWebhooks){let H=q.isDefault?" [默认通道]":"";console.error(` - ${q.name} (${q.id}) mode=${q.mode}${H}`)}if(K.materialPack)console.error(`[webhook-ready] 材料包预检: ${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2 ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);console.log(JSON.stringify(K,null,2));return}if($==="material-pack"||$==="material-pack-push"){let Q=$==="material-pack-push"?"push":I,K=$==="material-pack-push"?h(J.options.file)??h(J.options.input):J.command[3]??h(J.options.file)??h(J.options.input);if(!K)throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");if(!FX0(K))throw Error(`File not found: ${K}`);let q=GI(K);if(Q==="preview"){console.log(JSON.stringify(await HI(q.fileBuffer,q.fileName),null,2));return}if(Q!=="push")throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");let H=h(J.options.webhook)??h(J.options.selector),G=await F9(U,Y.seal.endpoints.approvalStylePreferences),W;if(H)W=N9(G,H);else if(G.length===1)W=G[0],console.error(`\uD83D\uDC49 自动锁定唯一可用 Webhook 通道: ${W.name} (${W.id})`);else if(G.length>1){let V=G.map((Z)=>`"${Z.name}" (${Z.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${V}],请通过 --webhook <idOrName> 指定目标通道。`)}else throw new l8("当前租户未配置任何 Webhook 集成通道。",1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`);let w=await zD(q.fileBuffer,q.fileName,{webhookUrl:W.incomingDocumentWebhook.url,secret:W.secret,materialPackFilePolicy:W.materialPackFilePolicy});console.log(JSON.stringify(w,null,2));return}if($==="list"){await D0("seal_webhook_ Line truncated
`)?"":`
`}`);process.exitCode=$.exitCode}var cG1=Boolean(r.main==r.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&FL0(process.argv[1])===FL0(p5));if(cG1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await nG1();else Ux().catch(($)=>{console.error($),process.exitCode=1});export{$x as tokenizeCommand,Ux as startServer,bG1 as resolveMcpEnabled,iG1 as createServer,uG1 as SEAL_MCP_ENABLED_ENV,kG1 as SEAL_CLI_TOOL_NAME,fG1 as LEGACY_SEAL_MCP_ENABLED_ENV};
`}`);process.exitCode=$.exitCode}var WW1=Boolean(r.main==r.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&EX0(process.argv[1])===EX0(r5));if(WW1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await GW1();else ju().catch(($)=>{console.error($),process.exitCode=1});export{Ru as tokenizeCommand,ju as startServer,KW1 as resolveMcpEnabled,qW1 as createServer,JW1 as SEAL_MCP_ENABLED_ENV,YW1 as SEAL_CLI_TOOL_NAME,QW1 as LEGACY_SEAL_MCP_ENABLED_ENV};
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-use Wrapped API",
"version": "0.10.12",
"version": "0.10.15",
"description": "Planned HTTP contract for the seal-use wrapped backend API.\n\nThese endpoints describe the intended stable API for frontend developers and agents once\nthe HTTP adapter is implemented.\nThey are not the raw downstream Seal endpoints. seal-use is responsible for enterprise\nselection, source authentication, response compaction, and diagnostics-friendly fields.\n"
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-use Wrapped API
version: 0.10.12
version: 0.10.15
description: |
Planned HTTP contract for the seal-use wrapped backend API.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.12",
"version": "0.10.15",
"type": "module",
"module": "src/server.ts",
"bin": {
+25 -8
View File
@@ -1,12 +1,12 @@
---
name: seal-use
description: "v0.10.12: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
description: "v0.10.15: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version: 0.10.12
short-description: Seal tenant and Hose approval automation (v0.10.12)
version: 0.10.15
short-description: Seal tenant and Hose approval automation (v0.10.15)
---
# Seal Use (v0.10.12)
# Seal Use (v0.10.15)
Use the `seal_cli` MCP tool when it is available; pass the command string as its `command` argument. If MCP is unavailable, fall back to the global `seal-use` CLI. This skill is a routing layer for agents: keep this file short, choose the right command, and read a focused reference only when the task needs detail.
@@ -39,7 +39,8 @@ seal-use corps list
- Prefer compact commands first: `pick`, `--summary`, `--fields`, `attachments --summary`, `rules count`, and `rules list --summary`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use `seal-use corps ...`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For repeat test-environment rule resets, prefer `rules clear --dry-run` followed by `rules clear --yes`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal `--dry-run` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use `--yes` only after reviewing its redacted `changesDiff`.
- Knowledge document creation is currently irreversible: the upstream API exposes no delete operation. Validate `contentType` and `scenarios` before creating, and use `enabled: false` when the document should be withdrawn.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of `description`; preserve `scope`, `strictness`, and unrelated clauses unless the user explicitly approves otherwise.
- Resolve and lock the target enterprise `corpId` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and `--timezone Asia/Shanghai`.
@@ -55,7 +56,8 @@ seal-use corps list
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read `references/enterprise-onboarding.md`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run `seal-use delegation create --corp <corpId> --note '<enterprise>'`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read `references/customer-feedback-rule-remediation.md`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- 模拟测试发布闭环: `seal-use simulation create --mode hosecloud --flow-ids ... --corp <corpId>` (合思指定单号) 或 `--mode material_pack --package-ids ... --schema-config file.json` (材料包导入), 支持多源系统 `--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>`, `simulation wait <batchId>` 轮询等待完成, `simulation clean <batchId>` 清理数据, `simulation specifications` 列出单据模板, `simulation list`/`get`/`batch-records` 查看批次与记录。创建前确认目标环境为测试环境。
- 模拟测试发布闭环: `seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` (合思指定单号) 或 `--mode material_pack --package-ids ... --schema-config file.json` (材料包导入), 支持多源系统 `--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>`, `simulation status <batchId>` 单次查询状态, `simulation wait <batchId>` 轮询等待完成, `simulation clean <batchId>` 清理数据, `simulation specifications` 列出单据模板, `simulation list`/`get`/`batch-records` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: `seal-use corps mark <corpId> --env <production|test> --confirm` (严格标记环境), `seal-use corps bind-test <prodCorpId> <testCorpId> --confirm` (严格1对1下挂,禁止多层级串联), `seal-use corps unbind-test <corpId> --confirm`, `seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]` (将正式企业的偏好和草稿规则覆盖同步到测试企业并直接发布成新版本,正式企业规则保持草稿态不发布)。
- Seal AI 智能审核发布到合思费控: `seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>`; read `references/hose-enterprise-deploy.md`.
- 审核决策偏好与思考深度: `seal-use preference get --corp <corpId>`, `preference decision update --json '...' --corp <corpId>`, `preference thinking-depth set --default <medium|high> --corp <corpId>`, `preference thinking-depth policies <list|upsert|remove> --corp <corpId>`.
- 审核大盘统计与去重分析: `seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|id] --corp <corpId>`, `seal-use approval-runs count --corp <corpId>`.
@@ -65,13 +67,28 @@ seal-use corps list
- LLM Model Config & Providers: `seal-use llm config --corp <corpId>`, `seal-use llm providers --corp <corpId>`.
- System Permissions Config: `seal-use permissions available --corp <corpId>`, `seal-use permissions configs --corp <corpId>`.
- Billing & Feature Quotas: `seal-use billing status --corp <corpId>`, `seal-use billing plans --corp <corpId>`, `seal-use billing features --corp <corpId>`.
- Webhook 准备看板与审批回调管理: `seal-use webhook ready [<材料包.zip>] --corp <corpId>` (别名 `status`) 检查企业环境、租户连通性、已激活通道与材料包预检;`seal-use webhook <list|get|add|update|delete> --corp <corpId>`.
- Webhook 材料包导入: `seal-use webhook material-pack preview <材料包.zip> --corp <corpId>` 只做本地校验和解析(无网络请求);`... push <材料包.zip> [--webhook <idOrName>] --corp <corpId>` 上传附件并通过入站 Webhook 触发 AI 审批(租户仅有 1 个通道时自动锁定无需指定 `--webhook`)。材料包格式:ZIP 根目录名 = `documentId`(或 `documentId@annotation`),Excel 附件列以 `[附件]` 为前缀(如 `[附件]合同协议`),单元格值为 ZIP 相对路径(支持多行/逗号/分号分隔);系统执行严格双向验证(Excel 声明的路径必须在 ZIP 中存在,ZIP 中的文件必须在某个 `[附件]` 列中声明)。详见 `references/cli.md` 中 "Material Pack Workflow" 一节。它与 `simulation material_pack` 的官方服务端导入流程相互独立。
- Webhook 准备看板与审批回调管理: `seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] --corp <corpId>` (别名 `status`) 检查企业环境、租户连通性、已激活通道与材料包预检;`seal-use webhook <list|get|add|update|delete> --corp <corpId>`.
- Webhook 材料包导入: `seal-use webhook material-pack preview <材料包.zip> --corp <corpId>` 只做本地校验和解析(无网络请求);`... push <材料包.zip> [--webhook <idOrName>] --corp <corpId>` 上传附件并通过入站 Webhook 触发 AI 审批(租户仅有 1 个通道时自动锁定无需指定 `--webhook`)。每个 Webhook 可配置材料包附件的最小字节数、可选最大字节数和文件后缀白名单;这是可修改的持久化策略,不是不可绕过的硬编码。校验不通过时不会上传附件或推送单据。材料包格式:ZIP 根目录名 = `documentId`(或 `documentId@annotation`),Excel 附件列以 `[附件]` 为前缀(如 `[附件]合同协议`),单元格值为 ZIP 相对路径(支持多行/逗号/分号分隔);系统执行严格双向验证(Excel 声明的路径必须在 ZIP 中存在,ZIP 中的文件必须在某个 `[附件]` 列中声明)。详见 `references/cli.md` 中 "Material Pack Workflow" 一节。它与 `simulation material_pack` 的官方服务端导入流程相互独立。
- HTTP REST API & Docs Server: `seal-use http [--port 8787] [--host 127.0.0.1]` (提供 `/docs` 交互文档、`/openapi.json`、`POST /api/cli` 与 `/v1/*` REST API)。
- 审批规则质量校验 (Linter): `seal-use rules lint [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary] --corp <corpId>`; read `references/rule-lint.md`. 全局配置默认关闭 (`config lint <enable|disable>`)。
- Full CLI inventory: read `references/cli.md`.
## Material-pack Webhook policy and recovery
材料包附件策略保存在目标入站 Webhook 的 `materialPackFilePolicy` 下,按 Webhook 生效。新建 Webhook 的默认策略是:最小文件大小 `500` 字节、最大文件大小不限制、后缀白名单为常见 PDF/Office/文本/邮件/图片格式。`信息表.xlsx` 是材料包根清单,不属于普通附件,不受这三个附件策略限制。完整默认后缀和边界规则见 `references/cli.md`。
这套策略允许人工或助手修改。错误处理有两条通道:先通过错误通道明确告诉助手是哪一个文件、哪一条规则失败;再通过配置或文件处置通道完成恢复。遇到附件被拦截时按以下闭环处理:
1. 从错误中识别被拦截的文件、实际大小、失败规则和目标 Webhook。
2. 向用户说明可选处置:替换/压缩文件,或在确认允许该格式/大小后修改 Webhook 策略。
3. 用户或业务负责人明确确认放宽策略后,读取目标 Webhook 当前配置(CLI 使用 `webhook get`/`webhook list`,MCP 使用 `seal_webhook_get`/`seal_webhook_list`)。
4. 调用 `seal_webhook_update` 或 `seal-use webhook update` 修改最小值、最大值或完整后缀白名单,写入后重新读取核对,再重试原来的材料包 push。
push 会重新读取最新 Webhook 配置;校验通过后才会开始上传附件。CLI 以非零退出码和 `stderr` 返回可恢复的业务错误,MCP 以工具错误返回。没有用户授权或没有修改权限时,不能擅自放宽策略,也不能绕过校验。
注意:直接执行本地 `material-pack preview` 只使用默认策略或命令行临时覆盖,不会自动读取某个 Webhook 的持久化策略;`webhook ready --file`(指定 Webhook 时)和 `material-pack push` 才使用保存的 Webhook 策略。需要验证实际入站通道策略时,优先使用 `ready --file --webhook ...`,或直接重试 push。
## High-Value Commands
```bash
+128 -24
View File
@@ -27,8 +27,8 @@ override that path. The legacy `current-corp` file is not read.
## Stream & Exit Code Contract
- **`stdout`**: Pure, deterministic JSON for machine/Agent parsing.
- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** (e.g. `👉 Next action: ...`).
- **`Exit Code`**: `0` on success, non-zero (e.g. `1`) on failure to trigger Agent error self-remediation.
- **`stderr`**: Diagnostics, probing logs, and **Next-Step Command Suggestions** with the stable prefix `👉 Next action: seal-use ...`.
- **`Exit Code`**: `0` on success; `1` runtime/upstream failure, `2` usage/argument error, `10` explicit destructive-operation confirmation required, `11` missing/invalid authentication, and `12` output protection requiring a compact/file/query alternative.
## Top-Level Commands
@@ -50,6 +50,10 @@ seal-use tools list
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
@@ -62,6 +66,12 @@ seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <c
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use data invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
@@ -71,25 +81,26 @@ seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get [<sign-key>] [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
seal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]
seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]
seal-use approval-runs count --corp <corpId> [--status APPROVED]
seal-use approval-runs export --corp <corpId> [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--limit <n>] [--downloads] [--out <file>]
seal-use approval-runs search --corp <corpId> [--query text] [--limit 20] [--includeBridge true]
@@ -102,12 +113,14 @@ seal-use approval-runs url <recordId> --corp <corpId>
seal-use approval-runs url --sourceDocumentSN <sourceDocumentSN> --corp <corpId>
seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sourceDocumentSN>]
seal-use simulation batch-records <batchId> --corp <corpId>
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] --corp <corpId>
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] --corp <corpId>
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] --corp <corpId>
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" --corp <corpId>
seal-use simulation status <batchId> --corp <corpId>
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] --corp <corpId>
seal-use simulation clean <batchId> --corp <corpId>
seal-use simulation specifications [--integration <sign-key>] --corp <corpId>
seal-use simulation approval-definitions --corp <corpId>
seal-use simulation list [--limit 50] --corp <corpId>
seal-use simulation get <batchId> --corp <corpId>
seal-use simulation templates --corp <corpId>
@@ -136,15 +149,31 @@ Identity and session:
- `seal-use corps list`
- `seal-use corps current`
Test Enterprise Binding & Staging Synchronization:
- **1-to-1 Association**: One production enterprise can only bind at most one test enterprise (`corps bind-test <prodCorpId> <testCorpId>`). Multi-tier chaining is rejected.
- **Marking & Rigorous Confirmation**: Marking (`corps mark <corpId> --env <production|test>`) and binding require explicit `--confirm`. Without confirmation, the CLI blocks with exit code `10` (`confirmationRequired`). Overwriting existing bindings requires `--force`.
- **Production Safety Guarantee (`corps sync-test`)**:
- In the **Production Enterprise**: Rules remain strictly in **draft state** without publishing any live version.
- In the **Test Enterprise**: Style preferences (`decisionPreferences`, `thinkingDepthPreference`) are updated to match production, test draft rules are cleared and populated with production draft rules, recoded, and immediately **published as a new official version** in the test tenant (`--version-name <name>`).
- `--dry-run` previews the full preference diff and rule sync plan without sending mutations. Execution requires `--yes`.
Approval rule maintenance:
- `seal-use rules count [--corp <corpId>]`
- `seal-use rules list --summary [--corp <corpId>]`
- `seal-use rules pull [--corp <corpId>] [--version <id|num|latest>] [--out <file>]`
- `seal-use rules lint [--file <path>] [--corp <corpId>] [--linter <name|path>] [--version <num>] [--code <code>] [--min-score <score>] [--summary]`
- `seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]`
- `seal-use rules push [--file <path>] [--corp <corpId>] [--publish] [--version-name <name>] [--dry-run|--yes]` incrementally applies the local file: matched IDs are updated, missing local IDs are created, and remote IDs absent from the file are deleted. It does not clear/recreate the whole draft or recode it. Run `--dry-run` first; a local file exported with `rules pull` is preferred.
- `seal-use rules clear [--corp <corpId>] [--dry-run|--yes]`
Rule identity and versioning:
- `rules list` and `rules pull` read the current **draft** rule set. Their `code` values belong to the draft code space.
- A published version has its own snapshot and code space. Publishing can recode rules, so a published `code` may differ from the draft `code`, and codes can shift again after later edits and publishes.
- Do not use a draft `#NN` as a cross-version identifier. For current draft work, prefer the stable rule `id`; for historical behavior, select the published `version` and locate the rule by its text/context or runtime rule ID from the approval run.
- `rules get --version ... --code ...` interprets `code` inside that selected published version, while `rules get --record-id ... --runtime-id ...` resolves the version recorded on the run.
Approval run lightweight queries:
- `seal-use approval-runs get <recordId> --corp <corpId> --fields metadata`
@@ -164,24 +193,27 @@ Approval knowledge documents & style:
Webhook integrations:
- `seal-use webhook ready [<材料包.zip|信息表.xlsx>] [--corp <corpId>]`
- `seal-use webhook ready [<材料包.zip|信息表.xlsx>] [--webhook <idOrName>] [--corp <corpId>]`
- `seal-use webhook status [<材料包.zip|信息表.xlsx>] [--corp <corpId>]`
- `seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]`
- `seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]`
- `seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]`
- `seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]`
- `seal-use webhook delete <idOrName> --yes [--corp <corpId>]`
- `seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> --corp <corpId>`
- `seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--corp <corpId>]`
- `seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]`
- `seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]`
- `seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] --corp <corpId>`
- `seal-use webhook material-pack push <材料包.zip|信息表.xlsx> [--webhook <idOrName>] --corp <corpId>`
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once.
Webhook writes read the current AI approval config and POST the merged full config back to `api/v1/agent/ai-approval/config`, preserving non-Webhook integrations. List/get mask `secret` by default; add returns the generated secret once. Each Webhook can also store a mutable `materialPackFilePolicy` with `minFileSizeBytes`, optional `maxFileSizeBytes`, and `allowedExtensions`. Update is a patch: omitted policy fields are retained; `allowedExtensions` replaces the complete list; `--clear-max-file-size` removes the upper bound.
All supported configuration writes accept `--dry-run`: rules clear/push, preference updates, thinking-depth policy changes, HoseCloud configure, and Webhook add/update/delete. Preview mode performs read-only discovery and returns JSON with `preview: true`, the exact `targetUrl`, a redacted `changesDiff` (`before`/`after`), and `impactCount`. It never sends the mutation request and does not require `--yes`; use the same command with `--yes` only after reviewing the preview.
Approval runs, simulations, and Langfuse bridge:
- `seal-use approval-runs search --corp <corpId> [--query <text>] [--limit 20]`
- `seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]`
- `seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sn>]`
- `seal-use simulation create --mode hosecloud --flow-ids ... --corp <corpId>`
- `seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` returns immediately with an `asyncTicket` (creation is non-blocking by default for compatibility).
- `seal-use simulation status <batchId> --corp <corpId>` performs one non-blocking status check and returns `QUEUED`/`RUNNING`/`COMPLETED`/`FAILED`-style state plus counters.
- `seal-use simulation wait <batchId> --corp <corpId>`
- `seal-use simulation clean <batchId> --corp <corpId>`
- `seal-use simulation list --corp <corpId>`
@@ -311,13 +343,17 @@ Create a document:
"title": "标题",
"purpose": "用途",
"content": "Markdown 内容",
"contentType": "text/markdown",
"status": "可选",
"scenarios": ["场景"],
"contentType": "policy",
"status": "published",
"scenarios": ["audit"],
"tags": ["标签"]
}
```
`contentType` 必须是 `document`、`video`、`pdf`、`feishu_doc` 或 `policy` 之一;`scenarios` 必填且至少包含一个 `fill`(智能填单)或 `audit`(智能审核)。这里的 `scenarios` 是产品能力开关,不是费用类别或业务场景名。
知识文档创建后当前 API 没有删除接口,创建操作不可逆;请在写入前确认标题、正文、内容类型和能力场景。需要撤下内容时,优先使用更新操作并设置 `enabled: false`(如果上游支持该字段),不要通过试探性创建来验证参数。规则支持删除,但知识文档与规则的生命周期能力并不对称。
Update a document:
```json
@@ -392,8 +428,11 @@ A **material pack** (材料包) is a ZIP file that bundles an Excel information
Before pushing or previewing, the system enforces:
1. **Excel → ZIP**: Every path declared in an `[附件]` column cell **must** exist as a ZIP entry. Error: `Excel 声明的附件路径在 ZIP 中不存在: <path>`
2. **ZIP → Excel**: Every ZIP file (excluding `信息表.xlsx`) **must** be declared in at least one `[附件]` column. Error: `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>`
3. **documentId ↔ ZIP root**: Every `documentId` in the Excel main sheet must have a matching ZIP root dir (exact match or `documentId@annotation`). Errors: `Excel 会议编号「X」在 ZIP 中找不到对应的根目录...` / `ZIP 根目录对应的编号「X」在信息表中找不到对应的会议编号`
2. **ZIP → Excel**: Every ZIP file (excluding `信息表.xlsx`) **must** be declared in exactly one `[附件]` column. Error: `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>`
3. **Document Directory Scope Isolation**: All attachments declared for a document `DOC_X` **must** reside in its own root directory (`DOC_X/` or `DOC_X@annotation/`). Cross-document references are strictly forbidden. Error: `单据「X」声明了跨单据或非本单据目录的附件路径: <path>。附件必须位于该单据自己的根目录...`
4. **Strict Declaration Uniqueness**: A given ZIP file path **cannot** be declared more than once across the entire material pack (even within the same document across multiple rows or fields). If the same logical document is needed in multiple places, separate files must be placed in distinct paths. Error: `附件路径「<path>」被重复声明了 N 次...`
5. **Attachment file policy**: Every attachment except the root `信息表.xlsx` must satisfy the selected Webhook's minimum size, optional maximum size, and extension whitelist. The default minimum is 500 bytes; the default maximum is unlimited; the default whitelist includes common PDF, Office, text, email, and image formats. Error: `附件文件过小...` / `附件文件过大...` / `附件后缀不在白名单中...`
6. **documentId ↔ ZIP root**: Every `documentId` in the Excel main sheet must have a matching ZIP root dir (exact match or `documentId@annotation`). Errors: `Excel 会议编号「X」在 ZIP 中找不到对应的根目录...` / `ZIP 根目录对应的编号「X」在信息表中找不到对应的会议编号`
All validation errors are collected and reported together in a single `MaterialPackValidationError`.
@@ -405,21 +444,86 @@ seal-use webhook ready [--file <pack.zip>] [--corp <corpId>]
# Dry-run: local parse & validation only, no network calls, returns preview JSON
seal-use webhook material-pack preview <pack.zip> --corp <corpId>
# Preview with temporary local policy overrides (comma-separated extensions)
seal-use webhook material-pack preview <pack.zip> --min-file-size 500 --max-file-size 20971520 --allowed-extensions .pdf,.xlsx,.docx --corp <corpId>
# Upload attachments and push documents via inbound Webhook
seal-use webhook material-pack push <pack.zip> [--webhook <nameOrId>] --corp <corpId>
# When there is exactly one webhook channel, --webhook can be omitted (auto-locked)
```
### Attachment file policy configuration
The policy is stored per inbound Webhook integration and is applied before any attachment upload or document push. A failed check stops the entire material-pack flow. The policy is intentionally mutable: after an authorized configuration change, retrying the same push reads the saved policy again.
Default configuration:
```json
{
"minFileSizeBytes": 500,
"maxFileSizeBytes": null,
"allowedExtensions": [
".pdf", ".xls", ".xlsx", ".csv", ".doc", ".docx", ".ppt", ".pptx",
".txt", ".rtf", ".odt", ".ods", ".odp", ".jpg", ".jpeg", ".png",
".gif", ".bmp", ".webp", ".heic", ".eml", ".msg"
]
}
```
`null` or an omitted `maxFileSizeBytes` means no per-file upper bound. Values are bytes; a file smaller than the minimum or larger than the maximum fails. Extensions are normalized case-insensitively and may be written with or without the leading dot. The root `信息表.xlsx` remains exempt from attachment policy checks.
```bash
# New Webhook: use the default 500-byte minimum and default extension whitelist
seal-use webhook add --name "材料包入站" --result-url "https://your-domain.com/callback" --corp <corpId>
# Configure an existing Webhook; sizes are bytes and extensions are comma-separated
seal-use webhook update <webhookIdOrName> \
--min-file-size 500 \
--max-file-size 20971520 \
--allowed-extensions .pdf,.xlsx,.xls,.docx,.pptx,.jpg,.png \
--corp <corpId>
# Allow a newly confirmed format while retaining the rest of the policy:
# first read webhook get/list, then pass the complete desired whitelist.
seal-use webhook update <webhookIdOrName> \
--allowed-extensions .pdf,.xlsx,.xls,.docx,.pptx,.jpg,.png,.zip \
--corp <corpId>
# Remove only the maximum-size limit (minimum and whitelist are retained).
seal-use webhook update <webhookIdOrName> --clear-max-file-size --corp <corpId>
```
The saved configuration is returned by `webhook get`/`webhook list` under `materialPackFilePolicy`. The root `信息表.xlsx` is always allowed as the material-pack manifest and is not subject to the attachment policy.
### Failure recovery loop
When a push fails because of the attachment policy, the error is actionable and should be handled as a two-channel recovery loop:
1. Error channel: read `附件文件过小`, `附件文件过大`, or `附件后缀不在白名单中`, including the attachment path and the configured boundary.
2. Resolution channel: ask whether the user wants to replace/compress the file or explicitly allow the format/size by changing the target Webhook policy.
3. If configuration change is authorized, read the current policy with `webhook get`/`webhook list`, update only the necessary fields, and verify the returned configuration.
4. Retry the original `material-pack push`; it will load the latest saved policy before any upload begins.
The same loop is available through MCP: read with `seal_webhook_get`/`seal_webhook_list`, update with `seal_webhook_update` and its `materialPackFilePolicy` patch, then retry `seal_webhook_material_pack` in `push` mode. For MCP, set `maxFileSizeBytes` to `null` to clear the upper bound. `allowedExtensions` is a complete replacement list, so include existing allowed suffixes when adding one.
If the assistant lacks permission to update the Webhook or the user does not authorize relaxing the rule, report the block rather than bypassing validation. Since validation happens before the upload loop, a failed attempt does not leave a partially pushed material pack.
The direct local `material-pack preview` command and MCP preview use the default or temporary policy. They do not automatically read a selected Webhook's persisted policy. Use `webhook ready --file --webhook <idOrName>` or the actual push path when validating against the saved inbound policy.
### Error messages reference
| Error message | Meaning | Fix |
|---|---|---|
| `Excel 声明的附件路径在 ZIP 中不存在: <path>` | Cell value references a file not in ZIP | Add the file to ZIP at exactly that path |
| `ZIP 中的文件未在 Excel 任何 [附件] 列中声明: <path>` | ZIP contains a file not referenced by any `[附件]` column | Add an `[附件]` column entry or remove the file from ZIP |
| `单据「X」声明了跨单据或非本单据目录的附件路径: <path>` | Document X declared a path inside another document's folder | Move file into Document X's own folder and update Excel |
| `附件路径「<path>」被重复声明了 N 次` | The same file path was declared in multiple columns/rows/documents | Each declaration must point to a unique file path; duplicate file if needed |
| `Excel 会议编号「X」在 ZIP 中找不到对应的根目录` | No ZIP root dir matches documentId `X` | Rename the ZIP folder to match the documentId |
| `ZIP 根目录对应的编号「X」在信息表中找不到` | ZIP folder has no matching documentId in Excel | Remove the folder or add the document to Excel |
| `ZIP 根目录缺少信息表.xlsx` | No `信息表.xlsx` found at ZIP root | Add the Excel file to the ZIP root |
| `附件文件过小` | Attachment is below the configured minimum byte size | Replace the empty/truncated file or lower `--min-file-size` |
| `附件文件过大` | Attachment exceeds the configured maximum byte size | Replace/compress the file or raise `--max-file-size` |
| `附件后缀不在白名单中` | Attachment extension is not allowed by the Webhook policy | Add the extension with `--allowed-extensions` or convert the file |
| `附件上传失败 <status>` | Network/server error during file upload | Check webhook URL, secret, and server availability |
## Failure Handling
@@ -133,6 +133,8 @@ seal-use tool seal_approval_rule_update --corp <corpId> \
Do not send `scope` or `strictness` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
For a complete local rule-set sync, `rules push` is incremental: it matches pulled rules by stable `id`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with `rules push --dry-run` before applying.
## 9. Publish and verify
Publish only when explicitly authorized:
@@ -2,6 +2,12 @@
Use this reference when the user wants rule counts, compact rule lists, one rule from a historical version, or approval knowledge search without dumping hundreds of rule descriptions.
## Draft and Published Rule Codes
`rules list` and `rules pull` operate on the current draft and therefore return draft `code` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as `#0038` is only meaningful together with its version context.
Use the draft `id` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
## Count Rules
Use count when only scale or existence matters.
+1 -1
View File
@@ -57,7 +57,7 @@ describe("CLI version & help handling", () => {
test("invalid command displays unknown command error with help hint", () => {
const result = runCli(["invalid-command"]);
expect(result.status).toBe(1);
expect(result.status).toBe(2);
expect(result.stderr).toContain("Unknown command: invalid-command. Run 'seal-use help' for available commands.");
});
+30
View File
@@ -0,0 +1,30 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { numberOption, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleAnalyticsCommand(
action: string | undefined,
client: Awaited<ReturnType<typeof createSealClient>>,
corp: CorpConfig,
args: ParsedArgs
) {
if (action === "insight" || action === "insight-stats" || action === "stats") {
await runTool(
"seal_insight_stats_get",
client,
corp,
{
startDate: stringOption(args.options.startDate) ?? stringOption(args.options["start-date"]),
endDate: stringOption(args.options.endDate) ?? stringOption(args.options["end-date"]),
limit: numberOption(args.options.limit)
},
outputOptions(args.options)
);
return;
}
throw new Error(`Unknown analytics command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
}
+42
View File
@@ -0,0 +1,42 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleContactsCommand(
action: string | undefined,
maybeName: string | undefined,
client: Awaited<ReturnType<typeof createSealClient>>,
corp: CorpConfig,
args: ParsedArgs
) {
if (action === "sync-time" || action === "last-sync-time") {
await runTool("seal_contacts_last_sync_time_get", client, corp, {}, outputOptions(args.options));
return;
}
if (action === "departments" || action === "department") {
if (!maybeName) {
await runTool("seal_contacts_departments_root_list", client, corp, {}, outputOptions(args.options));
return;
}
await runTool("seal_contacts_department_get", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
if (action === "children" || action === "department-children") {
if (!maybeName) throw new Error("Usage: seal-use contacts children <departmentId>");
await runTool("seal_contacts_department_children_list", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
if (action === "users" || action === "department-users") {
if (!maybeName) throw new Error("Usage: seal-use contacts users <departmentId>");
await runTool("seal_contacts_department_users_list", client, corp, { departmentId: maybeName }, outputOptions(args.options));
return;
}
throw new Error(`Unknown contacts command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
}
+480
View File
@@ -0,0 +1,480 @@
import { afterEach, describe, expect, test } from "bun:test";
import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import type { CorpConfig } from "../../core/config/types.js";
import { runCli } from "../runner.js";
const ORIGINAL_ENV = {
enterprises: process.env.SEAL_USE_ENTERPRISES_DIR,
config: process.env.SEAL_USE_CONFIG_FILE,
tokenStore: process.env.SEAL_USE_TOKEN_STORE
};
const ORIGINAL_FETCH = globalThis.fetch;
const tempDirs: string[] = [];
afterEach(() => {
restoreEnv("SEAL_USE_ENTERPRISES_DIR", ORIGINAL_ENV.enterprises);
restoreEnv("SEAL_USE_CONFIG_FILE", ORIGINAL_ENV.config);
restoreEnv("SEAL_USE_TOKEN_STORE", ORIGINAL_ENV.tokenStore);
globalThis.fetch = ORIGINAL_FETCH;
for (const dir of tempDirs.splice(0)) {
rmSync(dir, { recursive: true, force: true });
}
});
function setupTestEnv() {
const root = mkdtempSync(join(tmpdir(), "seal-use-bind-test-"));
const enterprises = join(root, "enterprises");
mkdirSync(enterprises, { recursive: true });
tempDirs.push(root);
process.env.SEAL_USE_ENTERPRISES_DIR = enterprises;
process.env.SEAL_USE_CONFIG_FILE = join(root, "config.json");
process.env.SEAL_USE_TOKEN_STORE = join(root, "tokens.json");
const prodCorp: CorpConfig = {
id: "corp-prod",
name: "Acme Production",
environment: "production",
seal: {
url: "https://acme-prod.sealai.cc",
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "seal",
token: "prod-token",
sealUrl: "https://acme-prod.sealai.cc",
expiresIn: 3600,
staffId: "seal"
},
auth: { refreshTtl: 300 }
};
const testCorp: CorpConfig = {
id: "corp-test",
name: "Acme Staging Test",
environment: "test",
seal: {
url: "https://acme-test.sealai.cc",
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "seal",
token: "test-token",
sealUrl: "https://acme-test.sealai.cc",
expiresIn: 3600,
staffId: "seal"
},
auth: { refreshTtl: 300 }
};
writeFileSync(join(enterprises, "corp-prod.json"), JSON.stringify(prodCorp, null, 2));
writeFileSync(join(enterprises, "corp-test.json"), JSON.stringify(testCorp, null, 2));
return { root, enterprises, prodCorp, testCorp };
}
function restoreEnv(name: string, value: string | undefined) {
if (value === undefined) delete process.env[name];
else process.env[name] = value;
}
describe("corps mark", () => {
test("requires confirmation and exit code 10 without --confirm", async () => {
setupTestEnv();
const result = await runCli(["corps", "mark", "corp-prod", "--env", "test"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(10);
expect(result.stderr).toContain("without --confirm");
expect(result.stderr).toContain("seal-use corps mark corp-prod --env test --confirm");
});
test("successfully updates environment with --confirm", async () => {
const { enterprises } = setupTestEnv();
const result = await runCli(["corps", "mark", "corp-prod", "--env", "test", "--confirm"]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
const parsed = JSON.parse(result.stdout);
expect(parsed.id).toBe("corp-prod");
expect(parsed.environment).toBe("test");
const saved = JSON.parse(readFileSync(join(enterprises, "corp-prod.json"), "utf-8"));
expect(saved.environment).toBe("test");
});
});
describe("corps bind-test & unbind-test", () => {
test("rejects self-binding with exit code 2", async () => {
setupTestEnv();
const result = await runCli(["corps", "bind-test", "corp-prod", "corp-prod", "--confirm"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Cannot bind enterprise 'corp-prod' to itself");
});
test("requires confirmation and exit code 10 without --confirm", async () => {
setupTestEnv();
const result = await runCli(["corps", "bind-test", "corp-prod", "corp-test"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(10);
expect(result.stderr).toContain("without --confirm");
expect(result.stderr).toContain("seal-use corps bind-test corp-prod corp-test --confirm");
});
test("successfully binds 1-to-1 with --confirm and sets tags", async () => {
const { enterprises } = setupTestEnv();
const result = await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
const parsed = JSON.parse(result.stdout);
expect(parsed.success).toBe(true);
expect(parsed.productionEnterprise.id).toBe("corp-prod");
expect(parsed.productionEnterprise.testCorpId).toBe("corp-test");
expect(parsed.productionEnterprise.environment).toBe("production");
expect(parsed.testEnterprise.id).toBe("corp-test");
expect(parsed.testEnterprise.prodCorpId).toBe("corp-prod");
expect(parsed.testEnterprise.environment).toBe("test");
const savedProd = JSON.parse(readFileSync(join(enterprises, "corp-prod.json"), "utf-8"));
expect(savedProd.testCorpId).toBe("corp-test");
expect(savedProd.environment).toBe("production");
const savedTest = JSON.parse(readFileSync(join(enterprises, "corp-test.json"), "utf-8"));
expect(savedTest.prodCorpId).toBe("corp-prod");
expect(savedTest.environment).toBe("test");
});
test("prevents multi-tier chaining: test corp cannot be bound as prod parent", async () => {
const { enterprises } = setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const thirdCorp: CorpConfig = {
id: "corp-subtest",
name: "Acme Subtest",
environment: "test",
seal: { url: "https://sub.sealai.cc", endpoints: { approvalStylePreferences: "" } },
source: { type: "seal", token: "tok", sealUrl: "https://sub.sealai.cc", expiresIn: 3600, staffId: "seal" },
auth: { refreshTtl: 300 }
};
writeFileSync(join(enterprises, "corp-subtest.json"), JSON.stringify(thirdCorp, null, 2));
const result = await runCli(["corps", "bind-test", "corp-test", "corp-subtest", "--confirm"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Multi-tier chaining is not permitted");
});
test("requires --force when re-binding an already bound corp", async () => {
const { enterprises } = setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const testCorp2: CorpConfig = {
id: "corp-test-2",
name: "Acme Staging 2",
environment: "test",
seal: { url: "https://test2.sealai.cc", endpoints: { approvalStylePreferences: "" } },
source: { type: "seal", token: "tok2", sealUrl: "https://test2.sealai.cc", expiresIn: 3600, staffId: "seal" },
auth: { refreshTtl: 300 }
};
writeFileSync(join(enterprises, "corp-test-2.json"), JSON.stringify(testCorp2, null, 2));
const conflictResult = await runCli(["corps", "bind-test", "corp-prod", "corp-test-2", "--confirm"]);
expect(conflictResult.isError).toBe(true);
expect(conflictResult.exitCode).toBe(10);
expect(conflictResult.stderr).toContain("requires --force");
const forceResult = await runCli(["corps", "bind-test", "corp-prod", "corp-test-2", "--confirm", "--force"]);
expect(forceResult.isError).toBe(false);
expect(forceResult.exitCode).toBe(0);
const savedProd = JSON.parse(readFileSync(join(enterprises, "corp-prod.json"), "utf-8"));
expect(savedProd.testCorpId).toBe("corp-test-2");
});
test("unbind-test requires confirmation then unlinks both sides", async () => {
const { enterprises } = setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const blockResult = await runCli(["corps", "unbind-test", "corp-prod"]);
expect(blockResult.isError).toBe(true);
expect(blockResult.exitCode).toBe(10);
expect(blockResult.stderr).toContain("without --confirm");
const successResult = await runCli(["corps", "unbind-test", "corp-prod", "--confirm"]);
expect(successResult.isError).toBe(false);
expect(successResult.exitCode).toBe(0);
const parsed = JSON.parse(successResult.stdout);
expect(parsed.success).toBe(true);
expect(parsed.unboundProduction).toBe("corp-prod");
expect(parsed.unboundTest).toBe("corp-test");
const savedProd = JSON.parse(readFileSync(join(enterprises, "corp-prod.json"), "utf-8"));
expect(savedProd.testCorpId).toBeUndefined();
const savedTest = JSON.parse(readFileSync(join(enterprises, "corp-test.json"), "utf-8"));
expect(savedTest.prodCorpId).toBeUndefined();
});
});
describe("corps sync-test", () => {
test("fails if production corp has no bound test corp", async () => {
setupTestEnv();
const result = await runCli(["corps", "sync-test", "corp-prod", "--dry-run"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("has no bound test enterprise");
});
test("dry-run produces preview diff without making network mutations", async () => {
setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const mockMutations: string[] = [];
mockSealSyncRequests({ onMutation: (method, path) => mockMutations.push(`${method} ${path}`) });
const result = await runCli(["corps", "sync-test", "corp-prod", "--dry-run"]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
const parsed = JSON.parse(result.stdout);
expect(parsed.dryRun).toBe(true);
expect(parsed.source.id).toBe("corp-prod");
expect(parsed.target.id).toBe("corp-test");
expect(parsed.rulesPlan.sourceDraftRuleCount).toBe(2);
expect(parsed.rulesPlan.targetExistingDraftRuleCount).toBe(1);
expect(parsed.rulesPlan.toDeleteCount).toBe(1);
expect(parsed.rulesPlan.toCreateCount).toBe(2);
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
expect(mockMutations).toEqual([]);
});
test("sync-test requires --yes and blocks with exit code 10", async () => {
setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
mockSealSyncRequests();
const result = await runCli(["corps", "sync-test", "corp-prod"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(10);
expect(result.stderr).toContain("without --yes");
expect(result.stderr).toContain("seal-use corps sync-test corp-prod --yes");
});
test("sync-test --yes overwrites test preferences, syncs rules, publishes new test version, and guarantees prod draft safety", async () => {
setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const requests: { method: string; path: string; body?: unknown }[] = [];
mockSealSyncRequests({
onMutation: (method, path, body) => requests.push({ method, path, body })
});
const result = await runCli([
"corps",
"sync-test",
"corp-prod",
"--yes",
"--version-name",
"v1.5-staging"
]);
expect(result.isError).toBe(false);
expect(result.exitCode).toBe(0);
const parsed = JSON.parse(result.stdout);
expect(parsed.success).toBe(true);
expect(parsed.source.id).toBe("corp-prod");
expect(parsed.source.draftRulesCount).toBe(2);
expect(parsed.target.id).toBe("corp-test");
expect(parsed.target.deletedDraftRulesCount).toBe(1);
expect(parsed.target.createdDraftRulesCount).toBe(2);
expect(parsed.target.publishedVersion.versionName).toBe("v1.5-staging");
expect(parsed.target.publishedVersion.versionNumber).toBe(3);
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
const patchPref = requests.find((r) => r.method === "PATCH" && r.path.includes("config"));
expect(patchPref).toBeDefined();
expect((patchPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const deleteRule = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/rules/test-rule-old");
expect(deleteRule).toBeDefined();
const createdRules = requests.filter((r) => r.method === "POST" && r.path === "/api/v1/rules");
expect(createdRules.length).toBe(2);
expect((createdRules[0]?.body as any).description).toBe("Production Rule A");
expect((createdRules[1]?.body as any).description).toBe("Production Rule B");
const publishVersion = requests.find((r) => r.method === "POST" && r.path === "/api/v1/rule-set-versions/publish");
expect(publishVersion).toBeDefined();
expect((publishVersion?.body as any).versionName).toBe("v1.5-staging");
const allPublishCalls = requests.filter((r) => r.path === "/api/v1/rule-set-versions/publish");
expect(allPublishCalls.length).toBe(1);
});
});
describe("corps list & current", () => {
test("outputs environment, testCorpId, and prodCorpId", async () => {
setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const listResult = await runCli(["corps", "list"]);
expect(listResult.isError).toBe(false);
const list = JSON.parse(listResult.stdout);
const prodItem = list.find((item: any) => item.id === "corp-prod");
const testItem = list.find((item: any) => item.id === "corp-test");
expect(prodItem.environment).toBe("production");
expect(prodItem.testCorpId).toBe("corp-test");
expect(testItem.environment).toBe("test");
expect(testItem.prodCorpId).toBe("corp-prod");
const currentResult = await runCli(["corps", "current", "--corp", "corp-prod"]);
expect(currentResult.isError).toBe(false);
const current = JSON.parse(currentResult.stdout);
expect(current.id).toBe("corp-prod");
expect(current.environment).toBe("production");
expect(current.testCorpId).toBe("corp-test");
});
});
function mockSealSyncRequests(options: {
onMutation?: (method: string, path: string, body?: unknown) => void;
} = {}) {
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
const requestUrl = typeof input === "string"
? input
: input instanceof URL
? input.toString()
: input.url;
const url = new URL(requestUrl);
const method = (
init?.method ??
(typeof input === "object" && "method" in input ? (input as Request).method : "GET")
).toUpperCase();
const isProd = url.host.includes("prod");
let rawBody = typeof init?.body === "string" ? init.body : undefined;
if (!rawBody && typeof input === "object" && "text" in input) {
rawBody = await (input as Request).clone().text().catch(() => "{}");
}
if (url.pathname === "/api/v1/auth/me") {
return jsonResponse({
data: {
user: { id: "user-1", name: isProd ? "Prod User" : "Test User" },
tenant: { id: isProd ? "tenant-prod" : "tenant-test", tenantSlug: isProd ? "acme-prod" : "acme-test" }
}
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "GET") {
return jsonResponse({
data: {
id: isProd ? "pref-prod" : "pref-test",
tenantId: isProd ? "tenant-prod" : "tenant-test",
tone: isProd ? "formal" : "casual",
language: "zh-CN",
decisionPreferences: {
explicitApprove: isProd ? "Prod approve note" : "Test approve note",
explicitReject: "Reject invalid expenses",
exemptApprove: "",
review: ""
},
thinkingDepthPreference: {
defaultLevel: isProd ? "high" : "medium",
routingPolicies: []
},
integrations: [
{ type: "hosecloud", signKey: isProd ? "prod-sign" : "test-sign" }
]
}
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "PATCH") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("PATCH", url.pathname, body);
return jsonResponse({ data: body });
}
if (url.pathname === "/api/v1/rules" && method === "GET") {
if (isProd) {
return jsonResponse({
data: {
rules: [
{ id: "prod-rule-1", description: "Production Rule A", scope: "global", strictness: "strict" },
{ id: "prod-rule-2", description: "Production Rule B", scope: "invoice", strictness: "flexible" }
],
hasPendingDeletes: false
}
});
} else {
return jsonResponse({
data: {
rules: [
{ id: "test-rule-old", description: "Old test rule", scope: "global", strictness: "strict" }
],
hasPendingDeletes: false
}
});
}
}
if (url.pathname.startsWith("/api/v1/rules/") && method === "DELETE") {
options.onMutation?.("DELETE", url.pathname);
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/rules" && method === "POST") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("POST", url.pathname, body);
return jsonResponse({
data: {
id: `new-rule-${Date.now()}`,
...body
}
});
}
if (url.pathname === "/api/v1/rules/batch-recode" && method === "POST") {
options.onMutation?.("POST", url.pathname);
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/rule-set-versions/publish" && method === "POST") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("POST", url.pathname, body);
return jsonResponse({
data: {
version: {
id: "ver-3",
versionNumber: 3,
versionName: body.versionName ?? "v1.0",
rules: []
},
rulesCount: 2
}
});
}
return jsonResponse({ error: `Unexpected request: ${method} ${url.pathname}` }, 404);
}) as typeof fetch;
}
function jsonResponse(value: unknown, status = 200) {
return new Response(JSON.stringify(value), {
status,
headers: { "content-type": "application/json" }
});
}
+371 -7
View File
@@ -9,17 +9,22 @@ import {
probeHoseDomain
} from "../../core/auth/hose.js";
import { clearCorpTokenCache } from "../../core/auth/token-store.js";
import { createSealClientForUrl } from "../../core/http/factory.js";
import { createSealClient, createSealClientForUrl } from "../../core/http/factory.js";
import { resolveSealCustomHeaders } from "../../core/http/request-headers.js";
import {
loadCorpConfigs,
loadGlobalConfig,
resolveWritableEnterprisesDir,
saveGlobalConfig
saveGlobalConfig,
updateCorpConfig
} from "../../core/config/loader.js";
import type { CorpConfig } from "../../core/config/types.js";
import { SealCookieMapSchema, SealHeaderMapSchema } from "../../core/config/types.js";
import type { CorpConfig, CorpEnvironment } from "../../core/config/types.js";
import * as api from "../../domains/seal/api.js";
import { getMe } from "../../domains/seal/api.js";
import { resolveLiveSealEnterpriseConfig } from "../../domains/seal/source.js";
import { selectCorp } from "../helpers.js";
import { confirmationRequired, usageError } from "../errors.js";
import {
inferCorpIdFromStaffId,
booleanOption,
@@ -50,8 +55,11 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
printJson(corps.map((item) => ({
id: item.id,
name: item.name,
environment: item.environment ?? "production",
sourceType: item.source.type,
provider: (item.source as any).provider ?? item.source.type,
testCorpId: item.testCorpId,
prodCorpId: item.prodCorpId,
current: item.id === currentCorpId
})));
return;
@@ -62,8 +70,345 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
printJson({
id: corp.id,
name: corp.name,
environment: corp.environment ?? "production",
sourceType: corp.source.type,
provider: (corp.source as any).provider ?? corp.source.type
provider: (corp.source as any).provider ?? corp.source.type,
testCorpId: corp.testCorpId,
prodCorpId: corp.prodCorpId
});
return;
}
if (action === "mark" || action === "mark-test" || action === "mark-prod") {
const corpId = maybeName ?? stringOption(args.options.corp);
if (!corpId) {
throw usageError("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");
}
const corp = selectCorp(corpId);
const targetEnv = (
action === "mark-test"
? "test"
: action === "mark-prod"
? "production"
: (stringOption(args.options.env) ?? stringOption(args.options.environment))
) as CorpEnvironment | undefined;
if (targetEnv !== "production" && targetEnv !== "test") {
throw usageError("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");
}
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to change environment tag of enterprise '${corp.name}' (${corp.id}) to '${targetEnv}' without --confirm. Marking alters synchronization safety guards.`,
`seal-use corps mark ${corp.id} --env ${targetEnv} --confirm`
);
}
const updated = updateCorpConfig(corp.id, { environment: targetEnv });
printJson({
id: updated.id,
name: updated.name,
environment: updated.environment,
testCorpId: updated.testCorpId,
prodCorpId: updated.prodCorpId
});
return;
}
if (action === "bind-test") {
let prodId: string | undefined;
let testId: string | undefined;
if (maybeName && args.command[3]) {
prodId = maybeName;
testId = args.command[3];
} else if (maybeName) {
const corpOption = stringOption(args.options.corp);
const testCorpOption = stringOption(args.options["test-corp"]) ?? stringOption(args.options.testCorp);
if (corpOption) {
prodId = corpOption;
testId = maybeName;
} else if (testCorpOption) {
prodId = maybeName;
testId = testCorpOption;
}
}
if (!prodId || !testId) {
throw usageError(
"Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]\n" +
" or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"
);
}
const prodCorp = selectCorp(prodId);
const testCorp = selectCorp(testId);
if (prodCorp.id === testCorp.id) {
throw usageError(`Cannot bind enterprise '${prodCorp.id}' to itself.`);
}
if (prodCorp.prodCorpId && prodCorp.prodCorpId !== testCorp.id) {
throw usageError(
`Cannot use '${prodCorp.id}' as a production enterprise because it is already registered as a test enterprise for '${prodCorp.prodCorpId}'. Multi-tier chaining is not permitted.`
);
}
if (testCorp.testCorpId && testCorp.testCorpId !== prodCorp.id) {
throw usageError(
`Cannot bind '${testCorp.id}' as a test enterprise because it already has a bound test enterprise '${testCorp.testCorpId}'. Multi-tier chaining is not permitted.`
);
}
const force = booleanOption(args.options.force) === true;
if (
(prodCorp.testCorpId && prodCorp.testCorpId !== testCorp.id) ||
(testCorp.prodCorpId && testCorp.prodCorpId !== prodCorp.id)
) {
if (!force) {
throw confirmationRequired(
`Enterprise binding conflict: production enterprise '${prodCorp.id}' is bound to '${prodCorp.testCorpId ?? "none"}', and test enterprise '${testCorp.id}' is bound to '${testCorp.prodCorpId ?? "none"}'. Overwriting an existing binding requires --force and --confirm.`,
`seal-use corps bind-test ${prodCorp.id} ${testCorp.id} --confirm --force`
);
}
}
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
const forceFlag = force ? " --force" : "";
throw confirmationRequired(
`Refusing to bind test enterprise '${testCorp.name}' (${testCorp.id}) to production enterprise '${prodCorp.name}' (${prodCorp.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${testCorp.id}' as a test environment.`,
`seal-use corps bind-test ${prodCorp.id} ${testCorp.id} --confirm${forceFlag}`
);
}
if (prodCorp.testCorpId && prodCorp.testCorpId !== testCorp.id) {
try {
updateCorpConfig(prodCorp.testCorpId, { prodCorpId: undefined });
} catch {}
}
if (testCorp.prodCorpId && testCorp.prodCorpId !== prodCorp.id) {
try {
updateCorpConfig(testCorp.prodCorpId, { testCorpId: undefined });
} catch {}
}
const updatedProd = updateCorpConfig(prodCorp.id, {
environment: "production",
testCorpId: testCorp.id
});
const updatedTest = updateCorpConfig(testCorp.id, {
environment: "test",
prodCorpId: prodCorp.id
});
printJson({
success: true,
productionEnterprise: {
id: updatedProd.id,
name: updatedProd.name,
environment: updatedProd.environment,
testCorpId: updatedProd.testCorpId
},
testEnterprise: {
id: updatedTest.id,
name: updatedTest.name,
environment: updatedTest.environment,
prodCorpId: updatedTest.prodCorpId
}
});
return;
}
if (action === "unbind-test") {
const targetId = maybeName ?? stringOption(args.options.corp);
const corp = selectCorp(targetId);
if (!corp.testCorpId && !corp.prodCorpId) {
printJson({
unbound: false,
message: `Enterprise '${corp.name}' (${corp.id}) does not have an active test enterprise binding.`
});
return;
}
const prodId = corp.testCorpId ? corp.id : corp.prodCorpId!;
const testId = corp.testCorpId ? corp.testCorpId : corp.id;
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to unbind production enterprise '${prodId}' and test enterprise '${testId}' without --confirm.`,
`seal-use corps unbind-test ${corp.id} --confirm`
);
}
updateCorpConfig(prodId, { testCorpId: undefined });
try {
updateCorpConfig(testId, { prodCorpId: undefined });
} catch {}
printJson({
success: true,
unboundProduction: prodId,
unboundTest: testId
});
return;
}
if (action === "sync-test") {
const targetCorpId = maybeName ?? stringOption(args.options.corp);
const prodCorp = selectCorp(targetCorpId);
if (!prodCorp.testCorpId) {
throw usageError(
`Production enterprise '${prodCorp.name}' (${prodCorp.id}) has no bound test enterprise.\n` +
`Run 'seal-use corps bind-test ${prodCorp.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`
);
}
const testCorp = selectCorp(prodCorp.testCorpId);
if (testCorp.environment !== "test") {
throw new Error(
`Target enterprise '${testCorp.name}' (${testCorp.id}) is marked as '${testCorp.environment}', NOT 'test'. Aborting sync to protect non-test environments.`
);
}
const prodClient = await createSealClient(prodCorp);
const testClient = await createSealClient(testCorp);
const prodPref = (await api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences)) as any;
const testPref = (await api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences)) as any;
const prodRules = await api.listApprovalRules(prodClient);
const testRules = await api.listApprovalRules(testClient);
const updatedTestPref = {
...testPref,
tone: prodPref.tone,
language: prodPref.language,
detailLevel: prodPref.detailLevel,
outputFormat: prodPref.outputFormat,
examples: prodPref.examples ?? [],
prohibitedPhrases: prodPref.prohibitedPhrases ?? [],
customInstructions: prodPref.customInstructions,
decisionPreferences: prodPref.decisionPreferences,
thinkingDepthPreference: prodPref.thinkingDepthPreference
};
const customVersionName = stringOption(args.options["version-name"]) ?? stringOption(args.options.versionName);
const dateStr = new Date().toISOString().slice(0, 10);
const versionName = customVersionName ?? `Sync from ${prodCorp.name} (${dateStr})`;
const dryRun = booleanOption(args.options["dry-run"]) === true || booleanOption(args.options.dryRun) === true;
if (dryRun) {
printJson({
dryRun: true,
source: {
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment
},
target: {
id: testCorp.id,
name: testCorp.name,
environment: testCorp.environment
},
preferencesDiff: {
decisionPreferences: {
before: testPref.decisionPreferences,
after: prodPref.decisionPreferences
},
thinkingDepthPreference: {
before: testPref.thinkingDepthPreference,
after: prodPref.thinkingDepthPreference
}
},
rulesPlan: {
sourceDraftRuleCount: prodRules.rules.length,
targetExistingDraftRuleCount: testRules.rules.length,
toDeleteCount: testRules.rules.length,
toCreateCount: prodRules.rules.length,
rulesToSync: prodRules.rules.map((r, idx) => ({
index: idx + 1,
description: r.description,
scope: r.scope,
strictness: r.strictness
}))
},
publishingPlan: {
targetCorpId: testCorp.id,
publishVersionName: versionName,
publishTarget: "test"
},
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
}
});
return;
}
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to overwrite test enterprise '${testCorp.name}' (${testCorp.id}) with preferences and ${prodRules.rules.length} draft rules from production enterprise '${prodCorp.name}' (${prodCorp.id}) without --yes. This will replace test draft rules and publish a new version on the test enterprise.`,
`seal-use corps sync-test ${prodCorp.id} --yes`
);
}
// 1. Update style & decision preferences in test enterprise
await api.updateApprovalStylePreferences(testClient, updatedTestPref, testCorp.seal.endpoints.approvalStylePreferences);
// 2. Clear old draft rules in test enterprise
for (const rule of testRules.rules) {
await api.deleteApprovalRule(testClient, rule.id);
}
// 3. Create new draft rules in test enterprise
const createdRules = [];
for (const rule of prodRules.rules) {
const created = await api.createApprovalRule(testClient, {
description: rule.description,
scope: rule.scope,
strictness: rule.strictness
});
createdRules.push(created);
}
// 4. Batch recode rules in test enterprise
await api.recodeApprovalRules(testClient).catch(() => undefined);
// 5. Publish new version in test enterprise
const published = await api.publishApprovalRuleVersion(testClient, versionName);
printJson({
success: true,
syncedAt: new Date().toISOString(),
source: {
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment,
draftRulesCount: prodRules.rules.length
},
target: {
id: testCorp.id,
name: testCorp.name,
environment: testCorp.environment,
deletedDraftRulesCount: testRules.rules.length,
createdDraftRulesCount: createdRules.length,
publishedVersion: {
id: published.version.id,
versionNumber: published.version.versionNumber,
versionName: published.version.versionName,
rulesCount: published.rulesCount
}
},
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
}
});
return;
}
@@ -324,6 +669,7 @@ async function addHoseCorp(input: Record<string, unknown>) {
const config: CorpConfig = {
id,
name,
environment: "production",
seal: {
url: sealUrl,
endpoints: {
@@ -374,8 +720,20 @@ async function addSealCorp(input: Record<string, unknown>) {
const expiresIn = optionalNumber(input, "expiresIn") ?? 30 * 24 * 60 * 60;
const verify = input.force === true || input.verify === false ? false : true;
const remote = verify ? await resolveSealWhoami(sealUrl, token) : undefined;
writeSealCorpConfig(input, { token, sealUrl, expiresIn, verify, remote });
const custom = sealCustomHeadersFromInput(input);
const remote = verify
? await resolveSealWhoami(sealUrl, token, resolveSealCustomHeaders(custom))
: undefined;
writeSealCorpConfig(input, { token, sealUrl, expiresIn, verify, remote, custom });
}
// Validates extra headers/cookies up front so a malformed name fails here
// rather than on the next config load.
function sealCustomHeadersFromInput(input: Record<string, unknown>) {
return {
headers: SealHeaderMapSchema.parse(input.headers),
cookies: SealCookieMapSchema.parse(input.cookies)
};
}
async function addLinkCorp(link: string, name: string | undefined, overwrite: boolean) {
@@ -419,9 +777,11 @@ function writeSealCorpConfig(
expiresIn: number;
verify: boolean;
remote?: RemoteSealIdentity;
custom?: { headers?: Record<string, string>; cookies?: Record<string, string> };
}
) {
const { token, sealUrl, expiresIn, verify, remote } = auth;
const custom = auth.custom ?? sealCustomHeadersFromInput(input);
const remoteUser = remote?.user;
const remoteTenant = remote?.tenant;
const tenantSlug = optionalString(input, "tenantSlug") ?? stringValue(remoteTenant?.tenantSlug);
@@ -444,9 +804,12 @@ function writeSealCorpConfig(
const config: CorpConfig = {
id,
name: optionalString(input, "name") ?? tenantName ?? id,
environment: "production",
seal: {
url: sealUrl,
tenantSlug,
headers: custom.headers,
cookies: custom.cookies,
endpoints: {
approvalStylePreferences: "api/v1/agent/ai-approval/config"
}
@@ -522,8 +885,9 @@ async function resolveHoseCorporation(domain: string, appKey: string, appSecurit
: undefined;
}
async function resolveSealWhoami(sealUrl: string, token: string) {
async function resolveSealWhoami(sealUrl: string, token: string, customHeaders: Record<string, string> = {}) {
const json = await getJson(`${sealUrl}/api/v1/auth/me`, {
...customHeaders,
authorization: `Bearer ${token}`
});
const data = objectValue(json.data);
+33
View File
@@ -0,0 +1,33 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { numberOption, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleDataCommand(
action: string | undefined,
client: Awaited<ReturnType<typeof createSealClient>>,
corp: CorpConfig,
args: ParsedArgs
) {
const params = {
offset: numberOption(args.options.offset),
limit: numberOption(args.options.limit),
startDate: stringOption(args.options.startDate) ?? stringOption(args.options["start-date"]),
endDate: stringOption(args.options.endDate) ?? stringOption(args.options["end-date"]),
search: stringOption(args.options.search) ?? stringOption(args.options.query)
};
if (action === "expenses" || action === "expense") {
await runTool("seal_expenses_list", client, corp, params, outputOptions(args.options));
return;
}
if (action === "invoices" || action === "invoice") {
await runTool("seal_invoices_list", client, corp, params, outputOptions(args.options));
return;
}
throw new Error(`Unknown data command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
}
+19 -3
View File
@@ -6,6 +6,7 @@ import { booleanOption, jsonObject, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
import * as api from "../../domains/seal/api.js";
import { CliError } from "../errors.js";
export async function handleDeployCommand(
systemOrAction: string | undefined,
@@ -83,7 +84,13 @@ export async function handleDeployCommand(
console.error(` • "${name}" (signKey: ${key}, 环境: ${origin})`);
console.error(` 👉 查看命令: seal-use deploy hosecloud get ${key} --corp ${corp.id}\n`);
}
throw new Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。");
throw new CliError(
"缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",
2,
hoseConfigs.length === 1
? `seal-use deploy hosecloud get ${hoseConfigs[0]!.signKey} --corp ${corp.id}`
: undefined
);
}
await runTool("seal_deploy_hosecloud_get", client, corp, { signKey }, outputOptions(args.options));
return;
@@ -102,7 +109,10 @@ export async function handleDeployCommand(
if (!payload || Object.keys(payload).length === 0) {
throw new Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");
}
await runTool("seal_deploy_hosecloud_configure", client, corp, payload, outputOptions(args.options));
await runTool("seal_deploy_hosecloud_configure", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
return;
}
@@ -143,7 +153,13 @@ export async function handleDeployCommand(
console.error(`💡 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${corp.id}\n`);
}
throw new Error("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。");
throw new CliError(
"缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",
2,
hoseConfigs.length === 1
? `seal-use deploy hosecloud sync ${hoseConfigs[0]!.signKey} --corp ${corp.id}`
: undefined
);
}
await runTool("seal_deploy_hosecloud_sync", client, corp, { signKey }, outputOptions(args.options));
+17 -5
View File
@@ -2,7 +2,7 @@ import { readFileSync } from "node:fs";
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { jsonObject, stringOption } from "../parser.js";
import { booleanOption, jsonObject, stringOption } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
@@ -29,7 +29,10 @@ export async function handlePreferenceCommand(
if (!payload || Object.keys(payload).length === 0) {
throw new Error("Usage: seal-use preference decision update --json '{\"explicitApprove\":\"...\"}'");
}
await runTool("seal_preference_decision_update", client, corp, payload, outputOptions(args.options));
await runTool("seal_preference_decision_update", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
return;
}
}
@@ -43,7 +46,10 @@ export async function handlePreferenceCommand(
if (defaultLevel !== "medium" && defaultLevel !== "high") {
throw new Error("Usage: seal-use preference thinking-depth set --default <medium|high>");
}
await runTool("seal_preference_thinking_depth_set", client, corp, { defaultLevel }, outputOptions(args.options));
await runTool("seal_preference_thinking_depth_set", client, corp, {
defaultLevel,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
return;
}
@@ -61,7 +67,10 @@ export async function handlePreferenceCommand(
if (!payload || !payload.id || !payload.name) {
throw new Error("Usage: seal-use preference thinking-depth policies upsert --json '{\"id\":\"...\",\"name\":\"...\",\"level\":\"high\"}'");
}
await runTool("seal_preference_thinking_depth_policies_upsert", client, corp, payload, outputOptions(args.options));
await runTool("seal_preference_thinking_depth_policies_upsert", client, corp, {
...payload,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
return;
}
@@ -70,7 +79,10 @@ export async function handlePreferenceCommand(
if (!policyId) {
throw new Error("Usage: seal-use preference thinking-depth policies remove <policyId>");
}
await runTool("seal_preference_thinking_depth_policies_remove", client, corp, { policyId }, outputOptions(args.options));
await runTool("seal_preference_thinking_depth_policies_remove", client, corp, {
policyId,
dryRun: booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"])
}, outputOptions(args.options));
return;
}
}
+5 -1
View File
@@ -1,6 +1,7 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool, runToolResult } from "../helpers.js";
import { confirmationRequired } from "../errors.js";
import {
booleanOption,
numberOption,
@@ -63,7 +64,10 @@ export async function handleRulesCommand(
const confirmed = booleanOption(args.options.yes) === true;
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]) ?? !confirmed;
if (!confirmed && !dryRun) {
throw new Error("Refusing to clear rules without --yes. Use --dry-run to preview.");
throw confirmationRequired(
"Refusing to clear rules without --yes. Use --dry-run to preview.",
`seal-use rules clear --corp ${corp.id} --dry-run`
);
}
const result = await runToolResult("seal_approval_rules_clear", client, corp, {
dryRun,
+26
View File
@@ -62,6 +62,7 @@ export async function handleSimulationCommand(
stringOption(args.options.signKey) ??
stringOption(args.options["sign-key"]) ??
stringOption(args.options.integration);
const noWait = booleanOption(args.options.noWait) ?? booleanOption(args.options["no-wait"]);
await runTool(
"seal_simulation_batch_create",
@@ -91,6 +92,7 @@ export async function handleSimulationCommand(
endTime: numberOption(args.options.endTime) ?? numberOption(args.options["end-time"]),
status: splitOption(args.options.status),
limit: numberOption(args.options.limit),
noWait,
rawParams: inputPayload
},
outputOptions(args.options)
@@ -115,6 +117,19 @@ export async function handleSimulationCommand(
return;
}
if (action === "status") {
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation status <batchId>");
await runTool(
"seal_simulation_batch_status",
client,
corp,
{ batchId },
outputOptions(args.options)
);
return;
}
if (action === "clean" || action === "delete") {
const batchId = maybeName ?? stringOption(args.options.batchId) ?? stringOption(args.options["batch-id"]);
if (!batchId) throw new Error("Usage: seal-use simulation clean <batchId>");
@@ -132,6 +147,17 @@ export async function handleSimulationCommand(
return;
}
if (action === "approval-definitions" || action === "definitions") {
await runTool(
"seal_simulation_feishu_approval_definitions_list",
client,
corp,
{},
outputOptions(args.options)
);
return;
}
if (action === "list") {
await runTool(
"seal_simulation_batches_list",
+43 -14
View File
@@ -13,6 +13,7 @@ import {
} from "../../domains/seal/material-pack/index.js";
import {
booleanOption,
materialPackFilePolicyOptions,
parseWebhookMode,
stringOption,
webhookRateOption,
@@ -20,11 +21,16 @@ import {
} from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
import type { MaterialPackFilePolicyPatch } from "../../domains/seal/material-pack/policy.js";
import { CliError, confirmationRequired, usageError } from "../errors.js";
export async function handleWebhookMaterialPackPreview(filePath: string) {
export async function handleWebhookMaterialPackPreview(
filePath: string,
filePolicy?: MaterialPackFilePolicyPatch
) {
if (!existsSync(filePath)) throw new Error(`File not found: ${filePath}`);
const input = readMaterialPackFile(filePath);
console.log(JSON.stringify(await previewMaterialPack(input.fileBuffer, input.fileName), null, 2));
console.log(JSON.stringify(await previewMaterialPack(input.fileBuffer, input.fileName, filePolicy), null, 2));
}
export async function handleWebhookCommand(
@@ -36,7 +42,10 @@ export async function handleWebhookCommand(
) {
if (action === "ready" || action === "status") {
const filePath = maybeName ?? stringOption(args.options.file) ?? stringOption(args.options.input);
const result = await checkWebhookReadiness(client, corp, { filePath });
const result = await checkWebhookReadiness(client, corp, {
filePath,
webhook: stringOption(args.options.webhook) ?? stringOption(args.options.selector)
});
console.error(`[webhook-ready] 企业环境: ${result.corp.name} (${result.corp.id}) [${result.stateMode}]`);
if (result.corp.tenant?.name) {
console.error(`[webhook-ready] 租户信息: ${result.corp.tenant.name} (${result.corp.tenant.id})`);
@@ -92,11 +101,16 @@ export async function handleWebhookCommand(
const options = integrations.map((i) => `"${i.name}" (${i.id})`).join(", ");
throw new Error(`当前租户存在多个 Webhook 通道 [${options}],请通过 --webhook <idOrName> 指定目标通道。`);
} else {
throw new Error("当前租户未配置任何 Webhook 集成通道。请先运行 'seal-use webhook add --name ... --result-url ...' 创建通道。");
throw new CliError(
"当前租户未配置任何 Webhook 集成通道。",
1,
`seal-use webhook add --name <name> --result-url <url> --corp ${corp.id}`
);
}
const result = await pushMaterialPack(input.fileBuffer, input.fileName, {
webhookUrl: integration.incomingDocumentWebhook.url,
secret: integration.secret
secret: integration.secret,
materialPackFilePolicy: integration.materialPackFilePolicy
});
console.log(JSON.stringify(result, null, 2));
return;
@@ -142,6 +156,8 @@ export async function handleWebhookCommand(
throw new Error("Usage: seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic]");
}
const autoApprovalRate = webhookRateOption(args.options);
const materialPackFilePolicy = materialPackFilePolicyOptions(args.options);
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
await runTool(
"seal_webhook_add",
client,
@@ -151,7 +167,9 @@ export async function handleWebhookCommand(
mode: parseWebhookMode(stringOption(args.options.mode)),
outgoingResultWebhook,
autoApprovalRate,
secret: stringOption(args.options.secret)
secret: stringOption(args.options.secret),
materialPackFilePolicy,
dryRun
},
outputOptions(args.options)
);
@@ -164,7 +182,7 @@ export async function handleWebhookCommand(
const secret = stringOption(args.options.secret);
const rotateSecret = booleanOption(args.options.rotateSecret) ?? booleanOption(args.options["rotate-secret"]);
if (secret !== undefined && rotateSecret) {
throw new Error("Use either --secret or --rotate-secret, not both");
throw usageError("Use either --secret or --rotate-secret, not both");
}
const name = stringOption(args.options.name);
const mode = parseWebhookMode(stringOption(args.options.mode));
@@ -174,15 +192,19 @@ export async function handleWebhookCommand(
stringOption(args.options.outgoingResultWebhook) ??
stringOption(args.options["outgoing-result-webhook"]);
const autoApprovalRate = webhookRateOption(args.options);
const materialPackFilePolicy = materialPackFilePolicyOptions(args.options);
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
if (
name === undefined &&
mode === undefined &&
outgoingResultWebhook === undefined &&
autoApprovalRate === undefined &&
secret === undefined &&
!rotateSecret
!rotateSecret &&
materialPackFilePolicy === undefined &&
!dryRun
) {
throw new Error("Webhook update requires at least one field option");
throw usageError("Webhook update requires at least one field option");
}
await runTool(
"seal_webhook_update",
@@ -195,7 +217,9 @@ export async function handleWebhookCommand(
outgoingResultWebhook,
autoApprovalRate,
secret,
rotateSecret
rotateSecret,
materialPackFilePolicy,
dryRun
},
outputOptions(args.options)
);
@@ -204,9 +228,13 @@ export async function handleWebhookCommand(
if (action === "delete") {
const selector = maybeName ?? stringOption(args.options.selector) ?? stringOption(args.options.id);
if (!selector) throw new Error("Usage: seal-use webhook delete <idOrName> --yes");
if (booleanOption(args.options.yes) !== true) {
throw new Error("Refusing to delete Webhook integration without --yes");
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
if (!selector) throw new Error("Usage: seal-use webhook delete <idOrName> [--yes|--dry-run]");
if (booleanOption(args.options.yes) !== true && !dryRun) {
throw confirmationRequired(
"Refusing to delete Webhook integration without --yes",
`seal-use webhook delete ${selector} --corp ${corp.id} --yes`
);
}
await runTool(
"seal_webhook_delete",
@@ -214,7 +242,8 @@ export async function handleWebhookCommand(
corp,
{
selector,
confirm: true
confirm: true,
dryRun
},
outputOptions(args.options)
);
+37
View File
@@ -0,0 +1,37 @@
import { describe, expect, test } from "bun:test";
import { CliError, classifyCliError, confirmationRequired, PayloadTooLargeError } from "./errors.js";
describe("CLI semantic errors", () => {
test("preserves explicit exit codes and next actions", () => {
const error = new CliError("missing sign key", 2, "seal-use deploy hosecloud get <sign-key>");
expect(classifyCliError(error)).toEqual({
exitCode: 2,
nextAction: "seal-use deploy hosecloud get <sign-key>"
});
});
test("classifies confirmation and output protection distinctly", () => {
expect(classifyCliError(confirmationRequired("Refusing to delete", "seal-use webhook delete <id> --yes"))).toMatchObject({
exitCode: 10,
nextAction: "seal-use webhook delete <id> --yes"
});
expect(classifyCliError(new PayloadTooLargeError("Output too large"))).toEqual({ exitCode: 12 });
});
test("classifies authentication failures from response status", () => {
expect(classifyCliError({ response: { status: 401 } })).toEqual({ exitCode: 11 });
expect(classifyCliError(new Error("bearer token expired"))).toEqual({ exitCode: 11 });
});
test("classifies unknown commands and subcommands across all domains as usage errors", () => {
expect(classifyCliError(new Error("Unknown command: not-a-command"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown contacts command: . Run 'seal-use help' for available commands."))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown data command: bad-subcommand"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown analytics command: invalid"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown approval-runs command: invalid"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown billing command: invalid"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Unknown webhook command: invalid"))).toEqual({ exitCode: 2 });
expect(classifyCliError(new Error("Usage: seal-use contacts children <departmentId>"))).toEqual({ exitCode: 2 });
});
});
+58
View File
@@ -0,0 +1,58 @@
export type CliExitCode = 1 | 2 | 10 | 11 | 12;
export class CliError extends Error {
readonly exitCode: CliExitCode;
readonly nextAction?: string;
constructor(message: string, exitCode: CliExitCode, nextAction?: string) {
super(message);
this.name = "CliError";
this.exitCode = exitCode;
this.nextAction = nextAction;
}
}
export class PayloadTooLargeError extends CliError {
constructor(message: string, nextAction?: string) {
super(message, 12, nextAction);
this.name = "PayloadTooLargeError";
}
}
export function usageError(message: string, nextAction?: string): CliError {
return new CliError(message, 2, nextAction);
}
export function confirmationRequired(message: string, nextAction: string): CliError {
return new CliError(message, 10, nextAction);
}
export function classifyCliError(error: unknown): {
exitCode: CliExitCode;
nextAction?: string;
} {
if (error instanceof CliError) {
return { exitCode: error.exitCode, nextAction: error.nextAction };
}
const value = error instanceof Error ? error.message : String(error);
const status = responseStatus(error);
if (status === 401 || status === 403 || /(?:^|\s)(?:token|bearer|session) (?:expired|missing|invalid)/i.test(value)) {
return { exitCode: 11 };
}
if (/^(?:Usage:|Unknown (?:[a-z0-9_-]+ )?command|Invalid (?:number|boolean|command)|--json must|Missing required JSON field)/i.test(value)) {
return { exitCode: 2 };
}
if (/^Refusing to (?:clear|delete)|without --yes|without confirm=true/i.test(value)) {
return { exitCode: 10 };
}
return { exitCode: 1 };
}
function responseStatus(error: unknown): number | undefined {
if (!error || typeof error !== "object") return undefined;
const response = (error as { response?: unknown }).response;
if (!response || typeof response !== "object") return undefined;
const status = (response as { status?: unknown }).status;
return typeof status === "number" ? status : undefined;
}
+128
View File
@@ -0,0 +1,128 @@
import { describe, expect, test } from "bun:test";
import { extractHelpRequest, renderHelp } from "./help.js";
import { runCli } from "./runner.js";
describe("extractHelpRequest", () => {
test("detects global help from empty command or help option", () => {
expect(extractHelpRequest({ command: [], options: {} })).toEqual({ isHelp: true, target: [] });
expect(extractHelpRequest({ command: ["help"], options: {} })).toEqual({ isHelp: true, target: [] });
expect(extractHelpRequest({ command: [], options: { help: true } })).toEqual({ isHelp: true, target: [] });
expect(extractHelpRequest({ command: [], options: { h: true } })).toEqual({ isHelp: true, target: [] });
});
test("detects area help across various syntax styles", () => {
expect(extractHelpRequest({ command: ["corps"], options: { help: true } })).toEqual({
isHelp: true,
target: ["corps"]
});
expect(extractHelpRequest({ command: ["corps"], options: { h: true } })).toEqual({
isHelp: true,
target: ["corps"]
});
expect(extractHelpRequest({ command: ["corps", "help"], options: {} })).toEqual({
isHelp: true,
target: ["corps"]
});
expect(extractHelpRequest({ command: ["help", "corps"], options: {} })).toEqual({
isHelp: true,
target: ["corps"]
});
});
test("detects subcommand help across various syntax styles", () => {
expect(extractHelpRequest({ command: ["corps", "bind-test"], options: { help: true } })).toEqual({
isHelp: true,
target: ["corps", "bind-test"]
});
expect(extractHelpRequest({ command: ["corps", "bind-test"], options: { h: true } })).toEqual({
isHelp: true,
target: ["corps", "bind-test"]
});
expect(extractHelpRequest({ command: ["corps", "help", "bind-test"], options: {} })).toEqual({
isHelp: true,
target: ["corps", "bind-test"]
});
expect(extractHelpRequest({ command: ["help", "corps", "bind-test"], options: {} })).toEqual({
isHelp: true,
target: ["corps", "bind-test"]
});
});
test("returns isHelp: false for normal executions", () => {
expect(extractHelpRequest({ command: ["corps", "list"], options: {} })).toEqual({
isHelp: false,
target: []
});
expect(extractHelpRequest({ command: ["corps", "bind-test", "prod", "test"], options: { confirm: true } })).toEqual({
isHelp: false,
target: []
});
});
});
describe("renderHelp", () => {
test("renders global help when target is empty", () => {
const help = renderHelp([]);
expect(help).toContain("seal-use CLI");
expect(help).toContain("seal-use corps list");
expect(help).toContain("seal-use webhook add");
});
test("renders focused area help without polluting with other domains", () => {
const help = renderHelp(["corps"]);
expect(help).toContain("seal-use corps - Enterprise and tenant management");
expect(help).toContain("seal-use corps bind-test");
expect(help).toContain("seal-use corps sync-test");
expect(help).not.toContain("seal-use webhook");
expect(help).not.toContain("seal-use simulation");
expect(help).not.toContain("seal-use billing");
});
test("renders focused subcommand help with usage, options, and description", () => {
const help = renderHelp(["corps", "bind-test"]);
expect(help).toContain("seal-use corps bind-test");
expect(help).toContain("--confirm");
expect(help).toContain("--force");
expect(help).toContain("1-to-1 association");
expect(help).not.toContain("seal-use corps list");
expect(help).not.toContain("seal-use webhook");
});
test("throws usage error for unknown area or subcommand", () => {
expect(() => renderHelp(["nonexistent-domain"])).toThrow(/Unknown command/);
expect(() => renderHelp(["corps", "nonexistent-cmd"])).toThrow(/Unknown corps command/);
});
});
describe("CLI help execution via runCli", () => {
test("seal-use corps bind-test --help prints only bind-test help with exitCode 0", async () => {
const result = await runCli(["corps", "bind-test", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("seal-use corps bind-test");
expect(result.stdout).toContain("--confirm");
expect(result.stdout).toContain("--force");
expect(result.stdout).not.toContain("seal-use webhook");
expect(result.stdout).not.toContain("seal-use simulation");
expect(result.stdout).not.toContain("seal-use billing");
expect(result.stdout).not.toContain("seal-use preference");
});
test("seal-use corps --help prints only corps domain commands with exitCode 0", async () => {
const result = await runCli(["corps", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("seal-use corps - Enterprise and tenant management");
expect(result.stdout).toContain("seal-use corps list");
expect(result.stdout).toContain("seal-use corps bind-test");
expect(result.stdout).not.toContain("seal-use webhook");
expect(result.stdout).not.toContain("seal-use simulation");
});
test("seal-use corps unknown-cmd --help exits with code 2", async () => {
const result = await runCli(["corps", "unknown-cmd", "--help"]);
expect(result.exitCode).toBe(2);
expect(result.isError).toBe(true);
expect(result.stderr).toContain("Unknown corps command: unknown-cmd");
});
});
+1076
View File
File diff suppressed because it is too large. Load diff
+43 -5
View File
@@ -1,5 +1,7 @@
import type { WebhookMode } from "../domains/seal/types.js";
import type { MaterialPackFilePolicyPatch } from "../domains/seal/material-pack/policy.js";
import type { ParsedArgs } from "./types.js";
import { usageError } from "./errors.js";
export function parseArgs(argv: string[]): ParsedArgs {
const command: string[] = [];
@@ -12,8 +14,12 @@ export function parseArgs(argv: string[]): ParsedArgs {
if (arg === "--json") {
const raw = argv[index + 1];
if (!raw) throw new Error("--json requires a JSON object argument");
json = JSON.parse(raw);
if (!raw) throw usageError("--json requires a JSON object argument");
try {
json = JSON.parse(raw);
} catch (error) {
throw usageError(`Invalid JSON: ${error instanceof Error ? error.message : String(error)}`);
}
index += 1;
continue;
}
@@ -46,7 +52,7 @@ export function parseArgs(argv: string[]): ParsedArgs {
export function jsonObject(value: unknown): Record<string, unknown> {
if (value === undefined) return {};
if (!value || typeof value !== "object" || Array.isArray(value)) {
throw new Error("--json must be an object");
throw usageError("--json must be an object");
}
return value as Record<string, unknown>;
}
@@ -58,7 +64,7 @@ export function stringOption(value: string | boolean | undefined): string | unde
export function numberOption(value: string | boolean | undefined): number | undefined {
if (typeof value !== "string") return undefined;
const number = Number(value);
if (!Number.isFinite(number)) throw new Error(`Invalid number: ${value}`);
if (!Number.isFinite(number)) throw usageError(`Invalid number: ${value}`);
return number;
}
@@ -73,7 +79,7 @@ export function booleanOption(value: string | boolean | undefined): boolean | un
if (typeof value === "boolean") return value;
if (value === "true") return true;
if (value === "false") return false;
throw new Error(`Invalid boolean: ${value}`);
throw usageError(`Invalid boolean: ${value}`);
}
export function requiredString(input: Record<string, unknown>, key: string): string {
@@ -201,3 +207,35 @@ export function webhookRateOption(options: Record<string, string | boolean>): nu
export function webhookShowSecretOption(options: Record<string, string | boolean>): boolean | undefined {
return booleanOption(options.showSecret) ?? booleanOption(options["show-secret"]);
}
export function materialPackFilePolicyOptions(
options: Record<string, string | boolean>
): MaterialPackFilePolicyPatch | undefined {
const clearMaxFileSize = booleanOption(
options.clearMaxFileSize ?? options["clear-max-file-size"]
) === true;
const minFileSizeBytes = numberOption(
options.minFileSizeBytes ?? options["min-file-size-bytes"] ?? options.minFileSize ?? options["min-file-size"]
);
const maxFileSizeBytes = numberOption(
options.maxFileSizeBytes ?? options["max-file-size-bytes"] ?? options.maxFileSize ?? options["max-file-size"]
);
const allowedExtensions = splitOption(
options.allowedExtensions ?? options["allowed-extensions"] ?? options.extensions
);
if (
minFileSizeBytes === undefined &&
maxFileSizeBytes === undefined &&
allowedExtensions === undefined &&
!clearMaxFileSize
) {
return undefined;
}
return {
minFileSizeBytes,
maxFileSizeBytes: clearMaxFileSize ? null : maxFileSizeBytes,
allowedExtensions
};
}
+9 -112
View File
@@ -1,5 +1,6 @@
import { writeFileSync } from "node:fs";
import { booleanOption, stringOption } from "./parser.js";
import { PayloadTooLargeError } from "./errors.js";
import type { OutputOptions } from "./types.js";
const RULE_LIST_FULL_COUNT_LIMIT = 100;
@@ -37,7 +38,7 @@ function protectLargeOutput(result: unknown, options: OutputOptions = {}) {
if (options.allowFull || options.outputFile) return;
const bodyBytes = Buffer.byteLength(JSON.stringify(result), "utf-8");
if (bodyBytes > DEFAULT_OUTPUT_BYTES_LIMIT) {
throw new Error(
throw new PayloadTooLargeError(
`Output is large (${bodyBytes} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`
);
}
@@ -56,8 +57,9 @@ export function protectLargeRuleListOutput(result: unknown, allowFull: boolean)
const effectiveCount = count ?? rulesCount ?? 0;
if (effectiveCount > RULE_LIST_FULL_COUNT_LIMIT || bodyBytes > RULE_LIST_FULL_BYTES_LIMIT) {
throw new Error(
`Rule list is large (${effectiveCount} rules, ${bodyBytes} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`
throw new PayloadTooLargeError(
`Rule list is large (${effectiveCount} rules, ${bodyBytes} 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"
);
}
}
@@ -69,114 +71,9 @@ export function outputOptions(options: Record<string, string | boolean>): Output
};
}
export function printHelp() {
console.log(`seal-use CLI
import { renderHelp } from "./help.js";
Usage:
seal-use version
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use openapi
seal-use probe [<corpId>]
seal-use config paths
seal-use config get
seal-use config mode <stateful|stateless> [--corp <corpId>]
seal-use config test-dir [<path>|--clear]
seal-use config lint [status|enable|disable] [--linter <name|path>] [--min-score <score>]
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
seal-use changelog [--limit <n>]
seal-use tools list
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
seal-use auth diagnose [--corp <corpId>]
seal-use auth hose-link [--corp <corpId>] [--expire 7200]
seal-use delegation list [--corp <corpId>]
seal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
seal-use delegation revoke <tokenId> [--corp <corpId>]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--corp <corpId>]
seal-use webhook status [<材料包.zip>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--corp <corpId>]
seal-use webhook update <idOrName> [--name <name>] [--result-url <url>] [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>|--rotate-secret] [--corp <corpId>]
seal-use webhook delete <idOrName> --yes [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--corp <corpId>]
seal-use webhook material-pack push <材料包.zip|信息表.xlsx> [--webhook <idOrName>] [--corp <corpId>]
seal-use deploy hosecloud requirements [--corp <corpId>]
seal-use deploy hosecloud list [--corp <corpId>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--corp <corpId>]
seal-use deploy hosecloud sync <sign-key> [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use rules count [--corp <corpId>]
seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules get --corp <corpId> --version <number|latest> --code '#0038'
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] [--corp <corpId>]
seal-use approval-runs count [--status APPROVED] [--corp <corpId>]
seal-use approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--limit <n>] [--downloads] [--out <file>] [--corp <corpId>]
seal-use approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
seal-use approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
seal-use approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
seal-use approval-runs cited-rules <recordId> [--corp <corpId>]
seal-use approval-runs document-summary <recordId> [--corp <corpId>]
seal-use approval-runs attachments <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] [--corp <corpId>]
seal-use approval-runs result <recordId> [--summary] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
seal-use approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
seal-use approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
seal-use simulation batch-records <batchId> [--corp <corpId>]
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--corp <corpId>]
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" [--corp <corpId>]
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
seal-use simulation clean <batchId> [--corp <corpId>]
seal-use simulation specifications [--integration <sign-key>] [--corp <corpId>]
seal-use simulation list [--limit 50] [--corp <corpId>]
seal-use simulation get <batchId> [--corp <corpId>]
seal-use simulation templates [--corp <corpId>]
seal-use simulation integrations [--corp <corpId>]
seal-use simulation package-upload <材料包.zip> [--corp <corpId>]
`);
export function printHelp(target: string[] = []) {
console.log(renderHelp(target));
}
+46 -1
View File
@@ -1,3 +1,6 @@
import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "bun:test";
import { runCli } from "./runner.js";
@@ -17,7 +20,49 @@ describe("CLI runner", () => {
const result = await runCli(["not-a-command"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(1);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Unknown command: not-a-command");
});
test("returns a semantic usage exit code for invalid JSON", async () => {
const result = await runCli(["version", "--json", "not-json"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Invalid JSON:");
});
test("returns usage exit code 2 for unknown subcommands across standalone domains", async () => {
const result = await runCli(["skill", "not-a-subcommand"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Unknown skill command: not-a-subcommand");
});
test("returns usage exit code 2 for unknown subcommands with an active enterprise", async () => {
const tempDir = mkdtempSync(join(tmpdir(), "seal-use-runner-test-"));
const originalEnv = process.env.SEAL_USE_ENTERPRISES_DIR;
try {
process.env.SEAL_USE_ENTERPRISES_DIR = tempDir;
writeFileSync(
join(tempDir, "test.json"),
JSON.stringify({
id: "test",
name: "Test Corp",
source: { type: "seal", token: "dummy-token", sealUrl: "https://test.sealai.cc" },
seal: { url: "https://test.sealai.cc" }
})
);
const result = await runCli(["contacts", "not-a-subcommand", "--corp", "test"]);
expect(result.isError).toBe(true);
expect(result.exitCode).toBe(2);
expect(result.stderr).toContain("Unknown contacts command: not-a-subcommand");
} finally {
if (originalEnv === undefined) delete process.env.SEAL_USE_ENTERPRISES_DIR;
else process.env.SEAL_USE_ENTERPRISES_DIR = originalEnv;
rmSync(tempDir, { recursive: true, force: true });
}
});
});
+42 -7
View File
@@ -6,9 +6,12 @@ import { createSealClient } from "../core/http/factory.js";
import type { CorpConfig } from "../core/config/types.js";
import { VERSION } from "../version.js";
import { handleApprovalRunsCommand } from "./commands/approval-runs.js";
import { handleAnalyticsCommand } from "./commands/analytics.js";
import { handleAuthCommand } from "./commands/auth.js";
import { handleBillingCommand } from "./commands/billing.js";
import { handleConfigCommand } from "./commands/config.js";
import { handleContactsCommand } from "./commands/contacts.js";
import { handleDataCommand } from "./commands/data.js";
import { handleContextCommand } from "./commands/context.js";
import { handleCorpsCommand } from "./commands/corps.js";
import { handleDelegationCommand, handleDelegationFromHoseLink } from "./commands/delegation.js";
@@ -30,8 +33,16 @@ import { handleToolsListCommand } from "./commands/tools.js";
import { handleUpdateCommand } from "./commands/update.js";
import { handleUsersCommand } from "./commands/users.js";
import { handleWebhookCommand, handleWebhookMaterialPackPreview } from "./commands/webhook.js";
import { classifyCliError } from "./errors.js";
import { selectCorp } from "./helpers.js";
import { booleanOption, numberOption, parseArgs, stringOption } from "./parser.js";
import {
booleanOption,
materialPackFilePolicyOptions,
numberOption,
parseArgs,
stringOption
} from "./parser.js";
import { extractHelpRequest } from "./help.js";
import {
formatConsoleOutput,
joinOutput,
@@ -56,6 +67,8 @@ const KNOWN_AREAS = new Set([
"auth",
"delegation",
"users",
"contacts",
"data",
"llm",
"permissions",
"billing",
@@ -64,6 +77,7 @@ const KNOWN_AREAS = new Set([
"context",
"rules",
"approval-runs",
"analytics",
"simulation",
"deploy",
"preference",
@@ -131,12 +145,17 @@ async function runCliOnce(argv: string[], options: CliRunOptions): Promise<CliRe
exitCode: 0
};
} catch (error) {
stderr.push(redactSensitiveText(error instanceof Error ? error.message : String(error)));
const message = redactSensitiveText(error instanceof Error ? error.message : String(error));
const classification = classifyCliError(error);
stderr.push(message);
if (classification.nextAction && !message.includes("Next action:")) {
stderr.push(`👉 Next action: ${classification.nextAction}`);
}
return {
stdout: joinOutput(stdout),
stderr: joinOutput(stderr),
isError: true,
exitCode: 1
exitCode: classification.exitCode
};
} finally {
console.log = originalLog;
@@ -162,19 +181,20 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (!area || area === "help" || args.options.help) {
printHelp();
const helpRequest = extractHelpRequest(args);
if (helpRequest.isHelp) {
printHelp(helpRequest.target);
return;
}
if (!KNOWN_AREAS.has(area)) {
if (!area || !KNOWN_AREAS.has(area)) {
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-use help' for available commands.`);
}
if (area === "webhook" && action === "material-pack" && maybeName === "preview") {
const filePath = args.command[3] ?? stringOption(args.options.file) ?? stringOption(args.options.input);
if (!filePath) throw new Error("Usage: seal-use webhook material-pack preview <材料包.zip>");
await handleWebhookMaterialPackPreview(filePath);
await handleWebhookMaterialPackPreview(filePath, materialPackFilePolicyOptions(args.options));
return;
}
@@ -308,6 +328,16 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "contacts") {
await handleContactsCommand(action, maybeName, client, corp, args);
return;
}
if (area === "data") {
await handleDataCommand(action, client, corp, args);
return;
}
if (area === "llm") {
await handleLlmCommand(action, client, corp, args);
return;
@@ -343,6 +373,11 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "analytics") {
await handleAnalyticsCommand(action, client, corp, args);
return;
}
if (area === "simulation") {
await handleSimulationCommand(action, maybeName, client, corp, args);
return;
+2
View File
@@ -7,6 +7,7 @@ describe("getDirectSealSession", () => {
const corp: CorpConfig = {
id: "corp-direct-1",
name: "Direct Corp",
environment: "production",
seal: {
url: "https://seal.example.com",
tenantSlug: "direct-slug",
@@ -48,6 +49,7 @@ describe("getDirectSealSession", () => {
const corp: CorpConfig = {
id: "corp-native-1",
name: "Native Seal Corp",
environment: "production",
seal: {
url: "https://tenant.sealai.cc",
tenantSlug: "tenant-slug",
+3
View File
@@ -59,6 +59,7 @@ describe("hose auth helpers", () => {
const corpWithSealUrl: CorpConfig = {
id: "corp-1",
name: "Corp 1",
environment: "production",
seal: { url: "https://custom.sealai.cc", endpoints: { approvalStylePreferences: "" } },
source,
auth: { refreshTtl: 300 }
@@ -68,6 +69,7 @@ describe("hose auth helpers", () => {
const corpWithoutSealUrl: CorpConfig = {
id: "corp-1",
name: "Corp 1",
environment: "production",
seal: { endpoints: { approvalStylePreferences: "" } },
source,
auth: { refreshTtl: 300 }
@@ -91,6 +93,7 @@ describe("hose auth helpers", () => {
const corp: CorpConfig = {
id: "corp-cached",
name: "Corp Cached",
environment: "production",
seal: { endpoints: { approvalStylePreferences: "" } },
source: {
type: "hose",
+68 -2
View File
@@ -1,13 +1,16 @@
import { afterEach, describe, expect, test } from "bun:test";
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
import { existsSync, mkdirSync, mkdtempSync, rmSync, utimesSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import {
findCorpConfigFile,
loadCorpConfigs,
loadGlobalConfig,
resolveEnterprisesDir,
resolveGlobalConfigFile,
saveGlobalConfig
saveGlobalConfig,
syncLegacyEnterprisesDir,
updateCorpConfig
} from "./loader.js";
const ORIGINAL_USE_ENV = process.env.SEAL_USE_ENTERPRISES_DIR;
@@ -153,6 +156,69 @@ describe("loadCorpConfigs", () => {
}
});
});
test("finds and updates an enterprise config file in-place", () => {
const dir = makeTempDir();
process.env.SEAL_USE_ENTERPRISES_DIR = dir;
writeCorpConfig(join(dir, "alpha.json"), "alpha", "Alpha Corp");
expect(findCorpConfigFile("alpha")).toBe(join(dir, "alpha.json"));
expect(findCorpConfigFile("nonexistent")).toBeUndefined();
const updated = updateCorpConfig("alpha", {
environment: "production",
testCorpId: "alpha-test"
});
expect(updated.id).toBe("alpha");
expect(updated.environment).toBe("production");
expect(updated.testCorpId).toBe("alpha-test");
// Check on-disk persistence
const reloaded = loadCorpConfigs().find((c) => c.id === "alpha");
expect(reloaded?.testCorpId).toBe("alpha-test");
// Unsetting / clearing testCorpId
const cleared = updateCorpConfig("alpha", {
testCorpId: undefined
});
expect(cleared.testCorpId).toBeUndefined();
const reloadedAfterClear = loadCorpConfigs().find((c) => c.id === "alpha");
expect(reloadedAfterClear?.testCorpId).toBeUndefined();
});
});
describe("syncLegacyEnterprisesDir", () => {
test("migrates files from legacy to primary and deletes legacy when > 7 days old", () => {
const primary = makeTempDir();
const legacy = makeTempDir();
writeCorpConfig(join(legacy, "old-corp.json"), "old-corp", "Old Corp");
const tenDaysAgo = (Date.now() - 10 * 24 * 60 * 60 * 1000) / 1000;
utimesSync(join(legacy, "old-corp.json"), tenDaysAgo, tenDaysAgo);
utimesSync(legacy, tenDaysAgo, tenDaysAgo);
const result = syncLegacyEnterprisesDir(primary, legacy);
expect(result.copied).toEqual(["old-corp.json"]);
expect(result.deletedLegacyDir).toBe(true);
expect(existsSync(join(primary, "old-corp.json"))).toBe(true);
expect(existsSync(legacy)).toBe(false);
});
test("preserves legacy directory when modified within 7 days", () => {
const primary = makeTempDir();
const legacy = makeTempDir();
writeCorpConfig(join(legacy, "recent-corp.json"), "recent-corp", "Recent Corp");
const result = syncLegacyEnterprisesDir(primary, legacy);
expect(result.copied).toEqual(["recent-corp.json"]);
expect(result.deletedLegacyDir).toBe(false);
expect(existsSync(join(primary, "recent-corp.json"))).toBe(true);
expect(existsSync(legacy)).toBe(true);
});
});
function makeTempDir(): string {
+122 -4
View File
@@ -1,4 +1,4 @@
import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { dirname, join } from "node:path";
import { CorpConfig, CorpConfigSchema, GlobalConfig, GlobalConfigInput, GlobalConfigSchema } from "./types.js";
@@ -16,6 +16,75 @@ export const LEGACY_USER_ENTERPRISES_DIR = join(homedir(), ".config", "seal-home
const PRIMARY_GLOBAL_CONFIG_FILE = join(homedir(), ".config", "seal-use", "config.json");
const LEGACY_GLOBAL_CONFIG_FILE = join(homedir(), ".config", "seal-home", "config.json");
export function syncLegacyEnterprisesDir(
primaryDir: string = PRIMARY_USER_ENTERPRISES_DIR,
legacyDir: string = LEGACY_USER_ENTERPRISES_DIR
): { copied: string[]; deletedLegacyDir: boolean } {
if (!existsSync(legacyDir)) {
return { copied: [], deletedLegacyDir: false };
}
mkdirSync(primaryDir, { recursive: true, mode: 0o700 });
const copied: string[] = [];
let legacyFiles: string[] = [];
try {
legacyFiles = readdirSync(legacyDir).filter((file) => file.endsWith(".json"));
} catch {
return { copied: [], deletedLegacyDir: false };
}
for (const file of legacyFiles) {
const legacyPath = join(legacyDir, file);
const primaryPath = join(primaryDir, file);
if (!existsSync(primaryPath)) {
copyFileSync(legacyPath, primaryPath);
copied.push(file);
} else {
const legacyMtime = statSync(legacyPath).mtimeMs;
const primaryMtime = statSync(primaryPath).mtimeMs;
if (legacyMtime > primaryMtime) {
copyFileSync(legacyPath, primaryPath);
copied.push(file);
}
}
}
const SEVEN_DAYS_MS = 7 * 24 * 60 * 60 * 1000;
const now = Date.now();
let hasNewerFileInLegacy = false;
let hasRecentlyModifiedFile = false;
for (const file of readdirSync(legacyDir)) {
const legacyPath = join(legacyDir, file);
const primaryPath = join(primaryDir, file);
const stat = statSync(legacyPath);
if (now - stat.mtimeMs < SEVEN_DAYS_MS) {
hasRecentlyModifiedFile = true;
}
if (file.endsWith(".json") && existsSync(primaryPath)) {
if (stat.mtimeMs > statSync(primaryPath).mtimeMs) {
hasNewerFileInLegacy = true;
}
}
}
const dirStat = statSync(legacyDir);
const dirRecentlyModified = now - dirStat.mtimeMs < SEVEN_DAYS_MS;
let deletedLegacyDir = false;
if (!hasNewerFileInLegacy && !hasRecentlyModifiedFile && !dirRecentlyModified) {
rmSync(legacyDir, { recursive: true, force: true });
deletedLegacyDir = true;
}
return { copied, deletedLegacyDir };
}
export function loadCorpConfigs(): CorpConfig[] {
const dirs = resolveEnterprisesDirs();
const byId = new Map<string, CorpConfig>();
@@ -42,9 +111,19 @@ function resolveEnterprisesDirs(): string[] {
if (configured) return existsSync(configured) ? [configured] : [];
const configuredUserDir = (process.env[USER_DIR_ENV] ?? process.env[LEGACY_USER_DIR_ENV])?.trim();
const userDirs = configuredUserDir
? (existsSync(configuredUserDir) ? [configuredUserDir] : [])
: [PRIMARY_USER_ENTERPRISES_DIR, LEGACY_USER_ENTERPRISES_DIR];
let userDirs: string[];
if (configuredUserDir) {
userDirs = existsSync(configuredUserDir) ? [configuredUserDir] : [];
} else {
try {
syncLegacyEnterprisesDir();
} catch {}
userDirs = existsSync(PRIMARY_USER_ENTERPRISES_DIR)
? [PRIMARY_USER_ENTERPRISES_DIR]
: (existsSync(LEGACY_USER_ENTERPRISES_DIR) ? [LEGACY_USER_ENTERPRISES_DIR] : [PRIMARY_USER_ENTERPRISES_DIR]);
}
const globalConfig = loadGlobalConfig();
const testDir = globalConfig.testEnterprisesDir?.trim();
@@ -104,3 +183,42 @@ export function saveGlobalConfig(config: GlobalConfigInput): GlobalConfig {
writeFileSync(file, `${JSON.stringify(normalized, null, 2)}\n`, { mode: 0o600 });
return normalized;
}
export function findCorpConfigFile(corpId: string): string | undefined {
const dirs = resolveEnterprisesDirs();
for (const dir of dirs) {
if (!existsSync(dir)) continue;
for (const file of readdirSync(dir)
.filter((item) => item.endsWith(".json"))
.filter((item) => !item.startsWith("example."))) {
const fullPath = join(dir, file);
try {
const content = readFileSync(fullPath, "utf-8");
const parsed = JSON.parse(content);
if (parsed && typeof parsed === "object" && parsed.id === corpId) {
return fullPath;
}
} catch {
// ignore malformed files
}
}
}
return undefined;
}
export function updateCorpConfig(corpId: string, patch: Partial<CorpConfig>): CorpConfig {
const filePath = findCorpConfigFile(corpId);
if (!filePath) {
throw new Error(`Enterprise config not found: ${corpId}`);
}
const raw = JSON.parse(readFileSync(filePath, "utf-8"));
const merged = { ...raw, ...patch };
for (const key of Object.keys(patch) as Array<keyof CorpConfig>) {
if (patch[key] === undefined) {
delete merged[key];
}
}
const validated = CorpConfigSchema.parse(merged);
writeFileSync(filePath, `${JSON.stringify(validated, null, 2)}\n`, "utf-8");
return validated;
}
+1
View File
@@ -6,6 +6,7 @@ function corp(id: string, name = id): CorpConfig {
return {
id,
name,
environment: "production",
seal: {
endpoints: {
approvalStylePreferences: "api/v1/agent/ai-approval/config"
+92 -1
View File
@@ -1,5 +1,10 @@
import { describe, expect, test } from "bun:test";
import { CorpConfigSchema, GlobalConfigSchema } from "./types.js";
import {
CorpConfigSchema,
GlobalConfigSchema,
SealCookieMapSchema,
SealHeaderMapSchema
} from "./types.js";
describe("CorpConfigSchema", () => {
test("accepts Hose key/password aliases", () => {
@@ -78,6 +83,92 @@ describe("CorpConfigSchema", () => {
expect(config.source.staffId).toBe("seal");
expect(config.source.tenantSlug).toBe("xiezihao");
});
test("leaves custom headers and cookies absent by default", () => {
const config = CorpConfigSchema.parse({
id: "direct",
name: "Direct",
source: {
type: "direct",
token: "seal-token",
sealUrl: "https://direct.sealai.cc"
}
});
expect(config.seal.headers).toBeUndefined();
expect(config.seal.cookies).toBeUndefined();
expect(config.environment).toBe("production");
expect(config.testCorpId).toBeUndefined();
expect(config.prodCorpId).toBeUndefined();
});
test("accepts environment, testCorpId, and prodCorpId", () => {
const prodConfig = CorpConfigSchema.parse({
id: "prod-corp",
name: "Prod Corp",
environment: "production",
testCorpId: "test-corp",
source: {
type: "direct",
token: "seal-token",
sealUrl: "https://direct.sealai.cc"
}
});
expect(prodConfig.environment).toBe("production");
expect(prodConfig.testCorpId).toBe("test-corp");
const testConfig = CorpConfigSchema.parse({
id: "test-corp",
name: "Test Corp",
environment: "test",
prodCorpId: "prod-corp",
source: {
type: "direct",
token: "seal-token",
sealUrl: "https://direct.sealai.cc"
}
});
expect(testConfig.environment).toBe("test");
expect(testConfig.prodCorpId).toBe("prod-corp");
});
test("accepts custom headers and cookies on the Seal endpoint", () => {
const config = CorpConfigSchema.parse({
id: "gated",
name: "Gated",
seal: {
url: "https://gated.sealai.cc",
headers: { "X-Tenant": "acme" },
cookies: { sdp_app_session_20142: "abc" }
},
source: {
type: "direct",
token: "seal-token",
sealUrl: "https://gated.sealai.cc"
}
});
expect(config.seal.headers).toEqual({ "X-Tenant": "acme" });
expect(config.seal.cookies).toEqual({ sdp_app_session_20142: "abc" });
});
});
describe("Seal custom header schemas", () => {
test("rejects an Authorization header supplied through config", () => {
expect(SealHeaderMapSchema.safeParse({ Authorization: "Bearer x" }).success).toBe(false);
expect(SealHeaderMapSchema.safeParse({ authorization: "Bearer x" }).success).toBe(false);
});
test("rejects malformed header and cookie names", () => {
expect(SealHeaderMapSchema.safeParse({ "bad name": "v" }).success).toBe(false);
expect(SealCookieMapSchema.safeParse({ "bad;name": "v" }).success).toBe(false);
});
test("rejects cookie values containing separators", () => {
expect(SealCookieMapSchema.safeParse({ name: "v;other=1" }).success).toBe(false);
expect(SealCookieMapSchema.safeParse({ name: "line\nbreak" }).success).toBe(false);
expect(SealCookieMapSchema.safeParse({ name: "ok-value" }).success).toBe(true);
});
});
describe("GlobalConfigSchema", () => {
+36 -1
View File
@@ -58,9 +58,38 @@ export const SealSourceSchema = z.discriminatedUnion("type", [
NativeSealSourceSchema
]);
// RFC 7230 token: shared by HTTP header names and cookie names.
const HTTP_TOKEN_PATTERN = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
export const SealHeaderMapSchema = z.record(
z.string().regex(HTTP_TOKEN_PATTERN, "Invalid HTTP header name"),
z.string()
).superRefine((headers, ctx) => {
for (const name of Object.keys(headers)) {
if (name.toLowerCase() === "authorization") {
ctx.addIssue({
code: "custom",
path: [name],
message: "seal.headers cannot set Authorization; the Seal session supplies the bearer token"
});
}
}
}).optional();
export const SealCookieMapSchema = z.record(
z.string().regex(HTTP_TOKEN_PATTERN, "Invalid cookie name"),
z.string().refine((value) => !/[\u0000-\u001f\u007f;]/.test(value), {
message: "Cookie value cannot contain control characters or semicolons"
})
).optional();
export const SealEndpointSchema = z.object({
url: z.string().url().optional(),
tenantSlug: z.string().optional(),
// Extra headers/cookies for Seal deployments reachable only through an
// upstream gateway that expects its own session cookie.
headers: SealHeaderMapSchema,
cookies: SealCookieMapSchema,
endpoints: z.object({
approvalStylePreferences: z.string().default("api/v1/agent/ai-approval/config")
}).default({
@@ -76,12 +105,17 @@ export const CorpAuthConfigSchema = z.object({
refreshTtl: z.number().int().positive().default(300)
}).default({ refreshTtl: 300 });
export const CorpEnvironmentSchema = z.enum(["production", "test"]).default("production");
export const CorpConfigSchema = z.object({
id: z.string(),
name: z.string(),
seal: SealEndpointSchema,
source: SealSourceSchema,
auth: CorpAuthConfigSchema
auth: CorpAuthConfigSchema,
environment: CorpEnvironmentSchema,
testCorpId: z.string().optional(),
prodCorpId: z.string().optional()
});
export const GlobalLintConfigSchema = z.object({
@@ -101,6 +135,7 @@ export const GlobalConfigSchema = z.object({
lint: GlobalLintConfigSchema
});
export type CorpEnvironment = z.infer<typeof CorpEnvironmentSchema>;
export type HoseSealSource = z.infer<typeof HoseSealSourceSchema>;
export type DirectSealSource = z.infer<typeof DirectSealSourceSchema>;
export type NativeSealSource = z.infer<typeof NativeSealSourceSchema>;
+33
View File
@@ -0,0 +1,33 @@
import { afterEach, describe, expect, test } from "bun:test";
import { createSealClientForUrl } from "./factory.js";
const servers: Array<ReturnType<typeof Bun.serve>> = [];
afterEach(() => {
for (const server of servers.splice(0)) server.stop(true);
});
describe("Seal HTTP client errors", () => {
test("includes ky's parsed response body after the response stream is consumed", async () => {
const server = Bun.serve({
port: 0,
fetch: () => new Response(JSON.stringify({
error: {
code: "error:common:invalid-parameter",
message: "contentType 取值非法"
}
}), {
status: 400,
headers: { "content-type": "application/json" }
})
});
servers.push(server);
await expect(
createSealClientForUrl(`http://127.0.0.1:${server.port}`, "dummy-token").get("/")
).rejects.toThrow(
'Request failed with status code 400 Bad Request: GET http://127.0.0.1:' +
`${server.port}/: {"error":{"code":"error:common:invalid-parameter","message":"contentType 取值非法"}}`
);
});
});
+37 -25
View File
@@ -1,6 +1,33 @@
import ky, { HTTPError, KyInstance } from "ky";
import { CorpConfig } from "../config/types.js";
import { clearSealToken, getSealSessionForCorp } from "../auth/seal.js";
import { resolveSealCustomHeaders } from "./request-headers.js";
function formatErrorData(data: unknown): string {
if (data === undefined || data === null || data === "") return "";
if (typeof data === "string") return data;
try {
return JSON.stringify(data);
} catch {
return String(data);
}
}
function withResponseBody(error: unknown): Error {
if (!(error instanceof HTTPError)) return error as Error;
const body = formatErrorData(error.data);
if (body) error.message = `${error.message}: ${body}`;
return error;
}
function createBeforeErrorHook(corpId?: string) {
return async ({ error }: { error: unknown }) => {
if (corpId && error instanceof HTTPError && error.response.status === 401) {
clearSealToken(corpId);
}
return withResponseBody(error);
};
}
export async function createSealClient(corp: CorpConfig): Promise<KyInstance> {
const session = await getSealSessionForCorp(corp);
@@ -9,22 +36,11 @@ export async function createSealClient(corp: CorpConfig): Promise<KyInstance> {
prefix: session.enterprise.sealUrl,
timeout: 30000,
headers: {
...resolveSealCustomHeaders(corp.seal),
Authorization: `Bearer ${session.token}`
},
hooks: {
beforeError: [
async ({ error }) => {
if (error instanceof HTTPError && error.response.status === 401) {
clearSealToken(corp.id);
}
const body =
error instanceof HTTPError
? await error.response.text().catch(() => "")
: "";
error.message = `${error.message}${body ? `: ${body}` : ""}`;
return error;
}
]
beforeError: [createBeforeErrorHook(corp.id)]
}
});
}
@@ -32,27 +48,23 @@ export async function createSealClient(corp: CorpConfig): Promise<KyInstance> {
export async function createSealClientForToken(corp: CorpConfig, token: string): Promise<KyInstance> {
const session = await getSealSessionForCorp(corp);
return createSealClientForUrl(session.enterprise.sealUrl, token);
return createSealClientForUrl(session.enterprise.sealUrl, token, resolveSealCustomHeaders(corp.seal));
}
export function createSealClientForUrl(sealUrl: string, token: string): KyInstance {
export function createSealClientForUrl(
sealUrl: string,
token: string,
customHeaders: Record<string, string> = {}
): KyInstance {
return ky.create({
prefix: sealUrl.replace(/\/+$/, ""),
timeout: 30000,
headers: {
...customHeaders,
Authorization: `Bearer ${token}`
},
hooks: {
beforeError: [
async ({ error }) => {
const body =
error instanceof HTTPError
? await error.response.text().catch(() => "")
: "";
error.message = `${error.message}${body ? `: ${body}` : ""}`;
return error;
}
]
beforeError: [createBeforeErrorHook()]
}
});
}
+64
View File
@@ -0,0 +1,64 @@
import { describe, expect, test } from "bun:test";
import { createSealClientForUrl } from "./factory.js";
import { formatCookieHeader, resolveSealCustomHeaders } from "./request-headers.js";
describe("formatCookieHeader", () => {
test("returns undefined when there are no cookies", () => {
expect(formatCookieHeader(undefined)).toBeUndefined();
expect(formatCookieHeader({})).toBeUndefined();
});
test("joins cookies with a semicolon and a space", () => {
expect(formatCookieHeader({ a: "1", b: "2" })).toBe("a=1; b=2");
});
});
describe("resolveSealCustomHeaders", () => {
test("returns an empty map when no custom headers are configured", () => {
expect(resolveSealCustomHeaders(undefined)).toEqual({});
});
test("keeps configured headers and renders cookies", () => {
expect(resolveSealCustomHeaders({
headers: { "X-Tenant": "acme" },
cookies: { sdp_session: "token" }
})).toEqual({
"X-Tenant": "acme",
Cookie: "sdp_session=token"
});
});
test("lets configured cookies replace a raw Cookie header", () => {
expect(resolveSealCustomHeaders({
headers: { Cookie: "stale=1" },
cookies: { fresh: "2" }
})).toEqual({ Cookie: "fresh=2" });
});
});
describe("createSealClientForUrl", () => {
test("sends custom headers and keeps the session Authorization", async () => {
const originalFetch = globalThis.fetch;
let sent: Headers | undefined;
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
const request = input instanceof Request ? input : new Request(input, init);
sent = new Headers(request.headers);
return new Response(JSON.stringify({ data: {} }), {
headers: { "content-type": "application/json" }
});
}) as typeof fetch;
try {
const client = createSealClientForUrl("https://corp-a.sealai.cc", "session-token", {
Cookie: "sdp_session=token",
Authorization: "Bearer stale"
});
await client.get("api/v1/auth/me");
} finally {
globalThis.fetch = originalFetch;
}
expect(sent?.get("cookie")).toBe("sdp_session=token");
expect(sent?.get("authorization")).toBe("Bearer session-token");
});
});
+20
View File
@@ -0,0 +1,20 @@
import type { CorpConfig } from "../config/types.js";
// The subset of the Seal endpoint config that carries extra request headers.
export type SealCustomHeaderSource = Pick<CorpConfig["seal"], "headers" | "cookies">;
// Renders configured cookies into one Cookie header, joined with "; ".
export function formatCookieHeader(cookies: Record<string, string> | undefined): string | undefined {
const pairs = Object.entries(cookies ?? {}).map(([name, value]) => `${name}=${value}`);
return pairs.length ? pairs.join("; ") : undefined;
}
// Extra tenant headers from corp config. A rendered Cookie header replaces a
// same-named entry, while Authorization is always left to the caller so the
// session bearer token can never be silently replaced by config.
export function resolveSealCustomHeaders(seal: SealCustomHeaderSource | undefined): Record<string, string> {
const headers: Record<string, string> = { ...(seal?.headers ?? {}) };
const cookieHeader = formatCookieHeader(seal?.cookies);
if (cookieHeader) headers.Cookie = cookieHeader;
return headers;
}
+196 -1
View File
@@ -6,6 +6,18 @@ import {
filterWebhookIntegrations,
findWebhookIntegration,
listWebhookIntegrations,
previewAddWebhookIntegration,
previewDeleteWebhookIntegration,
previewUpdateWebhookIntegration,
getDepartment,
getContactsLastSyncTime,
getInsightStats,
listExpenses,
listInvoices,
listFeishuSimulationApprovalDefinitions,
listDepartmentChildren,
listDepartmentUsers,
listRootDepartments,
searchUsers,
updateWebhookIntegration
} from "./api.js";
@@ -35,6 +47,150 @@ describe("Seal contact API", () => {
expect(requestedParams).toEqual({ query: "欧阳楠楠" });
expect(result.users).toEqual([{ _id: "user-1", name: "欧阳楠楠", departmentIds: [], permissions: [] }]);
});
test("reads the department tree, department users, and last sync time", async () => {
const requestedUrls: string[] = [];
const client = {
get: (url: string) => {
requestedUrls.push(url);
const data = url.endsWith("last-sync-time")
? { lastSyncTime: "2026-06-23T08:14:40.000Z" }
: url.endsWith("/users")
? { items: [{ _id: "user-1", name: "测试用户" }] }
: url.endsWith("/children") || url.endsWith("root/children")
? { items: [{ _id: "department-2", name: "财务" }] }
: { _id: "department-1", name: "公司", parentId: null };
return { json: async () => ({ data }) };
}
} as unknown as KyInstance;
await expect(listRootDepartments(client)).resolves.toMatchObject({
items: [{ _id: "department-2", name: "财务" }]
});
await expect(getDepartment(client, "department-1")).resolves.toMatchObject({
_id: "department-1",
name: "公司"
});
await expect(listDepartmentChildren(client, "department-1")).resolves.toMatchObject({
items: [{ _id: "department-2" }]
});
await expect(listDepartmentUsers(client, "department-1")).resolves.toMatchObject({
items: [{ _id: "user-1", name: "测试用户" }]
});
await expect(getContactsLastSyncTime(client)).resolves.toEqual({
lastSyncTime: "2026-06-23T08:14:40.000Z"
});
expect(requestedUrls).toEqual([
"api/v1/contacts/departments/root/children",
"api/v1/contacts/departments/department-1",
"api/v1/contacts/departments/department-1/children",
"api/v1/contacts/departments/department-1/users",
"api/v1/contacts/last-sync-time"
]);
});
test("forwards the insight stats date range and limit", async () => {
let requestedUrl = "";
const client = {
get: (url: string, options?: { searchParams?: URLSearchParams }) => {
requestedUrl = `${url}?${options?.searchParams?.toString() ?? ""}`;
return {
json: async () => ({
data: { tagStats: [], totalRisks: 2, analyzedRisks: 1, pendingRisks: 1 }
})
};
}
} as unknown as KyInstance;
await expect(getInsightStats(client, {
startDate: "2026-09-01T00:00:00+08:00",
endDate: "2026-09-30T23:59:59+08:00",
limit: 10
})).resolves.toEqual({
tagStats: [],
totalRisks: 2,
analyzedRisks: 1,
pendingRisks: 1
});
expect(requestedUrl).toBe(
"api/v1/insight/stats?startDate=2026-09-01T00%3A00%3A00%2B08%3A00&endDate=2026-09-30T23%3A59%3A59%2B08%3A00&limit=10"
);
});
test("defaults insight stats to the current calendar month", async () => {
let requestedUrl = "";
const client = {
get: (url: string, options?: { searchParams?: URLSearchParams }) => {
requestedUrl = `${url}?${options?.searchParams?.toString() ?? ""}`;
return { json: async () => ({ data: {} }) };
}
} as unknown as KyInstance;
await getInsightStats(client);
const parsed = new URL(`https://seal.test/${requestedUrl}`);
const now = new Date();
expect(parsed.searchParams.get("startDate")).toBe(
new Date(now.getFullYear(), now.getMonth(), 1).toISOString()
);
expect(parsed.searchParams.get("endDate")).toBe(
new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999).toISOString()
);
});
test("uses the frontend filter parameter names for expenses and invoices", async () => {
const requestedUrls: string[] = [];
const client = {
get: (url: string, options?: { searchParams?: URLSearchParams }) => {
requestedUrls.push(`${url}?${options?.searchParams?.toString() ?? ""}`);
return {
json: async () => ({
data: url.includes("expenses")
? { expenses: [], total: 0 }
: { invoices: [], total: 0, feishuApprovalAppId: null }
})
};
}
} as unknown as KyInstance;
await expect(listExpenses(client, {
startDate: "1757520000000",
endDate: "1789142399999",
search: "zz-probe-no-match",
offset: 0,
limit: 50
})).resolves.toEqual({ expenses: [], total: 0 });
await expect(listInvoices(client, {
startDate: "2026-08-31T16:00:00.000Z",
endDate: "2026-09-30T15:59:59.999Z",
search: "zz-probe-no-match",
offset: 0,
limit: 50
})).resolves.toEqual({ invoices: [], total: 0, feishuApprovalAppId: null });
expect(requestedUrls).toEqual([
"api/v1/expenses/list?filter%5BstartDate%5D=1757520000000&filter%5BendDate%5D=1789142399999&filter%5Bsearch%5D=zz-probe-no-match&offset=0&limit=50",
"api/v1/invoice/list?filter%5BstartDate%5D=2026-08-31T16%3A00%3A00.000Z&filter%5BendDate%5D=2026-09-30T15%3A59%3A59.999Z&filter%5Bsearch%5D=zz-probe-no-match&offset=0&limit=50"
]);
});
test("lists Feishu simulation approval definitions", async () => {
let requestedUrl = "";
const client = {
get: (url: string) => {
requestedUrl = url;
return {
json: async () => ({ data: [{ code: "travel", name: "差旅报销" }] })
};
}
} as unknown as KyInstance;
await expect(listFeishuSimulationApprovalDefinitions(client)).resolves.toEqual([
{ code: "travel", name: "差旅报销" }
]);
expect(requestedUrl).toBe("api/v1/integrations/feishu/simulation/approval-definitions");
});
});
describe("Seal Webhook API", () => {
@@ -112,10 +268,20 @@ describe("Seal Webhook API", () => {
const updated = await updateWebhookIntegration(client, "integration-1", {
name: "Renamed webhook",
rotateSecret: true
rotateSecret: true,
materialPackFilePolicy: {
minFileSizeBytes: 1000,
maxFileSizeBytes: 2000,
allowedExtensions: ["PDF", "xlsx"]
}
});
expect(updated.name).toBe("Renamed webhook");
expect(updated.secret).not.toBe("webhook-secret");
expect(updated.materialPackFilePolicy).toEqual({
minFileSizeBytes: 1000,
maxFileSizeBytes: 2000,
allowedExtensions: [".pdf", ".xlsx"]
});
expect((posted?.integrations as Array<Record<string, unknown>>)[1]).toMatchObject({ type: "hosecloud" });
const found = findWebhookIntegration([updated], "Renamed webhook");
@@ -126,6 +292,35 @@ describe("Seal Webhook API", () => {
expect(deleted.id).toBe("integration-1");
expect((posted?.integrations as Array<Record<string, unknown>>)).toHaveLength(1);
});
test("previews Webhook mutations without sending a write request", async () => {
const writes: string[] = [];
const client = {
get: () => ({
json: async () => ({ data: webhookConfig() })
}),
post: (url: string) => {
writes.push(`post:${url}`);
throw new Error("preview must not write");
},
patch: (url: string) => {
writes.push(`patch:${url}`);
throw new Error("preview must not write");
}
} as unknown as KyInstance;
const added = await previewAddWebhookIntegration(client, "https://seal.test", {
name: "Preview webhook",
outgoingResultWebhook: "https://callback.test/preview"
});
const updated = await previewUpdateWebhookIntegration(client, "integration-1", { name: "Preview rename" });
const deleted = await previewDeleteWebhookIntegration(client, "integration-1");
expect(added.integration?.name).toBe("Preview webhook");
expect(updated.integration?.name).toBe("Preview rename");
expect(deleted.after.integrations).toHaveLength(1);
expect(writes).toEqual([]);
});
});
function webhookConfig() {
+252 -15
View File
@@ -1,6 +1,11 @@
import { randomBytes } from "node:crypto";
import ky, { HTTPError, KyInstance } from "ky";
import { z } from "zod";
import {
mergeMaterialPackFilePolicy,
normalizeMaterialPackFilePolicy,
type MaterialPackFilePolicyPatch
} from "./material-pack/policy.js";
import { CorpConfig } from "../../core/config/types.js";
import { ensureHoseOpenapiToken, fetchHoseCloseApiToken, defaultSealUrl, normalizeBaseUrl } from "../../core/auth/hose.js";
import {
@@ -36,6 +41,22 @@ import {
SealUserDetailSchema,
SealContactSearchResult,
SealContactSearchResultSchema,
SealDepartment,
SealDepartmentSchema,
SealDepartmentListData,
SealDepartmentListDataSchema,
SealDepartmentUsersData,
SealDepartmentUsersDataSchema,
SealContactsLastSyncTime,
SealContactsLastSyncTimeSchema,
InsightStats,
InsightStatsSchema,
ExpenseListData,
ExpenseListDataSchema,
InvoiceListData,
InvoiceListDataSchema,
SimulationApprovalDefinition,
SimulationApprovalDefinitionSchema,
LlmConfig,
LlmConfigSchema,
LlmProvider,
@@ -259,6 +280,12 @@ export async function updateApprovalStylePreferences(
);
}
export type WebhookMutationPreview = {
before: ApprovalStylePreferences;
after: ApprovalStylePreferences;
integration?: WebhookIntegration;
};
export async function saveApprovalStylePreferences(
client: KyInstance,
params: Record<string, unknown>,
@@ -289,6 +316,7 @@ export async function addWebhookIntegration(
outgoingResultWebhook: string;
autoApprovalRate?: number;
secret?: string;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
},
endpoint = "api/v1/agent/ai-approval/config"
): Promise<WebhookIntegration> {
@@ -307,6 +335,29 @@ export async function addWebhookIntegration(
return integration;
}
export async function previewAddWebhookIntegration(
client: KyInstance,
baseUrl: string,
params: {
name: string;
mode?: WebhookMode;
outgoingResultWebhook: string;
autoApprovalRate?: number;
secret?: string;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
},
endpoint = "api/v1/agent/ai-approval/config"
): Promise<WebhookMutationPreview> {
const before = await getApprovalStylePreferences(client, endpoint);
const existing = parseWebhookIntegrations(before.integrations);
const integration = createWebhookIntegration(baseUrl, existing, params);
return {
before,
after: { ...before, integrations: [...before.integrations, integration] },
integration
};
}
export async function updateWebhookIntegration(
client: KyInstance,
selector: string,
@@ -317,26 +368,14 @@ export async function updateWebhookIntegration(
autoApprovalRate?: number;
secret?: string;
rotateSecret?: boolean;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
},
endpoint = "api/v1/agent/ai-approval/config"
): Promise<WebhookIntegration> {
const preferences = await getApprovalStylePreferences(client, endpoint);
const entries = getWebhookEntries(preferences.integrations);
const entry = findWebhookEntry(entries, selector);
const updated = WebhookIntegrationSchema.parse({
...entry.integration,
...(params.name === undefined ? {} : { name: requiredText(params.name, "name") }),
...(params.mode === undefined ? {} : { mode: params.mode }),
...(params.outgoingResultWebhook === undefined
? {}
: { outgoingResultWebhook: validUrl(params.outgoingResultWebhook, "outgoingResultWebhook") }),
...(params.autoApprovalRate === undefined
? {}
: { autoApprovalRate: validApprovalRate(params.autoApprovalRate) }),
...(params.rotateSecret || params.secret !== undefined
? { secret: params.rotateSecret ? generateWebhookSecret() : requiredText(params.secret ?? "", "secret") }
: {})
});
const updated = buildUpdatedWebhookIntegration(entry.integration, params);
const saved = await saveApprovalStylePreferences(client, {
...preferences,
@@ -352,6 +391,34 @@ export async function updateWebhookIntegration(
return updated;
}
export async function previewUpdateWebhookIntegration(
client: KyInstance,
selector: string,
params: {
name?: string;
mode?: WebhookMode;
outgoingResultWebhook?: string;
autoApprovalRate?: number;
secret?: string;
rotateSecret?: boolean;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
},
endpoint = "api/v1/agent/ai-approval/config"
): Promise<WebhookMutationPreview> {
const before = await getApprovalStylePreferences(client, endpoint);
const entries = getWebhookEntries(before.integrations);
const entry = findWebhookEntry(entries, selector);
const integration = buildUpdatedWebhookIntegration(entry.integration, params);
return {
before,
after: {
...before,
integrations: before.integrations.map((item, index) => index === entry.index ? integration : item)
},
integration
};
}
export async function deleteWebhookIntegration(
client: KyInstance,
selector: string,
@@ -372,6 +439,24 @@ export async function deleteWebhookIntegration(
return entry.integration;
}
export async function previewDeleteWebhookIntegration(
client: KyInstance,
selector: string,
endpoint = "api/v1/agent/ai-approval/config"
): Promise<WebhookMutationPreview> {
const before = await getApprovalStylePreferences(client, endpoint);
const entries = getWebhookEntries(before.integrations);
const entry = findWebhookEntry(entries, selector);
return {
before,
after: {
...before,
integrations: before.integrations.filter((_, index) => index !== entry.index)
},
integration: entry.integration
};
}
export function findWebhookIntegration(
integrations: WebhookIntegration[],
selector: string
@@ -445,6 +530,7 @@ function createWebhookIntegration(
outgoingResultWebhook: string;
autoApprovalRate?: number;
secret?: string;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
}
): WebhookIntegration {
const name = requiredText(params.name, "name");
@@ -470,7 +556,44 @@ function createWebhookIntegration(
url: `${root}/api/v1/integrations/webhook/${webhookId}/manual-result`
},
secret: params.secret ? requiredText(params.secret, "secret") : generateWebhookSecret(),
autoApprovalRate
autoApprovalRate,
materialPackFilePolicy: normalizeMaterialPackFilePolicy(params.materialPackFilePolicy)
});
}
function buildUpdatedWebhookIntegration(
integration: WebhookIntegration,
params: {
name?: string;
mode?: WebhookMode;
outgoingResultWebhook?: string;
autoApprovalRate?: number;
secret?: string;
rotateSecret?: boolean;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
}
): WebhookIntegration {
return WebhookIntegrationSchema.parse({
...integration,
...(params.name === undefined ? {} : { name: requiredText(params.name, "name") }),
...(params.mode === undefined ? {} : { mode: params.mode }),
...(params.outgoingResultWebhook === undefined
? {}
: { outgoingResultWebhook: validUrl(params.outgoingResultWebhook, "outgoingResultWebhook") }),
...(params.autoApprovalRate === undefined
? {}
: { autoApprovalRate: validApprovalRate(params.autoApprovalRate) }),
...(params.rotateSecret || params.secret !== undefined
? { secret: params.rotateSecret ? generateWebhookSecret() : requiredText(params.secret ?? "", "secret") }
: {}),
...(params.materialPackFilePolicy === undefined
? {}
: {
materialPackFilePolicy: mergeMaterialPackFilePolicy(
integration.materialPackFilePolicy,
params.materialPackFilePolicy
)
})
});
}
@@ -819,6 +942,120 @@ export async function searchUsers(
);
}
export async function listRootDepartments(client: KyInstance): Promise<SealDepartmentListData> {
return unwrap(
await client.get("api/v1/contacts/departments/root/children"),
SealDepartmentListDataSchema
);
}
export async function getDepartment(
client: KyInstance,
departmentId: string
): Promise<SealDepartment> {
return unwrap(
await client.get(`api/v1/contacts/departments/${encodeURIComponent(departmentId)}`),
SealDepartmentSchema
);
}
export async function listDepartmentChildren(
client: KyInstance,
departmentId: string
): Promise<SealDepartmentListData> {
return unwrap(
await client.get(`api/v1/contacts/departments/${encodeURIComponent(departmentId)}/children`),
SealDepartmentListDataSchema
);
}
export async function listDepartmentUsers(
client: KyInstance,
departmentId: string
): Promise<SealDepartmentUsersData> {
return unwrap(
await client.get(`api/v1/contacts/departments/${encodeURIComponent(departmentId)}/users`),
SealDepartmentUsersDataSchema
);
}
export async function getContactsLastSyncTime(client: KyInstance): Promise<SealContactsLastSyncTime> {
return unwrap(await client.get("api/v1/contacts/last-sync-time"), SealContactsLastSyncTimeSchema);
}
export async function getInsightStats(
client: KyInstance,
params: { startDate?: string; endDate?: string; limit?: number } = {}
): Promise<InsightStats> {
const defaultRange = currentMonthDateRange();
const searchParams = new URLSearchParams();
setOptional(searchParams, "startDate", params.startDate ?? defaultRange.startDate);
setOptional(searchParams, "endDate", params.endDate ?? defaultRange.endDate);
if (params.limit !== undefined) searchParams.set("limit", String(params.limit));
return unwrap(
await client.get("api/v1/insight/stats", { searchParams }),
InsightStatsSchema
);
}
function currentMonthDateRange(): { startDate: string; endDate: string } {
const now = new Date();
const start = new Date(now.getFullYear(), now.getMonth(), 1);
const end = new Date(now.getFullYear(), now.getMonth() + 1, 0, 23, 59, 59, 999);
return {
startDate: start.toISOString(),
endDate: end.toISOString()
};
}
export type DataListParams = {
offset?: number;
limit?: number;
startDate?: string;
endDate?: string;
search?: string;
};
function dataListSearchParams(params: DataListParams): URLSearchParams {
const searchParams = new URLSearchParams();
setOptional(searchParams, "filter[startDate]", params.startDate);
setOptional(searchParams, "filter[endDate]", params.endDate);
setOptional(searchParams, "filter[search]", params.search);
searchParams.set("offset", String(params.offset ?? 0));
searchParams.set("limit", String(params.limit ?? 50));
return searchParams;
}
export async function listExpenses(
client: KyInstance,
params: DataListParams = {}
): Promise<ExpenseListData> {
return unwrap(
await client.get("api/v1/expenses/list", { searchParams: dataListSearchParams(params) }),
ExpenseListDataSchema
);
}
export async function listInvoices(
client: KyInstance,
params: DataListParams = {}
): Promise<InvoiceListData> {
return unwrap(
await client.get("api/v1/invoice/list", { searchParams: dataListSearchParams(params) }),
InvoiceListDataSchema
);
}
export async function listFeishuSimulationApprovalDefinitions(
client: KyInstance
): Promise<SimulationApprovalDefinition[]> {
return unwrap(
await client.get("api/v1/integrations/feishu/simulation/approval-definitions"),
z.array(SimulationApprovalDefinitionSchema)
);
}
export async function deleteLocalUser(
client: KyInstance,
userId: string
@@ -73,6 +73,7 @@ describe("exportApprovalRunsToExcel integration", () => {
const testCorp: CorpConfig = {
id: "test-corp",
name: "测试企业",
environment: "production",
seal: {
endpoints: {
approvalStylePreferences: "api/v1/agent/ai-approval/config"
+53 -15
View File
@@ -20,47 +20,85 @@ export function buildAttachmentPlans(
entries: ZipEntry[],
parsed: Parsed[]
): MaterialAttachmentPlan[] {
// Collect all declared paths from all documents
const declaredPaths = new Set<string>()
const errors: string[] = []
// Map of path -> Array of declaration locations: { documentId, location }
const declaredPathLocations = new Map<string, Array<{ documentId: string; location: string }>>()
const plans: MaterialAttachmentPlan[] = parsed.map((item) => {
const { documentAttachments, expenseAttachments, personAttachments } = item
const docId = item.document.documentId
const recordPath = (path: string, location: string) => {
// 1. Check directory scope: path must start with docId/ or docId@.../
const rootDir = path.split("/")[0]!
const atIdx = rootDir.indexOf("@")
const dirDocId = atIdx >= 0 ? rootDir.slice(0, atIdx) : rootDir
if (dirDocId !== docId) {
errors.push(
`单据「${docId}」声明了跨单据或非本单据目录的附件路径: ${path}。附件必须位于该单据自己的根目录「${docId}/」或「${docId}@备注/」下。`
)
}
// 2. Track path location for uniqueness check
const existing = declaredPathLocations.get(path)
if (existing) {
existing.push({ documentId: docId, location })
} else {
declaredPathLocations.set(path, [{ documentId: docId, location }])
}
}
for (const g of documentAttachments) {
g.paths.forEach((p) => declaredPaths.add(p))
g.paths.forEach((p) => recordPath(p, `主表 [附件]${g.label}`))
}
for (const groups of Object.values(expenseAttachments)) {
groups.forEach((g) => g.paths.forEach((p) => declaredPaths.add(p)))
for (const [rowIdxStr, groups] of Object.entries(expenseAttachments)) {
const rowNum = Number(rowIdxStr) + 1
for (const g of groups) {
g.paths.forEach((p) => recordPath(p, `费用明细行 ${rowNum} [附件]${g.label}`))
}
}
for (const groups of Object.values(personAttachments)) {
groups.forEach((g) => g.paths.forEach((p) => declaredPaths.add(p)))
for (const [personName, groups] of Object.entries(personAttachments)) {
for (const g of groups) {
g.paths.forEach((p) => recordPath(p, `劳务人员「${personName}」[附件]${g.label}`))
}
}
return {
documentId: item.document.documentId,
documentId: docId,
categoryFields: documentAttachments,
expenseAttachments,
personAttachments,
}
})
// xlsx-only mode: skip file-level checks
if (!entries.length) return plans
// Duplicate path check: the same path cannot be declared multiple times (even in same document)
for (const [path, locs] of declaredPathLocations.entries()) {
if (locs.length > 1) {
const locDescriptions = locs.map((l) => `单据「${l.documentId}」的 ${l.location}`).join("、")
errors.push(
`附件路径「${path}」被重复声明了 ${locs.length} 次(出现在 ${locDescriptions})。禁止复用同一路径,若需在不同单据或不同字段使用,请分别放置到独立的附件文件路径。`
)
}
}
const errors: string[] = []
// xlsx-only mode: skip file-level checks against ZIP entries
if (!entries.length) {
if (errors.length) throw new MaterialPackValidationError(errors)
return plans
}
// Check 1: every declared path must exist as a ZIP entry
// Check 3: every declared path must exist as a ZIP entry
const zipFileSet = new Set(entries.map((e) => e.fileName))
for (const path of declaredPaths) {
for (const path of declaredPathLocations.keys()) {
if (!zipFileSet.has(path)) {
errors.push(`Excel 声明的附件路径在 ZIP 中不存在: ${path}`)
}
}
// Check 2: every ZIP file (non-信息表.xlsx) must be declared in at least one [附件] column
// Check 4: every ZIP file (non-信息表.xlsx) must be declared in exactly one [附件] column
for (const entry of entries) {
if (entry.fileName === "信息表.xlsx") continue
if (!declaredPaths.has(entry.fileName)) {
if (!declaredPathLocations.has(entry.fileName)) {
errors.push(`ZIP 中的文件未在 Excel 任何 [附件] 列中声明: ${entry.fileName}`)
}
}
+1
View File
@@ -1,4 +1,5 @@
export * from "./types.js";
export * from "./policy.js";
export * from "./signature.js";
export * from "./validate.js";
export * from "./parse.js";
@@ -153,6 +153,110 @@ describe("buildAttachmentPlans", () => {
const plans = buildAttachmentPlans(entries, parsed)
expect(plans[0]?.categoryFields[0]?.paths).toEqual(["DOC-001/合同/a.pdf"])
})
test("throws when document declares attachment outside its own directory", () => {
const parsed = [
{
document: { type: "document" as const, documentId: "DOC-001", documentSN: "DOC-001", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [{ key: "contract", label: "合同", paths: ["DOC-002/合同/a.pdf"] }],
expenseAttachments: {},
personAttachments: {},
},
{
document: { type: "document" as const, documentId: "DOC-002", documentSN: "DOC-002", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [],
expenseAttachments: {},
personAttachments: {},
},
]
const entries = [
{ fileName: "信息表.xlsx", uncompressedSize: 100, compressedSize: 80, raw: {} },
{ fileName: "DOC-002/合同/a.pdf", uncompressedSize: 100, compressedSize: 80, raw: {} },
]
try {
buildAttachmentPlans(entries, parsed)
expect(true).toBe(false)
} catch (e) {
const err = e as MaterialPackValidationError
expect(err.errors.some((m) => m.includes("DOC-001") && m.includes("跨单据或非本单据目录"))).toBe(true)
}
})
test("throws when same path is declared multiple times within the same document", () => {
const parsed = [
{
document: { type: "document" as const, documentId: "DOC-001", documentSN: "DOC-001", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [{ key: "contract", label: "合同", paths: ["DOC-001/合同/a.pdf"] }],
expenseAttachments: {
0: [{ key: "invoice", label: "发票", paths: ["DOC-001/合同/a.pdf"] }],
},
personAttachments: {},
},
]
const entries = [
{ fileName: "信息表.xlsx", uncompressedSize: 100, compressedSize: 80, raw: {} },
{ fileName: "DOC-001/合同/a.pdf", uncompressedSize: 100, compressedSize: 80, raw: {} },
]
try {
buildAttachmentPlans(entries, parsed)
expect(true).toBe(false)
} catch (e) {
const err = e as MaterialPackValidationError
expect(err.errors.some((m) => m.includes("重复声明") && m.includes("DOC-001/合同/a.pdf"))).toBe(true)
}
})
test("throws when same path is declared across different documents", () => {
const parsed = [
{
document: { type: "document" as const, documentId: "DOC-001", documentSN: "DOC-001", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [{ key: "contract", label: "合同", paths: ["DOC-001/合同/a.pdf"] }],
expenseAttachments: {},
personAttachments: {},
},
{
document: { type: "document" as const, documentId: "DOC-002", documentSN: "DOC-002", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [{ key: "contract", label: "合同", paths: ["DOC-001/合同/a.pdf"] }],
expenseAttachments: {},
personAttachments: {},
},
]
const entries = [
{ fileName: "信息表.xlsx", uncompressedSize: 100, compressedSize: 80, raw: {} },
{ fileName: "DOC-001/合同/a.pdf", uncompressedSize: 100, compressedSize: 80, raw: {} },
]
try {
buildAttachmentPlans(entries, parsed)
expect(true).toBe(false)
} catch (e) {
const err = e as MaterialPackValidationError
expect(err.errors.some((m) => m.includes("重复声明") && m.includes("DOC-001/合同/a.pdf"))).toBe(true)
}
})
test("accepts attachment paths in directory with @annotation", () => {
const parsed = [
{
document: { type: "document" as const, documentId: "DOC-001", documentSN: "DOC-001", startTime: null, fields: [] },
laborNames: [],
documentAttachments: [{ key: "contract", label: "合同", paths: ["DOC-001@广州技术服务/合同/a.pdf"] }],
expenseAttachments: {},
personAttachments: {},
},
]
const entries = [
{ fileName: "信息表.xlsx", uncompressedSize: 100, compressedSize: 80, raw: {} },
{ fileName: "DOC-001@广州技术服务/合同/a.pdf", uncompressedSize: 100, compressedSize: 80, raw: {} },
]
const plans = buildAttachmentPlans(entries, parsed)
expect(plans).toHaveLength(1)
expect(plans[0]?.categoryFields[0]?.paths).toEqual(["DOC-001@广州技术服务/合同/a.pdf"])
})
})
// ─── Integration tests: previewMaterialPack ──────────────────────────────────
+83
View File
@@ -0,0 +1,83 @@
import { z } from "zod"
export const DEFAULT_MATERIAL_PACK_ALLOWED_EXTENSIONS = [
".pdf",
".xls",
".xlsx",
".csv",
".doc",
".docx",
".ppt",
".pptx",
".txt",
".rtf",
".odt",
".ods",
".odp",
".jpg",
".jpeg",
".png",
".gif",
".bmp",
".webp",
".heic",
".eml",
".msg"
] as const
export const DEFAULT_MATERIAL_PACK_FILE_POLICY = {
minFileSizeBytes: 500,
allowedExtensions: [...DEFAULT_MATERIAL_PACK_ALLOWED_EXTENSIONS]
}
const fileExtensionSchema = z.string().trim().min(1).transform((value) => {
const normalized = value.toLowerCase()
return normalized.startsWith(".") ? normalized : `.${normalized}`
}).refine((value) => /^\.[a-z0-9][a-z0-9+_-]*$/.test(value), {
message: "文件后缀必须是简单扩展名,例如 .pdf 或 xlsx"
})
export const MaterialPackFilePolicySchema = z.object({
minFileSizeBytes: z.number().int().min(0).default(DEFAULT_MATERIAL_PACK_FILE_POLICY.minFileSizeBytes),
maxFileSizeBytes: z.number().int().positive().nullable().optional(),
allowedExtensions: z.array(fileExtensionSchema).min(1).default([...DEFAULT_MATERIAL_PACK_ALLOWED_EXTENSIONS])
.transform((extensions) => [...new Set(extensions)])
}).superRefine((policy, ctx) => {
if (
policy.maxFileSizeBytes !== undefined &&
policy.maxFileSizeBytes !== null &&
policy.maxFileSizeBytes < policy.minFileSizeBytes
) {
ctx.addIssue({
code: "custom",
path: ["maxFileSizeBytes"],
message: "最大文件大小不能小于最小文件大小"
})
}
})
export const MaterialPackFilePolicyPatchSchema = z.object({
minFileSizeBytes: z.number().int().min(0).optional(),
maxFileSizeBytes: z.number().int().positive().nullable().optional(),
allowedExtensions: z.array(fileExtensionSchema).min(1)
.transform((extensions) => [...new Set(extensions)])
}).optional()
export type MaterialPackFilePolicy = z.infer<typeof MaterialPackFilePolicySchema>
export type MaterialPackFilePolicyPatch = Partial<MaterialPackFilePolicy>
export function normalizeMaterialPackFilePolicy(
policy: MaterialPackFilePolicyPatch | undefined = undefined
): MaterialPackFilePolicy {
return MaterialPackFilePolicySchema.parse(policy ?? {})
}
export function mergeMaterialPackFilePolicy(
current: MaterialPackFilePolicy | undefined,
patch: MaterialPackFilePolicyPatch
): MaterialPackFilePolicy {
return normalizeMaterialPackFilePolicy({
...normalizeMaterialPackFilePolicy(current),
...patch
})
}
+12 -2
View File
@@ -10,7 +10,7 @@ import type { WebhookReadyResult } from "./types.js";
export async function checkWebhookReadiness(
client: KyInstance,
corp: CorpConfig,
options: { filePath?: string } = {}
options: { filePath?: string; webhook?: string } = {}
): Promise<WebhookReadyResult> {
const globalConfig = loadGlobalConfig();
const stateMode = globalConfig.stateful ? "stateful" : "stateless";
@@ -66,6 +66,12 @@ export async function checkWebhookReadiness(
? { id: rawWebhooks[0]!.id, name: rawWebhooks[0]!.name, mode: rawWebhooks[0]!.mode }
: null;
const materialPackWebhook = options.webhook
? api.findWebhookIntegration(rawWebhooks, options.webhook)
: isSingle
? rawWebhooks[0]
: undefined;
let materialPack: WebhookReadyResult["materialPack"];
if (options.filePath) {
if (!existsSync(options.filePath)) {
@@ -79,7 +85,11 @@ export async function checkWebhookReadiness(
} else {
try {
const input = readMaterialPackFile(options.filePath);
const preview = await previewMaterialPack(input.fileBuffer, input.fileName);
const preview = await previewMaterialPack(
input.fileBuffer,
input.fileName,
materialPackWebhook?.materialPackFilePolicy
);
materialPack = {
valid: true,
filePath: options.filePath,
+20 -6
View File
@@ -4,6 +4,7 @@ import { buildAttachmentPlans, injectAttachmentPlan } from "./attachments.js"
import { parseMaterialWorkbook } from "./parse.js"
import { extractZipEntry, readZipEntries, validatePackEntries, type ZipEntry } from "./validate.js"
import { MaterialPackValidationError, type MaterialPackPreview, type MaterialPackPushResult } from "./types.js"
import type { MaterialPackFilePolicyPatch } from "./policy.js"
function webhookInfo(url: string): { baseUrl: string; webhookId: string } {
const parsed = new URL(url)
@@ -54,12 +55,16 @@ function validateDocIdDirectories(entries: ZipEntry[], documentIds: string[]): v
if (errors.length) throw new MaterialPackValidationError(errors)
}
async function prepare(fileBuffer: Uint8Array, fileName: string) {
async function prepare(
fileBuffer: Uint8Array,
fileName: string,
filePolicy?: MaterialPackFilePolicyPatch
) {
let entries: ZipEntry[] = []
let workbook = fileBuffer
if (isZip(fileBuffer, fileName)) {
entries = await readZipEntries(fileBuffer)
validatePackEntries(entries)
validatePackEntries(entries, filePolicy)
const info = entries.find((entry) => entry.fileName === "信息表.xlsx")
if (!info) throw new Error("ZIP 根目录缺少信息表.xlsx")
workbook = await extractZipEntry(fileBuffer, info)
@@ -72,8 +77,12 @@ async function prepare(fileBuffer: Uint8Array, fileName: string) {
return { entries, parsed, plans, documents, fileBuffer }
}
export async function previewMaterialPack(fileBuffer: Uint8Array, fileName: string): Promise<MaterialPackPreview> {
const prepared = await prepare(fileBuffer, fileName)
export async function previewMaterialPack(
fileBuffer: Uint8Array,
fileName: string,
filePolicy?: MaterialPackFilePolicyPatch
): Promise<MaterialPackPreview> {
const prepared = await prepare(fileBuffer, fileName, filePolicy)
const documents = prepared.parsed.map((item, index) =>
injectAttachmentPlan(item.document, prepared.plans[index]!, new Map())
)
@@ -83,9 +92,14 @@ export async function previewMaterialPack(fileBuffer: Uint8Array, fileName: stri
export async function pushMaterialPack(
fileBuffer: Uint8Array,
fileName: string,
config: { webhookUrl: string; secret: string; docIdSuffix?: string }
config: {
webhookUrl: string;
secret: string;
docIdSuffix?: string;
materialPackFilePolicy?: MaterialPackFilePolicyPatch;
}
): Promise<MaterialPackPushResult> {
const prepared = await prepare(fileBuffer, fileName)
const prepared = await prepare(fileBuffer, fileName, config.materialPackFilePolicy)
const { baseUrl, webhookId } = webhookInfo(config.webhookUrl)
const results: MaterialPackPushResult["results"] = []
+1 -1
View File
@@ -39,7 +39,7 @@ export type MaterialPackPushResult = {
export class MaterialPackValidationError extends Error {
constructor(public readonly errors: string[], public readonly warnings: string[] = []) {
super(`材料包校验失败:${errors.length} 个错误`)
super([`材料包校验失败:${errors.length} 个错误`, ...errors.map((error) => `- ${error}`)].join("\n"))
this.name = "MaterialPackValidationError"
}
}
@@ -0,0 +1,46 @@
import { describe, expect, test } from "bun:test"
import { validatePackEntries, type ZipEntry } from "./validate.js"
function entries(attachment: Partial<ZipEntry> = {}): ZipEntry[] {
return [
{ fileName: "信息表.xlsx", uncompressedSize: 100, compressedSize: 80, raw: {} },
{
fileName: "DOC-001/合同/合同.pdf",
uncompressedSize: 500,
compressedSize: 400,
raw: {},
...attachment
}
]
}
describe("material pack attachment file policy", () => {
test("accepts the default 500-byte minimum and common PDF extension", () => {
expect(() => validatePackEntries(entries())).not.toThrow()
})
test("rejects attachments smaller than the configured minimum", () => {
expect(() => validatePackEntries(entries({ uncompressedSize: 499 }))).toThrow(
"附件文件过小"
)
})
test("rejects attachments larger than the configured maximum", () => {
expect(() => validatePackEntries(entries({ uncompressedSize: 1001 }), {
maxFileSizeBytes: 1000
})).toThrow("附件文件过大")
})
test("rejects extensions outside the configured whitelist", () => {
expect(() => validatePackEntries(entries({ fileName: "DOC-001/合同/合同.exe" }), {
allowedExtensions: [".pdf"]
})).toThrow("附件后缀不在白名单中")
})
test("rejects an invalid size range before any upload can start", () => {
expect(() => validatePackEntries(entries(), {
minFileSizeBytes: 1000,
maxFileSizeBytes: 999
})).toThrow("最大文件大小不能小于最小文件大小")
})
})
+42 -1
View File
@@ -1,6 +1,11 @@
import yauzl from "yauzl";
import iconv from "iconv-lite";
import { MaterialPackValidationError } from "./types.js";
import {
normalizeMaterialPackFilePolicy,
type MaterialPackFilePolicy,
type MaterialPackFilePolicyPatch
} from "./policy.js";
export const MATERIAL_PACK_LIMITS = { maxEntries: 1000, maxTotalSize: 500 * 1024 * 1024, maxCompressionRatio: 150 };
@@ -41,14 +46,17 @@ function isJunk(name: string): boolean {
return name.split("/").includes("__MACOSX") || base === ".DS_Store" || base.startsWith("._") || base.startsWith(".~") || base.startsWith("~$");
}
export function validatePackEntries(entries: ZipEntry[]): void {
export function validatePackEntries(entries: ZipEntry[], policy?: MaterialPackFilePolicyPatch): void {
const errors: string[] = [];
const filePolicy = normalizeMaterialPackFilePolicy(policy);
if (entries.length > MATERIAL_PACK_LIMITS.maxEntries) errors.push(`文件数超过 ${MATERIAL_PACK_LIMITS.maxEntries}`);
const total = entries.reduce((sum, entry) => sum + entry.uncompressedSize, 0);
if (total > MATERIAL_PACK_LIMITS.maxTotalSize) errors.push("解压后总大小超过 500MB");
for (const entry of entries) {
if (entry.fileName.startsWith("/") || entry.fileName.split("/").includes("..")) errors.push(`存在不安全路径: ${entry.fileName}`);
if (entry.compressedSize > 0 && entry.uncompressedSize / entry.compressedSize > MATERIAL_PACK_LIMITS.maxCompressionRatio) errors.push(`压缩比超过 150: ${entry.fileName}`);
if (entry.fileName === "信息表.xlsx") continue;
validateAttachmentFile(entry, filePolicy, errors);
}
const info = entries.find((entry) => entry.fileName === "信息表.xlsx");
if (!info) errors.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");
@@ -56,6 +64,39 @@ export function validatePackEntries(entries: ZipEntry[]): void {
if (errors.length) throw new MaterialPackValidationError(errors);
}
function validateAttachmentFile(
entry: ZipEntry,
policy: MaterialPackFilePolicy,
errors: string[]
): void {
const extension = getFileExtension(entry.fileName);
if (!extension || !policy.allowedExtensions.includes(extension)) {
errors.push(
`附件后缀不在白名单中: ${entry.fileName}(允许: ${policy.allowedExtensions.join(", ")})`
);
}
if (entry.uncompressedSize < policy.minFileSizeBytes) {
errors.push(
`附件文件过小: ${entry.fileName}(${entry.uncompressedSize} B,小于最小值 ${policy.minFileSizeBytes} B)`
);
}
if (
policy.maxFileSizeBytes !== undefined &&
policy.maxFileSizeBytes !== null &&
entry.uncompressedSize > policy.maxFileSizeBytes
) {
errors.push(
`附件文件过大: ${entry.fileName}(${entry.uncompressedSize} B,大于最大值 ${policy.maxFileSizeBytes} B)`
);
}
}
function getFileExtension(fileName: string): string {
const baseName = fileName.split("/").pop() ?? fileName;
const dotIndex = baseName.lastIndexOf(".");
return dotIndex > 0 ? baseName.slice(dotIndex).toLowerCase() : "";
}
export function extractZipEntry(buffer: Uint8Array, target: ZipEntry): Promise<Buffer> {
return new Promise((resolve, reject) => {
yauzl.fromBuffer(Buffer.from(buffer), { lazyEntries: true, autoClose: true, decodeStrings: false }, (openError: Error | null, zipFile: any) => {
+1
View File
@@ -76,6 +76,7 @@ function fakeCorp(): CorpConfig {
return {
id: "corp-search-test",
name: "Search Test Corp",
environment: "production",
seal: {
url: "https://seal.test",
endpoints: {
+33 -2
View File
@@ -501,7 +501,12 @@ describe("simulation tool handlers", () => {
sourceSystem: "hosecloud"
});
expect(postedBody).not.toHaveProperty("limit");
expect(result).toMatchObject({ batchId: "batch-1", created: true });
expect(result).toMatchObject({
batchId: "batch-1",
created: true,
noWait: true,
asyncTicket: "batch-1"
});
});
test("create tool surface exposes mode, flowIds, and rawParams", () => {
@@ -509,18 +514,44 @@ describe("simulation tool handlers", () => {
const { z } = require("zod") as typeof import("zod");
const schema = z.toJSONSchema(tool!.parameters) as { properties?: Record<string, unknown> };
expect(Object.keys(schema.properties ?? {})).toEqual(
expect.arrayContaining(["mode", "flowIds", "rawParams", "schemaConfig", "packageIds"])
expect.arrayContaining(["mode", "flowIds", "rawParams", "schemaConfig", "packageIds", "noWait"])
);
});
test("includes the simulation management tool set", () => {
expect(sealTools.find((item) => item.name === "seal_simulation_batches_list")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_batch_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_batch_status")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_templates_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_integrations_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_batch_records_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_simulation_material_package_upload")).toBeDefined();
});
test("status tool performs one non-blocking check and exposes the next action", async () => {
const tool = sealTools.find((item) => item.name === "seal_simulation_batch_status");
expect(tool).toBeDefined();
const client = {
get: (url: string) => {
expect(url).toBe("api/v1/simulation/batch/batch-1");
return { json: async () => ({ data: { ...hosecloudBatchFixture, id: "batch-1" } }) };
}
} as unknown as KyInstance;
const handler = tool!.handler as ToolHandler;
const result = await handler(client, { batchId: "batch-1" }, fakeContext()) as Record<string, unknown>;
expect(result).toMatchObject({
batchId: "batch-1",
status: "SYNCING",
terminal: false,
next: {
status: "seal-use simulation status batch-1",
wait: "seal-use simulation wait batch-1"
}
});
});
});
describe("simulation response schemas", () => {
+142 -1
View File
@@ -5,7 +5,7 @@ import { mkdtempSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { CorpConfig } from "../../core/config/types.js";
import { findSealTool, sealTools } from "./tools.js";
import { buildRulePushPlan, findSealTool, sealTools } from "./tools.js";
type ToolHandler = (
client: KyInstance,
@@ -84,6 +84,27 @@ describe("sealTools", () => {
expect(userDelegationTool).toBeDefined();
});
test("includes read-only contacts directory tools", () => {
expect(sealTools.find((item) => item.name === "seal_contacts_departments_root_list")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_contacts_department_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_contacts_department_children_list")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_contacts_department_users_list")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_contacts_last_sync_time_get")).toBeDefined();
});
test("includes the read-only insight stats tool", () => {
expect(sealTools.find((item) => item.name === "seal_insight_stats_get")).toBeDefined();
});
test("includes read-only financial data tools", () => {
expect(sealTools.find((item) => item.name === "seal_expenses_list")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_invoices_list")).toBeDefined();
});
test("includes the Feishu simulation approval definition tool", () => {
expect(sealTools.find((item) => item.name === "seal_simulation_feishu_approval_definitions_list")).toBeDefined();
});
test("includes system configuration tools", () => {
expect(sealTools.find((item) => item.name === "seal_llm_config_get")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_llm_providers_list")).toBeDefined();
@@ -223,6 +244,124 @@ describe("sealTools", () => {
expect(await countFakeRules(client)).toBe(0);
});
test("preference dry run reads config without patching it", async () => {
const tool = sealTools.find((item) => item.name === "seal_preference_decision_update");
expect(tool).toBeDefined();
let patched = false;
const client = {
get: () => ({
json: async () => ({
data: {
decisionPreferences: {
explicitApprove: "old",
explicitReject: "reject",
exemptApprove: "exempt",
review: "review"
},
integrations: []
}
})
}),
patch: () => {
patched = true;
throw new Error("preview must not patch");
}
} as unknown as KyInstance;
const handler = tool!.handler as ToolHandler;
const result = await handler(client, { explicitApprove: "new", dryRun: true }, fakeContext()) as {
preview: boolean;
targetUrl: string;
changesDiff: { after: { decisionPreferences: { explicitApprove: string } } };
};
expect(result.preview).toBe(true);
expect(result.targetUrl).toBe("https://seal.test/api/v1/agent/ai-approval/config");
expect(result.changesDiff.after.decisionPreferences.explicitApprove).toBe("new");
expect(patched).toBe(false);
});
test("plans incremental rule updates without rebuilding matched rules", () => {
const plan = buildRulePushPlan(
[
{
id: "rule-1",
code: 1,
description: "Keep receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
},
{
id: "rule-2",
code: 2,
description: "Keep attendee names",
scope: "meal",
strictness: "SHOULD_FOLLOW"
}
],
[
{
id: "rule-1",
description: "Keep complete receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
},
{
description: "Require cost center",
scope: "all",
strictness: "SUGGESTION"
}
]
);
expect(plan.updated).toMatchObject([
{ id: "rule-1", changedFields: ["description"] }
]);
expect(plan.created).toMatchObject([
{ description: "Require cost center" }
]);
expect(plan.deleted).toMatchObject([{ id: "rule-2", code: 2 }]);
expect(plan.unchanged).toEqual([]);
});
test("matches legacy local rules by unique content when no id is present", () => {
const plan = buildRulePushPlan(
[{
id: "rule-1",
description: "Keep receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
}],
[{
description: "Keep receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
}]
);
expect(plan.created).toEqual([]);
expect(plan.updated).toEqual([]);
expect(plan.deleted).toEqual([]);
expect(plan.unchanged).toEqual([{ id: "rule-1" }]);
});
test("rejects local rule ids that are absent from the current draft", () => {
expect(() => buildRulePushPlan(
[{
id: "rule-1",
description: "Keep receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
}],
[{
id: "stale-rule",
description: "Keep receipts",
scope: "travel",
strictness: "MUST_FOLLOW"
}]
)).toThrow("stale-rule");
});
test("includes approval run Langfuse bridge tools", () => {
expect(sealTools.find((item) => item.name === "seal_approval_runs_search")).toBeDefined();
expect(sealTools.find((item) => item.name === "seal_approval_runs_summary")).toBeDefined();
@@ -892,6 +1031,7 @@ function fakeContext(): { corp: CorpConfig } {
corp: {
id: "corp-a",
name: "Corp A",
environment: "production",
seal: {
endpoints: {
approvalStylePreferences: "api/v1/agent/ai-approval/config"
@@ -916,6 +1056,7 @@ function fakeHoseContext(): { corp: CorpConfig } {
corp: {
id: "corp-a",
name: "Corp A",
environment: "production",
seal: {
endpoints: {
approvalStylePreferences: "api/v1/agent/ai-approval/config"
+386 -60
View File
@@ -21,6 +21,7 @@ import {
pushMaterialPack,
readMaterialPackFile
} from "./material-pack/index.js";
import { MaterialPackFilePolicyPatchSchema, MaterialPackFilePolicySchema } from "./material-pack/policy.js";
import {
extractApprovalRunAttachments
} from "./attachments.js";
@@ -164,6 +165,91 @@ export const sealTools = [
context.corp
)
},
{
name: "seal_contacts_departments_root_list",
description: "列出当前 Seal 租户通讯录的顶级部门",
parameters: z.object({}),
handler: async (client: KyInstance) => api.listRootDepartments(client)
},
{
name: "seal_contacts_department_get",
description: "获取指定通讯录部门的详细信息",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
}),
handler: async (client: KyInstance, params: { departmentId: string }) =>
api.getDepartment(client, params.departmentId)
},
{
name: "seal_contacts_department_children_list",
description: "列出指定通讯录部门的直接子部门",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
}),
handler: async (client: KyInstance, params: { departmentId: string }) =>
api.listDepartmentChildren(client, params.departmentId)
},
{
name: "seal_contacts_department_users_list",
description: "列出指定通讯录部门下的用户",
parameters: z.object({
departmentId: z.string().describe("部门 ID")
}),
handler: async (client: KyInstance, params: { departmentId: string }) =>
api.listDepartmentUsers(client, params.departmentId)
},
{
name: "seal_contacts_last_sync_time_get",
description: "查询通讯录最后同步时间",
parameters: z.object({}),
handler: async (client: KyInstance) => api.getContactsLastSyncTime(client)
},
{
name: "seal_insight_stats_get",
description: "查询智能洞察风险标签统计及分析状态",
parameters: z.object({
startDate: z.string().optional().describe("统计开始时间(ISO 8601)"),
endDate: z.string().optional().describe("统计结束时间(ISO 8601)"),
limit: z.number().int().positive().max(100).optional().describe("最多返回的风险标签数量")
}),
handler: async (
client: KyInstance,
params: { startDate?: string; endDate?: string; limit?: number }
) => api.getInsightStats(client, params)
},
{
name: "seal_expenses_list",
description: "分页查询费用明细",
parameters: z.object({
offset: z.number().int().nonnegative().optional(),
limit: z.number().int().positive().max(100).optional(),
startDate: z.string().optional().describe("开始时间"),
endDate: z.string().optional().describe("结束时间"),
search: z.string().optional().describe("搜索费用类型、描述或金额")
}),
handler: async (client: KyInstance, params: api.DataListParams) => api.listExpenses(client, params)
},
{
name: "seal_invoices_list",
description: "分页查询进项发票",
parameters: z.object({
offset: z.number().int().nonnegative().optional(),
limit: z.number().int().positive().max(100).optional(),
startDate: z.string().optional().describe("开始时间"),
endDate: z.string().optional().describe("结束时间"),
search: z.string().optional().describe("搜索发票号码或销售方")
}),
handler: async (client: KyInstance, params: api.DataListParams) => api.listInvoices(client, params)
},
{
name: "seal_simulation_feishu_approval_definitions_list",
description: "列出飞书模拟测试可用的审批定义,便于选择 approvalCode",
parameters: z.object({}),
handler: async (client: KyInstance) => {
const approvalDefinitions = await api.listFeishuSimulationApprovalDefinitions(client);
return { count: approvalDefinitions.length, approvalDefinitions };
}
},
{
name: "seal_llm_config_get",
description: "查询当前 Seal 租户的大模型 (LLM) 配置",
@@ -208,7 +294,7 @@ export const sealTools = [
},
{
name: "seal_approval_rules_list",
description: "列出 Seal 当前草稿审批规则;支持 countOnly、fields、limit 以避免返回规则正文",
description: "列出 Seal 当前草稿审批规则;返回的 code 属于草稿编号体系,发布版本可能重新编码;支持 countOnly、fields、limit 以避免返回规则正文",
parameters: z.object({
countOnly: z.boolean().optional().describe("只返回规则数量,不返回规则列表"),
fields: z.array(z.enum([
@@ -253,6 +339,7 @@ export const sealTools = [
const before = await api.listApprovalRules(client);
if (params.dryRun) {
return {
...mutationPreview(context, "api/v1/rules", before.rules, [], before.rules.length),
corpId: context.corp.id,
corpName: context.corp.name,
dryRun: true,
@@ -422,7 +509,7 @@ export const sealTools = [
},
{
name: "seal_approval_rule_get",
description: "按版本号/code/runtime-id/record-id 定位单条规则,避免拉取整版规则快照",
description: "按版本号/code/runtime-id/record-id 定位单条规则;code 只在选定的版本编号体系内有效,避免拉取整版规则快照",
parameters: z.object({
versionId: z.string().optional().describe("规则版本 ID"),
versionNumber: z.number().int().positive().optional().describe("规则版本号"),
@@ -624,7 +711,7 @@ export const sealTools = [
},
{
name: "seal_approval_rules_push",
description: "将本地规则文件推送到远端草稿(本地调优通过后一键应用,支持直接发布为正式版本)",
description: "将本地规则文件增量同步到远端草稿;按规则 ID 更新/删除并保留未变更规则,支持直接发布为正式版本",
parameters: z.object({
file: z.string().optional().describe("要推送的本地规则文件路径,默认为 ./rules.local.json"),
dryRun: z.boolean().optional().describe("是否仅预览变更而不实际写入远端(默认 true,传 --yes 或 confirm: true 执行写入)"),
@@ -649,47 +736,62 @@ export const sealTools = [
const isDryRun = params.dryRun ?? !isConfirmed;
const before = await api.listApprovalRules(client);
const plan = buildRulePushPlan(before.rules, local.rules);
if (isDryRun) {
return {
...mutationPreview(
context,
"api/v1/rules",
before.rules,
local.rules.map((rule) => ({
description: rule.description,
scope: rule.scope ?? "ALL",
strictness: rule.strictness ?? "MUST_FOLLOW"
})),
before.rules.length + local.rules.length
),
corpId: context.corp.id,
dryRun: true,
localFile: local.resolvedPath,
localRulesCount: local.rules.length,
remoteDraftCount: before.rules.length,
changes: plan,
impactCount: plan.created.length + plan.updated.length + plan.deleted.length,
preservedRuleIds: [
...plan.updated.map((change) => change.id),
...plan.unchanged.map((rule) => rule.id)
],
warning: "Incremental mode preserves matched rule IDs and does not recode the draft rule set.",
willPublish: Boolean(params.publish),
message: "Preview mode. Use --yes or confirm=true to apply local rules to remote draft."
message: "Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."
};
}
// Step 1: Clear existing draft rules
let deleted = 0;
for (const rule of before.rules) {
for (const rule of plan.deleted) {
await api.deleteApprovalRule(client, rule.id);
deleted += 1;
}
// Step 2: Create new rules from local
const created: Array<{ id: string; description: string; code?: number }> = [];
for (const rule of local.rules) {
const strictness = rule.strictness?.toUpperCase()?.includes("SHOULD")
? "SHOULD_FOLLOW"
: rule.strictness?.toUpperCase()?.includes("SUGGEST")
? "SUGGESTION"
: "MUST_FOLLOW";
for (const rule of plan.created) {
const newRule = await api.createApprovalRule(client, {
description: rule.description,
scope: rule.scope ?? "ALL",
strictness
strictness: normalizeRuleStrictness(rule.strictness)
});
created.push({ id: newRule.id, description: newRule.description, code: newRule.code });
}
// Step 3: Recode
await api.recodeApprovalRules(client);
const updated: string[] = [];
for (const change of plan.updated) {
await api.updateApprovalRule(client, change.id, {
description: change.rule.description,
scope: change.rule.scope ?? "ALL",
strictness: normalizeRuleStrictness(change.rule.strictness)
});
updated.push(change.id);
}
// Step 4: Optional publish
let publishedVersion: unknown = undefined;
if (params.publish) {
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
@@ -701,8 +803,15 @@ export const sealTools = [
corpId: context.corp.id,
dryRun: false,
localFile: local.resolvedPath,
clearedDraftRules: deleted,
deletedRules: plan.deleted.length,
createdRules: created.length,
updatedRules: updated.length,
unchangedRules: plan.unchanged.length,
preservedRuleIds: [
...updated,
...plan.unchanged.map((rule) => rule.id)
],
recoded: false,
published: publishedVersion ?? false
};
}
@@ -948,13 +1057,15 @@ export const sealTools = [
},
{
name: "seal_webhook_add",
description: "新增 Webhook 集成并通过 AI 审批配置保存接口持久化",
description: "新增 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
name: z.string().min(1).describe("集成名称"),
mode: z.enum(["assisted", "semi_automatic", "fully_automatic"]).optional(),
outgoingResultWebhook: z.string().url().describe("Seal 完成 AI 审核后回调的外部地址"),
autoApprovalRate: z.number().int().min(0).max(100).optional(),
secret: z.string().min(1).optional().describe("可选;不传则生成 32 位十六进制 secret")
secret: z.string().min(1).optional().describe("可选;不传则生成 32 位十六进制 secret"),
materialPackFilePolicy: MaterialPackFilePolicyPatchSchema.describe("材料包附件文件策略:大小和后缀白名单"),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (
client: KyInstance,
@@ -964,16 +1075,30 @@ export const sealTools = [
outgoingResultWebhook: string;
autoApprovalRate?: number;
secret?: string;
materialPackFilePolicy?: Partial<z.infer<typeof MaterialPackFilePolicySchema>>;
dryRun?: boolean;
},
context: ToolContext
) => {
const baseUrl = getConfiguredSealBaseUrl(context.corp);
const integration = await api.addWebhookIntegration(
const preview = params.dryRun
? await api.previewAddWebhookIntegration(client, baseUrl, params, context.corp.seal.endpoints.approvalStylePreferences)
: undefined;
const integration = preview?.integration ?? await api.addWebhookIntegration(
client,
baseUrl,
params,
context.corp.seal.endpoints.approvalStylePreferences
);
if (params.dryRun) {
return mutationPreview(
context,
context.corp.seal.endpoints.approvalStylePreferences,
preview!.before,
preview!.after,
1
);
}
return {
saved: true,
integration: presentWebhookIntegration(integration, true)
@@ -982,7 +1107,7 @@ export const sealTools = [
},
{
name: "seal_webhook_update",
description: "更新现有 Webhook 集成并通过 AI 审批配置保存接口持久化",
description: "更新现有 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
selector: z.string().min(1).describe("Webhook 集成 ID 或名称"),
name: z.string().min(1).optional(),
@@ -990,7 +1115,9 @@ export const sealTools = [
outgoingResultWebhook: z.string().url().optional(),
autoApprovalRate: z.number().int().min(0).max(100).optional(),
secret: z.string().min(1).optional(),
rotateSecret: z.boolean().optional().describe("生成新 secret;与 secret 二选一")
rotateSecret: z.boolean().optional().describe("生成新 secret;与 secret 二选一"),
materialPackFilePolicy: MaterialPackFilePolicyPatchSchema.describe("材料包附件文件策略:大小和后缀白名单"),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (
client: KyInstance,
@@ -1002,18 +1129,32 @@ export const sealTools = [
autoApprovalRate?: number;
secret?: string;
rotateSecret?: boolean;
materialPackFilePolicy?: Partial<z.infer<typeof MaterialPackFilePolicySchema>>;
dryRun?: boolean;
},
context: ToolContext
) => {
if (params.secret !== undefined && params.rotateSecret) {
throw new Error("Webhook secret and rotateSecret cannot be used together");
}
const integration = await api.updateWebhookIntegration(
const preview = params.dryRun
? await api.previewUpdateWebhookIntegration(client, params.selector, params, context.corp.seal.endpoints.approvalStylePreferences)
: undefined;
const integration = preview?.integration ?? await api.updateWebhookIntegration(
client,
params.selector,
params,
context.corp.seal.endpoints.approvalStylePreferences
);
if (params.dryRun) {
return mutationPreview(
context,
context.corp.seal.endpoints.approvalStylePreferences,
preview!.before,
preview!.after,
1
);
}
return {
saved: true,
integration: presentWebhookIntegration(
@@ -1025,24 +1166,37 @@ export const sealTools = [
},
{
name: "seal_webhook_delete",
description: "删除指定 Webhook 集成并通过 AI 审批配置保存接口持久化",
description: "删除指定 Webhook 集成;使用 dryRun=true 可只预览请求而不持久化",
parameters: z.object({
selector: z.string().min(1).describe("Webhook 集成 ID 或名称"),
confirm: z.boolean().describe("必须明确传 true 才执行删除")
confirm: z.boolean().optional().describe("执行删除时必须明确传 true;dryRun 可省略"),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行删除")
}),
handler: async (
client: KyInstance,
params: { selector: string; confirm: boolean },
params: { selector: string; confirm?: boolean; dryRun?: boolean },
context: ToolContext
) => {
if (!params.confirm) {
if (!params.confirm && !params.dryRun) {
throw new Error("Refusing to delete Webhook integration without confirm=true");
}
const integration = await api.deleteWebhookIntegration(
const preview = params.dryRun
? await api.previewDeleteWebhookIntegration(client, params.selector, context.corp.seal.endpoints.approvalStylePreferences)
: undefined;
const integration = preview?.integration ?? await api.deleteWebhookIntegration(
client,
params.selector,
context.corp.seal.endpoints.approvalStylePreferences
);
if (params.dryRun) {
return mutationPreview(
context,
context.corp.seal.endpoints.approvalStylePreferences,
preview!.before,
preview!.after,
1
);
}
return {
deleted: true,
integration: presentWebhookIntegration(integration, false)
@@ -1418,6 +1572,7 @@ export const sealTools = [
packageIds: z.array(z.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),
templateId: z.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),
schemaConfig: z.record(z.string(), z.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),
noWait: z.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),
rawParams: z.record(z.string(), z.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")
}),
handler: async (
@@ -1434,6 +1589,7 @@ export const sealTools = [
packageIds?: string[];
templateId?: string;
schemaConfig?: Record<string, unknown>;
noWait?: boolean;
rawParams?: Record<string, unknown>;
}
) => {
@@ -1469,7 +1625,11 @@ export const sealTools = [
return {
...result,
created: true,
noWait: params.noWait ?? true,
asyncTicket: result.batchId,
next: {
status: `seal-use simulation status ${result.batchId}`,
wait: `seal-use simulation wait ${result.batchId}`,
getBatch: "seal-home simulation get <batchId>",
getRecords: "seal-home simulation batch-records <batchId>",
listBatches: "seal-home simulation list"
@@ -1511,6 +1671,32 @@ export const sealTools = [
};
}
},
{
name: "seal_simulation_batch_status",
description: "单次读取 Seal 模拟批次状态,不阻塞等待;适合根据异步票据轮询",
parameters: z.object({
batchId: z.string().describe("simulation batch ID")
}),
handler: async (client: KyInstance, params: { batchId: string }) => {
const batch = await api.getSimulationBatch(client, params.batchId);
const status = String(batch.status ?? "UNKNOWN").toUpperCase();
const terminal = ["COMPLETED", "FAILED", "CANCELLED", "CANCELED"].includes(status);
return {
batchId: params.batchId,
status,
terminal,
totalCount: batch.totalCount,
processedCount: batch.processedCount,
successCount: batch.successCount,
failedCount: batch.failedCount,
createdAt: batch.createdAt,
updatedAt: batch.updatedAt,
next: terminal
? { getRecords: `seal-use simulation batch-records ${params.batchId}` }
: { status: `seal-use simulation status ${params.batchId}`, wait: `seal-use simulation wait ${params.batchId}` }
};
}
},
{
name: "seal_simulation_templates_get",
description: "列出 Seal 模拟测试模板(我的模板,保存常用配置快速复用)",
@@ -1608,7 +1794,8 @@ export const sealTools = [
}
return pushMaterialPack(input.fileBuffer, input.fileName, {
webhookUrl: integration.incomingDocumentWebhook.url,
secret: integration.secret
secret: integration.secret,
materialPackFilePolicy: integration.materialPackFilePolicy
});
}
},
@@ -1798,15 +1985,17 @@ export const sealTools = [
rejectResubmitMethod: z.enum(["node_default", "to_ebot", "from_start"]).optional(),
autoApproveNodeNames: z.array(z.string()).optional(),
apiOrigin: z.string().default("production"),
customApiUrl: z.string().optional()
customApiUrl: z.string().optional(),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (client: KyInstance, rawParams: HosecloudConfigInput, context: ToolContext) => {
const apiKey = rawParams.apiKey ?? (rawParams as any).appKey;
const apiSecret = rawParams.apiSecret ?? (rawParams as any).appSecurity;
const { dryRun, ...inputParams } = rawParams;
const apiKey = inputParams.apiKey ?? (inputParams as any).appKey;
const apiSecret = inputParams.apiSecret ?? (inputParams as any).appSecurity;
if (!apiKey || !apiSecret) {
throw new Error("缺少合思凭证:apiKey (或 appKey) 与 apiSecret (或 appSecurity) 为必填项");
}
const params = { ...rawParams, apiKey, apiSecret };
const params = { ...inputParams, apiKey, apiSecret };
let effectiveApiOrigin = params.apiOrigin ?? "production";
let effectiveCustomApiUrl = params.customApiUrl;
@@ -1852,14 +2041,24 @@ export const sealTools = [
(item: any) => item.type !== "hosecloud" || item.signKey !== signKey
);
existing.push(nextIntegration);
await api.updateApprovalStylePreferences(client, {
const nextConfig = {
...config,
integrationSystem: "hosecloud",
integrations: existing
});
};
if (dryRun) {
return mutationPreview(
context,
context.corp.seal.endpoints.approvalStylePreferences,
config,
nextConfig,
1
);
}
await api.updateApprovalStylePreferences(client, nextConfig, context.corp.seal.endpoints.approvalStylePreferences);
console.error(`✓ 配置已保存 (signKey: ${signKey})`);
console.error(`👉 下一步操作:运行 \`seal-use deploy hosecloud sync ${signKey} --corp ${context.corp.id}\` 一键同步发布到合思审批流`);
console.error(`👉 Next action: seal-use deploy hosecloud sync ${signKey} --corp ${context.corp.id}`);
return {
integration: redactIntegrationSecrets(nextIntegration)
@@ -1920,18 +2119,21 @@ export const sealTools = [
explicitApprove: z.string().optional(),
explicitReject: z.string().optional(),
exemptApprove: z.string().optional(),
review: z.string().optional()
review: z.string().optional(),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (client: KyInstance, params: Partial<DecisionPreferences>) => {
const config = (await api.getApprovalStylePreferences(client)) as any;
handler: async (client: KyInstance, params: Partial<DecisionPreferences> & { dryRun?: boolean }, context: ToolContext) => {
const config = (await api.getApprovalStylePreferences(client, context.corp.seal.endpoints.approvalStylePreferences)) as any;
const { dryRun, ...changes } = params;
const updated = {
...config,
decisionPreferences: {
...config.decisionPreferences,
...params
...changes
}
};
await api.updateApprovalStylePreferences(client, updated);
if (dryRun) return mutationPreview(context, context.corp.seal.endpoints.approvalStylePreferences, config, updated, 1);
await api.updateApprovalStylePreferences(client, updated, context.corp.seal.endpoints.approvalStylePreferences);
return {
decisionPreferences: updated.decisionPreferences
};
@@ -1941,10 +2143,11 @@ export const sealTools = [
name: "seal_preference_thinking_depth_set",
description: "修改默认思考深度(medium 或 high)",
parameters: z.object({
defaultLevel: z.enum(["medium", "high"]).describe("默认思考深度")
defaultLevel: z.enum(["medium", "high"]).describe("默认思考深度"),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (client: KyInstance, params: { defaultLevel: "medium" | "high" }) => {
const config = (await api.getApprovalStylePreferences(client)) as any;
handler: async (client: KyInstance, params: { defaultLevel: "medium" | "high"; dryRun?: boolean }, context: ToolContext) => {
const config = (await api.getApprovalStylePreferences(client, context.corp.seal.endpoints.approvalStylePreferences)) as any;
const updated = {
...config,
thinkingDepthPreference: {
@@ -1952,7 +2155,8 @@ export const sealTools = [
routingPolicies: config.thinkingDepthPreference?.routingPolicies ?? []
}
};
await api.updateApprovalStylePreferences(client, updated);
if (params.dryRun) return mutationPreview(context, context.corp.seal.endpoints.approvalStylePreferences, config, updated, 1);
await api.updateApprovalStylePreferences(client, updated, context.corp.seal.endpoints.approvalStylePreferences);
return {
thinkingDepthPreference: updated.thinkingDepthPreference
};
@@ -1972,12 +2176,15 @@ export const sealTools = [
{
name: "seal_preference_thinking_depth_policies_upsert",
description: "新增或修改思考深度路由策略",
parameters: ThinkingPolicySchema,
handler: async (client: KyInstance, policy: ThinkingPolicy) => {
const config = (await api.getApprovalStylePreferences(client)) as any;
parameters: ThinkingPolicySchema.extend({
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (client: KyInstance, policy: ThinkingPolicy & { dryRun?: boolean }, context: ToolContext) => {
const config = (await api.getApprovalStylePreferences(client, context.corp.seal.endpoints.approvalStylePreferences)) as any;
const { dryRun, ...cleanPolicy } = policy;
const existing: ThinkingPolicy[] = config.thinkingDepthPreference?.routingPolicies ?? [];
const next = existing.filter((item) => item.id !== policy.id);
next.push(policy);
const next = existing.filter((item) => item.id !== cleanPolicy.id);
next.push(cleanPolicy);
const updated = {
...config,
thinkingDepthPreference: {
@@ -1985,9 +2192,10 @@ export const sealTools = [
routingPolicies: next
}
};
await api.updateApprovalStylePreferences(client, updated);
if (dryRun) return mutationPreview(context, context.corp.seal.endpoints.approvalStylePreferences, config, updated, 1);
await api.updateApprovalStylePreferences(client, updated, context.corp.seal.endpoints.approvalStylePreferences);
return {
policy,
policy: cleanPolicy,
policies: next
};
}
@@ -1996,10 +2204,11 @@ export const sealTools = [
name: "seal_preference_thinking_depth_policies_remove",
description: "删除一条思考深度路由策略",
parameters: z.object({
policyId: z.string().describe("路由策略 ID")
policyId: z.string().describe("路由策略 ID"),
dryRun: z.boolean().optional().describe("只返回前后配置 Diff,不执行写入")
}),
handler: async (client: KyInstance, params: { policyId: string }) => {
const config = (await api.getApprovalStylePreferences(client)) as any;
handler: async (client: KyInstance, params: { policyId: string; dryRun?: boolean }, context: ToolContext) => {
const config = (await api.getApprovalStylePreferences(client, context.corp.seal.endpoints.approvalStylePreferences)) as any;
const existing: ThinkingPolicy[] = config.thinkingDepthPreference?.routingPolicies ?? [];
const next = existing.filter((item) => item.id !== params.policyId);
if (next.length === existing.length) {
@@ -2012,7 +2221,8 @@ export const sealTools = [
routingPolicies: next
}
};
await api.updateApprovalStylePreferences(client, updated);
if (params.dryRun) return mutationPreview(context, context.corp.seal.endpoints.approvalStylePreferences, config, updated, 1);
await api.updateApprovalStylePreferences(client, updated, context.corp.seal.endpoints.approvalStylePreferences);
return {
removedId: params.policyId,
policies: next
@@ -2178,6 +2388,90 @@ function pickRuleFields(rule: ApprovalRule, fields: readonly RuleField[]) {
return output;
}
type RulePushPlan = {
created: LocalRuleItem[];
updated: Array<{ id: string; rule: LocalRuleItem; changedFields: string[] }>;
deleted: ApprovalRule[];
unchanged: Array<Pick<ApprovalRule, "id">>;
};
export function buildRulePushPlan(
remoteRules: ApprovalRule[],
localRules: LocalRuleItem[]
): RulePushPlan {
const remoteById = new Map(remoteRules.map((rule) => [rule.id, rule]));
const usedRemoteIds = new Set<string>();
const created: LocalRuleItem[] = [];
const updated: RulePushPlan["updated"] = [];
const unchanged: RulePushPlan["unchanged"] = [];
for (const localRule of localRules) {
let remoteRule: ApprovalRule | undefined;
if (localRule.id) {
remoteRule = remoteById.get(localRule.id);
if (!remoteRule) {
throw new Error(
`本地规则 ${localRule.id} 不存在于当前草稿。请先用 rules pull 获取当前草稿,再重新应用修改。`
);
}
if (usedRemoteIds.has(localRule.id)) {
throw new Error(`本地规则文件包含重复的规则 ID:${localRule.id}`);
}
} else {
const matches = remoteRules.filter(
(candidate) => !usedRemoteIds.has(candidate.id) && rulesHaveSameContent(candidate, localRule)
);
if (matches.length > 1) {
throw new Error(
`本地规则“${localRule.description}”无法唯一匹配远端草稿,请在规则文件中补充稳定的 id。`
);
}
remoteRule = matches[0];
}
if (!remoteRule) {
created.push(localRule);
continue;
}
usedRemoteIds.add(remoteRule.id);
const changedFields = ruleChangedFields(remoteRule, localRule);
if (changedFields.length) {
updated.push({ id: remoteRule.id, rule: localRule, changedFields });
} else {
unchanged.push({ id: remoteRule.id });
}
}
return {
created,
updated,
deleted: remoteRules.filter((rule) => !usedRemoteIds.has(rule.id)),
unchanged
};
}
function rulesHaveSameContent(remoteRule: ApprovalRule, localRule: LocalRuleItem): boolean {
return remoteRule.description === localRule.description.trim() &&
remoteRule.scope === (localRule.scope ?? "ALL") &&
remoteRule.strictness === normalizeRuleStrictness(localRule.strictness);
}
function ruleChangedFields(remoteRule: ApprovalRule, localRule: LocalRuleItem): string[] {
const changed: string[] = [];
if (remoteRule.description !== localRule.description.trim()) changed.push("description");
if (remoteRule.scope !== (localRule.scope ?? "ALL")) changed.push("scope");
if (remoteRule.strictness !== normalizeRuleStrictness(localRule.strictness)) changed.push("strictness");
return changed;
}
function normalizeRuleStrictness(value?: string): string {
const normalized = value?.toUpperCase() ?? "MUST_FOLLOW";
if (normalized.includes("SHOULD")) return "SHOULD_FOLLOW";
if (normalized.includes("SUGGEST")) return "SUGGESTION";
return "MUST_FOLLOW";
}
export type SimulationBatchCreateInput = {
mode?: string;
sourceSystem?: string;
@@ -2238,6 +2532,38 @@ function redactIntegrationSecrets(integration: Record<string, unknown>) {
);
}
function mutationPreview(
context: ToolContext,
endpoint: string,
before: unknown,
after: unknown,
impactCount: number
) {
const baseUrl = getConfiguredSealBaseUrl(context.corp).replace(/\/+$/, "");
return {
preview: true,
targetUrl: `${baseUrl}/${endpoint.replace(/^\/+/, "")}`,
changesDiff: {
before: redactPreviewValue(before),
after: redactPreviewValue(after)
},
impactCount
};
}
function redactPreviewValue(value: unknown): unknown {
if (Array.isArray(value)) return value.map(redactPreviewValue);
if (!value || typeof value !== "object") return value;
return Object.fromEntries(
Object.entries(value).map(([key, item]) => [
key,
["apiKey", "apiSecret", "secret", "token", "password"].includes(key) && typeof item === "string"
? "***"
: redactPreviewValue(item)
])
);
}
export function buildSimulationBatchParams(input: SimulationBatchCreateInput): Record<string, unknown> {
const sourceSystem = input.sourceSystem ?? input.mode ?? "hosecloud";
const params: Record<string, unknown> = {
+62 -1
View File
@@ -1,4 +1,5 @@
import { z } from "zod";
import { DEFAULT_MATERIAL_PACK_FILE_POLICY, MaterialPackFilePolicySchema } from "./material-pack/policy.js";
export const HosecloudStaffSchema = z.object({
staffId: z.string(),
@@ -181,7 +182,8 @@ export const WebhookIntegrationSchema = z.object({
outgoingResultWebhook: z.string().url(),
incomingManualResultWebhook: WebhookEndpointSchema,
secret: z.string().min(1),
autoApprovalRate: z.number().int().min(0).max(100).optional()
autoApprovalRate: z.number().int().min(0).max(100).optional(),
materialPackFilePolicy: MaterialPackFilePolicySchema.default(DEFAULT_MATERIAL_PACK_FILE_POLICY)
}).passthrough();
export const ApprovalStylePreferencesSchema = z.object({
@@ -286,6 +288,56 @@ export const SealContactSearchResultSchema = z.object({
users: z.array(SealUserDetailSchema).default([])
}).passthrough();
export const SealDepartmentSchema = z.object({
_id: z.string(),
tenantId: z.string().optional(),
name: z.string().optional(),
parentId: z.string().nullable().optional(),
ancestors: z.array(z.string()).default([]),
provider: z.string().optional(),
permissions: z.array(z.string()).default([]),
isDeleted: z.boolean().optional(),
syncedAt: z.string().optional(),
createdAt: z.string().optional(),
updatedAt: z.string().optional()
}).passthrough();
export const SealDepartmentListDataSchema = z.object({
items: z.array(SealDepartmentSchema).default([])
}).passthrough();
export const SealDepartmentUsersDataSchema = z.object({
items: z.array(SealUserDetailSchema).default([])
}).passthrough();
export const SealContactsLastSyncTimeSchema = z.object({
lastSyncTime: z.union([z.string(), z.number(), z.null()])
}).passthrough();
export const InsightTagStatsSchema = z.record(z.string(), z.unknown());
export const InsightStatsSchema = z.object({
tagStats: z.array(InsightTagStatsSchema).default([]),
totalRisks: z.number().default(0),
analyzedRisks: z.number().default(0),
pendingRisks: z.number().default(0)
}).passthrough();
const DataRecordSchema = z.record(z.string(), z.unknown());
export const ExpenseListDataSchema = z.object({
expenses: z.array(DataRecordSchema).default([]),
total: z.number().optional()
}).passthrough();
export const InvoiceListDataSchema = z.object({
invoices: z.array(DataRecordSchema).default([]),
total: z.number().optional(),
feishuApprovalAppId: z.string().nullable().optional()
}).passthrough();
export const SimulationApprovalDefinitionSchema = z.record(z.string(), z.unknown());
export const LlmConfigSchema = z.object({
provider: z.string(),
config: z.record(z.string(), z.unknown()).default({})
@@ -486,6 +538,7 @@ export const ThinkingDepthPreferenceSchema = z.object({
}).passthrough();
export const HosecloudConfigInputSchema = z.object({
dryRun: z.boolean().optional(),
signKey: z.string().min(1).optional(),
outboundName: z.string().optional(),
specificationId: z.string().optional(),
@@ -536,6 +589,14 @@ export type SealUserCreateResult = z.infer<typeof SealUserCreateResultSchema>;
export type SealUserResetPasswordResult = z.infer<typeof SealUserResetPasswordResultSchema>;
export type SealUserDetail = z.infer<typeof SealUserDetailSchema>;
export type SealContactSearchResult = z.infer<typeof SealContactSearchResultSchema>;
export type SealDepartment = z.infer<typeof SealDepartmentSchema>;
export type SealDepartmentListData = z.infer<typeof SealDepartmentListDataSchema>;
export type SealDepartmentUsersData = z.infer<typeof SealDepartmentUsersDataSchema>;
export type SealContactsLastSyncTime = z.infer<typeof SealContactsLastSyncTimeSchema>;
export type InsightStats = z.infer<typeof InsightStatsSchema>;
export type ExpenseListData = z.infer<typeof ExpenseListDataSchema>;
export type InvoiceListData = z.infer<typeof InvoiceListDataSchema>;
export type SimulationApprovalDefinition = z.infer<typeof SimulationApprovalDefinitionSchema>;
export type LlmConfig = z.infer<typeof LlmConfigSchema>;
export type LlmProvider = z.infer<typeof LlmProviderSchema>;
export type AvailablePermissionsData = z.infer<typeof AvailablePermissionsDataSchema>;
+4 -2
View File
@@ -7,6 +7,7 @@ import {
ListToolsRequestSchema
} from "@modelcontextprotocol/sdk/types.js";
import { runCli } from "./cli/runner.js";
import { classifyCliError } from "./cli/errors.js";
import { VERSION } from "./version.js";
const serverEntryFile = fileURLToPath(import.meta.url);
@@ -69,7 +70,7 @@ export function createServer(options: { enableCli?: boolean } = {}) {
stdout: "",
stderr: "seal_cli requires a non-empty command string",
isError: true,
exitCode: 1
exitCode: 2
});
}
@@ -89,11 +90,12 @@ export function createServer(options: { enableCli?: boolean } = {}) {
}
}));
} catch (error) {
const classification = classifyCliError(error);
return cliResult({
stdout: "",
stderr: error instanceof Error ? error.message : String(error),
isError: true,
exitCode: 1
exitCode: classification.exitCode
});
}
});