@poe-platform/safe-bash 0.1.746 → 0.1.748

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.
@@ -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
@@ -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,17 @@ 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;
48708
48715
  } else if (offsets[2] !== 0) return error("#REF!");
48709
48716
  const row = offsets[0], column = offsets[1], dims = dimensions(value3);
48710
48717
  if (row < 0 || column < 0 || row >= dims.height || column >= dims.width) return error("#REF!");
@@ -86932,6 +86939,7 @@ function lotusExternalVariable(name5) {
86932
86939
  async function lotusFormula(bytes, format3, group, row, column, sheetIndex, sheetName2, context2, consumeOperation, functions2 = lotusFunctions, names2, legacyReferenceLayout) {
86933
86940
  const b3 = new Binary(bytes), stack = [], modern = format3 !== "wk1";
86934
86941
  const relativeReferences = /* @__PURE__ */ new Map();
86942
+ const indexRanges = /* @__PURE__ */ new Map();
86935
86943
  let at = 0;
86936
86944
  const pop = async () => {
86937
86945
  if (stack.length) return stack.pop();
@@ -86939,7 +86947,8 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86939
86947
  return "#REF!";
86940
86948
  };
86941
86949
  const ref = (r, c4, rr, cr) => {
86942
- if (r < 0 || c4 < 0) return "#REF!";
86950
+ const rows = modern || legacyReferenceLayout === void 0 ? 65536 : legacyReferenceLayout === "wk1" ? 2048 : 16384;
86951
+ if (r < 0 || r >= rows || c4 < 0 || c4 >= 256) return "#REF!";
86943
86952
  const a3 = formatA1(r, c4);
86944
86953
  let i4 = 0;
86945
86954
  while (a3[i4] >= "A" && a3[i4] <= "Z") i4++;
@@ -86949,13 +86958,13 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86949
86958
  const c4 = b3.u16(p2), r = b3.u16(p2 + 2), cr = !!(c4 & 32768), rr = !!(r & 32768);
86950
86959
  if (legacyReferenceLayout === "works3" || legacyReferenceLayout === "symphony") {
86951
86960
  const axis = (raw, origin, bits3) => {
86952
- if (!(raw & 32768)) return raw;
86961
+ if (!(raw & 32768)) return raw & (1 << bits3) - 1;
86953
86962
  const shift = 32 - bits3, boundary = 2 ** (bits3 - 1);
86954
86963
  let delta = raw << shift >> shift;
86955
86964
  if (delta + origin >= boundary) delta -= boundary;
86956
86965
  return origin + delta;
86957
86966
  };
86958
- let targetColumn = c4;
86967
+ let targetColumn = c4 & 255;
86959
86968
  if (legacyReferenceLayout === "symphony" && cr) {
86960
86969
  let delta = c4 & 255;
86961
86970
  if (delta & 128 && delta + column >= 256) delta -= 256;
@@ -86983,6 +86992,10 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
86983
86992
  const target = b3.u8(p2 + 2), name5 = sheetName2(target);
86984
86993
  return (target === sheetIndex && !qualifySheet ? "" : quoteFormulaString(name5, "'", gnumericGrammar) + "!") + ref(b3.u16(p2), b3.u8(p2 + 3), !!(flags2 & 2), !!(flags2 & 1));
86985
86994
  };
86995
+ const rangeReference = (first, last2) => {
86996
+ if (first.endsWith("#REF!") || last2?.endsWith("#REF!")) return "#REF!";
86997
+ return first + (last2 === void 0 ? "" : ":" + last2);
86998
+ };
86986
86999
  while (at < bytes.length) {
86987
87000
  context2.signal.throwIfAborted();
86988
87001
  const op = b3.u8(at++);
@@ -87016,8 +87029,17 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87016
87029
  const name5 = `LOTUS_SHEET_REFERENCE_${relativeReferences.size}`;
87017
87030
  relativeReferences.set(name5, { kind: "reference", start: 0, end: 0, first, ...last2 ? { last: last2 } : {} });
87018
87031
  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)}` : ""));
87032
+ } else {
87033
+ const source = rangeReference(newRef(at + 1, flags2 & 7, crossSheet), op === 2 ? newRef(at + 5, flags2 >> 3 & 7, crossSheet) : void 0);
87034
+ stack.push(source);
87035
+ if (crossSheet) indexRanges.set(source, {
87036
+ firstSheet: b3.u8(at + 3),
87037
+ lastSheet: b3.u8(at + 7),
87038
+ first: ref(b3.u16(at + 1), b3.u8(at + 4), !!(flags2 & 2), !!(flags2 & 1)),
87039
+ last: ref(b3.u16(at + 5), b3.u8(at + 8), !!(flags2 & 16), !!(flags2 & 8))
87040
+ });
87041
+ }
87042
+ } else stack.push(rangeReference(oldRef(at), op === 2 ? oldRef(at + 4) : void 0));
87021
87043
  at += length;
87022
87044
  } else if (op === 5) {
87023
87045
  const length = format3 === "123" ? 4 : 2;
@@ -87056,7 +87078,14 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87056
87078
  const crossSheet = range5.first.sheet !== range5.last.sheet;
87057
87079
  const endpoint = (point) => (point.sheet === sheetIndex && !crossSheet ? "" : quoteFormulaString(sheetName2(point.sheet), "'", gnumericGrammar) + "!") + ref(point.row, point.column, op === 7, op === 7);
87058
87080
  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)));
87081
+ const source = endpoint(range5.first) + (single ? "" : ":" + endpoint(range5.last));
87082
+ stack.push(source);
87083
+ if (crossSheet) indexRanges.set(source, {
87084
+ firstSheet: range5.first.sheet,
87085
+ lastSheet: range5.last.sheet,
87086
+ first: ref(range5.first.row, range5.first.column, op === 7, op === 7),
87087
+ last: ref(range5.last.row, range5.last.column, op === 7, op === 7)
87088
+ });
87060
87089
  }
87061
87090
  } else if (modern && op >= 9 && op <= 11) {
87062
87091
  const length = op === 9 ? 4 : op === 10 ? 5 : 11;
@@ -87100,7 +87129,7 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87100
87129
  }
87101
87130
  const operands = [];
87102
87131
  for (let i4 = 0; i4 < args; i4++) operands.unshift(await pop());
87103
- let subtract3 = 0;
87132
+ let subtract3 = info?.[3] === "wk1_year_func" ? 1900 : 0;
87104
87133
  if (functions2 === lotusFunctions) {
87105
87134
  switch (info?.[1]) {
87106
87135
  case "CHOOSE":
@@ -87118,19 +87147,36 @@ async function lotusFormula(bytes, format3, group, row, column, sheetIndex, shee
87118
87147
  case "HLOOKUP":
87119
87148
  if (operands.length === 3) operands[2] = `(${operands[2]}+1)`;
87120
87149
  break;
87150
+ case "DSUM":
87151
+ case "DAVG":
87152
+ case "DCNT":
87153
+ case "DMIN":
87154
+ case "DMAX":
87155
+ case "DVAR":
87156
+ case "DSTD":
87157
+ case "DPURECOUNT":
87158
+ if (operands.length > 1) operands[1] = `(${operands[1]}+1)`;
87159
+ break;
87121
87160
  case "INDEX":
87122
- if (operands.length === 3) {
87161
+ if (operands.length === 3 || operands.length === 4) {
87123
87162
  const [, column2, row2] = operands;
87124
87163
  operands[1] = `(${row2}+1)`;
87125
87164
  operands[2] = `(${column2}+1)`;
87165
+ if (operands.length === 4) operands[3] = `(${operands[3]}+1)`;
87166
+ const span2 = indexRanges.get(operands[0]);
87167
+ if (span2) {
87168
+ const choices = [];
87169
+ for (let index2 = Math.min(span2.firstSheet, span2.lastSheet); index2 <= Math.max(span2.firstSheet, span2.lastSheet); index2++) {
87170
+ consumeOperation();
87171
+ choices.push(quoteFormulaString(sheetName2(index2), "'", gnumericGrammar) + "!" + span2.first + ":" + span2.last);
87172
+ }
87173
+ operands[0] = `(${choices.join(",")})`;
87174
+ }
87126
87175
  }
87127
87176
  break;
87128
87177
  case "STRING":
87129
87178
  operands.push("TRUE()");
87130
87179
  break;
87131
- case "YEAR":
87132
- subtract3 = 1900;
87133
- break;
87134
87180
  case "ROUNDUP":
87135
87181
  case "ROUNDDOWN":
87136
87182
  if (operands.length === 3) operands.pop();
@@ -87252,7 +87298,7 @@ async function readLotus(bytes, context2) {
87252
87298
  at += length;
87253
87299
  if (id === 0) {
87254
87300
  if (modern) {
87255
- if (length >= 18) group = data4.u8(16);
87301
+ if (version2 >= 4098 && length >= 18) group = data4.u8(16);
87256
87302
  } else {
87257
87303
  active = sheets.length;
87258
87304
  sheet(active);
@@ -91172,8 +91218,8 @@ init_platform();
91172
91218
  var tableNamespaces = ["urn:oasis:names:tc:opendocument:xmlns:table:1.0", "http://openoffice.org/2000/table"];
91173
91219
  function readOdfLabelRanges(parent, sheets, context2, charge) {
91174
91220
  const byName = new Map(sheets.map((sheet) => {
91175
- charge();
91176
- return [sheet.name, sheet];
91221
+ charge(1 + sheet.name.length);
91222
+ return [foldSheetName(sheet.name), sheet];
91177
91223
  }));
91178
91224
  const ranges2 = /* @__PURE__ */ new Map();
91179
91225
  const sizes = new Map(sheets.map((sheet) => {
@@ -91209,8 +91255,9 @@ function readOdfLabelRanges(parent, sheets, context2, charge) {
91209
91255
  });
91210
91256
  if (!parsed.ok || parsed.document.root.kind !== "reference") return invalid10();
91211
91257
  const first = parsed.document.root.first, last2 = parsed.document.root.last ?? first;
91212
- const sheet = first.sheet === void 0 ? void 0 : byName.get(first.sheet);
91213
- if (!sheet || first.workbook !== void 0 || last2.workbook !== void 0 || last2.sheet && last2.sheet !== first.sheet || !first.row || !first.column || !last2.row || !last2.column) return invalid10();
91258
+ const sheet = first.sheet === void 0 ? void 0 : byName.get(foldSheetName(first.sheet));
91259
+ const lastSheet = last2.sheet === void 0 ? sheet : byName.get(foldSheetName(last2.sheet));
91260
+ if (!sheet || first.workbook !== void 0 || last2.workbook !== void 0 || lastSheet !== sheet || !first.row || !first.column || !last2.row || !last2.column) return invalid10();
91214
91261
  const range5 = { startRow: first.row.value, endRow: last2.row.value, startColumn: first.column.value, endColumn: last2.column.value };
91215
91262
  if (Object.values(range5).some((value3) => !Number.isSafeInteger(value3) || value3 < 0) || range5.startRow > range5.endRow || range5.startColumn > range5.endColumn || range5.endRow >= MAX_SHEET_SIZE.rows || range5.endColumn >= MAX_SHEET_SIZE.columns) return invalid10();
91216
91263
  return { sheet, range: range5 };
@@ -91561,8 +91608,8 @@ function createOdfStyles(xml2, extended, book, context2) {
91561
91608
  }
91562
91609
  return { register, styles };
91563
91610
  }
91564
- function odfPrintStyles(records, index2, xml2, extended) {
91565
- const e = xml2.element, properties = { "style:print": "charts drawings objects" };
91611
+ function odfPrintProperties(records, xml2, extended) {
91612
+ const properties = { "style:print": "charts drawings objects" };
91566
91613
  for (const source of records) for (const n of odfChildren(source)) {
91567
91614
  xml2.charge();
91568
91615
  const v2 = odfObject(n), a3 = odfAttributes(n);
@@ -91580,10 +91627,83 @@ function odfPrintStyles(records, index2, xml2, extended) {
91580
91627
  } else if (a3.percentage) properties["style:scale-to"] = a3.percentage + "%";
91581
91628
  }
91582
91629
  }
91583
- return {
91584
- layout: e("style:page-layout", { "style:name": "pl" + index2 }, e("style:page-layout-properties", properties)),
91585
- master: e("style:master-page", { "style:name": "mp" + index2, "style:page-layout-name": "pl" + index2 })
91586
- };
91630
+ return properties;
91631
+ }
91632
+
91633
+ // packages/safe-bash-command-ssconvert/src/codecs/odf-style-definitions.ts
91634
+ init_platform();
91635
+ function createOdfStyleDefinitions(book, xml2) {
91636
+ const sections = /* @__PURE__ */ new Map();
91637
+ const shapes2 = /* @__PURE__ */ new Map();
91638
+ const names2 = /* @__PURE__ */ new Set();
91639
+ let anonymous = 0;
91640
+ for (const record7 of book.unsupportedRecords ?? []) {
91641
+ xml2.charge();
91642
+ if (record7.source !== "Gnumeric_OpenCalc:openoffice") continue;
91643
+ const data4 = odfObject(record7.data);
91644
+ const section = record7.kind === "automatic-styles" ? data4?.packagePart === "styles.xml" ? "stylesAutomatic" : "contentAutomatic" : record7.kind === "master-styles" ? "masters" : record7.kind === "font-face-decls" ? "fonts" : record7.kind === "styles" ? "styles" : void 0;
91645
+ if (!section) continue;
91646
+ let entries = sections.get(section);
91647
+ if (!entries) {
91648
+ entries = /* @__PURE__ */ new Map();
91649
+ sections.set(section, entries);
91650
+ }
91651
+ for (const child7 of odfChildren(data4?.xml)) {
91652
+ xml2.charge();
91653
+ const node3 = odfObject(child7), attributes4 = odfAttributes(child7, odfNamespaces.style);
91654
+ const key2 = attributes4.name ? JSON.stringify([node3?.namespace, node3?.name, attributes4.family ?? "", attributes4.name]) : "anonymous:" + anonymous++;
91655
+ entries.set(key2, child7);
91656
+ if (attributes4.name) names2.add(attributes4.name);
91657
+ }
91658
+ }
91659
+ for (const [section, entries] of sections) {
91660
+ const byShape = /* @__PURE__ */ new Map();
91661
+ shapes2.set(section, byShape);
91662
+ for (const child7 of entries.values()) {
91663
+ xml2.charge();
91664
+ const node3 = odfObject(child7), name5 = odfAttributes(child7, odfNamespaces.style).name;
91665
+ if (!node3 || !name5 || !Array.isArray(node3.attributes)) continue;
91666
+ const attributes4 = node3.attributes.filter((value3) => {
91667
+ xml2.charge();
91668
+ const attribute5 = odfObject(value3);
91669
+ return attribute5?.namespace !== odfNamespaces.style || attribute5?.name !== "name";
91670
+ });
91671
+ byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name5);
91672
+ }
91673
+ }
91674
+ function register(section, tag3, preferredName, attributes4, content2 = "") {
91675
+ const shape = xml2.element(tag3, attributes4, content2);
91676
+ let byShape = shapes2.get(section);
91677
+ const existing = byShape?.get(shape);
91678
+ if (existing !== void 0) return existing;
91679
+ let name5 = preferredName, suffix = 1;
91680
+ while (names2.has(name5)) {
91681
+ xml2.charge();
91682
+ name5 = preferredName + "_" + suffix++;
91683
+ }
91684
+ names2.add(name5);
91685
+ let entries = sections.get(section);
91686
+ if (!entries) {
91687
+ entries = /* @__PURE__ */ new Map();
91688
+ sections.set(section, entries);
91689
+ }
91690
+ entries.set("generated:" + name5, xml2.element(tag3, { "style:name": name5, ...attributes4 }, content2));
91691
+ if (!byShape) {
91692
+ byShape = /* @__PURE__ */ new Map();
91693
+ shapes2.set(section, byShape);
91694
+ }
91695
+ byShape.set(shape, name5);
91696
+ return name5;
91697
+ }
91698
+ function render(section) {
91699
+ let result2 = "";
91700
+ for (const value3 of sections.get(section)?.values() ?? []) {
91701
+ xml2.charge();
91702
+ result2 += typeof value3 === "string" ? value3 : xml2.retained(value3);
91703
+ }
91704
+ return result2;
91705
+ }
91706
+ return { register, render };
91587
91707
  }
91588
91708
 
91589
91709
  // packages/safe-bash-command-ssconvert/src/codecs/odf-function-names.ts
@@ -92428,7 +92548,8 @@ async function readOdf(bytes, context2) {
92428
92548
  const dateSystem = attr5(children5(calculation, "null-date")[0], "date-value")?.startsWith("1904") ? "1904" : "1900";
92429
92549
  const unsupportedRecords = [];
92430
92550
  const styles = readStyles(styleRoots, pkg.charge);
92431
- for (const r of styleRoots) for (const node3 of r.children) if (["styles", "automatic-styles", "master-styles", "font-face-decls", "font-decls"].includes(node3.localName)) unsupportedRecords.push(record4(node3));
92551
+ for (const r of styleRoots) for (const node3 of r.children) if (["styles", "automatic-styles", "master-styles", "font-face-decls", "font-decls"].includes(node3.localName))
92552
+ unsupportedRecords.push(record4(node3, { packagePart: r === preparseRoot ? "content.xml" : "styles.xml" }));
92432
92553
  if (manifest) unsupportedRecords.push(record4(manifest));
92433
92554
  for (const name5 of ["meta.xml", "settings.xml"]) if (pkg.entries.has(name5)) unsupportedRecords.push(record4(await pkg.document(name5)));
92434
92555
  const resources = /* @__PURE__ */ new Set();
@@ -92736,6 +92857,8 @@ async function readOdf(bytes, context2) {
92736
92857
  if (calculation) unsupportedRecords.push(record4(calculation));
92737
92858
  if (!sheets.length) invalid4("no sheets");
92738
92859
  const iteration = children5(calculation, "iteration")[0];
92860
+ const iterationMaximum = Number(attr5(iteration, "steps") ?? "100");
92861
+ if (!Number.isSafeInteger(iterationMaximum) || iterationMaximum < 0) invalid4("invalid iteration count");
92739
92862
  const lookup4 = attr5(calculation, "automatic-find-labels");
92740
92863
  if (lookup4 !== void 0 && !["true", "false"].includes(lookup4)) invalid4("invalid automatic label lookup setting");
92741
92864
  const book = {
@@ -92747,7 +92870,7 @@ async function readOdf(bytes, context2) {
92747
92870
  unsupportedRecords,
92748
92871
  ...iteration ? { iteration: {
92749
92872
  enabled: attr5(iteration, "status") === "enable",
92750
- maximum: 100,
92873
+ maximum: iterationMaximum,
92751
92874
  tolerance: Number(attr5(iteration, "maximum-difference") ?? "0.001")
92752
92875
  } } : {}
92753
92876
  };
@@ -93005,40 +93128,40 @@ function createOdfWriter(profile) {
93005
93128
  "table:maximum-difference": iteration?.tolerance ?? 1e-3
93006
93129
  })
93007
93130
  );
93008
- let automatic = "", masters = "", styleBody = "", fontFaces = "", pageLayouts = "", spreadsheet = "", validations = "", databaseRanges = "";
93131
+ const definitions4 = createOdfStyleDefinitions(book, xml2);
93132
+ let automatic = "", spreadsheet = "", validations = "", databaseRanges = "";
93009
93133
  for (const record7 of book.unsupportedRecords ?? []) {
93010
93134
  xml2.charge();
93011
93135
  const v2 = odfObject(record7.data), node3 = odfObject(v2?.xml);
93012
93136
  if (record7.source === "Gnumeric_OpenCalc:openoffice" && node3) {
93013
- if (["automatic-styles", "font-face-decls", "styles", "master-styles"].includes(record7.kind)) {
93014
- const content2 = odfChildren(node3).map((n) => xml2.retained(n)).join("");
93015
- if (record7.kind === "automatic-styles") automatic += content2;
93016
- else if (record7.kind === "master-styles") masters += content2;
93017
- else if (record7.kind === "font-face-decls") fontFaces += content2;
93018
- else styleBody += content2;
93019
- } else if (record7.kind === "content-validations") validations += odfChildren(node3).map((n) => xml2.retained(n)).join("");
93137
+ if (record7.kind === "content-validations") validations += odfChildren(node3).map((n) => xml2.retained(n)).join("");
93020
93138
  else if (record7.kind === "database-ranges") databaseRanges += xml2.retained(node3);
93021
93139
  }
93022
93140
  }
93023
93141
  for (const [index2, sheet] of book.sheets.entries()) {
93024
93142
  xml2.charge();
93025
- const sheetStyle = "ta" + index2;
93026
93143
  const view2 = odfObject(sheet.view?.gnumeric) ?? {}, properties = odfChildren(sheet.view?.odf).find((n) => odfObject(n)?.name === "table-properties");
93027
93144
  const originalProperties = odfAttributes(properties, odfNamespaces.gnm);
93028
- const print = odfPrintStyles((sheet.unsupportedRecords ?? []).filter((r) => r.kind === "PrintInformation").flatMap((r) => r.data ? [r.data] : []), index2, xml2, extended);
93029
- pageLayouts += print.layout;
93030
- masters += print.master;
93031
- automatic += e("style:style", { "style:name": sheetStyle, "style:family": "table", "style:master-page-name": "mp" + index2 }, e("style:table-properties", {
93032
- "table:display": sheet.visibility && sheet.visibility !== "visible" ? "false" : "true",
93033
- "style:writing-mode": Number(view2.RTL_Layout ?? 0) ? "rl-tb" : "lr-tb",
93034
- ...extended ? {
93035
- "gnm:display-formulas": String(Boolean(Number(view2.DisplayFormulas ?? 0))),
93036
- "gnm:display-col-header": String(!Number(view2.HideColHeader ?? 0)),
93037
- "gnm:display-row-header": String(!Number(view2.HideRowHeader ?? 0)),
93038
- "gnm:tab-color": originalProperties["tab-color"],
93039
- "gnm:tab-text-color": originalProperties["tab-text-color"]
93040
- } : {}
93041
- }));
93145
+ const print = odfPrintProperties((sheet.unsupportedRecords ?? []).filter((r) => r.kind === "PrintInformation").flatMap((r) => r.data ? [r.data] : []), xml2, extended);
93146
+ const layoutName = definitions4.register("stylesAutomatic", "style:page-layout", "pl" + index2, {}, e("style:page-layout-properties", print));
93147
+ const masterName = definitions4.register("masters", "style:master-page", "mp" + index2, { "style:page-layout-name": layoutName });
93148
+ const sheetStyle = definitions4.register(
93149
+ "contentAutomatic",
93150
+ "style:style",
93151
+ "ta" + index2,
93152
+ { "style:family": "table", "style:master-page-name": masterName },
93153
+ e("style:table-properties", {
93154
+ "table:display": sheet.visibility && sheet.visibility !== "visible" ? "false" : "true",
93155
+ "style:writing-mode": Number(view2.RTL_Layout ?? 0) ? "rl-tb" : "lr-tb",
93156
+ ...extended ? {
93157
+ "gnm:display-formulas": String(Boolean(Number(view2.DisplayFormulas ?? 0))),
93158
+ "gnm:display-col-header": String(!Number(view2.HideColHeader ?? 0)),
93159
+ "gnm:display-row-header": String(!Number(view2.HideRowHeader ?? 0)),
93160
+ "gnm:tab-color": originalProperties["tab-color"],
93161
+ "gnm:tab-text-color": originalProperties["tab-text-color"]
93162
+ } : {}
93163
+ })
93164
+ );
93042
93165
  const addresses = /* @__PURE__ */ new Map(), rowCells = /* @__PURE__ */ new Map();
93043
93166
  for (const cell of sheet.cells) {
93044
93167
  coordinate(cell.row, MAX_SHEET_SIZE.rows);
@@ -93317,7 +93440,8 @@ function createOdfWriter(profile) {
93317
93440
  if (pair.axis !== "row" && pair.axis !== "column") throw new SsconvertError("invalid-request", "Invalid OpenDocument label orientation");
93318
93441
  const dataSheet = pair.dataSheet === void 0 ? sheet : labelSheets.get(pair.dataSheet);
93319
93442
  if (!dataSheet) throw new SsconvertError("unsupported-feature", "OpenDocument label data sheet is not exported");
93320
- const address = (r, name5) => "$" + quoteFormulaString(name5, "'", odfGrammar) + "." + formatA1(r.startRow, r.startColumn) + ":." + formatA1(r.endRow, r.endColumn);
93443
+ const absolute = (row, column) => "$" + formatA1(0, column).slice(0, -1) + "$" + (row + 1);
93444
+ const address = (r, name5) => "$" + quoteFormulaString(name5, "'", odfGrammar) + "." + absolute(r.startRow, r.startColumn) + ":." + absolute(r.endRow, r.endColumn);
93321
93445
  labelRanges += e("table:label-range", {
93322
93446
  "table:label-cell-range-address": address(pair.labels, sheet.name),
93323
93447
  "table:data-cell-range-address": address(pair.data, dataSheet.name),
@@ -93333,8 +93457,8 @@ function createOdfWriter(profile) {
93333
93457
  parts.set(name5, encoder2.encode(value3));
93334
93458
  }
93335
93459
  part("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
93336
- part("content.xml", xml2.document("office:document-content", e("office:scripts") + e("office:font-face-decls") + e("office:automatic-styles", {}, automatic + cellStyles.styles.join("")) + e("office:body", {}, e("office:spreadsheet", {}, spreadsheet))));
93337
- part("styles.xml", xml2.document("office:document-styles", e("office:font-face-decls", {}, fontFaces) + e("office:styles", {}, styleBody) + e("office:automatic-styles", {}, pageLayouts) + e("office:master-styles", {}, masters)));
93460
+ part("content.xml", xml2.document("office:document-content", e("office:scripts") + e("office:font-face-decls") + e("office:automatic-styles", {}, definitions4.render("contentAutomatic") + automatic + cellStyles.styles.join("")) + e("office:body", {}, e("office:spreadsheet", {}, spreadsheet))));
93461
+ part("styles.xml", xml2.document("office:document-styles", e("office:font-face-decls", {}, definitions4.render("fonts")) + e("office:styles", {}, definitions4.render("styles")) + e("office:automatic-styles", {}, definitions4.render("stylesAutomatic")) + e("office:master-styles", {}, definitions4.render("masters"))));
93338
93462
  part("meta.xml", xml2.document("office:document-meta", e("office:meta", {}, e("meta:generator", {}, "Gnumeric/1.12.61"))));
93339
93463
  part("settings.xml", xml2.document("office:document-settings", e("office:settings", {}, e(
93340
93464
  "config:config-item-set",
@@ -164272,4 +164396,4 @@ tslib/tslib.js:
164272
164396
  @noble/ciphers/utils.js:
164273
164397
  (*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
164274
164398
  */
164275
- //# sourceMappingURL=chunk-3ZNXN3XO.js.map
164399
+ //# sourceMappingURL=chunk-MSEZFB2F.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-3ZNXN3XO.js";
84
+ } from "./chunk-MSEZFB2F.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-T2WAWJXF.js.map
174
+ //# sourceMappingURL=src-2MBSXQOA.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;