@poe-platform/safe-bash 0.1.746 → 0.1.747
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/safe-bash/chunks/{chunk-3ZNXN3XO.js → chunk-55AGFLG5.js} +118 -40
- package/dist/safe-bash/chunks/{src-T2WAWJXF.js → src-T672TQJC.js} +2 -2
- package/dist/safe-bash/core.browser.js +2 -1
- package/dist/safe-bash/shell/runtime.js +8 -1
- package/dist/safe-bash-command-ssconvert/index.js +114 -39
- package/package.json +2 -2
|
@@ -87252,7 +87252,7 @@ async function readLotus(bytes, context2) {
|
|
|
87252
87252
|
at += length;
|
|
87253
87253
|
if (id === 0) {
|
|
87254
87254
|
if (modern) {
|
|
87255
|
-
if (length >= 18) group = data4.u8(16);
|
|
87255
|
+
if (version2 >= 4098 && length >= 18) group = data4.u8(16);
|
|
87256
87256
|
} else {
|
|
87257
87257
|
active = sheets.length;
|
|
87258
87258
|
sheet(active);
|
|
@@ -91172,8 +91172,8 @@ init_platform();
|
|
|
91172
91172
|
var tableNamespaces = ["urn:oasis:names:tc:opendocument:xmlns:table:1.0", "http://openoffice.org/2000/table"];
|
|
91173
91173
|
function readOdfLabelRanges(parent, sheets, context2, charge) {
|
|
91174
91174
|
const byName = new Map(sheets.map((sheet) => {
|
|
91175
|
-
charge();
|
|
91176
|
-
return [sheet.name, sheet];
|
|
91175
|
+
charge(1 + sheet.name.length);
|
|
91176
|
+
return [foldSheetName(sheet.name), sheet];
|
|
91177
91177
|
}));
|
|
91178
91178
|
const ranges2 = /* @__PURE__ */ new Map();
|
|
91179
91179
|
const sizes = new Map(sheets.map((sheet) => {
|
|
@@ -91209,8 +91209,9 @@ function readOdfLabelRanges(parent, sheets, context2, charge) {
|
|
|
91209
91209
|
});
|
|
91210
91210
|
if (!parsed.ok || parsed.document.root.kind !== "reference") return invalid10();
|
|
91211
91211
|
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
|
-
|
|
91212
|
+
const sheet = first.sheet === void 0 ? void 0 : byName.get(foldSheetName(first.sheet));
|
|
91213
|
+
const lastSheet = last2.sheet === void 0 ? sheet : byName.get(foldSheetName(last2.sheet));
|
|
91214
|
+
if (!sheet || first.workbook !== void 0 || last2.workbook !== void 0 || lastSheet !== sheet || !first.row || !first.column || !last2.row || !last2.column) return invalid10();
|
|
91214
91215
|
const range5 = { startRow: first.row.value, endRow: last2.row.value, startColumn: first.column.value, endColumn: last2.column.value };
|
|
91215
91216
|
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
91217
|
return { sheet, range: range5 };
|
|
@@ -91561,8 +91562,8 @@ function createOdfStyles(xml2, extended, book, context2) {
|
|
|
91561
91562
|
}
|
|
91562
91563
|
return { register, styles };
|
|
91563
91564
|
}
|
|
91564
|
-
function
|
|
91565
|
-
const
|
|
91565
|
+
function odfPrintProperties(records, xml2, extended) {
|
|
91566
|
+
const properties = { "style:print": "charts drawings objects" };
|
|
91566
91567
|
for (const source of records) for (const n of odfChildren(source)) {
|
|
91567
91568
|
xml2.charge();
|
|
91568
91569
|
const v2 = odfObject(n), a3 = odfAttributes(n);
|
|
@@ -91580,10 +91581,83 @@ function odfPrintStyles(records, index2, xml2, extended) {
|
|
|
91580
91581
|
} else if (a3.percentage) properties["style:scale-to"] = a3.percentage + "%";
|
|
91581
91582
|
}
|
|
91582
91583
|
}
|
|
91583
|
-
return
|
|
91584
|
-
|
|
91585
|
-
|
|
91586
|
-
|
|
91584
|
+
return properties;
|
|
91585
|
+
}
|
|
91586
|
+
|
|
91587
|
+
// packages/safe-bash-command-ssconvert/src/codecs/odf-style-definitions.ts
|
|
91588
|
+
init_platform();
|
|
91589
|
+
function createOdfStyleDefinitions(book, xml2) {
|
|
91590
|
+
const sections = /* @__PURE__ */ new Map();
|
|
91591
|
+
const shapes2 = /* @__PURE__ */ new Map();
|
|
91592
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
91593
|
+
let anonymous = 0;
|
|
91594
|
+
for (const record7 of book.unsupportedRecords ?? []) {
|
|
91595
|
+
xml2.charge();
|
|
91596
|
+
if (record7.source !== "Gnumeric_OpenCalc:openoffice") continue;
|
|
91597
|
+
const data4 = odfObject(record7.data);
|
|
91598
|
+
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;
|
|
91599
|
+
if (!section) continue;
|
|
91600
|
+
let entries = sections.get(section);
|
|
91601
|
+
if (!entries) {
|
|
91602
|
+
entries = /* @__PURE__ */ new Map();
|
|
91603
|
+
sections.set(section, entries);
|
|
91604
|
+
}
|
|
91605
|
+
for (const child7 of odfChildren(data4?.xml)) {
|
|
91606
|
+
xml2.charge();
|
|
91607
|
+
const node3 = odfObject(child7), attributes4 = odfAttributes(child7, odfNamespaces.style);
|
|
91608
|
+
const key2 = attributes4.name ? JSON.stringify([node3?.namespace, node3?.name, attributes4.family ?? "", attributes4.name]) : "anonymous:" + anonymous++;
|
|
91609
|
+
entries.set(key2, child7);
|
|
91610
|
+
if (attributes4.name) names2.add(attributes4.name);
|
|
91611
|
+
}
|
|
91612
|
+
}
|
|
91613
|
+
for (const [section, entries] of sections) {
|
|
91614
|
+
const byShape = /* @__PURE__ */ new Map();
|
|
91615
|
+
shapes2.set(section, byShape);
|
|
91616
|
+
for (const child7 of entries.values()) {
|
|
91617
|
+
xml2.charge();
|
|
91618
|
+
const node3 = odfObject(child7), name5 = odfAttributes(child7, odfNamespaces.style).name;
|
|
91619
|
+
if (!node3 || !name5 || !Array.isArray(node3.attributes)) continue;
|
|
91620
|
+
const attributes4 = node3.attributes.filter((value3) => {
|
|
91621
|
+
xml2.charge();
|
|
91622
|
+
const attribute5 = odfObject(value3);
|
|
91623
|
+
return attribute5?.namespace !== odfNamespaces.style || attribute5?.name !== "name";
|
|
91624
|
+
});
|
|
91625
|
+
byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name5);
|
|
91626
|
+
}
|
|
91627
|
+
}
|
|
91628
|
+
function register(section, tag3, preferredName, attributes4, content2 = "") {
|
|
91629
|
+
const shape = xml2.element(tag3, attributes4, content2);
|
|
91630
|
+
let byShape = shapes2.get(section);
|
|
91631
|
+
const existing = byShape?.get(shape);
|
|
91632
|
+
if (existing !== void 0) return existing;
|
|
91633
|
+
let name5 = preferredName, suffix = 1;
|
|
91634
|
+
while (names2.has(name5)) {
|
|
91635
|
+
xml2.charge();
|
|
91636
|
+
name5 = preferredName + "_" + suffix++;
|
|
91637
|
+
}
|
|
91638
|
+
names2.add(name5);
|
|
91639
|
+
let entries = sections.get(section);
|
|
91640
|
+
if (!entries) {
|
|
91641
|
+
entries = /* @__PURE__ */ new Map();
|
|
91642
|
+
sections.set(section, entries);
|
|
91643
|
+
}
|
|
91644
|
+
entries.set("generated:" + name5, xml2.element(tag3, { "style:name": name5, ...attributes4 }, content2));
|
|
91645
|
+
if (!byShape) {
|
|
91646
|
+
byShape = /* @__PURE__ */ new Map();
|
|
91647
|
+
shapes2.set(section, byShape);
|
|
91648
|
+
}
|
|
91649
|
+
byShape.set(shape, name5);
|
|
91650
|
+
return name5;
|
|
91651
|
+
}
|
|
91652
|
+
function render(section) {
|
|
91653
|
+
let result2 = "";
|
|
91654
|
+
for (const value3 of sections.get(section)?.values() ?? []) {
|
|
91655
|
+
xml2.charge();
|
|
91656
|
+
result2 += typeof value3 === "string" ? value3 : xml2.retained(value3);
|
|
91657
|
+
}
|
|
91658
|
+
return result2;
|
|
91659
|
+
}
|
|
91660
|
+
return { register, render };
|
|
91587
91661
|
}
|
|
91588
91662
|
|
|
91589
91663
|
// packages/safe-bash-command-ssconvert/src/codecs/odf-function-names.ts
|
|
@@ -92428,7 +92502,8 @@ async function readOdf(bytes, context2) {
|
|
|
92428
92502
|
const dateSystem = attr5(children5(calculation, "null-date")[0], "date-value")?.startsWith("1904") ? "1904" : "1900";
|
|
92429
92503
|
const unsupportedRecords = [];
|
|
92430
92504
|
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))
|
|
92505
|
+
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))
|
|
92506
|
+
unsupportedRecords.push(record4(node3, { packagePart: r === preparseRoot ? "content.xml" : "styles.xml" }));
|
|
92432
92507
|
if (manifest) unsupportedRecords.push(record4(manifest));
|
|
92433
92508
|
for (const name5 of ["meta.xml", "settings.xml"]) if (pkg.entries.has(name5)) unsupportedRecords.push(record4(await pkg.document(name5)));
|
|
92434
92509
|
const resources = /* @__PURE__ */ new Set();
|
|
@@ -92736,6 +92811,8 @@ async function readOdf(bytes, context2) {
|
|
|
92736
92811
|
if (calculation) unsupportedRecords.push(record4(calculation));
|
|
92737
92812
|
if (!sheets.length) invalid4("no sheets");
|
|
92738
92813
|
const iteration = children5(calculation, "iteration")[0];
|
|
92814
|
+
const iterationMaximum = Number(attr5(iteration, "steps") ?? "100");
|
|
92815
|
+
if (!Number.isSafeInteger(iterationMaximum) || iterationMaximum < 0) invalid4("invalid iteration count");
|
|
92739
92816
|
const lookup4 = attr5(calculation, "automatic-find-labels");
|
|
92740
92817
|
if (lookup4 !== void 0 && !["true", "false"].includes(lookup4)) invalid4("invalid automatic label lookup setting");
|
|
92741
92818
|
const book = {
|
|
@@ -92747,7 +92824,7 @@ async function readOdf(bytes, context2) {
|
|
|
92747
92824
|
unsupportedRecords,
|
|
92748
92825
|
...iteration ? { iteration: {
|
|
92749
92826
|
enabled: attr5(iteration, "status") === "enable",
|
|
92750
|
-
maximum:
|
|
92827
|
+
maximum: iterationMaximum,
|
|
92751
92828
|
tolerance: Number(attr5(iteration, "maximum-difference") ?? "0.001")
|
|
92752
92829
|
} } : {}
|
|
92753
92830
|
};
|
|
@@ -93005,40 +93082,40 @@ function createOdfWriter(profile) {
|
|
|
93005
93082
|
"table:maximum-difference": iteration?.tolerance ?? 1e-3
|
|
93006
93083
|
})
|
|
93007
93084
|
);
|
|
93008
|
-
|
|
93085
|
+
const definitions4 = createOdfStyleDefinitions(book, xml2);
|
|
93086
|
+
let automatic = "", spreadsheet = "", validations = "", databaseRanges = "";
|
|
93009
93087
|
for (const record7 of book.unsupportedRecords ?? []) {
|
|
93010
93088
|
xml2.charge();
|
|
93011
93089
|
const v2 = odfObject(record7.data), node3 = odfObject(v2?.xml);
|
|
93012
93090
|
if (record7.source === "Gnumeric_OpenCalc:openoffice" && node3) {
|
|
93013
|
-
if (
|
|
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("");
|
|
93091
|
+
if (record7.kind === "content-validations") validations += odfChildren(node3).map((n) => xml2.retained(n)).join("");
|
|
93020
93092
|
else if (record7.kind === "database-ranges") databaseRanges += xml2.retained(node3);
|
|
93021
93093
|
}
|
|
93022
93094
|
}
|
|
93023
93095
|
for (const [index2, sheet] of book.sheets.entries()) {
|
|
93024
93096
|
xml2.charge();
|
|
93025
|
-
const sheetStyle = "ta" + index2;
|
|
93026
93097
|
const view2 = odfObject(sheet.view?.gnumeric) ?? {}, properties = odfChildren(sheet.view?.odf).find((n) => odfObject(n)?.name === "table-properties");
|
|
93027
93098
|
const originalProperties = odfAttributes(properties, odfNamespaces.gnm);
|
|
93028
|
-
const print =
|
|
93029
|
-
|
|
93030
|
-
|
|
93031
|
-
|
|
93032
|
-
"
|
|
93033
|
-
"style:
|
|
93034
|
-
|
|
93035
|
-
|
|
93036
|
-
|
|
93037
|
-
"
|
|
93038
|
-
"
|
|
93039
|
-
|
|
93040
|
-
|
|
93041
|
-
|
|
93099
|
+
const print = odfPrintProperties((sheet.unsupportedRecords ?? []).filter((r) => r.kind === "PrintInformation").flatMap((r) => r.data ? [r.data] : []), xml2, extended);
|
|
93100
|
+
const layoutName = definitions4.register("stylesAutomatic", "style:page-layout", "pl" + index2, {}, e("style:page-layout-properties", print));
|
|
93101
|
+
const masterName = definitions4.register("masters", "style:master-page", "mp" + index2, { "style:page-layout-name": layoutName });
|
|
93102
|
+
const sheetStyle = definitions4.register(
|
|
93103
|
+
"contentAutomatic",
|
|
93104
|
+
"style:style",
|
|
93105
|
+
"ta" + index2,
|
|
93106
|
+
{ "style:family": "table", "style:master-page-name": masterName },
|
|
93107
|
+
e("style:table-properties", {
|
|
93108
|
+
"table:display": sheet.visibility && sheet.visibility !== "visible" ? "false" : "true",
|
|
93109
|
+
"style:writing-mode": Number(view2.RTL_Layout ?? 0) ? "rl-tb" : "lr-tb",
|
|
93110
|
+
...extended ? {
|
|
93111
|
+
"gnm:display-formulas": String(Boolean(Number(view2.DisplayFormulas ?? 0))),
|
|
93112
|
+
"gnm:display-col-header": String(!Number(view2.HideColHeader ?? 0)),
|
|
93113
|
+
"gnm:display-row-header": String(!Number(view2.HideRowHeader ?? 0)),
|
|
93114
|
+
"gnm:tab-color": originalProperties["tab-color"],
|
|
93115
|
+
"gnm:tab-text-color": originalProperties["tab-text-color"]
|
|
93116
|
+
} : {}
|
|
93117
|
+
})
|
|
93118
|
+
);
|
|
93042
93119
|
const addresses = /* @__PURE__ */ new Map(), rowCells = /* @__PURE__ */ new Map();
|
|
93043
93120
|
for (const cell of sheet.cells) {
|
|
93044
93121
|
coordinate(cell.row, MAX_SHEET_SIZE.rows);
|
|
@@ -93317,7 +93394,8 @@ function createOdfWriter(profile) {
|
|
|
93317
93394
|
if (pair.axis !== "row" && pair.axis !== "column") throw new SsconvertError("invalid-request", "Invalid OpenDocument label orientation");
|
|
93318
93395
|
const dataSheet = pair.dataSheet === void 0 ? sheet : labelSheets.get(pair.dataSheet);
|
|
93319
93396
|
if (!dataSheet) throw new SsconvertError("unsupported-feature", "OpenDocument label data sheet is not exported");
|
|
93320
|
-
const
|
|
93397
|
+
const absolute = (row, column) => "$" + formatA1(0, column).slice(0, -1) + "$" + (row + 1);
|
|
93398
|
+
const address = (r, name5) => "$" + quoteFormulaString(name5, "'", odfGrammar) + "." + absolute(r.startRow, r.startColumn) + ":." + absolute(r.endRow, r.endColumn);
|
|
93321
93399
|
labelRanges += e("table:label-range", {
|
|
93322
93400
|
"table:label-cell-range-address": address(pair.labels, sheet.name),
|
|
93323
93401
|
"table:data-cell-range-address": address(pair.data, dataSheet.name),
|
|
@@ -93333,8 +93411,8 @@ function createOdfWriter(profile) {
|
|
|
93333
93411
|
parts.set(name5, encoder2.encode(value3));
|
|
93334
93412
|
}
|
|
93335
93413
|
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", {},
|
|
93414
|
+
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))));
|
|
93415
|
+
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
93416
|
part("meta.xml", xml2.document("office:document-meta", e("office:meta", {}, e("meta:generator", {}, "Gnumeric/1.12.61"))));
|
|
93339
93417
|
part("settings.xml", xml2.document("office:document-settings", e("office:settings", {}, e(
|
|
93340
93418
|
"config:config-item-set",
|
|
@@ -164272,4 +164350,4 @@ tslib/tslib.js:
|
|
|
164272
164350
|
@noble/ciphers/utils.js:
|
|
164273
164351
|
(*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) *)
|
|
164274
164352
|
*/
|
|
164275
|
-
//# sourceMappingURL=chunk-
|
|
164353
|
+
//# sourceMappingURL=chunk-55AGFLG5.js.map
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
updateWorkbook,
|
|
82
82
|
validSheetSize,
|
|
83
83
|
visitFormula
|
|
84
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-55AGFLG5.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-
|
|
174
|
+
//# sourceMappingURL=src-T672TQJC.js.map
|
|
@@ -91604,6 +91604,7 @@ ${prefix3} line ${offset + line}: \`${source2.split("\n")[line - 1] ?? ""}'
|
|
|
91604
91604
|
const isExtended = mode.includes("E");
|
|
91605
91605
|
const isFixed = mode.includes("F");
|
|
91606
91606
|
const isOnlyMatching = mode.includes("o");
|
|
91607
|
+
if (isExtended && !isFixed && rawPatterns.some((pattern) => pattern.includes("[:") || pattern.includes("[.") || pattern.includes("[="))) return void 0;
|
|
91607
91608
|
if (isCount && (isLineNumber || isOnlyMatching || beforeCtx > 0 || afterCtx > 0)) return void 0;
|
|
91608
91609
|
if (isOnlyMatching && (beforeCtx > 0 || afterCtx > 0)) return void 0;
|
|
91609
91610
|
if (isOnlyMatching) {
|
|
@@ -91611,7 +91612,7 @@ ${prefix3} line ${offset + line}: \`${source2.split("\n")[line - 1] ?? ""}'
|
|
|
91611
91612
|
const pat = rawPatterns[0];
|
|
91612
91613
|
const reFlags = isCaseInsensitive ? "gi" : "g";
|
|
91613
91614
|
let re;
|
|
91614
|
-
if (isExtended && /^[a-zA-Z0-9_
|
|
91615
|
+
if (isExtended && !pat.includes("|") && /^[a-zA-Z0-9_ :;,=.+*?()^\-[\]]+$/.test(pat) && !/\([^)]*[+*][^)]*\)[+*?]/.test(pat)) {
|
|
91615
91616
|
try {
|
|
91616
91617
|
re = new RegExp(pat, reFlags);
|
|
91617
91618
|
} catch {
|
|
@@ -28599,6 +28599,10 @@ export class Runtime {
|
|
|
28599
28599
|
const isExtended = mode.includes("E");
|
|
28600
28600
|
const isFixed = mode.includes("F");
|
|
28601
28601
|
const isOnlyMatching = mode.includes("o");
|
|
28602
|
+
// POSIX bracket classes, collating symbols and equivalence classes have
|
|
28603
|
+
// different meanings in JS RegExp. Let the command matcher parse them.
|
|
28604
|
+
if (isExtended && !isFixed && rawPatterns.some(pattern => pattern.includes("[:") || pattern.includes("[.") || pattern.includes("[=")))
|
|
28605
|
+
return undefined;
|
|
28602
28606
|
if (isCount && (isLineNumber || isOnlyMatching || beforeCtx > 0 || afterCtx > 0))
|
|
28603
28607
|
return undefined;
|
|
28604
28608
|
if (isOnlyMatching && (beforeCtx > 0 || afterCtx > 0))
|
|
@@ -28609,7 +28613,10 @@ export class Runtime {
|
|
|
28609
28613
|
const pat = rawPatterns[0];
|
|
28610
28614
|
const reFlags = isCaseInsensitive ? "gi" : "g";
|
|
28611
28615
|
let re;
|
|
28612
|
-
|
|
28616
|
+
// JS alternatives are ordered; only literal alternatives below can be
|
|
28617
|
+
// sorted to implement grep's leftmost-longest choice. Other alternatives
|
|
28618
|
+
// use the command's POSIX matcher through the normal fallback.
|
|
28619
|
+
if (isExtended && !pat.includes("|") && /^[a-zA-Z0-9_ :;,=.+*?()^\-[\]]+$/.test(pat) && !/\([^)]*[+*][^)]*\)[+*?]/.test(pat)) {
|
|
28613
28620
|
try {
|
|
28614
28621
|
re = new RegExp(pat, reFlags);
|
|
28615
28622
|
}
|
|
@@ -140355,7 +140355,7 @@ async function readLotus(bytes, context) {
|
|
|
140355
140355
|
at += length;
|
|
140356
140356
|
if (id === 0) {
|
|
140357
140357
|
if (modern) {
|
|
140358
|
-
if (length >= 18) group = data3.u8(16);
|
|
140358
|
+
if (version >= 4098 && length >= 18) group = data3.u8(16);
|
|
140359
140359
|
} else {
|
|
140360
140360
|
active = sheets.length;
|
|
140361
140361
|
sheet(active);
|
|
@@ -144349,8 +144349,8 @@ function odfDatabaseRanges(spreadsheet, sheetName2, charge) {
|
|
|
144349
144349
|
var tableNamespaces = ["urn:oasis:names:tc:opendocument:xmlns:table:1.0", "http://openoffice.org/2000/table"];
|
|
144350
144350
|
function readOdfLabelRanges(parent, sheets, context, charge) {
|
|
144351
144351
|
const byName = new Map(sheets.map((sheet) => {
|
|
144352
|
-
charge();
|
|
144353
|
-
return [sheet.name, sheet];
|
|
144352
|
+
charge(1 + sheet.name.length);
|
|
144353
|
+
return [foldSheetName(sheet.name), sheet];
|
|
144354
144354
|
}));
|
|
144355
144355
|
const ranges2 = /* @__PURE__ */ new Map();
|
|
144356
144356
|
const sizes = new Map(sheets.map((sheet) => {
|
|
@@ -144386,8 +144386,9 @@ function readOdfLabelRanges(parent, sheets, context, charge) {
|
|
|
144386
144386
|
});
|
|
144387
144387
|
if (!parsed.ok || parsed.document.root.kind !== "reference") return invalid10();
|
|
144388
144388
|
const first = parsed.document.root.first, last = parsed.document.root.last ?? first;
|
|
144389
|
-
const sheet = first.sheet === void 0 ? void 0 : byName.get(first.sheet);
|
|
144390
|
-
|
|
144389
|
+
const sheet = first.sheet === void 0 ? void 0 : byName.get(foldSheetName(first.sheet));
|
|
144390
|
+
const lastSheet = last.sheet === void 0 ? sheet : byName.get(foldSheetName(last.sheet));
|
|
144391
|
+
if (!sheet || first.workbook !== void 0 || last.workbook !== void 0 || lastSheet !== sheet || !first.row || !first.column || !last.row || !last.column) return invalid10();
|
|
144391
144392
|
const range3 = { startRow: first.row.value, endRow: last.row.value, startColumn: first.column.value, endColumn: last.column.value };
|
|
144392
144393
|
if (Object.values(range3).some((value3) => !Number.isSafeInteger(value3) || value3 < 0) || range3.startRow > range3.endRow || range3.startColumn > range3.endColumn || range3.endRow >= MAX_SHEET_SIZE.rows || range3.endColumn >= MAX_SHEET_SIZE.columns) return invalid10();
|
|
144393
144394
|
return { sheet, range: range3 };
|
|
@@ -144732,8 +144733,8 @@ function createOdfStyles(xml2, extended, book, context) {
|
|
|
144732
144733
|
}
|
|
144733
144734
|
return { register, styles };
|
|
144734
144735
|
}
|
|
144735
|
-
function
|
|
144736
|
-
const
|
|
144736
|
+
function odfPrintProperties(records, xml2, extended) {
|
|
144737
|
+
const properties = { "style:print": "charts drawings objects" };
|
|
144737
144738
|
for (const source of records) for (const n of odfChildren(source)) {
|
|
144738
144739
|
xml2.charge();
|
|
144739
144740
|
const v = odfObject(n), a3 = odfAttributes(n);
|
|
@@ -144751,10 +144752,80 @@ function odfPrintStyles(records, index2, xml2, extended) {
|
|
|
144751
144752
|
} else if (a3.percentage) properties["style:scale-to"] = a3.percentage + "%";
|
|
144752
144753
|
}
|
|
144753
144754
|
}
|
|
144754
|
-
return
|
|
144755
|
-
|
|
144756
|
-
|
|
144757
|
-
|
|
144755
|
+
return properties;
|
|
144756
|
+
}
|
|
144757
|
+
function createOdfStyleDefinitions(book, xml2) {
|
|
144758
|
+
const sections = /* @__PURE__ */ new Map();
|
|
144759
|
+
const shapes2 = /* @__PURE__ */ new Map();
|
|
144760
|
+
const names2 = /* @__PURE__ */ new Set();
|
|
144761
|
+
let anonymous = 0;
|
|
144762
|
+
for (const record7 of book.unsupportedRecords ?? []) {
|
|
144763
|
+
xml2.charge();
|
|
144764
|
+
if (record7.source !== "Gnumeric_OpenCalc:openoffice") continue;
|
|
144765
|
+
const data3 = odfObject(record7.data);
|
|
144766
|
+
const section = record7.kind === "automatic-styles" ? data3?.packagePart === "styles.xml" ? "stylesAutomatic" : "contentAutomatic" : record7.kind === "master-styles" ? "masters" : record7.kind === "font-face-decls" ? "fonts" : record7.kind === "styles" ? "styles" : void 0;
|
|
144767
|
+
if (!section) continue;
|
|
144768
|
+
let entries = sections.get(section);
|
|
144769
|
+
if (!entries) {
|
|
144770
|
+
entries = /* @__PURE__ */ new Map();
|
|
144771
|
+
sections.set(section, entries);
|
|
144772
|
+
}
|
|
144773
|
+
for (const child7 of odfChildren(data3?.xml)) {
|
|
144774
|
+
xml2.charge();
|
|
144775
|
+
const node3 = odfObject(child7), attributes4 = odfAttributes(child7, odfNamespaces.style);
|
|
144776
|
+
const key = attributes4.name ? JSON.stringify([node3?.namespace, node3?.name, attributes4.family ?? "", attributes4.name]) : "anonymous:" + anonymous++;
|
|
144777
|
+
entries.set(key, child7);
|
|
144778
|
+
if (attributes4.name) names2.add(attributes4.name);
|
|
144779
|
+
}
|
|
144780
|
+
}
|
|
144781
|
+
for (const [section, entries] of sections) {
|
|
144782
|
+
const byShape = /* @__PURE__ */ new Map();
|
|
144783
|
+
shapes2.set(section, byShape);
|
|
144784
|
+
for (const child7 of entries.values()) {
|
|
144785
|
+
xml2.charge();
|
|
144786
|
+
const node3 = odfObject(child7), name = odfAttributes(child7, odfNamespaces.style).name;
|
|
144787
|
+
if (!node3 || !name || !Array.isArray(node3.attributes)) continue;
|
|
144788
|
+
const attributes4 = node3.attributes.filter((value3) => {
|
|
144789
|
+
xml2.charge();
|
|
144790
|
+
const attribute5 = odfObject(value3);
|
|
144791
|
+
return attribute5?.namespace !== odfNamespaces.style || attribute5?.name !== "name";
|
|
144792
|
+
});
|
|
144793
|
+
byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name);
|
|
144794
|
+
}
|
|
144795
|
+
}
|
|
144796
|
+
function register(section, tag, preferredName, attributes4, content2 = "") {
|
|
144797
|
+
const shape = xml2.element(tag, attributes4, content2);
|
|
144798
|
+
let byShape = shapes2.get(section);
|
|
144799
|
+
const existing = byShape?.get(shape);
|
|
144800
|
+
if (existing !== void 0) return existing;
|
|
144801
|
+
let name = preferredName, suffix = 1;
|
|
144802
|
+
while (names2.has(name)) {
|
|
144803
|
+
xml2.charge();
|
|
144804
|
+
name = preferredName + "_" + suffix++;
|
|
144805
|
+
}
|
|
144806
|
+
names2.add(name);
|
|
144807
|
+
let entries = sections.get(section);
|
|
144808
|
+
if (!entries) {
|
|
144809
|
+
entries = /* @__PURE__ */ new Map();
|
|
144810
|
+
sections.set(section, entries);
|
|
144811
|
+
}
|
|
144812
|
+
entries.set("generated:" + name, xml2.element(tag, { "style:name": name, ...attributes4 }, content2));
|
|
144813
|
+
if (!byShape) {
|
|
144814
|
+
byShape = /* @__PURE__ */ new Map();
|
|
144815
|
+
shapes2.set(section, byShape);
|
|
144816
|
+
}
|
|
144817
|
+
byShape.set(shape, name);
|
|
144818
|
+
return name;
|
|
144819
|
+
}
|
|
144820
|
+
function render(section) {
|
|
144821
|
+
let result2 = "";
|
|
144822
|
+
for (const value3 of sections.get(section)?.values() ?? []) {
|
|
144823
|
+
xml2.charge();
|
|
144824
|
+
result2 += typeof value3 === "string" ? value3 : xml2.retained(value3);
|
|
144825
|
+
}
|
|
144826
|
+
return result2;
|
|
144827
|
+
}
|
|
144828
|
+
return { register, render };
|
|
144758
144829
|
}
|
|
144759
144830
|
var odfWriterFunctionNames = Object.freeze({
|
|
144760
144831
|
"ABS": "ABS",
|
|
@@ -145591,7 +145662,8 @@ async function readOdf(bytes, context) {
|
|
|
145591
145662
|
const dateSystem = attr5(children5(calculation, "null-date")[0], "date-value")?.startsWith("1904") ? "1904" : "1900";
|
|
145592
145663
|
const unsupportedRecords = [];
|
|
145593
145664
|
const styles = readStyles(styleRoots, pkg.charge);
|
|
145594
|
-
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))
|
|
145665
|
+
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))
|
|
145666
|
+
unsupportedRecords.push(record4(node3, { packagePart: r === preparseRoot ? "content.xml" : "styles.xml" }));
|
|
145595
145667
|
if (manifest) unsupportedRecords.push(record4(manifest));
|
|
145596
145668
|
for (const name of ["meta.xml", "settings.xml"]) if (pkg.entries.has(name)) unsupportedRecords.push(record4(await pkg.document(name)));
|
|
145597
145669
|
const resources = /* @__PURE__ */ new Set();
|
|
@@ -145899,6 +145971,8 @@ async function readOdf(bytes, context) {
|
|
|
145899
145971
|
if (calculation) unsupportedRecords.push(record4(calculation));
|
|
145900
145972
|
if (!sheets.length) invalid4("no sheets");
|
|
145901
145973
|
const iteration = children5(calculation, "iteration")[0];
|
|
145974
|
+
const iterationMaximum = Number(attr5(iteration, "steps") ?? "100");
|
|
145975
|
+
if (!Number.isSafeInteger(iterationMaximum) || iterationMaximum < 0) invalid4("invalid iteration count");
|
|
145902
145976
|
const lookup = attr5(calculation, "automatic-find-labels");
|
|
145903
145977
|
if (lookup !== void 0 && !["true", "false"].includes(lookup)) invalid4("invalid automatic label lookup setting");
|
|
145904
145978
|
const book = {
|
|
@@ -145910,7 +145984,7 @@ async function readOdf(bytes, context) {
|
|
|
145910
145984
|
unsupportedRecords,
|
|
145911
145985
|
...iteration ? { iteration: {
|
|
145912
145986
|
enabled: attr5(iteration, "status") === "enable",
|
|
145913
|
-
maximum:
|
|
145987
|
+
maximum: iterationMaximum,
|
|
145914
145988
|
tolerance: Number(attr5(iteration, "maximum-difference") ?? "0.001")
|
|
145915
145989
|
} } : {}
|
|
145916
145990
|
};
|
|
@@ -146168,40 +146242,40 @@ function createOdfWriter(profile) {
|
|
|
146168
146242
|
"table:maximum-difference": iteration?.tolerance ?? 1e-3
|
|
146169
146243
|
})
|
|
146170
146244
|
);
|
|
146171
|
-
|
|
146245
|
+
const definitions4 = createOdfStyleDefinitions(book, xml2);
|
|
146246
|
+
let automatic = "", spreadsheet = "", validations = "", databaseRanges = "";
|
|
146172
146247
|
for (const record7 of book.unsupportedRecords ?? []) {
|
|
146173
146248
|
xml2.charge();
|
|
146174
146249
|
const v = odfObject(record7.data), node3 = odfObject(v?.xml);
|
|
146175
146250
|
if (record7.source === "Gnumeric_OpenCalc:openoffice" && node3) {
|
|
146176
|
-
if (
|
|
146177
|
-
const content2 = odfChildren(node3).map((n) => xml2.retained(n)).join("");
|
|
146178
|
-
if (record7.kind === "automatic-styles") automatic += content2;
|
|
146179
|
-
else if (record7.kind === "master-styles") masters += content2;
|
|
146180
|
-
else if (record7.kind === "font-face-decls") fontFaces += content2;
|
|
146181
|
-
else styleBody += content2;
|
|
146182
|
-
} else if (record7.kind === "content-validations") validations += odfChildren(node3).map((n) => xml2.retained(n)).join("");
|
|
146251
|
+
if (record7.kind === "content-validations") validations += odfChildren(node3).map((n) => xml2.retained(n)).join("");
|
|
146183
146252
|
else if (record7.kind === "database-ranges") databaseRanges += xml2.retained(node3);
|
|
146184
146253
|
}
|
|
146185
146254
|
}
|
|
146186
146255
|
for (const [index2, sheet] of book.sheets.entries()) {
|
|
146187
146256
|
xml2.charge();
|
|
146188
|
-
const sheetStyle = "ta" + index2;
|
|
146189
146257
|
const view2 = odfObject(sheet.view?.gnumeric) ?? {}, properties = odfChildren(sheet.view?.odf).find((n) => odfObject(n)?.name === "table-properties");
|
|
146190
146258
|
const originalProperties = odfAttributes(properties, odfNamespaces.gnm);
|
|
146191
|
-
const print =
|
|
146192
|
-
|
|
146193
|
-
|
|
146194
|
-
|
|
146195
|
-
"
|
|
146196
|
-
"style:
|
|
146197
|
-
|
|
146198
|
-
|
|
146199
|
-
|
|
146200
|
-
"
|
|
146201
|
-
"
|
|
146202
|
-
|
|
146203
|
-
|
|
146204
|
-
|
|
146259
|
+
const print = odfPrintProperties((sheet.unsupportedRecords ?? []).filter((r) => r.kind === "PrintInformation").flatMap((r) => r.data ? [r.data] : []), xml2, extended);
|
|
146260
|
+
const layoutName = definitions4.register("stylesAutomatic", "style:page-layout", "pl" + index2, {}, e("style:page-layout-properties", print));
|
|
146261
|
+
const masterName = definitions4.register("masters", "style:master-page", "mp" + index2, { "style:page-layout-name": layoutName });
|
|
146262
|
+
const sheetStyle = definitions4.register(
|
|
146263
|
+
"contentAutomatic",
|
|
146264
|
+
"style:style",
|
|
146265
|
+
"ta" + index2,
|
|
146266
|
+
{ "style:family": "table", "style:master-page-name": masterName },
|
|
146267
|
+
e("style:table-properties", {
|
|
146268
|
+
"table:display": sheet.visibility && sheet.visibility !== "visible" ? "false" : "true",
|
|
146269
|
+
"style:writing-mode": Number(view2.RTL_Layout ?? 0) ? "rl-tb" : "lr-tb",
|
|
146270
|
+
...extended ? {
|
|
146271
|
+
"gnm:display-formulas": String(Boolean(Number(view2.DisplayFormulas ?? 0))),
|
|
146272
|
+
"gnm:display-col-header": String(!Number(view2.HideColHeader ?? 0)),
|
|
146273
|
+
"gnm:display-row-header": String(!Number(view2.HideRowHeader ?? 0)),
|
|
146274
|
+
"gnm:tab-color": originalProperties["tab-color"],
|
|
146275
|
+
"gnm:tab-text-color": originalProperties["tab-text-color"]
|
|
146276
|
+
} : {}
|
|
146277
|
+
})
|
|
146278
|
+
);
|
|
146205
146279
|
const addresses = /* @__PURE__ */ new Map(), rowCells = /* @__PURE__ */ new Map();
|
|
146206
146280
|
for (const cell of sheet.cells) {
|
|
146207
146281
|
coordinate(cell.row, MAX_SHEET_SIZE.rows);
|
|
@@ -146480,7 +146554,8 @@ function createOdfWriter(profile) {
|
|
|
146480
146554
|
if (pair.axis !== "row" && pair.axis !== "column") throw new SsconvertError("invalid-request", "Invalid OpenDocument label orientation");
|
|
146481
146555
|
const dataSheet = pair.dataSheet === void 0 ? sheet : labelSheets.get(pair.dataSheet);
|
|
146482
146556
|
if (!dataSheet) throw new SsconvertError("unsupported-feature", "OpenDocument label data sheet is not exported");
|
|
146483
|
-
const
|
|
146557
|
+
const absolute = (row, column) => "$" + formatA1(0, column).slice(0, -1) + "$" + (row + 1);
|
|
146558
|
+
const address = (r, name) => "$" + quoteFormulaString(name, "'", odfGrammar) + "." + absolute(r.startRow, r.startColumn) + ":." + absolute(r.endRow, r.endColumn);
|
|
146484
146559
|
labelRanges += e("table:label-range", {
|
|
146485
146560
|
"table:label-cell-range-address": address(pair.labels, sheet.name),
|
|
146486
146561
|
"table:data-cell-range-address": address(pair.data, dataSheet.name),
|
|
@@ -146496,8 +146571,8 @@ function createOdfWriter(profile) {
|
|
|
146496
146571
|
parts.set(name, encoder3.encode(value3));
|
|
146497
146572
|
}
|
|
146498
146573
|
part("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
|
|
146499
|
-
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))));
|
|
146500
|
-
part("styles.xml", xml2.document("office:document-styles", e("office:font-face-decls", {},
|
|
146574
|
+
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))));
|
|
146575
|
+
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"))));
|
|
146501
146576
|
part("meta.xml", xml2.document("office:document-meta", e("office:meta", {}, e("meta:generator", {}, "Gnumeric/1.12.61"))));
|
|
146502
146577
|
part("settings.xml", xml2.document("office:document-settings", e("office:settings", {}, e(
|
|
146503
146578
|
"config:config-item-set",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@poe-platform/safe-bash",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.747",
|
|
4
4
|
"description": "Extensible virtual shell with pluggable filesystems and streaming commands",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -645,7 +645,7 @@
|
|
|
645
645
|
"access": "public"
|
|
646
646
|
},
|
|
647
647
|
"dependencies": {
|
|
648
|
-
"@poe-platform/safe-fs": "0.1.
|
|
648
|
+
"@poe-platform/safe-fs": "0.1.747",
|
|
649
649
|
"pdf-lib": "1.17.1",
|
|
650
650
|
"@types/node": "^25.2.2",
|
|
651
651
|
"pako": "3.0.1",
|