@poe-platform/safe-bash 0.1.747 → 0.1.749

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/README.md CHANGED
@@ -67,7 +67,8 @@ All private command plugins are available from `@poe-platform/safe-bash/core` in
67
67
  - `if`/`elif`/`else`, `case`, `for name in …`, `while`, `until`, functions,
68
68
  groups `{ …; }`, subshells `( … )` (including adjacent nested subshells),
69
69
  `[[ … ]]` (including file age/identity, special-file, mode and nameref
70
- predicates; literal/glob and ASCII ERE comparisons also accept UTF-8 locales,
70
+ predicates; ordering uses byte comparison in C/POSIX and host Intl collation
71
+ in supported UTF-8 locales. Literal/glob and ASCII ERE comparisons also accept UTF-8 locales,
71
72
  with ranges limited to C/POSIX collation, including C.UTF-8), arithmetic commands `(( … ))`, and indexed arrays with arithmetic
72
73
  and relative negative element indices, including `declare -a`, `local -a`,
73
74
  and `readonly -a` array literals. Arithmetic array operands such as `a[i]`
@@ -48690,7 +48690,8 @@ var lookupSpecialForms = {
48690
48690
  if (!args.length || args.length > 4) return error("#VALUE!");
48691
48691
  let source = args[0];
48692
48692
  while (source.kind === "parentheses") source = source.child;
48693
- let value3 = host.evaluate(source, false);
48693
+ const areaSet = source.kind === "binary" && source.op === "union";
48694
+ let value3 = host.evaluate(source, areaSet);
48694
48695
  if (value3.kind === "error") return value3;
48695
48696
  const offsets = [0, 0, 0];
48696
48697
  for (let index2 = 1; index2 < args.length; index2++) {
@@ -48700,11 +48701,20 @@ var lookupSpecialForms = {
48700
48701
  if (n === void 0) return error("#VALUE!");
48701
48702
  offsets[index2 - 1] = Math.trunc(n) - 1;
48702
48703
  }
48703
- if (source.kind === "binary" && source.op === "union") {
48704
- if (value3.kind === "matrix") {
48705
- if (offsets[2] < 0 || offsets[2] >= value3.rows.length) return error("#REF!");
48706
- value3 = value3.rows[offsets[2]][0];
48707
- } else return error("#REF!");
48704
+ if (areaSet) {
48705
+ const areas = [], pending = [value3];
48706
+ while (pending.length) {
48707
+ host.tick();
48708
+ const area = pending.pop();
48709
+ if (area.kind === "set") for (let index2 = area.values.length - 1; index2 >= 0; index2--) pending.push(area.values[index2]);
48710
+ else areas.push(area);
48711
+ }
48712
+ if (offsets[2] < 0 || offsets[2] >= areas.length) return error("#REF!");
48713
+ value3 = areas[offsets[2]];
48714
+ if (value3.kind === "error") return value3;
48715
+ } else if (value3.kind === "range" && value3.sheets.length > 1) {
48716
+ if (offsets[2] < 0 || offsets[2] >= value3.sheets.length) return error("#REF!");
48717
+ value3 = { ...value3, sheets: [value3.sheets[offsets[2]]] };
48708
48718
  } else if (offsets[2] !== 0) return error("#REF!");
48709
48719
  const row = offsets[0], column = offsets[1], dims = dimensions(value3);
48710
48720
  if (row < 0 || column < 0 || row >= dims.height || column >= dims.width) return error("#REF!");
@@ -52493,6 +52503,73 @@ init_platform();
52493
52503
 
52494
52504
  // packages/safe-bash-command-ssconvert/src/codecs/xlsx.ts
52495
52505
  init_platform();
52506
+
52507
+ // packages/safe-bash-command-ssconvert/src/formulas/index-sheet-areas.ts
52508
+ init_platform();
52509
+ function expandIndexSheetAreas(document6, onWork) {
52510
+ const order = document6.sheetOrder;
52511
+ if (!order) return document6;
52512
+ let ids, names2;
52513
+ const sheetIndex = (endpoint) => {
52514
+ if (!ids || !names2) {
52515
+ ids = /* @__PURE__ */ new Map();
52516
+ names2 = /* @__PURE__ */ new Map();
52517
+ for (let index2 = 0; index2 < order.length; index2++) {
52518
+ onWork();
52519
+ const id = order[index2];
52520
+ ids.set(id, index2);
52521
+ names2.set(foldSheetName(document6.sheetNames?.[id] ?? id), index2);
52522
+ }
52523
+ }
52524
+ const name5 = endpoint.sheet ?? document6.position.sheet;
52525
+ return ids.get(name5) ?? names2.get(foldSheetName(name5)) ?? -1;
52526
+ };
52527
+ const visit = (node3) => {
52528
+ onWork();
52529
+ if (node3.kind === "parentheses" || node3.kind === "unary") return { ...node3, child: visit(node3.child) };
52530
+ if (node3.kind === "binary") return { ...node3, left: visit(node3.left), right: visit(node3.right) };
52531
+ if (node3.kind === "array") return { ...node3, rows: node3.rows.map((row) => row.map(visit)) };
52532
+ if (node3.kind !== "call") return node3;
52533
+ const args = node3.args.map(visit);
52534
+ let source = args[0];
52535
+ while (source?.kind === "parentheses") source = source.child;
52536
+ if (node3.name === "INDEX" && args.length >= 1 && args.length <= 4 && source?.kind === "reference" && source.last && source.first.workbook === void 0 && source.last.workbook === void 0 && !source.label) {
52537
+ const first = sheetIndex(source.first), last2 = sheetIndex(source.last);
52538
+ if (first >= 0 && last2 >= 0 && first !== last2) {
52539
+ let areas = [];
52540
+ for (let index2 = Math.min(first, last2); index2 <= Math.max(first, last2); index2++) {
52541
+ onWork();
52542
+ const sheet = document6.sheetNames?.[order[index2]] ?? order[index2];
52543
+ const first2 = { ...source.first, sheet };
52544
+ const last3 = { ...source.last, sheet };
52545
+ delete first2.sheetOffset;
52546
+ delete last3.sheetOffset;
52547
+ areas.push({ ...source, first: first2, last: last3 });
52548
+ }
52549
+ while (areas.length > 1) {
52550
+ const next = [];
52551
+ for (let index2 = 0; index2 < areas.length; index2 += 2) {
52552
+ onWork();
52553
+ next.push(areas[index2 + 1] ? {
52554
+ kind: "binary",
52555
+ op: "union",
52556
+ start: source.start,
52557
+ end: source.end,
52558
+ left: areas[index2],
52559
+ right: areas[index2 + 1]
52560
+ } : areas[index2]);
52561
+ }
52562
+ areas = next;
52563
+ }
52564
+ args[0] = { kind: "parentheses", start: source.start, end: source.end, child: areas[0] };
52565
+ }
52566
+ }
52567
+ return { ...node3, args };
52568
+ };
52569
+ return { ...document6, root: visit(document6.root) };
52570
+ }
52571
+
52572
+ // packages/safe-bash-command-ssconvert/src/codecs/xlsx.ts
52496
52573
  import { parseXmlSteps as parseXmlSteps3, XmlLimitError } from "@poe-platform/safe-fs/core";
52497
52574
 
52498
52575
  // packages/safe-bash-command-ssconvert/src/codecs/xlsx-schema.ts
@@ -56399,7 +56476,7 @@ function createXlsxWriter(edition) {
56399
56476
  ...array ? { t: "array", ref: rangeText(array.range) } : {},
56400
56477
  ...formulaSemanticsAttributes(array?.arrayStringLiterals ?? cell.arrayStringLiterals, true, cell.formula)
56401
56478
  },
56402
- escapeXlsx(exportXlsxFormula(cell.formula, sheet, cell.row, cell.column, context2, array?.arrayStringLiterals ?? cell.arrayStringLiterals))
56479
+ escapeXlsx(exportXlsxFormula(book, cell.formula, sheet, cell.row, cell.column, context2, array?.arrayStringLiterals ?? cell.arrayStringLiterals))
56403
56480
  );
56404
56481
  if (value3.kind === "string") {
56405
56482
  if ((stringCounts.get(stringKey) ?? 0) > 1) {
@@ -56443,7 +56520,7 @@ function createXlsxWriter(edition) {
56443
56520
  };
56444
56521
  for (const [gnm, xlsx, invert] of [["DisplayFormulas", "showFormulas", false], ["HideZero", "showZeros", true], ["HideGrid", "showGridLines", true], ["HideColHeader", "showRowColHeaders", true], ["DisplayOutlines", "showOutlineSymbols", false], ["RTL_Layout", "rightToLeft", false]])
56445
56522
  if (view2[gnm] !== void 0) viewAttrs[xlsx] = (invert ? !Number(view2[gnm]) : !!Number(view2[gnm])) ? 1 : 0;
56446
- const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context2, namespace5, exportXlsxFormula, styles, charge);
56523
+ const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context2, namespace5, exportXlsxFormula.bind(null, book), styles, charge);
56447
56524
  let cols = "", nextColumn = 0;
56448
56525
  for (const c4 of [...sheet.columns ?? []].sort((a3, b3) => a3.index - b3.index)) {
56449
56526
  const importedColumn = metadataNode(c4.style?.gnumeric, charge);
@@ -56524,7 +56601,7 @@ function createXlsxWriter(edition) {
56524
56601
  localSheetId: index2 < 0 ? void 0 : index2,
56525
56602
  ...formulaSemanticsAttributes(name5.arrayStringLiterals, true, name5.expression, name5.position ? { ...name5.position, sheet: book.sheets.find((s) => s.id === name5.position.sheet)?.name ?? name5.position.sheet } : void 0)
56526
56603
  },
56527
- escapeXlsx(exportXlsxFormula(name5.expression, sheet, name5.position?.row ?? 0, name5.position?.column ?? 0, context2, name5.arrayStringLiterals))
56604
+ escapeXlsx(exportXlsxFormula(book, name5.expression, sheet, name5.position?.row ?? 0, name5.position?.column ?? 0, context2, name5.arrayStringLiterals))
56528
56605
  );
56529
56606
  }
56530
56607
  for (const [index2, sheet] of book.sheets.entries()) {
@@ -56601,17 +56678,24 @@ function createXlsxWriter(edition) {
56601
56678
  }
56602
56679
  };
56603
56680
  }
