@poe-platform/safe-bash 0.1.756 → 0.1.758

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.
Files changed (161) hide show
  1. package/dist/image-ast/index.browser.js +76 -23
  2. package/dist/image-ast/index.js +76 -23
  3. package/dist/pdf-ast/ast.d.ts +3 -0
  4. package/dist/pdf-ast/index.js +88 -36
  5. package/dist/safe-bash/chunks/{chunk-LESPJ3OG.js → chunk-WNWIBBJZ.js} +15 -2
  6. package/dist/safe-bash/command-chunks/{chunk-S4J6MSLY.js → chunk-444OTXM7.js} +3 -3
  7. package/dist/safe-bash/command-chunks/{chunk-F3J5ZLKF.js → chunk-522TDVLS.js} +1 -1
  8. package/dist/safe-bash/command-chunks/{chunk-VFS2MDAB.js → chunk-6YLD37NH.js} +2 -2
  9. package/dist/safe-bash/command-chunks/{chunk-YI3GKJ7Q.js → chunk-766IWMTB.js} +2 -2
  10. package/dist/safe-bash/command-chunks/{chunk-6AIOGLZO.js → chunk-CE6Z2ULX.js} +2 -2
  11. package/dist/safe-bash/command-chunks/{chunk-KSH2F6RG.js → chunk-CUFCNL6G.js} +1 -1
  12. package/dist/safe-bash/command-chunks/{chunk-5VSGEE6J.js → chunk-F4IQCXZG.js} +5 -5
  13. package/dist/safe-bash/command-chunks/{chunk-F5MORDSU.js → chunk-FDNCPZQS.js} +32 -1
  14. package/dist/safe-bash/command-chunks/{chunk-SG3ZDZCX.js → chunk-FLMLM7Y4.js} +2 -2
  15. package/dist/safe-bash/command-chunks/{chunk-DVZCHNB5.js → chunk-J2NPH7DO.js} +11 -7
  16. package/dist/safe-bash/command-chunks/{chunk-CT3FB722.js → chunk-J7UMKBRK.js} +1 -1
  17. package/dist/safe-bash/command-chunks/{chunk-QQOAK7JQ.js → chunk-KKJCKPTA.js} +1 -1
  18. package/dist/safe-bash/command-chunks/{chunk-7KS6PX4U.js → chunk-KSIGF4AG.js} +3 -3
  19. package/dist/safe-bash/command-chunks/{chunk-KBBI4CSU.js → chunk-L2C5TIII.js} +2 -2
  20. package/dist/safe-bash/command-chunks/{chunk-4HQ7WYSI.js → chunk-MED2BOOW.js} +30 -5
  21. package/dist/safe-bash/command-chunks/{chunk-JRNLDPLI.js → chunk-OZSWW23M.js} +1 -1
  22. package/dist/safe-bash/command-chunks/{chunk-DKQ5REXF.js → chunk-QDPRSPHQ.js} +1 -1
  23. package/dist/safe-bash/command-chunks/{chunk-WOPU2VWF.js → chunk-RID3B5RE.js} +1 -1
  24. package/dist/safe-bash/command-chunks/{chunk-H2FQA4OU.js → chunk-TCAGGM44.js} +72 -19
  25. package/dist/safe-bash/command-chunks/{chunk-REYTQLLB.js → chunk-TT2DMDBY.js} +1 -1
  26. package/dist/safe-bash/command-chunks/{chunk-UGX6MXDD.js → chunk-UIIT4ULR.js} +3 -3
  27. package/dist/safe-bash/command-chunks/{chunk-A6NFLWZI.js → chunk-WKPOGTZY.js} +22 -6
  28. package/dist/safe-bash/command-chunks/{chunk-WI35236J.js → chunk-XYCWDGOG.js} +1 -1
  29. package/dist/safe-bash/command-chunks/{chunk-3DOHQQJR.js → chunk-Y64PA6IA.js} +8 -8
  30. package/dist/safe-bash/command-chunks/{chunk-4F6PG2OT.js → chunk-YJWWRCIG.js} +8 -8
  31. package/dist/safe-bash/command-chunks/{chunk-6Z7OS3TZ.js → chunk-ZP5KDHB4.js} +7 -7
  32. package/dist/safe-bash/commands/pandoc/index.d.ts +1 -1
  33. package/dist/safe-bash/commands/pandoc/index.js +5 -3
  34. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  35. package/dist/safe-bash/commands/python/index.js +6 -0
  36. package/dist/safe-bash/commands/python/jspi.js +11 -2
  37. package/dist/safe-bash/core.browser.js +6 -4
  38. package/dist/safe-bash-command-column/column.js +3 -3
  39. package/dist/safe-bash-command-column/index.js +3 -3
  40. package/dist/safe-bash-command-column/layout.js +2 -2
  41. package/dist/safe-bash-command-csvkit/index.js +8 -8
  42. package/dist/safe-bash-command-factor/command.js +2 -2
  43. package/dist/safe-bash-command-factor/index.js +2 -2
  44. package/dist/safe-bash-command-ffmpeg/index.js +5923 -5893
  45. package/dist/safe-bash-command-imagemagick/index.js +2 -2
  46. package/dist/safe-bash-command-pandoc/command.js +3 -3
  47. package/dist/safe-bash-command-pandoc/index.js +3 -3
  48. package/dist/safe-bash-command-pdfimages/index.js +72 -19
  49. package/dist/safe-bash-command-pdfinfo/index.js +88 -36
  50. package/dist/safe-bash-command-pdftk/index.js +72 -19
  51. package/dist/safe-bash-command-pdftoppm/index.js +88 -36
  52. package/dist/safe-bash-command-pdftotext/index.js +72 -19
  53. package/dist/safe-bash-command-qpdf/index.js +72 -19
  54. package/dist/safe-bash-command-sips/index.js +2 -2
  55. package/dist/safe-bash-command-soffice/index.js +17 -17
  56. package/dist/safe-bash-command-ssconvert/command-bindings.d.ts +18 -0
  57. package/dist/safe-bash-command-ssconvert/command.d.ts +5 -14
  58. package/dist/safe-bash-command-ssconvert/commands.d.ts +6 -0
  59. package/dist/safe-bash-command-ssconvert/commands.js +871 -0
  60. package/dist/safe-bash-command-ssconvert/core.js +8 -8
  61. package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
  62. package/dist/safe-bash-command-ssconvert/formats/ods.js +8 -8
  63. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +1 -1
  64. package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -8
  65. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +8 -8
  66. package/dist/safe-bash-command-ssconvert/index.js +376 -236
  67. package/dist/safe-bash-command-wkhtmltopdf/index.js +72 -19
  68. package/dist/safe-bash-command-yq/index.js +4 -4
  69. package/dist/safe-bash-compression-engine/files.js +2 -2
  70. package/dist/safe-bash-compression-engine/operand.js +4 -4
  71. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  72. package/dist/safe-bash-contracts/filesystem-output.js +1 -1
  73. package/dist/safe-bash-markdown-engine/commonmark-blocks.js +4 -4
  74. package/dist/safe-bash-markdown-engine/commonmark-inlines.js +4 -4
  75. package/dist/safe-bash-markdown-engine/commonmark-syntax.js +2 -2
  76. package/dist/safe-bash-markdown-engine/gfm-syntax.js +3 -3
  77. package/dist/safe-bash-markdown-engine/index.js +7 -7
  78. package/dist/safe-bash-mcp/index.js +4 -4
  79. package/dist/safe-bash-query-engine/index.js +5 -5
  80. package/dist/safe-bash-query-engine/interpreter.js +4 -4
  81. package/dist/safe-bash-query-engine/query-core.js +5 -5
  82. package/dist/spreadsheet-engine/formulas/ast.d.ts +13 -0
  83. package/dist/spreadsheet-engine/formulas/conventions.js +1 -1
  84. package/dist/spreadsheet-engine/formulas/dependencies.js +2 -2
  85. package/dist/spreadsheet-engine/formulas/evaluator.js +2 -2
  86. package/dist/spreadsheet-engine/formulas/named-expressions.d.ts +2 -2
  87. package/dist/spreadsheet-engine/formulas/named-expressions.js +31 -5
  88. package/dist/spreadsheet-engine/formulas/parser.js +34 -0
  89. package/dist/spreadsheet-engine/formulas/rewriting.js +19 -1
  90. package/dist/spreadsheet-engine/formulas/serialization.js +6 -0
  91. package/dist/spreadsheet-format-xls/biff-write-formulas.js +2 -0
  92. package/dist/xlsx-ast/formula-semantics.js +2 -0
  93. package/package.json +6 -2
  94. package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +16 -0
  95. package/dist/safe-bash/chunks/browser-ECQX6GMK.js +0 -6766
  96. package/dist/safe-bash/chunks/bz2-4OP3OWW3.js +0 -8
  97. package/dist/safe-bash/chunks/chunk-22XPAAOI.js +0 -173
  98. package/dist/safe-bash/chunks/chunk-44WUNUPV.js +0 -649
  99. package/dist/safe-bash/chunks/chunk-4E3SGG37.js +0 -876
  100. package/dist/safe-bash/chunks/chunk-4QTSSQKP.js +0 -898
  101. package/dist/safe-bash/chunks/chunk-5UVGPVXP.js +0 -410
  102. package/dist/safe-bash/chunks/chunk-64OE6Q6X.js +0 -3487
  103. package/dist/safe-bash/chunks/chunk-6IIFUPN2.js +0 -1526
  104. package/dist/safe-bash/chunks/chunk-BENDLTQD.js +0 -7065
  105. package/dist/safe-bash/chunks/chunk-BMO5LWEX.js +0 -534
  106. package/dist/safe-bash/chunks/chunk-BPMCPTNP.js +0 -1920
  107. package/dist/safe-bash/chunks/chunk-BRJTAWP5.js +0 -2955
  108. package/dist/safe-bash/chunks/chunk-C3GEIN7Q.js +0 -20054
  109. package/dist/safe-bash/chunks/chunk-CBVANNKK.js +0 -174814
  110. package/dist/safe-bash/chunks/chunk-CEWCRI6H.js +0 -2813
  111. package/dist/safe-bash/chunks/chunk-CGL53DQQ.js +0 -37
  112. package/dist/safe-bash/chunks/chunk-CTYJJD4O.js +0 -869
  113. package/dist/safe-bash/chunks/chunk-CWSS4MQA.js +0 -7
  114. package/dist/safe-bash/chunks/chunk-DLIGMTCP.js +0 -3266
  115. package/dist/safe-bash/chunks/chunk-EMAJ7WUW.js +0 -1031
  116. package/dist/safe-bash/chunks/chunk-FDKIZ2IJ.js +0 -1950
  117. package/dist/safe-bash/chunks/chunk-FZWJ2A7V.js +0 -3093
  118. package/dist/safe-bash/chunks/chunk-G2VCIF2J.js +0 -22
  119. package/dist/safe-bash/chunks/chunk-GVKBUQDX.js +0 -2649
  120. package/dist/safe-bash/chunks/chunk-IO2OGW3E.js +0 -28051
  121. package/dist/safe-bash/chunks/chunk-ISCZG7WA.js +0 -2648
  122. package/dist/safe-bash/chunks/chunk-JCN3FXLP.js +0 -38983
  123. package/dist/safe-bash/chunks/chunk-KJHDD4A2.js +0 -759
  124. package/dist/safe-bash/chunks/chunk-LB6HVRXS.js +0 -857
  125. package/dist/safe-bash/chunks/chunk-LLWAJOZH.js +0 -15
  126. package/dist/safe-bash/chunks/chunk-LMUKYZIJ.js +0 -708
  127. package/dist/safe-bash/chunks/chunk-M5SCNKIK.js +0 -2012
  128. package/dist/safe-bash/chunks/chunk-MJPFHANT.js +0 -3350
  129. package/dist/safe-bash/chunks/chunk-MZQW2DOL.js +0 -82
  130. package/dist/safe-bash/chunks/chunk-NB2V7EOY.js +0 -1348
  131. package/dist/safe-bash/chunks/chunk-NJVGOIYN.js +0 -17
  132. package/dist/safe-bash/chunks/chunk-OLNZHDIQ.js +0 -5141
  133. package/dist/safe-bash/chunks/chunk-OSUXMC43.js +0 -2317
  134. package/dist/safe-bash/chunks/chunk-OUUVROTM.js +0 -38
  135. package/dist/safe-bash/chunks/chunk-PA6GYKBQ.js +0 -151
  136. package/dist/safe-bash/chunks/chunk-PEFHZ226.js +0 -6957
  137. package/dist/safe-bash/chunks/chunk-QBB5P5KW.js +0 -4839
  138. package/dist/safe-bash/chunks/chunk-RSAWYAEH.js +0 -973
  139. package/dist/safe-bash/chunks/chunk-UWLYRWT4.js +0 -739
  140. package/dist/safe-bash/chunks/chunk-V463NBQH.js +0 -13
  141. package/dist/safe-bash/chunks/chunk-WPUALYUS.js +0 -843
  142. package/dist/safe-bash/chunks/chunk-XHKFSRGU.js +0 -5747
  143. package/dist/safe-bash/chunks/chunk-XHRCLZ3N.js +0 -13391
  144. package/dist/safe-bash/chunks/chunk-XPF5XHLY.js +0 -15
  145. package/dist/safe-bash/chunks/chunk-ZBFOWARG.js +0 -305
  146. package/dist/safe-bash/chunks/chunk-ZG7GWQ5P.js +0 -1859
  147. package/dist/safe-bash/chunks/model-store-EIY3ZQLZ.js +0 -10
  148. package/dist/safe-bash/chunks/pdf-renderer-CMF3CSVU.js +0 -22
  149. package/dist/safe-bash/chunks/pptx-ZL6L7KP2-O425BFIU.js +0 -30658
  150. package/dist/safe-bash/chunks/src-HHEPGR7U.js +0 -18969
  151. package/dist/safe-bash/chunks/src-MXIKQCIC.js +0 -187
  152. package/dist/safe-bash/chunks/usage-6TGVA2OM.js +0 -35
  153. package/dist/safe-bash/chunks/xz-EGQGQUEI.js +0 -8
  154. package/dist/safe-bash/chunks/xz-K2E2WLM6.js +0 -9
  155. package/dist/safe-bash/chunks/zstd-6JBLP5EF.js +0 -8
  156. package/dist/safe-bash/git_rust-C3QYOAZL.wasm +0 -0
  157. package/dist/safe-bash/command-chunks/{chunk-OQVIJMBY.js → chunk-7HINP7ZK.js} +4 -4
  158. package/dist/safe-bash/command-chunks/{chunk-XAYEDOV5.js → chunk-CG4JSOK2.js} +3 -3
  159. package/dist/safe-bash/command-chunks/{chunk-YIK4ZYQ4.js → chunk-DC52GWRK.js} +9 -9
  160. package/dist/safe-bash/command-chunks/{chunk-TOTZFBDT.js → chunk-TKACIO4X.js} +4 -4
  161. package/dist/safe-bash/command-chunks/{chunk-VTWKS4RM.js → chunk-WF2LSKMI.js} +3 -3
