@poe-platform/safe-bash 0.1.756 → 0.1.757

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 (113) hide show
  1. package/dist/image-ast/index.browser.js +4 -4
  2. package/dist/image-ast/index.js +4 -4
  3. package/dist/safe-bash/chunks/{chunk-LESPJ3OG.js → chunk-WNWIBBJZ.js} +15 -2
  4. package/dist/safe-bash/command-chunks/{chunk-S4J6MSLY.js → chunk-444OTXM7.js} +3 -3
  5. package/dist/safe-bash/command-chunks/{chunk-6AIOGLZO.js → chunk-CE6Z2ULX.js} +2 -2
  6. package/dist/safe-bash/command-chunks/{chunk-5VSGEE6J.js → chunk-F4IQCXZG.js} +5 -5
  7. package/dist/safe-bash/command-chunks/{chunk-F5MORDSU.js → chunk-FDNCPZQS.js} +32 -1
  8. package/dist/safe-bash/command-chunks/{chunk-SG3ZDZCX.js → chunk-FLMLM7Y4.js} +2 -2
  9. package/dist/safe-bash/command-chunks/{chunk-CT3FB722.js → chunk-J7UMKBRK.js} +1 -1
  10. package/dist/safe-bash/command-chunks/{chunk-QQOAK7JQ.js → chunk-KKJCKPTA.js} +1 -1
  11. package/dist/safe-bash/command-chunks/{chunk-7KS6PX4U.js → chunk-KSIGF4AG.js} +3 -3
  12. package/dist/safe-bash/command-chunks/{chunk-4HQ7WYSI.js → chunk-MED2BOOW.js} +30 -5
  13. package/dist/safe-bash/command-chunks/{chunk-JRNLDPLI.js → chunk-OZSWW23M.js} +1 -1
  14. package/dist/safe-bash/command-chunks/{chunk-DKQ5REXF.js → chunk-QDPRSPHQ.js} +1 -1
  15. package/dist/safe-bash/command-chunks/{chunk-WOPU2VWF.js → chunk-RID3B5RE.js} +1 -1
  16. package/dist/safe-bash/command-chunks/{chunk-DVZCHNB5.js → chunk-S4MLIYSN.js} +7 -7
  17. package/dist/safe-bash/command-chunks/{chunk-REYTQLLB.js → chunk-TT2DMDBY.js} +1 -1
  18. package/dist/safe-bash/command-chunks/{chunk-UGX6MXDD.js → chunk-UIIT4ULR.js} +3 -3
  19. package/dist/safe-bash/command-chunks/{chunk-A6NFLWZI.js → chunk-WKPOGTZY.js} +22 -6
  20. package/dist/safe-bash/command-chunks/{chunk-3DOHQQJR.js → chunk-Y64PA6IA.js} +8 -8
  21. package/dist/safe-bash/command-chunks/{chunk-6Z7OS3TZ.js → chunk-ZP5KDHB4.js} +7 -7
  22. package/dist/safe-bash/commands/pandoc/index.d.ts +1 -1
  23. package/dist/safe-bash/commands/pandoc/index.js +5 -3
  24. package/dist/safe-bash/commands/python/index.browser.js +1 -1
  25. package/dist/safe-bash/commands/python/index.js +6 -0
  26. package/dist/safe-bash/commands/python/jspi.js +11 -2
  27. package/dist/safe-bash/core.browser.js +6 -4
  28. package/dist/safe-bash-command-csvkit/index.js +8 -8
  29. package/dist/safe-bash-command-soffice/index.js +16 -16
  30. package/dist/safe-bash-command-ssconvert/core.js +8 -8
  31. package/dist/safe-bash-command-ssconvert/formats/csv.js +9 -9
  32. package/dist/safe-bash-command-ssconvert/formats/ods.js +8 -8
  33. package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +1 -1
  34. package/dist/safe-bash-command-ssconvert/formats/xls.js +9 -8
  35. package/dist/safe-bash-command-ssconvert/formats/xlsx.js +8 -8
  36. package/dist/safe-bash-command-ssconvert/index.js +107 -27
  37. package/dist/safe-bash-contracts/filesystem-descriptor.js +1 -1
  38. package/dist/safe-bash-contracts/filesystem-output.js +1 -1
  39. package/dist/safe-bash-mcp/index.js +4 -4
  40. package/dist/spreadsheet-engine/formulas/ast.d.ts +13 -0
  41. package/dist/spreadsheet-engine/formulas/conventions.js +1 -1
  42. package/dist/spreadsheet-engine/formulas/dependencies.js +2 -2
  43. package/dist/spreadsheet-engine/formulas/evaluator.js +2 -2
  44. package/dist/spreadsheet-engine/formulas/named-expressions.d.ts +2 -2
  45. package/dist/spreadsheet-engine/formulas/named-expressions.js +31 -5
  46. package/dist/spreadsheet-engine/formulas/parser.js +34 -0
  47. package/dist/spreadsheet-engine/formulas/rewriting.js +19 -1
  48. package/dist/spreadsheet-engine/formulas/serialization.js +6 -0
  49. package/dist/spreadsheet-format-xls/biff-write-formulas.js +2 -0
  50. package/dist/xlsx-ast/formula-semantics.js +2 -0
  51. package/package.json +2 -2
  52. package/dist/safe-bash/chunks/browser-ECQX6GMK.js +0 -6766
  53. package/dist/safe-bash/chunks/bz2-4OP3OWW3.js +0 -8
  54. package/dist/safe-bash/chunks/chunk-22XPAAOI.js +0 -173
  55. package/dist/safe-bash/chunks/chunk-44WUNUPV.js +0 -649
  56. package/dist/safe-bash/chunks/chunk-4E3SGG37.js +0 -876
  57. package/dist/safe-bash/chunks/chunk-4QTSSQKP.js +0 -898
  58. package/dist/safe-bash/chunks/chunk-5UVGPVXP.js +0 -410
  59. package/dist/safe-bash/chunks/chunk-64OE6Q6X.js +0 -3487
  60. package/dist/safe-bash/chunks/chunk-6IIFUPN2.js +0 -1526
  61. package/dist/safe-bash/chunks/chunk-BENDLTQD.js +0 -7065
  62. package/dist/safe-bash/chunks/chunk-BMO5LWEX.js +0 -534
  63. package/dist/safe-bash/chunks/chunk-BPMCPTNP.js +0 -1920
  64. package/dist/safe-bash/chunks/chunk-BRJTAWP5.js +0 -2955
  65. package/dist/safe-bash/chunks/chunk-C3GEIN7Q.js +0 -20054
  66. package/dist/safe-bash/chunks/chunk-CBVANNKK.js +0 -174814
  67. package/dist/safe-bash/chunks/chunk-CEWCRI6H.js +0 -2813
  68. package/dist/safe-bash/chunks/chunk-CGL53DQQ.js +0 -37
  69. package/dist/safe-bash/chunks/chunk-CTYJJD4O.js +0 -869
  70. package/dist/safe-bash/chunks/chunk-CWSS4MQA.js +0 -7
  71. package/dist/safe-bash/chunks/chunk-DLIGMTCP.js +0 -3266
  72. package/dist/safe-bash/chunks/chunk-EMAJ7WUW.js +0 -1031
  73. package/dist/safe-bash/chunks/chunk-FDKIZ2IJ.js +0 -1950
  74. package/dist/safe-bash/chunks/chunk-FZWJ2A7V.js +0 -3093
  75. package/dist/safe-bash/chunks/chunk-G2VCIF2J.js +0 -22
  76. package/dist/safe-bash/chunks/chunk-GVKBUQDX.js +0 -2649
  77. package/dist/safe-bash/chunks/chunk-IO2OGW3E.js +0 -28051
  78. package/dist/safe-bash/chunks/chunk-ISCZG7WA.js +0 -2648
  79. package/dist/safe-bash/chunks/chunk-JCN3FXLP.js +0 -38983
  80. package/dist/safe-bash/chunks/chunk-KJHDD4A2.js +0 -759
  81. package/dist/safe-bash/chunks/chunk-LB6HVRXS.js +0 -857
  82. package/dist/safe-bash/chunks/chunk-LLWAJOZH.js +0 -15
  83. package/dist/safe-bash/chunks/chunk-LMUKYZIJ.js +0 -708
  84. package/dist/safe-bash/chunks/chunk-M5SCNKIK.js +0 -2012
  85. package/dist/safe-bash/chunks/chunk-MJPFHANT.js +0 -3350
  86. package/dist/safe-bash/chunks/chunk-MZQW2DOL.js +0 -82
  87. package/dist/safe-bash/chunks/chunk-NB2V7EOY.js +0 -1348
  88. package/dist/safe-bash/chunks/chunk-NJVGOIYN.js +0 -17
  89. package/dist/safe-bash/chunks/chunk-OLNZHDIQ.js +0 -5141
  90. package/dist/safe-bash/chunks/chunk-OSUXMC43.js +0 -2317
  91. package/dist/safe-bash/chunks/chunk-OUUVROTM.js +0 -38
  92. package/dist/safe-bash/chunks/chunk-PA6GYKBQ.js +0 -151
  93. package/dist/safe-bash/chunks/chunk-PEFHZ226.js +0 -6957
  94. package/dist/safe-bash/chunks/chunk-QBB5P5KW.js +0 -4839
  95. package/dist/safe-bash/chunks/chunk-RSAWYAEH.js +0 -973
  96. package/dist/safe-bash/chunks/chunk-UWLYRWT4.js +0 -739
  97. package/dist/safe-bash/chunks/chunk-V463NBQH.js +0 -13
  98. package/dist/safe-bash/chunks/chunk-WPUALYUS.js +0 -843
  99. package/dist/safe-bash/chunks/chunk-XHKFSRGU.js +0 -5747
  100. package/dist/safe-bash/chunks/chunk-XHRCLZ3N.js +0 -13391
  101. package/dist/safe-bash/chunks/chunk-XPF5XHLY.js +0 -15
  102. package/dist/safe-bash/chunks/chunk-ZBFOWARG.js +0 -305
  103. package/dist/safe-bash/chunks/chunk-ZG7GWQ5P.js +0 -1859
  104. package/dist/safe-bash/chunks/model-store-EIY3ZQLZ.js +0 -10
  105. package/dist/safe-bash/chunks/pdf-renderer-CMF3CSVU.js +0 -22
  106. package/dist/safe-bash/chunks/pptx-ZL6L7KP2-O425BFIU.js +0 -30658
  107. package/dist/safe-bash/chunks/src-HHEPGR7U.js +0 -18969
  108. package/dist/safe-bash/chunks/src-MXIKQCIC.js +0 -187
  109. package/dist/safe-bash/chunks/usage-6TGVA2OM.js +0 -35
  110. package/dist/safe-bash/chunks/xz-EGQGQUEI.js +0 -8
  111. package/dist/safe-bash/chunks/xz-K2E2WLM6.js +0 -9
  112. package/dist/safe-bash/chunks/zstd-6JBLP5EF.js +0 -8
  113. package/dist/safe-bash/git_rust-C3QYOAZL.wasm +0 -0