56604
- function exportXlsxFormula(source, sheet, row, column, context2, arrayStringLiterals = false) {
56681
+ function exportXlsxFormula(book, source, sheet, row, column, context2, arrayStringLiterals = false) {
56605
56682
  const position = { sheet: sheet.id, row, column };
56683
+ let work = 0;
56684
+ const onWork = () => {
56685
+ context2.signal.throwIfAborted();
56686
+ if (++work > (context2.limits.workbookNodes ?? Infinity))
56687
+ throw new SsconvertError("resource-limit", "ssconvert XLSX formula node limit exceeded");
56688
+ };
56606
56689
  const parsed = parseExpression(source.startsWith("=") || source.startsWith("of:=") ? source : "=" + source, {
56607
56690
  position,
56608
56691
  arrayStringLiterals,
56692
+ workbook: book,
56609
56693
  signal: context2.signal,
56610
56694
  maximumLength: context2.limits.workbookTextBytes ?? context2.limits.outputBytes,
56611
56695
  maximumNodes: context2.limits.workbookNodes ?? Infinity
56612
56696
  });
56613
56697
  if (!parsed.ok) throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: unparsed XLSX formula");
56614
- const result2 = serializeExpression(parsed.document, excelGrammar, false, true, { relativeSheets: "fixed" });
56698
+ const result2 = serializeExpression(expandIndexSheetAreas(parsed.document, onWork), excelGrammar, false, true, { relativeSheets: "fixed" });
56615
56699
  return result2.startsWith("=") ? result2.slice(1) : result2;
56616
56700
  }
56617
56701
 
@@ -74917,8 +75001,8 @@ var operators = {
74917
75001
  ">=": 12,
74918
75002
  ">": 13,
74919
75003
  "<>": 14,
74920
- " ": 15,
74921
- ",": 16,
75004
+ intersection: 15,
75005
+ union: 16,
74922
75006
  ":": 17
74923
75007
  };
74924
75008
  var functions = new Map(Object.entries(biffFunctions).map(([id, spec]) => [spec[0], { id: Number(id), min: spec[1], max: spec[2] }]));
@@ -75062,7 +75146,12 @@ var BiffFormulaWriter = class {
75062
75146
  maximumLength: this.context.limits.workbookTextBytes ?? this.context.limits.outputBytes
75063
75147
  });