@@ -5,7 +5,7 @@ import {
5
5
  numericFunctionDescriptors,
6
6
  resolveName,
7
7
  statisticsFunctionDescriptors
8
- } from "./chunk-F5MORDSU.js";
8
+ } from "./chunk-FDNCPZQS.js";
9
9
  import {
10
10
  init_buffer
11
11
  } from "./chunk-HX3SHTCE.js";
@@ -637,21 +637,46 @@ var functionDescriptors = {
637
637
 
638
638
  // packages/spreadsheet-engine/src/formulas/named-expressions.ts
639
639
  init_buffer();
640
- function parseNamedExpression(name, book, parse, tick, maximumDepth = Infinity) {
640
+ function parseNamedExpression(name, book, parse, tick, maximumDepth = Infinity, relocation) {
641
641
  if (name.expression === "" || name.expression === "=") {
642
642
  tick();
643
643
  return { kind: "literal", value: { kind: "blank" }, start: 0, end: 0 };
644
644
  }
645
645
  const position = name.position ?? { sheet: name.sheet ?? book.sheets[0]?.id ?? "", row: 0, column: 0 };
646
+ function displace(ref, fallback) {
647
+ if (!relocation || ref.workbook !== void 0) return ref;
648
+ const origin = book.sheets.findIndex((sheet) => sheet.id === position.sheet);
649
+ const index = ref.sheetRelative ? origin + (ref.sheetOffset ?? 0) : ref.sheet !== void 0 || fallback !== void 0 ? book.sheets.findIndex((sheet) => foldSheetName(sheet.name) === foldSheetName(ref.sheet ?? fallback)) : origin;
650
+ const target = index >= 0 ? book.sheets[index + relocation.sheet] : void 0;
651
+ if (!target) return void 0;
652
+ const axis = (value, key) => ({ value: value.value + (value.relative ? position[key] : 0) + relocation[key], relative: false });
653
+ return { ...ref, sheet: target.name, sheetRelative: false, ...ref.row ? { row: axis(ref.row, "row") } : {}, ...ref.column ? { column: axis(ref.column, "column") } : {} };
654
+ }
646
655
  function bind(node, depth = 0) {
647
656
  tick();
648
657
  if (depth > maximumDepth) throw new SsconvertError("resource-limit", "ssconvert formula dependency depth limit exceeded");
649
- if (node.kind === "name" && (node.workbook === void 0 || node.workbook === "" && node.sheet !== void 0)) {
658
+ if (node.kind === "reference" && relocation) {
659
+ const first = displace(node.first), last = node.last ? displace(node.last, node.first.sheet) : void 0;
660
+ if (!first || node.last && !last) return { kind: "literal", value: { kind: "error", value: "#REF!" }, start: node.start, end: node.end };
661
+ return { ...node, first, ...last ? { last } : {} };
662
+ }
663
+ if (node.kind === "name" && (node.workbook === void 0 || node.workbook === "")) {
664
+ const inherited = relocation ? {
665
+ ...relocation,
666
+ row: relocation.row + (node.relocation?.row ?? 0),
667
+ column: relocation.column + (node.relocation?.column ?? 0),
668
+ sheet: relocation.sheet + (node.relocation?.sheet ?? 0)
669
+ } : node.relocation;
670
+ const bound = inherited ? { ...node, relocation: inherited } : node;
671
+ if (node.workbook === "" && node.sheet === void 0) return bound;
650
672
  const scope = node.sheet === void 0 ? name.sheet : book.sheets.find((sheet2) => foldSheetName(sheet2.name) === foldSheetName(node.sheet))?.id;
651
673
  const target = resolveName(book, node.name, scope);
652
- if (target?.sheet === void 0) return { kind: "name", name: node.name, workbook: "", start: node.start, end: node.end };
674
+ if (target?.sheet === void 0) {
675
+ const { sheet: ignoredSheet, ...global } = bound;
676
+ return { ...global, workbook: "" };
677
+ }
653
678
  const sheet = book.sheets.find((sheet2) => sheet2.id === target.sheet);
654
- return sheet ? { ...node, sheet: sheet.name } : node;
679
+ return sheet ? { ...bound, sheet: sheet.name } : bound;
655
680
  }
656
681
  if (node.kind === "parentheses" || node.kind === "unary") return { ...node, child: bind(node.child, depth + 1) };
657
682
  if (node.kind === "binary") return { ...node, left: bind(node.left, depth + 1), right: bind(node.right, depth + 1) };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SsconvertError
3
- } from "./chunk-F5MORDSU.js";
3
+ } from "./chunk-FDNCPZQS.js";
4
4
  import {
5
5
  init_buffer
6
6
  } from "./chunk-HX3SHTCE.js";
@@ -2,7 +2,7 @@ import {
2
2
  createXlsxWriter,
3
3
  probeXlsx,
4
4
  readXlsx
5
- } from "./chunk-5VSGEE6J.js";
5
+ } from "./chunk-F4IQCXZG.js";
6
6
  import {
7
7
  init_buffer
8
8
  } from "./chunk-HX3SHTCE.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  SsconvertError
3
- } from "./chunk-F5MORDSU.js";
3
+ } from "./chunk-FDNCPZQS.js";
4
4
  import {
5
5
  init_buffer
6
6
  } from "./chunk-HX3SHTCE.js";
