@poe-platform/safe-bash 0.1.754 → 0.1.756
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/image-ast/index.browser.js +39 -3
- package/dist/image-ast/index.js +39 -3
- package/dist/pdf-ast/canvas.d.ts +1 -0
- package/dist/pdf-ast/fonts/truetype.d.ts +1 -0
- package/dist/pdf-ast/index.js +39 -3
- package/dist/safe-bash/chunks/{chunk-3W6CRM25.js → chunk-CBVANNKK.js} +553 -289
- package/dist/safe-bash/chunks/{chunk-R2WG64VB.js → chunk-JCN3FXLP.js} +40 -4
- package/dist/safe-bash/chunks/{chunk-WNB4XH45.js → chunk-OSUXMC43.js} +3 -3
- package/dist/safe-bash/chunks/{chunk-37Y7GZTK.js → chunk-RSAWYAEH.js} +2 -2
- package/dist/safe-bash/chunks/{pdf-renderer-DHQDZC6N.js → pdf-renderer-CMF3CSVU.js} +3 -3
- package/dist/safe-bash/chunks/{src-S52LORVD.js → src-MXIKQCIC.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-IJHV6I6X.js → chunk-3DOHQQJR.js} +8 -6
- package/dist/safe-bash/command-chunks/{chunk-PUOJAS3O.js → chunk-H2FQA4OU.js} +39 -3
- package/dist/safe-bash/command-chunks/chunk-IDR3WWKI.js +46 -0
- package/dist/safe-bash/command-chunks/{chunk-XAZ3NTJ4.js → chunk-KBBI4CSU.js} +2 -2
- package/dist/safe-bash/command-chunks/{chunk-YY7HJMBG.js → chunk-KOM3FNCE.js} +1 -37
- package/dist/safe-bash/command-chunks/chunk-QQOAK7JQ.js +888 -0
- package/dist/safe-bash/command-chunks/{chunk-BE4AM2JW.js → chunk-UGX6MXDD.js} +5 -3
- package/dist/safe-bash/command-chunks/{chunk-CM4SVTIA.js → chunk-WI35236J.js} +1 -1
- package/dist/safe-bash/commands/ssconvert/index.d.ts +1 -2
- package/dist/safe-bash/commands/ssconvert/index.js +6 -260
- package/dist/safe-bash/core.browser.js +5 -207
- package/dist/safe-bash-command-csvkit/index.js +277 -49
- package/dist/safe-bash-command-ffmpeg/index.js +1741 -1717
- package/dist/safe-bash-command-imagemagick/index.js +2 -2
- package/dist/safe-bash-command-pandoc/command.js +3 -3
- package/dist/safe-bash-command-pandoc/index.js +3 -3
- package/dist/safe-bash-command-pdfimages/index.js +39 -3
- package/dist/safe-bash-command-pdfinfo/index.js +39 -3
- package/dist/safe-bash-command-pdftk/index.js +39 -3
- package/dist/safe-bash-command-pdftoppm/index.js +39 -3
- package/dist/safe-bash-command-pdftotext/index.js +39 -3
- package/dist/safe-bash-command-qpdf/index.js +39 -3
- package/dist/safe-bash-command-sips/index.js +2 -2
- package/dist/safe-bash-command-soffice/index.js +5 -4
- package/dist/safe-bash-command-ssconvert/formats/csv.js +4 -3
- package/dist/safe-bash-command-ssconvert/formats/spreadsheetml.js +4 -2
- package/dist/safe-bash-command-ssconvert/formats/xls.js +10 -666
- package/dist/safe-bash-command-ssconvert/index.d.ts +1 -0
- package/dist/safe-bash-command-ssconvert/index.js +706 -392
- package/dist/safe-bash-command-ssconvert/sync.d.ts +7 -0
- package/dist/safe-bash-command-timeout/index.js +1 -1
- package/dist/safe-bash-command-wkhtmltopdf/index.js +39 -3
- package/dist/spreadsheet-format-csv/text-export.d.ts +14 -0
- package/dist/spreadsheet-format-csv/text-export.js +2 -2
- package/dist/spreadsheet-format-xls/biff-binary.d.ts +7 -2
- package/dist/spreadsheet-format-xls/biff-binary.js +10 -1
- package/dist/spreadsheet-format-xls/biff-strings.d.ts +2 -3
- package/dist/spreadsheet-format-xls/biff-strings.js +14 -2
- package/package.json +2 -3
- package/third-party/pdf-ast/THIRD_PARTY_NOTICES.md +8 -1
- package/dist/safe-bash/command-chunks/chunk-MPUNHXWI.js +0 -205
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
import { builtInDirectContextExecutors } from "../safe-bash-contracts/runtime-control.js";
|
|
19
19
|
import { shellValueByteLength } from "../safe-bash-contracts/value.js";
|
|
20
20
|
import { writeFileOutput } from "../safe-bash-contracts/filesystem-output.js";
|
|
21
|
+
import { builtInDirectContextExecutors as builtInDirectContextExecutors2 } from "../safe-bash-contracts/runtime-control.js";
|
|
22
|
+
import { parseXml } from "@poe-platform/safe-fs/xml";
|
|
21
23
|
var __create = Object.create;
|
|
22
24
|
var __defProp = Object.defineProperty;
|
|
23
25
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -11813,12 +11815,12 @@ var require_PDFPageLeaf = __commonJS({
|
|
|
11813
11815
|
return this.context.lookupMaybe(numberOrRef, PDFNumber_1.default);
|
|
11814
11816
|
};
|
|
11815
11817
|
PDFPageLeaf2.prototype.getInheritableAttribute = function(name) {
|
|
11816
|
-
var
|
|
11818
|
+
var attribute7;
|
|
11817
11819
|
this.ascend(function(node3) {
|
|
11818
|
-
if (!
|
|
11819
|
-
|
|
11820
|
+
if (!attribute7)
|
|
11821
|
+
attribute7 = node3.get(name);
|
|
11820
11822
|
});
|
|
11821
|
-
return
|
|
11823
|
+
return attribute7;
|
|
11822
11824
|
};
|
|
11823
11825
|
PDFPageLeaf2.prototype.setParent = function(parentRef) {
|
|
11824
11826
|
this.set(PDFName_1.default.Parent, parentRef);
|
|
@@ -21529,12 +21531,12 @@ var require_PDFAcroField = __commonJS({
|
|
|
21529
21531
|
this.clearFlag(flag);
|
|
21530
21532
|
};
|
|
21531
21533
|
PDFAcroField2.prototype.getInheritableAttribute = function(name) {
|
|
21532
|
-
var
|
|
21534
|
+
var attribute7;
|
|
21533
21535
|
this.ascend(function(node3) {
|
|
21534
|
-
if (!
|
|
21535
|
-
|
|
21536
|
+
if (!attribute7)
|
|
21537
|
+
attribute7 = node3.dict.get(name);
|
|
21536
21538
|
});
|
|
21537
|
-
return
|
|
21539
|
+
return attribute7;
|
|
21538
21540
|
};
|
|
21539
21541
|
PDFAcroField2.prototype.ascend = function(visitor) {
|
|
21540
21542
|
visitor(this);
|
|
@@ -22730,12 +22732,12 @@ var require_utils3 = __commonJS({
|
|
|
22730
22732
|
return (flags & flag) !== 0;
|
|
22731
22733
|
};
|
|
22732
22734
|
var getInheritableAttribute = function(startNode, name) {
|
|
22733
|
-
var
|
|
22735
|
+
var attribute7;
|
|
22734
22736
|
ascend(startNode, function(node3) {
|
|
22735
|
-
if (!
|
|
22736
|
-
|
|
22737
|
+
if (!attribute7)
|
|
22738
|
+
attribute7 = node3.get(name);
|
|
22737
22739
|
});
|
|
22738
|
-
return
|
|
22740
|
+
return attribute7;
|
|
22739
22741
|
};
|
|
22740
22742
|
var ascend = function(startNode, visitor) {
|
|
22741
22743
|
visitor(startNode);
|
|
@@ -24825,7 +24827,7 @@ var require_svgPath = __commonJS({
|
|
|
24825
24827
|
["Z", 0],
|
|
24826
24828
|
["z", 0]
|
|
24827
24829
|
]);
|
|
24828
|
-
var
|
|
24830
|
+
var parse3 = function(path2) {
|
|
24829
24831
|
var cmd;
|
|
24830
24832
|
var ret = [];
|
|
24831
24833
|
var args = [];
|
|
@@ -25147,7 +25149,7 @@ var require_svgPath = __commonJS({
|
|
|
25147
25149
|
return result2;
|
|
25148
25150
|
};
|
|
25149
25151
|
exports.svgPathToOperators = function(path2) {
|
|
25150
|
-
return apply(
|
|
25152
|
+
return apply(parse3(path2));
|
|
25151
25153
|
};
|
|
25152
25154
|
}
|
|
25153
25155
|
});
|
|
@@ -33931,8 +33933,8 @@ var require_fontkit_umd = __commonJS({
|
|
|
33931
33933
|
var safer_1 = safer;
|
|
33932
33934
|
var BOMChar = "\uFEFF";
|
|
33933
33935
|
var PrependBOM = PrependBOMWrapper;
|
|
33934
|
-
function PrependBOMWrapper(
|
|
33935
|
-
this.encoder =
|
|
33936
|
+
function PrependBOMWrapper(encoder4, options) {
|
|
33937
|
+
this.encoder = encoder4;
|
|
33936
33938
|
this.addBOM = true;
|
|
33937
33939
|
}
|
|
33938
33940
|
PrependBOMWrapper.prototype.write = function(str2) {
|
|
@@ -33946,8 +33948,8 @@ var require_fontkit_umd = __commonJS({
|
|
|
33946
33948
|
return this.encoder.end();
|
|
33947
33949
|
};
|
|
33948
33950
|
var StripBOM = StripBOMWrapper;
|
|
33949
|
-
function StripBOMWrapper(
|
|
33950
|
-
this.decoder =
|
|
33951
|
+
function StripBOMWrapper(decoder2, options) {
|
|
33952
|
+
this.decoder = decoder2;
|
|
33951
33953
|
this.pass = false;
|
|
33952
33954
|
this.options = options || {};
|
|
33953
33955
|
}
|
|
@@ -44164,9 +44166,9 @@ var require_fontkit_umd = __commonJS({
|
|
|
44164
44166
|
iconv.defaultCharSingleByte = "?";
|
|
44165
44167
|
iconv.encode = function encode(str2, encoding, options) {
|
|
44166
44168
|
str2 = "" + (str2 || "");
|
|
44167
|
-
var
|
|
44168
|
-
var res =
|
|
44169
|
-
var trail =
|
|
44169
|
+
var encoder4 = iconv.getEncoder(encoding, options);
|
|
44170
|
+
var res = encoder4.write(str2);
|
|
44171
|
+
var trail = encoder4.end();
|
|
44170
44172
|
return trail && trail.length > 0 ? Buffer3.concat([res, trail]) : res;
|
|
44171
44173
|
};
|
|
44172
44174
|
iconv.decode = function decode4(buf, encoding, options) {
|
|
@@ -44177,9 +44179,9 @@ var require_fontkit_umd = __commonJS({
|
|
|
44177
44179
|
}
|
|
44178
44180
|
buf = Buffer3.from("" + (buf || ""), "binary");
|
|
44179
44181
|
}
|
|
44180
|
-
var
|
|
44181
|
-
var res =
|
|
44182
|
-
var trail =
|
|
44182
|
+
var decoder2 = iconv.getDecoder(encoding, options);
|
|
44183
|
+
var res = decoder2.write(buf);
|
|
44184
|
+
var trail = decoder2.end();
|
|
44183
44185
|
return trail ? res + trail : res;
|
|
44184
44186
|
};
|
|
44185
44187
|
iconv.encodingExists = function encodingExists(enc) {
|
|
@@ -44226,14 +44228,14 @@ var require_fontkit_umd = __commonJS({
|
|
|
44226
44228
|
return ("" + encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, "");
|
|
44227
44229
|
};
|
|
44228
44230
|
iconv.getEncoder = function getEncoder(encoding, options) {
|
|
44229
|
-
var codec = iconv.getCodec(encoding),
|
|
44230
|
-
if (codec.bomAware && options && options.addBOM)
|
|
44231
|
-
return
|
|
44231
|
+
var codec = iconv.getCodec(encoding), encoder4 = new codec.encoder(options, codec);
|
|
44232
|
+
if (codec.bomAware && options && options.addBOM) encoder4 = new bomHandling.PrependBOM(encoder4, options);
|
|
44233
|
+
return encoder4;
|
|
44232
44234
|
};
|
|
44233
44235
|
iconv.getDecoder = function getDecoder2(encoding, options) {
|
|
44234
|
-
var codec = iconv.getCodec(encoding),
|
|
44235
|
-
if (codec.bomAware && !(options && options.stripBOM === false))
|
|
44236
|
-
return
|
|
44236
|
+
var codec = iconv.getCodec(encoding), decoder2 = new codec.decoder(options, codec);
|
|
44237
|
+
if (codec.bomAware && !(options && options.stripBOM === false)) decoder2 = new bomHandling.StripBOM(decoder2, options);
|
|
44238
|
+
return decoder2;
|
|
44237
44239
|
};
|
|
44238
44240
|
var nodeVer = typeof process2 !== "undefined" && process2.versions && process2.versions.node;
|
|
44239
44241
|
if (nodeVer) {
|
|
@@ -60829,7 +60831,7 @@ var require_fontkit_umd = __commonJS({
|
|
|
60829
60831
|
path2.moveTo(x2, y2);
|
|
60830
60832
|
open = true;
|
|
60831
60833
|
}
|
|
60832
|
-
var
|
|
60834
|
+
var parse3 = function parse4() {
|
|
60833
60835
|
while (stream.pos < end2) {
|
|
60834
60836
|
var op = stream.readUInt8();
|
|
60835
60837
|
if (op < 32) {
|
|
@@ -60891,7 +60893,7 @@ var require_fontkit_umd = __commonJS({
|
|
|
60891
60893
|
var e = end2;
|
|
60892
60894
|
stream.pos = subr.offset;
|
|
60893
60895
|
end2 = subr.offset + subr.length;
|
|
60894
|
-
|
|
60896
|
+
parse4();
|
|
60895
60897
|
stream.pos = p2;
|
|
60896
60898
|
end2 = e;
|
|
60897
60899
|
}
|
|
@@ -61033,7 +61035,7 @@ var require_fontkit_umd = __commonJS({
|
|
|
61033
61035
|
var e = end2;
|
|
61034
61036
|
stream.pos = subr.offset;
|
|
61035
61037
|
end2 = subr.offset + subr.length;
|
|
61036
|
-
|
|
61038
|
+
parse4();
|
|
61037
61039
|
stream.pos = p2;
|
|
61038
61040
|
end2 = e;
|
|
61039
61041
|
}
|
|
@@ -61266,7 +61268,7 @@ var require_fontkit_umd = __commonJS({
|
|
|
61266
61268
|
}
|
|
61267
61269
|
}
|
|
61268
61270
|
};
|
|
61269
|
-
|
|
61271
|
+
parse3();
|
|
61270
61272
|
if (open) {
|
|
61271
61273
|
path2.closePath();
|
|
61272
61274
|
}
|
|
@@ -74319,9 +74321,9 @@ function parseExpression(source, options) {
|
|
|
74319
74321
|
options.onWork?.();
|
|
74320
74322
|
if (++nodes > (options.maximumNodes ?? Infinity))
|
|
74321
74323
|
throw new SsconvertError("resource-limit", "ssconvert formula node limit exceeded");
|
|
74322
|
-
const
|
|
74324
|
+
const children8 = value3.kind === "binary" ? [value3.left, value3.right] : value3.kind === "unary" || value3.kind === "parentheses" ? [value3.child] : value3.kind === "call" ? value3.args : value3.kind === "array" ? value3.rows.flat() : [];
|
|
74323
74325
|
let height = 1;
|
|
74324
|
-
for (const child7 of
|
|
74326
|
+
for (const child7 of children8)
|
|
74325
74327
|
height = Math.max(height, 1 + (heights.get(child7) ?? 1));
|
|
74326
74328
|
if (height > (options.maximumDepth ?? Infinity))
|
|
74327
74329
|
throw new SsconvertError("resource-limit", "ssconvert formula depth limit exceeded");
|
|
@@ -75056,7 +75058,7 @@ function parseExpression(source, options) {
|
|
|
75056
75058
|
return { ok: false, source, diagnostic };
|
|
75057
75059
|
}
|
|
75058
75060
|
}
|
|
75059
|
-
function parseNamedExpression(name, book,
|
|
75061
|
+
function parseNamedExpression(name, book, parse3, tick, maximumDepth = Infinity) {
|
|
75060
75062
|
if (name.expression === "" || name.expression === "=") {
|
|
75061
75063
|
tick();
|
|
75062
75064
|
return { kind: "literal", value: { kind: "blank" }, start: 0, end: 0 };
|
|
@@ -75084,7 +75086,7 @@ function parseNamedExpression(name, book, parse2, tick, maximumDepth = Infinity)
|
|
|
75084
75086
|
return { ...node3, rows: node3.rows.map((row) => row.map((child7) => bind(child7, depth + 1))) };
|
|
75085
75087
|
return node3;
|
|
75086
75088
|
}
|
|
75087
|
-
return bind(
|
|
75089
|
+
return bind(parse3(name.expression, position, name.arrayStringLiterals));
|
|
75088
75090
|
}
|
|
75089
75091
|
function encodeByteText(source, tick) {
|
|
75090
75092
|
let end2 = 0;
|
|
@@ -75392,7 +75394,7 @@ function binary(op, left, right, admission) {
|
|
|
75392
75394
|
return error("#NUM!");
|
|
75393
75395
|
return numericResult(op === "+" ? a3 + b3 : op === "-" ? a3 - b3 : op === "*" ? a3 * b3 : op === "/" ? a3 / b3 : a3 ** b3);
|
|
75394
75396
|
}
|
|
75395
|
-
function buildDependencyGraph(book, roots, resolve,
|
|
75397
|
+
function buildDependencyGraph(book, roots, resolve, parse3, tick, onRange, maximumDepth = Infinity) {
|
|
75396
75398
|
const precedents = /* @__PURE__ */ new Map(), dependents = /* @__PURE__ */ new Map(), volatile = /* @__PURE__ */ new Set();
|
|
75397
75399
|
const link = (cell, precedent) => {
|
|
75398
75400
|
tick();
|
|
@@ -75402,12 +75404,12 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
|
|
|
75402
75404
|
precedents.set(cell, parents);
|
|
75403
75405
|
}
|
|
75404
75406
|
parents.add(precedent);
|
|
75405
|
-
let
|
|
75406
|
-
if (!
|
|
75407
|
-
|
|
75408
|
-
dependents.set(precedent,
|
|
75407
|
+
let children8 = dependents.get(precedent);
|
|
75408
|
+
if (!children8) {
|
|
75409
|
+
children8 = /* @__PURE__ */ new Set();
|
|
75410
|
+
dependents.set(precedent, children8);
|
|
75409
75411
|
}
|
|
75410
|
-
|
|
75412
|
+
children8.add(cell);
|
|
75411
75413
|
};
|
|
75412
75414
|
const range3 = (cell, value3) => {
|
|
75413
75415
|
tick();
|
|
@@ -75468,7 +75470,7 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
|
|
|
75468
75470
|
const name = named(node3, position);
|
|
75469
75471
|
if (!name || names2.has(name))
|
|
75470
75472
|
return [];
|
|
75471
|
-
return staticRanges(parseNamedExpression(name, book,
|
|
75473
|
+
return staticRanges(parseNamedExpression(name, book, parse3, tick, maximumDepth), position, /* @__PURE__ */ new Set([...names2, name]), depth + 1);
|
|
75472
75474
|
}
|
|
75473
75475
|
if (node3.kind === "call" && (node3.name === "IF" || node3.name === "CHOOSE")) {
|
|
75474
75476
|
const ranges3 = [];
|
|
@@ -75577,12 +75579,12 @@ function buildDependencyGraph(book, roots, resolve, parse2, tick, onRange, maxim
|
|
|
75577
75579
|
if (node3.kind === "name" && (node3.workbook === void 0 || node3.workbook === "")) {
|
|
75578
75580
|
const name = named(node3, position2);
|
|
75579
75581
|
if (name && !names3.has(name)) {
|
|
75580
|
-
pending.push({ node: parseNamedExpression(name, book,
|
|
75582
|
+
pending.push({ node: parseNamedExpression(name, book, parse3, tick, maximumDepth), position: position2, names: /* @__PURE__ */ new Set([...names3, name]), depth: depth + 1 });
|
|
75581
75583
|
}
|
|
75582
75584
|
}
|
|
75583
|
-
const
|
|
75584
|
-
for (let index2 =
|
|
75585
|
-
pending.push({ node:
|
|
75585
|
+
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() : [];
|
|
75586
|
+
for (let index2 = children8.length - 1; index2 >= 0; index2--)
|
|
75587
|
+
pending.push({ node: children8[index2], position: position2, names: names3, depth: depth + 1 });
|
|
75586
75588
|
}
|
|
75587
75589
|
}
|
|
75588
75590
|
for (const sheet of book.sheets)
|
|
@@ -76288,8 +76290,8 @@ function resizeRetainedRecords(sheet, old, size, context) {
|
|
|
76288
76290
|
throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: resize style bounds");
|
|
76289
76291
|
return [{ node: node3, r0, r1, c0, c1 }];
|
|
76290
76292
|
});
|
|
76291
|
-
const
|
|
76292
|
-
return [{ ...record7, data: { ...data3, children:
|
|
76293
|
+
const children8 = rectangles2.filter((r) => r.r0 < size.rows && r.c0 < size.columns).map((r) => attributes(r.node, { endRow: String(Math.min(r.r1, size.rows - 1)), endCol: String(Math.min(r.c1, size.columns - 1)) }));
|
|
76294
|
+
return [{ ...record7, data: { ...data3, children: children8 } }];
|
|
76293
76295
|
});
|
|
76294
76296
|
if (size.rows <= old.rows && size.columns <= old.columns)
|
|
76295
76297
|
return retained2;
|
|
@@ -76588,14 +76590,14 @@ var odfNamespaces = {
|
|
|
76588
76590
|
function odfObject(value3) {
|
|
76589
76591
|
return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
|
|
76590
76592
|
}
|
|
76591
|
-
function odfAttributes(value3,
|
|
76593
|
+
function odfAttributes(value3, namespace6) {
|
|
76592
76594
|
const source = odfObject(value3)?.attributes;
|
|
76593
76595
|
if (Array.isArray(source))
|
|
76594
76596
|
return Object.fromEntries(source.flatMap((a3) => {
|
|
76595
76597
|
const v = odfObject(a3);
|
|
76596
|
-
return typeof v?.name === "string" && typeof v.value === "string" && (
|
|
76598
|
+
return typeof v?.name === "string" && typeof v.value === "string" && (namespace6 === void 0 || v.namespace === namespace6) ? [[v.name, v.value]] : [];
|
|
76597
76599
|
}));
|
|
76598
|
-
if (
|
|
76600
|
+
if (namespace6 !== void 0)
|
|
76599
76601
|
return {};
|
|
76600
76602
|
return Object.fromEntries(Object.entries(odfObject(source) ?? {}).filter((entry2) => typeof entry2[1] === "string"));
|
|
76601
76603
|
}
|
|
@@ -76606,7 +76608,7 @@ function odfChildren(value3) {
|
|
|
76606
76608
|
function upgradeOdfAnnotation(node3, charge) {
|
|
76607
76609
|
const original = odfChildren(node3);
|
|
76608
76610
|
charge(original.length);
|
|
76609
|
-
const attributes4 = [],
|
|
76611
|
+
const attributes4 = [], children8 = [...original];
|
|
76610
76612
|
for (const value3 of Array.isArray(node3.attributes) ? node3.attributes : []) {
|
|
76611
76613
|
charge();
|
|
76612
76614
|
const a3 = odfObject(value3);
|
|
@@ -76617,7 +76619,7 @@ function upgradeOdfAnnotation(node3, charge) {
|
|
|
76617
76619
|
continue;
|
|
76618
76620
|
if (a3.name === "create-date" || a3.name === "create-date-string") {
|
|
76619
76621
|
const date = a3.name === "create-date";
|
|
76620
|
-
|
|
76622
|
+
children8.push({
|
|
76621
76623
|
name: date ? "date" : "date-string",
|
|
76622
76624
|
namespace: odfNamespaces[date ? "dc" : "meta"],
|
|
76623
76625
|
attributes: [],
|
|
@@ -76634,13 +76636,13 @@ function upgradeOdfAnnotation(node3, charge) {
|
|
|
76634
76636
|
...node3,
|
|
76635
76637
|
namespace: odfNamespaces.office,
|
|
76636
76638
|
attributes: attributes4,
|
|
76637
|
-
children:
|
|
76638
|
-
content:
|
|
76639
|
+
children: children8,
|
|
76640
|
+
content: children8.map((_, index2) => ({ kind: "element", index: index2 }))
|
|
76639
76641
|
};
|
|
76640
76642
|
}
|
|
76641
76643
|
function createOdfXml(context, extended) {
|
|
76642
76644
|
let work = 0, nodes = 0;
|
|
76643
|
-
const
|
|
76645
|
+
const encoder4 = new TextEncoder(), names2 = /* @__PURE__ */ new Set();
|
|
76644
76646
|
const declarations = {
|
|
76645
76647
|
...Object.fromEntries(Object.entries(odfNamespaces).map(([prefix, uri]) => ["xmlns:" + prefix, uri])),
|
|
76646
76648
|
"xmlns:loext": odfEncryptionNamespace
|
|
@@ -76691,7 +76693,7 @@ function createOdfXml(context, extended) {
|
|
|
76691
76693
|
result2 += ` ${key}="${escape3(String(value3))}"`;
|
|
76692
76694
|
}
|
|
76693
76695
|
result2 += content2 ? ">" + content2 + "</" + tag + ">" : "/>";
|
|
76694
|
-
if (result2.length > context.limits.outputBytes ||
|
|
76696
|
+
if (result2.length > context.limits.outputBytes || encoder4.encode(result2).length > context.limits.outputBytes)
|
|
76695
76697
|
throw new SsconvertError("resource-limit", "ssconvert OpenDocument output bytes limit exceeded");
|
|
76696
76698
|
return result2;
|
|
76697
76699
|
}
|
|
@@ -76740,17 +76742,17 @@ function createOdfXml(context, extended) {
|
|
|
76740
76742
|
if (Array.isArray(v.attributes))
|
|
76741
76743
|
for (const a3 of v.attributes) {
|
|
76742
76744
|
charge();
|
|
76743
|
-
const
|
|
76744
|
-
if (typeof
|
|
76745
|
+
const attribute7 = odfObject(a3);
|
|
76746
|
+
if (typeof attribute7?.name !== "string" || typeof attribute7.value !== "string" || typeof attribute7.namespace !== "string")
|
|
76745
76747
|
continue;
|
|
76746
|
-
const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri ===
|
|
76747
|
-
if (
|
|
76748
|
+
const p2 = Object.entries(odfNamespaces).find(([, uri]) => uri === attribute7.namespace)?.[0];
|
|
76749
|
+
if (attribute7.namespace && (!p2 || !extended && ["gnm", "calcext"].includes(p2)))
|
|
76748
76750
|
continue;
|
|
76749
|
-
attributes4[(p2 ? p2 + ":" : "") +
|
|
76751
|
+
attributes4[(p2 ? p2 + ":" : "") + attribute7.name] = attribute7.value;
|
|
76750
76752
|
}
|
|
76751
76753
|
if (prefix === "text" && v.name === "a" && attributes4["xlink:href"] !== void 0 && hyperlink)
|
|
76752
76754
|
attributes4["xlink:href"] = hyperlink(attributes4["xlink:href"]);
|
|
76753
|
-
const
|
|
76755
|
+
const children8 = odfChildren(v);
|
|
76754
76756
|
const childHyperlinkContent = Boolean(hyperlink) && prefix === "text" && v.name === "a" && attributes4["xlink:href"] !== void 0;
|
|
76755
76757
|
const content2 = contentOverride ?? (Array.isArray(v.content) ? v.content.map((c4) => {
|
|
76756
76758
|
charge();
|
|
@@ -76761,11 +76763,11 @@ function createOdfXml(context, extended) {
|
|
|
76761
76763
|
return "";
|
|
76762
76764
|
if (item.index === void 0)
|
|
76763
76765
|
return retained2(item.value, depth + 1, hyperlink, childHyperlinkContent);
|
|
76764
|
-
if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >=
|
|
76766
|
+
if (typeof item.index !== "number" || !Number.isSafeInteger(item.index) || item.index < 0 || item.index >= children8.length)
|
|
76765
76767
|
throw new SsconvertError("invalid-request", "Invalid OpenDocument metadata child index");
|
|
76766
|
-
return retained2(
|
|
76767
|
-
}).join("") : (typeof v.text === "string" ? escape3(v.text) : "") +
|
|
76768
|
-
if (hyperlinkContent && prefix === "text" && !content2 && !
|
|
76768
|
+
return retained2(children8[item.index], depth + 1, hyperlink, childHyperlinkContent);
|
|
76769
|
+
}).join("") : (typeof v.text === "string" ? escape3(v.text) : "") + children8.map((c4) => retained2(c4, depth + 1, hyperlink, childHyperlinkContent)).join(""));
|
|
76770
|
+
if (hyperlinkContent && prefix === "text" && !content2 && !children8.length) {
|
|
76769
76771
|
if (v.name === "s" && Object.keys(attributes4).every((key) => key === "text:c")) {
|
|
76770
76772
|
const count = Number(attributes4["text:c"] ?? "1");
|
|
76771
76773
|
if (!Number.isSafeInteger(count) || count < 0)
|
|
@@ -76919,27 +76921,27 @@ function rewriteWorkbookHyperlinks(book, names2, context) {
|
|
|
76919
76921
|
item.assign(updated);
|
|
76920
76922
|
const attributes4 = odfObject(node3.attributes);
|
|
76921
76923
|
const list = Array.isArray(node3.attributes) ? node3.attributes : [];
|
|
76922
|
-
const field = (name,
|
|
76923
|
-
if (attributes4 && !
|
|
76924
|
+
const field = (name, namespace6) => {
|
|
76925
|
+
if (attributes4 && !namespace6 && typeof attributes4[name] === "string")
|
|
76924
76926
|
return attributes4[name];
|
|
76925
76927
|
for (const value4 of list) {
|
|
76926
76928
|
charge();
|
|
76927
|
-
const
|
|
76928
|
-
if (
|
|
76929
|
-
return
|
|
76929
|
+
const attribute7 = odfObject(value4);
|
|
76930
|
+
if (attribute7?.name === name && attribute7.namespace === namespace6 && typeof attribute7.value === "string")
|
|
76931
|
+
return attribute7.value;
|
|
76930
76932
|
}
|
|
76931
76933
|
return void 0;
|
|
76932
76934
|
};
|
|
76933
76935
|
const link = odf ? node3.name === "a" : node3.name === "HyperLink" && field("type", "") === "GnmHLinkCurWB";
|
|
76934
76936
|
if (link) {
|
|
76935
|
-
const name = odf ? "href" : "target",
|
|
76936
|
-
const source = field(name,
|
|
76937
|
+
const name = odf ? "href" : "target", namespace6 = odf ? odfNamespaces.xlink : "";
|
|
76938
|
+
const source = field(name, namespace6);
|
|
76937
76939
|
if (source !== void 0) {
|
|
76938
76940
|
const rewritten = target(source, odf);
|
|
76939
76941
|
updated.attributes = attributes4 ? { ...attributes4, [name]: rewritten } : list.map((value4) => {
|
|
76940
76942
|
charge();
|
|
76941
|
-
const
|
|
76942
|
-
return
|
|
76943
|
+
const attribute7 = odfObject(value4);
|
|
76944
|
+
return attribute7?.name === name && attribute7.namespace === namespace6 ? { ...attribute7, value: rewritten } : value4;
|
|
76943
76945
|
});
|
|
76944
76946
|
}
|
|
76945
76947
|
}
|
|
@@ -76951,10 +76953,10 @@ function rewriteWorkbookHyperlinks(book, names2, context) {
|
|
|
76951
76953
|
pending.push({ value: value4, role: childRole ?? child7.name, depth: item.depth + 1, assign });
|
|
76952
76954
|
};
|
|
76953
76955
|
if (Array.isArray(node3.children)) {
|
|
76954
|
-
const
|
|
76955
|
-
updated.children =
|
|
76956
|
-
|
|
76957
|
-
|
|
76956
|
+
const children8 = [...node3.children];
|
|
76957
|
+
updated.children = children8;
|
|
76958
|
+
children8.forEach((child7, index2) => enqueue(child7, (next) => {
|
|
76959
|
+
children8[index2] = next;
|
|
76958
76960
|
}));
|
|
76959
76961
|
}
|
|
76960
76962
|
if (odf && Array.isArray(node3.content)) {
|
|
@@ -77012,23 +77014,23 @@ function rewriteWorkbook(book, context, rewrite) {
|
|
|
77012
77014
|
throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: formula syntax at ${parsed.diagnostic.start}:${parsed.diagnostic.end}`);
|
|
77013
77015
|
return rewrite(parsed.document, namedExpression);
|
|
77014
77016
|
};
|
|
77015
|
-
const chart = (value3, sheet, parent,
|
|
77017
|
+
const chart = (value3, sheet, parent, namespace6) => {
|
|
77016
77018
|
context.signal.throwIfAborted();
|
|
77017
77019
|
if (++work > maximum)
|
|
77018
77020
|
throw new SsconvertError("resource-limit", "ssconvert workbook work limit exceeded");
|
|
77019
77021
|
if (value3 === null || typeof value3 !== "object" || Array.isArray(value3))
|
|
77020
77022
|
return value3;
|
|
77021
77023
|
const node3 = value3;
|
|
77022
|
-
const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace ===
|
|
77024
|
+
const role = parent === void 0 && node3.name === "Objects" ? "Objects" : parent === "Objects" && node3.namespace === namespace6 && (node3.name === "SheetObjectGraph" || node3.name === "GnmGraph") ? "graph" : (parent === "graph" || parent === "GogObject") && node3.namespace === "" && node3.name === "GogObject" ? "GogObject" : parent === "GogObject" && node3.namespace === "" && node3.name === "data" ? "data" : void 0;
|
|
77023
77025
|
const dimension = parent === "data" && node3.name === "dimension" && node3.namespace === "";
|
|
77024
77026
|
if (role === void 0 && !dimension)
|
|
77025
77027
|
return value3;
|
|
77026
|
-
const type = Array.isArray(node3.attributes) ? node3.attributes.find((
|
|
77028
|
+
const type = Array.isArray(node3.attributes) ? node3.attributes.find((attribute7) => attribute7 !== null && typeof attribute7 === "object" && !Array.isArray(attribute7) && attribute7.name === "type" && attribute7.namespace === "") : void 0;
|
|
77027
77029
|
const typeName = type && typeof type === "object" && !Array.isArray(type) && typeof type.value === "string" ? type.value : "";
|
|
77028
77030
|
return {
|
|
77029
77031
|
...node3,
|
|
77030
77032
|
...dimension && Object.hasOwn(chartDataTypes, typeName) && chartDataTypes[typeName].storage === "expression" && typeof node3.text === "string" && node3.text ? { text: formula3(node3.text, { sheet, row: 0, column: 0 }) } : {},
|
|
77031
|
-
...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace :
|
|
77033
|
+
...role !== void 0 && Array.isArray(node3.children) ? { children: node3.children.map((child7) => chart(child7, sheet, role, role === "Objects" && typeof node3.namespace === "string" ? node3.namespace : namespace6)) } : {}
|
|
77032
77034
|
};
|
|
77033
77035
|
};
|
|
77034
77036
|
const rewriteSheet = (sheet) => ({
|
|
@@ -82652,7 +82654,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
82652
82654
|
tick();
|
|
82653
82655
|
end2++;
|
|
82654
82656
|
}
|
|
82655
|
-
const source = input.subarray(0, end2),
|
|
82657
|
+
const source = input.subarray(0, end2), encoder4 = new TextEncoder();
|
|
82656
82658
|
const fullCases = uppercase ? upperFullCases : lowerFullCases;
|
|
82657
82659
|
const traverse = (emit) => {
|
|
82658
82660
|
let position = 0;
|
|
@@ -82667,7 +82669,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
82667
82669
|
const mark = readByteTextCharacter(source, position, tick);
|
|
82668
82670
|
if (!hasProperty(mark.point, 4))
|
|
82669
82671
|
break;
|
|
82670
|
-
const bytes2 =
|
|
82672
|
+
const bytes2 = encoder4.encode(String.fromCodePoint(mark.point));
|
|
82671
82673
|
emit(bytes2, 0, bytes2.length);
|
|
82672
82674
|
position = mark.next;
|
|
82673
82675
|
}
|
|
@@ -82678,7 +82680,7 @@ function caseByteText(input, uppercase, maximum, tick) {
|
|
|
82678
82680
|
emit(source, start, next);
|
|
82679
82681
|
continue;
|
|
82680
82682
|
}
|
|
82681
|
-
const bytes =
|
|
82683
|
+
const bytes = encoder4.encode(text2);
|
|
82682
82684
|
emit(bytes, 0, bytes.length);
|
|
82683
82685
|
}
|
|
82684
82686
|
};
|
|
@@ -98837,7 +98839,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
98837
98839
|
const key = JSON.stringify([value3.sheets.map((sheet) => sheet.id), value3.firstRow, value3.lastRow, value3.firstColumn, value3.lastColumn]);
|
|
98838
98840
|
ranges2.set(key, value3);
|
|
98839
98841
|
}
|
|
98840
|
-
function
|
|
98842
|
+
function parse3(source, position, arrayStringLiterals = false) {
|
|
98841
98843
|
tick();
|
|
98842
98844
|
const parsed = parseExpression(source, { position, arrayStringLiterals, workbook: book, signal: context.signal, maximumDepth: context.limits.formulaDepth, maximumLength: context.limits.inputBytes, maximumNodes: maximumWork2 - work, onWork: tick });
|
|
98843
98845
|
if (!parsed.ok)
|
|
@@ -98852,7 +98854,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
98852
98854
|
const group = sheet.formulaGroups?.find((group2) => group2.id === cell.formulaGroup && group2.kind === "array");
|
|
98853
98855
|
if (group)
|
|
98854
98856
|
arrayKeys.set(cell, `${sheet.id}:${group.id}`);
|
|
98855
|
-
const root =
|
|
98857
|
+
const root = parse3(cell.formula, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals);
|
|
98856
98858
|
expressions.set(cell, root);
|
|
98857
98859
|
if (work - checkpoint >= WORK_QUANTUM) {
|
|
98858
98860
|
checkpoint = work;
|
|
@@ -98931,7 +98933,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
98931
98933
|
const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
|
|
98932
98934
|
if (!name || names2.has(name))
|
|
98933
98935
|
return error("#REF!");
|
|
98934
|
-
return indirectRange(parseNamedExpression(name, book,
|
|
98936
|
+
return indirectRange(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, /* @__PURE__ */ new Set([...names2, name]), depth2 + 1);
|
|
98935
98937
|
}
|
|
98936
98938
|
function scalar2(value3, position) {
|
|
98937
98939
|
const label = scalarLabels.get(value3);
|
|
@@ -99025,7 +99027,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
99025
99027
|
const name = book.names?.find((entry2) => entry2.sheet === sheet && matches(entry2)) ?? book.names?.find((entry2) => entry2.sheet === void 0 && matches(entry2));
|
|
99026
99028
|
if (!name || names2.has(name))
|
|
99027
99029
|
return error("#NAME?");
|
|
99028
|
-
return evaluate(parseNamedExpression(name, book,
|
|
99030
|
+
return evaluate(parseNamedExpression(name, book, parse3, tick, context.limits.formulaDependencyDepth ?? Infinity), position, array, /* @__PURE__ */ new Set([...names2, name]), wantReference);
|
|
99029
99031
|
}
|
|
99030
99032
|
if (node3.kind === "unary") {
|
|
99031
99033
|
const apply = (value3) => {
|
|
@@ -99413,7 +99415,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
99413
99415
|
activeCell = cell;
|
|
99414
99416
|
const group = sheet.formulaGroups?.find((g) => g.id === cell.formulaGroup && g.kind === "array");
|
|
99415
99417
|
const position = { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column };
|
|
99416
|
-
const node3 = expressions.get(cell) ??
|
|
99418
|
+
const node3 = expressions.get(cell) ?? parse3(cell.formula, position);
|
|
99417
99419
|
let result2 = cell.cachedResult ?? cell.value;
|
|
99418
99420
|
try {
|
|
99419
99421
|
let remaining = book.iteration?.maximum ?? 0;
|
|
@@ -99461,7 +99463,7 @@ function* recalculateWorkbookSteps(input, context, options = false, onDiagnostic
|
|
|
99461
99463
|
}
|
|
99462
99464
|
const currentValues = /* @__PURE__ */ new Map();
|
|
99463
99465
|
const dependencyRanges = [];
|
|
99464
|
-
const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position),
|
|
99466
|
+
const graph = buildDependencyGraph(book, expressions, (node3, position) => localReferenceRange(book, node3, position), parse3, tick, (cell, range3) => dependencyRanges.push([cell, range3]), context.limits.formulaDependencyDepth ?? Infinity);
|
|
99465
99467
|
const pending = /* @__PURE__ */ new Set();
|
|
99466
99468
|
const queue = [];
|
|
99467
99469
|
const queueVolatile = typeof options === "boolean" || options.queueVolatile !== false;
|
|
@@ -99844,8 +99846,8 @@ async function openDatasourceSession(capability, context) {
|
|
|
99844
99846
|
} });
|
|
99845
99847
|
}
|
|
99846
99848
|
function compareServiceIds(a3, b3) {
|
|
99847
|
-
const
|
|
99848
|
-
const left =
|
|
99849
|
+
const encoder4 = new TextEncoder();
|
|
99850
|
+
const left = encoder4.encode(a3.id), right = encoder4.encode(b3.id);
|
|
99849
99851
|
for (let index2 = 0; index2 < Math.min(left.length, right.length); index2++) {
|
|
99850
99852
|
const difference2 = left[index2] - right[index2];
|
|
99851
99853
|
if (difference2)
|
|
@@ -101796,15 +101798,15 @@ async function runSolverValidation(book, context, registry = solverAlgorithms) {
|
|
|
101796
101798
|
}
|
|
101797
101799
|
function kaplanMeierChart(name, rows, probability, ticks, size, context) {
|
|
101798
101800
|
let work = 0;
|
|
101799
|
-
const node3 = (name2, attributes4 = {},
|
|
101801
|
+
const node3 = (name2, attributes4 = {}, children8 = [], text2 = "", namespace7 = "") => {
|
|
101800
101802
|
context.signal.throwIfAborted();
|
|
101801
101803
|
work += 1 + text2.length + Object.entries(attributes4).reduce((sum2, [key, value3]) => sum2 + key.length + value3.length, 0);
|
|
101802
101804
|
if (work > context.limits.operations)
|
|
101803
101805
|
throw new SsconvertError("resource-limit", "ssconvert analysis chart exceeds workbook limits");
|
|
101804
|
-
return { name: name2, namespace:
|
|
101806
|
+
return { name: name2, namespace: namespace7, text: text2, attributes: Object.entries(attributes4).map(([name3, value3]) => ({ name: name3, namespace: "", value: value3 })), children: children8 };
|
|
101805
101807
|
};
|
|
101806
101808
|
const property = (name2, value3) => node3("property", { name: name2 }, [], value3);
|
|
101807
|
-
const style2 = (
|
|
101809
|
+
const style2 = (children8) => node3("property", { name: "style", type: "GogStyle" }, children8);
|
|
101808
101810
|
const line = () => node3("line", { "auto-dash": "1", "auto-width": "1", "auto-color": "1" });
|
|
101809
101811
|
const fill = () => node3("fill", { type: "none", "auto-type": "1", "is-auto": "1", "auto-fore": "1" });
|
|
101810
101812
|
const axis = (role) => node3("GogObject", { role }, [
|
|
@@ -101861,13 +101863,13 @@ function kaplanMeierChart(name, rows, probability, ticks, size, context) {
|
|
|
101861
101863
|
plot
|
|
101862
101864
|
])
|
|
101863
101865
|
]);
|
|
101864
|
-
const
|
|
101866
|
+
const namespace6 = "http://www.gnumeric.org/v10.dtd";
|
|
101865
101867
|
return { source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: node3("Objects", {}, [node3("SheetObjectGraph", {
|
|
101866
101868
|
ObjectBound: `A2:${formatA1(Math.min(20, size.rows - 1), Math.min(5, size.columns - 1), size)}`,
|
|
101867
101869
|
ObjectOffset: "0 0 0 0",
|
|
101868
101870
|
Direction: "255",
|
|
101869
101871
|
Print: "1"
|
|
101870
|
-
}, [graph], "",
|
|
101872
|
+
}, [graph], "", namespace6)], "", namespace6) };
|
|
101871
101873
|
}
|
|
101872
101874
|
async function analysisUtility(book, tool, options, context, add5, merges) {
|
|
101873
101875
|
const p2 = options.properties;
|
|
@@ -103649,14 +103651,14 @@ async function statisticalAnalysis(book, tool, options, context) {
|
|
|
103649
103651
|
if (cell.row === anovaValidityRow && cell.column === 0)
|
|
103650
103652
|
return { ...cell, format: '"ANOVA";[Red]"Invalid ANOVA: Missing Observations"', style: { italic: true, horizontalAlignment: "left", verticalAlignment: "bottom" } };
|
|
103651
103653
|
if (cell.row === anovaValidityRow + 1 || cell.row === anovaErrorRow) {
|
|
103652
|
-
const
|
|
103654
|
+
const namespace6 = "http://www.gnumeric.org/v10.dtd";
|
|
103653
103655
|
return { ...cell, style: { ...cell.style, ...cell.row === anovaValidityRow + 1 ? { italic: true } : {}, gnumeric: {
|
|
103654
103656
|
name: "Style",
|
|
103655
|
-
namespace:
|
|
103657
|
+
namespace: namespace6,
|
|
103656
103658
|
attributes: [],
|
|
103657
|
-
children: [{ name: "StyleBorder", namespace:
|
|
103659
|
+
children: [{ name: "StyleBorder", namespace: namespace6, attributes: [], children: [{
|
|
103658
103660
|
name: "Bottom",
|
|
103659
|
-
namespace:
|
|
103661
|
+
namespace: namespace6,
|
|
103660
103662
|
attributes: [{ name: "Style", namespace: "", value: "1" }, { name: "Color", namespace: "", value: "0:0:0" }],
|
|
103661
103663
|
children: []
|
|
103662
103664
|
}] }]
|
|
@@ -104359,7 +104361,7 @@ function dirtyWorkbook(book, changes, context) {
|
|
|
104359
104361
|
const tick = budget(context);
|
|
104360
104362
|
book = snapshotWorkbook(book, context.limits);
|
|
104361
104363
|
const dirty = /* @__PURE__ */ new Set();
|
|
104362
|
-
function
|
|
104364
|
+
function parse3(source, position, arrayStringLiterals = false) {
|
|
104363
104365
|
tick();
|
|
104364
104366
|
const parsed = parseExpression(source, {
|
|
104365
104367
|
maximumDepth: context.limits.formulaDepth,
|
|
@@ -104382,11 +104384,11 @@ function dirtyWorkbook(book, changes, context) {
|
|
|
104382
104384
|
const source = cell.formula ?? group?.expression;
|
|
104383
104385
|
if (!source)
|
|
104384
104386
|
continue;
|
|
104385
|
-
roots.set(cell,
|
|
104387
|
+
roots.set(cell, parse3(source, { sheet: sheet.id, row: group?.range.startRow ?? cell.row, column: group?.range.startColumn ?? cell.column }, cell.arrayStringLiterals ?? group?.arrayStringLiterals));
|
|
104386
104388
|
if (cell.formulaDirty)
|
|
104387
104389
|
dirty.add(cell);
|
|
104388
104390
|
}
|
|
104389
|
-
const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position),
|
|
104391
|
+
const graph = buildDependencyGraph(book, roots, (node3, position) => localReferenceRange(book, node3, position), parse3, tick, (cell, range3) => {
|
|
104390
104392
|
for (const sheet of range3.sheets)
|
|
104391
104393
|
for (const change of changes) {
|
|
104392
104394
|
tick();
|
|
@@ -106170,8 +106172,8 @@ ${errors.map((e) => ` E ${e}`).join("\n")}`);
|
|
|
106170
106172
|
const parsed = legacyExpression(formula3, { ...gnumericGrammar, quoteSheetName: quoteNativeSheet }, { sheet: id, row, column }, context);
|
|
106171
106173
|
return parsed.ok ? rewriteReferences(parsed.document, { sheets: renames, signal: context.signal }) : formula3;
|
|
106172
106174
|
}
|
|
106173
|
-
function node3(name, style3,
|
|
106174
|
-
return { name, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children:
|
|
106175
|
+
function node3(name, style3, children8 = [], text2 = "") {
|
|
106176
|
+
return { name, namespace: "http://www.gnumeric.org/v10.dtd", text: text2, children: children8, attributes: Object.entries(style3).map(([name2, value3]) => {
|
|
106175
106177
|
let text3 = typeof value3 === "boolean" ? String(Number(value3)) : String(value3);
|
|
106176
106178
|
if (["Fore", "Back", "PatternColor", "Color"].includes(name2) && text3.length === 8 && [...text3].every((c4) => "0123456789ABCDEF".includes(c4)))
|
|
106177
106179
|
text3 = [text3.slice(2, 4), text3.slice(4, 6), text3.slice(6, 8)].map((s) => (parseInt(s, 16) * 257).toString(16).toUpperCase()).join(":");
|
|
@@ -106333,7 +106335,7 @@ function escapeXlsx(value3) {
|
|
|
106333
106335
|
}
|
|
106334
106336
|
function createXlsxXml(context) {
|
|
106335
106337
|
let nodes = 0, work = 0;
|
|
106336
|
-
const
|
|
106338
|
+
const encoder4 = new TextEncoder();
|
|
106337
106339
|
const names2 = /* @__PURE__ */ new Set();
|
|
106338
106340
|
function charge(amount = 1) {
|
|
106339
106341
|
context.signal.throwIfAborted();
|
|
@@ -106380,7 +106382,7 @@ function createXlsxXml(context) {
|
|
|
106380
106382
|
text2 += ` ${key}="${escapeXlsx(raw).split("\n").join(" ").split(" ").join("	")}"`;
|
|
106381
106383
|
}
|
|
106382
106384
|
text2 += content2 ? ">" + content2 + "</" + name + ">" : "/>";
|
|
106383
|
-
if (text2.length > context.limits.outputBytes ||
|
|
106385
|
+
if (text2.length > context.limits.outputBytes || encoder4.encode(text2).length > context.limits.outputBytes)
|
|
106384
106386
|
throw new SsconvertError("resource-limit", "ssconvert XLSX output bytes limit exceeded");
|
|
106385
106387
|
return text2;
|
|
106386
106388
|
};
|
|
@@ -106405,10 +106407,10 @@ function metadataNode(value3, charge) {
|
|
|
106405
106407
|
for (const a3 of source.attributes) {
|
|
106406
106408
|
charge?.();
|
|
106407
106409
|
if (a3 && typeof a3 === "object" && !Array.isArray(a3)) {
|
|
106408
|
-
const
|
|
106409
|
-
if (typeof
|
|
106410
|
-
charge?.(
|
|
106411
|
-
attributes4[
|
|
106410
|
+
const attribute7 = a3;
|
|
106411
|
+
if (typeof attribute7.name === "string" && typeof attribute7.value === "string") {
|
|
106412
|
+
charge?.(attribute7.name.length + attribute7.value.length);
|
|
106413
|
+
attributes4[attribute7.name] = attribute7.value;
|
|
106412
106414
|
}
|
|
106413
106415
|
}
|
|
106414
106416
|
}
|
|
@@ -106955,15 +106957,24 @@ function readCfb(bytes, context) {
|
|
|
106955
106957
|
return result2;
|
|
106956
106958
|
}
|
|
106957
106959
|
function readBiffRecords(bytes, context) {
|
|
106960
|
+
context.signal.throwIfAborted();
|
|
106961
|
+
if (bytes.length > context.limits.inputBytes)
|
|
106962
|
+
throw new SsconvertError("resource-limit", "ssconvert input bytes limit exceeded");
|
|
106958
106963
|
const binary3 = new Binary(bytes), records = [];
|
|
106959
106964
|
for (let offset = 0; offset < bytes.length; ) {
|
|
106960
106965
|
context.signal.throwIfAborted();
|
|
106966
|
+
context.work?.();
|
|
106961
106967
|
binary3.check(offset, 4);
|
|
106962
106968
|
const opcode = binary3.u16(offset), length = binary3.u16(offset + 2);
|
|
106963
|
-
if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) =>
|
|
106969
|
+
if (opcode === 0 && length === 0 && bytes.subarray(offset).every((byte) => {
|
|
106970
|
+
context.signal.throwIfAborted();
|
|
106971
|
+
context.work?.();
|
|
106972
|
+
return byte === 0;
|
|
106973
|
+
}))
|
|
106964
106974
|
break;
|
|
106965
106975
|
if (records.length >= (context.limits.workbookNodes ?? context.limits.inputBytes))
|
|
106966
106976
|
throw new SsconvertError("resource-limit", "ssconvert BIFF record limit exceeded");
|
|
106977
|
+
context.retain?.(128);
|
|
106967
106978
|
records.push({ opcode, offset, data: new Binary(binary3.slice(offset + 4, length)) });
|
|
106968
106979
|
offset += length + 4;
|
|
106969
106980
|
}
|
|
@@ -107855,6 +107866,8 @@ function biffOverrideCodepage(encoding) {
|
|
|
107855
107866
|
return encoding === void 0 ? void 0 : overrideCodepages[encoding];
|
|
107856
107867
|
}
|
|
107857
107868
|
function biffDecode(bytes, codepage) {
|
|
107869
|
+
if (codepage === 65001)
|
|
107870
|
+
return new TextDecoder("utf-8", { fatal: true, ignoreBOM: true }).decode(bytes);
|
|
107858
107871
|
const multibyte = biffDbcsTables[codepage];
|
|
107859
107872
|
if (multibyte) {
|
|
107860
107873
|
const characters2 = [];
|
|
@@ -107871,7 +107884,7 @@ function biffDecode(bytes, codepage) {
|
|
|
107871
107884
|
}
|
|
107872
107885
|
return characters2.join("");
|
|
107873
107886
|
}
|
|
107874
|
-
const name = codepage === 1200 || codepage === 1201 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
|
|
107887
|
+
const name = codepage === 20127 ? "ascii" : codepage === 1200 || codepage === 1201 || codepage === 28591 ? "iso-8859-1" : codepage === 1e4 ? "macintosh" : codepage >= 1250 && codepage <= 1258 ? `windows-${codepage}` : `cp${codepage}`;
|
|
107875
107888
|
const table2 = singleByteTables[name];
|
|
107876
107889
|
if (!table2)
|
|
107877
107890
|
throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: BIFF codepage ${codepage}`);
|
|
@@ -107900,6 +107913,8 @@ var BiffStrings = class {
|
|
|
107900
107913
|
}
|
|
107901
107914
|
advance() {
|
|
107902
107915
|
while (this.part < this.parts.length && this.offset === this.parts[this.part].bytes.length) {
|
|
107916
|
+
this.context.signal.throwIfAborted();
|
|
107917
|
+
this.context.work?.();
|
|
107903
107918
|
this.part++;
|
|
107904
107919
|
this.offset = 0;
|
|
107905
107920
|
}
|
|
@@ -107907,6 +107922,8 @@ var BiffStrings = class {
|
|
|
107907
107922
|
invalidBiff("truncated string/CONTINUE");
|
|
107908
107923
|
}
|
|
107909
107924
|
byte() {
|
|
107925
|
+
this.context.signal.throwIfAborted();
|
|
107926
|
+
this.context.work?.();
|
|
107910
107927
|
this.advance();
|
|
107911
107928
|
return this.parts[this.part].u8(this.offset++);
|
|
107912
107929
|
}
|
|
@@ -107929,6 +107946,7 @@ var BiffStrings = class {
|
|
|
107929
107946
|
this.context.signal.throwIfAborted();
|
|
107930
107947
|
if (length > (this.context.limits.workbookTextBytes ?? this.context.limits.inputBytes))
|
|
107931
107948
|
throw new SsconvertError("resource-limit", "ssconvert BIFF string limit exceeded");
|
|
107949
|
+
this.context.retain?.(length * 16);
|
|
107932
107950
|
}
|
|
107933
107951
|
unicode(length) {
|
|
107934
107952
|
this.admit(length * 3);
|
|
@@ -107941,6 +107959,7 @@ var BiffStrings = class {
|
|
|
107941
107959
|
const characters = [];
|
|
107942
107960
|
for (let i = 0; i < length; i++) {
|
|
107943
107961
|
this.context.signal.throwIfAborted();
|
|
107962
|
+
this.context.work?.();
|
|
107944
107963
|
if (this.offset === this.parts[this.part].bytes.length) {
|
|
107945
107964
|
this.advance();
|
|
107946
107965
|
const width2 = this.byte();
|
|
@@ -112683,8 +112702,8 @@ function translateBiffFormula(bytes, context) {
|
|
|
112683
112702
|
const rawSheet = data3.u16(offset), signedSheet = rawSheet >= 32768 ? rawSheet - 65536 : rawSheet;
|
|
112684
112703
|
const index2 = context.revision >= 8 ? data3.u32(offset + 2) : data3.u16(offset + 10);
|
|
112685
112704
|
offset += width2;
|
|
112686
|
-
const
|
|
112687
|
-
const extern =
|
|
112705
|
+
const namespace6 = context.revision >= 8 ? rawSheet : signedSheet > 0 ? signedSheet - 1 : void 0;
|
|
112706
|
+
const extern = namespace6 === void 0 ? void 0 : context.externalNames?.[namespace6];
|
|
112688
112707
|
if (extern !== void 0) {
|
|
112689
112708
|
const name2 = extern[index2 - 1];
|
|
112690
112709
|
if (!name2) {
|
|
@@ -112899,7 +112918,7 @@ function biffExternalPath(path2) {
|
|
|
112899
112918
|
function biffFormulaExtras(parts, revision2, codepage, context, accountWork) {
|
|
112900
112919
|
const cursor = new BiffStrings(parts, context, codepage);
|
|
112901
112920
|
const number5 = new Uint8Array(8), view2 = new DataView(number5.buffer);
|
|
112902
|
-
const
|
|
112921
|
+
const encoder4 = new TextEncoder();
|
|
112903
112922
|
const workLimit = context.limits.workbookWork ?? context.limits.inputBytes * 8;
|
|
112904
112923
|
const textLimit = context.limits.workbookTextBytes ?? context.limits.inputBytes;
|
|
112905
112924
|
let work = 0, textBytes = 0;
|
|
@@ -112914,7 +112933,7 @@ function biffFormulaExtras(parts, revision2, codepage, context, accountWork) {
|
|
|
112914
112933
|
accountWork?.(columns * rows);
|
|
112915
112934
|
const chunks = [];
|
|
112916
112935
|
const append = (text2) => {
|
|
112917
|
-
textBytes +=
|
|
112936
|
+
textBytes += encoder4.encode(text2).length;
|
|
112918
112937
|
if (textBytes > textLimit)
|
|
112919
112938
|
throw new SsconvertError("resource-limit", "ssconvert BIFF array text limit exceeded");
|
|
112920
112939
|
chunks.push(text2);
|
|
@@ -113276,8 +113295,8 @@ var BiffNameBindings = class {
|
|
|
113276
113295
|
});
|
|
113277
113296
|
}
|
|
113278
113297
|
};
|
|
113279
|
-
function biffNode(name, attributes4, text2 = "",
|
|
113280
|
-
return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children:
|
|
113298
|
+
function biffNode(name, attributes4, text2 = "", children8 = []) {
|
|
113299
|
+
return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children8 };
|
|
113281
113300
|
}
|
|
113282
113301
|
var biffMetadataOpcodes = /* @__PURE__ */ new Set([
|
|
113283
113302
|
42,
|
|
@@ -125864,7 +125883,7 @@ var BiffFormulaWriter = class {
|
|
|
125864
125883
|
return order;
|
|
125865
125884
|
}
|
|
125866
125885
|
compile(source, sheet, row, column, definition, arrayStringLiterals) {
|
|
125867
|
-
const
|
|
125886
|
+
const parse3 = (expression2, position, literals = arrayStringLiterals ?? false) => {
|
|
125868
125887
|
const parsed = parseExpression(expression2, {
|
|
125869
125888
|
maximumDepth: this.context.limits.formulaDepth,
|
|
125870
125889
|
workbook: this.book,
|
|
@@ -125884,7 +125903,7 @@ var BiffFormulaWriter = class {
|
|
|
125884
125903
|
}).root;
|
|
125885
125904
|
};
|
|
125886
125905
|
const relative = definition !== void 0;
|
|
125887
|
-
const root = definition ? parseNamedExpression(definition, this.book,
|
|
125906
|
+
const root = definition ? parseNamedExpression(definition, this.book, parse3, () => this.context.signal.throwIfAborted()) : parse3(source, { sheet, row, column });
|
|
125888
125907
|
const bytes = [], arrays = [], diagnostics = [];
|
|
125889
125908
|
const tokenBoundaries = [], arrayBoundaries = [];
|
|
125890
125909
|
const arrayStrings = [];
|
|
@@ -127168,12 +127187,12 @@ async function mergeBiffProperties(book, streams, handled, context, charge, allo
|
|
|
127168
127187
|
snapshots.delete(name);
|
|
127169
127188
|
if (!snapshots.size)
|
|
127170
127189
|
return preserved;
|
|
127171
|
-
const
|
|
127190
|
+
const parse3 = (bytes) => readBiffPropertySections(bytes, admit2, charge).map((section) => {
|
|
127172
127191
|
const data3 = bytes.subarray(section.offset, section.end);
|
|
127173
127192
|
return { ...section, bytes: data3, ...biffPropertyFields.has(section.guid) || section.guid === biffPropertyFormats.custom ? { values: readBiffPropertyValues(new Binary(data3), admit2, charge) } : {} };
|
|
127174
127193
|
});
|
|
127175
|
-
const old = new Map([...snapshots].map(([name, snapshot]) => [name,
|
|
127176
|
-
const fresh = new Map([...streams].map(([name, bytes]) => [name,
|
|
127194
|
+
const old = new Map([...snapshots].map(([name, snapshot]) => [name, parse3(snapshot.bytes)]));
|
|
127195
|
+
const fresh = new Map([...streams].map(([name, bytes]) => [name, parse3(bytes)]));
|
|
127177
127196
|
const original = /* @__PURE__ */ new Map(), pending = /* @__PURE__ */ new Map();
|
|
127178
127197
|
const identity2 = (property) => `${property.stream}:${property.section}:${property.id}`;
|
|
127179
127198
|
const readContext = { ...context, limits: { ...context.limits, inputBytes: context.limits.outputBytes } };
|
|
@@ -127467,7 +127486,7 @@ function handledPropertyRecord(record7, keys, charge) {
|
|
|
127467
127486
|
charge(data3.name.length + data3.namespace.length + data3.text.length + data3.attributes.length + data3.children.length);
|
|
127468
127487
|
return data3;
|
|
127469
127488
|
};
|
|
127470
|
-
const attributes4 = (n,
|
|
127489
|
+
const attributes4 = (n, namespace6, allowed) => {
|
|
127471
127490
|
const result2 = /* @__PURE__ */ new Map();
|
|
127472
127491
|
for (const value3 of n.attributes) {
|
|
127473
127492
|
charge(1);
|
|
@@ -127480,9 +127499,9 @@ function handledPropertyRecord(record7, keys, charge) {
|
|
|
127480
127499
|
if (!["name", "namespace", "value"].includes(key))
|
|
127481
127500
|
return void 0;
|
|
127482
127501
|
}
|
|
127483
|
-
if (typeof attr6.name !== "string" || attr6.namespace !==
|
|
127502
|
+
if (typeof attr6.name !== "string" || attr6.namespace !== namespace6 || typeof attr6.value !== "string" || !allowed.includes(attr6.name) || result2.has(attr6.name))
|
|
127484
127503
|
return void 0;
|
|
127485
|
-
charge(attr6.name.length +
|
|
127504
|
+
charge(attr6.name.length + namespace6.length + attr6.value.length);
|
|
127486
127505
|
result2.set(attr6.name, attr6.value);
|
|
127487
127506
|
}
|
|
127488
127507
|
return result2;
|
|
@@ -132594,10 +132613,10 @@ function crc322(bytes, previous = 0) {
|
|
|
132594
132613
|
function createZipCodec(runtime = defaults, profile = {}) {
|
|
132595
132614
|
const { yieldTurn, fail: fail2 } = runtime;
|
|
132596
132615
|
const { codec, CodecReader } = runtime.compression;
|
|
132597
|
-
const
|
|
132616
|
+
const decoder2 = new TextDecoder("utf-8", { fatal: true, ignoreBOM: true });
|
|
132598
132617
|
function text2(bytes) {
|
|
132599
132618
|
try {
|
|
132600
|
-
return
|
|
132619
|
+
return decoder2.decode(bytes);
|
|
132601
132620
|
} catch {
|
|
132602
132621
|
return fail2("invalid UTF-8 archive name or metadata");
|
|
132603
132622
|
}
|
|
@@ -135209,8 +135228,8 @@ function number(value3, fallback = 0) {
|
|
|
135209
135228
|
function sourceRecord(node3) {
|
|
135210
135229
|
return { name: node3.localName, namespace: node3.namespace, attributes: Object.fromEntries(node3.attributes.filter((a3) => a3.namespace !== "http://www.w3.org/2000/xmlns/").map((a3) => [a3.name, a3.value])), text: node3.text, children: node3.children.map(sourceRecord) };
|
|
135211
135230
|
}
|
|
135212
|
-
function record2(name, attributes4, text2 = "",
|
|
135213
|
-
return { name, namespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children:
|
|
135231
|
+
function record2(name, attributes4, text2 = "", children8 = []) {
|
|
135232
|
+
return { name, namespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: text2, children: children8 };
|
|
135214
135233
|
}
|
|
135215
135234
|
function indexed(index2) {
|
|
135216
135235
|
if (index2 < 8)
|
|
@@ -135462,8 +135481,8 @@ function numeric3(source, fallback) {
|
|
|
135462
135481
|
throw new SsconvertError("io", "E Invalid XLSX: invalid print number");
|
|
135463
135482
|
return value3;
|
|
135464
135483
|
}
|
|
135465
|
-
function gnode(name, attributes4 = {},
|
|
135466
|
-
return { name, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children:
|
|
135484
|
+
function gnode(name, attributes4 = {}, children8 = [], text2 = "") {
|
|
135485
|
+
return { name, namespace: gnumericNamespace, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8, text: text2 };
|
|
135467
135486
|
}
|
|
135468
135487
|
function header2(source) {
|
|
135469
135488
|
const sections = { Left: "", Middle: "", Right: "" };
|
|
@@ -135693,7 +135712,7 @@ function header3(node3, fallback, charge) {
|
|
|
135693
135712
|
return "&" + ["L", "C", "R"][index2] + output2;
|
|
135694
135713
|
}).join("");
|
|
135695
135714
|
}
|
|
135696
|
-
async function writeXlsxSheetSettings(sheet, records, xml2, context,
|
|
135715
|
+
async function writeXlsxSheetSettings(sheet, records, xml2, context, namespace6, charge) {
|
|
135697
135716
|
const handled = /* @__PURE__ */ new Set(), raw = /* @__PURE__ */ new Map();
|
|
135698
135717
|
for (const { record: record7, node: node4 } of records) {
|
|
135699
135718
|
charge();
|
|
@@ -135704,7 +135723,7 @@ async function writeXlsxSheetSettings(sheet, records, xml2, context, namespace5,
|
|
|
135704
135723
|
}
|
|
135705
135724
|
const node3 = (name, attributes4 = {}, content2 = [], text2 = "") => {
|
|
135706
135725
|
charge();
|
|
135707
|
-
return { name, namespace:
|
|
135726
|
+
return { name, namespace: namespace6, attributes: Object.fromEntries(Object.entries(attributes4).flatMap(([key, value3]) => value3 === void 0 ? [] : [[key, String(value3)]])), children: content2, text: text2 };
|
|
135708
135727
|
};
|
|
135709
135728
|
const originalPrint = metadataNode(readXlsxMetadata(node3("worksheet", {}, [...raw.values()])).find((record7) => record7.kind === "PrintInformation")?.data, charge);
|
|
135710
135729
|
const currentPrint = records.find((record7) => record7.record.kind === "PrintInformation")?.node ?? originalPrint;
|
|
@@ -135902,7 +135921,7 @@ function rgb(source, fallback) {
|
|
|
135902
135921
|
function alignment(value3, fallback) {
|
|
135903
135922
|
return value3 === void 0 ? fallback : value3.toLowerCase().split("_").at(-1) ?? fallback;
|
|
135904
135923
|
}
|
|
135905
|
-
function createXlsxStyles(xml2, edition,
|
|
135924
|
+
function createXlsxStyles(xml2, edition, namespace6, charge) {
|
|
135906
135925
|
const styles = [{ format: "General" }];
|
|
135907
135926
|
const dxfs = [];
|
|
135908
135927
|
const differentialIds = /* @__PURE__ */ new Map();
|
|
@@ -135965,7 +135984,7 @@ function createXlsxStyles(xml2, edition, namespace5, charge) {
|
|
|
135965
135984
|
defaultXf = xml2("xf", attrs, properties);
|
|
135966
135985
|
xfs.push(xml2("xf", { applyAlignment: 1, applyBorder: 1, applyFont: 1, applyFill: 1, applyNumberFormat: 1, ...attrs, xfId: 0 }, properties));
|
|
135967
135986
|
}
|
|
135968
|
-
return xml2("styleSheet", { xmlns:
|
|
135987
|
+
return xml2("styleSheet", { xmlns: namespace6 }, (custom2.size ? xml2("numFmts", { count: custom2.size }, [...custom2].map(([formatCode, numFmtId]) => xml2("numFmt", { formatCode, numFmtId })).join("")) : "") + xml2("fonts", { count: fonts.length }, fonts.join("")) + xml2("fills", { count: fills.length }, fills.join("")) + xml2("borders", { count: borders.length }, borders.join("")) + xml2("cellStyleXfs", { count: 1 }, defaultXf) + xml2("cellXfs", { count: xfs.length }, xfs.join("")) + xml2("cellStyles", { count: 1 }, xml2("cellStyle", { name: "Normal", xfId: 0, builtinId: 0 })) + (dxfs.length ? xml2("dxfs", { count: dxfs.length }, dxfs.map((node3) => {
|
|
135969
135988
|
const a3 = node3.attributes;
|
|
135970
135989
|
let content2 = "";
|
|
135971
135990
|
if (a3.Back !== void 0 || a3.Shade !== void 0)
|
|
@@ -135995,9 +136014,9 @@ function styleRecord(style2) {
|
|
|
135995
136014
|
function child3(node3, name) {
|
|
135996
136015
|
return node3?.children.find((n) => n.name === name);
|
|
135997
136016
|
}
|
|
135998
|
-
async function writeXlsxSheetMetadata(sheet, number5, xml2, context,
|
|
136017
|
+
async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace6, formula3, styles, charge) {
|
|
135999
136018
|
const records = (sheet.unsupportedRecords ?? []).map((record7) => ({ record: record7, node: metadataNode(record7.data, charge) }));
|
|
136000
|
-
const settings = await writeXlsxSheetSettings(sheet, records, xml2, context,
|
|
136019
|
+
const settings = await writeXlsxSheetSettings(sheet, records, xml2, context, namespace6, charge);
|
|
136001
136020
|
const pi2 = records.find((r) => r.record.kind === "PrintInformation")?.node;
|
|
136002
136021
|
let print = settings.print;
|
|
136003
136022
|
let filters = "", rules = "";
|
|
@@ -136005,7 +136024,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
|
|
|
136005
136024
|
const handled = /* @__PURE__ */ new Set(["PrintInformation", "SheetLayout", "Styles"]);
|
|
136006
136025
|
const render = (node3) => {
|
|
136007
136026
|
charge();
|
|
136008
|
-
if (node3.namespace !==
|
|
136027
|
+
if (node3.namespace !== namespace6 || Object.keys(node3.attributes).some((name) => name === "xmlns" || name.includes(":") && name !== "xml:space"))
|
|
136009
136028
|
throw new SsconvertError("unsupported-feature", "Unsupported ssconvert feature: XLSX metadata namespace or relationship");
|
|
136010
136029
|
return xml2(node3.name, node3.attributes, escapeXlsx(node3.text) + node3.children.map(render).join(""));
|
|
136011
136030
|
};
|
|
@@ -136014,7 +136033,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
|
|
|
136014
136033
|
const breaks = child3(pi2, gnm);
|
|
136015
136034
|
if (!breaks || breaks.children.length === 0)
|
|
136016
136035
|
continue;
|
|
136017
|
-
const raw = records.find((r) => r.record.kind === name && r.node?.namespace ===
|
|
136036
|
+
const raw = records.find((r) => r.record.kind === name && r.node?.namespace === namespace6)?.node;
|
|
136018
136037
|
const original = raw?.children.filter((n) => {
|
|
136019
136038
|
charge();
|
|
136020
136039
|
return n.name === "brk";
|
|
@@ -136167,7 +136186,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
|
|
|
136167
136186
|
name: `comments${number5}.xml`,
|
|
136168
136187
|
relation: "comments",
|
|
136169
136188
|
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",
|
|
136170
|
-
content: xml2("comments", { xmlns:
|
|
136189
|
+
content: xml2("comments", { xmlns: namespace6 }, xml2("authors", {}, authors.map((a3) => xml2("author", {}, escapeXlsx(encodeXlsxString(a3)))).join("")) + xml2("commentList", {}, comments.map((comment) => xml2("comment", { ref: comment.attributes.ObjectBound?.split(":")[0] ?? "A1", authorId: comment.attributes.Author === void 0 ? void 0 : authors.indexOf(comment.attributes.Author) }, commentText(comment))).join("")))
|
|
136171
136190
|
});
|
|
136172
136191
|
if (comments.length)
|
|
136173
136192
|
parts.push({
|
|
@@ -136263,7 +136282,7 @@ async function writeXlsxSheetMetadata(sheet, number5, xml2, context, namespace5,
|
|
|
136263
136282
|
continue;
|
|
136264
136283
|
if (record7.source === "Gnumeric_XmlIO:sax" && (record7.kind === "Rows" && sheet.rows !== void 0 || record7.kind === "Cols" && sheet.columns !== void 0))
|
|
136265
136284
|
continue;
|
|
136266
|
-
if (node3?.namespace ===
|
|
136285
|
+
if (node3?.namespace === namespace6 && record7.kind === "dataValidations") {
|
|
136267
136286
|
rules += render(node3);
|
|
136268
136287
|
continue;
|
|
136269
136288
|
}
|
|
@@ -136321,8 +136340,8 @@ function writeXlsxProperties(book, xml2) {
|
|
|
136321
136340
|
"xlsx:HyperlinksChanged": ["HyperlinksChanged", "bool"],
|
|
136322
136341
|
"gsf:security": ["DocSecurity", "int"]
|
|
136323
136342
|
};
|
|
136324
|
-
const
|
|
136325
|
-
const sorted = Object.entries(book.properties ?? {}).map(([key, value3]) => ({ key, value: value3, bytes:
|
|
136343
|
+
const encoder4 = new TextEncoder();
|
|
136344
|
+
const sorted = Object.entries(book.properties ?? {}).map(([key, value3]) => ({ key, value: value3, bytes: encoder4.encode(key) })).sort((a3, b3) => {
|
|
136326
136345
|
for (let index2 = 0; index2 < Math.min(a3.bytes.length, b3.bytes.length); index2++) {
|
|
136327
136346
|
const diff = a3.bytes[index2] - b3.bytes[index2];
|
|
136328
136347
|
if (diff)
|
|
@@ -136399,18 +136418,18 @@ function nativeOpenFormula(source, position, context, arrayStringLiterals = fals
|
|
|
136399
136418
|
return serializeExpression(parsed.document, gnumericGrammar, false, true, { relativeSheets: "fixed" });
|
|
136400
136419
|
}
|
|
136401
136420
|
function readFormulaSemantics(node3) {
|
|
136402
|
-
const value3 = node3?.attributes.find((
|
|
136421
|
+
const value3 = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "array-string-literals")?.value;
|
|
136403
136422
|
if (value3 !== void 0 && value3 !== "0" && value3 !== "1")
|
|
136404
136423
|
throw new SsconvertError("io", "Invalid ssconvert formula array string semantics");
|
|
136405
136424
|
return value3 === "1" ? { arrayStringLiterals: true } : {};
|
|
136406
136425
|
}
|
|
136407
136426
|
function readOpenFormula(node3) {
|
|
136408
|
-
const source = node3?.attributes.find((
|
|
136427
|
+
const source = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula")?.value;
|
|
136409
136428
|
if (source === void 0)
|
|
136410
136429
|
return void 0;
|
|
136411
136430
|
if (!source.startsWith("of:="))
|
|
136412
136431
|
throw new SsconvertError("io", "Invalid ssconvert OpenFormula expression");
|
|
136413
|
-
const anchor = node3?.attributes.find((
|
|
136432
|
+
const anchor = node3?.attributes.find((attribute7) => attribute7.namespace === namespace2 && attribute7.localName === "openformula-origin")?.value;
|
|
136414
136433
|
if (anchor === void 0)
|
|
136415
136434
|
return { source };
|
|
136416
136435
|
let values2;
|
|
@@ -136464,27 +136483,27 @@ async function recognize(root, schema, context) {
|
|
|
136464
136483
|
context.signal.throwIfAborted();
|
|
136465
136484
|
const matches = edges2.get(parent + ":" + node3.localName) ?? [];
|
|
136466
136485
|
const scans = ancestors.length === 0 || xlsxNamespaceScanElements.has(ancestors[ancestors.length - 1]);
|
|
136467
|
-
let
|
|
136486
|
+
let namespace6 = inheritedNamespace;
|
|
136468
136487
|
if (scans)
|
|
136469
|
-
for (const
|
|
136470
|
-
if (
|
|
136488
|
+
for (const attribute7 of node3.attributes) {
|
|
136489
|
+
if (attribute7.namespace !== "http://www.w3.org/2000/xmlns/")
|
|
136471
136490
|
continue;
|
|
136472
|
-
const key = Object.keys(xlsxNamespaces).find((key2) => xlsxNamespaces[key2].includes(
|
|
136473
|
-
if (
|
|
136491
|
+
const key = Object.keys(xlsxNamespaces).find((key2) => xlsxNamespaces[key2].includes(attribute7.value));
|
|
136492
|
+
if (attribute7.name === "xmlns") {
|
|
136474
136493
|
if (key)
|
|
136475
|
-
|
|
136494
|
+
namespace6 = key;
|
|
136476
136495
|
} else if (key) {
|
|
136477
|
-
const prefix2 =
|
|
136496
|
+
const prefix2 = attribute7.localName;
|
|
136478
136497
|
if (!prefixes.has(prefix2)) {
|
|
136479
136498
|
prefixes.set(prefix2, key);
|
|
136480
136499
|
if (!namespacePrefixes.has(key))
|
|
136481
136500
|
namespacePrefixes.set(key, prefix2);
|
|
136482
136501
|
}
|
|
136483
136502
|
} else
|
|
136484
|
-
unknownPrefixes.add(
|
|
136503
|
+
unknownPrefixes.add(attribute7.localName);
|
|
136485
136504
|
}
|
|
136486
136505
|
const colon = node3.name.indexOf(":"), prefix = colon < 0 ? void 0 : node3.name.slice(0, colon);
|
|
136487
|
-
const match3 = matches.find((m) => prefix === void 0 ? m[2] ===
|
|
136506
|
+
const match3 = matches.find((m) => prefix === void 0 ? m[2] === namespace6 : namespacePrefixes.get(m[2]) === prefix);
|
|
136488
136507
|
if (!match3) {
|
|
136489
136508
|
if (prefix !== void 0 && unknownPrefixes.has(prefix))
|
|
136490
136509
|
return void 0;
|
|
@@ -136503,7 +136522,7 @@ async function recognize(root, schema, context) {
|
|
|
136503
136522
|
return node3;
|
|
136504
136523
|
const accepted2 = [];
|
|
136505
136524
|
for (const item of node3.children) {
|
|
136506
|
-
const child7 = await visit(item, match3[1], [...ancestors, node3.localName],
|
|
136525
|
+
const child7 = await visit(item, match3[1], [...ancestors, node3.localName], namespace6);
|
|
136507
136526
|
if (child7)
|
|
136508
136527
|
accepted2.push(child7);
|
|
136509
136528
|
}
|
|
@@ -136511,10 +136530,10 @@ async function recognize(root, schema, context) {
|
|
|
136511
136530
|
...node3,
|
|
136512
136531
|
namespace: xlsxNamespaces[match3[2]]?.[0] ?? node3.namespace,
|
|
136513
136532
|
children: accepted2,
|
|
136514
|
-
attributes: node3.attributes.map((
|
|
136515
|
-
const colon2 =
|
|
136516
|
-
const key = colon2 < 0 ? void 0 : prefixes.get(
|
|
136517
|
-
return key ? { ...
|
|
136533
|
+
attributes: node3.attributes.map((attribute7) => {
|
|
136534
|
+
const colon2 = attribute7.name.indexOf(":");
|
|
136535
|
+
const key = colon2 < 0 ? void 0 : prefixes.get(attribute7.name.slice(0, colon2));
|
|
136536
|
+
return key ? { ...attribute7, namespace: xlsxNamespaces[key][0] } : attribute7;
|
|
136518
136537
|
})
|
|
136519
136538
|
};
|
|
136520
136539
|
}
|
|
@@ -136532,8 +136551,8 @@ function children3(node3, name) {
|
|
|
136532
136551
|
function child4(node3, name) {
|
|
136533
136552
|
return children3(node3, name)[0];
|
|
136534
136553
|
}
|
|
136535
|
-
function attr2(node3, name,
|
|
136536
|
-
return node3?.attributes.find((item) => item.localName === name && item.namespace ===
|
|
136554
|
+
function attr2(node3, name, namespace6 = "") {
|
|
136555
|
+
return node3?.attributes.find((item) => item.localName === name && item.namespace === namespace6)?.value;
|
|
136537
136556
|
}
|
|
136538
136557
|
function number2(value3, fallback = 0) {
|
|
136539
136558
|
if (value3 === void 0)
|
|
@@ -137255,8 +137274,8 @@ function createXlsxWriter(edition) {
|
|
|
137255
137274
|
}) };
|
|
137256
137275
|
}) };
|
|
137257
137276
|
}
|
|
137258
|
-
const
|
|
137259
|
-
const styles = createXlsxStyles(xml2, edition,
|
|
137277
|
+
const namespace6 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
137278
|
+
const styles = createXlsxStyles(xml2, edition, namespace6, charge);
|
|
137260
137279
|
const zip = createZipCodec();
|
|
137261
137280
|
const bounds2 = {
|
|
137262
137281
|
...zipLimits(context),
|
|
@@ -137268,20 +137287,20 @@ function createXlsxWriter(edition) {
|
|
|
137268
137287
|
const entries2 = [], types2 = [
|
|
137269
137288
|
{ name: "xl/workbook.xml", type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" }
|
|
137270
137289
|
];
|
|
137271
|
-
const
|
|
137290
|
+
const encoder4 = new TextEncoder();
|
|
137272
137291
|
let plainBytes = 0;
|
|
137273
137292
|
const declaration = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
137274
137293
|
const modified = new Date(context.clock?.now() ?? Date.UTC(2e3, 0, 1));
|
|
137275
137294
|
async function add5(name, content2, type) {
|
|
137276
137295
|
context.signal.throwIfAborted();
|
|
137277
137296
|
charge(content2.length);
|
|
137278
|
-
const length =
|
|
137297
|
+
const length = encoder4.encode(declaration + content2 + "\n").length;
|
|
137279
137298
|
if (length > context.limits.outputBytes - plainBytes)
|
|
137280
137299
|
limit("output bytes");
|
|
137281
137300
|
if (entries2.length >= bounds2.maxMembers)
|
|
137282
137301
|
limit("members");
|
|
137283
137302
|
plainBytes += length;
|
|
137284
|
-
entries2.push(await zip.makeZipEntry(name,
|
|
137303
|
+
entries2.push(await zip.makeZipEntry(name, encoder4.encode(declaration + content2 + "\n"), { modified, mode: 420, directory: false, symlink: false, compression: "deflate" }, bounds2, context.signal));
|
|
137285
137304
|
if (type)
|
|
137286
137305
|
types2.push({ name, type });
|
|
137287
137306
|
}
|
|
@@ -137455,7 +137474,7 @@ function createXlsxWriter(edition) {
|
|
|
137455
137474
|
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]])
|
|
137456
137475
|
if (view2[gnm] !== void 0)
|
|
137457
137476
|
viewAttrs[xlsx] = (invert ? !Number(view2[gnm]) : !!Number(view2[gnm])) ? 1 : 0;
|
|
137458
|
-
const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context,
|
|
137477
|
+
const metadata3 = await writeXlsxSheetMetadata(sheet, index2 + 1, xml2, context, namespace6, exportXlsxFormula.bind(null, book), styles, charge);
|
|
137459
137478
|
let cols = "", nextColumn = 0;
|
|
137460
137479
|
for (const c4 of [...sheet.columns ?? []].sort((a3, b3) => a3.index - b3.index)) {
|
|
137461
137480
|
const importedColumn = metadataNode(c4.style?.gnumeric, charge);
|
|
@@ -137507,7 +137526,7 @@ function createXlsxWriter(edition) {
|
|
|
137507
137526
|
tooltip: link.attributes.tip
|
|
137508
137527
|
});
|
|
137509
137528
|
}
|
|
137510
|
-
const sheetXml = xml2("worksheet", { xmlns:
|
|
137529
|
+
const sheetXml = xml2("worksheet", { xmlns: namespace6, "xmlns:r": relationships, "xmlns:gnmx": "http://www.gnumeric.org/ext/spreadsheetml" }, metadata3.properties + xml2("dimension", { ref: dimension }) + xml2("sheetViews", {}, xml2("sheetView", viewAttrs, xml2("selection", { activeCell: "A1", sqref: "A1" }))) + metadata3.format + xml2("cols", {}, cols) + xml2("sheetData", {}, sheetData) + metadata3.protection + metadata3.filters + (sheet.merges?.length ? xml2("mergeCells", {}, sheet.merges.map((r) => xml2("mergeCell", { ref: rangeText(r) })).join("")) : "") + metadata3.rules + (hyperlinks ? xml2("hyperlinks", {}, hyperlinks) : "") + metadata3.print + (legacyDrawing ? xml2("legacyDrawing", { "r:id": legacyDrawing }) : ""));
|
|
137511
137530
|
const partName = `worksheets/sheet${index2 + 1}.xml`;
|
|
137512
137531
|
await add5("xl/" + partName, sheetXml);
|
|
137513
137532
|
if (rels.length)
|
|
@@ -137517,7 +137536,7 @@ function createXlsxWriter(edition) {
|
|
|
137517
137536
|
sheetNodes.push(xml2("sheet", { name: sheet.name, sheetId: index2 + 1, "r:id": id }));
|
|
137518
137537
|
}
|
|
137519
137538
|
if (shared.length) {
|
|
137520
|
-
await add5("xl/sharedStrings.xml", xml2("sst", { xmlns:
|
|
137539
|
+
await add5("xl/sharedStrings.xml", xml2("sst", { xmlns: namespace6, uniqueCount: shared.length, count: shared.length }, shared.map((cell) => xml2("si", {}, writeRichString(cell.value.kind === "string" ? cell.value.value : "", cell.richText, xml2, charge))).join("")), "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml");
|
|
137521
137540
|
workbookRelations.push({ id: `rId${workbookRelations.length + 1}`, type: relationships + "/sharedStrings", target: "sharedStrings.xml" });
|
|
137522
137541
|
}
|
|
137523
137542
|
await add5("xl/styles.xml", styles.serialize(), "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml");
|
|
@@ -137546,7 +137565,7 @@ function createXlsxWriter(edition) {
|
|
|
137546
137565
|
if (!book.names?.some((n) => n.name === name && n.sheet === sheet.id))
|
|
137547
137566
|
names2 += xml2("definedName", { name: "_xlnm." + name, localSheetId: index2 }, escapeXlsx(expression2));
|
|
137548
137567
|
}
|
|
137549
|
-
await add5("xl/workbook.xml", xml2("workbook", { xmlns:
|
|
137568
|
+
await add5("xl/workbook.xml", xml2("workbook", { xmlns: namespace6, "xmlns:r": relationships }, xml2("fileVersion", { lastEdited: 4, lowestEdited: 4, rupBuild: 3820 }) + xml2("workbookPr", { date1904: book.dateSystem === "1904" ? 1 : 0 }) + xml2("bookViews", {}, xml2("workbookView", { activeTab: active })) + xml2("sheets", {}, sheetNodes.join("")) + xml2("definedNames", {}, names2) + xml2("calcPr", {
|
|
137550
137569
|
calcMode: book.calculationMode === "manual" ? "manual" : "auto",
|
|
137551
137570
|
iterate: book.iteration?.enabled === false ? 0 : 1,
|
|
137552
137571
|
iterateCount: book.iteration?.maximum ?? 100,
|
|
@@ -137687,8 +137706,8 @@ var xlsxFormat = {
|
|
|
137687
137706
|
};
|
|
137688
137707
|
var xl = "urn:schemas-microsoft-com:office:excel";
|
|
137689
137708
|
var gnumeric = "http://www.gnumeric.org/v10.dtd";
|
|
137690
|
-
function node(name, attributes4 = {},
|
|
137691
|
-
return { name, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: "", children:
|
|
137709
|
+
function node(name, attributes4 = {}, children8 = []) {
|
|
137710
|
+
return { name, namespace: gnumeric, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), text: "", children: children8 };
|
|
137692
137711
|
}
|
|
137693
137712
|
function readSpreadsheetMLMetadata(worksheet, sheet, context, chargeWorkbookWork) {
|
|
137694
137713
|
const result2 = [];
|
|
@@ -137992,10 +138011,10 @@ async function recognize2(root, context, positions, warnings) {
|
|
|
137992
138011
|
async function visit(node3, parent, ancestors, inherited) {
|
|
137993
138012
|
context.signal.throwIfAborted();
|
|
137994
138013
|
const start = position++;
|
|
137995
|
-
let
|
|
138014
|
+
let namespace6 = inherited;
|
|
137996
138015
|
const defaultNamespace = node3.attributes.find((a3) => a3.name === "xmlns");
|
|
137997
138016
|
if (defaultNamespace)
|
|
137998
|
-
|
|
138017
|
+
namespace6 = Object.keys(namespaces).find((key) => namespaces[key].includes(defaultNamespace.value)) ?? "";
|
|
137999
138018
|
if (parent === "START" || parent === "WORKBOOK")
|
|
138000
138019
|
for (const a3 of node3.attributes) {
|
|
138001
138020
|
if (a3.namespace !== "http://www.w3.org/2000/xmlns/")
|
|
@@ -138003,7 +138022,7 @@ async function recognize2(root, context, positions, warnings) {
|
|
|
138003
138022
|
const key = Object.keys(namespaces).find((key2) => namespaces[key2].includes(a3.value));
|
|
138004
138023
|
if (a3.name === "xmlns") {
|
|
138005
138024
|
if (key)
|
|
138006
|
-
|
|
138025
|
+
namespace6 = key;
|
|
138007
138026
|
} else if (key) {
|
|
138008
138027
|
if (!prefixes.has(a3.localName)) {
|
|
138009
138028
|
prefixes.set(a3.localName, key);
|
|
@@ -138014,7 +138033,7 @@ async function recognize2(root, context, positions, warnings) {
|
|
|
138014
138033
|
unknown.add(a3.localName);
|
|
138015
138034
|
}
|
|
138016
138035
|
const colon = node3.name.indexOf(":"), prefix = colon < 0 ? void 0 : node3.name.slice(0, colon);
|
|
138017
|
-
const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix === void 0 ? n[2] ===
|
|
138036
|
+
const match3 = spreadsheetmlSchema.find((n) => n[0] === parent && n[3] === node3.localName && (prefix === void 0 ? n[2] === namespace6 : primary.get(n[2]) === prefix));
|
|
138018
138037
|
if (!match3) {
|
|
138019
138038
|
if (prefix === void 0 || !unknown.has(prefix)) {
|
|
138020
138039
|
const message = `Unexpected element '${node3.name}' in state :
|
|
@@ -138026,7 +138045,7 @@ async function recognize2(root, context, positions, warnings) {
|
|
|
138026
138045
|
}
|
|
138027
138046
|
const accepted2 = [];
|
|
138028
138047
|
for (const child7 of node3.children) {
|
|
138029
|
-
const value3 = await visit(child7, match3[1], [...ancestors, node3.localName],
|
|
138048
|
+
const value3 = await visit(child7, match3[1], [...ancestors, node3.localName], namespace6);
|
|
138030
138049
|
if (value3)
|
|
138031
138050
|
accepted2.push(value3);
|
|
138032
138051
|
}
|
|
@@ -138044,8 +138063,8 @@ async function recognize2(root, context, positions, warnings) {
|
|
|
138044
138063
|
}
|
|
138045
138064
|
return visit(root, "START", [], "");
|
|
138046
138065
|
}
|
|
138047
|
-
function children4(node3, name,
|
|
138048
|
-
return node3?.children.filter((n) => n.localName === name && n.namespace === namespaces[
|
|
138066
|
+
function children4(node3, name, namespace6 = "SS") {
|
|
138067
|
+
return node3?.children.filter((n) => n.localName === name && n.namespace === namespaces[namespace6][0]) ?? [];
|
|
138049
138068
|
}
|
|
138050
138069
|
function attr3(node3, name) {
|
|
138051
138070
|
return node3?.attributes.find((a3) => a3.localName === name && a3.namespace === namespaces.SS[0])?.value;
|
|
@@ -138059,11 +138078,11 @@ function content(node3) {
|
|
|
138059
138078
|
function styleMetadata(style2) {
|
|
138060
138079
|
const attributes4 = [], nested = [];
|
|
138061
138080
|
const color5 = (value3) => value3.startsWith("#") && value3.length === 7 ? [value3.slice(1, 3), value3.slice(3, 5), value3.slice(5, 7)].map((c4) => (parseInt(c4, 16) * 257).toString(16).toUpperCase()).join(":") : value3;
|
|
138062
|
-
const node3 = (name, values2,
|
|
138081
|
+
const node3 = (name, values2, children8 = [], text2 = "") => ({
|
|
138063
138082
|
name,
|
|
138064
138083
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
138065
138084
|
text: text2,
|
|
138066
|
-
children:
|
|
138085
|
+
children: children8,
|
|
138067
138086
|
attributes: Object.entries(values2).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(name2 === "Color" ? color5(String(value3)) : value3) }))
|
|
138068
138087
|
});
|
|
138069
138088
|
const fullStyle = {
|
|
@@ -138480,23 +138499,23 @@ async function readSpreadsheetML(bytes, context) {
|
|
|
138480
138499
|
charge();
|
|
138481
138500
|
const origin = colIndex;
|
|
138482
138501
|
let across = 0, down = 0, explicit;
|
|
138483
|
-
for (const
|
|
138484
|
-
if (
|
|
138502
|
+
for (const attribute7 of node3.attributes) {
|
|
138503
|
+
if (attribute7.namespace !== namespaces.SS[0])
|
|
138485
138504
|
continue;
|
|
138486
|
-
if (
|
|
138505
|
+
if (attribute7.localName === "Index") {
|
|
138487
138506
|
const index3 = await numeric4(node3, "Index", colIndex + 1, true, name, rowIndex, colIndex);
|
|
138488
138507
|
if (index3 > 0)
|
|
138489
138508
|
colIndex = index3 - 1;
|
|
138490
|
-
} else if (
|
|
138491
|
-
const result2 = await formula3(
|
|
138509
|
+
} else if (attribute7.localName === "Formula") {
|
|
138510
|
+
const result2 = await formula3(attribute7.value, name, rowIndex, origin, colIndex);
|
|
138492
138511
|
if (result2 !== void 0)
|
|
138493
138512
|
pending = result2;
|
|
138494
|
-
} else if (
|
|
138513
|
+
} else if (attribute7.localName === "MergeAcross")
|
|
138495
138514
|
across = await numeric4(node3, "MergeAcross", 0, true, name, rowIndex, colIndex);
|
|
138496
|
-
else if (
|
|
138515
|
+
else if (attribute7.localName === "MergeDown")
|
|
138497
138516
|
down = await numeric4(node3, "MergeDown", 0, true, name, rowIndex, colIndex);
|
|
138498
|
-
else if (
|
|
138499
|
-
explicit = styles.get(
|
|
138517
|
+
else if (attribute7.localName === "StyleID")
|
|
138518
|
+
explicit = styles.get(attribute7.value);
|
|
138500
138519
|
}
|
|
138501
138520
|
if (rowIndex >= 1048576 || colIndex >= 16384)
|
|
138502
138521
|
limit2("cell coordinates");
|
|
@@ -141049,20 +141068,20 @@ var EntityDecoder2 = class {
|
|
|
141049
141068
|
};
|
|
141050
141069
|
function getDecoder(decodeTree) {
|
|
141051
141070
|
let ret = "";
|
|
141052
|
-
const
|
|
141071
|
+
const decoder2 = new EntityDecoder2(decodeTree, (str2) => ret += fromCodePoint2(str2));
|
|
141053
141072
|
return function decodeWithTrie(str2, decodeMode) {
|
|
141054
141073
|
let lastIndex = 0;
|
|
141055
141074
|
let offset = 0;
|
|
141056
141075
|
while ((offset = str2.indexOf("&", offset)) >= 0) {
|
|
141057
141076
|
ret += str2.slice(lastIndex, offset);
|
|
141058
|
-
|
|
141059
|
-
const len =
|
|
141077
|
+
decoder2.startEntity(decodeMode);
|
|
141078
|
+
const len = decoder2.write(
|
|
141060
141079
|
str2,
|
|
141061
141080
|
// Skip the "&"
|
|
141062
141081
|
offset + 1
|
|
141063
141082
|
);
|
|
141064
141083
|
if (len < 0) {
|
|
141065
|
-
lastIndex = offset +
|
|
141084
|
+
lastIndex = offset + decoder2.end();
|
|
141066
141085
|
break;
|
|
141067
141086
|
}
|
|
141068
141087
|
lastIndex = offset + len;
|
|
@@ -142190,8 +142209,8 @@ function probeHtml(bytes, context) {
|
|
|
142190
142209
|
return text2.includes("<table") || text2.includes("<html") || text2.includes("<!doctype html");
|
|
142191
142210
|
}
|
|
142192
142211
|
var namespace3 = "http://www.gnumeric.org/v10.dtd";
|
|
142193
|
-
function record4(name, attributes4,
|
|
142194
|
-
return { name, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children:
|
|
142212
|
+
function record4(name, attributes4, children8 = [], text2 = "") {
|
|
142213
|
+
return { name, namespace: namespace3, text: text2, attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8 };
|
|
142195
142214
|
}
|
|
142196
142215
|
function span(source) {
|
|
142197
142216
|
if (source === void 0)
|
|
@@ -142646,36 +142665,36 @@ function createHtmlWriter(profile) {
|
|
|
142646
142665
|
tick();
|
|
142647
142666
|
if (from < run.start || from >= run.end)
|
|
142648
142667
|
continue;
|
|
142649
|
-
for (const [key,
|
|
142668
|
+
for (const [key, attribute7] of Object.entries(run.attributes)) {
|
|
142650
142669
|
tick();
|
|
142651
|
-
attributes4.set(key,
|
|
142670
|
+
attributes4.set(key, attribute7);
|
|
142652
142671
|
}
|
|
142653
142672
|
}
|
|
142654
|
-
for (const [key,
|
|
142673
|
+
for (const [key, attribute7] of attributes4) {
|
|
142655
142674
|
tick();
|
|
142656
142675
|
let open = "", close = "";
|
|
142657
|
-
if (key === "bold" && Number(
|
|
142676
|
+
if (key === "bold" && Number(attribute7)) {
|
|
142658
142677
|
open = "<b>";
|
|
142659
142678
|
close = "</b>";
|
|
142660
142679
|
}
|
|
142661
|
-
if (key === "italic" && Number(
|
|
142680
|
+
if (key === "italic" && Number(attribute7)) {
|
|
142662
142681
|
open = "<i>";
|
|
142663
142682
|
close = "</i>";
|
|
142664
142683
|
}
|
|
142665
|
-
if (key === "strikethrough" && Number(
|
|
142684
|
+
if (key === "strikethrough" && Number(attribute7)) {
|
|
142666
142685
|
open = profile.legacy ? "<strike>" : '<span style="text-decoration: line-through;">';
|
|
142667
142686
|
close = profile.legacy ? "</strike>" : "</span>";
|
|
142668
142687
|
}
|
|
142669
|
-
if (key === "underline" &&
|
|
142670
|
-
const value4 = String(
|
|
142688
|
+
if (key === "underline" && attribute7 !== "none") {
|
|
142689
|
+
const value4 = String(attribute7);
|
|
142671
142690
|
const name = Object.hasOwn(richUnderlineClasses, value4) ? richUnderlineClasses[value4] : void 0;
|
|
142672
142691
|
if (name) {
|
|
142673
142692
|
open = profile.legacy ? "<u>" : `<span class="${name}">`;
|
|
142674
142693
|
close = profile.legacy ? "</u>" : "</span>";
|
|
142675
142694
|
}
|
|
142676
142695
|
}
|
|
142677
|
-
if (key === "rise" && Math.abs(Number(
|
|
142678
|
-
const sub = key === "subscript" || key === "rise" && Number(
|
|
142696
|
+
if (key === "rise" && Math.abs(Number(attribute7)) > 5 || key === "subscript" && Number(attribute7) || key === "superscript" && Number(attribute7)) {
|
|
142697
|
+
const sub = key === "subscript" || key === "rise" && Number(attribute7) < 0;
|
|
142679
142698
|
open = sub ? "<sub>" : "<sup>";
|
|
142680
142699
|
close = sub ? "</sub>" : "</sup>";
|
|
142681
142700
|
}
|
|
@@ -144668,7 +144687,7 @@ async function readLotusWorks(bytes, context, formula3, decodeLmbcs) {
|
|
|
144668
144687
|
if (id === 21594) {
|
|
144669
144688
|
const font2 = fonts[data3.u8(4)], align = data3.u8(1), style3 = {};
|
|
144670
144689
|
if (font2) {
|
|
144671
|
-
for (const [bit,
|
|
144690
|
+
for (const [bit, attribute7] of [[1, "bold"], [2, "italic"], [4, "underline"], [8, "strike"]]) style3[attribute7] = !!(font2.variant & bit);
|
|
144672
144691
|
if (font2.size) style3.fontSize = font2.size / 2;
|
|
144673
144692
|
if (font2.variant & 240) style3.fontColor = colors[font2.variant >> 4 & 15];
|
|
144674
144693
|
style3.fontName = font2.name;
|
|
@@ -147543,13 +147562,13 @@ var lpsolve_default = {
|
|
|
147543
147562
|
],
|
|
147544
147563
|
"source": "plugins/lpsolve/plugin.xml.in"
|
|
147545
147564
|
};
|
|
147546
|
-
function solverRecord(attributes4,
|
|
147565
|
+
function solverRecord(attributes4, children8 = []) {
|
|
147547
147566
|
return {
|
|
147548
147567
|
name: "Solver",
|
|
147549
147568
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
147550
147569
|
text: "",
|
|
147551
147570
|
attributes: Object.entries(attributes4).map(([name, value3]) => ({ name, namespace: "", value: value3 })),
|
|
147552
|
-
children:
|
|
147571
|
+
children: children8
|
|
147553
147572
|
};
|
|
147554
147573
|
}
|
|
147555
147574
|
function constraintRecord(type, lhs, rhs) {
|
|
@@ -147749,12 +147768,12 @@ var mps_default = {
|
|
|
147749
147768
|
"source": "plugins/mps/plugin.xml.in"
|
|
147750
147769
|
};
|
|
147751
147770
|
function sylkStyleNode(style2) {
|
|
147752
|
-
function node3(name, attributes4,
|
|
147771
|
+
function node3(name, attributes4, children8 = [], text2 = "") {
|
|
147753
147772
|
return {
|
|
147754
147773
|
name,
|
|
147755
147774
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
147756
147775
|
text: text2,
|
|
147757
|
-
children:
|
|
147776
|
+
children: children8,
|
|
147758
147777
|
attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) }))
|
|
147759
147778
|
};
|
|
147760
147779
|
}
|
|
@@ -149848,8 +149867,8 @@ function invalid4(message) {
|
|
|
149848
149867
|
function unsupported4(message = "package") {
|
|
149849
149868
|
throw new SsconvertError("unsupported-feature", `Unsupported ssconvert feature: encrypted OpenDocument ${message}`);
|
|
149850
149869
|
}
|
|
149851
|
-
function attribute3(node3, name,
|
|
149852
|
-
return node3?.attributes.find((a3) => a3.namespace ===
|
|
149870
|
+
function attribute3(node3, name, namespace6 = manifestNamespace) {
|
|
149871
|
+
return node3?.attributes.find((a3) => a3.namespace === namespace6 && a3.localName === name)?.value;
|
|
149853
149872
|
}
|
|
149854
149873
|
function child5(node3, name, optional = false) {
|
|
149855
149874
|
const found = node3.children.filter((c4) => c4.namespace === manifestNamespace && c4.localName === name);
|
|
@@ -150846,8 +150865,8 @@ var namespaces2 = {
|
|
|
150846
150865
|
svg: [odfNamespaces.svg, "http://www.w3.org/2000/svg"],
|
|
150847
150866
|
gnm: [odfNamespaces.gnm]
|
|
150848
150867
|
};
|
|
150849
|
-
function attribute4(node3, name,
|
|
150850
|
-
return node3.attributes.find((a3) => a3.localName === name && namespaces2[
|
|
150868
|
+
function attribute4(node3, name, namespace6) {
|
|
150869
|
+
return node3.attributes.find((a3) => a3.localName === name && namespaces2[namespace6].includes(a3.namespace))?.value;
|
|
150851
150870
|
}
|
|
150852
150871
|
function pointSize(source) {
|
|
150853
150872
|
if (!source)
|
|
@@ -151039,11 +151058,11 @@ var ns = {
|
|
|
151039
151058
|
xlink: ["http://www.w3.org/1999/xlink"],
|
|
151040
151059
|
gnm: ["http://www.gnumeric.org/odf-extension/1.0"]
|
|
151041
151060
|
};
|
|
151042
|
-
function attr4(node3, name,
|
|
151043
|
-
return node3?.attributes.find((a3) => a3.localName === name && ns[
|
|
151061
|
+
function attr4(node3, name, namespace6) {
|
|
151062
|
+
return node3?.attributes.find((a3) => a3.localName === name && ns[namespace6].includes(a3.namespace))?.value;
|
|
151044
151063
|
}
|
|
151045
|
-
function gnode2(name, attributes4 = {},
|
|
151046
|
-
return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children:
|
|
151064
|
+
function gnode2(name, attributes4 = {}, children8 = [], text2 = "") {
|
|
151065
|
+
return { name, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) })), children: children8, text: text2 };
|
|
151047
151066
|
}
|
|
151048
151067
|
function object2(value3) {
|
|
151049
151068
|
return value3 !== null && typeof value3 === "object" && !Array.isArray(value3) ? value3 : void 0;
|
|
@@ -151334,7 +151353,7 @@ function readOdfLabelRanges(parent, sheets, context, charge) {
|
|
|
151334
151353
|
function invalid11() {
|
|
151335
151354
|
throw new SsconvertError("io", "E Invalid OpenDocument: invalid label range");
|
|
151336
151355
|
}
|
|
151337
|
-
function
|
|
151356
|
+
function attribute7(node3, name) {
|
|
151338
151357
|
return node3.attributes.find((a3) => a3.localName === name && tableNamespaces.includes(a3.namespace))?.value;
|
|
151339
151358
|
}
|
|
151340
151359
|
function address(source) {
|
|
@@ -151369,11 +151388,11 @@ function readOdfLabelRanges(parent, sheets, context, charge) {
|
|
|
151369
151388
|
charge();
|
|
151370
151389
|
if (node3.localName !== "label-range" || !tableNamespaces.includes(node3.namespace))
|
|
151371
151390
|
continue;
|
|
151372
|
-
const axis =
|
|
151391
|
+
const axis = attribute7(node3, "orientation");
|
|
151373
151392
|
if (axis !== "row" && axis !== "column")
|
|
151374
151393
|
invalid11();
|
|
151375
|
-
const labels = address(
|
|
151376
|
-
const data3 = address(
|
|
151394
|
+
const labels = address(attribute7(node3, "label-cell-range-address"));
|
|
151395
|
+
const data3 = address(attribute7(node3, "data-cell-range-address"));
|
|
151377
151396
|
include(labels.sheet, labels.range);
|
|
151378
151397
|
include(data3.sheet, data3.range);
|
|
151379
151398
|
let pairs = ranges2.get(labels.sheet.id);
|
|
@@ -151811,8 +151830,8 @@ function createOdfStyleDefinitions(book, xml2) {
|
|
|
151811
151830
|
continue;
|
|
151812
151831
|
const attributes4 = node3.attributes.filter((value3) => {
|
|
151813
151832
|
xml2.charge();
|
|
151814
|
-
const
|
|
151815
|
-
return
|
|
151833
|
+
const attribute7 = odfObject(value3);
|
|
151834
|
+
return attribute7?.namespace !== odfNamespaces.style || attribute7?.name !== "name";
|
|
151816
151835
|
});
|
|
151817
151836
|
byShape.set(xml2.retained({ ...node3, attributes: attributes4 }), name);
|
|
151818
151837
|
}
|
|
@@ -152251,13 +152270,13 @@ var odfWriterFunctionNames = Object.freeze({
|
|
|
152251
152270
|
});
|
|
152252
152271
|
async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formula3, sheetNames) {
|
|
152253
152272
|
const e = xml2.element, a3 = odfAttributes(node3), base = styles.register({ style: { gnumeric: node3 }, ...a3.Format ? { format: a3.Format } : {} });
|
|
152254
|
-
const
|
|
152273
|
+
const children8 = odfChildren(node3), baseAddress = quoteFormulaString(sheet.name, "'", odfGrammar) + "." + formatA1(r.startRow, r.startColumn);
|
|
152255
152274
|
function expression2(source, name) {
|
|
152256
152275
|
const n = odfChildren(source).find((n2) => odfObject(n2)?.name === name), text2 = odfObject(n)?.text;
|
|
152257
152276
|
return typeof text2 === "string" ? formula3(text2.startsWith("=") ? text2 : "=" + text2, sheet, r.startRow, r.startColumn).slice(4) : "";
|
|
152258
152277
|
}
|
|
152259
152278
|
let maps = "", validationXml = "";
|
|
152260
|
-
for (const condition of
|
|
152279
|
+
for (const condition of children8.filter((n) => odfObject(n)?.name === "Condition")) {
|
|
152261
152280
|
xml2.charge();
|
|
152262
152281
|
const a4 = odfAttributes(condition), op = Number(a4.Operator), overlay = odfChildren(condition).find((n) => odfObject(n)?.name === "Style");
|
|
152263
152282
|
const first = expression2(condition, "Expression0"), last = expression2(condition, "Expression1");
|
|
@@ -152272,7 +152291,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formul
|
|
|
152272
152291
|
}
|
|
152273
152292
|
const styleName = maps ? id + "c" : base.name;
|
|
152274
152293
|
const styleXml = maps ? e("style:style", { "style:name": styleName, "style:family": "table-cell", "style:parent-style-name": base.name }, maps) : "";
|
|
152275
|
-
const validation =
|
|
152294
|
+
const validation = children8.find((n) => odfObject(n)?.name === "Validation"), input = children8.find((n) => odfObject(n)?.name === "InputMessage");
|
|
152276
152295
|
let validationName;
|
|
152277
152296
|
if (validation || input) {
|
|
152278
152297
|
const a4 = odfAttributes(validation), type = (a4.Type ?? "GNM_VALIDATION_TYPE_ANY").slice("GNM_VALIDATION_TYPE_".length), op = (a4.Operator ?? "GNM_VALIDATION_OP_NONE").slice("GNM_VALIDATION_OP_".length);
|
|
@@ -152308,7 +152327,7 @@ async function writeOdfRegion(node3, r, id, sheet, xml2, styles, context, formul
|
|
|
152308
152327
|
}, content2);
|
|
152309
152328
|
}
|
|
152310
152329
|
}
|
|
152311
|
-
const link =
|
|
152330
|
+
const link = children8.find((n) => odfObject(n)?.name === "HyperLink"), linkAttributes = odfAttributes(link);
|
|
152312
152331
|
return { styleName, styleXml, validationName, validationXml, ...linkAttributes.target ? { link: {
|
|
152313
152332
|
"xlink:href": linkAttributes.type === "GnmHLinkCurWB" ? translateOdfHyperlink(linkAttributes.target, "export", xml2.charge, sheetNames) : linkAttributes.target,
|
|
152314
152333
|
"xlink:type": "simple",
|
|
@@ -153895,14 +153914,14 @@ function createOdfWriter(profile) {
|
|
|
153895
153914
|
});
|
|
153896
153915
|
}
|
|
153897
153916
|
spreadsheet = prelude + (validations ? e("table:content-validations", {}, validations) : "") + spreadsheet + (labelRanges ? e("table:label-ranges", {}, labelRanges) : "") + names2() + databaseRanges;
|
|
153898
|
-
const parts = /* @__PURE__ */ new Map(),
|
|
153917
|
+
const parts = /* @__PURE__ */ new Map(), encoder4 = new TextEncoder();
|
|
153899
153918
|
if (wrapped)
|
|
153900
153919
|
context.own(() => {
|
|
153901
153920
|
for (const bytes of parts.values())
|
|
153902
153921
|
bytes.fill(0);
|
|
153903
153922
|
});
|
|
153904
153923
|
function part(name, value3) {
|
|
153905
|
-
parts.set(name,
|
|
153924
|
+
parts.set(name, encoder4.encode(value3));
|
|
153906
153925
|
}
|
|
153907
153926
|
part("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
|
|
153908
153927
|
part("content.xml", xml2.document("office:document-content", e("office:scripts") + e("office:font-face-decls", {}, definitions3.render("fonts")) + e("office:automatic-styles", {}, definitions3.render("contentAutomatic") + automatic + cellStyles.styles.join("")) + e("office:body", {}, e("office:spreadsheet", {}, spreadsheet))));
|
|
@@ -154006,7 +154025,7 @@ function createOdfWriter(profile) {
|
|
|
154006
154025
|
}, member.declaration));
|
|
154007
154026
|
return await packageParts(/* @__PURE__ */ new Map([
|
|
154008
154027
|
["mimetype", mime],
|
|
154009
|
-
["META-INF/manifest.xml",
|
|
154028
|
+
["META-INF/manifest.xml", encoder4.encode(manifest)],
|
|
154010
154029
|
["encrypted-package", member.bytes]
|
|
154011
154030
|
]), encrypted);
|
|
154012
154031
|
} finally {
|
|
@@ -155988,22 +156007,22 @@ function sheetObjects(sheet, context) {
|
|
|
155988
156007
|
charge();
|
|
155989
156008
|
if (!item || typeof item !== "object" || Array.isArray(item))
|
|
155990
156009
|
continue;
|
|
155991
|
-
const
|
|
155992
|
-
if (typeof
|
|
155993
|
-
charge(
|
|
155994
|
-
if (
|
|
155995
|
-
attributes4[
|
|
156010
|
+
const attribute7 = item;
|
|
156011
|
+
if (typeof attribute7.name === "string" && typeof attribute7.namespace === "string" && typeof attribute7.value === "string") {
|
|
156012
|
+
charge(attribute7.name.length + attribute7.namespace.length + attribute7.value.length);
|
|
156013
|
+
if (attribute7.namespace === "")
|
|
156014
|
+
attributes4[attribute7.name] = attribute7.value;
|
|
155996
156015
|
else
|
|
155997
|
-
qualifiedAttributes.push({ name:
|
|
156016
|
+
qualifiedAttributes.push({ name: attribute7.name, namespace: attribute7.namespace, value: attribute7.value });
|
|
155998
156017
|
}
|
|
155999
156018
|
}
|
|
156000
|
-
const
|
|
156019
|
+
const children8 = [];
|
|
156001
156020
|
for (const child7 of Array.isArray(record7.children) ? record7.children : []) {
|
|
156002
156021
|
const parsed = node3(child7, depth + 1);
|
|
156003
156022
|
if (parsed)
|
|
156004
|
-
|
|
156023
|
+
children8.push(parsed);
|
|
156005
156024
|
}
|
|
156006
|
-
return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children:
|
|
156025
|
+
return { name: record7.name, namespace: record7.namespace, text: record7.text, attributes: attributes4, qualifiedAttributes, children: children8 };
|
|
156007
156026
|
};
|
|
156008
156027
|
const style2 = (value3) => {
|
|
156009
156028
|
if (!value3 || value3.namespace !== "")
|
|
@@ -156490,18 +156509,18 @@ function sheetPrintSettings(sheet, context) {
|
|
|
156490
156509
|
const attributes4 = /* @__PURE__ */ Object.create(null);
|
|
156491
156510
|
for (const value4 of Array.isArray(data3.attributes) ? data3.attributes : []) {
|
|
156492
156511
|
tick();
|
|
156493
|
-
const
|
|
156494
|
-
if (
|
|
156495
|
-
tick(
|
|
156496
|
-
attributes4[
|
|
156512
|
+
const attribute7 = record7(value4);
|
|
156513
|
+
if (attribute7?.namespace === "" && typeof attribute7.name === "string" && typeof attribute7.value === "string") {
|
|
156514
|
+
tick(attribute7.name.length + attribute7.value.length);
|
|
156515
|
+
attributes4[attribute7.name] = attribute7.value;
|
|
156497
156516
|
}
|
|
156498
156517
|
}
|
|
156499
|
-
const
|
|
156518
|
+
const children8 = [];
|
|
156500
156519
|
for (const value4 of Array.isArray(data3.children) ? data3.children : []) {
|
|
156501
156520
|
const child7 = project(value4, depth + 1);
|
|
156502
|
-
if (child7)
|
|
156521
|
+
if (child7) children8.push(child7);
|
|
156503
156522
|
}
|
|
156504
|
-
return { name: data3.name, text: data3.text, attributes: attributes4, children:
|
|
156523
|
+
return { name: data3.name, text: data3.text, attributes: attributes4, children: children8 };
|
|
156505
156524
|
};
|
|
156506
156525
|
const margins = { top: 120, bottom: 120, left: 72, right: 72 };
|
|
156507
156526
|
let firstPageNumber;
|
|
@@ -163047,12 +163066,12 @@ ${warnings.map((w) => ` W ${w}`).join("\n")}`);
|
|
|
163047
163066
|
if (!Object.keys(style2).length) return cell;
|
|
163048
163067
|
return { ...cell, ...typeof style2.Format === "string" ? { format: style2.Format } : {}, style: { ...style2, gnumeric: sylkStyleNode(style2) } };
|
|
163049
163068
|
});
|
|
163050
|
-
function node3(name, attributes4,
|
|
163069
|
+
function node3(name, attributes4, children8 = []) {
|
|
163051
163070
|
return {
|
|
163052
163071
|
name,
|
|
163053
163072
|
namespace: "http://www.gnumeric.org/v10.dtd",
|
|
163054
163073
|
text: "",
|
|
163055
|
-
children:
|
|
163074
|
+
children: children8,
|
|
163056
163075
|
attributes: Object.entries(attributes4).map(([name2, value3]) => ({ name: name2, namespace: "", value: String(value3) }))
|
|
163057
163076
|
};
|
|
163058
163077
|
}
|
|
@@ -163423,10 +163442,10 @@ function decodeText(bytes, encoding) {
|
|
|
163423
163442
|
throw new RangeError("Invalid UCS-2");
|
|
163424
163443
|
}
|
|
163425
163444
|
}
|
|
163426
|
-
const
|
|
163427
|
-
if (
|
|
163445
|
+
const decoder2 = new TextDecoder(decoderLabel, { fatal: true });
|
|
163446
|
+
if (decoder2.encoding === "windows-1252" && bytes.some((b3) => [129, 141, 143, 144, 157].includes(b3)))
|
|
163428
163447
|
continue;
|
|
163429
|
-
return
|
|
163448
|
+
return decoder2.decode(bytes, { stream: true });
|
|
163430
163449
|
} catch {
|
|
163431
163450
|
}
|
|
163432
163451
|
}
|
|
@@ -163784,7 +163803,7 @@ function byteField(source, options, maximum, tick) {
|
|
|
163784
163803
|
append([quote]);
|
|
163785
163804
|
return Uint8Array.from(result2);
|
|
163786
163805
|
}
|
|
163787
|
-
function
|
|
163806
|
+
function appendTextField(text2, options, append) {
|
|
163788
163807
|
const whitespace3 = (c4) => c4 !== void 0 && c4 !== "\v" && c4 !== "\uFEFF" && c4.trim() === "";
|
|
163789
163808
|
const quoted = options.mode === "always" || options.mode === "auto" && (text2.includes(",") || text2.includes(" ") || text2.includes(" ") || text2.includes("\n") || text2.includes('"') || options.whitespace && (whitespace3(text2[0]) || whitespace3(text2.at(-1))));
|
|
163790
163809
|
if (!quoted || !options.quote) {
|
|
@@ -163860,7 +163879,7 @@ async function exportText(args, options) {
|
|
|
163860
163879
|
length += bytes.length;
|
|
163861
163880
|
chunks.push(bytes);
|
|
163862
163881
|
} else
|
|
163863
|
-
|
|
163882
|
+
appendTextField(cell ? await renderCellText(cell, book, renderingContext, options.format) : "", options, append);
|
|
163864
163883
|
}
|
|
163865
163884
|
append(options.eol);
|
|
163866
163885
|
}
|
|
@@ -165336,19 +165355,19 @@ function clipboardStyles(sheet, selection, defaults2, cellStyle, context) {
|
|
|
165336
165355
|
if (!a3 || !b3) return patch;
|
|
165337
165356
|
const attrs = /* @__PURE__ */ new Map();
|
|
165338
165357
|
for (const source of [a3, b3]) for (const raw of Array.isArray(source.attributes) ? source.attributes : []) {
|
|
165339
|
-
const
|
|
165340
|
-
if (
|
|
165358
|
+
const attribute7 = object3(raw);
|
|
165359
|
+
if (attribute7) attrs.set(`${String(attribute7.namespace)}:${String(attribute7.name)}`, raw);
|
|
165341
165360
|
}
|
|
165342
|
-
const
|
|
165361
|
+
const children8 = [...Array.isArray(a3.children) ? a3.children : []];
|
|
165343
165362
|
for (const child7 of Array.isArray(b3.children) ? b3.children : []) {
|
|
165344
|
-
const node3 = object3(child7), index2 =
|
|
165363
|
+
const node3 = object3(child7), index2 = children8.findIndex((raw) => {
|
|
165345
165364
|
const old = object3(raw);
|
|
165346
165365
|
return old?.name === node3?.name && old?.namespace === node3?.namespace;
|
|
165347
165366
|
});
|
|
165348
|
-
if (index2 < 0)
|
|
165349
|
-
else
|
|
165367
|
+
if (index2 < 0) children8.push(child7);
|
|
165368
|
+
else children8[index2] = merge(children8[index2], child7);
|
|
165350
165369
|
}
|
|
165351
|
-
return { ...a3, ...b3, text:
|
|
165370
|
+
return { ...a3, ...b3, text: children8.length ? "" : b3.text || a3.text || "", attributes: [...attrs.values()], children: children8 };
|
|
165352
165371
|
};
|
|
165353
165372
|
let regions = [{ range: selection, style: merge(defaults2, {}) }];
|
|
165354
165373
|
const apply = (range3, style2) => {
|
|
@@ -186935,7 +186954,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
|
|
|
186935
186954
|
let x = 0, y = 0;
|
|
186936
186955
|
let stems = 0;
|
|
186937
186956
|
let firstPoint = null;
|
|
186938
|
-
function
|
|
186957
|
+
function parse3(code) {
|
|
186939
186958
|
const view2 = new DataView(code.buffer, code.byteOffset, code.byteLength);
|
|
186940
186959
|
let i = 0;
|
|
186941
186960
|
while (i < code.length) {
|
|
@@ -187018,7 +187037,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
|
|
|
187018
187037
|
subrCode = font2.subrs[n + font2.subrsBias];
|
|
187019
187038
|
}
|
|
187020
187039
|
if (subrCode) {
|
|
187021
|
-
|
|
187040
|
+
parse3(subrCode);
|
|
187022
187041
|
}
|
|
187023
187042
|
break;
|
|
187024
187043
|
case 11:
|
|
@@ -187217,7 +187236,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
|
|
|
187217
187236
|
n = stack.pop() + font2.gsubrsBias;
|
|
187218
187237
|
subrCode = font2.gsubrs[n];
|
|
187219
187238
|
if (subrCode) {
|
|
187220
|
-
|
|
187239
|
+
parse3(subrCode);
|
|
187221
187240
|
}
|
|
187222
187241
|
break;
|
|
187223
187242
|
case 30:
|
|
@@ -187283,7 +187302,7 @@ function compileCharString(charStringCode, cmds, font2, glyphId) {
|
|
|
187283
187302
|
}
|
|
187284
187303
|
}
|
|
187285
187304
|
}
|
|
187286
|
-
|
|
187305
|
+
parse3(charStringCode);
|
|
187287
187306
|
}
|
|
187288
187307
|
var Commands = class {
|
|
187289
187308
|
cmds = [];
|
|
@@ -195955,22 +195974,22 @@ function decodeFlate(bytes, parms, maxDecodedBytes = DEFAULT_MAX_DECODED_BYTES)
|
|
|
195955
195974
|
inflated = new BoundedFlateStream(bytes, maxDecodedBytes).getBytes();
|
|
195956
195975
|
} catch (error2) {
|
|
195957
195976
|
if (error2 instanceof PdfError2 && error2.code === "E_LIMIT") throw error2;
|
|
195958
|
-
const
|
|
195977
|
+
const decoder2 = new Inflate22({
|
|
195959
195978
|
raw: !(bytes[0] === 31 && bytes[1] === 139),
|
|
195960
195979
|
chunkSize: Math.max(1, Math.min(64 * 1024, maxDecodedBytes + 1))
|
|
195961
195980
|
});
|
|
195962
195981
|
let length = 0;
|
|
195963
|
-
|
|
195982
|
+
decoder2.onData = (chunk) => {
|
|
195964
195983
|
length += chunk.length;
|
|
195965
195984
|
if (length > maxDecodedBytes) {
|
|
195966
195985
|
throw new PdfError2("E_LIMIT", "FlateDecode output exceeds maximum decoded byte budget");
|
|
195967
195986
|
}
|
|
195968
|
-
|
|
195987
|
+
decoder2.chunks.push(chunk);
|
|
195969
195988
|
};
|
|
195970
|
-
if (!
|
|
195989
|
+
if (!decoder2.push(bytes, true) || decoder2.err || !decoder2.ended) {
|
|
195971
195990
|
throw new PdfError2("E_CAPABILITY", "Invalid FlateDecode compressed stream");
|
|
195972
195991
|
}
|
|
195973
|
-
inflated =
|
|
195992
|
+
inflated = decoder2.result;
|
|
195974
195993
|
}
|
|
195975
195994
|
return applyPredictor(inflated, parms);
|
|
195976
195995
|
}
|
|
@@ -200073,17 +200092,22 @@ function parseTrueTypeFont(bytes) {
|
|
|
200073
200092
|
const cmapNumTables = cmap ? readU16(view2, cmapOffset + 2) : 0;
|
|
200074
200093
|
let format4Offset = 0;
|
|
200075
200094
|
let format12Offset = 0;
|
|
200095
|
+
let format4IsSymbolic = false;
|
|
200096
|
+
let format12IsSymbolic = false;
|
|
200076
200097
|
for (let i = 0; i < cmapNumTables; i++) {
|
|
200077
200098
|
const rec = cmapOffset + 4 + i * 8;
|
|
200078
200099
|
if (rec + 8 > bytes.byteLength) break;
|
|
200079
200100
|
const platformID = readU16(view2, rec);
|
|
200101
|
+
const encodingID = readU16(view2, rec + 2);
|
|
200080
200102
|
const subOffset = cmapOffset + readU32(view2, rec + 4);
|
|
200081
200103
|
if (subOffset + 4 > bytes.byteLength) continue;
|
|
200082
200104
|
const fmt = readU16(view2, subOffset);
|
|
200083
200105
|
if (fmt === 12 && (platformID === 3 || platformID === 0)) {
|
|
200084
200106
|
format12Offset = subOffset;
|
|
200107
|
+
format12IsSymbolic = platformID === 3 && encodingID === 0;
|
|
200085
200108
|
} else if (fmt === 4 && (platformID === 3 || platformID === 0)) {
|
|
200086
200109
|
format4Offset = subOffset;
|
|
200110
|
+
format4IsSymbolic = platformID === 3 && encodingID === 0;
|
|
200087
200111
|
}
|
|
200088
200112
|
}
|
|
200089
200113
|
if (format12Offset > 0) {
|
|
@@ -200372,6 +200396,7 @@ function parseTrueTypeFont(bytes) {
|
|
|
200372
200396
|
numGlyphs,
|
|
200373
200397
|
isCff: renderCffGlyph !== void 0,
|
|
200374
200398
|
hasCmap: cmap !== void 0,
|
|
200399
|
+
isSymbolicCmap: format12Offset > 0 ? format12IsSymbolic : format4IsSymbolic,
|
|
200375
200400
|
glyphNames,
|
|
200376
200401
|
getGlyphId(codePoint) {
|
|
200377
200402
|
return codePointToGlyph.get(codePoint) ?? 0;
|
|
@@ -202272,8 +202297,8 @@ var DecodingContext = class {
|
|
|
202272
202297
|
this.end = end2;
|
|
202273
202298
|
}
|
|
202274
202299
|
get decoder() {
|
|
202275
|
-
const
|
|
202276
|
-
return util_shadow(this, "decoder",
|
|
202300
|
+
const decoder2 = new ArithmeticDecoder(this.data, this.start, this.end);
|
|
202301
|
+
return util_shadow(this, "decoder", decoder2);
|
|
202277
202302
|
}
|
|
202278
202303
|
get contextCache() {
|
|
202279
202304
|
const cache = new ContextCache();
|
|
@@ -202282,13 +202307,13 @@ var DecodingContext = class {
|
|
|
202282
202307
|
};
|
|
202283
202308
|
var MAX_INT_322 = 2 ** 31 - 1;
|
|
202284
202309
|
var MIN_INT_32 = -(2 ** 31);
|
|
202285
|
-
function decodeInteger(contextCache, procedure,
|
|
202310
|
+
function decodeInteger(contextCache, procedure, decoder2) {
|
|
202286
202311
|
const contexts2 = contextCache.getContexts(procedure);
|
|
202287
202312
|
let prev = 1;
|
|
202288
202313
|
function readBits(length) {
|
|
202289
202314
|
let v = 0;
|
|
202290
202315
|
for (let i = 0; i < length; i++) {
|
|
202291
|
-
const bit =
|
|
202316
|
+
const bit = decoder2.readBit(contexts2, prev);
|
|
202292
202317
|
prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
|
|
202293
202318
|
v = v << 1 | bit;
|
|
202294
202319
|
}
|
|
@@ -202307,11 +202332,11 @@ function decodeInteger(contextCache, procedure, decoder) {
|
|
|
202307
202332
|
}
|
|
202308
202333
|
return null;
|
|
202309
202334
|
}
|
|
202310
|
-
function decodeIAID(contextCache,
|
|
202335
|
+
function decodeIAID(contextCache, decoder2, codeLength) {
|
|
202311
202336
|
const contexts2 = contextCache.getContexts("IAID");
|
|
202312
202337
|
let prev = 1;
|
|
202313
202338
|
for (let i = 0; i < codeLength; i++) {
|
|
202314
|
-
const bit =
|
|
202339
|
+
const bit = decoder2.readBit(contexts2, prev);
|
|
202315
202340
|
prev = prev << 1 | bit;
|
|
202316
202341
|
}
|
|
202317
202342
|
if (codeLength < 31) {
|
|
@@ -202520,7 +202545,7 @@ var RefinementTemplates = [{
|
|
|
202520
202545
|
var ReusedContexts = [39717, 1941, 229, 405];
|
|
202521
202546
|
var RefinementReusedContexts = [32, 8];
|
|
202522
202547
|
function decodeBitmapTemplate0(width2, height, decodingContext) {
|
|
202523
|
-
const
|
|
202548
|
+
const decoder2 = decodingContext.decoder;
|
|
202524
202549
|
const contexts2 = decodingContext.contextCache.getContexts("GB");
|
|
202525
202550
|
const bitmap = [];
|
|
202526
202551
|
let contextLabel, i, j, pixel, row, row1, row2;
|
|
@@ -202531,7 +202556,7 @@ function decodeBitmapTemplate0(width2, height, decodingContext) {
|
|
|
202531
202556
|
row2 = i < 2 ? row : bitmap[i - 2];
|
|
202532
202557
|
contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
|
|
202533
202558
|
for (j = 0; j < width2; j++) {
|
|
202534
|
-
row[j] = pixel =
|
|
202559
|
+
row[j] = pixel = decoder2.readBit(contexts2, contextLabel);
|
|
202535
202560
|
contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width2 ? row2[j + 3] << 11 : 0) | (j + 4 < width2 ? row1[j + 4] << 4 : 0) | pixel;
|
|
202536
202561
|
}
|
|
202537
202562
|
}
|
|
@@ -202585,12 +202610,12 @@ function decodeBitmap(mmr, width2, height, templateIndex, prediction, skip, at,
|
|
|
202585
202610
|
const pseudoPixelContext = ReusedContexts[templateIndex];
|
|
202586
202611
|
let row = new Uint8Array(width2);
|
|
202587
202612
|
const bitmap = [];
|
|
202588
|
-
const
|
|
202613
|
+
const decoder2 = decodingContext.decoder;
|
|
202589
202614
|
const contexts2 = decodingContext.contextCache.getContexts("GB");
|
|
202590
202615
|
let ltp = 0, j, i0, j0, contextLabel = 0, bit, shift;
|
|
202591
202616
|
for (let i = 0; i < height; i++) {
|
|
202592
202617
|
if (prediction) {
|
|
202593
|
-
const sltp =
|
|
202618
|
+
const sltp = decoder2.readBit(contexts2, pseudoPixelContext);
|
|
202594
202619
|
ltp ^= sltp;
|
|
202595
202620
|
if (ltp) {
|
|
202596
202621
|
bitmap.push(row);
|
|
@@ -202631,7 +202656,7 @@ function decodeBitmap(mmr, width2, height, templateIndex, prediction, skip, at,
|
|
|
202631
202656
|
}
|
|
202632
202657
|
}
|
|
202633
202658
|
}
|
|
202634
|
-
const pixel =
|
|
202659
|
+
const pixel = decoder2.readBit(contexts2, contextLabel);
|
|
202635
202660
|
row[j] = pixel;
|
|
202636
202661
|
}
|
|
202637
202662
|
}
|
|
@@ -202666,12 +202691,12 @@ function decodeRefinement(width2, height, templateIndex, referenceBitmap, offset
|
|
|
202666
202691
|
const referenceHeight = referenceBitmap.length;
|
|
202667
202692
|
const pseudoPixelContext = RefinementReusedContexts[templateIndex];
|
|
202668
202693
|
const bitmap = [];
|
|
202669
|
-
const
|
|
202694
|
+
const decoder2 = decodingContext.decoder;
|
|
202670
202695
|
const contexts2 = decodingContext.contextCache.getContexts("GR");
|
|
202671
202696
|
let ltp = 0;
|
|
202672
202697
|
for (let i = 0; i < height; i++) {
|
|
202673
202698
|
if (prediction) {
|
|
202674
|
-
const sltp =
|
|
202699
|
+
const sltp = decoder2.readBit(contexts2, pseudoPixelContext);
|
|
202675
202700
|
ltp ^= sltp;
|
|
202676
202701
|
if (ltp) {
|
|
202677
202702
|
throw new Jbig2Error("prediction is not supported");
|
|
@@ -202700,7 +202725,7 @@ function decodeRefinement(width2, height, templateIndex, referenceBitmap, offset
|
|
|
202700
202725
|
contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
|
|
202701
202726
|
}
|
|
202702
202727
|
}
|
|
202703
|
-
const pixel =
|
|
202728
|
+
const pixel = decoder2.readBit(contexts2, contextLabel);
|
|
202704
202729
|
row[j] = pixel;
|
|
202705
202730
|
}
|
|
202706
202731
|
}
|
|
@@ -202713,7 +202738,7 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
|
|
|
202713
202738
|
const newSymbols = [];
|
|
202714
202739
|
let currentHeight = 0;
|
|
202715
202740
|
let symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
|
|
202716
|
-
const
|
|
202741
|
+
const decoder2 = decodingContext.decoder;
|
|
202717
202742
|
const contextCache = decodingContext.contextCache;
|
|
202718
202743
|
let tableB1, symbolWidths;
|
|
202719
202744
|
if (huffman) {
|
|
@@ -202722,12 +202747,12 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
|
|
|
202722
202747
|
symbolCodeLength = Math.max(symbolCodeLength, 1);
|
|
202723
202748
|
}
|
|
202724
202749
|
while (newSymbols.length < numberOfNewSymbols) {
|
|
202725
|
-
const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH",
|
|
202750
|
+
const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder2);
|
|
202726
202751
|
currentHeight += deltaHeight;
|
|
202727
202752
|
let currentWidth = 0, totalWidth = 0;
|
|
202728
202753
|
const firstSymbol = huffman ? symbolWidths.length : 0;
|
|
202729
202754
|
while (true) {
|
|
202730
|
-
const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW",
|
|
202755
|
+
const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder2);
|
|
202731
202756
|
if (deltaWidth === null) {
|
|
202732
202757
|
break;
|
|
202733
202758
|
}
|
|
@@ -202735,13 +202760,13 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
|
|
|
202735
202760
|
totalWidth += currentWidth;
|
|
202736
202761
|
let bitmap;
|
|
202737
202762
|
if (refinement) {
|
|
202738
|
-
const numberOfInstances = decodeInteger(contextCache, "IAAI",
|
|
202763
|
+
const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder2);
|
|
202739
202764
|
if (numberOfInstances > 1) {
|
|
202740
202765
|
bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
|
|
202741
202766
|
} else {
|
|
202742
|
-
const symbolId = decodeIAID(contextCache,
|
|
202743
|
-
const rdx = decodeInteger(contextCache, "IARDX",
|
|
202744
|
-
const rdy = decodeInteger(contextCache, "IARDY",
|
|
202767
|
+
const symbolId = decodeIAID(contextCache, decoder2, symbolCodeLength);
|
|
202768
|
+
const rdx = decodeInteger(contextCache, "IARDX", decoder2);
|
|
202769
|
+
const rdy = decodeInteger(contextCache, "IARDY", decoder2);
|
|
202745
202770
|
const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
|
|
202746
202771
|
bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
|
|
202747
202772
|
}
|
|
@@ -202789,7 +202814,7 @@ function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols
|
|
|
202789
202814
|
let currentFlag = false, i, ii;
|
|
202790
202815
|
const totalSymbolsLength = symbols.length + numberOfNewSymbols;
|
|
202791
202816
|
while (flags.length < totalSymbolsLength) {
|
|
202792
|
-
let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX",
|
|
202817
|
+
let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder2);
|
|
202793
202818
|
while (runLength--) {
|
|
202794
202819
|
flags.push(currentFlag);
|
|
202795
202820
|
}
|
|
@@ -202823,33 +202848,33 @@ function decodeTextRegion(huffman, refinement, width2, height, defaultPixelValue
|
|
|
202823
202848
|
}
|
|
202824
202849
|
bitmap.push(row);
|
|
202825
202850
|
}
|
|
202826
|
-
const
|
|
202851
|
+
const decoder2 = decodingContext.decoder;
|
|
202827
202852
|
const contextCache = decodingContext.contextCache;
|
|
202828
|
-
let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT",
|
|
202853
|
+
let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder2);
|
|
202829
202854
|
let firstS = 0;
|
|
202830
202855
|
i = 0;
|
|
202831
202856
|
while (i < numberOfSymbolInstances) {
|
|
202832
|
-
const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT",
|
|
202857
|
+
const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder2);
|
|
202833
202858
|
stripT += deltaT;
|
|
202834
|
-
const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS",
|
|
202859
|
+
const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder2);
|
|
202835
202860
|
firstS += deltaFirstS;
|
|
202836
202861
|
let currentS = firstS;
|
|
202837
202862
|
do {
|
|
202838
202863
|
let currentT = 0;
|
|
202839
202864
|
if (stripSize > 1) {
|
|
202840
|
-
currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT",
|
|
202865
|
+
currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder2);
|
|
202841
202866
|
}
|
|
202842
202867
|
const t = stripSize * stripT + currentT;
|
|
202843
|
-
const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache,
|
|
202844
|
-
const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI",
|
|
202868
|
+
const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder2, symbolCodeLength);
|
|
202869
|
+
const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder2));
|
|
202845
202870
|
let symbolBitmap = inputSymbols[symbolId];
|
|
202846
202871
|
let symbolWidth = symbolBitmap[0].length;
|
|
202847
202872
|
let symbolHeight = symbolBitmap.length;
|
|
202848
202873
|
if (applyRefinement) {
|
|
202849
|
-
const rdw = decodeInteger(contextCache, "IARDW",
|
|
202850
|
-
const rdh = decodeInteger(contextCache, "IARDH",
|
|
202851
|
-
const rdx = decodeInteger(contextCache, "IARDX",
|
|
202852
|
-
const rdy = decodeInteger(contextCache, "IARDY",
|
|
202874
|
+
const rdw = decodeInteger(contextCache, "IARDW", decoder2);
|
|
202875
|
+
const rdh = decodeInteger(contextCache, "IARDH", decoder2);
|
|
202876
|
+
const rdx = decodeInteger(contextCache, "IARDX", decoder2);
|
|
202877
|
+
const rdy = decodeInteger(contextCache, "IARDY", decoder2);
|
|
202853
202878
|
symbolWidth += rdw;
|
|
202854
202879
|
symbolHeight += rdh;
|
|
202855
202880
|
symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
|
|
@@ -202916,7 +202941,7 @@ function decodeTextRegion(huffman, refinement, width2, height, defaultPixelValue
|
|
|
202916
202941
|
}
|
|
202917
202942
|
}
|
|
202918
202943
|
i++;
|
|
202919
|
-
const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS",
|
|
202944
|
+
const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder2);
|
|
202920
202945
|
if (deltaS === null) {
|
|
202921
202946
|
break;
|
|
202922
202947
|
}
|
|
@@ -203971,7 +203996,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
|
|
|
203971
203996
|
BlackIs1: true,
|
|
203972
203997
|
EndOfBlock: endOfBlock
|
|
203973
203998
|
};
|
|
203974
|
-
const
|
|
203999
|
+
const decoder2 = new CCITTFaxDecoder(input, params);
|
|
203975
204000
|
const bitmap = [];
|
|
203976
204001
|
let currentByte, eof = false;
|
|
203977
204002
|
for (let y = 0; y < height; y++) {
|
|
@@ -203980,7 +204005,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
|
|
|
203980
204005
|
let shift = -1;
|
|
203981
204006
|
for (let x = 0; x < width2; x++) {
|
|
203982
204007
|
if (shift < 0) {
|
|
203983
|
-
currentByte =
|
|
204008
|
+
currentByte = decoder2.readNextChar();
|
|
203984
204009
|
if (currentByte === -1) {
|
|
203985
204010
|
currentByte = 0;
|
|
203986
204011
|
eof = true;
|
|
@@ -203994,7 +204019,7 @@ function decodeMMRBitmap(input, width2, height, endOfBlock) {
|
|
|
203994
204019
|
if (endOfBlock && !eof) {
|
|
203995
204020
|
const lookForEOFLimit = 5;
|
|
203996
204021
|
for (let i = 0; i < lookForEOFLimit; i++) {
|
|
203997
|
-
if (
|
|
204022
|
+
if (decoder2.readNextChar() === -1) {
|
|
203998
204023
|
break;
|
|
203999
204024
|
}
|
|
204000
204025
|
}
|
|
@@ -206198,8 +206223,8 @@ function copyCoefficients(coefficients2, levelWidth, levelHeight, subband, delta
|
|
|
206198
206223
|
encodedData.set(chunk, position);
|
|
206199
206224
|
position += chunk.length;
|
|
206200
206225
|
}
|
|
206201
|
-
const
|
|
206202
|
-
bitModel.setDecoder(
|
|
206226
|
+
const decoder2 = new ArithmeticDecoder(encodedData, 0, totalLength);
|
|
206227
|
+
bitModel.setDecoder(decoder2);
|
|
206203
206228
|
for (j = 0; j < codingpasses; j++) {
|
|
206204
206229
|
switch (currentCodingpassType) {
|
|
206205
206230
|
case 0:
|
|
@@ -206550,8 +206575,8 @@ var BitModel = class _BitModel {
|
|
|
206550
206575
|
this.bitsDecoded = bitsDecoded;
|
|
206551
206576
|
this.reset();
|
|
206552
206577
|
}
|
|
206553
|
-
setDecoder(
|
|
206554
|
-
this.decoder =
|
|
206578
|
+
setDecoder(decoder2) {
|
|
206579
|
+
this.decoder = decoder2;
|
|
206555
206580
|
}
|
|
206556
206581
|
reset() {
|
|
206557
206582
|
this.contexts = new Int8Array(19);
|
|
@@ -206594,7 +206619,7 @@ var BitModel = class _BitModel {
|
|
|
206594
206619
|
neighborsSignificance[index2] |= 128;
|
|
206595
206620
|
}
|
|
206596
206621
|
runSignificancePropagationPass() {
|
|
206597
|
-
const
|
|
206622
|
+
const decoder2 = this.decoder;
|
|
206598
206623
|
const width2 = this.width, height = this.height;
|
|
206599
206624
|
const coefficentsMagnitude = this.coefficentsMagnitude;
|
|
206600
206625
|
const coefficentsSign = this.coefficentsSign;
|
|
@@ -206619,7 +206644,7 @@ var BitModel = class _BitModel {
|
|
|
206619
206644
|
continue;
|
|
206620
206645
|
}
|
|
206621
206646
|
const contextLabel = labels[neighborsSignificance[index2]];
|
|
206622
|
-
const decision =
|
|
206647
|
+
const decision = decoder2.readBit(contexts2, contextLabel);
|
|
206623
206648
|
if (decision) {
|
|
206624
206649
|
const sign = this.decodeSignBit(i, j, index2);
|
|
206625
206650
|
coefficentsSign[index2] = sign;
|
|
@@ -206680,7 +206705,7 @@ var BitModel = class _BitModel {
|
|
|
206680
206705
|
return decoded;
|
|
206681
206706
|
}
|
|
206682
206707
|
runMagnitudeRefinementPass() {
|
|
206683
|
-
const
|
|
206708
|
+
const decoder2 = this.decoder;
|
|
206684
206709
|
const width2 = this.width, height = this.height;
|
|
206685
206710
|
const coefficentsMagnitude = this.coefficentsMagnitude;
|
|
206686
206711
|
const neighborsSignificance = this.neighborsSignificance;
|
|
@@ -206704,7 +206729,7 @@ var BitModel = class _BitModel {
|
|
|
206704
206729
|
const significance = neighborsSignificance[index2] & 127;
|
|
206705
206730
|
contextLabel = significance === 0 ? 15 : 14;
|
|
206706
206731
|
}
|
|
206707
|
-
const bit =
|
|
206732
|
+
const bit = decoder2.readBit(contexts2, contextLabel);
|
|
206708
206733
|
coefficentsMagnitude[index2] = coefficentsMagnitude[index2] << 1 | bit;
|
|
206709
206734
|
bitsDecoded[index2]++;
|
|
206710
206735
|
processingFlags[index2] |= processedMask;
|
|
@@ -206713,7 +206738,7 @@ var BitModel = class _BitModel {
|
|
|
206713
206738
|
}
|
|
206714
206739
|
}
|
|
206715
206740
|
runCleanupPass() {
|
|
206716
|
-
const
|
|
206741
|
+
const decoder2 = this.decoder;
|
|
206717
206742
|
const width2 = this.width, height = this.height;
|
|
206718
206743
|
const neighborsSignificance = this.neighborsSignificance;
|
|
206719
206744
|
const coefficentsMagnitude = this.coefficentsMagnitude;
|
|
@@ -206738,7 +206763,7 @@ var BitModel = class _BitModel {
|
|
|
206738
206763
|
let i1 = 0, index2 = index0;
|
|
206739
206764
|
let i = i0, sign;
|
|
206740
206765
|
if (allEmpty) {
|
|
206741
|
-
const hasSignificantCoefficent =
|
|
206766
|
+
const hasSignificantCoefficent = decoder2.readBit(contexts2, _BitModel.RUNLENGTH_CONTEXT);
|
|
206742
206767
|
if (!hasSignificantCoefficent) {
|
|
206743
206768
|
bitsDecoded[index0]++;
|
|
206744
206769
|
bitsDecoded[index0 + oneRowDown]++;
|
|
@@ -206746,7 +206771,7 @@ var BitModel = class _BitModel {
|
|
|
206746
206771
|
bitsDecoded[index0 + threeRowsDown]++;
|
|
206747
206772
|
continue;
|
|
206748
206773
|
}
|
|
206749
|
-
i1 =
|
|
206774
|
+
i1 = decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
|
|
206750
206775
|
if (i1 !== 0) {
|
|
206751
206776
|
i = i0 + i1;
|
|
206752
206777
|
index2 += i1 * width2;
|
|
@@ -206767,7 +206792,7 @@ var BitModel = class _BitModel {
|
|
|
206767
206792
|
continue;
|
|
206768
206793
|
}
|
|
206769
206794
|
const contextLabel = labels[neighborsSignificance[index2]];
|
|
206770
|
-
const decision =
|
|
206795
|
+
const decision = decoder2.readBit(contexts2, contextLabel);
|
|
206771
206796
|
if (decision === 1) {
|
|
206772
206797
|
sign = this.decodeSignBit(i, j, index2);
|
|
206773
206798
|
coefficentsSign[index2] = sign;
|
|
@@ -206781,9 +206806,9 @@ var BitModel = class _BitModel {
|
|
|
206781
206806
|
}
|
|
206782
206807
|
}
|
|
206783
206808
|
checkSegmentationSymbol() {
|
|
206784
|
-
const
|
|
206809
|
+
const decoder2 = this.decoder;
|
|
206785
206810
|
const contexts2 = this.contexts;
|
|
206786
|
-
const symbol =
|
|
206811
|
+
const symbol = decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 3 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 2 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT) << 1 | decoder2.readBit(contexts2, _BitModel.UNIFORM_CONTEXT);
|
|
206787
206812
|
if (symbol !== 10) {
|
|
206788
206813
|
throw new JpxError("Invalid segmentation symbol");
|
|
206789
206814
|
}
|
|
@@ -207179,21 +207204,21 @@ function extractRawJpegFromStream(doc, stream, filters) {
|
|
|
207179
207204
|
function decodeJpegToRgba(jpegBytes, fallbackWidth = 1, fallbackHeight = 1, maxDecodedBytes = Infinity, options = {}) {
|
|
207180
207205
|
assertDecodedByteBudget(fallbackWidth * fallbackHeight * 4, maxDecodedBytes);
|
|
207181
207206
|
const decodeTransform = options.decode ? Int32Array.from(options.decode.flatMap(([low, high]) => [(high - low) * 256, low * 255])) : void 0;
|
|
207182
|
-
const
|
|
207207
|
+
const decoder2 = new __webpack_exports__JpegImage({
|
|
207183
207208
|
colorTransform: options.colorTransform,
|
|
207184
207209
|
decodeTransform,
|
|
207185
207210
|
onImageDimensions: (width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes)
|
|
207186
207211
|
});
|
|
207187
207212
|
let start = 0;
|
|
207188
207213
|
while (start + 1 < jpegBytes.length && !(jpegBytes[start] === 255 && jpegBytes[start + 1] === 216)) start++;
|
|
207189
|
-
|
|
207190
|
-
const { width: width2, height, numComponents: components22 } =
|
|
207214
|
+
decoder2.parse(jpegBytes.subarray(start));
|
|
207215
|
+
const { width: width2, height, numComponents: components22 } = decoder2;
|
|
207191
207216
|
if (!Number.isSafeInteger(width2) || !Number.isSafeInteger(height) || width2 <= 0 || height <= 0) {
|
|
207192
207217
|
throw new PdfError2("E_PARSE", "Invalid JPEG image dimensions");
|
|
207193
207218
|
}
|
|
207194
207219
|
if (![1, 3, 4].includes(components22)) throw new PdfError2("E_CAPABILITY", "Unsupported JPEG component count");
|
|
207195
207220
|
assertDecodedByteBudget(width2 * height * 4, maxDecodedBytes);
|
|
207196
|
-
const rgb22 =
|
|
207221
|
+
const rgb22 = decoder2.getData({ width: width2, height, forceRGB: true, isSourcePDF: options.isSourcePdf ?? false });
|
|
207197
207222
|
if (rgb22.length !== width2 * height * 3) throw new PdfError2("E_PARSE", "Invalid decoded JPEG sample count");
|
|
207198
207223
|
const rgba = new Uint8Array(width2 * height * 4);
|
|
207199
207224
|
for (let p2 = 0; p2 < width2 * height; p2++) {
|
|
@@ -207207,19 +207232,19 @@ function decodeJpegToRgba(jpegBytes, fallbackWidth = 1, fallbackHeight = 1, maxD
|
|
|
207207
207232
|
function decodeJbig2ToRgba(jbig2Bytes, fallbackWidth = 1, fallbackHeight = 1, globals, maxDecodedBytes = Infinity) {
|
|
207208
207233
|
if (jbig2Bytes.length < 11) throw new PdfError2("E_PARSE", "Invalid JBIG2 stream");
|
|
207209
207234
|
assertDecodedByteBudget(fallbackWidth * fallbackHeight * 4, maxDecodedBytes);
|
|
207210
|
-
const
|
|
207235
|
+
const decoder2 = new __webpack_exports__Jbig2Image((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
|
|
207211
207236
|
const signature2 = [151, 74, 66, 50, 13, 10, 26, 10];
|
|
207212
207237
|
const standalone = signature2.every((byte, i) => jbig2Bytes[i] === byte);
|
|
207213
207238
|
let width2 = fallbackWidth, height = fallbackHeight;
|
|
207214
207239
|
let pixels;
|
|
207215
207240
|
if (standalone) {
|
|
207216
|
-
pixels =
|
|
207217
|
-
width2 =
|
|
207218
|
-
height =
|
|
207241
|
+
pixels = decoder2.parse(jbig2Bytes);
|
|
207242
|
+
width2 = decoder2.width;
|
|
207243
|
+
height = decoder2.height;
|
|
207219
207244
|
} else {
|
|
207220
207245
|
const chunks = globals ? [{ data: globals, start: 0, end: globals.length }] : [];
|
|
207221
207246
|
chunks.push({ data: jbig2Bytes, start: 0, end: jbig2Bytes.length });
|
|
207222
|
-
const decoded =
|
|
207247
|
+
const decoded = decoder2.parseChunks(chunks);
|
|
207223
207248
|
if (!decoded) throw new PdfError2("E_PARSE", "JBIG2 stream has no page bitmap");
|
|
207224
207249
|
pixels = decoded;
|
|
207225
207250
|
}
|
|
@@ -207237,10 +207262,10 @@ function decodeJbig2ToRgba(jbig2Bytes, fallbackWidth = 1, fallbackHeight = 1, gl
|
|
|
207237
207262
|
return rgba;
|
|
207238
207263
|
}
|
|
207239
207264
|
function decodeJpxSamples(bytes, maxDecodedBytes = Infinity) {
|
|
207240
|
-
const
|
|
207241
|
-
|
|
207242
|
-
|
|
207243
|
-
const { width: width2, height, componentsCount: components22, tiles } =
|
|
207265
|
+
const decoder2 = new __webpack_exports__JpxImage((width22, height2) => assertDecodedByteBudget(width22 * height2 * 4, maxDecodedBytes));
|
|
207266
|
+
decoder2.failOnCorruptedImage = true;
|
|
207267
|
+
decoder2.parse(bytes);
|
|
207268
|
+
const { width: width2, height, componentsCount: components22, tiles } = decoder2;
|
|
207244
207269
|
if (!Number.isSafeInteger(width2) || !Number.isSafeInteger(height) || width2 <= 0 || height <= 0 || !Number.isSafeInteger(components22) || components22 <= 0 || !tiles?.length) {
|
|
207245
207270
|
throw new PdfError2("E_PARSE", "JPEG 2000 stream has no valid image");
|
|
207246
207271
|
}
|
|
@@ -207956,7 +207981,13 @@ function resolvePageFonts(doc, resourcesDict) {
|
|
|
207956
207981
|
embeddedCff = parseEmbeddedCffFont(doc.decodeStream(program), baseEncoding?.kind === "name" ? baseEncoding.decoded : void 0, glyphNames);
|
|
207957
207982
|
} else {
|
|
207958
207983
|
embeddedTrueType = parseTrueTypeFont(doc.decodeStream(program));
|
|
207959
|
-
if (subtype !== "Type0" &&
|
|
207984
|
+
if (subtype !== "Type0" && embeddedTrueType.isSymbolicCmap) {
|
|
207985
|
+
simpleToGid = /* @__PURE__ */ new Map();
|
|
207986
|
+
for (let code = 0; code < 256; code++) {
|
|
207987
|
+
const gid = embeddedTrueType.getGlyphId(61440 + code) || embeddedTrueType.getGlyphId(code);
|
|
207988
|
+
if (gid > 0) simpleToGid.set(code, gid);
|
|
207989
|
+
}
|
|
207990
|
+
} else if (subtype !== "Type0" && !embeddedTrueType.hasCmap) {
|
|
207960
207991
|
simpleToGid = /* @__PURE__ */ new Map();
|
|
207961
207992
|
const encoding = baseEncoding?.kind === "name" ? getEncoding(baseEncoding.decoded) : void 0;
|
|
207962
207993
|
for (let code = 0; code < 256; code++) {
|
|
@@ -211533,7 +211564,7 @@ var PdfPage = class {
|
|
|
211533
211564
|
this.cachedContentAst = parseContentStream(bytes);
|
|
211534
211565
|
this.isolatedInitialStream = false;
|
|
211535
211566
|
const stm = cosStream(bytes, { compress });
|
|
211536
|
-
|
|
211567
|
+
this.replaceContentStream(stm);
|
|
211537
211568
|
this.cachedContentsNode = dictGet(this.pageDict, "Contents");
|
|
211538
211569
|
}
|
|
211539
211570
|
getIsolatedContentAst() {
|
|
@@ -211550,9 +211581,33 @@ var PdfPage = class {
|
|
|
211550
211581
|
this.cachedContentAst = [...nodes];
|
|
211551
211582
|
const bytes = serializeContentAst(this.cachedContentAst);
|
|
211552
211583
|
const streamObj = cosStream(bytes, { compress });
|
|
211553
|
-
|
|
211584
|
+
this.replaceContentStream(streamObj);
|
|
211554
211585
|
this.cachedContentsNode = dictGet(this.pageDict, "Contents");
|
|
211555
211586
|
}
|
|
211587
|
+
replaceContentStream(stream) {
|
|
211588
|
+
const contents = dictGet(this.pageDict, "Contents");
|
|
211589
|
+
if (contents?.kind === "ref") {
|
|
211590
|
+
let references = 0;
|
|
211591
|
+
const pending = [...this.cosDoc.objects.values()].map((object5) => object5.value);
|
|
211592
|
+
const visited = /* @__PURE__ */ new Set();
|
|
211593
|
+
while (pending.length > 0 && references < 2) {
|
|
211594
|
+
const node3 = pending.pop();
|
|
211595
|
+
if (node3.kind === "ref") {
|
|
211596
|
+
if (node3.objectNumber === contents.objectNumber && node3.generationNumber === contents.generationNumber) references++;
|
|
211597
|
+
} else if (!visited.has(node3)) {
|
|
211598
|
+
visited.add(node3);
|
|
211599
|
+
if (node3.kind === "array") for (const item of node3.items) pending.push(item);
|
|
211600
|
+
else if (node3.kind === "dict") for (const entry2 of node3.entries) pending.push(entry2.value);
|
|
211601
|
+
else if (node3.kind === "stream") pending.push(node3.dict);
|
|
211602
|
+
}
|
|
211603
|
+
}
|
|
211604
|
+
if (references === 1) {
|
|
211605
|
+
this.cosDoc.setObject(contents.objectNumber, stream, contents.generationNumber);
|
|
211606
|
+
return;
|
|
211607
|
+
}
|
|
211608
|
+
}
|
|
211609
|
+
dictSet(this.pageDict, "Contents", this.cosDoc.allocateObject(stream));
|
|
211610
|
+
}
|
|
211556
211611
|
drawText(text2, options) {
|
|
211557
211612
|
const size = options.size ?? options.fontSize ?? 12;
|
|
211558
211613
|
const color5 = options.color ?? { r: 0, g: 0, b: 0 };
|
|
@@ -223698,13 +223753,13 @@ function* parseXmlSteps6(input, limits = {}) {
|
|
|
223698
223753
|
break;
|
|
223699
223754
|
if (ws === 0)
|
|
223700
223755
|
invalid9("attributes require whitespace");
|
|
223701
|
-
const [
|
|
223756
|
+
const [attribute7, attrPrefix, attrLocal, wAttr] = scanName();
|
|
223702
223757
|
pendingWork += wAttr;
|
|
223703
223758
|
while (pendingWork >= 512) {
|
|
223704
223759
|
yield 512;
|
|
223705
223760
|
pendingWork -= 512;
|
|
223706
223761
|
}
|
|
223707
|
-
if (attributes4?.has(
|
|
223762
|
+
if (attributes4?.has(attribute7))
|
|
223708
223763
|
invalid9("duplicate attribute");
|
|
223709
223764
|
if (++attributeCount > maxAttributes)
|
|
223710
223765
|
throw new XmlLimitError4("maxAttributes", "XML attribute limit exceeded");
|
|
@@ -223741,11 +223796,11 @@ function* parseXmlSteps6(input, limits = {}) {
|
|
|
223741
223796
|
pendingWork -= 512;
|
|
223742
223797
|
}
|
|
223743
223798
|
admitText(value3);
|
|
223744
|
-
(attributes4 ??= /* @__PURE__ */ new Map()).set(
|
|
223745
|
-
attrMeta.push([
|
|
223799
|
+
(attributes4 ??= /* @__PURE__ */ new Map()).set(attribute7, value3);
|
|
223800
|
+
attrMeta.push([attribute7, attrPrefix, attrLocal]);
|
|
223746
223801
|
offset = end2 + 1;
|
|
223747
|
-
if (
|
|
223748
|
-
const nsPrefix =
|
|
223802
|
+
if (attribute7 === "xmlns" || attribute7.startsWith("xmlns:")) {
|
|
223803
|
+
const nsPrefix = attribute7 === "xmlns" ? "" : attribute7.slice(6);
|
|
223749
223804
|
if (nsPrefix === "xmlns" || value3 === xmlnsNamespace || nsPrefix === "xml" !== (value3 === xmlNamespace) || nsPrefix !== "" && value3 === "")
|
|
223750
223805
|
invalid9("invalid namespace binding");
|
|
223751
223806
|
if (!ownsNamespaces) {
|
|
@@ -223765,10 +223820,10 @@ function* parseXmlSteps6(input, limits = {}) {
|
|
|
223765
223820
|
if (attrMeta.length > 0) {
|
|
223766
223821
|
const expanded = attrMeta.length > 1 ? /* @__PURE__ */ new Set() : void 0;
|
|
223767
223822
|
for (let i = 0; i < attrMeta.length; i++) {
|
|
223768
|
-
const [
|
|
223769
|
-
if (
|
|
223823
|
+
const [attribute7, attrPrefix, attrLocal] = attrMeta[i];
|
|
223824
|
+
if (attribute7 === "xmlns" || attribute7.startsWith("xmlns:"))
|
|
223770
223825
|
continue;
|
|
223771
|
-
pendingWork +=
|
|
223826
|
+
pendingWork += attribute7.length;
|
|
223772
223827
|
if (attrPrefix && !namespaces5.has(attrPrefix))
|
|
223773
223828
|
invalid9("unbound attribute prefix");
|
|
223774
223829
|
if (expanded) {
|
|
@@ -223790,22 +223845,22 @@ function* parseXmlSteps6(input, limits = {}) {
|
|
|
223790
223845
|
throw new XmlLimitError4("maxNodes", "XML resource limit exceeded");
|
|
223791
223846
|
if (stack.length + 1 > maxDepth)
|
|
223792
223847
|
throw new XmlLimitError4("maxDepth", "XML resource limit exceeded");
|
|
223793
|
-
const
|
|
223794
|
-
limits.onElement?.({ name, namespace:
|
|
223848
|
+
const namespace6 = namespaces5.get(prefix) ?? "";
|
|
223849
|
+
limits.onElement?.({ name, namespace: namespace6, localName }, stack.at(-1)?.element, stack.length + 1);
|
|
223795
223850
|
admitContent();
|
|
223796
223851
|
const retainedAttributes = [];
|
|
223797
223852
|
if (retainContent && attributes4) {
|
|
223798
223853
|
for (let i = 0; i < attrMeta.length; i++) {
|
|
223799
|
-
const [
|
|
223800
|
-
const value3 = attributes4.get(
|
|
223854
|
+
const [attribute7, attrPrefix, attrLocal] = attrMeta[i];
|
|
223855
|
+
const value3 = attributes4.get(attribute7);
|
|
223801
223856
|
admitContent();
|
|
223802
223857
|
retainedAttributes.push({
|
|
223803
|
-
name:
|
|
223858
|
+
name: attribute7,
|
|
223804
223859
|
localName: attrLocal,
|
|
223805
|
-
namespace:
|
|
223860
|
+
namespace: attribute7 === "xmlns" || attrPrefix === "xmlns" ? xmlnsNamespace : attrPrefix ? namespaces5.get(attrPrefix) : "",
|
|
223806
223861
|
value: value3
|
|
223807
223862
|
});
|
|
223808
|
-
pendingWork +=
|
|
223863
|
+
pendingWork += attribute7.length + 1;
|
|
223809
223864
|
}
|
|
223810
223865
|
}
|
|
223811
223866
|
while (pendingWork >= 512) {
|
|
@@ -223813,7 +223868,7 @@ function* parseXmlSteps6(input, limits = {}) {
|
|
|
223813
223868
|
pendingWork -= 512;
|
|
223814
223869
|
}
|
|
223815
223870
|
const content2 = retainContent ? [] : void 0;
|
|
223816
|
-
const element2 = { kind: "element", name, namespace:
|
|
223871
|
+
const element2 = { kind: "element", name, namespace: namespace6, localName, children: [], text: "", content: content2 ?? emptyContent, attributes: retainContent ? retainedAttributes : emptyAttributes, namespaces: retainContent ? namespaces5 : emptyNamespaces, ...root === void 0 && retainContent ? { prolog, epilog, ...declaration === void 0 ? {} : { declaration } } : {} };
|
|
223817
223872
|
const parent = stack.at(-1);
|
|
223818
223873
|
if (parent) {
|
|
223819
223874
|
parent.element.children.push(element2);
|
|
@@ -223877,10 +223932,10 @@ function davChildren(element2, localName) {
|
|
|
223877
223932
|
return element2.children.filter((child7) => child7.namespace === "DAV:" && child7.localName === localName);
|
|
223878
223933
|
}
|
|
223879
223934
|
function davChild(element2, localName) {
|
|
223880
|
-
const
|
|
223881
|
-
if (
|
|
223935
|
+
const children8 = davChildren(element2, localName);
|
|
223936
|
+
if (children8.length > 1)
|
|
223882
223937
|
invalid22(`duplicate DAV:${localName}`);
|
|
223883
|
-
return
|
|
223938
|
+
return children8[0];
|
|
223884
223939
|
}
|
|
223885
223940
|
function scalar(element2) {
|
|
223886
223941
|
if (element2.children.length)
|
|
@@ -224669,7 +224724,7 @@ var WebDavFileSystem = class {
|
|
|
224669
224724
|
if (response.status !== 207)
|
|
224670
224725
|
this.httpError(response.status, "PROPFIND", path2);
|
|
224671
224726
|
const result2 = /* @__PURE__ */ new Map();
|
|
224672
|
-
let
|
|
224727
|
+
let children8 = 0;
|
|
224673
224728
|
for (const element2 of await this.multistatus(response, signal)) {
|
|
224674
224729
|
signal.throwIfAborted();
|
|
224675
224730
|
const href = davChild(element2, "href");
|
|
@@ -224683,7 +224738,7 @@ var WebDavFileSystem = class {
|
|
|
224683
224738
|
if (result2.has(member))
|
|
224684
224739
|
throw new Error("duplicate response href");
|
|
224685
224740
|
if (member !== path2)
|
|
224686
|
-
admitDirectoryEntries(++
|
|
224741
|
+
admitDirectoryEntries(++children8, limit7, path2);
|
|
224687
224742
|
const stat = this.entryStat(element2, member);
|
|
224688
224743
|
recordOwnedResourceStat(response, this, member, stat);
|
|
224689
224744
|
result2.set(member, stat);
|
|
@@ -228091,23 +228146,23 @@ function clipboardObjectRecords(sheet, range3, context) {
|
|
|
228091
228146
|
name: value3.name,
|
|
228092
228147
|
namespace: value3.namespace,
|
|
228093
228148
|
text: value3.text,
|
|
228094
|
-
attributes: [...Object.entries(value3.attributes).map(([name, value4]) => ({ name, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((
|
|
228095
|
-
...
|
|
228096
|
-
value: bound !== void 0 &&
|
|
228149
|
+
attributes: [...Object.entries(value3.attributes).map(([name, value4]) => ({ name, namespace: "", value: value4 })), ...value3.qualifiedAttributes].map((attribute7) => ({
|
|
228150
|
+
...attribute7,
|
|
228151
|
+
value: bound !== void 0 && attribute7.namespace === "" && attribute7.name === "ObjectBound" ? bound : attribute7.value
|
|
228097
228152
|
})),
|
|
228098
228153
|
children: value3.children.map((child7) => node3(child7))
|
|
228099
228154
|
};
|
|
228100
228155
|
};
|
|
228101
|
-
const
|
|
228156
|
+
const children8 = copied.map((object5) => {
|
|
228102
228157
|
const bound = object5.anchor.range;
|
|
228103
228158
|
return node3(object5.payload, `${formatA1(bound.startRow - range3.startRow, bound.startColumn - range3.startColumn)}:${formatA1(bound.endRow - range3.startRow, bound.endColumn - range3.startColumn)}`);
|
|
228104
228159
|
});
|
|
228105
|
-
return
|
|
228160
|
+
return children8.length ? [{ source: "Gnumeric_XmlIO:sax", kind: "Objects", disposition: "retained", data: {
|
|
228106
228161
|
name: "Objects",
|
|
228107
228162
|
namespace: copied[0].payload.namespace,
|
|
228108
228163
|
text: "",
|
|
228109
228164
|
attributes: [],
|
|
228110
|
-
children:
|
|
228165
|
+
children: children8
|
|
228111
228166
|
} }] : [];
|
|
228112
228167
|
}
|
|
228113
228168
|
function imageBytes(text2, maximum, context) {
|
|
@@ -229166,13 +229221,13 @@ function clipboardStyleRecords(sheet, range3, context) {
|
|
|
229166
229221
|
}
|
|
229167
229222
|
return record6(step.value.children[0], true);
|
|
229168
229223
|
};
|
|
229169
|
-
const
|
|
229224
|
+
const children8 = clipboardStyles(sheet, range3, styleNode({ Script: 0 }, "General", true), styleNode, context).map((region) => ({ name: "StyleRegion", namespace: namespace4, text: "", attributes: Object.entries({
|
|
229170
229225
|
startCol: region.range.startColumn - range3.startColumn,
|
|
229171
229226
|
startRow: region.range.startRow - range3.startRow,
|
|
229172
229227
|
endCol: region.range.endColumn - range3.startColumn,
|
|
229173
229228
|
endRow: region.range.endRow - range3.startRow
|
|
229174
229229
|
}).map(([name, value3]) => ({ name, namespace: "", value: String(value3) })), children: [region.style] }));
|
|
229175
|
-
return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children:
|
|
229230
|
+
return [{ source: "Gnumeric_XmlIO:sax", kind: "Styles", disposition: "retained", data: { name: "Styles", namespace: namespace4, text: "", attributes: [], children: children8 } }];
|
|
229176
229231
|
}
|
|
229177
229232
|
function writeClipboardGnumeric(book, sheet, range3, context) {
|
|
229178
229233
|
const writer = new XmlWriter(context.limits.outputBytes, context);
|
|
@@ -229821,10 +229876,10 @@ Run 'ssconvert --help' to see a full list of available command line options.
|
|
|
229821
229876
|
`
|
|
229822
229877
|
);
|
|
229823
229878
|
function parseCommand(supplied, profile) {
|
|
229824
|
-
const
|
|
229825
|
-
const
|
|
229879
|
+
const encoder4 = new TextEncoder();
|
|
229880
|
+
const decoder2 = new TextDecoder("utf8", { ignoreBOM: true });
|
|
229826
229881
|
const byteMode = supplied.some((argument) => typeof argument !== "string");
|
|
229827
|
-
const bytes = supplied.map((argument) => typeof argument === "string" ?
|
|
229882
|
+
const bytes = supplied.map((argument) => typeof argument === "string" ? encoder4.encode(argument) : new Uint8Array(argument));
|
|
229828
229883
|
const argv = bytes.map((argument) => Array.from(argument, (byte) => String.fromCharCode(byte)).join(""));
|
|
229829
229884
|
const operandBytes = [];
|
|
229830
229885
|
const unknown = (index2) => {
|
|
@@ -229838,15 +229893,15 @@ function parseCommand(supplied, profile) {
|
|
|
229838
229893
|
message = "[Invalid UTF-8] Unknown option " + Array.from(option, (byte) => byte >= 32 && byte < 127 || byte === 9 || byte === 10 ? String.fromCharCode(byte) : `\\x${byte.toString(16).padStart(2, "0")}`).join("");
|
|
229839
229894
|
}
|
|
229840
229895
|
const result2 = parserError(message);
|
|
229841
|
-
return { ...result2, stderrBytes:
|
|
229896
|
+
return { ...result2, stderrBytes: encoder4.encode(result2.stderr) };
|
|
229842
229897
|
}
|
|
229843
|
-
const prefix =
|
|
229844
|
-
const suffix =
|
|
229898
|
+
const prefix = encoder4.encode("Unknown option ");
|
|
229899
|
+
const suffix = encoder4.encode("\nRun 'ssconvert --help' to see a full list of available command line options.\n");
|
|
229845
229900
|
const raw = new Uint8Array(prefix.length + option.length + suffix.length);
|
|
229846
229901
|
raw.set(prefix);
|
|
229847
229902
|
raw.set(option, prefix.length);
|
|
229848
229903
|
raw.set(suffix, prefix.length + option.length);
|
|
229849
|
-
return { kind: "terminal", exitCode: 1, stdout: "", stderr:
|
|
229904
|
+
return { kind: "terminal", exitCode: 1, stdout: "", stderr: decoder2.decode(raw), stderrBytes: raw };
|
|
229850
229905
|
};
|
|
229851
229906
|
const operands = [], scalars = {}, scalarBytes = {}, arrays = {}, flags = /* @__PURE__ */ new Set();
|
|
229852
229907
|
let options = true;
|
|
@@ -229862,7 +229917,7 @@ function parseCommand(supplied, profile) {
|
|
|
229862
229917
|
continue;
|
|
229863
229918
|
}
|
|
229864
229919
|
if (!options || !argument.startsWith("-") || argument === "-") {
|
|
229865
|
-
operands.push(
|
|
229920
|
+
operands.push(decoder2.decode(bytes[index2]));
|
|
229866
229921
|
operandBytes.push(bytes[index2]);
|
|
229867
229922
|
continue;
|
|
229868
229923
|
}
|
|
@@ -229909,7 +229964,7 @@ function parseCommand(supplied, profile) {
|
|
|
229909
229964
|
let decoded;
|
|
229910
229965
|
if (scalar2 === "lib-dir" || scalar2 === "data-dir") {
|
|
229911
229966
|
scalarBytes[scalar2] = new Uint8Array(valueBytes);
|
|
229912
|
-
decoded =
|
|
229967
|
+
decoded = decoder2.decode(valueBytes);
|
|
229913
229968
|
} else {
|
|
229914
229969
|
try {
|
|
229915
229970
|
decoded = new TextDecoder("utf8", { fatal: true, ignoreBOM: true }).decode(valueBytes);
|
|
@@ -229990,7 +230045,7 @@ async function runCommand(argv, engine, operation, profile) {
|
|
|
229990
230045
|
return { exitCode: error2.exitCode };
|
|
229991
230046
|
}
|
|
229992
230047
|
const parsed = parseCommand(argv, profile);
|
|
229993
|
-
const
|
|
230048
|
+
const encoder4 = new TextEncoder();
|
|
229994
230049
|
let stderrFailed = false;
|
|
229995
230050
|
async function report(bytes) {
|
|
229996
230051
|
operation.signal.throwIfAborted();
|
|
@@ -230010,7 +230065,7 @@ async function runCommand(argv, engine, operation, profile) {
|
|
|
230010
230065
|
if (outputBytes2 > (engine.limits.commandOutputBytes ?? Infinity))
|
|
230011
230066
|
throw new SsconvertError("resource-limit", "ssconvert output bytes limit exceeded");
|
|
230012
230067
|
}
|
|
230013
|
-
return
|
|
230068
|
+
return encoder4.encode(text2);
|
|
230014
230069
|
}
|
|
230015
230070
|
try {
|
|
230016
230071
|
if (parsed.kind === "terminal") {
|
|
@@ -230111,7 +230166,7 @@ async function runCommand(argv, engine, operation, profile) {
|
|
|
230111
230166
|
...operation,
|
|
230112
230167
|
async diagnostic(diagnostic) {
|
|
230113
230168
|
operation.signal.throwIfAborted();
|
|
230114
|
-
await report(diagnostic.bytes ??
|
|
230169
|
+
await report(diagnostic.bytes ?? encoder4.encode(`${diagnostic.message}
|
|
230115
230170
|
`));
|
|
230116
230171
|
emitted.add(diagnostic);
|
|
230117
230172
|
operation.signal.throwIfAborted();
|
|
@@ -230124,7 +230179,7 @@ async function runCommand(argv, engine, operation, profile) {
|
|
|
230124
230179
|
for (const diagnostic of result2.diagnostics) {
|
|
230125
230180
|
if (emitted.has(diagnostic)) continue;
|
|
230126
230181
|
operation.signal.throwIfAborted();
|
|
230127
|
-
await report(diagnostic.bytes ??
|
|
230182
|
+
await report(diagnostic.bytes ?? encoder4.encode(`${diagnostic.message}
|
|
230128
230183
|
`));
|
|
230129
230184
|
}
|
|
230130
230185
|
operation.signal.throwIfAborted();
|
|
@@ -230133,7 +230188,7 @@ async function runCommand(argv, engine, operation, profile) {
|
|
|
230133
230188
|
operation.signal.throwIfAborted();
|
|
230134
230189
|
if (stderrFailed) throw error2;
|
|
230135
230190
|
if (!isSsconvertError(error2)) throw error2;
|
|
230136
|
-
await report(
|
|
230191
|
+
await report(encoder4.encode(`${error2.message}
|
|
230137
230192
|
`));
|
|
230138
230193
|
operation.signal.throwIfAborted();
|
|
230139
230194
|
return { exitCode: error2.exitCode };
|
|
@@ -233363,6 +233418,264 @@ function ssconvertCommands(options = {}) {
|
|
|
233363
233418
|
function createSsconvertCommands(options = {}) {
|
|
233364
233419
|
return Object.freeze([createSsconvertCommand(options)]);
|
|
233365
233420
|
}
|
|
233421
|
+
function parseSimpleSeparatedRows(text2, sep) {
|
|
233422
|
+
const rows = [];
|
|
233423
|
+
let row = [];
|
|
233424
|
+
let field = "";
|
|
233425
|
+
let quoted = false;
|
|
233426
|
+
for (let i = 0; i < text2.length; i++) {
|
|
233427
|
+
const ch3 = text2[i];
|
|
233428
|
+
if (ch3 === '"') {
|
|
233429
|
+
if (quoted && text2[i + 1] === '"') {
|
|
233430
|
+
field += '"';
|
|
233431
|
+
i++;
|
|
233432
|
+
} else if (quoted || field.length === 0) {
|
|
233433
|
+
quoted = !quoted;
|
|
233434
|
+
} else {
|
|
233435
|
+
return void 0;
|
|
233436
|
+
}
|
|
233437
|
+
} else if (!quoted && ch3 === sep) {
|
|
233438
|
+
if (field.startsWith("=") || field.startsWith("'"))
|
|
233439
|
+
return void 0;
|
|
233440
|
+
row.push(field);
|
|
233441
|
+
field = "";
|
|
233442
|
+
} else if (!quoted && (ch3 === "\r" || ch3 === "\n")) {
|
|
233443
|
+
if (field.startsWith("=") || field.startsWith("'"))
|
|
233444
|
+
return void 0;
|
|
233445
|
+
row.push(field);
|
|
233446
|
+
rows.push(row);
|
|
233447
|
+
row = [];
|
|
233448
|
+
field = "";
|
|
233449
|
+
if (ch3 === "\r" && text2[i + 1] === "\n")
|
|
233450
|
+
i++;
|
|
233451
|
+
} else {
|
|
233452
|
+
field += ch3;
|
|
233453
|
+
}
|
|
233454
|
+
}
|
|
233455
|
+
if (quoted)
|
|
233456
|
+
return void 0;
|
|
233457
|
+
if (field.length > 0 || row.length > 0) {
|
|
233458
|
+
if (field.startsWith("=") || field.startsWith("'"))
|
|
233459
|
+
return void 0;
|
|
233460
|
+
row.push(field);
|
|
233461
|
+
rows.push(row);
|
|
233462
|
+
}
|
|
233463
|
+
return rows;
|
|
233464
|
+
}
|
|
233465
|
+
function formatSimpleCsv(rows) {
|
|
233466
|
+
let output2 = "";
|
|
233467
|
+
for (const row of rows) {
|
|
233468
|
+
for (let index2 = 0; index2 < row.length; index2++) {
|
|
233469
|
+
if (index2)
|
|
233470
|
+
output2 += ",";
|
|
233471
|
+
const value3 = row[index2];
|
|
233472
|
+
appendTextField(typeof value3 === "string" ? value3 : rendered(value3), { mode: "auto", quote: '"', whitespace: true }, (text2) => {
|
|
233473
|
+
output2 += text2;
|
|
233474
|
+
});
|
|
233475
|
+
}
|
|
233476
|
+
output2 += "\n";
|
|
233477
|
+
}
|
|
233478
|
+
return output2;
|
|
233479
|
+
}
|
|
233480
|
+
var namespace5 = "http://schemas.openxmlformats.org/spreadsheetml/2006/main";
|
|
233481
|
+
var decoder = new TextDecoder("utf-8", { fatal: true });
|
|
233482
|
+
var encoder3 = new TextEncoder();
|
|
233483
|
+
function parse2(bytes) {
|
|
233484
|
+
if (bytes.byteLength > 2097152)
|
|
233485
|
+
throw new RangeError("Synchronous XLSX XML limit exceeded");
|
|
233486
|
+
return parseXml(decoder.decode(bytes), { maxDepth: 32, maxNodes: 1e5, maxAttributes: 2e5, maxTextLength: 2097152 });
|
|
233487
|
+
}
|
|
233488
|
+
function attribute6(node3, name) {
|
|
233489
|
+
return node3.attributes.find((item) => item.name === name)?.value;
|
|
233490
|
+
}
|
|
233491
|
+
function children7(node3, name) {
|
|
233492
|
+
return node3.children.filter((item) => item.namespace === namespace5 && item.localName === name);
|
|
233493
|
+
}
|
|
233494
|
+
function stringValue(node3) {
|
|
233495
|
+
return decodeXlsxString(node3.children.flatMap((item) => {
|
|
233496
|
+
if (item.namespace !== namespace5)
|
|
233497
|
+
return [];
|
|
233498
|
+
if (item.localName === "t")
|
|
233499
|
+
return [item.text];
|
|
233500
|
+
return item.localName === "r" ? children7(item, "t").map((text2) => text2.text) : [];
|
|
233501
|
+
}).join(""));
|
|
233502
|
+
}
|
|
233503
|
+
function parseSimpleXlsxTable(entries2) {
|
|
233504
|
+
let expandedBytes = 0;
|
|
233505
|
+
for (const [name, bytes] of entries2) {
|
|
233506
|
+
expandedBytes += bytes.byteLength;
|
|
233507
|
+
if (expandedBytes > 2097152 || name === "EncryptionInfo" || name === "EncryptedPackage" || name.startsWith("xl/worksheets/") && name.endsWith(".xml") && name !== "xl/worksheets/sheet1.xml")
|
|
233508
|
+
return void 0;
|
|
233509
|
+
}
|
|
233510
|
+
const workbookBytes2 = entries2.get("xl/workbook.xml");
|
|
233511
|
+
let sheetName2 = "Sheet1";
|
|
233512
|
+
if (workbookBytes2) {
|
|
233513
|
+
const workbook = parse2(workbookBytes2);
|
|
233514
|
+
const sheets = children7(workbook, "sheets")[0];
|
|
233515
|
+
if (!sheets || children7(sheets, "sheet").length !== 1)
|
|
233516
|
+
return void 0;
|
|
233517
|
+
sheetName2 = attribute6(children7(sheets, "sheet")[0], "name") ?? sheetName2;
|
|
233518
|
+
}
|
|
233519
|
+
const sheetBytes = entries2.get("xl/worksheets/sheet1.xml");
|
|
233520
|
+
if (!sheetBytes)
|
|
233521
|
+
return void 0;
|
|
233522
|
+
const sheet = parse2(sheetBytes);
|
|
233523
|
+
if (sheet.namespace !== namespace5 || sheet.localName !== "worksheet")
|
|
233524
|
+
return void 0;
|
|
233525
|
+
const data3 = children7(sheet, "sheetData")[0];
|
|
233526
|
+
if (!data3)
|
|
233527
|
+
return void 0;
|
|
233528
|
+
const sharedBytes = entries2.get("xl/sharedStrings.xml");
|
|
233529
|
+
const sharedItems = sharedBytes ? children7(parse2(sharedBytes), "si") : [];
|
|
233530
|
+
if (sharedItems.some((item) => children7(item, "r").some((run) => children7(run, "rPr").length)))
|
|
233531
|
+
return void 0;
|
|
233532
|
+
const strings = sharedItems.map(stringValue);
|
|
233533
|
+
const rows = [];
|
|
233534
|
+
for (const row of children7(data3, "row")) {
|
|
233535
|
+
if (attribute6(row, "r") !== String(rows.length + 1))
|
|
233536
|
+
return void 0;
|
|
233537
|
+
const values2 = [];
|
|
233538
|
+
for (const cell of children7(row, "c")) {
|
|
233539
|
+
const ref = attribute6(cell, "r");
|
|
233540
|
+
if (ref === void 0 || attribute6(cell, "s") !== void 0 || children7(cell, "f").length)
|
|
233541
|
+
return void 0;
|
|
233542
|
+
const address = parseA1(ref);
|
|
233543
|
+
if (address.row !== rows.length || address.column !== values2.length)
|
|
233544
|
+
return void 0;
|
|
233545
|
+
const type = attribute6(cell, "t") ?? "n";
|
|
233546
|
+
const raw = children7(cell, "v")[0]?.text ?? "";
|
|
233547
|
+
if (type === "inlineStr") {
|
|
233548
|
+
const value3 = children7(cell, "is")[0];
|
|
233549
|
+
if (value3 && children7(value3, "r").some((run) => children7(run, "rPr").length))
|
|
233550
|
+
return void 0;
|
|
233551
|
+
values2.push({ kind: "string", value: value3 ? stringValue(value3) : "" });
|
|
233552
|
+
} else if (type === "s") {
|
|
233553
|
+
const index2 = Number(raw);
|
|
233554
|
+
if (!Number.isSafeInteger(index2) || index2 < 0 || String(index2) !== raw || strings[index2] === void 0)
|
|
233555
|
+
return void 0;
|
|
233556
|
+
values2.push({ kind: "string", value: strings[index2] });
|
|
233557
|
+
} else if (type === "b") {
|
|
233558
|
+
if (raw !== "0" && raw !== "1")
|
|
233559
|
+
return void 0;
|
|
233560
|
+
values2.push({ kind: "boolean", value: raw === "1" });
|
|
233561
|
+
} else if (type === "str")
|
|
233562
|
+
values2.push({ kind: "string", value: decodeXlsxString(raw) });
|
|
233563
|
+
else if (type === "n") {
|
|
233564
|
+
if (raw === "")
|
|
233565
|
+
values2.push({ kind: "blank" });
|
|
233566
|
+
else if (Number.isFinite(Number(raw)))
|
|
233567
|
+
values2.push({ kind: "number", value: Number(raw) });
|
|
233568
|
+
else
|
|
233569
|
+
return void 0;
|
|
233570
|
+
} else
|
|
233571
|
+
return void 0;
|
|
233572
|
+
}
|
|
233573
|
+
if (rows.length && values2.length !== rows[0].length)
|
|
233574
|
+
return void 0;
|
|
233575
|
+
rows.push(values2);
|
|
233576
|
+
}
|
|
233577
|
+
return { rows, sheetName: sheetName2 };
|
|
233578
|
+
}
|
|
233579
|
+
function simpleDecimal(value3) {
|
|
233580
|
+
let offset = value3.startsWith("-") ? 1 : 0;
|
|
233581
|
+
const first = offset;
|
|
233582
|
+
while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57)
|
|
233583
|
+
offset++;
|
|
233584
|
+
if (offset === first || offset > first + 1 && value3[first] === "0")
|
|
233585
|
+
return false;
|
|
233586
|
+
if (value3[offset] === ".") {
|
|
233587
|
+
const start = ++offset;
|
|
233588
|
+
while (offset < value3.length && value3.charCodeAt(offset) >= 48 && value3.charCodeAt(offset) <= 57)
|
|
233589
|
+
offset++;
|
|
233590
|
+
if (offset === start)
|
|
233591
|
+
return false;
|
|
233592
|
+
}
|
|
233593
|
+
return offset === value3.length && Number.isFinite(Number(value3));
|
|
233594
|
+
}
|
|
233595
|
+
function buildSimpleXlsx(rows, sheetName2 = "Sheet1") {
|
|
233596
|
+
const sheetRows = rows.map((row, rowIndex) => `<row r="${rowIndex + 1}">${row.map((value3, column) => {
|
|
233597
|
+
const reference = formatA1(rowIndex, column);
|
|
233598
|
+
const cell = typeof value3 === "string" ? simpleDecimal(value3) ? { kind: "number", value: Number(value3) } : { kind: "string", value: value3 } : value3;
|
|
233599
|
+
if (cell.kind === "blank")
|
|
233600
|
+
return `<c r="${reference}"/>`;
|
|
233601
|
+
if (cell.kind === "number")
|
|
233602
|
+
return `<c r="${reference}" t="n"><v>${cell.value}</v></c>`;
|
|
233603
|
+
if (cell.kind === "boolean")
|
|
233604
|
+
return `<c r="${reference}" t="b"><v>${cell.value ? 1 : 0}</v></c>`;
|
|
233605
|
+
if (cell.kind !== "string")
|
|
233606
|
+
throw new TypeError("Unsupported synchronous XLSX cell");
|
|
233607
|
+
return `<c r="${reference}" t="inlineStr"><is><t xml:space="preserve">${escapeXlsx(encodeXlsxString(cell.value))}</t></is></c>`;
|
|
233608
|
+
}).join("")}</row>`).join("");
|
|
233609
|
+
return {
|
|
233610
|
+
"[Content_Types].xml": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/></Types>'),
|
|
233611
|
+
"_rels/.rels": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>'),
|
|
233612
|
+
"xl/workbook.xml": encoder3.encode(`<?xml version="1.0" encoding="UTF-8"?><workbook xmlns="${namespace5}"><sheets><sheet name="${escapeXlsx(sheetName2)}" sheetId="1" r:id="rId1" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"/></sheets></workbook>`),
|
|
233613
|
+
"xl/_rels/workbook.xml.rels": encoder3.encode('<?xml version="1.0" encoding="UTF-8"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/sheet1.xml"/></Relationships>'),
|
|
233614
|
+
"xl/worksheets/sheet1.xml": encoder3.encode(`<?xml version="1.0" encoding="UTF-8"?><worksheet xmlns="${namespace5}"><sheetData>${sheetRows}</sheetData></worksheet>`)
|
|
233615
|
+
};
|
|
233616
|
+
}
|
|
233617
|
+
var syncUtf8Decoder = new TextDecoder("utf-8", { fatal: true });
|
|
233618
|
+
var syncUtf8Encoder = new TextEncoder();
|
|
233619
|
+
function createSyncSsconvertEvaluator(archive) {
|
|
233620
|
+
return function evalSyncSsconvert(execute, opArgs, inBytes, readFileSync, writeFileSync) {
|
|
233621
|
+
if (!builtInDirectContextExecutors2.has(execute) || opArgs.length === 0) return void 0;
|
|
233622
|
+
try {
|
|
233623
|
+
const parsed = parseCommand(opArgs);
|
|
233624
|
+
if (parsed.kind === "terminal") {
|
|
233625
|
+
if (parsed.exitCode === 0 && !parsed.stderr && parsed.stdout) {
|
|
233626
|
+
return parsed.stdout;
|
|
233627
|
+
}
|
|
233628
|
+
return void 0;
|
|
233629
|
+
}
|
|
233630
|
+
if (parsed.action !== "convert" || parsed.flags.length > 0 || Object.keys(parsed.arrays).length > 0 || parsed.scalars.clipboard !== void 0 || parsed.scalars.resize !== void 0 || parsed.scalars["export-range"] !== void 0 || parsed.scalars["export-options"] !== void 0 || parsed.scalars["import-encoding"] !== void 0 || parsed.operands.length !== 2) {
|
|
233631
|
+
return void 0;
|
|
233632
|
+
}
|
|
233633
|
+
const [srcUri, dstUri] = parsed.operands;
|
|
233634
|
+
if (srcUri.includes("%") || dstUri.includes("%")) return void 0;
|
|
233635
|
+
if (srcUri.includes("://") && srcUri !== "fd://0") return void 0;
|
|
233636
|
+
if (dstUri.includes("://") && dstUri !== "fd://1") return void 0;
|
|
233637
|
+
const impType = parsed.scalars["import-type"];
|
|
233638
|
+
const expType = parsed.scalars["export-type"];
|
|
233639
|
+
const lowerSrc = srcUri.toLowerCase();
|
|
233640
|
+
const lowerDst = dstUri.toLowerCase();
|
|
233641
|
+
let inFmt;
|
|
233642
|
+
if (impType === "Gnumeric_stf:stf_csvtab" || !impType && lowerSrc.endsWith(".csv")) inFmt = "csv";
|
|
233643
|
+
else if (!impType && lowerSrc.endsWith(".tsv")) inFmt = "tsv";
|
|
233644
|
+
else if (impType === "Gnumeric_Excel:xlsx" || !impType && lowerSrc.endsWith(".xlsx")) inFmt = "xlsx";
|
|
233645
|
+
if (!inFmt) return void 0;
|
|
233646
|
+
let outFmt;
|
|
233647
|
+
if (expType === "Gnumeric_stf:stf_csv" || !expType && lowerDst.endsWith(".csv")) outFmt = "csv";
|
|
233648
|
+
else if (expType === "Gnumeric_Excel:xlsx" || expType === "Gnumeric_Excel:xlsx2" || !expType && lowerDst.endsWith(".xlsx")) outFmt = "xlsx";
|
|
233649
|
+
if (!outFmt) return void 0;
|
|
233650
|
+
if (dstUri === "fd://1" && (!expType || outFmt !== "csv")) return void 0;
|
|
233651
|
+
const srcBytes = srcUri === "fd://0" ? inBytes : readFileSync?.(srcUri);
|
|
233652
|
+
if (!srcBytes || srcBytes.byteLength === 0 || srcBytes.byteLength > 131072) return void 0;
|
|
233653
|
+
let rows;
|
|
233654
|
+
let sheetName2 = srcUri === "fd://0" ? "Sheet1" : srcUri.split("/").pop() || "Sheet1";
|
|
233655
|
+
if (inFmt === "csv" || inFmt === "tsv") {
|
|
233656
|
+
const text2 = syncUtf8Decoder.decode(srcBytes);
|
|
233657
|
+
rows = parseSimpleSeparatedRows(text2, inFmt === "tsv" ? " " : ",");
|
|
233658
|
+
} else {
|
|
233659
|
+
const table2 = parseSimpleXlsxTable(archive.read(srcBytes));
|
|
233660
|
+
if (!table2) return void 0;
|
|
233661
|
+
rows = table2.rows;
|
|
233662
|
+
sheetName2 = table2.sheetName;
|
|
233663
|
+
}
|
|
233664
|
+
if (!rows) return void 0;
|
|
233665
|
+
if (outFmt === "csv") {
|
|
233666
|
+
const csvText = formatSimpleCsv(rows);
|
|
233667
|
+
if (dstUri === "fd://1") return csvText;
|
|
233668
|
+
if (!writeFileSync || !writeFileSync(dstUri, syncUtf8Encoder.encode(csvText))) return void 0;
|
|
233669
|
+
return "";
|
|
233670
|
+
}
|
|
233671
|
+
const xlsxBytes = archive.write(buildSimpleXlsx(rows, sheetName2));
|
|
233672
|
+
if (!writeFileSync || !writeFileSync(dstUri, xlsxBytes)) return void 0;
|
|
233673
|
+
return "";
|
|
233674
|
+
} catch {
|
|
233675
|
+
return void 0;
|
|
233676
|
+
}
|
|
233677
|
+
};
|
|
233678
|
+
}
|
|
233366
233679
|
export {
|
|
233367
233680
|
DEFAULT_SHEET_SIZE,
|
|
233368
233681
|
ImageExportError,
|
|
@@ -233382,6 +233695,7 @@ export {
|
|
|
233382
233695
|
createResourceIO,
|
|
233383
233696
|
createSsconvertCommand,
|
|
233384
233697
|
createSsconvertCommands,
|
|
233698
|
+
createSyncSsconvertEvaluator,
|
|
233385
233699
|
createVfsOutput,
|
|
233386
233700
|
createXlsxWriter,
|
|
233387
233701
|
csvFormat,
|