@lobehub/cli 0.0.93 → 0.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ import { Buffer as Buffer$1 } from "node:buffer";
15
15
  import * as net$1 from "node:net";
16
16
  import net, { BlockList, connect, createServer, isIP } from "node:net";
17
17
  import { scheduler, setImmediate as setImmediate$1, setTimeout as setTimeout$1 } from "node:timers/promises";
18
- import process$1, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
18
+ import _w, { cwd, execArgv, execPath, hrtime, platform as platform$1 } from "node:process";
19
19
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
20
20
  import { finished, pipeline } from "node:stream/promises";
21
21
  import { Duplex, PassThrough, Readable, Transform, Writable, getDefaultHighWaterMark, pipeline as pipeline$1 } from "node:stream";
@@ -8956,6 +8956,10 @@ var init_manifest = __esmMin((() => {
8956
8956
  ToolManifestSchema = object$1({
8957
8957
  $schema: string().optional(),
8958
8958
  api: array(LobeChatPluginApiSchema),
8959
+ connectorLinks: object$1({
8960
+ connectorId: string(),
8961
+ param: string()
8962
+ }).optional(),
8959
8963
  author: string().optional(),
8960
8964
  createdAt: string().optional(),
8961
8965
  gateway: string().optional(),
@@ -12052,6 +12056,42 @@ var init_acceptanceReviewRound = __esmMin((() => {
12052
12056
  });
12053
12057
  }));
12054
12058
 
12059
+ //#endregion
12060
+ //#region ../../packages/types/src/connector.ts
12061
+ var init_connector = __esmMin((() => {}));
12062
+
12063
+ //#endregion
12064
+ //#region ../../packages/types/src/inboundWebhook.ts
12065
+ var McpEventsWebhookConfigSchema, McpEventsWebhookStateSchema, InboundWebhookVerificationSchema, InboundWebhookDataSchema;
12066
+ var init_inboundWebhook = __esmMin((() => {
12067
+ init_zod$1();
12068
+ McpEventsWebhookConfigSchema = object$1({
12069
+ arguments: record(string(), unknown()),
12070
+ eventName: string().min(1)
12071
+ }).strict();
12072
+ McpEventsWebhookStateSchema = object$1({
12073
+ cursor: string().nullable().optional(),
12074
+ deliveryStatus: object$1({
12075
+ active: boolean().optional(),
12076
+ failedSince: string().optional(),
12077
+ lastDeliveryAt: string().optional(),
12078
+ lastError: string().nullable().optional(),
12079
+ retryAfterMs: number$1().nonnegative().optional(),
12080
+ throttled: boolean().optional()
12081
+ }).optional(),
12082
+ refreshBefore: datetime({ offset: true }).nullable().optional(),
12083
+ remoteSubscriptionId: string().optional(),
12084
+ truncated: boolean().optional()
12085
+ }).strict();
12086
+ InboundWebhookVerificationSchema = object$1({ scheme: literal("standard_webhooks") }).strict();
12087
+ InboundWebhookDataSchema = discriminatedUnion("kind", [object$1({
12088
+ kind: literal("mcp_events"),
12089
+ config: McpEventsWebhookConfigSchema,
12090
+ state: McpEventsWebhookStateSchema,
12091
+ verification: InboundWebhookVerificationSchema
12092
+ })]);
12093
+ }));
12094
+
12055
12095
  //#endregion
12056
12096
  //#region ../../packages/types/src/oauthApp.ts
12057
12097
  var init_oauthApp = __esmMin((() => {}));
@@ -12190,6 +12230,8 @@ var init_src$2 = __esmMin((() => {
12190
12230
  init_acceptanceReview();
12191
12231
  init_acceptanceReviewRound();
12192
12232
  init_agentRuntime();
12233
+ init_connector();
12234
+ init_inboundWebhook();
12193
12235
  init_oauthApp();
12194
12236
  init_chat();
12195
12237
  init_plugin();
@@ -21754,7 +21796,7 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
21754
21796
  const childProcess$2 = __require("node:child_process");
21755
21797
  const path$16 = __require("node:path");
21756
21798
  const fs$17 = __require("node:fs");
21757
- const process$3 = __require("node:process");
21799
+ const process$2 = __require("node:process");
21758
21800
  const { Argument, humanReadableArgName } = require_argument();
21759
21801
  const { CommanderError } = require_error$1();
21760
21802
  const { Help, stripColor } = require_help();
@@ -21806,13 +21848,13 @@ var require_command = /* @__PURE__ */ __commonJSMin$2(((exports) => {
21806
21848
  this._showSuggestionAfterError = true;
21807
21849
  this._savedState = null;
21808
21850
  this._outputConfiguration = {
21809
- writeOut: (str) => process$3.stdout.write(str),
21810
- writeErr: (str) => process$3.stderr.write(str),
21851
+ writeOut: (str) => process$2.stdout.write(str),
21852
+ writeErr: (str) => process$2.stderr.write(str),
21811
21853
  outputError: (str, write) => write(str),
21812
- getOutHelpWidth: () => process$3.stdout.isTTY ? process$3.stdout.columns : void 0,
21813
- getErrHelpWidth: () => process$3.stderr.isTTY ? process$3.stderr.columns : void 0,
21814
- getOutHasColors: () => useColor() ?? (process$3.stdout.isTTY && process$3.stdout.hasColors?.()),
21815
- getErrHasColors: () => useColor() ?? (process$3.stderr.isTTY && process$3.stderr.hasColors?.()),
21854
+ getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
21855
+ getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
21856
+ getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
21857
+ getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
21816
21858
  stripColor: (str) => stripColor(str)
21817
21859
  };
21818
21860
  this._hidden = false;
@@ -22170,7 +22212,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22170
22212
  */
22171
22213
  _exit(exitCode, code, message) {
22172
22214
  if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
22173
- process$3.exit(exitCode);
22215
+ process$2.exit(exitCode);
22174
22216
  }
22175
22217
  /**
22176
22218
  * Register callback `fn` for the command.
@@ -22509,11 +22551,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
22509
22551
  if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
22510
22552
  parseOptions = parseOptions || {};
22511
22553
  if (argv === void 0 && parseOptions.from === void 0) {
22512
- if (process$3.versions?.electron) parseOptions.from = "electron";
22513
- const execArgv = process$3.execArgv ?? [];
22554
+ if (process$2.versions?.electron) parseOptions.from = "electron";
22555
+ const execArgv = process$2.execArgv ?? [];
22514
22556
  if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
22515
22557
  }
22516
- if (argv === void 0) argv = process$3.argv;
22558
+ if (argv === void 0) argv = process$2.argv;
22517
22559
  this.rawArgs = argv.slice();
22518
22560
  let userArgs;
22519
22561
  switch (parseOptions.from) {
@@ -22523,7 +22565,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
22523
22565
  userArgs = argv.slice(2);
22524
22566
  break;
22525
22567
  case "electron":
22526
- if (process$3.defaultApp) {
22568
+ if (process$2.defaultApp) {
22527
22569
  this._scriptPath = argv[1];
22528
22570
  userArgs = argv.slice(2);
22529
22571
  } else userArgs = argv.slice(1);
@@ -22688,16 +22730,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
22688
22730
  }
22689
22731
  launchWithNode = sourceExt.includes(path$16.extname(executableFile));
22690
22732
  let proc;
22691
- if (process$3.platform !== "win32") if (launchWithNode) {
22733
+ if (process$2.platform !== "win32") if (launchWithNode) {
22692
22734
  args.unshift(executableFile);
22693
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
22694
- proc = childProcess$2.spawn(process$3.argv[0], args, { stdio: "inherit" });
22735
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
22736
+ proc = childProcess$2.spawn(process$2.argv[0], args, { stdio: "inherit" });
22695
22737
  } else proc = childProcess$2.spawn(executableFile, args, { stdio: "inherit" });
22696
22738
  else {
22697
22739
  this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
22698
22740
  args.unshift(executableFile);
22699
- args = incrementNodeInspectorPort(process$3.execArgv).concat(args);
22700
- proc = childProcess$2.spawn(process$3.execPath, args, { stdio: "inherit" });
22741
+ args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
22742
+ proc = childProcess$2.spawn(process$2.execPath, args, { stdio: "inherit" });
22701
22743
  }
22702
22744
  if (!proc.killed) [
22703
22745
  "SIGUSR1",
@@ -22706,20 +22748,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
22706
22748
  "SIGINT",
22707
22749
  "SIGHUP"
22708
22750
  ].forEach((signal) => {
22709
- process$3.on(signal, () => {
22751
+ process$2.on(signal, () => {
22710
22752
  if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
22711
22753
  });
22712
22754
  });
22713
22755
  const exitCallback = this._exitCallback;
22714
22756
  proc.on("close", (code) => {
22715
22757
  code = code ?? 1;
22716
- if (!exitCallback) process$3.exit(code);
22758
+ if (!exitCallback) process$2.exit(code);
22717
22759
  else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
22718
22760
  });
22719
22761
  proc.on("error", (err) => {
22720
22762
  if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
22721
22763
  else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
22722
- if (!exitCallback) process$3.exit(1);
22764
+ if (!exitCallback) process$2.exit(1);
22723
22765
  else {
22724
22766
  const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
22725
22767
  wrappedError.nestedError = err;
@@ -23128,13 +23170,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
23128
23170
  */
23129
23171
  _parseOptionsEnv() {
23130
23172
  this.options.forEach((option) => {
23131
- if (option.envVar && option.envVar in process$3.env) {
23173
+ if (option.envVar && option.envVar in process$2.env) {
23132
23174
  const optionKey = option.attributeName();
23133
23175
  if (this.getOptionValue(optionKey) === void 0 || [
23134
23176
  "default",
23135
23177
  "config",
23136
23178
  "env"
23137
- ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$3.env[option.envVar]);
23179
+ ].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
23138
23180
  else this.emit(`optionEnv:${option.name()}`);
23139
23181
  }
23140
23182
  });
@@ -23551,7 +23593,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
23551
23593
  */
23552
23594
  help(contextOptions) {
23553
23595
  this.outputHelp(contextOptions);
23554
- let exitCode = Number(process$3.exitCode ?? 0);
23596
+ let exitCode = Number(process$2.exitCode ?? 0);
23555
23597
  if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
23556
23598
  this._exit(exitCode, "commander.help", "(outputHelp)");
23557
23599
  }
@@ -23641,8 +23683,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
23641
23683
  * @package
23642
23684
  */
23643
23685
  function useColor() {
23644
- if (process$3.env.NO_COLOR || process$3.env.FORCE_COLOR === "0" || process$3.env.FORCE_COLOR === "false") return false;
23645
- if (process$3.env.FORCE_COLOR || process$3.env.CLICOLOR_FORCE !== void 0) return true;
23686
+ if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
23687
+ if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
23646
23688
  }
23647
23689
  exports.Command = Command;
23648
23690
  exports.useColor = useColor;
@@ -88898,6 +88940,25 @@ const SYSTEM_FILES_TO_IGNORE = [
88898
88940
  ".Trashes"
88899
88941
  ];
88900
88942
 
88943
+ //#endregion
88944
+ //#region ../../packages/file-loaders/src/fileParseBudget.ts
88945
+ var FileParseBudgetError, isFileParseBudgetError;
88946
+ var init_fileParseBudget = __esmMin((() => {
88947
+ FileParseBudgetError = class extends Error {
88948
+ actual;
88949
+ limit;
88950
+ reason;
88951
+ constructor(reason, limit, actual) {
88952
+ super(`File exceeds the parse budget (${reason}): ${actual} > ${limit}`);
88953
+ this.name = "FileParseBudgetError";
88954
+ this.reason = reason;
88955
+ this.limit = limit;
88956
+ this.actual = actual;
88957
+ }
88958
+ };
88959
+ isFileParseBudgetError = (error) => error instanceof FileParseBudgetError || error instanceof Error && error.name === "FileParseBudgetError";
88960
+ }));
88961
+
88901
88962
  //#endregion
88902
88963
  //#region ../../packages/utils/src/detectUtf16.ts
88903
88964
  var HEURISTIC_SAMPLE_BYTES, HEURISTIC_THRESHOLD, detectUtf16NoBom;
@@ -88922,10 +88983,284 @@ var init_detectUtf16 = __esmMin((() => {
88922
88983
  };
88923
88984
  }));
88924
88985
 
88986
+ //#endregion
88987
+ //#region ../../packages/utils/src/isBinaryContent.ts
88988
+ var NON_PRINTABLE_THRESHOLD, hasUtf8Bom, hasUtf16Bom, sniffBinaryBuffer, REPLACEMENT_CHAR, checkPrintableRatio;
88989
+ var init_isBinaryContent = __esmMin((() => {
88990
+ init_detectUtf16();
88991
+ NON_PRINTABLE_THRESHOLD = .3;
88992
+ hasUtf8Bom = (buf) => buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191;
88993
+ hasUtf16Bom = (buf) => buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
88994
+ sniffBinaryBuffer = (buffer) => {
88995
+ if (buffer.length === 0) return { isBinary: false };
88996
+ if (hasUtf8Bom(buffer) || hasUtf16Bom(buffer)) return { isBinary: false };
88997
+ const utf16Variant = detectUtf16NoBom(buffer);
88998
+ if (utf16Variant) return checkPrintableRatio(new TextDecoder(utf16Variant, { fatal: false }).decode(buffer), buffer.length);
88999
+ if (buffer.includes(0)) return {
89000
+ isBinary: true,
89001
+ reason: "contains null byte"
89002
+ };
89003
+ return checkPrintableRatio(new TextDecoder("utf-8", { fatal: false }).decode(buffer), buffer.length);
89004
+ };
89005
+ REPLACEMENT_CHAR = "�";
89006
+ checkPrintableRatio = (text, sampledBytes) => {
89007
+ if (text.length === 0) return { isBinary: false };
89008
+ let suspect = 0;
89009
+ for (const ch of text) {
89010
+ if (ch === REPLACEMENT_CHAR) {
89011
+ suspect++;
89012
+ continue;
89013
+ }
89014
+ const code = ch.codePointAt(0);
89015
+ if (code < 32 && code !== 9 && code !== 10 && code !== 13) suspect++;
89016
+ }
89017
+ const ratio = suspect / text.length;
89018
+ if (ratio > NON_PRINTABLE_THRESHOLD) return {
89019
+ isBinary: true,
89020
+ reason: `${(ratio * 100).toFixed(1)}% non-printable chars in first ${sampledBytes} bytes`
89021
+ };
89022
+ return { isBinary: false };
89023
+ };
89024
+ }));
89025
+
89026
+ //#endregion
89027
+ //#region ../../packages/file-loaders/src/loaders/ipynb/index.ts
89028
+ var ipynb_exports = /* @__PURE__ */ __exportAll$2({
89029
+ IpynbLoader: () => IpynbLoader,
89030
+ convertIpynbToMarkdown: () => convertIpynbToMarkdown,
89031
+ scrubIpynbFallbackText: () => scrubIpynbFallbackText
89032
+ });
89033
+ var import_src$5, log$11, SCRIPT_TAG_RE, ANSI_RE, MIME_TOKEN, DATA_URI_RE, BASE64_RUN_RE, BASE64_SEPARATOR_RE, NON_BASE64_RE, BASE64_SCRUB_THRESHOLD, joinSource, cleanStreamText, STYLE_BOUNDARY, stripStyleTags, humanSize, humanChars, base64Bytes, scrubDataUris, base64Placeholder, scrubIpynbFallbackText, singleLine, fence, convertOutput, isNotebookCell, convertCell, convertIpynbToBlocks, convertIpynbToMarkdown, BinaryNotebookError, IpynbLoader;
89034
+ var init_ipynb = __esmMin((() => {
89035
+ init_isBinaryContent();
89036
+ import_src$5 = /* @__PURE__ */ __toESM$2(require_src());
89037
+ log$11 = (0, import_src$5.default)("file-loaders:ipynb");
89038
+ SCRIPT_TAG_RE = /<script[\t\n\f\r />]/i;
89039
+ ANSI_RE = /\u001B\[[\d:;?]*[\u0020-\u002F]*[\u0040-\u007E]|\u001B\][^\u0007\u001B\u009C]{0,256}(?:\u0007|\u001B\\)?|\u001B[\u0021-\u002F]{0,2}[\u0030-\u007E]|[\u001B\u0007\u009C]/g;
89040
+ MIME_TOKEN = "[^\\s()<>@,;:\\\\\"/\\[\\]?=]+";
89041
+ DATA_URI_RE = new RegExp(`data:(${MIME_TOKEN}/${MIME_TOKEN})?(?:;${MIME_TOKEN}=${MIME_TOKEN})*;base64,([\\d+/=A-Za-z]{256,})`, "gi");
89042
+ BASE64_RUN_RE = /[\d+/=A-Za-z]{32,}(?:(?:"[\s,]*"|\\n|\r?\n)+[\d+/=A-Za-z]{32,})*/g;
89043
+ BASE64_SEPARATOR_RE = /((?:"[\s,]*"|\\n|\r?\n)+)/;
89044
+ NON_BASE64_RE = /[^\d+/=A-Z]/gi;
89045
+ BASE64_SCRUB_THRESHOLD = 1024;
89046
+ joinSource = (source) => Array.isArray(source) ? source.filter((part) => typeof part === "string").join("") : typeof source === "string" ? source : "";
89047
+ cleanStreamText = (text) => text.replaceAll(ANSI_RE, "").replaceAll("\r\n", "\n").split("\n").map((line) => {
89048
+ return line.split("\r").filter((frame) => frame !== "").at(-1) ?? "";
89049
+ }).join("\n");
89050
+ STYLE_BOUNDARY = new Set([
89051
+ 9,
89052
+ 10,
89053
+ 12,
89054
+ 13,
89055
+ 32,
89056
+ 47,
89057
+ 62
89058
+ ]);
89059
+ stripStyleTags = (html) => {
89060
+ const openRe = /<style/gi;
89061
+ const closeRe = /<\/style[\t\n\f\r ]*>/gi;
89062
+ let result = "";
89063
+ let pos = 0;
89064
+ while (pos < html.length) {
89065
+ openRe.lastIndex = pos;
89066
+ const open = openRe.exec(html);
89067
+ if (open === null) {
89068
+ result += html.slice(pos);
89069
+ break;
89070
+ }
89071
+ if (!STYLE_BOUNDARY.has(html.charCodeAt(open.index + 6))) {
89072
+ result += html.slice(pos, open.index + 6);
89073
+ pos = open.index + 6;
89074
+ continue;
89075
+ }
89076
+ result += html.slice(pos, open.index);
89077
+ closeRe.lastIndex = open.index;
89078
+ const close = closeRe.exec(html);
89079
+ if (close === null) break;
89080
+ pos = close.index + close[0].length;
89081
+ }
89082
+ return result;
89083
+ };
89084
+ humanSize = (bytes) => bytes >= 1024 ? `${Math.round(bytes / 1024)} KB` : `${bytes} B`;
89085
+ humanChars = (chars) => chars >= 1024 ? `${Math.round(chars / 1024)}k chars` : `${chars} chars`;
89086
+ base64Bytes = (payload) => {
89087
+ const clean = payload.replaceAll(NON_BASE64_RE, "");
89088
+ const padding = Math.min(2, (clean.match(/=*$/) ?? [""])[0].length);
89089
+ return Math.floor(clean.length * 3 / 4) - padding;
89090
+ };
89091
+ scrubDataUris = (text) => text.replaceAll(DATA_URI_RE, (_match, mime, payload) => `data:${mime ?? "unknown"};base64,[${humanSize(base64Bytes(payload))} omitted]`);
89092
+ base64Placeholder = (payload) => `[base64 payload — ${humanSize(base64Bytes(payload))}, omitted]`;
89093
+ scrubIpynbFallbackText = (raw) => raw.replaceAll(BASE64_RUN_RE, (match) => {
89094
+ const parts = match.split(BASE64_SEPARATOR_RE);
89095
+ if (parts.length > 1) {
89096
+ const segments = parts.filter((_, index) => index % 2 === 0);
89097
+ const payload = segments.join("");
89098
+ if (segments.slice(0, -1).every((segment) => segment.length === 76) && payload.length >= BASE64_SCRUB_THRESHOLD) return base64Placeholder(payload);
89099
+ return parts.map((part, index) => index % 2 === 0 && part.length >= BASE64_SCRUB_THRESHOLD ? base64Placeholder(part) : part).join("");
89100
+ }
89101
+ if (match.length < BASE64_SCRUB_THRESHOLD) return match;
89102
+ return base64Placeholder(match);
89103
+ });
89104
+ singleLine = (text) => text.replaceAll(/[`\r\n]+/g, " ").trim();
89105
+ fence = (body, language = "") => {
89106
+ let longest = 0;
89107
+ for (const run of body.match(/`{3,}/g) ?? []) if (run.length > longest) longest = run.length;
89108
+ const ticks = "`".repeat(longest > 0 ? longest + 1 : 3);
89109
+ return [
89110
+ ticks + language,
89111
+ body,
89112
+ ticks
89113
+ ].join("\n");
89114
+ };
89115
+ convertOutput = (output) => {
89116
+ switch (output.output_type) {
89117
+ case "stream": {
89118
+ const body = cleanStreamText(joinSource(output.text));
89119
+ return body.trim() ? fence(body) : "";
89120
+ }
89121
+ case "error": {
89122
+ const traceback = cleanStreamText((Array.isArray(output.traceback) ? output.traceback : []).filter((line) => typeof line === "string").join("\n"));
89123
+ return [`**Error:** \`${output.ename ?? ""}: ${output.evalue ?? ""}\``, fence(traceback)].join("\n");
89124
+ }
89125
+ case "display_data":
89126
+ case "execute_result": {
89127
+ const data = output.data ?? {};
89128
+ if ("application/vnd.jupyter.widget-view+json" in data) return "`[interactive widget — omitted]`";
89129
+ const html = data["text/html"];
89130
+ if (html !== void 0) {
89131
+ const htmlText = joinSource(html);
89132
+ if (SCRIPT_TAG_RE.test(htmlText)) return `\`[interactive HTML output (script) — ${humanChars(htmlText.length)}, omitted]\``;
89133
+ return scrubDataUris(stripStyleTags(htmlText)).trim();
89134
+ }
89135
+ const svg = data["image/svg+xml"];
89136
+ if (svg !== void 0) {
89137
+ const svgText = joinSource(svg);
89138
+ if (SCRIPT_TAG_RE.test(svgText)) return `\`[svg output (script) — ${humanChars(svgText.length)}, omitted]\``;
89139
+ return scrubDataUris(svgText).trim();
89140
+ }
89141
+ for (const mime of Object.keys(data)) if (mime.startsWith("image/")) return `![${mime} output — ${humanSize(base64Bytes(joinSource(data[mime])))}, omitted]`;
89142
+ const markdown = data["text/markdown"];
89143
+ if (markdown !== void 0) return scrubDataUris(joinSource(markdown));
89144
+ for (const mime of Object.keys(data)) if (mime.startsWith("text/")) {
89145
+ const body = joinSource(data[mime]);
89146
+ return body.trim() ? fence(body) : "";
89147
+ }
89148
+ return `\`[${Object.keys(data).join(", ") || "unknown"} output — omitted]\``;
89149
+ }
89150
+ default: return "";
89151
+ }
89152
+ };
89153
+ isNotebookCell = (cell) => {
89154
+ if (!cell || typeof cell !== "object") return false;
89155
+ const { cell_type: cellType, source } = cell;
89156
+ if (typeof cellType !== "string") return false;
89157
+ return source === void 0 || typeof source === "string" || Array.isArray(source) && source.every((part) => typeof part === "string");
89158
+ };
89159
+ convertCell = (cell, language) => {
89160
+ const source = joinSource(cell.source);
89161
+ switch (cell.cell_type) {
89162
+ case "markdown": return scrubDataUris(source);
89163
+ case "raw": return fence(scrubDataUris(source));
89164
+ case "code": {
89165
+ const blocks = [`${`**In [${cell.execution_count ?? " "}]:**`}\n${fence(source, language)}`];
89166
+ const outputs = (cell.outputs ?? []).map(convertOutput).filter(Boolean);
89167
+ if (outputs.length > 0) blocks.push(`**Output:**\n${outputs.join("\n\n")}`);
89168
+ return blocks.join("\n\n");
89169
+ }
89170
+ default: return source.trim() ? fence(scrubDataUris(source)) : void 0;
89171
+ }
89172
+ };
89173
+ convertIpynbToBlocks = (raw) => {
89174
+ let notebook;
89175
+ try {
89176
+ notebook = JSON.parse(raw.replace(/^\uFEFF/, ""));
89177
+ } catch {
89178
+ return null;
89179
+ }
89180
+ if (!notebook || typeof notebook !== "object" || !Array.isArray(notebook.cells)) return null;
89181
+ if (!Number.isInteger(notebook.nbformat) || notebook.nbformat < 4) return null;
89182
+ if (!notebook.cells.every(isNotebookCell)) return null;
89183
+ try {
89184
+ const languageInfo = notebook.metadata?.language_info;
89185
+ const languageName = typeof languageInfo?.name === "string" ? languageInfo.name : void 0;
89186
+ const language = languageName?.match(/^[\w#+.-]+/)?.[0] ?? "python";
89187
+ const kernel = notebook.metadata?.kernelspec?.display_name ?? notebook.metadata?.kernelspec?.name;
89188
+ const headerBits = ["Jupyter notebook"];
89189
+ if (typeof kernel === "string" && kernel) headerBits.push(`kernel: ${singleLine(kernel)}`);
89190
+ if (languageName) headerBits.push(`language: ${singleLine(languageName)}${typeof languageInfo?.version === "string" && languageInfo.version ? ` ${singleLine(languageInfo.version)}` : ""}`);
89191
+ const blocks = [`> ${headerBits.join(" · ")}`];
89192
+ for (const cell of notebook.cells) {
89193
+ const block = convertCell(cell, language);
89194
+ if (block !== void 0 && block.trim()) blocks.push(block);
89195
+ }
89196
+ return blocks;
89197
+ } catch {
89198
+ return null;
89199
+ }
89200
+ };
89201
+ convertIpynbToMarkdown = (raw) => {
89202
+ const blocks = convertIpynbToBlocks(raw);
89203
+ return blocks === null ? null : blocks.join("\n\n");
89204
+ };
89205
+ BinaryNotebookError = class extends Error {};
89206
+ IpynbLoader = class {
89207
+ async loadPages(filePath) {
89208
+ log$11("Loading ipynb file:", filePath);
89209
+ try {
89210
+ const buffer = await readFile(filePath);
89211
+ const sniff = sniffBinaryBuffer(buffer.subarray(0, 8192));
89212
+ if (sniff.isBinary) {
89213
+ log$11("Rejecting binary content: %s", sniff.reason);
89214
+ throw new BinaryNotebookError(`Binary content in .ipynb file: ${sniff.reason}`);
89215
+ }
89216
+ const raw = buffer.toString("utf8").replace(/^\uFEFF/, "");
89217
+ const blocks = convertIpynbToBlocks(raw);
89218
+ if (blocks === null) {
89219
+ log$11("Not nbformat v4 JSON, falling back to scrubbed raw text");
89220
+ const fallback = scrubIpynbFallbackText(raw);
89221
+ const lines = fallback.split("\n");
89222
+ return [{
89223
+ charCount: fallback.length,
89224
+ lineCount: lines.length,
89225
+ metadata: {
89226
+ lineNumberEnd: lines.length,
89227
+ lineNumberStart: 1
89228
+ },
89229
+ pageContent: fallback
89230
+ }];
89231
+ }
89232
+ log$11("Converted notebook into %d blocks", blocks.length);
89233
+ return blocks.map((block, index) => ({
89234
+ charCount: block.length,
89235
+ lineCount: block.split("\n").length,
89236
+ metadata: {
89237
+ chunkIndex: index,
89238
+ totalChunks: blocks.length
89239
+ },
89240
+ pageContent: block
89241
+ }));
89242
+ } catch (e) {
89243
+ const error = e;
89244
+ if (error instanceof BinaryNotebookError) throw error;
89245
+ console.error(`Error loading ipynb file ${filePath}: ${error.message}`);
89246
+ return [{
89247
+ charCount: 0,
89248
+ lineCount: 0,
89249
+ metadata: { error: `Failed to load ipynb file: ${error.message}` },
89250
+ pageContent: ""
89251
+ }];
89252
+ }
89253
+ }
89254
+ async aggregateContent(pages) {
89255
+ return pages.map((page) => page.pageContent).join("\n\n");
89256
+ }
89257
+ };
89258
+ }));
89259
+
88925
89260
  //#endregion
88926
89261
  //#region ../../packages/file-loaders/src/loaders/text/index.ts
88927
89262
  init_detectUtf16();
88928
- const log$11 = (0, import_src$6.default)("file-loaders:text");
89263
+ const log$10 = (0, import_src$6.default)("file-loaders:text");
88929
89264
  /**
88930
89265
  * Read a text file with automatic encoding detection.
88931
89266
  * Detects UTF-8, UTF-16LE, and UTF-16BE via BOM, with a heuristic fallback
@@ -88934,20 +89269,20 @@ const log$11 = (0, import_src$6.default)("file-loaders:text");
88934
89269
  const readTextFile = async (filePath) => {
88935
89270
  const buffer = await readFile(filePath);
88936
89271
  if (buffer.length >= 2 && buffer[0] === 255 && buffer[1] === 254) {
88937
- log$11("Detected UTF-16LE BOM");
89272
+ log$10("Detected UTF-16LE BOM");
88938
89273
  return new TextDecoder("utf-16le").decode(buffer.subarray(2));
88939
89274
  }
88940
89275
  if (buffer.length >= 2 && buffer[0] === 254 && buffer[1] === 255) {
88941
- log$11("Detected UTF-16BE BOM");
89276
+ log$10("Detected UTF-16BE BOM");
88942
89277
  return new TextDecoder("utf-16be").decode(buffer.subarray(2));
88943
89278
  }
88944
89279
  if (buffer.length >= 3 && buffer[0] === 239 && buffer[1] === 187 && buffer[2] === 191) {
88945
- log$11("Detected UTF-8 BOM");
89280
+ log$10("Detected UTF-8 BOM");
88946
89281
  return buffer.subarray(3).toString("utf8");
88947
89282
  }
88948
89283
  const variant = detectUtf16NoBom(buffer);
88949
89284
  if (variant) {
88950
- log$11("Detected %s without BOM (heuristic)", variant);
89285
+ log$10("Detected %s without BOM (heuristic)", variant);
88951
89286
  return new TextDecoder(variant).decode(buffer);
88952
89287
  }
88953
89288
  return buffer.toString("utf8");
@@ -88957,13 +89292,13 @@ const readTextFile = async (filePath) => {
88957
89292
  */
88958
89293
  var TextLoader = class {
88959
89294
  async loadPages(filePath) {
88960
- log$11("Loading text file:", filePath);
89295
+ log$10("Loading text file:", filePath);
88961
89296
  try {
88962
89297
  const fileContent = await readTextFile(filePath);
88963
- log$11("Text file loaded successfully, size:", fileContent.length, "bytes");
89298
+ log$10("Text file loaded successfully, size:", fileContent.length, "bytes");
88964
89299
  const lineCount = fileContent.split("\n").length;
88965
89300
  const charCount = fileContent.length;
88966
- log$11("Text file stats:", {
89301
+ log$10("Text file stats:", {
88967
89302
  charCount,
88968
89303
  lineCount
88969
89304
  });
@@ -88976,11 +89311,11 @@ var TextLoader = class {
88976
89311
  },
88977
89312
  pageContent: fileContent
88978
89313
  };
88979
- log$11("Text page created successfully");
89314
+ log$10("Text page created successfully");
88980
89315
  return [page];
88981
89316
  } catch (e) {
88982
89317
  const error = e;
88983
- log$11("Error encountered while loading text file");
89318
+ log$10("Error encountered while loading text file");
88984
89319
  console.error(`Error loading text file ${filePath}: ${error.message}`);
88985
89320
  const errorPage = {
88986
89321
  charCount: 0,
@@ -88988,7 +89323,7 @@ var TextLoader = class {
88988
89323
  metadata: { error: `Failed to load text file: ${error.message}` },
88989
89324
  pageContent: ""
88990
89325
  };
88991
- log$11("Created error page for failed text file loading");
89326
+ log$10("Created error page for failed text file loading");
88992
89327
  return [errorPage];
88993
89328
  }
88994
89329
  }
@@ -88999,9 +89334,9 @@ var TextLoader = class {
88999
89334
  * @returns Aggregated content
89000
89335
  */
89001
89336
  async aggregateContent(pages) {
89002
- log$11("Aggregating content from", pages.length, "text pages");
89337
+ log$10("Aggregating content from", pages.length, "text pages");
89003
89338
  const result = pages.map((page) => page.pageContent).join("\n");
89004
- log$11("Content aggregated successfully, length:", result.length);
89339
+ log$10("Content aggregated successfully, length:", result.length);
89005
89340
  return result;
89006
89341
  }
89007
89342
  };
@@ -93492,14 +93827,14 @@ var require_word = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
93492
93827
  //#endregion
93493
93828
  //#region ../../packages/file-loaders/src/loaders/doc/index.ts
93494
93829
  var doc_exports = /* @__PURE__ */ __exportAll$2({ DocLoader: () => DocLoader });
93495
- var import_src$5, import_word, log$10, DocLoader;
93830
+ var import_src$4, import_word, log$9, DocLoader;
93496
93831
  var init_doc = __esmMin((() => {
93497
- import_src$5 = /* @__PURE__ */ __toESM$2(require_src());
93832
+ import_src$4 = /* @__PURE__ */ __toESM$2(require_src());
93498
93833
  import_word = /* @__PURE__ */ __toESM$2(require_word());
93499
- log$10 = (0, import_src$5.default)("file-loaders:doc");
93834
+ log$9 = (0, import_src$4.default)("file-loaders:doc");
93500
93835
  DocLoader = class {
93501
93836
  async loadPages(filePath) {
93502
- log$10("Loading DOC file:", filePath);
93837
+ log$9("Loading DOC file:", filePath);
93503
93838
  try {
93504
93839
  const extracted = await new import_word.default().extract(filePath);
93505
93840
  const pageContent = extracted && typeof extracted.getBody === "function" ? extracted.getBody() : extracted?.text ?? "";
@@ -93510,11 +93845,11 @@ var init_doc = __esmMin((() => {
93510
93845
  metadata: { pageNumber: 1 },
93511
93846
  pageContent
93512
93847
  };
93513
- log$10("DOC loading completed");
93848
+ log$9("DOC loading completed");
93514
93849
  return [page];
93515
93850
  } catch (e) {
93516
93851
  const error = e;
93517
- log$10("Error encountered while loading DOC file");
93852
+ log$9("Error encountered while loading DOC file");
93518
93853
  console.error(`Error loading DOC file ${filePath}: ${error.message}`);
93519
93854
  return [{
93520
93855
  charCount: 0,
@@ -93525,7 +93860,7 @@ var init_doc = __esmMin((() => {
93525
93860
  }
93526
93861
  }
93527
93862
  async aggregateContent(pages) {
93528
- log$10("Aggregating content from", pages.length, "DOC pages");
93863
+ log$9("Aggregating content from", pages.length, "DOC pages");
93529
93864
  return pages.map((p) => p.pageContent).join("\n\n");
93530
93865
  }
93531
93866
  };
@@ -117504,23 +117839,23 @@ var require_lib$2 = /* @__PURE__ */ __commonJSMin$2(((exports) => {
117504
117839
  //#endregion
117505
117840
  //#region ../../packages/file-loaders/src/loaders/docx/index.ts
117506
117841
  var docx_exports = /* @__PURE__ */ __exportAll$2({ DocxLoader: () => DocxLoader });
117507
- var import_src$4, import_lib$3, log$9, DocxLoader;
117842
+ var import_src$3, import_lib$3, log$8, DocxLoader;
117508
117843
  var init_docx = __esmMin((() => {
117509
- import_src$4 = /* @__PURE__ */ __toESM$2(require_src());
117844
+ import_src$3 = /* @__PURE__ */ __toESM$2(require_src());
117510
117845
  import_lib$3 = /* @__PURE__ */ __toESM$2(require_lib$2());
117511
- log$9 = (0, import_src$4.default)("file-loaders:docx");
117846
+ log$8 = (0, import_src$3.default)("file-loaders:docx");
117512
117847
  DocxLoader = class {
117513
117848
  async loadPages(filePath) {
117514
- log$9("Loading DOCX file:", filePath);
117849
+ log$8("Loading DOCX file:", filePath);
117515
117850
  try {
117516
117851
  const buffer = await fs$1.readFile(filePath);
117517
- log$9("File buffer read, size:", buffer.length);
117852
+ log$8("File buffer read, size:", buffer.length);
117518
117853
  const result = await import_lib$3.extractRawText({ buffer });
117519
117854
  const pageContent = result.value;
117520
- log$9("Text extracted, length:", pageContent.length);
117855
+ log$8("Text extracted, length:", pageContent.length);
117521
117856
  const lineCount = pageContent.split("\n").length;
117522
117857
  const charCount = pageContent.length;
117523
- log$9("DOCX document processed, lines:", lineCount, "chars:", charCount);
117858
+ log$8("DOCX document processed, lines:", lineCount, "chars:", charCount);
117524
117859
  const page = {
117525
117860
  charCount,
117526
117861
  lineCount,
@@ -117530,15 +117865,15 @@ var init_docx = __esmMin((() => {
117530
117865
  if (result.messages.length > 0) {
117531
117866
  const warnings = result.messages.filter((msg) => msg.type === "warning");
117532
117867
  if (warnings.length > 0) {
117533
- log$9("Extraction warnings:", warnings.length);
117534
- warnings.forEach((warning) => log$9("Warning:", warning.message));
117868
+ log$8("Extraction warnings:", warnings.length);
117869
+ warnings.forEach((warning) => log$8("Warning:", warning.message));
117535
117870
  }
117536
117871
  }
117537
- log$9("DOCX loading completed");
117872
+ log$8("DOCX loading completed");
117538
117873
  return [page];
117539
117874
  } catch (e) {
117540
117875
  const error = e;
117541
- log$9("Error encountered while loading DOCX file");
117876
+ log$8("Error encountered while loading DOCX file");
117542
117877
  console.error(`Error loading DOCX file ${filePath}: ${error.message}`);
117543
117878
  const errorPage = {
117544
117879
  charCount: 0,
@@ -117546,7 +117881,7 @@ var init_docx = __esmMin((() => {
117546
117881
  metadata: { error: `Failed to load DOCX file: ${error.message}` },
117547
117882
  pageContent: ""
117548
117883
  };
117549
- log$9("Created error page for failed DOCX loading");
117884
+ log$8("Created error page for failed DOCX loading");
117550
117885
  return [errorPage];
117551
117886
  }
117552
117887
  }
@@ -117557,9 +117892,9 @@ var init_docx = __esmMin((() => {
117557
117892
  * @returns Aggregated content as a string.
117558
117893
  */
117559
117894
  async aggregateContent(pages) {
117560
- log$9("Aggregating content from", pages.length, "DOCX pages");
117895
+ log$8("Aggregating content from", pages.length, "DOCX pages");
117561
117896
  const result = pages.map((page) => page.pageContent).join("\n\n");
117562
- log$9("DOCX content aggregated successfully, length:", result.length);
117897
+ log$8("DOCX content aggregated successfully, length:", result.length);
117563
117898
  return result;
117564
117899
  }
117565
117900
  };
@@ -140914,6 +141249,1245 @@ ${page.pageContent}
140914
141249
  };
140915
141250
  }));
140916
141251
 
141252
+ //#endregion
141253
+ //#region ../../packages/file-loaders/src/loaders/excel/sheetBounds.ts
141254
+ var MAX_SHEET_CELLS, isRealCell, clampSheetRefToData;
141255
+ var init_sheetBounds = __esmMin((() => {
141256
+ init_xlsx();
141257
+ init_fileParseBudget();
141258
+ MAX_SHEET_CELLS = 5e6;
141259
+ isRealCell = (cell) => !!cell && typeof cell === "object" && cell.t !== "z" && (cell.v !== void 0 && cell.v !== null ? true : cell.f !== void 0 || cell.w !== void 0);
141260
+ clampSheetRefToData = (worksheet, { maxCells = MAX_SHEET_CELLS } = {}) => {
141261
+ const ref = worksheet?.["!ref"];
141262
+ if (!worksheet || !ref) return;
141263
+ const range = utils.decode_range(ref);
141264
+ let lastRow = range.s.r;
141265
+ let lastCol = range.s.c;
141266
+ for (const key in worksheet) {
141267
+ if (key.charCodeAt(0) === 33) continue;
141268
+ if (!isRealCell(worksheet[key])) continue;
141269
+ const { c, r } = utils.decode_cell(key);
141270
+ if (r < range.s.r || r > range.e.r || c < range.s.c || c > range.e.c) continue;
141271
+ if (r > lastRow) lastRow = r;
141272
+ if (c > lastCol) lastCol = c;
141273
+ }
141274
+ const area = (lastRow - range.s.r + 1) * (lastCol - range.s.c + 1);
141275
+ if (area > maxCells) throw new FileParseBudgetError("sheet-cells", maxCells, area);
141276
+ worksheet["!ref"] = utils.encode_range({
141277
+ e: {
141278
+ c: lastCol,
141279
+ r: lastRow
141280
+ },
141281
+ s: range.s
141282
+ });
141283
+ };
141284
+ }));
141285
+
141286
+ //#endregion
141287
+ //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/fd-slicer.js
141288
+ var require_fd_slicer = /* @__PURE__ */ __commonJSMin$2(((exports) => {
141289
+ var fs$8 = __require("fs");
141290
+ var util$3 = __require("util");
141291
+ var stream = __require("stream");
141292
+ var Readable = stream.Readable;
141293
+ var PassThrough = stream.PassThrough;
141294
+ var Pend = require_pend();
141295
+ var EventEmitter$2 = __require("events").EventEmitter;
141296
+ exports.BufferSlicer = BufferSlicer;
141297
+ exports.FdSlicer = FdSlicer;
141298
+ util$3.inherits(FdSlicer, EventEmitter$2);
141299
+ function FdSlicer(fd) {
141300
+ EventEmitter$2.call(this);
141301
+ this.fd = fd;
141302
+ this.pend = new Pend();
141303
+ this.pend.max = 1;
141304
+ this.refCount = 0;
141305
+ }
141306
+ FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
141307
+ var self = this;
141308
+ self.pend.go(function(cb) {
141309
+ fs$8.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
141310
+ cb();
141311
+ callback(err, bytesRead, buffer);
141312
+ });
141313
+ });
141314
+ };
141315
+ FdSlicer.prototype.createReadStream = function(options) {
141316
+ return new ReadStream(this, options);
141317
+ };
141318
+ FdSlicer.prototype.ref = function() {
141319
+ this.refCount += 1;
141320
+ };
141321
+ FdSlicer.prototype.unref = function() {
141322
+ var self = this;
141323
+ self.refCount -= 1;
141324
+ if (self.refCount < 0) throw new Error("invalid unref");
141325
+ if (self.refCount > 0) return;
141326
+ fs$8.close(self.fd, onCloseDone);
141327
+ function onCloseDone(err) {
141328
+ if (err) self.emit("error", err);
141329
+ else self.emit("close");
141330
+ }
141331
+ };
141332
+ util$3.inherits(ReadStream, Readable);
141333
+ function ReadStream(context, options) {
141334
+ options = options || {};
141335
+ Readable.call(this, options);
141336
+ this.context = context;
141337
+ this.context.ref();
141338
+ this.start = options.start || 0;
141339
+ this.endOffset = options.end;
141340
+ this.pos = this.start;
141341
+ }
141342
+ ReadStream.prototype._read = function(n) {
141343
+ var self = this;
141344
+ var toRead = Math.min(self._readableState.highWaterMark, n);
141345
+ if (self.endOffset != null) toRead = Math.min(toRead, self.endOffset - self.pos);
141346
+ if (toRead <= 0) {
141347
+ self.push(null);
141348
+ this._cleanup();
141349
+ return;
141350
+ }
141351
+ self.context.pend.go(function(cb) {
141352
+ var buffer = Buffer.allocUnsafe(toRead);
141353
+ fs$8.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
141354
+ if (err) self.destroy(err);
141355
+ else if (bytesRead === 0) {
141356
+ self.push(null);
141357
+ self._cleanup();
141358
+ } else {
141359
+ self.pos += bytesRead;
141360
+ self.push(buffer.slice(0, bytesRead));
141361
+ }
141362
+ cb();
141363
+ });
141364
+ });
141365
+ };
141366
+ ReadStream.prototype._destroy = function(err, cb) {
141367
+ this._cleanup();
141368
+ cb(err);
141369
+ };
141370
+ ReadStream.prototype._cleanup = function() {
141371
+ if (this.context != null) {
141372
+ this.context.unref();
141373
+ this.context = null;
141374
+ }
141375
+ };
141376
+ util$3.inherits(BufferSlicer, EventEmitter$2);
141377
+ function BufferSlicer(buffer) {
141378
+ EventEmitter$2.call(this);
141379
+ this.refCount = 0;
141380
+ this.buffer = buffer;
141381
+ }
141382
+ BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
141383
+ if (!(0 <= offset && offset <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
141384
+ if (position < 0) throw new RangeError("position is negative: " + position);
141385
+ if (offset + length > buffer.length) length = buffer.length - offset;
141386
+ if (position + length > this.buffer.length) length = this.buffer.length - position;
141387
+ if (length <= 0) {
141388
+ setImmediate(function() {
141389
+ callback(null, 0);
141390
+ });
141391
+ return;
141392
+ }
141393
+ this.buffer.copy(buffer, offset, position, position + length);
141394
+ setImmediate(function() {
141395
+ callback(null, length);
141396
+ });
141397
+ };
141398
+ BufferSlicer.prototype.createReadStream = function(options) {
141399
+ options = options || {};
141400
+ var readStream = new PassThrough(options);
141401
+ readStream.start = options.start || 0;
141402
+ readStream.endOffset = options.end;
141403
+ readStream.pos = readStream.endOffset || this.buffer.length;
141404
+ var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
141405
+ var maxChunkSize = 65536;
141406
+ var offset = 0;
141407
+ while (true) {
141408
+ var nextOffset = offset + maxChunkSize;
141409
+ if (nextOffset >= entireSlice.length) {
141410
+ if (offset < entireSlice.length) readStream.write(entireSlice.slice(offset, entireSlice.length));
141411
+ break;
141412
+ }
141413
+ readStream.write(entireSlice.slice(offset, nextOffset));
141414
+ offset = nextOffset;
141415
+ }
141416
+ readStream.end();
141417
+ return readStream;
141418
+ };
141419
+ BufferSlicer.prototype.ref = function() {
141420
+ this.refCount += 1;
141421
+ };
141422
+ BufferSlicer.prototype.unref = function() {
141423
+ this.refCount -= 1;
141424
+ if (this.refCount < 0) throw new Error("invalid unref");
141425
+ };
141426
+ }));
141427
+
141428
+ //#endregion
141429
+ //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/crc32.js
141430
+ var require_crc32 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
141431
+ const CRC_TABLE = new Int32Array([
141432
+ 0,
141433
+ 1996959894,
141434
+ 3993919788,
141435
+ 2567524794,
141436
+ 124634137,
141437
+ 1886057615,
141438
+ 3915621685,
141439
+ 2657392035,
141440
+ 249268274,
141441
+ 2044508324,
141442
+ 3772115230,
141443
+ 2547177864,
141444
+ 162941995,
141445
+ 2125561021,
141446
+ 3887607047,
141447
+ 2428444049,
141448
+ 498536548,
141449
+ 1789927666,
141450
+ 4089016648,
141451
+ 2227061214,
141452
+ 450548861,
141453
+ 1843258603,
141454
+ 4107580753,
141455
+ 2211677639,
141456
+ 325883990,
141457
+ 1684777152,
141458
+ 4251122042,
141459
+ 2321926636,
141460
+ 335633487,
141461
+ 1661365465,
141462
+ 4195302755,
141463
+ 2366115317,
141464
+ 997073096,
141465
+ 1281953886,
141466
+ 3579855332,
141467
+ 2724688242,
141468
+ 1006888145,
141469
+ 1258607687,
141470
+ 3524101629,
141471
+ 2768942443,
141472
+ 901097722,
141473
+ 1119000684,
141474
+ 3686517206,
141475
+ 2898065728,
141476
+ 853044451,
141477
+ 1172266101,
141478
+ 3705015759,
141479
+ 2882616665,
141480
+ 651767980,
141481
+ 1373503546,
141482
+ 3369554304,
141483
+ 3218104598,
141484
+ 565507253,
141485
+ 1454621731,
141486
+ 3485111705,
141487
+ 3099436303,
141488
+ 671266974,
141489
+ 1594198024,
141490
+ 3322730930,
141491
+ 2970347812,
141492
+ 795835527,
141493
+ 1483230225,
141494
+ 3244367275,
141495
+ 3060149565,
141496
+ 1994146192,
141497
+ 31158534,
141498
+ 2563907772,
141499
+ 4023717930,
141500
+ 1907459465,
141501
+ 112637215,
141502
+ 2680153253,
141503
+ 3904427059,
141504
+ 2013776290,
141505
+ 251722036,
141506
+ 2517215374,
141507
+ 3775830040,
141508
+ 2137656763,
141509
+ 141376813,
141510
+ 2439277719,
141511
+ 3865271297,
141512
+ 1802195444,
141513
+ 476864866,
141514
+ 2238001368,
141515
+ 4066508878,
141516
+ 1812370925,
141517
+ 453092731,
141518
+ 2181625025,
141519
+ 4111451223,
141520
+ 1706088902,
141521
+ 314042704,
141522
+ 2344532202,
141523
+ 4240017532,
141524
+ 1658658271,
141525
+ 366619977,
141526
+ 2362670323,
141527
+ 4224994405,
141528
+ 1303535960,
141529
+ 984961486,
141530
+ 2747007092,
141531
+ 3569037538,
141532
+ 1256170817,
141533
+ 1037604311,
141534
+ 2765210733,
141535
+ 3554079995,
141536
+ 1131014506,
141537
+ 879679996,
141538
+ 2909243462,
141539
+ 3663771856,
141540
+ 1141124467,
141541
+ 855842277,
141542
+ 2852801631,
141543
+ 3708648649,
141544
+ 1342533948,
141545
+ 654459306,
141546
+ 3188396048,
141547
+ 3373015174,
141548
+ 1466479909,
141549
+ 544179635,
141550
+ 3110523913,
141551
+ 3462522015,
141552
+ 1591671054,
141553
+ 702138776,
141554
+ 2966460450,
141555
+ 3352799412,
141556
+ 1504918807,
141557
+ 783551873,
141558
+ 3082640443,
141559
+ 3233442989,
141560
+ 3988292384,
141561
+ 2596254646,
141562
+ 62317068,
141563
+ 1957810842,
141564
+ 3939845945,
141565
+ 2647816111,
141566
+ 81470997,
141567
+ 1943803523,
141568
+ 3814918930,
141569
+ 2489596804,
141570
+ 225274430,
141571
+ 2053790376,
141572
+ 3826175755,
141573
+ 2466906013,
141574
+ 167816743,
141575
+ 2097651377,
141576
+ 4027552580,
141577
+ 2265490386,
141578
+ 503444072,
141579
+ 1762050814,
141580
+ 4150417245,
141581
+ 2154129355,
141582
+ 426522225,
141583
+ 1852507879,
141584
+ 4275313526,
141585
+ 2312317920,
141586
+ 282753626,
141587
+ 1742555852,
141588
+ 4189708143,
141589
+ 2394877945,
141590
+ 397917763,
141591
+ 1622183637,
141592
+ 3604390888,
141593
+ 2714866558,
141594
+ 953729732,
141595
+ 1340076626,
141596
+ 3518719985,
141597
+ 2797360999,
141598
+ 1068828381,
141599
+ 1219638859,
141600
+ 3624741850,
141601
+ 2936675148,
141602
+ 906185462,
141603
+ 1090812512,
141604
+ 3747672003,
141605
+ 2825379669,
141606
+ 829329135,
141607
+ 1181335161,
141608
+ 3412177804,
141609
+ 3160834842,
141610
+ 628085408,
141611
+ 1382605366,
141612
+ 3423369109,
141613
+ 3138078467,
141614
+ 570562233,
141615
+ 1426400815,
141616
+ 3317316542,
141617
+ 2998733608,
141618
+ 733239954,
141619
+ 1555261956,
141620
+ 3268935591,
141621
+ 3050360625,
141622
+ 752459403,
141623
+ 1541320221,
141624
+ 2607071920,
141625
+ 3965973030,
141626
+ 1969922972,
141627
+ 40735498,
141628
+ 2617837225,
141629
+ 3943577151,
141630
+ 1913087877,
141631
+ 83908371,
141632
+ 2512341634,
141633
+ 3803740692,
141634
+ 2075208622,
141635
+ 213261112,
141636
+ 2463272603,
141637
+ 3855990285,
141638
+ 2094854071,
141639
+ 198958881,
141640
+ 2262029012,
141641
+ 4057260610,
141642
+ 1759359992,
141643
+ 534414190,
141644
+ 2176718541,
141645
+ 4139329115,
141646
+ 1873836001,
141647
+ 414664567,
141648
+ 2282248934,
141649
+ 4279200368,
141650
+ 1711684554,
141651
+ 285281116,
141652
+ 2405801727,
141653
+ 4167216745,
141654
+ 1634467795,
141655
+ 376229701,
141656
+ 2685067896,
141657
+ 3608007406,
141658
+ 1308918612,
141659
+ 956543938,
141660
+ 2808555105,
141661
+ 3495958263,
141662
+ 1231636301,
141663
+ 1047427035,
141664
+ 2932959818,
141665
+ 3654703836,
141666
+ 1088359270,
141667
+ 936918e3,
141668
+ 2847714899,
141669
+ 3736837829,
141670
+ 1202900863,
141671
+ 817233897,
141672
+ 3183342108,
141673
+ 3401237130,
141674
+ 1404277552,
141675
+ 615818150,
141676
+ 3134207493,
141677
+ 3453421203,
141678
+ 1423857449,
141679
+ 601450431,
141680
+ 3009837614,
141681
+ 3294710456,
141682
+ 1567103746,
141683
+ 711928724,
141684
+ 3020668471,
141685
+ 3272380065,
141686
+ 1510334235,
141687
+ 755167117
141688
+ ]);
141689
+ function crc32(buf) {
141690
+ let crc = -1;
141691
+ for (let x of buf) crc = CRC_TABLE[(crc ^ x) & 255] ^ crc >>> 8;
141692
+ return (crc ^ -1) >>> 0;
141693
+ }
141694
+ module.exports = crc32;
141695
+ }));
141696
+
141697
+ //#endregion
141698
+ //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/index.js
141699
+ var require_yauzl = /* @__PURE__ */ __commonJSMin$2(((exports) => {
141700
+ var fs$7 = __require("fs");
141701
+ var zlib$1 = __require("zlib");
141702
+ var fd_slicer = require_fd_slicer();
141703
+ var util$2 = __require("util");
141704
+ var EventEmitter$1 = __require("events").EventEmitter;
141705
+ var Transform$2 = __require("stream").Transform;
141706
+ var PassThrough$1 = __require("stream").PassThrough;
141707
+ var Writable$1 = __require("stream").Writable;
141708
+ const crc32 = typeof zlib$1.crc32 === "function" ? zlib$1.crc32 : require_crc32();
141709
+ exports.open = open;
141710
+ exports.fromBuffer = fromBuffer;
141711
+ function open(path, options, callback) {
141712
+ if (typeof options === "function") {
141713
+ callback = options;
141714
+ options = null;
141715
+ }
141716
+ if (options == null) options = {};
141717
+ if (options.autoClose == null) options.autoClose = true;
141718
+ if (options.lazyEntries == null) options.lazyEntries = false;
141719
+ if (options.decodeStrings == null) options.decodeStrings = true;
141720
+ if (options.validateEntrySizes == null) options.validateEntrySizes = true;
141721
+ if (options.strictFileNames == null) options.strictFileNames = false;
141722
+ if (callback == null) callback = defaultCallback;
141723
+ fs$7.open(path, "r", function(err, fd) {
141724
+ if (err) return callback(err);
141725
+ fromFd(fd, options, function(err, zipfile) {
141726
+ if (err) fs$7.close(fd, defaultCallback);
141727
+ callback(err, zipfile);
141728
+ });
141729
+ });
141730
+ }
141731
+ function fromFd(fd, options, callback) {
141732
+ if (typeof options === "function") {
141733
+ callback = options;
141734
+ options = null;
141735
+ }
141736
+ if (options == null) options = {};
141737
+ if (options.autoClose == null) options.autoClose = false;
141738
+ if (options.lazyEntries == null) options.lazyEntries = false;
141739
+ if (options.decodeStrings == null) options.decodeStrings = true;
141740
+ if (options.validateEntrySizes == null) options.validateEntrySizes = true;
141741
+ if (options.strictFileNames == null) options.strictFileNames = false;
141742
+ if (callback == null) callback = defaultCallback;
141743
+ fs$7.fstat(fd, function(err, stats) {
141744
+ if (err) return callback(err);
141745
+ fromRandomAccessReader(new fd_slicer.FdSlicer(fd), stats.size, options, callback);
141746
+ });
141747
+ }
141748
+ function fromBuffer(buffer, options, callback) {
141749
+ if (typeof options === "function") {
141750
+ callback = options;
141751
+ options = null;
141752
+ }
141753
+ if (options == null) options = {};
141754
+ options.autoClose = false;
141755
+ if (options.lazyEntries == null) options.lazyEntries = false;
141756
+ if (options.decodeStrings == null) options.decodeStrings = true;
141757
+ if (options.validateEntrySizes == null) options.validateEntrySizes = true;
141758
+ if (options.strictFileNames == null) options.strictFileNames = false;
141759
+ fromRandomAccessReader(new fd_slicer.BufferSlicer(buffer), buffer.length, options, callback);
141760
+ }
141761
+ function fromRandomAccessReader(reader, totalSize, options, callback) {
141762
+ if (typeof options === "function") {
141763
+ callback = options;
141764
+ options = null;
141765
+ }
141766
+ if (options == null) options = {};
141767
+ if (options.autoClose == null) options.autoClose = true;
141768
+ if (options.lazyEntries == null) options.lazyEntries = false;
141769
+ if (options.decodeStrings == null) options.decodeStrings = true;
141770
+ var decodeStrings = !!options.decodeStrings;
141771
+ if (options.validateEntrySizes == null) options.validateEntrySizes = true;
141772
+ if (options.strictFileNames == null) options.strictFileNames = false;
141773
+ if (callback == null) callback = defaultCallback;
141774
+ if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
141775
+ if (totalSize > Number.MAX_SAFE_INTEGER) throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
141776
+ reader.ref();
141777
+ var eocdrWithoutCommentSize = 22;
141778
+ var zip64EocdlSize = 20;
141779
+ var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + 65535, totalSize);
141780
+ var buffer = newBuffer(bufferSize);
141781
+ readAndAssertNoEof(reader, buffer, 0, bufferSize, totalSize - buffer.length, function(err) {
141782
+ if (err) return callback(err);
141783
+ for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
141784
+ if (buffer.readUInt32LE(i) !== 101010256) continue;
141785
+ var eocdrBuffer = buffer.subarray(i);
141786
+ var diskNumber = eocdrBuffer.readUInt16LE(4);
141787
+ var entryCount = eocdrBuffer.readUInt16LE(10);
141788
+ var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
141789
+ var commentLength = eocdrBuffer.readUInt16LE(20);
141790
+ var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
141791
+ if (commentLength !== expectedCommentLength) return callback(/* @__PURE__ */ new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));
141792
+ var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
141793
+ if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
141794
+ var zip64EocdrOffset = readUInt64LE(buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize), 8);
141795
+ var zip64EocdrBuffer = newBuffer(56);
141796
+ return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err) {
141797
+ if (err) return callback(err);
141798
+ if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) return callback(/* @__PURE__ */ new Error("invalid zip64 end of central directory record signature"));
141799
+ diskNumber = zip64EocdrBuffer.readUInt32LE(16);
141800
+ if (diskNumber !== 0) return callback(/* @__PURE__ */ new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
141801
+ entryCount = readUInt64LE(zip64EocdrBuffer, 32);
141802
+ centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
141803
+ return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
141804
+ });
141805
+ }
141806
+ if (diskNumber !== 0) return callback(/* @__PURE__ */ new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
141807
+ return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
141808
+ }
141809
+ callback(/* @__PURE__ */ new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
141810
+ });
141811
+ }
141812
+ util$2.inherits(ZipFile, EventEmitter$1);
141813
+ function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
141814
+ var self = this;
141815
+ EventEmitter$1.call(self);
141816
+ self.reader = reader;
141817
+ self.reader.on("error", function(err) {
141818
+ emitError(self, err);
141819
+ });
141820
+ self.reader.once("close", function() {
141821
+ self.emit("close");
141822
+ });
141823
+ self.readEntryCursor = centralDirectoryOffset;
141824
+ self.fileSize = fileSize;
141825
+ self.entryCount = entryCount;
141826
+ self.comment = comment;
141827
+ self.entriesRead = 0;
141828
+ self.autoClose = !!autoClose;
141829
+ self.lazyEntries = !!lazyEntries;
141830
+ self.decodeStrings = !!decodeStrings;
141831
+ self.validateEntrySizes = !!validateEntrySizes;
141832
+ self.strictFileNames = !!strictFileNames;
141833
+ self.isOpen = true;
141834
+ self.emittedError = false;
141835
+ self.hasEachEntryBeenCalled = false;
141836
+ if (!self.lazyEntries) self._readEntry();
141837
+ }
141838
+ ZipFile.prototype.close = function() {
141839
+ if (!this.isOpen) return;
141840
+ this.isOpen = false;
141841
+ this.reader.unref();
141842
+ };
141843
+ function emitErrorAndAutoClose(self, err) {
141844
+ if (self.autoClose) self.close();
141845
+ emitError(self, err);
141846
+ }
141847
+ function emitError(self, err) {
141848
+ if (self.emittedError) return;
141849
+ self.emittedError = true;
141850
+ self.emit("error", err);
141851
+ }
141852
+ ZipFile.prototype.readEntry = function() {
141853
+ if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
141854
+ this._readEntry();
141855
+ };
141856
+ ZipFile.prototype._readEntry = function() {
141857
+ var self = this;
141858
+ if (self.entryCount === self.entriesRead) {
141859
+ setImmediate(function() {
141860
+ if (self.autoClose) self.close();
141861
+ if (self.emittedError) return;
141862
+ self.emit("end");
141863
+ });
141864
+ return;
141865
+ }
141866
+ if (self.emittedError) return;
141867
+ var buffer = newBuffer(46);
141868
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
141869
+ if (err) return emitErrorAndAutoClose(self, err);
141870
+ if (self.emittedError) return;
141871
+ var entry = new Entry();
141872
+ var signature = buffer.readUInt32LE(0);
141873
+ if (signature !== 33639248) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
141874
+ entry.versionMadeBy = buffer.readUInt16LE(4);
141875
+ entry.versionNeededToExtract = buffer.readUInt16LE(6);
141876
+ entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
141877
+ entry.compressionMethod = buffer.readUInt16LE(10);
141878
+ entry.lastModFileTime = buffer.readUInt16LE(12);
141879
+ entry.lastModFileDate = buffer.readUInt16LE(14);
141880
+ entry.crc32 = buffer.readUInt32LE(16);
141881
+ entry.compressedSize = buffer.readUInt32LE(20);
141882
+ entry.uncompressedSize = buffer.readUInt32LE(24);
141883
+ entry.fileNameLength = buffer.readUInt16LE(28);
141884
+ entry.extraFieldLength = buffer.readUInt16LE(30);
141885
+ entry.fileCommentLength = buffer.readUInt16LE(32);
141886
+ entry.internalFileAttributes = buffer.readUInt16LE(36);
141887
+ entry.externalFileAttributes = buffer.readUInt32LE(38);
141888
+ entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
141889
+ if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("strong encryption is not supported"));
141890
+ self.readEntryCursor += 46;
141891
+ buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
141892
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
141893
+ if (err) return emitErrorAndAutoClose(self, err);
141894
+ if (self.emittedError) return;
141895
+ entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
141896
+ var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
141897
+ entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
141898
+ entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
141899
+ try {
141900
+ entry.extraFields = parseExtraFields(entry.extraFieldRaw);
141901
+ } catch (err) {
141902
+ return emitErrorAndAutoClose(self, err);
141903
+ }
141904
+ if (self.decodeStrings) {
141905
+ var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
141906
+ entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
141907
+ entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
141908
+ var errorMessage = validateFileName(entry.fileName);
141909
+ if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
141910
+ } else {
141911
+ entry.fileComment = entry.fileCommentRaw;
141912
+ entry.fileName = entry.fileNameRaw;
141913
+ }
141914
+ entry.comment = entry.fileComment;
141915
+ self.readEntryCursor += buffer.length;
141916
+ self.entriesRead += 1;
141917
+ for (var i = 0; i < entry.extraFields.length; i++) {
141918
+ var extraField = entry.extraFields[i];
141919
+ if (extraField.id !== 1) continue;
141920
+ var zip64EiefBuffer = extraField.data;
141921
+ var index = 0;
141922
+ if (entry.uncompressedSize === 4294967295) {
141923
+ if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include uncompressed size"));
141924
+ entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
141925
+ index += 8;
141926
+ }
141927
+ if (entry.compressedSize === 4294967295) {
141928
+ if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include compressed size"));
141929
+ entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
141930
+ index += 8;
141931
+ }
141932
+ if (entry.relativeOffsetOfLocalHeader === 4294967295) {
141933
+ if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include relative header offset"));
141934
+ entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
141935
+ index += 8;
141936
+ }
141937
+ break;
141938
+ }
141939
+ if (self.validateEntrySizes && entry.compressionMethod === 0) {
141940
+ var expectedCompressedSize = entry.uncompressedSize;
141941
+ if (entry.isEncrypted()) expectedCompressedSize += 12;
141942
+ if (entry.compressedSize !== expectedCompressedSize) {
141943
+ var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
141944
+ return emitErrorAndAutoClose(self, new Error(msg));
141945
+ }
141946
+ }
141947
+ self.emit("entry", entry);
141948
+ if (!self.lazyEntries) self._readEntry();
141949
+ });
141950
+ });
141951
+ };
141952
+ ZipFile.prototype.eachEntry = function() {
141953
+ const self = this;
141954
+ if (!self.lazyEntries) throw new Error("eachEntry() requires lazyEntries: true");
141955
+ if (self.hasEachEntryBeenCalled) throw new Error("eachEntry() must only be called once per ZipFile");
141956
+ self.hasEachEntryBeenCalled = true;
141957
+ let pendingResolveReject = null;
141958
+ self.on("entry", onEntry);
141959
+ self.on("end", onEnd);
141960
+ self.on("error", onError);
141961
+ function cleanup() {
141962
+ self.removeListener("entry", onEntry);
141963
+ self.removeListener("end", onEnd);
141964
+ self.removeListener("error", onError);
141965
+ if (self.autoClose) self.close();
141966
+ }
141967
+ function onEntry(entry) {
141968
+ let { resolve } = pendingResolveReject;
141969
+ pendingResolveReject = null;
141970
+ resolve({ value: entry });
141971
+ }
141972
+ function onEnd() {
141973
+ let { resolve } = pendingResolveReject;
141974
+ pendingResolveReject = null;
141975
+ cleanup();
141976
+ resolve({ done: true });
141977
+ }
141978
+ function onError(err) {
141979
+ let { reject } = pendingResolveReject;
141980
+ pendingResolveReject = null;
141981
+ cleanup();
141982
+ reject(err);
141983
+ }
141984
+ return {
141985
+ [Symbol.asyncIterator]() {
141986
+ return this;
141987
+ },
141988
+ next() {
141989
+ const promise = new Promise((resolve, reject) => {
141990
+ if (pendingResolveReject != null) throw new Error("next() called before previous Promise was resolved.");
141991
+ pendingResolveReject = {
141992
+ resolve,
141993
+ reject
141994
+ };
141995
+ });
141996
+ self.readEntry();
141997
+ return promise;
141998
+ },
141999
+ return(value) {
142000
+ cleanup();
142001
+ return Promise.resolve({
142002
+ done: true,
142003
+ value
142004
+ });
142005
+ },
142006
+ throw(value) {
142007
+ cleanup();
142008
+ return Promise.reject(value);
142009
+ }
142010
+ };
142011
+ };
142012
+ ZipFile.prototype.openReadStream = function(entry, options, callback) {
142013
+ var self = this;
142014
+ var relativeStart = 0;
142015
+ var relativeEnd = entry.compressedSize;
142016
+ if (callback == null) {
142017
+ callback = options;
142018
+ options = null;
142019
+ }
142020
+ if (options == null) options = {};
142021
+ else {
142022
+ if (options.decodeFileData === false) {
142023
+ if (options.decrypt != null) throw new Error("cannot use options.decrypt when options.decodeFileData === false");
142024
+ if (options.decompress != null) throw new Error("cannot use options.decompress when options.decodeFileData === false");
142025
+ } else {
142026
+ if (options.decrypt != null) {
142027
+ if (!entry.isEncrypted()) throw new Error("options.decrypt can only be specified for encrypted entries. See also option decodeFileData.");
142028
+ if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt);
142029
+ if (entry.isCompressed()) {
142030
+ if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.");
142031
+ }
142032
+ }
142033
+ if (options.decompress != null) {
142034
+ if (!entry.isCompressed()) throw new Error("options.decompress can only be specified for compressed entries. See also option decodeFileData.");
142035
+ if (!(options.decompress === false || options.decompress === true)) throw new Error("invalid options.decompress value: " + options.decompress);
142036
+ decompress = options.decompress;
142037
+ }
142038
+ }
142039
+ if (options.start != null) {
142040
+ relativeStart = options.start;
142041
+ if (relativeStart < 0) throw new Error("options.start < 0");
142042
+ if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
142043
+ }
142044
+ if (options.end != null) {
142045
+ relativeEnd = options.end;
142046
+ if (relativeEnd < 0) throw new Error("options.end < 0");
142047
+ if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
142048
+ if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
142049
+ }
142050
+ }
142051
+ var rawMode = options.decodeFileData === false || (entry.compressionMethod === 0 || entry.compressionMethod === 8 && options.decompress === false) && (!entry.isEncrypted() || options.decrypt === false);
142052
+ if (options.start != null || options.end != null) {
142053
+ if (!rawMode) throw new Error("start/end range require options.decodeFileData === false for non-trivial encoded entries.");
142054
+ }
142055
+ if (!self.isOpen) return callback(/* @__PURE__ */ new Error("closed"));
142056
+ if (entry.isEncrypted() && !rawMode) {
142057
+ if (options.decrypt !== false) return callback(/* @__PURE__ */ new Error("entry is encrypted, and options.decodeFileData !== false"));
142058
+ }
142059
+ var decompress;
142060
+ if (rawMode) decompress = false;
142061
+ else if (entry.compressionMethod === 8) decompress = options.decodeFileData !== true;
142062
+ else return callback(/* @__PURE__ */ new Error("unsupported compression method: " + entry.compressionMethod));
142063
+ self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
142064
+ if (err) return callback(err);
142065
+ self.openReadStreamLowLevel(localFileHeader.fileDataStart, entry.compressedSize, relativeStart, relativeEnd, decompress, entry.uncompressedSize, callback);
142066
+ });
142067
+ };
142068
+ ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
142069
+ var self = this;
142070
+ fileDataStart + compressedSize;
142071
+ var readStream = self.reader.createReadStream({
142072
+ start: fileDataStart + relativeStart,
142073
+ end: fileDataStart + relativeEnd
142074
+ });
142075
+ var endpointStream = readStream;
142076
+ if (decompress) {
142077
+ var destroyed = false;
142078
+ var inflateFilter = zlib$1.createInflateRaw();
142079
+ readStream.on("error", function(err) {
142080
+ setImmediate(function() {
142081
+ if (!destroyed) inflateFilter.emit("error", err);
142082
+ });
142083
+ });
142084
+ readStream.pipe(inflateFilter);
142085
+ if (self.validateEntrySizes) {
142086
+ endpointStream = new AssertByteCountStream(uncompressedSize);
142087
+ inflateFilter.on("error", function(err) {
142088
+ setImmediate(function() {
142089
+ if (!destroyed) endpointStream.emit("error", err);
142090
+ });
142091
+ });
142092
+ inflateFilter.pipe(endpointStream);
142093
+ } else endpointStream = inflateFilter;
142094
+ installDestroyFn(endpointStream, function() {
142095
+ destroyed = true;
142096
+ if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
142097
+ readStream.unpipe(inflateFilter);
142098
+ readStream.destroy();
142099
+ });
142100
+ }
142101
+ callback(null, endpointStream);
142102
+ };
142103
+ ZipFile.prototype.readLocalFileHeader = function(entry, options, callback) {
142104
+ var self = this;
142105
+ if (callback == null) {
142106
+ callback = options;
142107
+ options = null;
142108
+ }
142109
+ if (options == null) options = {};
142110
+ self.reader.ref();
142111
+ var buffer = newBuffer(30);
142112
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
142113
+ try {
142114
+ if (err) return callback(err);
142115
+ var signature = buffer.readUInt32LE(0);
142116
+ if (signature !== 67324752) return callback(/* @__PURE__ */ new Error("invalid local file header signature: 0x" + signature.toString(16)));
142117
+ var fileNameLength = buffer.readUInt16LE(26);
142118
+ var extraFieldLength = buffer.readUInt16LE(28);
142119
+ var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
142120
+ if (fileDataStart + entry.compressedSize > self.fileSize) return callback(/* @__PURE__ */ new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
142121
+ if (options.minimal) return callback(null, { fileDataStart });
142122
+ var localFileHeader = new LocalFileHeader();
142123
+ localFileHeader.fileDataStart = fileDataStart;
142124
+ localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
142125
+ localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
142126
+ localFileHeader.compressionMethod = buffer.readUInt16LE(8);
142127
+ localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
142128
+ localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
142129
+ localFileHeader.crc32 = buffer.readUInt32LE(14);
142130
+ localFileHeader.compressedSize = buffer.readUInt32LE(18);
142131
+ localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
142132
+ localFileHeader.fileNameLength = fileNameLength;
142133
+ localFileHeader.extraFieldLength = extraFieldLength;
142134
+ buffer = newBuffer(fileNameLength + extraFieldLength);
142135
+ self.reader.ref();
142136
+ readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err) {
142137
+ try {
142138
+ if (err) return callback(err);
142139
+ localFileHeader.fileName = buffer.subarray(0, fileNameLength);
142140
+ localFileHeader.extraField = buffer.subarray(fileNameLength);
142141
+ return callback(null, localFileHeader);
142142
+ } finally {
142143
+ self.reader.unref();
142144
+ }
142145
+ });
142146
+ } finally {
142147
+ self.reader.unref();
142148
+ }
142149
+ });
142150
+ };
142151
+ ZipFile.prototype.openReadStreamPromise = function(entry, options) {
142152
+ return new Promise((resolve, reject) => {
142153
+ this.openReadStream(entry, options, function(err, readStream) {
142154
+ if (err) return reject(err);
142155
+ resolve(readStream);
142156
+ });
142157
+ });
142158
+ };
142159
+ ZipFile.prototype.openReadStreamLowLevelPromise = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize) {
142160
+ return new Promise((resolve, reject) => {
142161
+ this.openReadStream(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, function(err, readStream) {
142162
+ if (err) return reject(err);
142163
+ resolve(readStream);
142164
+ });
142165
+ });
142166
+ };
142167
+ ZipFile.prototype.readLocalFileHeaderPromise = function(entry, options) {
142168
+ return new Promise((resolve, reject) => {
142169
+ this.readLocalFileHeader(entry, options, function(err, localFileHeader) {
142170
+ if (err) return reject(err);
142171
+ resolve(localFileHeader);
142172
+ });
142173
+ });
142174
+ };
142175
+ function Entry() {}
142176
+ Entry.prototype.getLastModDate = function(options) {
142177
+ if (options == null) options = {};
142178
+ if (!options.forceDosFormat) for (var i = 0; i < this.extraFields.length; i++) {
142179
+ var extraField = this.extraFields[i];
142180
+ if (extraField.id === 21589) {
142181
+ var data = extraField.data;
142182
+ if (data.length < 5) continue;
142183
+ if (!(data[0] & 1)) continue;
142184
+ var posixTimestamp = data.readInt32LE(1);
142185
+ return /* @__PURE__ */ new Date(posixTimestamp * 1e3);
142186
+ } else if (extraField.id === 10) {
142187
+ var data = extraField.data;
142188
+ if (data.length !== 32) continue;
142189
+ if (data.readUInt16LE(4) !== 1) continue;
142190
+ if (data.readUInt16LE(6) !== 24) continue;
142191
+ var millisecondsSince1970 = (data.readUInt32LE(8) + 4294967296 * data.readInt32LE(12)) / 1e4 - 0xa9730b66800;
142192
+ return new Date(millisecondsSince1970);
142193
+ }
142194
+ }
142195
+ return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options.timezone);
142196
+ };
142197
+ Entry.prototype.canDecodeFileData = function() {
142198
+ return !this.isEncrypted() && (this.compressionMethod === 0 || this.compressionMethod === 8);
142199
+ };
142200
+ Entry.prototype.isEncrypted = function() {
142201
+ return (this.generalPurposeBitFlag & 1) !== 0;
142202
+ };
142203
+ Entry.prototype.isCompressed = function() {
142204
+ return this.compressionMethod === 8;
142205
+ };
142206
+ function LocalFileHeader() {}
142207
+ function dosDateTimeToDate(date, time, timezone) {
142208
+ var day = date & 31;
142209
+ var month = (date >> 5 & 15) - 1;
142210
+ var year = (date >> 9 & 127) + 1980;
142211
+ var millisecond = 0;
142212
+ var second = (time & 31) * 2;
142213
+ var minute = time >> 5 & 63;
142214
+ var hour = time >> 11 & 31;
142215
+ if (timezone == null || timezone === "local") return new Date(year, month, day, hour, minute, second, millisecond);
142216
+ else if (timezone === "UTC") return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
142217
+ else throw new Error("unrecognized options.timezone: " + options.timezone);
142218
+ }
142219
+ function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
142220
+ var fileName = null;
142221
+ for (var i = 0; i < extraFields.length; i++) {
142222
+ var extraField = extraFields[i];
142223
+ if (extraField.id === 28789) {
142224
+ if (extraField.data.length < 6) continue;
142225
+ if (extraField.data.readUInt8(0) !== 1) continue;
142226
+ var oldNameCrc32 = extraField.data.readUInt32LE(1);
142227
+ if (crc32(fileNameBuffer) !== oldNameCrc32) continue;
142228
+ fileName = decodeBuffer(extraField.data.subarray(5), true);
142229
+ break;
142230
+ }
142231
+ }
142232
+ if (fileName == null) fileName = decodeBuffer(fileNameBuffer, (generalPurposeBitFlag & 2048) !== 0);
142233
+ if (!strictFileNames) fileName = fileName.replace(/\\/g, "/");
142234
+ return fileName;
142235
+ }
142236
+ function validateFileName(fileName) {
142237
+ if (fileName.indexOf("\\") !== -1) return "invalid characters in fileName: " + fileName;
142238
+ if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) return "absolute path: " + fileName;
142239
+ if (fileName.split("/").indexOf("..") !== -1) return "invalid relative path: " + fileName;
142240
+ return null;
142241
+ }
142242
+ function parseExtraFields(extraFieldBuffer) {
142243
+ var extraFields = [];
142244
+ var i = 0;
142245
+ while (i < extraFieldBuffer.length - 3) {
142246
+ var headerId = extraFieldBuffer.readUInt16LE(i + 0);
142247
+ var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
142248
+ var dataStart = i + 4;
142249
+ var dataEnd = dataStart + dataSize;
142250
+ if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
142251
+ var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
142252
+ extraFields.push({
142253
+ id: headerId,
142254
+ data: dataBuffer
142255
+ });
142256
+ i = dataEnd;
142257
+ }
142258
+ return extraFields;
142259
+ }
142260
+ function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
142261
+ if (length === 0) return setImmediate(function() {
142262
+ callback(null, newBuffer(0));
142263
+ });
142264
+ reader.read(buffer, offset, length, position, function(err, bytesRead) {
142265
+ if (err) return callback(err);
142266
+ if (bytesRead < length) return callback(/* @__PURE__ */ new Error("unexpected EOF"));
142267
+ callback();
142268
+ });
142269
+ }
142270
+ util$2.inherits(AssertByteCountStream, Transform$2);
142271
+ function AssertByteCountStream(byteCount) {
142272
+ Transform$2.call(this);
142273
+ this.actualByteCount = 0;
142274
+ this.expectedByteCount = byteCount;
142275
+ }
142276
+ AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
142277
+ this.actualByteCount += chunk.length;
142278
+ if (this.actualByteCount > this.expectedByteCount) {
142279
+ var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
142280
+ return cb(new Error(msg));
142281
+ }
142282
+ cb(null, chunk);
142283
+ };
142284
+ AssertByteCountStream.prototype._flush = function(cb) {
142285
+ if (this.actualByteCount < this.expectedByteCount) {
142286
+ var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
142287
+ return cb(new Error(msg));
142288
+ }
142289
+ cb();
142290
+ };
142291
+ util$2.inherits(RandomAccessReader, EventEmitter$1);
142292
+ function RandomAccessReader() {
142293
+ EventEmitter$1.call(this);
142294
+ this.refCount = 0;
142295
+ }
142296
+ RandomAccessReader.prototype.ref = function() {
142297
+ this.refCount += 1;
142298
+ };
142299
+ RandomAccessReader.prototype.unref = function() {
142300
+ var self = this;
142301
+ self.refCount -= 1;
142302
+ if (self.refCount > 0) return;
142303
+ if (self.refCount < 0) throw new Error("invalid unref");
142304
+ self.close(onCloseDone);
142305
+ function onCloseDone(err) {
142306
+ if (err) return self.emit("error", err);
142307
+ self.emit("close");
142308
+ }
142309
+ };
142310
+ RandomAccessReader.prototype.createReadStream = function(options) {
142311
+ if (options == null) options = {};
142312
+ var start = options.start;
142313
+ var end = options.end;
142314
+ if (start === end) {
142315
+ var emptyStream = new PassThrough$1();
142316
+ setImmediate(function() {
142317
+ emptyStream.end();
142318
+ });
142319
+ return emptyStream;
142320
+ }
142321
+ var stream = this._readStreamForRange(start, end);
142322
+ var destroyed = false;
142323
+ var refUnrefFilter = new RefUnrefFilter(this);
142324
+ stream.on("error", function(err) {
142325
+ setImmediate(function() {
142326
+ if (!destroyed) refUnrefFilter.emit("error", err);
142327
+ });
142328
+ });
142329
+ installDestroyFn(refUnrefFilter, function() {
142330
+ stream.unpipe(refUnrefFilter);
142331
+ refUnrefFilter.unref();
142332
+ stream.destroy();
142333
+ });
142334
+ var byteCounter = new AssertByteCountStream(end - start);
142335
+ refUnrefFilter.on("error", function(err) {
142336
+ setImmediate(function() {
142337
+ if (!destroyed) byteCounter.emit("error", err);
142338
+ });
142339
+ });
142340
+ installDestroyFn(byteCounter, function() {
142341
+ destroyed = true;
142342
+ refUnrefFilter.unpipe(byteCounter);
142343
+ refUnrefFilter.destroy();
142344
+ });
142345
+ return stream.pipe(refUnrefFilter).pipe(byteCounter);
142346
+ };
142347
+ RandomAccessReader.prototype._readStreamForRange = function(start, end) {
142348
+ throw new Error("not implemented");
142349
+ };
142350
+ RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
142351
+ var readStream = this.createReadStream({
142352
+ start: position,
142353
+ end: position + length
142354
+ });
142355
+ var writeStream = new Writable$1();
142356
+ var written = 0;
142357
+ writeStream._write = function(chunk, encoding, cb) {
142358
+ chunk.copy(buffer, offset + written, 0, chunk.length);
142359
+ written += chunk.length;
142360
+ cb();
142361
+ };
142362
+ writeStream.on("finish", callback);
142363
+ readStream.on("error", function(error) {
142364
+ callback(error);
142365
+ });
142366
+ readStream.pipe(writeStream);
142367
+ };
142368
+ RandomAccessReader.prototype.close = function(callback) {
142369
+ setImmediate(callback);
142370
+ };
142371
+ util$2.inherits(RefUnrefFilter, PassThrough$1);
142372
+ function RefUnrefFilter(context) {
142373
+ PassThrough$1.call(this);
142374
+ this.context = context;
142375
+ this.context.ref();
142376
+ this.unreffedYet = false;
142377
+ }
142378
+ RefUnrefFilter.prototype._flush = function(cb) {
142379
+ this.unref();
142380
+ cb();
142381
+ };
142382
+ RefUnrefFilter.prototype.unref = function(cb) {
142383
+ if (this.unreffedYet) return;
142384
+ this.unreffedYet = true;
142385
+ this.context.unref();
142386
+ };
142387
+ var cp437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0";
142388
+ function decodeBuffer(buffer, isUtf8) {
142389
+ if (isUtf8) return buffer.toString("utf8");
142390
+ else {
142391
+ var result = "";
142392
+ for (var i = 0; i < buffer.length; i++) result += cp437[buffer[i]];
142393
+ return result;
142394
+ }
142395
+ }
142396
+ function readUInt64LE(buffer, offset) {
142397
+ var lower32 = buffer.readUInt32LE(offset);
142398
+ return buffer.readUInt32LE(offset + 4) * 4294967296 + lower32;
142399
+ }
142400
+ var newBuffer;
142401
+ if (typeof Buffer.allocUnsafe === "function") newBuffer = function(len) {
142402
+ return Buffer.allocUnsafe(len);
142403
+ };
142404
+ else newBuffer = function(len) {
142405
+ return new Buffer(len);
142406
+ };
142407
+ function installDestroyFn(stream, fn) {
142408
+ if (typeof stream.destroy === "function") stream._destroy = function(err, cb) {
142409
+ fn();
142410
+ if (cb != null) cb(err);
142411
+ };
142412
+ else stream.destroy = fn;
142413
+ }
142414
+ function defaultCallback(err) {
142415
+ if (err) throw err;
142416
+ }
142417
+ }));
142418
+
142419
+ //#endregion
142420
+ //#region ../../packages/file-loaders/src/loaders/excel/zipBudget.ts
142421
+ var import_yauzl$1, DEFAULT_XLSX_ZIP_LIMITS, WORKSHEET_PART, isZip, preflightXlsxZip;
142422
+ var init_zipBudget = __esmMin((() => {
142423
+ import_yauzl$1 = /* @__PURE__ */ __toESM$2(require_yauzl());
142424
+ init_fileParseBudget();
142425
+ DEFAULT_XLSX_ZIP_LIMITS = {
142426
+ maxEntries: 5e3,
142427
+ maxInputBytes: 64 * 1024 * 1024,
142428
+ maxTotalBytes: 512 * 1024 * 1024,
142429
+ maxWorksheetBytes: 256 * 1024 * 1024
142430
+ };
142431
+ WORKSHEET_PART = /(?:^|\/)worksheets\/[^/]+\.xml$/i;
142432
+ isZip = (data) => data.length >= 4 && data[0] === 80 && data[1] === 75;
142433
+ preflightXlsxZip = (input, limits = DEFAULT_XLSX_ZIP_LIMITS) => {
142434
+ if (!isZip(input)) return Promise.resolve();
142435
+ if (input.byteLength > limits.maxInputBytes) return Promise.reject(new FileParseBudgetError("zip-input", limits.maxInputBytes, input.byteLength));
142436
+ const buffer = Buffer.isBuffer(input) ? input : Buffer.from(input.buffer, input.byteOffset, input.byteLength);
142437
+ return new Promise((resolve, reject) => {
142438
+ import_yauzl$1.fromBuffer(buffer, { lazyEntries: true }, (err, zipfile) => {
142439
+ if (err || !zipfile) return reject(err || /* @__PURE__ */ new Error("Failed to open zip from buffer"));
142440
+ let settled = false;
142441
+ let active;
142442
+ const finish = (error) => {
142443
+ if (settled) return;
142444
+ settled = true;
142445
+ active?.destroy();
142446
+ active = void 0;
142447
+ zipfile.close();
142448
+ if (error) reject(error);
142449
+ else resolve();
142450
+ };
142451
+ if (zipfile.entryCount > limits.maxEntries) return finish(new FileParseBudgetError("zip-entries", limits.maxEntries, zipfile.entryCount));
142452
+ let declaredTotal = 0;
142453
+ let inflatedTotal = 0;
142454
+ const checkSizes = (entryBytes, total, isSheet) => {
142455
+ if (isSheet && entryBytes > limits.maxWorksheetBytes) return new FileParseBudgetError("sheet-xml", limits.maxWorksheetBytes, entryBytes);
142456
+ if (total > limits.maxTotalBytes) return new FileParseBudgetError("zip-expansion", limits.maxTotalBytes, total);
142457
+ };
142458
+ zipfile.on("entry", (entry) => {
142459
+ const isSheet = WORKSHEET_PART.test(entry.fileName);
142460
+ declaredTotal += entry.uncompressedSize;
142461
+ const declaredError = checkSizes(entry.uncompressedSize, declaredTotal, isSheet);
142462
+ if (declaredError) return finish(declaredError);
142463
+ if (entry.fileName.endsWith("/")) return zipfile.readEntry();
142464
+ zipfile.openReadStream(entry, (streamErr, stream) => {
142465
+ if (streamErr || !stream) return finish(streamErr || /* @__PURE__ */ new Error("Failed to open entry"));
142466
+ if (settled) return stream.destroy();
142467
+ active = stream;
142468
+ let entryBytes = 0;
142469
+ stream.on("data", (chunk) => {
142470
+ entryBytes += chunk.length;
142471
+ inflatedTotal += chunk.length;
142472
+ const actualError = checkSizes(entryBytes, inflatedTotal, isSheet);
142473
+ if (actualError) finish(actualError);
142474
+ });
142475
+ stream.on("error", finish);
142476
+ stream.on("end", () => {
142477
+ if (settled) return;
142478
+ active = void 0;
142479
+ zipfile.readEntry();
142480
+ });
142481
+ });
142482
+ });
142483
+ zipfile.on("end", () => finish());
142484
+ zipfile.on("error", finish);
142485
+ zipfile.readEntry();
142486
+ });
142487
+ });
142488
+ };
142489
+ }));
142490
+
140917
142491
  //#endregion
140918
142492
  //#region ../../packages/file-loaders/src/loaders/excel/index.ts
140919
142493
  var excel_exports = /* @__PURE__ */ __exportAll$2({ ExcelLoader: () => ExcelLoader });
@@ -140922,9 +142496,9 @@ var excel_exports = /* @__PURE__ */ __exportAll$2({ ExcelLoader: () => ExcelLoad
140922
142496
  * Handles empty sheets and escapes pipe characters.
140923
142497
  */
140924
142498
  function sheetToMarkdownTable(jsonData) {
140925
- log$8("Converting sheet data to Markdown table, rows:", jsonData?.length || 0);
142499
+ log$7("Converting sheet data to Markdown table, rows:", jsonData?.length || 0);
140926
142500
  if (!jsonData || jsonData.length === 0) {
140927
- log$8("Sheet is empty, returning placeholder message");
142501
+ log$7("Sheet is empty, returning placeholder message");
140928
142502
  return "*Sheet is empty or contains no data.*";
140929
142503
  }
140930
142504
  const toCell = (value) => value === null || value === void 0 ? "" : String(value).replaceAll("|", "\\|").trim();
@@ -140935,57 +142509,62 @@ function sheetToMarkdownTable(jsonData) {
140935
142509
  * workbook into 60+ MB of `| | |` text.
140936
142510
  */
140937
142511
  const headers = Object.keys(jsonData[0] || {}).filter((header) => !header.startsWith("__EMPTY") || jsonData.some((row) => toCell(row[header]) !== ""));
140938
- log$8("Sheet headers:", headers);
142512
+ log$7("Sheet headers:", headers);
140939
142513
  if (headers.length === 0) {
140940
- log$8("Sheet has no headers, returning placeholder message");
142514
+ log$7("Sheet has no headers, returning placeholder message");
140941
142515
  return "*Sheet has headers but no data.*";
140942
142516
  }
140943
142517
  const headerRow = `| ${headers.join(" | ")} |`;
140944
142518
  const separatorRow = `| ${headers.map(() => "---").join(" | ")} |`;
140945
- log$8("Building data rows for Markdown table");
142519
+ log$7("Building data rows for Markdown table");
140946
142520
  const result = `${headerRow}\n${separatorRow}\n${jsonData.map((row) => headers.map((header) => toCell(row[header]))).filter((cells) => cells.some((cell) => cell !== "")).map((cells) => `| ${cells.join(" | ")} |`).join("\n")}`;
140947
- log$8("Markdown table created, length:", result.length);
142521
+ log$7("Markdown table created, length:", result.length);
140948
142522
  return result;
140949
142523
  }
140950
- var import_src$3, log$8, ExcelLoader;
142524
+ var import_src$2, log$7, ExcelLoader;
140951
142525
  var init_excel = __esmMin((() => {
140952
- import_src$3 = /* @__PURE__ */ __toESM$2(require_src());
142526
+ import_src$2 = /* @__PURE__ */ __toESM$2(require_src());
140953
142527
  init_xlsx();
142528
+ init_fileParseBudget();
140954
142529
  init_prompt$1();
140955
- log$8 = (0, import_src$3.default)("file-loaders:excel");
142530
+ init_sheetBounds();
142531
+ init_zipBudget();
142532
+ log$7 = (0, import_src$2.default)("file-loaders:excel");
140956
142533
  ExcelLoader = class {
140957
142534
  async loadPages(filePath) {
140958
- log$8("Loading Excel file:", filePath);
142535
+ log$7("Loading Excel file:", filePath);
140959
142536
  const pages = [];
140960
142537
  try {
140961
- log$8("Reading Excel file as buffer");
142538
+ log$7("Reading Excel file as buffer");
140962
142539
  const dataBuffer = await readFile(filePath);
140963
- log$8("Excel file read successfully, size:", dataBuffer.length, "bytes");
140964
- log$8("Parsing Excel workbook");
142540
+ log$7("Excel file read successfully, size:", dataBuffer.length, "bytes");
142541
+ await preflightXlsxZip(dataBuffer);
142542
+ log$7("Parsing Excel workbook");
140965
142543
  const workbook = readSync$1(dataBuffer, { type: "buffer" });
140966
- log$8("Excel workbook parsed successfully, sheets:", workbook.SheetNames.length);
142544
+ log$7("Excel workbook parsed successfully, sheets:", workbook.SheetNames.length);
140967
142545
  for (const sheetName of workbook.SheetNames) {
140968
- log$8(`Processing sheet: ${sheetName}`);
142546
+ log$7(`Processing sheet: ${sheetName}`);
140969
142547
  const worksheet = workbook.Sheets[sheetName];
142548
+ clampSheetRefToData(worksheet);
140970
142549
  const jsonData = utils.sheet_to_json(worksheet, {
140971
142550
  defval: "",
140972
142551
  raw: false
140973
142552
  });
140974
- log$8(`Sheet ${sheetName} converted to JSON, rows:`, jsonData.length);
142553
+ log$7(`Sheet ${sheetName} converted to JSON, rows:`, jsonData.length);
140975
142554
  const tableMarkdown = sheetToMarkdownTable(jsonData);
140976
142555
  const lineCount = tableMarkdown.split("\n").length;
140977
142556
  const charCount = tableMarkdown.length;
140978
- log$8(`Sheet ${sheetName} converted to Markdown, lines: ${lineCount}, chars: ${charCount}`);
142557
+ log$7(`Sheet ${sheetName} converted to Markdown, lines: ${lineCount}, chars: ${charCount}`);
140979
142558
  pages.push({
140980
142559
  charCount,
140981
142560
  lineCount,
140982
142561
  metadata: { sheetName },
140983
142562
  pageContent: tableMarkdown.trim()
140984
142563
  });
140985
- log$8(`Added sheet ${sheetName} as page`);
142564
+ log$7(`Added sheet ${sheetName} as page`);
140986
142565
  }
140987
142566
  if (pages.length === 0) {
140988
- log$8("Excel file contains no sheets, creating empty page with error");
142567
+ log$7("Excel file contains no sheets, creating empty page with error");
140989
142568
  pages.push({
140990
142569
  charCount: 0,
140991
142570
  lineCount: 0,
@@ -140993,11 +142572,12 @@ var init_excel = __esmMin((() => {
140993
142572
  pageContent: ""
140994
142573
  });
140995
142574
  }
140996
- log$8("Excel loading completed, total pages:", pages.length);
142575
+ log$7("Excel loading completed, total pages:", pages.length);
140997
142576
  return pages;
140998
142577
  } catch (e) {
142578
+ if (isFileParseBudgetError(e)) throw e;
140999
142579
  const error = e;
141000
- log$8("Error encountered while loading Excel file");
142580
+ log$7("Error encountered while loading Excel file");
141001
142581
  console.error(`Error loading Excel file ${filePath}: ${error.message}`);
141002
142582
  const errorPage = {
141003
142583
  charCount: 0,
@@ -141005,7 +142585,7 @@ var init_excel = __esmMin((() => {
141005
142585
  metadata: { error: `Failed to load Excel file: ${error.message}` },
141006
142586
  pageContent: ""
141007
142587
  };
141008
- log$8("Created error page for failed Excel loading");
142588
+ log$7("Created error page for failed Excel loading");
141009
142589
  return [errorPage];
141010
142590
  }
141011
142591
  }
@@ -141016,288 +142596,14 @@ var init_excel = __esmMin((() => {
141016
142596
  * @returns Aggregated content as a string.
141017
142597
  */
141018
142598
  async aggregateContent(pages) {
141019
- log$8("Aggregating content from", pages.length, "Excel pages");
142599
+ log$7("Aggregating content from", pages.length, "Excel pages");
141020
142600
  const result = promptTemplate$1(pages);
141021
- log$8("Excel content aggregated successfully, length:", result.length);
142601
+ log$7("Excel content aggregated successfully, length:", result.length);
141022
142602
  return result;
141023
142603
  }
141024
142604
  };
141025
142605
  }));
141026
142606
 
141027
- //#endregion
141028
- //#region ../../packages/utils/src/isBinaryContent.ts
141029
- var NON_PRINTABLE_THRESHOLD, hasUtf8Bom, hasUtf16Bom, sniffBinaryBuffer, REPLACEMENT_CHAR, checkPrintableRatio;
141030
- var init_isBinaryContent = __esmMin((() => {
141031
- init_detectUtf16();
141032
- NON_PRINTABLE_THRESHOLD = .3;
141033
- hasUtf8Bom = (buf) => buf.length >= 3 && buf[0] === 239 && buf[1] === 187 && buf[2] === 191;
141034
- hasUtf16Bom = (buf) => buf.length >= 2 && (buf[0] === 255 && buf[1] === 254 || buf[0] === 254 && buf[1] === 255);
141035
- sniffBinaryBuffer = (buffer) => {
141036
- if (buffer.length === 0) return { isBinary: false };
141037
- if (hasUtf8Bom(buffer) || hasUtf16Bom(buffer)) return { isBinary: false };
141038
- const utf16Variant = detectUtf16NoBom(buffer);
141039
- if (utf16Variant) return checkPrintableRatio(new TextDecoder(utf16Variant, { fatal: false }).decode(buffer), buffer.length);
141040
- if (buffer.includes(0)) return {
141041
- isBinary: true,
141042
- reason: "contains null byte"
141043
- };
141044
- return checkPrintableRatio(new TextDecoder("utf-8", { fatal: false }).decode(buffer), buffer.length);
141045
- };
141046
- REPLACEMENT_CHAR = "�";
141047
- checkPrintableRatio = (text, sampledBytes) => {
141048
- if (text.length === 0) return { isBinary: false };
141049
- let suspect = 0;
141050
- for (const ch of text) {
141051
- if (ch === REPLACEMENT_CHAR) {
141052
- suspect++;
141053
- continue;
141054
- }
141055
- const code = ch.codePointAt(0);
141056
- if (code < 32 && code !== 9 && code !== 10 && code !== 13) suspect++;
141057
- }
141058
- const ratio = suspect / text.length;
141059
- if (ratio > NON_PRINTABLE_THRESHOLD) return {
141060
- isBinary: true,
141061
- reason: `${(ratio * 100).toFixed(1)}% non-printable chars in first ${sampledBytes} bytes`
141062
- };
141063
- return { isBinary: false };
141064
- };
141065
- }));
141066
-
141067
- //#endregion
141068
- //#region ../../packages/file-loaders/src/loaders/ipynb/index.ts
141069
- var ipynb_exports = /* @__PURE__ */ __exportAll$2({
141070
- IpynbLoader: () => IpynbLoader,
141071
- convertIpynbToMarkdown: () => convertIpynbToMarkdown,
141072
- scrubIpynbFallbackText: () => scrubIpynbFallbackText
141073
- });
141074
- var import_src$2, log$7, SCRIPT_TAG_RE, ANSI_RE, MIME_TOKEN, DATA_URI_RE, BASE64_RUN_RE, BASE64_SEPARATOR_RE, NON_BASE64_RE, BASE64_SCRUB_THRESHOLD, joinSource, cleanStreamText, STYLE_BOUNDARY, stripStyleTags, humanSize, humanChars, base64Bytes, scrubDataUris, base64Placeholder, scrubIpynbFallbackText, singleLine, fence, convertOutput, isNotebookCell, convertCell, convertIpynbToBlocks, convertIpynbToMarkdown, BinaryNotebookError, IpynbLoader;
141075
- var init_ipynb = __esmMin((() => {
141076
- init_isBinaryContent();
141077
- import_src$2 = /* @__PURE__ */ __toESM$2(require_src());
141078
- log$7 = (0, import_src$2.default)("file-loaders:ipynb");
141079
- SCRIPT_TAG_RE = /<script[\t\n\f\r />]/i;
141080
- ANSI_RE = /\u001B\[[\d:;?]*[\u0020-\u002F]*[\u0040-\u007E]|\u001B\][^\u0007\u001B\u009C]{0,256}(?:\u0007|\u001B\\)?|\u001B[\u0021-\u002F]{0,2}[\u0030-\u007E]|[\u001B\u0007\u009C]/g;
141081
- MIME_TOKEN = "[^\\s()<>@,;:\\\\\"/\\[\\]?=]+";
141082
- DATA_URI_RE = new RegExp(`data:(${MIME_TOKEN}/${MIME_TOKEN})?(?:;${MIME_TOKEN}=${MIME_TOKEN})*;base64,([\\d+/=A-Za-z]{256,})`, "gi");
141083
- BASE64_RUN_RE = /[\d+/=A-Za-z]{32,}(?:(?:"[\s,]*"|\\n|\r?\n)+[\d+/=A-Za-z]{32,})*/g;
141084
- BASE64_SEPARATOR_RE = /((?:"[\s,]*"|\\n|\r?\n)+)/;
141085
- NON_BASE64_RE = /[^\d+/=A-Z]/gi;
141086
- BASE64_SCRUB_THRESHOLD = 1024;
141087
- joinSource = (source) => Array.isArray(source) ? source.filter((part) => typeof part === "string").join("") : typeof source === "string" ? source : "";
141088
- cleanStreamText = (text) => text.replaceAll(ANSI_RE, "").replaceAll("\r\n", "\n").split("\n").map((line) => {
141089
- return line.split("\r").filter((frame) => frame !== "").at(-1) ?? "";
141090
- }).join("\n");
141091
- STYLE_BOUNDARY = new Set([
141092
- 9,
141093
- 10,
141094
- 12,
141095
- 13,
141096
- 32,
141097
- 47,
141098
- 62
141099
- ]);
141100
- stripStyleTags = (html) => {
141101
- const openRe = /<style/gi;
141102
- const closeRe = /<\/style[\t\n\f\r ]*>/gi;
141103
- let result = "";
141104
- let pos = 0;
141105
- while (pos < html.length) {
141106
- openRe.lastIndex = pos;
141107
- const open = openRe.exec(html);
141108
- if (open === null) {
141109
- result += html.slice(pos);
141110
- break;
141111
- }
141112
- if (!STYLE_BOUNDARY.has(html.charCodeAt(open.index + 6))) {
141113
- result += html.slice(pos, open.index + 6);
141114
- pos = open.index + 6;
141115
- continue;
141116
- }
141117
- result += html.slice(pos, open.index);
141118
- closeRe.lastIndex = open.index;
141119
- const close = closeRe.exec(html);
141120
- if (close === null) break;
141121
- pos = close.index + close[0].length;
141122
- }
141123
- return result;
141124
- };
141125
- humanSize = (bytes) => bytes >= 1024 ? `${Math.round(bytes / 1024)} KB` : `${bytes} B`;
141126
- humanChars = (chars) => chars >= 1024 ? `${Math.round(chars / 1024)}k chars` : `${chars} chars`;
141127
- base64Bytes = (payload) => {
141128
- const clean = payload.replaceAll(NON_BASE64_RE, "");
141129
- const padding = Math.min(2, (clean.match(/=*$/) ?? [""])[0].length);
141130
- return Math.floor(clean.length * 3 / 4) - padding;
141131
- };
141132
- scrubDataUris = (text) => text.replaceAll(DATA_URI_RE, (_match, mime, payload) => `data:${mime ?? "unknown"};base64,[${humanSize(base64Bytes(payload))} omitted]`);
141133
- base64Placeholder = (payload) => `[base64 payload — ${humanSize(base64Bytes(payload))}, omitted]`;
141134
- scrubIpynbFallbackText = (raw) => raw.replaceAll(BASE64_RUN_RE, (match) => {
141135
- const parts = match.split(BASE64_SEPARATOR_RE);
141136
- if (parts.length > 1) {
141137
- const segments = parts.filter((_, index) => index % 2 === 0);
141138
- const payload = segments.join("");
141139
- if (segments.slice(0, -1).every((segment) => segment.length === 76) && payload.length >= BASE64_SCRUB_THRESHOLD) return base64Placeholder(payload);
141140
- return parts.map((part, index) => index % 2 === 0 && part.length >= BASE64_SCRUB_THRESHOLD ? base64Placeholder(part) : part).join("");
141141
- }
141142
- if (match.length < BASE64_SCRUB_THRESHOLD) return match;
141143
- return base64Placeholder(match);
141144
- });
141145
- singleLine = (text) => text.replaceAll(/[`\r\n]+/g, " ").trim();
141146
- fence = (body, language = "") => {
141147
- let longest = 0;
141148
- for (const run of body.match(/`{3,}/g) ?? []) if (run.length > longest) longest = run.length;
141149
- const ticks = "`".repeat(longest > 0 ? longest + 1 : 3);
141150
- return [
141151
- ticks + language,
141152
- body,
141153
- ticks
141154
- ].join("\n");
141155
- };
141156
- convertOutput = (output) => {
141157
- switch (output.output_type) {
141158
- case "stream": {
141159
- const body = cleanStreamText(joinSource(output.text));
141160
- return body.trim() ? fence(body) : "";
141161
- }
141162
- case "error": {
141163
- const traceback = cleanStreamText((Array.isArray(output.traceback) ? output.traceback : []).filter((line) => typeof line === "string").join("\n"));
141164
- return [`**Error:** \`${output.ename ?? ""}: ${output.evalue ?? ""}\``, fence(traceback)].join("\n");
141165
- }
141166
- case "display_data":
141167
- case "execute_result": {
141168
- const data = output.data ?? {};
141169
- if ("application/vnd.jupyter.widget-view+json" in data) return "`[interactive widget — omitted]`";
141170
- const html = data["text/html"];
141171
- if (html !== void 0) {
141172
- const htmlText = joinSource(html);
141173
- if (SCRIPT_TAG_RE.test(htmlText)) return `\`[interactive HTML output (script) — ${humanChars(htmlText.length)}, omitted]\``;
141174
- return scrubDataUris(stripStyleTags(htmlText)).trim();
141175
- }
141176
- const svg = data["image/svg+xml"];
141177
- if (svg !== void 0) {
141178
- const svgText = joinSource(svg);
141179
- if (SCRIPT_TAG_RE.test(svgText)) return `\`[svg output (script) — ${humanChars(svgText.length)}, omitted]\``;
141180
- return scrubDataUris(svgText).trim();
141181
- }
141182
- for (const mime of Object.keys(data)) if (mime.startsWith("image/")) return `![${mime} output — ${humanSize(base64Bytes(joinSource(data[mime])))}, omitted]`;
141183
- const markdown = data["text/markdown"];
141184
- if (markdown !== void 0) return scrubDataUris(joinSource(markdown));
141185
- for (const mime of Object.keys(data)) if (mime.startsWith("text/")) {
141186
- const body = joinSource(data[mime]);
141187
- return body.trim() ? fence(body) : "";
141188
- }
141189
- return `\`[${Object.keys(data).join(", ") || "unknown"} output — omitted]\``;
141190
- }
141191
- default: return "";
141192
- }
141193
- };
141194
- isNotebookCell = (cell) => {
141195
- if (!cell || typeof cell !== "object") return false;
141196
- const { cell_type: cellType, source } = cell;
141197
- if (typeof cellType !== "string") return false;
141198
- return source === void 0 || typeof source === "string" || Array.isArray(source) && source.every((part) => typeof part === "string");
141199
- };
141200
- convertCell = (cell, language) => {
141201
- const source = joinSource(cell.source);
141202
- switch (cell.cell_type) {
141203
- case "markdown": return scrubDataUris(source);
141204
- case "raw": return fence(scrubDataUris(source));
141205
- case "code": {
141206
- const blocks = [`${`**In [${cell.execution_count ?? " "}]:**`}\n${fence(source, language)}`];
141207
- const outputs = (cell.outputs ?? []).map(convertOutput).filter(Boolean);
141208
- if (outputs.length > 0) blocks.push(`**Output:**\n${outputs.join("\n\n")}`);
141209
- return blocks.join("\n\n");
141210
- }
141211
- default: return source.trim() ? fence(scrubDataUris(source)) : void 0;
141212
- }
141213
- };
141214
- convertIpynbToBlocks = (raw) => {
141215
- let notebook;
141216
- try {
141217
- notebook = JSON.parse(raw.replace(/^\uFEFF/, ""));
141218
- } catch {
141219
- return null;
141220
- }
141221
- if (!notebook || typeof notebook !== "object" || !Array.isArray(notebook.cells)) return null;
141222
- if (!Number.isInteger(notebook.nbformat) || notebook.nbformat < 4) return null;
141223
- if (!notebook.cells.every(isNotebookCell)) return null;
141224
- try {
141225
- const languageInfo = notebook.metadata?.language_info;
141226
- const languageName = typeof languageInfo?.name === "string" ? languageInfo.name : void 0;
141227
- const language = languageName?.match(/^[\w#+.-]+/)?.[0] ?? "python";
141228
- const kernel = notebook.metadata?.kernelspec?.display_name ?? notebook.metadata?.kernelspec?.name;
141229
- const headerBits = ["Jupyter notebook"];
141230
- if (typeof kernel === "string" && kernel) headerBits.push(`kernel: ${singleLine(kernel)}`);
141231
- if (languageName) headerBits.push(`language: ${singleLine(languageName)}${typeof languageInfo?.version === "string" && languageInfo.version ? ` ${singleLine(languageInfo.version)}` : ""}`);
141232
- const blocks = [`> ${headerBits.join(" · ")}`];
141233
- for (const cell of notebook.cells) {
141234
- const block = convertCell(cell, language);
141235
- if (block !== void 0 && block.trim()) blocks.push(block);
141236
- }
141237
- return blocks;
141238
- } catch {
141239
- return null;
141240
- }
141241
- };
141242
- convertIpynbToMarkdown = (raw) => {
141243
- const blocks = convertIpynbToBlocks(raw);
141244
- return blocks === null ? null : blocks.join("\n\n");
141245
- };
141246
- BinaryNotebookError = class extends Error {};
141247
- IpynbLoader = class {
141248
- async loadPages(filePath) {
141249
- log$7("Loading ipynb file:", filePath);
141250
- try {
141251
- const buffer = await readFile(filePath);
141252
- const sniff = sniffBinaryBuffer(buffer.subarray(0, 8192));
141253
- if (sniff.isBinary) {
141254
- log$7("Rejecting binary content: %s", sniff.reason);
141255
- throw new BinaryNotebookError(`Binary content in .ipynb file: ${sniff.reason}`);
141256
- }
141257
- const raw = buffer.toString("utf8").replace(/^\uFEFF/, "");
141258
- const blocks = convertIpynbToBlocks(raw);
141259
- if (blocks === null) {
141260
- log$7("Not nbformat v4 JSON, falling back to scrubbed raw text");
141261
- const fallback = scrubIpynbFallbackText(raw);
141262
- const lines = fallback.split("\n");
141263
- return [{
141264
- charCount: fallback.length,
141265
- lineCount: lines.length,
141266
- metadata: {
141267
- lineNumberEnd: lines.length,
141268
- lineNumberStart: 1
141269
- },
141270
- pageContent: fallback
141271
- }];
141272
- }
141273
- log$7("Converted notebook into %d blocks", blocks.length);
141274
- return blocks.map((block, index) => ({
141275
- charCount: block.length,
141276
- lineCount: block.split("\n").length,
141277
- metadata: {
141278
- chunkIndex: index,
141279
- totalChunks: blocks.length
141280
- },
141281
- pageContent: block
141282
- }));
141283
- } catch (e) {
141284
- const error = e;
141285
- if (error instanceof BinaryNotebookError) throw error;
141286
- console.error(`Error loading ipynb file ${filePath}: ${error.message}`);
141287
- return [{
141288
- charCount: 0,
141289
- lineCount: 0,
141290
- metadata: { error: `Failed to load ipynb file: ${error.message}` },
141291
- pageContent: ""
141292
- }];
141293
- }
141294
- }
141295
- async aggregateContent(pages) {
141296
- return pages.map((page) => page.pageContent).join("\n\n");
141297
- }
141298
- };
141299
- }));
141300
-
141301
142607
  //#endregion
141302
142608
  //#region ../../packages/file-loaders/src/loaders/pdf/domMatrix.ts
141303
142609
  var IDENTITY, readInit, compose, DOMMatrixPolyfill, installDomMatrixPolyfill;
@@ -175372,7 +176678,7 @@ async function incrementalUpdate({ originalData, xrefInfo, changes, xref = null,
175372
176678
  for (const str of buffer) offset = writeString(str, offset, array);
175373
176679
  return array;
175374
176680
  }
175375
- var __webpack_modules__, __webpack_module_cache__, isNodeJS, FONT_IDENTITY_MATRIX, LINE_FACTOR, LINE_DESCENT_FACTOR, BASELINE_FACTOR, RenderingIntentFlag, AnnotationEditorPrefix, AnnotationEditorType, PermissionFlag, MeshFigureType, TextRenderingMode, ImageKind, AnnotationType, AnnotationReplyType, AnnotationFlag, AnnotationFieldFlag, AnnotationBorderStyleType, AnnotationActionEventType, DocumentActionEventType, PageActionEventType, VerbosityLevel, OPS, DrawOPS, PasswordResponses, verbosity, BaseException, PasswordException, UnknownErrorException, InvalidPDFException, ResponseException, FormatError, AbortException, FeatureTest, hexNumbers, Util, PDFStringTranslateTable, NormalizeRegex, NormalizationMap, AnnotationPrefix, CIRCULAR_REF, EOF, CmdCache, NameCache, RefCache, Name, Cmd, nonSerializable, Dict, Ref, RefSet, RefSetCache, BaseStream, PDF_VERSION_REGEXP, MAX_INT_32, MIN_INT_32, IDENTITY_MATRIX, RESOURCES_KEYS_OPERATOR_LIST, RESOURCES_KEYS_TEXT_CONTENT, MissingDataException, ParserEOFException, XRefEntryException, XRefParseException, ROMAN_NUMBER_MAP, XMLEntities, QCMS, wasm, cachedTextDecoder, cachedUint8ArrayMemory0, WASM_VECTOR_LEN, DataType, Intent, ColorSpace, AlternateCS, PatternCS, IndexedCS, DeviceGrayCS, DeviceRgbCS, DeviceRgbaCS, DeviceCmykCS, CalGrayCS, CalRGBCS, LabCS, IccColorSpace, CmykICCBasedCS, Stream$1, StringStream, NullStream, ChunkedStream, ChunkedStreamManager, MIN_IMAGE_DIM, MAX_IMAGE_DIM, MAX_ERROR, ImageResizer, emptyBuffer$1, DecodeStream, StreamsSequenceStream, ColorSpaceUtils, JpegError, DNLMarkerError, EOIMarkerError, dctZigZag, dctCos1, dctSin1, dctCos3, dctSin3, dctCos6, dctSin6, dctSqrt2, dctSqrt1d2, JpegImage, JpegStream, openjpeg, JpxError, JpxImage, InitialState, NullOptimizer, QueueOptimizer, OperatorList, MAX_NUM_SIZE, MAX_ENCODED_NUM_SIZE, BinaryCMapStream, BinaryCMapReader, Ascii85Stream, AsciiHexStream, ccittEOL, ccittEOF, twoDimPass, twoDimHoriz, twoDimVert0, twoDimVertR1, twoDimVertL1, twoDimVertR2, twoDimVertL2, twoDimVertR3, twoDimVertL3, twoDimTable, whiteTable1, whiteTable2, blackTable1, blackTable2, blackTable3, CCITTFaxDecoder, CCITTFaxStream, codeLenCodeMap, lengthDecode, distDecode, fixedLitCodeTab, fixedDistCodeTab, FlateStream, QeTable, ArithmeticDecoder, Jbig2Error, ContextCache, DecodingContext, SegmentTypes, CodingTemplates, RefinementTemplates, ReusedContexts, RefinementReusedContexts, RegionSegmentInformationFieldLength, SimpleSegmentVisitor, HuffmanLine, HuffmanTreeNode, HuffmanTable, standardTablesCache, Reader, Jbig2Image, Jbig2Stream, JpxStream, LZWStream, PredictorStream, RunLengthStream, MAX_LENGTH_TO_CACHE, Parser, specialChars, Lexer, Linearization, BUILT_IN_CMAPS, MAX_MAP_RANGE, CMap, IdentityCMap, CMapFactory, ExpertEncoding, MacExpertEncoding, MacRomanEncoding, StandardEncoding, WinAnsiEncoding, SymbolSetEncoding, ZapfDingbatsEncoding, getGlyphsUnicode, getDingbatsGlyphsUnicode, getSpecialPUASymbols, UnicodeRanges, SpecialCharRegExp, CategoryCache, SEAC_ANALYSIS_ENABLED, FontFlags, MacStandardGlyphOrdering, getVerticalPresentationForm, MAX_SIZE_TO_COMPILE, ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset, MAX_SUBR_NESTING, CFFStandardStrings, NUM_STANDARD_CFF_STRINGS, CharstringValidationData, CharstringValidationData12, CFFParser, CFF, CFFHeader, CFFStrings, CFFIndex, CFFDict, CFFTopDictLayout, CFFTopDict, CFFPrivateDictLayout, CFFPrivateDict, CFFCharsetPredefinedTypes, CFFCharset, CFFEncoding, CFFFDSelect, CFFOffsetTracker, CFFCompiler, getStdFontMap, getFontNameToFileMap, getNonStdFontMap, getSerifFonts, getSymbolsFonts, getGlyphMapForStandardFonts, getSupplementalGlyphMapForArialBlack, getSupplementalGlyphMapForCalibri, ToUnicodeMap, IdentityToUnicodeMap, CFFFont, NOOP, Commands, CompiledFont, TrueTypeCompiled, Type2Compiled, FontRendererFactory, getMetrics, getFontBasicMetrics, ON_CURVE_POINT, X_SHORT_VECTOR, Y_SHORT_VECTOR, REPEAT_FLAG, X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR, Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR, OVERLAP_SIMPLE, ARG_1_AND_2_ARE_WORDS, ARGS_ARE_XY_VALUES, WE_HAVE_A_SCALE, MORE_COMPONENTS, WE_HAVE_AN_X_AND_Y_SCALE, WE_HAVE_A_TWO_BY_TWO, WE_HAVE_INSTRUCTIONS, GlyfTable, Glyph, GlyphHeader, Contour, SimpleGlyph, CompositeGlyph, OTF_HEADER_SIZE, OTF_TABLE_ENTRY_SIZE, OpenTypeFileBuilder, HINTING_ENABLED, COMMAND_MAP, Type1CharString, EEXEC_ENCRYPT_KEY, CHAR_STRS_ENCRYPT_KEY, Type1Parser, Type1Font, PRIVATE_USE_AREAS, PDF_GLYPH_SPACE_UNITS, EXPORT_DATA_PROPERTIES, EXPORT_DATA_EXTRA_PROPERTIES, fonts_Glyph, Font, ErrorFont, CssFontInfo, SystemFontInfo, FontInfo, PatternInfo, FontPathInfo, ShadingType, Pattern, BaseShading, RadialAxialShading, MeshStreamReader, bCache, MeshShading, DummyShading, CalibriBoldFactors, CalibriBoldMetrics, CalibriBoldItalicFactors, CalibriBoldItalicMetrics, CalibriItalicFactors, CalibriItalicMetrics, CalibriRegularFactors, CalibriRegularMetrics, HelveticaBoldFactors, HelveticaBoldMetrics, HelveticaBoldItalicFactors, HelveticaBoldItalicMetrics, HelveticaItalicFactors, HelveticaItalicMetrics, HelveticaRegularFactors, HelveticaRegularMetrics, LiberationSansBoldWidths, LiberationSansBoldMapping, LiberationSansBoldItalicWidths, LiberationSansBoldItalicMapping, LiberationSansItalicWidths, LiberationSansItalicMapping, LiberationSansRegularWidths, LiberationSansRegularMapping, MyriadProBoldFactors, MyriadProBoldMetrics, MyriadProBoldItalicFactors, MyriadProBoldItalicMetrics, MyriadProItalicFactors, MyriadProItalicMetrics, MyriadProRegularFactors, MyriadProRegularMetrics, SegoeuiBoldFactors, SegoeuiBoldMetrics, SegoeuiBoldItalicFactors, SegoeuiBoldItalicMetrics, SegoeuiItalicFactors, SegoeuiItalicMetrics, SegoeuiRegularFactors, SegoeuiRegularMetrics, getXFAFontMap, PostScriptParser, PostScriptTokenTypes, PostScriptToken, PostScriptLexer, BaseLocalCache, LocalImageCache, LocalColorSpaceCache, LocalFunctionCache, LocalGStateCache, LocalTilingPatternCache, RegionalImageCache, GlobalColorSpaceCache, GlobalImageCache, PDFFunctionFactory, PDFFunction, PostScriptStack, PostScriptEvaluator, AstNode, AstArgument, AstLiteral, AstBinaryOperation, AstMin, AstVariable, AstVariableDefinition, ExpressionBuilderVisitor, PostScriptCompiler, baseTypes, arabicTypes, chars, types, NORMAL, BOLD, ITALIC, BOLDITALIC, substitutionMap, fontAliases, SEED, MASK_HIGH, MASK_LOW, MurmurHash3_64, PDFImage, DefaultPartialEvaluatorOptions, PatternType, TEXT_CHUNK_BATCH_SIZE, deferred, TimeSlotManager, PartialEvaluator, TranslatedFont, StateManager, TextState, EvalState, EvaluatorPreprocessor, DefaultAppearanceEvaluator, AppearanceStreamEvaluator, FakeUnicodeFont, DateFormats, TimeFormats, NameOrNumberTree, NameTree, NumberTree, FileSpec, XMLParserErrorCode, XMLParserBase, SimpleDOMNode, SimpleXMLParser, MetadataParser, MAX_DEPTH, StructElementType, StructTreeRoot, StructElementNode, StructElement, StructTreePage, isRef, isValidExplicitDest, Catalog, ObjectLoader, $acceptWhitespace, $addHTML, $appendChild, $childrenToHTML, $clean, $cleanPage, $cleanup, $clone, $consumed, $content, $data, $dump, $extra, $finalize, $flushHTML, $getAttributeIt, $getAttributes, $getAvailableSpace, $getChildrenByClass, $getChildrenByName, $getChildrenByNameIt, $getDataValue, $getExtra, $getRealChildrenByNameIt, $getChildren, $getContainedChildren, $getNextPage, $getSubformParent, $getParent, $getTemplateRoot, $globalData, $hasSettableValue, $ids, $indexOf, $insertAt, $isCDATAXml, $isBindable, $isDataValue, $isDescendent, $isNsAgnostic, $isSplittable, $isThereMoreWidth, $isTransparent, $isUsable, $lastAttribute, $namespaceId, $nodeName, $nsAttributes, $onChild, $onChildCheck, $onText, $pushGlyphs, $popPara, $pushPara, $removeChild, $root, $resolvePrototypes, $searchNode, $setId, $setSetAttributes, $setValue, $tabIndex, $text, $toPages, $toHTML, $toString, $toStyle, $uid, $buildXFAObject, NamespaceIds, dimConverters, measurementPattern, HTMLResult, FontFinder, WIDTH_FACTOR, text_FontInfo, FontSelector, TextMeasure, namePattern, indexPattern, operators, shortcuts, somCache, _applyPrototype, _attributes, _attributeNames, _children, _cloneAttribute, _dataValue, _defaultValue, _filteredChildrenGenerator, _getPrototype, _getUnsetAttributes, _hasChildren, _max, _options, _parent, _resolvePrototypesHelper, _setAttributes, _validator, uid, NS_DATASETS, XFAObject, XFAObjectArray, XFAAttribute, XmlObject, ContentObject, OptionObject, StringObject, IntegerObject, Option01, Option10, converters, TEMPLATE_NS_ID, SVG_NS, MAX_ATTEMPTS_FOR_LRTB_LAYOUT, MAX_EMPTY_PAGES, DEFAULT_TAB_INDEX, HEADING_PATTERN, MIMES, IMAGES_HEADERS, AppearanceFilter, Arc, Area, Assist, Barcode, Bind, BindItems, Bookend, BooleanElement, Border, Break, BreakAfter, BreakBefore, Button, Calculate, Caption, Certificate, Certificates, CheckButton, ChoiceList, Color, Comb, Connect, ContentArea, Corner, DateElement, DateTime, DateTimeEdit, Decimal, DefaultUi, Desc, DigestMethod, DigestMethods, Draw, Edge, Encoding, Encodings, Encrypt, EncryptData, Encryption, EncryptionMethod, EncryptionMethods, Event$1, ExData, ExObject, ExclGroup, Execute, Extras, Field, Fill, Filter, Float, template_Font, Format, Handler, Hyphenation, Image$1, ImageEdit, Integer, Issuers, Items, Keep, KeyUsage, Line, Linear, LockDocument, Manifest, Margin, Mdp, Medium, Message, NumericEdit, Occur, Oid, Oids, Overflow, PageArea, PageSet, Para, PasswordEdit, template_Pattern, Picture, Proto, Radial, Reason, Reasons, Rectangle, RefElement, Script, SetProperty, SignData, Signature, Signing, Solid, Speak, Stipple, Subform, SubformSet, SubjectDN, SubjectDNs, Submit, Template, Text, TextEdit, Time, TimeStamp, ToolTip, Traversal, Traverse, Ui, Validate, Value, Variables, TemplateNamespace, bind_NS_DATASETS, Binder, DataHandler, CONFIG_NS_ID, Acrobat, Acrobat7, ADBE_JSConsole, ADBE_JSDebugger, AddSilentPrint, AddViewerPreferences, AdjustData, AdobeExtensionLevel, Agent$1, AlwaysEmbed, Amd, config_Area, Attributes, AutoSave, Base, BatchOutput, BehaviorOverride, Cache, Change, Common, Compress, CompressLogicalStructure, CompressObjectStream, Compression, Config, Conformance, ContentCopy, Copies, Creator, CurrentPage, Data, Debug, DefaultTypeface, Destination, DocumentAssembly, Driver, DuplexOption, DynamicRender, Embed, config_Encrypt, config_Encryption, EncryptionLevel, Enforce, Equate, EquateRange, Exclude, ExcludeNS, FlipLabel, config_FontInfo, FormFieldFilling, GroupParent, IfEmpty, IncludeXDPContent, IncrementalLoad, IncrementalMerge, Interactive, Jog, LabelPrinter, Layout, Level, Linearized, Locale, LocaleSet, Log, MapElement, MediumInfo, config_Message, Messaging, Mode, ModifyAnnots, MsgId, NameAttr, NeverEmbed, NumberOfCopies, OpenAction, Output, OutputBin, OutputXSL, Overprint, Packets, PageOffset, PageRange, Pagination, PaginationOverride, Part, Pcl, Pdf, Pdfa, Permissions, PickTrayByPDFSize, config_Picture, PlaintextMetadata, Presence, Present, Print, PrintHighQuality, PrintScaling, PrinterName, Producer, Ps, Range$1, Record, Relevant, Rename, RenderPolicy, RunScripts, config_Script, ScriptModel, Severity, SilentPrint, Staple, StartNode, StartPage, SubmitFormat, SubmitUrl, SubsetBelow, SuppressBanner, Tagged, config_Template, Threshold, To, TemplateCache, Trace, Transform$2, Type, Uri, config_Validate, ValidateApprovalSignatures, ValidationMessaging, Version, VersionControl, ViewerPreferences, WebClient, Whitespace, Window, Xdc, Xdp, Xsl, Zpl, ConfigNamespace, CONNECTION_SET_NS_ID, ConnectionSet, EffectiveInputPolicy, EffectiveOutputPolicy, Operation, RootElement, SoapAction, SoapAddress, connection_set_Uri, WsdlAddress, WsdlConnection, XmlConnection, XsdConnection, ConnectionSetNamespace, DATASETS_NS_ID, datasets_Data, Datasets, DatasetsNamespace, LOCALE_SET_NS_ID, CalendarSymbols, CurrencySymbol, CurrencySymbols, DatePattern, DatePatterns, DateTimeSymbols, Day, DayNames, Era, EraNames, locale_set_Locale, locale_set_LocaleSet, Meridiem, MeridiemNames, Month, MonthNames, NumberPattern, NumberPatterns, NumberSymbol, NumberSymbols, TimePattern, TimePatterns, TypeFace, TypeFaces, LocaleSetNamespace, SIGNATURE_NS_ID, signature_Signature, SignatureNamespace, STYLESHEET_NS_ID, Stylesheet, StylesheetNamespace, XDP_NS_ID, xdp_Xdp, XdpNamespace, XHTML_NS_ID, $richText, VALID_STYLES, StyleMapping, spacesRegExp, crlfRegExp, crlfForRichTextRegExp, NoWhites, XhtmlObject, A, B, Body, Br, Html, I, Li, Ol, P, Span, Sub, Sup, Ul, XhtmlNamespace, NamespaceSetUp, UnknownNamespace, Root, Empty, Builder, XFAParser, XFAFactory, AnnotationFactory, Annotation, AnnotationBorderStyle, MarkupAnnotation, WidgetAnnotation, TextWidgetAnnotation, ButtonWidgetAnnotation, ChoiceWidgetAnnotation, SignatureWidgetAnnotation, TextAnnotation, LinkAnnotation, PopupAnnotation, FreeTextAnnotation, LineAnnotation, SquareAnnotation, CircleAnnotation, PolylineAnnotation, PolygonAnnotation, CaretAnnotation, InkAnnotation, HighlightAnnotation, UnderlineAnnotation, SquigglyAnnotation, StrikeOutAnnotation, StampAnnotation, FileAttachmentAnnotation, PARAMS, DatasetXMLParser, DatasetReader, SingleIntersector, STEPS, Intersector, Word64, calculate_sha_other_PARAMS, calculate_sha256_PARAMS, chunkSize, DecryptStream, ARCFourCipher, NullCipher, AESBaseCipher, AES128Cipher, AES256Cipher, PDFBase, PDF17, PDF20, CipherTransform, CipherTransformFactory, XRef, LETTER_SIZE_MEDIABOX, Page, PDF_HEADER_SIGNATURE, STARTXREF_SIGNATURE, ENDOBJ_SIGNATURE, PDFDocument, BasePdfManager, LocalPdfManager, NetworkPdfManager, CallbackKind, StreamKind, MessageHandler, MAX_LEAVES_PER_PAGES_NODE, MAX_IN_NAME_TREE_NODE, PageData, DocumentData, XRefWrapper, PDFEditor, PDFWorkerStream, PDFWorkerStreamReader, PDFWorkerStreamRangeReader, WorkerTask, WorkerMessageHandler;
176681
+ var __webpack_modules__, __webpack_module_cache__, isNodeJS, FONT_IDENTITY_MATRIX, LINE_FACTOR, LINE_DESCENT_FACTOR, BASELINE_FACTOR, RenderingIntentFlag, AnnotationEditorPrefix, AnnotationEditorType, PermissionFlag, MeshFigureType, TextRenderingMode, ImageKind, AnnotationType, AnnotationReplyType, AnnotationFlag, AnnotationFieldFlag, AnnotationBorderStyleType, AnnotationActionEventType, DocumentActionEventType, PageActionEventType, VerbosityLevel, OPS, DrawOPS, PasswordResponses, verbosity, BaseException, PasswordException, UnknownErrorException, InvalidPDFException, ResponseException, FormatError, AbortException, FeatureTest, hexNumbers, Util, PDFStringTranslateTable, NormalizeRegex, NormalizationMap, AnnotationPrefix, CIRCULAR_REF, EOF, CmdCache, NameCache, RefCache, Name, Cmd, nonSerializable, Dict, Ref, RefSet, RefSetCache, BaseStream, PDF_VERSION_REGEXP, MAX_INT_32, MIN_INT_32, IDENTITY_MATRIX, RESOURCES_KEYS_OPERATOR_LIST, RESOURCES_KEYS_TEXT_CONTENT, MissingDataException, ParserEOFException, XRefEntryException, XRefParseException, ROMAN_NUMBER_MAP, XMLEntities, QCMS, wasm, cachedTextDecoder, cachedUint8ArrayMemory0, WASM_VECTOR_LEN, DataType, Intent, ColorSpace, AlternateCS, PatternCS, IndexedCS, DeviceGrayCS, DeviceRgbCS, DeviceRgbaCS, DeviceCmykCS, CalGrayCS, CalRGBCS, LabCS, IccColorSpace, CmykICCBasedCS, Stream$1, StringStream, NullStream, ChunkedStream, ChunkedStreamManager, MIN_IMAGE_DIM, MAX_IMAGE_DIM, MAX_ERROR, ImageResizer, emptyBuffer$1, DecodeStream, StreamsSequenceStream, ColorSpaceUtils, JpegError, DNLMarkerError, EOIMarkerError, dctZigZag, dctCos1, dctSin1, dctCos3, dctSin3, dctCos6, dctSin6, dctSqrt2, dctSqrt1d2, JpegImage, JpegStream, openjpeg, JpxError, JpxImage, InitialState, NullOptimizer, QueueOptimizer, OperatorList, MAX_NUM_SIZE, MAX_ENCODED_NUM_SIZE, BinaryCMapStream, BinaryCMapReader, Ascii85Stream, AsciiHexStream, ccittEOL, ccittEOF, twoDimPass, twoDimHoriz, twoDimVert0, twoDimVertR1, twoDimVertL1, twoDimVertR2, twoDimVertL2, twoDimVertR3, twoDimVertL3, twoDimTable, whiteTable1, whiteTable2, blackTable1, blackTable2, blackTable3, CCITTFaxDecoder, CCITTFaxStream, codeLenCodeMap, lengthDecode, distDecode, fixedLitCodeTab, fixedDistCodeTab, FlateStream, QeTable, ArithmeticDecoder, Jbig2Error, ContextCache, DecodingContext, SegmentTypes, CodingTemplates, RefinementTemplates, ReusedContexts, RefinementReusedContexts, RegionSegmentInformationFieldLength, SimpleSegmentVisitor, HuffmanLine, HuffmanTreeNode, HuffmanTable, standardTablesCache, Reader, Jbig2Image, Jbig2Stream, JpxStream, LZWStream, PredictorStream, RunLengthStream, MAX_LENGTH_TO_CACHE, Parser, specialChars, Lexer, Linearization, BUILT_IN_CMAPS, MAX_MAP_RANGE, CMap, IdentityCMap, CMapFactory, ExpertEncoding, MacExpertEncoding, MacRomanEncoding, StandardEncoding, WinAnsiEncoding, SymbolSetEncoding, ZapfDingbatsEncoding, getGlyphsUnicode, getDingbatsGlyphsUnicode, getSpecialPUASymbols, UnicodeRanges, SpecialCharRegExp, CategoryCache, SEAC_ANALYSIS_ENABLED, FontFlags, MacStandardGlyphOrdering, getVerticalPresentationForm, MAX_SIZE_TO_COMPILE, ISOAdobeCharset, ExpertCharset, ExpertSubsetCharset, MAX_SUBR_NESTING, CFFStandardStrings, NUM_STANDARD_CFF_STRINGS, CharstringValidationData, CharstringValidationData12, CFFParser, CFF, CFFHeader, CFFStrings, CFFIndex, CFFDict, CFFTopDictLayout, CFFTopDict, CFFPrivateDictLayout, CFFPrivateDict, CFFCharsetPredefinedTypes, CFFCharset, CFFEncoding, CFFFDSelect, CFFOffsetTracker, CFFCompiler, getStdFontMap, getFontNameToFileMap, getNonStdFontMap, getSerifFonts, getSymbolsFonts, getGlyphMapForStandardFonts, getSupplementalGlyphMapForArialBlack, getSupplementalGlyphMapForCalibri, ToUnicodeMap, IdentityToUnicodeMap, CFFFont, NOOP, Commands, CompiledFont, TrueTypeCompiled, Type2Compiled, FontRendererFactory, getMetrics, getFontBasicMetrics, ON_CURVE_POINT, X_SHORT_VECTOR, Y_SHORT_VECTOR, REPEAT_FLAG, X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR, Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR, OVERLAP_SIMPLE, ARG_1_AND_2_ARE_WORDS, ARGS_ARE_XY_VALUES, WE_HAVE_A_SCALE, MORE_COMPONENTS, WE_HAVE_AN_X_AND_Y_SCALE, WE_HAVE_A_TWO_BY_TWO, WE_HAVE_INSTRUCTIONS, GlyfTable, Glyph, GlyphHeader, Contour, SimpleGlyph, CompositeGlyph, OTF_HEADER_SIZE, OTF_TABLE_ENTRY_SIZE, OpenTypeFileBuilder, HINTING_ENABLED, COMMAND_MAP, Type1CharString, EEXEC_ENCRYPT_KEY, CHAR_STRS_ENCRYPT_KEY, Type1Parser, Type1Font, PRIVATE_USE_AREAS, PDF_GLYPH_SPACE_UNITS, EXPORT_DATA_PROPERTIES, EXPORT_DATA_EXTRA_PROPERTIES, fonts_Glyph, Font, ErrorFont, CssFontInfo, SystemFontInfo, FontInfo, PatternInfo, FontPathInfo, ShadingType, Pattern, BaseShading, RadialAxialShading, MeshStreamReader, bCache, MeshShading, DummyShading, CalibriBoldFactors, CalibriBoldMetrics, CalibriBoldItalicFactors, CalibriBoldItalicMetrics, CalibriItalicFactors, CalibriItalicMetrics, CalibriRegularFactors, CalibriRegularMetrics, HelveticaBoldFactors, HelveticaBoldMetrics, HelveticaBoldItalicFactors, HelveticaBoldItalicMetrics, HelveticaItalicFactors, HelveticaItalicMetrics, HelveticaRegularFactors, HelveticaRegularMetrics, LiberationSansBoldWidths, LiberationSansBoldMapping, LiberationSansBoldItalicWidths, LiberationSansBoldItalicMapping, LiberationSansItalicWidths, LiberationSansItalicMapping, LiberationSansRegularWidths, LiberationSansRegularMapping, MyriadProBoldFactors, MyriadProBoldMetrics, MyriadProBoldItalicFactors, MyriadProBoldItalicMetrics, MyriadProItalicFactors, MyriadProItalicMetrics, MyriadProRegularFactors, MyriadProRegularMetrics, SegoeuiBoldFactors, SegoeuiBoldMetrics, SegoeuiBoldItalicFactors, SegoeuiBoldItalicMetrics, SegoeuiItalicFactors, SegoeuiItalicMetrics, SegoeuiRegularFactors, SegoeuiRegularMetrics, getXFAFontMap, PostScriptParser, PostScriptTokenTypes, PostScriptToken, PostScriptLexer, BaseLocalCache, LocalImageCache, LocalColorSpaceCache, LocalFunctionCache, LocalGStateCache, LocalTilingPatternCache, RegionalImageCache, GlobalColorSpaceCache, GlobalImageCache, PDFFunctionFactory, PDFFunction, PostScriptStack, PostScriptEvaluator, AstNode, AstArgument, AstLiteral, AstBinaryOperation, AstMin, AstVariable, AstVariableDefinition, ExpressionBuilderVisitor, PostScriptCompiler, baseTypes, arabicTypes, chars, types, NORMAL, BOLD, ITALIC, BOLDITALIC, substitutionMap, fontAliases, SEED, MASK_HIGH, MASK_LOW, MurmurHash3_64, PDFImage, DefaultPartialEvaluatorOptions, PatternType, TEXT_CHUNK_BATCH_SIZE, deferred, TimeSlotManager, PartialEvaluator, TranslatedFont, StateManager, TextState, EvalState, EvaluatorPreprocessor, DefaultAppearanceEvaluator, AppearanceStreamEvaluator, FakeUnicodeFont, DateFormats, TimeFormats, NameOrNumberTree, NameTree, NumberTree, FileSpec, XMLParserErrorCode, XMLParserBase, SimpleDOMNode, SimpleXMLParser, MetadataParser, MAX_DEPTH, StructElementType, StructTreeRoot, StructElementNode, StructElement, StructTreePage, isRef, isValidExplicitDest, Catalog, ObjectLoader, $acceptWhitespace, $addHTML, $appendChild, $childrenToHTML, $clean, $cleanPage, $cleanup, $clone, $consumed, $content, $data, $dump, $extra, $finalize, $flushHTML, $getAttributeIt, $getAttributes, $getAvailableSpace, $getChildrenByClass, $getChildrenByName, $getChildrenByNameIt, $getDataValue, $getExtra, $getRealChildrenByNameIt, $getChildren, $getContainedChildren, $getNextPage, $getSubformParent, $getParent, $getTemplateRoot, $globalData, $hasSettableValue, $ids, $indexOf, $insertAt, $isCDATAXml, $isBindable, $isDataValue, $isDescendent, $isNsAgnostic, $isSplittable, $isThereMoreWidth, $isTransparent, $isUsable, $lastAttribute, $namespaceId, $nodeName, $nsAttributes, $onChild, $onChildCheck, $onText, $pushGlyphs, $popPara, $pushPara, $removeChild, $root, $resolvePrototypes, $searchNode, $setId, $setSetAttributes, $setValue, $tabIndex, $text, $toPages, $toHTML, $toString, $toStyle, $uid, $buildXFAObject, NamespaceIds, dimConverters, measurementPattern, HTMLResult, FontFinder, WIDTH_FACTOR, text_FontInfo, FontSelector, TextMeasure, namePattern, indexPattern, operators, shortcuts, somCache, _applyPrototype, _attributes, _attributeNames, _children, _cloneAttribute, _dataValue, _defaultValue, _filteredChildrenGenerator, _getPrototype, _getUnsetAttributes, _hasChildren, _max, _options, _parent, _resolvePrototypesHelper, _setAttributes, _validator, uid, NS_DATASETS, XFAObject, XFAObjectArray, XFAAttribute, XmlObject, ContentObject, OptionObject, StringObject, IntegerObject, Option01, Option10, converters, TEMPLATE_NS_ID, SVG_NS, MAX_ATTEMPTS_FOR_LRTB_LAYOUT, MAX_EMPTY_PAGES, DEFAULT_TAB_INDEX, HEADING_PATTERN, MIMES, IMAGES_HEADERS, AppearanceFilter, Arc, Area, Assist, Barcode, Bind, BindItems, Bookend, BooleanElement, Border, Break, BreakAfter, BreakBefore, Button, Calculate, Caption, Certificate, Certificates, CheckButton, ChoiceList, Color, Comb, Connect, ContentArea, Corner, DateElement, DateTime, DateTimeEdit, Decimal, DefaultUi, Desc, DigestMethod, DigestMethods, Draw, Edge, Encoding, Encodings, Encrypt, EncryptData, Encryption, EncryptionMethod, EncryptionMethods, Event$1, ExData, ExObject, ExclGroup, Execute, Extras, Field, Fill, Filter, Float, template_Font, Format, Handler, Hyphenation, Image$1, ImageEdit, Integer, Issuers, Items, Keep, KeyUsage, Line, Linear, LockDocument, Manifest, Margin, Mdp, Medium, Message, NumericEdit, Occur, Oid, Oids, Overflow, PageArea, PageSet, Para, PasswordEdit, template_Pattern, Picture, Proto, Radial, Reason, Reasons, Rectangle, RefElement, Script, SetProperty, SignData, Signature, Signing, Solid, Speak, Stipple, Subform, SubformSet, SubjectDN, SubjectDNs, Submit, Template, Text, TextEdit, Time, TimeStamp, ToolTip, Traversal, Traverse, Ui, Validate, Value, Variables, TemplateNamespace, bind_NS_DATASETS, Binder, DataHandler, CONFIG_NS_ID, Acrobat, Acrobat7, ADBE_JSConsole, ADBE_JSDebugger, AddSilentPrint, AddViewerPreferences, AdjustData, AdobeExtensionLevel, Agent$1, AlwaysEmbed, Amd, config_Area, Attributes, AutoSave, Base, BatchOutput, BehaviorOverride, Cache, Change, Common, Compress, CompressLogicalStructure, CompressObjectStream, Compression, Config, Conformance, ContentCopy, Copies, Creator, CurrentPage, Data, Debug, DefaultTypeface, Destination, DocumentAssembly, Driver, DuplexOption, DynamicRender, Embed, config_Encrypt, config_Encryption, EncryptionLevel, Enforce, Equate, EquateRange, Exclude, ExcludeNS, FlipLabel, config_FontInfo, FormFieldFilling, GroupParent, IfEmpty, IncludeXDPContent, IncrementalLoad, IncrementalMerge, Interactive, Jog, LabelPrinter, Layout, Level, Linearized, Locale, LocaleSet, Log, MapElement, MediumInfo, config_Message, Messaging, Mode, ModifyAnnots, MsgId, NameAttr, NeverEmbed, NumberOfCopies, OpenAction, Output, OutputBin, OutputXSL, Overprint, Packets, PageOffset, PageRange, Pagination, PaginationOverride, Part, Pcl, Pdf, Pdfa, Permissions, PickTrayByPDFSize, config_Picture, PlaintextMetadata, Presence, Present, Print, PrintHighQuality, PrintScaling, PrinterName, Producer, Ps, Range$1, Record, Relevant, Rename, RenderPolicy, RunScripts, config_Script, ScriptModel, Severity, SilentPrint, Staple, StartNode, StartPage, SubmitFormat, SubmitUrl, SubsetBelow, SuppressBanner, Tagged, config_Template, Threshold, To, TemplateCache, Trace, Transform$1, Type, Uri, config_Validate, ValidateApprovalSignatures, ValidationMessaging, Version, VersionControl, ViewerPreferences, WebClient, Whitespace, Window, Xdc, Xdp, Xsl, Zpl, ConfigNamespace, CONNECTION_SET_NS_ID, ConnectionSet, EffectiveInputPolicy, EffectiveOutputPolicy, Operation, RootElement, SoapAction, SoapAddress, connection_set_Uri, WsdlAddress, WsdlConnection, XmlConnection, XsdConnection, ConnectionSetNamespace, DATASETS_NS_ID, datasets_Data, Datasets, DatasetsNamespace, LOCALE_SET_NS_ID, CalendarSymbols, CurrencySymbol, CurrencySymbols, DatePattern, DatePatterns, DateTimeSymbols, Day, DayNames, Era, EraNames, locale_set_Locale, locale_set_LocaleSet, Meridiem, MeridiemNames, Month, MonthNames, NumberPattern, NumberPatterns, NumberSymbol, NumberSymbols, TimePattern, TimePatterns, TypeFace, TypeFaces, LocaleSetNamespace, SIGNATURE_NS_ID, signature_Signature, SignatureNamespace, STYLESHEET_NS_ID, Stylesheet, StylesheetNamespace, XDP_NS_ID, xdp_Xdp, XdpNamespace, XHTML_NS_ID, $richText, VALID_STYLES, StyleMapping, spacesRegExp, crlfRegExp, crlfForRichTextRegExp, NoWhites, XhtmlObject, A, B, Body, Br, Html, I, Li, Ol, P, Span, Sub, Sup, Ul, XhtmlNamespace, NamespaceSetUp, UnknownNamespace, Root, Empty, Builder, XFAParser, XFAFactory, AnnotationFactory, Annotation, AnnotationBorderStyle, MarkupAnnotation, WidgetAnnotation, TextWidgetAnnotation, ButtonWidgetAnnotation, ChoiceWidgetAnnotation, SignatureWidgetAnnotation, TextAnnotation, LinkAnnotation, PopupAnnotation, FreeTextAnnotation, LineAnnotation, SquareAnnotation, CircleAnnotation, PolylineAnnotation, PolygonAnnotation, CaretAnnotation, InkAnnotation, HighlightAnnotation, UnderlineAnnotation, SquigglyAnnotation, StrikeOutAnnotation, StampAnnotation, FileAttachmentAnnotation, PARAMS, DatasetXMLParser, DatasetReader, SingleIntersector, STEPS, Intersector, Word64, calculate_sha_other_PARAMS, calculate_sha256_PARAMS, chunkSize, DecryptStream, ARCFourCipher, NullCipher, AESBaseCipher, AES128Cipher, AES256Cipher, PDFBase, PDF17, PDF20, CipherTransform, CipherTransformFactory, XRef, LETTER_SIZE_MEDIABOX, Page, PDF_HEADER_SIGNATURE, STARTXREF_SIGNATURE, ENDOBJ_SIGNATURE, PDFDocument, BasePdfManager, LocalPdfManager, NetworkPdfManager, CallbackKind, StreamKind, MessageHandler, MAX_LEAVES_PER_PAGES_NODE, MAX_IN_NAME_TREE_NODE, PageData, DocumentData, XRefWrapper, PDFEditor, PDFWorkerStream, PDFWorkerStreamReader, PDFWorkerStreamRangeReader, WorkerTask, WorkerMessageHandler;
175376
176682
  var init_pdf_worker = __esmMin((() => {
175377
176683
  __webpack_modules__ = {
175378
176684
  34: ((module, __unused_webpack_exports, __webpack_require__) => {
@@ -239123,7 +240429,7 @@ var init_pdf_worker = __esmMin((() => {
239123
240429
  this.area = new XFAObjectArray();
239124
240430
  }
239125
240431
  };
239126
- Transform$2 = class extends XFAObject {
240432
+ Transform$1 = class extends XFAObject {
239127
240433
  constructor(attributes) {
239128
240434
  super(CONFIG_NS_ID, "transform", true);
239129
240435
  this.groupParent = null;
@@ -239659,7 +240965,7 @@ var init_pdf_worker = __esmMin((() => {
239659
240965
  return new Trace(attrs);
239660
240966
  }
239661
240967
  static transform(attrs) {
239662
- return new Transform$2(attrs);
240968
+ return new Transform$1(attrs);
239663
240969
  }
239664
240970
  static type(attrs) {
239665
240971
  return new Type(attrs);
@@ -260187,1139 +261493,6 @@ var require_concat_stream = /* @__PURE__ */ __commonJSMin$2(((exports, module) =
260187
261493
  }
260188
261494
  }));
260189
261495
 
260190
- //#endregion
260191
- //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/fd-slicer.js
260192
- var require_fd_slicer = /* @__PURE__ */ __commonJSMin$2(((exports) => {
260193
- var fs$8 = __require("fs");
260194
- var util$3 = __require("util");
260195
- var stream = __require("stream");
260196
- var Readable = stream.Readable;
260197
- var PassThrough = stream.PassThrough;
260198
- var Pend = require_pend();
260199
- var EventEmitter$2 = __require("events").EventEmitter;
260200
- exports.BufferSlicer = BufferSlicer;
260201
- exports.FdSlicer = FdSlicer;
260202
- util$3.inherits(FdSlicer, EventEmitter$2);
260203
- function FdSlicer(fd) {
260204
- EventEmitter$2.call(this);
260205
- this.fd = fd;
260206
- this.pend = new Pend();
260207
- this.pend.max = 1;
260208
- this.refCount = 0;
260209
- }
260210
- FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
260211
- var self = this;
260212
- self.pend.go(function(cb) {
260213
- fs$8.read(self.fd, buffer, offset, length, position, function(err, bytesRead, buffer) {
260214
- cb();
260215
- callback(err, bytesRead, buffer);
260216
- });
260217
- });
260218
- };
260219
- FdSlicer.prototype.createReadStream = function(options) {
260220
- return new ReadStream(this, options);
260221
- };
260222
- FdSlicer.prototype.ref = function() {
260223
- this.refCount += 1;
260224
- };
260225
- FdSlicer.prototype.unref = function() {
260226
- var self = this;
260227
- self.refCount -= 1;
260228
- if (self.refCount < 0) throw new Error("invalid unref");
260229
- if (self.refCount > 0) return;
260230
- fs$8.close(self.fd, onCloseDone);
260231
- function onCloseDone(err) {
260232
- if (err) self.emit("error", err);
260233
- else self.emit("close");
260234
- }
260235
- };
260236
- util$3.inherits(ReadStream, Readable);
260237
- function ReadStream(context, options) {
260238
- options = options || {};
260239
- Readable.call(this, options);
260240
- this.context = context;
260241
- this.context.ref();
260242
- this.start = options.start || 0;
260243
- this.endOffset = options.end;
260244
- this.pos = this.start;
260245
- }
260246
- ReadStream.prototype._read = function(n) {
260247
- var self = this;
260248
- var toRead = Math.min(self._readableState.highWaterMark, n);
260249
- if (self.endOffset != null) toRead = Math.min(toRead, self.endOffset - self.pos);
260250
- if (toRead <= 0) {
260251
- self.push(null);
260252
- this._cleanup();
260253
- return;
260254
- }
260255
- self.context.pend.go(function(cb) {
260256
- var buffer = Buffer.allocUnsafe(toRead);
260257
- fs$8.read(self.context.fd, buffer, 0, toRead, self.pos, function(err, bytesRead) {
260258
- if (err) self.destroy(err);
260259
- else if (bytesRead === 0) {
260260
- self.push(null);
260261
- self._cleanup();
260262
- } else {
260263
- self.pos += bytesRead;
260264
- self.push(buffer.slice(0, bytesRead));
260265
- }
260266
- cb();
260267
- });
260268
- });
260269
- };
260270
- ReadStream.prototype._destroy = function(err, cb) {
260271
- this._cleanup();
260272
- cb(err);
260273
- };
260274
- ReadStream.prototype._cleanup = function() {
260275
- if (this.context != null) {
260276
- this.context.unref();
260277
- this.context = null;
260278
- }
260279
- };
260280
- util$3.inherits(BufferSlicer, EventEmitter$2);
260281
- function BufferSlicer(buffer) {
260282
- EventEmitter$2.call(this);
260283
- this.refCount = 0;
260284
- this.buffer = buffer;
260285
- }
260286
- BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
260287
- if (!(0 <= offset && offset <= buffer.length)) throw new RangeError("offset outside buffer: 0 <= " + offset + " <= " + buffer.length);
260288
- if (position < 0) throw new RangeError("position is negative: " + position);
260289
- if (offset + length > buffer.length) length = buffer.length - offset;
260290
- if (position + length > this.buffer.length) length = this.buffer.length - position;
260291
- if (length <= 0) {
260292
- setImmediate(function() {
260293
- callback(null, 0);
260294
- });
260295
- return;
260296
- }
260297
- this.buffer.copy(buffer, offset, position, position + length);
260298
- setImmediate(function() {
260299
- callback(null, length);
260300
- });
260301
- };
260302
- BufferSlicer.prototype.createReadStream = function(options) {
260303
- options = options || {};
260304
- var readStream = new PassThrough(options);
260305
- readStream.start = options.start || 0;
260306
- readStream.endOffset = options.end;
260307
- readStream.pos = readStream.endOffset || this.buffer.length;
260308
- var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
260309
- var maxChunkSize = 65536;
260310
- var offset = 0;
260311
- while (true) {
260312
- var nextOffset = offset + maxChunkSize;
260313
- if (nextOffset >= entireSlice.length) {
260314
- if (offset < entireSlice.length) readStream.write(entireSlice.slice(offset, entireSlice.length));
260315
- break;
260316
- }
260317
- readStream.write(entireSlice.slice(offset, nextOffset));
260318
- offset = nextOffset;
260319
- }
260320
- readStream.end();
260321
- return readStream;
260322
- };
260323
- BufferSlicer.prototype.ref = function() {
260324
- this.refCount += 1;
260325
- };
260326
- BufferSlicer.prototype.unref = function() {
260327
- this.refCount -= 1;
260328
- if (this.refCount < 0) throw new Error("invalid unref");
260329
- };
260330
- }));
260331
-
260332
- //#endregion
260333
- //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/crc32.js
260334
- var require_crc32 = /* @__PURE__ */ __commonJSMin$2(((exports, module) => {
260335
- const CRC_TABLE = new Int32Array([
260336
- 0,
260337
- 1996959894,
260338
- 3993919788,
260339
- 2567524794,
260340
- 124634137,
260341
- 1886057615,
260342
- 3915621685,
260343
- 2657392035,
260344
- 249268274,
260345
- 2044508324,
260346
- 3772115230,
260347
- 2547177864,
260348
- 162941995,
260349
- 2125561021,
260350
- 3887607047,
260351
- 2428444049,
260352
- 498536548,
260353
- 1789927666,
260354
- 4089016648,
260355
- 2227061214,
260356
- 450548861,
260357
- 1843258603,
260358
- 4107580753,
260359
- 2211677639,
260360
- 325883990,
260361
- 1684777152,
260362
- 4251122042,
260363
- 2321926636,
260364
- 335633487,
260365
- 1661365465,
260366
- 4195302755,
260367
- 2366115317,
260368
- 997073096,
260369
- 1281953886,
260370
- 3579855332,
260371
- 2724688242,
260372
- 1006888145,
260373
- 1258607687,
260374
- 3524101629,
260375
- 2768942443,
260376
- 901097722,
260377
- 1119000684,
260378
- 3686517206,
260379
- 2898065728,
260380
- 853044451,
260381
- 1172266101,
260382
- 3705015759,
260383
- 2882616665,
260384
- 651767980,
260385
- 1373503546,
260386
- 3369554304,
260387
- 3218104598,
260388
- 565507253,
260389
- 1454621731,
260390
- 3485111705,
260391
- 3099436303,
260392
- 671266974,
260393
- 1594198024,
260394
- 3322730930,
260395
- 2970347812,
260396
- 795835527,
260397
- 1483230225,
260398
- 3244367275,
260399
- 3060149565,
260400
- 1994146192,
260401
- 31158534,
260402
- 2563907772,
260403
- 4023717930,
260404
- 1907459465,
260405
- 112637215,
260406
- 2680153253,
260407
- 3904427059,
260408
- 2013776290,
260409
- 251722036,
260410
- 2517215374,
260411
- 3775830040,
260412
- 2137656763,
260413
- 141376813,
260414
- 2439277719,
260415
- 3865271297,
260416
- 1802195444,
260417
- 476864866,
260418
- 2238001368,
260419
- 4066508878,
260420
- 1812370925,
260421
- 453092731,
260422
- 2181625025,
260423
- 4111451223,
260424
- 1706088902,
260425
- 314042704,
260426
- 2344532202,
260427
- 4240017532,
260428
- 1658658271,
260429
- 366619977,
260430
- 2362670323,
260431
- 4224994405,
260432
- 1303535960,
260433
- 984961486,
260434
- 2747007092,
260435
- 3569037538,
260436
- 1256170817,
260437
- 1037604311,
260438
- 2765210733,
260439
- 3554079995,
260440
- 1131014506,
260441
- 879679996,
260442
- 2909243462,
260443
- 3663771856,
260444
- 1141124467,
260445
- 855842277,
260446
- 2852801631,
260447
- 3708648649,
260448
- 1342533948,
260449
- 654459306,
260450
- 3188396048,
260451
- 3373015174,
260452
- 1466479909,
260453
- 544179635,
260454
- 3110523913,
260455
- 3462522015,
260456
- 1591671054,
260457
- 702138776,
260458
- 2966460450,
260459
- 3352799412,
260460
- 1504918807,
260461
- 783551873,
260462
- 3082640443,
260463
- 3233442989,
260464
- 3988292384,
260465
- 2596254646,
260466
- 62317068,
260467
- 1957810842,
260468
- 3939845945,
260469
- 2647816111,
260470
- 81470997,
260471
- 1943803523,
260472
- 3814918930,
260473
- 2489596804,
260474
- 225274430,
260475
- 2053790376,
260476
- 3826175755,
260477
- 2466906013,
260478
- 167816743,
260479
- 2097651377,
260480
- 4027552580,
260481
- 2265490386,
260482
- 503444072,
260483
- 1762050814,
260484
- 4150417245,
260485
- 2154129355,
260486
- 426522225,
260487
- 1852507879,
260488
- 4275313526,
260489
- 2312317920,
260490
- 282753626,
260491
- 1742555852,
260492
- 4189708143,
260493
- 2394877945,
260494
- 397917763,
260495
- 1622183637,
260496
- 3604390888,
260497
- 2714866558,
260498
- 953729732,
260499
- 1340076626,
260500
- 3518719985,
260501
- 2797360999,
260502
- 1068828381,
260503
- 1219638859,
260504
- 3624741850,
260505
- 2936675148,
260506
- 906185462,
260507
- 1090812512,
260508
- 3747672003,
260509
- 2825379669,
260510
- 829329135,
260511
- 1181335161,
260512
- 3412177804,
260513
- 3160834842,
260514
- 628085408,
260515
- 1382605366,
260516
- 3423369109,
260517
- 3138078467,
260518
- 570562233,
260519
- 1426400815,
260520
- 3317316542,
260521
- 2998733608,
260522
- 733239954,
260523
- 1555261956,
260524
- 3268935591,
260525
- 3050360625,
260526
- 752459403,
260527
- 1541320221,
260528
- 2607071920,
260529
- 3965973030,
260530
- 1969922972,
260531
- 40735498,
260532
- 2617837225,
260533
- 3943577151,
260534
- 1913087877,
260535
- 83908371,
260536
- 2512341634,
260537
- 3803740692,
260538
- 2075208622,
260539
- 213261112,
260540
- 2463272603,
260541
- 3855990285,
260542
- 2094854071,
260543
- 198958881,
260544
- 2262029012,
260545
- 4057260610,
260546
- 1759359992,
260547
- 534414190,
260548
- 2176718541,
260549
- 4139329115,
260550
- 1873836001,
260551
- 414664567,
260552
- 2282248934,
260553
- 4279200368,
260554
- 1711684554,
260555
- 285281116,
260556
- 2405801727,
260557
- 4167216745,
260558
- 1634467795,
260559
- 376229701,
260560
- 2685067896,
260561
- 3608007406,
260562
- 1308918612,
260563
- 956543938,
260564
- 2808555105,
260565
- 3495958263,
260566
- 1231636301,
260567
- 1047427035,
260568
- 2932959818,
260569
- 3654703836,
260570
- 1088359270,
260571
- 936918e3,
260572
- 2847714899,
260573
- 3736837829,
260574
- 1202900863,
260575
- 817233897,
260576
- 3183342108,
260577
- 3401237130,
260578
- 1404277552,
260579
- 615818150,
260580
- 3134207493,
260581
- 3453421203,
260582
- 1423857449,
260583
- 601450431,
260584
- 3009837614,
260585
- 3294710456,
260586
- 1567103746,
260587
- 711928724,
260588
- 3020668471,
260589
- 3272380065,
260590
- 1510334235,
260591
- 755167117
260592
- ]);
260593
- function crc32(buf) {
260594
- let crc = -1;
260595
- for (let x of buf) crc = CRC_TABLE[(crc ^ x) & 255] ^ crc >>> 8;
260596
- return (crc ^ -1) >>> 0;
260597
- }
260598
- module.exports = crc32;
260599
- }));
260600
-
260601
- //#endregion
260602
- //#region node_modules/.pnpm/yauzl@3.4.0/node_modules/yauzl/index.js
260603
- var require_yauzl = /* @__PURE__ */ __commonJSMin$2(((exports) => {
260604
- var fs$7 = __require("fs");
260605
- var zlib$1 = __require("zlib");
260606
- var fd_slicer = require_fd_slicer();
260607
- var util$2 = __require("util");
260608
- var EventEmitter$1 = __require("events").EventEmitter;
260609
- var Transform$1 = __require("stream").Transform;
260610
- var PassThrough$1 = __require("stream").PassThrough;
260611
- var Writable$1 = __require("stream").Writable;
260612
- const crc32 = typeof zlib$1.crc32 === "function" ? zlib$1.crc32 : require_crc32();
260613
- exports.open = open;
260614
- exports.fromBuffer = fromBuffer;
260615
- function open(path, options, callback) {
260616
- if (typeof options === "function") {
260617
- callback = options;
260618
- options = null;
260619
- }
260620
- if (options == null) options = {};
260621
- if (options.autoClose == null) options.autoClose = true;
260622
- if (options.lazyEntries == null) options.lazyEntries = false;
260623
- if (options.decodeStrings == null) options.decodeStrings = true;
260624
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
260625
- if (options.strictFileNames == null) options.strictFileNames = false;
260626
- if (callback == null) callback = defaultCallback;
260627
- fs$7.open(path, "r", function(err, fd) {
260628
- if (err) return callback(err);
260629
- fromFd(fd, options, function(err, zipfile) {
260630
- if (err) fs$7.close(fd, defaultCallback);
260631
- callback(err, zipfile);
260632
- });
260633
- });
260634
- }
260635
- function fromFd(fd, options, callback) {
260636
- if (typeof options === "function") {
260637
- callback = options;
260638
- options = null;
260639
- }
260640
- if (options == null) options = {};
260641
- if (options.autoClose == null) options.autoClose = false;
260642
- if (options.lazyEntries == null) options.lazyEntries = false;
260643
- if (options.decodeStrings == null) options.decodeStrings = true;
260644
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
260645
- if (options.strictFileNames == null) options.strictFileNames = false;
260646
- if (callback == null) callback = defaultCallback;
260647
- fs$7.fstat(fd, function(err, stats) {
260648
- if (err) return callback(err);
260649
- fromRandomAccessReader(new fd_slicer.FdSlicer(fd), stats.size, options, callback);
260650
- });
260651
- }
260652
- function fromBuffer(buffer, options, callback) {
260653
- if (typeof options === "function") {
260654
- callback = options;
260655
- options = null;
260656
- }
260657
- if (options == null) options = {};
260658
- options.autoClose = false;
260659
- if (options.lazyEntries == null) options.lazyEntries = false;
260660
- if (options.decodeStrings == null) options.decodeStrings = true;
260661
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
260662
- if (options.strictFileNames == null) options.strictFileNames = false;
260663
- fromRandomAccessReader(new fd_slicer.BufferSlicer(buffer), buffer.length, options, callback);
260664
- }
260665
- function fromRandomAccessReader(reader, totalSize, options, callback) {
260666
- if (typeof options === "function") {
260667
- callback = options;
260668
- options = null;
260669
- }
260670
- if (options == null) options = {};
260671
- if (options.autoClose == null) options.autoClose = true;
260672
- if (options.lazyEntries == null) options.lazyEntries = false;
260673
- if (options.decodeStrings == null) options.decodeStrings = true;
260674
- var decodeStrings = !!options.decodeStrings;
260675
- if (options.validateEntrySizes == null) options.validateEntrySizes = true;
260676
- if (options.strictFileNames == null) options.strictFileNames = false;
260677
- if (callback == null) callback = defaultCallback;
260678
- if (typeof totalSize !== "number") throw new Error("expected totalSize parameter to be a number");
260679
- if (totalSize > Number.MAX_SAFE_INTEGER) throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
260680
- reader.ref();
260681
- var eocdrWithoutCommentSize = 22;
260682
- var zip64EocdlSize = 20;
260683
- var bufferSize = Math.min(zip64EocdlSize + eocdrWithoutCommentSize + 65535, totalSize);
260684
- var buffer = newBuffer(bufferSize);
260685
- readAndAssertNoEof(reader, buffer, 0, bufferSize, totalSize - buffer.length, function(err) {
260686
- if (err) return callback(err);
260687
- for (var i = bufferSize - eocdrWithoutCommentSize; i >= 0; i -= 1) {
260688
- if (buffer.readUInt32LE(i) !== 101010256) continue;
260689
- var eocdrBuffer = buffer.subarray(i);
260690
- var diskNumber = eocdrBuffer.readUInt16LE(4);
260691
- var entryCount = eocdrBuffer.readUInt16LE(10);
260692
- var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
260693
- var commentLength = eocdrBuffer.readUInt16LE(20);
260694
- var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
260695
- if (commentLength !== expectedCommentLength) return callback(/* @__PURE__ */ new Error("Invalid comment length. Expected: " + expectedCommentLength + ". Found: " + commentLength + ". Are there extra bytes at the end of the file? Or is the end of central dir signature `PK☺☻` in the comment?"));
260696
- var comment = decodeStrings ? decodeBuffer(eocdrBuffer.subarray(22), false) : eocdrBuffer.subarray(22);
260697
- if (i - zip64EocdlSize >= 0 && buffer.readUInt32LE(i - zip64EocdlSize) === 117853008) {
260698
- var zip64EocdrOffset = readUInt64LE(buffer.subarray(i - zip64EocdlSize, i - zip64EocdlSize + zip64EocdlSize), 8);
260699
- var zip64EocdrBuffer = newBuffer(56);
260700
- return readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err) {
260701
- if (err) return callback(err);
260702
- if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) return callback(/* @__PURE__ */ new Error("invalid zip64 end of central directory record signature"));
260703
- diskNumber = zip64EocdrBuffer.readUInt32LE(16);
260704
- if (diskNumber !== 0) return callback(/* @__PURE__ */ new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
260705
- entryCount = readUInt64LE(zip64EocdrBuffer, 32);
260706
- centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
260707
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
260708
- });
260709
- }
260710
- if (diskNumber !== 0) return callback(/* @__PURE__ */ new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
260711
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options.autoClose, options.lazyEntries, decodeStrings, options.validateEntrySizes, options.strictFileNames));
260712
- }
260713
- callback(/* @__PURE__ */ new Error("End of central directory record signature not found. Either not a zip file, or file is truncated."));
260714
- });
260715
- }
260716
- util$2.inherits(ZipFile, EventEmitter$1);
260717
- function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
260718
- var self = this;
260719
- EventEmitter$1.call(self);
260720
- self.reader = reader;
260721
- self.reader.on("error", function(err) {
260722
- emitError(self, err);
260723
- });
260724
- self.reader.once("close", function() {
260725
- self.emit("close");
260726
- });
260727
- self.readEntryCursor = centralDirectoryOffset;
260728
- self.fileSize = fileSize;
260729
- self.entryCount = entryCount;
260730
- self.comment = comment;
260731
- self.entriesRead = 0;
260732
- self.autoClose = !!autoClose;
260733
- self.lazyEntries = !!lazyEntries;
260734
- self.decodeStrings = !!decodeStrings;
260735
- self.validateEntrySizes = !!validateEntrySizes;
260736
- self.strictFileNames = !!strictFileNames;
260737
- self.isOpen = true;
260738
- self.emittedError = false;
260739
- self.hasEachEntryBeenCalled = false;
260740
- if (!self.lazyEntries) self._readEntry();
260741
- }
260742
- ZipFile.prototype.close = function() {
260743
- if (!this.isOpen) return;
260744
- this.isOpen = false;
260745
- this.reader.unref();
260746
- };
260747
- function emitErrorAndAutoClose(self, err) {
260748
- if (self.autoClose) self.close();
260749
- emitError(self, err);
260750
- }
260751
- function emitError(self, err) {
260752
- if (self.emittedError) return;
260753
- self.emittedError = true;
260754
- self.emit("error", err);
260755
- }
260756
- ZipFile.prototype.readEntry = function() {
260757
- if (!this.lazyEntries) throw new Error("readEntry() called without lazyEntries:true");
260758
- this._readEntry();
260759
- };
260760
- ZipFile.prototype._readEntry = function() {
260761
- var self = this;
260762
- if (self.entryCount === self.entriesRead) {
260763
- setImmediate(function() {
260764
- if (self.autoClose) self.close();
260765
- if (self.emittedError) return;
260766
- self.emit("end");
260767
- });
260768
- return;
260769
- }
260770
- if (self.emittedError) return;
260771
- var buffer = newBuffer(46);
260772
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
260773
- if (err) return emitErrorAndAutoClose(self, err);
260774
- if (self.emittedError) return;
260775
- var entry = new Entry();
260776
- var signature = buffer.readUInt32LE(0);
260777
- if (signature !== 33639248) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
260778
- entry.versionMadeBy = buffer.readUInt16LE(4);
260779
- entry.versionNeededToExtract = buffer.readUInt16LE(6);
260780
- entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
260781
- entry.compressionMethod = buffer.readUInt16LE(10);
260782
- entry.lastModFileTime = buffer.readUInt16LE(12);
260783
- entry.lastModFileDate = buffer.readUInt16LE(14);
260784
- entry.crc32 = buffer.readUInt32LE(16);
260785
- entry.compressedSize = buffer.readUInt32LE(20);
260786
- entry.uncompressedSize = buffer.readUInt32LE(24);
260787
- entry.fileNameLength = buffer.readUInt16LE(28);
260788
- entry.extraFieldLength = buffer.readUInt16LE(30);
260789
- entry.fileCommentLength = buffer.readUInt16LE(32);
260790
- entry.internalFileAttributes = buffer.readUInt16LE(36);
260791
- entry.externalFileAttributes = buffer.readUInt32LE(38);
260792
- entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
260793
- if (entry.generalPurposeBitFlag & 64) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("strong encryption is not supported"));
260794
- self.readEntryCursor += 46;
260795
- buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
260796
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, self.readEntryCursor, function(err) {
260797
- if (err) return emitErrorAndAutoClose(self, err);
260798
- if (self.emittedError) return;
260799
- entry.fileNameRaw = buffer.subarray(0, entry.fileNameLength);
260800
- var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
260801
- entry.extraFieldRaw = buffer.subarray(entry.fileNameLength, fileCommentStart);
260802
- entry.fileCommentRaw = buffer.subarray(fileCommentStart, fileCommentStart + entry.fileCommentLength);
260803
- try {
260804
- entry.extraFields = parseExtraFields(entry.extraFieldRaw);
260805
- } catch (err) {
260806
- return emitErrorAndAutoClose(self, err);
260807
- }
260808
- if (self.decodeStrings) {
260809
- var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
260810
- entry.fileComment = decodeBuffer(entry.fileCommentRaw, isUtf8);
260811
- entry.fileName = getFileNameLowLevel(entry.generalPurposeBitFlag, entry.fileNameRaw, entry.extraFields, self.strictFileNames);
260812
- var errorMessage = validateFileName(entry.fileName);
260813
- if (errorMessage != null) return emitErrorAndAutoClose(self, new Error(errorMessage));
260814
- } else {
260815
- entry.fileComment = entry.fileCommentRaw;
260816
- entry.fileName = entry.fileNameRaw;
260817
- }
260818
- entry.comment = entry.fileComment;
260819
- self.readEntryCursor += buffer.length;
260820
- self.entriesRead += 1;
260821
- for (var i = 0; i < entry.extraFields.length; i++) {
260822
- var extraField = entry.extraFields[i];
260823
- if (extraField.id !== 1) continue;
260824
- var zip64EiefBuffer = extraField.data;
260825
- var index = 0;
260826
- if (entry.uncompressedSize === 4294967295) {
260827
- if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include uncompressed size"));
260828
- entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
260829
- index += 8;
260830
- }
260831
- if (entry.compressedSize === 4294967295) {
260832
- if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include compressed size"));
260833
- entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
260834
- index += 8;
260835
- }
260836
- if (entry.relativeOffsetOfLocalHeader === 4294967295) {
260837
- if (index + 8 > zip64EiefBuffer.length) return emitErrorAndAutoClose(self, /* @__PURE__ */ new Error("zip64 extended information extra field does not include relative header offset"));
260838
- entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
260839
- index += 8;
260840
- }
260841
- break;
260842
- }
260843
- if (self.validateEntrySizes && entry.compressionMethod === 0) {
260844
- var expectedCompressedSize = entry.uncompressedSize;
260845
- if (entry.isEncrypted()) expectedCompressedSize += 12;
260846
- if (entry.compressedSize !== expectedCompressedSize) {
260847
- var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
260848
- return emitErrorAndAutoClose(self, new Error(msg));
260849
- }
260850
- }
260851
- self.emit("entry", entry);
260852
- if (!self.lazyEntries) self._readEntry();
260853
- });
260854
- });
260855
- };
260856
- ZipFile.prototype.eachEntry = function() {
260857
- const self = this;
260858
- if (!self.lazyEntries) throw new Error("eachEntry() requires lazyEntries: true");
260859
- if (self.hasEachEntryBeenCalled) throw new Error("eachEntry() must only be called once per ZipFile");
260860
- self.hasEachEntryBeenCalled = true;
260861
- let pendingResolveReject = null;
260862
- self.on("entry", onEntry);
260863
- self.on("end", onEnd);
260864
- self.on("error", onError);
260865
- function cleanup() {
260866
- self.removeListener("entry", onEntry);
260867
- self.removeListener("end", onEnd);
260868
- self.removeListener("error", onError);
260869
- if (self.autoClose) self.close();
260870
- }
260871
- function onEntry(entry) {
260872
- let { resolve } = pendingResolveReject;
260873
- pendingResolveReject = null;
260874
- resolve({ value: entry });
260875
- }
260876
- function onEnd() {
260877
- let { resolve } = pendingResolveReject;
260878
- pendingResolveReject = null;
260879
- cleanup();
260880
- resolve({ done: true });
260881
- }
260882
- function onError(err) {
260883
- let { reject } = pendingResolveReject;
260884
- pendingResolveReject = null;
260885
- cleanup();
260886
- reject(err);
260887
- }
260888
- return {
260889
- [Symbol.asyncIterator]() {
260890
- return this;
260891
- },
260892
- next() {
260893
- const promise = new Promise((resolve, reject) => {
260894
- if (pendingResolveReject != null) throw new Error("next() called before previous Promise was resolved.");
260895
- pendingResolveReject = {
260896
- resolve,
260897
- reject
260898
- };
260899
- });
260900
- self.readEntry();
260901
- return promise;
260902
- },
260903
- return(value) {
260904
- cleanup();
260905
- return Promise.resolve({
260906
- done: true,
260907
- value
260908
- });
260909
- },
260910
- throw(value) {
260911
- cleanup();
260912
- return Promise.reject(value);
260913
- }
260914
- };
260915
- };
260916
- ZipFile.prototype.openReadStream = function(entry, options, callback) {
260917
- var self = this;
260918
- var relativeStart = 0;
260919
- var relativeEnd = entry.compressedSize;
260920
- if (callback == null) {
260921
- callback = options;
260922
- options = null;
260923
- }
260924
- if (options == null) options = {};
260925
- else {
260926
- if (options.decodeFileData === false) {
260927
- if (options.decrypt != null) throw new Error("cannot use options.decrypt when options.decodeFileData === false");
260928
- if (options.decompress != null) throw new Error("cannot use options.decompress when options.decodeFileData === false");
260929
- } else {
260930
- if (options.decrypt != null) {
260931
- if (!entry.isEncrypted()) throw new Error("options.decrypt can only be specified for encrypted entries. See also option decodeFileData.");
260932
- if (options.decrypt !== false) throw new Error("invalid options.decrypt value: " + options.decrypt);
260933
- if (entry.isCompressed()) {
260934
- if (options.decompress !== false) throw new Error("entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.");
260935
- }
260936
- }
260937
- if (options.decompress != null) {
260938
- if (!entry.isCompressed()) throw new Error("options.decompress can only be specified for compressed entries. See also option decodeFileData.");
260939
- if (!(options.decompress === false || options.decompress === true)) throw new Error("invalid options.decompress value: " + options.decompress);
260940
- decompress = options.decompress;
260941
- }
260942
- }
260943
- if (options.start != null) {
260944
- relativeStart = options.start;
260945
- if (relativeStart < 0) throw new Error("options.start < 0");
260946
- if (relativeStart > entry.compressedSize) throw new Error("options.start > entry.compressedSize");
260947
- }
260948
- if (options.end != null) {
260949
- relativeEnd = options.end;
260950
- if (relativeEnd < 0) throw new Error("options.end < 0");
260951
- if (relativeEnd > entry.compressedSize) throw new Error("options.end > entry.compressedSize");
260952
- if (relativeEnd < relativeStart) throw new Error("options.end < options.start");
260953
- }
260954
- }
260955
- var rawMode = options.decodeFileData === false || (entry.compressionMethod === 0 || entry.compressionMethod === 8 && options.decompress === false) && (!entry.isEncrypted() || options.decrypt === false);
260956
- if (options.start != null || options.end != null) {
260957
- if (!rawMode) throw new Error("start/end range require options.decodeFileData === false for non-trivial encoded entries.");
260958
- }
260959
- if (!self.isOpen) return callback(/* @__PURE__ */ new Error("closed"));
260960
- if (entry.isEncrypted() && !rawMode) {
260961
- if (options.decrypt !== false) return callback(/* @__PURE__ */ new Error("entry is encrypted, and options.decodeFileData !== false"));
260962
- }
260963
- var decompress;
260964
- if (rawMode) decompress = false;
260965
- else if (entry.compressionMethod === 8) decompress = options.decodeFileData !== true;
260966
- else return callback(/* @__PURE__ */ new Error("unsupported compression method: " + entry.compressionMethod));
260967
- self.readLocalFileHeader(entry, { minimal: true }, function(err, localFileHeader) {
260968
- if (err) return callback(err);
260969
- self.openReadStreamLowLevel(localFileHeader.fileDataStart, entry.compressedSize, relativeStart, relativeEnd, decompress, entry.uncompressedSize, callback);
260970
- });
260971
- };
260972
- ZipFile.prototype.openReadStreamLowLevel = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, callback) {
260973
- var self = this;
260974
- fileDataStart + compressedSize;
260975
- var readStream = self.reader.createReadStream({
260976
- start: fileDataStart + relativeStart,
260977
- end: fileDataStart + relativeEnd
260978
- });
260979
- var endpointStream = readStream;
260980
- if (decompress) {
260981
- var destroyed = false;
260982
- var inflateFilter = zlib$1.createInflateRaw();
260983
- readStream.on("error", function(err) {
260984
- setImmediate(function() {
260985
- if (!destroyed) inflateFilter.emit("error", err);
260986
- });
260987
- });
260988
- readStream.pipe(inflateFilter);
260989
- if (self.validateEntrySizes) {
260990
- endpointStream = new AssertByteCountStream(uncompressedSize);
260991
- inflateFilter.on("error", function(err) {
260992
- setImmediate(function() {
260993
- if (!destroyed) endpointStream.emit("error", err);
260994
- });
260995
- });
260996
- inflateFilter.pipe(endpointStream);
260997
- } else endpointStream = inflateFilter;
260998
- installDestroyFn(endpointStream, function() {
260999
- destroyed = true;
261000
- if (inflateFilter !== endpointStream) inflateFilter.unpipe(endpointStream);
261001
- readStream.unpipe(inflateFilter);
261002
- readStream.destroy();
261003
- });
261004
- }
261005
- callback(null, endpointStream);
261006
- };
261007
- ZipFile.prototype.readLocalFileHeader = function(entry, options, callback) {
261008
- var self = this;
261009
- if (callback == null) {
261010
- callback = options;
261011
- options = null;
261012
- }
261013
- if (options == null) options = {};
261014
- self.reader.ref();
261015
- var buffer = newBuffer(30);
261016
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
261017
- try {
261018
- if (err) return callback(err);
261019
- var signature = buffer.readUInt32LE(0);
261020
- if (signature !== 67324752) return callback(/* @__PURE__ */ new Error("invalid local file header signature: 0x" + signature.toString(16)));
261021
- var fileNameLength = buffer.readUInt16LE(26);
261022
- var extraFieldLength = buffer.readUInt16LE(28);
261023
- var fileDataStart = entry.relativeOffsetOfLocalHeader + 30 + fileNameLength + extraFieldLength;
261024
- if (fileDataStart + entry.compressedSize > self.fileSize) return callback(/* @__PURE__ */ new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self.fileSize));
261025
- if (options.minimal) return callback(null, { fileDataStart });
261026
- var localFileHeader = new LocalFileHeader();
261027
- localFileHeader.fileDataStart = fileDataStart;
261028
- localFileHeader.versionNeededToExtract = buffer.readUInt16LE(4);
261029
- localFileHeader.generalPurposeBitFlag = buffer.readUInt16LE(6);
261030
- localFileHeader.compressionMethod = buffer.readUInt16LE(8);
261031
- localFileHeader.lastModFileTime = buffer.readUInt16LE(10);
261032
- localFileHeader.lastModFileDate = buffer.readUInt16LE(12);
261033
- localFileHeader.crc32 = buffer.readUInt32LE(14);
261034
- localFileHeader.compressedSize = buffer.readUInt32LE(18);
261035
- localFileHeader.uncompressedSize = buffer.readUInt32LE(22);
261036
- localFileHeader.fileNameLength = fileNameLength;
261037
- localFileHeader.extraFieldLength = extraFieldLength;
261038
- buffer = newBuffer(fileNameLength + extraFieldLength);
261039
- self.reader.ref();
261040
- readAndAssertNoEof(self.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader + 30, function(err) {
261041
- try {
261042
- if (err) return callback(err);
261043
- localFileHeader.fileName = buffer.subarray(0, fileNameLength);
261044
- localFileHeader.extraField = buffer.subarray(fileNameLength);
261045
- return callback(null, localFileHeader);
261046
- } finally {
261047
- self.reader.unref();
261048
- }
261049
- });
261050
- } finally {
261051
- self.reader.unref();
261052
- }
261053
- });
261054
- };
261055
- ZipFile.prototype.openReadStreamPromise = function(entry, options) {
261056
- return new Promise((resolve, reject) => {
261057
- this.openReadStream(entry, options, function(err, readStream) {
261058
- if (err) return reject(err);
261059
- resolve(readStream);
261060
- });
261061
- });
261062
- };
261063
- ZipFile.prototype.openReadStreamLowLevelPromise = function(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize) {
261064
- return new Promise((resolve, reject) => {
261065
- this.openReadStream(fileDataStart, compressedSize, relativeStart, relativeEnd, decompress, uncompressedSize, function(err, readStream) {
261066
- if (err) return reject(err);
261067
- resolve(readStream);
261068
- });
261069
- });
261070
- };
261071
- ZipFile.prototype.readLocalFileHeaderPromise = function(entry, options) {
261072
- return new Promise((resolve, reject) => {
261073
- this.readLocalFileHeader(entry, options, function(err, localFileHeader) {
261074
- if (err) return reject(err);
261075
- resolve(localFileHeader);
261076
- });
261077
- });
261078
- };
261079
- function Entry() {}
261080
- Entry.prototype.getLastModDate = function(options) {
261081
- if (options == null) options = {};
261082
- if (!options.forceDosFormat) for (var i = 0; i < this.extraFields.length; i++) {
261083
- var extraField = this.extraFields[i];
261084
- if (extraField.id === 21589) {
261085
- var data = extraField.data;
261086
- if (data.length < 5) continue;
261087
- if (!(data[0] & 1)) continue;
261088
- var posixTimestamp = data.readInt32LE(1);
261089
- return /* @__PURE__ */ new Date(posixTimestamp * 1e3);
261090
- } else if (extraField.id === 10) {
261091
- var data = extraField.data;
261092
- if (data.length !== 32) continue;
261093
- if (data.readUInt16LE(4) !== 1) continue;
261094
- if (data.readUInt16LE(6) !== 24) continue;
261095
- var millisecondsSince1970 = (data.readUInt32LE(8) + 4294967296 * data.readInt32LE(12)) / 1e4 - 0xa9730b66800;
261096
- return new Date(millisecondsSince1970);
261097
- }
261098
- }
261099
- return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime, options.timezone);
261100
- };
261101
- Entry.prototype.canDecodeFileData = function() {
261102
- return !this.isEncrypted() && (this.compressionMethod === 0 || this.compressionMethod === 8);
261103
- };
261104
- Entry.prototype.isEncrypted = function() {
261105
- return (this.generalPurposeBitFlag & 1) !== 0;
261106
- };
261107
- Entry.prototype.isCompressed = function() {
261108
- return this.compressionMethod === 8;
261109
- };
261110
- function LocalFileHeader() {}
261111
- function dosDateTimeToDate(date, time, timezone) {
261112
- var day = date & 31;
261113
- var month = (date >> 5 & 15) - 1;
261114
- var year = (date >> 9 & 127) + 1980;
261115
- var millisecond = 0;
261116
- var second = (time & 31) * 2;
261117
- var minute = time >> 5 & 63;
261118
- var hour = time >> 11 & 31;
261119
- if (timezone == null || timezone === "local") return new Date(year, month, day, hour, minute, second, millisecond);
261120
- else if (timezone === "UTC") return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
261121
- else throw new Error("unrecognized options.timezone: " + options.timezone);
261122
- }
261123
- function getFileNameLowLevel(generalPurposeBitFlag, fileNameBuffer, extraFields, strictFileNames) {
261124
- var fileName = null;
261125
- for (var i = 0; i < extraFields.length; i++) {
261126
- var extraField = extraFields[i];
261127
- if (extraField.id === 28789) {
261128
- if (extraField.data.length < 6) continue;
261129
- if (extraField.data.readUInt8(0) !== 1) continue;
261130
- var oldNameCrc32 = extraField.data.readUInt32LE(1);
261131
- if (crc32(fileNameBuffer) !== oldNameCrc32) continue;
261132
- fileName = decodeBuffer(extraField.data.subarray(5), true);
261133
- break;
261134
- }
261135
- }
261136
- if (fileName == null) fileName = decodeBuffer(fileNameBuffer, (generalPurposeBitFlag & 2048) !== 0);
261137
- if (!strictFileNames) fileName = fileName.replace(/\\/g, "/");
261138
- return fileName;
261139
- }
261140
- function validateFileName(fileName) {
261141
- if (fileName.indexOf("\\") !== -1) return "invalid characters in fileName: " + fileName;
261142
- if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) return "absolute path: " + fileName;
261143
- if (fileName.split("/").indexOf("..") !== -1) return "invalid relative path: " + fileName;
261144
- return null;
261145
- }
261146
- function parseExtraFields(extraFieldBuffer) {
261147
- var extraFields = [];
261148
- var i = 0;
261149
- while (i < extraFieldBuffer.length - 3) {
261150
- var headerId = extraFieldBuffer.readUInt16LE(i + 0);
261151
- var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
261152
- var dataStart = i + 4;
261153
- var dataEnd = dataStart + dataSize;
261154
- if (dataEnd > extraFieldBuffer.length) throw new Error("extra field length exceeds extra field buffer size");
261155
- var dataBuffer = extraFieldBuffer.subarray(dataStart, dataEnd);
261156
- extraFields.push({
261157
- id: headerId,
261158
- data: dataBuffer
261159
- });
261160
- i = dataEnd;
261161
- }
261162
- return extraFields;
261163
- }
261164
- function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
261165
- if (length === 0) return setImmediate(function() {
261166
- callback(null, newBuffer(0));
261167
- });
261168
- reader.read(buffer, offset, length, position, function(err, bytesRead) {
261169
- if (err) return callback(err);
261170
- if (bytesRead < length) return callback(/* @__PURE__ */ new Error("unexpected EOF"));
261171
- callback();
261172
- });
261173
- }
261174
- util$2.inherits(AssertByteCountStream, Transform$1);
261175
- function AssertByteCountStream(byteCount) {
261176
- Transform$1.call(this);
261177
- this.actualByteCount = 0;
261178
- this.expectedByteCount = byteCount;
261179
- }
261180
- AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
261181
- this.actualByteCount += chunk.length;
261182
- if (this.actualByteCount > this.expectedByteCount) {
261183
- var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
261184
- return cb(new Error(msg));
261185
- }
261186
- cb(null, chunk);
261187
- };
261188
- AssertByteCountStream.prototype._flush = function(cb) {
261189
- if (this.actualByteCount < this.expectedByteCount) {
261190
- var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
261191
- return cb(new Error(msg));
261192
- }
261193
- cb();
261194
- };
261195
- util$2.inherits(RandomAccessReader, EventEmitter$1);
261196
- function RandomAccessReader() {
261197
- EventEmitter$1.call(this);
261198
- this.refCount = 0;
261199
- }
261200
- RandomAccessReader.prototype.ref = function() {
261201
- this.refCount += 1;
261202
- };
261203
- RandomAccessReader.prototype.unref = function() {
261204
- var self = this;
261205
- self.refCount -= 1;
261206
- if (self.refCount > 0) return;
261207
- if (self.refCount < 0) throw new Error("invalid unref");
261208
- self.close(onCloseDone);
261209
- function onCloseDone(err) {
261210
- if (err) return self.emit("error", err);
261211
- self.emit("close");
261212
- }
261213
- };
261214
- RandomAccessReader.prototype.createReadStream = function(options) {
261215
- if (options == null) options = {};
261216
- var start = options.start;
261217
- var end = options.end;
261218
- if (start === end) {
261219
- var emptyStream = new PassThrough$1();
261220
- setImmediate(function() {
261221
- emptyStream.end();
261222
- });
261223
- return emptyStream;
261224
- }
261225
- var stream = this._readStreamForRange(start, end);
261226
- var destroyed = false;
261227
- var refUnrefFilter = new RefUnrefFilter(this);
261228
- stream.on("error", function(err) {
261229
- setImmediate(function() {
261230
- if (!destroyed) refUnrefFilter.emit("error", err);
261231
- });
261232
- });
261233
- installDestroyFn(refUnrefFilter, function() {
261234
- stream.unpipe(refUnrefFilter);
261235
- refUnrefFilter.unref();
261236
- stream.destroy();
261237
- });
261238
- var byteCounter = new AssertByteCountStream(end - start);
261239
- refUnrefFilter.on("error", function(err) {
261240
- setImmediate(function() {
261241
- if (!destroyed) byteCounter.emit("error", err);
261242
- });
261243
- });
261244
- installDestroyFn(byteCounter, function() {
261245
- destroyed = true;
261246
- refUnrefFilter.unpipe(byteCounter);
261247
- refUnrefFilter.destroy();
261248
- });
261249
- return stream.pipe(refUnrefFilter).pipe(byteCounter);
261250
- };
261251
- RandomAccessReader.prototype._readStreamForRange = function(start, end) {
261252
- throw new Error("not implemented");
261253
- };
261254
- RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
261255
- var readStream = this.createReadStream({
261256
- start: position,
261257
- end: position + length
261258
- });
261259
- var writeStream = new Writable$1();
261260
- var written = 0;
261261
- writeStream._write = function(chunk, encoding, cb) {
261262
- chunk.copy(buffer, offset + written, 0, chunk.length);
261263
- written += chunk.length;
261264
- cb();
261265
- };
261266
- writeStream.on("finish", callback);
261267
- readStream.on("error", function(error) {
261268
- callback(error);
261269
- });
261270
- readStream.pipe(writeStream);
261271
- };
261272
- RandomAccessReader.prototype.close = function(callback) {
261273
- setImmediate(callback);
261274
- };
261275
- util$2.inherits(RefUnrefFilter, PassThrough$1);
261276
- function RefUnrefFilter(context) {
261277
- PassThrough$1.call(this);
261278
- this.context = context;
261279
- this.context.ref();
261280
- this.unreffedYet = false;
261281
- }
261282
- RefUnrefFilter.prototype._flush = function(cb) {
261283
- this.unref();
261284
- cb();
261285
- };
261286
- RefUnrefFilter.prototype.unref = function(cb) {
261287
- if (this.unreffedYet) return;
261288
- this.unreffedYet = true;
261289
- this.context.unref();
261290
- };
261291
- var cp437 = "\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0";
261292
- function decodeBuffer(buffer, isUtf8) {
261293
- if (isUtf8) return buffer.toString("utf8");
261294
- else {
261295
- var result = "";
261296
- for (var i = 0; i < buffer.length; i++) result += cp437[buffer[i]];
261297
- return result;
261298
- }
261299
- }
261300
- function readUInt64LE(buffer, offset) {
261301
- var lower32 = buffer.readUInt32LE(offset);
261302
- return buffer.readUInt32LE(offset + 4) * 4294967296 + lower32;
261303
- }
261304
- var newBuffer;
261305
- if (typeof Buffer.allocUnsafe === "function") newBuffer = function(len) {
261306
- return Buffer.allocUnsafe(len);
261307
- };
261308
- else newBuffer = function(len) {
261309
- return new Buffer(len);
261310
- };
261311
- function installDestroyFn(stream, fn) {
261312
- if (typeof stream.destroy === "function") stream._destroy = function(err, cb) {
261313
- fn();
261314
- if (cb != null) cb(err);
261315
- };
261316
- else stream.destroy = fn;
261317
- }
261318
- function defaultCallback(err) {
261319
- if (err) throw err;
261320
- }
261321
- }));
261322
-
261323
261496
  //#endregion
261324
261497
  //#region ../../packages/file-loaders/src/utils/parser-utils.ts
261325
261498
  /** Extract specific files from either a ZIP file buffer or file path based on a filter function.
@@ -261685,6 +261858,7 @@ function isReadableFileType(fileType) {
261685
261858
 
261686
261859
  //#endregion
261687
261860
  //#region ../../packages/file-loaders/src/loadFile.ts
261861
+ init_fileParseBudget();
261688
261862
  const log$4 = (0, import_src$6.default)("file-loaders:loadFile");
261689
261863
  var UnsupportedFileTypeError = class extends Error {
261690
261864
  fileType;
@@ -261818,6 +261992,7 @@ const loadFile = async (filePath, fileMetadata) => {
261818
261992
  }
261819
261993
  } else log$4("Loader does not support attachDocumentMetadata.");
261820
261994
  } catch (loadErr) {
261995
+ if (isFileParseBudgetError(loadErr)) throw loadErr;
261821
261996
  const error = loadErr;
261822
261997
  console.error(`Error loading pages for ${filePath} using ${LoaderClass.name}: ${error.message}`);
261823
261998
  loaderError = `Loader execution failed: ${error.message}`;
@@ -330675,7 +330850,7 @@ var stdio_exports = /* @__PURE__ */ __exportAll$2({
330675
330850
  function getDefaultEnvironment() {
330676
330851
  const env = {};
330677
330852
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
330678
- const value = process$1.env[key];
330853
+ const value = _w.env[key];
330679
330854
  if (value === void 0) continue;
330680
330855
  if (value.startsWith("()")) continue;
330681
330856
  env[key] = value;
@@ -330686,7 +330861,7 @@ var import_cross_spawn$1, DEFAULT_INHERITED_ENV_VARS, StdioClientTransport;
330686
330861
  var init_stdio = __esmMin((() => {
330687
330862
  init_src_CeKsbNLO();
330688
330863
  import_cross_spawn$1 = /* @__PURE__ */ __toESM$2(require_cross_spawn(), 1);
330689
- DEFAULT_INHERITED_ENV_VARS = process$1.platform === "win32" ? [
330864
+ DEFAULT_INHERITED_ENV_VARS = _w.platform === "win32" ? [
330690
330865
  "APPDATA",
330691
330866
  "COMSPEC",
330692
330867
  "HOMEDRIVE",
@@ -330743,7 +330918,7 @@ var init_stdio = __esmMin((() => {
330743
330918
  this._serverParams.stderr ?? "inherit"
330744
330919
  ],
330745
330920
  shell: false,
330746
- windowsHide: process$1.platform === "win32",
330921
+ windowsHide: _w.platform === "win32",
330747
330922
  cwd: this._serverParams.cwd
330748
330923
  });
330749
330924
  this._process.on("error", (error) => {
@@ -333777,9 +333952,9 @@ const getSubprocessResult = ({ stdout }) => {
333777
333952
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/utils/standard-stream.js
333778
333953
  const isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
333779
333954
  const STANDARD_STREAMS = [
333780
- process$1.stdin,
333781
- process$1.stdout,
333782
- process$1.stderr
333955
+ _w.stdin,
333956
+ _w.stdout,
333957
+ _w.stderr
333783
333958
  ];
333784
333959
  const STANDARD_STREAMS_ALIASES = [
333785
333960
  "stdin",
@@ -333904,9 +334079,9 @@ const NO_ESCAPE_REGEXP = /^[\w./-]+$/;
333904
334079
  //#endregion
333905
334080
  //#region node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
333906
334081
  function isUnicodeSupported() {
333907
- const { env } = process$1;
334082
+ const { env } = _w;
333908
334083
  const { TERM, TERM_PROGRAM } = env;
333909
- if (process$1.platform !== "win32") return TERM !== "linux";
334084
+ if (_w.platform !== "win32") return TERM !== "linux";
333910
334085
  return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
333911
334086
  }
333912
334087
 
@@ -334441,7 +334616,7 @@ function traversePathUp(startPath) {
334441
334616
 
334442
334617
  //#endregion
334443
334618
  //#region node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
334444
- const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath = process$1.execPath, addExecPath = true } = {}) => {
334619
+ const npmRunPath = ({ cwd = _w.cwd(), path: pathOption = _w.env[pathKey()], preferLocal = true, execPath = _w.execPath, addExecPath = true } = {}) => {
334445
334620
  const cwdPath = path.resolve(toPath(cwd));
334446
334621
  const result = [];
334447
334622
  const pathParts = pathOption.split(path.delimiter);
@@ -334459,7 +334634,7 @@ const applyExecPath = (result, pathParts, execPath, cwdPath) => {
334459
334634
  const pathPart = path.resolve(cwdPath, toPath(execPath), "..");
334460
334635
  if (!pathParts.includes(pathPart)) result.push(pathPart);
334461
334636
  };
334462
- const npmRunPathEnv = ({ env = process$1.env, ...options } = {}) => {
334637
+ const npmRunPathEnv = ({ env = _w.env, ...options } = {}) => {
334463
334638
  env = { ...env };
334464
334639
  const pathName = pathKey({ env });
334465
334640
  options.path = env[pathName];
@@ -335594,7 +335769,7 @@ const normalizeCwd = (cwd = getDefaultCwd()) => {
335594
335769
  };
335595
335770
  const getDefaultCwd = () => {
335596
335771
  try {
335597
- return process$1.cwd();
335772
+ return _w.cwd();
335598
335773
  } catch (error) {
335599
335774
  error.message = `The current directory does not exist.\n${error.message}`;
335600
335775
  throw error;
@@ -335630,7 +335805,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
335630
335805
  options.killSignal = normalizeKillSignal(options.killSignal);
335631
335806
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
335632
335807
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
335633
- if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
335808
+ if (_w.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
335634
335809
  return {
335635
335810
  file,
335636
335811
  commandArguments,
@@ -335657,7 +335832,7 @@ const addDefaultOptions = ({ extendEnv = true, preferLocal = false, cwd, localDi
335657
335832
  });
335658
335833
  const getEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
335659
335834
  const env = extendEnv ? {
335660
- ...process$1.env,
335835
+ ..._w.env,
335661
335836
  ...envOption
335662
335837
  } : envOption;
335663
335838
  if (preferLocal || node) return npmRunPathEnv({
@@ -336659,12 +336834,12 @@ const guessStreamDirection = {
336659
336834
  }
336660
336835
  };
336661
336836
  const getStandardStreamDirection = (value) => {
336662
- if ([0, process$1.stdin].includes(value)) return "input";
336837
+ if ([0, _w.stdin].includes(value)) return "input";
336663
336838
  if ([
336664
336839
  1,
336665
336840
  2,
336666
- process$1.stdout,
336667
- process$1.stderr
336841
+ _w.stdout,
336842
+ _w.stderr
336668
336843
  ].includes(value)) return "output";
336669
336844
  };
336670
336845
  const DEFAULT_DIRECTION = "output";
@@ -337728,9 +337903,9 @@ const addIpcMethods = (subprocess, { ipc }) => {
337728
337903
  Object.assign(subprocess, getIpcMethods(subprocess, false, ipc));
337729
337904
  };
337730
337905
  const getIpcExport = () => {
337731
- const anyProcess = process$1;
337906
+ const anyProcess = _w;
337732
337907
  const isSubprocess = true;
337733
- const ipc = process$1.channel !== void 0;
337908
+ const ipc = _w.channel !== void 0;
337734
337909
  return {
337735
337910
  ...getIpcMethods(anyProcess, isSubprocess, ipc),
337736
337911
  getCancelSignal: getCancelSignal$1.bind(void 0, {
@@ -338207,7 +338382,7 @@ var SignalExitFallback = class extends SignalExitBase {
338207
338382
  };
338208
338383
  var SignalExit = class extends SignalExitBase {
338209
338384
  /* c8 ignore start */
338210
- #hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
338385
+ #hupSig = process$1.platform === "win32" ? "SIGINT" : "SIGHUP";
338211
338386
  /* c8 ignore stop */
338212
338387
  #emitter = new Emitter();
338213
338388
  #process;
@@ -338302,8 +338477,8 @@ var SignalExit = class extends SignalExitBase {
338302
338477
  } else return og.call(this.#process, ev, ...args);
338303
338478
  }
338304
338479
  };
338305
- const process$2 = globalThis.process;
338306
- const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
338480
+ const process$1 = globalThis.process;
338481
+ const { onExit, load: load$1, unload } = signalExitWrap(processOk(process$1) ? new SignalExit(process$1) : new SignalExitFallback());
338307
338482
 
338308
338483
  //#endregion
338309
338484
  //#region node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/cleanup.js
@@ -555010,14 +555185,16 @@ function registerConnectorCommand(program) {
555010
555185
  truncate$2(c.name || "", 30),
555011
555186
  c.sourceType || "",
555012
555187
  c.status === "connected" ? import_picocolors.default.green(c.status) : c.status || "",
555013
- String(c.toolCount)
555188
+ String(c.toolCount),
555189
+ String(c.links?.length ?? 0)
555014
555190
  ]), [
555015
555191
  "ID",
555016
555192
  "IDENTIFIER",
555017
555193
  "NAME",
555018
555194
  "SOURCE",
555019
555195
  "STATUS",
555020
- "TOOLS"
555196
+ "TOOLS",
555197
+ "ACCOUNTS"
555021
555198
  ]);
555022
555199
  });
555023
555200
  connector.command("add").description("Add a custom MCP connector and sync its tools").option("--url <url>", "MCP server URL (streamable HTTP / SSE)").option("--name <name>", "Display name (defaults to the identifier)").option("--identifier <id>", "Connector identifier (derived from --name or --url if omitted)").option("--auth <type>", "Auth type: none, bearer or oauth2").option("--token <token>", "Bearer token (with --auth bearer)").option("--header <key:value>", "Custom request header (repeatable)", collect$1, []).option("--stdio-cmd <command>", "stdio MCP server command").option("--stdio-arg <arg>", "stdio MCP server argument (repeatable)", collect$1, []).option("--force", "Overwrite an existing connector with the same identifier").option("--json [fields]", "Output JSON, optionally specify fields (comma-separated)").action(async (options) => {