@@ -28747,7 +28747,7 @@ var ParsedCosDocument = class {
28747
28747
  return void 0;
28748
28748
  }
28749
28749
  };
28750
- function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false) {
28750
+ function parseNodeFromLexer(lexer, bytes, maxDepth, repair = false) {
28751
28751
  const stack = [];
28752
28752
  while (true) {
28753
28753
  const tok = lexer.nextToken();
@@ -28756,7 +28756,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
28756
28756
  if (!parent) return void 0;
28757
28757
  throw new PdfError("E_PARSE", parent.kind === "array" ? "Unterminated PDF array" : "Unterminated PDF dictionary");
28758
28758
  }
28759
- if (!parent && recoverEmptyObject && tok.kind === "keyword" && tok.value === "endobj") {
28759
+ if (!parent && repair && tok.kind === "keyword" && tok.value === "endobj") {
28760
28760
  return { kind: "null", span: tok.span };
28761
28761
  }
28762
28762
  let node;
@@ -28771,6 +28771,7 @@ function parseNodeFromLexer(lexer, bytes, maxDepth, recoverEmptyObject = false)
28771
28771
  parent.key = { kind: "name", rawBytes: tok.rawBytes, decoded: tok.decoded, span: tok.span };
28772
28772
  continue;
28773
28773
  } else {
28774
+ if (repair) continue;
28774
28775
  throw new PdfError("E_PARSE", `Expected dictionary key /Name, got ${tok.kind}`);
28775
28776
  }
28776
28777
  } else {
@@ -28939,7 +28940,7 @@ function parseHeaderVersion(bytes) {
28939
28940
  }
28940
28941
  return head.slice(idx + 5, idx + 8);
28941
28942
  }
28942
- function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObject = false) {
28943
+ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, repair = false) {
28943
28944
  const lexer = new CosByteLexer(bytes, offset);
28944
28945
  const objNumTok = lexer.nextToken();
28945
28946
  const genNumTok = lexer.nextToken();
@@ -28947,7 +28948,7 @@ function parseObjectAtOffset(bytes, offset, maxRecursionDepth, recoverEmptyObjec
28947
28948
  if (objNumTok?.kind !== "number" || genNumTok?.kind !== "number" || objKwTok?.kind !== "keyword" || objKwTok.value !== "obj") {
28948
28949
  throw new PdfError("E_PARSE", `Malformed indirect object header at byte offset ${offset}`);
28949
28950
  }
28950
- const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, recoverEmptyObject);
28951
+ const value = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, repair);
28951
28952
  if (!value) {
28952
28953
  throw new PdfError("E_PARSE", `Empty indirect object ${objNumTok.value} at offset ${offset}`);
28953
28954
  }