@@ -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;
@@ -21,6 +21,8 @@ export function createPythonJspiExecutor(options) {
21
21
  let running;
22
22
  let retirement;
23
23
  let schedulerCleanup;
24
+ let interpreterFinalized = false;
25
+ let finalizationFailure;
24
26
  let cleanup;
25
27
  let runtime;
26
28
  let native;
@@ -284,7 +286,9 @@ await _safe_quiesce_tasks()
284
286
  }
285
287
  finally {
286
288
  active.value = native ? 2 : 0;
287
- finalized = Number(await engine.promising(runtime._module._Py_FinalizeEx)());
289
+ finalized = Number(await Promise.resolve().then(() => engine.promising(runtime._module._Py_FinalizeEx)())
290
+ .catch(reason => { finalizationFailure = { reason }; throw reason; }));
291
+ interpreterFinalized = true;
288
292
  }
289
293
  }
290
294
  }
@@ -330,7 +334,12 @@ await _safe_quiesce_tasks()
330
334
  controller.abort();
331
335
  await running?.catch(() => { });
332
336
  await cleanup?.catch(() => { });
333
- await schedulerCleanup;
337
+ // Callback failures remain visible on run. Once callbacks have drained and
338
+ // CPython finalized, they cannot leave an interpreter occupying capacity.
339
+ await schedulerCleanup?.catch(error => { if (!interpreterFinalized)
340
+ throw error; });
341
+ if (finalizationFailure)
342
+ throw finalizationFailure.reason;
334
343
  })();
