Author SHA1 Message Date
Renovate d41d409a0e chore(deps): update actions/setup-node action to v6.5.0
renovate/stability-days Updates have met minimum release age requirement
Lint / pre-commit Linting (push) Successful in 47s
Test / Run Tests (push) Successful in 4m44s
2026-07-24 22:43:12 +00:00
Renovate dcdca8e753 chore(deps): update actions/checkout action to v7.0.1 (#106)
Lint / pre-commit Linting (push) Successful in 58s
Test / Run Tests (push) Successful in 1m36s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-07-25 00:32:05 +02:00
Renovate 9dcad628d4 chore(deps): update pre-commit hook python-jsonschema/check-jsonschema to v0.37.4 (#105)
Lint / pre-commit Linting (push) Successful in 57s
Test / Run Tests (push) Successful in 1m27s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-07-03 20:53:34 +02:00
Renovate c9b5d215f6 chore(deps): update actions/setup-python action to v6.3.0 (#104)
Lint / pre-commit Linting (push) Successful in 58s
Test / Run Tests (push) Successful in 1m36s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-06-29 02:54:05 +02:00
Renovate e8534d7fae chore(deps): update actions/checkout action to v7 (#103)
Lint / pre-commit Linting (push) Successful in 1m9s
Test / Run Tests (push) Successful in 1m32s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-06-22 02:36:03 +02:00
Renovate 873de41ead chore(deps): update pre-commit hook python-jsonschema/check-jsonschema to v0.37.3 (#100)
Lint / pre-commit Linting (push) Successful in 1m13s
Test / Run Tests (push) Successful in 1m52s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-06-19 03:14:22 +02:00
Renovate 36e34e99c5 chore(deps): update actions/checkout action to v6.0.3 (#98)
Lint / pre-commit Linting (push) Successful in 1m3s
Test / Run Tests (push) Successful in 1m26s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-06-05 16:45:22 +02:00
Renovate 2292b914ad chore(deps): update vitest monorepo to v4.1.8 (#97)
Lint / pre-commit Linting (push) Successful in 54s
Test / Run Tests (push) Successful in 1m21s
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@vitest/coverage-v8](https://vitest.dev/guide/coverage) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | [`4.1.7` → `4.1.8`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/4.1.7/4.1.8) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@vitest%2fcoverage-v8/4.1.8?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@vitest%2fcoverage-v8/4.1.7/4.1.8?slim=true) |
| [vitest](https://vitest.dev) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | [`4.1.7` → `4.1.8`](https://renovatebot.com/diffs/npm/vitest/4.1.7/4.1.8) | ![age](https://developer.mend.io/api/mc/badges/age/npm/vitest/4.1.8?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vitest/4.1.7/4.1.8?slim=true) |

---

### Release Notes

<details>
<summary>vitest-dev/vitest (@&#8203;vitest/coverage-v8)</summary>

### [`v4.1.8`](https://github.com/vitest-dev/vitest/releases/tag/v4.1.8)

[Compare Source](https://github.com/vitest-dev/vitest/compare/v4.1.7...v4.1.8)

#####    🐞 Bug Fixes

- **browser**:
  - Disable client `cdp` API when `allowWrite/allowExec: false` \[backport to v4]  -  by [@&#8203;hi-ogawa](https://github.com/hi-ogawa) and **Codex** in [#&#8203;10450](https://github.com/vitest-dev/vitest/issues/10450) [<samp>(e4067)</samp>](https://github.com/vitest-dev/vitest/commit/e4067b3b1)
  - Remove orphaned Playwright route when same module is mocked via multiple ids \[backport to v4]  -  by [@&#8203;toxik](https://github.com/toxik) and [@&#8203;Zelys-DFKH](https://github.com/Zelys-DFKH) in [#&#8203;10474](https://github.com/vitest-dev/vitest/issues/10474) [<samp>(675b4)</samp>](https://github.com/vitest-dev/vitest/commit/675b4343f)

#####     [View changes on GitHub](https://github.com/vitest-dev/vitest/compare/v4.1.7...v4.1.8)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "on monday,on friday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yMDMuMCIsInVwZGF0ZWRJblZlciI6IjQzLjIwMy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0aW9uIiwibnBtIl19-->

Reviewed-on: https://git.horstenkamp.eu/Screeps/screeps-deploy-action/pulls/97
Reviewed-by: LLMReview <27+autoreview@noreplay.horstenkamp.eu>
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-06-05 13:46:00 +02:00
Renovate bdd0fbfd7e chore(deps): update vitest monorepo to v4.1.7 (#96)
Lint / pre-commit Linting (push) Successful in 51s
Test / Run Tests (push) Successful in 1m21s
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [@vitest/coverage-v8](https://vitest.dev/guide/coverage) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8)) | [`4.1.6` → `4.1.7`](https://renovatebot.com/diffs/npm/@vitest%2fcoverage-v8/4.1.6/4.1.7) | ![age](https://developer.mend.io/api/mc/badges/age/npm/@vitest%2fcoverage-v8/4.1.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@vitest%2fcoverage-v8/4.1.6/4.1.7?slim=true) |
| [vitest](https://vitest.dev) ([source](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest)) | [`4.1.6` → `4.1.7`](https://renovatebot.com/diffs/npm/vitest/4.1.6/4.1.7) | ![age](https://developer.mend.io/api/mc/badges/age/npm/vitest/4.1.7?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/vitest/4.1.6/4.1.7?slim=true) |

---

### Release Notes

<details>
<summary>vitest-dev/vitest (@&#8203;vitest/coverage-v8)</summary>

### [`v4.1.7`](https://github.com/vitest-dev/vitest/releases/tag/v4.1.7)

[Compare Source](https://github.com/vitest-dev/vitest/compare/v4.1.6...v4.1.7)

#####    🐞 Bug Fixes

- **runner**: Limit concurrency per task branch in addition to per leaf callbacks (backport)  -  by [@&#8203;hi-ogawa](https://github.com/hi-ogawa) in [#&#8203;10384](https://github.com/vitest-dev/vitest/issues/10384) [<samp>(4f0f2)</samp>](https://github.com/vitest-dev/vitest/commit/4f0f2a1ee)

#####     [View changes on GitHub](https://github.com/vitest-dev/vitest/compare/v4.1.6...v4.1.7)

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "on monday,on friday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about these updates again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4xODUuMSIsInVwZGF0ZWRJblZlciI6IjQzLjE4NS4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJhdXRvbWF0aW9uIiwibnBtIl19-->

Reviewed-on: https://git.horstenkamp.eu/Screeps/screeps-deploy-action/pulls/96
Reviewed-by: LLMReview <27+autoreview@noreplay.horstenkamp.eu>
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-05-25 18:38:53 +02:00
Renovate df5d81df5c chore(deps): update actions/setup-python action to v6.2.0 (#95)
Lint / pre-commit Linting (push) Successful in 1m2s
Test / Run Tests (push) Successful in 1m17s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-05-23 01:04:04 +02:00
Renovate 0b930f5645 chore(deps): update actions/setup-node action to v6.4.0 (#94)
Lint / pre-commit Linting (push) Successful in 1m1s
Test / Run Tests (push) Successful in 1m23s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-05-23 00:57:45 +02:00
Renovate 67f3f15c2b chore(deps): update actions/checkout action to v6.0.2 (#93)
Lint / pre-commit Linting (push) Successful in 58s
Test / Run Tests (push) Successful in 1m17s
Co-authored-by: Renovate Bot <renovate@horstenkamp.eu>
Co-committed-by: Renovate Bot <renovate@horstenkamp.eu>
2026-05-23 00:47:20 +02:00
Philipp d0a08da728 feat: add rollback_on_failure feature (#88)
Lint / pre-commit Linting (push) Successful in 44s
Test / Run Tests (push) Successful in 1m2s
This PR adds the ability to download existing code before deployment and automatically roll back if the post-deployment monitor detects a failure.

Reviewed-on: #88
Reviewed-by: LLMReview <27+autoreview@noreplay.horstenkamp.eu>
2026-05-17 13:13:58 +02:00
Philipp 076e96f3de fix(monitor): use global console channel and implement shard filtering (#87)
Lint / pre-commit Linting (push) Successful in 47s
Test / Run Tests (push) Successful in 1m3s
This PR fixes the issue where console monitoring was empty when a specific shard was targeted on the official Screeps server.

### Changes:
- **Unified Subscription**: Changed WebSocket subscription path from `shard/console` (invalid) to the global `console` channel.
- **Shard Filtering**: Implemented client-side filtering in `handleConsoleEvent` to only display logs matching the targeted shard.
- **Precise Timing**: Retained the shard-specific `api.time()` call for accurate tick duration tracking.
- **Tests**: Added and updated 48 unit tests verifying the fix and shard filtering logic.
- **Distribution**: Rebuilt `dist/index.js` and bumped version to `v0.2.1`.

Reviewed-on: #87
2026-05-16 22:29:24 +02:00
Philipp bf52580bf3 feat: add Screeps console monitoring with configurable error handling and shard support (#84)
Lint / pre-commit Linting (push) Successful in 1m5s
Test / Run Tests (push) Successful in 1m23s
Reviewed-on: #84
2026-05-16 19:44:39 +02:00
12 changed files with 529 additions and 2148 deletions

No files matched your search

+2 -2
View File
@@ -9,8 +9,8 @@ jobs:
name: pre-commit Linting
runs-on: pi
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
- run: pip install pre-commit
shell: bash
- name: Pre Commit
+2 -2
View File
@@ -9,8 +9,8 @@ jobs:
name: Run Tests
runs-on: pi
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6.5.0
with:
node-version: '24'
- run: npm install
+1 -1
View File
@@ -29,7 +29,7 @@ repos:
types_or: [css, javascript]
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.37.2
rev: 0.37.4
hooks:
- id: check-renovate
- id: check-github-actions
+1
View File
@@ -6,6 +6,7 @@ This repository is maintained by Gemini.
* **Test-Driven Development (TDD):** Wherever possible, Test-Driven Development principles should be followed. Write tests before writing the code they are intended to validate.
* **Pre-commit Hooks:** Ensure that `pre-commit` hooks are installed and active before making any commits. This can be done by running `pre-commit install` in your local repository.
* **Note for Gemini:** Git commits trigger pre-commit hooks, which can take several seconds (or minutes) to complete. Checking the command status for git commit is only appropriate every 120s.
## Repository Comparison
+73 -22
View File
@@ -20,6 +20,23 @@ vi.mock("../monitor.js", () => ({
}),
}));
// Mock screeps-api
vi.mock("screeps-api", () => {
const mockApi = {
auth: vi.fn().mockResolvedValue(),
code: {
get: vi.fn().mockResolvedValue({ ok: 1, modules: { main: "old_code" } }),
set: vi.fn().mockResolvedValue({ ok: 1 }),
},
};
// Use a regular function so it can be called with `new`
return {
ScreepsAPI: vi.fn(function () {
return mockApi;
}),
};
});
import * as core from "@actions/core";
import { monitorConsole } from "../monitor.js";
@@ -29,7 +46,9 @@ import {
readReplaceAndWriteFiles,
readFilesIntoDict,
applyOnAction,
postCode,
} from "../index.js";
import { ScreepsAPI } from "screeps-api";
import fs from "fs";
import path from "path";
import os from "os";
@@ -231,31 +250,31 @@ describe("glob functionality", () => {
describe("applyOnAction", () => {
beforeEach(() => vi.clearAllMocks());
it("'ignore' + true → no core call", () => {
applyOnAction("ignore", true, "msg");
it("'ignore' + true → no core call, returns false", () => {
expect(applyOnAction("ignore", true, "msg")).toBe(false);
expect(core.warning).not.toHaveBeenCalled();
expect(core.setFailed).not.toHaveBeenCalled();
});
it("'warn' + true → core.warning() called with message", () => {
applyOnAction("warn", true, "boom");
it("'warn' + true → core.warning() called with message, returns false", () => {
expect(applyOnAction("warn", true, "boom")).toBe(false);
expect(core.warning).toHaveBeenCalledWith("boom");
expect(core.setFailed).not.toHaveBeenCalled();
});
it("'fail' + true → core.setFailed() called with message", () => {
applyOnAction("fail", true, "boom");
it("'fail' + true → core.setFailed() called with message, returns true", () => {
expect(applyOnAction("fail", true, "boom")).toBe(true);
expect(core.setFailed).toHaveBeenCalledWith("boom");
expect(core.warning).not.toHaveBeenCalled();
});
it("'fail' + false → no core call", () => {
applyOnAction("fail", false, "boom");
it("'fail' + false → no core call, returns false", () => {
expect(applyOnAction("fail", false, "boom")).toBe(false);
expect(core.setFailed).not.toHaveBeenCalled();
});
it("'warn' + false → no core call", () => {
applyOnAction("warn", false, "msg");
it("'warn' + false → no core call, returns false", () => {
expect(applyOnAction("warn", false, "msg")).toBe(false);
expect(core.warning).not.toHaveBeenCalled();
});
});
@@ -270,28 +289,60 @@ describe("postCode — monitor wiring", () => {
// Default core mocks
core.getInput.mockImplementation((name) => {
if (name === "monitor") return "0";
if (name === "token") return "test-token";
if (name === "branch") return "default";
if (name === "on_traceback") return "fail";
return "";
});
core.getBooleanInput.mockReturnValue(false);
core.getBooleanInput.mockImplementation((name) => {
if (name === "rollback_on_failure") return false;
return false;
});
});
it("does not call monitorConsole when monitor=0 (default)", async () => {
// We need to mock the rest of postCode to not fail before it hits the monitor block
// This is a bit complex as postCode is large, but we can mock the inputs to exit early or mock the API
// Actually, I'll just check if monitorConsole is called.
// We just run postCode with monitor=0 and verify monitorConsole is not called.
await postCode();
expect(monitorConsole).not.toHaveBeenCalled();
});
// For this test, I'll make validateAuthentication fail so it returns early but after input check
it("rolls back to previous code when monitor detects a failure and rollback_on_failure is true", async () => {
// Setup inputs for monitor and rollback
core.getInput.mockImplementation((name) => {
if (name === "monitor") return "0";
if (name === "monitor") return "10";
if (name === "token") return "test-token";
if (name === "branch") return "default";
if (name === "on_traceback") return "fail";
return "";
});
core.getBooleanInput.mockImplementation((name) => {
if (name === "rollback_on_failure") return true;
return false;
});
// We'll just run a partial check or rely on the monitor unit tests for depth
// The wiring in index.js is:
// const monitorTicks = parseInt(core.getInput("monitor") || "0", 10);
// if (monitorTicks > 0) { ... }
// Simulate a failure in monitorConsole
monitorConsole.mockResolvedValueOnce({
sawTraceback: true, // Should trigger "fail" due to on_traceback=fail
sawErrorLog: false,
sawWarningLog: false,
});
// Testing the logic inside index.js directly by calling postCode would require full environment mock.
// I'll stick to the applyOnAction unit tests and rely on monitor.test.js for the heavy lifting.
await postCode();
// Verify rollback was performed
const mockApiInstance = new ScreepsAPI();
// `code.set` should be called twice:
// 1st time: uploading the new files
// 2nd time: rolling back to oldCode
expect(mockApiInstance.code.set).toHaveBeenCalledTimes(2);
expect(mockApiInstance.code.set).toHaveBeenNthCalledWith(2, "default", {
main: "old_code",
});
// Verify it called core.setFailed due to traceback
expect(core.setFailed).toHaveBeenCalledWith(
"Screeps console: traceback detected",
);
});
});
+140 -29
View File
@@ -11,12 +11,15 @@ vi.mock("@actions/core", () => ({
endGroup: vi.fn(),
}));
// ── mock @actions/artifact so tests never attempt real uploads ──────────────
vi.mock("@actions/artifact", () => ({
DefaultArtifactClient: vi.fn().mockImplementation(() => ({
import * as artifact from "@actions/artifact";
vi.mock("@actions/artifact", () => {
const mockClient = {
uploadArtifact: vi.fn().mockResolvedValue({}),
})),
}));
};
return {
create: vi.fn(() => mockClient),
};
});
import * as core from "@actions/core";
import fs from "fs";
@@ -28,8 +31,10 @@ import {
buildSubscribePath,
detectTraceback,
detectWarning,
outputMultiline,
buildProgressMessage,
writeLogFile,
uploadLogArtifacts,
handleConsoleEvent,
monitorConsole,
} from "../monitor.js";
@@ -123,6 +128,33 @@ describe("detectWarning", () => {
});
});
describe("outputMultiline", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("prefixes lines with shard when provided", () => {
outputMultiline("line1\nline2", "info", "shard0");
expect(core.info).toHaveBeenCalledWith("[shard0] line1");
expect(core.info).toHaveBeenCalledWith("[shard0] line2");
});
it("does not prefix when shard is missing", () => {
outputMultiline("line1", "info");
expect(core.info).toHaveBeenCalledWith("line1");
});
it("uses core.warning for level=warning", () => {
outputMultiline("warn", "warning", "s0");
expect(core.warning).toHaveBeenCalledWith("[s0] warn");
});
it("uses core.error for level=error", () => {
outputMultiline("err", "error", "s0");
expect(core.error).toHaveBeenCalledWith("[s0] err");
});
});
describe("buildProgressMessage", () => {
it("formats correctly at 0 elapsed", () => {
expect(buildProgressMessage(0, 50)).toBe("[Monitor] 0/50 ticks elapsed...");
@@ -141,48 +173,79 @@ describe("buildProgressMessage", () => {
});
});
describe("uploadLogArtifacts", () => {
beforeEach(() => {
vi.clearAllMocks();
});
it("instantiates client and calls uploadArtifact", async () => {
await uploadLogArtifacts(
["/path/to/shard0_console_log.txt"],
"custom-name",
);
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
"custom-name",
["/path/to/shard0_console_log.txt"],
"/path/to",
{ continueOnError: true },
);
});
it("does nothing if filePaths is empty", async () => {
await uploadLogArtifacts([]);
expect(artifact.create().uploadArtifact).not.toHaveBeenCalled();
});
});
// ────────────────────────────────────────────────────────────────────────────
// handleConsoleEvent
// ────────────────────────────────────────────────────────────────────────────
describe("handleConsoleEvent", () => {
let state;
let stdoutBuffer;
let shardBuffers;
beforeEach(() => {
vi.clearAllMocks();
state = { sawTraceback: false, sawErrorLog: false, sawWarningLog: false };
stdoutBuffer = [];
shardBuffers = {};
});
const makeEvent = (log = [], results = [], error = null) => ({
data: { messages: { log, results }, error },
});
it("calls core.info for each stdout line when logToFile=false", () => {
const event = makeEvent(["line1", "line2"]);
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
expect(core.info).toHaveBeenCalledWith("line1");
expect(core.info).toHaveBeenCalledWith("line2");
expect(stdoutBuffer).toHaveLength(0);
it("calls core.info for each stdout line with shard prefix when logToFile=false", () => {
const event = {
data: {
shard: "shard0",
messages: { log: ["line1"], results: ["line2"] },
},
};
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(core.info).toHaveBeenCalledWith("[shard0] line1");
expect(core.info).toHaveBeenCalledWith("[shard0] line2");
expect(Object.keys(shardBuffers)).toHaveLength(0);
});
it("buffers stdout when logToFile=true; does not call core.info", () => {
const event = makeEvent(["line1", "line2"]);
handleConsoleEvent(event, { logToFile: true }, stdoutBuffer, state);
const event = {
data: { shard: "shard0", messages: { log: ["line1", "line2"] } },
};
handleConsoleEvent(event, { logToFile: true }, shardBuffers, state);
expect(core.info).not.toHaveBeenCalled();
expect(stdoutBuffer).toEqual(["line1", "line2"]);
expect(shardBuffers["shard0"]).toEqual(["line1", "line2"]);
});
it("includes results lines in output", () => {
const event = makeEvent([], ["result1"]);
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(core.info).toHaveBeenCalledWith("result1");
});
it("calls core.error when error field is non-empty", () => {
const event = makeEvent([], [], "Script crashed");
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(core.error).toHaveBeenCalledWith("Script crashed");
expect(state.sawErrorLog).toBe(true);
});
@@ -190,58 +253,73 @@ describe("handleConsoleEvent", () => {
it("sets state.sawTraceback when error contains stack frames", () => {
const error = "TypeError: boom\n at Object.<anonymous> (main:1:1)";
const event = makeEvent([], [], error);
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(state.sawTraceback).toBe(true);
expect(state.sawErrorLog).toBe(true);
});
it("does not set sawTraceback for plain error without stack frames", () => {
const event = makeEvent([], [], "Script error: low CPU");
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(state.sawTraceback).toBe(false);
expect(state.sawErrorLog).toBe(true);
});
it("sets state.sawWarningLog and calls core.warning for warn lines", () => {
const event = makeEvent(["<font color='orange'>low energy</font>"]);
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state);
expect(state.sawWarningLog).toBe(true);
expect(core.warning).toHaveBeenCalled();
});
it("calls core.warning regardless of logToFile setting", () => {
const event = makeEvent(["<font color='orange'>warn line</font>"]);
handleConsoleEvent(event, { logToFile: true }, stdoutBuffer, state);
handleConsoleEvent(event, { logToFile: true }, shardBuffers, state);
expect(core.warning).toHaveBeenCalled();
});
it("handles missing messages gracefully (no crash on empty event)", () => {
const event = { data: {} };
expect(() =>
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state),
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state),
).not.toThrow();
});
it("handles completely empty event gracefully", () => {
const event = {};
expect(() =>
handleConsoleEvent(event, { logToFile: false }, stdoutBuffer, state),
handleConsoleEvent(event, { logToFile: false }, shardBuffers, state),
).not.toThrow();
});
it("filters messages by shard when targetShard is provided", () => {
const event = { data: { shard: "shard0", messages: { log: ["msg0"] } } };
handleConsoleEvent(event, { shard: "shard1" }, stdoutBuffer, state);
handleConsoleEvent(event, { shard: "shard1" }, shardBuffers, state);
expect(core.info).not.toHaveBeenCalled();
handleConsoleEvent(event, { shard: "shard0" }, stdoutBuffer, state);
expect(core.info).toHaveBeenCalledWith("msg0");
handleConsoleEvent(event, { shard: "shard0" }, shardBuffers, state);
expect(core.info).toHaveBeenCalledWith("[shard0] msg0");
});
it("does not filter when targetShard is undefined", () => {
const event = { data: { shard: "shard0", messages: { log: ["msg0"] } } };
handleConsoleEvent(event, {}, stdoutBuffer, state);
expect(core.info).toHaveBeenCalledWith("msg0");
handleConsoleEvent(event, {}, shardBuffers, state);
expect(core.info).toHaveBeenCalledWith("[shard0] msg0");
});
it("buffers messages separately for different shards", () => {
const event0 = { data: { shard: "shard0", messages: { log: ["msg0"] } } };
const event1 = { data: { shard: "shard1", messages: { log: ["msg1"] } } };
handleConsoleEvent(event0, { logToFile: true }, shardBuffers, state);
handleConsoleEvent(event1, { logToFile: true }, shardBuffers, state);
expect(shardBuffers["shard0"]).toEqual(["msg0"]);
expect(shardBuffers["shard1"]).toEqual(["msg1"]);
});
it("uses 'default' key when shard is missing in event", () => {
const event = { data: { messages: { log: ["msg"] } } };
handleConsoleEvent(event, { logToFile: true }, shardBuffers, state);
expect(shardBuffers["default"]).toEqual(["msg"]);
});
});
@@ -519,4 +597,37 @@ describe("monitorConsole", () => {
expect(result.sawTraceback).toBe(true);
expect(result.sawErrorLog).toBe(true);
});
it("creates separate log files for different shards when logToFile=true", async () => {
const api = buildMockApi({ ticks: [100, 101, 102, 103] });
setTimeout(() => {
api._fireConsole({
shard: "shard0",
messages: { log: ["msg0"], results: [] },
error: null,
});
api._fireConsole({
shard: "shard1",
messages: { log: ["msg1"], results: [] },
error: null,
});
}, 50);
// Verify uploadArtifact was called with two files
await monitorConsole(api, {
...BASE_OPTS,
logToFile: true,
});
expect(artifact.create().uploadArtifact).toHaveBeenCalledWith(
"screeps-console-log",
expect.arrayContaining([
expect.stringContaining("shard0_console_log.txt"),
expect.stringContaining("shard1_console_log.txt"),
]),
expect.any(String),
{ continueOnError: true },
);
});
});
+4
View File
@@ -67,6 +67,10 @@ inputs:
description: 'Print a progress update every N ticks when log_to_file=true (default: 10).'
required: false
default: '10'
rollback_on_failure:
description: 'Automatically rollback to previous code if the monitor detects failures. Requires monitor > 0. (default: false)'
required: false
default: 'false'
outputs:
saw_traceback:
description: true if a JS traceback was detected during monitoring.
+11 -84
View File
@@ -1,100 +1,27 @@
import{createRequire as __WEBPACK_EXTERNAL_createRequire}from"module";var __webpack_modules__={76846:function(i,_,z){var re=this&&this.__createBinding||(Object.create?function(i,_,z,re){if(re===undefined)re=z;var Pe=Object.getOwnPropertyDescriptor(_,z);if(!Pe||("get"in Pe?!_.__esModule:Pe.writable||Pe.configurable)){Pe={enumerable:true,get:function(){return _[z]}}}Object.defineProperty(i,re,Pe)}:function(i,_,z,re){if(re===undefined)re=z;i[re]=_[z]});var Pe=this&&this.__exportStar||function(i,_){for(var z in i)if(z!=="default"&&!Object.prototype.hasOwnProperty.call(_,z))re(_,i,z)};Object.defineProperty(_,"__esModule",{value:true});const $t=z(64487);Pe(z(13776),_);Pe(z(45655),_);Pe(z(64487),_);const er=new $t.DefaultArtifactClient;_["default"]=er},35592:(i,_,z)=>{Object.defineProperty(_,"__esModule",{value:true});_.Timestamp=void 0;const re=z(68886);const Pe=z(68886);const $t=z(68886);const er=z(68886);const tr=z(68886);const rr=z(68886);const nr=z(68886);class Timestamp$Type extends nr.MessageType{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){const i=this.create();const _=Date.now();i.seconds=rr.PbLong.from(Math.floor(_/1e3)).toString();i.nanos=_%1e3*1e6;return i}toDate(i){return new Date(rr.PbLong.from(i.seconds).toNumber()*1e3+Math.ceil(i.nanos/1e6))}fromDate(i){const _=this.create();const z=i.getTime();_.seconds=rr.PbLong.from(Math.floor(z/1e3)).toString();_.nanos=z%1e3*1e6;return _}internalJsonWrite(i,_){let z=rr.PbLong.from(i.seconds).toNumber()*1e3;if(z<Date.parse("0001-01-01T00:00:00Z")||z>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(i.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let re="Z";if(i.nanos>0){let _=(i.nanos+1e9).toString().substring(1);if(_.substring(3)==="000000")re="."+_.substring(0,3)+"Z";else if(_.substring(6)==="000")re="."+_.substring(0,6)+"Z";else re="."+_+"Z"}return new Date(z).toISOString().replace(".000Z",re)}internalJsonRead(i,_,z){if(typeof i!=="string")throw new Error("Unable to parse Timestamp from JSON "+(0,tr.typeofJsonValue)(i)+".");let re=i.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!re)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let Pe=Date.parse(re[1]+"-"+re[2]+"-"+re[3]+"T"+re[4]+":"+re[5]+":"+re[6]+(re[8]?re[8]:"Z"));if(Number.isNaN(Pe))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(Pe<Date.parse("0001-01-01T00:00:00Z")||Pe>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(!z)z=this.create();z.seconds=rr.PbLong.from(Pe/1e3).toString();z.nanos=0;if(re[7])z.nanos=parseInt("1"+re[7]+"0".repeat(9-re[7].length))-1e9;return z}create(i){const _={seconds:"0",nanos:0};globalThis.Object.defineProperty(_,er.MESSAGE_TYPE,{enumerable:false,value:this});if(i!==undefined)(0,$t.reflectionMergePartial)(this,_,i);return _}internalBinaryRead(i,_,z,re){let $t=re!==null&&re!==void 0?re:this.create(),er=i.pos+_;while(i.pos<er){let[_,re]=i.tag();switch(_){case 1:$t.seconds=i.int64().toString();break;case 2:$t.nanos=i.int32();break;default:let er=z.readUnknownField;if(er==="throw")throw new globalThis.Error(`Unknown field ${_} (wire type ${re}) for ${this.typeName}`);let tr=i.skip(re);if(er!==false)(er===true?Pe.UnknownFieldHandler.onRead:er)(this.typeName,$t,_,re,tr)}}return $t}internalBinaryWrite(i,_,z){if(i.seconds!=="0")_.tag(1,re.WireType.Varint).int64(i.seconds);if(i.nanos!==0)_.tag(2,re.WireType.Varint).int32(i.nanos);let $t=z.writeUnknownFields;if($t!==false)($t==true?Pe.UnknownFieldHandler.onWrite:$t)(this.typeName,i,_);return _}}_.Timestamp=new Timestamp$Type},78806:(i,_,z)=>{Object.defineProperty(_,"__esModule",{value:true});_.BytesValue=_.StringValue=_.BoolValue=_.UInt32Value=_.Int32Value=_.UInt64Value=_.Int64Value=_.FloatValue=_.DoubleValue=void 0;const re=z(68886);const Pe=z(68886);const $t=z(68886);const er=z(68886);const tr=z(68886);const rr=z(68886);const nr=z(68886);class DoubleValue$Type extends nr.MessageType{constructor(){super("google.protobuf.DoubleValue",[{no:1,name:"value",kind:"scalar",T:1}])}internalJsonWrite(i,_){return this.refJsonWriter.scalar(2,i.value,"value",false,true)}internalJsonRead(i,_,z){if(!z)z=this.create();z.value=this.refJsonReader.scalar(i,1,undefined,"value");return z}create(i){const _={value:0};globalThis.Object.defineProperty(_,rr.MESSAGE_TYPE,{enumerable:false,value:this});if(i!==undefined)(0,tr.reflectionMergePartial)(this,_,i);return _}internalBinaryRead(i,_,z,re){let Pe=re!==null&&re!==void 0?re:this.create(),$t=i.pos+_;while(i.pos<$t){let[_,re]=i.tag();switch(_){case 1:Pe.value=i.double();break;default:let $t=z.readUnknownFiLine truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=i=>i.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=i=>i.replace(/\r?\n|\r/g,"\r\n");const re=[];const Pe=new Uint8Array([13,10]);sr=0;let $t=false;for(const[_,er]of i){if(typeof er==="string"){const i=br.encode(z+`; name="${escape(normalizeLinefeeds(_))}"`+`\r\n\r\n${normalizeLinefeeds(er)}\r\n`);re.push(i);sr+=i.byteLength}else{const i=br.encode(`${z}; name="${escape(normalizeLinefeeds(_))}"`+(er.name?`; filename="${escape(er.name)}"`:"")+"\r\n"+`Content-Type: ${er.type||"application/octet-stream"}\r\n\r\n`);re.push(i,er,Pe);if(typeof er.size==="number"){sr+=i.byteLength+er.size+Pe.byteLength}else{$t=true}}}const er=br.encode(`--${_}--`);re.push(er);sr+=er.byteLength;if($t){sr=null}ir=i;nr=async function*(){for(const i of re){if(i.stream){yield*i.stream()}else{yield i}}};or="multipart/form-data; boundary="+_}else if(er(i)){ir=i;sr=i.size;if(i.type){or=i.type}}else if(typeof i[Symbol.asyncIterator]==="function"){if(_){throw new TypeError("keepalive")}if(Pe.isDisturbed(i)||i.locked){throw new TypeError("Response body object should not be disturbed or locked")}re=i instanceof Qr?i:$t(i)}if(typeof ir==="string"||Pe.isBuffer(ir)){sr=Buffer.byteLength(ir)}if(nr!=null){let _;re=new Qr({async start(){_=nr(i)[Symbol.asyncIterator]()},async pull(i){const{value:z,done:Pe}=await _.next();if(Pe){queueMicrotask((()=>{i.close()}))}else{if(!hr(re)){i.enqueue(new Uint8Array(z))}}return i.desiredSize>0},async cancel(i){await _.return()},type:undefined})}const ar={stream:re,source:ir,length:sr};return[ar,or]}function safelyExtractBody(i,_=false){if(!Qr){Qr=z(63774).ReadableStream}if(i instanceof Qr){pr(!Pe.isDisturbed(i),"The body has already been consumed.");pr(!i.locked,"The stream is locked.")}return extractBody(i,_)}function cloneBody(i){const[_,z]=i.stream.tee();const re=lr(z,{transfer:[z]});const[,Pe]=re.tee();i.stream=_;return{stream:Pe,length:i.length,source:i.source}}async function*consumeBody(i){if(i){if(gr(i)){yield i}else{const _=i.stream;if(Pe.isDisturbed(_)){throw new TypeError("The body has already been consumed.")}if(_.locked){throw new TypeError("The stream is locked.")}_[ur]=true;yield*_}}}function throwIfAborted(i){if(i.aborted){throw new Ar("The operation was aborted.","AbortError")}}function bodyMixinMethods(i){const _={blob(){return specConsumeBody(this,(i=>{let _=bodyMimeType(this);if(_==="failure"){_=""}else if(_){_=Br(_)}return new cr([i],{type:_})}),i)},arrayBuffer(){return specConsumeBody(this,(i=>new Uint8Array(i).buffer),i)},text(){return specConsumeBody(this,utf8DecodeBytes,i)},json(){return specConsumeBody(this,parseJSONFromBytes,i)},async formData(){ar.brandCheck(this,i);throwIfAborted(this[or]);const _=this.headers.get("Content-Type");if(/multipart\/form-data/.test(_)){const i={};for(const[_,z]of this.headers)i[_.toLowerCase()]=z;const _=new sr;let z;try{z=new re({headers:i,preservePath:true})}catch(i){throw new Ar(`${i}`,"AbortError")}z.on("field",((i,z)=>{_.append(i,z)}));z.on("file",((i,z,re,Pe,$t)=>{const er=[];if(Pe==="base64"||Pe.toLowerCase()==="base64"){let Pe="";z.on("data",(i=>{Pe+=i.toString().replace(/[\r\n]/gm,"");const _=Pe.length-Pe.length%4;er.push(Buffer.from(Pe.slice(0,_),"base64"));Pe=Pe.slice(_)}));z.on("end",(()=>{er.push(Buffer.from(Pe,"base64"));_.append(i,new yr(er,re,{type:$t}))}))}else{z.on("data",(i=>{er.push(i)}));z.on("end",(()=>{_.append(i,new yr(er,re,{type:$t}))}))}}));const Pe=new Promise(((i,_)=>{z.on("finish",i);z.on("error",(i=>_(new TypeError(i))))}));if(this.body!==null)for await(const i of consumeBody(this[or].body))z.write(i);z.end();await Pe;return _}else if(/application\/x-www-form-urlencoded/.test(_)){let i;try{let _="";const z=new TextDecoder("utf-8",{ignoreBOM:true});for await(const i of consumeBody(this[or].body)){if(!gr(i)){throw new TypeError("Expected Uint8Array chunk")}_+=z.decode(i,{stream:true})}_+=z.decode();i=new URLSearchParams(_)}catch(i){throw Object.assign(new TypeError,{cause:i})}const _=new sr;for(const[z,re]of i){_.append(z,re)}return _}else{await Promise.resolve();throwIfAborted(this[or]);throw ar.errors.exception({header:`${i.name}.formData`,message:"Could not parse content as FormData."})}}};return _}function mixinBody(i){Object.assign(i.prototype,bodyMixinMethods(i))}async function specConsumeBody(i,_,z){ar.brandCheck(i,z);throwIfAborted(i[or]);if(bodyUnusable(i[or].body)){throw new TypeError("Body is unusable")}const re=nr();const errorSteps=i=>re.reject(i);const successSteps=i=>{try{re.resolve(_(i))}catch(i){errorSteps(i)}};if(i[or].body==null){successSteps(new Uint8Array);return re.promise}await ir(i[or].body,successSteps,errorSteps);return re.promise}function bodyUnusable(i){return i!=null&&(i.stream.locked||Pe.isDisturbed(i.stream))}function utf8DecodeBytes(i){if(i.length===0){return""}if(i[0]===239&&i[1]===187&&i[2]===191){i=i.subarray(3)}const _=wr.decode(i);return _}function pLine truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */$t[Pe-4]=this.maskKey[0];$t[Pe-3]=this.maskKey[1];$t[Pe-2]=this.maskKey[2];$t[Pe-1]=this.maskKey[3];$t[1]=z;if(z===126){$t.writeUInt16BE(_,2)}else if(z===127){$t[2]=$t[3]=0;$t.writeUIntBE(_,4,6)}$t[1]|=128;for(let i=0;i<_;i++){$t[Pe+i]=this.frameData[i]^this.maskKey[i%4]}return $t}}i.exports={WebsocketFrameSend:WebsocketFrameSend}},85553:(i,_,z)=>{const{Writable:re}=z(2203);const Pe=z(31637);const{parserStates:$t,opcodes:er,states:tr,emptyBuffer:rr}=z(31859);const{kReadyState:nr,kSentClose:ir,kResponse:sr,kReceivedClose:or}=z(65199);const{isValidStatusCode:ar,failWebsocketConnection:Ar,websocketMessageReceived:lr}=z(34604);const{WebsocketFrameSend:cr}=z(80231);const dr={};dr.ping=Pe.channel("undici:websocket:ping");dr.pong=Pe.channel("undici:websocket:pong");class ByteParser extends re{#o=[];#a=0;#A=$t.INFO;#l={};#c=[];constructor(i){super();this.ws=i}_write(i,_,z){this.#o.push(i);this.#a+=i.length;this.run(z)}run(i){while(true){if(this.#A===$t.INFO){if(this.#a<2){return i()}const _=this.consume(2);this.#l.fin=(_[0]&128)!==0;this.#l.opcode=_[0]&15;this.#l.originalOpcode??=this.#l.opcode;this.#l.fragmented=!this.#l.fin&&this.#l.opcode!==er.CONTINUATION;if(this.#l.fragmented&&this.#l.opcode!==er.BINARY&&this.#l.opcode!==er.TEXT){Ar(this.ws,"Invalid frame type was fragmented.");return}const z=_[1]&127;if(z<=125){this.#l.payloadLength=z;this.#A=$t.READ_DATA}else if(z===126){this.#A=$t.PAYLOADLENGTH_16}else if(z===127){this.#A=$t.PAYLOADLENGTH_64}if(this.#l.fragmented&&z>125){Ar(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#l.opcode===er.PING||this.#l.opcode===er.PONG||this.#l.opcode===er.CLOSE)&&z>125){Ar(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#l.opcode===er.CLOSE){if(z===1){Ar(this.ws,"Received close frame with a 1-byte body.");return}const i=this.consume(z);this.#l.closeInfo=this.parseCloseBody(false,i);if(!this.ws[ir]){const i=Buffer.allocUnsafe(2);i.writeUInt16BE(this.#l.closeInfo.code,0);const _=new cr(i);this.ws[sr].socket.write(_.createFrame(er.CLOSE),(i=>{if(!i){this.ws[ir]=true}}))}this.ws[nr]=tr.CLOSING;this.ws[or]=true;this.end();return}else if(this.#l.opcode===er.PING){const _=this.consume(z);if(!this.ws[or]){const i=new cr(_);this.ws[sr].socket.write(i.createFrame(er.PONG));if(dr.ping.hasSubscribers){dr.ping.publish({payload:_})}}this.#A=$t.INFO;if(this.#a>0){continue}else{i();return}}else if(this.#l.opcode===er.PONG){const _=this.consume(z);if(dr.pong.hasSubscribers){dr.pong.publish({payload:_})}if(this.#a>0){continue}else{i();return}}}else if(this.#A===$t.PAYLOADLENGTH_16){if(this.#a<2){return i()}const _=this.consume(2);this.#l.payloadLength=_.readUInt16BE(0);this.#A=$t.READ_DATA}else if(this.#A===$t.PAYLOADLENGTH_64){if(this.#a<8){return i()}const _=this.consume(8);const z=_.readUInt32BE(0);if(z>2**31-1){Ar(this.ws,"Received payload length > 2^31 bytes.");return}const re=_.readUInt32BE(4);this.#l.payloadLength=(z<<8)+re;this.#A=$t.READ_DATA}else if(this.#A===$t.READ_DATA){if(this.#a<this.#l.payloadLength){return i()}else if(this.#a>=this.#l.payloadLength){const i=this.consume(this.#l.payloadLength);this.#c.push(i);if(!this.#l.fragmented||this.#l.fin&&this.#l.opcode===er.CONTINUATION){const i=Buffer.concat(this.#c);lr(this.ws,this.#l.originalOpcode,i);this.#l={};this.#c.length=0}this.#A=$t.INFO}}if(this.#a>0){continue}else{i();break}}}consume(i){if(i>this.#a){return null}else if(i===0){return rr}if(this.#o[0].length===i){this.#a-=this.#o[0].length;return this.#o.shift()}const _=Buffer.allocUnsafe(i);let z=0;while(z!==i){const re=this.#o[0];const{length:Pe}=re;if(Pe+z===i){_.set(this.#o.shift(),z);break}else if(Pe+z>i){_.set(re.subarray(0,i-z),z);this.#o[0]=re.subarray(i-z);break}else{_.set(this.#o.shift(),z);z+=re.length}}this.#a-=i;return _}parseCloseBody(i,_){let z;if(_.length>=2){z=_.readUInt16BE(0)}if(i){if(!ar(z)){return null}return{code:z}}let re=_.subarray(2);if(re[0]===239&&re[1]===187&&re[2]===191){re=re.subarray(3)}if(z!==undefined&&!ar(z)){return null}try{re=new TextDecoder("utf-8",{fatal:true}).decode(re)}catch{return null}return{code:z,reason:re}}get closingInfo(){return this.#l.closeInfo}}i.exports={ByteParser:ByteParser}},65199:i=>{i.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},34604:(i,_,z)=>{const{kReadyState:re,kController:Pe,kResponse:$t,kBinaryType:er,kWebSocketURL:tr}=z(65199);const{states:rr,opcodes:nr}=z(31859);const{MessageEvent:ir,ErrorEvent:sr}=z(3273);function isEstablished(i){return i[re]===rr.OPEN}function isClosing(i){return i[re]===rr.CLOSING}function isClosed(i){return i[re]===rr.CLOSED}function fireEvent(i,_,z=Event,re){const Pe=new z(i,re);_.dispatchEvent(Pe)}function websocketMessageReceived(i,_,z){if(i[rLine truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=i=>i.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=i=>i.replace(/\r?\n|\r/g,"\r\n");const re=[];const Pe=new Uint8Array([13,10]);sr=0;let $t=false;for(const[_,er]of i){if(typeof er==="string"){const i=br.encode(z+`; name="${escape(normalizeLinefeeds(_))}"`+`\r\n\r\n${normalizeLinefeeds(er)}\r\n`);re.push(i);sr+=i.byteLength}else{const i=br.encode(`${z}; name="${escape(normalizeLinefeeds(_))}"`+(er.name?`; filename="${escape(er.name)}"`:"")+"\r\n"+`Content-Type: ${er.type||"application/octet-stream"}\r\n\r\n`);re.push(i,er,Pe);if(typeof er.size==="number"){sr+=i.byteLength+er.size+Pe.byteLength}else{$t=true}}}const er=br.encode(`--${_}--`);re.push(er);sr+=er.byteLength;if($t){sr=null}ir=i;nr=async function*(){for(const i of re){if(i.stream){yield*i.stream()}else{yield i}}};or="multipart/form-data; boundary="+_}else if(er(i)){ir=i;sr=i.size;if(i.type){or=i.type}}else if(typeof i[Symbol.asyncIterator]==="function"){if(_){throw new TypeError("keepalive")}if(Pe.isDisturbed(i)||i.locked){throw new TypeError("Response body object should not be disturbed or locked")}re=i instanceof Qr?i:$t(i)}if(typeof ir==="string"||Pe.isBuffer(ir)){sr=Buffer.byteLength(ir)}if(nr!=null){let _;re=new Qr({async start(){_=nr(i)[Symbol.asyncIterator]()},async pull(i){const{value:z,done:Pe}=await _.next();if(Pe){queueMicrotask((()=>{i.close()}))}else{if(!hr(re)){i.enqueue(new Uint8Array(z))}}return i.desiredSize>0},async cancel(i){await _.return()},type:undefined})}const ar={stream:re,source:ir,length:sr};return[ar,or]}function safelyExtractBody(i,_=false){if(!Qr){Qr=z(63774).ReadableStream}if(i instanceof Qr){pr(!Pe.isDisturbed(i),"The body has already been consumed.");pr(!i.locked,"The stream is locked.")}return extractBody(i,_)}function cloneBody(i){const[_,z]=i.stream.tee();const re=lr(z,{transfer:[z]});const[,Pe]=re.tee();i.stream=_;return{stream:Pe,length:i.length,source:i.source}}async function*consumeBody(i){if(i){if(gr(i)){yield i}else{const _=i.stream;if(Pe.isDisturbed(_)){throw new TypeError("The body has already been consumed.")}if(_.locked){throw new TypeError("The stream is locked.")}_[ur]=true;yield*_}}}function throwIfAborted(i){if(i.aborted){throw new Ar("The operation was aborted.","AbortError")}}function bodyMixinMethods(i){const _={blob(){return specConsumeBody(this,(i=>{let _=bodyMimeType(this);if(_==="failure"){_=""}else if(_){_=Br(_)}return new cr([i],{type:_})}),i)},arrayBuffer(){return specConsumeBody(this,(i=>new Uint8Array(i).buffer),i)},text(){return specConsumeBody(this,utf8DecodeBytes,i)},json(){return specConsumeBody(this,parseJSONFromBytes,i)},async formData(){ar.brandCheck(this,i);throwIfAborted(this[or]);const _=this.headers.get("Content-Type");if(/multipart\/form-data/.test(_)){const i={};for(const[_,z]of this.headers)i[_.toLowerCase()]=z;const _=new sr;let z;try{z=new re({headers:i,preservePath:true})}catch(i){throw new Ar(`${i}`,"AbortError")}z.on("field",((i,z)=>{_.append(i,z)}));z.on("file",((i,z,re,Pe,$t)=>{const er=[];if(Pe==="base64"||Pe.toLowerCase()==="base64"){let Pe="";z.on("data",(i=>{Pe+=i.toString().replace(/[\r\n]/gm,"");const _=Pe.length-Pe.length%4;er.push(Buffer.from(Pe.slice(0,_),"base64"));Pe=Pe.slice(_)}));z.on("end",(()=>{er.push(Buffer.from(Pe,"base64"));_.append(i,new yr(er,re,{type:$t}))}))}else{z.on("data",(i=>{er.push(i)}));z.on("end",(()=>{_.append(i,new yr(er,re,{type:$t}))}))}}));const Pe=new Promise(((i,_)=>{z.on("finish",i);z.on("error",(i=>_(new TypeError(i))))}));if(this.body!==null)for await(const i of consumeBody(this[or].body))z.write(i);z.end();await Pe;return _}else if(/application\/x-www-form-urlencoded/.test(_)){let i;try{let _="";const z=new TextDecoder("utf-8",{ignoreBOM:true});for await(const i of consumeBody(this[or].body)){if(!gr(i)){throw new TypeError("Expected Uint8Array chunk")}_+=z.decode(i,{stream:true})}_+=z.decode();i=new URLSearchParams(_)}catch(i){throw Object.assign(new TypeError,{cause:i})}const _=new sr;for(const[z,re]of i){_.append(z,re)}return _}else{await Promise.resolve();throwIfAborted(this[or]);throw ar.errors.exception({header:`${i.name}.formData`,message:"Could not parse content as FormData."})}}};return _}function mixinBody(i){Object.assign(i.prototype,bodyMixinMethods(i))}async function specConsumeBody(i,_,z){ar.brandCheck(i,z);throwIfAborted(i[or]);if(bodyUnusable(i[or].body)){throw new TypeError("Body is unusable")}const re=nr();const errorSteps=i=>re.reject(i);const successSteps=i=>{try{re.resolve(_(i))}catch(i){errorSteps(i)}};if(i[or].body==null){successSteps(new Uint8Array);return re.promise}await ir(i[or].body,successSteps,errorSteps);return re.promise}function bodyUnusable(i){return i!=null&&(i.stream.locked||Pe.isDisturbed(i.stream))}function utf8DecodeBytes(i){if(i.length===0){return""}if(i[0]===239&&i[1]===187&&i[2]===191){i=i.subarray(3)}const _=wr.decode(i);return _}function pLine truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */$t[Pe-4]=this.maskKey[0];$t[Pe-3]=this.maskKey[1];$t[Pe-2]=this.maskKey[2];$t[Pe-1]=this.maskKey[3];$t[1]=z;if(z===126){$t.writeUInt16BE(_,2)}else if(z===127){$t[2]=$t[3]=0;$t.writeUIntBE(_,4,6)}$t[1]|=128;for(let i=0;i<_;i++){$t[Pe+i]=this.frameData[i]^this.maskKey[i%4]}return $t}}i.exports={WebsocketFrameSend:WebsocketFrameSend}},83042:(i,_,z)=>{const{Writable:re}=z(2203);const Pe=z(31637);const{parserStates:$t,opcodes:er,states:tr,emptyBuffer:rr}=z(90362);const{kReadyState:nr,kSentClose:ir,kResponse:sr,kReceivedClose:or}=z(62218);const{isValidStatusCode:ar,failWebsocketConnection:Ar,websocketMessageReceived:lr}=z(71927);const{WebsocketFrameSend:cr}=z(96098);const dr={};dr.ping=Pe.channel("undici:websocket:ping");dr.pong=Pe.channel("undici:websocket:pong");class ByteParser extends re{#o=[];#a=0;#A=$t.INFO;#l={};#c=[];constructor(i){super();this.ws=i}_write(i,_,z){this.#o.push(i);this.#a+=i.length;this.run(z)}run(i){while(true){if(this.#A===$t.INFO){if(this.#a<2){return i()}const _=this.consume(2);this.#l.fin=(_[0]&128)!==0;this.#l.opcode=_[0]&15;this.#l.originalOpcode??=this.#l.opcode;this.#l.fragmented=!this.#l.fin&&this.#l.opcode!==er.CONTINUATION;if(this.#l.fragmented&&this.#l.opcode!==er.BINARY&&this.#l.opcode!==er.TEXT){Ar(this.ws,"Invalid frame type was fragmented.");return}const z=_[1]&127;if(z<=125){this.#l.payloadLength=z;this.#A=$t.READ_DATA}else if(z===126){this.#A=$t.PAYLOADLENGTH_16}else if(z===127){this.#A=$t.PAYLOADLENGTH_64}if(this.#l.fragmented&&z>125){Ar(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#l.opcode===er.PING||this.#l.opcode===er.PONG||this.#l.opcode===er.CLOSE)&&z>125){Ar(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#l.opcode===er.CLOSE){if(z===1){Ar(this.ws,"Received close frame with a 1-byte body.");return}const i=this.consume(z);this.#l.closeInfo=this.parseCloseBody(false,i);if(!this.ws[ir]){const i=Buffer.allocUnsafe(2);i.writeUInt16BE(this.#l.closeInfo.code,0);const _=new cr(i);this.ws[sr].socket.write(_.createFrame(er.CLOSE),(i=>{if(!i){this.ws[ir]=true}}))}this.ws[nr]=tr.CLOSING;this.ws[or]=true;this.end();return}else if(this.#l.opcode===er.PING){const _=this.consume(z);if(!this.ws[or]){const i=new cr(_);this.ws[sr].socket.write(i.createFrame(er.PONG));if(dr.ping.hasSubscribers){dr.ping.publish({payload:_})}}this.#A=$t.INFO;if(this.#a>0){continue}else{i();return}}else if(this.#l.opcode===er.PONG){const _=this.consume(z);if(dr.pong.hasSubscribers){dr.pong.publish({payload:_})}if(this.#a>0){continue}else{i();return}}}else if(this.#A===$t.PAYLOADLENGTH_16){if(this.#a<2){return i()}const _=this.consume(2);this.#l.payloadLength=_.readUInt16BE(0);this.#A=$t.READ_DATA}else if(this.#A===$t.PAYLOADLENGTH_64){if(this.#a<8){return i()}const _=this.consume(8);const z=_.readUInt32BE(0);if(z>2**31-1){Ar(this.ws,"Received payload length > 2^31 bytes.");return}const re=_.readUInt32BE(4);this.#l.payloadLength=(z<<8)+re;this.#A=$t.READ_DATA}else if(this.#A===$t.READ_DATA){if(this.#a<this.#l.payloadLength){return i()}else if(this.#a>=this.#l.payloadLength){const i=this.consume(this.#l.payloadLength);this.#c.push(i);if(!this.#l.fragmented||this.#l.fin&&this.#l.opcode===er.CONTINUATION){const i=Buffer.concat(this.#c);lr(this.ws,this.#l.originalOpcode,i);this.#l={};this.#c.length=0}this.#A=$t.INFO}}if(this.#a>0){continue}else{i();break}}}consume(i){if(i>this.#a){return null}else if(i===0){return rr}if(this.#o[0].length===i){this.#a-=this.#o[0].length;return this.#o.shift()}const _=Buffer.allocUnsafe(i);let z=0;while(z!==i){const re=this.#o[0];const{length:Pe}=re;if(Pe+z===i){_.set(this.#o.shift(),z);break}else if(Pe+z>i){_.set(re.subarray(0,i-z),z);this.#o[0]=re.subarray(i-z);break}else{_.set(this.#o.shift(),z);z+=re.length}}this.#a-=i;return _}parseCloseBody(i,_){let z;if(_.length>=2){z=_.readUInt16BE(0)}if(i){if(!ar(z)){return null}return{code:z}}let re=_.subarray(2);if(re[0]===239&&re[1]===187&&re[2]===191){re=re.subarray(3)}if(z!==undefined&&!ar(z)){return null}try{re=new TextDecoder("utf-8",{fatal:true}).decode(re)}catch{return null}return{code:z,reason:re}}get closingInfo(){return this.#l.closeInfo}}i.exports={ByteParser:ByteParser}},62218:i=>{i.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},71927:(i,_,z)=>{const{kReadyState:re,kController:Pe,kResponse:$t,kBinaryType:er,kWebSocketURL:tr}=z(62218);const{states:rr,opcodes:nr}=z(90362);const{MessageEvent:ir,ErrorEvent:sr}=z(18686);function isEstablished(i){return i[re]===rr.OPEN}function isClosing(i){return i[re]===rr.CLOSING}function isClosed(i){return i[re]===rr.CLOSED}function fireEvent(i,_,z=Event,re){const Pe=new z(i,re);_.dispatchEvent(Pe)}function websocketMessageReceived(i,_,z){if(i[Line truncated
/**
* Archiver Vending
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(50549);var Pe={};var vending=function(i,_){return vending.create(i,_)};vending.create=function(i,_){if(Pe[i]){var z=new re(i,_);z.setFormat(i);z.setModule(new Pe[i](_));return z}else{throw new Error("create("+i+"): format not registered")}};vending.registerFormat=function(i,_){if(Pe[i]){throw new Error("register("+i+"): format already registered")}if(typeof _!=="function"){throw new Error("register("+i+"): format module invalid")}if(typeof _.prototype.append!=="function"||typeof _.prototype.finalize!=="function"){throw new Error("register("+i+"): format module missing methods")}Pe[i]=_};vending.isRegisteredFormat=function(i){if(Pe[i]){return true}return false};vending.registerFormat("zip",z(22836));vending.registerFormat("tar",z(10396));vending.registerFormat("json",z(54693));i.exports=vending},50549:(i,_,z)=>{
/**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(79896);var Pe=z(51364);var $t=z(97329);var er=z(16928);var tr=z(53296);var rr=z(39023).inherits;var nr=z(13110);var ir=z(29963).Transform;var sr=process.platform==="win32";var Archiver=function(i,_){if(!(this instanceof Archiver)){return new Archiver(i,_)}if(typeof i!=="string"){_=i;i="zip"}_=this.options=tr.defaults(_,{highWaterMark:1024*1024,statConcurrency:4});ir.call(this,_);this._format=false;this._module=false;this._pending=0;this._pointer=0;this._entriesCount=0;this._entriesProcessedCount=0;this._fsEntriesTotalBytes=0;this._fsEntriesProcessedBytes=0;this._queue=$t.queue(this._onQueueTask.bind(this),1);this._queue.drain(this._onQueueDrain.bind(this));this._statQueue=$t.queue(this._onStatQueueTask.bind(this),_.statConcurrency);this._statQueue.drain(this._onQueueDrain.bind(this));this._state={aborted:false,finalize:false,finalizing:false,finalized:false,modulePiped:false};this._streams=[]};rr(Archiver,ir);Archiver.prototype._abort=function(){this._state.aborted=true;this._queue.kill();this._statQueue.kill();if(this._queue.idle()){this._shutdown()}};Archiver.prototype._append=function(i,_){_=_||{};var z={source:null,filepath:i};if(!_.name){_.name=i}_.sourcePath=i;z.data=_;this._entriesCount++;if(_.stats&&_.stats instanceof re.Stats){z=this._updateQueueTaskWithStats(z,_.stats);if(z){if(_.stats.size){this._fsEntriesTotalBytes+=_.stats.size}this._queue.push(z)}}else{this._statQueue.push(z)}};Archiver.prototype._finalize=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return}this._state.finalizing=true;this._moduleFinalize();this._state.finalizing=false;this._state.finalized=true};Archiver.prototype._maybeFinalize=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return false}if(this._state.finalize&&this._pending===0&&this._queue.idle()&&this._statQueue.idle()){this._finalize();return true}return false};Archiver.prototype._moduleAppend=function(i,_,z){if(this._state.aborted){z();return}this._module.append(i,_,function(i){this._task=null;if(this._state.aborted){this._shutdown();return}if(i){this.emit("error",i);setImmediate(z);return}this.emit("entry",_);this._entriesProcessedCount++;if(_.stats&&_.stats.size){this._fsEntriesProcessedBytes+=_.stats.size}this.emit("progress",{entries:{total:this._entriesCount,processed:this._entriesProcessedCount},fs:{totalBytes:this._fsEntriesTotalBytes,processedBytes:this._fsEntriesProcessedBytes}});setImmediate(z)}.bind(this))};Archiver.prototype._moduleFinalize=function(){if(typeof this._module.finalize==="function"){this._module.finalize()}else if(typeof this._module.end==="function"){this._module.end()}else{this.emit("error",new nr("NOENDMETHOD"))}};Archiver.prototype._modulePipe=function(){this._module.on("error",this._onModuleError.bind(this));this._module.pipe(this);this._state.modulePiped=true};Archiver.prototype._moduleSupports=function(i){if(!this._module.supports||!this._module.supports[i]){return false}return this._module.supports[i]};Archiver.prototype._moduleUnpipe=function(){this._module.unpipe(this);this._state.modulePiped=false};Archiver.prototype._normalizeEntryData=function(i,_){i=tr.defaults(i,{type:"file",name:null,date:null,mode:null,prefix:null,sourcePath:null,stats:false});if(_&&i.stats===false){i.stats=_}var z=i.type==="directory";if(i.name){if(typeof i.prefix==="string"&&""!==i.prefix){i.name=i.prefix+"/"+i.name;i.prefix=null}i.name=tr.sanitizePath(i.name);if(i.type!=="symlink"&&i.name.slice(-1)==="/"){z=true;i.type="directory"}else if(z){i.name+="/"}}if(typeof i.mode==="number"){if(sr){i.mode&=511}else{i.mode&=4095}}else if(i.stats&&i.mode===null){if(sr){i.mode=i.stats.mode&511}else{i.mode=i.stats.mode&4095}if(sr&&z){i.mode=493}}else if(i.mode===null){i.mode=z?493:420}if(i.stats&&i.date===null){i.date=i.stats.mtime}else{i.date=tr.dateify(i.date)}return i};Archiver.prototype._onModuleError=function(i){this.emit("error",i)};Archiver.prototype._onQueueDrain=function(){if(this._state.finalizing||this._state.finalized||this._state.aborted){return}if(this._state.finalize&&this._pending===0&&this._queue.idle()&&this._statQueue.idle()){this._finalize()}};Archiver.prototype._onQueueTask=function(i,_){var fullCallback=()=>{if(i.data.callback){i.data.callback()}_()};if(this._state.finalizing||this._state.finalized||this._state.aborted){fullCallback();return}this._task=i;this._moduleAppend(i.source,i.data,fullCallback)};Archiver.prototype._onStatQueueTask=function(i,_){if(this._state.finalizing||this._state.finalized||this._state.aborted){_();return}re.lstat(i.filepath,function(z,re){if(this._state.aborted){setImmediate(_);return}if(z){this._entriesCount--;this.emit("warning",z);setImmediate(_);return}i=this._updateQueueTaskWithStats(i,re);if(i){if(re.size){this._fsEntriesTotalBytes+=re.size}this._queue.push(i)}setImmediate(_)}.bind(this))};Archiver.prototype._shutdown=function(){this._moduleUnpipe();this.end()};Archiver.prototype._transform=function(i,_,z){if(i){this._pointer+=i.lengtLine truncated
/**
* Archiver Core
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(39023);const Pe={ABORTED:"archive was aborted",DIRECTORYDIRPATHREQUIRED:"diretory dirpath argument must be a non-empty string value",DIRECTORYFUNCTIONINVALIDDATA:"invalid data returned by directory custom data function",ENTRYNAMEREQUIRED:"entry name must be a non-empty string value",FILEFILEPATHREQUIRED:"file filepath argument must be a non-empty string value",FINALIZING:"archive already finalizing",QUEUECLOSED:"queue closed",NOENDMETHOD:"no suitable finalize/end method defined by module",DIRECTORYNOTSUPPORTED:"support for directory entries not defined by module",FORMATSET:"archive format already set",INPUTSTEAMBUFFERREQUIRED:"input source must be valid Stream or Buffer instance",MODULESET:"module already set",SYMLINKNOTSUPPORTED:"support for symlink entries not defined by module",SYMLINKFILEPATHREQUIRED:"symlink filepath argument must be a non-empty string value",SYMLINKTARGETREQUIRED:"symlink target argument must be a non-empty string value",ENTRYNOTSUPPORTED:"entry not supported"};function ArchiverError(i,_){Error.captureStackTrace(this,this.constructor);this.message=Pe[i]||i;this.code=i;this.data=_}re.inherits(ArchiverError,Error);_=i.exports=ArchiverError},54693:(i,_,z)=>{
/**
* JSON Format Plugin
*
* @module plugins/json
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(39023).inherits;var Pe=z(29963).Transform;var $t=z(84928);var er=z(53296);var Json=function(i){if(!(this instanceof Json)){return new Json(i)}i=this.options=er.defaults(i,{});Pe.call(this,i);this.supports={directory:true,symlink:true};this.files=[]};re(Json,Pe);Json.prototype._transform=function(i,_,z){z(null,i)};Json.prototype._writeStringified=function(){var i=JSON.stringify(this.files);this.write(i)};Json.prototype.append=function(i,_,z){var re=this;_.crc32=0;function onend(i,Pe){if(i){z(i);return}_.size=Pe.length||0;_.crc32=$t.unsigned(Pe);re.files.push(_);z(null,_)}if(_.sourceType==="buffer"){onend(null,i)}else if(_.sourceType==="stream"){er.collectStream(i,onend)}};Json.prototype.finalize=function(){this._writeStringified();this.end()};i.exports=Json},10396:(i,_,z)=>{
/**
* TAR Format Plugin
*
* @module plugins/tar
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(43106);var Pe=z(56118);var $t=z(53296);var Tar=function(i){if(!(this instanceof Tar)){return new Tar(i)}i=this.options=$t.defaults(i,{gzip:false});if(typeof i.gzipOptions!=="object"){i.gzipOptions={}}this.supports={directory:true,symlink:true};this.engine=Pe.pack(i);this.compressor=false;if(i.gzip){this.compressor=re.createGzip(i.gzipOptions);this.compressor.on("error",this._onCompressorError.bind(this))}};Tar.prototype._onCompressorError=function(i){this.engine.emit("error",i)};Tar.prototype.append=function(i,_,z){var re=this;_.mtime=_.date;function append(i,Pe){if(i){z(i);return}re.engine.entry(_,Pe,(function(i){z(i,_)}))}if(_.sourceType==="buffer"){append(null,i)}else if(_.sourceType==="stream"&&_.stats){_.size=_.stats.size;var Pe=re.engine.entry(_,(function(i){z(i,_)}));i.pipe(Pe)}else if(_.sourceType==="stream"){$t.collectStream(i,append)}};Tar.prototype.finalize=function(){this.engine.finalize()};Tar.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Tar.prototype.pipe=function(i,_){if(this.compressor){return this.engine.pipe.apply(this.engine,[this.compressor]).pipe(i,_)}else{return this.engine.pipe.apply(this.engine,arguments)}};Tar.prototype.unpipe=function(){if(this.compressor){return this.compressor.unpipe.apply(this.compressor,arguments)}else{return this.engine.unpipe.apply(this.engine,arguments)}};i.exports=Tar},22836:(i,_,z)=>{
/**
* ZIP Format Plugin
*
* @module plugins/zip
* @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE}
* @copyright (c) 2012-2014 Chris Talkington, contributors.
*/
var re=z(41622);var Pe=z(53296);var Zip=function(i){if(!(this instanceof Zip)){return new Zip(i)}i=this.options=Pe.defaults(i,{comment:"",forceUTC:false,namePrependSlash:false,store:false});this.supports={directory:true,symlink:true};this.engine=new re(i)};Zip.prototype.append=function(i,_,z){this.engine.entry(i,_,z)};Zip.prototype.finalize=function(){this.engine.finalize()};Zip.prototype.on=function(){return this.engine.on.apply(this.engine,arguments)};Zip.prototype.pipe=function(){return this.engine.pipe.apply(this.engine,arguments)};Zip.prototype.unpipe=function(){return this.engine.unpipe.apply(this.engine,arguments)};i.exports=Zip},97329:function(i,_){(function(i,z){true?z(_):0})(this,(function(i){"use strict";function apply(i,..._){return(...z)=>i(..._,...z)}function initialParams(i){return function(..._){var z=_.pop();return i.call(this,_,z)}}var _=typeof queueMicrotask==="function"&&queueMicrotask;var z=typeof setImmediate==="function"&&setImmediate;var re=typeof process==="object"&&typeof process.nextTick==="function";function fallback(i){setTimeout(i,0)}function wrap(i){return(_,...z)=>i((()=>_(...z)))}var Pe;if(_){Pe=queueMicrotask}else if(z){Pe=setImmediate}else if(re){Pe=process.nextTick}else{Pe=fallback}var $t=wrap(Pe);function asyncify(i){if(isAsync(i)){return function(..._){const z=_.pop();const re=i.apply(this,_);return handlePromise(re,z)}}return initialParams((function(_,z){var re;try{re=i.apply(this,_)}catch(i){return z(i)}if(re&&typeof re.then==="function"){return handlePromise(re,z)}else{z(null,re)}}))}function handlePromise(i,_){return i.then((i=>{invokeCallback(_,null,i)}),(i=>{invokeCallback(_,i&&(i instanceof Error||i.message)?i:new Error(i))}))}function invokeCallback(i,_,z){try{i(_,z)}catch(i){$t((i=>{throw i}),i)}}function isAsync(i){return i[Symbol.toStringTag]==="AsyncFunction"}function isAsyncGenerator(i){return i[Symbol.toStringTag]==="AsyncGenerator"}function isAsyncIterable(i){return typeof i[Symbol.asyncIterator]==="function"}function wrapAsync(i){if(typeof i!=="function")throw new Error("expected a function");return isAsync(i)?asyncify(i):i}function awaitify(i,_){if(!_)_=i.length;if(!_)throw new Error("arity is undefined");function awaitable(...z){if(typeof z[_-1]==="function"){return i.apply(this,z)}return new Promise(((re,Pe)=>{z[_-1]=(i,..._)=>{if(i)return Pe(i);re(_.length>1?_:_[0])};i.apply(this,z)}))}return awaitable}function applyEach$1(i){return function applyEach(_,...z){const re=awaitify((function(re){var Pe=this;return i(_,((i,_)=>{wrapAsync(i).apply(Pe,z.concat(_))}),re)}));return re}}function _asyncMap(i,_,z,re){_=_||[];var Pe=[];var $t=0;var er=wrapAsync(z);return i(_,((i,_,z)=>{var re=$t++;er(i,((i,_)=>{Pe[re]=_;z(i)}))}),(i=>{re(i,Pe)}))}function isArrayLike(i){return i&&typeof i.length==="number"&&i.length>=0&&i.length%1===0}const er={};function once(i){function wrapper(..._){if(i===null)return;var z=i;i=null;z.apply(this,_)}Object.assign(wrapper,i);return wrapper}function getIterator(i){return i[Symbol.iterator]&&i[Symbol.iterator]()}function createArrayIterator(i){var _=-1;var z=i.length;return function next(){return++_<z?{value:i[_],key:_}:null}}function createES2015Iterator(i){var _=-1;return function next(){var z=i.next();if(z.done)return null;_++;return{value:z.value,key:_}}}function createObjectIterator(i){var _=i?Object.keys(i):[];var z=-1;var re=_.length;return function next(){var Pe=_[++z];if(Pe==="__proto__"){return next()}return z<re?{value:i[Pe],key:Pe}:null}}function createIterator(i){if(isArrayLike(i)){return createArrayIterator(i)}var _=getIterator(i);return _?createES2015Iterator(_):createObjectIterator(i)}function onlyOnce(i){return function(..._){if(i===null)throw new Error("Callback was already called.");var z=i;i=null;z.apply(this,_)}}function asyncEachOfLimit(i,_,z,re){let Pe=false;let $t=false;let tr=false;let rr=0;let nr=0;function replenish(){if(rr>=_||tr||Pe)return;tr=true;i.next().then((({value:i,done:_})=>{if($t||Pe)return;tr=false;if(_){Pe=true;if(rr<=0){re(null)}return}rr++;z(i,nr,iterateeCallback);nr++;replenish()})).catch(handleError)}function iterateeCallback(i,_){rr-=1;if($t)return;if(i)return handleError(i);if(i===false){Pe=true;$t=true;return}if(_===er||Pe&&rr<=0){Pe=true;return re(null)}replenish()}function handleError(i){if($t)return;tr=false;Pe=true;re(i)}replenish()}var eachOfLimit$2=i=>(_,z,re)=>{re=once(re);if(i<=0){throw new RangeError("concurrency limit cannot be less than 1")}if(!_){return re(null)}if(isAsyncGenerator(_)){return asyncEachOfLimit(_,i,z,re)}if(isAsyncIterable(_)){return asyncEachOfLimit(_[Symbol.asyncIterator](),i,z,re)}var Pe=createIterator(_);var $t=false;var tr=false;var rr=0;var nr=false;function iterateeCallback(i,_){if(tr)return;rr-=1;if(i){$t=true;re(i)}else if(i===false){$t=true;tr=true}else if(_===er||$t&&rr<=0){$t=true;return re(null)}else if(!nr){replenish()}}function replenish(){nr=true;while(rr<i&&!$t){var _=Pe();if(_===null){$t=true;if(rr<=0){re(null)}return}rr+=1;z(_.value,_.key,Line truncated
/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
var z;(function(i){if(typeof DO_NOT_EXPORT_CRC==="undefined"){if(true){i(_)}else{}}else{i(z={})}})((function(i){i.version="1.2.2";function signed_crc_table(){var i=0,_=new Array(256);for(var z=0;z!=256;++z){i=z;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;i=i&1?-306674912^i>>>1:i>>>1;_[z]=i}return typeof Int32Array!=="undefined"?new Int32Array(_):_}var _=signed_crc_table();function slice_by_16_tables(i){var _=0,z=0,re=0,Pe=typeof Int32Array!=="undefined"?new Int32Array(4096):new Array(4096);for(re=0;re!=256;++re)Pe[re]=i[re];for(re=0;re!=256;++re){z=i[re];for(_=256+re;_<4096;_+=256)z=Pe[_]=z>>>8^i[z&255]}var $t=[];for(re=1;re!=16;++re)$t[re-1]=typeof Int32Array!=="undefined"?Pe.subarray(re*256,re*256+256):Pe.slice(re*256,re*256+256);return $t}var z=slice_by_16_tables(_);var re=z[0],Pe=z[1],$t=z[2],er=z[3],tr=z[4];var rr=z[5],nr=z[6],ir=z[7],sr=z[8],or=z[9];var ar=z[10],Ar=z[11],lr=z[12],cr=z[13],dr=z[14];function crc32_bstr(i,z){var re=z^-1;for(var Pe=0,$t=i.length;Pe<$t;)re=re>>>8^_[(re^i.charCodeAt(Pe++))&255];return~re}function crc32_buf(i,z){var ur=z^-1,pr=i.length-15,hr=0;for(;hr<pr;)ur=dr[i[hr++]^ur&255]^cr[i[hr++]^ur>>8&255]^lr[i[hr++]^ur>>16&255]^Ar[i[hr++]^ur>>>24]^ar[i[hr++]]^or[i[hr++]]^sr[i[hr++]]^ir[i[hr++]]^nr[i[hr++]]^rr[i[hr++]]^tr[i[hr++]]^er[i[hr++]]^$t[i[hr++]]^Pe[i[hr++]]^re[i[hr++]]^_[i[hr++]];pr+=15;while(hr<pr)ur=ur>>>8^_[(ur^i[hr++])&255];return~ur}function crc32_str(i,z){var re=z^-1;for(var Pe=0,$t=i.length,er=0,tr=0;Pe<$t;){er=i.charCodeAt(Pe++);if(er<128){re=re>>>8^_[(re^er)&255]}else if(er<2048){re=re>>>8^_[(re^(192|er>>6&31))&255];re=re>>>8^_[(re^(128|er&63))&255]}else if(er>=55296&&er<57344){er=(er&1023)+64;tr=i.charCodeAt(Pe++)&1023;re=re>>>8^_[(re^(240|er>>8&7))&255];re=re>>>8^_[(re^(128|er>>2&63))&255];re=re>>>8^_[(re^(128|tr>>6&15|(er&3)<<4))&255];re=re>>>8^_[(re^(128|tr&63))&255]}else{re=re>>>8^_[(re^(224|er>>12&15))&255];re=re>>>8^_[(re^(128|er>>6&63))&255];re=re>>>8^_[(re^(128|er&63))&255]}}return~re}i.table=_;i.bstr=crc32_bstr;i.buf=crc32_buf;i.str=crc32_str}))},3662:(i,_,z)=>{const{Transform:re}=z(29963);const Pe=z(84891);class CRC32Stream extends re{constructor(i){super(i);this.checksum=Buffer.allocUnsafe(4);this.checksum.writeInt32BE(0,0);this.rawSize=0}_transform(i,_,z){if(i){this.checksum=Pe.buf(i,this.checksum)>>>0;this.rawSize+=i.length}z(null,i)}digest(i){const _=Buffer.allocUnsafe(4);_.writeUInt32BE(this.checksum>>>0,0);return i?_.toString(i):_}hex(){return this.digest("hex").toUpperCase()}size(){return this.rawSize}}i.exports=CRC32Stream},76252:(i,_,z)=>{const{DeflateRaw:re}=z(43106);const Pe=z(84891);class DeflateCRC32Stream extends re{constructor(i){super(i);this.checksum=Buffer.allocUnsafe(4);this.checksum.writeInt32BE(0,0);this.rawSize=0;this.compressedSize=0}push(i,_){if(i){this.compressedSize+=i.length}return super.push(i,_)}_transform(i,_,z){if(i){this.checksum=Pe.buf(i,this.checksum)>>>0;this.rawSize+=i.length}super._transform(i,_,z)}digest(i){const _=Buffer.allocUnsafe(4);_.writeUInt32BE(this.checksum>>>0,0);return i?_.toString(i):_}hex(){return this.digest("hex").toUpperCase()}size(i=false){if(i){return this.compressedSize}else{return this.rawSize}}}i.exports=DeflateCRC32Stream},82770:(i,_,z)=>{i.exports={CRC32Stream:z(3662),DeflateCRC32Stream:z(76252)}},6110:(i,_,z)=>{_.formatArgs=formatArgs;_.save=save;_.load=load;_.useColors=useColors;_.storage=localstorage();_.destroy=(()=>{let i=false;return()=>{if(!i){i=true;console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}}})();_.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function useColors(){if(typeof window!=="undefined"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)){return true}if(typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)){return false}let i;return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.cLine truncated
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* @copyright 2015 Toru Nagashima. All rights reserved.
* See LICENSE file in root directory for full license.
*/
Object.defineProperty(_,"__esModule",{value:true});const z=new WeakMap;const re=new WeakMap;function pd(i){const _=z.get(i);console.assert(_!=null,"'this' is expected an Event object, but got",i);return _}function setCancelFlag(i){if(i.passiveListener!=null){if(typeof console!=="undefined"&&typeof console.error==="function"){console.error("Unable to preventDefault inside passive event listener invocation.",i.passiveListener)}return}if(!i.event.cancelable){return}i.canceled=true;if(typeof i.event.preventDefault==="function"){i.event.preventDefault()}}function Event(i,_){z.set(this,{eventTarget:i,event:_,eventPhase:2,currentTarget:i,canceled:false,stopped:false,immediateStopped:false,passiveListener:null,timeStamp:_.timeStamp||Date.now()});Object.defineProperty(this,"isTrusted",{value:false,enumerable:true});const re=Object.keys(_);for(let i=0;i<re.length;++i){const _=re[i];if(!(_ in this)){Object.defineProperty(this,_,defineRedirectDescriptor(_))}}}Event.prototype={get type(){return pd(this).event.type},get target(){return pd(this).eventTarget},get currentTarget(){return pd(this).currentTarget},composedPath(){const i=pd(this).currentTarget;if(i==null){return[]}return[i]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return pd(this).eventPhase},stopPropagation(){const i=pd(this);i.stopped=true;if(typeof i.event.stopPropagation==="function"){i.event.stopPropagation()}},stopImmediatePropagation(){const i=pd(this);i.stopped=true;i.immediateStopped=true;if(typeof i.event.stopImmediatePropagation==="function"){i.event.stopImmediatePropagation()}},get bubbles(){return Boolean(pd(this).event.bubbles)},get cancelable(){return Boolean(pd(this).event.cancelable)},preventDefault(){setCancelFlag(pd(this))},get defaultPrevented(){return pd(this).canceled},get composed(){return Boolean(pd(this).event.composed)},get timeStamp(){return pd(this).timeStamp},get srcElement(){return pd(this).eventTarget},get cancelBubble(){return pd(this).stopped},set cancelBubble(i){if(!i){return}const _=pd(this);_.stopped=true;if(typeof _.event.cancelBubble==="boolean"){_.event.cancelBubble=true}},get returnValue(){return!pd(this).canceled},set returnValue(i){if(!i){setCancelFlag(pd(this))}},initEvent(){}};Object.defineProperty(Event.prototype,"constructor",{value:Event,configurable:true,writable:true});if(typeof window!=="undefined"&&typeof window.Event!=="undefined"){Object.setPrototypeOf(Event.prototype,window.Event.prototype);re.set(window.Event.prototype,Event)}function defineRedirectDescriptor(i){return{get(){return pd(this).event[i]},set(_){pd(this).event[i]=_},configurable:true,enumerable:true}}function defineCallDescriptor(i){return{value(){const _=pd(this).event;return _[i].apply(_,arguments)},configurable:true,enumerable:true}}function defineWrapper(i,_){const z=Object.keys(_);if(z.length===0){return i}function CustomEvent(_,z){i.call(this,_,z)}CustomEvent.prototype=Object.create(i.prototype,{constructor:{value:CustomEvent,configurable:true,writable:true}});for(let re=0;re<z.length;++re){const Pe=z[re];if(!(Pe in i.prototype)){const i=Object.getOwnPropertyDescriptor(_,Pe);const z=typeof i.value==="function";Object.defineProperty(CustomEvent.prototype,Pe,z?defineCallDescriptor(Pe):defineRedirectDescriptor(Pe))}}return CustomEvent}function getWrapper(i){if(i==null||i===Object.prototype){return Event}let _=re.get(i);if(_==null){_=defineWrapper(getWrapper(Object.getPrototypeOf(i)),i);re.set(i,_)}return _}function wrapEvent(i,_){const z=getWrapper(Object.getPrototypeOf(_));return new z(i,_)}function isStopped(i){return pd(i).immediateStopped}function setEventPhase(i,_){pd(i).eventPhase=_}function setCurrentTarget(i,_){pd(i).currentTarget=_}function setPassiveListener(i,_){pd(i).passiveListener=_}const Pe=new WeakMap;const $t=1;const er=2;const tr=3;function isObject(i){return i!==null&&typeof i==="object"}function getListeners(i){const _=Pe.get(i);if(_==null){throw new TypeError("'this' is expected an EventTarget object, but got another value.")}return _}function defineEventAttributeDescriptor(i){return{get(){const _=getListeners(this);let z=_.get(i);while(z!=null){if(z.listenerType===tr){return z.listener}z=z.next}return null},set(_){if(typeof _!=="function"&&!isObject(_)){_=null}const z=getListeners(this);let re=null;let Pe=z.get(i);while(Pe!=null){if(Pe.listenerType===tr){if(re!==null){re.next=Pe.next}else if(Pe.next!==null){z.set(i,Pe.next)}else{z.delete(i)}}else{re=Pe}Pe=Pe.next}if(_!==null){const Pe={listener:_,listenerType:tr,passive:false,once:false,next:null};if(re===null){z.set(i,Pe)}else{re.next=Pe}}},configurable:true,enumerable:true}}function defineEventAttribute(i,_){Object.defineProperty(i,`on${_}`,defineEventAttributeDescriptor(_))}function defineCustomEventTarget(i){function CustomEventTarget(){EventTarget.call(this)}CustomEventTarget.prototype=Object.create(EventTarget.prototype,{constructor:{value:CustomEventTarget,configurable:true,writaLine truncated
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(i){return Object.prototype.toString.call(i)==="[object Object]"}function isPlainObject(i){var _,z;if(isObject(i)===false)return false;_=i.constructor;if(_===undefined)return true;z=_.prototype;if(isObject(z)===false)return false;if(z.hasOwnProperty("isPrototypeOf")===false){return false}return true}_.isPlainObject=isPlainObject},96543:i=>{const isStream=i=>i!==null&&typeof i==="object"&&typeof i.pipe==="function";isStream.writable=i=>isStream(i)&&i.writable!==false&&typeof i._write==="function"&&typeof i._writableState==="object";isStream.readable=i=>isStream(i)&&i.readable!==false&&typeof i._read==="function"&&typeof i._readableState==="object";isStream.duplex=i=>isStream.writable(i)&&isStream.readable(i);isStream.transform=i=>isStream.duplex(i)&&typeof i._transform==="function";i.exports=isStream},82513:i=>{var _={}.toString;i.exports=Array.isArray||function(i){return _.call(i)=="[object Array]"}},79699:i=>{function e(i){this.message=i}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var _="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(i){var _=String(i).replace(/=+$/,"");if(_.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var z,re,Pe=0,$t=0,er="";re=_.charAt($t++);~re&&(z=Pe%4?64*z+re:re,Pe++%4)?er+=String.fromCharCode(255&z>>(-2*Pe&6)):0)re="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(re);return er};function t(i){var z=i.replace(/-/g,"+").replace(/_/g,"/");switch(z.length%4){case 0:break;case 2:z+="==";break;case 3:z+="=";break;default:throw"Illegal base64url string!"}try{return function(i){return decodeURIComponent(_(i).replace(/(.)/g,(function(i,_){var z=_.charCodeAt(0).toString(16).toUpperCase();return z.length<2&&(z="0"+z),"%"+z})))}(z)}catch(i){return _(z)}}function n(i){this.message=i}function o(i,_){if("string"!=typeof i)throw new n("Invalid token specified");var z=!0===(_=_||{}).header?0:1;try{return JSON.parse(t(i.split(".")[z]))}catch(i){throw new n("Invalid token specified: "+i.message)}}n.prototype=new Error,n.prototype.name="InvalidTokenError";const z=o;z.default=o,z.InvalidTokenError=n,i.exports=z},32126:(i,_,z)=>{var re=z(39023);var Pe=z(1835);i.exports={Readable:Readable,Writable:Writable};re.inherits(Readable,Pe);re.inherits(Writable,Pe);function beforeFirstCall(i,_,z){i[_]=function(){delete i[_];z.apply(this,arguments);return this[_].apply(this,arguments)}}function Readable(i,_){if(!(this instanceof Readable))return new Readable(i,_);Pe.call(this,_);beforeFirstCall(this,"_read",(function(){var z=i.call(this,_);var re=this.emit.bind(this,"error");z.on("error",re);z.pipe(this)}));this.emit("readable")}function Writable(i,_){if(!(this instanceof Writable))return new Writable(i,_);Pe.call(this,_);beforeFirstCall(this,"_write",(function(){var z=i.call(this,_);var re=this.emit.bind(this,"error");z.on("error",re);this.pipe(z)}));this.emit("writable")}},34793:(i,_,z)=>{var re=z(19183);var Pe=Object.keys||function(i){var _=[];for(var z in i){_.push(z)}return _};i.exports=Duplex;var $t=Object.create(z(45481));$t.inherits=z(39598);var er=z(74559);var tr=z(54579);$t.inherits(Duplex,er);{var rr=Pe(tr.prototype);for(var nr=0;nr<rr.length;nr++){var ir=rr[nr];if(!Duplex.prototype[ir])Duplex.prototype[ir]=tr.prototype[ir]}}function Duplex(i){if(!(this instanceof Duplex))return new Duplex(i);er.call(this,i);tr.call(this,i);if(i&&i.readable===false)this.readable=false;if(i&&i.writable===false)this.writable=false;this.allowHalfOpen=true;if(i&&i.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}Object.defineProperty(Duplex.prototype,"writableHighWaterMark",{enumerable:false,get:function(){return this._writableState.highWaterMark}});function onend(){if(this.allowHalfOpen||this._writableState.ended)return;re.nextTick(onEndNT,this)}function onEndNT(i){i.end()}Object.defineProperty(Duplex.prototype,"destroyed",{get:function(){if(this._readableState===undefined||this._writableState===undefined){return false}return this._readableState.destroyed&&this._writableState.destroyed},set:function(i){if(this._readableState===undefined||this._writableState===undefined){return}this._readableState.destroyed=i;this._writableState.destroyed=i}});Duplex.prototype._destroy=function(i,_){this.push(null);this.end();re.nextTick(_,i)}},72029:(i,_,z)=>{i.exports=PassThrough;var re=z(69343);var Pe=Object.create(z(45481));Pe.inherits=z(39598);Pe.inherits(PassThrough,re);function PassThrough(i){if(!(this instanceof PassThrough))return new PassThrough(i);re.call(this,i)}PassThrough.prototype._transform=function(i,_,z){z(null,i)}},74559:(i,_,z)=>{var re=z(19183);i.exports=Readable;var Pe=z(82513);var $t;Readable.ReadableState=ReadableState;var er=z(24434).EventEmitter;var EElistenerCount=function(i,_){return i.listeners(_).length};var tr=z(87137);var rr=z(13644).Buffer;var nr=(typeof global!=="undefined"?global:typeof window!=="undefined"?window:typeof self!=="undefined"?selLine truncated
import{createRequire as A}from"module";var i={7884:(A,i,g)=>{var E;E={value:true};i.v=void 0;const p=g(6856);function create(){return p.DefaultArtifactClient.create()}i.v=create},6856:function(A,i,g){var E=this&&this.__createBinding||(Object.create?function(A,i,g,E){if(E===undefined)E=g;var p=Object.getOwnPropertyDescriptor(i,g);if(!p||("get"in p?!i.__esModule:p.writable||p.configurable)){p={enumerable:true,get:function(){return i[g]}}}Object.defineProperty(A,E,p)}:function(A,i,g,E){if(E===undefined)E=g;A[E]=i[g]});var p=this&&this.__setModuleDefault||(Object.create?function(A,i){Object.defineProperty(A,"default",{enumerable:true,value:i})}:function(A,i){A["default"]=i});var C=this&&this.__importStar||function(A){if(A&&A.__esModule)return A;var i={};if(A!=null)for(var g in A)if(g!=="default"&&Object.prototype.hasOwnProperty.call(A,g))E(i,A,g);p(i,A);return i};var f=this&&this.__awaiter||function(A,i,g,E){function adopt(A){return A instanceof g?A:new g((function(i){i(A)}))}return new(g||(g=Promise))((function(g,p){function fulfilled(A){try{step(E.next(A))}catch(A){p(A)}}function rejected(A){try{step(E["throw"](A))}catch(A){p(A)}}function step(A){A.done?g(A.value):adopt(A.value).then(fulfilled,rejected)}step((E=E.apply(A,i||[])).next())}))};Object.defineProperty(i,"__esModule",{value:true});i.DefaultArtifactClient=void 0;const Q=C(g(4086));const B=g(5973);const I=g(6036);const y=g(1631);const b=g(1774);const D=g(809);const R=g(1280);const k=g(9562);const S=g(6928);class DefaultArtifactClient{static create(){return new DefaultArtifactClient}uploadArtifact(A,i,g,E){return f(this,void 0,void 0,(function*(){Q.info(`Starting artifact upload\nFor more detailed logs during the artifact upload process, enable step-debugging: https://docs.github.com/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging#enabling-step-debug-logging`);(0,b.checkArtifactName)(A);const p=(0,B.getUploadSpecification)(A,g,i);const C={artifactName:A,artifactItems:[],size:0,failedItems:[]};const f=new I.UploadHttpClient;if(p.length===0){Q.warning(`No files found that can be uploaded`)}else{const i=yield f.createArtifactInFileContainer(A,E);if(!i.fileContainerResourceUrl){Q.debug(i.toString());throw new Error("No URL provided by the Artifact Service to upload an artifact to")}Q.debug(`Upload Resource URL: ${i.fileContainerResourceUrl}`);Q.info(`Container for artifact "${A}" successfully created. Starting upload of file(s)`);const g=yield f.uploadArtifactToFileContainer(i.fileContainerResourceUrl,p,E);Q.info(`File upload process has finished. Finalizing the artifact upload`);yield f.patchArtifactSize(g.totalSize,A);if(g.failedItems.length>0){Q.info(`Upload finished. There were ${g.failedItems.length} items that failed to upload`)}else{Q.info(`Artifact has been finalized. All files have been successfully uploaded!`)}Q.info(`\nThe raw size of all the files that were specified for upload is ${g.totalSize} bytes\nThe size of all the files that were uploaded is ${g.uploadSize} bytes. This takes into account any gzip compression used to reduce the upload size, time and storage\n\nNote: The size of downloaded zips can differ significantly from the reported size. For more information see: https://github.com/actions/upload-artifact#zipped-artifact-downloads \r\n`);C.artifactItems=p.map((A=>A.absoluteFilePath));C.size=g.uploadSize;C.failedItems=g.failedItems}return C}))}downloadArtifact(A,i,g){return f(this,void 0,void 0,(function*(){const E=new D.DownloadHttpClient;const p=yield E.listArtifacts();if(p.count===0){throw new Error(`Unable to find any artifacts for the associated workflow`)}const C=p.value.find((i=>i.name===A));if(!C){throw new Error(`Unable to find an artifact with the name: ${A}`)}const f=yield E.getContainerItems(C.name,C.fileContainerResourceUrl);if(!i){i=(0,k.getWorkSpaceDirectory)()}i=(0,S.normalize)(i);i=(0,S.resolve)(i);const B=(0,R.getDownloadSpecification)(A,f.value,i,(g===null||g===void 0?void 0:g.createArtifactFolder)||false);if(B.filesToDownload.length===0){Q.info(`No downloadable files were found for the artifact: ${C.name}`)}else{yield(0,y.createDirectoriesForArtifact)(B.directoryStructure);Q.info("Directory structure has been set up for the artifact");yield(0,y.createEmptyFilesForArtifact)(B.emptyFilesToCreate);yield E.downloadSingleArtifact(B.filesToDownload)}return{artifactName:A,downloadPath:B.rootDownloadLocation}}))}downloadAllArtifacts(A){return f(this,void 0,void 0,(function*(){const i=new D.DownloadHttpClient;const g=[];const E=yield i.listArtifacts();if(E.count===0){Q.info("Unable to find any artifacts for the associated workflow");return g}if(!A){A=(0,k.getWorkSpaceDirectory)()}A=(0,S.normalize)(A);A=(0,S.resolve)(A);let p=0;while(p<E.count){const C=E.value[p];p+=1;Q.info(`starting download of artifact ${C.name} : ${p}/${E.count}`);const f=yield i.getContainerItems(C.name,C.fileContainerResourceUrl);const B=(0,R.getDownloadSpecification)(C.name,f.value,A,true);if(B.filesToDownload.length===0){Q.inLine truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=A=>A.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=A=>A.replace(/\r?\n|\r/g,"\r\n");const E=[];const p=new Uint8Array([13,10]);b=0;let C=false;for(const[i,f]of A){if(typeof f==="string"){const A=P.encode(g+`; name="${escape(normalizeLinefeeds(i))}"`+`\r\n\r\n${normalizeLinefeeds(f)}\r\n`);E.push(A);b+=A.byteLength}else{const A=P.encode(`${g}; name="${escape(normalizeLinefeeds(i))}"`+(f.name?`; filename="${escape(f.name)}"`:"")+"\r\n"+`Content-Type: ${f.type||"application/octet-stream"}\r\n\r\n`);E.push(A,f,p);if(typeof f.size==="number"){b+=A.byteLength+f.size+p.byteLength}else{C=true}}}const f=P.encode(`--${i}--`);E.push(f);b+=f.byteLength;if(C){b=null}y=A;I=async function*(){for(const A of E){if(A.stream){yield*A.stream()}else{yield A}}};D="multipart/form-data; boundary="+i}else if(f(A)){y=A;b=A.size;if(A.type){D=A.type}}else if(typeof A[Symbol.asyncIterator]==="function"){if(i){throw new TypeError("keepalive")}if(p.isDisturbed(A)||A.locked){throw new TypeError("Response body object should not be disturbed or locked")}E=A instanceof _?A:C(A)}if(typeof y==="string"||p.isBuffer(y)){b=Buffer.byteLength(y)}if(I!=null){let i;E=new _({async start(){i=I(A)[Symbol.asyncIterator]()},async pull(A){const{value:g,done:p}=await i.next();if(p){queueMicrotask((()=>{A.close()}))}else{if(!L(E)){A.enqueue(new Uint8Array(g))}}return A.desiredSize>0},async cancel(A){await i.return()},type:undefined})}const R={stream:E,source:y,length:b};return[R,D]}function safelyExtractBody(A,i=false){if(!_){_=g(3774).ReadableStream}if(A instanceof _){U(!p.isDisturbed(A),"The body has already been consumed.");U(!A.locked,"The stream is locked.")}return extractBody(A,i)}function cloneBody(A){const[i,g]=A.stream.tee();const E=S(g,{transfer:[g]});const[,p]=E.tee();A.stream=i;return{stream:p,length:A.length,source:A.source}}async function*consumeBody(A){if(A){if(M(A)){yield A}else{const i=A.stream;if(p.isDisturbed(i)){throw new TypeError("The body has already been consumed.")}if(i.locked){throw new TypeError("The stream is locked.")}i[x]=true;yield*i}}}function throwIfAborted(A){if(A.aborted){throw new k("The operation was aborted.","AbortError")}}function bodyMixinMethods(A){const i={blob(){return specConsumeBody(this,(A=>{let i=bodyMimeType(this);if(i==="failure"){i=""}else if(i){i=Y(i)}return new v([A],{type:i})}),A)},arrayBuffer(){return specConsumeBody(this,(A=>new Uint8Array(A).buffer),A)},text(){return specConsumeBody(this,utf8DecodeBytes,A)},json(){return specConsumeBody(this,parseJSONFromBytes,A)},async formData(){R.brandCheck(this,A);throwIfAborted(this[D]);const i=this.headers.get("Content-Type");if(/multipart\/form-data/.test(i)){const A={};for(const[i,g]of this.headers)A[i.toLowerCase()]=g;const i=new b;let g;try{g=new E({headers:A,preservePath:true})}catch(A){throw new k(`${A}`,"AbortError")}g.on("field",((A,g)=>{i.append(A,g)}));g.on("file",((A,g,E,p,C)=>{const f=[];if(p==="base64"||p.toLowerCase()==="base64"){let p="";g.on("data",(A=>{p+=A.toString().replace(/[\r\n]/gm,"");const i=p.length-p.length%4;f.push(Buffer.from(p.slice(0,i),"base64"));p=p.slice(i)}));g.on("end",(()=>{f.push(Buffer.from(p,"base64"));i.append(A,new V(f,E,{type:C}))}))}else{g.on("data",(A=>{f.push(A)}));g.on("end",(()=>{i.append(A,new V(f,E,{type:C}))}))}}));const p=new Promise(((A,i)=>{g.on("finish",A);g.on("error",(A=>i(new TypeError(A))))}));if(this.body!==null)for await(const A of consumeBody(this[D].body))g.write(A);g.end();await p;return i}else if(/application\/x-www-form-urlencoded/.test(i)){let A;try{let i="";const g=new TextDecoder("utf-8",{ignoreBOM:true});for await(const A of consumeBody(this[D].body)){if(!M(A)){throw new TypeError("Expected Uint8Array chunk")}i+=g.decode(A,{stream:true})}i+=g.decode();A=new URLSearchParams(i)}catch(A){throw Object.assign(new TypeError,{cause:A})}const i=new b;for(const[g,E]of A){i.append(g,E)}return i}else{await Promise.resolve();throwIfAborted(this[D]);throw R.errors.exception({header:`${A.name}.formData`,message:"Could not parse content as FormData."})}}};return i}function mixinBody(A){Object.assign(A.prototype,bodyMixinMethods(A))}async function specConsumeBody(A,i,g){R.brandCheck(A,g);throwIfAborted(A[D]);if(bodyUnusable(A[D].body)){throw new TypeError("Body is unusable")}const E=I();const errorSteps=A=>E.reject(A);const successSteps=A=>{try{E.resolve(i(A))}catch(A){errorSteps(A)}};if(A[D].body==null){successSteps(new Uint8Array);return E.promise}await y(A[D].body,successSteps,errorSteps);return E.promise}function bodyUnusable(A){return A!=null&&(A.stream.locked||p.isDisturbed(A.stream))}function utf8DecodeBytes(A){if(A.length===0){return""}if(A[0]===239&&A[1]===187&&A[2]===191){A=A.subarray(3)}const i=j.decode(A);return i}function parseJSONFromBytes(A){return JSON.parse(utf8DecodeBytes(A))}function bodyMimeType(A){const{headersList:i}=A[D];const g=i.get("content-Line truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */C[p-4]=this.maskKey[0];C[p-3]=this.maskKey[1];C[p-2]=this.maskKey[2];C[p-1]=this.maskKey[3];C[1]=g;if(g===126){C.writeUInt16BE(i,2)}else if(g===127){C[2]=C[3]=0;C.writeUIntBE(i,4,6)}C[1]|=128;for(let A=0;A<i;A++){C[p+A]=this.frameData[A]^this.maskKey[A%4]}return C}}A.exports={WebsocketFrameSend:WebsocketFrameSend}},5553:(A,i,g)=>{const{Writable:E}=g(2203);const p=g(1637);const{parserStates:C,opcodes:f,states:Q,emptyBuffer:B}=g(1859);const{kReadyState:I,kSentClose:y,kResponse:b,kReceivedClose:D}=g(5199);const{isValidStatusCode:R,failWebsocketConnection:k,websocketMessageReceived:S}=g(4604);const{WebsocketFrameSend:v}=g(231);const F={};F.ping=p.channel("undici:websocket:ping");F.pong=p.channel("undici:websocket:pong");class ByteParser extends E{#n=[];#o=0;#a=C.INFO;#c={};#l=[];constructor(A){super();this.ws=A}_write(A,i,g){this.#n.push(A);this.#o+=A.length;this.run(g)}run(A){while(true){if(this.#a===C.INFO){if(this.#o<2){return A()}const i=this.consume(2);this.#c.fin=(i[0]&128)!==0;this.#c.opcode=i[0]&15;this.#c.originalOpcode??=this.#c.opcode;this.#c.fragmented=!this.#c.fin&&this.#c.opcode!==f.CONTINUATION;if(this.#c.fragmented&&this.#c.opcode!==f.BINARY&&this.#c.opcode!==f.TEXT){k(this.ws,"Invalid frame type was fragmented.");return}const g=i[1]&127;if(g<=125){this.#c.payloadLength=g;this.#a=C.READ_DATA}else if(g===126){this.#a=C.PAYLOADLENGTH_16}else if(g===127){this.#a=C.PAYLOADLENGTH_64}if(this.#c.fragmented&&g>125){k(this.ws,"Fragmented frame exceeded 125 bytes.");return}else if((this.#c.opcode===f.PING||this.#c.opcode===f.PONG||this.#c.opcode===f.CLOSE)&&g>125){k(this.ws,"Payload length for control frame exceeded 125 bytes.");return}else if(this.#c.opcode===f.CLOSE){if(g===1){k(this.ws,"Received close frame with a 1-byte body.");return}const A=this.consume(g);this.#c.closeInfo=this.parseCloseBody(false,A);if(!this.ws[y]){const A=Buffer.allocUnsafe(2);A.writeUInt16BE(this.#c.closeInfo.code,0);const i=new v(A);this.ws[b].socket.write(i.createFrame(f.CLOSE),(A=>{if(!A){this.ws[y]=true}}))}this.ws[I]=Q.CLOSING;this.ws[D]=true;this.end();return}else if(this.#c.opcode===f.PING){const i=this.consume(g);if(!this.ws[D]){const A=new v(i);this.ws[b].socket.write(A.createFrame(f.PONG));if(F.ping.hasSubscribers){F.ping.publish({payload:i})}}this.#a=C.INFO;if(this.#o>0){continue}else{A();return}}else if(this.#c.opcode===f.PONG){const i=this.consume(g);if(F.pong.hasSubscribers){F.pong.publish({payload:i})}if(this.#o>0){continue}else{A();return}}}else if(this.#a===C.PAYLOADLENGTH_16){if(this.#o<2){return A()}const i=this.consume(2);this.#c.payloadLength=i.readUInt16BE(0);this.#a=C.READ_DATA}else if(this.#a===C.PAYLOADLENGTH_64){if(this.#o<8){return A()}const i=this.consume(8);const g=i.readUInt32BE(0);if(g>2**31-1){k(this.ws,"Received payload length > 2^31 bytes.");return}const E=i.readUInt32BE(4);this.#c.payloadLength=(g<<8)+E;this.#a=C.READ_DATA}else if(this.#a===C.READ_DATA){if(this.#o<this.#c.payloadLength){return A()}else if(this.#o>=this.#c.payloadLength){const A=this.consume(this.#c.payloadLength);this.#l.push(A);if(!this.#c.fragmented||this.#c.fin&&this.#c.opcode===f.CONTINUATION){const A=Buffer.concat(this.#l);S(this.ws,this.#c.originalOpcode,A);this.#c={};this.#l.length=0}this.#a=C.INFO}}if(this.#o>0){continue}else{A();break}}}consume(A){if(A>this.#o){return null}else if(A===0){return B}if(this.#n[0].length===A){this.#o-=this.#n[0].length;return this.#n.shift()}const i=Buffer.allocUnsafe(A);let g=0;while(g!==A){const E=this.#n[0];const{length:p}=E;if(p+g===A){i.set(this.#n.shift(),g);break}else if(p+g>A){i.set(E.subarray(0,A-g),g);this.#n[0]=E.subarray(A-g);break}else{i.set(this.#n.shift(),g);g+=E.length}}this.#o-=A;return i}parseCloseBody(A,i){let g;if(i.length>=2){g=i.readUInt16BE(0)}if(A){if(!R(g)){return null}return{code:g}}let E=i.subarray(2);if(E[0]===239&&E[1]===187&&E[2]===191){E=E.subarray(3)}if(g!==undefined&&!R(g)){return null}try{E=new TextDecoder("utf-8",{fatal:true}).decode(E)}catch{return null}return{code:g,reason:E}}get closingInfo(){return this.#c.closeInfo}}A.exports={ByteParser:ByteParser}},5199:A=>{A.exports={kWebSocketURL:Symbol("url"),kReadyState:Symbol("ready state"),kController:Symbol("controller"),kResponse:Symbol("response"),kBinaryType:Symbol("binary type"),kSentClose:Symbol("sent close"),kReceivedClose:Symbol("received close"),kByteParser:Symbol("byte parser")}},4604:(A,i,g)=>{const{kReadyState:E,kController:p,kResponse:C,kBinaryType:f,kWebSocketURL:Q}=g(5199);const{states:B,opcodes:I}=g(1859);const{MessageEvent:y,ErrorEvent:b}=g(3273);function isEstablished(A){return A[E]===B.OPEN}function isClosing(A){return A[E]===B.CLOSING}function isClosed(A){return A[E]===B.CLOSED}function fireEvent(A,i,g=Event,E){const p=new g(A,E);i.dispatchEvent(p)}function websocketMessageReceived(A,i,g){if(A[E]!==B.OPEN){return}let p;if(i===I.TEXT){try{p=new TextDecoder("utf-8",{fatal:true}).decode(g)}catch{failWebsocketConnection(A,"ReceivLine truncated
/*!
* mime-db
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015-2022 Douglas Christopher Wilson
* MIT Licensed
*/
i.exports=z(81813)},14096:(i,_,z)=>{
A.exports=g(1813)},4096:(A,i,g)=>{
/*!
* mime-types
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
var re=z(99829);var Pe=z(16928).extname;var $t=/^\s*([^;\s]*)(?:;|\s|$)/;var er=/^text\//i;_.charset=charset;_.charsets={lookup:charset};_.contentType=contentType;_.extension=extension;_.extensions=Object.create(null);_.lookup=lookup;_.types=Object.create(null);populateMaps(_.extensions,_.types);function charset(i){if(!i||typeof i!=="string"){return false}var _=$t.exec(i);var z=_&&re[_[1].toLowerCase()];if(z&&z.charset){return z.charset}if(_&&er.test(_[1])){return"UTF-8"}return false}function contentType(i){if(!i||typeof i!=="string"){return false}var z=i.indexOf("/")===-1?_.lookup(i):i;if(!z){return false}if(z.indexOf("charset")===-1){var re=_.charset(z);if(re)z+="; charset="+re.toLowerCase()}return z}function extension(i){if(!i||typeof i!=="string"){return false}var z=$t.exec(i);var re=z&&_.extensions[z[1].toLowerCase()];if(!re||!re.length){return false}return re[0]}function lookup(i){if(!i||typeof i!=="string"){return false}var z=Pe("x."+i).toLowerCase().substr(1);if(!z){return false}return _.types[z]||false}function populateMaps(i,_){var z=["nginx","apache",undefined,"iana"];Object.keys(re).forEach((function forEachMimeType(Pe){var $t=re[Pe];var er=$t.extensions;if(!er||!er.length){return}i[Pe]=er;for(var tr=0;tr<er.length;tr++){var rr=er[tr];if(_[rr]){var nr=z.indexOf(re[_[rr]].source);var ir=z.indexOf($t.source);if(_[rr]!=="application/octet-stream"&&(nr>ir||nr===ir&&_[rr].substr(0,12)==="application/")){continue}}_[rr]=Pe}}))}},4469:(i,_,z)=>{var re=z(16928);var Pe=z(79896);var $t=parseInt("0777",8);i.exports=mkdirP.mkdirp=mkdirP.mkdirP=mkdirP;function mkdirP(i,_,z,er){if(typeof _==="function"){z=_;_={}}else if(!_||typeof _!=="object"){_={mode:_}}var tr=_.mode;var rr=_.fs||Pe;if(tr===undefined){tr=$t}if(!er)er=null;var nr=z||function(){};i=re.resolve(i);rr.mkdir(i,tr,(function(z){if(!z){er=er||i;return nr(null,er)}switch(z.code){case"ENOENT":if(re.dirname(i)===i)return nr(z);mkdirP(re.dirname(i),_,(function(z,re){if(z)nr(z,re);else mkdirP(i,_,nr,re)}));break;default:rr.stat(i,(function(i,_){if(i||!_.isDirectory())nr(z,er);else nr(null,er)}));break}}))}mkdirP.sync=function sync(i,_,z){if(!_||typeof _!=="object"){_={mode:_}}var er=_.mode;var tr=_.fs||Pe;if(er===undefined){er=$t}if(!z)z=null;i=re.resolve(i);try{tr.mkdirSync(i,er);z=z||i}catch(Pe){switch(Pe.code){case"ENOENT":z=sync(re.dirname(i),_,z);sync(i,_,z);break;default:var rr;try{rr=tr.statSync(i)}catch(i){throw Pe}if(!rr.isDirectory())throw Pe;break}}return z}},70744:i=>{var _=1e3;var z=_*60;var re=z*60;var Pe=re*24;var $t=Pe*7;var er=Pe*365.25;i.exports=function(i,_){_=_||{};var z=typeof i;if(z==="string"&&i.length>0){return parse(i)}else if(z==="number"&&isFinite(i)){return _.long?fmtLong(i):fmtShort(i)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(i))};function parse(i){i=String(i);if(i.length>100){return}var tr=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(i);if(!tr){return}var rr=parseFloat(tr[1]);var nr=(tr[2]||"ms").toLowerCase();switch(nr){case"years":case"year":case"yrs":case"yr":case"y":return rr*er;case"weeks":case"week":case"w":return rr*$t;case"days":case"day":case"d":return rr*Pe;case"hours":case"hour":case"hrs":case"hr":case"h":return rr*re;case"minutes":case"minute":case"mins":case"min":case"m":return rr*z;case"seconds":case"second":case"secs":case"sec":case"s":return rr*_;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return rr;default:return undefined}}function fmtShort(i){var $t=Math.abs(i);if($t>=Pe){return Math.round(i/Pe)+"d"}if($t>=re){return Math.round(i/re)+"h"}if($t>=z){return Math.round(i/z)+"m"}if($t>=_){return Math.round(i/_)+"s"}return i+"ms"}function fmtLong(i){var $t=Math.abs(i);if($t>=Pe){return plural(i,$t,Pe,"day")}if($t>=re){return plural(i,$t,re,"hour")}if($t>=z){return plural(i,$t,z,"minute")}if($t>=_){return plural(i,$t,_,"second")}return i+" ms"}function plural(i,_,z,re){var Pe=_>=z*1.5;return Math.round(i/z)+" "+re+(Pe?"s":"")}},26705:(i,_,z)=>{Object.defineProperty(_,"__esModule",{value:true});function _interopDefault(i){return i&&typeof i==="object"&&"default"in i?i["default"]:i}var re=_interopDefault(z(2203));var Pe=_interopDefault(z(58611));var $t=_interopDefault(z(87016));var er=_interopDefault(z(62686));var tr=_interopDefault(z(65692));var rr=_interopDefault(z(43106));const nr=re.Readable;const ir=Symbol("buffer");const sr=Symbol("type");class Blob{constructor(){this[sr]="";const i=arguments[0];const _=arguments[1];const z=[];let re=0;if(i){const _=i;const Pe=Number(_.length);for(let i=0;i<Pe;i++){const Pe=_[i];let $t;if(Pe instanceof Buffer){$t=Pe}else if(ArrayBuffer.isView(Pe)){$t=Buffer.from(Pe.buffer,Pe.byteOffset,Pe.byteLength)}else if(Pe instanceof ArrayBuffer){$t=Buffer.from(Pe)}else if(Pe instanceof Blob){$t=Pe[ir]}else{$t=Buffer.from(typeof Pe==="string"?Pe:String(Pe))}re+=$t.length;z.push($t)}}this[ir]=Buffer.concat(z);let Pe=_&&_.type!==Line truncated
var E=g(9829);var p=g(6928).extname;var C=/^\s*([^;\s]*)(?:;|\s|$)/;var f=/^text\//i;i.charset=charset;i.charsets={lookup:charset};i.contentType=contentType;i.extension=extension;i.extensions=Object.create(null);i.lookup=lookup;i.types=Object.create(null);populateMaps(i.extensions,i.types);function charset(A){if(!A||typeof A!=="string"){return false}var i=C.exec(A);var g=i&&E[i[1].toLowerCase()];if(g&&g.charset){return g.charset}if(i&&f.test(i[1])){return"UTF-8"}return false}function contentType(A){if(!A||typeof A!=="string"){return false}var g=A.indexOf("/")===-1?i.lookup(A):A;if(!g){return false}if(g.indexOf("charset")===-1){var E=i.charset(g);if(E)g+="; charset="+E.toLowerCase()}return g}function extension(A){if(!A||typeof A!=="string"){return false}var g=C.exec(A);var E=g&&i.extensions[g[1].toLowerCase()];if(!E||!E.length){return false}return E[0]}function lookup(A){if(!A||typeof A!=="string"){return false}var g=p("x."+A).toLowerCase().substr(1);if(!g){return false}return i.types[g]||false}function populateMaps(A,i){var g=["nginx","apache",undefined,"iana"];Object.keys(E).forEach((function forEachMimeType(p){var C=E[p];var f=C.extensions;if(!f||!f.length){return}A[p]=f;for(var Q=0;Q<f.length;Q++){var B=f[Q];if(i[B]){var I=g.indexOf(E[i[B]].source);var y=g.indexOf(C.source);if(i[B]!=="application/octet-stream"&&(I>y||I===y&&i[B].substr(0,12)==="application/")){continue}}i[B]=p}}))}},744:A=>{var i=1e3;var g=i*60;var E=g*60;var p=E*24;var C=p*7;var f=p*365.25;A.exports=function(A,i){i=i||{};var g=typeof A;if(g==="string"&&A.length>0){return parse(A)}else if(g==="number"&&isFinite(A)){return i.long?fmtLong(A):fmtShort(A)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(A))};function parse(A){A=String(A);if(A.length>100){return}var Q=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(A);if(!Q){return}var B=parseFloat(Q[1]);var I=(Q[2]||"ms").toLowerCase();switch(I){case"years":case"year":case"yrs":case"yr":case"y":return B*f;case"weeks":case"week":case"w":return B*C;case"days":case"day":case"d":return B*p;case"hours":case"hour":case"hrs":case"hr":case"h":return B*E;case"minutes":case"minute":case"mins":case"min":case"m":return B*g;case"seconds":case"second":case"secs":case"sec":case"s":return B*i;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return B;default:return undefined}}function fmtShort(A){var C=Math.abs(A);if(C>=p){return Math.round(A/p)+"d"}if(C>=E){return Math.round(A/E)+"h"}if(C>=g){return Math.round(A/g)+"m"}if(C>=i){return Math.round(A/i)+"s"}return A+"ms"}function fmtLong(A){var C=Math.abs(A);if(C>=p){return plural(A,C,p,"day")}if(C>=E){return plural(A,C,E,"hour")}if(C>=g){return plural(A,C,g,"minute")}if(C>=i){return plural(A,C,i,"second")}return A+" ms"}function plural(A,i,g,E){var p=i>=g*1.5;return Math.round(A/g)+" "+E+(p?"s":"")}},7777:(A,i,g)=>{var E=g(7016).parse;var p={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var C=String.prototype.endsWith||function(A){return A.length<=this.length&&this.indexOf(A,this.length-A.length)!==-1};function getProxyForUrl(A){var i=typeof A==="string"?E(A):A||{};var g=i.protocol;var C=i.host;var f=i.port;if(typeof C!=="string"||!C||typeof g!=="string"){return""}g=g.split(":",1)[0];C=C.replace(/:\d*$/,"");f=parseInt(f)||p[g]||0;if(!shouldProxy(C,f)){return""}var Q=getEnv("npm_config_"+g+"_proxy")||getEnv(g+"_proxy")||getEnv("npm_config_proxy")||getEnv("all_proxy");if(Q&&Q.indexOf("://")===-1){Q=g+"://"+Q}return Q}function shouldProxy(A,i){var g=(getEnv("npm_config_no_proxy")||getEnv("no_proxy")).toLowerCase();if(!g){return true}if(g==="*"){return false}return g.split(/[,\s]/).every((function(g){if(!g){return true}var E=g.match(/^(.+):(\d+)$/);var p=E?E[1]:g;var f=E?parseInt(E[2]):0;if(f&&f!==i){return true}if(!/^[.*]/.test(p)){return A!==p}if(p.charAt(0)==="*"){p=p.slice(1)}return!C.call(A,p)}))}function getEnv(A){return process.env[A.toLowerCase()]||process.env[A.toUpperCase()]||""}i.T=getProxyForUrl},9546:(A,i,g)=>{var E;E={value:true};const p=g(1354);const C=g(7016);const f=g(4434);const Q=g(2830);const B=g(3106);const I=g(4922);const y=g(9023);const b=g(9896);const D=g(9557);const R=g(6928);function _interopDefaultLegacy(A){return A&&typeof A==="object"&&"default"in A?A:{default:A}}const k=_interopDefaultLegacy(p);const S=_interopDefaultLegacy(C);const v=_interopDefaultLegacy(Q);const F=_interopDefaultLegacy(B);const x=_interopDefaultLegacy(I);const U=_interopDefaultLegacy(y);const L=_interopDefaultLegacy(b);const M=_interopDefaultLegacy(D);const T=_interopDefaultLegacy(R);const H=v["default"]("screepsapi:socket");const G={reconnect:true,resubscribe:true,keepAlive:true,maxRetries:10,maxRetryDelay:60*1e3};class Socket extends f.EventEmitter{constructor(A){super();this.api=A;this.opts=Object.assign({},G);this.on("error",(()=>{}));this.reset();this.on("auth",(A=>{if(A.data.status==="ok"){while(this.__queue.lLine truncated
/*!
* normalize-path <https://github.com/jonschlinkert/normalize-path>
* Tmp
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/
i.exports=function(i,_){if(typeof i!=="string"){throw new TypeError("expected path to be a string")}if(i==="\\"||i==="/")return"/";var z=i.length;if(z<=1)return i;var re="";if(z>4&&i[3]==="\\"){var Pe=i[2];if((Pe==="?"||Pe===".")&&i.slice(0,2)==="\\\\"){i=i.slice(2);re="//"}}var $t=i.split(/[/\\]+/);if(_!==false&&$t[$t.length-1]===""){$t.pop()}return re+$t.join("/")}},55560:(i,_,z)=>{var re=z(58264);i.exports=re(once);i.exports.strict=re(onceStrict);once.proto=once((function(){Object.defineProperty(Function.prototype,"once",{value:function(){return once(this)},configurable:true});Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return onceStrict(this)},configurable:true})}));function once(i){var f=function(){if(f.called)return f.value;f.called=true;return f.value=i.apply(this,arguments)};f.called=false;return f}function onceStrict(i){var f=function(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=i.apply(this,arguments)};var _=i.name||"Function wrapped with `once`";f.onceError=_+" shouldn't be called more than once";f.called=false;return f}},19183:i=>{if(typeof process==="undefined"||!process.version||process.version.indexOf("v0.")===0||process.version.indexOf("v1.")===0&&process.version.indexOf("v1.8.")!==0){i.exports={nextTick:nextTick}}else{i.exports=process}function nextTick(i,_,z,re){if(typeof i!=="function"){throw new TypeError('"callback" argument must be a function')}var Pe=arguments.length;var $t,er;switch(Pe){case 0:case 1:return process.nextTick(i);case 2:return process.nextTick((function afterTickOne(){i.call(null,_)}));case 3:return process.nextTick((function afterTickTwo(){i.call(null,_,z)}));case 4:return process.nextTick((function afterTickThree(){i.call(null,_,z,re)}));default:$t=new Array(Pe-1);er=0;while(er<$t.length){$t[er++]=arguments[er]}return process.nextTick((function afterTick(){i.apply(null,$t)}))}}},7945:i=>{i.exports=global.process},77777:(i,_,z)=>{var re=z(87016).parse;var Pe={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};var $t=String.prototype.endsWith||function(i){return i.length<=this.length&&this.indexOf(i,this.length-i.length)!==-1};function getProxyForUrl(i){var _=typeof i==="string"?re(i):i||{};var z=_.protocol;var $t=_.host;var er=_.port;if(typeof $t!=="string"||!$t||typeof z!=="string"){return""}z=z.split(":",1)[0];$t=$t.replace(/:\d*$/,"");er=parseInt(er)||Pe[z]||0;if(!shouldProxy($t,er)){return""}var tr=getEnv("npm_config_"+z+"_proxy")||getEnv(z+"_proxy")||getEnv("npm_config_proxy")||getEnv("all_proxy");if(tr&&tr.indexOf("://")===-1){tr=z+"://"+tr}return tr}function shouldProxy(i,_){var z=(getEnv("npm_config_no_proxy")||getEnv("no_proxy")).toLowerCase();if(!z){return true}if(z==="*"){return false}return z.split(/[,\s]/).every((function(z){if(!z){return true}var re=z.match(/^(.+):(\d+)$/);var Pe=re?re[1]:z;var er=re?parseInt(re[2]):0;if(er&&er!==_){return true}if(!/^[.*]/.test(Pe)){return i!==Pe}if(Pe.charAt(0)==="*"){Pe=Pe.slice(1)}return!$t.call(i,Pe)}))}function getEnv(i){return process.env[i.toLowerCase()]||process.env[i.toUpperCase()]||""}_.T=getProxyForUrl},80652:(i,_,z)=>{const{SymbolDispose:re}=z(50999);const{AbortError:Pe,codes:$t}=z(69220);const{isNodeStream:er,isWebStream:tr,kControllerErrorFunction:rr}=z(83426);const nr=z(36815);const{ERR_INVALID_ARG_TYPE:ir}=$t;let sr;const validateAbortSignal=(i,_)=>{if(typeof i!=="object"||!("aborted"in i)){throw new ir(_,"AbortSignal",i)}};i.exports.addAbortSignal=function addAbortSignal(_,z){validateAbortSignal(_,"signal");if(!er(z)&&!tr(z)){throw new ir("stream",["ReadableStream","WritableStream","Stream"],z)}return i.exports.addAbortSignalNoValidate(_,z)};i.exports.addAbortSignalNoValidate=function(i,_){if(typeof i!=="object"||!("aborted"in i)){return _}const $t=er(_)?()=>{_.destroy(new Pe(undefined,{cause:i.reason}))}:()=>{_[rr](new Pe(undefined,{cause:i.reason}))};if(i.aborted){$t()}else{sr=sr||z(23539).addAbortListener;const Pe=sr(i,$t);nr(_,Pe[re])}return _}},77336:(i,_,z)=>{const{StringPrototypeSlice:re,SymbolIterator:Pe,TypedArrayPrototypeSet:$t,Uint8Array:er}=z(50999);const{Buffer:tr}=z(20181);const{inspect:rr}=z(23539);i.exports=class BufferList{constructor(){this.head=null;this.tail=null;this.length=0}push(i){const _={data:i,next:null};if(this.length>0)this.tail.next=_;else this.head=_;this.tail=_;++this.length}unshift(i){const _={data:i,next:this.head};if(this.length===0)this.tail=_;this.head=_;++this.length}shift(){if(this.length===0)return;const i=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return i}clear(){this.head=this.tail=null;this.length=0}join(i){if(this.length===0)return"";let _=this.head;let z=""+_.data;while((_=_.next)!==null)z+=i+_.data;return z}concat(i){if(this.length===0)return tr.alloc(0);const _=tr.allocUnsafe(i>>>0);let z=this.head;let re=0;while(z){$t(_,z.data,re);re+=z.data.length;z=z.next}return _}consume(i,_){const z=this.head.data;if(i<z.length){const _=z.slice(0,i);this.heLine truncated
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var re=z(20181);var Pe=re.Buffer;function copyProps(i,_){for(var z in i){_[z]=i[z]}}if(Pe.from&&Pe.alloc&&Pe.allocUnsafe&&Pe.allocUnsafeSlow){i.exports=re}else{copyProps(re,_);_.Buffer=SafeBuffer}function SafeBuffer(i,_,z){return Pe(i,_,z)}SafeBuffer.prototype=Object.create(Pe.prototype);copyProps(Pe,SafeBuffer);SafeBuffer.from=function(i,_,z){if(typeof i==="number"){throw new TypeError("Argument must not be a number")}return Pe(i,_,z)};SafeBuffer.alloc=function(i,_,z){if(typeof i!=="number"){throw new TypeError("Argument must be a number")}var re=Pe(i);if(_!==undefined){if(typeof z==="string"){re.fill(_,z)}else{re.fill(_)}}else{re.fill(0)}return re};SafeBuffer.allocUnsafe=function(i){if(typeof i!=="number"){throw new TypeError("Argument must be a number")}return Pe(i)};SafeBuffer.allocUnsafeSlow=function(i){if(typeof i!=="number"){throw new TypeError("Argument must be a number")}return re.SlowBuffer(i)}},89546:(i,_,z)=>{var re;re={value:true};const Pe=z(11354);const $t=z(87016);const er=z(24434);const tr=z(2830);const rr=z(43106);const nr=z(34922);const ir=z(39023);const sr=z(79896);const or=z(99557);const ar=z(16928);function _interopDefaultLegacy(i){return i&&typeof i==="object"&&"default"in i?i:{default:i}}const Ar=_interopDefaultLegacy(Pe);const lr=_interopDefaultLegacy($t);const cr=_interopDefaultLegacy(tr);const dr=_interopDefaultLegacy(rr);const ur=_interopDefaultLegacy(nr);const pr=_interopDefaultLegacy(ir);const hr=_interopDefaultLegacy(sr);const gr=_interopDefaultLegacy(or);const fr=_interopDefaultLegacy(ar);const mr=cr["default"]("screepsapi:socket");const Er={reconnect:true,resubscribe:true,keepAlive:true,maxRetries:10,maxRetryDelay:60*1e3};class Socket extends er.EventEmitter{constructor(i){super();this.api=i;this.opts=Object.assign({},Er);this.on("error",(()=>{}));this.reset();this.on("auth",(i=>{if(i.data.status==="ok"){while(this.__queue.length){this.emit(this.__queue.shift())}clearInterval(this.keepAliveInter);if(this.opts.keepAlive){this.keepAliveInter=setInterval((()=>this.ws&&this.ws.ping(1)),1e4)}}}))}reset(){this.authed=false;this.connected=false;this.reconnecting=false;clearInterval(this.keepAliveInter);this.keepAliveInter=0;this.__queue=[];this.__subQueue=[];this.__subs={}}async connect(i={}){Object.assign(this.opts,i);if(!this.api.token){throw new Error("No token! Call api.auth() before connecting the socket!")}return new Promise(((i,_)=>{const z=this.api.opts.url.replace("http","ws");const re=new $t.URL("socket/websocket",z);this.ws=new Ar["default"](re);this.ws.on("open",(()=>{this.connected=true;this.reconnecting=false;if(this.opts.resubscribe){this.__subQueue.push(...Object.keys(this.__subs))}mr("connected");this.emit("connected");i(this.auth(this.api.token))}));this.ws.on("close",(()=>{clearInterval(this.keepAliveInter);this.authed=false;this.connected=false;mr("disconnected");this.emit("disconnected");if(this.opts.reconnect){this.reconnect().catch((()=>{}))}}));this.ws.on("error",(i=>{this.ws.terminate();this.emit("error",i);mr(`error ${i}`);if(!this.connected){_(i)}}));this.ws.on("unexpected-response",((i,z)=>{const re=new Error(`WS Unexpected Response: ${z.statusCode} ${z.statusMessage}`);this.emit("error",re);_(re)}));this.ws.on("message",(i=>this.handleMessage(i)))}))}async reconnect(){if(this.reconnecting){return}this.reconnecting=true;let i=0;let _;do{let z=Math.pow(2,i)*100;if(z>this.opts.maxRetryDelay)z=this.opts.maxRetryDelay;await this.sleep(z);if(!this.reconnecting)return;try{await this.connect();_=false}catch(i){_=true}i++;mr(`reconnect ${i}/${this.opts.maxRetries}`)}while(_&&i<this.opts.maxRetries);if(_){const i=new Error(`Reconnection failed after ${this.opts.maxRetries} retries`);this.reconnecting=false;mr("reconnect failed");this.emit("error",i);throw i}else{Object.keys(this.__subs).forEach((i=>this.subscribe(i)))}}disconnect(){mr("disconnect");clearInterval(this.keepAliveInter);this.ws.removeAllListeners();this.ws.terminate();this.reset();this.emit("disconnected")}sleep(i){return new Promise(((_,z)=>{setTimeout(_,i)}))}handleMessage(i){i=i.data||i;if(i.slice(0,3)==="gz:"){i=this.api.inflate(i)}mr(`message ${i}`);if(i[0]==="["){i=JSON.parse(i);let[,_,z,re]=i[0].match(/^(.+):(.+?)(?:\/(.+))?$/);re=re||_;const Pe={channel:re,id:z,type:_,data:i[1]};this.emit(i[0],Pe);this.emit(Pe.channel,Pe);this.emit("message",Pe)}else{const[_,...z]=i.split(" ");const re={type:"server",channel:_,data:z};if(_==="auth"){re.data={status:z[0],token:z[1]}}if(["protocol","time","package"].includes(_)){re.data={[_]:z[0]}}this.emit(_,re);this.emit("message",re)}}async gzip(i){this.send(`gzip ${i?"on":"off"}`)}async send(i){if(!this.connected){this.__queue.push(i)}else{this.ws.send(i)}}auth(i){return new Promise(((_,z)=>{this.send(`auth ${i}`);this.once("auth",(i=>{const{data:re}=i;if(re.status==="ok"){this.authed=true;this.emit("token",re.token);this.emit("authed");while(this.__subQueue.length){this.send(this.__subQueue.shift())}_()}else{z(new Error("socket auth failed"))}}))}))}async Line truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=i=>i.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=i=>i.replace(/\r?\n|\r/g,"\r\n");const re=[];const Pe=new Uint8Array([13,10]);ir=0;let $t=false;for(const[_,er]of i){if(typeof er==="string"){const i=mr.encode(z+`; name="${escape(normalizeLinefeeds(_))}"`+`\r\n\r\n${normalizeLinefeeds(er)}\r\n`);re.push(i);ir+=i.byteLength}else{const i=mr.encode(`${z}; name="${escape(normalizeLinefeeds(_))}"`+(er.name?`; filename="${escape(er.name)}"`:"")+"\r\n"+`Content-Type: ${er.type||"application/octet-stream"}\r\n\r\n`);re.push(i,er,Pe);if(typeof er.size==="number"){ir+=i.byteLength+er.size+Pe.byteLength}else{$t=true}}}const er=mr.encode(`--${_}--\r\n`);re.push(er);ir+=er.byteLength;if($t){ir=null}nr=i;rr=async function*(){for(const i of re){if(i.stream){yield*i.stream()}else{yield i}}};sr=`multipart/form-data; boundary=${_}`}else if($t(i)){nr=i;ir=i.size;if(i.type){sr=i.type}}else if(typeof i[Symbol.asyncIterator]==="function"){if(_){throw new TypeError("keepalive")}if(re.isDisturbed(i)||i.locked){throw new TypeError("Response body object should not be disturbed or locked")}z=i instanceof ReadableStream?i:Pe(i)}if(typeof nr==="string"||re.isBuffer(nr)){ir=Buffer.byteLength(nr)}if(rr!=null){let _;z=new ReadableStream({async start(){_=rr(i)[Symbol.asyncIterator]()},async pull(i){const{value:re,done:Pe}=await _.next();if(Pe){queueMicrotask((()=>{i.close();i.byobRequest?.respond(0)}))}else{if(!dr(z)){const _=new Uint8Array(re);if(_.byteLength){i.enqueue(_)}}}return i.desiredSize>0},async cancel(i){await _.return()},type:"bytes"})}const or={stream:z,source:nr,length:ir};return[or,sr]}function safelyExtractBody(i,_=false){if(i instanceof ReadableStream){cr(!re.isDisturbed(i),"The body has already been consumed.");cr(!i.locked,"The stream is locked.")}return extractBody(i,_)}function cloneBody(i,_){const[z,re]=_.stream.tee();_.stream=z;return{stream:re,length:_.length,source:_.source}}function throwIfAborted(i){if(i.aborted){throw new DOMException("The operation was aborted.","AbortError")}}function bodyMixinMethods(i){const _={blob(){return consumeBody(this,(i=>{let _=bodyMimeType(this);if(_===null){_=""}else if(_){_=hr(_)}return new lr([i],{type:_})}),i)},arrayBuffer(){return consumeBody(this,(i=>new Uint8Array(i).buffer),i)},text(){return consumeBody(this,sr,i)},json(){return consumeBody(this,parseJSONFromBytes,i)},formData(){return consumeBody(this,(i=>{const _=bodyMimeType(this);if(_!==null){switch(_.essence){case"multipart/form-data":{const z=gr(i,_);if(z==="failure"){throw new TypeError("Failed to parse body as FormData.")}const re=new or;re[ar]=z;return re}case"application/x-www-form-urlencoded":{const _=new URLSearchParams(i.toString());const z=new or;for(const[i,re]of _){z.append(i,re)}return z}}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')}),i)},bytes(){return consumeBody(this,(i=>new Uint8Array(i)),i)}};return _}function mixinBody(i){Object.assign(i.prototype,bodyMixinMethods(i))}async function consumeBody(i,_,z){Ar.brandCheck(i,z);if(bodyUnusable(i)){throw new TypeError("Body is unusable: Body has already been read")}throwIfAborted(i[ar]);const re=rr();const errorSteps=i=>re.reject(i);const successSteps=i=>{try{re.resolve(_(i))}catch(i){errorSteps(i)}};if(i[ar].body==null){successSteps(Buffer.allocUnsafe(0));return re.promise}await nr(i[ar].body,successSteps,errorSteps);return re.promise}function bodyUnusable(i){const _=i[ar].body;return _!=null&&(_.stream.locked||re.isDisturbed(_.stream))}function parseJSONFromBytes(i){return JSON.parse(sr(i))}function bodyMimeType(i){const _=i[ar].headersList;const z=ir(_);if(z==="failure"){return null}return z}i.exports={extractBody:extractBody,safelyExtractBody:safelyExtractBody,cloneBody:cloneBody,mixinBody:mixinBody,streamRegistry:Br,hasFinalizationRegistry:Er,bodyUnusable:bodyUnusable}},4495:i=>{const _=["GET","HEAD","POST"];const z=new Set(_);const re=[101,204,205,304];const Pe=[301,302,303,307,308];const $t=new Set(Pe);const er=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"];const tr=new Set(er);const rr=["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"];const nr=new Set(rr);const ir=["follow","manual","error"];const sr=["GET","HEAD","OPTIONS","TRACE"];const or=new Set(sr);const ar=["navigate","same-origin","no-cors",Line truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */tr[er-4]=z[0];tr[er-3]=z[1];tr[er-2]=z[2];tr[er-1]=z[3];tr[1]=$t;if($t===126){tr.writeUInt16BE(Pe,2)}else if($t===127){tr[2]=tr[3]=0;tr.writeUIntBE(Pe,4,6)}tr[1]|=128;for(let i=0;i<Pe;++i){tr[er+i]=_[i]^z[i&3]}return tr}}i.exports={WebsocketFrameSend:WebsocketFrameSend}},19469:(i,_,z)=>{const{createInflateRaw:re,Z_DEFAULT_WINDOWBITS:Pe}=z(38522);const{isValidClientWindowBits:$t}=z(98625);const er=Buffer.from([0,0,255,255]);const tr=Symbol("kBuffer");const rr=Symbol("kLength");class PerMessageDeflate{#ie;#N={};constructor(i){this.#N.serverNoContextTakeover=i.has("server_no_context_takeover");this.#N.serverMaxWindowBits=i.get("server_max_window_bits")}decompress(i,_,z){if(!this.#ie){let i=Pe;if(this.#N.serverMaxWindowBits){if(!$t(this.#N.serverMaxWindowBits)){z(new Error("Invalid server_max_window_bits"));return}i=Number.parseInt(this.#N.serverMaxWindowBits)}this.#ie=re({windowBits:i});this.#ie[tr]=[];this.#ie[rr]=0;this.#ie.on("data",(i=>{this.#ie[tr].push(i);this.#ie[rr]+=i.length}));this.#ie.on("error",(i=>{this.#ie=null;z(i)}))}this.#ie.write(i);if(_){this.#ie.write(er)}this.#ie.flush((()=>{const i=Buffer.concat(this.#ie[tr],this.#ie[rr]);this.#ie[tr].length=0;this.#ie[rr]=0;z(null,i)}))}}i.exports={PerMessageDeflate:PerMessageDeflate}},81652:(i,_,z)=>{const{Writable:re}=z(57075);const Pe=z(34589);const{parserStates:$t,opcodes:er,states:tr,emptyBuffer:rr,sentCloseFrameState:nr}=z(20736);const{kReadyState:ir,kSentClose:sr,kResponse:or,kReceivedClose:ar}=z(61216);const{channels:Ar}=z(42414);const{isValidStatusCode:lr,isValidOpcode:cr,failWebsocketConnection:dr,websocketMessageReceived:ur,utf8Decode:pr,isControlFrame:hr,isTextBinaryFrame:gr,isContinuationFrame:fr}=z(98625);const{WebsocketFrameSend:mr}=z(3264);const{closeWebSocketConnection:Er}=z(86897);const{PerMessageDeflate:Br}=z(19469);class ByteParser extends re{#o=[];#a=0;#se=false;#A=$t.INFO;#l={};#c=[];#h;constructor(i,_){super();this.ws=i;this.#h=_==null?new Map:_;if(this.#h.has("permessage-deflate")){this.#h.set("permessage-deflate",new Br(_))}}_write(i,_,z){this.#o.push(i);this.#a+=i.length;this.#se=true;this.run(z)}run(i){while(this.#se){if(this.#A===$t.INFO){if(this.#a<2){return i()}const _=this.consume(2);const z=(_[0]&128)!==0;const re=_[0]&15;const Pe=(_[1]&128)===128;const tr=!z&&re!==er.CONTINUATION;const rr=_[1]&127;const nr=_[0]&64;const ir=_[0]&32;const sr=_[0]&16;if(!cr(re)){dr(this.ws,"Invalid opcode received");return i()}if(Pe){dr(this.ws,"Frame cannot be masked");return i()}if(nr!==0&&!this.#h.has("permessage-deflate")){dr(this.ws,"Expected RSV1 to be clear.");return}if(ir!==0||sr!==0){dr(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(tr&&!gr(re)){dr(this.ws,"Invalid frame type was fragmented.");return}if(gr(re)&&this.#c.length>0){dr(this.ws,"Expected continuation frame");return}if(this.#l.fragmented&&tr){dr(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((rr>125||tr)&&hr(re)){dr(this.ws,"Control frame either too large or fragmented");return}if(fr(re)&&this.#c.length===0&&!this.#l.compressed){dr(this.ws,"Unexpected continuation frame");return}if(rr<=125){this.#l.payloadLength=rr;this.#A=$t.READ_DATA}else if(rr===126){this.#A=$t.PAYLOADLENGTH_16}else if(rr===127){this.#A=$t.PAYLOADLENGTH_64}if(gr(re)){this.#l.binaryType=re;this.#l.compressed=nr!==0}this.#l.opcode=re;this.#l.masked=Pe;this.#l.fin=z;this.#l.fragmented=tr}else if(this.#A===$t.PAYLOADLENGTH_16){if(this.#a<2){return i()}const _=this.consume(2);this.#l.payloadLength=_.readUInt16BE(0);this.#A=$t.READ_DATA}else if(this.#A===$t.PAYLOADLENGTH_64){if(this.#a<8){return i()}const _=this.consume(8);const z=_.readUInt32BE(0);if(z>2**31-1){dr(this.ws,"Received payload length > 2^31 bytes.");return}const re=_.readUInt32BE(4);this.#l.payloadLength=(z<<8)+re;this.#A=$t.READ_DATA}else if(this.#A===$t.READ_DATA){if(this.#a<this.#l.payloadLength){return i()}const _=this.consume(this.#l.payloadLength);if(hr(this.#l.opcode)){this.#se=this.parseControlFrame(_);this.#A=$t.INFO}else{if(!this.#l.compressed){this.#c.push(_);if(!this.#l.fragmented&&this.#l.fin){const i=Buffer.concat(this.#c);ur(this.ws,this.#l.binaryType,i);this.#c.length=0}this.#A=$t.INFO}else{this.#h.get("permessage-deflate").decompress(_,this.#l.fin,((_,z)=>{if(_){Er(this.ws,1007,_.message,_.message.length);return}this.#c.push(z);if(!this.#l.fin){this.#A=$t.INFO;this.#se=true;this.run(i);return}ur(this.ws,this.#l.binaryType,Buffer.concat(this.#c));this.#se=true;this.#A=$t.INFO;this.#c.length=0;this.run(i)}));this.#se=false;break}}}}}consume(i){if(i>this.#a){throw new Error("Called consume() before buffers satiated.")}else if(i===0){return rr}if(this.#o[0].length===i){this.#a-=this.#o[0].length;return this.#o.shift()}const _=Buffer.allocUnsafe(i);let z=0;while(z!==i){const re=this.#o[0];const{length:Pe}=re;if(Pe+z===i){_.set(this.#o.shift(),z);break}else if(Pe+z>i){_.set(re.subarray(0,i-z),z);this.#o[0]=re.subarray(i-z);break}else{_.set(this.#o.shift()Line truncated
/**
* ZipStream
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* @ignore
* @license [MIT]{@link https://github.com/archiverjs/node-zip-stream/blob/master/LICENSE}
* @copyright (c) 2014 Chris Talkington, contributors.
* MIT Licensed
*/
var re=z(39023).inherits;var Pe=z(47544).ZipArchiveOutputStream;var $t=z(47544).ZipArchiveEntry;var er=z(53296);var tr=i.exports=function(i){if(!(this instanceof tr)){return new tr(i)}i=this.options=i||{};i.zlib=i.zlib||{};Pe.call(this,i);if(typeof i.level==="number"&&i.level>=0){i.zlib.level=i.level;delete i.level}if(!i.forceZip64&&typeof i.zlib.level==="number"&&i.zlib.level===0){i.store=true}i.namePrependSlash=i.namePrependSlash||false;if(i.comment&&i.comment.length>0){this.setComment(i.comment)}};re(tr,Pe);tr.prototype._normalizeFileData=function(i){i=er.defaults(i,{type:"file",name:null,namePrependSlash:this.options.namePrependSlash,linkname:null,date:null,mode:null,store:this.options.store,comment:""});var _=i.type==="directory";var z=i.type==="symlink";if(i.name){i.name=er.sanitizePath(i.name);if(!z&&i.name.slice(-1)==="/"){_=true;i.type="directory"}else if(_){i.name+="/"}}if(_||z){i.store=true}i.date=er.dateify(i.date);return i};tr.prototype.entry=function(i,_,z){if(typeof z!=="function"){z=this._emitErrorCallback.bind(this)}_=this._normalizeFileData(_);if(_.type!=="file"&&_.type!=="directory"&&_.type!=="symlink"){z(new Error(_.type+" entries not currently supported"));return}if(typeof _.name!=="string"||_.name.length===0){z(new Error("entry name must be a non-empty string value"));return}if(_.type==="symlink"&&typeof _.linkname!=="string"){z(new Error("entry linkname must be a non-empty string value when type equals symlink"));return}var re=new $t(_.name);re.setTime(_.date,this.options.forceLocalTime);if(_.namePrependSlash){re.setName(_.name,true)}if(_.store){re.setMethod(0)}if(_.comment.length>0){re.setComment(_.comment)}if(_.type==="symlink"&&typeof _.mode!=="number"){_.mode=40960}if(typeof _.mode==="number"){if(_.type==="symlink"){_.mode|=40960}re.setUnixMode(_.mode)}if(_.type==="symlink"&&typeof _.linkname==="string"){i=Buffer.from(_.linkname)}return Pe.prototype.entry.call(this,re,i,z)};tr.prototype.finalize=function(){this.finish()}},42078:module=>{module.exports=eval("require")("encoding")},42613:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("assert")},90290:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("async_hooks")},20181:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("buffer")},77969:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("bufferutil")},35317:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("child_process")},64236:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("console")},49140:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("constants")},76982:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("crypto")},31637:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("diagnostics_channel")},24434:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("events")},79896:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs")},91943:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("fs/promises")},58611:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("http")},85675:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("http2")},65692:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("https")},69278:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("net")},34589:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:assert")},16698:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:async_hooks")},4573:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:buffer")},37540:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:console")},77598:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:crypto")},53053:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:diagnostics_channel")},40610:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:dns")},78474:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:events")},73024:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs")},51455:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:fs/promises")},37067:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http")},32467:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:http2")},44708:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:https")},77030:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:net")},48161:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:os")},76760:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:path")},643:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:perf_hooks")},1708:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:process")},41792:i=>{i.exports=__WEBPACK_EXTERNAL_createRequire(import.meta.url)("node:queryLine truncated
const E=g(9896);const p=g(857);const C=g(6928);const f=g(6982);const Q={fs:E.constants,os:p.constants};const B="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",I=/XXXXXX/,y=3,b=(Q.O_CREAT||Q.fs.O_CREAT)|(Q.O_EXCL||Q.fs.O_EXCL)|(Q.O_RDWR||Q.fs.O_RDWR),D=p.platform()==="win32",R=Q.EBADF||Q.os.errno.EBADF,k=Q.ENOENT||Q.os.errno.ENOENT,S=448,v=384,F="exit",x=[],U=E.rmdirSync.bind(E);let L=false;function rimraf(A,i){return E.rm(A,{recursive:true},i)}function FN_RIMRAF_SYNC(A){return E.rmSync(A,{recursive:true})}function tmpName(A,i){const g=_parseArguments(A,i),p=g[0],C=g[1];_assertAndSanitizeOptions(p,(function(A,i){if(A)return C(A);let g=i.tries;(function _getUniqueName(){try{const A=_generateTmpName(i);E.stat(A,(function(i){if(!i){if(g-- >0)return _getUniqueName();return C(new Error("Could not get a unique tmp filename, max tries reached "+A))}C(null,A)}))}catch(A){C(A)}})()}))}function tmpNameSync(A){const i=_parseArguments(A),g=i[0];const p=_assertAndSanitizeOptionsSync(g);let C=p.tries;do{const A=_generateTmpName(p);try{E.statSync(A)}catch(i){return A}}while(C-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function file(A,i){const g=_parseArguments(A,i),p=g[0],C=g[1];tmpName(p,(function _tmpNameCreated(A,i){if(A)return C(A);E.open(i,b,p.mode||v,(function _fileCreated(A,g){if(A)return C(A);if(p.discardDescriptor){return E.close(g,(function _discardCallback(A){return C(A,i,undefined,_prepareTmpFileRemoveCallback(i,-1,p,false))}))}else{const A=p.discardDescriptor||p.detachDescriptor;C(null,i,g,_prepareTmpFileRemoveCallback(i,A?-1:g,p,false))}}))}))}function fileSync(A){const i=_parseArguments(A),g=i[0];const p=g.discardDescriptor||g.detachDescriptor;const C=tmpNameSync(g);let f=E.openSync(C,b,g.mode||v);if(g.discardDescriptor){E.closeSync(f);f=undefined}return{name:C,fd:f,removeCallback:_prepareTmpFileRemoveCallback(C,p?-1:f,g,true)}}function dir(A,i){const g=_parseArguments(A,i),p=g[0],C=g[1];tmpName(p,(function _tmpNameCreated(A,i){if(A)return C(A);E.mkdir(i,p.mode||S,(function _dirCreated(A){if(A)return C(A);C(null,i,_prepareTmpDirRemoveCallback(i,p,false))}))}))}function dirSync(A){const i=_parseArguments(A),g=i[0];const p=tmpNameSync(g);E.mkdirSync(p,g.mode||S);return{name:p,removeCallback:_prepareTmpDirRemoveCallback(p,g,true)}}function _removeFileAsync(A,i){const _handler=function(A){if(A&&!_isENOENT(A)){return i(A)}i()};if(0<=A[0])E.close(A[0],(function(){E.unlink(A[1],_handler)}));else E.unlink(A[1],_handler)}function _removeFileSync(A){let i=null;try{if(0<=A[0])E.closeSync(A[0])}catch(A){if(!_isEBADF(A)&&!_isENOENT(A))throw A}finally{try{E.unlinkSync(A[1])}catch(A){if(!_isENOENT(A))i=A}}if(i!==null){throw i}}function _prepareTmpFileRemoveCallback(A,i,g,E){const p=_prepareRemoveCallback(_removeFileSync,[i,A],E);const C=_prepareRemoveCallback(_removeFileAsync,[i,A],E,p);if(!g.keep)x.unshift(p);return E?p:C}function _prepareTmpDirRemoveCallback(A,i,g){const p=i.unsafeCleanup?rimraf:E.rmdir.bind(E);const C=i.unsafeCleanup?FN_RIMRAF_SYNC:U;const f=_prepareRemoveCallback(C,A,g);const Q=_prepareRemoveCallback(p,A,g,f);if(!i.keep)x.unshift(f);return g?f:Q}function _prepareRemoveCallback(A,i,g,E){let p=false;return function _cleanupCallback(C){if(!p){const f=E||_cleanupCallback;const Q=x.indexOf(f);if(Q>=0)x.splice(Q,1);p=true;if(g||A===U||A===FN_RIMRAF_SYNC){return A(i)}else{return A(i,C||function(){})}}}}function _garbageCollector(){if(!L)return;while(x.length){try{x[0]()}catch(A){}}}function _randomChars(A){let i=[],g=null;try{g=f.randomBytes(A)}catch(i){g=f.pseudoRandomBytes(A)}for(let E=0;E<A;E++){i.push(B[g[E]%B.length])}return i.join("")}function _isUndefined(A){return typeof A==="undefined"}function _parseArguments(A,i){if(typeof A==="function"){return[{},A]}if(_isUndefined(A)){return[{},i]}const g={};for(const i of Object.getOwnPropertyNames(A)){g[i]=A[i]}return[g,i]}function _resolvePath(A,i,g){const p=C.isAbsolute(A)?A:C.join(i,A);E.stat(p,(function(A){if(A){E.realpath(C.dirname(p),(function(A,i){if(A)return g(A);g(null,C.join(i,C.basename(p)))}))}else{E.realpath(p,g)}}))}function _resolvePathSync(A,i){const g=C.isAbsolute(A)?A:C.join(i,A);try{E.statSync(g);return E.realpathSync(g)}catch(A){const i=E.realpathSync(C.dirname(g));return C.join(i,C.basename(g))}}function _generateTmpName(A){const i=A.tmpdir;if(!_isUndefined(A.name)){return C.join(i,A.dir,A.name)}if(!_isUndefined(A.template)){return C.join(i,A.dir,A.template).replace(I,_randomChars(6))}const g=[A.prefix?A.prefix:"tmp","-",process.pid,"-",_randomChars(12),A.postfix?"-"+A.postfix:""].join("");return C.join(i,A.dir,g)}function _assertOptionsBase(A){if(!_isUndefined(A.name)){const i=A.name;if(C.isAbsolute(i))throw new Error(`name option must not contain an absolute path, found "${i}".`);const g=C.basename(i);if(g===".."||g==="."||g!==i)throw new Error(`name option must not contain a path, found "${i}".`)}if(!_isUndefined(A.template)&&!A.template.match(I)){throw new Error(`Invalid template, Line truncated
/*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */;const escape=A=>A.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22");const normalizeLinefeeds=A=>A.replace(/\r?\n|\r/g,"\r\n");const E=[];const p=new Uint8Array([13,10]);y=0;let C=false;for(const[i,f]of A){if(typeof f==="string"){const A=H.encode(g+`; name="${escape(normalizeLinefeeds(i))}"`+`\r\n\r\n${normalizeLinefeeds(f)}\r\n`);E.push(A);y+=A.byteLength}else{const A=H.encode(`${g}; name="${escape(normalizeLinefeeds(i))}"`+(f.name?`; filename="${escape(f.name)}"`:"")+"\r\n"+`Content-Type: ${f.type||"application/octet-stream"}\r\n\r\n`);E.push(A,f,p);if(typeof f.size==="number"){y+=A.byteLength+f.size+p.byteLength}else{C=true}}}const f=H.encode(`--${i}--\r\n`);E.push(f);y+=f.byteLength;if(C){y=null}I=A;B=async function*(){for(const A of E){if(A.stream){yield*A.stream()}else{yield A}}};b=`multipart/form-data; boundary=${i}`}else if(C(A)){I=A;y=A.size;if(A.type){b=A.type}}else if(typeof A[Symbol.asyncIterator]==="function"){if(i){throw new TypeError("keepalive")}if(E.isDisturbed(A)||A.locked){throw new TypeError("Response body object should not be disturbed or locked")}g=A instanceof ReadableStream?A:p(A)}if(typeof I==="string"||E.isBuffer(I)){y=Buffer.byteLength(I)}if(B!=null){let i;g=new ReadableStream({async start(){i=B(A)[Symbol.asyncIterator]()},async pull(A){const{value:E,done:p}=await i.next();if(p){queueMicrotask((()=>{A.close();A.byobRequest?.respond(0)}))}else{if(!F(g)){const i=new Uint8Array(E);if(i.byteLength){A.enqueue(i)}}}return A.desiredSize>0},async cancel(A){await i.return()},type:"bytes"})}const D={stream:g,source:I,length:y};return[D,b]}function safelyExtractBody(A,i=false){if(A instanceof ReadableStream){v(!E.isDisturbed(A),"The body has already been consumed.");v(!A.locked,"The stream is locked.")}return extractBody(A,i)}function cloneBody(A,i){const[g,E]=i.stream.tee();i.stream=g;return{stream:E,length:i.length,source:i.source}}function throwIfAborted(A){if(A.aborted){throw new DOMException("The operation was aborted.","AbortError")}}function bodyMixinMethods(A){const i={blob(){return consumeBody(this,(A=>{let i=bodyMimeType(this);if(i===null){i=""}else if(i){i=L(i)}return new S([A],{type:i})}),A)},arrayBuffer(){return consumeBody(this,(A=>new Uint8Array(A).buffer),A)},text(){return consumeBody(this,b,A)},json(){return consumeBody(this,parseJSONFromBytes,A)},formData(){return consumeBody(this,(A=>{const i=bodyMimeType(this);if(i!==null){switch(i.essence){case"multipart/form-data":{const g=M(A,i);if(g==="failure"){throw new TypeError("Failed to parse body as FormData.")}const E=new D;E[R]=g;return E}case"application/x-www-form-urlencoded":{const i=new URLSearchParams(A.toString());const g=new D;for(const[A,E]of i){g.append(A,E)}return g}}}throw new TypeError('Content-Type was not one of "multipart/form-data" or "application/x-www-form-urlencoded".')}),A)},bytes(){return consumeBody(this,(A=>new Uint8Array(A)),A)}};return i}function mixinBody(A){Object.assign(A.prototype,bodyMixinMethods(A))}async function consumeBody(A,i,g){k.brandCheck(A,g);if(bodyUnusable(A)){throw new TypeError("Body is unusable: Body has already been read")}throwIfAborted(A[R]);const E=B();const errorSteps=A=>E.reject(A);const successSteps=A=>{try{E.resolve(i(A))}catch(A){errorSteps(A)}};if(A[R].body==null){successSteps(Buffer.allocUnsafe(0));return E.promise}await I(A[R].body,successSteps,errorSteps);return E.promise}function bodyUnusable(A){const i=A[R].body;return i!=null&&(i.stream.locked||E.isDisturbed(i.stream))}function parseJSONFromBytes(A){return JSON.parse(b(A))}function bodyMimeType(A){const i=A[R].headersList;const g=y(i);if(g==="failure"){return null}return g}A.exports={extractBody:extractBody,safelyExtractBody:safelyExtractBody,cloneBody:cloneBody,mixinBody:mixinBody,streamRegistry:Y,hasFinalizationRegistry:G,bodyUnusable:bodyUnusable}},4495:A=>{const i=["GET","HEAD","POST"];const g=new Set(i);const E=[101,204,205,304];const p=[301,302,303,307,308];const C=new Set(p);const f=["1","7","9","11","13","15","17","19","20","21","22","23","25","37","42","43","53","69","77","79","87","95","101","102","103","104","109","110","111","113","115","117","119","123","135","137","139","143","161","179","389","427","465","512","513","514","515","526","530","531","532","540","548","554","556","563","587","601","636","989","990","993","995","1719","1720","1723","2049","3659","4045","4190","5060","5061","6000","6566","6665","6666","6667","6668","6669","6679","6697","10080"];const Q=new Set(f);const B=["","no-referrer","no-referrer-when-downgrade","same-origin","origin","strict-origin","origin-when-cross-origin","strict-origin-when-cross-origin","unsafe-url"];const I=new Set(B);const y=["follow","manual","error"];const b=["GET","HEAD","OPTIONS","TRACE"];const D=new Set(b);const R=["navigate","same-origin","no-cors","cors"];const k=["omit","same-origin","include"];const S=["default","no-store","reload","no-cache","force-cLine truncated
/*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */Q[f-4]=g[0];Q[f-3]=g[1];Q[f-2]=g[2];Q[f-1]=g[3];Q[1]=C;if(C===126){Q.writeUInt16BE(p,2)}else if(C===127){Q[2]=Q[3]=0;Q.writeUIntBE(p,4,6)}Q[1]|=128;for(let A=0;A<p;++A){Q[f+A]=i[A]^g[A&3]}return Q}}A.exports={WebsocketFrameSend:WebsocketFrameSend}},9469:(A,i,g)=>{const{createInflateRaw:E,Z_DEFAULT_WINDOWBITS:p}=g(8522);const{isValidClientWindowBits:C}=g(8625);const f=Buffer.from([0,0,255,255]);const Q=Symbol("kBuffer");const B=Symbol("kLength");class PerMessageDeflate{#re;#S={};constructor(A){this.#S.serverNoContextTakeover=A.has("server_no_context_takeover");this.#S.serverMaxWindowBits=A.get("server_max_window_bits")}decompress(A,i,g){if(!this.#re){let A=p;if(this.#S.serverMaxWindowBits){if(!C(this.#S.serverMaxWindowBits)){g(new Error("Invalid server_max_window_bits"));return}A=Number.parseInt(this.#S.serverMaxWindowBits)}this.#re=E({windowBits:A});this.#re[Q]=[];this.#re[B]=0;this.#re.on("data",(A=>{this.#re[Q].push(A);this.#re[B]+=A.length}));this.#re.on("error",(A=>{this.#re=null;g(A)}))}this.#re.write(A);if(i){this.#re.write(f)}this.#re.flush((()=>{const A=Buffer.concat(this.#re[Q],this.#re[B]);this.#re[Q].length=0;this.#re[B]=0;g(null,A)}))}}A.exports={PerMessageDeflate:PerMessageDeflate}},1652:(A,i,g)=>{const{Writable:E}=g(7075);const p=g(4589);const{parserStates:C,opcodes:f,states:Q,emptyBuffer:B,sentCloseFrameState:I}=g(736);const{kReadyState:y,kSentClose:b,kResponse:D,kReceivedClose:R}=g(1216);const{channels:k}=g(2414);const{isValidStatusCode:S,isValidOpcode:v,failWebsocketConnection:F,websocketMessageReceived:x,utf8Decode:U,isControlFrame:L,isTextBinaryFrame:M,isContinuationFrame:T}=g(8625);const{WebsocketFrameSend:H}=g(3264);const{closeWebSocketConnection:G}=g(6897);const{PerMessageDeflate:Y}=g(9469);class ByteParser extends E{#n=[];#o=0;#ie=false;#a=C.INFO;#c={};#l=[];#d;constructor(A,i){super();this.ws=A;this.#d=i==null?new Map:i;if(this.#d.has("permessage-deflate")){this.#d.set("permessage-deflate",new Y(i))}}_write(A,i,g){this.#n.push(A);this.#o+=A.length;this.#ie=true;this.run(g)}run(A){while(this.#ie){if(this.#a===C.INFO){if(this.#o<2){return A()}const i=this.consume(2);const g=(i[0]&128)!==0;const E=i[0]&15;const p=(i[1]&128)===128;const Q=!g&&E!==f.CONTINUATION;const B=i[1]&127;const I=i[0]&64;const y=i[0]&32;const b=i[0]&16;if(!v(E)){F(this.ws,"Invalid opcode received");return A()}if(p){F(this.ws,"Frame cannot be masked");return A()}if(I!==0&&!this.#d.has("permessage-deflate")){F(this.ws,"Expected RSV1 to be clear.");return}if(y!==0||b!==0){F(this.ws,"RSV1, RSV2, RSV3 must be clear");return}if(Q&&!M(E)){F(this.ws,"Invalid frame type was fragmented.");return}if(M(E)&&this.#l.length>0){F(this.ws,"Expected continuation frame");return}if(this.#c.fragmented&&Q){F(this.ws,"Fragmented frame exceeded 125 bytes.");return}if((B>125||Q)&&L(E)){F(this.ws,"Control frame either too large or fragmented");return}if(T(E)&&this.#l.length===0&&!this.#c.compressed){F(this.ws,"Unexpected continuation frame");return}if(B<=125){this.#c.payloadLength=B;this.#a=C.READ_DATA}else if(B===126){this.#a=C.PAYLOADLENGTH_16}else if(B===127){this.#a=C.PAYLOADLENGTH_64}if(M(E)){this.#c.binaryType=E;this.#c.compressed=I!==0}this.#c.opcode=E;this.#c.masked=p;this.#c.fin=g;this.#c.fragmented=Q}else if(this.#a===C.PAYLOADLENGTH_16){if(this.#o<2){return A()}const i=this.consume(2);this.#c.payloadLength=i.readUInt16BE(0);this.#a=C.READ_DATA}else if(this.#a===C.PAYLOADLENGTH_64){if(this.#o<8){return A()}const i=this.consume(8);const g=i.readUInt32BE(0);if(g>2**31-1){F(this.ws,"Received payload length > 2^31 bytes.");return}const E=i.readUInt32BE(4);this.#c.payloadLength=(g<<8)+E;this.#a=C.READ_DATA}else if(this.#a===C.READ_DATA){if(this.#o<this.#c.payloadLength){return A()}const i=this.consume(this.#c.payloadLength);if(L(this.#c.opcode)){this.#ie=this.parseControlFrame(i);this.#a=C.INFO}else{if(!this.#c.compressed){this.#l.push(i);if(!this.#c.fragmented&&this.#c.fin){const A=Buffer.concat(this.#l);x(this.ws,this.#c.binaryType,A);this.#l.length=0}this.#a=C.INFO}else{this.#d.get("permessage-deflate").decompress(i,this.#c.fin,((i,g)=>{if(i){G(this.ws,1007,i.message,i.message.length);return}this.#l.push(g);if(!this.#c.fin){this.#a=C.INFO;this.#ie=true;this.run(A);return}x(this.ws,this.#c.binaryType,Buffer.concat(this.#l));this.#ie=true;this.#a=C.INFO;this.#l.length=0;this.run(A)}));this.#ie=false;break}}}}}consume(A){if(A>this.#o){throw new Error("Called consume() before buffers satiated.")}else if(A===0){return B}if(this.#n[0].length===A){this.#o-=this.#n[0].length;return this.#n.shift()}const i=Buffer.allocUnsafe(A);let g=0;while(g!==A){const E=this.#n[0];const{length:p}=E;if(p+g===A){i.set(this.#n.shift(),g);break}else if(p+g>A){i.set(E.subarray(0,A-g),g);this.#n[0]=E.subarray(A-g);break}else{i.set(this.#n.shift(),g);g+=E.length}}this.#o-=A;return i}parseCloseBody(A){p(A.length!==1);let i;if(A.length>=2){i=A.readUInt16BE(0)}if(i!==undefined&&!S(i)){return{code:1002,Line truncated
+82 -25
View File
@@ -118,17 +118,19 @@ export function validateAuthentication(token, username, password) {
* @param {'ignore'|'warn'|'fail'} action
* @param {boolean} flag - Only acts when true
* @param {string} message - Passed to core.warning / core.setFailed
* @returns {boolean} - Returns true if the action was 'fail' and the flag was true.
*/
export function applyOnAction(action, flag, message) {
if (!flag) return;
if (!flag) return false;
if (action === "warn") {
core.warning(message);
return;
return false;
}
if (action === "fail") {
core.setFailed(message);
return true;
}
// 'ignore' → no-op
return false;
}
/**
@@ -179,33 +181,72 @@ export async function postCode() {
return;
}
let api = new ScreepsAPI(login_arguments);
if (token) {
if (!token) {
core.info(`Logging in as user ${username}`);
try {
await api.auth(username, password, login_arguments);
} catch (err) {
core.error(`Authentication error: ${err}`);
throw err;
}
}
let oldCode = null;
let rollbackOnFailure = false;
try {
rollbackOnFailure = core.getBooleanInput("rollback_on_failure");
} catch (e) {
// getBooleanInput throws if not 'true' or 'false', ignore
}
if (rollbackOnFailure) {
core.info(
`Downloading existing code from branch ${branch} for potential rollback...`,
);
try {
const getResponse = await api.code.get(branch);
if (getResponse && getResponse.ok && getResponse.modules) {
oldCode = getResponse.modules;
core.info(
`Successfully downloaded existing code (modules: ${Object.keys(oldCode).join(", ")})`,
);
} else {
core.setFailed(
`Failed to download existing code, but rollback_on_failure is enabled. Aborting deployment.`,
);
return;
}
} catch (err) {
core.setFailed(
`Error downloading existing code: ${err.message}. Aborting deployment.`,
);
return;
}
}
try {
const response = await api.code.set(branch, files_to_push);
core.info(JSON.stringify(response, null, 2));
core.info(`Code set successfully to ${branch}`);
} else {
core.info(`Logging in as user ${username}`);
await Promise.resolve()
.then(() => api.auth(username, password, login_arguments))
.then(() => api.code.set(branch, files_to_push))
.then(() => {
core.info(`Code set successfully to ${branch}`);
})
.catch((err) => {
core.error(`Upload error: ${err}`);
throw err;
});
} catch (err) {
core.error(`Upload error: ${err}`);
throw err;
}
// Console monitoring (optional)
const monitorTicks = parseInt(core.getInput("monitor") || "0", 10);
if (monitorTicks > 0) {
const onTraceback = core.getInput("on_traceback") || "fail";
const onErrorLog = core.getInput("on_error_log") || "warn";
const onWarningLog = core.getInput("on_warning_log") || "ignore";
const result = await monitorConsole(api, {
monitor: monitorTicks,
logToFile: core.getBooleanInput("log_to_file"),
onTraceback: core.getInput("on_traceback") || "fail",
onErrorLog: core.getInput("on_error_log") || "warn",
onWarningLog: core.getInput("on_warning_log") || "ignore",
onTraceback,
onErrorLog,
onWarningLog,
monitorInterval: parseInt(core.getInput("monitor_interval") || "10", 10),
hostname,
shard: core.getInput("shard") || undefined,
@@ -215,21 +256,37 @@ export async function postCode() {
core.setOutput("saw_error_log", String(result.sawErrorLog));
core.setOutput("saw_warning_log", String(result.sawWarningLog));
applyOnAction(
core.getInput("on_traceback"),
const fail1 = applyOnAction(
onTraceback,
result.sawTraceback,
"Screeps console: traceback detected",
);
applyOnAction(
core.getInput("on_error_log"),
const fail2 = applyOnAction(
onErrorLog,
result.sawErrorLog,
"Screeps console: error log output detected",
);
applyOnAction(
core.getInput("on_warning_log"),
const fail3 = applyOnAction(
onWarningLog,
result.sawWarningLog,
"Screeps console: warning log output detected",
);
const shouldFail = fail1 || fail2 || fail3;
if (shouldFail && rollbackOnFailure && oldCode) {
core.info(
"Action failed based on monitor configuration. Rolling back to previous code...",
);
try {
await api.code.set(branch, oldCode);
core.info(
`Successfully rolled back to previous code on branch ${branch}.`,
);
} catch (err) {
core.error(`Rollback failed: ${err}`);
}
}
}
}
+50 -33
View File
@@ -1,5 +1,5 @@
import * as core from "@actions/core";
import { DefaultArtifactClient } from "@actions/artifact";
import { create } from "@actions/artifact";
import fs from "fs";
import path from "path";
import os from "os";
@@ -88,17 +88,21 @@ export function safeDecode(text) {
/**
* Outputs text to the action log, splitting by newline to ensure proper display.
* Optionally prepends a [shard] prefix.
*
* @param {string} text
* @param {"info"|"warning"|"error"} level
* @param {string} [shard]
*/
export function outputMultiline(text, level = "info") {
export function outputMultiline(text, level = "info", shard = null) {
if (!text) return;
const prefix = shard ? `[${shard}] ` : "";
const lines = text.split(/\r?\n/);
lines.forEach((line) => {
if (level === "error") core.error(line);
else if (level === "warning") core.warning(line);
else core.info(line);
const formattedLine = `${prefix}${line}`;
if (level === "error") core.error(formattedLine);
else if (level === "warning") core.warning(formattedLine);
else core.info(formattedLine);
});
}
@@ -125,29 +129,29 @@ export async function writeLogFile(lines, filePath) {
}
/**
* Uploads a file as a named workflow artifact using @actions/artifact.
* Uploads one or more files as a named workflow artifact using @actions/artifact.
* Degrades gracefully to core.warning() if the runner does not support the
* artifact service (e.g. a bare self-hosted runner without the service configured).
* artifact service.
*
* @param {string} filePath - Absolute path of the file to upload
* @param {string} [artifactName="screeps-console-log"] - Artifact display name
* @param {string[]} filePaths - Absolute paths of the files to upload
* @param {string} [artifactName="screeps-console-log"] - Artifact display name
* @returns {Promise<void>}
*/
export async function uploadLogArtifact(
filePath,
export async function uploadLogArtifacts(
filePaths,
artifactName = "screeps-console-log",
) {
if (!filePaths || filePaths.length === 0) return;
try {
const client = new DefaultArtifactClient();
await client.uploadArtifact(
artifactName,
[filePath],
path.dirname(filePath),
);
core.info(`[Monitor] Console log uploaded as artifact '${artifactName}'.`);
const client = create();
const rootDir = path.dirname(filePaths[0]);
await client.uploadArtifact(artifactName, filePaths, rootDir, {
continueOnError: true,
});
core.info(`[Monitor] Console logs uploaded as artifact '${artifactName}'.`);
} catch (err) {
core.warning(
`[Monitor] Could not upload console log as artifact: ${err.message}`,
`[Monitor] Could not upload console logs as artifact: ${err.message}`,
);
}
}
@@ -173,12 +177,12 @@ export async function uploadLogArtifact(
* - All stdout lines → core.info() when logToFile=false,
* pushed to stdoutBuffer when logToFile=true.
*
* @param {{ data?: { messages?: { log?: string[], results?: string[] }, error?: string } }} event
* @param {{ logToFile: boolean }} opts
* @param {string[]} stdoutBuffer - Mutable buffer used in logToFile mode
* @param {{ data?: { messages?: { log?: string[], results?: string[] }, error?: string, shard?: string } }} event
* @param {{ logToFile: boolean, shard?: string }} opts
* @param {Record<string, string[]>} shardBuffers - Mutable buffer Map used in logToFile mode
* @param {{ sawTraceback: boolean, sawErrorLog: boolean, sawWarningLog: boolean }} state
*/
export function handleConsoleEvent(event, opts, stdoutBuffer, state) {
export function handleConsoleEvent(event, opts, shardBuffers, state) {
const { logToFile, shard: targetShard } = opts;
const data = event?.data ?? {};
@@ -198,7 +202,7 @@ export function handleConsoleEvent(event, opts, stdoutBuffer, state) {
const warnPattern = /<font\s+color=['"](?:orange|yellow)['"]/i;
logLines
.filter((l) => warnPattern.test(l))
.forEach((l) => outputMultiline(safeDecode(l), "warning"));
.forEach((l) => outputMultiline(safeDecode(l), "warning", data.shard));
}
// Traceback detection in log lines (Screeps sometimes sends errors here)
@@ -211,9 +215,11 @@ export function handleConsoleEvent(event, opts, stdoutBuffer, state) {
const allStdout = [...logLines, ...results].map(safeDecode);
if (allStdout.length > 0) {
if (logToFile) {
stdoutBuffer.push(...allStdout);
const shard = data.shard || "default";
if (!shardBuffers[shard]) shardBuffers[shard] = [];
shardBuffers[shard].push(...allStdout);
} else {
allStdout.forEach((l) => outputMultiline(l, "info"));
allStdout.forEach((l) => outputMultiline(l, "info", data.shard));
}
}
@@ -221,7 +227,7 @@ export function handleConsoleEvent(event, opts, stdoutBuffer, state) {
if (errorText) {
state.sawErrorLog = true;
const decodedError = safeDecode(errorText);
outputMultiline(decodedError, "error");
outputMultiline(decodedError, "error", data.shard);
if (detectTraceback(decodedError)) {
state.sawTraceback = true;
}
@@ -322,7 +328,7 @@ export async function monitorConsole(api, opts) {
const subscribePath = buildSubscribePath(hostname, providedShard);
// Shared mutable state — updated by handleConsoleEvent via event listener
const stdoutBuffer = [];
const shardBuffers = {}; // { [shardName]: string[] }
const state = {
sawTraceback: false,
sawErrorLog: false,
@@ -336,7 +342,7 @@ export async function monitorConsole(api, opts) {
// Step 2: connect socket + subscribe
await api.socket.connect();
await api.socket.subscribe(subscribePath, (event) => {
handleConsoleEvent(event, opts, stdoutBuffer, state);
handleConsoleEvent(event, opts, shardBuffers, state);
});
core.info(
@@ -378,13 +384,24 @@ export async function monitorConsole(api, opts) {
}
// Step 6: artifact upload
if (logToFile && stdoutBuffer.length > 0) {
const shardKeys = Object.keys(shardBuffers);
if (logToFile && shardKeys.length > 0) {
const tmpDir = await fs.promises.mkdtemp(
path.join(os.tmpdir(), "screeps-monitor-"),
);
const tmpFile = path.join(tmpDir, "screeps_console_log.txt");
await writeLogFile(stdoutBuffer, tmpFile);
await uploadLogArtifact(tmpFile);
const filePaths = [];
for (const sName of shardKeys) {
const fileName =
sName === "default"
? "screeps_console_log.txt"
: `${sName}_console_log.txt`;
const tmpFile = path.join(tmpDir, fileName);
await writeLogFile(shardBuffers[sName], tmpFile);
filePaths.push(tmpFile);
}
await uploadLogArtifacts(filePaths);
} else if (logToFile) {
core.info(
"[Monitor] No stdout lines were collected; skipping artifact upload.",
+162 -1950
View File
File diff suppressed because it is too large. Load diff
+1
View File
@@ -10,6 +10,7 @@
"build": "ncc build index.js -o dist -m --external utf-8-validate --external bufferutil"
},
"dependencies": {
"@actions/artifact": "^1.1.2",
"@actions/core": "^3.0.0",
"glob": "^13.0.0",
"screeps-api": "^1.7.2"