@@ -29136,7 +29137,7 @@ function repairScanCosDocument(bytes, maxObjects, maxRecursionDepth) {
29136
29137
  try {
29137
29138
  const token = lexer.nextToken();
29138
29139
  if (token?.kind === "keyword" && token.value === "trailer") {
29139
- const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth);
29140
+ const trailer = parseNodeFromLexer(lexer, bytes, maxRecursionDepth, true);
29140
29141
  if (trailer?.kind === "dict") trailers.push(trailer);
29141
29142
  pos = lexer.offset;
29142
29143
  continue;
@@ -29192,7 +29193,7 @@ function unpackRecoveredObjects(objects, maxObjects, maxDecompressedBytes, maxRe
29192
29193
  const t = dictGet(obj.value.dict, "Type");
29193
29194
  if (t?.kind === "name" && t.decoded === "ObjStm") {
29194
29195
  try {
29195
- for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth).entries()) {
29196
+ for (const [unpackedNum, unpackedVal] of unpackObjectStream(obj.value, maxDecompressedBytes, maxRecursionDepth, true).entries()) {
29196
29197
  if (!objects.has(unpackedNum)) {
29197
29198
  objects.set(unpackedNum, {
29198
29199
  objectNumber: unpackedNum,
@@ -29228,7 +29229,7 @@ function recoveredReferences(objects) {
29228
29229
  }
29229
29230
  return { ...rootRef ? { rootRef } : {}, ...infoRef ? { infoRef } : {} };
29230
29231
  }
29231
- function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth) {
29232
+ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth, repair = false) {
29232
29233
  const nNode = dictGet(streamObj.dict, "N");
29233
29234
  const firstNode = dictGet(streamObj.dict, "First");
29234
29235
  if (nNode?.kind !== "number" || firstNode?.kind !== "number") {
@@ -29248,7 +29249,7 @@ function unpackObjectStream(streamObj, maxDecompressedBytes, maxRecursionDepth)
29248
29249
  for (const pair of pairs) {
29249
29250
  try {
29250
29251
  const valLexer = new CosByteLexer(decoded, firstNode.value + pair.relativeOffset);
29251
- const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth);
29252
+ const node = parseNodeFromLexer(valLexer, decoded, maxRecursionDepth, repair);
29252
29253
  if (node) {
29253
29254
  result.set(pair.objectNumber, node);
29254
29255
  }
@@ -29431,7 +29432,7 @@ function parseCosDocument(bytes, options = {}) {
29431
29432
  if (!unpacked) {
29432
29433
  const stmObj = objects.get(entry.objectStreamNumber)?.value;
29433
29434
  if (stmObj?.kind === "stream") {
29434
- unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth);
29435
+ unpacked = unpackObjectStream(stmObj, maxDecompressedBytes, maxRecursionDepth, recovery === "repair");
29435
29436
  objStmCache.set(entry.objectStreamNumber, unpacked);
29436
29437
  }
29437
29438
  }
@@ -30939,7 +30940,11 @@ function resolvePageFonts(doc, resourcesDict) {
30939
30940
  let cmap;
30940
30941
  const toUniNode = doc.resolve(dictGet(fObj, "ToUnicode"));
30941
30942
  if (toUniNode?.kind === "stream") {
30942
- cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
30943
+ try {
30944
+ cmap = parseToUnicodeCMap(doc.decodeStream(toUniNode));
30945
+ } catch (error) {
30946
+ if (error instanceof PdfError && error.code === "E_LIMIT") throw error;
30947
+ }
30943
30948
  }
30944
30949
  const encNode = doc.resolve(dictGet(fObj, "Encoding"));
30945
30950
  if (encNode?.kind === "dict") {
@@ -32063,8 +32068,12 @@ function evaluateContentStreamToDisplayList(params) {
32063
32068
  const images = [];
32064
32069
  const operations = [];
32065
32070
  const emit = (operation) => {
32066
- const clipPaths = curState().clipPaths;
32067
- if (clipPaths) operation = { ...operation, value: { ...operation.value, clipPaths } };
32071
+ const { clipPaths, clipImages } = curState();
32072
+ if (clipPaths || clipImages) operation = { ...operation, value: {
32073
+ ...operation.value,
32074
+ ...clipPaths ? { clipPaths } : {},
32075
+ ...clipImages ? { clipImages } : {}
32076
+ } };
32068
32077
  operations.push(operation);
32069
32078
  switch (operation.kind) {
32070
32079
  case "path":
@@ -32328,6 +32337,18 @@ function evaluateContentStreamToDisplayList(params) {
32328
32337
  let hasTextClip = false;
32329
32338
  let activeTm = [1, 0, 0, 1, 0, 0];
32330
32339
  let activeTlm = [1, 0, 0, 1, 0, 0];
32340
+ const paintImage = (image, patternMask, resources, activeFonts, depth) => {
32341
+ if (!patternMask) {
32342
+ emit({ kind: "image", value: image });
32343
+ return;
32344
+ }
32345
+ const st = curState();
32346
+ stateStack.push({ ...st, clipImages: [...st.clipImages ?? [], image] });
32347
+ walkNodes([{ kind: "path-op", paint: "f", segments: [
32348
+ { kind: "rect", x: 0, y: 0, width: 1, height: 1 }
32349
+ ] }], void 0, void 0, resources, activeFonts, depth);
32350
+ stateStack.pop();
32351
+ };
32331
32352
  const walkNodes = (nodes, mcid, actualText, activeResources = params.resourcesDict, activeFonts = fonts, depth = 0) => {
32332
32353
  for (const node of nodes) {
32333
32354
  switch (node.kind) {
@@ -32511,7 +32532,8 @@ function evaluateContentStreamToDisplayList(params) {
32511
32532
  st.fillAlpha,
32512
32533
  "PatternShading_" + st.fillPatternName,
32513
32534
  patClip,
32514
- shading?.kind === "stream" ? shading : void 0
32535
+ shading?.kind === "stream" ? shading : void 0,
32536
+ st.blendMode
32515
32537
  );
32516
32538
  if (shImg) {
32517
32539
  emit({ kind: "image", value: shImg });
@@ -32620,18 +32642,20 @@ function evaluateContentStreamToDisplayList(params) {
32620
32642
  const subNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "Subtype"));
32621
32643
  const sub = subNode?.kind === "name" ? subNode.decoded : "";
32622
32644
  if (sub === "Image") {
32645
+ const maskNode = params.cosDoc.resolve(dictGet(xobjNode.dict, "ImageMask"));
32646
+ const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
32623
32647
  const decoded = decodeXObjectImageToRgba(
32624
32648
  params.cosDoc,
32625
32649
  xobjNode,
32626
32650
  activeResources,
32627
- {
32651
+ patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
32628
32652
  r: st.fillColor.r,
32629
32653
  g: st.fillColor.g,
32630
32654
  b: st.fillColor.b,
32631
32655
  alpha: st.fillAlpha
32632
32656
  }
32633
32657
  );
32634
- emit({ kind: "image", value: {
32658
+ paintImage({
32635
32659
  name: node.name,
32636
32660
  matrix: [...st.ctm],
32637
32661
  width: decoded.width,
@@ -32641,7 +32665,7 @@ function evaluateContentStreamToDisplayList(params) {
32641
32665
  decodedRgba: decoded.rgba,
32642
32666
  ...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
32643
32667
  ...st.clipRect ? { clipRect: [...st.clipRect] } : {}
32644
- } });
32668
+ }, patternMask, activeResources, activeFonts, depth);
32645
32669
  } else if (sub === "Form" && depth < 8) {
32646
32670
  const formStreamBytes = params.cosDoc.decodeStream(xobjNode);
32647
32671
  const formNodes = parseContentStream(formStreamBytes);
@@ -32697,19 +32721,22 @@ function evaluateContentStreamToDisplayList(params) {
32697
32721
  }
32698
32722
  case "inline-image": {
32699
32723
  const st = curState();
32724
+ const maskEntry = dictGet(node.dict, "ImageMask") ?? dictGet(node.dict, "IM");
32725
+ const maskNode = params.cosDoc ? params.cosDoc.resolve(maskEntry) : maskEntry;
32726
+ const patternMask = !!st.fillPatternName && maskNode?.kind === "boolean" && maskNode.value;
32700
32727
  const decoded = decodeInlineImageNodeToRgba(
32701
32728
  params.cosDoc,
32702
32729
  node.dict,
32703
32730
  node.data,
32704
32731
  activeResources,
32705
- {
32732
+ patternMask ? { r: 1, g: 1, b: 1, alpha: 1 } : {
32706
32733
  r: st.fillColor.r,
32707
32734
  g: st.fillColor.g,
32708
32735
  b: st.fillColor.b,
32709
32736
  alpha: st.fillAlpha
32710
32737
  }
32711
32738
  );
32712
- emit({ kind: "image", value: {
32739
+ paintImage({
32713
32740
  name: "InlineImage",
32714
32741
  matrix: [...st.ctm],
32715
32742
  width: decoded.width,
@@ -32719,7 +32746,7 @@ function evaluateContentStreamToDisplayList(params) {
32719
32746
  decodedRgba: decoded.rgba,
32720
32747
  ...st.blendMode && st.blendMode !== "Normal" ? { blendMode: st.blendMode } : {},
32721
32748
  ...st.clipRect ? { clipRect: [...st.clipRect] } : {}
32722
- } });
32749
+ }, patternMask, activeResources, activeFonts, depth);
32723
32750
  break;
32724
32751
  }
32725
32752
  case "text-object": {
@@ -34854,6 +34881,7 @@ function renderDisplayListToBitmap(displayList, options = {}) {
34854
34881
  const aaVec = options.antialiasVector !== false;
34855
34882
  const aaTxt = options.antialiasText !== false;
34856
34883
  const clipMasks = /* @__PURE__ */ new Map();
34884
+ const imageClipMasks = /* @__PURE__ */ new Map();
34857
34885
  for (const original of paintOperations(displayList)) {
34858
34886
  if (original.kind === "glyph" && (original.value.renderMode === 3 || !original.value.outline && !original.value.unicode.trim())) continue;
34859
34887
  const operation = original.kind === "glyph" ? { kind: "path", value: glyphPaint(original.value) } : original;
@@ -34868,6 +34896,31 @@ function renderDisplayListToBitmap(displayList, options = {}) {
34868
34896
  }
34869
34897
  clipMasks.set(clips, clipMask);
34870
34898
  }
34899
+ const imageClips = original.value.clipImages;
34900
+ if (imageClips) {
34901
+ let imageMask = imageClipMasks.get(imageClips);
34902
+ if (!imageMask) {
34903
+ imageMask = new Uint8Array(width * height * 4).fill(255);
34904
+ for (const image of imageClips) {
34905
+ const layer = renderDisplayListToBitmap({
34906
+ ...displayList,
34907
+ rotation: 0,
34908
+ paths: [],
34909
+ glyphs: [],
34910
+ images: [image],
34911
+ operations: [{ kind: "image", value: image }]
34912
+ }, { scale, transparent: true }).data;
34913
+ for (let i = 3; i < layer.length; i += 4) imageMask[i] = Math.round(imageMask[i] * layer[i] / 255);
34914
+ }
34915
+ imageClipMasks.set(imageClips, imageMask);
34916
+ }
34917
+ if (clipMask) {
34918
+ clipMask = clipMask.slice();
34919
+ for (let i = 3; i < clipMask.length; i += 4) clipMask[i] = Math.round(clipMask[i] * imageMask[i] / 255);
34920
+ } else {
34921
+ clipMask = imageMask;
34922
+ }
34923
+ }
34871
34924
  if (operation.kind === "path") {
34872
34925
  const path = operation.value;
34873
34926
  if (path.fillColor) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SsconvertError,
3
3
  isUnicodeAlphanumeric
4
- } from "./chunk-F5MORDSU.js";
4
+ } from "./chunk-FDNCPZQS.js";
5
5
  import {
6
6
  init_buffer
7
7
  } from "./chunk-HX3SHTCE.js";
@@ -3,16 +3,16 @@ import {
3
3
  } from "./chunk-IDR3WWKI.js";
4
4
  import {
5
5
  TextConverterUnavailable
6
- } from "./chunk-JRNLDPLI.js";
6
+ } from "./chunk-OZSWW23M.js";
7
7
  import {
8
8
  singleByteTables
9
9
  } from "./chunk-KOM3FNCE.js";
10
10
  import {
11
11
  converterLocale
12
- } from "./chunk-4HQ7WYSI.js";
12
+ } from "./chunk-MED2BOOW.js";
13
13
  import {
14
14
  SsconvertError
15
- } from "./chunk-F5MORDSU.js";
15
+ } from "./chunk-FDNCPZQS.js";
16
16
  import {
17
17
  init_buffer
18
18
  } from "./chunk-HX3SHTCE.js";
@@ -2,7 +2,7 @@ import {
2
2
  cellValueFormat,
3
3
  functionDescriptors,
4
4
  parseNamedExpression
5
- } from "./chunk-4HQ7WYSI.js";
5
+ } from "./chunk-MED2BOOW.js";
6
6
  import {
7
7
  DEFAULT_SHEET_SIZE,
8
8
  MAX_SHEET_SIZE,
@@ -27,7 +27,7 @@ import {
27
27
  statisticsFunctionDescriptors,
28
28
  sylkGrammar,
29
29
  validSheetSize
30
- } from "./chunk-F5MORDSU.js";
30
+ } from "./chunk-FDNCPZQS.js";
31
31
  import {
32
32
  init_buffer
33
33
  } from "./chunk-HX3SHTCE.js";
@@ -225,6 +225,22 @@ function rewriteReferences(document, edit) {
225
225
  const position = { ...target, sheet: document.sheetNames?.[target.sheet] ?? target.sheet };
226
226
  changes.push({ start: node.start, end: node.end, text: label ? serializeLabelReference({ ...node, first, ...last ? { last } : {}, label }, document.grammar, position) : serializeReference(first, last, document.grammar, position) });
227
227
  }
228
+ } else if (node.kind === "name" && node.relocation && edit.translation === "copy") {
229
+ const relocation = { ...node.relocation };
230
+ if (relocation.relative) {
231
+ relocation.row += target.row - document.position.row;
232
+ relocation.column += target.column - document.position.column;
233
+ }
234
+ if (relocation.sheetRelative !== false && target.sheet !== document.position.sheet) {
235
+ const origin = document.sheetOrder?.indexOf(document.position.sheet) ?? -1;
236
+ const destination = document.sheetOrder?.indexOf(target.sheet) ?? -1;
237
+ if (origin < 0 || destination < 0) throw new SsconvertError("invalid-request", "Cross-sheet formula copy requires workbook tab order");
238
+ relocation.sheet += destination - origin;
239
+ }
240
+ if (![relocation.row, relocation.column, relocation.sheet].every(Number.isSafeInteger))
241
+ throw new SsconvertError("invalid-request", "Invalid live name displacement");
242
+ const text = serializeExpression({ ...document, root: { ...node, relocation } }, document.grammar, false).slice(document.grammar.prefixes[0]?.length ?? 0);
243
+ changes.push({ start: node.start, end: node.end, text });
228
244
  } else if (node.kind === "name" && (node.workbook === void 0 || node.workbook === "") && node.sheet && renamedSheet(node.sheet) !== void 0) {
229
245
  const text = quoteFormulaString(renamedSheet(node.sheet), "'", document.grammar) + document.grammar.sheetSeparator + node.name;
230
246
  changes.push({ start: node.start, end: node.end, text: document.grammar.bracketReferences ? "[" + text + "]" : text });
@@ -2381,7 +2397,7 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
2381
2397
  if (node.kind === "name") {
2382
2398
  const name = named(node, position);
2383
2399
  if (!name || names.has(name)) return [];
2384
- return staticRanges(parseNamedExpression(name, book, parse2, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names, name]), depth + 1);
2400
+ return staticRanges(parseNamedExpression(name, book, parse2, tick, maximumDepth, node.relocation), position, /* @__PURE__ */ new Set([...names, name]), depth + 1);
2385
2401
  }
2386
2402
  if (node.kind === "call" && (node.name === "IF" || node.name === "CHOOSE")) {
2387
2403
  const ranges2 = [];
@@ -2473,7 +2489,7 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
2473
2489
  if (node.kind === "name" && (node.workbook === void 0 || node.workbook === "")) {
2474
2490
  const name = named(node, position2);
2475
2491
  if (name && !names2.has(name)) {
2476
- pending.push({ node: parseNamedExpression(name, book, parse2, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names2, name]), depth: depth + 1 });
2492
+ pending.push({ node: parseNamedExpression(name, book, parse2, tick, maximumDepth, node.relocation), position: position2, names: /* @__PURE__ */ new Set([...names2, name]), depth: depth + 1 });
2477
2493
  }
2478
2494
  }
2479
2495
  const children = node.kind === "unary" || node.kind === "parentheses" ? [node.child] : node.kind === "binary" ? [node.left, node.right] : node.kind === "call" ? node.args : node.kind === "array" ? node.rows.flat() : [];
@@ -22506,7 +22522,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
22506
22522
  const matches = (entry2) => entry2.name === node.name;
22507
22523
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
22508
22524
  if (!name || names.has(name)) return error("#REF!");
22509
- return indirectRange(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names, name]), depth2 + 1);
22525
+ return indirectRange(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity, node.relocation), position, /* @__PURE__ */ new Set([...names, name]), depth2 + 1);
22510
22526
  }
22511
22527
  function scalar(value, position) {
22512
22528
  const label = scalarLabels.get(value);
@@ -22580,7 +22596,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
22580
22596
  const matches = (entry2) => entry2.name === node.name;
22581
22597
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
22582
22598
  if (!name || names.has(name)) return error("#NAME?");
22583
- return evaluate(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names, name]), wantReference);
22599
+ return evaluate(parseNamedExpression(name, book, parse2, tick, context.limits.formulaDependencyDepth ?? Infinity, node.relocation), position, array, /* @__PURE__ */ new Set([...names, name]), wantReference);
22584
22600
  }
22585
22601
  if (node.kind === "unary") {
22586
22602
  const apply = (value) => {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PdfDocument,
3
3
  renderPdfPageToPng
4
- } from "./chunk-H2FQA4OU.js";
4
+ } from "./chunk-TCAGGM44.js";
5
5
  import {
6
6
  init_buffer
7
7
  } from "./chunk-HX3SHTCE.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  encodeText,
3
3
  nativeTextCharsets
4
- } from "./chunk-UGX6MXDD.js";
4
+ } from "./chunk-UIIT4ULR.js";
5
5
  import {
6
6
  encodingName
7
7
  } from "./chunk-IDR3WWKI.js";
@@ -9,17 +9,17 @@ import {
9
9
  exportRangeForSheet,
10
10
  inferText,
11
11
  parseFormula
12
- } from "./chunk-6AIOGLZO.js";
12
+ } from "./chunk-CE6Z2ULX.js";
13
13
  import {
14
14
  CodecWriteFailure,
15
15
  TextConverterUnavailable
16
- } from "./chunk-JRNLDPLI.js";
16
+ } from "./chunk-OZSWW23M.js";
17
17
  import {
18
18
  renderCellText
19
- } from "./chunk-S4J6MSLY.js";
19
+ } from "./chunk-444OTXM7.js";
20
20
  import {
21
21
  exportOptionPairs
22
- } from "./chunk-REYTQLLB.js";
22
+ } from "./chunk-TT2DMDBY.js";
23
23
  import {
24
24
  singleByteTables
25
25
  } from "./chunk-KOM3FNCE.js";
@@ -27,17 +27,17 @@ import {
27
27
  formattingLocale,
28
28
  readByteTextCharacter,
29
29
  recalculateWorkbook
30
- } from "./chunk-A6NFLWZI.js";
30
+ } from "./chunk-WKPOGTZY.js";
31
31
  import {
32
32
  exportLocale
33
- } from "./chunk-4HQ7WYSI.js";
33
+ } from "./chunk-MED2BOOW.js";
34
34
  import {
35
35
  DEFAULT_SHEET_SIZE,
36
36
  MAX_SHEET_SIZE,
37
37
  SsconvertError,
38
38
  decodeByteString,
39
39
  foldSheetName
40
- } from "./chunk-F5MORDSU.js";
40
+ } from "./chunk-FDNCPZQS.js";
41
41
  import {
42
42
  init_buffer
43
43
  } from "./chunk-HX3SHTCE.js";
@@ -1,6 +1,13 @@
1
1
  import {
2
2
  configuredTable
3
- } from "./chunk-TOTZFBDT.js";
3
+ } from "./chunk-TKACIO4X.js";
4
+ import {
5
+ cell,
6
+ decode,
7
+ fields,
8
+ validateScalar,
9
+ whitespace
10
+ } from "./chunk-FXNKUBHR.js";
4
11
  import {
5
12
  ColumnInputs,
6
13
  diagnostics
@@ -11,13 +18,6 @@ import {
11
18
  settings,
12
19
  usage
13
20
  } from "./chunk-6WTZPHDU.js";
14
- import {
15
- cell,
16
- decode,
17
- fields,
18
- validateScalar,
19
- whitespace
20
- } from "./chunk-FXNKUBHR.js";
21
21
  import {
22
22
  init_buffer
23
23
  } from "./chunk-HX3SHTCE.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  renderCellText
3
- } from "./chunk-S4J6MSLY.js";
3
+ } from "./chunk-444OTXM7.js";
4
4
  import {
5
5
  exportOptionPairs
6
- } from "./chunk-REYTQLLB.js";
6
+ } from "./chunk-TT2DMDBY.js";
7
7
  import {
8
8
  readGnumericRichText,
9
9
  writeGnumericRichText
10
- } from "./chunk-CT3FB722.js";
10
+ } from "./chunk-J7UMKBRK.js";
11
11
  import {
12
12
  richTextSegments
13
- } from "./chunk-WOPU2VWF.js";
13
+ } from "./chunk-RID3B5RE.js";
14
14
  import {
15
15
  createOdfXml,
16
16
  dateSerial,
@@ -27,10 +27,10 @@ import {
27
27
  translateOdfHyperlink,
28
28
  upgradeOdfAnnotation,
29
29
  visitFormula
30
- } from "./chunk-A6NFLWZI.js";
30
+ } from "./chunk-WKPOGTZY.js";
31
31
  import {
32
32
  converterLocale
33
- } from "./chunk-4HQ7WYSI.js";
33
+ } from "./chunk-MED2BOOW.js";
34
34
  import {
35
35
  DEFAULT_SHEET_SIZE,
36
36
  MAX_SHEET_SIZE,
@@ -46,7 +46,7 @@ import {
46
46
  quoteNativeSheet,
47
47
  quotedLabelText,
48
48
  serializeExpression
49
- } from "./chunk-F5MORDSU.js";
49
+ } from "./chunk-FDNCPZQS.js";
50
50
  import {
51
51
  createZipCodec
52
52
  } from "./chunk-MKQVQMXO.js";