335
344
  return retirement;
336
345
  },
@@ -158,7 +158,7 @@ import {
158
158
  sha256,
159
159
  sha384,
160
160
  sha512
161
- } from "./chunks/chunk-LESPJ3OG.js";
161
+ } from "./chunks/chunk-WNWIBBJZ.js";
162
162
  import {
163
163
  PythonFailure,
164
164
  inspectPythonCapabilities
@@ -95420,8 +95420,8 @@ import {
95420
95420
  convertSync
95421
95421
  } from "../safe-bash-command-pandoc/index.js";
95422
95422
  import * as safe_bash_command_pandoc_star from "../safe-bash-command-pandoc/index.js";
95423
- function createPandocCommand(options8 = {}) {
95424
- const def = createRawPandocCommand(options8);
95423
+ function createPandocCommand(options8 = {}, hasCommand) {
95424
+ const def = createRawPandocCommand(options8, hasCommand);
95425
95425
  if (options8.limits === void 0 && options8.filters === void 0 && options8.jsonFilterCommand === void 0 && options8.citeproc === void 0) {
95426
95426
  internal_exports.builtInDirectContextExecutors.add(def.execute);
95427
95427
  }
@@ -95435,10 +95435,12 @@ function createPandocCommands(options8 = {}) {
95435
95435
  return defs;
95436
95436
  }
95437
95437
  function pandocCommands(options8 = {}) {
95438
- const command4 = createPandocCommand(options8);
95438
+ let hasCommand;
95439
+ const command4 = createPandocCommand(options8, (name2) => hasCommand?.(name2) ?? false);
95439
95440
  return {
95440
95441
  name: "pandoc",
95441
95442
  setup(host2) {
95443
+ hasCommand = (name2) => host2.commands.has(name2);
95442
95444
  host2.commands.register(command4, { replace: options8.replace ?? false });
95443
95445
  }
95444
95446
  };
@@ -5,20 +5,20 @@ import {
5
5
  isCfb,
6
6
  readBiffRecords,
7
7
  readCfb
8
- } from "../safe-bash/command-chunks/chunk-QQOAK7JQ.js";
9
- import "../safe-bash/command-chunks/chunk-5VSGEE6J.js";
10
- import "../safe-bash/command-chunks/chunk-SG3ZDZCX.js";
8
+ } from "../safe-bash/command-chunks/chunk-KKJCKPTA.js";
9
+ import "../safe-bash/command-chunks/chunk-F4IQCXZG.js";
10
+ import "../safe-bash/command-chunks/chunk-FLMLM7Y4.js";
11
11
  import "../safe-bash/command-chunks/chunk-KOM3FNCE.js";
12
- import "../safe-bash/command-chunks/chunk-CT3FB722.js";
12
+ import "../safe-bash/command-chunks/chunk-J7UMKBRK.js";
13
13
  import "../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
14
- import "../safe-bash/command-chunks/chunk-WOPU2VWF.js";
15
- import "../safe-bash/command-chunks/chunk-A6NFLWZI.js";
16
- import "../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
14
+ import "../safe-bash/command-chunks/chunk-RID3B5RE.js";
15
+ import "../safe-bash/command-chunks/chunk-WKPOGTZY.js";
16
+ import "../safe-bash/command-chunks/chunk-MED2BOOW.js";
17
17
  import {
18
18
  SsconvertError,
19
19
  formatA1,
20
20
  parseA1
21
- } from "../safe-bash/command-chunks/chunk-F5MORDSU.js";
21
+ } from "../safe-bash/command-chunks/chunk-FDNCPZQS.js";
22
22
  import {
23
23
  normalizeEncoding,
24
24
  pythonCodecAliases,
@@ -1,30 +1,30 @@
1
1
  import {
2
2
  createEngine
3
- } from "../safe-bash/command-chunks/chunk-DVZCHNB5.js";
3
+ } from "../safe-bash/command-chunks/chunk-S4MLIYSN.js";
4
4
  import {
5
5
  xlsxFormat
6
- } from "../safe-bash/command-chunks/chunk-DKQ5REXF.js";
6
+ } from "../safe-bash/command-chunks/chunk-QDPRSPHQ.js";
7
7
  import {
8
8
  csvFormat
9
- } from "../safe-bash/command-chunks/chunk-3DOHQQJR.js";
10
- import "../safe-bash/command-chunks/chunk-UGX6MXDD.js";
9
+ } from "../safe-bash/command-chunks/chunk-Y64PA6IA.js";
10
+ import "../safe-bash/command-chunks/chunk-UIIT4ULR.js";
11
11
  import "../safe-bash/command-chunks/chunk-IDR3WWKI.js";
12
- import "../safe-bash/command-chunks/chunk-6AIOGLZO.js";
13
- import "../safe-bash/command-chunks/chunk-JRNLDPLI.js";
12
+ import "../safe-bash/command-chunks/chunk-CE6Z2ULX.js";
13
+ import "../safe-bash/command-chunks/chunk-OZSWW23M.js";
14
14
  import {
15
15
  odsFormat
16
- } from "../safe-bash/command-chunks/chunk-6Z7OS3TZ.js";
17
- import "../safe-bash/command-chunks/chunk-S4J6MSLY.js";
18
- import "../safe-bash/command-chunks/chunk-REYTQLLB.js";
19
- import "../safe-bash/command-chunks/chunk-5VSGEE6J.js";
20
- import "../safe-bash/command-chunks/chunk-SG3ZDZCX.js";
16
+ } from "../safe-bash/command-chunks/chunk-ZP5KDHB4.js";
17
+ import "../safe-bash/command-chunks/chunk-444OTXM7.js";
18
+ import "../safe-bash/command-chunks/chunk-TT2DMDBY.js";
19
+ import "../safe-bash/command-chunks/chunk-F4IQCXZG.js";
20
+ import "../safe-bash/command-chunks/chunk-FLMLM7Y4.js";
21
21
  import "../safe-bash/command-chunks/chunk-KOM3FNCE.js";
