@sheetxl/io-xlsx 0.8.0-beta.1 → 0.8.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/BzOEBR0jaxXg9wvt.cjs +5 -0
- package/browser/cjs/C8oC1tPbhgR0Dqtx.cjs +2 -0
- package/browser/cjs/Ca-xJDjg5bOpUPXX.cjs +1 -0
- package/browser/cjs/{D5Y4KQhKdukOkjvA.cjs → D3EWCPfCu-qMOIGd.cjs} +1 -2
- package/browser/cjs/{BAtEL-5TLyoaPFDP.cjs → DULsYP_GcPGLVYSE.cjs} +10 -1
- package/browser/cjs/DtBN3UOzNJjYBwJ6.cjs +1 -0
- package/browser/cjs/index.cjs +1 -1
- package/browser/cjs/sNZR19Wk-XQ2xZ9E.cjs +1 -0
- package/browser/esm/B9q618XELV7uWJsA.mjs +67 -0
- package/browser/esm/{Dj7D2nVdAZ3TiUks.mjs → BwbMurFOptAFs7gC.mjs} +1595 -1124
- package/browser/esm/{CLWzJJyoSrykkVLX.mjs → CMHb6pUUmsCP9r_9.mjs} +2 -2
- package/browser/esm/{ijQzHH-bvDfUHIi1.mjs → CMzkLUwbgA73RvCb.mjs} +1 -1
- package/browser/esm/D75_rfogFUfXADKc.mjs +3324 -0
- package/browser/esm/{4BWLu134ABlCQEtM.mjs → DfuBawaydlvgZMR-.mjs} +1824 -1051
- package/browser/esm/{BkNXyG6NC-w5Xo92.mjs → DhqYgh9G2vLn7mIE.mjs} +28 -13
- package/browser/esm/DoMlKUCnMSlR2qX5.mjs +159 -0
- package/browser/esm/{Cok_fBIUCHDSrKw0.mjs → DtpWa7tZahylJ3HS.mjs} +446 -347
- package/browser/esm/{Ctqql4O-3xj2K8vv.mjs → IZf0hIeLYj3T0Xvu.mjs} +2 -2
- package/browser/esm/{Dz1Dp8DDJvhd09RR.mjs → _UDbQq5-pHbU1f82.mjs} +1 -1
- package/browser/esm/index.mjs +3 -3
- package/node/esm/{CF1R5ovFsRNu--Rw.mjs → BD03jrMQ_UKA196-.mjs} +1934 -1143
- package/node/esm/{fOnuUjpPCAzmuIXN.mjs → Bi_kZVtZams7taqa.mjs} +2 -2
- package/node/esm/{Ctcl4jN52INWpKWC.mjs → BxHvzSROx_N_7nJH.mjs} +607 -506
- package/node/esm/{CEAmv36xpTNgFwl_.mjs → CB1ijGbhl-e2l6Mm.mjs} +49 -35
- package/node/esm/CO1M1H1N6fB422K-.mjs +2959 -0
- package/node/esm/CWpezSa6TERGEv-B.mjs +3410 -0
- package/node/esm/{CEV7nKotMpeRRnQC.mjs → CY-pSutJLHskZfXZ.mjs} +1 -1
- package/node/esm/Dezt2uIDqlxjiuk5.mjs +170 -0
- package/node/esm/index.mjs +40 -25
- package/package.json +3 -3
- package/types/src/ConditionalFormatRules.d.ts +3 -3
- package/types/src/DataValidationRules.d.ts +18 -2
- package/types/src/ExcelCalcStamp.d.ts +39 -0
- package/types/src/ExcelCompat.d.ts +197 -42
- package/types/src/LegacyFormula.d.ts +28 -7
- package/types/src/Plugin.d.ts +16 -5
- package/types/src/ProtectionAttributes.d.ts +38 -0
- package/types/src/SourcePackage.d.ts +31 -12
- package/types/src/Types.d.ts +17 -0
- package/types/src/reader/HiddenFormulas.d.ts +16 -0
- package/types/src/reader/Warning.d.ts +29 -0
- package/types/src/reader/dom/DOMTransformer.d.ts +1 -1
- package/types/src/reader/dom/ExecutionContext.d.ts +16 -3
- package/types/src/reader/dom/Types.d.ts +19 -3
- package/types/src/reader/domVisitors/CommentVisitor.d.ts +18 -1
- package/types/src/reader/domVisitors/CommentsVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/ExternalLinkVisitor.d.ts +21 -3
- package/types/src/reader/domVisitors/SheetColorContainerVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/SheetStyleVisitor.d.ts +6 -1
- package/types/src/reader/domVisitors/ThreadedCommentVisitor.d.ts +9 -1
- package/types/src/reader/domVisitors/ThreadedCommentsVisitor.d.ts +2 -2
- package/types/src/reader/domVisitors/WorkbookVisitor.d.ts +11 -1
- package/types/src/reader/sax/LeanSaxParser.d.ts +58 -0
- package/types/src/reader/sax/SaxParser.d.ts +11 -1
- package/types/src/reader/sax/SaxVisitor.d.ts +3 -2
- package/types/src/reader/saxVisitors/ContentTypesVisitor.d.ts +9 -0
- package/types/src/reader/saxVisitors/WorksheetVisitor.d.ts +11 -4
- package/types/src/utils/VmlNoteShapes.d.ts +75 -0
- package/types/src/vba/VBAProject.d.ts +52 -4
- package/types/src/writer/builder/ContentTypes.d.ts +13 -0
- package/types/src/writer/builder/Emitter.d.ts +6 -6
- package/types/src/writer/builder/OpcXmlUtils.d.ts +2 -0
- package/types/src/writer/builder/PackageBuilder.d.ts +70 -22
- package/types/src/writer/builder/PartWriter.d.ts +5 -0
- package/types/src/writer/builder/RelationshipSet.d.ts +3 -0
- package/types/src/writer/builder/Types.d.ts +107 -38
- package/types/src/writer/builder/_Types.d.ts +17 -0
- package/types/src/writer/emitters/CommentsEmitter.d.ts +52 -0
- package/types/src/writer/emitters/EmbeddedPartEmitter.d.ts +60 -0
- package/types/src/writer/emitters/ExternalLinkEmitter.d.ts +19 -0
- package/types/src/writer/emitters/LegacyDrawingEmitter.d.ts +18 -0
- package/types/src/writer/emitters/PersonsEmitter.d.ts +17 -0
- package/types/src/writer/emitters/PivotTableEmitter.d.ts +45 -0
- package/types/src/writer/emitters/ThreadedCommentsEmitter.d.ts +21 -0
- package/types/src/writer/emitters/WorkbookEmitter.d.ts +16 -3
- package/types/src/writer/utils/DrawMLUtils.d.ts +16 -1
- package/types/src/writer/utils/HiddenFormulaXfs.d.ts +28 -0
- package/browser/cjs/Bg0e53JZa8vhmm5a.cjs +0 -1
- package/browser/cjs/CK5FFUvet6FnIYO_.cjs +0 -5
- package/browser/cjs/DV6LeTEiiFUrZoxj.cjs +0 -1
- package/browser/cjs/DWkuoJSgvcXJTdN1.cjs +0 -1
- package/browser/cjs/Db8YjGM6TG34c8aT.cjs +0 -1
- package/browser/esm/BzQ_lPzc8C4OTIGZ.mjs +0 -99
- package/browser/esm/CJknI8BYGSZr-4zS.mjs +0 -52
- package/browser/esm/D-m_kQLaewdwuXaF.mjs +0 -2685
- package/node/esm/CvnRSooxEQdlJgMn.mjs +0 -2766
- package/node/esm/DQd0vxzTaPt2qSL-.mjs +0 -108
- package/node/esm/ssSlRCbCqxvZ9IX8.mjs +0 -2481
|
@@ -1,2766 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license @sheetxl/io-xlsx - SheetXL - Import/Export from/to Excel - v0.8.0-beta.1
|
|
3
|
-
*
|
|
4
|
-
* (C) 2026-present SheetXL Inc. & Michael T. Ford
|
|
5
|
-
* License: The license can be found at https://www.sheetxl.com/license.
|
|
6
|
-
*/
|
|
7
|
-
import { c as t, d as e, f as s, l as o, p as i, r, s as n, u as a } from "./DQd0vxzTaPt2qSL-.mjs";
|
|
8
|
-
import { A as c, B as l, C as h, F as p, I as u, L as d, M as g, N as m, P as f, R as T, S as y, T as x, c as b, d as v, j as w, k as S, m as C, o as k, p as P, r as A, t as E, v as I, x as O, y as D } from "./ssSlRCbCqxvZ9IX8.mjs";
|
|
9
|
-
import { BufferUtils as V, CommonUtils as L, ExpectedError as $ } from "@sheetxl/utils";
|
|
10
|
-
import { AddressUtils as j, CommonUtils as N, CoordUtils as R, FormulaError as B, ICondition as M, IConditionalFormat as H, IRange as _, OutOfBoundsError as z, ResourceCollection as X, Theme as F, Tuple as q, Workbook as W } from "@sheetxl/sdk";
|
|
11
|
-
import { BlobReader as U, Uint8ArrayReader as G, Uint8ArrayWriter as Z, ZipReader as J } from "@zip.js/zip.js";
|
|
12
|
-
var Q = /* @__PURE__ */ new Uint8Array(0), K = class t {
|
|
13
|
-
constructor(t, e, s) {
|
|
14
|
-
this.buffers = /* @__PURE__ */ new Map(), this.zip = t, this.entries = e, this.rawBuffer = s;
|
|
15
|
-
}
|
|
16
|
-
static normalize(t) {
|
|
17
|
-
return t.startsWith("/") ? t.slice(1) : t;
|
|
18
|
-
}
|
|
19
|
-
static async create(e) {
|
|
20
|
-
const s = e instanceof Blob ? Q : e instanceof Uint8Array ? e : new Uint8Array(e), o = new J(e instanceof Blob ? new U(e) : new G(s)), i = /* @__PURE__ */ new Map();
|
|
21
|
-
for (const t of await o.getEntries()) t.directory || i.set(t.filename, t);
|
|
22
|
-
return new t(o, i, s);
|
|
23
|
-
}
|
|
24
|
-
getNames() {
|
|
25
|
-
return [...this.entries.keys()];
|
|
26
|
-
}
|
|
27
|
-
has(e) {
|
|
28
|
-
return this.entries.has(t.normalize(e));
|
|
29
|
-
}
|
|
30
|
-
uncompressedSize(e) {
|
|
31
|
-
return this.entries.get(t.normalize(e))?.uncompressedSize ?? 0;
|
|
32
|
-
}
|
|
33
|
-
async getBuffer(e) {
|
|
34
|
-
const s = t.normalize(e), o = this.buffers.get(s);
|
|
35
|
-
if (o) return o;
|
|
36
|
-
const i = this.entries.get(s);
|
|
37
|
-
if (!i) return null;
|
|
38
|
-
const r = await i.getData(new Z());
|
|
39
|
-
return this.buffers.set(s, r), r;
|
|
40
|
-
}
|
|
41
|
-
async prefetch(t) {
|
|
42
|
-
const e = [];
|
|
43
|
-
for (const [s, o] of this.entries) !this.buffers.has(s) && t(s, o) && e.push(o.getData(new Z()).then((t) => {
|
|
44
|
-
this.buffers.set(s, t);
|
|
45
|
-
}));
|
|
46
|
-
await Promise.all(e);
|
|
47
|
-
}
|
|
48
|
-
getEntry(e) {
|
|
49
|
-
return this.buffers.get(t.normalize(e)) ?? null;
|
|
50
|
-
}
|
|
51
|
-
async getTextStream(e, s) {
|
|
52
|
-
const o = this.entries.get(t.normalize(e));
|
|
53
|
-
if (!o) return null;
|
|
54
|
-
const i = new TransformStream();
|
|
55
|
-
o.getData(i.writable).catch(() => {});
|
|
56
|
-
const r = i.readable.getReader(), n = new TextDecoder("utf-8");
|
|
57
|
-
return new ReadableStream({ async pull(t) {
|
|
58
|
-
const { value: e, done: o } = await r.read();
|
|
59
|
-
if (o) {
|
|
60
|
-
const e = n.decode();
|
|
61
|
-
e && t.enqueue(e), t.close();
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
s?.(e.byteLength);
|
|
65
|
-
const i = n.decode(e, { stream: !0 });
|
|
66
|
-
i && t.enqueue(i);
|
|
67
|
-
} }).getReader();
|
|
68
|
-
}
|
|
69
|
-
getRawEntry(e) {
|
|
70
|
-
const s = this.entries.get(t.normalize(e));
|
|
71
|
-
if (!s || s.encrypted) return null;
|
|
72
|
-
const o = s.offset;
|
|
73
|
-
if (o + 30 > this.rawBuffer.byteLength) return null;
|
|
74
|
-
const i = new DataView(this.rawBuffer.buffer, this.rawBuffer.byteOffset + o, 30);
|
|
75
|
-
if (67324752 !== i.getUint32(0, !0)) return null;
|
|
76
|
-
const r = o + 30 + i.getUint16(26, !0) + i.getUint16(28, !0), n = r + s.compressedSize;
|
|
77
|
-
return n > this.rawBuffer.byteLength ? null : {
|
|
78
|
-
data: this.rawBuffer.subarray(r, n),
|
|
79
|
-
compressionMethod: s.compressionMethod,
|
|
80
|
-
signature: s.signature
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
async close() {
|
|
84
|
-
await this.zip.close();
|
|
85
|
-
}
|
|
86
|
-
}, Y = class {
|
|
87
|
-
constructor(t) {
|
|
88
|
-
this._sink = t, this._samples = [], this._t0 = tt(), this._tPrev = this._t0, this._heapPrev = et();
|
|
89
|
-
}
|
|
90
|
-
mark(t) {
|
|
91
|
-
const e = tt(), s = et(), o = {
|
|
92
|
-
label: t,
|
|
93
|
-
tMs: e - this._t0,
|
|
94
|
-
dtMs: e - this._tPrev,
|
|
95
|
-
heapBytes: s,
|
|
96
|
-
dHeapBytes: void 0 !== s && void 0 !== this._heapPrev ? s - this._heapPrev : void 0,
|
|
97
|
-
rssBytes: st()
|
|
98
|
-
};
|
|
99
|
-
this._tPrev = e, this._heapPrev = s, this._samples.push(o), this._sink?.(o);
|
|
100
|
-
}
|
|
101
|
-
samples() {
|
|
102
|
-
return this._samples;
|
|
103
|
-
}
|
|
104
|
-
toTable() {
|
|
105
|
-
return this._samples.map((t) => ({
|
|
106
|
-
phase: t.label,
|
|
107
|
-
tMs: Math.round(t.tMs),
|
|
108
|
-
dtMs: Math.round(t.dtMs),
|
|
109
|
-
heapMB: void 0 !== t.heapBytes ? ot(t.heapBytes / 1048576) : "—",
|
|
110
|
-
dHeapMB: void 0 !== t.dHeapBytes ? ot(t.dHeapBytes / 1048576) : "—",
|
|
111
|
-
rssMB: void 0 !== t.rssBytes ? ot(t.rssBytes / 1048576) : "—"
|
|
112
|
-
}));
|
|
113
|
-
}
|
|
114
|
-
}, tt = "object" == typeof performance && "function" == typeof performance.now ? () => performance.now() : () => Date.now();
|
|
115
|
-
function et() {
|
|
116
|
-
const t = "object" == typeof performance ? performance.memory : void 0;
|
|
117
|
-
if (t && "number" == typeof t.usedJSHeapSize) return t.usedJSHeapSize;
|
|
118
|
-
const e = globalThis.process;
|
|
119
|
-
return "object" == typeof e && "function" == typeof e.memoryUsage ? e.memoryUsage().heapUsed : void 0;
|
|
120
|
-
}
|
|
121
|
-
function st() {
|
|
122
|
-
const t = globalThis.process;
|
|
123
|
-
if ("object" == typeof t && "function" == typeof t.memoryUsage) return t.memoryUsage().rss;
|
|
124
|
-
}
|
|
125
|
-
function ot(t) {
|
|
126
|
-
return Math.round(10 * t) / 10;
|
|
127
|
-
}
|
|
128
|
-
var it = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", rt = `-${it}.0-9·̀-ͯ‿-⁀`, nt = (new RegExp(`^[${it}]$`, "u"), new RegExp(`^[${rt}]$`, "u"), new RegExp(`^[${it}][${rt}]*$`, "u")), at = (new RegExp(`^[${rt}]+$`, "u"), [
|
|
129
|
-
32,
|
|
130
|
-
10,
|
|
131
|
-
13,
|
|
132
|
-
9
|
|
133
|
-
]);
|
|
134
|
-
function ct(t) {
|
|
135
|
-
return t >= 65 && t <= 90 || t >= 97 && t <= 122 || 58 === t || 95 === t || 8204 === t || 8205 === t || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
|
|
136
|
-
}
|
|
137
|
-
var lt = ":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", ht = `-${lt}.0-9·̀-ͯ‿-⁀`;
|
|
138
|
-
new RegExp(`^[${lt}]$`, "u"), new RegExp(`^[${ht}]$`, "u"), new RegExp(`^[${lt}][${ht}]*$`, "u"), new RegExp(`^[${ht}]+$`, "u");
|
|
139
|
-
var pt = "A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-", ut = `-${pt}.0-9·̀-ͯ‿-⁀`, dt = (new RegExp(`^[${pt}]$`, "u"), new RegExp(`^[${ut}]$`, "u"), new RegExp(`^[${pt}][${ut}]*$`, "u"));
|
|
140
|
-
function gt(t) {
|
|
141
|
-
return t >= 65 && t <= 90 || 95 === t || t >= 97 && t <= 122 || t >= 192 && t <= 214 || t >= 216 && t <= 246 || t >= 248 && t <= 767 || t >= 880 && t <= 893 || t >= 895 && t <= 8191 || t >= 8204 && t <= 8205 || t >= 8304 && t <= 8591 || t >= 11264 && t <= 12271 || t >= 12289 && t <= 55295 || t >= 63744 && t <= 64975 || t >= 65008 && t <= 65533 || t >= 65536 && t <= 983039;
|
|
142
|
-
}
|
|
143
|
-
var mt = function(t) {
|
|
144
|
-
return 32 === t || 10 === t || 13 === t || 9 === t;
|
|
145
|
-
}, ft = function(t) {
|
|
146
|
-
return t >= 32 && t <= 55295 || 10 === t || 13 === t || 9 === t || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
|
|
147
|
-
}, Tt = ct, yt = function(t) {
|
|
148
|
-
return ct(t) || t >= 48 && t <= 57 || 45 === t || 46 === t || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
|
|
149
|
-
}, xt = at, bt = nt, vt = function(t) {
|
|
150
|
-
return t >= 1 && t <= 55295 || t >= 57344 && t <= 65533 || t >= 65536 && t <= 1114111;
|
|
151
|
-
}, wt = gt, St = function(t) {
|
|
152
|
-
return gt(t) || 45 === t || 46 === t || t >= 48 && t <= 57 || 183 === t || t >= 768 && t <= 879 || t >= 8255 && t <= 8256;
|
|
153
|
-
}, Ct = dt, kt = "http://www.w3.org/XML/1998/namespace", Pt = "http://www.w3.org/2000/xmlns/", At = {
|
|
154
|
-
__proto__: null,
|
|
155
|
-
xml: kt,
|
|
156
|
-
xmlns: Pt
|
|
157
|
-
}, Et = {
|
|
158
|
-
__proto__: null,
|
|
159
|
-
amp: "&",
|
|
160
|
-
gt: ">",
|
|
161
|
-
lt: "<",
|
|
162
|
-
quot: "\"",
|
|
163
|
-
apos: "'"
|
|
164
|
-
}, It = -1, Ot = -2, Dt = 13, Vt = 33, Lt = 10, $t = 60, jt = 61, Nt = 62, Rt = 63, Bt = 93, Mt = (t) => 34 === t || 39 === t, Ht = [34, 39], _t = [
|
|
165
|
-
...Ht,
|
|
166
|
-
91,
|
|
167
|
-
Nt
|
|
168
|
-
], zt = [
|
|
169
|
-
...Ht,
|
|
170
|
-
$t,
|
|
171
|
-
Bt
|
|
172
|
-
], Xt = [
|
|
173
|
-
jt,
|
|
174
|
-
Rt,
|
|
175
|
-
...xt
|
|
176
|
-
], Ft = [
|
|
177
|
-
...xt,
|
|
178
|
-
Nt,
|
|
179
|
-
38,
|
|
180
|
-
$t
|
|
181
|
-
];
|
|
182
|
-
function qt(t, e, s) {
|
|
183
|
-
switch (e) {
|
|
184
|
-
case "xml":
|
|
185
|
-
s !== kt && t.fail(`xml prefix must be bound to ${kt}.`);
|
|
186
|
-
break;
|
|
187
|
-
case "xmlns": s !== Pt && t.fail(`xmlns prefix must be bound to ${Pt}.`);
|
|
188
|
-
}
|
|
189
|
-
switch (s) {
|
|
190
|
-
case Pt:
|
|
191
|
-
t.fail("" === e ? `the default namespace may not be set to ${s}.` : `may not assign a prefix (even "xmlns") to the URI ${Pt}.`);
|
|
192
|
-
break;
|
|
193
|
-
case kt: switch (e) {
|
|
194
|
-
case "xml": break;
|
|
195
|
-
case "":
|
|
196
|
-
t.fail(`the default namespace may not be set to ${s}.`);
|
|
197
|
-
break;
|
|
198
|
-
default: t.fail("may not assign the xml namespace to another prefix.");
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
var Wt, Ut, Gt = (t) => Ct.test(t), Zt = (t) => bt.test(t), Jt = {
|
|
203
|
-
xmldecl: "xmlDeclHandler",
|
|
204
|
-
text: "textHandler",
|
|
205
|
-
processinginstruction: "piHandler",
|
|
206
|
-
doctype: "doctypeHandler",
|
|
207
|
-
comment: "commentHandler",
|
|
208
|
-
opentagstart: "openTagStartHandler",
|
|
209
|
-
attribute: "attributeHandler",
|
|
210
|
-
opentag: "openTagHandler",
|
|
211
|
-
closetag: "closeTagHandler",
|
|
212
|
-
cdata: "cdataHandler",
|
|
213
|
-
error: "errorHandler",
|
|
214
|
-
end: "endHandler",
|
|
215
|
-
ready: "readyHandler"
|
|
216
|
-
}, Qt = class {
|
|
217
|
-
get closed() {
|
|
218
|
-
return this._closed;
|
|
219
|
-
}
|
|
220
|
-
constructor(t) {
|
|
221
|
-
this.i = 0, this.prevI = 0, this.opt = t ?? {}, this.fragmentOpt = !!this.opt.fragment;
|
|
222
|
-
const e = this.xmlnsOpt = !!this.opt.xmlns;
|
|
223
|
-
if (this.trackPosition = !1 !== this.opt.position, this.fileName = this.opt.fileName, e) {
|
|
224
|
-
this.nameStartCheck = wt, this.nameCheck = St, this.isName = Gt, this.processAttribs = this.processAttribsNS, this.pushAttrib = this.pushAttribNS, this.ns = {
|
|
225
|
-
__proto__: null,
|
|
226
|
-
...At
|
|
227
|
-
};
|
|
228
|
-
const t = this.opt.additionalNamespaces;
|
|
229
|
-
null != t && (function(t, e) {
|
|
230
|
-
for (const s of Object.keys(e)) qt(t, s, e[s]);
|
|
231
|
-
}(this, t), Object.assign(this.ns, t));
|
|
232
|
-
} else this.nameStartCheck = Tt, this.nameCheck = yt, this.isName = Zt, this.processAttribs = this.processAttribsPlain, this.pushAttrib = this.pushAttribPlain;
|
|
233
|
-
this.stateTable = [
|
|
234
|
-
this.sBegin,
|
|
235
|
-
this.sBeginWhitespace,
|
|
236
|
-
this.sDoctype,
|
|
237
|
-
this.sDoctypeQuote,
|
|
238
|
-
this.sDTD,
|
|
239
|
-
this.sDTDQuoted,
|
|
240
|
-
this.sDTDOpenWaka,
|
|
241
|
-
this.sDTDOpenWakaBang,
|
|
242
|
-
this.sDTDComment,
|
|
243
|
-
this.sDTDCommentEnding,
|
|
244
|
-
this.sDTDCommentEnded,
|
|
245
|
-
this.sDTDPI,
|
|
246
|
-
this.sDTDPIEnding,
|
|
247
|
-
this.sText,
|
|
248
|
-
this.sEntity,
|
|
249
|
-
this.sOpenWaka,
|
|
250
|
-
this.sOpenWakaBang,
|
|
251
|
-
this.sComment,
|
|
252
|
-
this.sCommentEnding,
|
|
253
|
-
this.sCommentEnded,
|
|
254
|
-
this.sCData,
|
|
255
|
-
this.sCDataEnding,
|
|
256
|
-
this.sCDataEnding2,
|
|
257
|
-
this.sPIFirstChar,
|
|
258
|
-
this.sPIRest,
|
|
259
|
-
this.sPIBody,
|
|
260
|
-
this.sPIEnding,
|
|
261
|
-
this.sXMLDeclNameStart,
|
|
262
|
-
this.sXMLDeclName,
|
|
263
|
-
this.sXMLDeclEq,
|
|
264
|
-
this.sXMLDeclValueStart,
|
|
265
|
-
this.sXMLDeclValue,
|
|
266
|
-
this.sXMLDeclSeparator,
|
|
267
|
-
this.sXMLDeclEnding,
|
|
268
|
-
this.sOpenTag,
|
|
269
|
-
this.sOpenTagSlash,
|
|
270
|
-
this.sAttrib,
|
|
271
|
-
this.sAttribName,
|
|
272
|
-
this.sAttribNameSawWhite,
|
|
273
|
-
this.sAttribValue,
|
|
274
|
-
this.sAttribValueQuoted,
|
|
275
|
-
this.sAttribValueClosed,
|
|
276
|
-
this.sAttribValueUnquoted,
|
|
277
|
-
this.sCloseTag,
|
|
278
|
-
this.sCloseTagSawWhite
|
|
279
|
-
], this._init();
|
|
280
|
-
}
|
|
281
|
-
_init() {
|
|
282
|
-
this.openWakaBang = "", this.text = "", this.name = "", this.piTarget = "", this.entity = "", this.q = null, this.tags = [], this.tag = null, this.topNS = null, this.chunk = "", this.chunkPosition = 0, this.i = 0, this.prevI = 0, this.carriedFromPrevious = void 0, this.forbiddenState = 0, this.attribList = [];
|
|
283
|
-
const { fragmentOpt: t } = this;
|
|
284
|
-
this.state = t ? Dt : 0, this.reportedTextBeforeRoot = this.reportedTextAfterRoot = this.closedRoot = this.sawRoot = t, this.xmlDeclPossible = !t, this.xmlDeclExpects = ["version"], this.entityReturnState = void 0;
|
|
285
|
-
let { defaultXMLVersion: e } = this.opt;
|
|
286
|
-
if (void 0 === e) {
|
|
287
|
-
if (!0 === this.opt.forceXMLVersion) throw new Error("forceXMLVersion set but defaultXMLVersion is not set");
|
|
288
|
-
e = "1.0";
|
|
289
|
-
}
|
|
290
|
-
this.setXMLVersion(e), this.positionAtNewLine = 0, this.doctype = !1, this._closed = !1, this.xmlDecl = {
|
|
291
|
-
version: void 0,
|
|
292
|
-
encoding: void 0,
|
|
293
|
-
standalone: void 0
|
|
294
|
-
}, this.line = 1, this.column = 0, this.ENTITIES = Object.create(Et), this.readyHandler?.();
|
|
295
|
-
}
|
|
296
|
-
get position() {
|
|
297
|
-
return this.chunkPosition + this.i;
|
|
298
|
-
}
|
|
299
|
-
get columnIndex() {
|
|
300
|
-
return this.position - this.positionAtNewLine;
|
|
301
|
-
}
|
|
302
|
-
on(t, e) {
|
|
303
|
-
this[Jt[t]] = e;
|
|
304
|
-
}
|
|
305
|
-
off(t) {
|
|
306
|
-
this[Jt[t]] = void 0;
|
|
307
|
-
}
|
|
308
|
-
makeError(t) {
|
|
309
|
-
let e = this.fileName ?? "";
|
|
310
|
-
return this.trackPosition && (e.length > 0 && (e += ":"), e += `${this.line}:${this.column}`), e.length > 0 && (e += ": "), new Error(e + t);
|
|
311
|
-
}
|
|
312
|
-
fail(t) {
|
|
313
|
-
const e = this.makeError(t), s = this.errorHandler;
|
|
314
|
-
if (void 0 === s) throw e;
|
|
315
|
-
return s(e), this;
|
|
316
|
-
}
|
|
317
|
-
write(t) {
|
|
318
|
-
if (this.closed) return this.fail("cannot write after close.");
|
|
319
|
-
let e = !1;
|
|
320
|
-
null === t ? (e = !0, t = "") : "object" == typeof t && (t = t.toString()), void 0 !== this.carriedFromPrevious && (t = `${this.carriedFromPrevious}${t}`, this.carriedFromPrevious = void 0);
|
|
321
|
-
let s = t.length;
|
|
322
|
-
const o = t.charCodeAt(s - 1);
|
|
323
|
-
!e && (13 === o || o >= 55296 && o <= 56319) && (this.carriedFromPrevious = t[s - 1], s--, t = t.slice(0, s));
|
|
324
|
-
const { stateTable: i } = this;
|
|
325
|
-
for (this.chunk = t, this.i = 0; this.i < s;) i[this.state].call(this);
|
|
326
|
-
return this.chunkPosition += s, e ? this.end() : this;
|
|
327
|
-
}
|
|
328
|
-
close() {
|
|
329
|
-
return this.write(null);
|
|
330
|
-
}
|
|
331
|
-
getCode10() {
|
|
332
|
-
const t = this.chunk, e = this.i;
|
|
333
|
-
if (this.prevI = e, this.i++, e >= t.length) return It;
|
|
334
|
-
const s = t.charCodeAt(e);
|
|
335
|
-
if (this.column++, s < 55296) {
|
|
336
|
-
if (s >= 32 || 9 === s) return s;
|
|
337
|
-
switch (s) {
|
|
338
|
-
case Lt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Lt;
|
|
339
|
-
case 13: return t.charCodeAt(e + 1) === Lt && (this.i = e + 2), this.line++, this.column = 0, this.positionAtNewLine = this.position, Ot;
|
|
340
|
-
default: return this.fail("disallowed character."), s;
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
if (s > 56319) return s >= 57344 && s <= 65533 || this.fail("disallowed character."), s;
|
|
344
|
-
const o = 65536 + 1024 * (s - 55296) + (t.charCodeAt(e + 1) - 56320);
|
|
345
|
-
return this.i = e + 2, o > 1114111 && this.fail("disallowed character."), o;
|
|
346
|
-
}
|
|
347
|
-
getCode11() {
|
|
348
|
-
const { chunk: t, i: e } = this;
|
|
349
|
-
if (this.prevI = e, this.i = e + 1, e >= t.length) return It;
|
|
350
|
-
const s = t.charCodeAt(e);
|
|
351
|
-
if (this.column++, s < 55296) {
|
|
352
|
-
if (s > 31 && s < 127 || s > 159 && 8232 !== s || 9 === s) return s;
|
|
353
|
-
switch (s) {
|
|
354
|
-
case Lt: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Lt;
|
|
355
|
-
case 13: {
|
|
356
|
-
const s = t.charCodeAt(e + 1);
|
|
357
|
-
s !== Lt && 133 !== s || (this.i = e + 2);
|
|
358
|
-
}
|
|
359
|
-
case 133:
|
|
360
|
-
case 8232: return this.line++, this.column = 0, this.positionAtNewLine = this.position, Ot;
|
|
361
|
-
default: return this.fail("disallowed character."), s;
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
if (s > 56319) return s >= 57344 && s <= 65533 || this.fail("disallowed character."), s;
|
|
365
|
-
const o = 65536 + 1024 * (s - 55296) + (t.charCodeAt(e + 1) - 56320);
|
|
366
|
-
return this.i = e + 2, o > 1114111 && this.fail("disallowed character."), o;
|
|
367
|
-
}
|
|
368
|
-
getCodeNorm() {
|
|
369
|
-
const t = this.getCode();
|
|
370
|
-
return t === Ot ? Lt : t;
|
|
371
|
-
}
|
|
372
|
-
unGet() {
|
|
373
|
-
this.i = this.prevI, this.column--;
|
|
374
|
-
}
|
|
375
|
-
captureTo(t) {
|
|
376
|
-
let { i: e } = this;
|
|
377
|
-
const { chunk: s } = this;
|
|
378
|
-
for (;;) {
|
|
379
|
-
const o = this.getCode(), i = o === Ot, r = i ? Lt : o;
|
|
380
|
-
if (r === It || t.includes(r)) return this.text += s.slice(e, this.prevI), r;
|
|
381
|
-
i && (this.text += `${s.slice(e, this.prevI)}\n`, e = this.i);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
captureToChar(t) {
|
|
385
|
-
let { i: e } = this;
|
|
386
|
-
const { chunk: s } = this;
|
|
387
|
-
for (;;) {
|
|
388
|
-
let o = this.getCode();
|
|
389
|
-
switch (o) {
|
|
390
|
-
case Ot:
|
|
391
|
-
this.text += `${s.slice(e, this.prevI)}\n`, e = this.i, o = Lt;
|
|
392
|
-
break;
|
|
393
|
-
case It: return this.text += s.slice(e), !1;
|
|
394
|
-
}
|
|
395
|
-
if (o === t) return this.text += s.slice(e, this.prevI), !0;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
captureNameChars() {
|
|
399
|
-
const { chunk: t, i: e } = this;
|
|
400
|
-
for (;;) {
|
|
401
|
-
const s = this.getCode();
|
|
402
|
-
if (s === It) return this.name += t.slice(e), It;
|
|
403
|
-
if (!yt(s)) return this.name += t.slice(e, this.prevI), s === Ot ? Lt : s;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
skipSpaces() {
|
|
407
|
-
for (;;) {
|
|
408
|
-
const t = this.getCodeNorm();
|
|
409
|
-
if (t === It || !mt(t)) return t;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
setXMLVersion(t) {
|
|
413
|
-
this.currentXMLVersion = t, "1.0" === t ? (this.isChar = ft, this.getCode = this.getCode10) : (this.isChar = vt, this.getCode = this.getCode11);
|
|
414
|
-
}
|
|
415
|
-
sBegin() {
|
|
416
|
-
65279 === this.chunk.charCodeAt(0) && (this.i++, this.column++), this.state = 1;
|
|
417
|
-
}
|
|
418
|
-
sBeginWhitespace() {
|
|
419
|
-
const t = this.i, e = this.skipSpaces();
|
|
420
|
-
switch (this.prevI !== t && (this.xmlDeclPossible = !1), e) {
|
|
421
|
-
case $t:
|
|
422
|
-
if (this.state = 15, 0 !== this.text.length) throw new Error("no-empty text at start");
|
|
423
|
-
break;
|
|
424
|
-
case It: break;
|
|
425
|
-
default: this.unGet(), this.state = Dt, this.xmlDeclPossible = !1;
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
sDoctype() {
|
|
429
|
-
const t = this.captureTo(_t);
|
|
430
|
-
switch (t) {
|
|
431
|
-
case Nt:
|
|
432
|
-
this.doctypeHandler?.(this.text), this.text = "", this.state = Dt, this.doctype = !0;
|
|
433
|
-
break;
|
|
434
|
-
case It: break;
|
|
435
|
-
default: this.text += String.fromCodePoint(t), 91 === t ? this.state = 4 : Mt(t) && (this.state = 3, this.q = t);
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
sDoctypeQuote() {
|
|
439
|
-
const t = this.q;
|
|
440
|
-
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.q = null, this.state = 2);
|
|
441
|
-
}
|
|
442
|
-
sDTD() {
|
|
443
|
-
const t = this.captureTo(zt);
|
|
444
|
-
t !== It && (this.text += String.fromCodePoint(t), t === Bt ? this.state = 2 : t === $t ? this.state = 6 : Mt(t) && (this.state = 5, this.q = t));
|
|
445
|
-
}
|
|
446
|
-
sDTDQuoted() {
|
|
447
|
-
const t = this.q;
|
|
448
|
-
this.captureToChar(t) && (this.text += String.fromCodePoint(t), this.state = 4, this.q = null);
|
|
449
|
-
}
|
|
450
|
-
sDTDOpenWaka() {
|
|
451
|
-
const t = this.getCodeNorm();
|
|
452
|
-
switch (this.text += String.fromCodePoint(t), t) {
|
|
453
|
-
case 33:
|
|
454
|
-
this.state = 7, this.openWakaBang = "";
|
|
455
|
-
break;
|
|
456
|
-
case Rt:
|
|
457
|
-
this.state = 11;
|
|
458
|
-
break;
|
|
459
|
-
default: this.state = 4;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
sDTDOpenWakaBang() {
|
|
463
|
-
const t = String.fromCodePoint(this.getCodeNorm()), e = this.openWakaBang += t;
|
|
464
|
-
this.text += t, "-" !== e && (this.state = "--" === e ? 8 : 4, this.openWakaBang = "");
|
|
465
|
-
}
|
|
466
|
-
sDTDComment() {
|
|
467
|
-
this.captureToChar(45) && (this.text += "-", this.state = 9);
|
|
468
|
-
}
|
|
469
|
-
sDTDCommentEnding() {
|
|
470
|
-
const t = this.getCodeNorm();
|
|
471
|
-
this.text += String.fromCodePoint(t), this.state = 45 === t ? 10 : 8;
|
|
472
|
-
}
|
|
473
|
-
sDTDCommentEnded() {
|
|
474
|
-
const t = this.getCodeNorm();
|
|
475
|
-
this.text += String.fromCodePoint(t), t === Nt ? this.state = 4 : (this.fail("malformed comment."), this.state = 8);
|
|
476
|
-
}
|
|
477
|
-
sDTDPI() {
|
|
478
|
-
this.captureToChar(Rt) && (this.text += "?", this.state = 12);
|
|
479
|
-
}
|
|
480
|
-
sDTDPIEnding() {
|
|
481
|
-
const t = this.getCodeNorm();
|
|
482
|
-
this.text += String.fromCodePoint(t), t === Nt && (this.state = 4);
|
|
483
|
-
}
|
|
484
|
-
sText() {
|
|
485
|
-
0 !== this.tags.length ? this.handleTextInRoot() : this.handleTextOutsideRoot();
|
|
486
|
-
}
|
|
487
|
-
sEntity() {
|
|
488
|
-
let { i: t } = this;
|
|
489
|
-
const { chunk: e } = this;
|
|
490
|
-
t: for (;;) switch (this.getCode()) {
|
|
491
|
-
case Ot:
|
|
492
|
-
this.entity += `${e.slice(t, this.prevI)}\n`, t = this.i;
|
|
493
|
-
break;
|
|
494
|
-
case 59: {
|
|
495
|
-
const { entityReturnState: s } = this, o = this.entity + e.slice(t, this.prevI);
|
|
496
|
-
let i;
|
|
497
|
-
this.state = s, "" === o ? (this.fail("empty entity name."), i = "&;") : (i = this.parseEntity(o), this.entity = ""), s === Dt && void 0 === this.textHandler || (this.text += i);
|
|
498
|
-
break t;
|
|
499
|
-
}
|
|
500
|
-
case It:
|
|
501
|
-
this.entity += e.slice(t);
|
|
502
|
-
break t;
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
sOpenWaka() {
|
|
506
|
-
const t = this.getCode();
|
|
507
|
-
if (Tt(t)) this.state = 34, this.unGet(), this.xmlDeclPossible = !1;
|
|
508
|
-
else switch (t) {
|
|
509
|
-
case 47:
|
|
510
|
-
this.state = 43, this.xmlDeclPossible = !1;
|
|
511
|
-
break;
|
|
512
|
-
case 33:
|
|
513
|
-
this.state = 16, this.openWakaBang = "", this.xmlDeclPossible = !1;
|
|
514
|
-
break;
|
|
515
|
-
case Rt:
|
|
516
|
-
this.state = 23;
|
|
517
|
-
break;
|
|
518
|
-
default: this.fail("disallowed character in tag name"), this.state = Dt, this.xmlDeclPossible = !1;
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
sOpenWakaBang() {
|
|
522
|
-
switch (this.openWakaBang += String.fromCodePoint(this.getCodeNorm()), this.openWakaBang) {
|
|
523
|
-
case "[CDATA[":
|
|
524
|
-
this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0), this.state = 20, this.openWakaBang = "";
|
|
525
|
-
break;
|
|
526
|
-
case "--":
|
|
527
|
-
this.state = 17, this.openWakaBang = "";
|
|
528
|
-
break;
|
|
529
|
-
case "DOCTYPE":
|
|
530
|
-
this.state = 2, (this.doctype || this.sawRoot) && this.fail("inappropriately located doctype declaration."), this.openWakaBang = "";
|
|
531
|
-
break;
|
|
532
|
-
default: this.openWakaBang.length >= 7 && this.fail("incorrect syntax.");
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
sComment() {
|
|
536
|
-
this.captureToChar(45) && (this.state = 18);
|
|
537
|
-
}
|
|
538
|
-
sCommentEnding() {
|
|
539
|
-
const t = this.getCodeNorm();
|
|
540
|
-
45 === t ? (this.state = 19, this.commentHandler?.(this.text), this.text = "") : (this.text += `-${String.fromCodePoint(t)}`, this.state = 17);
|
|
541
|
-
}
|
|
542
|
-
sCommentEnded() {
|
|
543
|
-
const t = this.getCodeNorm();
|
|
544
|
-
t !== Nt ? (this.fail("malformed comment."), this.text += `--${String.fromCodePoint(t)}`, this.state = 17) : this.state = Dt;
|
|
545
|
-
}
|
|
546
|
-
sCData() {
|
|
547
|
-
this.captureToChar(Bt) && (this.state = 21);
|
|
548
|
-
}
|
|
549
|
-
sCDataEnding() {
|
|
550
|
-
const t = this.getCodeNorm();
|
|
551
|
-
t === Bt ? this.state = 22 : (this.text += `]${String.fromCodePoint(t)}`, this.state = 20);
|
|
552
|
-
}
|
|
553
|
-
sCDataEnding2() {
|
|
554
|
-
const t = this.getCodeNorm();
|
|
555
|
-
switch (t) {
|
|
556
|
-
case Nt:
|
|
557
|
-
this.cdataHandler?.(this.text), this.text = "", this.state = Dt;
|
|
558
|
-
break;
|
|
559
|
-
case Bt:
|
|
560
|
-
this.text += "]";
|
|
561
|
-
break;
|
|
562
|
-
default: this.text += `]]${String.fromCodePoint(t)}`, this.state = 20;
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
sPIFirstChar() {
|
|
566
|
-
const t = this.getCodeNorm();
|
|
567
|
-
this.nameStartCheck(t) ? (this.piTarget += String.fromCodePoint(t), this.state = 24) : t === Rt || mt(t) ? (this.fail("processing instruction without a target."), this.state = t === Rt ? 26 : 25) : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(t), this.state = 24);
|
|
568
|
-
}
|
|
569
|
-
sPIRest() {
|
|
570
|
-
const { chunk: t, i: e } = this;
|
|
571
|
-
for (;;) {
|
|
572
|
-
const s = this.getCodeNorm();
|
|
573
|
-
if (s === It) return void (this.piTarget += t.slice(e));
|
|
574
|
-
if (!this.nameCheck(s)) {
|
|
575
|
-
this.piTarget += t.slice(e, this.prevI);
|
|
576
|
-
const o = s === Rt;
|
|
577
|
-
o || mt(s) ? "xml" === this.piTarget ? (this.xmlDeclPossible || this.fail("an XML declaration must be at the start of the document."), this.state = o ? Vt : 27) : this.state = o ? 26 : 25 : (this.fail("disallowed character in processing instruction name."), this.piTarget += String.fromCodePoint(s));
|
|
578
|
-
break;
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
sPIBody() {
|
|
583
|
-
if (0 === this.text.length) {
|
|
584
|
-
const t = this.getCodeNorm();
|
|
585
|
-
t === Rt ? this.state = 26 : mt(t) || (this.text = String.fromCodePoint(t));
|
|
586
|
-
} else this.captureToChar(Rt) && (this.state = 26);
|
|
587
|
-
}
|
|
588
|
-
sPIEnding() {
|
|
589
|
-
const t = this.getCodeNorm();
|
|
590
|
-
if (t === Nt) {
|
|
591
|
-
const { piTarget: t } = this;
|
|
592
|
-
"xml" === t.toLowerCase() && this.fail("the XML declaration must appear at the start of the document."), this.piHandler?.({
|
|
593
|
-
target: t,
|
|
594
|
-
body: this.text
|
|
595
|
-
}), this.piTarget = this.text = "", this.state = Dt;
|
|
596
|
-
} else t === Rt ? this.text += "?" : (this.text += `?${String.fromCodePoint(t)}`, this.state = 25);
|
|
597
|
-
this.xmlDeclPossible = !1;
|
|
598
|
-
}
|
|
599
|
-
sXMLDeclNameStart() {
|
|
600
|
-
const t = this.skipSpaces();
|
|
601
|
-
t !== Rt ? t !== It && (this.state = 28, this.name = String.fromCodePoint(t)) : this.state = Vt;
|
|
602
|
-
}
|
|
603
|
-
sXMLDeclName() {
|
|
604
|
-
const t = this.captureTo(Xt);
|
|
605
|
-
if (t === Rt) return this.state = Vt, this.name += this.text, this.text = "", void this.fail("XML declaration is incomplete.");
|
|
606
|
-
if (mt(t) || t === jt) {
|
|
607
|
-
if (this.name += this.text, this.text = "", !this.xmlDeclExpects.includes(this.name)) switch (this.name.length) {
|
|
608
|
-
case 0:
|
|
609
|
-
this.fail("did not expect any more name/value pairs.");
|
|
610
|
-
break;
|
|
611
|
-
case 1:
|
|
612
|
-
this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);
|
|
613
|
-
break;
|
|
614
|
-
default: this.fail(`expected one of ${this.xmlDeclExpects.join(", ")}`);
|
|
615
|
-
}
|
|
616
|
-
this.state = t === jt ? 30 : 29;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
sXMLDeclEq() {
|
|
620
|
-
const t = this.getCodeNorm();
|
|
621
|
-
if (t === Rt) return this.state = Vt, void this.fail("XML declaration is incomplete.");
|
|
622
|
-
mt(t) || (t !== jt && this.fail("value required."), this.state = 30);
|
|
623
|
-
}
|
|
624
|
-
sXMLDeclValueStart() {
|
|
625
|
-
const t = this.getCodeNorm();
|
|
626
|
-
if (t === Rt) return this.state = Vt, void this.fail("XML declaration is incomplete.");
|
|
627
|
-
mt(t) || (Mt(t) ? this.q = t : (this.fail("value must be quoted."), this.q = 32), this.state = 31);
|
|
628
|
-
}
|
|
629
|
-
sXMLDeclValue() {
|
|
630
|
-
const t = this.captureTo([this.q, Rt]);
|
|
631
|
-
if (t === Rt) return this.state = Vt, this.text = "", void this.fail("XML declaration is incomplete.");
|
|
632
|
-
if (t === It) return;
|
|
633
|
-
const e = this.text;
|
|
634
|
-
switch (this.text = "", this.name) {
|
|
635
|
-
case "version": {
|
|
636
|
-
this.xmlDeclExpects = ["encoding", "standalone"];
|
|
637
|
-
const t = e;
|
|
638
|
-
this.xmlDecl.version = t, /^1\.[0-9]+$/.test(t) ? this.opt.forceXMLVersion || this.setXMLVersion(t) : this.fail("version number must match /^1\\.[0-9]+$/.");
|
|
639
|
-
break;
|
|
640
|
-
}
|
|
641
|
-
case "encoding":
|
|
642
|
-
/^[A-Za-z][A-Za-z0-9._-]*$/.test(e) || this.fail("encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/."), this.xmlDeclExpects = ["standalone"], this.xmlDecl.encoding = e;
|
|
643
|
-
break;
|
|
644
|
-
case "standalone": "yes" !== e && "no" !== e && this.fail("standalone value must match \"yes\" or \"no\"."), this.xmlDeclExpects = [], this.xmlDecl.standalone = e;
|
|
645
|
-
}
|
|
646
|
-
this.name = "", this.state = 32;
|
|
647
|
-
}
|
|
648
|
-
sXMLDeclSeparator() {
|
|
649
|
-
const t = this.getCodeNorm();
|
|
650
|
-
t !== Rt ? (mt(t) || (this.fail("whitespace required."), this.unGet()), this.state = 27) : this.state = Vt;
|
|
651
|
-
}
|
|
652
|
-
sXMLDeclEnding() {
|
|
653
|
-
this.getCodeNorm() === Nt ? ("xml" !== this.piTarget ? this.fail("processing instructions are not allowed before root.") : "version" !== this.name && this.xmlDeclExpects.includes("version") && this.fail("XML declaration must contain a version."), this.xmlDeclHandler?.(this.xmlDecl), this.name = "", this.piTarget = this.text = "", this.state = Dt) : this.fail("The character ? is disallowed anywhere in XML declarations."), this.xmlDeclPossible = !1;
|
|
654
|
-
}
|
|
655
|
-
sOpenTag() {
|
|
656
|
-
const t = this.captureNameChars();
|
|
657
|
-
if (t === It) return;
|
|
658
|
-
const e = this.tag = {
|
|
659
|
-
name: this.name,
|
|
660
|
-
attributes: Object.create(null)
|
|
661
|
-
};
|
|
662
|
-
switch (this.name = "", this.xmlnsOpt && (this.topNS = e.ns = Object.create(null)), this.openTagStartHandler?.(e), this.sawRoot = !0, !this.fragmentOpt && this.closedRoot && this.fail("documents may contain only one root."), t) {
|
|
663
|
-
case Nt:
|
|
664
|
-
this.openTag();
|
|
665
|
-
break;
|
|
666
|
-
case 47:
|
|
667
|
-
this.state = 35;
|
|
668
|
-
break;
|
|
669
|
-
default: mt(t) || this.fail("disallowed character in tag name."), this.state = 36;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
sOpenTagSlash() {
|
|
673
|
-
this.getCode() === Nt ? this.openSelfClosingTag() : (this.fail("forward-slash in opening tag not followed by >."), this.state = 36);
|
|
674
|
-
}
|
|
675
|
-
sAttrib() {
|
|
676
|
-
const t = this.skipSpaces();
|
|
677
|
-
t !== It && (Tt(t) ? (this.unGet(), this.state = 37) : t === Nt ? this.openTag() : 47 === t ? this.state = 35 : this.fail("disallowed character in attribute name."));
|
|
678
|
-
}
|
|
679
|
-
sAttribName() {
|
|
680
|
-
const t = this.captureNameChars();
|
|
681
|
-
t === jt ? this.state = 39 : mt(t) ? this.state = 38 : t === Nt ? (this.fail("attribute without value."), this.pushAttrib(this.name, this.name), this.name = this.text = "", this.openTag()) : t !== It && this.fail("disallowed character in attribute name.");
|
|
682
|
-
}
|
|
683
|
-
sAttribNameSawWhite() {
|
|
684
|
-
const t = this.skipSpaces();
|
|
685
|
-
switch (t) {
|
|
686
|
-
case It: return;
|
|
687
|
-
case jt:
|
|
688
|
-
this.state = 39;
|
|
689
|
-
break;
|
|
690
|
-
default: this.fail("attribute without value."), this.text = "", this.name = "", t === Nt ? this.openTag() : Tt(t) ? (this.unGet(), this.state = 37) : (this.fail("disallowed character in attribute name."), this.state = 36);
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
sAttribValue() {
|
|
694
|
-
const t = this.getCodeNorm();
|
|
695
|
-
Mt(t) ? (this.q = t, this.state = 40) : mt(t) || (this.fail("unquoted attribute value."), this.state = 42, this.unGet());
|
|
696
|
-
}
|
|
697
|
-
sAttribValueQuoted() {
|
|
698
|
-
const { q: t, chunk: e } = this;
|
|
699
|
-
let { i: s } = this;
|
|
700
|
-
for (;;) switch (this.getCode()) {
|
|
701
|
-
case t:
|
|
702
|
-
this.pushAttrib(this.name, this.text + e.slice(s, this.prevI)), this.name = this.text = "", this.q = null, this.state = 41;
|
|
703
|
-
return;
|
|
704
|
-
case 38:
|
|
705
|
-
this.text += e.slice(s, this.prevI), this.state = 14, this.entityReturnState = 40;
|
|
706
|
-
return;
|
|
707
|
-
case Lt:
|
|
708
|
-
case Ot:
|
|
709
|
-
case 9:
|
|
710
|
-
this.text += `${e.slice(s, this.prevI)} `, s = this.i;
|
|
711
|
-
break;
|
|
712
|
-
case $t:
|
|
713
|
-
this.text += e.slice(s, this.prevI), this.fail("disallowed character.");
|
|
714
|
-
return;
|
|
715
|
-
case It:
|
|
716
|
-
this.text += e.slice(s);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
|
-
sAttribValueClosed() {
|
|
721
|
-
const t = this.getCodeNorm();
|
|
722
|
-
mt(t) ? this.state = 36 : t === Nt ? this.openTag() : 47 === t ? this.state = 35 : Tt(t) ? (this.fail("no whitespace between attributes."), this.unGet(), this.state = 37) : this.fail("disallowed character in attribute name.");
|
|
723
|
-
}
|
|
724
|
-
sAttribValueUnquoted() {
|
|
725
|
-
const t = this.captureTo(Ft);
|
|
726
|
-
switch (t) {
|
|
727
|
-
case 38:
|
|
728
|
-
this.state = 14, this.entityReturnState = 42;
|
|
729
|
-
break;
|
|
730
|
-
case $t:
|
|
731
|
-
this.fail("disallowed character.");
|
|
732
|
-
break;
|
|
733
|
-
case It: break;
|
|
734
|
-
default: this.text.includes("]]>") && this.fail("the string \"]]>\" is disallowed in char data."), this.pushAttrib(this.name, this.text), this.name = this.text = "", t === Nt ? this.openTag() : this.state = 36;
|
|
735
|
-
}
|
|
736
|
-
}
|
|
737
|
-
sCloseTag() {
|
|
738
|
-
const t = this.captureNameChars();
|
|
739
|
-
t === Nt ? this.closeTag() : mt(t) ? this.state = 44 : t !== It && this.fail("disallowed character in closing tag.");
|
|
740
|
-
}
|
|
741
|
-
sCloseTagSawWhite() {
|
|
742
|
-
switch (this.skipSpaces()) {
|
|
743
|
-
case Nt:
|
|
744
|
-
this.closeTag();
|
|
745
|
-
break;
|
|
746
|
-
case It: break;
|
|
747
|
-
default: this.fail("disallowed character in closing tag.");
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
handleTextInRoot() {
|
|
751
|
-
let { i: t, forbiddenState: e } = this;
|
|
752
|
-
const { chunk: s, textHandler: o } = this;
|
|
753
|
-
t: for (;;) switch (this.getCode()) {
|
|
754
|
-
case $t:
|
|
755
|
-
if (this.state = 15, void 0 !== o) {
|
|
756
|
-
const { text: e } = this, i = s.slice(t, this.prevI);
|
|
757
|
-
0 !== e.length ? (o(e + i), this.text = "") : 0 !== i.length && o(i);
|
|
758
|
-
}
|
|
759
|
-
e = 0;
|
|
760
|
-
break t;
|
|
761
|
-
case 38:
|
|
762
|
-
this.state = 14, this.entityReturnState = Dt, void 0 !== o && (this.text += s.slice(t, this.prevI)), e = 0;
|
|
763
|
-
break t;
|
|
764
|
-
case Bt:
|
|
765
|
-
switch (e) {
|
|
766
|
-
case 0:
|
|
767
|
-
e = 1;
|
|
768
|
-
break;
|
|
769
|
-
case 1:
|
|
770
|
-
e = 2;
|
|
771
|
-
break;
|
|
772
|
-
case 2: break;
|
|
773
|
-
default: throw new Error("impossible state");
|
|
774
|
-
}
|
|
775
|
-
break;
|
|
776
|
-
case Nt:
|
|
777
|
-
2 === e && this.fail("the string \"]]>\" is disallowed in char data."), e = 0;
|
|
778
|
-
break;
|
|
779
|
-
case Ot:
|
|
780
|
-
void 0 !== o && (this.text += `${s.slice(t, this.prevI)}\n`), t = this.i, e = 0;
|
|
781
|
-
break;
|
|
782
|
-
case It:
|
|
783
|
-
void 0 !== o && (this.text += s.slice(t));
|
|
784
|
-
break t;
|
|
785
|
-
default: e = 0;
|
|
786
|
-
}
|
|
787
|
-
this.forbiddenState = e;
|
|
788
|
-
}
|
|
789
|
-
handleTextOutsideRoot() {
|
|
790
|
-
let { i: t } = this;
|
|
791
|
-
const { chunk: e, textHandler: s } = this;
|
|
792
|
-
let o = !1;
|
|
793
|
-
t: for (;;) {
|
|
794
|
-
const i = this.getCode();
|
|
795
|
-
switch (i) {
|
|
796
|
-
case $t:
|
|
797
|
-
if (this.state = 15, void 0 !== s) {
|
|
798
|
-
const { text: o } = this, i = e.slice(t, this.prevI);
|
|
799
|
-
0 !== o.length ? (s(o + i), this.text = "") : 0 !== i.length && s(i);
|
|
800
|
-
}
|
|
801
|
-
break t;
|
|
802
|
-
case 38:
|
|
803
|
-
this.state = 14, this.entityReturnState = Dt, void 0 !== s && (this.text += e.slice(t, this.prevI)), o = !0;
|
|
804
|
-
break t;
|
|
805
|
-
case Ot:
|
|
806
|
-
void 0 !== s && (this.text += `${e.slice(t, this.prevI)}\n`), t = this.i;
|
|
807
|
-
break;
|
|
808
|
-
case It:
|
|
809
|
-
void 0 !== s && (this.text += e.slice(t));
|
|
810
|
-
break t;
|
|
811
|
-
default: mt(i) || (o = !0);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
o && (this.sawRoot || this.reportedTextBeforeRoot || (this.fail("text data outside of root node."), this.reportedTextBeforeRoot = !0), this.closedRoot && !this.reportedTextAfterRoot && (this.fail("text data outside of root node."), this.reportedTextAfterRoot = !0));
|
|
815
|
-
}
|
|
816
|
-
pushAttribNS(t, e) {
|
|
817
|
-
const { prefix: s, local: o } = this.qName(t), i = {
|
|
818
|
-
name: t,
|
|
819
|
-
prefix: s,
|
|
820
|
-
local: o,
|
|
821
|
-
value: e
|
|
822
|
-
};
|
|
823
|
-
if (this.attribList.push(i), this.attributeHandler?.(i), "xmlns" === s) {
|
|
824
|
-
const t = e.trim();
|
|
825
|
-
"1.0" === this.currentXMLVersion && "" === t && this.fail("invalid attempt to undefine prefix in XML 1.0"), this.topNS[o] = t, qt(this, o, t);
|
|
826
|
-
} else if ("xmlns" === t) {
|
|
827
|
-
const t = e.trim();
|
|
828
|
-
this.topNS[""] = t, qt(this, "", t);
|
|
829
|
-
}
|
|
830
|
-
}
|
|
831
|
-
pushAttribPlain(t, e) {
|
|
832
|
-
const s = {
|
|
833
|
-
name: t,
|
|
834
|
-
value: e
|
|
835
|
-
};
|
|
836
|
-
this.attribList.push(s), this.attributeHandler?.(s);
|
|
837
|
-
}
|
|
838
|
-
end() {
|
|
839
|
-
this.sawRoot || this.fail("document must contain a root element.");
|
|
840
|
-
const { tags: t } = this;
|
|
841
|
-
for (; t.length > 0;) {
|
|
842
|
-
const e = t.pop();
|
|
843
|
-
this.fail(`unclosed tag: ${e.name}`);
|
|
844
|
-
}
|
|
845
|
-
0 !== this.state && this.state !== Dt && this.fail("unexpected end.");
|
|
846
|
-
const { text: e } = this;
|
|
847
|
-
return 0 !== e.length && (this.textHandler?.(e), this.text = ""), this._closed = !0, this.endHandler?.(), this._init(), this;
|
|
848
|
-
}
|
|
849
|
-
resolve(t) {
|
|
850
|
-
let e = this.topNS[t];
|
|
851
|
-
if (void 0 !== e) return e;
|
|
852
|
-
const { tags: s } = this;
|
|
853
|
-
for (let o = s.length - 1; o >= 0; o--) if (e = s[o].ns[t], void 0 !== e) return e;
|
|
854
|
-
return e = this.ns[t], void 0 !== e ? e : this.opt.resolvePrefix?.(t);
|
|
855
|
-
}
|
|
856
|
-
qName(t) {
|
|
857
|
-
const e = t.indexOf(":");
|
|
858
|
-
if (-1 === e) return {
|
|
859
|
-
prefix: "",
|
|
860
|
-
local: t
|
|
861
|
-
};
|
|
862
|
-
const s = t.slice(e + 1), o = t.slice(0, e);
|
|
863
|
-
return ("" === o || "" === s || s.includes(":")) && this.fail(`malformed name: ${t}.`), {
|
|
864
|
-
prefix: o,
|
|
865
|
-
local: s
|
|
866
|
-
};
|
|
867
|
-
}
|
|
868
|
-
processAttribsNS() {
|
|
869
|
-
const { attribList: t } = this, e = this.tag;
|
|
870
|
-
{
|
|
871
|
-
const { prefix: t, local: s } = this.qName(e.name);
|
|
872
|
-
e.prefix = t, e.local = s;
|
|
873
|
-
const o = e.uri = this.resolve(t) ?? "";
|
|
874
|
-
"" !== t && ("xmlns" === t && this.fail("tags may not have \"xmlns\" as prefix."), "" === o && (this.fail(`unbound namespace prefix: ${JSON.stringify(t)}.`), e.uri = t));
|
|
875
|
-
}
|
|
876
|
-
if (0 === t.length) return;
|
|
877
|
-
const { attributes: s } = e, o = /* @__PURE__ */ new Set();
|
|
878
|
-
for (const e of t) {
|
|
879
|
-
const { name: t, prefix: i, local: r } = e;
|
|
880
|
-
let n, a;
|
|
881
|
-
"" === i ? (n = "xmlns" === t ? Pt : "", a = t) : (n = this.resolve(i), void 0 === n && (this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`), n = i), a = `{${n}}${r}`), o.has(a) && this.fail(`duplicate attribute: ${a}.`), o.add(a), e.uri = n, s[t] = e;
|
|
882
|
-
}
|
|
883
|
-
this.attribList = [];
|
|
884
|
-
}
|
|
885
|
-
processAttribsPlain() {
|
|
886
|
-
const { attribList: t } = this, e = this.tag.attributes;
|
|
887
|
-
for (const { name: s, value: o } of t) void 0 !== e[s] && this.fail(`duplicate attribute: ${s}.`), e[s] = o;
|
|
888
|
-
this.attribList = [];
|
|
889
|
-
}
|
|
890
|
-
openTag() {
|
|
891
|
-
this.processAttribs();
|
|
892
|
-
const { tags: t } = this, e = this.tag;
|
|
893
|
-
e.isSelfClosing = !1, this.openTagHandler?.(e), t.push(e), this.state = Dt, this.name = "";
|
|
894
|
-
}
|
|
895
|
-
openSelfClosingTag() {
|
|
896
|
-
this.processAttribs();
|
|
897
|
-
const { tags: t } = this, e = this.tag;
|
|
898
|
-
e.isSelfClosing = !0, this.openTagHandler?.(e), this.closeTagHandler?.(e), null === (this.tag = t[t.length - 1] ?? null) && (this.closedRoot = !0), this.state = Dt, this.name = "";
|
|
899
|
-
}
|
|
900
|
-
closeTag() {
|
|
901
|
-
const { tags: t, name: e } = this;
|
|
902
|
-
if (this.state = Dt, this.name = "", "" === e) return this.fail("weird empty close tag."), void (this.text += "</>");
|
|
903
|
-
const s = this.closeTagHandler;
|
|
904
|
-
let o = t.length;
|
|
905
|
-
for (; o-- > 0;) {
|
|
906
|
-
const o = this.tag = t.pop();
|
|
907
|
-
if (this.topNS = o.ns, s?.(o), o.name === e) break;
|
|
908
|
-
this.fail(`unexpected close tag: ${e}.`);
|
|
909
|
-
}
|
|
910
|
-
0 === o ? this.closedRoot = !0 : o < 0 && (this.fail(`unmatched closing tag: ${e}.`), this.text += `</${e}>`);
|
|
911
|
-
}
|
|
912
|
-
parseEntity(t) {
|
|
913
|
-
if ("#" !== t[0]) {
|
|
914
|
-
const e = this.ENTITIES[t];
|
|
915
|
-
return void 0 !== e ? e : (this.fail(this.isName(t) ? "undefined entity." : "disallowed character in entity name."), `&${t};`);
|
|
916
|
-
}
|
|
917
|
-
let e = NaN;
|
|
918
|
-
return "x" === t[1] && /^#x[0-9a-f]+$/i.test(t) ? e = parseInt(t.slice(2), 16) : /^#[0-9]+$/.test(t) && (e = parseInt(t.slice(1), 10)), this.isChar(e) ? String.fromCodePoint(e) : (this.fail("malformed character entity."), `&${t};`);
|
|
919
|
-
}
|
|
920
|
-
};
|
|
921
|
-
(Ut = Wt || (Wt = {})).Events = {
|
|
922
|
-
XmlDecl: "xmldecl",
|
|
923
|
-
Text: "text",
|
|
924
|
-
ProcessingInstruction: "processinginstruction",
|
|
925
|
-
Doctype: "doctype",
|
|
926
|
-
Comment: "comment",
|
|
927
|
-
OpenTagStart: "opentagstart",
|
|
928
|
-
Attribute: "attribute",
|
|
929
|
-
OpenTag: "opentag",
|
|
930
|
-
CloseTag: "closetag",
|
|
931
|
-
CDdata: "cdata",
|
|
932
|
-
Error: "error",
|
|
933
|
-
End: "end",
|
|
934
|
-
Ready: "ready"
|
|
935
|
-
}, Ut.parseStream = async (t, e, s) => {
|
|
936
|
-
const o = new Qt({
|
|
937
|
-
position: !1,
|
|
938
|
-
...s
|
|
939
|
-
});
|
|
940
|
-
let i;
|
|
941
|
-
e.onOpenTagStart && o.on(Wt.Events.OpenTagStart, e.onOpenTagStart), e.onOpenTag && o.on(Wt.Events.OpenTag, e.onOpenTag), e.onCloseTag && o.on(Wt.Events.CloseTag, e.onCloseTag), e.onAttribute && o.on(Wt.Events.Attribute, e.onAttribute), e.onText && o.on(Wt.Events.Text, e.onText), e.onError && o.on(Wt.Events.Error, e.onError);
|
|
942
|
-
const r = e.onEnd;
|
|
943
|
-
if (r) {
|
|
944
|
-
const t = () => {
|
|
945
|
-
i = r();
|
|
946
|
-
};
|
|
947
|
-
o.on(Wt.Events.End, t);
|
|
948
|
-
}
|
|
949
|
-
for (;;) {
|
|
950
|
-
const { value: e, done: s } = await t.read();
|
|
951
|
-
if (s) break;
|
|
952
|
-
o.write(e);
|
|
953
|
-
}
|
|
954
|
-
return o.close(), i;
|
|
955
|
-
};
|
|
956
|
-
var Kt = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null, Yt = (t) => {
|
|
957
|
-
const e = parseInt(t);
|
|
958
|
-
return isNaN(e) ? null : e;
|
|
959
|
-
}, te = (t) => {
|
|
960
|
-
const e = parseFloat(t);
|
|
961
|
-
return isNaN(e) ? null : e;
|
|
962
|
-
}, ee = null, se = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), oe = (t) => se(t).replace(/"/g, """), ie = class {
|
|
963
|
-
constructor() {
|
|
964
|
-
this._registeredVisitors = /* @__PURE__ */ new Map();
|
|
965
|
-
}
|
|
966
|
-
registerVisitor(t) {
|
|
967
|
-
this._registeredVisitors.set(t.from, t);
|
|
968
|
-
}
|
|
969
|
-
createEventHandler(t, e, s) {
|
|
970
|
-
const o = this._registeredVisitors, i = [], r = [];
|
|
971
|
-
let n = null, a = null, c = null, l = null;
|
|
972
|
-
const h = [], p = {
|
|
973
|
-
key: null,
|
|
974
|
-
source: t,
|
|
975
|
-
parent: null
|
|
976
|
-
};
|
|
977
|
-
let u = null, d = !1, g = null, m = null, f = null;
|
|
978
|
-
const T = (t, e) => {
|
|
979
|
-
let s = c.attributes[t];
|
|
980
|
-
if (e) if (Array.isArray(e)) {
|
|
981
|
-
const t = e.length;
|
|
982
|
-
for (let o = 0; o < t; o++) {
|
|
983
|
-
if (null == s) return;
|
|
984
|
-
if (s = e[o](s), null == s) return;
|
|
985
|
-
}
|
|
986
|
-
} else {
|
|
987
|
-
if (null == s) return;
|
|
988
|
-
if (s = e(s), null == s) return;
|
|
989
|
-
}
|
|
990
|
-
return s;
|
|
991
|
-
}, y = {
|
|
992
|
-
getSource: () => u?.source ?? null,
|
|
993
|
-
setSource: (t) => {
|
|
994
|
-
u.source = t;
|
|
995
|
-
},
|
|
996
|
-
setKey: (t) => {
|
|
997
|
-
u.key = t;
|
|
998
|
-
},
|
|
999
|
-
getFrom: () => c,
|
|
1000
|
-
getAttribute: (t, e) => T(t, e) ?? null,
|
|
1001
|
-
hasAttribute: (t) => null !== y.getAttribute(t),
|
|
1002
|
-
getParent: () => {
|
|
1003
|
-
const t = h[h.length - 2];
|
|
1004
|
-
return t.parent ?? t.source;
|
|
1005
|
-
},
|
|
1006
|
-
getPath: () => {
|
|
1007
|
-
const t = [], e = r.length;
|
|
1008
|
-
for (let s = 0; s < e; s++) t.push(r[s].local);
|
|
1009
|
-
return t.join("\\");
|
|
1010
|
-
},
|
|
1011
|
-
parseAttribute: T,
|
|
1012
|
-
getRawXml: () => f,
|
|
1013
|
-
copyToObject: (t, e, s, o) => {
|
|
1014
|
-
const i = T(o ?? e, s);
|
|
1015
|
-
void 0 !== i && (t[e] = i);
|
|
1016
|
-
},
|
|
1017
|
-
copyTo: (t, e, s) => {
|
|
1018
|
-
const o = T(s ?? t, e);
|
|
1019
|
-
void 0 !== o && (u.source[t] = o);
|
|
1020
|
-
},
|
|
1021
|
-
warn: (t) => {
|
|
1022
|
-
s ? s?.(t) : console.warn(t);
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
return {
|
|
1026
|
-
onOpenTag: (t) => {
|
|
1027
|
-
let e = t.name;
|
|
1028
|
-
const s = e.indexOf(":");
|
|
1029
|
-
if (-1 !== s && (e = e.slice(s + 1)), g) return g.push(((t) => {
|
|
1030
|
-
const e = t.attributes ?? {};
|
|
1031
|
-
let s = `<${t.name}`;
|
|
1032
|
-
for (const t in e) {
|
|
1033
|
-
const o = e[t];
|
|
1034
|
-
s += ` ${t}="${oe("string" == typeof o ? o : o?.value ?? "")}"`;
|
|
1035
|
-
}
|
|
1036
|
-
return s + ">";
|
|
1037
|
-
})(t)), n = {
|
|
1038
|
-
local: e,
|
|
1039
|
-
tag: t,
|
|
1040
|
-
destination: null
|
|
1041
|
-
}, r.push(n), a = e, void (c = t);
|
|
1042
|
-
const f = (i.length > 0 ? i[i.length - 1] : o).get(e);
|
|
1043
|
-
if (n = {
|
|
1044
|
-
local: e,
|
|
1045
|
-
visitor: f,
|
|
1046
|
-
tag: t,
|
|
1047
|
-
destination: null
|
|
1048
|
-
}, d) return r.push(n), a = e, void (c = t);
|
|
1049
|
-
l = n?.visitor ?? null, a = e, c = t;
|
|
1050
|
-
let T = !!f && null === f.to;
|
|
1051
|
-
if (f && !T && f.scope) {
|
|
1052
|
-
const t = f.scope(y);
|
|
1053
|
-
null === t ? T = !0 : t && (i.push(t), n.pushedScope = !0);
|
|
1054
|
-
}
|
|
1055
|
-
f && (0 === r.length ? (u = p, n.destination = u, n.pushedDestination = !0, h.push(u)) : T ? (u = null, n.destination = null) : f.transparent ? n.destination = u : (u = {
|
|
1056
|
-
key: null,
|
|
1057
|
-
source: {},
|
|
1058
|
-
parent: null
|
|
1059
|
-
}, n.destination = u, n.pushedDestination = !0, h.push(u))), r.push(n), d = T;
|
|
1060
|
-
const x = l?.openTag?.(y);
|
|
1061
|
-
void 0 !== x && (u.parent = x), f?.raw && !T && (g = [], m = n);
|
|
1062
|
-
},
|
|
1063
|
-
onCloseTag: (t) => {
|
|
1064
|
-
let e = t.name;
|
|
1065
|
-
const o = e.indexOf(":");
|
|
1066
|
-
if (-1 !== o && (e = e.slice(o + 1)), e !== a) throw new Error(`mismatch open/close tag: '${e}'/'${a}'`);
|
|
1067
|
-
let T = !1;
|
|
1068
|
-
if (g) {
|
|
1069
|
-
if (r[r.length - 1] !== m) return g.push(`</${t.name}>`), r.pop(), n = r[r.length - 1] ?? null, a = n?.local ?? null, void (c = n?.tag ?? null);
|
|
1070
|
-
f = g.join(""), g = null, m = null, T = !0;
|
|
1071
|
-
}
|
|
1072
|
-
d || l?.closeTag?.(y), T && (f = null);
|
|
1073
|
-
const x = r.pop() ?? null;
|
|
1074
|
-
n = r[r.length - 1] ?? null, x?.pushedScope && i.pop();
|
|
1075
|
-
const b = x?.destination;
|
|
1076
|
-
if (b && x.pushedDestination) {
|
|
1077
|
-
h.pop(), u = h[h.length - 1] ?? p;
|
|
1078
|
-
const t = x.visitor;
|
|
1079
|
-
t && t.to && void 0 !== b.source && (Array.isArray(t.to) ? u.source.push ? u.source.push(b.source) : s?.(`Unable to parse array for ${t.from} at ${y.getPath()}`) : b.key ? u.source[b.key] = b.source : "string" == typeof t.to && (u.source[t.to] = b.source));
|
|
1080
|
-
}
|
|
1081
|
-
a = n?.local ?? null, c = n?.tag ?? null, l = n?.visitor ?? null, d = !n?.destination;
|
|
1082
|
-
},
|
|
1083
|
-
onText: (t) => {
|
|
1084
|
-
g ? g.push(se(t)) : l?.text?.(t, y);
|
|
1085
|
-
},
|
|
1086
|
-
onEnd: e
|
|
1087
|
-
};
|
|
1088
|
-
}
|
|
1089
|
-
}, re = `IFERROR(${C}(`, ne = re.toUpperCase(), ae = P.toUpperCase(), ce = { kind: "none" }, le = { kind: "spilled" }, he = (t, e) => {
|
|
1090
|
-
if (34 !== t.charCodeAt(e)) return null;
|
|
1091
|
-
let s = "", o = e + 1;
|
|
1092
|
-
for (; o < t.length;) if (34 === t.charCodeAt(o)) {
|
|
1093
|
-
if (34 !== t.charCodeAt(o + 1)) return {
|
|
1094
|
-
value: s,
|
|
1095
|
-
end: o + 1
|
|
1096
|
-
};
|
|
1097
|
-
s += "\"", o += 2;
|
|
1098
|
-
} else s += t[o], o++;
|
|
1099
|
-
return null;
|
|
1100
|
-
}, pe = (t) => {
|
|
1101
|
-
const e = [];
|
|
1102
|
-
let s = 0;
|
|
1103
|
-
for (; s < t.length;) {
|
|
1104
|
-
const o = t.charCodeAt(s);
|
|
1105
|
-
if (34 === o) {
|
|
1106
|
-
const e = he(t, s);
|
|
1107
|
-
if (null === e) break;
|
|
1108
|
-
s = e.end;
|
|
1109
|
-
continue;
|
|
1110
|
-
}
|
|
1111
|
-
if (!(o >= 65 && o <= 90 || o >= 97 && o <= 122 || 95 === o)) {
|
|
1112
|
-
s++;
|
|
1113
|
-
continue;
|
|
1114
|
-
}
|
|
1115
|
-
let i = s + 1;
|
|
1116
|
-
for (; i < t.length;) {
|
|
1117
|
-
const e = t.charCodeAt(i);
|
|
1118
|
-
if (!(e >= 65 && e <= 90 || e >= 97 && e <= 122 || e >= 48 && e <= 57 || 95 === e || 46 === e)) break;
|
|
1119
|
-
i++;
|
|
1120
|
-
}
|
|
1121
|
-
40 === t.charCodeAt(i) && e.push(t.slice(s, i).toUpperCase().replace(/^_XLFN\./, "").replace(/^_XLWS\./, "")), s = i;
|
|
1122
|
-
}
|
|
1123
|
-
return e;
|
|
1124
|
-
}, ue = (t) => {
|
|
1125
|
-
let e = 0, s = 0;
|
|
1126
|
-
for (let o = 0; o < t.length; o++) {
|
|
1127
|
-
const i = t[o];
|
|
1128
|
-
if ("\"" !== i && "'" !== i) {
|
|
1129
|
-
if ("[" === i) s++;
|
|
1130
|
-
else if ("]" === i) s > 0 && s--;
|
|
1131
|
-
else if (0 === s) {
|
|
1132
|
-
if ("(" === i) e++;
|
|
1133
|
-
else if (")" === i && (e--, e < 0)) return !1;
|
|
1134
|
-
}
|
|
1135
|
-
} else {
|
|
1136
|
-
for (o++; o < t.length;) {
|
|
1137
|
-
if (t[o] === i) {
|
|
1138
|
-
if (t[o + 1] === i) {
|
|
1139
|
-
o += 2;
|
|
1140
|
-
continue;
|
|
1141
|
-
}
|
|
1142
|
-
break;
|
|
1143
|
-
}
|
|
1144
|
-
o++;
|
|
1145
|
-
}
|
|
1146
|
-
if (o >= t.length) return !1;
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
return 0 === e && 0 === s;
|
|
1150
|
-
}, de = class {
|
|
1151
|
-
static {
|
|
1152
|
-
this.Collapsed = 1;
|
|
1153
|
-
}
|
|
1154
|
-
static {
|
|
1155
|
-
this.CustomFormat = 2;
|
|
1156
|
-
}
|
|
1157
|
-
static {
|
|
1158
|
-
this.CustomHeight = 4;
|
|
1159
|
-
}
|
|
1160
|
-
static {
|
|
1161
|
-
this.Hidden = 8;
|
|
1162
|
-
}
|
|
1163
|
-
static {
|
|
1164
|
-
this.Ht = 16;
|
|
1165
|
-
}
|
|
1166
|
-
static {
|
|
1167
|
-
this.OutlineLevel = 32;
|
|
1168
|
-
}
|
|
1169
|
-
static {
|
|
1170
|
-
this.Ph = 64;
|
|
1171
|
-
}
|
|
1172
|
-
static {
|
|
1173
|
-
this.R = 128;
|
|
1174
|
-
}
|
|
1175
|
-
static {
|
|
1176
|
-
this.S = 256;
|
|
1177
|
-
}
|
|
1178
|
-
static {
|
|
1179
|
-
this.Spans = 512;
|
|
1180
|
-
}
|
|
1181
|
-
static {
|
|
1182
|
-
this.ThickBot = 1024;
|
|
1183
|
-
}
|
|
1184
|
-
static {
|
|
1185
|
-
this.ThickTop = 2048;
|
|
1186
|
-
}
|
|
1187
|
-
}, ge = (t, e, s) => {
|
|
1188
|
-
if (t[0].value[0] === t[1].value[0]) return e;
|
|
1189
|
-
}, me = {
|
|
1190
|
-
colStart: 0,
|
|
1191
|
-
colEnd: 0,
|
|
1192
|
-
rowStart: 0,
|
|
1193
|
-
rowEnd: 0
|
|
1194
|
-
}, fe = (t, e, s, o, i, r, n) => {
|
|
1195
|
-
let a = !1, c = !1, l = [], p = !1, u = null, d = null, g = null, m = null, f = null, T = null;
|
|
1196
|
-
const y = n?.get("richData") ?? N.EmptyArray, x = n?.get("dummyWrapped") ?? null, b = j.normalizeA1ToR1C1, v = R.createConflatingRanges(), w = /* @__PURE__ */ new Map(), S = [];
|
|
1197
|
-
let C = !1, k = !1, P = null;
|
|
1198
|
-
let A = !1;
|
|
1199
|
-
const E = R.createConflatingRanges();
|
|
1200
|
-
let I = !1, O = -1, D = -1, V = null, L = null, $ = null;
|
|
1201
|
-
const M = [];
|
|
1202
|
-
let H = null, z = -2, X = 0, F = "", q = "", W = "", U = "", G = "", Z = "", J = "", Q = "", K = "", Y = "", tt = "", et = "", st = "", ot = "", it = !0, rt = null, nt = !1, at = !1, ct = null, lt = 0;
|
|
1203
|
-
return {
|
|
1204
|
-
...s,
|
|
1205
|
-
onEnd: () => {
|
|
1206
|
-
M.length > 0 && (e.rows = j.runsToRefs(M, !1));
|
|
1207
|
-
let o = v.done(ge);
|
|
1208
|
-
const i = o.length;
|
|
1209
|
-
if (i > 0) {
|
|
1210
|
-
const t = /* @__PURE__ */ new Set();
|
|
1211
|
-
for (let e = 0; e < S.length; e++) t.add(S[e][0].split(":")[0]);
|
|
1212
|
-
const s = new Array(i);
|
|
1213
|
-
for (let e = 0; e < i; e++) {
|
|
1214
|
-
const i = o[e], r = j.rangeToString(i), n = i.value[1];
|
|
1215
|
-
let a = j.resolveRelativeToA1(n, i.rowStart, i.colStart);
|
|
1216
|
-
a && !t.has(r.split(":")[0]) && ue(a) && (a = `${h}(${a})`), s[e] = [r, a];
|
|
1217
|
-
}
|
|
1218
|
-
e.formulas = s;
|
|
1219
|
-
}
|
|
1220
|
-
const r = E.done(!0), n = r.length;
|
|
1221
|
-
if (n > 0) {
|
|
1222
|
-
const t = new Array(n);
|
|
1223
|
-
for (let e = 0; e < n; e++) {
|
|
1224
|
-
const s = r[e];
|
|
1225
|
-
t[e] = j.rangeToString(s);
|
|
1226
|
-
}
|
|
1227
|
-
e.volatile = t;
|
|
1228
|
-
}
|
|
1229
|
-
S.length > 0 && (e.formulaArray = [...S]);
|
|
1230
|
-
const a = l.length;
|
|
1231
|
-
if (a > 0) {
|
|
1232
|
-
l.sort(R.createRangeComparator(_.Axis.Column));
|
|
1233
|
-
let t = l[0], s = t.colStart, o = t.colEnd, i = t.rowEnd, r = t.value;
|
|
1234
|
-
const n = [];
|
|
1235
|
-
n.push(t);
|
|
1236
|
-
let c = null;
|
|
1237
|
-
for (let e = 1; e < a; e++) c = l[e], r !== c.value || s !== c.colStart || o !== c.colEnd || i + 1 !== c.rowEnd ? (n.push(c), t = c, s = t.colStart, o = t.colEnd, i = t.rowEnd, r = t.value) : (i = c.rowEnd, t.rowEnd = i);
|
|
1238
|
-
const h = n.length, p = new Array(h);
|
|
1239
|
-
for (let t = 0; t < h; t++) {
|
|
1240
|
-
const e = n[t];
|
|
1241
|
-
p[t] = [j.rangeToString(e), e.value];
|
|
1242
|
-
}
|
|
1243
|
-
e.directStyles = p;
|
|
1244
|
-
}
|
|
1245
|
-
const c = t.build();
|
|
1246
|
-
c && (e.data = c.tuples), s?.onEnd?.();
|
|
1247
|
-
},
|
|
1248
|
-
onOpenTag: (t) => {
|
|
1249
|
-
let o = t.name;
|
|
1250
|
-
const h = o.indexOf(":");
|
|
1251
|
-
if (-1 !== h && (o = o.slice(h + 1)), lt++, lt % 196608 == 0 && i?.(lt), L) {
|
|
1252
|
-
const e = t.attributes;
|
|
1253
|
-
switch (o) {
|
|
1254
|
-
case "v":
|
|
1255
|
-
c = !0;
|
|
1256
|
-
break;
|
|
1257
|
-
case "f":
|
|
1258
|
-
switch (p = !0, e.t ?? null) {
|
|
1259
|
-
case null:
|
|
1260
|
-
case "normal": break;
|
|
1261
|
-
case "shared":
|
|
1262
|
-
const t = e.si;
|
|
1263
|
-
d = e.ref, u = t;
|
|
1264
|
-
break;
|
|
1265
|
-
case "array":
|
|
1266
|
-
d = e.ref, P = d;
|
|
1267
|
-
break;
|
|
1268
|
-
case "datatable": d = e.ref, p = !0;
|
|
1269
|
-
}
|
|
1270
|
-
const t = e.ca;
|
|
1271
|
-
void 0 !== t && (A = "1" === t);
|
|
1272
|
-
break;
|
|
1273
|
-
case "is":
|
|
1274
|
-
I = !0;
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
I && !p && r?.onOpenTag?.(t);
|
|
1278
|
-
return;
|
|
1279
|
-
}
|
|
1280
|
-
if (a) {
|
|
1281
|
-
if ("c" === o) {
|
|
1282
|
-
L = t;
|
|
1283
|
-
const e = t.attributes, s = e.r;
|
|
1284
|
-
D = j.fastStringToCol(s);
|
|
1285
|
-
const o = e.t;
|
|
1286
|
-
void 0 === o ? $ = null : ($ = o, "str" === $ && (I = !0));
|
|
1287
|
-
let i = e.s;
|
|
1288
|
-
void 0 === i && (null !== ct || at) && (i = "0"), void 0 !== i && (i = parseInt(i), rt && rt.value === i && rt.colEnd + 1 === D ? rt.colEnd = D : (rt = {
|
|
1289
|
-
colStart: D,
|
|
1290
|
-
rowStart: O,
|
|
1291
|
-
colEnd: D,
|
|
1292
|
-
rowEnd: O,
|
|
1293
|
-
value: i
|
|
1294
|
-
}, l.push(rt))), P = null, k = !1;
|
|
1295
|
-
const r = e.cm;
|
|
1296
|
-
C = void 0 !== r && ((t) => {
|
|
1297
|
-
const e = (n?.get("metadata"))?.cells;
|
|
1298
|
-
if (!e) return !1;
|
|
1299
|
-
const s = parseInt(t, 10);
|
|
1300
|
-
return !(!Number.isFinite(s) || s < 1) && !0 === (e[s - 1]?.get("XLDAPR"))?.fDynamic;
|
|
1301
|
-
})(r);
|
|
1302
|
-
const a = e.vm;
|
|
1303
|
-
if (void 0 !== a) {
|
|
1304
|
-
const t = y[parseInt(a) - 1];
|
|
1305
|
-
if (B.isError(t)) {
|
|
1306
|
-
const e = t.getCode();
|
|
1307
|
-
V = {
|
|
1308
|
-
t: "e",
|
|
1309
|
-
v: e
|
|
1310
|
-
}, C && e === B.Code.Spill && (k = !0);
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
}
|
|
1314
|
-
} else {
|
|
1315
|
-
if ("row" === o) {
|
|
1316
|
-
a = !0;
|
|
1317
|
-
const e = t.attributes.r;
|
|
1318
|
-
if (O = parseInt(e) - 1, X = 0, q = t.attributes.customHeight, void 0 !== q && (X |= de.CustomHeight), q !== K && (it = !0, K = q), F = t.attributes.ht, void 0 !== F && (X |= de.Ht), F !== Q && (it = !0, Q = F), W = t.attributes.hidden, void 0 !== W && (X |= de.Hidden), W !== Y && (it = !0, Y = W), G = t.attributes.s, void 0 !== G && (X |= de.S), G !== et && (it = !0, et = G), U = t.attributes.customFormat, void 0 !== U && (X |= de.CustomFormat), U !== tt && (it = !0, tt = U), Z = t.attributes.outlineLevel, void 0 !== Z && (X |= de.OutlineLevel), Z !== st && (it = !0, st = Z), J = t.attributes.collapsed, void 0 !== J && (X |= de.Collapsed), J !== ot && (it = !0, ot = J), 0 !== X) if (z + 1 !== O || it) {
|
|
1319
|
-
const t = void 0 !== q && ("1" === q || "true" === q), e = void 0 !== U && ("1" === U || "true" === U);
|
|
1320
|
-
ct = e && void 0 !== G ? G : null, e && null === ct && (ct = "0"), H = {
|
|
1321
|
-
min: O,
|
|
1322
|
-
max: O,
|
|
1323
|
-
value: {
|
|
1324
|
-
sz: void 0 === F ? -1 : parseFloat(F),
|
|
1325
|
-
csz: t,
|
|
1326
|
-
h: void 0 !== W && ("1" === W || "true" === W),
|
|
1327
|
-
s: null === ct ? void 0 : "0" === ct ? 0 : parseInt(ct),
|
|
1328
|
-
l: void 0 === Z || "0" === Z ? 0 : parseInt(Z),
|
|
1329
|
-
cl: void 0 !== J && ("1" === J || "true" === J)
|
|
1330
|
-
}
|
|
1331
|
-
}, M.push(H);
|
|
1332
|
-
} else H.max = O;
|
|
1333
|
-
z = O, it = !1;
|
|
1334
|
-
return;
|
|
1335
|
-
}
|
|
1336
|
-
if (!nt && "sheetData" === o) {
|
|
1337
|
-
nt = !0;
|
|
1338
|
-
const t = e.cols, s = t ? t.length : 0;
|
|
1339
|
-
for (let e = 0; !at && e < s; e++) t[e].v.s && (at = !0);
|
|
1340
|
-
}
|
|
1341
|
-
s?.onOpenTag?.(t);
|
|
1342
|
-
}
|
|
1343
|
-
},
|
|
1344
|
-
onCloseTag: (e) => {
|
|
1345
|
-
let o = e.name;
|
|
1346
|
-
if (!p || "c" !== o && "f" !== o || (u && (m = w.get(u) ?? null), m && (v.append(O, D, m), A && E.append(O, D)), null !== P && S.push([P, C ? k ? "dynamicSpillError" : "dynamic" : "static"]), p = !1, m = null, u = null, d = null, c = !1, A = !1, P = null, C = !1, k = !1), L) {
|
|
1347
|
-
const s = o.indexOf(":");
|
|
1348
|
-
if (-1 !== s && (o = o.slice(s + 1)), I) if ("is" === o || "v" === o) {
|
|
1349
|
-
const e = r?.onEnd?.();
|
|
1350
|
-
null != e && t.pushAt(O, D, "" + e);
|
|
1351
|
-
} else "f" !== o && r?.onCloseTag?.(e);
|
|
1352
|
-
c && (c = !1), "c" === o && (L = null, I = !1);
|
|
1353
|
-
return;
|
|
1354
|
-
}
|
|
1355
|
-
if (a) return a = !1, void (rt = null);
|
|
1356
|
-
s?.onCloseTag?.(e);
|
|
1357
|
-
},
|
|
1358
|
-
onText: (i) => {
|
|
1359
|
-
const n = i.trim();
|
|
1360
|
-
if (c) {
|
|
1361
|
-
switch (V = null, $) {
|
|
1362
|
-
case null:
|
|
1363
|
-
case "n":
|
|
1364
|
-
V = parseFloat(n);
|
|
1365
|
-
break;
|
|
1366
|
-
case "b":
|
|
1367
|
-
V = "1" === n || "true" === n;
|
|
1368
|
-
break;
|
|
1369
|
-
case "s":
|
|
1370
|
-
V = n;
|
|
1371
|
-
break;
|
|
1372
|
-
case "e":
|
|
1373
|
-
if ("#VALUE!" === n) {
|
|
1374
|
-
const t = L.attributes.vm;
|
|
1375
|
-
if (void 0 !== t) {
|
|
1376
|
-
const e = y[parseInt(t) - 1];
|
|
1377
|
-
if (B.isError(e)) {
|
|
1378
|
-
V = {
|
|
1379
|
-
t: "e",
|
|
1380
|
-
v: e.getCode()
|
|
1381
|
-
};
|
|
1382
|
-
break;
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
}
|
|
1386
|
-
const t = B.getBuiltInByLabel(n);
|
|
1387
|
-
t ? V = {
|
|
1388
|
-
t: "e",
|
|
1389
|
-
v: t.getCode()
|
|
1390
|
-
} : (V = n, o?.(`Unknown formula error '${n}' in cell ${j.cellToString({
|
|
1391
|
-
colIndex: D,
|
|
1392
|
-
rowIndex: O
|
|
1393
|
-
})}`));
|
|
1394
|
-
break;
|
|
1395
|
-
case "str":
|
|
1396
|
-
case "inlineStr": I = !0;
|
|
1397
|
-
}
|
|
1398
|
-
null !== V && t.pushAt(O, D, V);
|
|
1399
|
-
}
|
|
1400
|
-
if (u) {
|
|
1401
|
-
if (f === u) m = T;
|
|
1402
|
-
else {
|
|
1403
|
-
if (m = w.get(u) ?? null, !m) {
|
|
1404
|
-
const t = [];
|
|
1405
|
-
g = b(n, O, D, t), m = [
|
|
1406
|
-
g,
|
|
1407
|
-
t,
|
|
1408
|
-
n
|
|
1409
|
-
], w.set(u, m);
|
|
1410
|
-
}
|
|
1411
|
-
f = u, T = m;
|
|
1412
|
-
}
|
|
1413
|
-
u = null;
|
|
1414
|
-
}
|
|
1415
|
-
if (p) {
|
|
1416
|
-
if (null !== x) {
|
|
1417
|
-
const t = ((t) => {
|
|
1418
|
-
if (t.length < re.length) return ce;
|
|
1419
|
-
if (t.slice(0, re.length).toUpperCase() !== ne) return ce;
|
|
1420
|
-
const e = he(t, re.length);
|
|
1421
|
-
if (null === e) return ce;
|
|
1422
|
-
if (41 !== t.charCodeAt(e.end)) return ce;
|
|
1423
|
-
if (44 !== t.charCodeAt(e.end + 1)) return ce;
|
|
1424
|
-
if (41 !== t.charCodeAt(t.length - 1)) return ce;
|
|
1425
|
-
const s = e.value;
|
|
1426
|
-
return s.toUpperCase() === ae ? le : 0 === s.length ? ce : {
|
|
1427
|
-
kind: "formula",
|
|
1428
|
-
formula: s
|
|
1429
|
-
};
|
|
1430
|
-
})(n);
|
|
1431
|
-
"none" !== t.kind && x.push({
|
|
1432
|
-
sheet: e,
|
|
1433
|
-
rowIndex: O,
|
|
1434
|
-
colIndex: D,
|
|
1435
|
-
formula: "formula" === t.kind ? t.formula : null
|
|
1436
|
-
});
|
|
1437
|
-
}
|
|
1438
|
-
const t = [];
|
|
1439
|
-
g = b(n, O, D, t), m = [
|
|
1440
|
-
g,
|
|
1441
|
-
t,
|
|
1442
|
-
n
|
|
1443
|
-
];
|
|
1444
|
-
}
|
|
1445
|
-
I ? r?.onText?.(i) : a || s?.onText?.(n);
|
|
1446
|
-
}
|
|
1447
|
-
};
|
|
1448
|
-
}, Te = (t) => {
|
|
1449
|
-
const e = t.indexOf(":");
|
|
1450
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
1451
|
-
}, ye = {
|
|
1452
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": "workbooks",
|
|
1453
|
-
"application/vnd.ms-excel.sheet.macroEnabled.main+xml": "workbooks",
|
|
1454
|
-
"application/vnd.ms-excel.sheet.binary.macroEnabled.main": "workbooks",
|
|
1455
|
-
"application/vnd.ms-excel.addin.macroEnabled.main+xml": "workbooks",
|
|
1456
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": "workbooks",
|
|
1457
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": "sheets",
|
|
1458
|
-
"application/vnd.ms-excel.worksheet": "sheets",
|
|
1459
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": "charts",
|
|
1460
|
-
"application/vnd.ms-excel.chartsheet": "charts",
|
|
1461
|
-
"application/vnd.ms-excel.macrosheet+xml": "macros",
|
|
1462
|
-
"application/vnd.ms-excel.macrosheet": "macros",
|
|
1463
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": "dialogs",
|
|
1464
|
-
"application/vnd.ms-excel.dialogsheet": "dialogs",
|
|
1465
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml": "strs",
|
|
1466
|
-
"application/vnd.ms-excel.sharedStrings": "strs",
|
|
1467
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": "styles",
|
|
1468
|
-
"application/vnd.ms-excel.styles": "styles",
|
|
1469
|
-
"application/vnd.openxmlformats-package.core-properties+xml": "coreprops",
|
|
1470
|
-
"application/vnd.openxmlformats-officedocument.custom-properties+xml": "custprops",
|
|
1471
|
-
"application/vnd.openxmlformats-officedocument.extended-properties+xml": "extprops",
|
|
1472
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": "comments",
|
|
1473
|
-
"application/vnd.ms-excel.comments": "comments",
|
|
1474
|
-
"application/vnd.ms-excel.threadedcomments+xml": "threadedcomments",
|
|
1475
|
-
"application/vnd.ms-excel.person+xml": "people",
|
|
1476
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml": "metadata",
|
|
1477
|
-
"application/vnd.ms-excel.sheetMetadata": "metadata",
|
|
1478
|
-
"application/vnd.ms-excel.externalLink": "links",
|
|
1479
|
-
"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml": "links",
|
|
1480
|
-
"application/vnd.openxmlformats-officedocument.theme+xml": "themes"
|
|
1481
|
-
}, xe = (t) => t.startsWith("/") ? t.slice(1) : t, be = /^xl\/(worksheets|chartsheets)\/[^/]+\.xml$/i, ve = async (h, C) => {
|
|
1482
|
-
const { password: P, onVBA: N, profile: R, createWorkbookOptions: B = {}, ..._ } = C ?? {}, U = B.origin && "string" != typeof B.origin ? B.origin : null, G = R ? new Y("function" == typeof R ? R : void 0) : null, Z = [], J = C?.progress, Q = J?.onProgress ? J.onProgress.bind(J) : void 0, tt = h.byteLength;
|
|
1483
|
-
let et = 0, st = 0;
|
|
1484
|
-
const ot = Q ? (t) => {
|
|
1485
|
-
if (et <= 0) return;
|
|
1486
|
-
st += t;
|
|
1487
|
-
const e = Math.min(tt, Math.round(st / et * tt));
|
|
1488
|
-
Q(e, tt);
|
|
1489
|
-
} : void 0, it = import("./Ctcl4jN52INWpKWC.mjs");
|
|
1490
|
-
let rt = null;
|
|
1491
|
-
try {
|
|
1492
|
-
rt = new DOMParser();
|
|
1493
|
-
} catch (t) {}
|
|
1494
|
-
let nt = null;
|
|
1495
|
-
try {
|
|
1496
|
-
nt = new XMLSerializer();
|
|
1497
|
-
} catch (t) {}
|
|
1498
|
-
let at, ct, lt, ht = null;
|
|
1499
|
-
rt || (ht = import("@xmldom/xmldom"));
|
|
1500
|
-
try {
|
|
1501
|
-
const [t, e] = await Promise.all([ht, it]);
|
|
1502
|
-
at = new e.DOMTransformer(), ct = rt ?? new t.DOMParser(), lt = nt ?? new t.XMLSerializer();
|
|
1503
|
-
} catch (t) {
|
|
1504
|
-
throw new Error("Unable to load XLSX parser.", { cause: t });
|
|
1505
|
-
}
|
|
1506
|
-
const pt = (t) => lt.serializeToString(t);
|
|
1507
|
-
let ut;
|
|
1508
|
-
try {
|
|
1509
|
-
ut = await K.create(h);
|
|
1510
|
-
} catch (t) {
|
|
1511
|
-
throw new $("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.", { cause: t });
|
|
1512
|
-
}
|
|
1513
|
-
G?.mark("zip-open");
|
|
1514
|
-
try {
|
|
1515
|
-
if (!ut.has("[Content_Types].xml")) throw new $("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
|
|
1516
|
-
const h = (t) => {
|
|
1517
|
-
const e = ut.getEntry(t);
|
|
1518
|
-
return e ? { content: e } : void 0;
|
|
1519
|
-
}, C = {
|
|
1520
|
-
workbooks: [],
|
|
1521
|
-
sheets: [],
|
|
1522
|
-
charts: [],
|
|
1523
|
-
dialogs: [],
|
|
1524
|
-
macros: [],
|
|
1525
|
-
strs: [],
|
|
1526
|
-
comments: [],
|
|
1527
|
-
threadedcomments: [],
|
|
1528
|
-
links: [],
|
|
1529
|
-
coreprops: [],
|
|
1530
|
-
extprops: [],
|
|
1531
|
-
custprops: [],
|
|
1532
|
-
themes: [],
|
|
1533
|
-
styles: [],
|
|
1534
|
-
metadata: [],
|
|
1535
|
-
people: [],
|
|
1536
|
-
sst: "",
|
|
1537
|
-
style: "",
|
|
1538
|
-
defaults: {}
|
|
1539
|
-
};
|
|
1540
|
-
{
|
|
1541
|
-
const t = ((t, e) => ({
|
|
1542
|
-
onOpenTag: (e) => {
|
|
1543
|
-
const s = ((t) => {
|
|
1544
|
-
const e = t.indexOf(":");
|
|
1545
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
1546
|
-
})(e.name), o = e.attributes;
|
|
1547
|
-
if ("Override" === s) {
|
|
1548
|
-
const e = o.ContentType, s = o.PartName;
|
|
1549
|
-
if (!e || !s) return;
|
|
1550
|
-
const i = ye[e], r = i ? t[i] : void 0;
|
|
1551
|
-
Array.isArray(r) && r.push(s);
|
|
1552
|
-
} else if ("Default" === s) {
|
|
1553
|
-
const e = o.Extension, s = o.ContentType;
|
|
1554
|
-
e && (t.defaults[e.toLowerCase()] = s);
|
|
1555
|
-
}
|
|
1556
|
-
},
|
|
1557
|
-
onEnd: () => {
|
|
1558
|
-
t.sst = t.strs.length > 0 ? t.strs[0] : "", t.style = t.styles.length > 0 ? t.styles[0] : "";
|
|
1559
|
-
},
|
|
1560
|
-
onError: (t) => {
|
|
1561
|
-
e?.(`Error parsing content types: ${t?.message ?? t}`);
|
|
1562
|
-
}
|
|
1563
|
-
}))(C, (t) => {
|
|
1564
|
-
Z.push([t, "[Content_Types].xml"]);
|
|
1565
|
-
}), e = await ut.getTextStream("[Content_Types].xml");
|
|
1566
|
-
if (!e) throw new Error("Error parsing content types: '[Content_Types].xml'");
|
|
1567
|
-
try {
|
|
1568
|
-
await Wt.parseStream(e, t, { xmlns: !1 });
|
|
1569
|
-
} catch (t) {
|
|
1570
|
-
throw new Error("Error parsing content types: '[Content_Types].xml'", { cause: t });
|
|
1571
|
-
}
|
|
1572
|
-
U && await ut.getBuffer("[Content_Types].xml");
|
|
1573
|
-
}
|
|
1574
|
-
G?.mark("content-types");
|
|
1575
|
-
const P = C.sst, _ = /* @__PURE__ */ new Set();
|
|
1576
|
-
for (const t of C.sheets) _.add(xe(t));
|
|
1577
|
-
P && _.add(xe(P));
|
|
1578
|
-
for (const t of _) et += ut.uncompressedSize(t);
|
|
1579
|
-
if (await ut.prefetch((t) => !_.has(t) && !be.test(t)), G?.mark("prefetch-side-parts"), 0 === C.workbooks.length) {
|
|
1580
|
-
const t = n("_rels/.rels", h, ct, at), e = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
|
|
1581
|
-
if (t) {
|
|
1582
|
-
for (const s of t.values()) if (s.type === e && s.target) {
|
|
1583
|
-
C.workbooks.push(s.target);
|
|
1584
|
-
break;
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
if (0 === C.workbooks.length) throw new $("Unable to parse as an Excel document. Try to save as '.xlsx' and try again.");
|
|
1589
|
-
C.richstructure = ["/xl/richData/rdrichvaluestructure.xml"], C.richdata = ["/xl/richData/rdrichvalue.xml"];
|
|
1590
|
-
const z = B?.resources ?? new X(), K = z.beginPersist(), Y = {}, st = /* @__PURE__ */ new Set(), it = /* @__PURE__ */ new Map();
|
|
1591
|
-
it.set("richTypes", []), it.set("parseInlineDxf", (t) => {
|
|
1592
|
-
if (!t) return;
|
|
1593
|
-
const e = ct.parseFromString(`<dxf xmlns:x14="${p}" xmlns:xm="${u}">${t}</dxf>`, "text/xml")?.documentElement;
|
|
1594
|
-
if (!e) return;
|
|
1595
|
-
const s = at.parseDxf(e);
|
|
1596
|
-
return Object.keys(s).length > 0 ? s : void 0;
|
|
1597
|
-
});
|
|
1598
|
-
const rt = [];
|
|
1599
|
-
it.set("dummyWrapped", rt);
|
|
1600
|
-
const nt = a("metadata", C, h, ct, at).entries().next()?.value?.[1]?.metadata;
|
|
1601
|
-
nt && it.set("metadata", nt);
|
|
1602
|
-
const lt = /* @__PURE__ */ new Map(), ht = [], dt = (t, e = lt) => {
|
|
1603
|
-
const s = t.lastIndexOf("/"), o = t.substring(0, s + 1) + "_rels/" + t.substring(s + 1, t.length) + ".rels";
|
|
1604
|
-
let i = e.get(o);
|
|
1605
|
-
return i || (i = n(o, h, ct, at, bt), e.set(o, i)), i;
|
|
1606
|
-
}, gt = (n, a, p, u = lt) => {
|
|
1607
|
-
let y = dt(a, u).get(n), x = y?.target;
|
|
1608
|
-
if (!x) return null;
|
|
1609
|
-
if ("External" === y.targetMode) {
|
|
1610
|
-
if (!p) return y.target;
|
|
1611
|
-
const t = z.add({ source: { external: y.target } });
|
|
1612
|
-
return t.addReference(Y), st.add(t), K.toResourceId(t);
|
|
1613
|
-
}
|
|
1614
|
-
const C = a.lastIndexOf("/"), P = a.substring(0, C + 1);
|
|
1615
|
-
x.startsWith("/") || (x = P + x), x = i(x);
|
|
1616
|
-
const I = at?.getVisitorParamsState().get("dxfs");
|
|
1617
|
-
let O = u.get(x);
|
|
1618
|
-
if (!O) {
|
|
1619
|
-
const i = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", n = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink";
|
|
1620
|
-
if (y.type === i) {
|
|
1621
|
-
const t = {};
|
|
1622
|
-
O = t;
|
|
1623
|
-
const o = async () => {
|
|
1624
|
-
const o = ((t, s, o, i, n, a, h, p) => {
|
|
1625
|
-
const u = new ie(), y = p?.get("parseInlineDxf"), x = new q.TransposedBuilder();
|
|
1626
|
-
let C = null;
|
|
1627
|
-
u.registerVisitor({
|
|
1628
|
-
from: "autoFilter",
|
|
1629
|
-
to: "autoTable",
|
|
1630
|
-
openTag: (t) => {
|
|
1631
|
-
const e = t.getAttribute("ref"), s = j.fastStringToRange(e);
|
|
1632
|
-
t.getSource().r = s, t.getSource().v = {};
|
|
1633
|
-
},
|
|
1634
|
-
closeTag: (t) => {
|
|
1635
|
-
const e = t.getSource(), s = e.v, o = s.hiddenButtons;
|
|
1636
|
-
if (Array.isArray(o)) {
|
|
1637
|
-
const t = o.length, i = e.r, r = i.colEnd - i.colStart + 1;
|
|
1638
|
-
0 === t ? s.hiddenButtons = !1 : t === r && (s.hiddenButtons = !0);
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
}), u.registerVisitor({
|
|
1642
|
-
from: "conditionalFormatting",
|
|
1643
|
-
to: {},
|
|
1644
|
-
openTag: (t) => {
|
|
1645
|
-
const e = t.getParent();
|
|
1646
|
-
e.conditionals || (e.conditionals = []);
|
|
1647
|
-
let s = t.getAttribute("sqref");
|
|
1648
|
-
s && (s = s.trim().split(/\s+/).join(","));
|
|
1649
|
-
const o = {
|
|
1650
|
-
r: s,
|
|
1651
|
-
conditionals: e.conditionals
|
|
1652
|
-
}, i = t.getAttribute("pivot", Kt);
|
|
1653
|
-
null !== i && (o.pivot = i), t.setSource(o);
|
|
1654
|
-
}
|
|
1655
|
-
}), u.registerVisitor({
|
|
1656
|
-
from: "cfRule",
|
|
1657
|
-
to: {},
|
|
1658
|
-
openTag: (t) => {
|
|
1659
|
-
const e = t.getParent();
|
|
1660
|
-
if (!e?.r) return;
|
|
1661
|
-
const s = t.getSource() ?? {};
|
|
1662
|
-
void 0 !== e.pivot && (s.pivot = e.pivot), e.conditionals.push({
|
|
1663
|
-
r: e.r,
|
|
1664
|
-
v: null,
|
|
1665
|
-
rule: s
|
|
1666
|
-
}), t.copyToObject(s, "type", ee), t.copyToObject(s, "priority", Yt), t.copyToObject(s, "stopIfTrue", Kt);
|
|
1667
|
-
const o = t.getAttribute("dxfId", Yt);
|
|
1668
|
-
if (null !== o) {
|
|
1669
|
-
let e = i?.get(o);
|
|
1670
|
-
e || (a?.(`Unable to load conditional color. Invalid dxfI: '${o}' at '${t.getPath()}'.`), e = {}), s.style = e;
|
|
1671
|
-
}
|
|
1672
|
-
t.copyToObject(s, "aboveAverage", Kt), t.copyToObject(s, "equalAverage", Kt), t.copyToObject(s, "stdDev", Yt), t.copyToObject(s, "bottom", Kt), t.copyToObject(s, "percent", Kt), t.copyToObject(s, "rank", Yt), t.copyToObject(s, "operator", ee), t.copyToObject(s, "text", ee), t.copyToObject(s, "timePeriod", ee);
|
|
1673
|
-
},
|
|
1674
|
-
closeTag: (t) => {
|
|
1675
|
-
const e = t.getParent();
|
|
1676
|
-
if (!e?.r) return;
|
|
1677
|
-
const s = e.conditionals[e.conditionals.length - 1], o = s?.rule;
|
|
1678
|
-
if (!o) return;
|
|
1679
|
-
const i = {}, r = b(o, a);
|
|
1680
|
-
r && (i.condition = r), o.style && (i.style = o.style), o.scale && (i.scale = o.scale), o.stopIfTrue && (i.stopIfTrue = !0), o.pivot && (i.pivot = !0), s.v = i, s.priority = o.priority, o.x14Id && (s.x14Id = o.x14Id), delete s.rule;
|
|
1681
|
-
}
|
|
1682
|
-
});
|
|
1683
|
-
const P = (t) => {
|
|
1684
|
-
const e = t.conditions ?? [], s = [];
|
|
1685
|
-
for (let t = 0; t < e.length; t++) {
|
|
1686
|
-
const o = e[t], i = {};
|
|
1687
|
-
o.type && (i.type = o.type), void 0 !== o.value && (i.value = o.value), o.exclusive && (i.exclusive = !0), s.push(i);
|
|
1688
|
-
}
|
|
1689
|
-
return s;
|
|
1690
|
-
};
|
|
1691
|
-
u.registerVisitor({
|
|
1692
|
-
from: "colorScale",
|
|
1693
|
-
to: {},
|
|
1694
|
-
openTag: (t) => {},
|
|
1695
|
-
closeTag: (t) => {
|
|
1696
|
-
const e = t.getSource(), s = e.colors ?? [], o = P(e);
|
|
1697
|
-
for (let t = 0; t < o.length; t++) o[t].color = s[t];
|
|
1698
|
-
t.getParent().scale = {
|
|
1699
|
-
type: H.ScaleType.ColorScale,
|
|
1700
|
-
stops: o
|
|
1701
|
-
};
|
|
1702
|
-
}
|
|
1703
|
-
}), u.registerVisitor({
|
|
1704
|
-
from: "dataBar",
|
|
1705
|
-
to: {},
|
|
1706
|
-
openTag: (t) => {
|
|
1707
|
-
t.copyTo("maxLength", Yt), t.copyTo("minLength", Yt), t.copyTo("showValue", Kt);
|
|
1708
|
-
},
|
|
1709
|
-
closeTag: (t) => {
|
|
1710
|
-
const e = t.getSource(), s = {
|
|
1711
|
-
type: H.ScaleType.DataBar,
|
|
1712
|
-
stops: P(e)
|
|
1713
|
-
}, o = e.colors?.[0];
|
|
1714
|
-
o && (s.color = o), void 0 !== e.minLength && (s.minLength = e.minLength), void 0 !== e.maxLength && (s.maxLength = e.maxLength), void 0 !== e.showValue && (s.showValue = e.showValue), t.getParent().scale = s;
|
|
1715
|
-
}
|
|
1716
|
-
}), u.registerVisitor({
|
|
1717
|
-
from: "iconSet",
|
|
1718
|
-
to: {},
|
|
1719
|
-
openTag: (t) => {
|
|
1720
|
-
t.copyTo("iconSet", ee), t.copyTo("reverse", Kt), t.copyTo("showValue", Kt);
|
|
1721
|
-
},
|
|
1722
|
-
closeTag: (t) => {
|
|
1723
|
-
const e = t.getSource(), s = {
|
|
1724
|
-
type: H.ScaleType.IconSet,
|
|
1725
|
-
stops: P(e)
|
|
1726
|
-
};
|
|
1727
|
-
void 0 !== e.iconSet && (s.iconSet = e.iconSet), void 0 !== e.reverse && (s.reverse = e.reverse), void 0 !== e.showValue && (s.showValue = e.showValue), t.getParent().scale = s;
|
|
1728
|
-
}
|
|
1729
|
-
}), u.registerVisitor({
|
|
1730
|
-
from: "formula",
|
|
1731
|
-
to: {},
|
|
1732
|
-
text: (t, e) => {
|
|
1733
|
-
const s = e.getParent();
|
|
1734
|
-
let o = s.formulas;
|
|
1735
|
-
o || (o = [], s.formulas = o), o.push(t);
|
|
1736
|
-
}
|
|
1737
|
-
}), u.registerVisitor({
|
|
1738
|
-
from: "cfvo",
|
|
1739
|
-
to: {},
|
|
1740
|
-
openTag: (t) => {
|
|
1741
|
-
const e = t.getParent();
|
|
1742
|
-
e.conditions || (e.conditions = []);
|
|
1743
|
-
const s = t.getSource();
|
|
1744
|
-
e.conditions.push(s), t.copyTo("type", ee), s.type === H.ColorStopType.Formula ? t.copyTo("value", ee, "val") : t.copyTo("value", te, "val"), !1 === t.getAttribute("gte", Kt) && (s.exclusive = !0);
|
|
1745
|
-
}
|
|
1746
|
-
}), u.registerVisitor({
|
|
1747
|
-
from: "color",
|
|
1748
|
-
to: {},
|
|
1749
|
-
openTag: (t) => {
|
|
1750
|
-
const s = t.getParent();
|
|
1751
|
-
s.colors || (s.colors = []);
|
|
1752
|
-
const o = e((e) => t.getAttribute(e));
|
|
1753
|
-
s.colors.push(o);
|
|
1754
|
-
}
|
|
1755
|
-
}), u.registerVisitor({
|
|
1756
|
-
from: "filterColumn",
|
|
1757
|
-
to: {},
|
|
1758
|
-
openTag: (t) => {
|
|
1759
|
-
const e = t.getParent().v, s = parseInt(t.getAttribute("colId")), o = t.getSource();
|
|
1760
|
-
o.index = s;
|
|
1761
|
-
let i = e.filter;
|
|
1762
|
-
i || (i = { conditions: [] }, e.filter = i);
|
|
1763
|
-
let r = i.conditions;
|
|
1764
|
-
if (r || (r = [], i.conditions = r), r.push(o), t.getAttribute("hiddenButton", Kt) && e) {
|
|
1765
|
-
let t = e.hiddenButtons;
|
|
1766
|
-
t || (t = [], e.hiddenButtons = t), t.push(s);
|
|
1767
|
-
}
|
|
1768
|
-
if (t.getAttribute("showButton", Kt) && e) {
|
|
1769
|
-
let t = e.showButtons;
|
|
1770
|
-
t || (t = [], e.showButtons = t), t.push(s);
|
|
1771
|
-
}
|
|
1772
|
-
return o;
|
|
1773
|
-
}
|
|
1774
|
-
}), u.registerVisitor({
|
|
1775
|
-
from: "colorFilter",
|
|
1776
|
-
openTag: (t) => {
|
|
1777
|
-
const e = t.getParent(), s = {};
|
|
1778
|
-
e.operator = M.BuiltInOperatorNames.Color, e.param = s, t.copyToObject(s, "cellColor"), t.copyToObject(s, "styleId", Yt, "dxfId");
|
|
1779
|
-
}
|
|
1780
|
-
}), u.registerVisitor({
|
|
1781
|
-
from: "iconFilter",
|
|
1782
|
-
openTag: (t) => {
|
|
1783
|
-
const e = t.getParent(), s = {};
|
|
1784
|
-
e.operator = M.BuiltInOperatorNames.Icon, e.param = s, t.copyToObject(s, "iconId", Yt), t.copyToObject(s, "iconSet", ee);
|
|
1785
|
-
}
|
|
1786
|
-
}), u.registerVisitor({
|
|
1787
|
-
from: "top10",
|
|
1788
|
-
openTag: (t) => {
|
|
1789
|
-
const e = t.getParent(), s = {};
|
|
1790
|
-
e.operator = M.BuiltInOperatorNames.TopN, e.param = s, t.copyToObject(s, "filterVal", te), t.copyToObject(s, "percent", Kt), t.copyToObject(s, "top", Kt), t.copyToObject(s, "limit", te, "val");
|
|
1791
|
-
}
|
|
1792
|
-
}), u.registerVisitor({
|
|
1793
|
-
from: "dynamicFilter",
|
|
1794
|
-
openTag: (t) => {
|
|
1795
|
-
const e = t.getParent(), s = {};
|
|
1796
|
-
e.operator = M.BuiltInOperatorNames.TimePeriod, e.param = s;
|
|
1797
|
-
let o = t.getAttribute("type");
|
|
1798
|
-
Object.values(M.AverageType).includes(o) ? (e.operator = M.BuiltInOperatorNames.Average, t.copyToObject(s, "stdDevs", Yt, "val")) : t.copyToObject(s, "anchorDate", Yt, "val"), t.copyToObject(s, "operator", ee, "type"), t.copyToObject(s, "maxVal", te, "maxVal");
|
|
1799
|
-
}
|
|
1800
|
-
}), u.registerVisitor({
|
|
1801
|
-
from: "filters",
|
|
1802
|
-
to: {},
|
|
1803
|
-
openTag: (t) => {
|
|
1804
|
-
const e = t.getParent(), s = {};
|
|
1805
|
-
return e.operator = M.BuiltInOperatorNames.InSet, e.param = s, t.copyToObject(s, "blank", Kt), t.copyToObject(s, "calendarType", ee), s;
|
|
1806
|
-
}
|
|
1807
|
-
}), u.registerVisitor({
|
|
1808
|
-
from: "filter",
|
|
1809
|
-
openTag: (t) => {
|
|
1810
|
-
const e = t.getParent();
|
|
1811
|
-
let s = e.items;
|
|
1812
|
-
s || (s = [], e.items = s), s.push(t.getAttribute("val", ee));
|
|
1813
|
-
}
|
|
1814
|
-
}), u.registerVisitor({
|
|
1815
|
-
from: "dateGroupItem",
|
|
1816
|
-
to: {},
|
|
1817
|
-
openTag: (t) => {
|
|
1818
|
-
const e = t.getParent();
|
|
1819
|
-
let s = e.dateGroups;
|
|
1820
|
-
s || (s = [], e.dateGroups = s), s.push(t.getSource()), t.copyTo("group", ee, "dateTimeGrouping"), t.copyTo("day", Yt), t.copyTo("hour", Yt), t.copyTo("minute", Yt), t.copyTo("month", Yt), t.copyTo("second", Yt), t.copyTo("year", Yt);
|
|
1821
|
-
}
|
|
1822
|
-
}), u.registerVisitor({
|
|
1823
|
-
from: "customFilters",
|
|
1824
|
-
openTag: (t) => {
|
|
1825
|
-
const e = t.getParent(), s = t.getAttribute("and"), o = "and" === s || "1" === s, i = [];
|
|
1826
|
-
return e.operator = o ? M.BuiltInOperatorNames.And : M.BuiltInOperatorNames.Or, e.param = i, t.setSource(e), i;
|
|
1827
|
-
},
|
|
1828
|
-
closeTag: (t) => {
|
|
1829
|
-
const e = t.getSource(), s = e?.param;
|
|
1830
|
-
if (1 !== s?.length) return;
|
|
1831
|
-
const o = s[0];
|
|
1832
|
-
e.operator = o.operator, e.param = o.param;
|
|
1833
|
-
}
|
|
1834
|
-
}), u.registerVisitor({
|
|
1835
|
-
from: "customFilter",
|
|
1836
|
-
openTag: (t) => {
|
|
1837
|
-
const e = t.getParent();
|
|
1838
|
-
let s;
|
|
1839
|
-
Array.isArray(e) ? (s = {}, e.push(s)) : s = e;
|
|
1840
|
-
const o = k({
|
|
1841
|
-
operator: t.getAttribute("operator"),
|
|
1842
|
-
val: t.getAttribute("val")
|
|
1843
|
-
});
|
|
1844
|
-
o && (s.operator = o.operator, s.param = o.param);
|
|
1845
|
-
}
|
|
1846
|
-
}), u.registerVisitor({
|
|
1847
|
-
from: "sortState",
|
|
1848
|
-
to: {},
|
|
1849
|
-
openTag: (t) => {
|
|
1850
|
-
const e = t.getParent();
|
|
1851
|
-
let s = e.v;
|
|
1852
|
-
s && (s.sort = {}, t.setSource(e));
|
|
1853
|
-
}
|
|
1854
|
-
}), u.registerVisitor({
|
|
1855
|
-
from: "sortCondition",
|
|
1856
|
-
to: {},
|
|
1857
|
-
openTag: (t) => {
|
|
1858
|
-
const e = t.getParent(), s = e.v;
|
|
1859
|
-
if (!s) return;
|
|
1860
|
-
const o = s.sort;
|
|
1861
|
-
if (!o) return;
|
|
1862
|
-
let i = o.sorts;
|
|
1863
|
-
i || (i = [], o.sorts = i);
|
|
1864
|
-
const r = t.getAttribute("ref");
|
|
1865
|
-
let n = 0;
|
|
1866
|
-
if (r) {
|
|
1867
|
-
const t = j.fastStringToRange(r, me).colStart, s = e.r, o = s.colStart;
|
|
1868
|
-
n = s ? t - o : t;
|
|
1869
|
-
}
|
|
1870
|
-
const a = {};
|
|
1871
|
-
t.copyToObject(a, "sortOn", ee, "sortBy"), t.copyToObject(a, "dxfId", ee, "sortBy"), t.copyToObject(a, "iconSet", ee), t.copyToObject(a, "customList", ee), a.reverse = t.getAttribute("descending", Kt) ?? !1;
|
|
1872
|
-
const c = {
|
|
1873
|
-
index: n,
|
|
1874
|
-
criteria: a
|
|
1875
|
-
};
|
|
1876
|
-
i.push(c);
|
|
1877
|
-
}
|
|
1878
|
-
}), u.registerVisitor({
|
|
1879
|
-
from: "AlternateContent",
|
|
1880
|
-
to: null
|
|
1881
|
-
});
|
|
1882
|
-
const I = (t) => {
|
|
1883
|
-
C = t.getSource(), t.copyTo("topLeft", ee, "topLeftCell");
|
|
1884
|
-
const e = r(t.getAttribute("defaultGridColor")), s = t.getAttribute("colorId");
|
|
1885
|
-
null === s || e || (t.getSource().gridLineColor = "index" + parseFloat(s)), t.copyTo("showZeros", Kt), t.copyTo("showFormulas", Kt), t.copyTo("zoomScale", Yt), t.copyTo("showRowHeaders", Kt, "showRowColHeaders"), t.copyTo("showColumnHeaders", Kt, "showRowColHeaders"), t.copyTo("showRowGridlines", Kt, "showGridLines"), t.copyTo("showColumnGridlines", Kt, "showGridLines"), t.copyTo("rightToLeft", Kt);
|
|
1886
|
-
};
|
|
1887
|
-
u.registerVisitor({
|
|
1888
|
-
from: "sheetView",
|
|
1889
|
-
to: "view",
|
|
1890
|
-
openTag: (t) => {
|
|
1891
|
-
I(t);
|
|
1892
|
-
},
|
|
1893
|
-
closeTag: () => {
|
|
1894
|
-
C = null;
|
|
1895
|
-
}
|
|
1896
|
-
}), u.registerVisitor({
|
|
1897
|
-
from: "customSheetViews",
|
|
1898
|
-
to: "customSheetViews",
|
|
1899
|
-
openTag: (t) => {
|
|
1900
|
-
t.setSource([]);
|
|
1901
|
-
}
|
|
1902
|
-
}), u.registerVisitor({
|
|
1903
|
-
from: "customSheetView",
|
|
1904
|
-
to: [],
|
|
1905
|
-
openTag: (t) => {
|
|
1906
|
-
I(t);
|
|
1907
|
-
},
|
|
1908
|
-
closeTag: () => {
|
|
1909
|
-
C = null;
|
|
1910
|
-
}
|
|
1911
|
-
}), u.registerVisitor({
|
|
1912
|
-
from: "selection",
|
|
1913
|
-
to: "selection",
|
|
1914
|
-
openTag: (t) => {
|
|
1915
|
-
if (!C) return;
|
|
1916
|
-
t.copyTo("cell", ee, "activeCell"), t.copyTo("rangeIndex", Yt, "activeCellId");
|
|
1917
|
-
const e = t.getAttribute("activeCell"), s = t.getAttribute("sqref");
|
|
1918
|
-
s && s !== e && (t.getSource().ranges = s.trim().split(/\s+/));
|
|
1919
|
-
}
|
|
1920
|
-
}), u.registerVisitor({
|
|
1921
|
-
from: "pane",
|
|
1922
|
-
to: null,
|
|
1923
|
-
openTag: (t) => {
|
|
1924
|
-
if (!C) return;
|
|
1925
|
-
if ("frozen" === t.getAttribute("state")) {
|
|
1926
|
-
const e = {};
|
|
1927
|
-
C.freezePanes = e, t.copyToObject(e, "topLeft", ee, "topLeftCell");
|
|
1928
|
-
const s = (C.topLeft ? j.fastStringToCell(C.topLeft) : void 0) ?? {
|
|
1929
|
-
colIndex: 0,
|
|
1930
|
-
rowIndex: 0
|
|
1931
|
-
}, o = {
|
|
1932
|
-
colIndex: 0,
|
|
1933
|
-
rowIndex: 0
|
|
1934
|
-
};
|
|
1935
|
-
t.copyToObject(o, "colIndex", Yt, "xSplit"), t.copyToObject(o, "rowIndex", Yt, "ySplit");
|
|
1936
|
-
const i = {
|
|
1937
|
-
colIndex: s.colIndex + o.colIndex,
|
|
1938
|
-
rowIndex: s.rowIndex + o.rowIndex
|
|
1939
|
-
};
|
|
1940
|
-
e.coords = j.cellToString(i);
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
}), u.registerVisitor({
|
|
1944
|
-
from: "tabColor",
|
|
1945
|
-
to: null,
|
|
1946
|
-
openTag: (s) => {
|
|
1947
|
-
const o = e((t) => s.getAttribute(t));
|
|
1948
|
-
o && (t.tabColor = o);
|
|
1949
|
-
}
|
|
1950
|
-
}), u.registerVisitor({
|
|
1951
|
-
from: "pageSetUpPr",
|
|
1952
|
-
to: "pageSetUpPr",
|
|
1953
|
-
openTag: (t) => {}
|
|
1954
|
-
}), u.registerVisitor({
|
|
1955
|
-
from: "outlinePr",
|
|
1956
|
-
to: "outlinePr",
|
|
1957
|
-
openTag: (t) => {}
|
|
1958
|
-
}), u.registerVisitor({
|
|
1959
|
-
from: "pageMargins",
|
|
1960
|
-
to: "pageMargins",
|
|
1961
|
-
openTag: (t) => {
|
|
1962
|
-
t.copyTo("bottom", te), t.copyTo("footer", te), t.copyTo("header", te), t.copyTo("left", te), t.copyTo("right", te), t.copyTo("top", te), t.copyTo("bottom", te);
|
|
1963
|
-
}
|
|
1964
|
-
}), u.registerVisitor({
|
|
1965
|
-
from: "pageSetup",
|
|
1966
|
-
to: "pageSetup",
|
|
1967
|
-
openTag: (t) => {
|
|
1968
|
-
t.copyTo("blackAndWhite", Kt), t.copyTo("cellComments"), t.copyTo("copies", Yt), t.copyTo("draft", Kt), t.copyTo("errors"), t.copyTo("firstPageNumber", Yt), t.copyTo("fitToHeight", Yt), t.copyTo("fitToWidth", Yt), t.copyTo("horizontalDpi", Yt), t.copyTo("orientation"), t.copyTo("pageOrder"), t.copyTo("paperSize", Yt), t.copyTo("scale", Yt), t.copyTo("useFirstPageNumber", Kt), t.copyTo("usePrinterDefaults", Kt), t.copyTo("verticalDpi", Yt);
|
|
1969
|
-
}
|
|
1970
|
-
}), u.registerVisitor({
|
|
1971
|
-
from: "printOptions",
|
|
1972
|
-
to: "printOptions",
|
|
1973
|
-
openTag: (t) => {
|
|
1974
|
-
t.copyTo("gridLines", Kt), t.copyTo("gridLinesSet", Kt), t.copyTo("headings", Kt), t.copyTo("horizontalCentered", Kt), t.copyTo("verticalCentered", Kt);
|
|
1975
|
-
}
|
|
1976
|
-
}), u.registerVisitor({
|
|
1977
|
-
from: "headerFoot",
|
|
1978
|
-
to: "headerFoot",
|
|
1979
|
-
openTag: (t) => {}
|
|
1980
|
-
}), u.registerVisitor({
|
|
1981
|
-
from: "mergeCells",
|
|
1982
|
-
to: "merges",
|
|
1983
|
-
openTag: (t) => {
|
|
1984
|
-
t.setSource([]);
|
|
1985
|
-
}
|
|
1986
|
-
}), u.registerVisitor({
|
|
1987
|
-
from: "dataValidations",
|
|
1988
|
-
to: "validations",
|
|
1989
|
-
openTag: (t) => {
|
|
1990
|
-
t.setSource([]);
|
|
1991
|
-
}
|
|
1992
|
-
});
|
|
1993
|
-
const O = {
|
|
1994
|
-
from: "dataValidation",
|
|
1995
|
-
to: [],
|
|
1996
|
-
openTag: (t) => {
|
|
1997
|
-
let e = t.getAttribute("sqref");
|
|
1998
|
-
e && (e = e.trim().split(/\s+/).join(","));
|
|
1999
|
-
const s = {}, o = {
|
|
2000
|
-
r: e,
|
|
2001
|
-
v: s,
|
|
2002
|
-
rule: {
|
|
2003
|
-
type: t.getAttribute("type") ?? void 0,
|
|
2004
|
-
operator: t.getAttribute("operator") ?? void 0
|
|
2005
|
-
}
|
|
2006
|
-
};
|
|
2007
|
-
!0 === t.getAttribute("showDropDown", Kt) && (s.hideDropdown = !0), t.copyToObject(s, "alert", ee, "error"), t.copyToObject(s, "alertTitle", ee, "errorTitle"), t.copyToObject(s, "showAlertMessage", Kt, "showErrorMessage"), s.alertStyle = t.getAttribute("errorStyle") ?? "stop", t.copyToObject(s, "imeMode"), t.copyToObject(s, "prompt"), t.copyToObject(s, "promptTitle"), t.copyToObject(s, "showPromptMessage", Kt, "showInputMessage"), t.setSource(o);
|
|
2008
|
-
},
|
|
2009
|
-
closeTag: (t) => {
|
|
2010
|
-
const e = t.getSource();
|
|
2011
|
-
if (!e?.rule) return;
|
|
2012
|
-
const s = A(e.rule, a);
|
|
2013
|
-
s && (t.getAttribute("allowBlank", Kt) && (s.includeBlanks = !0), e.v.condition = s), delete e.rule;
|
|
2014
|
-
}
|
|
2015
|
-
};
|
|
2016
|
-
u.registerVisitor(O), u.registerVisitor({
|
|
2017
|
-
from: "formula1",
|
|
2018
|
-
to: {},
|
|
2019
|
-
text: (t, e) => {
|
|
2020
|
-
const s = e.getParent().rule;
|
|
2021
|
-
s?.type && (s.formula1 = E(t, s.type));
|
|
2022
|
-
}
|
|
2023
|
-
}), u.registerVisitor({
|
|
2024
|
-
from: "formula2",
|
|
2025
|
-
to: {},
|
|
2026
|
-
text: (t, e) => {
|
|
2027
|
-
const s = e.getParent().rule;
|
|
2028
|
-
s?.type && (s.formula2 = E(t, s.type));
|
|
2029
|
-
}
|
|
2030
|
-
}), u.registerVisitor({
|
|
2031
|
-
from: "picture",
|
|
2032
|
-
to: "picture",
|
|
2033
|
-
openTag: (t) => {
|
|
2034
|
-
const e = t.getAttribute("r:id");
|
|
2035
|
-
if (!e) return void console.warn("no rId found for picture", t.getPath());
|
|
2036
|
-
const o = s(e, !0);
|
|
2037
|
-
t.getSource().resId = o;
|
|
2038
|
-
}
|
|
2039
|
-
});
|
|
2040
|
-
const D = {
|
|
2041
|
-
from: "slicer",
|
|
2042
|
-
to: {},
|
|
2043
|
-
openTag: (t) => {
|
|
2044
|
-
const e = t.getAttribute("r:id");
|
|
2045
|
-
if (!e) return void console.warn("no rId found for picture", t.getPath());
|
|
2046
|
-
const o = s(e)?.slicers, i = t.getParent();
|
|
2047
|
-
i.slicers || (i.slicers = {});
|
|
2048
|
-
const r = Object.keys(o);
|
|
2049
|
-
for (const t of r) i.slicers[t] = o[t];
|
|
2050
|
-
}
|
|
2051
|
-
};
|
|
2052
|
-
u.registerVisitor(D);
|
|
2053
|
-
const V = (t, e) => ({
|
|
2054
|
-
from: t,
|
|
2055
|
-
to: {},
|
|
2056
|
-
openTag: (t) => {
|
|
2057
|
-
t.setSource("");
|
|
2058
|
-
},
|
|
2059
|
-
text: (t, e) => {
|
|
2060
|
-
e.setSource((e.getSource() ?? "") + t);
|
|
2061
|
-
},
|
|
2062
|
-
closeTag: (t) => {
|
|
2063
|
-
e(String(t.getSource() ?? ""), t);
|
|
2064
|
-
}
|
|
2065
|
-
}), L = /* @__PURE__ */ new Map();
|
|
2066
|
-
L.set("dataValidations", {
|
|
2067
|
-
from: "dataValidations",
|
|
2068
|
-
to: "validations",
|
|
2069
|
-
openTag: (t) => {
|
|
2070
|
-
const e = t.getParent();
|
|
2071
|
-
t.setSource(e.validations ?? []);
|
|
2072
|
-
},
|
|
2073
|
-
closeTag: (t) => {
|
|
2074
|
-
0 === (t.getSource()?.length ?? 0) && t.setSource(void 0);
|
|
2075
|
-
}
|
|
2076
|
-
}), L.set("dataValidation", {
|
|
2077
|
-
...O,
|
|
2078
|
-
closeTag: (t) => {
|
|
2079
|
-
O.closeTag(t);
|
|
2080
|
-
const e = t.getSource();
|
|
2081
|
-
e && !e.r && (t.warn("x14 dataValidation with no xm:sqref was dropped."), t.setSource(void 0));
|
|
2082
|
-
}
|
|
2083
|
-
});
|
|
2084
|
-
const $ = (t) => ({
|
|
2085
|
-
from: t,
|
|
2086
|
-
to: {},
|
|
2087
|
-
openTag: (e) => {
|
|
2088
|
-
e.setSource({
|
|
2089
|
-
rule: e.getParent()?.rule,
|
|
2090
|
-
key: t
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
});
|
|
2094
|
-
L.set("formula1", $("formula1")), L.set("formula2", $("formula2")), L.set("f", V("f", (t, e) => {
|
|
2095
|
-
const s = e.getParent(), o = s?.rule;
|
|
2096
|
-
o && (o[s.key] = E(t, o.type));
|
|
2097
|
-
})), L.set("sqref", V("sqref", (t, e) => {
|
|
2098
|
-
const s = e.getParent(), o = t.trim();
|
|
2099
|
-
s && o && (s.r = o.split(/\s+/).join(","));
|
|
2100
|
-
}));
|
|
2101
|
-
const N = /* @__PURE__ */ new Map(), R = [], B = /* @__PURE__ */ new Map();
|
|
2102
|
-
B.set("conditionalFormattings", {
|
|
2103
|
-
from: "conditionalFormattings",
|
|
2104
|
-
transparent: !0
|
|
2105
|
-
}), B.set("conditionalFormatting", {
|
|
2106
|
-
from: "conditionalFormatting",
|
|
2107
|
-
to: {},
|
|
2108
|
-
openTag: (t) => {
|
|
2109
|
-
t.setSource({ rules: [] });
|
|
2110
|
-
},
|
|
2111
|
-
closeTag: (t) => {
|
|
2112
|
-
const e = t.getSource(), s = e?.rules ?? [];
|
|
2113
|
-
for (let t = 0; t < s.length; t++) {
|
|
2114
|
-
const o = s[t];
|
|
2115
|
-
o.sqref = e.sqref, o.id ? N.set(o.id, o) : R.push(o);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
}), B.set("cfRule", {
|
|
2119
|
-
from: "cfRule",
|
|
2120
|
-
to: {},
|
|
2121
|
-
openTag: (t) => {
|
|
2122
|
-
t.copyTo("id", ee), t.copyTo("type", ee), t.copyTo("priority", Yt), t.copyTo("stopIfTrue", Kt), t.copyTo("operator", ee), t.copyTo("text", ee), t.copyTo("timePeriod", ee), t.copyTo("aboveAverage", Kt), t.copyTo("equalAverage", Kt), t.copyTo("stdDev", Yt), t.copyTo("bottom", Kt), t.copyTo("percent", Kt), t.copyTo("rank", Yt);
|
|
2123
|
-
},
|
|
2124
|
-
closeTag: (t) => {
|
|
2125
|
-
const e = t.getSource();
|
|
2126
|
-
e && t.getParent()?.rules?.push(e);
|
|
2127
|
-
}
|
|
2128
|
-
}), B.set("sqref", V("sqref", (t, e) => {
|
|
2129
|
-
const s = e.getParent(), o = t.trim();
|
|
2130
|
-
s && o && (s.sqref = o);
|
|
2131
|
-
})), B.set("dataBar", {
|
|
2132
|
-
from: "dataBar",
|
|
2133
|
-
to: {},
|
|
2134
|
-
openTag: (t) => {
|
|
2135
|
-
t.copyTo("minLength", Yt), t.copyTo("maxLength", Yt), t.copyTo("gradient", Kt), t.copyTo("border", Kt), t.copyTo("direction", ee), t.copyTo("axisPosition", ee), t.copyTo("negativeBarColorSameAsPositive", Kt), t.copyTo("negativeBarBorderColorSameAsPositive", Kt);
|
|
2136
|
-
},
|
|
2137
|
-
closeTag: (t) => {
|
|
2138
|
-
t.getParent().dataBar = t.getSource();
|
|
2139
|
-
}
|
|
2140
|
-
}), B.set("iconSet", {
|
|
2141
|
-
from: "iconSet",
|
|
2142
|
-
to: {},
|
|
2143
|
-
openTag: (t) => {
|
|
2144
|
-
t.copyTo("iconSet", ee), t.copyTo("custom", Kt), t.copyTo("reverse", Kt), t.copyTo("showValue", Kt);
|
|
2145
|
-
},
|
|
2146
|
-
closeTag: (t) => {
|
|
2147
|
-
t.getParent().iconSet = t.getSource();
|
|
2148
|
-
}
|
|
2149
|
-
});
|
|
2150
|
-
const _ = /* @__PURE__ */ new Map();
|
|
2151
|
-
_.set("f", V("f", (t, e) => {
|
|
2152
|
-
const s = e.getParent();
|
|
2153
|
-
if (!s) return;
|
|
2154
|
-
const o = t.trim(), i = Number(o);
|
|
2155
|
-
s.value = o.length > 0 && Number.isFinite(i) ? i : t;
|
|
2156
|
-
})), B.set("cfvo", {
|
|
2157
|
-
from: "cfvo",
|
|
2158
|
-
to: {},
|
|
2159
|
-
scope: () => _,
|
|
2160
|
-
openTag: (t) => {
|
|
2161
|
-
const e = t.getParent();
|
|
2162
|
-
e.conditions || (e.conditions = []);
|
|
2163
|
-
const s = t.getSource();
|
|
2164
|
-
e.conditions.push(s), t.copyTo("type", ee), !1 === t.getAttribute("gte", Kt) && (s.exclusive = !0);
|
|
2165
|
-
}
|
|
2166
|
-
}), B.set("f", V("f", (t, e) => {
|
|
2167
|
-
const s = e.getParent();
|
|
2168
|
-
s && (s.formulas ??= []).push(t);
|
|
2169
|
-
})), B.set("dxf", {
|
|
2170
|
-
from: "dxf",
|
|
2171
|
-
to: {},
|
|
2172
|
-
raw: !0,
|
|
2173
|
-
closeTag: (t) => {
|
|
2174
|
-
if (!y) return;
|
|
2175
|
-
const e = t.getParent();
|
|
2176
|
-
if (!e) return;
|
|
2177
|
-
const s = y(t.getRawXml() ?? "");
|
|
2178
|
-
s && (e.style = s);
|
|
2179
|
-
}
|
|
2180
|
-
});
|
|
2181
|
-
const z = (t) => ({
|
|
2182
|
-
from: t,
|
|
2183
|
-
to: {},
|
|
2184
|
-
openTag: (s) => {
|
|
2185
|
-
const o = e((t) => s.getAttribute(t));
|
|
2186
|
-
o && (s.getParent()[t] = o);
|
|
2187
|
-
}
|
|
2188
|
-
});
|
|
2189
|
-
B.set("borderColor", z("borderColor")), B.set("negativeFillColor", z("negativeFillColor")), B.set("negativeBorderColor", z("negativeBorderColor")), B.set("axisColor", z("axisColor")), B.set("cfIcon", {
|
|
2190
|
-
from: "cfIcon",
|
|
2191
|
-
to: {},
|
|
2192
|
-
openTag: (t) => {
|
|
2193
|
-
const e = t.getAttribute("iconSet"), s = t.getAttribute("iconId", Yt);
|
|
2194
|
-
if (null === e || null === s) return;
|
|
2195
|
-
const o = t.getParent();
|
|
2196
|
-
o.icons || (o.icons = []), o.icons.push({
|
|
2197
|
-
set: e,
|
|
2198
|
-
id: s
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
});
|
|
2202
|
-
const X = /* @__PURE__ */ new Map();
|
|
2203
|
-
X.set("id", V("id", (t, e) => {
|
|
2204
|
-
const s = e.getParent(), o = t.trim();
|
|
2205
|
-
s && o && (s.x14Id = o);
|
|
2206
|
-
}));
|
|
2207
|
-
const F = /* @__PURE__ */ new Map();
|
|
2208
|
-
F.set("slicerList", {
|
|
2209
|
-
from: "slicerList",
|
|
2210
|
-
transparent: !0
|
|
2211
|
-
}), F.set("slicer", D);
|
|
2212
|
-
const W = /* @__PURE__ */ new Map([
|
|
2213
|
-
[l(g), L],
|
|
2214
|
-
[l(c), B],
|
|
2215
|
-
[l(w), B],
|
|
2216
|
-
[l(S), X],
|
|
2217
|
-
[l(m), F],
|
|
2218
|
-
[l(f), F]
|
|
2219
|
-
]), U = /* @__PURE__ */ new Set();
|
|
2220
|
-
u.registerVisitor({
|
|
2221
|
-
from: "extLst",
|
|
2222
|
-
transparent: !0
|
|
2223
|
-
}), u.registerVisitor({
|
|
2224
|
-
from: "ext",
|
|
2225
|
-
transparent: !0,
|
|
2226
|
-
scope: (t) => {
|
|
2227
|
-
const e = t.getAttribute("uri"), s = l(e), o = W.get(s);
|
|
2228
|
-
if (o) return o;
|
|
2229
|
-
if (!d.has(s) && !U.has(s)) {
|
|
2230
|
-
U.add(s);
|
|
2231
|
-
const o = T[s];
|
|
2232
|
-
t.warn(o ? `Extension content '${o}' (${e}) is not read; it will be lost on resave.` : `Unknown extension content (uri ${e}) is not read; it will be lost on resave.`);
|
|
2233
|
-
}
|
|
2234
|
-
return null;
|
|
2235
|
-
}
|
|
2236
|
-
}), u.registerVisitor({
|
|
2237
|
-
from: "mergeCell",
|
|
2238
|
-
to: [],
|
|
2239
|
-
openTag: (t) => {
|
|
2240
|
-
const e = t.getAttribute("ref");
|
|
2241
|
-
t.setSource(e);
|
|
2242
|
-
}
|
|
2243
|
-
}), u.registerVisitor({
|
|
2244
|
-
from: "hyperlinks",
|
|
2245
|
-
to: "hyperlinks",
|
|
2246
|
-
openTag: (t) => {
|
|
2247
|
-
t.setSource([]);
|
|
2248
|
-
}
|
|
2249
|
-
}), u.registerVisitor({
|
|
2250
|
-
from: "hyperlink",
|
|
2251
|
-
to: [],
|
|
2252
|
-
openTag: (t) => {
|
|
2253
|
-
const e = t.getAttribute("r:id"), o = t.getAttribute("ref");
|
|
2254
|
-
if (!o) return void console.warn("No ref found for hyperlink");
|
|
2255
|
-
t.setKey(o);
|
|
2256
|
-
let i = e ? s(e) : "";
|
|
2257
|
-
if ("string" != typeof i) return void console.warn("Invalid address ", i);
|
|
2258
|
-
i.endsWith("\\") && (i = i.substring(0, i.length - 1));
|
|
2259
|
-
const r = t.getAttribute("location");
|
|
2260
|
-
if (r && (i += "#" + r), !i) return void console.warn("No address found for hyperlink. r:id", e);
|
|
2261
|
-
let n;
|
|
2262
|
-
const a = t.getAttribute("tooltip");
|
|
2263
|
-
n = a ? {
|
|
2264
|
-
address: i,
|
|
2265
|
-
screenTip: a
|
|
2266
|
-
} : i, t.setSource({
|
|
2267
|
-
r: o,
|
|
2268
|
-
v: n
|
|
2269
|
-
});
|
|
2270
|
-
}
|
|
2271
|
-
}), u.registerVisitor({
|
|
2272
|
-
from: "drawing",
|
|
2273
|
-
to: "movables",
|
|
2274
|
-
openTag: (t) => {
|
|
2275
|
-
const e = t.getAttribute("r:id");
|
|
2276
|
-
if (!e) return;
|
|
2277
|
-
const o = s(e);
|
|
2278
|
-
o ? t.setSource(o.movables) : console.warn("no drawing found for rId", e);
|
|
2279
|
-
}
|
|
2280
|
-
}), u.registerVisitor({
|
|
2281
|
-
from: "tableParts",
|
|
2282
|
-
to: "tables",
|
|
2283
|
-
openTag: (t) => {
|
|
2284
|
-
t.setSource([]);
|
|
2285
|
-
}
|
|
2286
|
-
}), u.registerVisitor({
|
|
2287
|
-
from: "tablePart",
|
|
2288
|
-
to: [],
|
|
2289
|
-
openTag: (t) => {
|
|
2290
|
-
const e = t.getAttribute("r:id");
|
|
2291
|
-
if (!e) return;
|
|
2292
|
-
const o = s(e);
|
|
2293
|
-
o ? t.setSource(o) : console.warn("no table found for rId", e);
|
|
2294
|
-
}
|
|
2295
|
-
});
|
|
2296
|
-
const G = (t, e) => {
|
|
2297
|
-
e.conditions?.length && (t.stops = P(e)), void 0 !== e.minLength && (t.minLength = e.minLength), void 0 !== e.maxLength && (t.maxLength = e.maxLength), (e.gradient ?? 1) && (t.gradient = !0), e.border && e.borderColor && (t.borderColor = e.borderColor), !e.negativeBarColorSameAsPositive && e.negativeFillColor && (t.negativeFillColor = e.negativeFillColor), !(e.negativeBarBorderColorSameAsPositive ?? 1) && e.negativeBorderColor && (t.negativeBorderColor = e.negativeBorderColor), e.axisColor && (t.axisColor = e.axisColor), "middle" !== e.axisPosition && "none" !== e.axisPosition || (t.axisPosition = e.axisPosition), "leftToRight" !== e.direction && "rightToLeft" !== e.direction || (t.direction = e.direction);
|
|
2298
|
-
}, Z = (t, e) => {
|
|
2299
|
-
e.conditions?.length && (t.stops = P(e)), e.iconSet && e.iconSet !== t.iconSet && (t.iconSet = e.iconSet), e.icons?.length && (t.icon = e.icons), void 0 !== e.reverse && (t.reverse = e.reverse), void 0 !== e.showValue && (t.showValue = e.showValue);
|
|
2300
|
-
}, J = (t) => {
|
|
2301
|
-
if (!t.sqref) return null;
|
|
2302
|
-
const e = t.sqref.split(/\s+/).join(",");
|
|
2303
|
-
if ("iconSet" === t.type) {
|
|
2304
|
-
if (!t.iconSet) return null;
|
|
2305
|
-
const s = {
|
|
2306
|
-
type: H.ScaleType.IconSet,
|
|
2307
|
-
stops: []
|
|
2308
|
-
};
|
|
2309
|
-
return Z(s, t.iconSet), {
|
|
2310
|
-
r: e,
|
|
2311
|
-
v: { scale: s },
|
|
2312
|
-
priority: t.priority
|
|
2313
|
-
};
|
|
2314
|
-
}
|
|
2315
|
-
const s = b(t, a);
|
|
2316
|
-
if (!s) return null;
|
|
2317
|
-
const o = { condition: s };
|
|
2318
|
-
return t.style && (o.style = t.style), t.stopIfTrue && (o.stopIfTrue = !0), {
|
|
2319
|
-
r: e,
|
|
2320
|
-
v: o,
|
|
2321
|
-
priority: t.priority
|
|
2322
|
-
};
|
|
2323
|
-
};
|
|
2324
|
-
u.registerVisitor({
|
|
2325
|
-
from: "worksheet",
|
|
2326
|
-
to: {},
|
|
2327
|
-
openTag: (t) => {},
|
|
2328
|
-
closeTag: (t) => {
|
|
2329
|
-
const e = t.getSource();
|
|
2330
|
-
let s = e?.conditionals;
|
|
2331
|
-
if (s) for (let t = 0; t < s.length; t++) {
|
|
2332
|
-
const e = s[t], o = e.x14Id;
|
|
2333
|
-
if (!o) continue;
|
|
2334
|
-
delete e.x14Id;
|
|
2335
|
-
const i = N.get(o);
|
|
2336
|
-
if (!i) continue;
|
|
2337
|
-
N.delete(o);
|
|
2338
|
-
const r = e.v?.scale;
|
|
2339
|
-
i.dataBar && r?.type === H.ScaleType.DataBar ? G(r, i.dataBar) : i.iconSet && r?.type === H.ScaleType.IconSet && Z(r, i.iconSet);
|
|
2340
|
-
}
|
|
2341
|
-
const o = [...N.values(), ...R], i = /* @__PURE__ */ new Set();
|
|
2342
|
-
let r = 0;
|
|
2343
|
-
for (let t = 0; t < o.length; t++) {
|
|
2344
|
-
const n = J(o[t]);
|
|
2345
|
-
n ? (s || (s = [], e.conditionals = s), s.push(n)) : (i.add(o[t].type ?? "unknown"), r++);
|
|
2346
|
-
}
|
|
2347
|
-
if (r > 0) {
|
|
2348
|
-
const t = [...i].map((t) => `'${t}'`).join(", ");
|
|
2349
|
-
a?.(1 === r ? `An x14-only conditional formatting rule (type ${t}) is not read and will be lost on resave.` : `${r} x14-only conditional formatting rules (types ${t}) are not read and will be lost on resave.`);
|
|
2350
|
-
}
|
|
2351
|
-
if (s) {
|
|
2352
|
-
s.length > 1 && s.sort((t, e) => (t.priority ?? Infinity) - (e.priority ?? Infinity));
|
|
2353
|
-
for (let t = 0; t < s.length; t++) delete s[t].priority;
|
|
2354
|
-
}
|
|
2355
|
-
}
|
|
2356
|
-
}), u.registerVisitor({
|
|
2357
|
-
from: "customProperties",
|
|
2358
|
-
to: "customProperties",
|
|
2359
|
-
openTag: (t) => {
|
|
2360
|
-
t.setSource([]);
|
|
2361
|
-
},
|
|
2362
|
-
closeTag: (t) => {
|
|
2363
|
-
const e = t.getSource();
|
|
2364
|
-
e.length > 0 && (t.getParent().customProperties = e);
|
|
2365
|
-
}
|
|
2366
|
-
}), u.registerVisitor({
|
|
2367
|
-
from: "customPr",
|
|
2368
|
-
to: {},
|
|
2369
|
-
openTag: (t) => {
|
|
2370
|
-
const e = t.getParent();
|
|
2371
|
-
t.copyTo("name");
|
|
2372
|
-
const o = t.getAttribute("r:id");
|
|
2373
|
-
if (!o) return void console.warn("no rId found for customProperties", t.getPath());
|
|
2374
|
-
const i = s(o, !0), r = t.getSource();
|
|
2375
|
-
r.resId = i, e.push(r);
|
|
2376
|
-
}
|
|
2377
|
-
}), u.registerVisitor({
|
|
2378
|
-
from: "sheetProtection",
|
|
2379
|
-
to: "protection",
|
|
2380
|
-
openTag: (t) => {
|
|
2381
|
-
let e = !1;
|
|
2382
|
-
if (t.hasAttribute("sheet") && Kt(t.getAttribute("sheet")) && (e = !0), !e) return void t.setSource(void 0);
|
|
2383
|
-
const s = (t) => !0 === t || "1" === t || "on" === t || "true" === t || !1 !== t && "0" !== t && "off" !== t && "false" !== t && null;
|
|
2384
|
-
t.copyTo("autoTable", s), t.copyTo("deleteColumns", s), t.copyTo("formatCells", s), t.copyTo("formatColumns", s), t.copyTo("formatRows", s), t.copyTo("insertColumns", s), t.copyTo("insertHyperlinks", s), t.copyTo("insertRows", s), t.copyTo("objects", s), t.copyTo("pivotTables", s), t.copyTo("scenarios", s), t.copyTo("selectLockedCells", s), t.copyTo("selectUnlockedCells", s), t.copyTo("sort", s);
|
|
2385
|
-
const o = {};
|
|
2386
|
-
t.copyToObject(o, "hash", ee, "hashValue"), t.copyToObject(o, "algorithm", ee, "algorithmName"), t.copyToObject(o, "salt", ee, "saltValue"), t.copyToObject(o, "spinCount", Yt), Object.keys(o).length > 0 && (t.getSource().password = o);
|
|
2387
|
-
}
|
|
2388
|
-
}), u.registerVisitor({
|
|
2389
|
-
from: "protectedRanges",
|
|
2390
|
-
to: "protectedRanges",
|
|
2391
|
-
openTag: (t) => {
|
|
2392
|
-
t.setSource([]);
|
|
2393
|
-
}
|
|
2394
|
-
}), u.registerVisitor({
|
|
2395
|
-
from: "protectedRange",
|
|
2396
|
-
to: [],
|
|
2397
|
-
openTag: (t) => {
|
|
2398
|
-
let e = t.getAttribute("sqref");
|
|
2399
|
-
e && (e = e.trim().split(/\s+/).join(","));
|
|
2400
|
-
const s = {}, o = {
|
|
2401
|
-
r: e,
|
|
2402
|
-
v: s
|
|
2403
|
-
};
|
|
2404
|
-
t.copyToObject(s, "name"), t.copyToObject(s, "securityDescriptor");
|
|
2405
|
-
const i = {};
|
|
2406
|
-
t.copyToObject(i, "hash", ee, "hashValue"), t.copyToObject(i, "algorithm", ee, "algorithmName"), t.copyToObject(i, "salt", ee, "saltValue"), t.copyToObject(i, "spinCount", Yt), Object.keys(i).length > 0 && (s.password = i), t.setSource(o);
|
|
2407
|
-
},
|
|
2408
|
-
closeTag: (t) => {
|
|
2409
|
-
const e = t.getSource();
|
|
2410
|
-
e?.r && e.v.name || t.setSource(void 0);
|
|
2411
|
-
}
|
|
2412
|
-
}), u.registerVisitor({
|
|
2413
|
-
from: "sheetFormatPr",
|
|
2414
|
-
to: "sheetFormatPr",
|
|
2415
|
-
openTag: (e) => {
|
|
2416
|
-
e.copyToObject(t, "defaultColSize", te, "defaultColWidth"), e.copyToObject(t, "outlineLevelCol", Yt, "outlineLevelCol");
|
|
2417
|
-
const s = e.getAttribute("customHeight");
|
|
2418
|
-
"1" !== s && "true" !== s || e.copyToObject(t, "defaultRowSize", te, "defaultRowHeight"), e.copyToObject(t, "outlineLevelRow", Yt, "outlineLevelRow");
|
|
2419
|
-
}
|
|
2420
|
-
}), u.registerVisitor({
|
|
2421
|
-
from: "cols",
|
|
2422
|
-
to: "cols",
|
|
2423
|
-
openTag: (t) => {
|
|
2424
|
-
t.setSource([]);
|
|
2425
|
-
}
|
|
2426
|
-
}), u.registerVisitor({
|
|
2427
|
-
from: "col",
|
|
2428
|
-
to: [],
|
|
2429
|
-
openTag: (t) => {
|
|
2430
|
-
const e = t.getSource(), s = t.getAttribute("min"), o = t.getAttribute("max"), i = void 0 === s ? 0 : parseInt(s) - 1, r = void 0 === o ? i : parseInt(o) - 1;
|
|
2431
|
-
e.r = j.runToString(i, r, !0);
|
|
2432
|
-
const n = {};
|
|
2433
|
-
e.v = n, t.copyToObject(n, "sz", te, "width"), t.copyToObject(n, "csz", Kt, "customWidth"), t.copyToObject(n, "h", Kt, "hidden"), t.copyToObject(n, "l", Yt, "outlineLevel"), t.copyToObject(n, "s", Yt, "style");
|
|
2434
|
-
}
|
|
2435
|
-
}), u.registerVisitor({
|
|
2436
|
-
from: "oleObjects",
|
|
2437
|
-
to: null,
|
|
2438
|
-
openTag: (t) => {
|
|
2439
|
-
t.warn("'OLE Objects' are not supported.");
|
|
2440
|
-
}
|
|
2441
|
-
});
|
|
2442
|
-
let Q = !1, K = !1, Y = 0, tt = "";
|
|
2443
|
-
const et = (t) => {
|
|
2444
|
-
const e = t.indexOf(":");
|
|
2445
|
-
return -1 === e ? t : t.slice(e + 1);
|
|
2446
|
-
};
|
|
2447
|
-
return fe(x, t, u.createEventHandler(t, n, a), a, h, {
|
|
2448
|
-
onOpenTag: (t) => {
|
|
2449
|
-
Q = !0;
|
|
2450
|
-
const e = et(t.name);
|
|
2451
|
-
"t" === e || "v" === e ? 0 === Y && (K = !0) : "rPh" !== e && "phoneticPr" !== e || Y++;
|
|
2452
|
-
},
|
|
2453
|
-
onText: (t) => {
|
|
2454
|
-
K && (tt += t);
|
|
2455
|
-
},
|
|
2456
|
-
onCloseTag: (t) => {
|
|
2457
|
-
const e = et(t.name);
|
|
2458
|
-
"t" === e || "v" === e ? K = !1 : "rPh" !== e && "phoneticPr" !== e || Y > 0 && Y--;
|
|
2459
|
-
},
|
|
2460
|
-
onEnd: () => {
|
|
2461
|
-
if (!Q) return;
|
|
2462
|
-
const t = o(v(tt));
|
|
2463
|
-
return Q = !1, K = !1, Y = 0, tt = "", t;
|
|
2464
|
-
},
|
|
2465
|
-
onError: (t) => {}
|
|
2466
|
-
}, p);
|
|
2467
|
-
})(t, (t, e = !1) => gt(t, x, e) ?? null, kt, I, () => {}, (t, e) => {
|
|
2468
|
-
const s = e ? `${e} (${x})` : x;
|
|
2469
|
-
Z.push([t, s]);
|
|
2470
|
-
}, void 0, it), i = await ut.getTextStream(x, ot);
|
|
2471
|
-
if (i) try {
|
|
2472
|
-
await Wt.parseStream(i, o, { xmlns: !1 });
|
|
2473
|
-
} catch (t) {
|
|
2474
|
-
throw console.warn(`Error parsing sheet: '${x}'`, t), new Error(`Error parsing sheet: '${x}'`, { cause: t });
|
|
2475
|
-
}
|
|
2476
|
-
const n = dt(x, u);
|
|
2477
|
-
let a, h = /* @__PURE__ */ new Map();
|
|
2478
|
-
if (n) {
|
|
2479
|
-
const e = "http://schemas.microsoft.com/office/2017/10/relationships/threadedComment";
|
|
2480
|
-
let o;
|
|
2481
|
-
n.forEach((t, s) => {
|
|
2482
|
-
t.type === e && (a = gt(s, x, !1, u)?.comments, a && a.forEach((t) => {
|
|
2483
|
-
const e = t.v;
|
|
2484
|
-
h.set(e.id, t);
|
|
2485
|
-
}));
|
|
2486
|
-
});
|
|
2487
|
-
const i = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments";
|
|
2488
|
-
if (n.forEach((t, e) => {
|
|
2489
|
-
t.type === i && (o = gt(e, x, !1, u));
|
|
2490
|
-
}), o || a) {
|
|
2491
|
-
const e = a ?? [], i = o?.authors, r = o?.comments, n = r ? r.length : 0;
|
|
2492
|
-
if (r) for (let t = 0; t < n; t++) {
|
|
2493
|
-
const o = r[t];
|
|
2494
|
-
if (!o) continue;
|
|
2495
|
-
const n = o.v;
|
|
2496
|
-
let a = i && void 0 !== n.personId ? i[n.personId] : n.personId;
|
|
2497
|
-
if (a && a.startsWith("tc=") && (a = s(a.substring(3)), h.has(a))) continue;
|
|
2498
|
-
const c = xt({ displayName: a }), l = {
|
|
2499
|
-
id: L.uuidV4(),
|
|
2500
|
-
personId: c.id,
|
|
2501
|
-
done: !1,
|
|
2502
|
-
asNote: !0,
|
|
2503
|
-
content: n.content
|
|
2504
|
-
};
|
|
2505
|
-
e.push({
|
|
2506
|
-
r: o.r,
|
|
2507
|
-
v: l
|
|
2508
|
-
});
|
|
2509
|
-
}
|
|
2510
|
-
t.comments = e;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
};
|
|
2514
|
-
ht.push(o());
|
|
2515
|
-
} else if (y.type === n) {
|
|
2516
|
-
const t = o(x, h, ct, at, bt);
|
|
2517
|
-
if (t && 0 !== Object.keys(t).length) {
|
|
2518
|
-
const e = t, s = [];
|
|
2519
|
-
dt(x, u)?.forEach((t) => {
|
|
2520
|
-
"External" === t.targetMode && t.type && t.target && s.push({
|
|
2521
|
-
type: t.type,
|
|
2522
|
-
target: t.target
|
|
2523
|
-
});
|
|
2524
|
-
}), e.identity = s, O = e;
|
|
2525
|
-
} else O = null;
|
|
2526
|
-
} else O = p ? t(x, h, (t, e) => {
|
|
2527
|
-
const s = z.add({ source: { buffer: t } });
|
|
2528
|
-
return s.addReference(Y), st.add(s), K.toResourceId(s);
|
|
2529
|
-
}, bt) : o(x, h, ct, at, bt);
|
|
2530
|
-
}
|
|
2531
|
-
return O;
|
|
2532
|
-
};
|
|
2533
|
-
a("coreprops", C, h, ct, at), a("extprops", C, h, ct, at);
|
|
2534
|
-
const mt = /* @__PURE__ */ new Map(), ft = /* @__PURE__ */ new Map(), Tt = a("people", C, h, ct, at);
|
|
2535
|
-
let yt = null;
|
|
2536
|
-
if (Tt.size > 0 && (yt = Tt.entries().next()?.value?.[1]?.persons, yt)) {
|
|
2537
|
-
const t = yt.length;
|
|
2538
|
-
for (let e = 0; e < t; e++) {
|
|
2539
|
-
const t = yt[e];
|
|
2540
|
-
mt.set(t.id, t), void 0 !== t.displayName && ft.set(t.displayName, t);
|
|
2541
|
-
}
|
|
2542
|
-
}
|
|
2543
|
-
const xt = (t) => {
|
|
2544
|
-
if (!t) return;
|
|
2545
|
-
if (t.id && mt.has(t.id)) return mt.get(t.id);
|
|
2546
|
-
let e = t.displayName;
|
|
2547
|
-
if (!t.id) {
|
|
2548
|
-
if (e) {
|
|
2549
|
-
const t = ft.get(e);
|
|
2550
|
-
if (t) return t;
|
|
2551
|
-
}
|
|
2552
|
-
t.id = L.uuidV4();
|
|
2553
|
-
}
|
|
2554
|
-
const s = mt.get(t.id);
|
|
2555
|
-
if (s) return s;
|
|
2556
|
-
const o = t;
|
|
2557
|
-
return mt.set(t.id, o), e && ft.set(e, o), yt || (yt = []), yt.push(o), o;
|
|
2558
|
-
}, bt = {
|
|
2559
|
-
paramMap: it,
|
|
2560
|
-
getRefs: dt,
|
|
2561
|
-
getRef: gt,
|
|
2562
|
-
parsedRefs: lt,
|
|
2563
|
-
addPerson: xt,
|
|
2564
|
-
serializeElement: pt
|
|
2565
|
-
}, vt = [];
|
|
2566
|
-
if (P) {
|
|
2567
|
-
const t = await ut.getTextStream(P, ot);
|
|
2568
|
-
if (t) {
|
|
2569
|
-
const e = ((t, e) => {
|
|
2570
|
-
let s = !1, o = !1, i = 0, r = "";
|
|
2571
|
-
return {
|
|
2572
|
-
onOpenTag: (t) => {
|
|
2573
|
-
const e = Te(t.name);
|
|
2574
|
-
"t" === e ? s && 0 === i && (o = !0) : "si" === e ? (s = !0, r = "", i = 0) : "rPh" !== e && "phoneticPr" !== e || i++;
|
|
2575
|
-
},
|
|
2576
|
-
onText: (t) => {
|
|
2577
|
-
o && (r += t);
|
|
2578
|
-
},
|
|
2579
|
-
onCloseTag: (e) => {
|
|
2580
|
-
const n = Te(e.name);
|
|
2581
|
-
"t" === n ? o = !1 : "si" === n ? (t(v(r)), s = !1, r = "") : "rPh" !== n && "phoneticPr" !== n || i > 0 && i--;
|
|
2582
|
-
},
|
|
2583
|
-
onError: (t) => {
|
|
2584
|
-
e?.(`Error parsing shared strings: ${t?.message ?? t}`);
|
|
2585
|
-
}
|
|
2586
|
-
};
|
|
2587
|
-
})((t) => {
|
|
2588
|
-
vt.push(t);
|
|
2589
|
-
}, (t) => {
|
|
2590
|
-
Z.push([t, P]);
|
|
2591
|
-
});
|
|
2592
|
-
try {
|
|
2593
|
-
await Wt.parseStream(t, e, { xmlns: !1 });
|
|
2594
|
-
} catch (t) {
|
|
2595
|
-
throw console.warn(`Error parsing shared strings: '${P}'`, t), new Error(`Error parsing shared strings: '${P}'`, { cause: t });
|
|
2596
|
-
}
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
G?.mark("shared-strings");
|
|
2600
|
-
let wt = vt.length;
|
|
2601
|
-
const St = /* @__PURE__ */ new Map();
|
|
2602
|
-
let Ct = wt;
|
|
2603
|
-
const kt = (t) => {
|
|
2604
|
-
const e = St.get(t);
|
|
2605
|
-
if (void 0 !== e) return e;
|
|
2606
|
-
const s = Ct;
|
|
2607
|
-
return St.set(t, Ct++), vt.push(t), s;
|
|
2608
|
-
}, Pt = [];
|
|
2609
|
-
C.slicersCache = Pt;
|
|
2610
|
-
const At = ut.getNames(), Et = At.length;
|
|
2611
|
-
for (let t = 0; t < Et; t++) {
|
|
2612
|
-
const e = At[t];
|
|
2613
|
-
e && e.startsWith("xl/slicerCache") && Pt.push(`/${e}`);
|
|
2614
|
-
}
|
|
2615
|
-
const It = a("slicersCache", C, h, ct, at, bt), Ot = /* @__PURE__ */ new Map();
|
|
2616
|
-
It.forEach((t) => {
|
|
2617
|
-
const e = t.name;
|
|
2618
|
-
delete t.name, Ot.set(e, t);
|
|
2619
|
-
}), it.set("slicerCaches", Ot), a("richstructure", C, h, ct, at, bt), a("richdata", C, h, ct, at, bt);
|
|
2620
|
-
const Dt = a("themes", C, h, ct, at, bt);
|
|
2621
|
-
let Vt = null;
|
|
2622
|
-
if (Dt && Dt.entries) {
|
|
2623
|
-
let t = Dt.entries().next();
|
|
2624
|
-
t?.value?.[1] && (Vt = t.value[1]);
|
|
2625
|
-
}
|
|
2626
|
-
const Lt = new F(Vt);
|
|
2627
|
-
let $t = a("styles", C, h, ct, at, bt).entries().next()?.value?.[1];
|
|
2628
|
-
$t && ($t = JSON.parse(V.JSONStableStringify($t)));
|
|
2629
|
-
const jt = a("workbooks", C, h, ct, at, bt);
|
|
2630
|
-
G?.mark("side-parts-json"), await Promise.all(ht), Q && et > 0 && (Q(tt, tt), await new Promise((t) => setTimeout(t, 0))), G?.mark("sheets");
|
|
2631
|
-
const Nt = {
|
|
2632
|
-
...jt.entries().next().value?.[1],
|
|
2633
|
-
styles: $t,
|
|
2634
|
-
theme: Lt.toJSON()
|
|
2635
|
-
};
|
|
2636
|
-
if (vt.length > 0 && (Nt.strings = vt), yt && yt.length > 0 && (Nt.people = yt), N) {
|
|
2637
|
-
const t = ut.getEntry("xl/vbaProject.bin");
|
|
2638
|
-
if (t) try {
|
|
2639
|
-
const { VBAProject: e } = await import("./CEAmv36xpTNgFwl_.mjs"), s = e.extract(t);
|
|
2640
|
-
s ? (N?.(s), Nt.vba = s) : Z.push(["Unable to parse VBA project.", "xl/vbaProject.bin"]);
|
|
2641
|
-
} catch (t) {
|
|
2642
|
-
Z.push([`Error extracting VBA: ${t?.message ?? t}`, "xl/vbaProject.bin"]);
|
|
2643
|
-
}
|
|
2644
|
-
}
|
|
2645
|
-
let Rt = null;
|
|
2646
|
-
const Bt = {
|
|
2647
|
-
...B,
|
|
2648
|
-
resources: z,
|
|
2649
|
-
json: Nt,
|
|
2650
|
-
formulaTransform: x(() => Rt?.getCalculation())
|
|
2651
|
-
};
|
|
2652
|
-
void 0 === Bt.disableLoadAutoFit && (Bt.disableLoadAutoFit = !1), G?.mark("json-assembled");
|
|
2653
|
-
const Mt = new W(Bt);
|
|
2654
|
-
if (Rt = Mt, G?.mark("workbook-constructed"), rt.length > 0) {
|
|
2655
|
-
await Mt.whenCalculationReady();
|
|
2656
|
-
const t = /* @__PURE__ */ new Map(), e = Nt.sheets ?? [], s = Mt.getSheets().getItems();
|
|
2657
|
-
for (let o = 0; o < e.length; o++) {
|
|
2658
|
-
const i = e[o]?.sheet, r = s[o];
|
|
2659
|
-
i && r && t.set(i, r);
|
|
2660
|
-
}
|
|
2661
|
-
((t, e, s) => {
|
|
2662
|
-
if (0 === e.length) return;
|
|
2663
|
-
const o = t.getCalculation().getFunctions(), i = /* @__PURE__ */ new Map(), r = (t) => {
|
|
2664
|
-
let e = i.get(t);
|
|
2665
|
-
return void 0 === e && (e = null !== o.getByName(t), i.set(t, e)), e;
|
|
2666
|
-
}, n = /* @__PURE__ */ new Map();
|
|
2667
|
-
for (const t of e) {
|
|
2668
|
-
let e = n.get(t.sheet);
|
|
2669
|
-
e || (e = [], n.set(t.sheet, e)), e.push(t);
|
|
2670
|
-
}
|
|
2671
|
-
for (const [t, e] of n) {
|
|
2672
|
-
const o = s.get(t);
|
|
2673
|
-
if (!o) continue;
|
|
2674
|
-
const i = (t, e) => `${t},${e}`, n = /* @__PURE__ */ new Set();
|
|
2675
|
-
for (const t of e) null === t.formula && n.add(i(t.rowIndex, t.colIndex));
|
|
2676
|
-
for (const t of e) {
|
|
2677
|
-
if (null === t.formula) continue;
|
|
2678
|
-
const e = pe(t.formula);
|
|
2679
|
-
let s = !0;
|
|
2680
|
-
for (const t of e) if (!r(t)) {
|
|
2681
|
-
s = !1;
|
|
2682
|
-
break;
|
|
2683
|
-
}
|
|
2684
|
-
if (!s) continue;
|
|
2685
|
-
const a = [], c = [[t.rowIndex, t.colIndex]], l = /* @__PURE__ */ new Set([i(t.rowIndex, t.colIndex)]);
|
|
2686
|
-
for (; c.length > 0;) {
|
|
2687
|
-
const [t, e] = c.pop(), s = [
|
|
2688
|
-
[t + 1, e],
|
|
2689
|
-
[t - 1, e],
|
|
2690
|
-
[t, e + 1],
|
|
2691
|
-
[t, e - 1]
|
|
2692
|
-
];
|
|
2693
|
-
for (const [t, e] of s) {
|
|
2694
|
-
const s = i(t, e);
|
|
2695
|
-
!l.has(s) && n.has(s) && (l.add(s), a.push([t, e]), c.push([t, e]));
|
|
2696
|
-
}
|
|
2697
|
-
}
|
|
2698
|
-
for (const [t, e] of a) n.delete(i(t, e)), o.getRange({
|
|
2699
|
-
rowStart: t,
|
|
2700
|
-
colStart: e,
|
|
2701
|
-
rowEnd: t,
|
|
2702
|
-
colEnd: e
|
|
2703
|
-
}).clear();
|
|
2704
|
-
o.getRange({
|
|
2705
|
-
rowStart: t.rowIndex,
|
|
2706
|
-
colStart: t.colIndex,
|
|
2707
|
-
rowEnd: t.rowIndex,
|
|
2708
|
-
colEnd: t.colIndex
|
|
2709
|
-
}).setValue("=" + t.formula);
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
})(Mt, rt, t);
|
|
2713
|
-
}
|
|
2714
|
-
if (st.forEach((t) => {
|
|
2715
|
-
t.deleteReference(Y);
|
|
2716
|
-
}), K.endPersist(), U) {
|
|
2717
|
-
O(U);
|
|
2718
|
-
const t = /* @__PURE__ */ new Map();
|
|
2719
|
-
let e = 0;
|
|
2720
|
-
for (const s of ut.getNames()) {
|
|
2721
|
-
const o = ut.getEntry(s);
|
|
2722
|
-
if (!o) continue;
|
|
2723
|
-
const i = ut.getRawEntry(s), r = i ? {
|
|
2724
|
-
data: o,
|
|
2725
|
-
uncompressedSize: ut.uncompressedSize(s),
|
|
2726
|
-
raw: {
|
|
2727
|
-
compressedData: i.data,
|
|
2728
|
-
compressionMethod: i.compressionMethod,
|
|
2729
|
-
signature: i.signature
|
|
2730
|
-
}
|
|
2731
|
-
} : {
|
|
2732
|
-
data: o,
|
|
2733
|
-
uncompressedSize: ut.uncompressedSize(s)
|
|
2734
|
-
};
|
|
2735
|
-
t.set(s, r), e += o.byteLength;
|
|
2736
|
-
}
|
|
2737
|
-
if (e > 67108864) Z.push([`Source package too large to retain (${e} bytes, limit ${I}); unmodeled parts will be dropped on save.`, "SourcePackage"]);
|
|
2738
|
-
else if (t.size > 0) {
|
|
2739
|
-
const e = new D(t);
|
|
2740
|
-
y(U, e);
|
|
2741
|
-
let s = Mt.getSheets().getItems();
|
|
2742
|
-
const o = Mt.getTransactions().addListener({ onCommitEnd: (t) => {
|
|
2743
|
-
const s = t.getOperation()?.name;
|
|
2744
|
-
"insertCells" !== s && "deleteCells" !== s || e.markStructuralChange();
|
|
2745
|
-
} }), i = Mt.addListeners({ onSheetsChange: () => {
|
|
2746
|
-
const t = Mt.getSheets().getItems();
|
|
2747
|
-
(t.length !== s.length || t.some((t, e) => t !== s[e])) && e.markStructuralChange(), s = t;
|
|
2748
|
-
} });
|
|
2749
|
-
Mt.addListeners({ onClose: () => {
|
|
2750
|
-
o(), i(), O(U);
|
|
2751
|
-
} });
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
if (Z.length && J?.onWarning) for (const t of Z) {
|
|
2755
|
-
const [e, s] = t;
|
|
2756
|
-
J.onWarning(e, s);
|
|
2757
|
-
}
|
|
2758
|
-
return G && !0 === R && console.table(G.toTable()), Mt;
|
|
2759
|
-
} catch (t) {
|
|
2760
|
-
let e = "Unable to parse XLSX.";
|
|
2761
|
-
throw t instanceof z && (e = "Unable to open XLSX. There are too many rows or columns."), new Error(e, { cause: t });
|
|
2762
|
-
} finally {
|
|
2763
|
-
await ut.close().catch(() => {});
|
|
2764
|
-
}
|
|
2765
|
-
};
|
|
2766
|
-
export { ve as readXLSX };
|