@@ -1,7 +1,7 @@
1
1
  import type { CommandDefinition, VirtualShellPlugin } from "../../contracts/index.js";
2
2
  import { type PandocCommandsOptions } from "../../../safe-bash-command-pandoc/index.js";
3
3
  export * from "../../../safe-bash-command-pandoc/index.js";
4
- export declare function createPandocCommand(options?: PandocCommandsOptions): CommandDefinition;
4
+ export declare function createPandocCommand(options?: PandocCommandsOptions, hasCommand?: (name: string) => boolean): CommandDefinition;
5
5
  export declare function createPandocCommands(options?: PandocCommandsOptions): readonly CommandDefinition[];
6
6
  export declare function pandocCommands(options?: PandocCommandsOptions): VirtualShellPlugin;
7
7
  export declare function evalSyncPandoc(inBytes: Uint8Array | undefined, opArgs: readonly string[], readFileSync?: (filePath: string) => Uint8Array | undefined, writeFileSync?: (filePath: string, bytes: Uint8Array) => boolean): string | undefined;
@@ -1,8 +1,8 @@
1
1
  import { builtInDirectContextExecutors, syncCommandEvaluators } from "../internal.js";
2
2
  import { createPandocCommand as createRawPandocCommand, createPandocCommands as createRawPandocCommands, inspectFormats, parseConversionArgs, convertSync, } from "../../../safe-bash-command-pandoc/index.js";