22
- import "../safe-bash/command-chunks/chunk-CT3FB722.js";
22
+ import "../safe-bash/command-chunks/chunk-J7UMKBRK.js";
23
23
  import "../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
24
- import "../safe-bash/command-chunks/chunk-WOPU2VWF.js";
25
- import "../safe-bash/command-chunks/chunk-A6NFLWZI.js";
26
- import "../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
27
- import "../safe-bash/command-chunks/chunk-F5MORDSU.js";
24
+ import "../safe-bash/command-chunks/chunk-RID3B5RE.js";
25
+ import "../safe-bash/command-chunks/chunk-WKPOGTZY.js";
26
+ import "../safe-bash/command-chunks/chunk-MED2BOOW.js";
27
+ import "../safe-bash/command-chunks/chunk-FDNCPZQS.js";
28
28
  import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
29
29
  import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
30
30
  import {
@@ -3,13 +3,13 @@ import {
3
3
  createRegistry,
4
4
  createResourceIO,
5
5
  defaultSsconvertLimits
6
- } from "../safe-bash/command-chunks/chunk-DVZCHNB5.js";
7
- import "../safe-bash/command-chunks/chunk-6AIOGLZO.js";
8
- import "../safe-bash/command-chunks/chunk-JRNLDPLI.js";
9
- import "../safe-bash/command-chunks/chunk-S4J6MSLY.js";
10
- import "../safe-bash/command-chunks/chunk-REYTQLLB.js";
11
- import "../safe-bash/command-chunks/chunk-A6NFLWZI.js";
12
- import "../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
6
+ } from "../safe-bash/command-chunks/chunk-S4MLIYSN.js";
7
+ import "../safe-bash/command-chunks/chunk-CE6Z2ULX.js";
8
+ import "../safe-bash/command-chunks/chunk-OZSWW23M.js";
9
+ import "../safe-bash/command-chunks/chunk-444OTXM7.js";
10
+ import "../safe-bash/command-chunks/chunk-TT2DMDBY.js";
11
+ import "../safe-bash/command-chunks/chunk-WKPOGTZY.js";
12
+ import "../safe-bash/command-chunks/chunk-MED2BOOW.js";
13
13
  import {
14
14
  DEFAULT_SHEET_SIZE,
15
15
  MAX_SHEET_SIZE,
@@ -23,7 +23,7 @@ import {
23
23
  snapshotWorkbook,
24
24
  updateWorkbook,
25
25
  validSheetSize
26
- } from "../safe-bash/command-chunks/chunk-F5MORDSU.js";
26
+ } from "../safe-bash/command-chunks/chunk-FDNCPZQS.js";
27
27
  import {
28
28
  init_buffer
29
29
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  csvFormat
3
- } from "../../safe-bash/command-chunks/chunk-3DOHQQJR.js";
4
- import "../../safe-bash/command-chunks/chunk-UGX6MXDD.js";
3
+ } from "../../safe-bash/command-chunks/chunk-Y64PA6IA.js";
4
+ import "../../safe-bash/command-chunks/chunk-UIIT4ULR.js";
5
5
  import "../../safe-bash/command-chunks/chunk-IDR3WWKI.js";
6
- import "../../safe-bash/command-chunks/chunk-6AIOGLZO.js";
7
- import "../../safe-bash/command-chunks/chunk-JRNLDPLI.js";
8
- import "../../safe-bash/command-chunks/chunk-S4J6MSLY.js";
9
- import "../../safe-bash/command-chunks/chunk-REYTQLLB.js";
6
+ import "../../safe-bash/command-chunks/chunk-CE6Z2ULX.js";
7
+ import "../../safe-bash/command-chunks/chunk-OZSWW23M.js";
8
+ import "../../safe-bash/command-chunks/chunk-444OTXM7.js";
9
+ import "../../safe-bash/command-chunks/chunk-TT2DMDBY.js";
10
10
  import "../../safe-bash/command-chunks/chunk-KOM3FNCE.js";
11
- import "../../safe-bash/command-chunks/chunk-A6NFLWZI.js";
12
- import "../../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
13
- import "../../safe-bash/command-chunks/chunk-F5MORDSU.js";
11
+ import "../../safe-bash/command-chunks/chunk-WKPOGTZY.js";
12
+ import "../../safe-bash/command-chunks/chunk-MED2BOOW.js";
13
+ import "../../safe-bash/command-chunks/chunk-FDNCPZQS.js";
14
14
  import {
15
15
  init_buffer
16
16
  } from "../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  odsFormat
3
- } from "../../safe-bash/command-chunks/chunk-6Z7OS3TZ.js";
4
- import "../../safe-bash/command-chunks/chunk-S4J6MSLY.js";
5
- import "../../safe-bash/command-chunks/chunk-REYTQLLB.js";
6
- import "../../safe-bash/command-chunks/chunk-CT3FB722.js";
3
+ } from "../../safe-bash/command-chunks/chunk-ZP5KDHB4.js";
4
+ import "../../safe-bash/command-chunks/chunk-444OTXM7.js";
5
+ import "../../safe-bash/command-chunks/chunk-TT2DMDBY.js";
6
+ import "../../safe-bash/command-chunks/chunk-J7UMKBRK.js";
7
7
  import "../../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
8
- import "../../safe-bash/command-chunks/chunk-WOPU2VWF.js";
9
- import "../../safe-bash/command-chunks/chunk-A6NFLWZI.js";
10
- import "../../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
11
- import "../../safe-bash/command-chunks/chunk-F5MORDSU.js";
8
+ import "../../safe-bash/command-chunks/chunk-RID3B5RE.js";
9
+ import "../../safe-bash/command-chunks/chunk-WKPOGTZY.js";
10
+ import "../../safe-bash/command-chunks/chunk-MED2BOOW.js";
11
+ import "../../safe-bash/command-chunks/chunk-FDNCPZQS.js";
12
12
  import "../../safe-bash/command-chunks/chunk-MKQVQMXO.js";
