@poe-platform/safe-bash 0.1.816 → 0.1.817

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/pdf-ast/content/evaluator.d.ts +4 -0
  2. package/dist/pdf-ast/cos/value-parser.d.ts +2 -0
  3. package/dist/pdf-ast/fonts/resolve.d.ts +5 -1
  4. package/dist/pdf-ast/index.js +172 -165
  5. package/dist/safe-bash/command-chunks/biff-KLS4T7FP-UO3CXFFF.js +5581 -0
  6. package/dist/safe-bash/command-chunks/chunk-2J4OQT3F.js +153 -0
  7. package/dist/safe-bash/command-chunks/{chunk-K7VDCBXW.js → chunk-ABL2DPJI.js} +20 -20
  8. package/dist/safe-bash/command-chunks/{chunk-RINR7XPR.js → chunk-E64ZI2YB.js} +121 -4
  9. package/dist/safe-bash/command-chunks/{chunk-GEDO5V32.js → chunk-FSG6UC2N.js} +243 -105
  10. package/dist/safe-bash/command-chunks/{chunk-4QEJPP3K.js → chunk-S5X7PBO4.js} +1 -1
  11. package/dist/safe-bash/command-chunks/{chunk-IHLZ6HNQ.js → chunk-TSKJNCKD.js} +3 -2
  12. package/dist/safe-bash/command-chunks/{chunk-DBZCTL7C.js → chunk-UYZ6EFZE.js} +20 -18
  13. package/dist/safe-bash/command-chunks/{chunk-B2C3UPJS.js → chunk-W42SUPD6.js} +13 -1
  14. package/dist/safe-bash/command-chunks/chunk-ZHHALBM7.js +398 -0
  15. package/dist/safe-bash/command-chunks/{command-engine-GHE6QUHU.js → command-engine-2QXVRRH3.js} +8 -4
  16. package/dist/safe-bash/command-chunks/{engine-RG6HQCCB-FXYZS264.js → engine-T4GP6QOK-ECFKMR5V.js} +1 -1
  17. package/dist/safe-bash/command-chunks/odf-SL5TG4B3-XI3FNOTN.js +3041 -0
  18. package/dist/safe-bash/command-chunks/{xlsx-RE54MFCS-IQ6OXXKK.js → xlsx-RE54MFCS-4UZ5W3U7.js} +1 -1
  19. package/dist/safe-bash-command-apply-patch/apply.js +1 -1
  20. package/dist/safe-bash-command-apply-patch/index.js +1 -1
  21. package/dist/safe-bash-command-csvkit/index.js +1 -1
  22. package/dist/safe-bash-command-diff/diff.js +1 -1
  23. package/dist/safe-bash-command-diff/index.js +1 -1
  24. package/dist/safe-bash-command-pptx/engine.js +1 -1
  25. package/dist/safe-bash-command-ssconvert/index.js +5 -5
  26. package/dist/safe-bash-presentation-engine/index.js +1 -1
  27. package/dist/safe-bash-presentation-engine/retained-tags.d.ts +20 -0
  28. package/dist/safe-bash-presentation-engine/tags.d.ts +2 -0
  29. package/dist/safe-bash-presentation-engine/tags.js +11 -3
  30. package/dist/safe-bash-xml-engine/document.js +2 -2
  31. package/dist/safe-bash-xml-engine/index.js +2 -2
  32. package/dist/safe-bash-xml-engine/stored-document.d.ts +2 -0
  33. package/dist/safe-bash-xml-engine/stored-document.js +1 -1
  34. package/dist/safe-bash-xml-engine/stored-evaluate.js +2 -2
  35. package/dist/safe-bash-xml-engine/stored-namespaces.d.ts +21 -0
  36. package/dist/safe-bash-zip-engine/zip/safety.js +1 -1
  37. package/dist/safe-bash-zip-engine/zip/volumes.js +1 -1
  38. package/dist/spreadsheet-format-xls/biff-properties-merge.js +3 -3
  39. package/dist/spreadsheet-format-xls/biff-properties.d.ts +4 -2
  40. package/dist/spreadsheet-format-xls/biff-properties.js +141 -122
  41. package/dist/spreadsheet-format-xls/biff-property-names.d.ts +24 -0
  42. package/dist/spreadsheet-format-xls/biff-property-names.js +167 -0
  43. package/dist/xlsx-ast/comment-geometry.js +1 -1
  44. package/package.json +3 -2
  45. package/dist/safe-bash/command-chunks/biff-UBP2BZLK-JPODPKS3.js +0 -5448
  46. package/dist/safe-bash/command-chunks/chunk-O2HNOQQG.js +0 -161
  47. package/dist/safe-bash/command-chunks/chunk-ZUP5TBRG.js +0 -99
  48. package/dist/safe-bash/command-chunks/odf-3EA3EVSD-7B5GVNTC.js +0 -3097