3
3
  export * from "../../../safe-bash-command-pandoc/index.js";
4
- export function createPandocCommand(options = {}) {
5
- const def = createRawPandocCommand(options);
4
+ export function createPandocCommand(options = {}, hasCommand) {
5
+ const def = createRawPandocCommand(options, hasCommand);
6
6
  if (options.limits === undefined && options.filters === undefined && options.jsonFilterCommand === undefined && options.citeproc === undefined) {
7
7
  builtInDirectContextExecutors.add(def.execute);
8
8
  }
@@ -17,10 +17,12 @@ export function createPandocCommands(options = {}) {
17
17
  return defs;
18
18
  }
19
19
  export function pandocCommands(options = {}) {
20
- const command = createPandocCommand(options);
20
+ let hasCommand;
21
+ const command = createPandocCommand(options, name => hasCommand?.(name) ?? false);
21
22
  return {
22
23
  name: "pandoc",
23
24
  setup(host) {
25
+ hasCommand = name => host.commands.has(name);
24
26
  host.commands.register(command, { replace: options.replace ?? false });
25
27
  },
26
28
  };
@@ -16,7 +16,7 @@ import {
16
16
  pythonCommands,
17
17
  pythonDocumentPackages,
18
18
  pythonHostFailureCode
19
- } from "../../chunks/chunk-LESPJ3OG.js";
19
+ } from "../../chunks/chunk-WNWIBBJZ.js";
20
20
  import {
21
21
  PythonFailure,
22
22
  inspectPythonCapabilities
@@ -112,6 +112,12 @@ export function createPythonCommands(options) {
112
112
  fragment = undefined;
113
113
  if (packages)
114
114
  environment.finish(packages);
115
+ // Operation failures remain reportable after all work drains. Only an
116
+ // unconfirmed interpreter termination must keep its capacity occupied.
117
+ if (results[1]?.status === 'fulfilled' && admitted) {
118
+ activeWorkers--;
119
+ admitted = false;
120
+ }
115
121
  for (const result of results)
116
122
  if (result.status === 'rejected')
117
123
  throw result.reason;