13
13
  import "../../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
14
14
  import {
@@ -12,7 +12,7 @@ import {
12
12
  parseExpression,
13
13
  quoteNativeSheet,
14
14
  serializeExpression
15
- } from "../../safe-bash/command-chunks/chunk-F5MORDSU.js";
15
+ } from "../../safe-bash/command-chunks/chunk-FDNCPZQS.js";
16
16
  import {
17
17
  init_buffer
18
18
  } from "../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  encodeText
3
- } from "../../safe-bash/command-chunks/chunk-UGX6MXDD.js";
3
+ } from "../../safe-bash/command-chunks/chunk-UIIT4ULR.js";
4
4
  import "../../safe-bash/command-chunks/chunk-IDR3WWKI.js";
5
- import "../../safe-bash/command-chunks/chunk-JRNLDPLI.js";
5
+ import "../../safe-bash/command-chunks/chunk-OZSWW23M.js";
6
6
  import {
7
7
  exportOptionPairs
8
- } from "../../safe-bash/command-chunks/chunk-REYTQLLB.js";
8
+ } from "../../safe-bash/command-chunks/chunk-TT2DMDBY.js";
9
9
  import {
10
10
  BiffStrings,
11
11
  Binary,
@@ -16,20 +16,20 @@ import {
16
16
  isCfb,
17
17
  readBiffRecords,
18
18
  readCfb
19
- } from "../../safe-bash/command-chunks/chunk-QQOAK7JQ.js";
19
+ } from "../../safe-bash/command-chunks/chunk-KKJCKPTA.js";
20
20
  import {
21
21
  expandIndexSheetAreas,
22
22
  metadataNode
23
- } from "../../safe-bash/command-chunks/chunk-SG3ZDZCX.js";
23
+ } from "../../safe-bash/command-chunks/chunk-FLMLM7Y4.js";
24
24
  import {
25
25
  singleByteTables
26
26
  } from "../../safe-bash/command-chunks/chunk-KOM3FNCE.js";
27
- import "../../safe-bash/command-chunks/chunk-WOPU2VWF.js";
27
+ import "../../safe-bash/command-chunks/chunk-RID3B5RE.js";
28
28
  import {
29
29
  cellValueFormat,
30
30
  functionDescriptors,
31
31
  parseNamedExpression
32
- } from "../../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
32
+ } from "../../safe-bash/command-chunks/chunk-MED2BOOW.js";
33
33
  import {
34
34
  DEFAULT_SHEET_SIZE,
35
35
  SsconvertError,
@@ -40,7 +40,7 @@ import {
40
40
  parseA1,
41
41
  parseExpression,
42
42
  quoteFormulaString
43
- } from "../../safe-bash/command-chunks/chunk-F5MORDSU.js";
43
+ } from "../../safe-bash/command-chunks/chunk-FDNCPZQS.js";
44
44
  import {
45
45
  init_buffer
46
46
  } from "../../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -5611,6 +5611,7 @@ var BiffFormulaWriter = class {
5611
5611
  push(last.subarray(2));
5612
5612
  } else push(first);
5613
5613
  } else if (node.kind === "name") {
5614
+ if (node.relocation) throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: live name relocation in BIFF output");
5614
5615
  if (node.workbook) {
5615
5616
  const bookIndex = this.externalBook(node.workbook), book = this.externalBooks[bookIndex];
5616
5617
  const scope2 = node.sheet === void 0 ? void 0 : this.externalScope(bookIndex, node.sheet);
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  xlsxFormat
3
- } from "../../safe-bash/command-chunks/chunk-DKQ5REXF.js";
4
- import "../../safe-bash/command-chunks/chunk-5VSGEE6J.js";
5
- import "../../safe-bash/command-chunks/chunk-SG3ZDZCX.js";
6
- import "../../safe-bash/command-chunks/chunk-CT3FB722.js";
3
+ } from "../../safe-bash/command-chunks/chunk-QDPRSPHQ.js";
4
+ import "../../safe-bash/command-chunks/chunk-F4IQCXZG.js";
5
+ import "../../safe-bash/command-chunks/chunk-FLMLM7Y4.js";
6
+ import "../../safe-bash/command-chunks/chunk-J7UMKBRK.js";
7
7
  import "../../safe-bash/command-chunks/chunk-6X2OX6IJ.js";
8
- import "../../safe-bash/command-chunks/chunk-WOPU2VWF.js";
9
- import "../../safe-bash/command-chunks/chunk-A6NFLWZI.js";
10
- import "../../safe-bash/command-chunks/chunk-4HQ7WYSI.js";
11
- import "../../safe-bash/command-chunks/chunk-F5MORDSU.js";
8
+ import "../../safe-bash/command-chunks/chunk-RID3B5RE.js";
9
+ import "../../safe-bash/command-chunks/chunk-WKPOGTZY.js";
10
+ import "../../safe-bash/command-chunks/chunk-MED2BOOW.js";
11
+ import "../../safe-bash/command-chunks/chunk-FDNCPZQS.js";
12
12
  import "../../safe-bash/command-chunks/chunk-MKQVQMXO.js";
13
13
  import "../../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