75064
75148
  if (!parsed.ok) throw new SsconvertError("unsupported-feature", `Cannot export Excel formula: ${expression2}`);
75065
- return parsed.document.root;
75149
+ let work = 0;
75150
+ return expandIndexSheetAreas(parsed.document, () => {
75151
+ this.context.signal.throwIfAborted();
75152
+ if (++work > (this.context.limits.workbookNodes ?? this.context.limits.cells))
75153
+ throw new SsconvertError("resource-limit", "ssconvert BIFF formula node limit exceeded");
75154
+ }).root;
75066
75155
  };
75067
75156
  const relative = definition !== void 0;
75068
75157
  const root = definition ? parseNamedExpression(definition, this.book, parse3, () => this.context.signal.throwIfAborted()) : parse3(source, { sheet, row, column });
@@ -86932,6 +87021,7 @@ function lotusExternalVariable(name5) {
86932
87021
  async function lotusFormula(bytes, format3, group, row, column, sheetIndex, sheetName2, context2, consumeOperation, functions2 = lotusFunctions, names2, legacyReferenceLayout) {
86933
87022
  const b3 = new Binary(bytes), stack = [], modern = format3 !== "wk1";
86934
87023
  const relativeReferences = /* @__PURE__ */ new Map();
87024
+ const indexRanges = /* @__PURE__ */ new Map();
86935
87025
  let at = 0;
86936
87026
  const pop = async () => {
86937
87027
  if (stack.length) return stack.pop();
@@ -86939,7 +87029,8 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86939
87029
  return "#REF!";
86940
87030
  };
86941
87031
  const ref = (r, c4, rr, cr) => {
86942
- if (r < 0 || c4 < 0) return "#REF!";
87032
+ const rows = modern || legacyReferenceLayout === void 0 ? 65536 : legacyReferenceLayout === "wk1" ? 2048 : 16384;
87033
+ if (r < 0 || r >= rows || c4 < 0 || c4 >= 256) return "#REF!";
86943
87034
  const a3 = formatA1(r, c4);
86944
87035
  let i4 = 0;
86945
87036
  while (a3[i4] >= "A" && a3[i4] <= "Z") i4++;
@@ -86949,13 +87040,13 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86949
87040
  const c4 = b3.u16(p2), r = b3.u16(p2 + 2), cr = !!(c4 & 32768), rr = !!(r & 32768);
86950
87041
  if (legacyReferenceLayout === "works3" || legacyReferenceLayout === "symphony") {
86951
87042
  const axis = (raw, origin, bits3) => {
86952
- if (!(raw & 32768)) return raw;
87043
+ if (!(raw & 32768)) return raw & (1 << bits3) - 1;
86953
87044
  const shift = 32 - bits3, boundary = 2 ** (bits3 - 1);
86954
87045
  let delta = raw << shift >> shift;
86955
87046
  if (delta + origin >= boundary) delta -= boundary;
86956
87047
  return origin + delta;
86957
87048
  };
86958
- let targetColumn = c4;
87049
+ let targetColumn = c4 & 255;
86959
87050
  if (legacyReferenceLayout === "symphony" && cr) {
86960
87051
  let delta = c4 & 255;
86961
87052
  if (delta & 128 && delta + column >= 256) delta -= 256;
@@ -86983,6 +87074,10 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86983
87074
  const target = b3.u8(p2 + 2), name5 = sheetName2(target);
86984
87075
  return (target === sheetIndex && !qualifySheet ? "" : quoteFormulaString(name5, "'", gnumericGrammar) + "!") + ref(b3.u16(p2), b3.u8(p2 + 3), !!(flags2 & 2), !!(flags2 & 1));
86985
87076
  };
87077
+ const rangeReference = (first, last2) => {
87078
+ if (first.endsWith("#REF!") || last2?.endsWith("#REF!")) return "#REF!";
87079
+ return first + (last2 === void 0 ? "" : ":" + last2);
87080
+ };
86986
87081
  while (at < bytes.length) {
86987
87082
  context2.signal.throwIfAborted();
86988
87083
  const op = b3.u8(at++);
@@ -87016,8 +87111,17 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87016
87111
  const name5 = `LOTUS_SHEET_REFERENCE_${relativeReferences.size}`;
87017
87112
  relativeReferences.set(name5, { kind: "reference", start: 0, end: 0, first, ...last2 ? { last: last2 } : {} });
87018
87113
  stack.push(name5);
87019
- } else stack.push(newRef(at + 1, flags2 & 7, crossSheet) + (op === 2 ? `:${newRef(at + 5, flags2 >> 3 & 7, crossSheet)}` : ""));
87020
- } else stack.push(oldRef(at) + (op === 2 ? `:${oldRef(at + 4)}` : ""));
87114
+ } else {
87115
+ const source = rangeReference(newRef(at + 1, flags2 & 7, crossSheet), op === 2 ? newRef(at + 5, flags2 >> 3 & 7, crossSheet) : void 0);
87116
+ stack.push(source);
87117
+ if (crossSheet) indexRanges.set(source, {
87118
+ firstSheet: b3.u8(at + 3),
87119
+ lastSheet: b3.u8(at + 7),
87120
+ first: ref(b3.u16(at + 1), b3.u8(at + 4), !!(flags2 & 2), !!(flags2 & 1)),
87121
+ last: ref(b3.u16(at + 5), b3.u8(at + 8), !!(flags2 & 16), !!(flags2 & 8))
87122
+ });
87123
+ }
87124
+ } else stack.push(rangeReference(oldRef(at), op === 2 ? oldRef(at + 4) : void 0));
87021
87125
  at += length;
87022
87126
  } else if (op === 5) {
87023
87127
  const length = format3 === "123" ? 4 : 2;
@@ -87056,7 +87160,14 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87056
87160
  const crossSheet = range5.first.sheet !== range5.last.sheet;
87057
87161
  const endpoint = (point) => (point.sheet === sheetIndex && !crossSheet ? "" : quoteFormulaString(sheetName2(point.sheet), "'", gnumericGrammar) + "!") + ref(point.row, point.column, op === 7, op === 7);
87058
87162
  const single = range5.first.row === range5.last.row && range5.first.column === range5.last.column && range5.first.sheet === range5.last.sheet;
87059
- stack.push(endpoint(range5.first) + (single ? "" : ":" + endpoint(range5.last)));
87163
+ const source = endpoint(range5.first) + (single ? "" : ":" + endpoint(range5.last));
87164
+ stack.push(source);
87165
+ if (crossSheet) indexRanges.set(source, {
87166
+ firstSheet: range5.first.sheet,
87167
+ lastSheet: range5.last.sheet,
87168
+ first: ref(range5.first.row, range5.first.column, op === 7, op === 7),
87169
+ last: ref(range5.last.row, range5.last.column, op === 7, op === 7)
87170
+ });
87060
87171
  }