@@ -1,3097 +0,0 @@
1
- import {
2
- L as L2
3
- } from "./chunk-ZUP5TBRG.js";
4
- import {
5
- C,
6
- D,
7
- I,
8
- L,
9
- T,
10
- V,
11
- g,
12
- l,
13
- nt,
14
- ot,
15
- rt,
16
- u
17
- } from "./chunk-LNWAYODV.js";
18
- import "./chunk-WHWIZ2B7.js";
19
- import {
20
- ZipStorageFailure,
21
- createStoredZipEntries
22
- } from "./chunk-37XCUS43.js";
23
- import {
24
- ZipDirectoryIndex,
25
- ZipWriteChain,
26
- createZipCodec
27
- } from "./chunk-IOEUZ4EA.js";
28
- import {
29
- CodecError,
30
- createCompressionCodec
31
- } from "./chunk-E6SK3OU2.js";
32
- import "./chunk-65DS4IOB.js";
33
-
34
- // packages/safe-bash-command-ssconvert/dist/chunks/odf-3EA3EVSD.js
35
- import { SsconvertError as un } from "../../spreadsheet-engine/contracts.js";
36
- import { createAxisStorage as _i } from "../../spreadsheet-engine/workbook/axis-storage.js";
37
- import { SsconvertError as In } from "../../spreadsheet-engine/contracts.js";
38
- import { IntegerTable as Ei } from "@poe-platform/safe-fs/storage";
39
- import { SsconvertError as Cn } from "../../spreadsheet-engine/contracts.js";
40
- import { createAxisStorage as zi } from "../../spreadsheet-engine/workbook/axis-storage.js";
41
- import { snapshotRecords as $i } from "../../spreadsheet-ast/model.js";
42
- import { encodeTextStream as ui } from "../../spreadsheet-engine/encoding/encode-stream.js";
43
- import { ownWorkbookSource as ji } from "../../spreadsheet-engine/workbook/source.js";
44
- import { IntegerTable as qa } from "@poe-platform/safe-fs/storage";
45
- import { encodeTextStream as Ki } from "../../spreadsheet-engine/encoding/encode-stream.js";
46
- import { ownedRangeSource as qi } from "../../spreadsheet-engine/range-input.js";
47
- import { SsconvertError as zt } from "../../spreadsheet-engine/contracts.js";
48
- import { parseXmlStream as Zi, XmlLimitError as eo } from "@poe-platform/safe-fs/xml";
49
- import { SsconvertError as Le } from "../../spreadsheet-engine/contracts.js";
50
- import { MAX_SHEET_SIZE as me, DEFAULT_SHEET_SIZE as Un, formatA1 as Yn } from "../../spreadsheet-ast/index.js";
51
- import { foldSheetName as Ja } from "../../spreadsheet-ast/case-fold.js";
52
- import { parseExpression as on } from "../../spreadsheet-engine/formulas/parser.js";
53
- import { quotedLabelText as to } from "../../spreadsheet-engine/formulas/quoted-labels.js";
54
- import { SsconvertError as Ai } from "../../spreadsheet-engine/contracts.js";
55
- import { parseExpression as Ni } from "../../spreadsheet-engine/formulas/parser.js";
56
- import { visitFormula as pi } from "../../spreadsheet-engine/formulas/rewriting.js";
57
- import { recalculateWorkbook as bi } from "../../spreadsheet-engine/formulas/evaluator.js";
58
- import { visitFormula as no } from "../../spreadsheet-engine/formulas/rewriting.js";
59
- import { gnumericGrammar as ca, odfGrammar as qt, internalOdfGrammar as ao, legacyOpenOfficeGrammar as la } from "../../spreadsheet-engine/formulas/conventions.js";
60
- import { serializeExpression as oi, quoteNativeSheet as io, quoteFormulaString as Qa } from "../../spreadsheet-engine/formulas/serialization.js";
61
- import { translateOdfHyperlink as Za } from "../../spreadsheet-engine/codecs/odf-hyperlinks.js";
62
- import { dateSerial as oo, gregorian as ro } from "../../spreadsheet-engine/formulas/functions/dates.js";
63
- import { converterLocale as so } from "../../spreadsheet-engine/locale/runtime.js";
64
- import { formatA1 as jn } from "../../spreadsheet-ast/index.js";
65
- import { parseExpression as Li } from "../../spreadsheet-engine/formulas/parser.js";
66
- import { odfGrammar as yi } from "../../spreadsheet-engine/formulas/conventions.js";
67
- import { translateOdfHyperlink as gi } from "../../spreadsheet-engine/codecs/odf-hyperlinks.js";
68
- import { SsconvertError as Fa } from "../../spreadsheet-engine/contracts.js";
69
- import { odfNamespaces as Sn } from "../../spreadsheet-engine/codecs/odf-write-support.js";
70
- import { richTextSegments as Ri } from "../../spreadsheet-engine/codecs/rich-text-runs.js";
71
- import { writeGnumericRichText as wi } from "../../spreadsheet-engine/codecs/gnumeric-rich-text.js";
72
- import { SsconvertError as Ci } from "../../spreadsheet-engine/contracts.js";
73
- import { DEFAULT_SHEET_SIZE as Ii, MAX_SHEET_SIZE as Ya } from "../../spreadsheet-ast/index.js";
74
- import { parseExpression as Mi } from "../../spreadsheet-engine/formulas/parser.js";
75
- import { odfGrammar as Di } from "../../spreadsheet-engine/formulas/conventions.js";
76
- import { foldSheetName as Qn } from "../../spreadsheet-ast/case-fold.js";
77
- import { createOdfXml as co, odfObject as qe, odfAttributes as Kt, odfChildren as Rt, odfNamespaces as Lt, odfEncryptionNamespace as lo, upgradeOdfAnnotation as fo } from "../../spreadsheet-engine/codecs/odf-write-support.js";
78
- import { SsconvertError as aa } from "../../spreadsheet-engine/contracts.js";
79
- import { odfNamespaces as Fi } from "../../spreadsheet-engine/codecs/odf-write-support.js";
80
- import { exportOptionPairs as Eo } from "../../spreadsheet-engine/cli/export-options.js";
81
- import { renderCellText as _o } from "../../spreadsheet-engine/formatting/cell-text.js";
82
- import { encodeTextStream as xi } from "../../spreadsheet-engine/encoding/encode-stream.js";
83
- import { SsconvertError as tn } from "../../spreadsheet-engine/contracts.js";
84
- import { parseFormatSections as Ui } from "../../spreadsheet-engine/formatting/sections.js";
85
- import { scanFormat as Yi } from "../../spreadsheet-engine/formatting/numeric.js";
86
- import { odfObject as bt, odfAttributes as $t, odfChildren as nn, odfNamespaces as Xa } from "../../spreadsheet-engine/codecs/odf-write-support.js";
87
- import { snapshotRecords as Hi } from "../../spreadsheet-ast/model.js";
88
- import { IntegerTable as ki } from "@poe-platform/safe-fs/storage";
89
- import { odfAttributes as oa, odfChildren as za, odfNamespaces as Pn, odfObject as bn } from "../../spreadsheet-engine/codecs/odf-write-support.js";
90
- import { odfAttributes as Rn, odfChildren as ra, odfObject as jt } from "../../spreadsheet-engine/codecs/odf-write-support.js";
91
- import { formatA1 as Xi } from "../../spreadsheet-ast/index.js";
92
- import { quoteFormulaString as vi } from "../../spreadsheet-engine/formulas/serialization.js";
93
- import { odfGrammar as Wi } from "../../spreadsheet-engine/formulas/conventions.js";
94
- import { translateOdfHyperlink as Vi } from "../../spreadsheet-engine/codecs/odf-hyperlinks.js";
95
- import { serialDate as To } from "../../spreadsheet-engine/formulas/functions/dates.js";
96
- import { readGnumericRichText as uo } from "../../spreadsheet-engine/codecs/gnumeric-rich-text.js";
97
- function La(n, t) {
98
- let o, e = false, l2, _ = Promise.resolve(), d = /* @__PURE__ */ new WeakMap(), f = new Uint8Array(16384), i = new DataView(f.buffer), r = () => {
99
- if (n.signal.throwIfAborted(), e) throw new un("invalid-request", "ODF XML storage is closed");
100
- }, E = () => (e = true, l2 ??= _.then(async () => {
101
- f.fill(0), await o?.close();
102
- }));
103
- n.own(E), r();
104
- try {
105
- o = n.createWorkingStorage();
106
- } catch (L3) {
107
- throw new ZipStorageFailure(L3);
108
- }
109
- r();
110
- function a(L3) {
111
- let R = _.then(async () => {
112
- r();
113
- try {
114
- return await L3();
115
- } catch (A) {
116
- throw new ZipStorageFailure(A);
117
- }
118
- });
119
- return _ = R.then(() => {
120
- }, () => {
121
- }), R;
122
- }
123
- async function c(L3, R) {
124
- return a(async () => {
125
- let A = JSON.stringify(R, (w, s) => {
126
- if (s instanceof Map) return [...s];
127
- if (s && typeof s == "object" && "kind" in s && s.kind === "element") {
128
- let m = s;
129
- return { ...m, children: void 0, text: void 0, storedContent: d.get(m) };
130
- }
131
- return s;
132
- }), y = o.allocate(16 + A.length * 2);
133
- f.fill(0, 0, 16), i.setFloat64(8, A.length, true), await o.write(y, f.subarray(0, 16)), r();
134
- for (let w = 0; w < A.length; w += 8192) {
135
- let s = Math.min(8192, A.length - w);
136
- for (let m = 0; m < s; m++) i.setUint16(m * 2, A.charCodeAt(w + m), true);
137
- await o.write(y + 16 + w * 2, f.subarray(0, s * 2)), r();
138
- }
139
- let P = d.get(L3);
140
- P ? (i.setFloat64(0, y, true), await o.write(P.tail, f.subarray(0, 8)), r(), P.tail = y) : d.set(L3, { head: y, tail: y });
141
- });
142
- }
143
- async function T2(L3) {
144
- let R = await o.read(L3, 16);
145
- if (r(), R.length !== 16) throw new un("io", "Truncated ODF XML header");
146
- let A = new DataView(R.buffer, R.byteOffset, 16), y = A.getFloat64(0, true), P = A.getFloat64(8, true);
147
- if (!Number.isSafeInteger(y) || y < 0 || !Number.isSafeInteger(P) || P < 0 || P > (Number.MAX_SAFE_INTEGER - L3 - 16) / 2) throw new un("io", "Invalid ODF XML record");
148
- let w = "";
149
- for (let m = 0; m < P; m += 8192) {
150
- let u2 = Math.min(8192, P - m), b = await o.read(L3 + 16 + m * 2, u2 * 2);
151
- if (r(), b.length !== u2 * 2) throw new un("io", "Truncated ODF XML content");
152
- let O = new DataView(b.buffer, b.byteOffset, b.byteLength), U = [];
153
- for (let C2 = 0; C2 < u2; C2++) U.push(O.getUint16(C2 * 2, true));
154
- w += String.fromCharCode(...U);
155
- }
156
- let s = JSON.parse(w, (m, u2) => {
157
- if (u2 && typeof u2 == "object" && "kind" in u2 && u2.kind === "element") {
158
- let { storedContent: b, ...O } = u2, U = { ...O, namespaces: new Map(O.namespaces), children: O.content.filter((C2) => C2.kind === "element"), text: O.content.filter((C2) => C2.kind === "text" || C2.kind === "cdata").map((C2) => C2.text).join("") };
159
- return b && d.set(U, b), U;
160
- }
161
- return u2;
162
- });
163
- return { next: y, content: s };
164
- }
165
- async function* S(L3) {
166
- r();
167
- let R = d.get(L3);
168
- if (R) {
169
- let A = R.tail;
170
- for (let y = R.head; ; ) {
171
- let P = await a(() => T2(y));
172
- if (yield* P.content, y === A) break;
173
- if (P.next <= y) throw new un("io", "Invalid ODF XML chain");
174
- y = P.next;
175
- }
176
- }
177
- yield* L3.content, r();
178
- }
179
- async function* N(L3) {
180
- for await (let R of S(L3)) R.kind === "element" && (yield R);
181
- }
182
- async function g2(L3) {
183
- let R = [];
184
- for await (let A of S(L3)) R.push(A.kind === "element" ? await g2(A) : A);
185
- return { ...L3, content: R, children: R.filter((A) => A.kind === "element"), text: R.filter((A) => A.kind === "text" || A.kind === "cdata").map((A) => A.text).join("") };
186
- }
187
- return { streamElements: { captureBefore: true, includeNested: true, matches(L3, R) {
188
- return !R || !t.includes(L3.namespace) || !t.includes(R.namespace) ? false : R.localName === "table-row" ? ["table-cell", "covered-table-cell"].includes(L3.localName) : ["table-row", "table-row-group", "table-header-rows", "table-rows"].includes(L3.localName) && ["table", "table-row-group", "table-header-rows", "table-rows"].includes(R.localName);
189
- }, async consume(L3, R, A = []) {
190
- await c(R, [...A, L3]);
191
- } }, content: S, children: N, append: c, materialize: g2, has: (L3) => d.has(L3), close: E };
192
- }
193
- function ya(n, t) {
194
- let o = new Ei(n, 128), e = new Uint8Array(16384), l2 = new DataView(e.buffer), _ = false, d = Promise.resolve(), f = () => {
195
- if (t.throwIfAborted(), _) throw new Cn("invalid-request", "ODF cells are closed");
196
- };
197
- function i(a) {
198
- let c = d.then(() => (f(), a()));
199
- return d = c.then(() => {
200
- }, () => {
201
- }), c;
202
- }
203
- let r = (a) => BigInt(a) << 38n;
204
- async function E(a) {
205
- let c = Number(a), T2 = await n.read(c, 8);
206
- if (f(), T2.length !== 8) throw new Cn("io", "Truncated ODF cell header");
207
- let S = new DataView(T2.buffer, T2.byteOffset, 8).getFloat64(0, true);
208
- if (!Number.isSafeInteger(S) || S < 0 || S > (Number.MAX_SAFE_INTEGER - c - 8) / 2) throw new Cn("io", "Invalid ODF cell length");
209
- let N = "";
210
- for (let y = 0; y < S; y += 8192) {
211
- let P = Math.min(8192, S - y), w = await n.read(c + 8 + y * 2, P * 2);
212
- if (f(), w.length !== P * 2) throw new Cn("io", "Truncated ODF cell");
213
- let s = new DataView(w.buffer, w.byteOffset, w.byteLength), m = [];
214
- for (let u2 = 0; u2 < P; u2++) m.push(s.getUint16(u2 * 2, true));
215
- N += String.fromCharCode(...m);
216
- }
217
- let [g2, p] = JSON.parse(N), L3 = 0, R = 0;
218
- function A(y) {
219
- if (!y || typeof y != "object") return;
220
- let P = y;
221
- for (let w of Object.keys(P)) typeof P[w] == "number" ? (p[R] === L3 && (P[w] = -0, R++), L3++) : A(P[w]);
222
- }
223
- return p.length && A(g2), g2;
224
- }
225
- return { async close() {
226
- _ = true, await d, e.fill(0), o = void 0;
227
- }, append(a, c) {
228
- f();
229
- let T2 = 0, S = [], g2 = "[" + JSON.stringify(c, (L3, R) => (typeof R == "number" && (Object.is(R, -0) && S.push(T2), T2++), R)) + "," + JSON.stringify(S) + "]", p = r(a) | BigInt(c.row) << 14n | BigInt(c.column);
230
- return i(async () => {
231
- let L3 = n.allocate(8 + g2.length * 2);
232
- l2.setFloat64(0, g2.length, true), await n.write(L3, e.subarray(0, 8)), f();
233
- for (let R = 0; R < g2.length; R += 8192) {
234
- let A = Math.min(8192, g2.length - R);
235
- for (let y = 0; y < A; y++) l2.setUint16(y * 2, g2.charCodeAt(R + y), true);
236
- await n.write(L3 + 8 + R * 2, e.subarray(0, A * 2)), f();
237
- }
238
- await o.set(p, BigInt(L3)), f();
239
- });
240
- }, async *cells(a) {
241
- f();
242
- let c = o.entries(r(a), r(a + 1));
243
- try {
244
- for (; ; ) {
245
- let T2 = await i(async () => {
246
- let S = await c.next();
247
- return f(), S.done ? void 0 : E(S.value[1]);
248
- });
249
- if (!T2) break;
250
- yield T2;
251
- }
252
- f();
253
- } finally {
254
- await c.return(void 0);
255
- }
256
- } };
257
- }
258
- function ga(n) {
259
- let t, o, e = /* @__PURE__ */ new Map(), l2 = false, _, d;
260
- if (n.own(() => (l2 = true, d ??= Promise.resolve().then(async () => {
261
- await t?.close(), await o?.close(), await _?.close();
262
- }))), l2) throw new In("invalid-request", "ODF source is closed");
263
- try {
264
- _ = n.createWorkingStorage();
265
- } catch (a) {
266
- throw new ZipStorageFailure(a);
267
- }
268
- if (l2) throw new In("invalid-request", "ODF source is closed");
269
- let f = _, i = Promise.resolve();
270
- function r(a) {
271
- let c = i.then(a);
272
- return i = c.then(() => {
273
- }, () => {
274
- }), c;
275
- }
276
- let E = { allocate(a) {
277
- try {
278
- return f.allocate(a);
279
- } catch (c) {
280
- throw new ZipStorageFailure(c);
281
- }
282
- }, read(a, c) {
283
- return r(async () => {
284
- try {
285
- return new Uint8Array(await f.read(a, c));
286
- } catch (T2) {
287
- throw new ZipStorageFailure(T2);
288
- }
289
- });
290
- }, write(a, c) {
291
- return r(async () => {
292
- try {
293
- await f.write(a, c);
294
- } catch (T2) {
295
- throw new ZipStorageFailure(T2);
296
- }
297
- });
298
- }, close: () => f.close() };
299
- return t = ya(E, n.signal), o = _i(E, n.signal), { cells: t, axes: o, sheets: e, workbook(a) {
300
- let c = t, T2 = (N) => {
301
- if (n.signal.throwIfAborted(), l2) throw new In("invalid-request", "ODF source is closed");
302
- let g2 = e.get(N);
303
- if (!g2) throw new In("invalid-request", "Unknown ODF source sheet");
304
- return g2;
305
- };
306
- function S(N) {
307
- throw n.signal.throwIfAborted(), N instanceof ZipStorageFailure ? N.cause : N;
308
- }
309
- return { metadata: a, async *cells(N) {
310
- try {
311
- yield* c.cells(T2(N).ordinal);
312
- } catch (g2) {
313
- return S(g2);
314
- }
315
- }, async *axes(N, g2) {
316
- try {
317
- yield* T2(N)[g2].values();
318
- } catch (p) {
319
- return S(p);
320
- }
321
- } };
322
- } };
323
- }
324
- function Mn(n, t, o) {
325
- let e = t ? new ZipWriteChain(t, 16384, n.signal, async (r) => {
326
- r.throwIfAborted();
327
- }) : void 0, l2 = e ? new Uint8Array(16384) : void 0, _ = [], d = 0, f = false;
328
- function i() {
329
- l2?.fill(0), _.length = 0;
330
- }
331
- return n.own(i), { get hasContent() {
332
- return f;
333
- }, dispose: i, async append(r) {
334
- n.signal.throwIfAborted();
335
- async function* E() {
336
- for (let a of typeof r == "string" ? [r] : r) n.signal.throwIfAborted(), a && (f = true, yield a);
337
- }
338
- if (!e) {
339
- for await (let a of E()) _.push(a);
340
- return;
341
- }
342
- for await (let a of ui(E(), "UTF-8", false, n)) {
343
- o(a.length);
344
- for (let c = 0; c < a.length; ) {
345
- let T2 = Math.min(l2.length - d, a.length - c);
346
- l2.set(a.subarray(c, c + T2), d), d += T2, c += T2, d === l2.length && (await e.append([l2], d), d = 0);
347
- }
348
- }
349
- }, async *render() {
350
- if (n.signal.throwIfAborted(), !e) {
351
- yield* _;
352
- return;
353
- }
354
- d && (await e.append([l2.subarray(0, d)], d), d = 0), l2.fill(0), yield* e.read();
355
- } };
356
- }
357
- var wa = "243f6a8885a308d313198a2e03707344a4093822299f31d0082efa98ec4e6c89452821e638d01377be5466cf34e90c6cc0ac29b7c97c50dd3f84d5b5b54709179216d5d98979fb1bd1310ba698dfb5ac2ffd72dbd01adfb7b8e1afed6a267e96ba7c9045f12c7f9924a19947b3916cf70801f2e2858efc16636920d871574e69a458fea3f4933d7e0d95748f728eb658718bcd5882154aee7b54a41dc25a59b59c30d5392af26013c5d1b023286085f0ca417918b8db38ef8e79dcb0603a180e6c9e0e8bb01e8a3ed71577c1bd314b2778af2fda55605c60e65525f3aa55ab945748986263e8144055ca396a2aab10b6b4cc5c341141e8cea15486af7c72e993b3ee1411636fbc2a2ba9c55d741831f6ce5c3e169b87931eafd6ba336c24cf5c7a325381289586773b8f48986b4bb9afc4bfe81b6628219361d809ccfb21a991487cac605dec8032ef845d5de98575b1dc262302eb651b8823893e81d396acc50f6d6ff383f442392e0b4482a484200469c8f04a9e1f9b5e21c66842f6e96c9a670c9c61abd388f06a51a0d2d8542f68960fa728ab5133a36eef0b6c137a3be4ba3bf0507efb2a98a1f1651d39af017666ca593e82430e888cee8619456f9fb47d84a5c33b8b5ebee06f75d885c12073401a449f56c16aa64ed3aa62363f77061bfedf72429b023d37d0d724d00a1248db0fead349f1c09b075372c980991b7b25d479d8f6e8def7e3fe501ab6794c3b976ce0bd04c006bac1a94fb6409f60c45e5c9ec2196a246368fb6faf3e6c53b51339b2eb3b52ec6f6dfc511f9b30952ccc814544af5ebd09bee3d004de334afd660f2807192e4bb3c0cba85745c8740fd20b5f39b9d3fbdb5579c0bd1a60320ad6a100c6402c7279679f25fefb1fa3cc8ea5e9f8db3222f83c7516dffd616b152f501ec8ad0552ab323db5fafd23876053317b483e00df829e5c57bbca6f8ca01a87562edf1769dbd542a8f6287effc3ac6732c68c4f5573695b27b0bbca58c8e1ffa35db8f011a010fa3d98fd2183b84afcb56c2dd1d35b9a53e479b6f84565d28e49bc4bfb9790e1ddf2daa4cb7e3362fb1341cee4c6e8ef20cada36774c01d07e9efe2bf11fb495dbda4dae909198eaad8e716b93d5a0d08ed1d0afc725e08e3c5b2f8e7594b78ff6e2fbf2122b648888b812900df01c4fad5ea0688fc31cd1cff191b3a8c1ad2f2f2218be0e1777ea752dfe8b021fa1e5a0cc0fb56f74e818acf3d6ce89e299b4a84fe0fd13e0b77cc43b81d2ada8d9165fa2668095770593cc7314211a1477e6ad206577b5fa86c75442f5fb9d35cfebcdaf0c7b3e89a0d6411bd3ae1e7e4900250e2d2071b35e226800bb57b8e0af2464369bf009b91e5563911d59dfa6aa78c14389d95a537f207d5ba202e5b9c5832603766295cfa911c819684e734a41b3472dca7b14a94a1b5100529a532915d60f573fbc9bc6e42b60a47681e6740008ba6fb5571be91ff296ec6b2a0dd915b6636521e7b9f9b6ff34052ec585566453b02d5da99f8fa108ba47996e85076a4b7a70e9b5b32944db75092ec4192623ad6ea6b049a7df7d9cee60b88fedb266ecaa8c71699a17ff5664526cc2b19ee1193602a575094c29a0591340e4183a3e3f54989a5b429d656b8fe4d699f73fd6a1d29c07efe830f54d2d38e6f0255dc14cdd20868470eb266382e9c6021ecc5e09686b3f3ebaefc93c9718146b6a70a1687f358452a0e286b79c5305aa5007373e07841c7fdeae5c8e7d44ec5716f2b8b03ada37f0500c0df01c1f040200b3ffae0cf51a3cb574b225837a58dc0921bdd19113f97ca92ff69432477322f547013ae5e58137c2dadcc8b576349af3dda7a94461460fd0030eecc8c73ea4751e41e238cd993bea0e2f3280bba1183eb3314e548b384f6db9086f420d03f60a04bf2cb8129024977c795679b072bcaf89afde9a771fd9930810b38bae12dccf3f2e5512721f2e6b7124501adde69f84cd877a5847187408da17bc9f9abce94b7d8cec7aec3adb851dfa63094366c464c3d2ef1c18473215d908dd433b3724c2ba1612a14d432a65c45150940002133ae4dd71dff89e10314e5581ac77d65f11199b043556f1d7a3c76b3c11183b5924a509f28fe6ed97f1fbfa9ebabf2c1e153c6e86e34570eae96fb1860e5e0a5a3e2ab3771fe71c4e3d06fa2965dcb999e71d0f803e89d65266c8252e4cc9789c10b36ac6150eba94e2ea78a5fc3c531e0a2df4f2f74ea7361d2b3d1939260f19c279605223a708f71312b6ebadfe6eeac31f66e3bc4595a67bc883b17f37d1018cff28c332ddefbe6c5aa56558218568ab9802eecea50fdb2f953b2aef7dad5b6e2f841521b62829076170ecdd4775619f151013cca830eb61bd960334fe1eaa0363cfb5735c904c70a239d59e9e0bcbaade14eecc86bc60622ca79cab5cabb2f3846e648b1eaf19bdf0caa02369b9655abb5040685a323c2ab4b3319ee9d5c021b8f79b540b19875fa09995f7997e623d7da8f837889a97e32d7711ed935f166812810e358829c7e61fd696dedfa17858ba9957f584a51b2272639b83c3ff1ac24696cdb30aeb532e30548fd948e46dbc312858ebf2ef34c6ffeafe28ed61ee7c3c735d4a14d9e864b7e342105d14203e13e045eee2b6a3aaabeadb6c4f15facb4fd0c742f442ef6abbb5654f3b1d41cd2105d81e799e86854dc7e44b476a3d816250cf62a1f25b8d2646fc8883a0c1c7b6a37f1524c369cb749247848a0b5692b285095bbf00ad19489d1462b17423820e0058428d2a0c55f5ea1dadf43e233f70613372f0928d937e41d65fecf16c223bdb7cde3759cbee74604085f2a7ce77326ea607808419f8509ee8efd85561d99735a969a7aac50c06c25a04abfc800bcadc9e447a2ec3453484fdd567050e1e9ec9db73dbd3105588cd675fda79e3674340c5c43465713e38d83d28f89ef16dff20153e21e78fb03d4ae6e39f2bdb83adf7e93d5a68948140f7f64c261c94692934411520f77602d4f7bcf46b2ed4a20068d40824713320f46a43b7d4b7500061af1e39f62e9724454614214f74bf8b88404d95fc1d96b591af70f4ddd366a02f45bfbc09ec03bd97857fac6dd031cb850496eb27b355fd3941da2547e6abca0a9a28507825530429f40a2c86dae9b66dfb68dc1462d7486900680ec0a427a18dee4f3ffea2e887ad8cb58ce0067af4d6b6aace1e7cd3375fecce78a399406b2a4220fe9e35d9f385b9ee39d7ab3b124e8b1dc9faf74b6d185626a36631eae397b23a6efa74dd5b43326841e7f7ca7820fbfb0af54ed8feb397454056acba48952755533a3a20838d87fe6ba9b7d096954b55a867bca1159a58cca9296399e1db33a62a4a563f3125f95ef47e1c9029317cfdf8e80204272f7080bb155c05282ce395c11548e4c66d2248c1133fc70f86dc07f9c9ee41041f0f404779a45d886e17325f51ebd59bc0d1f2bcc18f41113564257b7834602a9c60dff8e8a31f636c1b0e12b4c202e1329eaf664fd1cad181156b2395e0333e92e13b240b62eebeb92285b2a20ee6ba0d99de720c8c2da2f728d012784595b794fd647d0862e7ccf5f05449a36f877d48fac39dfd27f33e8d1e0a476341992eff743a6f6eabf4f8fd37a812dc60a1ebddf8991be14cdb6e6b0dc67b55106d672c372765d43bdcd0e804f1290dc7cc00ffa3b5390f92690fed0b667b9ffbcedb7d9ca091cf0bd9155ea3bb132f88515bad247b9479bf763bd6eb37392eb3cc1159798026e297f42e312d6842ada7c66a2b3b12754ccc782ef11c6a124237b79251e706a1bbe64bfb63501a6b101811caedfa3d25bdd8e2e1c3c9444216590a121386d90cec6ed5abea2a64af674eda86a85fbebfe98864e4c3fe9dbc8057f0f7c08660787bf86003604dd1fd8346f6381fb07745ae04d736fccc83426b33f01eab71b08041873c005e5f77a057bebde8ae2455464299bf582e614e58f48ff2ddfda2f474ef388789bdc25366f9c3c8b38e74b475f25546fcd9b97aeb26618b1ddf84846a0e79915f95e2466e598e20b457708cd55591c902de4cb90bace1bb8205d011a862487574a99eb77f19b6e0a9dc09662d09a1c4324633e85a1f0209f0be8c4a99a0251d6efe101ab93d1d0ba5a4dfa186f20f2868f169dcb7da83573906fea1e2ce9b4fcd7f5250115e01a70683faa002b5c40de6d0279af88c27773f8641c3604c0661a806b5f0177a28c0f586e0006058aa30dc7d6211e69ed72338ea6353c2dd94c2c21634bbcbee5690bcb6deebfc7da1ce591d766f05e4094b7c018839720a3d7c927c2486e3725f724d9db91ac15bb4d39eb8fced54557808fca5b5d83d7cd34dad0fc41e50ef5eb161e6f8a28514d96c51133c6fd5c7e756e14ec4362abfceddc6c837d79a323492638212670efa8e406000e03a39ce37d3faf5cfabc277375ac52d1b5cb0679e4fa33742d382274099bc9bbed5118e9dbf0f7315d62d1c7ec700c47bb78c1b6b21a19045b26eb1be6a366eb45748ab2fbc946e79c6a376d26549c2c8530ff8ee468dde7dd5730a1d4cd04dc62939bbdba9ba4650ac9526e8be5ee304a1fad5f06a2d519a63ef8ce29a86ee22c089c2b843242ef6a51e03aa9cf2d0a483c061ba9be96a4d8fe51550ba645bd62826a2f9a73a3ae14ba99586ef5562e9c72fefd3f752f7da3f046f6977fa0a5980e4a91587b086019b09e6ad3b3ee593e990fd5a9e34d7972cf0b7d9022b8b5196d5ac3a017da67dd1cf3ed67c7d2d281f9f25cfadf2b89b5ad6b4725a88f54ce029ac71e019a5e647b0acfded93fa9be8d3c48d283b57ccf8d5662979132e28785f0191ed756055f7960e44e3d35e8c15056dd488f46dba03a161250564f0bdc3eb9e153c9057a297271aeca93a072a1b3f6d9b1e6321f5f59c66fb26dcf3197533d928b155fdf5035634828aba3cbb28517711c20ad9f8abcc5167ccad925f4de817513830dc8e379d58629320f991ea7a90c2fb3e7bce5121ce64774fbe32a8b6e37ec3293d4648de53696413e680a2ae0810dd6db22469852dfd09072166b39a460a6445c0dd586cdecf1c20c8ae5bbef7dd1b588d40ccd2017f6bb4e3bbdda26a7e3a59ff453e350a44bcb4cdd572eacea8fa6484bb8d6612aebf3c6f47d29be463542f5d9eaec2771bf64e6370740e0d8de75b1357f8721671af537d5d4040cb084eb4e2cc34d2466a0115af84e1b0042895983a1d06b89fb4ce6ea0486f3f3b823520ab82011a1d4b277227f8611560b1e7933fdcbb3a792b344525bda08839e151ce794b2f32c9b7a01fbac9e01cc87ebcc7d1f6cf0111c3a1e8aac71a908749d44fbd9ad0dadecbd50ada380339c32ac69136678df9317ce0b12b4ff79e59b743f5bb3af2d519ff27d9459cbf97222c15e6fc2a0f91fc719b941525fae59361ceb69cebc2a8645912baa8d1b6c1075ee3056a0c10d25065cb03a442e0ec6e0e1698db3b4c98a0be3278e9649f1f9532e0d392dfd3a0342b8971f21e1b0a74414ba3348cc5be7120c37632d8df359f8d9b992f2ee60b6f470fe3f11de54cda541edad891ce6279cfcd3e7e6f1618b166fd2c1d05848fd2c5f6fb2299f523f357a632762393a8353156cccd02acf081625a75ebb56e16369788d273ccde96629281b949d04c50901b71c65614e6c6c7bd327a140a45e1d006c3f27b9ac9aa53fd62a80f00bb25bfe235bdd2f671126905b2040222b6cbcf7ccd769c2b53113ec01640e3d338abbd602547adf0ba38209cf746ce7677afa1c52075606085cbfe4e8ae88dd87aaaf9b04cf9aa7e1948c25c02fb8a8c01c36ae4d6ebe1f990d4f869a65cdea03f09252dc208e69fb74e6132ce77e25b578fdfe33ac372e6";
358
- async function mn(n, t, o, e, l2, _ = 1) {
359
- if (e.throwIfAborted(), n.length < 4 || n.length > 56 || t.length !== 8) throw new TypeError("Invalid ODF Blowfish profile");
360
- let d = new Uint32Array(1042), f = new Uint8Array(o.length);
361
- for (let a = 0; a < d.length; a++) d[a] = Number.parseInt(wa.slice(a * 8, a * 8 + 8), 16);
362
- let i = d.subarray(0, 18), r = d.subarray(18);
363
- function E(a, c) {
364
- for (let T2 = 0; T2 < 16; T2++) {
365
- a = (a ^ i[T2]) >>> 0;
366
- let S = ((r[a >>> 24] + r[256 + (a >>> 16 & 255)] | 0) ^ r[512 + (a >>> 8 & 255)]) + r[768 + (a & 255)] >>> 0, N = (c ^ S) >>> 0;
367
- c = a, a = N;
368
- }
369
- return [(c ^ i[17]) >>> 0, (a ^ i[16]) >>> 0];
370
- }
371
- try {
372
- for (let g2 = 0, p = 0; g2 < i.length; g2++) {
373
- let L3 = 0;
374
- for (let R = 0; R < 4; R++, p++) L3 = L3 << 8 | n[p % n.length];
375
- i[g2] = i[g2] ^ L3;
376
- }
377
- let a = 0, c = 0;
378
- for (let g2 = 0; g2 < d.length; g2 += 2) e.throwIfAborted(), [a, c] = E(a, c), d[g2] = a, d[g2 + 1] = c;
379
- let T2 = new DataView(t.buffer, t.byteOffset, t.byteLength);
380
- a = T2.getUint32(0), c = T2.getUint32(4);
381
- let S = 0, N = 0;
382
- for (let g2 = 0; g2 < o.length; g2++) {
383
- e.throwIfAborted(), g2 % _ === 0 && ([S, N] = E(a, c));
384
- let p = o[g2];
385
- f[g2] = p ^ S >>> 24, S = (S << 8 | N >>> 24) >>> 0, N = N << 8 >>> 0;
386
- let L3 = l2 === "encrypt" ? f[g2] : p;
387
- a = (a << 8 | c >>> 24) >>> 0, c = (c << 8 | L3) >>> 0, (g2 & 4095) === 4095 && await new Promise((R) => setTimeout(R, 0));
388
- }
389
- return e.throwIfAborted(), f;
390
- } catch (a) {
391
- throw f.fill(0), a;
392
- } finally {
393
- d.fill(0);
394
- }
395
- }
396
- var Oi = Uint32Array.from([1116352408, 1899447441, 3049323471, 3921009573, 961987163, 1508970993, 2453635748, 2870763221, 3624381080, 310598401, 607225278, 1426881987, 1925078388, 2162078206, 2614888103, 3248222580, 3835390401, 4022224774, 264347078, 604807628, 770255983, 1249150122, 1555081692, 1996064986, 2554220882, 2821834349, 2952996808, 3210313671, 3336571891, 3584528711, 113926993, 338241895, 666307205, 773529912, 1294757372, 1396182291, 1695183700, 1986661051, 2177026350, 2456956037, 2730485921, 2820302411, 3259730800, 3345764771, 3516065817, 3600352804, 4094571909, 275423344, 430227734, 506948616, 659060556, 883997877, 958139571, 1322822218, 1537002063, 1747873779, 1955562222, 2024104815, 2227730452, 2361852424, 2428436474, 2756734187, 3204031479, 3329325298]);
397
- var Ft = new Uint32Array(64);
398
- var Xn = class extends L {
399
- A = 0;
400
- B = 0;
401
- C = 0;
402
- D = 0;
403
- E = 0;
404
- F = 0;
405
- G = 0;
406
- H = 0;
407
- constructor(t, o) {
408
- super(64, t, 8, false), this.A = o[0] | 0, this.B = o[1] | 0, this.C = o[2] | 0, this.D = o[3] | 0, this.E = o[4] | 0, this.F = o[5] | 0, this.G = o[6] | 0, this.H = o[7] | 0;
409
- }
410
- get() {
411
- let { A: t, B: o, C: e, D: l2, E: _, F: d, G: f, H: i } = this;
412
- return [t, o, e, l2, _, d, f, i];
413
- }
414
- set(t, o, e, l2, _, d, f, i) {
415
- this.A = t | 0, this.B = o | 0, this.C = e | 0, this.D = l2 | 0, this.E = _ | 0, this.F = d | 0, this.G = f | 0, this.H = i | 0;
416
- }
417
- _cloneInto(t) {
418
- return (t ||= new this.constructor()).set(...this.get()), this._cloneIntoMeta(t);
419
- }
420
- process(t, o) {
421
- for (let a = 0; a < 16; a++, o += 4) Ft[a] = t.getUint32(o, false);
422
- for (let a = 16; a < 64; a++) {
423
- let c = Ft[a - 15], T2 = Ft[a - 2], S = V(c, 7) ^ V(c, 18) ^ c >>> 3, N = V(T2, 17) ^ V(T2, 19) ^ T2 >>> 10;
424
- Ft[a] = N + Ft[a - 7] + S + Ft[a - 16] | 0;
425
- }
426
- let { A: e, B: l2, C: _, D: d, E: f, F: i, G: r, H: E } = this;
427
- for (let a = 0; a < 64; a++) {
428
- let c = V(f, 6) ^ V(f, 11) ^ V(f, 25), T2 = E + c + nt(f, i, r) + Oi[a] + Ft[a] | 0, N = (V(e, 2) ^ V(e, 13) ^ V(e, 22)) + ot(e, l2, _) | 0;
429
- E = r, r = i, i = f, f = d + T2 | 0, d = _, _ = l2, l2 = e, e = T2 + N | 0;
430
- }
431
- e = e + this.A | 0, l2 = l2 + this.B | 0, _ = _ + this.C | 0, d = d + this.D | 0, f = f + this.E | 0, i = i + this.F | 0, r = r + this.G | 0, E = E + this.H | 0, this.set(e, l2, _, d, f, i, r, E);
432
- }
433
- roundClean() {
434
- T(Ft);
435
- }
436
- destroy() {
437
- this.destroyed = true, this.set(0, 0, 0, 0, 0, 0, 0, 0), T(this.buffer);
438
- }
439
- };
440
- var vn = class extends Xn {
441
- constructor() {
442
- super(32, rt);
443
- }
444
- };
445
- var Wt = C(() => new vn(), D(1));
446
- var Dn = class {
447
- oHash;
448
- iHash;
449
- blockLen;
450
- outputLen;
451
- canXOF = false;
452
- finished = false;
453
- destroyed = false;
454
- constructor(t, o) {
455
- if (I(t), u(o, void 0, "key"), this.iHash = t.create(), typeof this.iHash.update != "function") throw new Error("expected Hash instance");
456
- this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
457
- let e = this.blockLen, l2 = new Uint8Array(e);
458
- l2.set(o.length > e ? t.create().update(o).digest() : o);
459
- for (let _ = 0; _ < l2.length; _++) l2[_] ^= 54;
460
- this.iHash.update(l2), this.oHash = t.create();
461
- for (let _ = 0; _ < l2.length; _++) l2[_] ^= 106;
462
- this.oHash.update(l2), T(l2);
463
- }
464
- update(t) {
465
- return l(this), this.iHash.update(t), this;
466
- }
467
- digestInto(t) {
468
- l(this), g(t, this), this.finished = true;
469
- let o = t.subarray(0, this.outputLen);
470
- this.iHash.digestInto(o), this.oHash.update(o), this.oHash.digestInto(o), this.destroy();
471
- }
472
- digest() {
473
- let t = new Uint8Array(this.oHash.outputLen);
474
- return this.digestInto(t), t;
475
- }
476
- _cloneInto(t) {
477
- t ||= Object.create(Object.getPrototypeOf(this), {});
478
- let { oHash: o, iHash: e, finished: l2, destroyed: _, blockLen: d, outputLen: f, canXOF: i } = this;
479
- return t = t, t.finished = l2, t.destroyed = _, t.blockLen = d, t.outputLen = f, t.canXOF = i, t.oHash = o._cloneInto(t.oHash), t.iHash = e._cloneInto(t.iHash), t;
480
- }
481
- clone() {
482
- return this._cloneInto();
483
- }
484
- destroy() {
485
- this.destroyed = true, this.oHash.destroy(), this.iHash.destroy();
486
- }
487
- };
488
- var Ca = (() => {
489
- let n = ((t, o, e) => new Dn(t, o).update(e).digest());
490
- return n.create = (t, o) => new Dn(t, o), n;
491
- })();
492
- var it = "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0";
493
- var Ia = /* @__PURE__ */ new Map([["SHA1", L2], ["http://www.w3.org/2000/09/xmldsig#sha1", L2], ["http://www.w3.org/2000/09/xmldsig#sha256", Wt], ["http://www.w3.org/2001/04/xmlenc#sha256", Wt]]);
494
- var Si = /* @__PURE__ */ new Map([["http://www.w3.org/2001/04/xmlenc#aes128-cbc", 16], ["http://www.w3.org/2001/04/xmlenc#aes192-cbc", 24], ["http://www.w3.org/2001/04/xmlenc#aes256-cbc", 32]]);
495
- function De(n) {
496
- throw new zt("io", `E Invalid OpenDocument: ${n}`);
497
- }
498
- function Ke(n = "package") {
499
- throw new zt("unsupported-feature", `Unsupported ssconvert feature: encrypted OpenDocument ${n}`);
500
- }
501
- function ke(n, t, o = it) {
502
- return n?.attributes.find((e) => e.namespace === o && e.localName === t)?.value;
503
- }
504
- function Wn(n, t, o = false) {
505
- let e = n.children.filter((l2) => l2.namespace === it && l2.localName === t);
506
- return (e.length > 1 || !o && e.length !== 1) && De("invalid encryption declaration"), e[0];
507
- }
508
- function Vt(n) {
509
- let t = n?.trim(), o = t?.startsWith("+") ? t.slice(1) : t;
510
- (!o || [...o].some((l2) => l2 < "0" || l2 > "9")) && De("invalid encryption integer");
511
- let e = Number(o);
512
- if (!Number.isSafeInteger(e)) throw new zt("resource-limit", "ssconvert OpenDocument encryption integer limit exceeded");
513
- return e;
514
- }
515
- function Vn(n, t) {
516
- n === void 0 && De("missing encryption bytes");
517
- let o = [...n].filter((l2) => !` \r
518
- `.includes(l2)).join(""), e;
519
- try {
520
- e = atob(o), btoa(e) !== o && De("invalid encryption bytes");
521
- } catch {
522
- De("invalid encryption bytes");
523
- }
524
- return t !== void 0 && e.length !== t && De("invalid encryption byte length"), Uint8Array.from(e, (l2) => l2.charCodeAt(0));
525
- }
526
- async function zn(n, t, o, e, l2) {
527
- let _ = new Uint8Array(e), d = new Uint8Array(t.length + 4), f = new DataView(d.buffer);
528
- d.set(t);
529
- let i = Ca.create(L2, n), r;
530
- try {
531
- for (let E = 1, a = 0; a < e; E++, a += 20) {
532
- f.setUint32(t.length, E), r = i.clone().update(d).digest();
533
- let c = _.subarray(a, Math.min(a + 20, e));
534
- c.set(r.subarray(0, c.length));
535
- for (let T2 = 1; T2 < o; T2++) {
536
- l2.signal.throwIfAborted();
537
- let S = i.clone().update(r).digest();
538
- r.fill(0), r = S;
539
- for (let N = 0; N < c.length; N++) c[N] = c[N] ^ r[N];
540
- (T2 & 255) === 0 && await new Promise((N) => setTimeout(N, 0));
541
- }
542
- r.fill(0), r = void 0;
543
- }
544
- return l2.signal.throwIfAborted(), _;
545
- } catch (E) {
546
- throw _.fill(0), E;
547
- } finally {
548
- i.destroy(), r?.fill(0), d.fill(0);
549
- }
550
- }
551
- async function Ma(n, t, o, e, l2, _, d) {
552
- e.password || Ke(), n.namespace !== it && Ke("manifest revision");
553
- let f = await t.has("encrypted-package");
554
- if (f) {
555
- let p = 0;
556
- for (let L3 of ["mimetype", "META-INF/manifest.xml", "encrypted-package"]) await t.has(L3) && p++;
557
- (n.children.length !== 1 || p !== t.size) && De("ambiguous encrypted package");
558
- }
559
- let i = [], r = /* @__PURE__ */ new Set(), E = 0;
560
- for (let p of n.children) {
561
- if (l2(), p.namespace !== it || p.localName !== "file-entry") continue;
562
- let L3 = ke(p, "full-path");
563
- (!L3 || r.has(L3)) && De("ambiguous manifest member"), r.add(L3);
564
- }
565
- for (let p of n.children) {
566
- l2();
567
- let L3 = p.children.filter((ye) => ye.localName === "encryption-data");
568
- if (!L3.length) continue;
569
- (L3.length !== 1 || p.namespace !== it || p.localName !== "file-entry" || L3[0].namespace !== it) && De("invalid encryption declaration");
570
- let R = ke(p, "full-path");
571
- (!R || R === "mimetype" || R === "META-INF/manifest.xml" || !await t.has(R)) && De("invalid encrypted member");
572
- let A = await t.get(R), y = L3[0], P = Wn(y, "algorithm"), w = Wn(y, "key-derivation"), s = ke(P, "algorithm-name") ?? "", m = s === "Blowfish CFB" || s === it + "#blowfish", u2 = s === "http://www.w3.org/2009/xmlenc11#aes256-gcm";
573
- (f !== u2 || u2 && R !== "encrypted-package") && Ke("encryption algorithm");
574
- let b = u2 ? "aes-gcm" : m ? "blowfish-cfb8" : "aes-cbc", O = u2 ? 32 : m ? Vt(ke(w, "key-size") ?? "16") : Si.get(s);
575
- O === void 0 && Ke("encryption algorithm"), m && (O < 4 || O > 56) && Ke("encryption key size"), (A.method !== 0 || A.size === 0 || b === "aes-cbc" && A.size % 16 || u2 && A.size < 28) && De("invalid encrypted member framing");
576
- let U = ke(w, "key-derivation-name");
577
- (u2 ? U !== "urn:org:documentfoundation:names:experimental:office:manifest:argon2id" : U !== "PBKDF2" && U !== it + "#pbkdf2") && Ke("key derivation"), Vt(ke(w, "key-size") ?? "16") !== O && De("inconsistent encryption key size");
578
- let C2 = "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", I2 = Vt(u2 ? ke(w, "argon2-iterations", C2) : ke(w, "iteration-count"));
579
- I2 || De("invalid encryption iteration count");
580
- let M = u2 ? Vt(ke(w, "argon2-memory", C2)) : 0, Y = u2 ? Vt(ke(w, "argon2-lanes", C2)) : 0, W = u2 ? 4 * Y * Math.floor(M / (4 * Y)) * 1024 : 0;
581
- if (u2 && ((!Y || Y >= 2 ** 24 || M < 8 * Y || M >= 2 ** 32 || I2 >= 2 ** 32) && De("invalid Argon2 parameters"), W >= 2 ** 32 || W > (e.limits.encryptionMemoryBytes ?? 1 / 0))) throw new zt("resource-limit", "ssconvert OpenDocument encryption memory limit exceeded");
582
- let v = Vt(ke(p, "size"));
583
- if (v > d || v > (e.limits.zipRatio ?? 1 / 0) * A.size) throw new zt("resource-limit", "ssconvert OpenDocument decrypted entry limit exceeded");
584
- if (E += v + A.size, !Number.isSafeInteger(E) || E > _) throw new zt("resource-limit", "ssconvert OpenDocument decrypted bytes limit exceeded");
585
- let ne = Wn(y, "start-key-generation", true), K = Ia.get(ke(ne, "start-key-generation-name") ?? "SHA1");
586
- K || Ke("start key algorithm"), u2 && K !== Wt && Ke("start key algorithm"), Vt(ke(ne, "key-size") ?? "20") !== K.outputLen && De("inconsistent start key size");
587
- let G = ke(y, "checksum-type") ?? "SHA1/1K", j = G === "SHA1/1K" || G === it + "#sha1-1k" ? L2 : G === it + "#sha256-1k" ? Wt : Ia.get(G);
588
- !u2 && !j && Ke("checksum algorithm"), u2 && (ke(y, "checksum") !== void 0 || ke(y, "checksum-type") !== void 0) && De("unexpected authenticated checksum");
589
- let ue = u2 ? void 0 : Vn(ke(y, "checksum"), j.outputLen), ve = Vn(ke(P, "initialisation-vector"), u2 ? 12 : m ? 8 : 16), ze = Vn(ke(w, "salt"));
590
- if ((!ze.length || u2 && ze.length < 8) && De("invalid encryption salt"), l2((u2 ? M * I2 * 1024 : I2 * Math.ceil(O / 20) * 128) + (m ? (A.size + Math.ceil(A.size / 8) + 1042) * 128 : A.size * 4) + v + ze.length * Math.ceil(O / 20)), u2) {
591
- let ye = await o(R);
592
- ve.every((Q, Ue) => ye[Ue] === Q) || De("inconsistent encrypted package IV");
593
- }
594
- i.push({ path: R, cipher: b, keyBytes: O, iterations: I2, memory: M, lanes: Y, arenaBytes: W, size: v, startHash: K, checksumHash: j, checksum: ue, iv: ve, salt: ze, prefixChecksum: G === "SHA1/1K" || G === it + "#sha1-1k" || G === it + "#sha256-1k" });
595
- }
596
- let a = /* @__PURE__ */ new Map();
597
- if (!i.length) return a;
598
- e.own(() => {
599
- for (let p of a.values()) p.fill(0);
600
- });
601
- let c = i[0].cipher, T2 = i.every((p) => p.cipher === c) ? c : "mixed", S = e.limits.inputBytes;
602
- e.signal.throwIfAborted();
603
- let N;
604
- try {
605
- N = await e.password.read(Object.freeze({ format: "odf", algorithm: T2, revision: f ? "libreoffice" : "1.2", encoding: "utf8", maxBytes: S, signal: e.signal, ...e.inputFilename === void 0 ? {} : { inputFilename: e.inputFilename } }));
606
- } catch {
607
- e.signal.throwIfAborted(), Ke("password acquisition failed");
608
- }
609
- e.signal.throwIfAborted(), N === void 0 && Ke("password required"), (typeof N == "string" ? N.length > S : !(N instanceof Uint8Array) || N.length > S) && Ke("password encoding or length"), typeof N == "string" && [...N].some((p) => {
610
- let L3 = p.codePointAt(0);
611
- return L3 >= 55296 && L3 <= 57343;
612
- }) && Ke("password encoding or length");
613
- let g2 = typeof N == "string" ? new TextEncoder().encode(N) : new Uint8Array(N);
614
- try {
615
- g2.length > S && Ke("password encoding or length");
616
- try {
617
- new TextDecoder("UTF-8", { fatal: true }).decode(g2);
618
- } catch {
619
- Ke("password encoding or length");
620
- }
621
- for (let p of i) {
622
- let L3 = p.startHash(g2), R, A;
623
- try {
624
- let [{ cbc: y, gcm: P }, { argon2idAsync: w }] = await Promise.all([import("./aes-DUEAWV73-LZOSUFMR.js"), import("./argon2-WTUGKGHD-C2NVNIFH.js")]);
625
- R = p.cipher === "aes-gcm" ? await w(L3, p.salt, { t: p.iterations, m: p.memory, p: p.lanes, dkLen: p.keyBytes, version: 19, maxmem: p.arenaBytes, asyncTick: 10 }) : await zn(L3, p.salt, p.iterations, p.keyBytes, e), e.signal.throwIfAborted();
626
- let s = await o(p.path), m = 0;
627
- if (p.cipher === "aes-gcm") try {
628
- A = P(R, p.iv).decrypt(s.subarray(12));
629
- } catch {
630
- De("encrypted content could not be verified");
631
- }
632
- else if (p.cipher === "blowfish-cfb8") A = await mn(R, p.iv, s, e.signal, "decrypt");
633
- else {
634
- A = new Uint8Array(s.length);
635
- let I2 = p.iv;
636
- for (let M = 0; M < s.length; M += 16384) {
637
- e.signal.throwIfAborted();
638
- let Y = s.subarray(M, Math.min(M + 16384, s.length)), W = y(R, I2, { disablePadding: true }).decrypt(Y);
639
- try {
640
- A.set(W, M);
641
- } finally {
642
- W.fill(0);
643
- }
644
- I2 = Y.subarray(Y.length - 16), M && await new Promise((v) => setTimeout(v, 0));
645
- }
646
- m = A[A.length - 1], (m < 1 || m > 16) && De("encrypted content could not be verified");
647
- }
648
- let u2 = A.subarray(0, A.length - m);
649
- if (p.cipher !== "aes-gcm") {
650
- let I2 = p.checksumHash(p.prefixChecksum ? u2.subarray(0, 1024) : u2), M = 0;
651
- for (let Y = 0; Y < I2.length; Y++) M |= I2[Y] ^ p.checksum[Y];
652
- if (M && p.cipher === "blowfish-cfb8") {
653
- A.fill(0), A = await mn(R, p.iv, s, e.signal, "decrypt", 8), u2 = A, I2 = p.checksumHash(p.prefixChecksum ? u2.subarray(0, 1024) : u2), M = 0;
654
- for (let Y = 0; Y < I2.length; Y++) M |= I2[Y] ^ p.checksum[Y];
655
- }
656
- M && De("encrypted content could not be verified");
657
- }
658
- let b = createCompressionCodec(), O = new b.CodecReader((async function* () {
659
- yield u2;
660
- })(), e.signal), U = new Uint8Array(p.size), C2 = 0;
661
- try {
662
- for await (let I2 of b.codec(O, { mode: "inflate-raw", chunkSize: 16384 }, e.signal)) I2.length > U.length - C2 && De("encrypted content could not be verified"), U.set(I2, C2), C2 += I2.length;
663
- (C2 !== U.length || await O.chunk() !== void 0) && De("encrypted content could not be verified");
664
- } catch (I2) {
665
- if (U.fill(0), e.signal.throwIfAborted(), I2 instanceof zt) throw I2;
666
- De("encrypted content could not be verified");
667
- } finally {
668
- await O.close(), A.fill(0);
669
- }
670
- a.set(p.path, U);
671
- } finally {
672
- L3.fill(0), R?.fill(0), A?.fill(0);
673
- }
674
- }
675
- return a;
676
- } catch (p) {
677
- for (let L3 of a.values()) L3.fill(0);
678
- throw p;
679
- } finally {
680
- g2.fill(0);
681
- }
682
- }
683
- function Da(n, t, o) {
684
- let e = /* @__PURE__ */ new Map(), l2 = [];
685
- if (!n.sheets.some((i) => i.cells.some((r) => (o(), (r.formula || r.formulaGroup) && (n.automaticLabelLookup || i.labelRanges?.some((E) => (o(), r.row >= E.labels.startRow && r.row <= E.labels.endRow && r.column >= E.labels.startColumn && r.column <= E.labels.endColumn))))))) return { book: n, documents: e };
686
- n = { ...n, sheets: n.sheets.map((i) => ({ ...i, cells: i.cells.map((r) => (o(), (r.formula || r.formulaGroup) && r.cachedResult ? { ...r, value: r.cachedResult } : r)) })) };
687
- function d(i, r) {
688
- o(i.length);
689
- let E = Ni(i, { position: r, workbook: n, signal: t.signal, onWork: o, maximumLength: t.limits.workbookTextBytes ?? t.limits.outputBytes, maximumNodes: t.limits.workbookNodes ?? 1 / 0 });
690
- if (!E.ok) return;
691
- let a = false;
692
- pi(E.document.root, (c) => {
693
- o(), c.kind === "reference" && c.label && (a = true);
694
- }), a && (e.set(JSON.stringify([r.sheet, r.row, r.column, i]), E.document), l2.push(r));
695
- }
696
- for (let i of n.sheets) for (let r of i.cells) o(), r.formula && d(r.formula, { sheet: i.id, row: r.row, column: r.column });
697
- for (let i of n.names ?? []) {
698
- o();
699
- let r = n.sheets.find((E) => E.id === (i.position?.sheet ?? i.sheet) || E.name === (i.position?.sheet ?? i.sheet)) ?? n.sheets[0];
700
- r && d(i.expression, { sheet: r.id, row: i.position?.row ?? 0, column: i.position?.column ?? 0 });
701
- }
702
- if (!l2.length) return { book: n, documents: e };
703
- let f = [];
704
- return n = { ...n, sheets: n.sheets.map((i) => ({ ...i, cells: i.cells.map((r) => {
705
- if (o(), !r.formula && !r.formulaGroup) return r;
706
- let E = i.labelRanges?.some((T2) => (o(), r.row >= T2.labels.startRow && r.row <= T2.labels.endRow && r.column >= T2.labels.startColumn && r.column <= T2.labels.endColumn));
707
- if (!l2.some((T2) => (o(), (T2.sheet !== i.id || T2.row !== r.row || T2.column !== r.column) && (E || n.automaticLabelLookup && T2.sheet === i.id)))) return r;
708
- let c = r.formulaGroup && i.formulaGroups?.some((T2) => (o(), T2.id === r.formulaGroup && T2.kind === "array"));
709
- return (n.calculationMode !== "manual" || c) && f.push({ sheet: i.id, row: r.row, column: r.column }), r;
710
- }) })) }, f.length && (n = bi(n, t, { force: false, queueVolatile: false }, void 0, { target: f, tick: o, onCycle() {
711
- if (!n.iteration?.enabled) throw new Ai("unsupported-feature", "Unsupported ssconvert feature: circular formula label in OpenDocument output");
712
- } })), { book: n, documents: e };
713
- }
714
- var Ba = { opendoc_content_dtd: `START OFFICE OO_NS_OFFICE document-content
715
- OFFICE SCRIPT OO_NS_OFFICE scripts
716
- OFFICE OFFICE_FONTS OO_NS_OFFICE font-face-decls
717
- OFFICE_FONTS FONT_FACE OO_NS_STYLE font-face
718
- OFFICE OFFICE_STYLES OO_NS_OFFICE automatic-styles
719
- OFFICE_STYLES PAGE_LAYOUT OO_NS_STYLE page-layout
720
- PAGE_LAYOUT PAGE_LAYOUT_PROPS OO_NS_STYLE page-layout-properties
721
- PAGE_LAYOUT_PROPS BACK_IMAGE OO_NS_STYLE background-image
722
- PAGE_LAYOUT HEADER_STYLE OO_NS_STYLE header-style
723
- HEADER_STYLE HEADER_PROPERTIES OO_NS_STYLE header-footer-properties
724
- HEADER_PROPERTIES HF_BACK_IMAGE OO_NS_STYLE background-image
725
- PAGE_LAYOUT FOOTER_STYLE OO_NS_STYLE footer-style
726
- FOOTER_STYLE FOOTER_PROPERTIES OO_NS_STYLE header-footer-properties
727
- FOOTER_PROPERTIES HF_BACK_IMAGE OO_NS_STYLE background-image
728
- OFFICE_STYLES STYLE OO_NS_STYLE style
729
- STYLE TABLE_CELL_PROPS OO_NS_STYLE table-cell-properties
730
- STYLE TABLE_COL_PROPS OO_NS_STYLE table-column-properties
731
- STYLE TABLE_ROW_PROPS OO_NS_STYLE table-row-properties
732
- STYLE CHART_PROPS OO_NS_STYLE chart-properties
733
- STYLE TEXT_PROPS OO_NS_STYLE text-properties
734
- STYLE TABLE_PROPS OO_NS_STYLE table-properties
735
- STYLE PARAGRAPH_PROPS OO_NS_STYLE paragraph-properties
736
- PARAGRAPH_PROPS PARA_TABS OO_NS_STYLE tab-stops
737
- STYLE GRAPHIC_PROPS OO_NS_STYLE graphic-properties
738
- STYLE STYLE_MAP OO_NS_STYLE map
739
- OFFICE_STYLES NUMBER_STYLE OO_NS_NUMBER number-style
740
- NUMBER_STYLE NUMBER_STYLE_NUMBERFILL_CHARACTER OO_NS_LOCALC_EXT fill-character
741
- NUMBER_STYLE LOEXT_TEXT OO_NS_LOCALC_EXT text
742
- NUMBER_STYLE NUMBER_STYLE_NUMBER OO_NS_NUMBER number
743
- NUMBER_STYLE_NUMBER NUMBER_EMBEDDED_TEXT OO_NS_NUMBER embedded-text
744
- NUMBER_STYLE NUMBER_STYLE_TEXT OO_NS_NUMBER text
745
- NUMBER_STYLE NUMBER_STYLE_FRACTION OO_NS_NUMBER fraction
746
- NUMBER_STYLE NUMBER_SCI_STYLE_PROP OO_NS_NUMBER scientific-number
747
- NUMBER_STYLE NUMBER_MAP OO_NS_STYLE map
748
- NUMBER_STYLE NUMBER_TEXT_PROP OO_NS_STYLE text-properties
749
- NUMBER_STYLE NUMBER_FILL_CHARACTER OO_NS_NUMBER fill-character
750
- OFFICE_STYLES DATE_STYLE OO_NS_NUMBER date-style
751
- DATE_STYLE DATE_DAY OO_NS_NUMBER day
752
- DATE_STYLE DATE_MONTH OO_NS_NUMBER month
753
- DATE_STYLE DATE_YEAR OO_NS_NUMBER year
754
- DATE_STYLE DATE_ERA OO_NS_NUMBER era
755
- DATE_STYLE DATE_DAY_OF_WEEK OO_NS_NUMBER day-of-week
756
- DATE_STYLE DATE_WEEK_OF_YEAR OO_NS_NUMBER week-of-year
757
- DATE_STYLE DATE_QUARTER OO_NS_NUMBER quarter
758
- DATE_STYLE DATE_HOURS OO_NS_NUMBER hours
759
- DATE_STYLE DATE_MINUTES OO_NS_NUMBER minutes
760
- DATE_STYLE DATE_SECONDS OO_NS_NUMBER seconds
761
- DATE_STYLE DATE_AM_PM OO_NS_NUMBER am-pm
762
- DATE_STYLE DATE_TEXT OO_NS_NUMBER text
763
- DATE_STYLE DATE_TEXT_PROP OO_NS_STYLE text-properties
764
- DATE_STYLE DATE_MAP OO_NS_STYLE map
765
- DATE_STYLE DATE_FILL_CHARACTER OO_NS_NUMBER fill-character
766
- OFFICE_STYLES TIME_STYLE OO_NS_NUMBER time-style
767
- TIME_STYLE TIME_HOURS OO_NS_NUMBER hours
768
- TIME_STYLE TIME_MINUTES OO_NS_NUMBER minutes
769
- TIME_STYLE TIME_SECONDS OO_NS_NUMBER seconds
770
- TIME_STYLE TIME_AM_PM OO_NS_NUMBER am-pm
771
- TIME_STYLE TIME_TEXT OO_NS_NUMBER text
772
- TIME_STYLE TIME_TEXT_PROP OO_NS_STYLE text-properties
773
- TIME_STYLE TIME_MAP OO_NS_STYLE map
774
- TIME_STYLE TIME_FILL_CHARACTER OO_NS_NUMBER fill-character
775
- OFFICE_STYLES STYLE_BOOL OO_NS_NUMBER boolean-style
776
- STYLE_BOOL BOOL_PROP OO_NS_NUMBER boolean
777
- OFFICE_STYLES STYLE_CURRENCY OO_NS_NUMBER currency-style
778
- STYLE_CURRENCY CURRENCY_STYLE OO_NS_NUMBER number
779
- STYLE_CURRENCY CURRENCY_STYLE_PROP OO_NS_STYLE properties
780
- STYLE_CURRENCY CURRENCY_MAP OO_NS_STYLE map
781
- STYLE_CURRENCY CURRENCY_SYMBOL OO_NS_NUMBER currency-symbol
782
- STYLE_CURRENCY CURRENCY_TEXT OO_NS_NUMBER text
783
- STYLE_CURRENCY CURRENCY_TEXT_PROP OO_NS_STYLE text-properties
784
- STYLE_CURRENCY CURRENCY_FILL_CHARACTER OO_NS_NUMBER fill-character
785
- OFFICE_STYLES STYLE_PERCENTAGE OO_NS_NUMBER percentage-style
786
- STYLE_PERCENTAGE PERCENTAGE_STYLE_PROP OO_NS_NUMBER number
787
- STYLE_PERCENTAGE PERCENTAGE_TEXT OO_NS_NUMBER text
788
- STYLE_PERCENTAGE PERCENTAGE_MAP OO_NS_STYLE map
789
- STYLE_PERCENTAGE PERCENTAGE_TEXT_PROP OO_NS_STYLE text-properties
790
- STYLE_PERCENTAGE PERCENTAGE_FILL_CHARACTER OO_NS_NUMBER fill-character
791
- OFFICE_STYLES STYLE_TEXT OO_NS_NUMBER text-style
792
- STYLE_TEXT STYLE_TEXT_CONTENT OO_NS_NUMBER text-content
793
- STYLE_TEXT STYLE_TEXT_PROP OO_NS_NUMBER text
794
- STYLE_TEXT STYLE_TEXT_MAP OO_NS_STYLE map
795
- OFFICE OFFICE_BODY OO_NS_OFFICE body
796
- OFFICE_BODY SPREADSHEET OO_NS_OFFICE spreadsheet
797
- SPREADSHEET DATA_PILOT_TABLES OO_NS_TABLE data-pilot-tables
798
- DATA_PILOT_TABLES DATA_PILOT_TABLE OO_NS_TABLE data-pilot-table
799
- DATA_PILOT_TABLE DPT_SOURCE_CELL_RANGE OO_NS_TABLE source-cell-range
800
- DATA_PILOT_TABLE DATA_PILOT_FIELD OO_NS_TABLE data-pilot-field
801
- DATA_PILOT_FIELD DATA_PILOT_LEVEL OO_NS_TABLE data-pilot-level
802
- DATA_PILOT_LEVEL DATA_PILOT_LAYOUT_INFO OO_NS_TABLE data-pilot-layout-info
803
- DATA_PILOT_LEVEL DATA_PILOT_SORT_INFO OO_NS_TABLE data-pilot-sort-info
804
- DATA_PILOT_LEVEL DATA_PILOT_DISPLAY_INFO OO_NS_TABLE data-pilot-display-info
805
- DATA_PILOT_LEVEL DATA_PILOT_MEMBERS OO_NS_TABLE data-pilot-members
806
- DATA_PILOT_MEMBERS DATA_PILOT_MEMBER OO_NS_TABLE data-pilot-member
807
- DATA_PILOT_LEVEL DATA_PILOT_SUBTOTALS OO_NS_TABLE data-pilot-subtotals
808
- DATA_PILOT_SUBTOTALS DATA_PILOT_SUBTOTAL OO_NS_TABLE data-pilot-subtotal
809
- DATA_PILOT_FIELD DATA_PILOT_GROUPS OO_NS_TABLE data-pilot-groups
810
- SPREADSHEET CONTENT_VALIDATIONS OO_NS_TABLE content-validations
811
- CONTENT_VALIDATIONS CONTENT_VALIDATION OO_NS_TABLE content-validation
812
- CONTENT_VALIDATION ERROR_MESSAGE OO_NS_TABLE error-message
813
- ERROR_MESSAGE TEXT_CONTENT OO_NS_TEXT p
814
- TEXT_CONTENT TEXT_S OO_NS_TEXT s
815
- TEXT_CONTENT TEXT_LINE_BREAK OO_NS_TEXT line-break
816
- TEXT_CONTENT TEXT_TAB OO_NS_TEXT tab
817
- TEXT_CONTENT TEXT_SPAN OO_NS_TEXT span
818
- TEXT_SPAN TEXT_SPAN OO_NS_TEXT span
819
- TEXT_SPAN TEXT_S OO_NS_TEXT s
820
- TEXT_SPAN TEXT_LINE_BREAK OO_NS_TEXT line-break
821
- TEXT_SPAN TEXT_TAB OO_NS_TEXT tab
822
- TEXT_SPAN TEXT_ADDR OO_NS_TEXT a
823
- TEXT_ADDR TEXT_S OO_NS_TEXT s
824
- TEXT_ADDR TEXT_LINE_BREAK OO_NS_TEXT line-break
825
- TEXT_ADDR TEXT_TAB OO_NS_TEXT tab
826
- TEXT_ADDR TEXT_SPAN OO_NS_TEXT span
827
- CONTENT_VALIDATION HELP_MESSAGE OO_NS_TABLE help-message
828
- HELP_MESSAGE TEXT_CONTENT OO_NS_TEXT p
829
- SPREADSHEET CALC_SETTINGS OO_NS_TABLE calculation-settings
830
- CALC_SETTINGS ITERATION OO_NS_TABLE iteration
831
- CALC_SETTINGS DATE_CONVENTION OO_NS_TABLE null-date
832
- SPREADSHEET CHART OO_NS_CHART chart
833
- OFFICE_BODY OFFICE_CHART OO_NS_OFFICE chart
834
- OFFICE_CHART CHART_CHART OO_NS_CHART chart
835
- CHART_CHART CHART_TABLE OO_NS_TABLE table
836
- CHART_TABLE CHART_TABLE_ROWS OO_NS_TABLE table-rows
837
- CHART_TABLE_ROWS CHART_TABLE_ROW OO_NS_TABLE table-row
838
- CHART_TABLE_ROW CHART_TABLE_CELL OO_NS_TABLE table-cell
839
- CHART_TABLE_CELL CHART_CELL_P OO_NS_TEXT p
840
- CHART_TABLE_CELL CHART_CELL_DRAW_G OO_NS_DRAW g
841
- CHART_CELL_DRAW_G CHART_CELL_SVG_DESC OO_NS_SVG desc
842
- CHART_TABLE CHART_TABLE_COLS OO_NS_TABLE table-columns
843
- CHART_TABLE_COLS CHART_TABLE_COL OO_NS_TABLE table-column
844
- CHART_TABLE CHART_TABLE_HROWS OO_NS_TABLE table-header-rows
845
- CHART_TABLE_HROWS CHART_TABLE_HROW OO_NS_TABLE table-header-row
846
- CHART_TABLE_HROWS CHART_TABLE_ROW OO_NS_TABLE table-row
847
- CHART_TABLE CHART_TABLE_HCOLS OO_NS_TABLE table-header-columns
848
- CHART_TABLE_HCOLS CHART_TABLE_HCOL OO_NS_TABLE table-header-column
849
- CHART_TABLE_HCOLS CHART_TABLE_COL OO_NS_TABLE table-column
850
- CHART_CHART CHART_TITLE OO_NS_CHART title
851
- CHART_TITLE TEXT_CONTENT OO_NS_TEXT p
852
- CHART_CHART CHART_SUBTITLE OO_NS_CHART subtitle
853
- CHART_SUBTITLE TEXT_CONTENT OO_NS_TEXT p
854
- CHART_CHART CHART_FOOTER OO_NS_CHART footer
855
- CHART_FOOTER TEXT_CONTENT OO_NS_TEXT p
856
- CHART_CHART CHART_LEGEND OO_NS_CHART legend
857
- CHART_LEGEND CHART_LEGEND_TITLE OO_GNUM_NS_EXT title
858
- CHART_LEGEND_TITLE TEXT_CONTENT OO_NS_TEXT p
859
- CHART_CHART CHART_COLOR_SCALE OO_GNUM_NS_EXT color-scale
860
- CHART_CHART CHART_PLOT_AREA OO_NS_CHART plot-area
861
- CHART_PLOT_AREA CHART_SERIES OO_NS_CHART series
862
- CHART_SERIES SERIES_DOMAIN OO_NS_CHART domain
863
- CHART_SERIES SERIES_DATA_PT OO_NS_CHART data-point
864
- CHART_SERIES SERIES_DATA_ERR OO_NS_CHART error-indicator
865
- CHART_SERIES SERIES_REGRESSION OO_NS_CHART regression-curve
866
- SERIES_REGRESSION SERIES_REG_EQ OO_NS_CHART equation
867
- SERIES_REGRESSION SERIES_REG_EQ_GNM OO_GNUM_NS_EXT equation
868
- CHART_SERIES SERIES_REGRESSION_MULTIPLE OO_GNUM_NS_EXT regression-curve
869
- SERIES_REGRESSION_MULTIPLE SERIES_REG_EQ OO_NS_CHART equation
870
- SERIES_REGRESSION_MULTIPLE SERIES_REG_EQ_GNM OO_GNUM_NS_EXT equation
871
- CHART_SERIES SERIES_DROPLINES OO_GNUM_NS_EXT droplines
872
- CHART_SERIES SERIES_SERIESLINES OO_GNUM_NS_EXT serieslines
873
- CHART_PLOT_AREA CHART_WALL OO_NS_CHART wall
874
- CHART_PLOT_AREA CHART_FLOOR OO_NS_CHART floor
875
- CHART_PLOT_AREA CHART_AXIS OO_NS_CHART axis
876
- CHART_PLOT_AREA GNM_CHART_AXIS OO_GNUM_NS_EXT axis
877
- CHART_AXIS CHART_AXIS_LINE OO_GNUM_NS_EXT axisline
878
- CHART_AXIS CHART_GRID OO_NS_CHART grid
879
- CHART_AXIS CHART_AXIS_CAT OO_NS_CHART categories
880
- CHART_AXIS CHART_AXIS_TITLE OO_NS_CHART title
881
- GNM_CHART_AXIS GNM_CHART_AXIS_LINE OO_GNUM_NS_EXT axisline
882
- GNM_CHART_AXIS GNM_CHART_GRID OO_NS_CHART grid
883
- GNM_CHART_AXIS GNM_CHART_AXIS_CAT OO_NS_CHART categories
884
- GNM_CHART_AXIS GNM_CHART_AXIS_TITLE OO_NS_CHART title
885
- CHART_AXIS_TITLE TEXT_CONTENT OO_NS_TEXT p
886
- CHART_PLOT_AREA CHART_OOO_COORDINATE_REGION OO_NS_CHART_OOO coordinate-region
887
- SPREADSHEET TABLE OO_NS_TABLE table
888
- TABLE SHEET_SELECTIONS OO_GNUM_NS_EXT selections
889
- SHEET_SELECTIONS SELECTION OO_GNUM_NS_EXT selection
890
- TABLE TABLE_SOURCE OO_NS_TABLE table-source
891
- TABLE TABLE_SHAPES OO_NS_TABLE shapes
892
- TABLE_SHAPES DRAW_CONTROL_SHAPES OO_NS_DRAW control
893
- TABLE_SHAPES DRAW_FRAME OO_NS_DRAW frame
894
- TABLE_SHAPES DRAW_CAPTION OO_NS_DRAW caption
895
- DRAW_CAPTION TEXT_CONTENT OO_NS_TEXT p
896
- TABLE_SHAPES DRAW_CUSTOM_SHAPE OO_NS_DRAW custom-shape
897
- DRAW_CUSTOM_SHAPE TEXT_CONTENT OO_NS_TEXT p
898
- DRAW_CUSTOM_SHAPE DRAW_ENHANCED_GEOMETRY OO_NS_DRAW enhanced-geometry
899
- DRAW_ENHANCED_GEOMETRY DRAW_ENHANCED_GEOMETRY_EQUATION OO_NS_DRAW equation
900
- DRAW_ENHANCED_GEOMETRY DRAW_ENHANCED_GEOMETRY_HANDLE OO_NS_DRAW handle
901
- TABLE_SHAPES DRAW_ELLIPSE OO_NS_DRAW ellipse
902
- DRAW_ELLIPSE TEXT_CONTENT OO_NS_TEXT p
903
- TABLE_SHAPES DRAW_LINE OO_NS_DRAW line
904
- DRAW_LINE TEXT_CONTENT OO_NS_TEXT p
905
- TABLE_SHAPES DRAW_RECT OO_NS_DRAW rect
906
- DRAW_RECT TEXT_CONTENT OO_NS_TEXT p
907
- TABLE FORMS OO_NS_OFFICE forms
908
- FORMS FORM OO_NS_FORM form
909
- FORM FORM_PROPERTIES OO_NS_FORM properties
910
- FORM_PROPERTIES FORM_PROPERTY OO_NS_FORM property
911
- FORM_PROPERTIES FORM_LIST_PROPERTY OO_NS_FORM list-property
912
- FORM FORM_BUTTON OO_NS_FORM button
913
- FORM_BUTTON FORM_PROPERTIES OO_NS_FORM properties
914
- FORM_BUTTON BUTTON_OFFICE_EVENT_LISTENERS OO_NS_OFFICE event-listeners
915
- BUTTON_OFFICE_EVENT_LISTENERS BUTTON_EVENT_LISTENER OO_NS_SCRIPT event-listener
916
- FORM FORM_VALUE_RANGE OO_NS_FORM value-range
917
- FORM_VALUE_RANGE FORM_PROPERTIES OO_NS_FORM properties
918
- FORM FORM_CHECKBOX OO_NS_FORM checkbox
919
- FORM_CHECKBOX FORM_PROPERTIES OO_NS_FORM properties
920
- FORM FORM_RADIO OO_NS_FORM radio
921
- FORM_RADIO FORM_PROPERTIES OO_NS_FORM properties
922
- FORM FORM_LISTBOX OO_NS_FORM listbox
923
- FORM_LISTBOX FORM_PROPERTIES OO_NS_FORM properties
924
- FORM FORM_COMBOBOX OO_NS_FORM combobox
925
- FORM_COMBOBOX FORM_PROPERTIES OO_NS_FORM properties
926
- FORM FORM_GENERIC OO_NS_FORM generic-control
927
- FORM_GENERIC FORM_PROPERTIES OO_NS_FORM properties
928
- TABLE TABLE_ROWS OO_NS_TABLE table-rows
929
- TABLE TABLE_H_ROWS OO_NS_TABLE table-header-rows
930
- TABLE TABLE_COL OO_NS_TABLE table-column
931
- TABLE TABLE_COLS OO_NS_TABLE table-columns
932
- TABLE TABLE_H_COLS OO_NS_TABLE table-header-columns
933
- TABLE_H_COLS TABLE_COL OO_NS_TABLE table-column
934
- TABLE_COLS TABLE_COL OO_NS_TABLE table-column
935
- TABLE TABLE_ROW OO_NS_TABLE table-row
936
- TABLE SOFTPAGEBREAK OO_NS_TEXT soft-page-break
937
- TABLE_ROWS TABLE_ROW OO_NS_TABLE table-row
938
- TABLE_H_ROWS TABLE_ROW OO_NS_TABLE table-row
939
- TABLE_ROWS SOFTPAGEBREAK OO_NS_TEXT soft-page-break
940
- TABLE_H_ROWS SOFTPAGEBREAK OO_NS_TEXT soft-page-break
941
- TABLE_ROW TABLE_CELL OO_NS_TABLE table-cell
942
- TABLE_CELL DETECTIVE OO_NS_TABLE detective
943
- DETECTIVE DETECTIVE_OPERATION OO_NS_TABLE operation
944
- TABLE_CELL DRAW_CUSTOM_SHAPE OO_NS_DRAW custom-shape
945
- TABLE_CELL CELL_TEXT OO_NS_TEXT p
946
- CELL_TEXT DRAW_CUSTOM_SHAPE OO_NS_DRAW custom-shape
947
- CELL_TEXT TEXT_S OO_NS_TEXT s
948
- CELL_TEXT TEXT_ADDR OO_NS_TEXT a
949
- CELL_TEXT TEXT_LINE_BREAK OO_NS_TEXT line-break
950
- CELL_TEXT TEXT_TAB OO_NS_TEXT tab
951
- CELL_TEXT TEXT_SPAN OO_NS_TEXT span
952
- TABLE_CELL CELL_OBJECT OO_NS_DRAW object
953
- TABLE_CELL CELL_GRAPHIC OO_NS_DRAW g
954
- CELL_GRAPHIC CELL_GRAPHIC OO_NS_DRAW g
955
- CELL_GRAPHIC DRAW_POLYLINE OO_NS_DRAW polyline
956
- CELL_GRAPHIC DRAW_CONTROL OO_NS_DRAW control
957
- TABLE_CELL DRAW_CONTROL OO_NS_DRAW control
958
- TABLE_CELL DRAW_RECT OO_NS_DRAW rect
959
- TABLE_CELL DRAW_LINE OO_NS_DRAW line
960
- TABLE_CELL DRAW_ELLIPSE OO_NS_DRAW ellipse
961
- TABLE_CELL DRAW_FRAME OO_NS_DRAW frame
962
- DRAW_FRAME DRAW_OBJECT OO_NS_DRAW object
963
- DRAW_OBJECT DRAW_OBJECT_TEXT OO_NS_TEXT p
964
- DRAW_FRAME DRAW_IMAGE OO_NS_DRAW image
965
- DRAW_IMAGE DRAW_IMAGE_TEXT OO_NS_TEXT p
966
- DRAW_FRAME SVG_DESC OO_NS_SVG desc
967
- DRAW_FRAME SVG_TITLE OO_NS_SVG title
968
- DRAW_FRAME DRAW_TEXT_BOX OO_NS_DRAW text-box
969
- DRAW_TEXT_BOX TEXT_CONTENT OO_NS_TEXT p
970
- TABLE_CELL CELL_ANNOTATION OO_NS_OFFICE annotation
971
- CELL_ANNOTATION TEXT_CONTENT OO_NS_TEXT p
972
- CELL_ANNOTATION CELL_ANNOTATION_AUTHOR OO_NS_DC creator
973
- CELL_ANNOTATION CELL_ANNOTATION_DATE OO_NS_DC date
974
- CELL_ANNOTATION CELL_ANNOTATION_DATE_STRING OO_NS_META date-string
975
- TABLE_ROW TABLE_COVERED_CELL OO_NS_TABLE covered-table-cell
976
- TABLE_COVERED_CELL COVERED_CELL_TEXT OO_NS_TEXT p
977
- COVERED_CELL_TEXT COVERED_CELL_TEXT_S OO_NS_TEXT s
978
- TABLE_COVERED_CELL DRAW_CONTROL OO_NS_DRAW control
979
- TABLE TABLE_COL_GROUP OO_NS_TABLE table-column-group
980
- TABLE_COL_GROUP TABLE_COL_GROUP OO_NS_TABLE table-column-group
981
- TABLE_COL_GROUP TABLE_H_COLS OO_NS_TABLE table-header-columns
982
- TABLE_COL_GROUP TABLE_COL OO_NS_TABLE table-column
983
- TABLE_ROW_GROUP TABLE_ROW_GROUP OO_NS_TABLE table-row-group
984
- TABLE TABLE_ROW_GROUP OO_NS_TABLE table-row-group
985
- TABLE_ROW_GROUP TABLE_ROW OO_NS_TABLE table-row
986
- TABLE NAMED_EXPRS OO_NS_TABLE named-expressions
987
- SPREADSHEET NAMED_EXPRS OO_NS_TABLE named-expressions
988
- SPREADSHEET LABEL_RANGES OO_NS_TABLE label-ranges
989
- LABEL_RANGES LABEL_RANGE OO_NS_TABLE label-range
990
- NAMED_EXPRS NAMED_EXPR OO_NS_TABLE named-expression
991
- NAMED_EXPRS NAMED_RANGE OO_NS_TABLE named-range
992
- SPREADSHEET DB_RANGES OO_NS_TABLE database-ranges
993
- DB_RANGES DB_RANGE OO_NS_TABLE database-range
994
- DB_RANGE FILTER OO_NS_TABLE filter
995
- FILTER FILTER_COND OO_NS_TABLE filter-condition
996
- FILTER FILTER_AND OO_NS_TABLE filter-and
997
- FILTER_AND FILTER_OR OO_NS_TABLE filter-or
998
- FILTER_OR FILTER_COND_IGNORE OO_NS_TABLE filter-condition
999
- FILTER_OR FILTER_AND_IGNORE OO_NS_TABLE filter-or
1000
- FILTER_AND FILTER_COND OO_NS_TABLE filter-condition
1001
- FILTER FILTER_OR OO_NS_TABLE filter-or
1002
- DB_RANGE TABLE_SORT OO_NS_TABLE sort
1003
- TABLE_SORT SORT_BY OO_NS_TABLE sort-by`, ooo1_content_dtd: `START OFFICE OO_NS_OFFICE document-content
1004
- OFFICE SCRIPT OO_NS_OFFICE script
1005
- OFFICE OFFICE_FONTS OO_NS_OFFICE font-decls
1006
- OFFICE_FONTS FONT_DECL OO_NS_STYLE font-decl
1007
- OFFICE OFFICE_STYLES OO_NS_OFFICE automatic-styles
1008
- OFFICE_STYLES PAGE_MASTER OO_NS_STYLE page-master
1009
- OFFICE_STYLES STYLE OO_NS_STYLE style
1010
- STYLE STYLE_PROP OO_NS_STYLE properties
1011
- STYLE_PROP STYLE_TAB_STOPS OO_NS_STYLE tab-stops
1012
- OFFICE_STYLES NUMBER_STYLE OO_NS_NUMBER number-style
1013
- NUMBER_STYLE NUMBER_STYLE_NUMBER OO_NS_NUMBER number
1014
- NUMBER_STYLE NUMBER_STYLE_TEXT OO_NS_NUMBER text
1015
- NUMBER_STYLE NUMBER_STYLE_FRACTION OO_NS_NUMBER fraction
1016
- NUMBER_STYLE NUMBER_SCI_STYLE_PROP OO_NS_NUMBER scientific-number
1017
- NUMBER_STYLE NUMBER_STYLE_PROP OO_NS_STYLE properties
1018
- NUMBER_STYLE NUMBER_MAP OO_NS_STYLE map
1019
- NUMBER_STYLE NUMBER_FILL_CHARACTER OO_NS_NUMBER fill-character
1020
- OFFICE_STYLES DATE_STYLE OO_NS_NUMBER date-style
1021
- DATE_STYLE DATE_DAY OO_NS_NUMBER day
1022
- DATE_STYLE DATE_MONTH OO_NS_NUMBER month
1023
- DATE_STYLE DATE_YEAR OO_NS_NUMBER year
1024
- DATE_STYLE DATE_ERA OO_NS_NUMBER era
1025
- DATE_STYLE DATE_DAY_OF_WEEK OO_NS_NUMBER day-of-week
1026
- DATE_STYLE DATE_WEEK_OF_YEAR OO_NS_NUMBER week-of-year
1027
- DATE_STYLE DATE_QUARTER OO_NS_NUMBER quarter
1028
- DATE_STYLE DATE_HOURS OO_NS_NUMBER hours
1029
- DATE_STYLE DATE_MINUTES OO_NS_NUMBER minutes
1030
- DATE_STYLE DATE_SECONDS OO_NS_NUMBER seconds
1031
- DATE_STYLE DATE_AM_PM OO_NS_NUMBER am-pm
1032
- DATE_STYLE DATE_TEXT OO_NS_NUMBER text
1033
- DATE_STYLE DATE_TEXT_PROP OO_NS_STYLE text-properties
1034
- DATE_STYLE DATE_MAP OO_NS_STYLE map
1035
- DATE_STYLE DATE_FILL_CHARACTER OO_NS_NUMBER fill-character
1036
- OFFICE_STYLES TIME_STYLE OO_NS_NUMBER time-style
1037
- TIME_STYLE TIME_HOURS OO_NS_NUMBER hours
1038
- TIME_STYLE TIME_MINUTES OO_NS_NUMBER minutes
1039
- TIME_STYLE TIME_SECONDS OO_NS_NUMBER seconds
1040
- TIME_STYLE TIME_AM_PM OO_NS_NUMBER am-pm
1041
- TIME_STYLE TIME_TEXT OO_NS_NUMBER text
1042
- TIME_STYLE TIME_TEXT_PROP OO_NS_STYLE text-properties
1043
- TIME_STYLE TIME_MAP OO_NS_STYLE map
1044
- TIME_STYLE TIME_FILL_CHARACTER OO_NS_NUMBER fill-character
1045
- OFFICE_STYLES STYLE_BOOL OO_NS_NUMBER boolean-style
1046
- STYLE_BOOL BOOL_PROP OO_NS_NUMBER boolean
1047
- OFFICE_STYLES STYLE_CURRENCY OO_NS_NUMBER currency-style
1048
- STYLE_CURRENCY CURRENCY_STYLE OO_NS_NUMBER number
1049
- STYLE_CURRENCY CURRENCY_STYLE_PROP OO_NS_STYLE properties
1050
- STYLE_CURRENCY CURRENCY_MAP OO_NS_STYLE map
1051
- STYLE_CURRENCY CURRENCY_SYMBOL OO_NS_NUMBER currency-symbol
1052
- STYLE_CURRENCY CURRENCY_TEXT OO_NS_NUMBER text
1053
- STYLE_CURRENCY CURRENCY_FILL_CHARACTER OO_NS_NUMBER fill-character
1054
- OFFICE_STYLES STYLE_PERCENTAGE OO_NS_NUMBER percentage-style
1055
- STYLE_PERCENTAGE PERCENTAGE_STYLE_PROP OO_NS_NUMBER number
1056
- STYLE_PERCENTAGE PERCENTAGE_TEXT OO_NS_NUMBER text
1057
- STYLE_PERCENTAGE PERCENTAGE_FILL_CHARACTER OO_NS_NUMBER fill-character
1058
- OFFICE_STYLES STYLE_TEXT OO_NS_NUMBER text-style
1059
- STYLE_TEXT STYLE_TEXT_CONTENT OO_NS_NUMBER text-content
1060
- STYLE_TEXT STYLE_TEXT_PROP OO_NS_NUMBER text
1061
- STYLE_TEXT STYLE_TEXT_MAP OO_NS_STYLE map
1062
- OFFICE OFFICE_BODY OO_NS_OFFICE body
1063
- OFFICE_BODY TABLE_CALC_SETTINGS OO_NS_TABLE calculation-settings
1064
- TABLE_CALC_SETTINGS DATE_CONVENTION OO_NS_TABLE null-date
1065
- TABLE_CALC_SETTINGS ITERATION OO_NS_TABLE iteration
1066
- OFFICE_BODY VALIDATIONS OO_NS_TABLE content-validations
1067
- VALIDATIONS VALIDATION OO_NS_TABLE content-validation
1068
- VALIDATION VALIDATION_MSG OO_NS_TABLE error-message
1069
- OFFICE_BODY TABLE OO_NS_TABLE table
1070
- TABLE FORMS OO_NS_OFFICE forms
1071
- TABLE TABLE_COL OO_NS_TABLE table-column
1072
- TABLE TABLE_ROW OO_NS_TABLE table-row
1073
- TABLE_ROW TABLE_CELL OO_NS_TABLE table-cell
1074
- TABLE_CELL CELL_CONTROL OO_NS_DRAW control
1075
- TABLE_CELL CELL_ANNOTATION OO_NS_OFFICE annotation
1076
- CELL_ANNOTATION ANNOTATION_TEXT OO_NS_TEXT p
1077
- CELL_ANNOTATION CELL_ANNOTATION_AUTHOR OO_NS_DC creator
1078
- CELL_ANNOTATION CELL_ANNOTATION_DATE OO_NS_DC date
1079
- CELL_ANNOTATION CELL_ANNOTATION_DATE_STRING OO_NS_META date-string
1080
- ANNOTATION_TEXT ANNOTATION_TEXT OO_NS_TEXT span
1081
- ANNOTATION_TEXT ANNOTATION_TEXT OO_NS_TEXT a
1082
- ANNOTATION_TEXT ANNOTATION_SPACE OO_NS_TEXT s
1083
- ANNOTATION_TEXT ANNOTATION_TAB OO_NS_TEXT tab
1084
- ANNOTATION_TEXT ANNOTATION_TAB OO_NS_TEXT tab-stop
1085
- ANNOTATION_TEXT ANNOTATION_BREAK OO_NS_TEXT line-break
1086
- TABLE_CELL CELL_TEXT OO_NS_TEXT p
1087
- CELL_TEXT CELL_TEXT_S OO_NS_TEXT s
1088
- CELL_TEXT CELL_TEXT_SPAN OO_NS_TEXT span
1089
- TABLE_CELL CELL_OBJECT OO_NS_DRAW object
1090
- TABLE_CELL CELL_GRAPHIC OO_NS_DRAW g
1091
- CELL_GRAPHIC CELL_GRAPHIC OO_NS_DRAW g
1092
- CELL_GRAPHIC DRAW_POLYLINE OO_NS_DRAW polyline
1093
- CELL_GRAPHIC CELL_CONTROL OO_NS_DRAW control
1094
- TABLE_CELL DRAW_LINE OO_NS_DRAW line
1095
- DRAW_LINE IGNORED_TEXT_CONTENT OO_NS_TEXT p
1096
- TABLE_ROW TABLE_COVERED_CELL OO_NS_TABLE covered-table-cell
1097
- TABLE_COVERED_CELL DRAW_LINE OO_NS_DRAW line
1098
- TABLE TABLE_COL_GROUP OO_NS_TABLE table-column-group
1099
- TABLE_COL_GROUP TABLE_COL_GROUP OO_NS_TABLE table-column-group
1100
- TABLE_COL_GROUP TABLE_COL OO_NS_TABLE table-column
1101
- TABLE TABLE_ROW_GROUP OO_NS_TABLE table-row-group
1102
- TABLE_ROW_GROUP TABLE_ROW_GROUP OO_NS_TABLE table-row-group
1103
- TABLE_ROW_GROUP TABLE_ROW OO_NS_TABLE table-row
1104
- OFFICE_BODY NAMED_EXPRS OO_NS_TABLE named-expressions
1105
- OFFICE_BODY LABEL_RANGES OO_NS_TABLE label-ranges
1106
- LABEL_RANGES LABEL_RANGE OO_NS_TABLE label-range
1107
- NAMED_EXPRS NAMED_EXPR OO_NS_TABLE named-expression
1108
- NAMED_EXPRS NAMED_RANGE OO_NS_TABLE named-range
1109
- OFFICE_BODY DB_RANGES OO_NS_TABLE database-ranges
1110
- DB_RANGES DB_RANGE OO_NS_TABLE database-range
1111
- DB_RANGE TABLE_SORT OO_NS_TABLE sort
1112
- TABLE_SORT SORT_BY OO_NS_TABLE sort-by`, styles_dtd: `START OFFICE_FONTS_OOO1 OO_NS_OFFICE font-decls
1113
- OFFICE_FONTS_OOO1 FONT_DECL_OOO1 OO_NS_STYLE font-decl
1114
- START OFFICE_DOC_STYLES OO_NS_OFFICE document-styles
1115
- OFFICE_DOC_STYLES OFFICE_FONTS_OOO1 OO_NS_OFFICE font-decls
1116
- OFFICE_DOC_STYLES OFFICE_FONTS OO_NS_OFFICE font-face-decls
1117
- OFFICE_FONTS FONT_DECL OO_NS_STYLE font-face
1118
- OFFICE_DOC_STYLES OFFICE_STYLES OO_NS_OFFICE styles
1119
- OFFICE_STYLES FILLIMAGE OO_NS_DRAW fill-image
1120
- OFFICE_STYLES DASH OO_NS_DRAW stroke-dash
1121
- OFFICE_STYLES HATCH OO_NS_DRAW hatch
1122
- OFFICE_STYLES GRADIENT OO_NS_DRAW gradient
1123
- OFFICE_STYLES MARKER OO_NS_DRAW marker
1124
- OFFICE_STYLES STYLE OO_NS_STYLE style
1125
- STYLE TABLE_CELL_PROPS OO_NS_STYLE table-cell-properties
1126
- STYLE TEXT_PROP OO_NS_STYLE text-properties
1127
- STYLE PARAGRAPH_PROPS OO_NS_STYLE paragraph-properties
1128
- PARAGRAPH_PROPS PARA_TABS OO_NS_STYLE tab-stops
1129
- STYLE STYLE_PROP OO_NS_STYLE properties
1130
- STYLE_PROP STYLE_TAB_STOPS OO_NS_STYLE tab-stops
1131
- OFFICE_STYLES DEFAULT_STYLE OO_NS_STYLE default-style
1132
- DEFAULT_STYLE DEFAULT_TABLE_CELL_PROPS OO_NS_STYLE table-cell-properties
1133
- DEFAULT_STYLE DEFAULT_TEXT_PROP OO_NS_STYLE text-properties
1134
- DEFAULT_STYLE DEFAULT_GRAPHIC_PROPS OO_NS_STYLE graphic-properties
1135
- DEFAULT_STYLE DEFAULT_PARAGRAPH_PROPS OO_NS_STYLE paragraph-properties
1136
- DEFAULT_PARAGRAPH_PROPS DEFAULT_PARA_TABS OO_NS_STYLE tab-stops
1137
- DEFAULT_STYLE DEFAULT_STYLE_PROP OO_NS_STYLE properties
1138
- DEFAULT_STYLE_PROP STYLE_TAB_STOPS OO_NS_STYLE tab-stops
1139
- DEFAULT_STYLE DEFAULT_TABLE_COL_PROPS OO_NS_STYLE table-column-properties
1140
- DEFAULT_STYLE DEFAULT_TABLE_ROW_PROPS OO_NS_STYLE table-row-properties
1141
- OFFICE_STYLES NUMBER_STYLE OO_NS_NUMBER number-style
1142
- NUMBER_STYLE NUMBER_STYLE_NUMBERFILL_CHARACTER OO_NS_LOCALC_EXT fill-character
1143
- NUMBER_STYLE LOEXT_TEXT OO_NS_LOCALC_EXT text
1144
- NUMBER_STYLE NUMBER_STYLE_NUMBER OO_NS_NUMBER number
1145
- NUMBER_STYLE_NUMBER NUMBER_EMBEDDED_TEXT OO_NS_NUMBER embedded-text
1146
- NUMBER_STYLE NUMBER_STYLE_TEXT OO_NS_NUMBER text
1147
- NUMBER_STYLE_TEXT FORMAT_TEXT_INVISIBLE OO_GNUM_NS_EXT invisible
1148
- NUMBER_STYLE_TEXT FORMAT_TEXT_REPEATED OO_GNUM_NS_EXT repeated
1149
- NUMBER_STYLE NUMBER_STYLE_FRACTION OO_NS_NUMBER fraction
1150
- NUMBER_STYLE NUMBER_SCI_STYLE_PROP OO_NS_NUMBER scientific-number
1151
- NUMBER_STYLE NUMBER_STYLE_PROP OO_NS_STYLE properties
1152
- NUMBER_STYLE NUMBER_MAP OO_NS_STYLE map
1153
- NUMBER_STYLE NUMBER_TEXT_PROP OO_NS_STYLE text-properties
1154
- NUMBER_STYLE FORMAT_TEXT_INVISIBLE OO_GNUM_NS_EXT invisible
1155
- NUMBER_STYLE NUMBER_FILL_CHARACTER OO_NS_NUMBER fill-character
1156
- OFFICE_STYLES DATE_STYLE OO_NS_NUMBER date-style
1157
- DATE_STYLE DATE_DAY OO_NS_NUMBER day
1158
- DATE_STYLE DATE_MONTH OO_NS_NUMBER month
1159
- DATE_STYLE DATE_YEAR OO_NS_NUMBER year
1160
- DATE_STYLE DATE_ERA OO_NS_NUMBER era
1161
- DATE_STYLE DATE_DAY_OF_WEEK OO_NS_NUMBER day-of-week
1162
- DATE_STYLE DATE_WEEK_OF_YEAR OO_NS_NUMBER week-of-year
1163
- DATE_STYLE DATE_QUARTER OO_NS_NUMBER quarter
1164
- DATE_STYLE DATE_HOURS OO_NS_NUMBER hours
1165
- DATE_STYLE DATE_MINUTES OO_NS_NUMBER minutes
1166
- DATE_STYLE DATE_SECONDS OO_NS_NUMBER seconds
1167
- DATE_STYLE DATE_AM_PM OO_NS_NUMBER am-pm
1168
- DATE_STYLE DATE_TEXT OO_NS_NUMBER text
1169
- DATE_STYLE DATE_TEXT_PROP OO_NS_STYLE text-properties
1170
- DATE_STYLE DATE_MAP OO_NS_STYLE map
1171
- DATE_STYLE DATE_FILL_CHARACTER OO_NS_NUMBER fill-character
1172
- OFFICE_STYLES TIME_STYLE OO_NS_NUMBER time-style
1173
- TIME_STYLE TIME_HOURS OO_NS_NUMBER hours
1174
- TIME_STYLE TIME_MINUTES OO_NS_NUMBER minutes
1175
- TIME_STYLE TIME_SECONDS OO_NS_NUMBER seconds
1176
- TIME_STYLE TIME_AM_PM OO_NS_NUMBER am-pm
1177
- TIME_STYLE TIME_TEXT OO_NS_NUMBER text
1178
- TIME_STYLE TIME_TEXT_PROP OO_NS_STYLE text-properties
1179
- TIME_STYLE TIME_MAP OO_NS_STYLE map
1180
- TIME_STYLE TIME_FILL_CHARACTER OO_NS_NUMBER fill-character
1181
- OFFICE_STYLES STYLE_BOOL OO_NS_NUMBER boolean-style
1182
- STYLE_BOOL BOOL_PROP OO_NS_NUMBER boolean
1183
- OFFICE_STYLES STYLE_CURRENCY OO_NS_NUMBER currency-style
1184
- STYLE_CURRENCY CURRENCY_STYLE OO_NS_NUMBER number
1185
- STYLE_CURRENCY CURRENCY_STYLE_PROP OO_NS_STYLE properties
1186
- STYLE_CURRENCY CURRENCY_MAP OO_NS_STYLE map
1187
- STYLE_CURRENCY CURRENCY_SYMBOL OO_NS_NUMBER currency-symbol
1188
- STYLE_CURRENCY CURRENCY_TEXT OO_NS_NUMBER text
1189
- CURRENCY_TEXT FORMAT_TEXT_INVISIBLE OO_GNUM_NS_EXT invisible
1190
- CURRENCY_TEXT FORMAT_TEXT_REPEATED OO_GNUM_NS_EXT repeated
1191
- STYLE_CURRENCY CURRENCY_TEXT_PROP OO_NS_STYLE text-properties
1192
- STYLE_CURRENCY CURRENCY_FILL_CHARACTER OO_NS_NUMBER fill-character
1193
- STYLE_CURRENCY CURRENCY_FILL_CHARACTER2 OO_NS_LOCALC_EXT fill-character
1194
- OFFICE_STYLES STYLE_PERCENTAGE OO_NS_NUMBER percentage-style
1195
- STYLE_PERCENTAGE PERCENTAGE_STYLE_PROP OO_NS_NUMBER number
1196
- STYLE_PERCENTAGE PERCENTAGE_TEXT OO_NS_NUMBER text
1197
- STYLE_PERCENTAGE PERCENTAGE_MAP OO_NS_STYLE map
1198
- STYLE_PERCENTAGE PERCENTAGE_TEXT_PROP OO_NS_STYLE text-properties
1199
- STYLE_PERCENTAGE PERCENTAGE_FILL_CHARACTER OO_NS_NUMBER fill-character
1200
- OFFICE_STYLES STYLE_TEXT OO_NS_NUMBER text-style
1201
- STYLE_TEXT STYLE_TEXT_CONTENT OO_NS_NUMBER text-content
1202
- STYLE_TEXT STYLE_TEXT_PROP OO_NS_NUMBER text
1203
- STYLE_TEXT_PROP FORMAT_TEXT_INVISIBLE OO_GNUM_NS_EXT invisible
1204
- STYLE_TEXT STYLE_TEXT_MAP OO_NS_STYLE map
1205
- STYLE_TEXT STYLE_TEXT_TEXT_PROP OO_NS_STYLE text-properties
1206
- OFFICE_DOC_STYLES AUTOMATIC_STYLES OO_NS_OFFICE automatic-styles
1207
- AUTOMATIC_STYLES PAGE_MASTER OO_NS_STYLE page-master
1208
- PAGE_MASTER PAGE_MASTER_PROPS OO_NS_STYLE properties
1209
- PAGE_MASTER_PROPS PAGE_MASTER_BG_IMAGE OO_NS_STYLE background-image
1210
- PAGE_MASTER PAGE_MASTER_HEADER OO_NS_STYLE header-style
1211
- PAGE_MASTER_HEADER PAGE_MASTER_PROPS OO_NS_STYLE properties
1212
- PAGE_MASTER PAGE_MASTER_FOOTER OO_NS_STYLE footer-style
1213
- PAGE_MASTER_FOOTER PAGE_MASTER_PROPS OO_NS_STYLE properties
1214
- AUTOMATIC_STYLES STYLE OO_NS_STYLE style
1215
- AUTOMATIC_STYLES PAGE_LAYOUT OO_NS_STYLE page-layout
1216
- PAGE_LAYOUT PAGE_LAYOUT_PROPS OO_NS_STYLE page-layout-properties
1217
- PAGE_LAYOUT_PROPS BACK_IMAGE OO_NS_STYLE background-image
1218
- PAGE_LAYOUT HEADER_STYLE OO_NS_STYLE header-style
1219
- HEADER_STYLE HEADER_PROPERTIES OO_NS_STYLE header-footer-properties
1220
- HEADER_PROPERTIES HF_BACK_IMAGE OO_NS_STYLE background-image
1221
- PAGE_LAYOUT FOOTER_STYLE OO_NS_STYLE footer-style
1222
- FOOTER_STYLE FOOTER_PROPERTIES OO_NS_STYLE header-footer-properties
1223
- FOOTER_PROPERTIES HF_BACK_IMAGE OO_NS_STYLE background-image
1224
- AUTOMATIC_STYLES NUMBER_STYLE OO_NS_NUMBER number-style
1225
- AUTOMATIC_STYLES DATE_STYLE OO_NS_NUMBER date-style
1226
- AUTOMATIC_STYLES TIME_STYLE OO_NS_NUMBER time-style
1227
- AUTOMATIC_STYLES STYLE_BOOL OO_NS_NUMBER boolean-style
1228
- AUTOMATIC_STYLES STYLE_CURRENCY OO_NS_NUMBER currency-style
1229
- AUTOMATIC_STYLES STYLE_PERCENTAGE OO_NS_NUMBER percentage-style
1230
- AUTOMATIC_STYLES STYLE_TEXT OO_NS_NUMBER text-style
1231
- OFFICE_DOC_STYLES MASTER_STYLES OO_NS_OFFICE master-styles
1232
- MASTER_STYLES MASTER_PAGE OO_NS_STYLE master-page
1233
- MASTER_PAGE MASTER_PAGE_HEADER_LEFT OO_NS_STYLE header-left
1234
- MASTER_PAGE_HEADER_LEFT MASTER_PAGE_HEADER_FOOTER_LEFT_P OO_NS_TEXT p
1235
- MASTER_PAGE_HEADER_FOOTER_LEFT_P MASTER_PAGE_HEADER_FOOTER_LEFT_SPAN OO_NS_TEXT span
1236
- MASTER_PAGE_HEADER_FOOTER_LEFT_SPAN MASTER_PAGE_HEADER_FOOTER_LEFT_PAGE_NUMBER OO_NS_TEXT page-number
1237
- MASTER_PAGE_HEADER_FOOTER_LEFT_SPAN MASTER_PAGE_HEADER_FOOTER_LEFT_SHEET_NAME OO_NS_TEXT sheet-name
1238
- MASTER_PAGE MASTER_PAGE_FOOTER_LEFT OO_NS_STYLE footer-left
1239
- MASTER_PAGE_FOOTER_LEFT MASTER_PAGE_HEADER_FOOTER_LEFT_P OO_NS_TEXT p
1240
- MASTER_PAGE MASTER_PAGE_HEADER OO_NS_STYLE header
1241
- MASTER_PAGE_HEADER MASTER_PAGE_HF_R_LEFT OO_NS_STYLE region-left
1242
- MASTER_PAGE_HF_R_LEFT MASTER_PAGE_HF_P OO_NS_TEXT p
1243
- MASTER_PAGE_HF_P TEXT_S OO_NS_TEXT s
1244
- MASTER_PAGE_HF_P TEXT_LINE_BREAK OO_NS_TEXT line-break
1245
- MASTER_PAGE_HF_P TEXT_TAB OO_NS_TEXT tab
1246
- MASTER_PAGE_HF_P HF_TITLE OO_NS_TEXT title
1247
- MASTER_PAGE_HF_P HF_DATE OO_NS_TEXT date
1248
- MASTER_PAGE_HF_P HF_TIME OO_NS_TEXT time
1249
- MASTER_PAGE_HF_P HF_SHEET_NAME OO_NS_TEXT sheet-name
1250
- MASTER_PAGE_HF_P HF_PAGE_NUMBER OO_NS_TEXT page-number
1251
- MASTER_PAGE_HF_P HF_PAGE_COUNT OO_NS_TEXT page-count
1252
- MASTER_PAGE_HF_P HF_FILE_NAME OO_NS_TEXT file-name
1253
- MASTER_PAGE_HF_P HF_EXPRESSION OO_NS_TEXT expression
1254
- MASTER_PAGE_HF_P TEXT_SPAN OO_NS_TEXT span
1255
- TEXT_SPAN TEXT_SPAN OO_NS_TEXT span
1256
- TEXT_SPAN TEXT_S OO_NS_TEXT s
1257
- TEXT_SPAN TEXT_LINE_BREAK OO_NS_TEXT line-break
1258
- TEXT_SPAN TEXT_TAB OO_NS_TEXT tab
1259
- TEXT_SPAN HF_SHEET_NAME OO_NS_TEXT sheet-name
1260
- TEXT_SPAN HF_PAGE_NUMBER OO_NS_TEXT page-number
1261
- TEXT_SPAN HF_PAGE_COUNT OO_NS_TEXT page-count
1262
- TEXT_SPAN HF_FILE_NAME OO_NS_TEXT file-name
1263
- TEXT_SPAN HF_EXPRESSION OO_NS_TEXT expression
1264
- MASTER_PAGE_HEADER MASTER_PAGE_HF_R_RIGHT OO_NS_STYLE region-right
1265
- MASTER_PAGE_HF_R_RIGHT MASTER_PAGE_HF_P OO_NS_TEXT p
1266
- MASTER_PAGE_HEADER MASTER_PAGE_HF_R_CENTER OO_NS_STYLE region-center
1267
- MASTER_PAGE_HF_R_CENTER MASTER_PAGE_HF_P OO_NS_TEXT p
1268
- MASTER_PAGE_HEADER MASTER_PAGE_HF_P OO_NS_TEXT p
1269
- MASTER_PAGE MASTER_PAGE_FOOTER OO_NS_STYLE footer
1270
- MASTER_PAGE_FOOTER MASTER_PAGE_HF_R_LEFT OO_NS_STYLE region-left
1271
- MASTER_PAGE_FOOTER MASTER_PAGE_HF_R_RIGHT OO_NS_STYLE region-right
1272
- MASTER_PAGE_FOOTER MASTER_PAGE_HF_R_CENTER OO_NS_STYLE region-center
1273
- MASTER_PAGE_FOOTER MASTER_PAGE_HF_P OO_NS_TEXT p` };
1274
- function Bn(n, t) {
1275
- if (n === void 0) return;
1276
- t(n.length);
1277
- let o = "";
1278
- for (let e of n.trim()) {
1279
- if (` \r
1280
- `.includes(e)) break;
1281
- o += e;
1282
- }
1283
- if (o === "sub") return -1;
1284
- if (o === "super") return 1;
1285
- if (o.length > 1 && o.endsWith("%") && Number(o.slice(0, -1)) === 0) return 0;
1286
- }
1287
- var An = { text: [Sn.text, "http://openoffice.org/2000/text"], style: [Sn.style, "http://openoffice.org/2000/style"], fo: [Sn.fo, "http://www.w3.org/1999/XSL/Format"], svg: [Sn.svg, "http://www.w3.org/2000/svg"], gnm: [Sn.gnm] };
1288
- function Ge(n, t, o) {
1289
- return n.attributes.find((e) => e.localName === t && An[o].includes(e.namespace))?.value;
1290
- }
1291
- function hi(n) {
1292
- if (!n) return;
1293
- let o = { pt: 1, pc: 12, in: 72, cm: 72 / 2.54, mm: 72 / 25.4 }[n.slice(-2)], e = Number(n.slice(0, -2));
1294
- return o && Number.isFinite(e) && e >= 0 ? e * o : void 0;
1295
- }
1296
- function Fn(n, t) {
1297
- let o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map();
1298
- for (let f of n) for (let i of f.children) for (let r of i.children) {
1299
- if (t(), !An.style.includes(r.namespace)) continue;
1300
- let E = Ge(r, "name", "style");
1301
- if (E && (["styles", "automatic-styles"].includes(i.localName) && r.localName === "style" && o.set(Ge(r, "family", "style") + ":" + E, r), ["font-face-decls", "font-decls"].includes(i.localName))) {
1302
- let a = Ge(r, "font-family", "svg") ?? Ge(r, "font-family", "fo");
1303
- a !== void 0 && e.set(E, a.length >= 2 && ["'", '"'].includes(a[0]) && a.at(-1) === a[0] ? a.slice(1, -1) : a);
1304
- }
1305
- }
1306
- let l2 = /* @__PURE__ */ new Map(), _ = /* @__PURE__ */ new Set();
1307
- function d(f, i) {
1308
- if (!f) return {};
1309
- t();
1310
- let r = i + ":" + f, E = l2.get(r);
1311
- if (E) return E;
1312
- let a = o.get(r);
1313
- if (!a) return {};
1314
- if (_.has(r)) throw new Fa("io", "E Invalid OpenDocument: cyclic text style inheritance");
1315
- _.add(r);
1316
- try {
1317
- let c = { ...d(Ge(a, "parent-style-name", "style"), i) };
1318
- for (let T2 of a.children) {
1319
- if (t(), !An.style.includes(T2.namespace) || !["text-properties", "properties"].includes(T2.localName)) continue;
1320
- let S = Ge(T2, "font-name", "style"), N = Ge(T2, "font-family", "fo") ?? (S ? e.get(S) ?? S : void 0);
1321
- N !== void 0 && (c.family = N);
1322
- let g2 = hi(Ge(T2, "font-size", "fo"));
1323
- g2 !== void 0 && (c.size = Math.round(g2 * 1024));
1324
- let p = Ge(T2, "font-weight", "fo");
1325
- if (p !== void 0) {
1326
- let s = p === "normal" ? 400 : p === "bold" ? 700 : Number(p);
1327
- Number.isInteger(s) && s >= 100 && s <= 900 && (c.bold = (s - 400) / 300);
1328
- }
1329
- let L3 = Ge(T2, "font-style", "fo");
1330
- L3 !== void 0 && (c.italic = ["italic", "oblique"].includes(L3) ? 1 : 0);
1331
- let R = Ge(T2, "text-line-through-style", "style");
1332
- R !== void 0 && (c.strikethrough = R === "none" ? 0 : 1);
1333
- let A = Bn(Ge(T2, "text-position", "style"), t);
1334
- A !== void 0 && (c.subscript = A === -1 ? 1 : 0, c.superscript = A === 1 ? 1 : 0);
1335
- let y = Ge(T2, "text-underline-style", "style"), P = Ge(T2, "text-underline-type", "style");
1336
- if (y !== void 0 || P === "none") {
1337
- let s = P === "double" || Ge(T2, "text-underline-width", "style") === "bold", m = Ge(T2, "text-underline-placement", "gnm") === "low";
1338
- c.underline = y === "none" || P === "none" ? "none" : m ? s ? "doubleAccounting" : "low" : s ? "double" : "single";
1339
- }
1340
- let w = Ge(T2, "color", "fo");
1341
- w?.length === 7 && w[0] === "#" && [...w.slice(1)].every((s) => "0123456789abcdefABCDEF".includes(s)) && (c.color = [w.slice(1, 3), w.slice(3, 5), w.slice(5)].map((s) => s.toUpperCase()).join("x"));
1342
- }
1343
- return l2.set(r, c), c;
1344
- } finally {
1345
- _.delete(r);
1346
- }
1347
- }
1348
- return (f) => {
1349
- let i = "", r = 0, E = [];
1350
- function a(S, N) {
1351
- t(S.length);
1352
- let g2 = r;
1353
- r += new TextEncoder().encode(S).length, i += S;
1354
- let p = Object.keys(N);
1355
- if (t(p.length), r === g2 || !p.length) return;
1356
- let L3 = E.at(-1);
1357
- L3?.end === g2 && Object.keys(L3.attributes).length === p.length && p.every((R) => L3.attributes[R] === N[R]) ? E[E.length - 1] = { ...L3, end: r } : E.push({ start: g2, end: r, attributes: N });
1358
- }
1359
- function c(S, N) {
1360
- t();
1361
- let g2 = { ...N, ...d(Ge(S, "style-name", "text"), S.localName === "p" ? "paragraph" : "text") };
1362
- for (let p of S.content) if (t(), p.kind === "text" || p.kind === "cdata") a(p.text, g2);
1363
- else if (p.kind === "element" && An.text.includes(p.namespace)) {
1364
- if (["span", "a"].includes(p.localName)) c(p, g2);
1365
- else if (["tab", "tab-stop", "line-break"].includes(p.localName)) a(p.localName === "line-break" ? `
1366
- ` : " ", g2);
1367
- else if (p.localName === "s") {
1368
- let L3 = Number(Ge(p, "c", "text") ?? "1");
1369
- if (!Number.isSafeInteger(L3) || L3 < 0) throw new Fa("io", "E Invalid OpenDocument: invalid text space count");
1370
- t(L3), a(" ".repeat(L3), g2);
1371
- }
1372
- }
1373
- }
1374
- let T2 = true;
1375
- for (let S of f.children) An.text.includes(S.namespace) && S.localName === "p" && (T2 || a(`
1376
- `, {}), T2 = false, c(S, {}));
1377
- return { value: i, ...E.length ? { richText: E } : {} };
1378
- };
1379
- }
1380
- async function $n(n, t, o, e, l2, _, d = true) {
1381
- let f = "";
1382
- for (let { text: i, attributes: r } of Ri(n, t, o.charge)) {
1383
- let E = {};
1384
- if (typeof r.family == "string" && (E["style:font-name"] = await e.register("fonts", "style:font-face", "rtfont", { "svg:font-family": r.family })), typeof r.size == "number" && Number.isFinite(r.size) && r.size >= 0 && (E["fo:font-size"] = r.size / 1024 + "pt"), r.bold !== void 0) {
1385
- let c = Number(r.bold), T2 = c * 300 + 400, S = Math.round(T2), N = c === (S - 400) / 300 ? S : Math.trunc(T2);
1386
- E["fo:font-weight"] = N === 400 ? "normal" : N === 700 ? "bold" : N >= 100 && N <= 900 ? String(N) : Number(r.bold) ? "bold" : "normal";
1387
- }
1388
- if (r.italic !== void 0 && (E["fo:font-style"] = Number(r.italic) ? "italic" : "normal"), r.strikethrough !== void 0 && (E["style:text-line-through-style"] = Number(r.strikethrough) ? "solid" : "none"), (r.subscript !== void 0 || r.superscript !== void 0) && (E["style:text-position"] = Number(r.subscript) ? "sub 83%" : Number(r.superscript) ? "super 83%" : "0% 100%"), typeof r.color == "string" && (E["fo:color"] = "#" + r.color.split("x").join("")), typeof r.underline == "string") {
1389
- let c = ["low", "singleAccounting", "doubleAccounting"].includes(r.underline), T2 = ["double", "double-line", "doubleAccounting"].includes(r.underline), S = c || T2 || ["single", "single-line", "error", "error-line"].includes(r.underline);
1390
- E["style:text-underline-style"] = S ? "solid" : "none", E["style:text-underline-type"] = S ? T2 ? "double" : "single" : "none", E["style:text-underline-width"] = "auto", E["style:text-underline-color"] = "font-color", E["style:text-underline-mode"] = "continuous", l2 && c && (E["gnm:text-underline-placement"] = "low");
1391
- }
1392
- let a = _ ? o.element("text:a", _, o.escape(i)) : o.text(i, d);
1393
- if (!Object.keys(E).length) f += a;
1394
- else {
1395
- let c = await e.register("contentAutomatic", "style:style", "rt", { "style:family": "text" }, o.element("style:text-properties", E));
1396
- f += o.element("text:span", { "text:style-name": c }, a);
1397
- }
1398
- }
1399
- return f;
1400
- }
1401
- var Nn = "urn:oasis:names:tc:opendocument:xmlns:";
1402
- var _t = { table: [Nn + "table:1.0", "http://openoffice.org/2000/table"], office: [Nn + "office:1.0", "http://openoffice.org/2000/office"], text: [Nn + "text:1.0", "http://openoffice.org/2000/text"], style: [Nn + "style:1.0", "http://openoffice.org/2000/style"], fo: [Nn + "xsl-fo-compatible:1.0", "http://www.w3.org/1999/XSL/Format"], dc: ["http://purl.org/dc/elements/1.1/"], xlink: ["http://www.w3.org/1999/xlink"], gnm: ["http://www.gnumeric.org/odf-extension/1.0"] };
1403
- function $(n, t, o) {
1404
- return n?.attributes.find((e) => e.localName === t && _t[o].includes(e.namespace))?.value;
1405
- }
1406
- function Xe(n, t = {}, o = [], e = "") {
1407
- return { name: n, namespace: "http://www.gnumeric.org/v10.dtd", attributes: Object.entries(t).map(([l2, _]) => ({ name: l2, namespace: "", value: String(_) })), children: o, text: e };
1408
- }
1409
- function pt(n) {
1410
- return n !== null && typeof n == "object" && !Array.isArray(n) ? n : void 0;
1411
- }
1412
- function Pa(n) {
1413
- let t = pt(n)?.attributes;
1414
- return Object.fromEntries(Array.isArray(t) ? t.flatMap((o) => {
1415
- let e = pt(o);
1416
- return typeof e?.name == "string" && typeof e.value == "string" ? [[e.name, e.value]] : [];
1417
- }) : []);
1418
- }
1419
- function pn(n) {
1420
- if (!(!n?.startsWith("#") || n.length !== 7 || [...n.slice(1)].some((t) => !"0123456789abcdefABCDEF".includes(t)))) return [1, 3, 5].map((t) => (parseInt(n.slice(t, t + 2), 16) * 257).toString(16).toUpperCase()).join(":");
1421
- }
1422
- function Kn(n) {
1423
- if (!n) return;
1424
- let o = { cm: 72 / 2.54, mm: 72 / 25.4, in: 72, pt: 1, pc: 12 }[n.slice(-2)], e = Number(n.slice(0, -2));
1425
- return o && Number.isFinite(e) && e >= 0 ? e * o : void 0;
1426
- }
1427
- function qn(n, t) {
1428
- let o = n.children.find((_) => _.localName === "creator" && _t.dc.includes(_.namespace))?.text ?? $(n, "author", "office"), e = t(n), l2 = e.richText?.every((_) => typeof _.attributes.family != "string" || !_.attributes.family.includes(":"));
1429
- return { ...o === void 0 ? {} : { Author: o }, Text: e.value, ...e.richText?.length && l2 ? { TextFormat: wi(e.richText) } : {} };
1430
- }
1431
- function Jn(n, t, o) {
1432
- let e = Pa(t), l2 = pt(t)?.children, _ = Array.isArray(l2) ? l2.find((a) => pt(a)?.name === "Font") : void 0, d = Pa(_), f = pt(_)?.text ?? "Sans", i = Array.isArray(l2) ? pt(l2.find((a) => pt(a)?.name === "StyleBorder"))?.children : void 0, r = /* @__PURE__ */ new Map();
1433
- if (Array.isArray(i)) for (let a of i) {
1434
- let c = pt(a)?.name;
1435
- typeof c == "string" && r.set(c, a);
1436
- }
1437
- for (let a of n.children) {
1438
- if (o(), !_t.style.includes(a.namespace) || !a.localName.endsWith("properties")) continue;
1439
- let c = pn($(a, "background-color", "fo"));
1440
- c && (e.Back = c, e.Shade = 1);
1441
- let T2 = pn($(a, "background-colour", "gnm"));
1442
- T2 && (e.Back = T2);
1443
- let S = pn($(a, "pattern-colour", "gnm"));
1444
- S && (e.PatternColor = S);
1445
- let N = $(a, "pattern", "gnm");
1446
- N !== void 0 && Number.isInteger(Number(N)) && Number(N) > 0 && (e.Shade = Number(N));
1447
- let g2 = $(a, "wrap-option", "fo");
1448
- g2 !== void 0 && (e.WrapText = g2 === "wrap" ? 1 : 0);
1449
- let p = $(a, "cell-protect", "style");
1450
- p !== void 0 && (e.Locked = p.includes("protected") && p !== "unprotected" ? 1 : 0, p.includes("formula-hidden") && (e.Hidden = 1));
1451
- let L3 = pn($(a, "color", "fo"));
1452
- L3 && (e.Fore = L3);
1453
- let R = $(a, "text-align", "fo"), A = { start: "LEFT", end: "RIGHT", left: "LEFT", right: "RIGHT", center: "CENTER", justify: "JUSTIFY" };
1454
- R && A[R] && (e.HAlign = "GNM_HALIGN_" + A[R]);
1455
- let y = $(a, "vertical-align", "style"), P = { top: "TOP", middle: "CENTER", bottom: "BOTTOM", justify: "JUSTIFY" };
1456
- y && P[y] && (e.VAlign = "GNM_VALIGN_" + P[y]);
1457
- let w = $(a, "rotation-angle", "style");
1458
- w !== void 0 && Number.isFinite(Number(w)) && (e.Rotation = Number(w));
1459
- let s = $(a, "shrink-to-fit", "style");
1460
- s !== void 0 && (e.ShrinkToFit = s === "true" ? 1 : 0);
1461
- let m = Kn($(a, "font-size", "fo"));
1462
- m !== void 0 && (d.Unit = m);
1463
- let u2 = $(a, "font-weight", "fo");
1464
- u2 !== void 0 && (d.Bold = u2 === "bold" || Number(u2) >= 600 ? 1 : 0);
1465
- let b = $(a, "font-style", "fo");
1466
- b !== void 0 && (d.Italic = b === "italic" || b === "oblique" ? 1 : 0);
1467
- let O = $(a, "text-underline-style", "style");
1468
- if (O !== void 0) {
1469
- let I2 = $(a, "text-underline-type", "style"), M = I2 === "double" || $(a, "text-underline-width", "style") === "bold";
1470
- d.Underline = O === "none" || I2 === "none" ? 0 : (M ? 2 : 1) + ($(a, "text-underline-placement", "gnm") === "low" ? 2 : 0);
1471
- }
1472
- let U = $(a, "text-line-through-style", "style");
1473
- U !== void 0 && (d.StrikeThrough = U === "none" ? 0 : 1);
1474
- let C2 = Bn($(a, "text-position", "style"), o);
1475
- C2 !== void 0 && (d.Script = C2), f = $(a, "font-family", "fo") ?? $(a, "font-name", "style") ?? f;
1476
- for (let [I2, M] of [["top", "Top"], ["bottom", "Bottom"], ["left", "Left"], ["right", "Right"]]) {
1477
- let Y = $(a, "border-" + I2, "fo") ?? $(a, "border", "fo");
1478
- if (!Y) continue;
1479
- let W = Y.split(" ").filter(Boolean), v = Y === "none" ? "none" : W[1], ne = Kn(W[0]), K = pn(W[2]), G = v === "none" ? 0 : v === "double" ? 6 : v === "dashed" ? 4 : v === "dotted" ? 7 : ne !== void 0 ? ne > 2.5 ? 5 : ne > 1 ? 2 : 1 : void 0;
1480
- G !== void 0 && r.set(M, Xe(M, { Style: G, Color: K ?? "0:0:0" }));
1481
- }
1482
- }
1483
- let E = Array.isArray(l2) ? l2.filter((a) => !["Font", "StyleBorder"].includes(String(pt(a)?.name))) : [];
1484
- return Xe("Style", e, [Xe("Font", d, [], String(f)), ...E, ...r.size ? [Xe("StyleBorder", {}, [...r.values()])] : []]);
1485
- }
1486
- async function xa(n, t, o = [], e = [], l2 = Fn(o, t), _ = (d) => d.children) {
1487
- let d = [], f = [], i = [], r = 0, E = 0, a = (A, y) => Number($(A, y, "table") ?? "1");
1488
- async function c(A) {
1489
- for await (let P of _(A)) if (t(), !!_t.table.includes(P.namespace)) {
1490
- if (["table-row-group", "table-rows", "table-header-rows"].includes(P.localName)) {
1491
- let w = r;
1492
- await c(P), P.localName === "table-header-rows" && r > w && i.push(Xe("repeat_top", { value: `$${w + 1}:$${r}` }));
1493
- continue;
1494
- }
1495
- if (P.localName === "table-row") {
1496
- E = 0;
1497
- for await (let w of _(P)) {
1498
- let m = function(u2) {
1499
- for (let b of u2.children) if (t(), !!_t.text.includes(b.namespace)) {
1500
- if (b.localName === "a") {
1501
- let O = $(b, "href", "xlink");
1502
- if (!O) continue;
1503
- let U = O.startsWith("http") ? "GnmHLinkURL" : O.startsWith("mail") ? "GnmHLinkEMail" : O.startsWith("file") ? "GnmHLinkExternal" : "GnmHLinkCurWB", C2 = U === "GnmHLinkCurWB" ? gi(O, "import", t, e) : O;
1504
- f.push(Xe("StyleRegion", { startRow: r, endRow: r, startCol: E, endCol: E }, [Xe("Style", { Fore: "0:0:FFFF" }, [Xe("Font", { Underline: 1 }), Xe("HyperLink", { type: U, target: C2, ...$(b, "title", "office") ? { tip: $(b, "title", "office") } : {} })])]));
1505
- }
1506
- m(b);
1507
- }
1508
- };
1509
- var y = m;
1510
- if (t(), !_t.table.includes(w.namespace) || !["table-cell", "covered-table-cell"].includes(w.localName)) continue;
1511
- let s = jn(r, E);
1512
- for (let u2 of w.children.filter((b) => b.localName === "annotation" && _t.office.includes(b.namespace))) d.push(Xe("CellComment", { ObjectBound: s, ObjectOffset: "1 0 1 0", Direction: 17, Print: 1, ...qn(u2, l2) }));
1513
- m(w), E += a(w, "number-columns-repeated");
1514
- }
1515
- r += a(P, "number-rows-repeated");
1516
- }
1517
- }
1518
- }
1519
- await c(n);
1520
- let T2 = $(n, "style-name", "table"), N = o.flatMap((A) => A.children).flatMap((A) => A.children).filter((A) => _t.style.includes(A.namespace)), g2 = N.find((A) => A.localName === "style" && $(A, "name", "style") === T2), p = N.find((A) => A.localName === "master-page" && $(A, "name", "style") === $(g2, "master-page-name", "style")), L3 = N.find((A) => ["page-layout", "page-master"].includes(A.localName) && $(A, "name", "style") === $(p, "page-layout-name", "style"));
1521
- for (let A of L3?.children ?? []) {
1522
- t();
1523
- let y = $(A, "print-orientation", "style");
1524
- (y === "portrait" || y === "landscape") && i.push(Xe("orientation", {}, [], y));
1525
- let P = {};
1526
- for (let b of ["top", "bottom", "left", "right"]) {
1527
- let O = Kn($(A, "margin-" + b, "fo") ?? $(A, "margin", "fo"));
1528
- O !== void 0 && (P[b] = O);
1529
- }
1530
- Object.keys(P).length && i.push(Xe("Margins", {}, Object.entries(P).map(([b, O]) => Xe(b, { Points: O, PrefUnit: "cm" }))));
1531
- let w = $(A, "scale-to-pages", "style"), s = $(A, "scale-to-X", "style") ?? $(A, "scale-to-X", "gnm") ?? w, m = $(A, "scale-to-Y", "style") ?? $(A, "scale-to-Y", "gnm") ?? w, u2 = $(A, "scale-to", "style");
1532
- s || m ? i.push(Xe("Scale", { type: "fit", cols: s ?? "0", rows: m ?? "0" })) : u2?.endsWith("%") && i.push(Xe("Scale", { type: "percentage", percentage: u2.slice(0, -1) }));
1533
- }
1534
- let R = [];
1535
- for (let [A, y] of [["Objects", d], ["Styles", f], ["PrintInformation", i]]) y.length && R.push({ source: "Gnumeric_XmlIO:sax", kind: A, disposition: "retained", data: Xe(A, {}, y) });
1536
- return R;
1537
- }
1538
- function Ua(n, t, o) {
1539
- let e = [];
1540
- for (let _ of n.children.filter((d) => d.localName === "database-ranges" && _t.table.includes(d.namespace))) for (let d of _.children) {
1541
- let T2 = function(S) {
1542
- for (let N of S.children) if (o(), !!_t.table.includes(N.namespace)) if (N.localName === "filter-condition") {
1543
- let p = { "=": "eq", "!=": "ne", "<": "lt", ">": "gt", "<=": "lte", ">=": "gte" }[$(N, "operator", "table") ?? "="], L3 = $(N, "value", "table") ?? "";
1544
- p && c.push(Xe("Field", { Index: $(N, "field-number", "table") ?? "0", Type: "expr", Op0: p, Value0: $(N, "data-type", "table") === "number" ? 40 : 60, ValueType0: L3 }));
1545
- } else ["filter", "filter-and"].includes(N.localName) && T2(N);
1546
- };
1547
- var l2 = T2;
1548
- o();
1549
- let f = $(d, "target-range-address", "table");
1550
- if (!f) continue;
1551
- o(f.length);
1552
- let i = Li("=[" + f + "]", { grammar: yi, position: { sheet: t, row: 0, column: 0 } });
1553
- if (!i.ok || i.document.root.kind !== "reference") continue;
1554
- let r = i.document.root, E = r.first, a = r.last ?? E;
1555
- if (E.workbook || a.workbook || (E.sheet ?? t) !== t || (a.sheet ?? E.sheet ?? t) !== t || !E.row || !E.column || !a.row || !a.column) continue;
1556
- let c = [];
1557
- T2(d), (c.length || $(d, "display-filter-buttons", "table") === "true") && e.push(Xe("Filter", { Area: jn(E.row.value, E.column.value) + ":" + jn(a.row.value, a.column.value) }, c));
1558
- }
1559
- return e.length ? [{ source: "Gnumeric_XmlIO:sax", kind: "Filters", disposition: "retained", data: Xe("Filters", {}, e) }] : [];
1560
- }
1561
- var Zn = ["urn:oasis:names:tc:opendocument:xmlns:table:1.0", "http://openoffice.org/2000/table"];
1562
- function Ha(n, t, o, e) {
1563
- let l2 = new Map(t.map((a) => (e(1 + a.name.length), [Qn(a.name), a]))), _ = /* @__PURE__ */ new Map(), d = new Map(t.map((a) => (e(), [a.id, { ...a.size ?? Ii }])));
1564
- function f(a, c) {
1565
- let T2 = d.get(a.id);
1566
- for (; T2.rows <= c.endRow; ) e(), T2.rows *= 2;
1567
- for (; T2.columns <= c.endColumn; ) e(), T2.columns *= 2;
1568
- }
1569
- function i() {
1570
- throw new Ci("io", "E Invalid OpenDocument: invalid label range");
1571
- }
1572
- function r(a, c) {
1573
- return a.attributes.find((T2) => T2.localName === c && Zn.includes(T2.namespace))?.value;
1574
- }
1575
- function E(a) {
1576
- if (!a) return i();
1577
- e(a.length);
1578
- let c = Mi("=[" + a + "]", { maximumDepth: o.limits.formulaDepth, grammar: Di, position: { sheet: t[0]?.id ?? "", row: 0, column: 0 }, signal: o.signal, maximumLength: o.limits.workbookTextBytes ?? o.limits.inputBytes, maximumNodes: o.limits.workbookNodes ?? 1 / 0 });
1579
- if (!c.ok || c.document.root.kind !== "reference") return i();
1580
- let T2 = c.document.root.first, S = c.document.root.last ?? T2, N = T2.sheet === void 0 ? void 0 : l2.get(Qn(T2.sheet)), g2 = S.sheet === void 0 ? N : l2.get(Qn(S.sheet));
1581
- if (!N || T2.workbook !== void 0 || S.workbook !== void 0 || g2 !== N || !T2.row || !T2.column || !S.row || !S.column) return i();
1582
- let p = { startRow: T2.row.value, endRow: S.row.value, startColumn: T2.column.value, endColumn: S.column.value };
1583
- return Object.values(p).some((L3) => !Number.isSafeInteger(L3) || L3 < 0) || p.startRow > p.endRow || p.startColumn > p.endColumn || p.endRow >= Ya.rows || p.endColumn >= Ya.columns ? i() : { sheet: N, range: p };
1584
- }
1585
- for (let a of n.children) if (e(), !(a.localName !== "label-ranges" || !Zn.includes(a.namespace))) for (let c of a.children) {
1586
- if (e(), c.localName !== "label-range" || !Zn.includes(c.namespace)) continue;
1587
- let T2 = r(c, "orientation");
1588
- T2 !== "row" && T2 !== "column" && i();
1589
- let S = E(r(c, "label-cell-range-address")), N = E(r(c, "data-cell-range-address"));
1590
- f(S.sheet, S.range), f(N.sheet, N.range);
1591
- let g2 = _.get(S.sheet.id);
1592
- g2 || (g2 = [], _.set(S.sheet.id, g2)), g2.push({ axis: T2, labels: S.range, data: N.range, ...N.sheet !== S.sheet ? { dataSheet: N.sheet.id } : {} });
1593
- }
1594
- return t.map((a) => {
1595
- e();
1596
- let c = _.get(a.id);
1597
- return { ...a, size: d.get(a.id), ...c ? { labelRanges: c } : {} };
1598
- });
1599
- }
1600
- var ea = 1024;
1601
- var Pt = { t: 3, m: 65536, p: 4, dkLen: 32, version: 19, maxmem: 64 * 1024 * 1024, asyncTick: 10 };
1602
- var ka = /* @__PURE__ */ new Map([["odf12-aes128-cbc", { cipher: "aes-cbc", keyBytes: 16 }], ["odf12-aes192-cbc", { cipher: "aes-cbc", keyBytes: 24 }], ["odf12-aes256-cbc", { cipher: "aes-cbc", keyBytes: 32 }], ["odf12-blowfish-cfb8", { cipher: "blowfish-cfb8", keyBytes: 16 }], ["odf12-blowfish-cfb64", { cipher: "blowfish-cfb64", keyBytes: 16 }], ["libreoffice-aes256-gcm", { cipher: "aes-gcm", keyBytes: 32 }]]);
1603
- function xt(n) {
1604
- throw new aa("unsupported-feature", `Unsupported ssconvert feature: encrypted OpenDocument ${n}`);
1605
- }
1606
- function ta() {
1607
- throw new aa("resource-limit", "ssconvert OpenDocument encrypted output bytes limit exceeded");
1608
- }
1609
- function na(n) {
1610
- return btoa(String.fromCharCode(...n));
1611
- }
1612
- async function ia(n, t, o, e) {
1613
- let [{ cbc: l2, gcm: _ }, { argon2idAsync: d }] = await Promise.all([import("./aes-DUEAWV73-LZOSUFMR.js"), import("./argon2-WTUGKGHD-C2NVNIFH.js")]);
1614
- (!t.password || !t.entropy) && xt("export requires password and cryptographic entropy capabilities");
1615
- let f = e.cipher === "aes-gcm", i = e.cipher === "blowfish-cfb8" || e.cipher === "blowfish-cfb64", r = i ? L2 : Wt;
1616
- if (f && (t.limits.encryptionMemoryBytes ?? Pt.maxmem) < Pt.maxmem) throw new aa("resource-limit", "ssconvert OpenDocument encryption memory limit exceeded");
1617
- let E = e.cipher === "blowfish-cfb64" ? 8 : 1, a = [...n].filter(([R]) => R !== "mimetype" && R !== "META-INF/manifest.xml"), c = 0;
1618
- for (let [, R] of a) c += R.length, c > t.limits.outputBytes && ta(), o.charge((f ? Pt.m * Pt.t * 1024 : ea * Math.ceil(e.keyBytes / 20) * 128) + R.length * 8 + 128);
1619
- let T2 = t.limits.inputBytes, S;
1620
- t.signal.throwIfAborted();
1621
- try {
1622
- S = await t.password.read(Object.freeze({ purpose: "encrypt", format: "odf", algorithm: e.cipher, revision: f ? "libreoffice" : "1.2", encoding: "utf8", maxBytes: T2, signal: t.signal, ...t.outputFilename === void 0 ? {} : { outputFilename: t.outputFilename } }));
1623
- } catch {
1624
- t.signal.throwIfAborted(), xt("password acquisition failed");
1625
- }
1626
- t.signal.throwIfAborted(), S === void 0 && xt("password required"), (typeof S == "string" ? S.length > T2 || [...S].some((R) => {
1627
- let A = R.codePointAt(0);
1628
- return A >= 55296 && A <= 57343;
1629
- }) : !(S instanceof Uint8Array) || S.length > T2) && xt("password encoding or length");
1630
- let N = typeof S == "string" ? new TextEncoder().encode(S) : new Uint8Array(S), g2 = /* @__PURE__ */ new Map(), p, L3 = 0;
1631
- try {
1632
- N.length > T2 && xt("password encoding or length");
1633
- try {
1634
- new TextDecoder("utf-8", { fatal: true }).decode(N);
1635
- } catch {
1636
- xt("password encoding or length");
1637
- }
1638
- p = r(N);
1639
- for (let [R, A] of a) {
1640
- let y = createCompressionCodec(), P = new y.CodecReader((async function* () {
1641
- yield A;
1642
- })(), t.signal), w = [], s = 0, m, u2, b;
1643
- try {
1644
- for await (let j of y.codec(P, { mode: "deflate-raw", chunkSize: 16384 }, t.signal)) t.signal.throwIfAborted(), j.length > t.limits.outputBytes - L3 - s && ta(), o.charge(j.length), w.push(new Uint8Array(j)), s += j.length;
1645
- let O = i || f ? 0 : 16 - s % 16;
1646
- s + O + (f ? 28 : 0) > t.limits.outputBytes - L3 && ta(), i && o.charge((Math.ceil(s / E) + 521) * 128);
1647
- let U = f ? 28 : i ? 24 : 48, C2;
1648
- t.signal.throwIfAborted();
1649
- try {
1650
- C2 = await t.entropy.read(Object.freeze({ length: U, signal: t.signal }));
1651
- } catch {
1652
- t.signal.throwIfAborted(), xt("entropy acquisition failed");
1653
- }
1654
- t.signal.throwIfAborted(), (!(C2 instanceof Uint8Array) || C2.length !== U) && xt(`entropy must provide exactly ${U} bytes`), m = new Uint8Array(C2);
1655
- let I2 = m.subarray(0, 16), M = m.subarray(16, f ? 28 : i ? 24 : 32);
1656
- b = new Uint8Array(s + O);
1657
- let Y = 0;
1658
- for (let j of w) b.set(j, Y), Y += j.length, j.fill(0);
1659
- let W = r(b.subarray(0, Math.min(s, 1024)));
1660
- O && (b.set(m.subarray(32, 32 + O), s), b[b.length - 1] = O), u2 = f ? await d(p, I2, Pt) : await zn(p, I2, ea, e.keyBytes, t), t.signal.throwIfAborted();
1661
- let v = i ? await mn(u2, M, b, t.signal, "encrypt", E) : new Uint8Array(b.length + (f ? 28 : 0));
1662
- f && (v.set(M), v.set(_(u2, M).encrypt(b), 12));
1663
- let ne = M;
1664
- for (let j = 0; e.cipher === "aes-cbc" && j < b.length; j += 16384) {
1665
- t.signal.throwIfAborted();
1666
- let ue = l2(u2, ne, { disablePadding: true }).encrypt(b.subarray(j, j + 16384));
1667
- v.set(ue, j), ne = v.subarray(j + ue.length - 16, j + ue.length), j && await new Promise((ve) => setTimeout(ve, 0));
1668
- }
1669
- t.signal.throwIfAborted(), L3 += v.length;
1670
- let K = o.element, G = K("manifest:encryption-data", f ? {} : { "manifest:checksum-type": i ? "SHA1/1K" : Fi.manifest + "#sha256-1k", "manifest:checksum": na(W) }, K("manifest:algorithm", { "manifest:algorithm-name": f ? "http://www.w3.org/2009/xmlenc11#aes256-gcm" : i ? "Blowfish CFB" : `http://www.w3.org/2001/04/xmlenc#aes${e.keyBytes * 8}-cbc`, "manifest:initialisation-vector": na(M) }) + K("manifest:key-derivation", { ...f ? { "manifest:key-derivation-name": "urn:org:documentfoundation:names:experimental:office:manifest:argon2id", "loext:argon2-iterations": Pt.t, "loext:argon2-memory": Pt.m, "loext:argon2-lanes": Pt.p } : { "manifest:key-derivation-name": "PBKDF2", "manifest:iteration-count": ea }, "manifest:key-size": e.keyBytes, "manifest:salt": na(I2) }) + K("manifest:start-key-generation", { "manifest:start-key-generation-name": f ? "http://www.w3.org/2001/04/xmlenc#sha256" : "http://www.w3.org/2000/09/xmldsig#" + (i ? "sha1" : "sha256"), "manifest:key-size": r.outputLen }));
1671
- g2.set(R, { bytes: v, size: A.length, declaration: G });
1672
- } finally {
1673
- u2?.fill(0), m?.fill(0), b?.fill(0);
1674
- for (let O of w) O.fill(0);
1675
- await P.close();
1676
- }
1677
- }
1678
- return g2;
1679
- } finally {
1680
- N.fill(0), p?.fill(0);
1681
- }
1682
- }
1683
- async function va(n, t, o, e, l2, _) {
1684
- let d = n.element, f = [], i = l2 ? new ZipDirectoryIndex(l2, { maximumKeyLength: 1 / 0, signal: e.signal }) : /* @__PURE__ */ new Map(), r = l2 ? new ZipDirectoryIndex(l2, { maximumKeyLength: 1 / 0, signal: e.signal }) : /* @__PURE__ */ new Map(), E = l2 ? new ZipWriteChain(l2, 16384, e.signal, async (s) => {
1685
- s.throwIfAborted();
1686
- }) : void 0, a = E ? new Uint8Array(16384) : void 0, c = 0, T2 = 0, S = 0;
1687
- function N() {
1688
- a?.fill(0);
1689
- }
1690
- e.own(N);
1691
- async function g2(...s) {
1692
- if (!E) {
1693
- f.push(...s);
1694
- return;
1695
- }
1696
- async function* m() {
1697
- yield* s;
1698
- }
1699
- for await (let u2 of xi(m(), "UTF-8", false, e)) {
1700
- if (u2.length > e.limits.outputBytes - T2) throw new tn("resource-limit", "ssconvert OpenDocument output bytes limit exceeded");
1701
- _?.(u2.length), T2 += u2.length;
1702
- for (let b = 0; b < u2.length; ) {
1703
- let O = Math.min(a.length - c, u2.length - b);
1704
- a.set(u2.subarray(b, b + O), c), c += O, b += O, c === a.length && (await E.append([a], c), c = 0);
1705
- }
1706
- }
1707
- }
1708
- async function* p() {
1709
- if (!E) {
1710
- yield* f;
1711
- return;
1712
- }
1713
- c && (await E.append([a.subarray(0, c)], c), c = 0), a.fill(0), yield* E.read();
1714
- }
1715
- function L3(s, m = /* @__PURE__ */ new Set(), u2 = 0) {
1716
- if (n.charge(typeof s == "string" ? s.length : 1), !(s === null || typeof s != "object")) {
1717
- if (m.has(s)) throw new tn("invalid-request", "Invalid cyclic OpenDocument style metadata");
1718
- if (u2 > (e.limits.xmlDepth ?? 1 / 0)) throw new tn("resource-limit", "ssconvert OpenDocument style metadata depth limit exceeded");
1719
- m.add(s);
1720
- try {
1721
- if (Array.isArray(s)) for (let b of s) L3(b, m, u2 + 1);
1722
- else for (let [b, O] of Object.entries(s)) n.charge(b.length), L3(O, m, u2 + 1);
1723
- } finally {
1724
- m.delete(s);
1725
- }
1726
- }
1727
- }
1728
- async function R(s) {
1729
- n.charge();
1730
- let m = $t(s, Xa.style).name;
1731
- m && await r.set(m, 0);
1732
- for (let u2 of nn(s)) await R(u2);
1733
- }
1734
- for (let s of o.unsupportedRecords ?? []) if (["styles", "automatic-styles"].includes(s.kind)) {
1735
- let m = bt(s.data)?.xml;
1736
- L3(m), await R(m);
1737
- }
1738
- async function A(s) {
1739
- let m = s.style?.odf;
1740
- m && (L3(m), await R(m));
1741
- }
1742
- for (let s of o.sheets) for (let m of s.cells) await A(m);
1743
- function y(s) {
1744
- if (!s) return;
1745
- let m = s.split(":");
1746
- if (m.length !== 3 || m.some((u2) => !u2 || [...u2].some((b) => !"0123456789abcdefABCDEF".includes(b)))) throw new tn("invalid-request", "Invalid OpenDocument style color");
1747
- return "#" + m.map((u2) => Math.round(parseInt(u2, 16) / 257).toString(16).padStart(2, "0")).join("");
1748
- }
1749
- function P(s, m) {
1750
- let u2 = { book: o, context: e, tick: n.charge }, b = Ui(s, u2);
1751
- if (b.length !== 1) throw new tn("unsupported-feature", "Unsupported ssconvert feature: multi-section ODF number format");
1752
- let O = Yi(b[0].pattern, u2), U = O.filter((G) => !G.literal).map((G) => G.text).join("").toLowerCase();
1753
- if (s === "General") return { xml: "", kind: "float" };
1754
- let C2 = U.includes("y") || U.includes("d") ? "date" : U.includes("h") || U.includes("s") ? "time" : U.includes("@") ? "string" : "float", I2 = "";
1755
- if (C2 === "date" || C2 === "time") {
1756
- let G = false;
1757
- for (let j = 0; j < O.length; j++) {
1758
- let ue = O[j], ve = ue.text.toLowerCase();
1759
- if (ue.literal) {
1760
- I2 += d("number:text", {}, n.escape(ue.text));
1761
- continue;
1762
- }
1763
- ve === "[" && O[j + 2]?.text === "]" && (G = true, j++);
1764
- let ze = O[j], ye = ze.text.toLowerCase();
1765
- if (ye === "]") continue;
1766
- let Q = 1;
1767
- for (; O[j + 1]?.text.toLowerCase() === ye && !O[j + 1]?.literal; ) j++, Q++;
1768
- let Ue = ye === "m" && (C2 === "time" || O.slice(0, j).some((lt) => !lt.literal && lt.text.toLowerCase() === "h") && O.slice(j + 1).some((lt) => !lt.literal && lt.text.toLowerCase() === "s")), et = ye === "y" ? "year" : ye === "d" ? Q > 2 ? "day-of-week" : "day" : ye === "m" ? Ue ? "minutes" : "month" : ye === "h" ? "hours" : ye === "s" ? "seconds" : void 0;
1769
- et ? I2 += d("number:" + et, { "number:style": Q > 1 ? "long" : "short", "number:textual": ye === "m" && !Ue && Q > 2 ? "true" : void 0 }) : I2 += d("number:text", {}, n.escape(ze.text.repeat(Q)));
1770
- }
1771
- return { kind: C2, xml: d("number:" + C2 + "-style", { "style:name": m, "number:truncate-on-overflow": G ? "false" : void 0 }, I2) };
1772
- }
1773
- if (C2 === "string") return { kind: C2, xml: d("number:text-style", { "style:name": m }, d("number:text-content")) };
1774
- let M = (G) => O[G] && !O[G].literal && "0#".includes(O[G].text), Y = O.findIndex((G, j) => M(j)), W = O.findIndex((G) => !G.literal && G.text === "."), v = -1;
1775
- for (let G = 0; G < O.length; G++) M(G) && (v = G);
1776
- if (Y < 0 || U.includes("?") || U.includes("e") || U.includes("/")) throw new tn("unsupported-feature", "Unsupported ssconvert feature: ODF numeric format " + s);
1777
- let ne = W < 0 ? 0 : O.slice(W + 1, v + 1).filter((G) => !G.literal && "0#".includes(G.text)).length, K = O.slice(Y, W < 0 ? v + 1 : W).filter((G) => !G.literal && G.text === "0").length;
1778
- return I2 = O.slice(0, Y).map((G) => d("number:text", {}, n.escape(G.text))).join("") + d("number:number", { "number:decimal-places": ne, "number:min-integer-digits": K, "number:grouping": U.includes(",") ? "true" : "false" }) + O.slice(v + 1).map((G) => d("number:text", {}, n.escape(G.text))).join(""), { kind: C2, xml: d(U.includes("%") ? "number:percentage-style" : "number:number-style", { "style:name": m }, I2) };
1779
- }
1780
- async function w(s) {
1781
- n.charge();
1782
- let m = bt(s.style?.odf), u2 = s.style?.gnumeric, b = $t(u2), O = s.format ?? b.Format ?? "General";
1783
- if (m) return { name: $t(m, Xa.style).name, kind: O.toLowerCase().includes("y") || O.toLowerCase().includes("d") ? "date" : O.toLowerCase().includes("h") ? "time" : "float" };
1784
- if (!u2 && O === "General") return { kind: "float" };
1785
- L3(u2), n.charge(O.length);
1786
- let U = JSON.stringify([u2, O]);
1787
- n.charge(U.length);
1788
- let C2 = await i.get(U), I2 = C2 ?? S, M = "ce" + I2;
1789
- if (C2 === void 0) {
1790
- for (; await r.get(M) !== void 0 || await r.get("N" + M) !== void 0; ) n.charge(), M = "ce" + ++I2;
1791
- S = I2 + 1, await r.set(M, 0), await r.set("N" + M, 0);
1792
- }
1793
- let Y = P(O, "N" + M);
1794
- if (C2 !== void 0) return { name: M, kind: Y.kind };
1795
- await i.set(U, I2);
1796
- let W = {}, v = {}, ne = {};
1797
- W["fo:background-color"] = Number(b.Shade ?? 0) ? y(b.Back) : void 0, t && b.Shade !== void 0 && (W["gnm:pattern"] = b.Shade, W["gnm:background-colour"] = y(b.Back), W["gnm:pattern-colour"] = y(b.PatternColor)), b.WrapText !== void 0 && (W["fo:wrap-option"] = Number(b.WrapText) ? "wrap" : "no-wrap"), b.ShrinkToFit !== void 0 && (W["style:shrink-to-fit"] = String(!!Number(b.ShrinkToFit))), b.Rotation !== void 0 && (W["style:rotation-angle"] = b.Rotation), (b.Locked !== void 0 || b.Hidden !== void 0) && (W["style:cell-protect"] = Number(b.Hidden) ? "formula-hidden" + (Number(b.Locked) ? " protected" : "") : Number(b.Locked) ? "protected" : "none");
1798
- let K = { GNM_HALIGN_LEFT: "start", GNM_HALIGN_RIGHT: "end", GNM_HALIGN_CENTER: "center", GNM_HALIGN_JUSTIFY: "justify", 2: "start", 4: "end", 8: "center" }, G = { GNM_VALIGN_TOP: "top", GNM_VALIGN_BOTTOM: "bottom", GNM_VALIGN_CENTER: "middle", 1: "top", 2: "bottom", 4: "middle" };
1799
- ne["fo:text-align"] = K[b.HAlign ?? ""], W["style:vertical-align"] = G[b.VAlign ?? ""], v["fo:color"] = y(b.Fore);
1800
- let j = nn(u2).find((Q) => bt(Q)?.name === "Font"), ue = $t(j);
1801
- if (j) {
1802
- if (v["fo:font-family"] = typeof bt(j)?.text == "string" ? bt(j).text : void 0, v["fo:font-size"] = ue.Unit ? ue.Unit + "pt" : void 0, ue.Bold !== void 0 && (v["fo:font-weight"] = Number(ue.Bold) ? "bold" : "normal"), ue.Italic !== void 0 && (v["fo:font-style"] = Number(ue.Italic) ? "italic" : "normal"), ue.Underline !== void 0) {
1803
- let Q = Number(ue.Underline), Ue = Q === 3 || Q === 4;
1804
- v["style:text-underline-style"] = Q ? "solid" : "none", v["style:text-underline-type"] = Q === 2 || Q === 4 ? "double" : Q ? "single" : "none", v["style:text-underline-width"] = "auto", v["style:text-underline-color"] = "font-color", v["style:text-underline-mode"] = "continuous", t && Ue && (v["gnm:text-underline-placement"] = "low");
1805
- }
1806
- ue.StrikeThrough !== void 0 && (v["style:text-line-through-style"] = Number(ue.StrikeThrough) ? "solid" : "none"), ue.Script !== void 0 && (v["style:text-position"] = Number(ue.Script) < 0 ? "sub 80%" : Number(ue.Script) > 0 ? "super 80%" : "0% 100%");
1807
- }
1808
- let ve = nn(nn(u2).find((Q) => bt(Q)?.name === "StyleBorder")), ze = { Top: "top", Bottom: "bottom", Left: "left", Right: "right" }, ye = ["none", "solid", "solid", "dashed", "dotted", "solid", "double", "solid", "dashed", "dash-dot", "dash-dot", "dash-dot-dot", "dash-dot-dot"];
1809
- for (let Q of ve) {
1810
- n.charge();
1811
- let Ue = $t(Q), et = ze[String(bt(Q)?.name)];
1812
- et && (W["fo:border-" + et] = `${[0, 1, 2, 1, 1, 3, 1, 0.5, 2, 1, 2, 1, 2][Number(Ue.Style)] ?? 1}pt ${ye[Number(Ue.Style)] ?? "solid"} ${y(Ue.Color) ?? "#000000"}`);
1813
- }
1814
- return await g2(Y.xml, d("style:style", { "style:name": M, "style:family": "table-cell", "style:data-style-name": Y.xml ? "N" + M : void 0 }, d("style:table-cell-properties", W) + d("style:paragraph-properties", ne) + d("style:text-properties", v))), { name: M, kind: Y.kind };
1815
- }
1816
- return { register: w, reserve: A, styles: f, render: p, dispose: N };
1817
- }
1818
- function Wa(n, t, o) {
1819
- let e = { "style:print": "charts drawings objects" };
1820
- for (let l2 of n) for (let _ of nn(l2)) {
1821
- t.charge();
1822
- let d = bt(_), f = $t(_);
1823
- if (d?.name === "orientation" && typeof d.text == "string" && (e["style:print-orientation"] = d.text), d?.name === "Margins") for (let i of nn(_)) {
1824
- let r = bt(i)?.name, E = $t(i);
1825
- typeof r == "string" && ["top", "bottom", "left", "right"].includes(r) && E.Points && (e["fo:margin-" + r] = E.Points + "pt");
1826
- }
1827
- d?.name === "Scale" && (f.type === "fit" ? o ? (Number(f.cols) > 0 && (e["gnm:scale-to-X"] = f.cols), Number(f.rows) > 0 && (e["gnm:scale-to-Y"] = f.rows)) : Number(f.cols) > 0 && Number(f.rows) > 0 && (e["style:scale-to-pages"] = Number(f.cols) * Number(f.rows)) : f.percentage && (e["style:scale-to"] = f.percentage + "%"));
1828
- }
1829
- return e;
1830
- }
1831
- function Va(n, t) {
1832
- let o = [], e = [];
1833
- return { async put(l2) {
1834
- if (n.signal.throwIfAborted(), !t) return o.push(l2), o.length;
1835
- let _ = t.allocate(24), d = new Uint8Array(24), f = new DataView(d.buffer);
1836
- return l2.forEach((i, r) => f.setFloat64(r * 8, i, true)), await t.write(_, d), n.signal.throwIfAborted(), _;
1837
- }, async get(l2) {
1838
- if (n.signal.throwIfAborted(), !t) return o[l2 - 1];
1839
- let _ = new Uint8Array(await t.read(l2, 24));
1840
- if (n.signal.throwIfAborted(), _.length !== 24) throw new RangeError("Truncated ODF definition record");
1841
- let d = new DataView(_.buffer), f = [d.getFloat64(0, true), d.getFloat64(8, true), d.getFloat64(16, true)];
1842
- if (f.some((i) => !Number.isSafeInteger(i) || i < 0)) throw new RangeError("Invalid ODF definition record");
1843
- return f;
1844
- }, async putText(l2) {
1845
- if (n.signal.throwIfAborted(), !t) return e.push(l2), e.length;
1846
- let _ = t.allocate(8 + l2.length * 2), d = new Uint8Array(8), f = new Uint8Array(4096), i = new DataView(f.buffer);
1847
- new DataView(d.buffer).setFloat64(0, l2.length, true);
1848
- try {
1849
- await t.write(_, d);
1850
- for (let r = 0; r < l2.length; r += 2048) {
1851
- n.signal.throwIfAborted();
1852
- let E = Math.min(2048, l2.length - r);
1853
- for (let a = 0; a < E; a++) i.setUint16(a * 2, l2.charCodeAt(r + a), true);
1854
- await t.write(_ + 8 + r * 2, f.subarray(0, E * 2));
1855
- }
1856
- return n.signal.throwIfAborted(), _;
1857
- } finally {
1858
- f.fill(0);
1859
- }
1860
- }, async *text(l2) {
1861
- if (n.signal.throwIfAborted(), !t) {
1862
- yield e[l2 - 1];
1863
- return;
1864
- }
1865
- let _ = new Uint8Array(await t.read(l2, 8));
1866
- if (n.signal.throwIfAborted(), _.length !== 8) throw new RangeError("Truncated ODF definition text");
1867
- let d = new DataView(_.buffer).getFloat64(0, true);
1868
- if (!Number.isSafeInteger(d) || d < 0 || !Number.isSafeInteger(l2 + 8 + d * 2)) throw new RangeError("Invalid ODF definition text");
1869
- for (let f = 0; f < d; f += 2048) {
1870
- n.signal.throwIfAborted();
1871
- let i = Math.min(2048, d - f), r = await t.read(l2 + 8 + f * 2, i * 2);
1872
- if (n.signal.throwIfAborted(), r.length !== i * 2) throw new RangeError("Truncated ODF definition text");
1873
- let E = new DataView(r.buffer, r.byteOffset, r.byteLength), a = [];
1874
- for (let c = 0; c < i; c++) a.push(E.getUint16(c * 2, true));
1875
- yield String.fromCharCode(...a);
1876
- }
1877
- } };
1878
- }
1879
- async function $a(n, t, o, e, l2) {
1880
- let _ = n.unsupportedRecords ?? [], d = Object.isFrozen(_) ? _ : Hi(_, o.limits), f = () => e ? new ZipDirectoryIndex(e, { maximumKeyLength: 1 / 0, signal: o.signal }) : /* @__PURE__ */ new Map(), i = () => ({ identities: f(), shapes: f(), count: 0, entries: e ? new ki(e, 128) : /* @__PURE__ */ new Map() }), r = /* @__PURE__ */ new Map(), E = f(), a = f(), c = Va(o, e);
1881
- function T2(R) {
1882
- let A = r.get(R);
1883
- return A || (A = i(), r.set(R, A)), A;
1884
- }
1885
- function S(R, A) {
1886
- return za(bn(d[R - 1]?.data)?.xml)[A];
1887
- }
1888
- async function N(R, A, y) {
1889
- let P = await R.identities.get(A);
1890
- P === void 0 && (P = R.count++, await R.identities.set(A, P)), await R.entries.set(BigInt(P), BigInt(y));
1891
- }
1892
- let g2 = 0;
1893
- for (let [R, A] of d.entries()) {
1894
- if (t.charge(), A.source !== "Gnumeric_OpenCalc:openoffice") continue;
1895
- let y = bn(A.data), P = A.kind === "automatic-styles" ? y?.packagePart === "styles.xml" ? "stylesAutomatic" : "contentAutomatic" : A.kind === "master-styles" ? "masters" : A.kind === "font-face-decls" ? "fonts" : A.kind === "styles" ? "styles" : void 0;
1896
- if (!P) continue;
1897
- let w = T2(P);
1898
- for (let [s, m] of za(y?.xml).entries()) {
1899
- t.charge();
1900
- let u2 = bn(m), b = oa(m, Pn.style), O = b.name ? JSON.stringify([u2?.namespace, u2?.name, b.family ?? "", b.name]) : "anonymous:" + g2++;
1901
- await N(w, O, await c.put([R + 1, s, 0])), b.name && await E.set(b.name, 0);
1902
- }
1903
- }
1904
- for (let R of r.values()) for await (let [, A] of R.entries.entries()) {
1905
- let [y, P] = await c.get(Number(A)), w = S(y, P);
1906
- t.charge();
1907
- let s = bn(w), m = oa(w, Pn.style).name;
1908
- if (!s || !m || !Array.isArray(s.attributes)) continue;
1909
- let u2 = s.attributes.filter((b) => {
1910
- t.charge();
1911
- let O = bn(b);
1912
- return O?.namespace !== Pn.style || O?.name !== "name";
1913
- });
1914
- await R.shapes.set(t.retained({ ...s, attributes: u2 }), Number(A));
1915
- }
1916
- async function p(R, A, y, P, w = "") {
1917
- let s = t.element(A, P, w), m = T2(R), u2 = await m.shapes.get(s);
1918
- if (u2 !== void 0) {
1919
- let [I2, M, Y] = await c.get(u2);
1920
- if (I2) return oa(S(I2, M), Pn.style).name;
1921
- let W = "";
1922
- for await (let v of c.text(Y)) W += v;
1923
- return W;
1924
- }
1925
- let b = await a.get(y) ?? 0, O = b ? y + "_" + b : y;
1926
- for (; await E.get(O) !== void 0; ) t.charge(), O = y + "_" + ++b;
1927
- await E.set(O, 0), await a.set(y, b + 1);
1928
- let U = t.element(A, { "style:name": O, ...P }, w);
1929
- if (e && l2) {
1930
- let I2 = 0;
1931
- for (let M of U) {
1932
- o.signal.throwIfAborted();
1933
- let Y = M.codePointAt(0);
1934
- I2 += Y < 128 ? 1 : Y < 2048 ? 2 : Y < 65536 ? 3 : 4;
1935
- }
1936
- l2(I2);
1937
- }
1938
- let C2 = await c.put([0, await c.putText(U), await c.putText(O)]);
1939
- return await N(m, "generated:" + O, C2), await m.shapes.set(s, C2), O;
1940
- }
1941
- async function* L3(R) {
1942
- let A = r.get(R);
1943
- if (A) for await (let [, y] of A.entries.entries()) {
1944
- t.charge();
1945
- let [P, w] = await c.get(Number(y));
1946
- P ? yield* t.retainedFragments(S(P, w)) : yield* c.text(w);
1947
- }
1948
- }
1949
- return { register: p, render: L3 };
1950
- }
1951
- var ja = Object.freeze({ ABS: "ABS", ACCRINT: "ACCRINT", ACCRINTM: "ACCRINTM", ACOS: "ACOS", ACOSH: "ACOSH", ACOT: "ACOT", ACOTH: "ACOTH", ADDRESS: "ADDRESS", AMORDEGRC: "AMORDEGRC", AMORLINC: "AMORLINC", AND: "AND", ARABIC: "ARABIC", AREAS: "AREAS", ASC: "ASC", ASIN: "ASIN", ASINH: "ASINH", ATAN: "ATAN", ATAN2: "ATAN2", ATANH: "ATANH", AVEDEV: "AVEDEV", AVERAGE: "AVERAGE", AVERAGEA: "AVERAGEA", AVERAGEIF: "AVERAGEIF", AVERAGEIFS: "AVERAGEIFS", "BINOM.DIST.RANGE": "B", BASE: "BASE", BESSELI: "BESSELI", BESSELJ: "BESSELJ", BESSELK: "BESSELK", BESSELY: "BESSELY", BETADIST: "BETADIST", BETAINV: "BETAINV", BIN2DEC: "BIN2DEC", BIN2HEX: "BIN2HEX", BIN2OCT: "BIN2OCT", BINOMDIST: "BINOMDIST", BITAND: "BITAND", BITLSHIFT: "BITLSHIFT", BITOR: "BITOR", BITRSHIFT: "BITRSHIFT", BITXOR: "BITXOR", CEIL: "CEILING", CELL: "CELL", CHAR: "CHAR", CHOOSE: "CHOOSE", CLEAN: "CLEAN", CODE: "CODE", COLUMN: "COLUMN", COLUMNS: "COLUMNS", "CONFIDENCE.T": "COM.MICROSOFT.CONFIDENCE.T", COMBIN: "COMBIN", COMBINA: "COMBINA", COMPLEX: "COMPLEX", CONCAT: "COM.MICROSOFT.CONCAT", CONCATENATE: "COM.MICROSOFT.CONCAT", CONFIDENCE: "CONFIDENCE", CONVERT: "CONVERT", CORREL: "CORREL", COS: "COS", COSH: "COSH", COT: "COT", COTH: "COTH", COUNT: "COUNT", COUNTA: "COUNTA", COUNTBLANK: "COUNTBLANK", COUNTIF: "COUNTIF", COUNTIFS: "COUNTIFS", COUPDAYBS: "COUPDAYBS", COUPDAYS: "COUPDAYS", COUPDAYSNC: "COUPDAYSNC", COUPNCD: "COUPNCD", COUPNUM: "COUPNUM", COUPPCD: "COUPPCD", COVAR: "COVAR", CRITBINOM: "CRITBINOM", CSC: "CSC", CSCH: "CSCH", CUMIPMT: "CUMIPMT", CUMPRINC: "CUMPRINC", DATE: "DATE", DATEDIF: "DATEDIF", DATEVALUE: "DATEVALUE", DAVERAGE: "DAVERAGE", DAY: "DAY", DAYS: "DAYS", DAYS360: "DAYS360", DB: "DB", DCOUNT: "DCOUNT", DCOUNTA: "DCOUNTA", DDB: "DDB", DEC2BIN: "DEC2BIN", DEC2HEX: "DEC2HEX", DEC2OCT: "DEC2OCT", DECIMAL: "DECIMAL", DEGREES: "DEGREES", DELTA: "DELTA", DEVSQ: "DEVSQ", DGET: "DGET", DISC: "DISC", DMAX: "DMAX", DMIN: "DMIN", DOLLAR: "DOLLAR", DOLLARDE: "DOLLARDE", DOLLARFR: "DOLLARFR", DPRODUCT: "DPRODUCT", DSTDEV: "DSTDEV", DSTDEVP: "DSTDEVP", DSUM: "DSUM", DURATION: "DURATION", DVAR: "DVAR", DVARP: "DVARP", EDATE: "EDATE", EFFECT: "EFFECT", EOMONTH: "EOMONTH", ERF: "ERF", ERFC: "ERFC", "ERROR.TYPE": "ERROR.TYPE", EUROCONVERT: "EUROCONVERT", EVEN: "EVEN", EXACT: "EXACT", EXP: "EXP", EXPONDIST: "EXPONDIST", FACT: "FACT", FACTDOUBLE: "FACTDOUBLE", FALSE: "FALSE", FIND: "FIND", FINDB: "FINDB", FISHER: "FISHER", FISHERINV: "FISHERINV", FIXED: "FIXED", FLOOR: "FLOOR", FORECAST: "FORECAST", "GET.FORMULA": "FORMULA", FREQUENCY: "FREQUENCY", FTEST: "FTEST", FV: "FV", FVSCHEDULE: "FVSCHEDULE", GAMMA: "GAMMA", GAMMADIST: "GAMMADIST", GAMMAINV: "GAMMAINV", GAMMALN: "GAMMALN", GCD: "GCD", GEOMEAN: "GEOMEAN", GESTEP: "GESTEP", GETPIVOTDATA: "GETPIVOTDATA", GROWTH: "GROWTH", HARMEAN: "HARMEAN", HEX2BIN: "HEX2BIN", HEX2DEC: "HEX2DEC", HEX2OCT: "HEX2OCT", HLOOKUP: "HLOOKUP", HOUR: "HOUR", HYPERLINK: "HYPERLINK", HYPGEOMDIST: "HYPGEOMDIST", IF: "IF", IFERROR: "IFERROR", IFNA: "IFNA", IFS: "COM.MICROSOFT.IFS", IMABS: "IMABS", IMAGINARY: "IMAGINARY", IMARGUMENT: "IMARGUMENT", IMCONJUGATE: "IMCONJUGATE", IMCOS: "IMCOS", IMCOT: "IMCOT", IMCSC: "IMCSC", IMCSCH: "IMCSCH", IMDIV: "IMDIV", IMEXP: "IMEXP", IMLN: "IMLN", IMLOG10: "IMLOG10", IMLOG2: "IMLOG2", IMPOWER: "IMPOWER", IMPRODUCT: "IMPRODUCT", IMREAL: "IMREAL", IMSEC: "IMSEC", IMSECH: "IMSECH", IMSIN: "IMSIN", IMSQRT: "IMSQRT", IMSUB: "IMSUB", IMSUM: "IMSUM", IMTAN: "IMTAN", INDEX: "INDEX", INDIRECT: "INDIRECT", INFO: "INFO", INT: "INT", INTERCEPT: "INTERCEPT", INTRATE: "INTRATE", IPMT: "IPMT", IRR: "IRR", ISBLANK: "ISBLANK", ISERR: "ISERR", ISERROR: "ISERROR", ISEVEN: "ISEVEN", ISFORMULA: "ISFORMULA", ISLOGICAL: "ISLOGICAL", ISNA: "ISNA", ISNONTEXT: "ISNONTEXT", ISNUMBER: "ISNUMBER", ISODD: "ISODD", ISOWEEKNUM: "ISOWEEKNUM", ISPMT: "ISPMT", ISREF: "ISREF", ISTEXT: "ISTEXT", JIS: "JIS", KURT: "KURT", LARGE: "LARGE", LCM: "LCM", LEFT: "LEFT", LEFTB: "LEFTB", CHIDIST: "LEGACY.CHIDIST", CHIINV: "LEGACY.CHIINV", CHITEST: "LEGACY.CHITEST", FDIST: "LEGACY.FDIST", FINV: "LEGACY.FINV", NORMSDIST: "LEGACY.NORMSDIST", NORMSINV: "LEGACY.NORMSINV", TDIST: "LEGACY.TDIST", LEN: "LEN", LENB: "LENB", LINEST: "LINEST", LN: "LN", LOG: "LOG", LOG10: "LOG10", LOGEST: "LOGEST", LOGINV: "LOGINV", LOGNORMDIST: "LOGNORMDIST", LOOKUP: "LOOKUP", LOWER: "LOWER", MATCH: "MATCH", MAX: "MAX", MAXA: "MAXA", MAXIFS: "COM.MICROSOFT.MAXIFS", MDETERM: "MDETERM", MDURATION: "MDURATION", MEDIAN: "MEDIAN", MID: "MID", MIDB: "MIDB", MIN: "MIN", MINA: "MINA", MINIFS: "COM.MICROSOFT.MINIFS", MINUTE: "MINUTE", MINVERSE: "MINVERSE", MIRR: "MIRR", MMULT: "MMULT", MOD: "MOD", MODE: "MODE", "MODE.MULT": "COM.MICROSOFT.MODE.MULT", MONTH: "MONTH", MROUND: "MROUND", MULTINOMIAL: "MULTINOMIAL", MUNIT: "MUNIT", N: "N", NA: "NA", NEGBINOMDIST: "NEGBINOMDIST", NETWORKDAYS: "NETWORKDAYS", NOMINAL: "NOMINAL", NORMDIST: "NORMDIST", NORMINV: "NORMINV", NOT: "NOT", NOW: "NOW", NPER: "NPER", NPV: "NPV", NUMBERVALUE: "NUMBERVALUE", OCT2BIN: "OCT2BIN", OCT2DEC: "OCT2DEC", OCT2HEX: "OCT2HEX", ODD: "ODD", ODDFPRICE: "ODDFPRICE", ODDFYIELD: "ODDFYIELD", ODDLPRICE: "ODDLPRICE", ODDLYIELD: "ODDLYIELD", OFFSET: "OFFSET", OR: "OR", G_DURATION: "PDURATION", PEARSON: "PEARSON", PERCENTILE: "PERCENTILE", "PERCENTILE.EXC": "COM.MICROSOFT.PERCENTILE.EXC", PERCENTRANK: "PERCENTRANK", "PERCENTRANK.EXC": "COM.MICROSOFT.PERCENTRANK.EXC", PERMUT: "PERMUT", PERMUTATIONA: "PERMUTATIONA", PI: "PI", PMT: "PMT", POISSON: "POISSON", POWER: "POWER", PPMT: "PPMT", PRICE: "PRICE", PRICEDISC: "PRICEDISC", PRICEMAT: "PRICEMAT", PROB: "PROB", PRODUCT: "PRODUCT", PROPER: "PROPER", PV: "PV", QUARTILE: "QUARTILE", "QUARTILE.EXC": "COM.MICROSOFT.QUARTILE.EXC", QUOTIENT: "QUOTIENT", RADIANS: "RADIANS", RAND: "RAND", RANDBETWEEN: "RANDBETWEEN", RANK: "RANK", "RANK.AVG": "COM.MICROSOFT.RANK.AVG", RATE: "RATE", RECEIVED: "RECEIVED", REPLACE: "REPLACE", REPLACEB: "REPLACEB", REPT: "REPT", RIGHT: "RIGHT", RIGHTB: "RIGHTB", ROMAN: "ROMAN", ROUND: "ROUND", ROUNDDOWN: "ROUNDDOWN", ROUNDUP: "ROUNDUP", ROW: "ROW", ROWS: "ROWS", RRI: "RRI", RSQ: "RSQ", SEARCH: "SEARCH", SEARCHB: "SEARCHB", SEC: "SEC", SECH: "SECH", SECOND: "SECOND", SERIESSUM: "SERIESSUM", SHEET: "SHEET", SHEETS: "SHEETS", SIGN: "SIGN", SIN: "SIN", SINH: "SINH", SKEW: "SKEW", SKEWP: "SKEWP", SLN: "SLN", SLOPE: "SLOPE", SMALL: "SMALL", SQRT: "SQRT", SQRTPI: "SQRTPI", STANDARDIZE: "STANDARDIZE", STDEV: "STDEV", STDEVA: "STDEVA", STDEVP: "STDEVP", STDEVPA: "STDEVPA", STEYX: "STEYX", SUBSTITUTE: "SUBSTITUTE", SUBTOTAL: "SUBTOTAL", SUM: "SUM", SUMIF: "SUMIF", SUMIFS: "SUMIFS", "ODF.SUMPRODUCT": "SUMPRODUCT", SUMSQ: "SUMSQ", SUMX2MY2: "SUMX2MY2", SUMX2PY2: "SUMX2PY2", SUMXMY2: "SUMXMY2", SWITCH: "COM.MICROSOFT.SWITCH", SYD: "SYD", T: "T", TAN: "TAN", TANH: "TANH", TBILLEQ: "TBILLEQ", TBILLPRICE: "TBILLPRICE", TBILLYIELD: "TBILLYIELD", TEXT: "TEXT", TEXTJOIN: "COM.MICROSOFT.TEXTJOIN", "ODF.TIME": "TIME", TIMEVALUE: "TIMEVALUE", TINV: "TINV", TODAY: "TODAY", TRANSPOSE: "TRANSPOSE", TREND: "TREND", TRIM: "TRIM", TRIMMEAN: "TRIMMEAN", TRUE: "TRUE", TRUNC: "TRUNC", TTEST: "TTEST", TYPE: "TYPE", UNICHAR: "UNICHAR", UNICODE: "UNICODE", UPPER: "UPPER", VALUE: "VALUE", VAR: "VAR", VARA: "VARA", VARP: "VARP", VARPA: "VARPA", VDB: "VDB", VLOOKUP: "VLOOKUP", WEEKDAY: "WEEKDAY", WEEKNUM: "WEEKNUM", WEIBULL: "WEIBULL", WORKDAY: "WORKDAY", XIRR: "XIRR", XNPV: "XNPV", XOR: "XOR", YEAR: "YEAR", YEARFRAC: "YEARFRAC", YIELD: "YIELD", YIELDDISC: "YIELDDISC", YIELDMAT: "YIELDMAT", ZTEST: "ZTEST" });
1952
- async function Ka(n, t, o, e, l2, _, d, f, i) {
1953
- let r = l2.element, E = Rn(n), a = await _.register({ style: { gnumeric: n }, ...E.Format ? { format: E.Format } : {} }), c = ra(n), T2 = vi(e.name, "'", Wi) + "." + Xi(t.startRow, t.startColumn);
1954
- function S(s, m) {
1955
- let u2 = ra(s).find((O) => jt(O)?.name === m), b = jt(u2)?.text;
1956
- return typeof b == "string" ? f(b.startsWith("=") ? b : "=" + b, e, t.startRow, t.startColumn).slice(4) : "";
1957
- }
1958
- let N = "", g2 = "";
1959
- for (let s of c.filter((m) => jt(m)?.name === "Condition")) {
1960
- l2.charge();
1961
- let m = Rn(s), u2 = Number(m.Operator), b = ra(s).find((Y) => jt(Y)?.name === "Style"), O = S(s, "Expression0"), U = S(s, "Expression1"), C2 = ["", "", "=", "!=", ">", "<", ">=", "<="];
1962
- if (!b || !O || !Number.isInteger(u2) || u2 < 0 || u2 > 8) {
1963
- await d.diagnostic?.({ code: "odf-write-loss", severity: "warning", message: `ODF writer does not export sheet '${e.name}' conditional operator '${m.Operator ?? ""}'` });
1964
- continue;
1965
- }
1966
- let I2 = (await _.register({ style: { gnumeric: b } })).name, M = u2 === 0 || u2 === 1 ? `of:cell-content-is-${u2 === 1 ? "not-" : ""}between(${O};${U})` : u2 === 8 ? `of:is-true-formula(${O})` : "of:cell-content()" + C2[u2] + O;
1967
- N += r("style:map", { "style:apply-style-name": I2, "style:condition": M, "style:base-cell-address": T2 });
1968
- }
1969
- let p = N ? o + "c" : a.name, L3 = N ? r("style:style", { "style:name": p, "style:family": "table-cell", "style:parent-style-name": a.name }, N) : "", R = c.find((s) => jt(s)?.name === "Validation"), A = c.find((s) => jt(s)?.name === "InputMessage"), y;
1970
- if (R || A) {
1971
- let s = Rn(R), m = (s.Type ?? "GNM_VALIDATION_TYPE_ANY").slice(20), u2 = (s.Operator ?? "GNM_VALIDATION_OP_NONE").slice(18), b = S(R, "Expression0"), O = S(R, "Expression1"), U = { ANY: "", AS_INT: "cell-content-is-whole-number() and ", AS_NUMBER: "cell-content-is-decimal-number() and ", AS_DATE: "cell-content-is-date() and ", AS_TIME: "cell-content-is-time() and " }, C2 = { EQUAL: " = ", NOT_EQUAL: " != ", GT: " > ", LT: " < ", GTE: " >= ", LTE: " <= " }, I2 = m === "TEXT_LENGTH", M = "";
1972
- if (m === "CUSTOM") M = `of:is-true-formula(${b})`;
1973
- else if (m === "IN_LIST") M = `of:cell-content-is-in-list(${b})`;
1974
- else if (Object.hasOwn(U, m) || I2) {
1975
- let Y = "of:" + (U[m] ?? ""), W = I2 ? "cell-content-text-length" : "cell-content";
1976
- u2 === "NONE" ? M = Y + "is-true-formula(1)" : u2 === "BETWEEN" || u2 === "NOT_BETWEEN" ? M = `${Y}${W}-is-${u2 === "NOT_BETWEEN" ? "not-" : ""}between(${b};${O})` : Object.hasOwn(C2, u2) && (M = Y + W + "()" + C2[u2] + b);
1977
- }
1978
- if (!M) await d.diagnostic?.({ code: "odf-write-loss", severity: "warning", message: `ODF writer does not export sheet '${e.name}' validation type/operator '${m}/${u2}'` });
1979
- else {
1980
- y = o + "v";
1981
- let Y = Rn(A), W = (A ? r("table:help-message", { "table:display": "true", "table:title": Y.Title }, r("text:p", {}, l2.text(Y.Message ?? ""))) : "") + (R && s.Style !== "GNM_VALIDATION_STYLE_NONE" ? r("table:error-message", { "table:display": "true", "table:title": s.Title, "table:message-type": s.Style?.endsWith("WARNING") ? "warning" : s.Style?.endsWith("INFO") ? "information" : "stop" }, r("text:p", {}, l2.text(s.Message ?? ""))) : "");
1982
- g2 = r("table:content-validation", { "table:name": y, "table:condition": M, "table:base-cell-address": T2, "table:allow-empty-cell": s.AllowBlank === "1" ? "true" : "false", "table:display-list": s.UseDropdown === "1" ? "unsorted" : "none" }, W);
1983
- }
1984
- }
1985
- let P = c.find((s) => jt(s)?.name === "HyperLink"), w = Rn(P);
1986
- return { styleName: p, styleXml: L3, validationName: y, validationXml: g2, ...w.target ? { link: { "xlink:href": w.type === "GnmHLinkCurWB" ? Vi(w.target, "export", l2.charge, i) : w.target, "xlink:type": "simple", "office:title": w.tip } } : {} };
1987
- }
1988
- var Qe = "urn:oasis:names:tc:opendocument:xmlns:";
1989
- var ot2 = { OO_NS_OFFICE: [Qe + "office:1.0", "http://openoffice.org/2000/office"], OO_NS_TABLE: [Qe + "table:1.0", "http://openoffice.org/2000/table"], OO_NS_TEXT: [Qe + "text:1.0", "http://openoffice.org/2000/text"], OO_NS_STYLE: [Qe + "style:1.0", "http://openoffice.org/2000/style"], OO_NS_NUMBER: [Qe + "datastyle:1.0", "http://openoffice.org/2000/datastyle"], OO_NS_DRAW: [Qe + "drawing:1.0", "http://openoffice.org/2000/drawing"], OO_NS_CHART: [Qe + "chart:1.0", "http://openoffice.org/2000/chart"], OO_NS_CHART_OOO: ["http://openoffice.org/2010/chart"], OO_NS_DC: ["http://purl.org/dc/elements/1.1/"], OO_NS_META: [Qe + "meta:1.0", "http://openoffice.org/2000/meta"], OO_NS_SVG: [Qe + "svg-compatible:1.0", "http://www.w3.org/2000/svg"], OO_NS_FORM: [Qe + "form:1.0", "http://openoffice.org/2000/form"], OO_NS_SCRIPT: [Qe + "script:1.0", "http://openoffice.org/2000/script"], OO_NS_LOCALC_EXT: ["urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0"], OO_GNUM_NS_EXT: ["http://www.gnumeric.org/odf-extension/1.0"] };
1990
- var rn = ot2.OO_NS_OFFICE;
1991
- var Tt = ot2.OO_NS_TABLE;
1992
- var sn = ot2.OO_NS_TEXT;
1993
- var ct = ot2.OO_NS_STYLE;
1994
- var ht = ot2.OO_NS_NUMBER;
1995
- var Oo = /* @__PURE__ */ new Map([["application/vnd.oasis.opendocument.spreadsheet", false], ["application/vnd.oasis.opendocument.spreadsheet-template", false], ["application/vnd.sun.xml.calc", true], ["application/vnd.sun.xml.calc.template", true]]);
1996
- var mo = Object.fromEntries(Object.entries(Ba).map(([n, t]) => {
1997
- let o = /* @__PURE__ */ new Map();
1998
- for (let e of t.split(`
1999
- `)) {
2000
- let l2 = e.split(" "), _ = l2[0] + ":" + l2[3], d = o.get(_) ?? [];
2001
- d.push(l2), o.set(_, d);
2002
- }
2003
- return [n, o];
2004
- }));
2005
- function pe(n) {
2006
- throw new Le("io", `E Invalid OpenDocument: ${n}`);
2007
- }
2008
- function fe(n) {
2009
- throw new Le("resource-limit", `ssconvert OpenDocument ${n} limit exceeded`);
2010
- }
2011
- function z(n, t, o = Tt) {
2012
- return n?.attributes.find((e) => e.localName === t && o.includes(e.namespace))?.value;
2013
- }
2014
- function Ut(n, t, o = Tt) {
2015
- return n?.children.filter((e) => e.localName === t && o.includes(e.namespace)) ?? [];
2016
- }
2017
- function ut(n, t = 1) {
2018
- let o = n === void 0 ? t : Number(n);
2019
- return (!Number.isSafeInteger(o) || o < 0) && pe("invalid repeat/span count"), o;
2020
- }
2021
- function hn(n) {
2022
- return { name: n.localName, namespace: n.namespace, attributes: n.attributes.filter((t) => t.namespace !== "http://www.w3.org/2000/xmlns/").map((t) => ({ name: t.localName, namespace: t.namespace, value: t.value })), text: n.text, children: n.children.map(hn), ...n.children.length ? { content: n.content.flatMap((t) => t.kind === "text" || t.kind === "cdata" ? [{ kind: "text", text: t.text }] : t.kind === "element" ? [{ kind: "element", index: n.children.indexOf(t) }] : []) } : {} };
2023
- }
2024
- function an(n, t = {}) {
2025
- return { source: "Gnumeric_OpenCalc:openoffice", kind: n.localName, disposition: "retained", data: { xml: hn(n), ...t } };
2026
- }
2027
- async function Hn(n, t, o = "odf-import-warning") {
2028
- let e = so(t.environment) === "C" ? Array.from(n, (l2) => l2.codePointAt(0) < 128 ? l2 : "?").join("") : n;
2029
- await t.diagnostic?.({ code: o, severity: "warning", message: n, bytes: new TextEncoder().encode(e) });
2030
- }
2031
- function ri(n) {
2032
- return { maxArchiveBytes: Math.min(n.limits.inputBytes, n.limits.compressedBytes ?? n.limits.inputBytes), maxEntryBytes: Math.min(n.limits.inputBytes, n.limits.inflatedBytes ?? n.limits.inputBytes), maxTotalBytes: Math.min(n.limits.inputBytes, n.limits.inflatedBytes ?? n.limits.inputBytes), maxMembers: n.limits.zipEntries ?? n.limits.workbookNodes ?? 1 / 0, maxPathBytes: 1 / 0, maxDepth: n.limits.xmlDepth ?? 1 / 0, maxPaxBytes: n.limits.inputBytes, maxTextBytes: n.limits.workbookTextBytes ?? n.limits.inputBytes, chunkSize: 16384 };
2033
- }
2034
- function si(n, t) {
2035
- let o = "compressedSize" in n ? n.compressedSize : n.data.length;
2036
- return n.size > (t.limits.zipRatio ?? 1 / 0) * Math.max(1, o) && fe("ZIP ratio"), n.directory ? false : ((n.symlink || n.name.startsWith("/") || n.name.includes("\\") || n.name.split("/").some((e) => !e || e === "." || e === "..")) && pe("noncanonical ZIP member"), true);
2037
- }
2038
- function ei(n, t) {
2039
- let o = /* @__PURE__ */ new Map();
2040
- for (let e of n) si(e, t) && o.set(e.name, e);
2041
- return o;
2042
- }
2043
- async function ci(n, t) {
2044
- t.signal.throwIfAborted();
2045
- let o = createZipCodec(void 0, { rejectDuplicateNames: true, zip64: true }), e = ri(t), l2;
2046
- if (!(n instanceof Uint8Array)) {
2047
- let a = n.read.bind(n);
2048
- l2 = qi({ size: n.size, async read(c, T2, S) {
2049
- try {
2050
- return await a(c, T2, S);
2051
- } catch (N) {
2052
- throw new ZipStorageFailure(N);
2053
- }
2054
- } }, t.signal, () => t.signal.throwIfAborted(), t.own);
2055
- }
2056
- let _, d, f = async () => {
2057
- };
2058
- if (l2 && t.createWorkingStorage) {
2059
- let a = createStoredZipEntries(t.createWorkingStorage.bind(t), l2);
2060
- f = a.close;
2061
- let c = 0;
2062
- try {
2063
- d = (await o.readZipArchive(l2, e, t.signal, { storage: a.storage, async onEntry(S) {
2064
- si(S, t) && (await a.set(S), c++);
2065
- } })).members;
2066
- } catch (T2) {
2067
- throw await f(), T2;
2068
- }
2069
- _ = { get: a.get, size: c };
2070
- } else {
2071
- let a = l2 ? await o.readZipArchive(l2, e, t.signal) : await o.readZipArchive(new Uint8Array(n), e, t.signal);
2072
- d = a.entries.length, _ = ei(a.entries, t);
2073
- }
2074
- let i = { get size() {
2075
- return _.size;
2076
- }, async get(a) {
2077
- return _.get(a);
2078
- }, async has(a) {
2079
- return await _.get(a) !== void 0;
2080
- } };
2081
- try {
2082
- let g2 = function(u2 = 1) {
2083
- t.signal.throwIfAborted(), u2 > (t.limits.workbookWork ?? 1 / 0) - N && fe("work"), N += u2;
2084
- }, s = function(u2) {
2085
- u2 > (t.limits.workbookTextBytes ?? e.maxTotalBytes) - S && fe("retained text"), S += u2;
2086
- };
2087
- var r = g2, E = s;
2088
- let a = await i.has("encrypted-package") ? /* @__PURE__ */ new Set() : void 0;
2089
- a && t.own(() => {
2090
- for (let u2 of a) u2.fill(0);
2091
- });
2092
- let c = 0, T2 = 0, S = 0, N = 0, p = /* @__PURE__ */ new Map(), L3 = /* @__PURE__ */ new Set();
2093
- async function* R(u2) {
2094
- let b = p.get(u2);
2095
- if (b) {
2096
- for (let C2 = 0; C2 < b.length; C2 += e.chunkSize) t.signal.throwIfAborted(), yield b.subarray(C2, C2 + e.chunkSize);
2097
- return;
2098
- }
2099
- let O = await i.get(u2);
2100
- O || pe(`missing part '${u2}'`);
2101
- let U = !L3.has(u2);
2102
- for await (let C2 of o.decodeZipEntry(O, e, t.signal)) try {
2103
- U && (C2.length > e.maxTotalBytes - c && fe("decoded bytes"), c += C2.length, g2(C2.length)), yield C2;
2104
- } finally {
2105
- a && C2.fill(0);
2106
- }
2107
- L3.add(u2);
2108
- }
2109
- async function A(u2) {
2110
- let b = p.get(u2);
2111
- if (b) return b;
2112
- let O = [], U = 0;
2113
- for await (let M of R(u2)) {
2114
- let Y = new Uint8Array(M);
2115
- a?.add(Y), U += Y.length, O.push(Y);
2116
- }
2117
- let C2 = new Uint8Array(U), I2 = 0;
2118
- a?.add(C2);
2119
- for (let M of O) C2.set(M, I2), I2 += M.length;
2120
- return p.set(u2, C2), C2;
2121
- }
2122
- async function y(u2, b) {
2123
- let O = { expectedEncoding: "UTF-8", ...b ? { streamElements: b } : {}, retainContent: true, maxDepth: t.limits.xmlDepth ?? 1 / 0, maxNodes: (t.limits.workbookNodes ?? 1 / 0) - T2, maxAttributes: t.limits.workbookNodes ?? 1 / 0, maxTextLength: e.maxTextBytes, onElement() {
2124
- T2++, g2();
2125
- } };
2126
- async function* U() {
2127
- let I2 = new Uint8Array(2), M = 0, Y;
2128
- for await (let W of R(u2)) {
2129
- W.length > (t.limits.workbookTextBytes ?? e.maxTotalBytes) - S && fe("XML text"), S += W.length;
2130
- let v = 0;
2131
- if (!Y) {
2132
- for (; M < 2 && v < W.length; ) I2[M++] = W[v++];
2133
- if (M < 2) continue;
2134
- (I2[0] === 255 && I2[1] === 254 || I2[0] === 60 && I2[1] === 0) && (O.expectedEncoding = "UTF-16LE"), (I2[0] === 254 && I2[1] === 255 || I2[0] === 0 && I2[1] === 60) && (O.expectedEncoding = "UTF-16BE"), Y = new TextDecoder(O.expectedEncoding, { fatal: true }), yield Y.decode(I2, { stream: true });
2135
- }
2136
- yield Y.decode(W.subarray(v), { stream: true });
2137
- }
2138
- yield Y ? Y.decode() : new TextDecoder("UTF-8", { fatal: true }).decode(I2.subarray(0, M));
2139
- }
2140
- let C2 = 0;
2141
- return Zi(U(), O, async (I2) => {
2142
- g2(I2), I2 && ++C2 % 64 === 0 && await new Promise((M) => setTimeout(M, 0));
2143
- });
2144
- }
2145
- async function P(u2, b) {
2146
- let O = new Uint8Array(b), U = 0;
2147
- for await (let C2 of R(u2)) {
2148
- let I2 = Math.min(C2.length, b - U);
2149
- O.set(C2.subarray(0, I2), U), U += I2;
2150
- }
2151
- return O.subarray(0, U);
2152
- }
2153
- async function w(u2) {
2154
- return await i.has("mimetype") ? Oo.get(new TextDecoder().decode(await P("mimetype", 2048))) : await i.has("content.xml") && new TextDecoder().decode(await P("content.xml", 512)).includes(rn[0]) ? false : u2;
2155
- }
2156
- async function m(u2) {
2157
- let b = await i.has("encrypted-package"), O = b && await i.has("mimetype") ? await A("mimetype") : void 0;
2158
- if (b) {
2159
- let C2 = z(u2.children[0], "media-type", [Qe + "manifest:1.0"]);
2160
- (!O || C2 !== new TextDecoder().decode(O) || !["application/vnd.oasis.opendocument.spreadsheet", "application/vnd.oasis.opendocument.spreadsheet-template"].includes(C2)) && pe("inconsistent encrypted package media type");
2161
- }
2162
- let U = await Ma(u2, i, A, t, g2, e.maxTotalBytes - c, e.maxEntryBytes);
2163
- if (b) {
2164
- let C2 = U.get("encrypted-package");
2165
- (!C2 || U.size !== 1) && pe("missing encrypted package declaration"), c += C2.length;
2166
- let I2 = new Uint8Array(C2);
2167
- a.add(I2);
2168
- let M = e.maxMembers - d;
2169
- M < 1 && fe("ZIP members");
2170
- let Y = await o.readZipArchive(I2, { ...e, maxMembers: M, maxTotalBytes: e.maxTotalBytes - c }, t.signal);
2171
- for (let ne of Y.entries) for (let K of [ne.data, ne.rawName, ne.localName, ne.comment, ne.localExtra, ne.centralExtra]) K && a.add(K);
2172
- a.add(Y.comment);
2173
- let W = ei(Y.entries, t);
2174
- W.has("encrypted-package") && pe("nested encrypted package"), _ = W, p.clear(), L3.clear(), await i.has("mimetype") || pe("missing inner package media type");
2175
- let v = await A("mimetype");
2176
- (v.length !== O.length || !v.every((ne, K) => ne === O[K])) && pe("inconsistent encrypted package media type");
2177
- return;
2178
- }
2179
- for (let [C2, I2] of U) c += I2.length, p.set(C2, I2);
2180
- }
2181
- return { entries: i, read: A, document: y, version: w, charge: g2, retainText: s, decrypt: m, close: f };
2182
- } catch (a) {
2183
- throw await f(), a;
2184
- }
2185
- }
2186
- function li(n, t) {
2187
- if (t.signal.throwIfAborted(), n instanceof ZipStorageFailure) throw n.cause;
2188
- if (n instanceof SyntaxError && n.message === "Invalid XML: DTD and entity declarations are forbidden") throw new Le("capability-denied", "ssconvert host denies XML DTD and entity declarations");
2189
- if (n instanceof Le) throw n;
2190
- (n instanceof eo || n instanceof CodecError && n.code === "resource-limit") && fe("package"), pe(n instanceof Error ? n.message : "invalid package");
2191
- }
2192
- async function Gs(n, t) {
2193
- try {
2194
- let o = t.inputFilename?.toLowerCase(), e = o?.endsWith(".sxc") || o?.endsWith(".stc"), l2 = await ci(n, t);
2195
- try {
2196
- return await l2.version(e ? true : void 0) !== void 0;
2197
- } finally {
2198
- await l2.close();
2199
- }
2200
- } catch (o) {
2201
- return t.signal.throwIfAborted(), o instanceof CodecError && o.code === "invalid-package" || o instanceof Le && o.code === "io" ? false : li(o, t);
2202
- }
2203
- }
2204
- async function sa(n, t, o, e, l2) {
2205
- let _ = mo[t];
2206
- async function d(i, r, E) {
2207
- e();
2208
- let a = _.get(r + ":" + i.localName)?.find((S) => ot2[S[2]].includes(i.namespace));
2209
- if (!a) {
2210
- Object.values(ot2).some((S) => S.includes(i.namespace)) && await Hn(`Unexpected element '${i.name}' in state :
2211
- ${E.join(" -> ")}
2212
- `, o, "odf-unknown-element");
2213
- return;
2214
- }
2215
- if (l2?.has(i)) {
2216
- let S = { ...i, children: [], content: [], text: "" };
2217
- for await (let N of l2.content(i)) {
2218
- let g2 = N.kind === "element" ? await d(N, a[1], [...E, i.localName]) : N;
2219
- g2 && await l2.append(S, [g2]);
2220
- }
2221
- return S;
2222
- }
2223
- let c = [], T2 = /* @__PURE__ */ new Map();
2224
- for (let S of i.children) {
2225
- let N = await d(S, a[1], [...E, i.localName]);
2226
- N && (c.push(N), T2.set(S, N));
2227
- }
2228
- return { ...i, children: c, content: i.content.flatMap((S) => S.kind !== "element" ? [S] : T2.has(S) ? [T2.get(S)] : []) };
2229
- }
2230
- let f = await d(n, "START", []);
2231
- return f || pe(`unrecognized ${t} root`), f;
2232
- }
2233
- function da(n, t) {
2234
- let o = Ut(n, "p", sn);
2235
- if (!o.length) return;
2236
- function e(l2) {
2237
- let _ = "";
2238
- for (let d of l2.content) if (t(), d.kind === "text" || d.kind === "cdata") _ += d.text;
2239
- else if (d.kind === "element" && sn.includes(d.namespace)) if (d.localName === "s") {
2240
- let f = ut(z(d, "c", sn));
2241
- t(f), _ += " ".repeat(f);
2242
- } else d.localName === "tab" || d.localName === "tab-stop" ? _ += " " : d.localName === "line-break" ? _ += `
2243
- ` : ["span", "a"].includes(d.localName) && (_ += e(d));
2244
- return _;
2245
- }
2246
- return o.map(e).join(`
2247
- `);
2248
- }
2249
- function So(n, t) {
2250
- t(n.length);
2251
- let o = n[0] === "-", e = o ? 1 : 0;
2252
- if (n[e++] !== "P") return;
2253
- let l2 = false, _ = -1, d = 0, f = 0;
2254
- for (; e < n.length; ) {
2255
- if (n[e] === "T") {
2256
- if (l2 || ++e === n.length) return;
2257
- l2 = true;
2258
- continue;
2259
- }
2260
- let i = e;
2261
- for (; n[e] !== void 0 && n[e] >= "0" && n[e] <= "9"; ) e++;
2262
- if (i === e) return;
2263
- let r = n[e] === ".";
2264
- if (r) {
2265
- let T2 = ++e;
2266
- for (; n[e] !== void 0 && n[e] >= "0" && n[e] <= "9"; ) e++;
2267
- if (e === T2) return;
2268
- }
2269
- let E = Number(n.slice(i, e)), a = n[e++], c = "DHMS".indexOf(a ?? "?");
2270
- if (c <= _ || c < 0 || (l2 ? a === "D" : a !== "D") || r && a !== "S" || (_ = c, d++, f += E * [86400, 3600, 60, 1][c], !Number.isFinite(f))) return;
2271
- }
2272
- if (d) return f === 0 ? 0 : (o ? -f : f) / 86400;
2273
- }
2274
- function Ao(n, t, o, e) {
2275
- let l2 = t ? Tt : rn;
2276
- for (let d of n.attributes) if (l2.includes(d.namespace)) {
2277
- if (d.localName === "value") {
2278
- let f = Number(d.value);
2279
- if (Number.isFinite(f)) return { kind: "number", value: f };
2280
- }
2281
- if (d.localName === "boolean-value") return { kind: "boolean", value: d.value.toLowerCase() !== "false" && d.value !== "0" };
2282
- if (d.localName === "string-value") return { kind: "string", value: d.value };
2283
- if (d.localName === "date-value") {
2284
- let f = d.value.split("T"), i = f[0].split("-").map(Number);
2285
- if (i.length !== 3 || i.some((a) => !Number.isInteger(a))) continue;
2286
- let r = ro(i[0], i[1], i[2]);
2287
- if (r.getUTCFullYear() !== i[0] || r.getUTCMonth() + 1 !== i[1] || r.getUTCDate() !== i[2]) continue;
2288
- let E = 0;
2289
- if (f[1]) {
2290
- let a = f[1].split(":"), c = parseFloat(a[2] ?? ""), T2 = Number(a[0]), S = Number(a[1]);
2291
- a.length >= 3 && Number.isInteger(T2) && Number.isInteger(S) && Number.isFinite(c) && (E = (T2 + S / 60 + c / 3600) / 24);
2292
- }
2293
- return { kind: "number", value: oo(r, { book: { sheets: [], dateSystem: o } }) + E };
2294
- }
2295
- if (d.localName === "time-value") {
2296
- let f = So(d.value, e);
2297
- if (f !== void 0) return { kind: "number", value: f };
2298
- }
2299
- }
2300
- let _ = da(n, e);
2301
- return _ !== void 0 && (t || z(n, "value-type", rn) !== void 0) ? { kind: "string", value: _ } : void 0;
2302
- }
2303
- async function ti(n, t, o, e, l2, _) {
2304
- let d = t ? la : qt;
2305
- if (!t && n.startsWith("oooc:") ? (d = la, n = n.slice(5)) : !t && n.startsWith("of:") ? n = n.slice(3) : !t && n.startsWith("msoxl:") && (d = { ...ca, leftAssociativePower: true }, n = n.slice(6)), n === "=") return;
2306
- let f = on(n, { maximumDepth: e.limits.formulaDepth, grammar: d, position: o, workbook: l2, onWork: _, signal: e.signal, maximumLength: e.limits.workbookTextBytes ?? e.limits.inputBytes, maximumNodes: e.limits.workbookNodes ?? 1 / 0 });
2307
- if (!f.ok) {
2308
- await Hn(`${o.sheet}!${Yn(o.row, o.column)} : Unable to parse '${n}'
2309
- `, e);
2310
- return;
2311
- }
2312
- let i = false;
2313
- return no(f.document.root, (r) => {
2314
- r.kind === "reference" && (r.first.sheet && r.first.sheetRelative || r.last?.sheet && r.last.sheetRelative) && (i = true);
2315
- }), oi(f.document, i ? ao : { ...ca, quoteSheetName: io }, false, true);
2316
- }
2317
- function Xs(n, t) {
2318
- return t.createWorkingStorage ? No(n, t, true) : Promise.resolve(void 0);
2319
- }
2320
- async function No(n, t, o = false) {
2321
- let e, l2, _, d;
2322
- try {
2323
- d = await (async () => {
2324
- let i = await ci(n, t);
2325
- e = i.close;
2326
- let r = await i.version(true);
2327
- r === void 0 && pe("Unknown mimetype for openoffice file.");
2328
- let E = r, a = await i.entries.has("encrypted-package");
2329
- !a && !await i.entries.has("content.xml") && pe("No stream named content.xml found.");
2330
- let c = await i.entries.has("META-INF/manifest.xml") ? await i.document("META-INF/manifest.xml") : void 0;
2331
- a && !c && pe("missing encrypted package manifest"), c && ((c.localName !== "manifest" || ![Qe + "manifest:1.0", "http://openoffice.org/2001/manifest"].includes(c.namespace)) && pe("invalid manifest"), (a || c.children.some((J) => J.children.some((V2) => V2.localName === "encryption-data"))) && await i.decrypt(c)), a && (await i.entries.has("content.xml") || pe("No stream named content.xml found."), c = await i.entries.has("META-INF/manifest.xml") ? await i.document("META-INF/manifest.xml") : void 0, c && (c.localName !== "manifest" || c.namespace !== Qe + "manifest:1.0" || c.children.some((J) => J.children.some((V2) => V2.localName === "encryption-data"))) && pe("invalid inner package manifest")), t.createWorkingStorage && (l2 = La(t, Tt));
2332
- let T2 = await i.document("content.xml", l2?.streamElements), S = (J) => l2 ? l2.children(J) : J.children;
2333
- async function N(J) {
2334
- if (i.charge(), J.attributes.some((V2) => V2.localName === "formula") || ["named-expression", "named-range"].includes(J.localName)) return true;
2335
- for await (let V2 of S(J)) if (await N(V2)) return true;
2336
- return false;
2337
- }
2338
- o && await N(T2) && (o = false);
2339
- let g2 = o ? ga(t) : void 0, p = await sa(T2, E ? "ooo1_content_dtd" : "opendoc_content_dtd", t, i.charge, l2), L3 = [p];
2340
- await i.entries.has("styles.xml") && L3.unshift(await sa(await i.document("styles.xml"), "styles_dtd", t, i.charge));
2341
- let R = await sa(T2, E ? "ooo1_content_dtd" : "opendoc_content_dtd", t, i.charge, l2), A = Ut(R, "body", rn)[0], y = E ? A : Ut(A, "spreadsheet", rn)[0];
2342
- y || pe("missing spreadsheet body");
2343
- let P = Ut(y, "calculation-settings")[0], w = z(Ut(P, "null-date")[0], "date-value")?.startsWith("1904") ? "1904" : "1900", s = [], m = po(L3, i.charge), u2 = Fn(L3, i.charge);
2344
- for (let J of L3) for (let V2 of J.children) ["styles", "automatic-styles", "master-styles", "font-face-decls", "font-decls"].includes(V2.localName) && s.push(an(V2, { packagePart: J === p ? "content.xml" : "styles.xml" }));
2345
- c && s.push(an(c));
2346
- for (let J of ["meta.xml", "settings.xml"]) await i.entries.has(J) && s.push(an(await i.document(J)));
2347
- let b = /* @__PURE__ */ new Set();
2348
- async function O(J, V2 = "") {
2349
- for await (let se of S(J)) {
2350
- if (i.charge(), ot2.OO_NS_DRAW.includes(se.namespace) && ["image", "object", "object-ole"].includes(se.localName)) {
2351
- let be = z(se, "href", ["http://www.w3.org/1999/xlink"]);
2352
- if (be && !be.includes(":") && !be.startsWith("/") && !be.startsWith("#")) {
2353
- let ge;
2354
- try {
2355
- ge = decodeURIComponent(be);
2356
- } catch {
2357
- pe("invalid embedded resource URI");
2358
- }
2359
- (ge.includes("\\") || ge.includes(":")) && pe("invalid embedded resource path");
2360
- let Re = V2.split("/").filter(Boolean);
2361
- for (let Ee of ge.split("/")) Ee === ".." ? (Re.length || pe("embedded resource escapes package"), Re.pop()) : Ee && Ee !== "." && Re.push(Ee);
2362
- let ce = Re.join("/"), he = se.localName === "object" ? [ce + "/content.xml", ce + "/styles.xml"] : [ce];
2363
- for (let Ee of he) if (!b.has(Ee) && await i.entries.has(Ee)) if (b.add(Ee), Ee.endsWith(".xml") && se.localName === "object") {
2364
- let we = await i.document(Ee);
2365
- s.push({ source: "Gnumeric_OpenCalc:openoffice", kind: "embedded-document", disposition: "retained", data: { path: Ee, xml: hn(we) } }), await O(we, Ee.slice(0, Ee.lastIndexOf("/")));
2366
- } else {
2367
- let we = await i.read(Ee);
2368
- i.retainText(we.length * 2), i.charge(we.length);
2369
- let de = "";
2370
- for (let Ae of we) de += Ae.toString(16).padStart(2, "0");
2371
- s.push({ source: "Gnumeric_OpenCalc:openoffice", kind: "embedded-resource", disposition: "retained", data: { path: Ee, encoding: "hex", bytes: de } });
2372
- }
2373
- }
2374
- }
2375
- await O(se, V2);
2376
- }
2377
- }
2378
- await O(R);
2379
- let U = [], C2 = [], I2 = 0, M = 0, Y = [], W = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Set(), ne, K = Ut(y, "table");
2380
- K.length > t.limits.sheets && fe("sheets");
2381
- let G = K.map((J, V2) => (i.charge(), z(J, "name") ?? `Sheet${V2 + 1}`)), j = /* @__PURE__ */ new Set();
2382
- for (let [J, V2] of K.entries()) {
2383
- let rt2 = function(le, q = {}) {
2384
- ++M > (t.limits.workbookNodes ?? 1 / 0) && fe("metadata"), we.push(an(le, q));
2385
- }, ie = function(le, q, oe) {
2386
- let ae = q;
2387
- for (; ae < le && ae < oe; ) ae *= 2;
2388
- return Math.min(ae, oe);
2389
- };
2390
- var et = rt2, lt = ie;
2391
- i.charge();
2392
- let se = G[J];
2393
- j.has(se) && pe("duplicate sheet name"), j.add(se);
2394
- let be = se, ge = [], Re = [], ce = [], he = [], Ee = [], we = [], de = g2 ? { ordinal: J, rows: g2.axes.axis(), columns: g2.axes.axis() } : void 0;
2395
- de && g2.sheets.set(be, de);
2396
- let Ae = 0, Ot = 0, Ye = 0, tt = 0, mt = [], yt = m.resolve(z(V2, "style-name"), "table");
2397
- async function h(le, q, oe = 0) {
2398
- for await (let ae of S(le)) {
2399
- if (i.charge(), !Tt.includes(ae.namespace)) continue;
2400
- if (ae.localName === `table-${q}-group` || ae.localName === `table-header-${q}s` || ae.localName === `table-${q}s`) {
2401
- await h(ae, q, oe + (ae.localName.endsWith("-group") ? 1 : 0));
2402
- continue;
2403
- }
2404
- if (ae.localName !== `table-${q}`) continue;
2405
- let Be = ut(z(ae, `number-${q}s-repeated`)), $e = q === "row" ? Ae : Ot, cn = q === "row" ? me.rows : me.columns;
2406
- Be > cn - $e && fe(`${q} extent`);
2407
- let gt = m.resolve(z(ae, "style-name"), `table-${q}`), Yt = z(ae, "default-cell-style-name"), Ht = m.axisSize(z(ae, "style-name"), q), Jt = z(ae, "visibility") !== void 0 && z(ae, "visibility") !== "visible";
2408
- if (Ht !== void 0 || Jt || oe || gt) {
2409
- Be > (t.limits.workbookNodes ?? 1 / 0) - M && fe("axis metadata");
2410
- for (let re = 0; re < Be; re++) {
2411
- i.charge(), M++, re > 0 && re % 1024 === 0 && (await new Promise((nt2) => setTimeout(nt2, 0)), i.charge());
2412
- let Fe = { index: $e + re, ...Ht === void 0 ? {} : { sizePoints: Ht }, ...Jt ? { hidden: Jt } : {}, ...oe ? { outlineLevel: oe } : {}, ...gt ? { style: gt.style } : {} };
2413
- de ? await (q === "row" ? de.rows : de.columns).add(Fe) : (q === "row" ? Re : ce).push(Fe);
2414
- }
2415
- }
2416
- if (q === "column") {
2417
- Yt && mt.push({ start: $e, end: $e + Be, name: Yt }), Ot += Be;
2418
- continue;
2419
- }
2420
- let Ce = 0;
2421
- for await (let re of S(ae)) {
2422
- if (i.charge(), !Tt.includes(re.namespace) || !["table-cell", "covered-table-cell"].includes(re.localName)) continue;
2423
- let Fe = ut(z(re, "number-columns-repeated"));
2424
- if (Fe > me.columns - Ce && fe("column extent"), re.localName === "covered-table-cell") {
2425
- Ce += Fe;
2426
- continue;
2427
- }
2428
- let nt2 = z(re, "formula"), xe = Ao(re, E, w, i.charge), Je = nt2 && !["=", "of:=", "oooc:="].includes(nt2) ? nt2 : void 0, wt = re.attributes.findIndex((F) => F.localName === "error-value" && ot2.OO_GNUM_NS_EXT.includes(F.namespace)), Ln = re.attributes.findIndex((F) => F.localName === "formula" && Tt.includes(F.namespace));
2429
- if (Je && wt >= 0 && wt < Ln) {
2430
- let F = Je.startsWith("msoxl:"), k = on(F ? Je.slice(6) : Je, { maximumDepth: t.limits.formulaDepth, grammar: F ? ca : E ? la : qt, position: { sheet: be, row: Ae, column: Ce }, signal: t.signal, maximumLength: t.limits.workbookTextBytes ?? t.limits.inputBytes, maximumNodes: t.limits.workbookNodes ?? 1 / 0 });
2431
- k.ok && k.document.root.kind === "literal" && k.document.root.value.kind === "error" && (xe = k.document.root.value, Je = void 0);
2432
- }
2433
- let ln = nt2 === "=" || nt2 === "of:=" || nt2 === "oooc:=", je = re.attributes.some((F) => (E ? Tt : rn).includes(F.namespace) && ["value", "boolean-value", "string-value", "date-value", "time-value"].includes(F.localName));
2434
- if (ln) {
2435
- let F = { kind: "error", value: da(re, i.charge) ?? "#VALUE!" };
2436
- if (ne) {
2437
- let k = ne.cells.findIndex((X) => X.row === ne.row && X.column === ne.column);
2438
- k >= 0 && (ne.cells[k] = { ...ne.cells[k], value: F }), je || (xe = void 0);
2439
- } else xe = F, ne = { cells: ge, row: Ae, column: Ce };
2440
- } else !Je && !je && xe?.kind === "string" && (ne = { cells: ge, row: Ae, column: Ce });
2441
- let dn = z(re, "style-name") ?? Yt ?? mt.find((F) => Ce >= F.start && Ce < F.end)?.name, kt = m.resolve(dn) ?? m.defaultCell, Gt = z(re, "columns-spanned-fake", ot2.OO_GNUM_NS_EXT) === "true" ? 1 : ut(z(re, "number-columns-spanned")), Ct = ut(z(re, "number-rows-spanned"));
2442
- (Gt > me.columns - Ce || Ct > me.rows - Ae) && fe("merge extent"), (Gt > 1 || Ct > 1) && (he.push({ startRow: Ae, startColumn: Ce, endRow: Ae + Ct - 1, endColumn: Ce + Gt - 1 }), Ye = Math.max(Ye, Ae + Ct), tt = Math.max(tt, Ce + Gt));
2443
- let It = ut(z(re, "number-matrix-columns-spanned"), 0), Mt = ut(z(re, "number-matrix-rows-spanned"), 0), yn = z(re, "content-validation-name"), D2 = xe?.kind === "string" ? u2(re) : void 0, H = xe?.kind === "string" && D2?.value === xe.value ? D2.richText : void 0;
2444
- for (let F of re.children) if (F.namespace !== sn[0] && F.namespace !== sn[1] || F.localName !== "p") {
2445
- let k = F.localName === "annotation" && ot2.OO_NS_OFFICE.includes(F.namespace) ? qn(F, u2) : void 0;
2446
- rt2(F, { row: Ae, column: Ce, ...k ? { sourceComment: JSON.stringify([k.Author ?? null, k.Text, k.TextFormat ?? null]) } : {} });
2447
- }
2448
- let ee = Ut(re, "p", sn);
2449
- if (ee.some((F) => F.children.length || F.attributes.some((k) => k.namespace !== "http://www.w3.org/2000/xmlns/"))) for (let F of ee) rt2(F, { row: Ae, column: Ce, rows: Be, columns: Fe, sourceText: D2?.value ?? da(re, i.charge) ?? "", sourceRichText: (H ?? []).map((k) => ({ start: k.start, end: k.end, attributes: k.attributes })) });
2450
- if (yn && rt2(re, { row: Ae, column: Ce, rows: Be, columns: Fe, validation: yn }), xe || Je) {
2451
- let F = Be * Fe;
2452
- (!Number.isSafeInteger(F) || F > t.limits.cells - I2) && fe("cells"), I2 += F;
2453
- for (let k = 0; k < Be; k++) for (let X = 0; X < Fe; X++) {
2454
- i.charge();
2455
- let Te = k === 0 && X === 0;
2456
- k * Fe + X > 0 && (k * Fe + X) % 1024 === 0 && (await new Promise((Ve) => setTimeout(Ve, 0)), i.charge());
2457
- let He = z(re, "style-name") ?? Yt ?? mt.find((Ve) => Ce + X >= Ve.start && Ce + X < Ve.end)?.name, te = X === 0 ? kt : m.resolve(He) ?? m.defaultCell, We = { row: Ae + k, column: Ce + X, value: xe ?? { kind: "blank" }, ...Te && Je ? { formula: Je, formulaDirty: true, ...xe === void 0 ? {} : { cachedResult: xe } } : {}, ...H?.length ? { richText: H } : {}, ...te?.format ? { format: te.format } : {}, ...te ? { style: te.style } : {} };
2458
- g2 ? await g2.cells.append(J, We) : ge.push(We);
2459
- }
2460
- Ye = Math.max(Ye, Ae + Be), tt = Math.max(tt, Ce + Fe);
2461
- } else kt && rt2(re, { row: Ae, column: Ce, rows: Be, columns: Fe, styleName: dn ?? "" });
2462
- if (Je) {
2463
- let F = { sheet: be, row: Ae, column: Ce };
2464
- Y.push(async (k) => {
2465
- i.charge();
2466
- let X = await ti(Je, E, F, t, k, i.charge), Te = W.get(be), He = Te.get(`${F.row}:${F.column}`);
2467
- if (X) {
2468
- let te;
2469
- if (It || Mt) {
2470
- let We = It || 1, Ve = Mt || 1;
2471
- (!It || !Mt) && await Hn(`${be}!${Yn(F.row, F.column)} : Invalid array expression does not specify number of ${It ? "rows" : "columns"}.
2472
- `, t), (We > me.columns - F.column || Ve > me.rows - F.row) && fe("array extent"), te = `array-${F.row}-${F.column}`, Ee.push({ id: te, kind: "array", expression: X, range: { startRow: F.row, startColumn: F.column, endRow: F.row + Ve - 1, endColumn: F.column + We - 1 } });
2473
- }
2474
- ge[He] = { ...ge[He], formula: X, ...te ? { formulaGroup: te } : {} };
2475
- } else if (++M > (t.limits.workbookNodes ?? 1 / 0) && fe("metadata"), we.push({ source: "Gnumeric_OpenCalc:openoffice", kind: "unparsed-formula", disposition: "retained", data: { row: F.row, column: F.column, formula: nt2, rows: Be, columns: Fe } }), xe !== void 0) {
2476
- let { formula: te, formulaDirty: We, cachedResult: Ve, ...gn } = ge[He];
2477
- ge[He] = gn;
2478
- } else {
2479
- for (let te = 0; te < Be; te++) for (let We = 0; We < Fe; We++) {
2480
- i.charge();
2481
- let Ve = Te.get(`${F.row + te}:${F.column + We}`);
2482
- v.add(ge[Ve]), I2--;
2483
- }
2484
- kt && rt2(re, { row: F.row, column: F.column, rows: Be, columns: Fe, styleName: dn ?? "" });
2485
- }
2486
- });
2487
- }
2488
- Ce += Fe;
2489
- }
2490
- Ae += Be;
2491
- }
2492
- }
2493
- await h(V2, "column"), await h(V2, "row");
2494
- let B = [...await xa(V2, i.charge, L3, G, u2, S), ...Ua(y, se, i.charge)];
2495
- B.length > (t.limits.workbookNodes ?? 1 / 0) - M && fe("metadata"), M += B.length, we.push(...B);
2496
- for await (let le of S(V2)) ["table-column", "table-row", "table-column-group", "table-row-group", "table-header-rows", "table-header-columns", "table-columns", "table-rows", "named-expressions"].includes(le.localName) || rt2(le);
2497
- z(V2, "print-ranges") && rt2(l2 ? await l2.materialize(V2) : V2, { printRanges: z(V2, "print-ranges") });
2498
- let x = Rt(yt?.style.odf).find((le) => qe(le)?.name === "table-properties" && qe(le)?.namespace === Lt.style), Z = Kt(x, Lt.gnm), _e = { RTL_Layout: Kt(x, Lt.style)["writing-mode"] === "rl-tb" ? "1" : "0" };
2499
- for (let [le, q, oe] of [["display-formulas", "DisplayFormulas", false], ["display-col-header", "HideColHeader", true], ["display-row-header", "HideRowHeader", true]]) Z[le] !== void 0 && (_e[q] = Z[le] === "true" !== oe ? "1" : "0");
2500
- U.push({ id: be, name: se, cells: ge.sort((le, q) => le.row - q.row || le.column - q.column), size: { rows: ie(Math.max(Ye, (de?.rows.maximum ?? Re.at(-1)?.index ?? -1) + 1), Un.rows, me.rows), columns: ie(Math.max(tt, (de?.columns.maximum ?? ce.at(-1)?.index ?? -1) + 1), Un.columns, me.columns) }, ...yt?.display === "false" ? { visibility: "hidden" } : {}, rows: Re, columns: ce, merges: he, formulaGroups: Ee, unsupportedRecords: we }), yt && (U[U.length - 1] = { ...U[U.length - 1], view: { odf: yt.style.odf ?? null, gnumeric: _e } });
2501
- }
2502
- async function ue(J, V2) {
2503
- for await (let se of S(J)) if (se.localName === "named-expressions" && Tt.includes(se.namespace)) for (let be of se.children) {
2504
- i.charge();
2505
- let ge = z(be, "name");
2506
- if (!ge) continue;
2507
- let Re = z(be, "expression") ?? (z(be, "cell-range-address") ? "=[" + z(be, "cell-range-address") + "]" : void 0);
2508
- if (!Re) continue;
2509
- let ce = V2 ?? U[0]?.id ?? (K[0] ? z(K[0], "name") : void 0) ?? "Sheet1", he = z(be, "base-cell-address"), Ee = he ? on("=[" + he + "]", { maximumDepth: t.limits.formulaDepth, grammar: qt, position: { sheet: ce, row: 0, column: 0 }, signal: t.signal, maximumLength: t.limits.workbookTextBytes ?? t.limits.inputBytes, maximumNodes: t.limits.workbookNodes ?? 1 / 0 }) : void 0, we = Ee?.ok && Ee.document.root.kind === "reference" && !Ee.document.root.last ? Ee.document.root.first : void 0, de = we?.sheet;
2510
- de !== void 0 && i.charge(de.length);
2511
- let Ae = de === void 0 ? void 0 : Ja(de), Ye = { sheet: Ae === void 0 ? ce : U.find((mt) => (i.charge(1 + mt.name.length), Ja(mt.name) === Ae))?.id ?? de, row: we?.row?.value ?? 0, column: we?.column?.value ?? 0 }, tt = await ti(Re, E, Ye, t, Q, i.charge);
2512
- tt && C2.push({ name: ge, expression: tt, ...V2 ? { sheet: V2 } : {}, position: Ye });
2513
- }
2514
- }
2515
- for (let J of y.children) ["table", "named-expressions", "calculation-settings", "label-ranges"].includes(J.localName) || s.push(an(J));
2516
- P && s.push(an(P)), U.length || pe("no sheets");
2517
- let ve = Ut(P, "iteration")[0], ze = Number(z(ve, "steps") ?? "100");
2518
- (!Number.isSafeInteger(ze) || ze < 0) && pe("invalid iteration count");
2519
- let ye = z(P, "automatic-find-labels");
2520
- ye !== void 0 && !["true", "false"].includes(ye) && pe("invalid automatic label lookup setting");
2521
- let Q = { sheets: Ha(y, U, t, i.charge), names: C2, dateSystem: w, automaticLabelLookup: ye !== "false", calculationMode: "automatic", unsupportedRecords: s, ...ve ? { iteration: { enabled: z(ve, "status") === "enable", maximum: ze, tolerance: Number(z(ve, "maximum-difference") ?? "0.001") } } : {} };
2522
- if (g2) return g2.workbook(Q);
2523
- for (let J of Q.sheets) W.set(J.id, new Map(J.cells.map((V2, se) => (i.charge(), [`${V2.row}:${V2.column}`, se]))));
2524
- for (let [J, V2] of Y.entries()) J % 128 === 0 && (await new Promise((se) => setTimeout(se, 0)), i.charge()), await V2(Q);
2525
- for (let [J, V2] of K.entries()) await ue(V2, U[J].id);
2526
- await ue(y);
2527
- let Ue = [];
2528
- for (let J of Q.sheets) {
2529
- let V2 = [], se = J.formulaGroups ?? [];
2530
- for (let [Re, ce] of J.cells.entries()) Re > 0 && Re % 1024 === 0 && await new Promise((he) => setTimeout(he, 0)), i.charge(), v.has(ce) || V2.push(ce);
2531
- if (se.length) {
2532
- let Re = new Map(V2.map((ce, he) => [`${ce.row}:${ce.column}`, he]));
2533
- for (let ce of se) {
2534
- let he = (ce.range.endRow - ce.range.startRow + 1) * (ce.range.endColumn - ce.range.startColumn + 1);
2535
- i.charge(he);
2536
- let Ee = 0;
2537
- for (let we = ce.range.startRow; we <= ce.range.endRow; we++) for (let de = ce.range.startColumn; de <= ce.range.endColumn; de++) {
2538
- ++Ee % 1024 === 0 && (await new Promise((Ye) => setTimeout(Ye, 0)), i.charge());
2539
- let Ae = `${we}:${de}`, Ot = Re.get(Ae);
2540
- if (Ot === void 0) I2 >= t.limits.cells && fe("cells"), I2++, Re.set(Ae, V2.length), V2.push({ row: we, column: de, value: { kind: "blank" }, formulaGroup: ce.id });
2541
- else {
2542
- let Ye = V2[Ot];
2543
- V2[Ot] = { ...Ye, formulaGroup: ce.id, ...Ye.value.kind === "blank" ? {} : { cachedResult: Ye.value } };
2544
- }
2545
- }
2546
- }
2547
- }
2548
- let be = J.size.rows, ge = J.size.columns;
2549
- for (let Re of se) {
2550
- for (; be <= Re.range.endRow; ) be = Math.min(be * 2, me.rows);
2551
- for (; ge <= Re.range.endColumn; ) ge = Math.min(ge * 2, me.columns);
2552
- }
2553
- Ue.push({ ...J, cells: V2.sort((Re, ce) => Re.row - ce.row || Re.column - ce.column), size: { rows: be, columns: ge } });
2554
- }
2555
- return { ...Q, sheets: Ue };
2556
- })();
2557
- } catch (i) {
2558
- try {
2559
- li(i, t);
2560
- } catch (r) {
2561
- _ = { error: r };
2562
- }
2563
- }
2564
- let f = [];
2565
- try {
2566
- await l2?.close();
2567
- } catch (i) {
2568
- f.push(i);
2569
- }
2570
- try {
2571
- await e?.();
2572
- } catch (i) {
2573
- f.push(i);
2574
- }
2575
- if (f.length) throw _ ? new AggregateError([_.error, ...f], "ODF read and cleanup failed") : f.length === 1 ? f[0] : new AggregateError(f, "ODF cleanup failed");
2576
- if (_) throw _.error;
2577
- return d;
2578
- }
2579
- function po(n, t) {
2580
- let o = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Map(), l2;
2581
- for (let i of n) for (let r of i.children) if (["styles", "automatic-styles"].includes(r.localName)) for (let E of r.children) {
2582
- t();
2583
- let a = z(E, "name", ct), c = z(E, "family", ct);
2584
- ct.includes(E.namespace) && E.localName === "style" && a && c && o.set(c + ":" + a, E), ct.includes(E.namespace) && E.localName === "default-style" && z(E, "family", ct) === "table-cell" && (l2 = E), ht.includes(E.namespace) && a && e.set(a, bo(E, t));
2585
- }
2586
- let _ = /* @__PURE__ */ new Map();
2587
- function d(i, r = "table-cell", E = /* @__PURE__ */ new Set()) {
2588
- if (!i) return;
2589
- let a = r + ":" + i, c = _.get(a);
2590
- if (c) return c;
2591
- let T2 = o.get(a);
2592
- if (!T2) return;
2593
- t(), E.has(a) && pe("cyclic style inheritance");
2594
- let S = new Set(E);
2595
- S.add(a);
2596
- let N = d(z(T2, "parent-style-name", ct), r, S), g2 = e.get(z(T2, "data-style-name", ct) ?? "") ?? N?.format, p = T2.children.map((R) => z(R, "display", Tt)).find((R) => R !== void 0) ?? N?.display, L3 = { ...g2 ? { format: g2 } : {}, style: { ...N?.style, odf: hn(T2), gnumeric: Jn(T2, N?.style.gnumeric, t) }, ...p ? { display: p } : {} };
2597
- return _.set(a, L3), L3;
2598
- }
2599
- function f(i, r) {
2600
- let E = `table-${r}`, a = i ? o.get(E + ":" + i) : void 0, c = /* @__PURE__ */ new Set();
2601
- for (; a; ) {
2602
- t(), c.has(a) && pe("cyclic axis style inheritance"), c.add(a);
2603
- let T2 = a.children.find((g2) => ct.includes(g2.namespace) && ["properties", `table-${r}-properties`].includes(g2.localName)), S = z(T2, r === "row" ? "row-height" : "column-width", ct);
2604
- if (S) {
2605
- let g2 = { cm: 28.346456692913385, mm: 2.834645669291339, in: 72, pt: 1, pc: 12 }, p = S.slice(-2), L3 = Number(S.slice(0, -2)), R = g2[p];
2606
- if (R && Number.isFinite(L3) && L3 >= 0) return L3 * R;
2607
- }
2608
- let N = z(a, "parent-style-name", ct);
2609
- a = N ? o.get(E + ":" + N) : void 0;
2610
- }
2611
- }
2612
- return { resolve: d, axisSize: f, defaultCell: l2 ? { style: { odf: hn(l2), gnumeric: Jn(l2, void 0, t) }, format: e.get(z(l2, "data-style-name", ct) ?? "") } : void 0 };
2613
- }
2614
- function bo(n, t) {
2615
- let o = "";
2616
- for (let e of n.children) {
2617
- if (t(), !ht.includes(e.namespace)) continue;
2618
- let l2 = z(e, "style", ht) === "long";
2619
- if (e.localName === "text" || e.localName === "currency-symbol") o += '"' + e.text.split('"').join('""') + '"';
2620
- else if (e.localName === "number" || e.localName === "scientific-number") {
2621
- let _ = ut(z(e, "decimal-places", ht), 0), d = ut(z(e, "min-integer-digits", ht), 1);
2622
- if (t(_ + d), o += (z(e, "grouping", ht) === "true" ? "#,##" : "") + "0".repeat(d) + (_ ? "." + "0".repeat(_) : ""), e.localName === "scientific-number") {
2623
- let f = ut(z(e, "min-exponent-digits", ht), 2);
2624
- t(f), o += "E+" + "0".repeat(f);
2625
- }
2626
- } else e.localName === "day" ? o += l2 ? "dd" : "d" : e.localName === "month" ? o += z(e, "textual", ht) === "true" ? l2 ? "mmmm" : "mmm" : l2 ? "mm" : "m" : e.localName === "year" ? o += l2 ? "yyyy" : "yy" : e.localName === "day-of-week" ? o += l2 ? "dddd" : "ddd" : e.localName === "hours" ? o += z(n, "truncate-on-overflow", ht) === "false" ? "[h]" : l2 ? "hh" : "h" : e.localName === "minutes" ? o += l2 ? "mm" : "m" : e.localName === "seconds" ? o += l2 ? "ss" : "s" : e.localName === "am-pm" ? o += "AM/PM" : e.localName === "text-content" && (o += "@");
2627
- }
2628
- return o || "General";
2629
- }
2630
- function ni(n) {
2631
- let t = String(n), o = t.indexOf("e");
2632
- if (o < 0) return t;
2633
- let e = t.slice(0, o), l2 = e.indexOf("."), _ = e.replace(".", ""), d = (l2 < 0 ? e.length : l2) + Number(t.slice(o + 1));
2634
- return d <= 0 ? "0." + "0".repeat(-d) + _ : d >= _.length ? _ + "0".repeat(d - _.length) : _.slice(0, d) + "." + _.slice(d);
2635
- }
2636
- async function xn(n) {
2637
- let t = [], o = 0;
2638
- try {
2639
- for await (let _ of n) t.push(_.slice()), o += _.length;
2640
- let e = new Uint8Array(o), l2 = 0;
2641
- for (let _ of t) e.set(_, l2), l2 += _.length;
2642
- return e;
2643
- } finally {
2644
- for (let e of t) e.fill(0);
2645
- }
2646
- }
2647
- function vs(n) {
2648
- let t = Ro(n);
2649
- return (o, e, l2) => xn(t(o, e, l2));
2650
- }
2651
- function Ro(n) {
2652
- return async function* (t, o, e) {
2653
- let l2, _, d = [], f, i = false, r, E, a = [], c = new Uint8Array(16384), T2 = () => (i = true, r ??= Promise.resolve().then(async () => {
2654
- await _?.close(), await l2?.close();
2655
- }));
2656
- e.own(T2);
2657
- try {
2658
- let M = function(h) {
2659
- h > e.limits.outputBytes - I2 && fe("output bytes"), I2 += h;
2660
- }, K = function(h, B) {
2661
- if (s.charge(), !Number.isSafeInteger(h) || h < 0 || h >= B) throw new Le("invalid-request", "Invalid OpenDocument cell coordinate");
2662
- }, G = function(h) {
2663
- if (K(h.startRow, me.rows), K(h.endRow, me.rows), K(h.startColumn, me.columns), K(h.endColumn, me.columns), h.startRow > h.endRow || h.startColumn > h.endColumn) throw new Le("invalid-request", "Invalid OpenDocument range");
2664
- }, j = function(h, B, x, Z) {
2665
- s.charge(h.length);
2666
- let _e = b.documents.get(JSON.stringify([B.id, x, Z, h])), ie = _e ? { ok: true, document: _e } : on(h, { maximumDepth: e.limits.formulaDepth, position: { sheet: B.id, row: x, column: Z }, workbook: O, signal: e.signal, onWork: s.charge, maximumLength: e.limits.workbookTextBytes ?? e.limits.outputBytes, maximumNodes: e.limits.workbookNodes ?? 1 / 0 });
2667
- if (!ie.ok) throw new Le("unsupported-feature", "Unsupported ssconvert feature: invalid OpenDocument formula");
2668
- let le = { ...qt.functionExportAliases, ...ja };
2669
- function q(oe) {
2670
- s.charge(), oe.kind === "call" ? (Object.hasOwn(le, oe.name) || (le[oe.name] = oe.name.startsWith("ODF.") ? oe.name.slice(4) : "ORG.GNUMERIC." + oe.name), oe.args.forEach(q)) : oe.kind === "array" ? oe.rows.forEach((ae) => ae.forEach(q)) : oe.kind === "binary" ? (q(oe.left), q(oe.right)) : (oe.kind === "unary" || oe.kind === "parentheses") && q(oe.child);
2671
- }
2672
- return q(ie.document.root), oi(ie.document, { ...qt, functionExportAliases: le }, false, true, { quotedLabel(oe) {
2673
- let ae = to(O, oe, ie.document.position, s.charge);
2674
- return s.charge(ae.length), ae;
2675
- } });
2676
- }, ye = function(h) {
2677
- return h !== null && typeof h == "object" && !Object.isFrozen(h) ? $i(h, e.limits) : h;
2678
- }, we = function(h) {
2679
- let B = ye(Rt(h));
2680
- return (async function* () {
2681
- for (let x of B) yield* s.retainedFragments(x);
2682
- })();
2683
- }, de = function(h, B) {
2684
- he.set(h, typeof B == "string" && (!l2 || y) ? Ee.encode(B) : B);
2685
- };
2686
- var S = M, N = K, g2 = G, p = j, L3 = ye, R = we, A = de;
2687
- e.signal.throwIfAborted();
2688
- let y;
2689
- for (let h of o) for (let [B, x] of Eo(h)) if (B === "encryption" && (y = ka.get(x), y === void 0)) throw new Le("invalid-request", "Invalid OpenDocument encryption profile");
2690
- let P = y?.cipher === "aes-gcm", w = n === "extended", s = co(e, w), m = s.element, u2 = "metadata" in t ? await ji(t, e.limits, () => e.signal.throwIfAborted(), e.createWorkingStorage?.bind(e)) : void 0, b = Da(u2?.metadata ?? t, e, s.charge), O = b.book;
2691
- if (O.sheets.some((h) => !Object.isFrozen(h.cells))) {
2692
- let h = 0;
2693
- O = { ...O, sheets: O.sheets.map((B) => {
2694
- if (Object.isFrozen(B.cells)) return h += B.cells.length, h > e.limits.cells && fe("cells"), B;
2695
- let x = [];
2696
- for (let Z of B.cells) ++h > e.limits.cells && fe("cells"), x.push(Z);
2697
- return { ...B, cells: Object.freeze(x) };
2698
- }) };
2699
- }
2700
- let U = createZipCodec(), C2 = { ...ri(e), maxArchiveBytes: e.limits.outputBytes, maxEntryBytes: e.limits.outputBytes, maxTotalBytes: e.limits.outputBytes };
2701
- if (i) throw new Le("invalid-request", "ODF writer is closed");
2702
- if (l2 = e.createWorkingStorage?.(), i) throw new Le("invalid-request", "ODF writer is closed");
2703
- _ = zi(l2, e.signal);
2704
- let I2 = 0;
2705
- f = await va(s, w, O, e, l2, M);
2706
- let Y = u2 ? /* @__PURE__ */ new Map() : void 0, W = 0;
2707
- if (u2) for (let h of O.sheets) {
2708
- let B = 0;
2709
- for await (let x of u2.cells(h.id)) ++W > e.limits.cells && fe("cells"), await f.reserve(x), B++;
2710
- Y.set(h.id, B);
2711
- }
2712
- let v = 0;
2713
- (!O.sheets.length || O.sheets.length > e.limits.sheets) && fe("sheets");
2714
- let ne = O.sheets.map((h) => (s.charge(h.name.length), h.name));
2715
- async function* ue(h) {
2716
- async function* B() {
2717
- for (let x of O.names ?? []) {
2718
- if (s.charge(), x.sheet !== h) continue;
2719
- let Z = O.sheets.find((Be) => Be.id === (x.position?.sheet ?? h) || Be.name === (x.position?.sheet ?? h)) ?? O.sheets[0], _e = x.position?.row ?? 0, ie = x.position?.column ?? 0;
2720
- K(_e, me.rows), K(ie, me.columns);
2721
- let le = j(x.expression, Z, _e, ie), q = Yn(_e, ie), oe = Qa(Z.name, "'", qt) + ".$" + q.slice(0, q.length - String(_e + 1).length) + "$" + (_e + 1), ae = on(x.expression, { maximumDepth: e.limits.formulaDepth, position: { sheet: Z.id, row: _e, column: ie }, workbook: O, signal: e.signal, onWork: s.charge, maximumLength: e.limits.workbookTextBytes ?? e.limits.outputBytes, maximumNodes: e.limits.workbookNodes ?? 1 / 0 });
2722
- yield ae.ok && ae.document.root.kind === "reference" && !ae.document.root.label ? m("table:named-range", { "table:name": x.name, "table:cell-range-address": le.slice(5, -1), "table:base-cell-address": oe }) : m("table:named-expression", { "table:name": x.name, "table:expression": le, "table:base-cell-address": oe });
2723
- }
2724
- }
2725
- yield* s.stream("table:named-expressions", {}, B());
2726
- }
2727
- let ve = O.iteration, ze = m("table:calculation-settings", { "table:null-year": 1930, "table:automatic-find-labels": String(O.automaticLabelLookup ?? false), "table:case-sensitive": "false", "table:precision-as-shown": "false", "table:search-criteria-must-apply-to-whole-cell": "true", "table:use-regular-expressions": "false", "table:use-wildcards": "false" }, m("table:null-date", { "table:date-value": O.dateSystem === "1904" ? "1904-1-1" : "1899-12-30", "table:value-type": "date" }) + m("table:iteration", { "table:status": ve?.enabled ? "enable" : "disable", "table:steps": ve?.maximum ?? 100, "table:maximum-difference": ve?.tolerance ?? 1e-3 })), Q = await $a(O, s, e, l2, M), Ue = Mn(e, l2, M);
2728
- d.push(Ue);
2729
- let et = Mn(e, l2, M);
2730
- d.push(et);
2731
- let lt = Mn(e, l2, M);
2732
- d.push(lt);
2733
- for (let h of O.unsupportedRecords ?? []) {
2734
- s.charge();
2735
- let B = qe(h.data), x = qe(B?.xml);
2736
- if (h.source === "Gnumeric_OpenCalc:openoffice" && x) if (h.kind === "content-validations") for (let Z of Rt(x)) await et.append(s.retainedFragments(ye(Z)));
2737
- else h.kind === "database-ranges" && await lt.append(s.retainedFragments(ye(x)));
2738
- }
2739
- async function* J() {
2740
- for (let [B, x] of O.sheets.entries()) {
2741
- let Yt = function(D2) {
2742
- if (K(D2.row, me.rows), K(D2.column, me.columns), ++v > e.limits.cells && fe("cells"), Y && gt >= Y.get(x.id)) throw new Le("invalid-request", "ODF source coordinates changed during replay");
2743
- return gt++, cn(D2.row, D2.column);
2744
- };
2745
- var h = Yt;
2746
- s.charge();
2747
- let Z = qe(x.view?.gnumeric) ?? {}, _e = Rt(x.view?.odf).find((D2) => qe(D2)?.name === "table-properties"), ie = Kt(_e, Lt.gnm), le = Wa((x.unsupportedRecords ?? []).filter((D2) => D2.kind === "PrintInformation").flatMap((D2) => D2.data ? [D2.data] : []), s, w), q = await Q.register("stylesAutomatic", "style:page-layout", "pl" + B, {}, m("style:page-layout-properties", le)), oe = await Q.register("masters", "style:master-page", "mp" + B, { "style:page-layout-name": q }), ae = await Q.register("contentAutomatic", "style:style", "ta" + B, { "style:family": "table", "style:master-page-name": oe }, m("style:table-properties", { "table:display": x.visibility && x.visibility !== "visible" ? "false" : "true", "style:writing-mode": Number(Z.RTL_Layout ?? 0) ? "rl-tb" : "lr-tb", ...w ? { "gnm:display-formulas": String(!!Number(Z.DisplayFormulas ?? 0)), "gnm:display-col-header": String(!Number(Z.HideColHeader ?? 0)), "gnm:display-row-header": String(!Number(Z.HideRowHeader ?? 0)), "gnm:tab-color": ie["tab-color"], "gnm:tab-text-color": ie["tab-text-color"] } : {} })), Be = x.cells, $e = l2 ? new qa(l2, 128) : /* @__PURE__ */ new Map(), cn = (D2, H) => BigInt(D2) << 14n | BigInt(H), gt = 0;
2748
- for await (let D2 of u2?.cells(x.id) ?? Be) {
2749
- let H = Yt(D2);
2750
- await $e.set(H, BigInt(gt));
2751
- }
2752
- if (Y && gt !== Y.get(x.id)) throw new Le("invalid-request", "ODF source coordinates changed during replay");
2753
- async function Ht(D2, H) {
2754
- let ee = cn(D2, H);
2755
- await $e.get(ee) === void 0 && (++v > e.limits.cells && fe("cells"), await $e.set(ee, 0n));
2756
- }
2757
- async function* Jt() {
2758
- let D2 = $e instanceof Map ? [...$e].sort(([F], [k]) => F < k ? -1 : F > k ? 1 : 0) : $e.entries(), H = u2?.cells(x.id)[Symbol.asyncIterator](), ee = 0;
2759
- try {
2760
- for await (let [F, k] of D2) if (e.signal.throwIfAborted(), k === 0n) yield { row: Number(F >> 14n), column: Number(F & 0x3fffn), value: { kind: "blank" } };
2761
- else if (H) {
2762
- let X = await H.next();
2763
- if (X.done || k !== BigInt(++ee) || cn(X.value.row, X.value.column) !== F) throw new Le("invalid-request", "ODF source coordinates changed during replay");
2764
- yield X.value;
2765
- } else yield Be[Number(k - 1n)];
2766
- if (H && !(await H.next()).done) throw new Le("invalid-request", "ODF source coordinates changed during replay");
2767
- } finally {
2768
- await H?.return?.();
2769
- }
2770
- }
2771
- let Ce = /* @__PURE__ */ new Map(), re = /* @__PURE__ */ new Map(), Fe = /* @__PURE__ */ new Map(), nt2 = /* @__PURE__ */ new Map(), xe = [], Je = /* @__PURE__ */ new Map();
2772
- for (let D2 of x.unsupportedRecords ?? []) {
2773
- s.charge();
2774
- let H = qe(D2.data), ee = qe(H?.xml);
2775
- if (D2.source === "Gnumeric_OpenCalc:openoffice" && ee && typeof H?.row == "number" && typeof H.column == "number") {
2776
- K(H.row, me.rows), K(H.column, me.columns);
2777
- let F = `${H.row}:${H.column}`;
2778
- if (D2.kind === "table-cell") {
2779
- let k = typeof H.rows == "number" ? H.rows : 1, X = typeof H.columns == "number" ? H.columns : 1;
2780
- if (!Number.isSafeInteger(k) || !Number.isSafeInteger(X) || k < 1 || X < 1) throw new Le("invalid-request", "Invalid OpenDocument metadata repeat");
2781
- let Te = { startRow: H.row, startColumn: H.column, endRow: H.row + k - 1, endColumn: H.column + X - 1 };
2782
- G(Te), xe.push({ range: Te, style: Kt(ee, Lt.table)["style-name"] ?? (typeof H.styleName == "string" ? H.styleName : void 0), validation: typeof H.validation == "string" ? H.validation : void 0 });
2783
- } else if (D2.kind === "p" && typeof H.sourceText == "string") {
2784
- let k = typeof H.rows == "number" ? H.rows : 1, X = typeof H.columns == "number" ? H.columns : 1, Te = { startRow: H.row, startColumn: H.column, endRow: H.row + k - 1, endColumn: H.column + X - 1 };
2785
- G(Te);
2786
- let He = Fe.get(F);
2787
- Fe.set(F, { text: H.sourceText, richText: H.sourceRichText ?? [], xml: (He?.xml ?? "") + s.retained(ee, 0, (te) => Za(te, "normalize", s.charge, ne)), range: Te });
2788
- } else if (D2.kind === "annotation" && ot2.OO_NS_OFFICE.includes(String(ee.namespace))) {
2789
- let k = ee.namespace !== Lt.office, X;
2790
- if (!k && typeof H.sourceComment == "string") {
2791
- s.charge(H.sourceComment.length);
2792
- try {
2793
- let Te = JSON.parse(H.sourceComment);
2794
- Array.isArray(Te) && Te.length === 3 && (X = JSON.stringify(Te.slice(1)));
2795
- } catch {
2796
- }
2797
- }
2798
- nt2.set(F, { ...typeof H.sourceComment == "string" ? { signature: H.sourceComment } : {}, ...X === void 0 ? {} : { textSignature: X }, xml: k ? "" : s.retained(ee), node: k ? fo(ee, s.charge) : ee }), await Ht(H.row, H.column);
2799
- } else re.set(F, (re.get(F) ?? "") + s.retained(ee)), await Ht(H.row, H.column);
2800
- } else if (D2.kind === "Styles") for (let F of Rt(D2.data)) {
2801
- s.charge();
2802
- let k = Kt(F), X = Rt(F).find((te) => qe(te)?.name === "Style");
2803
- if (!X) continue;
2804
- let Te = { startRow: Number(k.startRow), endRow: Number(k.endRow), startColumn: Number(k.startCol), endColumn: Number(k.endCol) };
2805
- G(Te);
2806
- let He = await Ka(X, Te, `rg${B}_${xe.length}`, x, s, f, e, j, ne);
2807
- await Ue.append(He.styleXml), await et.append(He.validationXml), xe.push({ range: Te, style: He.styleName, validation: He.validationName, link: He.link });
2808
- }
2809
- else if (D2.kind === "Objects") for (let F of Rt(D2.data)) {
2810
- s.charge();
2811
- let k = qe(F), X = Kt(F);
2812
- if ((k?.name === "CellComment" || k?.name === "GnmCellComment") && X.ObjectBound) {
2813
- let Te = on("=" + X.ObjectBound.split(":")[0], { maximumDepth: e.limits.formulaDepth, position: { sheet: x.id, row: 0, column: 0 }, signal: e.signal });
2814
- if (Te.ok && Te.document.root.kind === "reference") {
2815
- let He = Te.document.root.first, te = He.row?.value ?? 0, We = He.column?.value ?? 0, Ve = `${te}:${We}`;
2816
- K(te, me.rows), K(We, me.columns), Ce.set(Ve, X), await Ht(te, We);
2817
- }
2818
- } else await Hn(`ODF ${n} writer does not export sheet '${x.name}' object '${String(k?.name ?? "unknown")}'
2819
- `, e, "odf-write-loss");
2820
- }
2821
- }
2822
- let wt = l2 ? new qa(l2, 128) : void 0, Ln = wt ? void 0 : /* @__PURE__ */ new Set(), ln = 0;
2823
- async function je(D2) {
2824
- ln = Math.max(ln, D2), wt ? await wt.set(BigInt(D2), 0n) : Ln.add(D2);
2825
- }
2826
- await je(0);
2827
- async function* dn() {
2828
- async function* D2() {
2829
- if (wt) for await (let [ee] of wt.entries()) yield Number(ee);
2830
- else yield* [...Ln].sort((ee, F) => ee - F);
2831
- }
2832
- let H;
2833
- for await (let ee of D2()) H !== void 0 && (yield [H, ee - H]), H = ee;
2834
- }
2835
- let kt = 0;
2836
- for await (let D2 of Jt()) {
2837
- let H = D2.style?.gnumeric, ee = Rt(H).find((k) => qe(k)?.name === "HyperLink"), F = Kt(ee);
2838
- F.target && Je.set(`${D2.row}:${D2.column}`, { "xlink:href": F.type === "GnmHLinkCurWB" ? Za(F.target, "export", s.charge, ne) : F.target, "xlink:type": "simple", "office:title": F.tip }), kt = Math.max(kt, D2.column + 1), await je(D2.row), await je(D2.row + 1);
2839
- }
2840
- let Gt = [];
2841
- for (let D2 of x.merges ?? []) {
2842
- G(D2);
2843
- for (let H of Gt) if (s.charge(), D2.startRow <= H.endRow && D2.endRow >= H.startRow && D2.startColumn <= H.endColumn && D2.endColumn >= H.startColumn) throw new Le("invalid-request", "Invalid overlapping OpenDocument merges");
2844
- Gt.push(D2), await je(D2.startRow), await je(D2.startRow + 1), await je(D2.endRow), await je(D2.endRow + 1);
2845
- }
2846
- for (let { range: D2 } of xe) await je(D2.startRow), await je(D2.endRow + 1);
2847
- let Ct = _.axis(), It = _.axis();
2848
- for await (let D2 of u2?.axes ? u2.axes(x.id, "rows") : x.rows ?? []) K(D2.index, me.rows), await Ct.get(D2.index) === void 0 && await Ct.add({ index: D2.index, ...D2.sizePoints === void 0 ? {} : { sizePoints: D2.sizePoints }, ...D2.hidden === void 0 ? {} : { hidden: D2.hidden } }), await je(D2.index), await je(D2.index + 1);
2849
- for await (let D2 of u2?.axes ? u2.axes(x.id, "columns") : x.columns ?? []) {
2850
- if (K(D2.index, me.columns), await It.get(D2.index) !== void 0) throw new Le("invalid-request", "Duplicate OpenDocument column metadata");
2851
- await It.add({ index: D2.index, ...D2.sizePoints === void 0 ? {} : { sizePoints: D2.sizePoints }, ...D2.hidden === void 0 ? {} : { hidden: D2.hidden } });
2852
- }
2853
- let Mt = x.size?.rows ?? Un.rows;
2854
- K(Mt - 1, me.rows), Mt = Math.max(Mt, ln), await je(Mt);
2855
- async function* yn() {
2856
- let D2 = 0, H = 0;
2857
- for await (let X of It.values()) {
2858
- X.index > D2 && (yield m("table:table-column", { "table:number-columns-repeated": X.index - D2 }));
2859
- let Te = `co${B}_${H++}`;
2860
- await Ue.append(m("style:style", { "style:name": Te, "style:family": "table-column" }, m("style:table-column-properties", { "style:column-width": X.sizePoints === void 0 ? void 0 : X.sizePoints + "pt" }))), yield m("table:table-column", { "table:style-name": Te, "table:visibility": X.hidden ? "collapse" : "visible" }), D2 = X.index + 1;
2861
- }
2862
- let ee = Math.max(x.size?.columns ?? Un.columns, D2);
2863
- K(ee - 1, me.columns), ee = Math.max(ee, kt);
2864
- for (let { range: X } of xe) ee = Math.max(ee, X.endColumn + 1);
2865
- for (let X of x.merges ?? []) ee = Math.max(ee, X.endColumn + 1);
2866
- ee > D2 && (yield m("table:table-column", { "table:number-columns-repeated": ee - D2 > 1 ? ee - D2 : void 0 }));
2867
- let F = Jt(), k = Ct.values();
2868
- try {
2869
- let X = await F.next(), Te = await k.next(), He = 0;
2870
- for await (let [te, We] of dn()) {
2871
- if (te >= me.rows) break;
2872
- s.charge(), He++ % 64 === 0 && (await new Promise((Ie) => setTimeout(Ie, 0)), e.signal.throwIfAborted());
2873
- let Ve = /* @__PURE__ */ new Map(), gn = (x.merges ?? []).filter((Ie) => te >= Ie.startRow && te <= Ie.endRow);
2874
- for (; !X.done && X.value.row === te; ) Ve.set(X.value.column, X.value), X = await F.next();
2875
- s.charge(x.merges?.length ?? 0), s.charge(xe.length);
2876
- let Ea = xe.filter((Ie) => te >= Ie.range.startRow && te <= Ie.range.endRow).reverse(), Dt = /* @__PURE__ */ new Set();
2877
- for (let Ie of Ve.keys()) Dt.add(Ie), Dt.add(Ie + 1);
2878
- for (let Ie of gn) Dt.add(Ie.startColumn), Dt.add(Ie.startColumn + 1), Dt.add(Ie.endColumn + 1);
2879
- for (let Ie of Ea) Dt.add(Ie.range.startColumn), Dt.add(Ie.range.endColumn + 1);
2880
- let wn = !Te.done && Te.value.index === te ? Te.value : void 0;
2881
- wn && (Te = await k.next());
2882
- let _a = { "table:number-rows-repeated": We > 1 ? We : void 0, "table:visibility": wn?.hidden ? "collapse" : void 0 };
2883
- if (wn?.sizePoints !== void 0) {
2884
- let Ie = `ro${B}_${te}`;
2885
- await Ue.append(m("style:style", { "style:name": Ie, "style:family": "table-row" }, m("style:table-row-properties", { "style:row-height": wn.sizePoints + "pt" }))), _a["table:style-name"] = Ie;
2886
- }
2887
- async function* di() {
2888
- let Ie = [...Dt].sort((Oe, Pe) => Oe - Pe), dt = 0;
2889
- for (let Oe of Ie) {
2890
- if (s.charge(), Oe < dt || Oe >= me.columns) continue;
2891
- Oe > dt && (yield m("table:table-cell", Oe - dt > 1 ? { "table:number-columns-repeated": Oe - dt } : {}));
2892
- let Pe = Ve.get(Oe), at = gn.find((Ne) => Oe >= Ne.startColumn && Oe <= Ne.endColumn), St = Ea.find((Ne) => Oe >= Ne.range.startColumn && Oe <= Ne.range.endColumn);
2893
- if (at && (te !== at.startRow || Oe !== at.startColumn)) {
2894
- let Ne = Math.min(at.endColumn + 1, Ie.find((Se) => Se > Oe) ?? at.endColumn + 1);
2895
- yield m("table:covered-table-cell", Ne - Oe > 1 ? { "table:number-columns-repeated": Ne - Oe } : {}), dt = Ne;
2896
- continue;
2897
- }
2898
- if (!Pe && !at && !St) {
2899
- dt = Oe;
2900
- continue;
2901
- }
2902
- let Me = {};
2903
- Pe && !Pe.formula && Pe.value.kind === "error" && (w && (Me["gnm:error-value"] = Pe.value.value), Me["table:formula"] = "of:=" + Pe.value.value), at && (Me["table:number-columns-spanned"] = at.endColumn - at.startColumn + 1, Me["table:number-rows-spanned"] = at.endRow - at.startRow + 1);
2904
- let fn = `${te}:${Oe}`, Xt = x.formulaGroups?.find((Ne) => Ne.kind === "array" && te >= Ne.range.startRow && te <= Ne.range.endRow && Oe >= Ne.range.startColumn && Oe <= Ne.range.endColumn);
2905
- s.charge(x.formulaGroups?.length ?? 0), Pe?.formula && (!Xt || te === Xt.range.startRow && Oe === Xt.range.startColumn) && (Me["table:formula"] = j(Pe.formula, x, te, Oe), Xt && (G(Xt.range), Me["table:number-matrix-columns-spanned"] = Xt.range.endColumn - Oe + 1, Me["table:number-matrix-rows-spanned"] = Xt.range.endRow - te + 1)), Me["table:content-validation-name"] = St?.validation, St?.style && (Me["table:style-name"] = St.style);
2906
- let En = re.get(fn) ?? "", ft = Ce.get(fn), Et = nt2.get(fn), Ta = ft ? JSON.stringify([ft.Author ?? null, ft.Text ?? "", ft.TextFormat ?? null]) : void 0;
2907
- if (s.charge((Ta?.length ?? 0) + (Et?.signature?.length ?? 0)), Et?.xml && (Et.signature === void 0 || Et.signature === Ta)) En += Et.xml;
2908
- else if (ft) {
2909
- let Ne = ft.Text ?? "", Se = JSON.stringify([Ne, ft.TextFormat ?? null]);
2910
- s.charge(Se.length);
2911
- let Bt = Et?.textSignature === Se, Qt = "";
2912
- if (!Bt) {
2913
- let At = uo(ft.TextFormat, s.charge), Nt = At?.length ? await $n(Ne, At, s, Q, w, void 0, false) : s.text(Ne);
2914
- Qt = m("text:p", {}, Nt);
2915
- }
2916
- let _n = Et ? Rt(Et.node).filter((At) => {
2917
- s.charge();
2918
- let Nt = qe(At);
2919
- return !(!Bt && Nt?.name === "p" && Nt.namespace === Lt.text || Nt?.name === "creator" && Nt.namespace === Lt.dc);
2920
- }).map((At) => s.retained(At)).join("") : "", Zt = (ft.Author === void 0 ? "" : m("dc:creator", {}, s.escape(ft.Author))) + _n + Qt;
2921
- En += Et ? s.retained(Et.node, 0, void 0, false, Zt) : m("office:annotation", {}, Zt);
2922
- }
2923
- if (Pe) {
2924
- let Ne = await f.register(Pe);
2925
- Ne.name && !St?.style && (Me["table:style-name"] = Ne.name);
2926
- let Se = Pe.formula ? Pe.cachedResult ?? Pe.value : Pe.value;
2927
- if (Se.kind === "number") {
2928
- if (!Number.isFinite(Se.value)) throw new Le("invalid-request", "Invalid OpenDocument numeric value");
2929
- if (Ne.kind === "date") {
2930
- let Ze = To(Se.value, { book: O });
2931
- if (!Ze) throw new Le("unsupported-feature", "Unsupported ssconvert feature: OpenDocument date outside supported calendar");
2932
- Me["office:value-type"] = "date";
2933
- let en = Math.round((Se.value - Math.floor(Se.value)) * 86400) % 86400;
2934
- Me["office:date-value"] = Ze.toISOString().slice(0, 10) + (Se.value !== Math.floor(Se.value) ? "T" + [Math.floor(en / 3600), Math.floor(en / 60) % 60, en % 60].map((fi) => String(fi).padStart(2, "0")).join(":") : "");
2935
- } else if (Ne.kind === "time" && Se.value >= 0 && Number.isFinite(Se.value * 86400)) {
2936
- Me["office:value-type"] = "time";
2937
- let Ze = Se.value * 86400, en = Ze % 60;
2938
- Me["office:time-value"] = `PT0${ni(Math.floor(Ze / 3600))}H${String(Math.floor(Ze / 60) % 60).padStart(2, "0")}M${en < 10 ? "0" : ""}${ni(en)}S`;
2939
- } else Me["office:value-type"] = "float", Me["office:value"] = Se.value;
2940
- } else Se.kind === "boolean" ? (Me["office:value-type"] = "boolean", Me["office:boolean-value"] = String(Se.value)) : (Se.kind === "string" || Se.kind === "error") && (Me["office:value-type"] = "string", (Pe.formula || Se.kind === "error") && (Me["office:string-value"] = Se.value), Se.kind === "error" && !Pe.formula && (Me["table:formula"] = "of:=" + Se.value, w && (Me["gnm:error-value"] = Se.value)));
2941
- s.charge(Fe.size);
2942
- let Bt = Pe.displayedText ?? await _o(Pe, O, e), Qt = Fe.get(fn) ?? [...Fe.values()].find((Ze) => te >= Ze.range.startRow && te <= Ze.range.endRow && Oe >= Ze.range.startColumn && Oe <= Ze.range.endColumn), _n = St?.link ?? Je.get(fn), Zt = Se.kind === "string" && Bt === Se.value ? Pe.richText : void 0, At = JSON.stringify(Qt?.richText ?? []), Nt = JSON.stringify(Zt ?? []);
2943
- if (s.charge(At.length + Nt.length), Qt?.text === Bt && At === Nt) En += Qt.xml;
2944
- else {
2945
- let Ze = Zt?.length ? await $n(Bt, Zt, s, Q, w, _n) : _n ? m("text:a", _n, s.escape(Bt)) : s.text(Bt);
2946
- En += m("text:p", {}, Ze);
2947
- }
2948
- }
2949
- let kn = !Pe && !at && St ? Math.min(St.range.endColumn + 1, Ie.find((Ne) => Ne > Oe) ?? St.range.endColumn + 1) : Oe + 1;
2950
- kn - Oe > 1 && (Me["table:number-columns-repeated"] = kn - Oe), yield m("table:table-cell", Me, En), dt = kn;
2951
- }
2952
- dt < ee && (yield m("table:table-cell", { "table:number-columns-repeated": ee - dt > 1 ? ee - dt : void 0 }));
2953
- }
2954
- yield* s.stream("table:table-row", _a, di());
2955
- }
2956
- yield* ue(x.id);
2957
- } finally {
2958
- await Promise.all([F.return(void 0), k.return(void 0)]);
2959
- }
2960
- }
2961
- yield* s.stream("table:table", { "table:name": x.name, "table:style-name": ae }, yn());
2962
- }
2963
- }
2964
- let V2 = l2 ? new ZipWriteChain(l2, 16384, e.signal, async (h) => {
2965
- h.throwIfAborted();
2966
- }) : void 0, se = 0;
2967
- for await (let h of J()) {
2968
- if (M(h.length), !V2) {
2969
- a.push(h.slice());
2970
- continue;
2971
- }
2972
- for (let B = 0; B < h.length; ) {
2973
- let x = Math.min(c.length - se, h.length - B);
2974
- c.set(h.subarray(B, B + x), se), se += x, B += x, se === c.length && (await V2.append([c], se), se = 0);
2975
- }
2976
- }
2977
- V2 && se && await V2.append([c.subarray(0, se)], se);
2978
- async function* be() {
2979
- V2 ? yield* V2.read() : yield* a;
2980
- }
2981
- let ge = new Map(O.sheets.map((h) => (s.charge(), [h.id, h])));
2982
- async function* Re() {
2983
- for (let h of O.sheets) for (let B of h.labelRanges ?? []) {
2984
- if (s.charge(), G(B.labels), G(B.data), B.axis !== "row" && B.axis !== "column") throw new Le("invalid-request", "Invalid OpenDocument label orientation");
2985
- let x = B.dataSheet === void 0 ? h : ge.get(B.dataSheet);
2986
- if (!x) throw new Le("unsupported-feature", "OpenDocument label data sheet is not exported");
2987
- let Z = (ie, le) => "$" + Yn(0, le).slice(0, -1) + "$" + (ie + 1), _e = (ie, le) => "$" + Qa(le, "'", qt) + "." + Z(ie.startRow, ie.startColumn) + ":." + Z(ie.endRow, ie.endColumn);
2988
- yield m("table:label-range", { "table:label-cell-range-address": _e(B.labels, h.name), "table:data-cell-range-address": _e(B.data, x.name), "table:orientation": B.axis });
2989
- }
2990
- }
2991
- async function* ce() {
2992
- yield ze, et.hasContent && (yield* s.stream("table:content-validations", {}, et.render())), yield* be(), O.sheets.some((h) => h.labelRanges?.length) && (yield* s.stream("table:label-ranges", {}, Re())), yield* ue(), yield* lt.render();
2993
- }
2994
- let he = /* @__PURE__ */ new Map(), Ee = new TextEncoder();
2995
- P && e.own(() => {
2996
- for (let h of he.values()) h instanceof Uint8Array && h.fill(0);
2997
- }), de("mimetype", "application/vnd.oasis.opendocument.spreadsheet");
2998
- async function* Ae() {
2999
- yield m("office:scripts"), yield* s.stream("office:font-face-decls", {}, Q.render("fonts"));
3000
- async function* h() {
3001
- yield* Q.render("contentAutomatic"), yield* Ue.render(), yield* f.render();
3002
- }
3003
- yield* s.stream("office:automatic-styles", {}, h()), yield* s.stream("office:body", {}, s.stream("office:spreadsheet", {}, ce()));
3004
- }
3005
- de("content.xml", s.documentStream("office:document-content", Ae()));
3006
- async function* Ot() {
3007
- yield* s.stream("office:font-face-decls", {}, Q.render("fonts")), yield* s.stream("office:styles", {}, Q.render("styles")), yield* s.stream("office:automatic-styles", {}, Q.render("stylesAutomatic")), yield* s.stream("office:master-styles", {}, Q.render("masters"));
3008
- }
3009
- de("styles.xml", s.documentStream("office:document-styles", Ot())), de("meta.xml", s.document("office:document-meta", m("office:meta", {}, m("meta:generator", {}, "Gnumeric/1.12.61")))), de("settings.xml", s.document("office:document-settings", m("office:settings", {}, m("config:config-item-set", { "config:name": "gnm:settings" }, m("config:config-item", { "config:name": "gnm:has_foreign", "config:type": "boolean" }, String(w)) + m("config:config-item", { "config:name": "gnm:active-sheet", "config:type": "string" }, s.escape(O.sheets.find((h) => h.id === O.activeSheet)?.name ?? O.sheets[0].name))))));
3010
- for (let h of O.unsupportedRecords ?? []) {
3011
- s.charge();
3012
- let B = qe(h.data);
3013
- if (!(h.source !== "Gnumeric_OpenCalc:openoffice" || !B)) if ((h.kind === "embedded-resource" || h.kind === "embedded-document") && typeof B.path == "string") {
3014
- let x = B.path;
3015
- if (he.has(x) || x.startsWith("/") || x.includes("\\") || x.split("/").some((Z) => !Z || Z === "." || Z === "..")) throw new Le("invalid-request", "Invalid OpenDocument embedded path");
3016
- if (h.kind === "embedded-document") {
3017
- let Z = qe(B.xml);
3018
- if (Z?.name !== "document-content" && Z?.name !== "document-styles") throw new Le("invalid-request", "Invalid OpenDocument embedded document root");
3019
- de(x, s.documentStream("office:" + Z.name, we(B.xml)));
3020
- } else if (B.encoding === "hex" && typeof B.bytes == "string") {
3021
- if (s.charge(B.bytes.length), B.bytes.length % 2 || [...B.bytes].some((_e) => !"0123456789abcdefABCDEF".includes(_e))) throw new Le("invalid-request", "Invalid OpenDocument embedded bytes");
3022
- B.bytes.length / 2 > e.limits.outputBytes && fe("embedded bytes");
3023
- let Z = new Uint8Array(B.bytes.length / 2);
3024
- for (let _e = 0; _e < Z.length; _e++) Z[_e] = parseInt(B.bytes.slice(_e * 2, _e * 2 + 2), 16);
3025
- he.set(x, Z);
3026
- }
3027
- } else ["document-meta", "document-settings"].includes(h.kind) && B.xml && de(h.kind === "document-meta" ? "meta.xml" : "settings.xml", s.documentStream("office:" + h.kind, we(B.xml)));
3028
- }
3029
- let Ye = y ? /* @__PURE__ */ new Map() : void 0;
3030
- if (Ye) for (let [h, B] of he) {
3031
- let x = typeof B == "string" ? Ee.encode(B) : B instanceof Uint8Array ? B : await xn(B);
3032
- he.set(h, x), Ye.set(h, x);
3033
- }
3034
- let tt = y === void 0 || P ? void 0 : await ia(Ye, e, s, y);
3035
- de("META-INF/manifest.xml", '<?xml version="1.0" encoding="UTF-8"?>' + m("manifest:manifest", { "xmlns:manifest": "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0", "manifest:version": "1.2" }, m("manifest:file-entry", { "manifest:full-path": "/", "manifest:media-type": "application/vnd.oasis.opendocument.spreadsheet", "manifest:version": "1.2" }) + (O.unsupportedRecords ?? []).filter((h) => h.kind === "embedded-document").flatMap((h) => {
3036
- let B = qe(h.data);
3037
- return typeof B?.path == "string" && B.path.endsWith("/content.xml") ? [m("manifest:file-entry", { "manifest:full-path": B.path.slice(0, -11), "manifest:media-type": "application/vnd.oasis.opendocument.chart" })] : [];
3038
- }).join("") + [...he.keys()].filter((h) => h !== "mimetype").map((h) => m("manifest:file-entry", { "manifest:full-path": h, "manifest:media-type": h.endsWith(".xml") ? "text/xml" : h.endsWith(".png") ? "image/png" : h.endsWith(".jpg") || h.endsWith(".jpeg") ? "image/jpeg" : "", "manifest:size": tt?.get(h)?.size }, tt?.get(h)?.declaration ?? "")).join("")));
3039
- let mt = 0;
3040
- async function* yt(h, B = tt) {
3041
- h.size > C2.maxMembers - mt && fe("ZIP members"), mt += h.size;
3042
- let x = [], Z = 0, _e = l2 ? U.createStagedWriter(l2, C2, e.signal) : void 0;
3043
- try {
3044
- for (let [ie, le] of h) {
3045
- let q = B?.get(ie)?.bytes ?? le, oe = { modified: /* @__PURE__ */ new Date("2000-01-01Z"), mode: 420, directory: false, symlink: false, compression: ie === "mimetype" || B?.has(ie) ? "store" : "deflate" };
3046
- if (_e) {
3047
- async function* ae() {
3048
- typeof q == "string" || q instanceof Uint8Array ? yield q : yield* q;
3049
- }
3050
- async function* Be() {
3051
- for await (let $e of Ki(ae(), "UTF-8", false, e)) s.charge($e.length), Z += $e.length, Z > e.limits.outputBytes && fe("output bytes"), yield $e;
3052
- }
3053
- await _e.addSource(ie, Be(), oe);
3054
- } else {
3055
- let ae = typeof q == "string" ? Ee.encode(q) : q instanceof Uint8Array ? q : await xn(q);
3056
- s.charge(ae.length), Z += ae.length, Z > e.limits.outputBytes && fe("output bytes"), x.push(await U.makeZipEntry(ie, ae, oe, C2, e.signal));
3057
- }
3058
- }
3059
- _e ? yield* _e.finish() : yield await U.writeZipArchive({ entries: x, comment: new Uint8Array() }, C2, e.signal);
3060
- } catch (ie) {
3061
- throw e.signal.throwIfAborted(), ie instanceof CodecError && ie.code === "resource-limit" && fe("output package"), ie;
3062
- } finally {
3063
- if (P) for (let ie of x) ie.data.fill(0);
3064
- }
3065
- }
3066
- if (!P) {
3067
- yield* yt(he);
3068
- return;
3069
- }
3070
- he.size + 3 > C2.maxMembers && fe("ZIP members");
3071
- let rt2 = await xn(yt(he));
3072
- try {
3073
- let h = await ia(/* @__PURE__ */ new Map([["encrypted-package", rt2]]), e, s, y), B = h.get("encrypted-package"), x = Ye.get("mimetype"), Z = '<?xml version="1.0" encoding="UTF-8"?>' + m("manifest:manifest", { "xmlns:manifest": Lt.manifest, "xmlns:loext": lo, "manifest:version": "1.4" }, m("manifest:file-entry", { "manifest:full-path": "encrypted-package", "manifest:media-type": new TextDecoder().decode(x), "manifest:size": B.size }, B.declaration));
3074
- yield* yt(/* @__PURE__ */ new Map([["mimetype", x], ["META-INF/manifest.xml", Ee.encode(Z)], ["encrypted-package", B.bytes]]), h);
3075
- } finally {
3076
- rt2.fill(0);
3077
- for (let h of he.values()) h instanceof Uint8Array && h.fill(0);
3078
- }
3079
- } catch (y) {
3080
- throw E = { error: y }, y;
3081
- } finally {
3082
- for (let y of d) y.dispose();
3083
- f?.dispose(), c.fill(0);
3084
- for (let y of a) y.fill(0);
3085
- await T2().catch((y) => {
3086
- throw E ? new AggregateError([E.error, y], "ODF export and storage cleanup failed") : y;
3087
- });
3088
- }
3089
- };
3090
- }
3091
- export {
3092
- Ro as createOdfStreamWriter,
3093
- vs as createOdfWriter,
3094
- Gs as probeOdf,
3095
- No as readOdf,
3096
- Xs as readOdfWorkbookSource
3097
- };