14
14
  import {
@@ -73156,7 +73156,7 @@ var odfGrammar = Object.freeze({
73156
73156
  prefixes: Object.freeze(["of:=", "oooc:=", "="]),
73157
73157
  functionPrefixes: Object.freeze(["ORG.GNUMERIC.", "COM.MICROSOFT."])
73158
73158
  });
73159
- var internalOdfGrammar = Object.freeze({ ...odfGrammar, internalLabels: true });
73159
+ var internalOdfGrammar = Object.freeze({ ...odfGrammar, internalLabels: true, internalNames: true });
73160
73160
  var sylkGrammar = Object.freeze({ ...gnumericGrammar, id: "sylk", address: "r1c1" });
73161
73161
  var sylkWriterGrammar = Object.freeze({ ...sylkGrammar, id: "sylk-writer", stringEscape: "raw" });
73162
73162
  var legacyOpenOfficeGrammar = Object.freeze({
@@ -74602,6 +74602,40 @@ function parseExpression(source, options) {
74602
74602
  throw new SsconvertError("resource-limit", "ssconvert formula node limit exceeded");
74603
74603
  try {
74604
74604
  const c4 = source[offset];
74605
+ if (source.startsWith("@name.", offset)) {
74606
+ if (grammar3.id !== "gnumeric" && !grammar3.internalNames)
74607
+ fail2("Internal live name in native formula");
74608
+ offset += 6;
74609
+ const relative = source.startsWith("relative", offset);
74610
+ if (!relative && !source.startsWith("absolute", offset))
74611
+ fail2("Invalid live name mode");
74612
+ offset += 8;
74613
+ const fixedSheet = source.startsWith(".fixed-sheet", offset);
74614
+ if (fixedSheet)
74615
+ offset += 12;
74616
+ if (source[offset++] !== "[")
74617
+ fail2("Invalid live name mode");
74618
+ const displacement = (separator2) => {
74619
+ const start2 = offset;
74620
+ if (source[offset] === "-")
74621
+ offset++;
74622
+ const begin = offset;
74623
+ while (digit(source[offset]))
74624
+ offset++;
74625
+ const value3 = Number(source.slice(start2, offset));
74626
+ if (offset === begin || !Number.isSafeInteger(value3) || source[offset++] !== separator2)
74627
+ fail2("Invalid live name displacement");
74628
+ return value3;
74629
+ };
74630
+ const row = displacement(","), column = displacement(","), sheet = displacement("]");
74631
+ if (!relative && (row !== 0 || column !== 0) || source[offset++] !== ":" || source[offset] !== '"')
74632
+ fail2("Invalid live name");
74633
+ const name = quoted('"', grammar3.stringEscape);
74634
+ if (!name)
74635
+ fail2("Empty live name");
74636
+ options.onName?.(name);
74637
+ return node3({ kind: "name", name, workbook: "", relocation: { relative, row, column, sheet, ...fixedSheet ? { sheetRelative: false } : {} }, start, end: offset });
74638
+ }
74605
74639
  if (c4 === "@" && !internalLabels)
74606
74640
  fail2("Internal label reference in native formula");
74607
74641
  if (c4 === "@" && internalLabels) {
@@ -75058,23 +75092,51 @@ function parseExpression(source, options) {
75058
75092
  return { ok: false, source, diagnostic };
75059
75093
  }
75060
75094
  }
75061
- function parseNamedExpression(name, book, parse3, tick, maximumDepth = Infinity) {
75095
+ function parseNamedExpression(name, book, parse3, tick, maximumDepth = Infinity, relocation) {
75062
75096
  if (name.expression === "" || name.expression === "=") {
75063
75097
  tick();
75064
75098
  return { kind: "literal", value: { kind: "blank" }, start: 0, end: 0 };
75065
75099
  }
75066
75100
  const position = name.position ?? { sheet: name.sheet ?? book.sheets[0]?.id ?? "", row: 0, column: 0 };
75101
+ function displace(ref, fallback) {
75102
+ if (!relocation || ref.workbook !== void 0)
75103
+ return ref;
75104
+ const origin = book.sheets.findIndex((sheet) => sheet.id === position.sheet);
75105
+ const index2 = 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;
75106
+ const target = index2 >= 0 ? book.sheets[index2 + relocation.sheet] : void 0;
75107
+ if (!target)
75108
+ return void 0;
75109
+ const axis = (value3, key) => ({ value: value3.value + (value3.relative ? position[key] : 0) + relocation[key], relative: false });
75110
+ return { ...ref, sheet: target.name, sheetRelative: false, ...ref.row ? { row: axis(ref.row, "row") } : {}, ...ref.column ? { column: axis(ref.column, "column") } : {} };
75111
+ }
75067
75112
  function bind(node3, depth = 0) {
75068
75113
  tick();
75069
75114
  if (depth > maximumDepth)
75070
75115
  throw new SsconvertError("resource-limit", "ssconvert formula dependency depth limit exceeded");
75071
- if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "" && node3.sheet !== void 0)) {
75116
+ if (node3.kind === "reference" && relocation) {
75117
+ const first = displace(node3.first), last = node3.last ? displace(node3.last, node3.first.sheet) : void 0;
75118
+ if (!first || node3.last && !last)
75119
+ return { kind: "literal", value: { kind: "error", value: "#REF!" }, start: node3.start, end: node3.end };
75120
+ return { ...node3, first, ...last ? { last } : {} };
75121
+ }
75122
+ if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "")) {
75123
+ const inherited = relocation ? {
75124
+ ...relocation,
75125
+ row: relocation.row + (node3.relocation?.row ?? 0),
75126
+ column: relocation.column + (node3.relocation?.column ?? 0),
75127
+ sheet: relocation.sheet + (node3.relocation?.sheet ?? 0)
75128
+ } : node3.relocation;
75129
+ const bound = inherited ? { ...node3, relocation: inherited } : node3;
75130
+ if (node3.workbook === "" && node3.sheet === void 0)
75131
+ return bound;
75072
75132
  const scope = node3.sheet === void 0 ? name.sheet : book.sheets.find((sheet2) => foldSheetName(sheet2.name) === foldSheetName(node3.sheet))?.id;
75073
75133
  const target = resolveName(book, node3.name, scope);
75074
- if (target?.sheet === void 0)
75075
- return { kind: "name", name: node3.name, workbook: "", start: node3.start, end: node3.end };
75134
+ if (target?.sheet === void 0) {
75135
+ const { sheet: ignoredSheet, ...global2 } = bound;
75136
+ return { ...global2, workbook: "" };
75137
+ }
75076
75138
  const sheet = book.sheets.find((sheet2) => sheet2.id === target.sheet);
75077
- return sheet ? { ...node3, sheet: sheet.name } : node3;
75139
+ return sheet ? { ...bound, sheet: sheet.name } : bound;
75078
75140
  }
75079
75141
  if (node3.kind === "parentheses" || node3.kind === "unary")
75080
75142
  return { ...node3, child: bind(node3.child, depth + 1) };
@@ -75470,7 +75532,7 @@ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maxim
75470
75532
  const name = named(node3, position);
75471
75533
  if (!name || names2.has(name))
75472
75534
  return [];
75473
- return staticRanges(parseNamedExpression(name, book, parse3, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names2, name]), depth + 1);
75535
+ return staticRanges(parseNamedExpression(name, book, parse3, tick, maximumDepth, node3.relocation), position, /* @__PURE__ */ new Set([...names2, name]), depth + 1);
75474
75536
  }
75475
75537
  if (node3.kind === "call" && (node3.name === "IF" || node3.name === "CHOOSE")) {
75476
75538
  const ranges3 = [];
@@ -75579,7 +75641,7 @@ function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maxim
75579
75641
  if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "")) {
75580
75642
  const name = named(node3, position2);
75581
75643
  if (name && !names3.has(name)) {
75582
- pending.push({ node: parseNamedExpression(name, book, parse3, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names3, name]), depth: depth + 1 });
75644
+ pending.push({ node: parseNamedExpression(name, book, parse3, tick, maximumDepth, node3.relocation), position: position2, names: /* @__PURE__ */ new Set([...names3, name]), depth: depth + 1 });
75583
75645
  }
75584
75646
  }
75585
75647
  const children8 = node3.kind === "unary" || node3.kind === "parentheses" ? [node3.child] : node3.kind === "binary" ? [node3.left, node3.right] : node3.kind === "call" ? node3.args : node3.kind === "array" ? node3.rows.flat() : [];
@@ -76018,6 +76080,12 @@ function serializeExpression(document6, grammar3 = document6.grammar, preserveSo
76018
76080
  case "reference":
76019
76081
  return value3.label ? grammar3.quotedLabels === "openformula" && options.quotedLabel ? quoteFormulaString(options.quotedLabel(value3), "'", grammar3) : serializeLabelReference(value3, grammar3, position) : serializeReference(options.relativeSheets === "fixed" ? { ...value3.first, sheetRelative: false } : value3.first, options.relativeSheets === "fixed" && value3.last ? { ...value3.last, sheetRelative: false } : value3.last, grammar3, position);
76020
76082
  case "name": {
76083
+ if (value3.relocation) {
76084
+ if (grammar3.id !== "gnumeric" && !grammar3.internalNames)
76085
+ throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: live name relocation in target grammar");
76086
+ const { relative, row, column, sheet } = value3.relocation;
76087
+ return `@name.${relative ? "relative" : "absolute"}${value3.relocation.sheetRelative === false ? ".fixed-sheet" : ""}[${row},${column},${sheet}]:` + quoteFormulaString(value3.name, '"', grammar3);
76088
+ }
76021
76089
  if (grammar3.qualifiedNames === false && (value3.sheet !== void 0 || value3.workbook !== void 0))
76022
76090
  throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: qualified formula name in target grammar");
76023
76091
  if (value3.workbook === "" && grammar3.bracketReferences && value3.sheet === void 0)
@@ -76192,6 +76260,23 @@ function rewriteReferences(document6, edit) {
76192
76260
  const position = { ...target, sheet: document6.sheetNames?.[target.sheet] ?? target.sheet };
76193
76261
  changes.push({ start: node3.start, end: node3.end, text: label ? serializeLabelReference({ ...node3, first, ...last ? { last } : {}, label }, document6.grammar, position) : serializeReference(first, last, document6.grammar, position) });
76194
76262
  }
76263
+ } else if (node3.kind === "name" && node3.relocation && edit.translation === "copy") {
76264
+ const relocation = { ...node3.relocation };
76265
+ if (relocation.relative) {
76266
+ relocation.row += target.row - document6.position.row;
76267
+ relocation.column += target.column - document6.position.column;
76268
+ }
76269
+ if (relocation.sheetRelative !== false && target.sheet !== document6.position.sheet) {
76270
+ const origin = document6.sheetOrder?.indexOf(document6.position.sheet) ?? -1;
76271
+ const destination = document6.sheetOrder?.indexOf(target.sheet) ?? -1;
76272
+ if (origin < 0 || destination < 0)
76273
+ throw new SsconvertError("invalid-request", "Cross-sheet formula copy requires workbook tab order");
76274
+ relocation.sheet += destination - origin;
76275
+ }
76276
+ if (![relocation.row, relocation.column, relocation.sheet].every(Number.isSafeInteger))
76277
+ throw new SsconvertError("invalid-request", "Invalid live name displacement");
76278
+ const text2 = serializeExpression({ ...document6, root: { ...node3, relocation } }, document6.grammar, false).slice(document6.grammar.prefixes[0]?.length ?? 0);
76279
+ changes.push({ start: node3.start, end: node3.end, text: text2 });
76195
76280
  } else if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "") && node3.sheet && renamedSheet(node3.sheet) !== void 0) {
76196
76281
  const text2 = quoteFormulaString(renamedSheet(node3.sheet), "'", document6.grammar) + document6.grammar.sheetSeparator + node3.name;
76197
76282
  changes.push({ start: node3.start, end: node3.end, text: document6.grammar.bracketReferences ? "[" + text2 + "]" : text2 });
@@ -98933,7 +99018,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
98933
99018
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
98934
99019
  if (!name || names2.has(name))
98935
99020
  return error("#REF!");
98936
- return indirectRange(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names2, name]), depth2 + 1);
99021
+ return indirectRange(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity, node3.relocation), position, /* @__PURE__ */ new Set([...names2, name]), depth2 + 1);
98937
99022
  }