87061
87172
  } else if (modern && op >= 9 && op <= 11) {
87062
87173
  const length = op === 9 ? 4 : op === 10 ? 5 : 11;
@@ -87100,7 +87211,7 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87100
87211
  }
87101
87212
  const operands = [];
87102
87213
  for (let i4 = 0; i4 < args; i4++) operands.unshift(await pop());
87103
- let subtract3 = 0;
87214
+ let subtract3 = info?.[3] === "wk1_year_func" ? 1900 : 0;
87104
87215
  if (functions2 === lotusFunctions) {
87105
87216
  switch (info?.[1]) {
87106
87217
  case "CHOOSE":
@@ -87118,19 +87229,36 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87118
87229
  case "HLOOKUP":
87119
87230
  if (operands.length === 3) operands[2] = `(${operands[2]}+1)`;
87120
87231
  break;
87232
+ case "DSUM":
87233
+ case "DAVG":
87234
+ case "DCNT":
87235
+ case "DMIN":
87236
+ case "DMAX":
87237
+ case "DVAR":
87238
+ case "DSTD":
87239
+ case "DPURECOUNT":
87240
+ if (operands.length > 1) operands[1] = `(${operands[1]}+1)`;
87241
+ break;
87121
87242
  case "INDEX":
87122
- if (operands.length === 3) {
87243
+ if (operands.length === 3 || operands.length === 4) {
87123
87244
  const [, column2, row2] = operands;
87124
87245
  operands[1] = `(${row2}+1)`;
87125
87246
  operands[2] = `(${column2}+1)`;
87247
+ if (operands.length === 4) operands[3] = `(${operands[3]}+1)`;
87248
+ const span2 = indexRanges.get(operands[0]);
87249
+ if (span2) {
87250
+ const choices = [];
87251
+ for (let index2 = Math.min(span2.firstSheet, span2.lastSheet); index2 <= Math.max(span2.firstSheet, span2.lastSheet); index2++) {
87252
+ consumeOperation();
87253
+ choices.push(quoteFormulaString(sheetName2(index2), "'", gnumericGrammar) + "!" + span2.first + ":" + span2.last);
87254
+ }
87255
+ operands[0] = `(${choices.join(",")})`;
87256
+ }
87126
87257
  }
87127
87258
  break;
87128
87259
  case "STRING":
87129
87260
  operands.push("TRUE()");
87130
87261
  break;
87131
- case "YEAR":
87132
- subtract3 = 1900;
87133
- break;
87134
87262
  case "ROUNDUP":
87135
87263
  case "ROUNDDOWN":
87136
87264
  if (operands.length === 3) operands.pop();
@@ -164350,4 +164478,4 @@ tslib/tslib.js:
164350
164478
  @noble/ciphers/utils.js:
164351
164479
  (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
164352
164480
  */
164353
- //# sourceMappingURL=chunk-55AGFLG5.js.map
164481
+ //# sourceMappingURL=chunk-BQEH4DKJ.js.map
@@ -3861,7 +3861,7 @@ var Interpreter = class _Interpreter {
3861
3861
  if (!isNumber(input)) throw new JqError(`${describe(input, budget)} cannot be ${name}ed`);
3862
3862
  budget.step();
3863
3863
  const n = numberValue(input);
3864
- yield name === "floor" ? Math.floor(n) : name === "ceil" ? Math.ceil(n) : name === "round" ? Math.round(n) : Math.abs(n);
3864
+ yield name === "floor" ? Math.floor(n) : name === "ceil" ? Math.ceil(n) : name === "round" ? Math.sign(n) * Math.round(Math.abs(n)) : Math.abs(n);
3865
3865
  return;
3866
3866
  }
3867
3867
  if (name === "implode") {
@@ -3874,10 +3874,11 @@ var Interpreter = class _Interpreter {
3874
3874
  }
3875
3875
  const el = input[i];
3876
3876
  const cp = isNumber(el) ? numberValue(el) : NaN;
3877
- if (!Number.isInteger(cp) || cp < 0 || cp > 1114111) {
3877
+ if (!isNumber(el)) {
3878
3878
  throw new JqError("implode elements must be Unicode codepoints");
3879
3879
  }
3880
- out += String.fromCodePoint(cp);
3880
+ const point = Math.trunc(cp);
3881
+ out += String.fromCodePoint(!Number.isFinite(point) || point < 0 || point > 1114111 || point >= 55296 && point <= 57343 ? 65533 : point);
3881
3882
  }
3882
3883
  budget.value(out);
3883
3884
  yield out;
@@ -5144,4 +5145,4 @@ export {
5144
5145
  moduleProgram,
5145
5146
  parse
5146
5147
  };
5147
- //# sourceMappingURL=chunk-JCXAGOEK.js.map
5148
+ //# sourceMappingURL=chunk-K3LGRJMX.js.map
@@ -11,7 +11,7 @@ import {
11
11
  tryProcessFlatJsonChunkSync,
12
12
  tryProcessFlatSelectProjectChunkSync,
13
13
  tryWriteCompactSync
14
- } from "./chunk-JCXAGOEK.js";
14
+ } from "./chunk-K3LGRJMX.js";
15
15
  import {
16
16
  Budget,
17
17
  JqError,
@@ -2530,4 +2530,4 @@ export {
2530
2530
  createXmlCommands,
2531
2531
  xmlCommands
2532
2532
  };
2533
- //# sourceMappingURL=chunk-OF2PDE3W.js.map
2533
+ //# sourceMappingURL=chunk-RPNX7NO2.js.map
@@ -12,7 +12,7 @@ import {
12
12
  import {
13
13
  Interpreter,
14
14
  parse
15
- } from "./chunk-JCXAGOEK.js";
15
+ } from "./chunk-K3LGRJMX.js";
16
16
  import {
17
17
  Budget,
18
18
  Decimal,
@@ -2879,4 +2879,4 @@ export {
2879
2879
  createYqCommands,
2880
2880
  yqCommands
2881
2881
  };
2882
- //# sourceMappingURL=chunk-BS6QFRNX.js.map
2882
+ //# sourceMappingURL=chunk-XIWFKWNM.js.map
@@ -81,7 +81,7 @@ import {
81
81
  updateWorkbook,
82
82
  validSheetSize,
83
83
  visitFormula
84
- } from "./chunk-55AGFLG5.js";
84
+ } from "./chunk-BQEH4DKJ.js";
85
85
  import "./chunk-CVAVQZSF.js";
86
86
  import "./chunk-RCM5PZBN.js";
87
87
  import "./chunk-LSRHLNCR.js";
@@ -171,4 +171,4 @@ export {
171
171
  validSheetSize,
172
172
  visitFormula
173
173
  };
174
- //# sourceMappingURL=src-T672TQJC.js.map
174
+ //# sourceMappingURL=src-YBSQFQZO.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-S3BO2NJT.js";
4
4
  import {
5
5
  Interpreter
6
- } from "./chunk-6742OVAC.js";
6
+ } from "./chunk-WX5IUIQK.js";
7
7
  import {
8
8
  Budget,
9
9
  JqLimitError,
@@ -1526,7 +1526,7 @@ var Interpreter = class _Interpreter {
1526
1526
  throw new JqError(`${describe(input, budget)} cannot be ${name}ed`);
1527
1527
  budget.step();
1528
1528
  const n = numberValue(input);
1529
- yield name === "floor" ? Math.floor(n) : name === "ceil" ? Math.ceil(n) : name === "round" ? Math.round(n) : Math.abs(n);
1529
+ yield name === "floor" ? Math.floor(n) : name === "ceil" ? Math.ceil(n) : name === "round" ? Math.sign(n) * Math.round(Math.abs(n)) : Math.abs(n);
1530
1530
  return;
1531
1531
  }
1532
1532
  if (name === "implode") {
@@ -1541,10 +1541,11 @@ var Interpreter = class _Interpreter {
1541
1541
  }
1542
1542
  const el = input[i];
1543
1543
  const cp = isNumber(el) ? numberValue(el) : NaN;
1544
- if (!Number.isInteger(cp) || cp < 0 || cp > 1114111) {
1544
+ if (!isNumber(el)) {
1545
1545
  throw new JqError("implode elements must be Unicode codepoints");
1546
1546
  }
1547
- out += String.fromCodePoint(cp);
1547
+ const point = Math.trunc(cp);
1548
+ out += String.fromCodePoint(!Number.isFinite(point) || point < 0 || point > 1114111 || point >= 55296 && point <= 57343 ? 65533 : point);
1548
1549
  }
1549
1550
  budget.value(out);
1550
1551
  yield out;