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