98938
99023
  function scalar2(value3, position) {
98939
99024
  const label = scalarLabels.get(value3);
@@ -99027,7 +99112,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
99027
99112
  const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
99028
99113
  if (!name || names2.has(name))
99029
99114
  return error("#NAME?");
99030
- return evaluate(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names2, name]), wantReference);
99115
+ return evaluate(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity, node3.relocation), position, array, /* @__PURE__ */ new Set([...names2, name]), wantReference);
99031
99116
  }
99032
99117
  if (node3.kind === "unary") {
99033
99118
  const apply = (value3) => {
@@ -126101,6 +126186,8 @@ var BiffFormulaWriter = class {
126101
126186
  } else
126102
126187
  push(first);
126103
126188
  } else if (node3.kind === "name") {
126189
+ if (node3.relocation)
126190
+ throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: live name relocation in BIFF output");
126104
126191
  if (node3.workbook) {
126105
126192
  const bookIndex = this.externalBook(node3.workbook), book = this.externalBooks[bookIndex];
126106
126193
  const scope2 = node3.sheet === void 0 ? void 0 : this.externalScope(bookIndex, node3.sheet);
@@ -136412,6 +136499,8 @@ function nativeOpenFormula(source, position, context, arrayStringLiterals = fals
136412
136499
  throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: automatic label intersection in Gnumeric output");
136413
136500
  if (node3.kind === "reference" && node3.label)
136414
136501
  throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: live label reference in Gnumeric output");
136502
+ if (node3.kind === "name" && node3.relocation)
136503
+ throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: live name relocation in Gnumeric output");
136415
136504
  });
136416
136505
  if (!source.startsWith("of:="))
136417
136506
  return source;
@@ -146798,17 +146887,8 @@ async function lotusFormula(bytes, format2, group, row, column, sheetIndex, shee
146798
146887
  stack.push("#NAME?");
146799
146888
  }
146800
146889
  } else {
146801
- const crossSheet = range3.first.sheet !== range3.last.sheet;
146802
- const endpoint = (point) => (point.sheet === sheetIndex && !crossSheet ? "" : quoteFormulaString(sheetName2(point.sheet), "'", gnumericGrammar) + "!") + ref(point.row, point.column, op === 7, op === 7);
146803
- const single = range3.first.row === range3.last.row && range3.first.column === range3.last.column && range3.first.sheet === range3.last.sheet;
146804
- const source = endpoint(range3.first) + (single ? "" : ":" + endpoint(range3.last));
146805
- stack.push(source);
146806
- if (crossSheet) indexRanges.set(source, {
146807
- firstSheet: range3.first.sheet,
146808
- lastSheet: range3.last.sheet,
146809
- first: ref(range3.first.row, range3.first.column, op === 7, op === 7),
146810
- last: ref(range3.last.row, range3.last.column, op === 7, op === 7)
146811
- });
146890
+ const fixedSheet = range3.first.sheet !== sheetIndex || range3.last.sheet !== sheetIndex;
146891
+ stack.push(`@name.${op === 7 ? "relative" : "absolute"}${fixedSheet ? ".fixed-sheet" : ""}[0,0,0]:` + quoteFormulaString(name, '"', gnumericGrammar));
146812
146892
  }
146813
146893
  } else if (modern && op >= 9 && op <= 11) {
146814
146894
  const length = op === 9 ? 4 : op === 10 ? 5 : 11;
@@ -146957,14 +147037,14 @@ async function lotusFormula(bytes, format2, group, row, column, sheetIndex, shee
146957
147037
  if (!parsed.ok) throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: Lotus relative-sheet formula");
146958
147038
  const substitute = (node3) => {
146959
147039
  context.signal.throwIfAborted();
146960
- if (node3.kind === "name") return relativeReferences.get(node3.name) ?? node3;
147040
+ if (node3.kind === "name") return node3.relocation ? node3 : relativeReferences.get(node3.name) ?? node3;
146961
147041
  if (node3.kind === "unary" || node3.kind === "parentheses") return { ...node3, child: substitute(node3.child) };
146962
147042
  if (node3.kind === "binary") return { ...node3, left: substitute(node3.left), right: substitute(node3.right) };
146963
147043
  if (node3.kind === "call") return { ...node3, args: node3.args.map(substitute) };
146964
147044
  if (node3.kind === "array") return { ...node3, rows: node3.rows.map((row2) => row2.map(substitute)) };
146965
147045
  return node3;
146966
147046
  };
146967
- const expression2 = serializeExpression({ ...parsed.document, root: substitute(parsed.document.root) }, odfGrammar, false, true);
147047
+ const expression2 = serializeExpression({ ...parsed.document, root: substitute(parsed.document.root) }, internalOdfGrammar, false, true);
146968
147048
  if (expression2.length > (context.limits.workbookTextBytes ?? context.limits.inputBytes))
146969
147049
  throw new SsconvertError("resource-limit", "ssconvert Lotus formula length limit exceeded");
146970
147050
  return expression2;
@@ -218619,7 +218699,7 @@ function forwardFileDescriptor(descriptor3, operation, capabilities, snapshot =
218619
218699
  write: (retained2, buffer, position, options) => operation("write", options, () => retained2.write(buffer, position, options)),
218620
218700
  truncate: (retained2, length, options) => operation("ftruncate", options, () => retained2.truncate(length, options)),
218621
218701
  sync: (retained2, dataOnly, options) => operation(dataOnly ? "fdatasync" : "fsync", options, () => retained2.sync(dataOnly, options)),
218622
- close: (retained2) => operation("close", {}, () => retained2.close())
218702
+ close: (retained2, options) => operation("close", {}, () => retained2.close(options))
218623
218703
  };
218624
218704
  }
218625
218705
  function integer6(value3, syscall, path2) {
@@ -218787,10 +218867,10 @@ var ManagedFileDescriptor = class {
218787
218867
  await backend.sync(backend.resource, dataOnly, forwarded);
218788
218868
  });
218789
218869
  }
218790
- close() {
218870
+ close(options = {}) {
218791
218871
  this.#closing ??= this.#pending.then(async () => {
218792
218872
  try {
218793
- await this.#backend.close(this.#backend.resource);
218873
+ await this.#backend.close(this.#backend.resource, options);
218794
218874
  } finally {
218795
218875
  this.#backend = void 0;
218796
218876
  this.#getPosition = void 0;
@@ -218848,7 +218928,7 @@ async function openFileDescriptor(path2, options, capabilities, acquire) {
218848
218928
  signal?.throwIfAborted();
218849
218929
  return descriptor3;
218850
218930
  } catch (error2) {
218851
- await finishCleanup(() => backend.close(backend.resource), true);
218931
+ await finishCleanup(() => backend.close(backend.resource, {}), true);
218852
218932
  signal?.throwIfAborted();
218853
218933
  throw error2;
218854
218934
  }